From 7621bf47c8a6cd6f92e9719c63086ff1672e96a3 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 24 Feb 2017 01:12:46 -0500 Subject: [PATCH 1/2] Quick fix to resolve some serious group issues Group leader swapping didn't work and left the client in a bad state This just disbands the group if the leader leaves Also prevents a group leader from disbanding other groups ... Which also lead to bad states Group leader swapping not working is better than these issues :P --- zone/client_packet.cpp | 18 +++++++++++------- zone/groups.cpp | 10 ++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 1c5e4ebfd..5411dbf7a 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6506,6 +6506,16 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) if (!group) //We must recheck this here.. incase the final bot disbanded the party..otherwise we crash return; #endif + Mob* memberToDisband = GetTarget(); + + if (!memberToDisband) + memberToDisband = entity_list.GetMob(gd->name2); + + if (memberToDisband) { + auto group2 = memberToDisband->GetGroup(); + if (group2 != group) // they're not in our group! + memberToDisband = this; + } if (group->GroupCount() < 3) { @@ -6527,7 +6537,7 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) GetMerc()->Suspend(); } } - else if (group->IsLeader(this) && GetTarget() == this) + else if (group->IsLeader(this) && (GetTarget() == this || memberToDisband == this)) { LeaveGroup(); if (GetMerc() && !GetMerc()->IsSuspended()) @@ -6537,12 +6547,6 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) } else { - Mob* memberToDisband = nullptr; - memberToDisband = GetTarget(); - - if (!memberToDisband) - memberToDisband = entity_list.GetMob(gd->name2); - if (memberToDisband) { if (group->IsLeader(this)) diff --git a/zone/groups.cpp b/zone/groups.cpp index 94a2b0032..e9b2ec93c 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -581,6 +581,16 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender) return false; } + // TODO: fix this shit + // okay, so there is code below that tries to handle this. It does not. + // So instead of figuring it out now, lets just disband the group so the client doesn't + // sit there with a broken group and there isn't any group leader shuffling going on + // since the code below doesn't work. + if (oldmember == GetLeader()) { + DisbandGroup(); + return true; + } + for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) { if (members[i] == oldmember) From 0968ce0d60fb22feb5257ed5c498576c9917055e Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 24 Feb 2017 15:28:22 -0500 Subject: [PATCH 2/2] Add petnaming type 5 (`s ward) --- zone/pets.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zone/pets.cpp b/zone/pets.cpp index a50dcbed4..b9ccafe38 100644 --- a/zone/pets.cpp +++ b/zone/pets.cpp @@ -304,6 +304,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, // 2 - `s Warder // 3 - Random name if client, `s pet for others // 4 - Keep DB name + // 5 - `s ward if (petname != nullptr) { @@ -325,6 +326,10 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower, // Keep the DB name } else if (record.petnaming == 3 && IsClient()) { strcpy(npc_type->name, GetRandPetName()); + } else if (record.petnaming == 5 && IsClient()) { + strcpy(npc_type->name, this->GetName()); + npc_type->name[24] = '\0'; + strcat(npc_type->name, "`s_ward"); } else { strcpy(npc_type->name, this->GetCleanName()); npc_type->name[25] = '\0';