This is code is 100% maded by me
This code give extra exp in many times, when you gain extra exp the color of exp is other.
This code tested in Evolutions 0.7.7
On "int64_t Creature::getGainedExperience(Creature* attacker) const"
replace:
with:
CONFIGMANAGER.CPP
add:
CONFIGMANAGER.H
add:
CONFIG.LUA
add:
In LINKERS add:
Coments Please
This code give extra exp in many times, when you gain extra exp the color of exp is other.
This code tested in Evolutions 0.7.7
On "int64_t Creature::getGainedExperience(Creature* attacker) const"
replace:
Code:
return (int64_t)std::floor(getDamageRatio(attacker) * lostExperience * g_config.getNumber(ConfigManager::RATE_EXPERIENCE));
with:
Code:
#ifdef __FOX_RAND_EXP__
Player* player = attacker->getPlayer();
if(player){
int32_t randomExp = random_range(0, 100);
int32_t x = (uint32_t)g_config.getNumber(ConfigManager::DOUBLE_EXP_CHANCE);
int32_t y = (uint32_t)g_config.getNumber(ConfigManager::TRIPLE_EXP_CHANCE);
int32_t z = (uint32_t)g_config.getNumber(ConfigManager::HALF_EXP_CHANCE);
if(randomExp <= x){
g_game.addAnimatedText(attacker->getPosition(), 906, "DoubleExp"); //blue
return (int64_t)std::floor(getDamageRatio(attacker) * lostExperience * g_config.getNumber(ConfigManager::RATE_EXPERIENCE) * 2);
}
else if(randomExp <= x+y){
g_game.addAnimatedText(attacker->getPosition(), 966, "TripleExp"); // 966, orange
return (int64_t)std::floor(getDamageRatio(attacker) * lostExperience * g_config.getNumber(ConfigManager::RATE_EXPERIENCE) * 3);
}
else if(randomExp <= x+y+z){
g_game.addAnimatedText(attacker->getPosition(), 906, "Half Exp!"); //black
return (int64_t)std::floor(getDamageRatio(attacker) * lostExperience * g_config.getNumber(ConfigManager::RATE_EXPERIENCE) / 2);
}
else{
//g_game.addAnimatedText(attacker->getPosition(), 906, "NormalExp!");
return (int64_t)std::floor(getDamageRatio(attacker) * lostExperience * g_config.getNumber(ConfigManager::RATE_EXPERIENCE));
}
}
else
return (int64_t)std::floor(getDamageRatio(attacker) * lostExperience * g_config.getNumber(ConfigManager::RATE_EXPERIENCE));
#else
return (int64_t)std::floor(getDamageRatio(attacker) * lostExperience * g_config.getNumber(ConfigManager::RATE_EXPERIENCE));
#endif
CONFIGMANAGER.CPP
add:
Code:
#ifdef __FOX_RAND_EXP__
m_confInteger[DOUBLE_EXP_CHANCE] = getGlobalNumber(L, "doubleExpChance", 5);
m_confInteger[TRIPLE_EXP_CHANCE] = getGlobalNumber(L, "tripleExpChance", 2);
m_confInteger[HALF_EXP_CHANCE] = getGlobalNumber(L, "halfExpChance", 2);
#endif
CONFIGMANAGER.H
add:
Code:
#ifdef __FOX_RAND_EXP__
DOUBLE_EXP_CHANCE,
TRIPLE_EXP_CHANCE,
HALF_EXP_CHANCE,
#endif
CONFIG.LUA
add:
Code:
-- random exp chance (in %)
doubleExpChance = 5
tripleExpChance = 2
halfExpChance = 2
In LINKERS add:
Code:
-D__FOX_RAND_EXP__
Coments Please