After I did some testing, I found a formula to calculate the exact conlevels of the mobs according to their color indicator. I added a new conlevel (CON_GRAY) to account for all mob colors the client (SoF+) is showing and a new rule for a green XP modifier.
Well, I am happy with it and would like to share:
mob.h
ruletypes.h
Code:
RULE_INT ( Character, GreenModifier, 20 )
attack.cpp
Death()
Code:
if(!IsLdonTreasure) {
int conlevel = give_exp->GetLevelCon(GetLevel());
if (conlevel != CON_GRAY)
{
if(GetOwner() && GetOwner()->IsClient()){
}
else {
give_exp_client->AddEXP((EXP_FORMULA), conlevel); // Pyro: Comment this if NPC death crashes zone
if(killerMob && (killerMob->GetID() == give_exp_client->GetID() || killerMob->GetUltimateOwner()->GetID() == give_exp_client->GetID()))
killerMob->TrySpellOnKill();
}
}
}
bot.cpp
ShowSpawnWindow()
Code:
switch(CurrentCon) {
case CON_GRAY:
case CON_GREEN: {
WindowText += "<c \"#00FF00\">";
break;
}
client.cpp
CheckIncreaseSkill()
Code:
if(against_who)
{
if(against_who->SpecAttacks[IMMUNE_AGGRO] || against_who->IsClient() ||
GetLevelCon(against_who->GetLevel()) == CON_GRAY)
{
return false;
}
}
exp.cpp
Group::SplitExp()
Code:
int conlevel = Mob::GetLevelCon(maxlevel, other->GetLevel());
if (conlevel == CON_GRAY)
return; //no exp for grayies...
exp.cpp
Raid::SplitExp()
Code:
int conlevel = Mob::GetLevelCon(maxlevel, other->GetLevel());
if(conlevel == CON_GRAY)
return; //no exp for grayies...
fearpath.cpp
Mob::CheckFlee()
Code:
int32 con = GetLevelCon(hate_top->GetLevel(), GetLevel());
float run_ratio;
switch(con) {
//these values are not 100% researched
case CON_GRAY:
case CON_GREEN:
run_ratio = RuleI(Combat, FleeHPRatio);
break;
mob.h
Code:
inline int32 GetLevelCon(int8 iOtherLevel) const { return(this?GetLevelCon(GetLevel(), iOtherLevel):CON_GRAY); }
And the heart of it:
MobAI.cpp
Code:
int32 Mob::GetLevelCon(int8 mylevel, int8 iOtherLevel) {
sint16 diff = iOtherLevel - mylevel;
int32 conlevel=0;
int32 conGrayLvl = mylevel - (int32)((mylevel + 5)/3);
int32 conGreenLvl = mylevel - (int32)((mylevel + 7)/4);
//_log(LAUNCHER__STATUS, "GetConLevel: mylevel = %d", mylevel);
//_log(LAUNCHER__STATUS, "GetConLevel: iOtherLevel = %d", iOtherLevel);
//_log(LAUNCHER__STATUS, "GetConLevel: conGrayLvl = %d", conGrayLvl);
//_log(LAUNCHER__STATUS, "GetConLevel: conGreenLvl = %d", conGreenLvl);
if (diff == 0)
return CON_WHITE;
else if (diff >= 1 && diff <= 3)
return CON_YELLOW;
else if (diff >= 4)
return CON_RED;
if (mylevel <= 15)
{
if (diff <= -6)
conlevel = CON_GRAY;
else
conlevel = CON_BLUE;
}
else
if (mylevel <= 20)
{
if (iOtherLevel <= conGrayLvl)
conlevel = CON_GRAY;
else
if (iOtherLevel <= conGreenLvl)
conlevel = CON_GREEN;
else
conlevel = CON_BLUE;
}
else
{
if (iOtherLevel <= conGrayLvl)
conlevel = CON_GRAY;
else
if (iOtherLevel <= conGreenLvl)
conlevel = CON_GREEN;
else
if (diff <= -6)
conlevel = CON_LIGHTBLUE;
else
conlevel = CON_BLUE;
}
return conlevel;
}