Functions to get char information

Results 1 to 20 of 20
  1. #1
    Account Upgraded | Title Enabled! Nick1337 is offline
    MemberRank
    May 2009 Join Date
    357Posts

    Functions to get char information

    PHP Functions for geting character information , can be used for ranking & panels.

    Character Job:
    Spoiler:

    PHP Code:
    function getjob($job)  //  Gets job name
    {
    if (
    $job == '0'){
    return 
    "Vagrant";
    }
    if (
    $job == '1'){
    return 
    "Mercenary";
    }
    if (
    $job == '2'){
    return 
    "Acrobat";
    }
    if (
    $job == '3'){
    return 
    "Assist";
    }
    if (
    $job == '4'){
    return 
    "Magician";
    }
    if (
    $job == '6'){
    return 
    "Knight";
    }
    if (
    $job == '7'){
    return 
    "Blade";
    }
    if (
    $job == '8'){
    return 
    "Jester";
    }
    if (
    $job == '9'){
    return 
    "Ranger";
    }
    if (
    $job == '10'){
    return 
    "Ringmaster";
    }
    if (
    $job == '11'){
    return 
    "Billposter";
    }
    if (
    $job == '12'){
    return 
    "Psykeeper";
    }
    if (
    $job == '13'){
    return 
    "Elementor";
    }
    if (
    $job == '16'){
    return 
    "Master Knight";
    }
    if (
    $job == '17'){
    return 
    "Master Blade";
    }
    if (
    $job == '18'){
    return 
    "Master Jester";
    }
    if (
    $job == '19'){
    return 
    "Master Ranger";
    }
    if (
    $job == '20'){
    return 
    "Master Ringmaster";
    }
    if (
    $job == '21'){
    return 
    "Master Billposter";
    }
    if (
    $job == '22'){
    return 
    "Master Psykeeper";
    }
    if (
    $job == '23'){
    return 
    "Master Elementor";
    }
    if (
    $job == '24'){
    return 
    "Hero Knight";
    }
    if (
    $job == '25'){
    return 
    "Hero Blade";
    }
     if (
    $job == '26'){
    return 
    "Hero Jester";
    }
    if (
    $job == '27'){
    return 
    "Hero Ranger";
    }
    if (
    $job == '28'){
    return 
    "Hero Ringmaster";
    }
    if (
    $job == '29'){
    return 
    "Hero Billposter";
    }
    if (
    $job == '30'){
    return 
    "Hero Psykeeper";
    }
    if (
    $job == '31'){
    return 
    "Hero Elementor";
    }


    Character Location:
    Spoiler:

    PHP Code:
    function getmap($map// Gets location name
    {
    if (
    $map == '1'){
    echo 
    'Madrigal';
    }
    if (
    $map == '2'){
    echo 
    'Azria';
    }
    if (
    $map == '3'){
    echo 
    'Coral Island';
    }
    if (
    $map == '21'){
    echo 
    'Abyss dungeon 1Fl';
    }
    if (
    $map == '22'){
    echo 
    'Abyss dungeon 2Fl';
    }
    if (
    $map == '23'){
    echo 
    'Abyss dungeon 3Fl';
    }
    if (
    $map == '24'){
    echo 
    'Abyss dungeon 4Fl';
    }
    if (
    $map == '25'){
    echo 
    'Abyss dungeon 5Fl';
    }
    if (
    $map == '151'){
    echo 
    'Secret room 0';
    }
    if (
    $map == '152'){
    echo 
    'Secret room 1';
    }
    if (
    $map == '153'){
    echo 
    'Secret room 2';
    }
    if (
    $map == '154'){
    echo 
    'Secret room 3';
    }
    if (
    $map == '155'){
    echo 
    'Secret room 4';
    }
    if (
    $map == '156'){
    echo 
    'Secret room 5';
    }
    if (
    $map == '157'){
    echo 
    'Secret room 6';
    }
    if (
    $map == '158'){
    echo 
    'Secret room 7';
    }
    if (
    $map == '159'){
    echo 
    'Secret room 8';
    }
    if (
    $map == '160'){
    echo 
    'Secret room 9';
    }
    if (
    $map == '161'){
    echo 
    'Secret room 10';
    }
    if (
    $map == '162'){
    echo 
    'Secret room 11';
    }
    if (
    $map == '163'){
    echo 
    'Secret room 12';
    }
    if (
    $map == '164'){
    echo 
    'Secret room 13';
    }
    if (
    $map == '165'){
    echo 
    'Secret room 14';
    }
    if (
    $map == '166'){
    echo 
    'Secret room 15';
    }
    if (
    $map == '167'){
    echo 
    'Secret room 16';
    }
    if (
    $map == '200'){
    echo 
    'Mars Dungeon';
    }
    if (
    $map == '201'){
    echo 
    'Dekane Mine';
    }
    if (
    $map == '202'){
    echo 
    'Guild Siege Territory';
    }
    if (
    $map == '203'){
    echo 
    'Volcanic Island - Volcane Dungeon';
    }
    if (
    $map == '204'){
    echo 
    'Ivillis Temple';
    }
    if (
    $map == '205'){
    echo 
    'Ivillis Temple Boss';
    }
    if (
    $map == '206'){
    echo 
    'Volkane RED';
    }
    if (
    $map == '207'){
    echo 
    'Volkane YELLOW';
    }
    if (
    $map == '208'){
    echo 
    'Arena';
    }
    if (
    $map == '209'){
    echo 
    'House';
    }
    if (
    $map == '211'){
    echo 
    'O/X Quiz zone';
    }
    if (
    $map == '212'){
    echo 
    'Guild House';
    }
    if (
    $map == '213'){
    echo 
    'Guild Hall';
    }
    if (
    $map == '214'){
    echo 
    'Guild Mansion';
    }
    if (
    $map == '210'){
    echo 
    'Boss Monster: Big Muscle';
    }
    if (
    $map == '220'){
    echo 
    'Boss Monster: Krrr';
    }
    if (
    $map == '230'){
    echo 
    'Boss Monster: Mushmoot';
    }
    if (
    $map == '121'){
    echo 
    'Aminus Dungeon';
    }
    if (
    $map == '122'){
    echo 
    'Aminus Dungeon (Hero)';
    }
    if (
    $map == '123'){
    echo 
    'Catacombs of Anguish';
    }
    if (
    $map == '124'){
    echo 
    'The Wilds';
    }
    if (
    $map == '125'){
    echo 
    'The Savage Wilds';
    }


    Character Gender
    Spoiler:

    PHP Code:
    function getgender($gender// Gets player gender
    {
    if(
    $gender == '0')
    {
    return 
    "Male";
    }
    if(
    $gender == '1')
    {
    return 
    "Female";
    }



    Character Access Level
    Spoiler:

    PHP Code:
    function getaccess($access// Gets player access level 
    {
    if(
    $access == 'F')
    {
    return 
    "Member";
    }
    if(
    $access == 'Z')
    {
    return 
    "Game Master";
    }



    Character Master/Hero tag
    Spoiler:

    Master:
    PHP Code:
    function master($lvl// Gets Master tag
    {
    if(
    $lvl >= '60' && $lvl <= '120')
    {
    return 
    "[MASTER]";

    PHP Code:
    if($var['m_nJob'] >= '16' && $var['m_nJob'] <= '23')
                {
                
    $lvl $var['m_nLevel'].' '.master($var['m_nLevel']);
                } 
    Hero:
    PHP Code:
    function hero($lvl// Gets Hero tag
    {
    if(
    $lvl >= '121' && $lvl <= '200')
    {
    return 
    "[HERO]";
    }

    PHP Code:
    if($var['m_nJob'] >= '24' && $var['m_nJob'] <= '31')
                {
                
    $lvl =  $var['m_nLevel'].' '.hero($var['m_nLevel']);
                } 


  2. #2
    PENTAKILL Scratch is offline
    MemberRank
    Oct 2008 Join Date
    LiverpoolLocation
    3,172Posts

    Re: Functions to get char information

    greatwork but

    the access lvl Z its ok?

    its not

    S
    P
    O
    F
    the access levels?

  3. #3
    Alpha Member Masius is offline
    MemberRank
    Dec 2007 Join Date
    1,580Posts

    Re: Functions to get char information

    Too many if's bro. l2switch

    Character job:
    Spoiler:


    function getJob($job) {
    switch($job) {
    case 0:
    $job = "Vagrant";
    break;
    case 1:
    $job = "Mercenary";
    break;
    case 2:
    $job = "Acrobat";
    break;
    case 3:
    $job = "Assist";
    break;
    case 4:
    $job = "Magician";
    break;
    case 6:
    $job = "Knight";
    break;
    case 7:
    $job = "Blade";
    break;
    case 8:
    $job = "Jester";
    break;
    case 9:
    $job = "Ranger";
    break;
    case 10:
    $job = "Ringmaster";
    break;
    case 11:
    $job = "Billposter";
    break;
    case 12:
    $job = "Psykeeper";
    break;
    case 13:
    $job = "Elementor";
    break;
    }
    return $job;
    }


    too lazy to make it for the rest of the classes (Master&Hero), but by using switch the code looks smoother, tbh. Too many if's annoy me, but I used to do it like that.

  4. #4
    Account Upgraded | Title Enabled! Nick1337 is offline
    MemberRank
    May 2009 Join Date
    357Posts

    Re: Functions to get char information

    Quote Originally Posted by Sparkly View Post
    Too many if's bro. l2switch

    Character job:
    Spoiler:


    function getJob($job) {
    switch($job) {
    case 0:
    $job = "Vagrant";
    break;
    case 1:
    $job = "Mercenary";
    break;
    case 2:
    $job = "Acrobat";
    break;
    case 3:
    $job = "Assist";
    break;
    case 4:
    $job = "Magician";
    break;
    case 6:
    $job = "Knight";
    break;
    case 7:
    $job = "Blade";
    break;
    case 8:
    $job = "Jester";
    break;
    case 9:
    $job = "Ranger";
    break;
    case 10:
    $job = "Ringmaster";
    break;
    case 11:
    $job = "Billposter";
    break;
    case 12:
    $job = "Psykeeper";
    break;
    case 13:
    $job = "Elementor";
    break;
    }
    return $job;
    }


    too lazy to make it for the rest of the classes (Master&Hero), but by using switch the code looks smoother, tbh. Too many if's annoy me, but I used to do it like that.
    Heh ^^ , im stilll learning ;3 thanks for the advice

  5. #5
    Alpha Member Masius is offline
    MemberRank
    Dec 2007 Join Date
    1,580Posts

    Re: Functions to get char information

    another way of doing it, through arrays: (less code lines, same effect, code is tidier):
    Spoiler:

    function getJob($job) {

    $jobIDarray = array("0","1","2","3","4","6","7","8","9","10","11","12","13");
    $jobNAMEarray = array ("Vagrant","Mercenary","Acrobat","Assist","Magician","Knight","Blade","Jester","Ranger","Ringmaster","Billposter","Psykeeper","Elementor");

    $job = str_replace($jobIDarray, $jobNAMEarray, $job);

    return $job;
    }

  6. #6
    Account Upgraded | Title Enabled! Nick1337 is offline
    MemberRank
    May 2009 Join Date
    357Posts

    Re: Functions to get char information

    Quote Originally Posted by Rejected View Post
    greatwork but

    the access lvl Z its ok?

    its not

    S
    P
    O
    F
    the access levels?
    PHP Code:
    function getaccess($access// Gets player access level 
    {
    if(
    $access == 'F')
    {
    return 
    "Member";
    }
    if(
    $access == 'Z' || 'S' || 'P' || 'O' )
    {
    return 
    "Game Master";
    }

    than do this ;o

  7. #7
    Valued Member Awesome© is offline
    MemberRank
    Jun 2010 Join Date
    127.0.0.1Location
    143Posts

    Re: Functions to get char information

    Might be useful.
    ~thanked!

  8. #8
    Banned aldieri is offline
    BannedRank
    Oct 2008 Join Date
    ArizonaLocation
    250Posts

    Re: Functions to get char information

    Quote Originally Posted by Sparkly View Post
    another way of doing it, through arrays: (less code lines, same effect, code is tidier):
    Spoiler:

    function getJob($job) {

    $jobIDarray = array("0","1","2","3","4","6","7","8","9","10","11","12","13");
    $jobNAMEarray = array ("Vagrant","Mercenary","Acrobat","Assist","Magician","Knight","Blade","Jester","Ranger","Ringmaster","Billposter","Psykeeper","Elementor");

    $job = str_replace($jobIDarray, $jobNAMEarray, $job);

    return $job;
    }
    You'll have to reverse both orders though or on the double digit jobs you will get both jobs, aka for '13' youd get job 1 and job 3, aka instead of Elementor you would get MercenaryAssist.

  9. #9
    Enthusiast TyRoXx is offline
    MemberRank
    Oct 2008 Join Date
    GermanyLocation
    37Posts

    Re: Functions to get char information

    Why don't you learn PHP before posting stupid things?
    PHP Code:
    function getJobName($id//getJob does not say anything about what the function does
    {
        
    $names = array("Vagrant","Mercenary","Acrobat","Assist""Magician","Knight","Blade""Jester","Ranger","Ringmaster" ,"Billposter","Psykeeper","Elementor");
        return 
    $names[$id];


  10. #10
    Account Upgraded | Title Enabled! Nick1337 is offline
    MemberRank
    May 2009 Join Date
    357Posts

    Re: Functions to get char information

    Quote Originally Posted by aldieri View Post
    You'll have to reverse both orders though or on the double digit jobs you will get both jobs, aka for '13' youd get job 1 and job 3, aka instead of Elementor you would get MercenaryAssist.
    Thats why i never use arrays :o
    Thanks for explaining btw. :)

    Edit:
    Quote Originally Posted by TyRoXx View Post
    Why don't you learn PHP before posting stupid things?
    PHP Code:
    function getJobName($id//getJob does not say anything about what the function does
    {
        
    $names = array("Vagrant","Mercenary","Acrobat","Assist""Magician","Knight","Blade""Jester","Ranger","Ringmaster" ,"Billposter","Psykeeper","Elementor");
        return 
    $names[$id];

    That was just a name for the function...
    Thanks for the honesty -_-
    Last edited by Nick1337; 13-06-10 at 10:48 PM.

  11. #11
    Not working on UnitedFlyf Mootie is offline
    MemberRank
    Apr 2009 Join Date
    1,589Posts

    Re: Functions to get char information

    Quote Originally Posted by TyRoXx View Post
    Why don't you learn PHP before posting stupid things?
    PHP Code:
    function getJobName($id//getJob does not say anything about what the function does
    {
        
    $names = array("Vagrant","Mercenary","Acrobat","Assist""Magician","Knight","Blade""Jester","Ranger","Ringmaster" ,"Billposter","Psykeeper","Elementor");
        return 
    $names[$id];

    Nice job. Don't forget the Master/Hero jobs.

  12. #12
    Apprentice D4rkn3t is offline
    MemberRank
    Jun 2010 Join Date
    9Posts

    Re: Functions to get char information

    good job man

  13. #13
    Account Upgraded | Title Enabled! Nick1337 is offline
    MemberRank
    May 2009 Join Date
    357Posts

    Re: Functions to get char information

    Quote Originally Posted by D4rkn3t View Post
    good job man
    Thanks :)

  14. #14
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Re: Functions to get char information

    Nice job.

    PS: My Adapter is back online! I'm online again. ;>

  15. #15
    We are Maverick! Dell Honne is offline
    MemberRank
    Feb 2009 Join Date
    ON, CanadaLocation
    3,271Posts

    Re: Functions to get char information

    Quote Originally Posted by apixen View Post
    Nice job.

    PS: My Adapter is back online! I'm online again. ;>
    Oh great.

    on topic: Wow that is a lot of code. I can't imagine all the copy pasta going on here :P

  16. #16
    Banned aldieri is offline
    BannedRank
    Oct 2008 Join Date
    ArizonaLocation
    250Posts

    Re: Functions to get char information

    Quote Originally Posted by Dell Honne View Post
    Oh great.

    on topic: Wow that is a lot of code. I can't imagine all the copy pasta going on here :P
    Just a little smaller version of his code.
    Spoiler:

    function getJob($job) {

    $jobIDarray = array("31","30","29","28","27","26","25","24","23","22","21","20","19","18","17","16","13","12","11","10","9","8","7","6","4","3","2","1","0");
    $jobNAMEarray = array("Hero Elementor","Hero Psykeeper","Hero Billposter","Hero Ringmaster","Hero Ranger","Hero Jester","Hero Blade","Hero Knight","Master Elementor","Master Psykeeper","Master Billposter","Master Ringmaster","Master Ranger","Master Jester","Master Blade","Master Knight","Master Elementor","Psykeeper","Billposter","Ringmaster","Ranger","Jester","Blade","Knight","Magician","Assist","Acrobat","Mercenary","Vagrant");

    $job = str_replace($jobIDarray, $jobNAMEarray, $job);

    return $job;
    }

  17. #17
    Account Upgraded | Title Enabled! Imortal is offline
    MemberRank
    Aug 2006 Join Date
    EverywhereLocation
    293Posts

    Re: Functions to get char information

    Quote Originally Posted by TyRoXx View Post
    Why don't you learn PHP before posting stupid things?
    PHP Code:
    function getJobName($id//getJob does not say anything about what the function does
    {
        
    $names = array("Vagrant","Mercenary","Acrobat","Assist""Magician","Knight","Blade""Jester","Ranger","Ringmaster" ,"Billposter","Psykeeper","Elementor");
        return 
    $names[$id];

    Right back at you, You're missing the 3 classes that aren't used. using this if you try to get any of the jobs passed the puppeteer class it's going to be one class off. and then after doppler/gatekeeper it will be even further off.

  18. #18
    Apprentice antskiiiiXX is offline
    MemberRank
    Jun 2009 Join Date
    6Posts

    Re: Functions to get char information

    Great job man very helpful <:

  19. #19
    Alpha Member Masius is offline
    MemberRank
    Dec 2007 Join Date
    1,580Posts

    Re: Functions to get char information

    Quote Originally Posted by aldieri View Post
    Just a little smaller version of his code.
    Spoiler:

    function getJob($job) {

    $jobIDarray = array("31","30","29","28","27","26","25","24","23","22","21","20","19","18","17","16","13","12","11","10","9","8","7","6","4","3","2","1","0");
    $jobNAMEarray = array("Hero Elementor","Hero Psykeeper","Hero Billposter","Hero Ringmaster","Hero Ranger","Hero Jester","Hero Blade","Hero Knight","Master Elementor","Master Psykeeper","Master Billposter","Master Ringmaster","Master Ranger","Master Jester","Master Blade","Master Knight","Master Elementor","Psykeeper","Billposter","Ringmaster","Ranger","Jester","Blade","Knight","Magician","Assist","Acrobat","Mercenary","Vagrant");

    $job = str_replace($jobIDarray, $jobNAMEarray, $job);

    return $job;
    }
    errr, why did you just copy paste the code I had posted before with only a few more jobs added? ...............

  20. #20
    Member mikmeg is offline
    MemberRank
    Dec 2009 Join Date
    57Posts

    Re: Functions to get char information

    another one versione:

    function getJob($job)
    {
    $aJob = array(
    0 => 'Vagrant',
    1 => 'Mercenary',
    2 => 'Acrobat',
    3 => 'Assist',
    4 => 'Magician',
    5 => 'Puppeter',
    6 => 'Knight',
    7 => 'Blade',
    8 => 'Jester',
    9 => 'Ranger',
    10 => 'Ringmaster',
    11 => 'Billposter',
    12 => 'Psykeeper',
    13 => 'Elementor',
    14 => 'Gatekeeper',
    15 => 'Doppler',
    16 => 'Master Knight',
    17 => 'Master Blade',
    18 => 'Master Jester',
    19 => 'Master Ranger',
    20 => 'Master Ringmaster',
    21 => 'Master Billposter',
    22 => 'Master Psykeeper',
    23 => 'Master Elementor',
    24 => 'Hero Knight',
    25 => 'Hero Blade',
    26 => 'Hero Jester',
    27 => 'Hero Ranger',
    28 => 'Hero Ringmaster',
    29 => 'Hero Billposter',
    30 => 'Hero Psykeeper',
    31 => 'Hero Elementor'
    );

    return $aJob[$job];
    }
    Last edited by mikmeg; 17-06-10 at 11:22 PM.



Advertisement