[HELP] /class not working?

This forum is for main questions (format files, STB / STL and so on).

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Forum rules
Client Editing is a delicate subject. osRose and osiRose will not support or use any Client Editing tool or results as a standard. So you are free to experiment, test, and develop there on Client Editing, but at your own risk :)

[HELP] /class not working?

Postby ikill1 on Mon Sep 30, 2019 10:01 am

i'm using animalcrackerz source code but /class is not working for normal players, but working on GMs, what is the possible problem?

Heres the code

  1. bool CWorldServer::pakGMClass( CPlayer* thisclient, char* classid )
  2. {
  3.     int classid_new = thisclient->CharInfo->Job;
  4.  
  5.     if ( strcmp ( classid , "Visitor" ) == 0 || strcmp ( classid , "visitor" ) == 0)
  6.     {
  7.             //classid_new = 0;
  8.     }
  9.     else if ( strcmp ( classid , "Soldier" ) == 0 || strcmp ( classid , "soldier" ) == 0)
  10.     {
  11.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor
  12.              classid_new = 111;
  13.     }
  14.     else if ( strcmp ( classid , "Knight" ) == 0 || strcmp ( classid , "knight" ) == 0)
  15.     {
  16.         if ((thisclient->Stats->Level >= 100) && (classid_new == 111))  // solder
  17.              classid_new = 121;
  18.     }
  19.     else if ( strcmp ( classid , "Champion" ) == 0 || strcmp ( classid , "champion" ) == 0)
  20.     {
  21.         if ((thisclient->Stats->Level >= 100) && (classid_new == 111))  // solder
  22.                 classid_new = 122;
  23.     }
  24.     else if ( strcmp ( classid , "Muse" ) == 0 || strcmp ( classid , "muse" ) == 0)
  25.     {
  26.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor
  27.                 classid_new = 211;
  28.     }
  29.     else if ( strcmp ( classid , "Mage" ) == 0 || strcmp ( classid , "mage" ) == 0)
  30.     {
  31.         if  ((thisclient->Stats->Level >= 100) && (classid_new == 211))  // muse
  32.                 classid_new = 221;
  33.     }
  34.     else if ( strcmp ( classid , "Cleric" ) == 0 || strcmp ( classid , "cleric" ) == 0)
  35.     {
  36.         if ((thisclient->Stats->Level >= 100) && (classid_new == 211)) // muse
  37.                 classid_new = 222;
  38.     }
  39.     else if ( strcmp ( classid , "Hawker" ) == 0 || strcmp ( classid , "hawker" ) == 0)
  40.     {
  41.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor
  42.                 classid_new = 311;
  43.     }
  44.     else if ( strcmp ( classid , "Raider" ) == 0 || strcmp ( classid , "raider" ) == 0)
  45.     {
  46.         if ((thisclient->Stats->Level >= 100) && (classid_new == 311))  // hawker
  47.                 classid_new = 321;
  48.     }
  49.     else if ( strcmp ( classid , "Scout" ) == 0 || strcmp ( classid , "scout" ) == 0)
  50.     {
  51.         if ((thisclient->Stats->Level >= 100) && (classid_new == 311))  // hawker
  52.                 classid_new = 322;
  53.     }
  54.     else if ( strcmp ( classid , "Dealer" ) == 0 || strcmp ( classid , "dealer" ) == 0)
  55.     {
  56.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor
  57.                classid_new = 411;
  58.     }
  59.     else if ( strcmp ( classid , "Bourgeois" ) == 0 || strcmp ( classid , "bourgeois" ) == 0)
  60.     {
  61.         if ((thisclient->Stats->Level >= 100) && (classid_new == 411))  // dealer
  62.                 classid_new = 421;
  63.     }
  64.     else if ( strcmp ( classid , "Artisan" ) == 0 || strcmp ( classid , "artisan" ) == 0)
  65.     {
  66.         if ((thisclient->Stats->Level >= 100) && (classid_new == 411))  // dealer
  67.                 classid_new = 422;
  68.     }
  69.     else
  70.     {
  71.         return true;
  72.     }
  73.     bool changed = true;
  74.     if ( thisclient->CharInfo->Job == classid_new )
  75.         SendPM(thisclient, "Class has not been changed! %s",classid );
  76.         changed = false;
  77.     //thisclient->CharInfo->Job = classid_new;
  78.     BEGINPACKET(pak, 0x0721);
  79.     ADDWORD(pak,4);
  80.     ADDWORD(pak, thisclient->CharInfo->Job);
  81.     ADDWORD(pak,0);
  82.     thisclient->client->SendPacket(&pak);
  83.     RESETPACKET(pak, 0x0730);
  84.     ADDWORD    ( pak, 5 );
  85.     ADDDWORD   ( pak, 0 );
  86.     ADDWORD    ( pak, 0xa24d );
  87.     ADDWORD    ( pak, 0x40b3 );
  88.     thisclient->client->SendPacket(&pak);
  89.  
  90.     if (changed)
  91.     {
  92.             thisclient->saveskills();
  93.             thisclient->ResetSkillOffset();
  94.             SendPM(thisclient, "Class changed! Relog to remove your previous skills." );
  95.     }
  96.     else
  97.     {
  98.             if ( thisclient->Stats->Level < 10 )
  99.                 SendPM(thisclient, "Class change failed! You must be at least lvl 10 to change your job." );
  100.             else if (classid_new == 0) // visitor
  101.                 SendPM(thisclient, "Class change failed! Pick a first job, muse, dealer, hawker, or solder" );
  102.             else
  103.                 SendPM(thisclient, "Class change failed!" );
  104.     }
  105.     return true;
  106. }
Last edited by ikill1 on Mon Sep 30, 2019 10:56 am, edited 1 time in total.
ikill1
Jelly Bean
Jelly Bean
 
Posts: 17
Joined: Wed Sep 28, 2016 9:27 am

Re: [HELP] /class not working?

Postby lazypenguin on Mon Sep 30, 2019 10:17 am

When posting code it is much more readable if you wrap the code with code tags like so:
  1. [code]put your code in here[/code]
.

In this case, I would double check where `pakGMClass` is being called from as there's a good chance that it is being filtered by access level before this function is called. See `CWorldServer::pakGMCommand` in `gmcmds.cpp`

For example, this is source code from the roseza server:

  1.  
  2.    else if (strcmp(command, "class")==0)
  3.     {
  4.         if(Config.Command_Class > thisclient->Session->accesslevel)
  5.            return true;
  6.         if ((tmp = strtok(NULL, " "))==NULL)
  7.             return true;
  8.         char* classid=(char*)tmp;
  9.         return pakGMClass( thisclient, classid );
  10.     }
  11.  


So we can see that the command can only be executed if the player has an accesslevel higher than the Command_Class value in the configuration. The default level for the `/class` command is 299 but the value will be overridden by whatever value you store in your `commands.ini` file. To change this, you can simply update your `commands.ini` file to a lower valueor update your player's access level to higher than 299 (or whatever you have it set to in `commands.ini`).

Best of luck!
lazypenguin
Pomic
Pomic
 
Posts: 78
Joined: Mon Aug 10, 2009 6:51 am

Re: [HELP] /class not working?

Postby ikill1 on Mon Sep 30, 2019 10:50 am

oh sorry. kinda new here xD

Here?

  1. else if (strcmp(command, "class")==0)
  2.     {
  3.         if(Config.Command_Class > thisclient->Session->accesslevel)
  4.            return true;
  5.         if ((tmp = strtok(NULL, " "))==NULL)return true;
  6.         char* classid=(char*)tmp;
  7.         return pakGMClass( thisclient, classid );

}
ikill1
Jelly Bean
Jelly Bean
 
Posts: 17
Joined: Wed Sep 28, 2016 9:27 am

Re: [HELP] /class not working?

Postby lazypenguin on Mon Sep 30, 2019 11:18 am

Your options are:

1) Change the code you quoted above to not check access level
2) Open `commands.ini` next to your server exe's and change the line: `Class=299` to a value that makes sense for you.
3) Edit the player's accesslevel in the database to higher than 299


I'd recommend just editing the player's accesslevel value in the database to 299 or higher. Be aware that this might give them access to other commands as well.
lazypenguin
Pomic
Pomic
 
Posts: 78
Joined: Mon Aug 10, 2009 6:51 am

Re: [HELP] /class not working?

Postby PurpleYouko on Mon Sep 30, 2019 3:31 pm

Some config values are also defined in the database table "list_config"
I don't remember seeing "Config.Command_Class" defined in there but it might be worth checking it.

Easiest thing to do though would be comment out the conditional that checks the config requirements then re-compile
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: [HELP] /class not working?

Postby ikill1 on Mon Sep 30, 2019 3:36 pm

Thank you, guys! i just change the access level on command.ini and it works!
ikill1
Jelly Bean
Jelly Bean
 
Posts: 17
Joined: Wed Sep 28, 2016 9:27 am


Return to Client Editing Question Zone

Who is online

Users browsing this forum: No registered users and 6 guests

cron