From ab345b88470e6e3371d9fd1874f4ea3ae655194b Mon Sep 17 00:00:00 2001 From: ThePenguinMan96 Date: Mon, 4 Aug 2025 17:55:29 -0700 Subject: [PATCH] Changes requested I fixed what was requested of me. Built it, tested it - all functions are working. --- src/strategy/actions/ChatActionContext.h | 8 ++++---- src/strategy/actions/GenericActions.cpp | 3 --- src/strategy/actions/TameAction.cpp | 4 ++-- src/strategy/actions/TameAction.h | 2 +- src/strategy/triggers/GenericTriggers.cpp | 6 ++++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/strategy/actions/ChatActionContext.h b/src/strategy/actions/ChatActionContext.h index 4521292e..cf9d8c51 100644 --- a/src/strategy/actions/ChatActionContext.h +++ b/src/strategy/actions/ChatActionContext.h @@ -193,8 +193,8 @@ public: creators["calc"] = &ChatActionContext::calc; creators["wipe"] = &ChatActionContext::wipe; creators["tame"] = &ChatActionContext::tame; - creators["glyphs"] = &ChatActionContext::glyphs; // Added for custom Glyphs - creators["glyph equip"] = &ChatActionContext::glyph_equip; // Added for custom Glyphs + creators["glyphs"] = &ChatActionContext::glyphs; // Added for custom Glyphs + creators["glyph equip"] = &ChatActionContext::glyph_equip; // Added for custom Glyphs creators["pet"] = &ChatActionContext::pet; creators["pet attack"] = &ChatActionContext::pet_attack; creators["roll"] = &ChatActionContext::roll_action; @@ -305,8 +305,8 @@ private: static Action* calc(PlayerbotAI* ai) { return new TellCalculateItemAction(ai); } static Action* wipe(PlayerbotAI* ai) { return new WipeAction(ai); } static Action* tame(PlayerbotAI* botAI) { return new TameAction(botAI); } - static Action* glyphs(PlayerbotAI* botAI) { return new TellGlyphsAction(botAI); } // Added for custom Glyphs - static Action* glyph_equip(PlayerbotAI* ai) { return new EquipGlyphsAction(ai); } // Added for custom Glyphs + static Action* glyphs(PlayerbotAI* botAI) { return new TellGlyphsAction(botAI); } // Added for custom Glyphs + static Action* glyph_equip(PlayerbotAI* ai) { return new EquipGlyphsAction(ai); } // Added for custom Glyphs static Action* pet(PlayerbotAI* botAI) { return new PetAction(botAI); } static Action* pet_attack(PlayerbotAI* botAI) { return new PetAction(botAI, "attack"); } static Action* roll_action(PlayerbotAI* botAI) { return new RollAction(botAI); } diff --git a/src/strategy/actions/GenericActions.cpp b/src/strategy/actions/GenericActions.cpp index 21120343..ae8010e1 100644 --- a/src/strategy/actions/GenericActions.cpp +++ b/src/strategy/actions/GenericActions.cpp @@ -156,9 +156,6 @@ bool PetAttackAction::Execute(Event event) bool SetPetStanceAction::Execute(Event /*event*/) { - // Get the bot player object from the AI - Player* bot = botAI->GetBot(); - // Prepare a list to hold all controlled pet and guardian creatures std::vector targets; diff --git a/src/strategy/actions/TameAction.cpp b/src/strategy/actions/TameAction.cpp index 2a3c36db..8446c24c 100644 --- a/src/strategy/actions/TameAction.cpp +++ b/src/strategy/actions/TameAction.cpp @@ -108,7 +108,7 @@ bool TameAction::Execute(Event event) // Handle "tame abandon" command to give up your current pet if (mode == "abandon") { - return abandonPet(); + return AbandonPet(); } // Try to process the command based on mode and value @@ -476,7 +476,7 @@ bool TameAction::CreateAndSetPet(uint32 creatureEntry) return true; } -bool TameAction::abandonPet() +bool TameAction::AbandonPet() { // Get the bot player and its current pet (if any) Player* bot = botAI->GetBot(); diff --git a/src/strategy/actions/TameAction.h b/src/strategy/actions/TameAction.h index daac1755..018ba5a0 100644 --- a/src/strategy/actions/TameAction.h +++ b/src/strategy/actions/TameAction.h @@ -25,7 +25,7 @@ private: bool SetPetByFamily(const std::string& family); bool RenamePet(const std::string& newName); bool CreateAndSetPet(uint32 creatureEntry); - bool abandonPet(); + bool AbandonPet(); std::string lastPetName; uint32 lastPetId = 0; diff --git a/src/strategy/triggers/GenericTriggers.cpp b/src/strategy/triggers/GenericTriggers.cpp index a907085b..5f1935a9 100644 --- a/src/strategy/triggers/GenericTriggers.cpp +++ b/src/strategy/triggers/GenericTriggers.cpp @@ -692,9 +692,11 @@ bool NewPetTrigger::IsActive() { // Get the bot player object from the AI Player* bot = botAI->GetBot(); + if (!bot) + return false; // Try to get the current pet; initialize guardian and GUID to null/empty - Pet* pet = bot ? bot->GetPet() : nullptr; + Pet* pet = bot->GetPet(); Guardian* guardian = nullptr; ObjectGuid currentPetGuid = ObjectGuid::Empty; @@ -706,7 +708,7 @@ bool NewPetTrigger::IsActive() else { // If no pet, try to get a guardian pet and its GUID - guardian = bot ? bot->GetGuardianPet() : nullptr; + guardian = bot->GetGuardianPet(); if (guardian) currentPetGuid = guardian->GetGUID(); }