PDA

View Full Version : Spell And Skill Rule for Above MaxLevel Players


trevius
08-12-2008, 07:02 PM
This code is something that might not be considered for being added to the Official Source, but I wanted to post it in case any custom servers wanted to use the code.

This new rule is for setting an Extra Level Cap above the "MaxLevel" rule setting to correct some issues for players who are above "MaxLevel". My server MaxLevel is set to 70, so that is the highest level people can attain via normal experience. But, I also use quests for players to level from 70 to 75. Without this rule in place, all level 71+ player spells will be removed from their spell book every time they zone. They also won't be able to train any skills once they are level 71+.

By setting this rule, it corrects the issues with spells being removed from the spell book for level 71+ players and also fixes issues with training skills from Class GMs. If the rule is not needed, it can simply be set to match whatever the MaxLevel rule is currently set to. If it is needed, you just need to set it to whatever the highest level attainable is on the server.

common/ruletypes.h - Add to the Character Section
RULE_INT ( Character, MaxExpLevel, 0 ) //Sets the Max Level attainable via Experience

zone/exp.cpp
Remove this line:
int8 maxlevel = RuleI(Character, MaxLevel) + 1;

And replace it with this:
int8 maxlevel = RuleI(Character, MaxExpLevel) + 1;

if(maxlevel <= 1)
maxlevel = RuleI(Character, MaxLevel) + 1;

Then, remove these lines:
if(GetLevel() == RuleI(Character, MaxLevel)){
int32 expneeded = GetEXPForLevel(RuleI(Character, MaxLevel) + 1);

And replace them with this:
if(GetLevel() == maxlevel - 1){
int32 expneeded = GetEXPForLevel(maxlevel);

Optional SQL:
Insert into rule_values values (0, 'Character:MaxExpLevel', 0);

This will basically allow an extra option to set the Max Level attainable via experience to be separate from the max level you want spell books and skill training to be allowed to work properly for. Really, I think many of the max level checks that are done with the MaxLevel rule could probably just be removed completely. But, in order to have minimal changes to how things currently work, I created this new rule. If you don't set the rule, it will base all max level calculations on your MaxLevel setting. But, if you do set it, you could set them both to the same level to have the same effect. Or, you have the option to set the MaxLevel rule higher than the new MaxExpLevel rule, which will allow players over the level cap to still retain spells for their higher levels.

I would love to find a fix for player skills not being shown properly on the client for level 71+ as well as AC and Attack being calculated incorrectly on the client, but I am pretty sure that is a limit of the client since Titanium was only made for players up to level 70. Even though my skills do always show up properly when I am in GM mode no matter what level I am. So, maybe I can find a way for GM properties to be used for players so that they always see accurate skill numbers even when over level 70.

As of right now, once you hit level 71+, all skills other than Languages and Tradeskills get rolled to 0 and are marked in RED. This is only a graphical display issue on the client, so the server still has all of the skills and AC/Attack calculated as they should be. But, I would love to get this display issue fixed if it is possible.

For now, at least this rule fixes the issues with the Spellbook and Skills, which were both fairly annoying issues on my server.