Ok, this isn't exactly a pretty function yet, but it should use the math properly at least, which is the important part for now:
Code:
int32 Client::ManaFromIntWis(int8 level, int16 totalintorwis) {
float mana_per = 0.0;
int totalmana = 0;
// Do calculations for Mana Per INT/WIS for the first 100 INT/WIS points
if (level < 40) {
mana_per = level * 0.075;
}
else if (level < 80) {
mana_per = (3 + ((level - 40) * 0.15)); // ((40 * 0.075) + ((level - 40) * 0.15))
}
else {
mana_per = 9; // ((40 * 0.075) + (40 * 0.15))
}
// Calculate how much mana is added from the first 100 INT/WIS points
if (totalintorwis > 100) {
totalmana += mana_per * 100;
totalintorwis -= 100;
}
else {
totalmana += mana_per * totalintorwis;
totalintorwis = 0;
}
// If there was over 100 INT/WIS, do the rest of the Mana Calculations
if (totalintorwis) {
// Do calculations for Mana Per INT/WIS for INT/WIS over 100 points
if (level < 40) {
mana_per = level * 0.1875;
}
else if (level < 80) {
mana_per = ((40 * 0.1875) + ((level - 40) * 0.375));
}
else {
mana_per = 22.5; // ((40 * 0.1875) + (40 * 0.375))
}
// Calculate how much mana is added for points over 100 INT/WIS
if (totalintorwis > 100) {
totalmana += mana_per * 100;
totalintorwis -= 100;
totalmana += ((mana_per * totalintorwis) / 2);
}
else {
totalmana += mana_per * totalintorwis;
}
}
return totalmana;
}
That will all be rewritten once I look at how the current HP/Mana/Endurance code is all written currently in the source. But, that should be the formula for nearly exact mana per INT or WIS point. It may add 1 extra mana point for some levels, but that is the most it should ever be off.
That formula should also be able to be used to calculate Endurance with just a few adjustments to account for Endurance gaining stats from all 4 STR/STA/AGI/DEX stats.
So, this should just leave the HP per STA formulas to figure out for the 6 types between all classes. I suspect that will be a flat rate gain just like the Mana/Endurance ones are, so it should be fairly simple to figure it out.