Page 1 of 1

/level of more than 10 levels/ gives wrong skill increase

Posted: Wed Apr 24, 2019 5:56 am
by Ememjr
When you use the /Level command to increase your level be more than 10 levels at a time, the max stat increase may replect the wrong amount

ie you are level 1 and use /level 100 it will take you to 0 max instead of 500 max

you only see this on the spell type 2 skils at this time

the reason is that the routine that raises skill is

Code: Select all

player->GetSkills()->IncreaseAllSkillCaps(5 * (new_level - old_level));
and the value is an int8, changeing the value to an int16 will correct this issue

and some will ask well it dosent happen to my combat skills and the answer is

Code: Select all

player->GetSkills()->IncreaseAllSkillCaps(5 * (new_level - old_level));
is at line 3500 of the level increase code and that increase all skiils by 5 * number of levels
but then
at line 3539
the code is lesseting groups of skills

Code: Select all

GetPlayer()->GetSkills()->SetSkillCapsByType(1, 5*new_level);
	GetPlayer()->GetSkills()->SetSkillCapsByType(3, 5*new_level);
	GetPlayer()->GetSkills()->SetSkillCapsByType(6, 5*new_level);
	GetPlayer()->GetSkills()->SetSkillCapsByType(13, 5*new_level);
diectly by there level * 5 so those will be correct

which to me is extra work that is not needed

for now i will change int8 to int16, then remove the 4 SetSkillCapsByType lines

Re: /level of more than 10 levels/ gives wrong skill increase

Posted: Thu Apr 25, 2019 1:58 pm
by Ememjr
this fix has been commited, in SVN commit # 2821