A lot of our max skill calculations are incomplete and getting them right means adding a lot of ugly code to the MaxSkill class. Would it be possible to use a class_skillcap list and a block of generic code to get the max skills?
I am guessing that checking the value from a list, several times, is too expensive.
Heres some pseudo code of how I thought it could work:
Code:
/*
class_skillcap table example:
ClassID, SkillID, Index, Level, SkillCap
(MonkID), (BindWoundID), 1, 1, 200
(MonkID), (BindWoundID), 2, 50, 210
(PaladinID),(BindWoundID), 1, 10, 200
(PaladinID),(BindWoundID), 2, 50, 210
*/
public int GetMaxSkill(class, skill, level)
{
int caplevel = -1;
int index = 1;
//Get the base level
baselevel = GetCapLevel(class, skill, index);
if (level < baselevel || baselevel = -1)
return 0; // cant use skill
caplevel = baselevel;
while (level >= caplevel ) {
index++;
caplevel = GetCapLevel(class, skill, index);
if (caplevel = -1)
break;
}
if (caplevel = -1)
return 0; // cant use skill
else {
// workout the max skill and compare it to the skill cap
int maxskill = (((level - baselevel) * 5)+5);
int skillcap = GetCap(class, skill, caplevel);
if (maxskill > skillcap)
return = skillcap;
else
return = maxskill;
}
}
private int GetCapLevel(class, skill, index)
{
//return the skill cap level for this class, race and index
//return -1 if the item doesn't exist
}
private int GetCap(class, skill, level)
{
//return the skill cap for this class, race and skill cap level
}
The class_skillcap table would have about 500 records. (There would also have to be a race_skillcap list for the race specific skills).