mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-25 16:52:25 +00:00
[Bug Fix] Fix edge cases where camped bots would be left in a raid (#3139)
* [Bug Fix] Fix edge cases where camped bots would be left in a raid * formatting
This commit is contained in:
parent
c975dc2412
commit
abc27ab423
@ -116,6 +116,30 @@ void Raid::HandleBotGroupDisband(uint32 owner, uint32 gid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we need to cleanup any camped/offline bots when the owner leaves the Raid
|
||||||
|
void Raid::HandleOfflineBots(uint32 owner) {
|
||||||
|
std::list<BotsAvailableList> bots_list;
|
||||||
|
if (!database.botdb.LoadBotsList(owner, bots_list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& b: bots_list) {
|
||||||
|
if (IsRaidMember(b.Name)) {
|
||||||
|
for (const auto& m: members) {
|
||||||
|
if (m.is_bot && strcmp(m.member_name, b.Name) == 0) {
|
||||||
|
uint32 gid = GetGroup(m.member_name);
|
||||||
|
SendRaidGroupRemove(m.member_name, gid);
|
||||||
|
RemoveMember(m.member_name);
|
||||||
|
GroupUpdate(gid);
|
||||||
|
if (!RaidCount()) {
|
||||||
|
DisbandRaid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8 Bot::GetNumberNeedingHealedInRaidGroup(uint8& need_healed, uint8 hpr, bool includePets, Raid* raid) {
|
uint8 Bot::GetNumberNeedingHealedInRaidGroup(uint8& need_healed, uint8 hpr, bool includePets, Raid* raid) {
|
||||||
|
|
||||||
if (raid) {
|
if (raid) {
|
||||||
@ -170,8 +194,8 @@ void Bot::CreateBotRaid(Mob* invitee, Client* invitor, bool group_invite, Raid*
|
|||||||
Group* g_invitee = invitee->GetGroup();
|
Group* g_invitee = invitee->GetGroup();
|
||||||
Group* g_invitor = invitor->GetGroup();
|
Group* g_invitor = invitor->GetGroup();
|
||||||
|
|
||||||
if (g_invitee && invitor->IsClient()) {
|
if (g_invitee && invitor->IsClient() && !g_invitee->IsLeader(invitee)) {
|
||||||
if (!g_invitee->IsLeader(invitee)) {
|
if (g_invitee->GetLeader()) {
|
||||||
invitor->Message(
|
invitor->Message(
|
||||||
Chat::Red,
|
Chat::Red,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@ -180,6 +204,9 @@ void Bot::CreateBotRaid(Mob* invitee, Client* invitor, bool group_invite, Raid*
|
|||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
invitor->Message(Chat::Red, "You can only invite group leaders or ungrouped bots.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12180,6 +12180,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket* app)
|
|||||||
uint32 i = raid->GetPlayerIndex(raid_command_packet->leader_name);
|
uint32 i = raid->GetPlayerIndex(raid_command_packet->leader_name);
|
||||||
raid->SetNewRaidLeader(i);
|
raid->SetNewRaidLeader(i);
|
||||||
raid->HandleBotGroupDisband(c_to_disband->CharacterID());
|
raid->HandleBotGroupDisband(c_to_disband->CharacterID());
|
||||||
|
raid->HandleOfflineBots(c_to_disband->CharacterID());
|
||||||
raid->RemoveMember(raid_command_packet->leader_name);
|
raid->RemoveMember(raid_command_packet->leader_name);
|
||||||
raid->SendGroupDisband(c_to_disband);
|
raid->SendGroupDisband(c_to_disband);
|
||||||
raid->GroupUpdate(group);
|
raid->GroupUpdate(group);
|
||||||
|
|||||||
@ -1703,11 +1703,10 @@ void Raid::VerifyRaid()
|
|||||||
//attribute before calling a client function or casting to client.
|
//attribute before calling a client function or casting to client.
|
||||||
b = entity_list.GetBotByBotName(m.member_name);
|
b = entity_list.GetBotByBotName(m.member_name);
|
||||||
m.member = b->CastToClient();
|
m.member = b->CastToClient();
|
||||||
m.is_bot = true; //Used to identify those members who are Bots
|
m.is_bot = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m.member = nullptr;
|
m.member = nullptr;
|
||||||
m.is_bot = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -256,6 +256,7 @@ public:
|
|||||||
std::vector<Bot*> GetRaidGroupBotMembers(uint32 gid);
|
std::vector<Bot*> GetRaidGroupBotMembers(uint32 gid);
|
||||||
std::vector<Bot*> GetRaidBotMembers(uint32 owner = 0);
|
std::vector<Bot*> GetRaidBotMembers(uint32 owner = 0);
|
||||||
void HandleBotGroupDisband(uint32 owner, uint32 gid = RAID_GROUPLESS);
|
void HandleBotGroupDisband(uint32 owner, uint32 gid = RAID_GROUPLESS);
|
||||||
|
void HandleOfflineBots(uint32 owner);
|
||||||
|
|
||||||
RaidMember members[MAX_RAID_MEMBERS];
|
RaidMember members[MAX_RAID_MEMBERS];
|
||||||
char leadername[64];
|
char leadername[64];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user