Add rule Character:FinalExpMultiplier - Added on top of everything else, easy for setting EXP events

This commit is contained in:
Akkadius 2020-08-21 01:04:18 -05:00
parent 482816058f
commit 32407dbb56
2 changed files with 38 additions and 23 deletions

View File

@ -52,6 +52,7 @@ RULE_BOOL(Character, LeaveCorpses, true, "Setting whether you leave a corpse beh
RULE_BOOL(Character, LeaveNakedCorpses, false, "Setting whether you leave a corpse without items")
RULE_INT(Character, MaxDraggedCorpses, 2, "Maximum number of corpses you can drag at once")
RULE_REAL(Character, DragCorpseDistance, 400, "If a player is using /corpsedrag and moving, the corpse will not move until the player exceeds this distance")
RULE_REAL(Character, FinalExpMultiplier, 1, "Added on top of everything else, easy for setting EXP events")
RULE_REAL(Character, ExpMultiplier, 0.5, "If greater than 0, the experience gained is multiplied by this value. ")
RULE_REAL(Character, AAExpMultiplier, 0.5, "If greater than 0, the AA experience gained is multiplied by this value. ")
RULE_REAL(Character, GroupExpMultiplier, 0.5, "The experience in a group is multiplied by this value in addition to the group multiplier. The group multiplier is: 2 members=x 1.2, 3=x1.4, 4=x1.6, 5=x1.8, 6=x2.16")

View File

@ -194,6 +194,10 @@ uint32 Client::CalcEXP(uint8 conlevel) {
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
in_add_exp *= RuleR(Character, FinalExpMultiplier);
}
return in_add_exp;
}
@ -311,6 +315,10 @@ void Client::CalculateStandardAAExp(uint32 &add_aaxp, uint8 conlevel, bool resex
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
add_aaxp *= RuleR(Character, FinalExpMultiplier);
}
add_aaxp = (uint32)(RuleR(Character, AAExpMultiplier) * add_aaxp * aatotalmod);
}
@ -466,6 +474,10 @@ void Client::CalculateExp(uint32 in_add_exp, uint32 &add_exp, uint32 &add_aaxp,
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
add_exp *= RuleR(Character, FinalExpMultiplier);
}
add_exp = GetEXP() + add_exp;
}
@ -563,22 +575,22 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
}
if (isrezzexp) {
if (RuleI(Character, ShowExpValues) > 0)
if (RuleI(Character, ShowExpValues) > 0)
Message(Chat::Experience, "You regain %s experience from resurrection. %s", exp_amount_message.c_str(), exp_percent_message.c_str());
else MessageString(Chat::Experience, REZ_REGAIN);
} else {
if (membercount > 1) {
if (RuleI(Character, ShowExpValues) > 0)
if (RuleI(Character, ShowExpValues) > 0)
Message(Chat::Experience, "You have gained %s party experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
else MessageString(Chat::Experience, GAIN_GROUPXP);
}
else if (IsRaidGrouped()) {
if (RuleI(Character, ShowExpValues) > 0)
if (RuleI(Character, ShowExpValues) > 0)
Message(Chat::Experience, "You have gained %s raid experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
else MessageString(Chat::Experience, GAIN_RAIDEXP);
}
}
else {
if (RuleI(Character, ShowExpValues) > 0)
if (RuleI(Character, ShowExpValues) > 0)
Message(Chat::Experience, "You have gained %s experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str());
else MessageString(Chat::Experience, GAIN_XP);
}
@ -660,7 +672,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) {
if (RuleB(AA, SoundForAAEarned)) {
SendSound();
}
/* QS: PlayerLogAARate */
if (RuleB(QueryServ, PlayerLogAARate)){
int add_points = (m_pp.aapoints - last_unspentAA);
@ -801,7 +813,7 @@ void Client::SetLevel(uint8 set_level, bool command)
/* QS: PlayerLogLevels */
if (RuleB(QueryServ, PlayerLogLevels)){
std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID());
QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc);
QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc);
}
}
else if (set_level < m_pp.level){
@ -839,7 +851,7 @@ void Client::SetLevel(uint8 set_level, bool command)
SetHP(CalcMaxHP()); // Why not, lets give them a free heal
}
if (RuleI(World, PVPMinLevel) > 0 && level >= RuleI(World, PVPMinLevel) && m_pp.pvp == 0) SetPVP(true);
if (RuleI(World, PVPMinLevel) > 0 && level >= RuleI(World, PVPMinLevel) && m_pp.pvp == 0) SetPVP(true);
DoTributeUpdate();
SendHPUpdate();
@ -943,32 +955,34 @@ uint32 Client::GetEXPForLevel(uint16 check_level)
return finalxp;
}
void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level, bool ignore_mods)
{
void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level, bool ignore_mods)
{
uint32 award;
uint32 xp_for_level;
if (exp_percentage > 100)
{
exp_percentage = 100;
}
if (exp_percentage > 100)
{
exp_percentage = 100;
}
if (!max_level || GetLevel() < max_level)
{
max_level = GetLevel();
}
{
max_level = GetLevel();
}
xp_for_level = GetEXPForLevel(max_level + 1) - GetEXPForLevel(max_level);
award = xp_for_level * exp_percentage / 100;
award = xp_for_level * exp_percentage / 100;
if(RuleB(Zone, LevelBasedEXPMods) && !ignore_mods)
{
if(zone->level_exp_mod[GetLevel()].ExpMod)
{
if (RuleB(Zone, LevelBasedEXPMods) && !ignore_mods) {
if (zone->level_exp_mod[GetLevel()].ExpMod) {
award *= zone->level_exp_mod[GetLevel()].ExpMod;
}
}
if (RuleR(Character, FinalExpMultiplier) >= 0) {
award *= RuleR(Character, FinalExpMultiplier);
}
uint32 newexp = GetEXP() + award;
SetEXP(newexp, GetAAXP());
}
@ -1126,7 +1140,7 @@ uint32 Client::GetCharMaxLevelFromQGlobal() {
while(iter != globalMap.end()) {
if((*iter).name.compare("CharMaxLevel") == 0){
return atoi((*iter).value.c_str());
}
}
++iter;
++gcount;
}