mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-03 17:32:33 +00:00
Merge branch 'master' of https://github.com/EQEmu/Server
This commit is contained in:
commit
affb735c38
@ -2,6 +2,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
|||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
== 10/19/2014 ==
|
== 10/19/2014 ==
|
||||||
Uleat: Updated command #peekinv to display item links properly in RoF clients
|
Uleat: Updated command #peekinv to display item links properly in RoF clients
|
||||||
|
demonstar55: Group Mentoring in raids
|
||||||
|
demonstar55: Inspect Buffs (text only version) works in raid groups
|
||||||
|
demonstar55: Make use of the Inspect Buffs op/packet. 62 SOL until someone finds its op
|
||||||
|
|
||||||
== 10/18/2014==
|
== 10/18/2014==
|
||||||
demonstar55: Implement group mentor, sharing leadership exp (SoF+ only)
|
demonstar55: Implement group mentor, sharing leadership exp (SoF+ only)
|
||||||
|
|||||||
@ -3191,10 +3191,10 @@ const char* Database::GetRaidLeaderName(uint32 rid)
|
|||||||
|
|
||||||
// maintank, assist, puller, marknpc currently unused
|
// maintank, assist, puller, marknpc currently unused
|
||||||
void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank,
|
void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank,
|
||||||
char *assist, char *puller, char *marknpc, GroupLeadershipAA_Struct *GLAA)
|
char *assist, char *puller, char *marknpc, char *mentoree, int *mentor_percent, GroupLeadershipAA_Struct *GLAA)
|
||||||
{
|
{
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
"SELECT maintank, assist, puller, marknpc, leadershipaa FROM raid_leaders WHERE gid = %lu AND rid = %lu",
|
"SELECT maintank, assist, puller, marknpc, mentoree, mentor_percent, leadershipaa FROM raid_leaders WHERE gid = %lu AND rid = %lu",
|
||||||
(unsigned long)gid, (unsigned long)rid);
|
(unsigned long)gid, (unsigned long)rid);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
@ -3211,6 +3211,12 @@ void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank,
|
|||||||
if (marknpc)
|
if (marknpc)
|
||||||
marknpc[0] = '\0';
|
marknpc[0] = '\0';
|
||||||
|
|
||||||
|
if (mentoree)
|
||||||
|
mentoree[0] = '\0';
|
||||||
|
|
||||||
|
if (mentor_percent)
|
||||||
|
*mentor_percent = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3228,8 +3234,14 @@ void Database::GetGroupLeadershipInfo(uint32 gid, uint32 rid, char *maintank,
|
|||||||
if (marknpc)
|
if (marknpc)
|
||||||
strcpy(marknpc, row[3]);
|
strcpy(marknpc, row[3]);
|
||||||
|
|
||||||
if (GLAA && results.LengthOfColumn(4) == sizeof(GroupLeadershipAA_Struct))
|
if (mentoree)
|
||||||
memcpy(GLAA, row[4], sizeof(GroupLeadershipAA_Struct));
|
strcpy(mentoree, row[4]);
|
||||||
|
|
||||||
|
if (mentor_percent)
|
||||||
|
*mentor_percent = atoi(row[5]);
|
||||||
|
|
||||||
|
if (GLAA && results.LengthOfColumn(6) == sizeof(GroupLeadershipAA_Struct))
|
||||||
|
memcpy(GLAA, row[6], sizeof(GroupLeadershipAA_Struct));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3288,7 +3300,7 @@ void Database::SetRaidGroupLeaderInfo(uint32 gid, uint32 rid)
|
|||||||
if (results.RowsAffected() != 0)
|
if (results.RowsAffected() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
query = StringFormat("INSERT INTO raid_leaders(gid, rid, marknpc, leadershipaa, maintank, assist, puller) VALUES(%lu, %lu, '', '', '', '', '')",
|
query = StringFormat("INSERT INTO raid_leaders(gid, rid, marknpc, leadershipaa, maintank, assist, puller, mentoree, mentor_percent) VALUES(%lu, %lu, '', '', '', '', '', '', 0)",
|
||||||
(unsigned long)gid, (unsigned long)rid);
|
(unsigned long)gid, (unsigned long)rid);
|
||||||
results = QueryDatabase(query);
|
results = QueryDatabase(query);
|
||||||
|
|
||||||
|
|||||||
@ -215,7 +215,7 @@ public:
|
|||||||
uint32 GetRaidID(const char* name);
|
uint32 GetRaidID(const char* name);
|
||||||
const char *GetRaidLeaderName(uint32 rid);
|
const char *GetRaidLeaderName(uint32 rid);
|
||||||
void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
||||||
GroupLeadershipAA_Struct* GLAA = nullptr);
|
char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||||
void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
||||||
RaidLeadershipAA_Struct* RLAA = nullptr);
|
RaidLeadershipAA_Struct* RLAA = nullptr);
|
||||||
void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid);
|
void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid);
|
||||||
|
|||||||
@ -245,6 +245,7 @@ N(OP_IncreaseStats),
|
|||||||
N(OP_InitialHPUpdate),
|
N(OP_InitialHPUpdate),
|
||||||
N(OP_InitialMobHealth),
|
N(OP_InitialMobHealth),
|
||||||
N(OP_InspectAnswer),
|
N(OP_InspectAnswer),
|
||||||
|
N(OP_InspectBuffs),
|
||||||
N(OP_InspectMessageUpdate),
|
N(OP_InspectMessageUpdate),
|
||||||
N(OP_InspectRequest),
|
N(OP_InspectRequest),
|
||||||
N(OP_InstillDoubt),
|
N(OP_InstillDoubt),
|
||||||
|
|||||||
@ -3968,6 +3968,11 @@ struct MarkNPC_Struct
|
|||||||
/*08**/ char Name[64];
|
/*08**/ char Name[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct InspectBuffs_Struct {
|
||||||
|
/*000*/ uint32 spell_id[BUFF_COUNT];
|
||||||
|
/*100*/ uint32 tics_remaining[BUFF_COUNT];
|
||||||
|
};
|
||||||
|
|
||||||
struct RaidGeneral_Struct {
|
struct RaidGeneral_Struct {
|
||||||
/*00*/ uint32 action; //=10
|
/*00*/ uint32 action; //=10
|
||||||
/*04*/ char player_name[64]; //should both be the player's name
|
/*04*/ char player_name[64]; //should both be the player's name
|
||||||
|
|||||||
@ -1309,6 +1309,20 @@ namespace RoF
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
ENCODE(OP_InspectBuffs)
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(InspectBuffs_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(InspectBuffs_Struct, structs::InspectBuffs_Struct);
|
||||||
|
|
||||||
|
// we go over the internal 25 instead of the packet's since no entry is 0, which it will be already
|
||||||
|
for (int i = 0; i < BUFF_COUNT; i++) {
|
||||||
|
OUT(spell_id[i]);
|
||||||
|
OUT(tics_remaining[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
|
|
||||||
ENCODE(OP_InspectRequest)
|
ENCODE(OP_InspectRequest)
|
||||||
{
|
{
|
||||||
ENCODE_LENGTH_EXACT(Inspect_Struct);
|
ENCODE_LENGTH_EXACT(Inspect_Struct);
|
||||||
|
|||||||
@ -44,6 +44,7 @@ E(OP_GuildMemberUpdate)
|
|||||||
E(OP_GuildsList)
|
E(OP_GuildsList)
|
||||||
E(OP_HPUpdate)
|
E(OP_HPUpdate)
|
||||||
E(OP_Illusion)
|
E(OP_Illusion)
|
||||||
|
E(OP_InspectBuffs)
|
||||||
E(OP_InspectRequest)
|
E(OP_InspectRequest)
|
||||||
E(OP_InterruptCast)
|
E(OP_InterruptCast)
|
||||||
E(OP_ItemLinkResponse)
|
E(OP_ItemLinkResponse)
|
||||||
|
|||||||
@ -2473,6 +2473,11 @@ struct GroupFollow_Struct { // Live Follow Struct
|
|||||||
/*0152*/
|
/*0152*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct InspectBuffs_Struct {
|
||||||
|
/*000*/ uint32 spell_id[BUFF_COUNT];
|
||||||
|
/*168*/ uint32 tics_remaining[BUFF_COUNT];
|
||||||
|
};
|
||||||
|
|
||||||
struct LFG_Struct {
|
struct LFG_Struct {
|
||||||
/*000*/ uint32 unknown000;
|
/*000*/ uint32 unknown000;
|
||||||
/*004*/ uint32 value; // 0x00 = off 0x01 = on
|
/*004*/ uint32 value; // 0x00 = off 0x01 = on
|
||||||
|
|||||||
@ -1125,6 +1125,20 @@ namespace Underfoot
|
|||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENCODE(OP_InspectBuffs)
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(InspectBuffs_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(InspectBuffs_Struct, structs::InspectBuffs_Struct);
|
||||||
|
|
||||||
|
// we go over the internal 25 instead of the packet's since no entry is 0, which it will be already
|
||||||
|
for (int i = 0; i < BUFF_COUNT; i++) {
|
||||||
|
OUT(spell_id[i]);
|
||||||
|
OUT(tics_remaining[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
|
|
||||||
ENCODE(OP_InspectRequest)
|
ENCODE(OP_InspectRequest)
|
||||||
{
|
{
|
||||||
ENCODE_LENGTH_EXACT(Inspect_Struct);
|
ENCODE_LENGTH_EXACT(Inspect_Struct);
|
||||||
|
|||||||
@ -34,6 +34,7 @@ E(OP_GroupUpdate)
|
|||||||
E(OP_GuildMemberList)
|
E(OP_GuildMemberList)
|
||||||
E(OP_GuildsList)
|
E(OP_GuildsList)
|
||||||
E(OP_Illusion)
|
E(OP_Illusion)
|
||||||
|
E(OP_InspectBuffs)
|
||||||
E(OP_InspectRequest)
|
E(OP_InspectRequest)
|
||||||
E(OP_ItemLinkResponse)
|
E(OP_ItemLinkResponse)
|
||||||
E(OP_ItemPacket)
|
E(OP_ItemPacket)
|
||||||
|
|||||||
@ -2166,6 +2166,14 @@ struct GroupFollow_Struct { // Underfoot Follow Struct
|
|||||||
/*0152*/
|
/*0152*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct InspectBuffs_Struct {
|
||||||
|
/*000*/ uint32 spell_id[BUFF_COUNT];
|
||||||
|
/*100*/ uint32 filler100[5]; // BUFF_COUNT is really 30...
|
||||||
|
/*120*/ uint32 tics_remaining[BUFF_COUNT];
|
||||||
|
/*220*/ uint32 filler220[5]; // BUFF_COUNT is really 30...
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct LFG_Struct {
|
struct LFG_Struct {
|
||||||
/*000*/ uint32 unknown000;
|
/*000*/ uint32 unknown000;
|
||||||
/*004*/ uint32 value; // 0x00 = off 0x01 = on
|
/*004*/ uint32 value; // 0x00 = off 0x01 = on
|
||||||
|
|||||||
@ -501,6 +501,7 @@ OP_GroupMakeLeader=0x4129
|
|||||||
OP_DoGroupLeadershipAbility=0x17d7
|
OP_DoGroupLeadershipAbility=0x17d7
|
||||||
OP_GroupLeadershipAAUpdate=0x6567
|
OP_GroupLeadershipAAUpdate=0x6567
|
||||||
OP_GroupMentor=0x56DB
|
OP_GroupMentor=0x56DB
|
||||||
|
OP_InspectBuffs=0x01f3
|
||||||
|
|
||||||
# LFG/LFP Opcodes
|
# LFG/LFP Opcodes
|
||||||
OP_LFGCommand=0x4463
|
OP_LFGCommand=0x4463
|
||||||
|
|||||||
@ -487,6 +487,7 @@ OP_GroupLeaderChange=0x7545
|
|||||||
OP_GroupRoles=0x6b67
|
OP_GroupRoles=0x6b67
|
||||||
OP_GroupMakeLeader=0x6087
|
OP_GroupMakeLeader=0x6087
|
||||||
OP_GroupMentor=0x1224
|
OP_GroupMentor=0x1224
|
||||||
|
OP_InspectBuffs=0x66bf
|
||||||
# LFG/LFP Opcodes
|
# LFG/LFP Opcodes
|
||||||
OP_LFGCommand=0x3288 # C
|
OP_LFGCommand=0x3288 # C
|
||||||
OP_LFGGetMatchesRequest=0x5613 # C
|
OP_LFGGetMatchesRequest=0x5613 # C
|
||||||
|
|||||||
@ -453,6 +453,7 @@ OP_CancelInvite=0x596C #Trevius 03/02/09
|
|||||||
OP_GroupFollow2=0x59D4 #Xinu 02/20/09
|
OP_GroupFollow2=0x59D4 #Xinu 02/20/09
|
||||||
OP_GroupInvite2=0x07F6 #Xinu 02/20/09
|
OP_GroupInvite2=0x07F6 #Xinu 02/20/09
|
||||||
OP_GroupMentor=0x9EF3
|
OP_GroupMentor=0x9EF3
|
||||||
|
OP_InspectBuffs=0x3547
|
||||||
|
|
||||||
#LFG/LFP Opcodes
|
#LFG/LFP Opcodes
|
||||||
OP_LFGCommand=0x5D81 #Trevius 01/16/09
|
OP_LFGCommand=0x5D81 #Trevius 01/16/09
|
||||||
|
|||||||
@ -420,6 +420,8 @@ OP_RaidJoin=0x1f21 # ShowEQ 10/27/05
|
|||||||
OP_RaidInvite=0x5891 # ShowEQ 10/27/05
|
OP_RaidInvite=0x5891 # ShowEQ 10/27/05
|
||||||
OP_RaidUpdate=0x1f21 # EQEmu 06/29/05
|
OP_RaidUpdate=0x1f21 # EQEmu 06/29/05
|
||||||
|
|
||||||
|
OP_InspectBuffs=0x4FB6
|
||||||
|
|
||||||
|
|
||||||
OP_ZoneComplete=0x0000
|
OP_ZoneComplete=0x0000
|
||||||
OP_ItemLinkText=0x0000
|
OP_ItemLinkText=0x0000
|
||||||
|
|||||||
@ -490,6 +490,7 @@ OP_GroupLeaderChange=0x0c33 # C
|
|||||||
OP_GroupRoles=0x116d # C
|
OP_GroupRoles=0x116d # C
|
||||||
OP_GroupMakeLeader=0x5851
|
OP_GroupMakeLeader=0x5851
|
||||||
OP_GroupMentor=0x292f
|
OP_GroupMentor=0x292f
|
||||||
|
OP_InspectBuffs=0x105b
|
||||||
|
|
||||||
# LFG/LFP Opcodes
|
# LFG/LFP Opcodes
|
||||||
OP_LFGCommand=0x2c38 # C
|
OP_LFGCommand=0x2c38 # C
|
||||||
|
|||||||
2
utils/sql/git/required/2014_10_19_raid_group_mentor.sql
Normal file
2
utils/sql/git/required/2014_10_19_raid_group_mentor.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `raid_leaders` ADD `mentoree` VARCHAR(64) NOT NULL;
|
||||||
|
ALTER TABLE `raid_leaders` ADD `mentor_percent` INT(4) DEFAULT 0 NOT NULL;
|
||||||
37
zone/aa.cpp
37
zone/aa.cpp
@ -1793,29 +1793,26 @@ int Client::GroupLeadershipAAOffenseEnhancement()
|
|||||||
|
|
||||||
void Client::InspectBuffs(Client* Inspector, int Rank)
|
void Client::InspectBuffs(Client* Inspector, int Rank)
|
||||||
{
|
{
|
||||||
if(!Inspector || (Rank == 0)) return;
|
// At some point the removed the restriction of being a group member for this to work
|
||||||
|
// not sure when, but the way it's coded now, it wouldn't work with mobs.
|
||||||
|
if (!Inspector || Rank == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
EQApplicationPacket *outapp = new EQApplicationPacket(OP_InspectBuffs, sizeof(InspectBuffs_Struct));
|
||||||
|
InspectBuffs_Struct *ib = (InspectBuffs_Struct *)outapp->pBuffer;
|
||||||
|
|
||||||
Inspector->Message_StringID(0, CURRENT_SPELL_EFFECTS, GetName());
|
|
||||||
uint32 buff_count = GetMaxTotalSlots();
|
uint32 buff_count = GetMaxTotalSlots();
|
||||||
for (uint32 i = 0; i < buff_count; ++i)
|
uint32 packet_index = 0;
|
||||||
{
|
for (uint32 i = 0; i < buff_count; i++) {
|
||||||
if (buffs[i].spellid != SPELL_UNKNOWN)
|
if (buffs[i].spellid == SPELL_UNKNOWN)
|
||||||
{
|
continue;
|
||||||
if(Rank == 1)
|
ib->spell_id[packet_index] = buffs[i].spellid;
|
||||||
Inspector->Message(0, "%s", spells[buffs[i].spellid].name);
|
if (Rank > 1)
|
||||||
else
|
ib->tics_remaining[packet_index] = spells[buffs[i].spellid].buffdurationformula == DF_Permanent ? 0xFFFFFFFF : buffs[i].ticsremaining;
|
||||||
{
|
packet_index++;
|
||||||
if (spells[buffs[i].spellid].buffdurationformula == DF_Permanent)
|
|
||||||
Inspector->Message(0, "%s (Permanent)", spells[buffs[i].spellid].name);
|
|
||||||
else {
|
|
||||||
char *TempString = nullptr;
|
|
||||||
MakeAnyLenString(&TempString, "%.1f", static_cast<float>(buffs[i].ticsremaining) / 10.0f);
|
|
||||||
Inspector->Message_StringID(0, BUFF_MINUTES_REMAINING, spells[buffs[i].spellid].name, TempString);
|
|
||||||
safe_delete_array(TempString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Inspector->FastQueuePacket(&outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//this really need to be renamed to LoadAAActions()
|
//this really need to be renamed to LoadAAActions()
|
||||||
|
|||||||
@ -576,6 +576,7 @@ void Client::CompleteConnect()
|
|||||||
if (grpID < 12){
|
if (grpID < 12){
|
||||||
raid->SendRaidGroupRemove(GetName(), grpID);
|
raid->SendRaidGroupRemove(GetName(), grpID);
|
||||||
raid->SendRaidGroupAdd(GetName(), grpID);
|
raid->SendRaidGroupAdd(GetName(), grpID);
|
||||||
|
raid->CheckGroupMentor(grpID, this);
|
||||||
if (raid->IsGroupLeader(GetName())) { // group leader same thing!
|
if (raid->IsGroupLeader(GetName())) { // group leader same thing!
|
||||||
raid->UpdateGroupAAs(raid->GetGroup(this));
|
raid->UpdateGroupAAs(raid->GetGroup(this));
|
||||||
raid->GroupUpdate(grpID, false);
|
raid->GroupUpdate(grpID, false);
|
||||||
@ -5337,6 +5338,17 @@ void Client::Handle_OP_DoGroupLeadershipAbility(const EQApplicationPacket *app)
|
|||||||
if (!Target || !Target->IsClient())
|
if (!Target || !Target->IsClient())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (IsRaidGrouped()) {
|
||||||
|
Raid *raid = GetRaid();
|
||||||
|
if (!raid)
|
||||||
|
return;
|
||||||
|
uint32 group_id = raid->GetGroup(this);
|
||||||
|
if (group_id > 11 || raid->GroupCount(group_id) < 3)
|
||||||
|
return;
|
||||||
|
Target->CastToClient()->InspectBuffs(this, raid->GetLeadershipAA(groupAAInspectBuffs, group_id));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Group *g = GetGroup();
|
Group *g = GetGroup();
|
||||||
|
|
||||||
if (!g || (g->GroupCount() < 3))
|
if (!g || (g->GroupCount() < 3))
|
||||||
@ -6869,10 +6881,25 @@ void Client::Handle_OP_GroupMentor(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GroupMentor_Struct *gms = (GroupMentor_Struct *)app->pBuffer;
|
GroupMentor_Struct *gms = (GroupMentor_Struct *)app->pBuffer;
|
||||||
|
gms->name[63] = '\0';
|
||||||
|
|
||||||
|
if (IsRaidGrouped()) {
|
||||||
|
Raid *raid = GetRaid();
|
||||||
|
if (!raid)
|
||||||
|
return;
|
||||||
|
uint32 group_id = raid->GetGroup(this);
|
||||||
|
if (group_id > 11)
|
||||||
|
return;
|
||||||
|
if (strlen(gms->name))
|
||||||
|
raid->SetGroupMentor(group_id, gms->percent, gms->name);
|
||||||
|
else
|
||||||
|
raid->ClearGroupMentor(group_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Group *group = GetGroup();
|
Group *group = GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
return;
|
return;
|
||||||
gms->name[63] = '\0';
|
|
||||||
|
|
||||||
if (strlen(gms->name))
|
if (strlen(gms->name))
|
||||||
group->SetGroupMentor(gms->percent, gms->name);
|
group->SetGroupMentor(gms->percent, gms->name);
|
||||||
|
|||||||
17
zone/exp.cpp
17
zone/exp.cpp
@ -169,9 +169,20 @@ void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) {
|
|||||||
} else {
|
} else {
|
||||||
if (m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel())
|
if (m_pp.group_leadership_points < MaxBankedGroupLeadershipPoints(GetLevel())
|
||||||
&& RuleI(Character, KillsPerGroupLeadershipAA) > 0) {
|
&& RuleI(Character, KillsPerGroupLeadershipAA) > 0) {
|
||||||
// mentoring stuff needs to be added here when raids are have support for it
|
uint32 group_id = raid->GetGroup(this);
|
||||||
AddLeadershipEXP(0, GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA));
|
uint32 exp = GROUP_EXP_PER_POINT / RuleI(Character, KillsPerGroupLeadershipAA);
|
||||||
Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
|
Client *mentoree = raid->GetMentoree(group_id);
|
||||||
|
if (raid->GetMentorPercent(group_id) && mentoree &&
|
||||||
|
mentoree->GetGroupPoints() < MaxBankedGroupLeadershipPoints(mentoree->GetLevel())) {
|
||||||
|
uint32 mentor_exp = exp * (raid->GetMentorPercent(group_id) / 100.0f);
|
||||||
|
exp -= mentor_exp;
|
||||||
|
mentoree->AddLeadershipEXP(mentor_exp, 0);
|
||||||
|
mentoree->Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
|
||||||
|
}
|
||||||
|
if (exp > 0) {
|
||||||
|
AddLeadershipEXP(exp, 0);
|
||||||
|
Message_StringID(MT_Leadership, GAIN_GROUP_LEADERSHIP_EXP);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS);
|
Message_StringID(MT_Leadership, MAX_GROUP_LEADERSHIP_POINTS);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,10 @@ Raid::Raid(uint32 raidID)
|
|||||||
memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS));
|
memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS));
|
||||||
memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct));
|
memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct));
|
||||||
memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS);
|
memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS);
|
||||||
|
for (int i = 0; i < MAX_RAID_GROUPS; i++) {
|
||||||
|
group_mentor[i].mentor_percent = 0;
|
||||||
|
group_mentor[i].mentoree = nullptr;
|
||||||
|
}
|
||||||
leader = nullptr;
|
leader = nullptr;
|
||||||
memset(leadername, 0, 64);
|
memset(leadername, 0, 64);
|
||||||
locked = false;
|
locked = false;
|
||||||
@ -43,6 +47,10 @@ Raid::Raid(Client* nLeader)
|
|||||||
memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS));
|
memset(members ,0, (sizeof(RaidMember)*MAX_RAID_MEMBERS));
|
||||||
memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct));
|
memset(&raid_aa, 0, sizeof(RaidLeadershipAA_Struct));
|
||||||
memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS);
|
memset(group_aa, 0, sizeof(GroupLeadershipAA_Struct) * MAX_RAID_GROUPS);
|
||||||
|
for (int i = 0; i < MAX_RAID_GROUPS; i++) {
|
||||||
|
group_mentor[i].mentor_percent = 0;
|
||||||
|
group_mentor[i].mentoree = nullptr;
|
||||||
|
}
|
||||||
leader = nLeader;
|
leader = nLeader;
|
||||||
memset(leadername, 0, 64);
|
memset(leadername, 0, 64);
|
||||||
strn0cpy(leadername, nLeader->GetName(), 64);
|
strn0cpy(leadername, nLeader->GetName(), 64);
|
||||||
@ -1482,13 +1490,19 @@ void Raid::MemberZoned(Client *c)
|
|||||||
if(!c)
|
if(!c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Raid::GetGroup() goes over the members as well, this way we go over once
|
||||||
|
uint32 gid = RAID_GROUPLESS;
|
||||||
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
for(int x = 0; x < MAX_RAID_MEMBERS; x++)
|
||||||
{
|
{
|
||||||
if(members[x].member == c)
|
if(members[x].member == c)
|
||||||
{
|
{
|
||||||
members[x].member = nullptr;
|
members[x].member = nullptr;
|
||||||
|
gid = members[x].GroupNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gid < 12 && group_mentor[gid].mentoree == c)
|
||||||
|
group_mentor[gid].mentoree = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Raid::SendHPPacketsTo(Client *c)
|
void Raid::SendHPPacketsTo(Client *c)
|
||||||
@ -1597,7 +1611,56 @@ void Raid::LoadLeadership()
|
|||||||
{
|
{
|
||||||
database.GetRaidLeadershipInfo(GetID(), nullptr, nullptr, nullptr, nullptr, &raid_aa);
|
database.GetRaidLeadershipInfo(GetID(), nullptr, nullptr, nullptr, nullptr, &raid_aa);
|
||||||
|
|
||||||
for (uint32 group_id = 0; group_id < MAX_RAID_GROUPS; group_id++)
|
char mentor_name[64];
|
||||||
database.GetGroupLeadershipInfo(group_id, GetID(), nullptr, nullptr, nullptr, nullptr, &group_aa[group_id]);
|
for (uint32 group_id = 0; group_id < MAX_RAID_GROUPS; group_id++) {
|
||||||
|
database.GetGroupLeadershipInfo(group_id, GetID(), nullptr, nullptr, nullptr, nullptr,
|
||||||
|
mentor_name, &group_mentor[group_id].mentor_percent, &group_aa[group_id]);
|
||||||
|
if (strlen(mentor_name)) {
|
||||||
|
group_mentor[group_id].name = mentor_name;
|
||||||
|
mentor_name[0] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Raid::SetGroupMentor(uint32 group_id, int percent, char *name)
|
||||||
|
{
|
||||||
|
if (group_id > 11)
|
||||||
|
return;
|
||||||
|
group_mentor[group_id].name = name;
|
||||||
|
group_mentor[group_id].mentor_percent = percent;
|
||||||
|
Client *client = entity_list.GetClientByName(name);
|
||||||
|
group_mentor[group_id].mentoree = client ? client : nullptr;
|
||||||
|
|
||||||
|
std::string query = StringFormat("UPDATE raid_leaders SET mentoree = '%s', mentor_percent = %i WHERE gid = %i AND rid = %i LIMIT 1",
|
||||||
|
name, percent, group_id, GetID());
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
if (!results.Success())
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to set raid group mentor: %s\n", results.ErrorMessage().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Raid::ClearGroupMentor(uint32 group_id)
|
||||||
|
{
|
||||||
|
if (group_id > 11)
|
||||||
|
return;
|
||||||
|
group_mentor[group_id].name.clear();
|
||||||
|
group_mentor[group_id].mentor_percent = 0;
|
||||||
|
group_mentor[group_id].mentoree = nullptr;
|
||||||
|
|
||||||
|
std::string query = StringFormat("UPDATE raid_leaders SET mentoree = '', mentor_percent = 0 WHERE gid = %i AND rid = %i LIMIT 1",
|
||||||
|
group_id, GetID());
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
if (!results.Success())
|
||||||
|
LogFile->write(EQEMuLog::Error, "Unable to clear raid group mentor: %s\n", results.ErrorMessage().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// there isn't a nice place to add this in another function, unlike groups
|
||||||
|
// so we do it here instead
|
||||||
|
void Raid::CheckGroupMentor(uint32 group_id, Client *c)
|
||||||
|
{
|
||||||
|
if (!c || group_id > 11)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (group_mentor[group_id].name == c->GetName())
|
||||||
|
group_mentor[group_id].mentoree = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
zone/raids.h
14
zone/raids.h
@ -92,6 +92,12 @@ struct RaidMember{
|
|||||||
bool IsLooter;
|
bool IsLooter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct GroupMentor {
|
||||||
|
std::string name;
|
||||||
|
Client *mentoree;
|
||||||
|
int mentor_percent;
|
||||||
|
};
|
||||||
|
|
||||||
class Raid : public GroupIDConsumer {
|
class Raid : public GroupIDConsumer {
|
||||||
public:
|
public:
|
||||||
Raid(Client *nLeader);
|
Raid(Client *nLeader);
|
||||||
@ -221,6 +227,12 @@ public:
|
|||||||
inline void SetRaidAAs(RaidLeadershipAA_Struct *rlaa)
|
inline void SetRaidAAs(RaidLeadershipAA_Struct *rlaa)
|
||||||
{ memcpy(&raid_aa, rlaa, sizeof(RaidLeadershipAA_Struct)); }
|
{ memcpy(&raid_aa, rlaa, sizeof(RaidLeadershipAA_Struct)); }
|
||||||
|
|
||||||
|
void SetGroupMentor(uint32 group_id, int percent, char *name);
|
||||||
|
void ClearGroupMentor(uint32 group_id);
|
||||||
|
void CheckGroupMentor(uint32 group_id, Client *c); // this just checks if we should be fixing the pointer in group mentor struct on zone
|
||||||
|
inline int GetMentorPercent(uint32 group_id) { return group_mentor[group_id].mentor_percent; }
|
||||||
|
inline Client *GetMentoree(uint32 group_id) { return group_mentor[group_id].mentoree; }
|
||||||
|
|
||||||
RaidMember members[MAX_RAID_MEMBERS];
|
RaidMember members[MAX_RAID_MEMBERS];
|
||||||
char leadername[64];
|
char leadername[64];
|
||||||
protected:
|
protected:
|
||||||
@ -233,6 +245,8 @@ protected:
|
|||||||
std::string motd;
|
std::string motd;
|
||||||
RaidLeadershipAA_Struct raid_aa;
|
RaidLeadershipAA_Struct raid_aa;
|
||||||
GroupLeadershipAA_Struct group_aa[MAX_RAID_GROUPS];
|
GroupLeadershipAA_Struct group_aa[MAX_RAID_GROUPS];
|
||||||
|
|
||||||
|
GroupMentor group_mentor[MAX_RAID_GROUPS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user