Prevent Multiclassing, enforce class tree

If you want to help us or give some corrections / codes, put it here ;)

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

Prevent Multiclassing, enforce class tree

Postby monkeyrose on Tue Sep 04, 2007 11:07 am

In GmCmds.cpp, prevents user from using the /class command to change classes without being the proper prerequisite class.

Prevents going back to visitor, or else they could multiclass.

  1.  
  2. bool CWorldServer::pakGMClass( CPlayer* thisclient, char* classid )
  3. {
  4.     int classid_new = thisclient->CharInfo->Job;
  5.  
  6.     if ( strcmp ( classid , "Visitor" ) == 0 || strcmp ( classid , "visitor" ) == 0)
  7.     {
  8.         // classid_new = 0;
  9.     }
  10.     else if ( strcmp ( classid , "Soldier" ) == 0 || strcmp ( classid , "soldier" ) == 0)
  11.     {
  12.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor
  13.              classid_new = 111;
  14.     }
  15.     else if ( strcmp ( classid , "Knight" ) == 0 || strcmp ( classid , "knight" ) == 0)
  16.     {
  17.         if ((thisclient->Stats->Level >= 100) && (classid_new == 111))  // solder
  18.              classid_new = 121;
  19.     }
  20.     else if ( strcmp ( classid , "Champion" ) == 0 || strcmp ( classid , "champion" ) == 0)
  21.     {
  22.         if ((thisclient->Stats->Level >= 100) && (classid_new == 111))  // solder
  23.                 classid_new = 122;
  24.     }
  25.     else if ( strcmp ( classid , "Muse" ) == 0 || strcmp ( classid , "muse" ) == 0)
  26.     {
  27.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor
  28.                 classid_new = 211;
  29.     }
  30.     else if ( strcmp ( classid , "Mage" ) == 0 || strcmp ( classid , "mage" ) == 0)
  31.     {
  32.         if ((thisclient->Stats->Level >= 100) && (classid_new == 211))  // muse
  33.                 classid_new = 221;
  34.     }
  35.     else if ( strcmp ( classid , "Cleric" ) == 0 || strcmp ( classid , "cleric" ) == 0)
  36.     {
  37.         if ((thisclient->Stats->Level >= 100) && (classid_new == 211))  // muse
  38.                 classid_new = 222;
  39.     }
  40.     else if ( strcmp ( classid , "Hawker" ) == 0 || strcmp ( classid , "hawker" ) == 0)
  41.     {
  42.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor
  43.                 classid_new = 311;
  44.     }
  45.     else if ( strcmp ( classid , "Raider" ) == 0 || strcmp ( classid , "raider" ) == 0)
  46.     {
  47.         if ((thisclient->Stats->Level >= 100) && (classid_new == 311))  // hawker
  48.                 classid_new = 321;
  49.     }
  50.     else if ( strcmp ( classid , "Scout" ) == 0 || strcmp ( classid , "scout" ) == 0)
  51.     {
  52.         if ((thisclient->Stats->Level >= 100) && (classid_new == 311))  // hawker
  53.                 classid_new = 322;
  54.     }
  55.     else if ( strcmp ( classid , "Dealer" ) == 0 || strcmp ( classid , "dealer" ) == 0)
  56.     {
  57.          if ((thisclient->Stats->Level >= 10) && (classid_new == 0 )) // visitor        
  58.                classid_new = 411;
  59.     }
  60.     else if ( strcmp ( classid , "Bourgeois" ) == 0 || strcmp ( classid , "bourgeois" ) == 0)
  61.     {
  62.         if ((thisclient->Stats->Level >= 100) && (classid_new == 411))  // dealer
  63.                 classid_new = 421;
  64.     }
  65.     else if ( strcmp ( classid , "Artisan" ) == 0 || strcmp ( classid , "artisan" ) == 0)
  66.     {
  67.         if ((thisclient->Stats->Level >= 100) && (classid_new == 411))  // dealer
  68.                 classid_new = 422;
  69.     }    
  70.     else
  71.     {
  72.         return true;
  73.     }
  74.     bool changed = true;
  75.     if ( thisclient->CharInfo->Job == classid_new )
  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.     ADDWORD(pak, 0xa24d);
  86.     ADDWORD(pak, 0x40b3);
  87.     thisclient->client->SendPacket(&pak);
  88.    
  89.     if ( changed )
  90.     {
  91.        SendPM(thisclient, "Class changed!" );
  92.     }
  93.     else
  94.     {
  95.        if ( thisclient->Stats->Level < 10 )
  96.           SendPM(thisclient, "Class change failed! You must be at least lvl 10 to change your job." );
  97.        else if (classid_new == 0) // visitor
  98.           SendPM(thisclient, "Class change failed! Pick a first job, muse, dealer, hawker, or solder" );
  99.        else  
  100.           SendPM(thisclient, "Class change failed!" );        
  101.     }
  102.      
  103.     return true;
  104. }
  105.  
monkeyrose
Smoulie
Smoulie
 
Posts: 58
Joined: Thu Aug 09, 2007 2:44 pm

Re: Prevent Multiclassing, enforce class tree

Postby john0114 on Tue Sep 04, 2007 7:19 pm

will this prevent any change in class. ie: champ into a knight, or champ into a raider, or even maybe having a function that will only allow users to change class once.
john0114
Smoulie
Smoulie
 
Posts: 69
Joined: Tue Aug 21, 2007 8:40 am

Re: Prevent Multiclassing, enforce class tree

Postby monkeyrose on Tue Sep 04, 2007 7:59 pm

This would allow a solder to go to a champ or a knight, but would disallow a knight to become a champ.

The idea is to prevent somebody from getting skills from multiple classes. Like get Cleric Buffs and then Mage AOEs.
monkeyrose
Smoulie
Smoulie
 
Posts: 58
Joined: Thu Aug 09, 2007 2:44 pm

Re: Prevent Multiclassing, enforce class tree

Postby Poseidon on Wed Sep 05, 2007 2:01 am

Note: This is only to those who are giving the class command to players.
User avatar
Poseidon
Moderator
Moderator
 
Posts: 302
Joined: Thu Aug 09, 2007 5:02 am

Re: Prevent Multiclassing, enforce class tree

Postby john0114 on Wed Sep 05, 2007 6:27 am

excellent!
john0114
Smoulie
Smoulie
 
Posts: 69
Joined: Tue Aug 21, 2007 8:40 am

Re: Prevent Multiclassing, enforce class tree

Postby monkeyrose on Thu Sep 06, 2007 11:14 am

Poseidon wrote:Note: This is only to those who are giving the class command to players.


Thats a good point. Perhaps I should add a snippet to allow multiclassing for any player with an accesslevel of 300. Normal players couldn't, but it would allow GMs/admins to change class.
monkeyrose
Smoulie
Smoulie
 
Posts: 58
Joined: Thu Aug 09, 2007 2:44 pm

Re: Prevent Multiclassing, enforce class tree

Postby rl2171 on Sat Sep 08, 2007 5:05 am

monkeyrose wrote:
Poseidon wrote:Note: This is only to those who are giving the class command to players.


Thats a good point. Perhaps I should add a snippet to allow multiclassing for any player with an accesslevel of 300. Normal players couldn't, but it would allow GMs/admins to change class.


Do you have updated code?

I am working on some stuff to add to Rev 79

Rob
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Re: Prevent Multiclassing, enforce class tree

Postby monkeyrose on Sun Sep 09, 2007 8:01 pm

  1. // GM: Change Class (from Crash)
  2. // Block Multiclass, except for GMs  (from MonkeyRose)
  3. bool CWorldServer::pakGMClass( CPlayer* thisclient, char* classid )
  4. {
  5.     int classid_new = thisclient->CharInfo->Job;
  6.     // allow GMs to multiclass
  7.     bool GM = ( thisclient->Session->accesslevel == 300 );
  8.     if ( strcmp ( classid , "Visitor" ) == 0 || strcmp ( classid , "visitor" ) == 0)
  9.     {
  10.         if (GM)
  11.            classid_new = 0;
  12.     }
  13.     else if ( strcmp ( classid , "Soldier" ) == 0 || strcmp ( classid , "soldier" ) == 0)
  14.     {
  15.          if ( GM || ((thisclient->Stats->Level >= 10) && (classid_new == 0 ))) // visitor
  16.              classid_new = 111;
  17.     }
  18.     else if ( strcmp ( classid , "Knight" ) == 0 || strcmp ( classid , "knight" ) == 0)
  19.     {
  20.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 111)))  // solder
  21.              classid_new = 121;
  22.     }
  23.     else if ( strcmp ( classid , "Champion" ) == 0 || strcmp ( classid , "champion" ) == 0)
  24.     {
  25.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 111)))  // solder
  26.                 classid_new = 122;
  27.     }
  28.     else if ( strcmp ( classid , "Muse" ) == 0 || strcmp ( classid , "muse" ) == 0)
  29.     {
  30.          if ( GM || ((thisclient->Stats->Level >= 10) && (classid_new == 0 ))) // visitor
  31.                 classid_new = 211;
  32.     }
  33.     else if ( strcmp ( classid , "Mage" ) == 0 || strcmp ( classid , "mage" ) == 0)
  34.     {
  35.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 211)))  // muse
  36.                 classid_new = 221;
  37.     }
  38.     else if ( strcmp ( classid , "Cleric" ) == 0 || strcmp ( classid , "cleric" ) == 0)
  39.     {
  40.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 211)))  // muse
  41.                 classid_new = 222;
  42.     }
  43.     else if ( strcmp ( classid , "Hawker" ) == 0 || strcmp ( classid , "hawker" ) == 0)
  44.     {
  45.          if ( GM || ((thisclient->Stats->Level >= 10) && (classid_new == 0 ))) // visitor
  46.                 classid_new = 311;
  47.     }
  48.     else if ( strcmp ( classid , "Raider" ) == 0 || strcmp ( classid , "raider" ) == 0)
  49.     {
  50.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 311)))  // hawker
  51.                 classid_new = 321;
  52.     }
  53.     else if ( strcmp ( classid , "Scout" ) == 0 || strcmp ( classid , "scout" ) == 0)
  54.     {
  55.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 311)))  // hawker
  56.                 classid_new = 322;
  57.     }
  58.     else if ( strcmp ( classid , "Dealer" ) == 0 || strcmp ( classid , "dealer" ) == 0)
  59.     {
  60.          if ( GM || ((thisclient->Stats->Level >= 10) && (classid_new == 0 ))) // visitor        
  61.                classid_new = 411;
  62.     }
  63.     else if ( strcmp ( classid , "Bourgeois" ) == 0 || strcmp ( classid , "bourgeois" ) == 0)
  64.     {
  65.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 411)))  // dealer
  66.                 classid_new = 421;
  67.     }
  68.     else if ( strcmp ( classid , "Artisan" ) == 0 || strcmp ( classid , "artisan" ) == 0)
  69.     {
  70.         if ( GM || ((thisclient->Stats->Level >= 100) && (classid_new == 411)))  // dealer
  71.                 classid_new = 422;
  72.     }    
  73.     else
  74.     {
  75.         return true;
  76.     }
  77.     bool changed = true;
  78.     if ( thisclient->CharInfo->Job == classid_new )
  79.        changed = false;
  80.     thisclient->CharInfo->Job = classid_new;
  81.     BEGINPACKET(pak, 0x0721);
  82.     ADDWORD(pak,4);
  83.     ADDWORD(pak, thisclient->CharInfo->Job);
  84.     ADDWORD(pak,0);
  85.     thisclient->client->SendPacket(&pak);
  86.     RESETPACKET(pak, 0x0730);
  87.     ADDWORD(pak, 5);
  88.     ADDWORD(pak, 0xa24d);
  89.     ADDWORD(pak, 0x40b3);
  90.     thisclient->client->SendPacket(&pak);
  91.    
  92.     if ( changed )
  93.     {
  94.        SendPM(thisclient, "Class changed!" );
  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.      
  106.     return true;
  107. }
  108.  
monkeyrose
Smoulie
Smoulie
 
Posts: 58
Joined: Thu Aug 09, 2007 2:44 pm

Re: Prevent Multiclassing, enforce class tree

Postby rl2171 on Mon Sep 10, 2007 6:02 am

Thx MonkeyRose!

I have it in the next Rev to come out now. Credits for the update is there to you as well.

Rob
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8


Return to Submit Code

Who is online

Users browsing this forum: No registered users and 2 guests