Cilraaz
05-03-2012, 02:22 PM
I'm working on an original trilogy server currently and am curious what the best way to impliment the original race/class bonuses/penalties would be. It looks like there is currently code in place to grant 5% bonus experience for the Halfling race, as well as Rogue and Warrior classes. As I understand it, the original bonuses/penalties were actually modifiers to total experience needed per level, rather than experience earned per mob.
I've looked at it, and it seems that I could do this in one of two ways, both in EQEmuServer/zone/exp.cpp. I could either modify GetEXPForLevel to include the modifier and increase the exp needed per level, or modify AddEXP to include an inverse of the modifier to decrease the exp gained per mob.
Theoretically, either way should yield the same results, but I believe modifying GetEXPForLevel would be "more correct" based on rounding errors. Is there any reason that this might cause a problem? The comment above the function is what brings up my concern about doing it that way ("// Note: The client calculates exp separately, we cant change this function"). In addition, there is already code the modifies exp gained. In any case, here are my two options. If anyone knows why either would work, please let me know.
GetEXPForLevel modification:
uint32 Client::GetEXPForLevel(int16 check_level)
{
int16 check_levelm1 = check_level-1;
float racemod;
float classmod;
float mod;
if (check_level < 31)
mod = 1.0;
else if (check_level < 36)
mod = 1.1;
else if (check_level < 41)
mod = 1.2;
else if (check_level < 46)
mod = 1.3;
else if (check_level < 52)
mod = 1.4;
else if (check_level < 53)
mod = 1.5;
else if (check_level < 54)
mod = 1.6;
else if (check_level < 55)
mod = 1.7;
else if (check_level < 56)
mod = 1.9;
else if (check_level < 57)
mod = 2.1;
else if (check_level < 58)
mod = 2.3;
else if (check_level < 59)
mod = 2.5;
else if (check_level < 60)
mod = 2.7;
else if (check_level < 61)
mod = 3.0;
else
mod = 3.1;
float base = (check_levelm1)*(check_levelm1)*(check_levelm1);
mod *= 1000;
if(GetBaseRace() == TROLL || GetBaseRace() == IKSAR) {
racemod = 1.2;
} else if(GetBaseRace() == OGRE) {
racemod = 1.15;
} else if(GetBaseRace() == BARBARIAN) {
racemod = 1.05;
} else if(GetBaseRace() == HALFLING) {
racemod = 0.95;
} else {
//do nothing
}
if(GetClass() == PALADIN || GetClass() == SHADOWKNIGHT || GetClass() == RANGER || GetClass() == BARD) {
classmod = 1.4;
} else if(GetClass() == MONK) {
classmod = 1.2;
} else if(GetClass() == WIZARD || GetClass() == ENCHANTER || GetClass() == MAGICIAN || GetClass() == NECROMANCER) {
classmod = 1.1;
} else if(GetClass() == ROGUE) {
classmod = 0.91;
} else if(GetClass() == WARRIOR) {
classmod = 0.9;
} else {
//do nothing
}
return(uint32(base * mod * racemod * classmod));
}
AddEXP modification (twice: once within the if(resexp) block and once after):
if(RuleB(Character,UseRaceClassExpBonuses))
{
if(GetBaseRace() == TROLL || GetBaseRace() == IKSAR) {
totalmod *= 0.833;
} else if(GetBaseRace() == OGRE) {
totalmod *= 0.870;
} else if(GetBaseRace() == BARBARIAN) {
totalmod *= 0.952;
} else if(GetBaseRace() == HALFLING) {
totalmod *= 1.053;
} else {
//do nothing
}
if(GetClass() == PALADIN || GetClass() == SHADOWKNIGHT || GetClass() == RANGER || GetClass() == BARD) {
totalmod *= 0.714;
} else if(GetClass() == MONK) {
totalmod *= 0.833;
} else if(GetClass() == WIZARD || GetClass() == ENCHANTER || GetClass() == MAGICIAN || GetClass() == NECROMANCER) {
totalmod *= 0.909;
} else if(GetClass() == ROGUE) {
totalmod *= 1.099;
} else if(GetClass() == WARRIOR) {
totalmod *= 1.111;
} else {
//do nothing
}
}
Thanks for any insight that anyone could provide.
I've looked at it, and it seems that I could do this in one of two ways, both in EQEmuServer/zone/exp.cpp. I could either modify GetEXPForLevel to include the modifier and increase the exp needed per level, or modify AddEXP to include an inverse of the modifier to decrease the exp gained per mob.
Theoretically, either way should yield the same results, but I believe modifying GetEXPForLevel would be "more correct" based on rounding errors. Is there any reason that this might cause a problem? The comment above the function is what brings up my concern about doing it that way ("// Note: The client calculates exp separately, we cant change this function"). In addition, there is already code the modifies exp gained. In any case, here are my two options. If anyone knows why either would work, please let me know.
GetEXPForLevel modification:
uint32 Client::GetEXPForLevel(int16 check_level)
{
int16 check_levelm1 = check_level-1;
float racemod;
float classmod;
float mod;
if (check_level < 31)
mod = 1.0;
else if (check_level < 36)
mod = 1.1;
else if (check_level < 41)
mod = 1.2;
else if (check_level < 46)
mod = 1.3;
else if (check_level < 52)
mod = 1.4;
else if (check_level < 53)
mod = 1.5;
else if (check_level < 54)
mod = 1.6;
else if (check_level < 55)
mod = 1.7;
else if (check_level < 56)
mod = 1.9;
else if (check_level < 57)
mod = 2.1;
else if (check_level < 58)
mod = 2.3;
else if (check_level < 59)
mod = 2.5;
else if (check_level < 60)
mod = 2.7;
else if (check_level < 61)
mod = 3.0;
else
mod = 3.1;
float base = (check_levelm1)*(check_levelm1)*(check_levelm1);
mod *= 1000;
if(GetBaseRace() == TROLL || GetBaseRace() == IKSAR) {
racemod = 1.2;
} else if(GetBaseRace() == OGRE) {
racemod = 1.15;
} else if(GetBaseRace() == BARBARIAN) {
racemod = 1.05;
} else if(GetBaseRace() == HALFLING) {
racemod = 0.95;
} else {
//do nothing
}
if(GetClass() == PALADIN || GetClass() == SHADOWKNIGHT || GetClass() == RANGER || GetClass() == BARD) {
classmod = 1.4;
} else if(GetClass() == MONK) {
classmod = 1.2;
} else if(GetClass() == WIZARD || GetClass() == ENCHANTER || GetClass() == MAGICIAN || GetClass() == NECROMANCER) {
classmod = 1.1;
} else if(GetClass() == ROGUE) {
classmod = 0.91;
} else if(GetClass() == WARRIOR) {
classmod = 0.9;
} else {
//do nothing
}
return(uint32(base * mod * racemod * classmod));
}
AddEXP modification (twice: once within the if(resexp) block and once after):
if(RuleB(Character,UseRaceClassExpBonuses))
{
if(GetBaseRace() == TROLL || GetBaseRace() == IKSAR) {
totalmod *= 0.833;
} else if(GetBaseRace() == OGRE) {
totalmod *= 0.870;
} else if(GetBaseRace() == BARBARIAN) {
totalmod *= 0.952;
} else if(GetBaseRace() == HALFLING) {
totalmod *= 1.053;
} else {
//do nothing
}
if(GetClass() == PALADIN || GetClass() == SHADOWKNIGHT || GetClass() == RANGER || GetClass() == BARD) {
totalmod *= 0.714;
} else if(GetClass() == MONK) {
totalmod *= 0.833;
} else if(GetClass() == WIZARD || GetClass() == ENCHANTER || GetClass() == MAGICIAN || GetClass() == NECROMANCER) {
totalmod *= 0.909;
} else if(GetClass() == ROGUE) {
totalmod *= 1.099;
} else if(GetClass() == WARRIOR) {
totalmod *= 1.111;
} else {
//do nothing
}
}
Thanks for any insight that anyone could provide.