From 3f056462d6562bb3b76b0ea6618c1e3dfa60ee11 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 18 Oct 2014 13:27:33 -0400 Subject: [PATCH] Enable gaining of group leadership while in raids Note: raid leaders can only gain raid leadership, so they won't ever gain group leadership while leading a raid, even if they don't end up gaining group due to the restrictions. From what I can tell, this should be in line with live --- changelog.txt | 1 + zone/client.cpp | 20 ++++++++++++++++++-- zone/exp.cpp | 44 ++++++++++++++++++++++++++------------------ 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/changelog.txt b/changelog.txt index df7f664f4..1b3a75404 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 10/18/2014== demonstar55: Implement group mentor, sharing leadership exp (SoF+ only) +demonstar55: Add gaining of group leadership while in raids == 10/16/2014 == Uleat: Fixed the auto-conversion view naming error and renamed the views in the script files. Added a fix sql for databases that auto-converted. diff --git a/zone/client.cpp b/zone/client.cpp index 3b95c8d77..b8527204f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4256,12 +4256,28 @@ bool Client::IsLeadershipEXPOn() { Group *g = GetGroup(); - if(g && g->IsLeader(this) && (g->GroupCount() > 2)) + if (g && g->IsLeader(this) && g->GroupCount() > 2) return true; Raid *r = GetRaid(); - if(r && r->IsLeader(this) && (r->RaidCount() > 17)) + if (!r) + return false; + + // raid leaders can only gain raid AA XP + if (r->IsLeader(this)) { + if (r->RaidCount() > 17) + return true; + else + return false; + } + + uint32 gid = r->GetGroup(this); + + if (gid > 11) // not in a group + return false; + + if (r->IsGroupLeader(GetName()) && r->GroupCount(gid) > 2) return true; return false; diff --git a/zone/exp.cpp b/zone/exp.cpp index c5c5cf69d..a06fdc017 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -133,14 +133,12 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { } } - if(IsLeadershipEXPOn() && (conlevel == CON_BLUE || conlevel == CON_WHITE || conlevel == CON_YELLOW || conlevel == CON_RED)) { + if (IsLeadershipEXPOn() && (conlevel == CON_BLUE || conlevel == CON_WHITE || conlevel == CON_YELLOW || conlevel == CON_RED)) { add_exp = static_cast(static_cast(add_exp) * 0.8f); - if(GetGroup()) - { - if((m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel())) - && (RuleI(Character, KillsPerGroupLeadershipAA) > 0)) - { + if (GetGroup()) { + if (m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel()) + && RuleI(Character, KillsPerGroupLeadershipAA) > 0) { uint32 exp = GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA); Client *mentoree = GetGroup()->GetMentoree(); if (GetGroup()->GetMentorPercent() && mentoree && @@ -154,20 +152,30 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { AddLeadershipEXP(exp, 0); // ends up rounded up if mentored, no idea how live actually does it Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); } - } - else + } else { Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS); - } - else - { - if((m_pp.raid_leadership_points < MaxBankedRaidLeadershipPoints(GetLevel())) - && (RuleI(Character, KillsPerRaidLeadershipAA) > 0)) - { - AddLeadershipEXP(0, RAID_EXP_PER_POINT / RuleI(Character, KillsPerRaidLeadershipAA)); - Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_EXP); } - else - Message_StringID(MT_Leadership, MAX_RAID_LEADERSHIP_POINTS); + } else { + Raid *raid = GetRaid(); + // Raid leaders CAN NOT gain group AA XP, other group leaders can though! + if (raid->IsLeader(this)) { + if (m_pp.raid_leadership_points < MaxBankedRaidLeadershipPoints(GetLevel()) + && RuleI(Character, KillsPerRaidLeadershipAA) > 0) { + AddLeadershipEXP(0, RAID_EXP_PER_POINT / RuleI(Character, KillsPerRaidLeadershipAA)); + Message_StringID(MT_Leadership, GAIN_RAID_LEADERSHIP_EXP); + } else { + Message_StringID(MT_Leadership, MAX_RAID_LEADERSHIP_POINTS); + } + } else { + if (m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel()) + && RuleI(Character, KillsPerGroupLeadershipAA) > 0) { + // mentoring stuff needs to be added here when raids are have support for it + AddLeadershipEXP(0, GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA)); + Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP); + } else { + Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS); + } + } } }