Page 1 of 1
Changing a characters class.
Posted: Sat Aug 11, 2007 4:46 pm
by msknight
Hi Folks,
I'm trying to change a characters class. When the character is off line, I change the classid and base_class fields, and the character seems to be that, but when they log in, the character goes back to the previous class. Any idea what else I'm missing, please?
Michelle.
Posted: Sat Aug 11, 2007 5:13 pm
by Kaifer Riot
If i don't mistake, the server have to restart

Posted: Sat Aug 11, 2007 7:36 pm
by msknight
Nope - didn't work. There was a message in teh server console that it had reverted the character to base class, stating that it was a possible exploit while subclassing. There's probably something I'm missing somewhere.
Posted: Mon Aug 13, 2007 4:09 pm
by Fulminus
I replied in your dropcalc thread, but I find it interesting now that you mention that you actually changed the base_class as well :/
When you are changing the mainclass and if the mainclass is active, you need to change both the classId and the base_class, which apparently you are doing. If you need to change the classId of a subclass, you should not touch the base_class. Instead, change the classId in the subclasses table and the classId in the characters table. The warning you are getting on the log merely means that the class_id in the characters table is not equal to the base_class nor does it match any of the char's subclasses. As a result, the core will automatically revert the char to whatever value is stored in base_class.
It sounds to me like your change of base_class didn't work.
Posted: Mon Aug 13, 2007 4:54 pm
by msknight
Hi Fulminus,
So if I get this right, base_class is the class immediatley below the class that the character is? Note- I'm just dealing with the main class here - subclasses are a bit above me!
Posted: Mon Aug 13, 2007 6:18 pm
by Fulminus
The base_class is the class of the main. This value is normally only changed when a player completes an occupation change quest (or cat).
The characters.classId denotes the currently active class. It will either be the same as base_class or the same as one of the subclasses. This value is changed both upon completion of occupation change quests (or cat) and whenever the player switches between subclasses.
If the value of characters.classId doesn't match the subclasses nor the base_class, then its value is ignored and the core's anti-exploit code over-writes it using the value of base_class.
Assuming that a player is currently using his main class (or has no subclasses at all), then in order to change the class you must set both the classId and the base_class to the id of the new class.
On retrospect, if you always only wish to change the main class, the easiest thing will be to only change the base_class. This way, if the player had a subclass active, it won't be affected. The player will not notice the main class's change except by going to a village master to switch back to the main. If the player had the main class active (or had no subclasses), then the core will display a warning about possible exploits, but it will then automatically set the player to the correct (new) class that you set.
Posted: Mon Aug 13, 2007 7:53 pm
by msknight
Fulminus ... that explanation was gorgeous! Exactly what I needed!
Many thanks! I'm going to code it up now.