PDA

View Full Version : Original Trilogy Race/Class Modifiers


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.

Cilraaz
05-04-2012, 04:21 PM
I realized when I compiled the first option (still haven't had a chance to test it) that I failed to initialize racemod and classmod properly. They should have been initialized equal to 1.0, default for any of the non-modified races/classes. Oops.

float racemod = 1.0;
float classmod = 1.0;

I think I'll have a chance to test out the modification of that function tonight. Before I get much further into this, can anyone at least confirm that my memory of the modifiers is correct as far as them modifying xp per level, rather than xp gain per mob?

Cilraaz
05-06-2012, 02:25 PM
Well, for anyone who wanted to use this on their server for old race/class modifiers, it appears to work properly. Here's a table of test data, where the experience numbers are totals needed to complete the level:

Wood Elf Druid (0%)
Level 1 - 1000xp
Level 20 - 8000000xp
Level 40 - 83200000xp
Level 59 - 616137000xp

Human SK (40%)
Level 1 - 1399xp (+39.9%)
Level 20 - 11199999xp (+39.9%)
Level 40 - 116479998xp (+39.9%)
Level 59 - 862591785xp (+39.9%)

Iksar SK (68%)
Level 1 - 1680xp (+68%)
Level 20 - 13440000xp (+68%)
Level 40 - 139776003xp (+68%)
Level 59 - 1035110183xp (+68%)

The 40% penalty turned into 39.999%, which over the course of 60 levels is 15xp. I think that's acceptable. The client (Titanium in my case) appears to sync percentages properly, also.