mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 07:21:48 +00:00
[Bug Fix] Fix Group XP not working. (#2748)
This commit is contained in:
parent
f1a6006ee1
commit
be03628aa9
32
zone/exp.cpp
32
zone/exp.cpp
@ -1070,7 +1070,7 @@ void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level, bool ignore
|
|||||||
SetEXP(newexp, GetAAXP());
|
SetEXP(newexp, GetAAXP());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::SplitExp(uint64 exp, Mob* other) {
|
void Group::SplitExp(const uint64 exp, Mob* other) {
|
||||||
if (other->CastToNPC()->MerchantType != 0) {
|
if (other->CastToNPC()->MerchantType != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1079,13 +1079,13 @@ void Group::SplitExp(uint64 exp, Mob* other) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto member_count = GroupCount();
|
const auto member_count = GroupCount();
|
||||||
if (!member_count) {
|
if (!member_count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto group_experience = exp;
|
auto group_experience = exp;
|
||||||
auto highest_level = GetHighestLevel();
|
const auto highest_level = GetHighestLevel();
|
||||||
|
|
||||||
auto group_modifier = 1.0f;
|
auto group_modifier = 1.0f;
|
||||||
if (RuleB(Character, EnableGroupEXPModifier)) {
|
if (RuleB(Character, EnableGroupEXPModifier)) {
|
||||||
@ -1104,30 +1104,30 @@ void Group::SplitExp(uint64 exp, Mob* other) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto consider_level = Mob::GetLevelCon(highest_level, other->GetLevel());
|
const uint8 consider_level = Mob::GetLevelCon(highest_level, other->GetLevel());
|
||||||
if (consider_level == CON_GRAY) {
|
if (consider_level == CON_GRAY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& m : members) {
|
for (const auto& m : members) {
|
||||||
if (m && m->IsClient()) {
|
if (m && m->IsClient()) {
|
||||||
uint32 diff = m->GetLevel() - highest_level;
|
const int32 diff = m->GetLevel() - highest_level;
|
||||||
uint32 max_diff = -(m->GetLevel() * 15 / 10 - m->GetLevel());
|
int32 max_diff = -(m->GetLevel() * 15 / 10 - m->GetLevel());
|
||||||
|
|
||||||
if (max_diff > -5) {
|
if (max_diff > -5) {
|
||||||
max_diff = -5;
|
max_diff = -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff >= max_diff) {
|
if (diff >= max_diff) {
|
||||||
uint64 tmp = (m->GetLevel() + 3) * (m->GetLevel() + 3) * 75 * 35 / 10;
|
const uint64 tmp = (m->GetLevel() + 3) * (m->GetLevel() + 3) * 75 * 35 / 10;
|
||||||
uint64 tmp2 = group_experience / member_count;
|
const uint64 tmp2 = group_experience / member_count;
|
||||||
m->CastToClient()->AddEXP(tmp < tmp2 ? tmp : tmp2, consider_level);
|
m->CastToClient()->AddEXP(tmp < tmp2 ? tmp : tmp2, consider_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Raid::SplitExp(uint64 exp, Mob* other) {
|
void Raid::SplitExp(const uint64 exp, Mob* other) {
|
||||||
if (other->CastToNPC()->MerchantType != 0) {
|
if (other->CastToNPC()->MerchantType != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1136,36 +1136,36 @@ void Raid::SplitExp(uint64 exp, Mob* other) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto member_count = RaidCount();
|
const auto member_count = RaidCount();
|
||||||
if (!member_count) {
|
if (!member_count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto raid_experience = exp;
|
auto raid_experience = exp;
|
||||||
auto highest_level = GetHighestLevel();
|
const auto highest_level = GetHighestLevel();
|
||||||
|
|
||||||
raid_experience = static_cast<uint64>(
|
raid_experience = static_cast<uint64>(
|
||||||
static_cast<float>(raid_experience) *
|
static_cast<float>(raid_experience) *
|
||||||
(1.0f - RuleR(Character, RaidExpMultiplier))
|
(1.0f - RuleR(Character, RaidExpMultiplier))
|
||||||
);
|
);
|
||||||
|
|
||||||
auto consider_level = Mob::GetLevelCon(highest_level, other->GetLevel());
|
const auto consider_level = Mob::GetLevelCon(highest_level, other->GetLevel());
|
||||||
if (consider_level == CON_GRAY) {
|
if (consider_level == CON_GRAY) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& m : members) {
|
for (const auto& m : members) {
|
||||||
if (m.member) {
|
if (m.member) {
|
||||||
uint32 diff = m.member->GetLevel() - highest_level;
|
const int32 diff = m.member->GetLevel() - highest_level;
|
||||||
uint32 max_diff = -(m.member->GetLevel() * 15 / 10 - m.member->GetLevel());
|
int32 max_diff = -(m.member->GetLevel() * 15 / 10 - m.member->GetLevel());
|
||||||
|
|
||||||
if (max_diff > -5) {
|
if (max_diff > -5) {
|
||||||
max_diff = -5;
|
max_diff = -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff >= max_diff) {
|
if (diff >= max_diff) {
|
||||||
uint64 tmp = (m.member->GetLevel() + 3) * (m.member->GetLevel() + 3) * 75 * 35 / 10;
|
const uint64 tmp = (m.member->GetLevel() + 3) * (m.member->GetLevel() + 3) * 75 * 35 / 10;
|
||||||
uint64 tmp2 = (raid_experience / member_count) + 1;
|
const uint64 tmp2 = (raid_experience / member_count) + 1;
|
||||||
m.member->AddEXP(tmp < tmp2 ? tmp : tmp2, consider_level);
|
m.member->AddEXP(tmp < tmp2 ? tmp : tmp2, consider_level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public:
|
|||||||
bool IsGroup() { return true; }
|
bool IsGroup() { return true; }
|
||||||
void SendGroupJoinOOZ(Mob* NewMember);
|
void SendGroupJoinOOZ(Mob* NewMember);
|
||||||
void CastGroupSpell(Mob* caster,uint16 spellid);
|
void CastGroupSpell(Mob* caster,uint16 spellid);
|
||||||
void SplitExp(uint64 exp, Mob* other);
|
void SplitExp(const uint64 exp, Mob* other);
|
||||||
void GroupMessage(Mob* sender,uint8 language,uint8 lang_skill,const char* message);
|
void GroupMessage(Mob* sender,uint8 language,uint8 lang_skill,const char* message);
|
||||||
void GroupMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
void GroupMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||||
uint32 GetTotalGroupDamage(Mob* other);
|
uint32 GetTotalGroupDamage(Mob* other);
|
||||||
|
|||||||
@ -157,7 +157,7 @@ public:
|
|||||||
|
|
||||||
void RaidMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
void RaidMessageString(Mob* sender, uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0);
|
||||||
void CastGroupSpell(Mob* caster,uint16 spellid, uint32 gid);
|
void CastGroupSpell(Mob* caster,uint16 spellid, uint32 gid);
|
||||||
void SplitExp(uint64 exp, Mob* other);
|
void SplitExp(const uint64 exp, Mob* other);
|
||||||
uint32 GetTotalRaidDamage(Mob* other);
|
uint32 GetTotalRaidDamage(Mob* other);
|
||||||
void BalanceHP(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0);
|
void BalanceHP(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0);
|
||||||
void BalanceMana(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0);
|
void BalanceMana(int32 penalty, uint32 gid, float range = 0, Mob* caster = nullptr, int32 limit = 0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user