mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Rework how XTarget auto haters work
This should cause the auto haters to be shared with other toons who might be interested (group/raid) like live. There maybe some bugs since there is a lot of complex interactions here.
This commit is contained in:
+36
-2
@@ -64,6 +64,8 @@ Group::Group(uint32 gid)
|
||||
MarkedNPCs[i] = 0;
|
||||
|
||||
NPCMarkerID = 0;
|
||||
|
||||
m_autohatermgr.SetOwner(nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
//creating a new group
|
||||
@@ -94,6 +96,7 @@ Group::Group(Mob* leader)
|
||||
MarkedNPCs[i] = 0;
|
||||
|
||||
NPCMarkerID = 0;
|
||||
m_autohatermgr.SetOwner(nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
Group::~Group()
|
||||
@@ -346,6 +349,9 @@ bool Group::AddMember(Mob* newmember, const char *NewMemberName, uint32 Characte
|
||||
database.SetGroupID(NewMemberName, GetID(), CharacterID, ismerc);
|
||||
}
|
||||
|
||||
if (newmember && newmember->IsClient())
|
||||
newmember->CastToClient()->JoinGroupXTargets(this);
|
||||
|
||||
safe_delete(outapp);
|
||||
|
||||
return true;
|
||||
@@ -718,8 +724,10 @@ bool Group::DelMember(Mob* oldmember, bool ignoresender)
|
||||
if (oldmember->GetName() == mentoree_name)
|
||||
ClearGroupMentor();
|
||||
|
||||
if(oldmember->IsClient())
|
||||
if(oldmember->IsClient()) {
|
||||
SendMarkedNPCsToMember(oldmember->CastToClient(), true);
|
||||
oldmember->CastToClient()->LeaveGroupXTargets(this);
|
||||
}
|
||||
|
||||
if(GroupCount() < 3)
|
||||
{
|
||||
@@ -872,7 +880,7 @@ uint32 Group::GetTotalGroupDamage(Mob* other) {
|
||||
return total;
|
||||
}
|
||||
|
||||
void Group::DisbandGroup() {
|
||||
void Group::DisbandGroup(bool joinraid) {
|
||||
auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate_Struct));
|
||||
|
||||
GroupUpdate_Struct* gu = (GroupUpdate_Struct*) outapp->pBuffer;
|
||||
@@ -899,6 +907,8 @@ void Group::DisbandGroup() {
|
||||
database.SetGroupID(members[i]->GetCleanName(), 0, members[i]->CastToClient()->CharacterID(), false);
|
||||
members[i]->CastToClient()->QueuePacket(outapp);
|
||||
SendMarkedNPCsToMember(members[i]->CastToClient(), true);
|
||||
if (!joinraid)
|
||||
members[i]->CastToClient()->LeaveGroupXTargets(this);
|
||||
}
|
||||
|
||||
if (members[i]->IsMerc())
|
||||
@@ -2292,6 +2302,30 @@ void Group::UpdateXTargetMarkedNPC(uint32 Number, Mob *m)
|
||||
|
||||
}
|
||||
|
||||
void Group::SetDirtyAutoHaters()
|
||||
{
|
||||
for (int i = 0; i < MAX_GROUP_MEMBERS; ++i)
|
||||
if (members[i] && members[i]->IsClient())
|
||||
members[i]->CastToClient()->SetDirtyAutoHaters();
|
||||
}
|
||||
|
||||
void Group::JoinRaidXTarget(Raid *raid, bool first)
|
||||
{
|
||||
if (!GetXTargetAutoMgr()->empty())
|
||||
raid->GetXTargetAutoMgr()->merge(*GetXTargetAutoMgr());
|
||||
|
||||
for (int i = 0; i < MAX_GROUP_MEMBERS; ++i) {
|
||||
if (members[i] && members[i]->IsClient()) {
|
||||
auto *client = members[i]->CastToClient();
|
||||
if (!first)
|
||||
client->RemoveAutoXTargets();
|
||||
client->SetXTargetAutoMgr(raid->GetXTargetAutoMgr());
|
||||
if (!client->GetXTargetAutoMgr()->empty())
|
||||
client->SetDirtyAutoHaters();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Group::SetMainTank(const char *NewMainTankName)
|
||||
{
|
||||
MainTankName = NewMainTankName;
|
||||
|
||||
Reference in New Issue
Block a user