Merge pull request #1164 from fryguy503/group-fixes

[Bug] Fix for Group Leader Disband Issue
This commit is contained in:
Chris Miles
2021-01-03 17:13:31 -06:00
committed by GitHub
9 changed files with 163 additions and 59 deletions
+32 -6
View File
@@ -4209,7 +4209,7 @@ void EntityList::ForceGroupUpdate(uint32 gid)
}
}
void EntityList::SendGroupLeave(uint32 gid, const char *name)
void EntityList::SendGroupLeave(uint32 gid, const char *name, bool checkleader)
{
auto it = client_list.begin();
while (it != client_list.end()) {
@@ -4225,13 +4225,39 @@ void EntityList::SendGroupLeave(uint32 gid, const char *name)
gj->action = groupActLeave;
strcpy(gj->yourname, c->GetName());
Mob *Leader = g->GetLeader();
if (Leader)
if (Leader) {
Leader->CastToClient()->GetGroupAAs(&gj->leader_aas);
}
c->QueuePacket(outapp);
safe_delete(outapp);
g->DelMemberOOZ(name);
if (g->IsLeader(c) && c->IsLFP())
g->DelMemberOOZ(name, checkleader);
if (g->IsLeader(c) && c->IsLFP()) {
c->UpdateLFP();
}
}
}
}
++it;
}
}
void EntityList::SendGroupLeader(uint32 gid, const char *lname, const char *oldlname)
{
auto it = client_list.begin();
while (it != client_list.end()) {
if (it->second){
Group *g = nullptr;
g = it->second->GetGroup();
if (g) {
if (g->GetID() == gid) {
EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate,sizeof(GroupJoin_Struct));
GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer;
gj->action = groupActMakeLeader;
strcpy(gj->membername, lname);
strcpy(gj->yourname, oldlname);
it->second->QueuePacket(outapp);
Log(Logs::Detail, Logs::Group, "SendGroupLeader(): Entity loop leader update packet sent to: %s .", it->second->GetName());
safe_delete(outapp);
}
}
}
@@ -4254,9 +4280,9 @@ void EntityList::SendGroupJoin(uint32 gid, const char *name)
gj->action = groupActJoin;
strcpy(gj->yourname, it->second->GetName());
Mob *Leader = g->GetLeader();
if (Leader)
if (Leader) {
Leader->CastToClient()->GetGroupAAs(&gj->leader_aas);
}
it->second->QueuePacket(outapp);
safe_delete(outapp);
}