mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
-Fixed a memleak in inviting mercs to group.
-Fixed a duplicate merc in window bug.
This commit is contained in:
parent
56825e9ed0
commit
2124b63982
@ -6482,15 +6482,6 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app)
|
||||
database.SetGroupID(inviter->GetName(), group->GetID(), inviter->CastToClient()->CharacterID());
|
||||
database.SetGroupLeaderName(group->GetID(), inviter->GetName());
|
||||
|
||||
// Add the merc back into the new group
|
||||
if (GetMerc())
|
||||
{
|
||||
if (GetMerc()->AddMercToGroup(GetMerc(), group))
|
||||
{
|
||||
database.SetGroupID(GetMerc()->GetName(), group->GetID(), inviter->CastToClient()->CharacterID(), true);
|
||||
}
|
||||
}
|
||||
|
||||
group->UpdateGroupAAs();
|
||||
|
||||
//Invite the inviter into the group first.....dont ask
|
||||
@ -6525,11 +6516,6 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app)
|
||||
if(!group->AddMember(this))
|
||||
return;
|
||||
|
||||
if(GetMerc())
|
||||
{
|
||||
group->AddMember(GetMerc());
|
||||
}
|
||||
|
||||
if(inviter->CastToClient()->IsLFP()) {
|
||||
// If the player who invited us to a group is LFP, have them update world now that we have joined
|
||||
// their group.
|
||||
@ -6546,6 +6532,16 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app)
|
||||
if(inviter->CastToClient()->GetClientVersion() >= EQClientSoD)
|
||||
database.RefreshGroupFromDB(inviter->CastToClient());
|
||||
|
||||
// Add the merc back into the new group
|
||||
if (GetMerc())
|
||||
{
|
||||
if (GetMerc()->AddMercToGroup(GetMerc(), group))
|
||||
{
|
||||
database.SetGroupID(GetMerc()->GetName(), group->GetID(), inviter->CastToClient()->CharacterID(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//send updates to clients out of zone...
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_GroupJoin, sizeof(ServerGroupJoin_Struct));
|
||||
ServerGroupJoin_Struct* gj = (ServerGroupJoin_Struct*)pack->pBuffer;
|
||||
@ -6661,9 +6657,9 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
|
||||
{
|
||||
if(group->IsLeader(this)) // the group leader can kick other members out of the group...
|
||||
{
|
||||
group->DelMember(memberToDisband,false);
|
||||
if(memberToDisband->IsClient())
|
||||
{
|
||||
group->DelMember(memberToDisband,false);
|
||||
Client* memberClient = memberToDisband->CastToClient();
|
||||
Merc* memberMerc = memberToDisband->CastToClient()->GetMerc();
|
||||
if(memberMerc != NULL)
|
||||
@ -6672,8 +6668,22 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
|
||||
if(!memberMerc->IsGrouped() && !memberClient->IsGrouped())
|
||||
{
|
||||
Group *g = new Group(memberClient);
|
||||
|
||||
if(!g)
|
||||
{
|
||||
delete g;
|
||||
g = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
entity_list.AddGroup(g);
|
||||
|
||||
if(g->GetID() == 0)
|
||||
{
|
||||
safe_delete(g);
|
||||
return;
|
||||
}
|
||||
if(memberMerc->AddMercToGroup(memberMerc, g)) {
|
||||
entity_list.AddGroup(g);
|
||||
database.SetGroupLeaderName(g->GetID(), memberClient->GetName());
|
||||
g->SaveGroupLeaderAA();
|
||||
database.SetGroupID(memberClient->GetName(), g->GetID(), memberClient->CharacterID());
|
||||
@ -6685,19 +6695,36 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
|
||||
}
|
||||
else if(memberToDisband->IsMerc())
|
||||
{
|
||||
memberToDisband->CastToMerc()->RemoveMercFromGroup(memberToDisband->CastToMerc(), group);
|
||||
memberToDisband->CastToMerc()->Suspend();
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // ...but other members can only remove themselves
|
||||
{
|
||||
// ...but other members can only remove themselves
|
||||
group->DelMember(this,false);
|
||||
|
||||
if(!IsGrouped() && GetMerc() != NULL)
|
||||
{
|
||||
if(!IsGrouped()) {
|
||||
Group *g = new Group(this);
|
||||
Group *g = new Group(this);
|
||||
|
||||
if(!g)
|
||||
{
|
||||
delete g;
|
||||
g = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
entity_list.AddGroup(g);
|
||||
|
||||
if(g->GetID() == 0)
|
||||
{
|
||||
safe_delete(g);
|
||||
return;
|
||||
}
|
||||
|
||||
if(GetMerc()->AddMercToGroup(GetMerc(), g)) {
|
||||
entity_list.AddGroup(g);
|
||||
database.SetGroupLeaderName(g->GetID(), this->GetName());
|
||||
g->SaveGroupLeaderAA();
|
||||
database.SetGroupID(this->GetName(), g->GetID(), this->CharacterID());
|
||||
@ -13771,9 +13798,6 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app)
|
||||
if(merc)
|
||||
merc->Dismiss();
|
||||
}
|
||||
|
||||
SendMercMerchantResponsePacket(10);
|
||||
|
||||
}
|
||||
|
||||
void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app)
|
||||
|
||||
@ -214,6 +214,9 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte
|
||||
if(!newmember && !NewMemberName)
|
||||
return false;
|
||||
|
||||
if(GroupCount() >= MAX_GROUP_MEMBERS) //Sanity check for merging groups together.
|
||||
return false;
|
||||
|
||||
if(!newmember)
|
||||
InZone = false;
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user