Skip to content

Commit

Permalink
NPCBots: Do not set 'player controlled' flag on pets / totems
Browse files Browse the repository at this point in the history
(cherry picked from commit 26d0c7199f8818fb043e8e8c068cfd0543647850)
  • Loading branch information
trickerer committed Aug 15, 2024
1 parent f019bf9 commit 8c9ae31
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/game/AI/NpcBots/bot_shaman_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,7 @@ class shaman_bot : public CreatureScript
summon->SetPvP(me->IsPvP());
summon->SetOwnerGUID(master->GetGUID());
summon->SetControlledByPlayer(!IAmFree());
summon->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
//summon->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
// totem will claim master's summon slot
// free it to avoid conflicts with other shaman bots and master
// if master is a shaman his totem will despawn
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/AI/NpcBots/botmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,9 +1650,11 @@ void BotMgr::CleanupsBeforeBotDelete(Creature* bot)
//bot->SetOwnerGUID(ObjectGuid::Empty);
//_owner->m_Controlled.erase(bot);
bot->SetControlledByPlayer(false);
//bot->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
//bot->RemoveUnitFlag(UNIT_FLAG_PVP_ATTACKABLE);
bot->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
bot->SetCreator(nullptr);
//bot->SetCreatorGUID(ObjectGuid::Empty);

Map* map = bot->FindMap();
if (!map || map->IsDungeon())
Expand Down Expand Up @@ -1812,8 +1814,10 @@ BotAddResult BotMgr::AddBot(Creature* bot)
//ASSERT(!bot->GetOwnerGUID());
//bot->SetOwnerGUID(_owner->GetGUID());
bot->SetCreator(_owner); //needed in case of FFAPVP
//bot->SetCreatorGUID(_owner->GetGUID());
//_owner->m_Controlled.insert(bot);
bot->SetControlledByPlayer(true);
//bot->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
bot->SetByteValue(UNIT_FIELD_BYTES_2, 1, _owner->GetByteValue(UNIT_FIELD_BYTES_2, 1));
bot->SetFaction(_owner->GetFaction());
bot->SetPhaseMask(_owner->GetPhaseMask(), true);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/AI/NpcBots/bpet_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ void bot_pet_ai::IsSummonedBy(WorldObject* summoner)
//myType = petOwner->GetBotAI()->GetAIMiscValue(BOTAI_MISC_PET_TYPE);
//ASSERT(myType);
me->setActive(true);
me->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
//me->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
ASSERT(!me->GetBotAI());
ASSERT(!me->GetBotPetAI());
me->SetBotPetAI(this);
Expand Down

0 comments on commit 8c9ae31

Please sign in to comment.