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