From 5e475ad8cdfae219169bcbc70ccc9f889eceab08 Mon Sep 17 00:00:00 2001 From: neckkola <65987027+neckkola@users.noreply.github.com> Date: Tue, 18 Jan 2022 22:33:09 -0400 Subject: [PATCH] End of Day Jan 18 --- zone/bot.cpp | 32 +++++++++++++++++++++----------- zone/bot_raid.cpp | 17 +++++++++++------ zone/botspellsai.cpp | 2 +- zone/client_packet.cpp | 7 ++++++- zone/entity.cpp | 7 ++++--- zone/entity.h | 2 +- 6 files changed, 44 insertions(+), 23 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index d8685eb83..dbf8ddd9c 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2300,8 +2300,8 @@ bool Bot::Process() } // Bot AI - uint32 raid = entity_list.GetRaidByBot(this)->GetID(); - if (raid >= 0) + Raid* bot_raid = entity_list.GetRaidByBotName(this->GetName()); + if (bot_raid) AI_Process_Raid(); else AI_Process(); @@ -8388,7 +8388,7 @@ void Bot::Camp(bool databaseSave) { RemoveBotFromGroup(this, GetGroup()); //Mitch - Raid* bot_raid = entity_list.GetRaidByBot(this); + Raid* bot_raid = entity_list.GetRaidByBotName(this->GetName()); if (bot_raid) bot_raid->RemoveMember(this->GetName()); @@ -8405,9 +8405,14 @@ void Bot::Camp(bool databaseSave) { } void Bot::Zone() { - if(HasGroup()) + Raid* raid = entity_list.GetRaidByBotName(this->GetName()); + if (raid) { + raid->MemberZoned(this->CastToClient()); + } + else if (HasGroup()) { GetGroup()->MemberZoned(this); - + } + Save(); Depop(); } @@ -8656,7 +8661,11 @@ void Bot::ProcessClientZoneChange(Client* botOwner) { Bot* tempBot = *itr; if(tempBot) { - if(tempBot->HasGroup()) { + Raid* raid = entity_list.GetRaidByBotName(tempBot->GetName()); + if (raid) { + tempBot->Zone(); + } + else if(tempBot->HasGroup()) { Group* g = tempBot->GetGroup(); if(g && g->IsGroupMember(botOwner)) { if(botOwner && botOwner->IsClient()) { @@ -10454,7 +10463,8 @@ void Bot::ProcessRaidInvite(Bot* invitee, Client* invitor) { entity_list.AddRaid(raid); raid->SetRaidDetails(); raid->SendRaidCreate(invitor); - raid->SendMakeGroupLeaderPacketTo(raid->leadername, invitor); + raid->SetLeader(invitor); //Added Jan 18 + raid->SendMakeLeaderPacketTo(raid->leadername, invitor); if (g_invitor) { @@ -10480,9 +10490,9 @@ void Bot::ProcessRaidInvite(Bot* invitee, Client* invitor) { c = g_invitor->members[x]->CastToClient(); if (x == 0) { raid->SendRaidCreate(c); - raid->SendMakeLeaderPacketTo(raid->leadername, c); - raid->AddMember(c, 0, false, true, false); - raid->SetGroupLeader(c->GetName()); + raid->SendMakeLeaderPacketTo(invitor->GetName(), c); + raid->AddMember(c, 0, true, true, true); + //raid->SetGroupLeader(c->GetName()); //Mitch Jan 18 //raid->GroupUpdate(0, true); if (raid->IsLocked()) { raid->SendRaidLockTo(c); @@ -10572,7 +10582,7 @@ void Bot::ProcessRaidInvite(Bot* invitee, Client* invitor) { { //Second, add the single invitor raid->SendRaidCreate(invitor); - raid->SendMakeLeaderPacketTo(raid->leadername, invitor); + raid->SendMakeLeaderPacketTo(invitor->GetName(), invitor); //Mitch Jan 18 raid->AddMember(invitor, 0xFFFFFFFF, true, false, true); if (raid->IsLocked()) { raid->SendRaidLockTo(invitor); diff --git a/zone/bot_raid.cpp b/zone/bot_raid.cpp index ef85d9c3e..808c8f138 100644 --- a/zone/bot_raid.cpp +++ b/zone/bot_raid.cpp @@ -52,7 +52,7 @@ void Bot::AI_Process_Raid() #define PASSIVE (GetBotStance() == EQ::constants::stancePassive) #define NOT_PASSIVE (GetBotStance() != EQ::constants::stancePassive) - Raid* raid = entity_list.GetRaidByBot(this); + Raid* raid = entity_list.GetRaidByBotName(this->GetName()); Client* bot_owner = (GetBotOwner() && GetBotOwner()->IsClient() ? GetBotOwner()->CastToClient() : nullptr); uint32 r_group = raid->GetGroup(GetName()); @@ -75,11 +75,11 @@ void Bot::AI_Process_Raid() // We also need a leash owner and follow mob (subset of primary AI criteria) Client* leash_owner = nullptr; - if (r_group >= 0) { - leash_owner = raid->GetGroupLeader(r_group)->CastToClient(); + if (r_group < 12) { + leash_owner = raid->GetGroupLeader(r_group); } else { - leash_owner = raid->GetLeader(); + leash_owner = bot_owner; } if (!leash_owner) { @@ -94,7 +94,12 @@ void Bot::AI_Process_Raid() follow_mob = leash_owner; SetFollowID(leash_owner->GetID()); } + + if (send_hp_update_timer.Check(false)) { + raid->SendHPManaEndPacketsFrom(this); + + } // Berserk updates should occur if primary AI criteria are met if (GetClass() == WARRIOR || GetClass() == BERSERKER) { @@ -1531,7 +1536,7 @@ bool Bot::AICastSpell_Raid(Mob* tar, uint8 iChance, uint32 iSpellTypes) { // Bot AI Raid - Raid* raid = entity_list.GetRaidByBot(this); + Raid* raid = entity_list.GetRaidByBotName(this->GetName()); if (!raid) return false; @@ -2592,7 +2597,7 @@ void Raid::RaidBotGroupSay(Bot* b, uint8 language, uint8 lang_skill, const char* uint8 Bot::GetNumberNeedingHealedInRaidGroup(uint8 hpr, bool includePets) { uint8 needHealed = 0; Raid* raid = nullptr; - raid = entity_list.GetRaidByBot(this); + raid = entity_list.GetRaidByBotName(this->GetName()); uint32 r_group = raid->GetGroup(this->GetName()); std::vector raid_group_members = raid->GetRaidGroupMembers(r_group); for (RaidMember iter : raid_group_members) { diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index f4f76f310..5b0288485 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -32,7 +32,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes) { // Bot AI - Raid* raid = entity_list.GetRaidByBot(this); + Raid* raid = entity_list.GetRaidByBotName(this->GetName()); if (raid) { return AICastSpell_Raid(tar, iChance, iSpellTypes); //return true; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0b901ef0b..7e7d3b60e 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6988,7 +6988,12 @@ void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) } #ifdef BOTS else if (Invitee->IsBot()) { - Bot::ProcessBotGroupInvite(this, std::string(Invitee->GetName())); + Client* inviter = entity_list.GetClientByName(gis->inviter_name); + Bot* invitee = entity_list.GetBotByBotName(gis->invitee_name); + if (inviter->IsRaidGrouped()) + Bot::ProcessRaidInvite(invitee, inviter); + else + Bot::ProcessBotGroupInvite(this, std::string(Invitee->GetName())); } #endif } diff --git a/zone/entity.cpp b/zone/entity.cpp index f301f6726..cc78fe6ca 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2048,15 +2048,16 @@ Raid* EntityList::GetRaidByClient(Client* client) return nullptr; } -Raid* EntityList::GetRaidByBot(Bot* bot) +Raid* EntityList::GetRaidByBotName(const char* name) { + std::list::iterator iterator; iterator = raid_list.begin(); while (iterator != raid_list.end()) { for (auto& member : (*iterator)->members) { - if (member.member) { - if (member.member == bot->CastToClient()) { + if (member.membername) { + if (strcmp(member.membername, name) == 0) { //client->p_raid_instance = *iterator; return *iterator; } diff --git a/zone/entity.h b/zone/entity.h index 0bbc298bc..45f588ccf 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -198,7 +198,7 @@ public: Raid *GetRaidByID(uint32 id); Raid *GetRaidByLeaderName(const char *leader); #ifdef BOTS - Raid* GetRaidByBot(Bot* bot); + Raid* GetRaidByBotName(const char* name); #endif Corpse *GetCorpseByOwner(Client* client);