From d67fa473a2cfc4f765c0564fa2adc7a42921fe7c Mon Sep 17 00:00:00 2001 From: neckkola <65987027+neckkola@users.noreply.github.com> Date: Wed, 23 Feb 2022 15:58:13 -0400 Subject: [PATCH] Cleanup of bot raid work and inclusion of bot_raid in cmake --- .../base/base_raid_members_repository.h | 24 ++- zone/CMakeLists.txt | 1 + zone/bot.cpp | 13 +- zone/bot.h | 8 +- zone/client.cpp | 4 +- zone/client_packet.cpp | 14 +- zone/entity.cpp | 6 +- zone/exp.cpp | 6 +- zone/groups.cpp | 5 +- zone/mob.cpp | 2 +- zone/raids.cpp | 163 +++++++++--------- zone/raids.h | 15 +- 12 files changed, 135 insertions(+), 126 deletions(-) diff --git a/common/repositories/base/base_raid_members_repository.h b/common/repositories/base/base_raid_members_repository.h index 88169a5ab..f37a44186 100644 --- a/common/repositories/base/base_raid_members_repository.h +++ b/common/repositories/base/base_raid_members_repository.h @@ -27,7 +27,9 @@ public: int isgroupleader; int israidleader; int islooter; +#ifdef BOTS int isbot; +#endif }; static std::string PrimaryKey() @@ -47,7 +49,9 @@ public: "isgroupleader", "israidleader", "islooter", +#ifdef BOTS "isbot", +#endif }; } @@ -92,7 +96,9 @@ public: entry.isgroupleader = 0; entry.israidleader = 0; entry.islooter = 0; +#ifdef BOTS entry.isbot = 0; +#endif return entry; } @@ -137,7 +143,9 @@ public: entry.isgroupleader = atoi(row[6]); entry.israidleader = atoi(row[7]); entry.islooter = atoi(row[8]); +#ifdef BOTS entry.isbot = atoi(row[9]); +#endif return entry; } @@ -180,7 +188,9 @@ public: update_values.push_back(columns[6] + " = " + std::to_string(raid_members_entry.isgroupleader)); update_values.push_back(columns[7] + " = " + std::to_string(raid_members_entry.israidleader)); update_values.push_back(columns[8] + " = " + std::to_string(raid_members_entry.islooter)); - update_values.push_back(columns[9] + " = " + std::to_string(raid_members_entry.isbot)); //Mitch +#ifdef BOTS + update_values.push_back(columns[9] + " = " + std::to_string(raid_members_entry.isbot)); +#endif auto results = db.QueryDatabase( fmt::format( @@ -211,8 +221,9 @@ public: insert_values.push_back(std::to_string(raid_members_entry.isgroupleader)); insert_values.push_back(std::to_string(raid_members_entry.israidleader)); insert_values.push_back(std::to_string(raid_members_entry.islooter)); +#ifdef BOTS insert_values.push_back(std::to_string(raid_members_entry.isbot)); - +#endif auto results = db.QueryDatabase( fmt::format( "{} VALUES ({})", @@ -250,8 +261,9 @@ public: insert_values.push_back(std::to_string(raid_members_entry.isgroupleader)); insert_values.push_back(std::to_string(raid_members_entry.israidleader)); insert_values.push_back(std::to_string(raid_members_entry.islooter)); +#ifdef BOTS insert_values.push_back(std::to_string(raid_members_entry.isbot)); - +#endif insert_chunks.push_back("(" + implode(",", insert_values) + ")"); } @@ -293,8 +305,9 @@ public: entry.isgroupleader = atoi(row[6]); entry.israidleader = atoi(row[7]); entry.islooter = atoi(row[8]); +#ifdef BOTS entry.isbot = atoi(row[9]); - +#endif all_entries.push_back(entry); } @@ -327,8 +340,9 @@ public: entry.isgroupleader = atoi(row[6]); entry.israidleader = atoi(row[7]); entry.islooter = atoi(row[8]); +#ifdef BOTS entry.isbot = atoi(row[9]); - +#endif all_entries.push_back(entry); } diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 3c24da07a..6afb4bb85 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -11,6 +11,7 @@ SET(zone_sources beacon.cpp bonuses.cpp bot.cpp + bot_raid.cpp bot_command.cpp bot_database.cpp botspellsai.cpp diff --git a/zone/bot.cpp b/zone/bot.cpp index a7c9bd6f5..a4333eb66 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8370,9 +8370,8 @@ Bot* Bot::GetBotByBotClientOwnerAndBotName(Client* c, std::string botName) { void Bot::ProcessBotGroupInvite(Client* c, std::string botName) { if(c) { -// Bot* invitedBot = GetBotByBotClientOwnerAndBotName(entity_list.GetBotByBotName(botName)->GetOwner()->CastToClient(), botName); Bot* invitedBot = GetBotByBotClientOwnerAndBotName(c, botName); - //Mitch changed entity from c + if(invitedBot && !invitedBot->HasGroup()) { if(!c->IsGrouped()) { Group *g = new Group(c); @@ -10402,8 +10401,7 @@ void Bot::ProcessRaidInvite(Bot* invitee, Client* invitor) { raid->SendRaidCreate(c); raid->AddMember(c, 0, true, true, true); raid->SendMakeLeaderPacketTo(raid->leadername, c); - //raid->SetGroupLeader(c->GetName()); //Mitch Jan 18 - //raid->GroupUpdate(0, true); + if (raid->IsLocked()) { raid->SendRaidLockTo(c); } @@ -10479,13 +10477,8 @@ void Bot::ProcessRaidInvite(Bot* invitee, Client* invitor) { else { //Third, no group so add the single client - //raid->SendRaidCreate(invitee); - //raid->SendMakeLeaderPacketTo(raid->leadername, invitee); raid->AddBot(invitee); - // raid->SendBulkRaid(invitee); - //if (raid->IsLocked()) { - // raid->SendRaidLockTo(invitee); - //} + } } else diff --git a/zone/bot.h b/zone/bot.h index 6cd8eb519..7a0c34b32 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -382,10 +382,10 @@ public: void PetAIProcess_Raid(); void AI_Process_Raid(); bool AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes); - static void ProcessRaidInvite(Bot* invitee, Client* invitor); //Mitch - static void ProcessRaidInvite(Client* invitee, Client* invitor); //Mitch - uint8 GetNumberNeedingHealedInRaidGroup(uint8 hpr, bool includePets); //Mitch - inline void SetDirtyAutoHaters() { m_dirtyautohaters = true; } //Mitch + static void ProcessRaidInvite(Bot* invitee, Client* invitor); + static void ProcessRaidInvite(Client* invitee, Client* invitor); + uint8 GetNumberNeedingHealedInRaidGroup(uint8 hpr, bool includePets); + inline void SetDirtyAutoHaters() { m_dirtyautohaters = true; } static std::list GetBotSpellsForSpellEffect(Bot* botCaster, int spellEffect); static std::list GetBotSpellsForSpellEffectAndTargetType(Bot* botCaster, int spellEffect, SpellTargetType targetType); diff --git a/zone/client.cpp b/zone/client.cpp index f2a831a45..5dfdd8318 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -804,7 +804,7 @@ void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req, CLIENT_CO // todo: save packets for later use AddPacket(app, ack_req); } - else if (eqs) // && !IsBot()) //Mitch added the BoTcheck for a fail safe on trying to send a packet to a BoT! + else if (eqs) { eqs->QueuePacket(app, ack_req); } @@ -818,7 +818,7 @@ void Client::FastQueuePacket(EQApplicationPacket** app, bool ack_req, CLIENT_CON return; } else { - if(eqs) // && !IsBot()) //Mitch added + if(eqs) eqs->FastQueuePacket((EQApplicationPacket **)app, ack_req); else if (app && (*app)) delete *app; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d07920f4d..c7fdd3a4c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -11455,7 +11455,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket* app) case RaidCommandInviteIntoExisting: case RaidCommandInvite: { -#ifdef BOTS //Mitch +#ifdef BOTS Bot* player_to_invite = nullptr; Client* player_to_invite_owner = nullptr; @@ -11532,7 +11532,9 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket* app) break; } +#ifdef BOTS } +#endif case RaidCommandAcceptInvite: { Client* player_accepting_invite = entity_list.GetClientByName(raid_command_packet->player_name); @@ -11581,7 +11583,7 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket* app) Bot::ProcessRaidInvite(invitee, invitor); //two clients with one or both having groups with bots break; } - else if (invitee->IsBot()) + else if (invitee && invitee->IsBot()) { Bot::ProcessRaidInvite(b, player_accepting_invite); //client inviting a bot break; @@ -11859,13 +11861,15 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket* app) Raid* raid = entity_list.GetRaidByClient(this); Client* c_to_disband = entity_list.GetClientByName(raid_command_packet->leader_name); Client* c_doing_disband = entity_list.GetClientByName(raid_command_packet->player_name); +#ifdef BOTS Bot* b_to_disband = entity_list.GetBotByBotName(raid_command_packet->leader_name); - +#endif + if (raid) { uint32 group = raid->GetGroup(raid_command_packet->leader_name); #ifdef BOTS - //Mitch added to remove all bots if the Bot_Owner is removed from the Raid + //Added to remove all bots if the Bot_Owner is removed from the Raid //Does not camp the Bots, just removes from the raid std::vector raid_members_bots; if (c_to_disband) @@ -11917,8 +11921,6 @@ void Client::Handle_OP_RaidCommand(const EQApplicationPacket* app) if (raid->IsGroupLeader(b_to_disband->GetName())) { // Remove the entire BOT group in this case - //uint32 gid = raid->GetGroup(b_to_disband->GetName()); - //std::vector r_group_members = raid->GetRaidGroupMembers(gid); Group* group_inst = new Group(b_to_disband); entity_list.AddGroup(group_inst); database.SetGroupID(b_to_disband->GetCleanName(), group_inst->GetID(), b_to_disband->GetBotID()); diff --git a/zone/entity.cpp b/zone/entity.cpp index e1270a49c..c9e6a4023 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2112,7 +2112,7 @@ Raid* EntityList::GetRaidByClient(Client* client) return nullptr; } - +#ifdef BOTS Raid* EntityList::GetRaidByBotName(const char* name) { @@ -2134,7 +2134,9 @@ Raid* EntityList::GetRaidByBotName(const char* name) return nullptr; } +#endif +#ifdef BOTS Raid* EntityList::GetRaidByBot(Bot* bot) { @@ -2152,7 +2154,7 @@ Raid* EntityList::GetRaidByBot(Bot* bot) } return nullptr; } - +#endif Raid *EntityList::GetRaidByMob(Mob *mob) diff --git a/zone/exp.cpp b/zone/exp.cpp index 045a9bba6..e46dcce48 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -1097,7 +1097,11 @@ void Raid::SplitExp(uint32 exp, Mob* other) { return; for (unsigned int x = 0; x < MAX_RAID_MEMBERS; x++) { - if (members[x].member != nullptr && members[x].member->CastToBot()->GetBotID() == 0) // If Group Member is Client +#ifdef BOTS + if (members[x].member != nullptr && !members[x].IsBot) // If Group Member is Client +#else + if (members[x].member != nullptr) // If Group Member is Client +#endif { Client *cmember = members[x].member; // add exp + exp cap diff --git a/zone/groups.cpp b/zone/groups.cpp index f2867f9d1..425eeb419 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1248,10 +1248,7 @@ void Group::VerifyGroup() { members[i] = nullptr; continue; } - //if (them == nullptr && members[i] == nullptr) { //fixes a group bug with bots Mitch added Jan 1 2022 - // membername[i][0] = '\0'; - // continue; - //} + if(them != nullptr && members[i] != them) { //our pointer is out of date... not so good. #if EQDEBUG >= 5 diff --git a/zone/mob.cpp b/zone/mob.cpp index 306421057..aca66b7e3 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3855,7 +3855,7 @@ void Mob::QuestJournalledSay(Client *QuestInitiator, const char *str, Journal::O const char *Mob::GetCleanName() { - if (clean_name != NULL && !strlen(clean_name)) { //extra check added for crash condition. Mitch + if (!strlen(clean_name)) { CleanMobName(GetName(), clean_name); } diff --git a/zone/raids.cpp b/zone/raids.cpp index 56d5b31c8..cbe90cf0a 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -24,7 +24,7 @@ #include "groups.h" #include "mob.h" #include "raids.h" -#include "bot.h" //Mitch +#include "bot.h" #include "worldserver.h" @@ -96,13 +96,22 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo if(!c) return; +#ifdef BOTS std::string query = StringFormat("INSERT INTO raid_members SET raidid = %lu, charid = %lu, " "groupid = %lu, _class = %d, level = %d, name = '%s', " "isgroupleader = %d, israidleader = %d, islooter = %d, isbot = 0", (unsigned long)GetID(), (unsigned long)c->CharacterID(), (unsigned long)group, c->GetClass(), c->GetLevel(), c->GetName(), groupleader, rleader, looter); - auto results = database.QueryDatabase(query); +#else + std::string query = StringFormat("INSERT INTO raid_members SET raidid = %lu, charid = %lu, " + "groupid = %lu, _class = %d, level = %d, name = '%s', " + "isgroupleader = %d, israidleader = %d, islooter = %d", + (unsigned long)GetID(), (unsigned long)c->CharacterID(), + (unsigned long)group, c->GetClass(), c->GetLevel(), + c->GetName(), groupleader, rleader, looter); +#endif + auto results = database.QueryDatabase(query); if(!results.Success()) { LogError("Error inserting into raid members: [{}]", results.ErrorMessage().c_str()); @@ -171,7 +180,8 @@ void Raid::AddMember(Client *c, uint32 group, bool rleader, bool groupleader, bo worldserver.SendPacket(pack); safe_delete(pack); } -//Mitch + +#ifdef BOTS void Raid::AddBot(Bot* b, uint32 group, bool rleader, bool groupleader, bool looter) { if (!b) return; @@ -190,17 +200,6 @@ void Raid::AddBot(Bot* b, uint32 group, bool rleader, bool groupleader, bool loo LearnMembers(); VerifyRaid(); -// Bots are being invited and cannot be the raid leader -// if (rleader) { -// database.SetRaidGroupLeaderInfo(RAID_GROUPLESS, GetID()); -// UpdateRaidAAs(); -// } - -// Bots can be group leaders, though they do not have GroupAA -// if (group != RAID_GROUPLESS && groupleader) { -// database.SetRaidGroupLeaderInfo(group, GetID()); -// UpdateGroupAAs(group); //Mitch Jan 22 -// } if (group < 12) //Jan22 GroupUpdate(group); //Jan22 @@ -210,36 +209,7 @@ void Raid::AddBot(Bot* b, uint32 group, bool rleader, bool groupleader, bool loo b->SetRaidGrouped(true); b->p_raid_instance = this; - //SendRaidMOTD(b->GetOwner()->CastToClient()); - // Mitch What to do here? - // xtarget shit .......... - //if (group == RAID_GROUPLESS) { - // if (rleader) { - // GetXTargetAutoMgr()->merge(*c->GetXTargetAutoMgr()); - // c->GetXTargetAutoMgr()->clear(); - // c->SetXTargetAutoMgr(GetXTargetAutoMgr()); - // } - // else { - // if (!c->GetXTargetAutoMgr()->empty()) { - // GetXTargetAutoMgr()->merge(*c->GetXTargetAutoMgr()); - // c->GetXTargetAutoMgr()->clear(); - // c->RemoveAutoXTargets(); - // } - - // c->SetXTargetAutoMgr(GetXTargetAutoMgr()); - - // if (!c->GetXTargetAutoMgr()->empty()) - // c->SetDirtyAutoHaters(); - // } - //} - -// Raid* raid_update = nullptr; -// raid_update = b->GetOwner()->GetRaid(); -// if (raid_update) { -// raid_update->SendHPManaEndPacketsTo(b->GetOwner()->CastToClient()); -// raid_update->SendHPManaEndPacketsFrom(b->GetOwner()->CastToClient()); -// } auto pack = new ServerPacket(ServerOP_RaidAdd, sizeof(ServerRaidGeneralAction_Struct)); ServerRaidGeneralAction_Struct* rga = (ServerRaidGeneralAction_Struct*)pack->pBuffer; @@ -250,6 +220,7 @@ void Raid::AddBot(Bot* b, uint32 group, bool rleader, bool groupleader, bool loo worldserver.SendPacket(pack); safe_delete(pack); } +#endif void Raid::RemoveMember(const char *characterName) @@ -1063,7 +1034,7 @@ void Raid::SendRaidAdd(const char *who, Client *to) for(int x = 0; x < MAX_RAID_MEMBERS; x++) { - if(strcmp(members[x].membername, who) == 0)// || !members[x].SentToBotOwner) //Mitch + if(strcmp(members[x].membername, who) == 0) { auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidAddMember_Struct)); RaidAddMember_Struct *ram = (RaidAddMember_Struct*)outapp->pBuffer; @@ -1212,8 +1183,10 @@ void Raid::SendBulkRaid(Client *to) if(!to) return; +#ifdef BOTS if (members[GetPlayerIndex(to)].IsBot) return; +#endif for(int x = 0; x < MAX_RAID_MEMBERS; x++) { @@ -1228,7 +1201,11 @@ void Raid::QueuePacket(const EQApplicationPacket *app, bool ack_req) { for(int x = 0; x < MAX_RAID_MEMBERS; x++) { +#ifdef BOTS if(members[x].member && !members[x].IsBot) +#else + if(members[x].member) +#endif { members[x].member->QueuePacket(app, ack_req); } @@ -1238,9 +1215,10 @@ void Raid::QueuePacket(const EQApplicationPacket *app, bool ack_req) void Raid::SendMakeLeaderPacket(const char *who) //30 { - //if (entity_list.GetBotByBotName(who) && IsRaidMemberBot(entity_list.GetBotByBotName(who)->CastToClient())) +#ifdef BOTS if (entity_list.GetBotByBotName(who) && members[GetPlayerIndex(who)].IsBot) return; +#endif auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); RaidLeadershipUpdate_Struct *rg = (RaidLeadershipUpdate_Struct*)outapp->pBuffer; @@ -1257,8 +1235,10 @@ void Raid::SendMakeLeaderPacketTo(const char *who, Client *to) if(!to) return; +#ifdef BOTS if (members[GetPlayerIndex(who)].IsBot) return; +#endif auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); RaidLeadershipUpdate_Struct *rg = (RaidLeadershipUpdate_Struct*)outapp->pBuffer; @@ -1290,8 +1270,10 @@ void Raid::SendGroupUpdate(Client *to) if(!to) return; +#ifdef BOTS if (members[GetPlayerIndex(to)].IsBot) return; +#endif auto outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupUpdate2_Struct)); GroupUpdate2_Struct* gu = (GroupUpdate2_Struct*)outapp->pBuffer; @@ -1481,8 +1463,10 @@ void Raid::SendRaidMOTDToWorld() void Raid::SendGroupLeadershipAA(Client *c, uint32 gid) { +#ifdef BOTS if (members[GetPlayerIndex(c)].IsBot) return; +#endif auto outapp = new EQApplicationPacket(OP_RaidUpdate, sizeof(RaidLeadershipUpdate_Struct)); RaidLeadershipUpdate_Struct *rlaa = (RaidLeadershipUpdate_Struct *)outapp->pBuffer; @@ -1499,45 +1483,25 @@ void Raid::SendGroupLeadershipAA(Client *c, uint32 gid) void Raid::SendGroupLeadershipAA(uint32 gid) { for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) +#ifdef BOTS if (members[i].member && members[i].GroupNumber == gid && !members[i].IsBot) +#else + if (members[i].member && members[i].GroupNumber == gid) +#endif SendGroupLeadershipAA(members[i].member, gid); } void Raid::SendAllRaidLeadershipAA() { for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) +#ifdef BOTS if (members[i].member && !members[i].IsBot) - SendGroupLeadershipAA(members[i].member, members[i].GroupNumber); +#else + if (members[i].member) +#endif + SendGroupLeadershipAA(members[i].member, members[i].GroupNumber); } -bool Raid::IsRaidMemberBot(Client* client) -{ - std::string query = StringFormat("SELECT mob_type FROM vw_bot_character_mobs WHERE name = '%s' LIMIT 1", - client->GetCleanName()); - auto results = database.QueryDatabase(query); - - if (!results.Success()) - return true; //return true to avoid sending a packet to a non-existant client as a failsafe - - if (results.RowCount() == 0) { - LogError( - "Error getting B/C info for character name [{}] for IsRaidMemberBot. Error [{}]", - client->GetCleanName(), - results.ErrorMessage().c_str() - ); - return true;//return true to avoid sending a packet to a non-existant client as a failsafe - } - - auto row = results.begin(); - const char* c = "C"; - const char* b = "B"; - if (strcmp(row[0], c) == 0) { - return false; // client is a client - } - else if (strcmp(row[0], b) == 0) { - return true; // client is actually a bot - } -} void Raid::LockRaid(bool lockFlag) { @@ -1604,11 +1568,18 @@ bool Raid::LearnMembers() { memset(members, 0, (sizeof(RaidMember)*MAX_RAID_MEMBERS)); +#ifdef BOTS std::string query = StringFormat("SELECT name, groupid, _class, level, " "isgroupleader, israidleader, islooter, isbot " "FROM raid_members WHERE raidid = %lu", (unsigned long)GetID()); - auto results = database.QueryDatabase(query); +#else + std::string query = StringFormat("SELECT name, groupid, _class, level, " + "isgroupleader, israidleader, islooter " + "FROM raid_members WHERE raidid = %lu", + (unsigned long)GetID()); +#endif + auto results = database.QueryDatabase(query); if (!results.Success()) return false; @@ -1636,8 +1607,10 @@ bool Raid::LearnMembers() members[index].IsGroupLeader = atoi(row[4]); members[index].IsRaidLeader = atoi(row[5]); members[index].IsLooter = atoi(row[6]); - members[index].IsBot = atoi(row[7]); //Mitch - ++index; +#ifdef BOTS + members[index].IsBot = atoi(row[7]); +#endif + ++index; } return true; @@ -1653,21 +1626,28 @@ void Raid::VerifyRaid() else{ Client *c = entity_list.GetClientByName(members[x].membername); #ifdef BOTS - Bot* b = entity_list.GetBotByBotName(members[x].membername); //Mitch + Bot* b = entity_list.GetBotByBotName(members[x].membername); #endif if(c){ members[x].member = c; +#ifdef BOTS members[x].IsBot = false; +#endif } #ifdef BOTS else if(b){ - members[x].member = b->CastToClient(); //Raid requires client* we are forcing it here to be a BOT + //Raid requires client* we are forcing it here to be a BOT. Care is needed here as any client function that + //does not exist within the Bot Class will likely corrupt memory for the member object. Good practice to test the IsBot + //attribute before calling a client function or casting to client. + members[x].member = b->CastToClient(); members[x].IsBot = true; //Used to identify those members who are Bots } #endif else { members[x].member = nullptr; +#ifdef BOTS members[x].IsBot = false; +#endif } } if(members[x].IsRaidLeader){ @@ -1720,7 +1700,11 @@ void Raid::SendHPManaEndPacketsTo(Client *client) EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); for(int x = 0; x < MAX_RAID_MEMBERS; x++) { +#ifdef BOTS if(members[x].member && !members[x].IsBot) { +#else + if (members[x].member) { +#endif if((members[x].member != client) && (members[x].GroupNumber == group_id)) { members[x].member->CreateHPPacket(&hp_packet); @@ -1762,7 +1746,11 @@ void Raid::SendHPManaEndPacketsFrom(Mob *mob) mob->CreateHPPacket(&hpapp); for(int x = 0; x < MAX_RAID_MEMBERS; x++) { +#ifdef BOTS if(members[x].member && !members[x].IsBot) { +#else + if (members[x].member) { +#endif if(!mob->IsClient() || ((members[x].member != mob->CastToClient()) && (members[x].GroupNumber == group_id))) { members[x].member->QueuePacket(&hpapp, false); if (members[x].member->ClientVersion() >= EQ::versions::ClientVersion::SoD) { @@ -1795,7 +1783,11 @@ void Raid::SendManaPacketFrom(Mob *mob) EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); for (int x = 0; x < MAX_RAID_MEMBERS; x++) { +#ifdef BOTS if (members[x].member && !members[x].IsBot) { +#else + if (members[x].member) { +#endif if (!mob->IsClient() || ((members[x].member != mob->CastToClient()) && (members[x].GroupNumber == group_id))) { if (members[x].member->ClientVersion() >= EQ::versions::ClientVersion::SoD) { outapp.SetOpcode(OP_MobManaUpdate); @@ -1822,7 +1814,11 @@ void Raid::SendEndurancePacketFrom(Mob *mob) EQApplicationPacket outapp(OP_MobManaUpdate, sizeof(MobManaUpdate_Struct)); for (int x = 0; x < MAX_RAID_MEMBERS; x++) { +#ifdef BTOS if (members[x].member && !members[x].IsBot) { +#else + if (members[x].member) { +#endif if (!mob->IsClient() || ((members[x].member != mob->CastToClient()) && (members[x].GroupNumber == group_id))) { if (members[x].member->ClientVersion() >= EQ::versions::ClientVersion::SoD) { outapp.SetOpcode(OP_MobEnduranceUpdate); @@ -1929,11 +1925,15 @@ void Raid::CheckGroupMentor(uint32 group_id, Client *c) void Raid::SetDirtyAutoHaters() { for (int i = 0; i < MAX_RAID_MEMBERS; ++i) +#ifdef BOTS if (members[i].member && members[i].IsBot) { members[i].member->CastToBot()->SetDirtyAutoHaters(); } else if (members[i].member && !members[i].IsBot) +#else + if (members[i].member) +#endif { members[i].member->SetDirtyAutoHaters(); } @@ -1955,9 +1955,10 @@ void Raid::QueueClients(Mob *sender, const EQApplicationPacket *app, bool ack_re if (!members[i].member->IsClient()) continue; +#ifdef BOTS if (members[i].IsBot) continue; - +#endif if (ignore_sender && members[i].member == sender) continue; @@ -2020,6 +2021,7 @@ bool Raid::DoesAnyMemberHaveExpeditionLockout( return Expedition::HasLockoutByCharacterName(raid_member.membername, expedition_name, event_name); }); } +#ifdef BOTS Mob* Raid::GetRaidMainAssistOneByName(const char* name) { Raid* raid = entity_list.GetRaidByBotName(name); @@ -2032,3 +2034,4 @@ Mob* Raid::GetRaidMainAssistOneByName(const char* name) } return nullptr; } +#endif diff --git a/zone/raids.h b/zone/raids.h index cfaea07e7..141fd17ca 100644 --- a/zone/raids.h +++ b/zone/raids.h @@ -90,13 +90,7 @@ struct RaidMember{ bool IsLooter; #ifdef BOTS bool IsBot = false; - bool IsGroupHealer; - bool IsRaidSlower; - bool IsRaidMainAssistOne; - bool IsRaidMainAssistTwo; - bool IsRaidMainTank; - bool IsRaidOffTankOne; - bool IsRaidOffTankTwo; + bool IsRaidMainAssistOne = false; #endif }; @@ -123,10 +117,9 @@ public: void AddMember(Client *c, uint32 group = 0xFFFFFFFF, bool rleader=false, bool groupleader=false, bool looter=false); #ifdef BOTS - void AddBot(Bot* b, uint32 group = 0xFFFFFFFF, bool rleader=false, bool groupleader=false, bool looter=false); //Mitch - void RaidBotGroupSay(Bot* b, uint8 language, uint8 lang_skill, const char* msg, ...); //Mitch - static Mob* GetRaidMainAssistOneByName(const char* name); - bool IsRaidMemberBot(Client* client); + void AddBot(Bot* b, uint32 group = 0xFFFFFFFF, bool rleader=false, bool groupleader=false, bool looter=false); + void RaidBotGroupSay(Bot* b, uint8 language, uint8 lang_skill, const char* msg, ...); //Not yet implemented + Mob* GetRaidMainAssistOneByName(const char* name); #endif void RemoveMember(const char *c); void DisbandRaid();