mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix bot chest looting exploits in ICC and Halls of Stone (#1280)
- Prevent bots from looting Gunship Armory chest in ICC before the event ends (#1162) - Fix bots being able to loot Tribunal Cache in Halls of Stone multiple times (#1200) - Ensure bots do not attempt to loot Deathbringer's Cache in ICC before it is available Three chests (Gunship Armory, Tribunal Cache, Deathbringer's Cache) were tested and now behave as expected: bots will not approach or attempt to loot chests while they are unlootable, even if players move close to them. Closes #1162, #1200
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
#include "GuildMgr.h"
|
||||
#include "BroadcastHelper.h"
|
||||
|
||||
bool LootAction::Execute(Event event)
|
||||
{
|
||||
bool LootAction::Execute(Event /*event*/)
|
||||
{
|
||||
if (!AI_VALUE(bool, "has available loot"))
|
||||
return false;
|
||||
|
||||
@@ -61,7 +61,7 @@ enum ProfessionSpells
|
||||
TAILORING = 3908
|
||||
};
|
||||
|
||||
bool OpenLootAction::Execute(Event event)
|
||||
bool OpenLootAction::Execute(Event /*event*/)
|
||||
{
|
||||
LootObject lootObject = AI_VALUE(LootObject, "loot target");
|
||||
bool result = DoLoot(lootObject);
|
||||
@@ -70,7 +70,6 @@ bool OpenLootAction::Execute(Event event)
|
||||
AI_VALUE(LootObjectStack*, "available loot")->Remove(lootObject.guid);
|
||||
context->GetValue<LootObject>("loot target")->Set(LootObject());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -131,6 +130,14 @@ bool OpenLootAction::DoLoot(LootObject& lootObject)
|
||||
if (go && (go->GetGoState() != GO_STATE_READY))
|
||||
return false;
|
||||
|
||||
// This prevents dungeon chests like Tribunal Chest (Halls of Stone) from being ninja'd by the bots
|
||||
if (go && go->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND))
|
||||
return false;
|
||||
|
||||
// This prevents raid chests like Gunship Armory (ICC) from being ninja'd by the bots
|
||||
if (go && go->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE))
|
||||
return false;
|
||||
|
||||
if (lootObject.skillId == SKILL_MINING)
|
||||
return botAI->HasSkill(SKILL_MINING) ? botAI->CastSpell(MINING, bot) : false;
|
||||
|
||||
@@ -189,7 +196,7 @@ uint32 OpenLootAction::GetOpeningSpell(LootObject& lootObject, GameObject* go)
|
||||
return sPlayerbotAIConfig->openGoSpell;
|
||||
}
|
||||
|
||||
bool OpenLootAction::CanOpenLock(LootObject& lootObject, SpellInfo const* spellInfo, GameObject* go)
|
||||
bool OpenLootAction::CanOpenLock(LootObject& /*lootObject*/, SpellInfo const* spellInfo, GameObject* go)
|
||||
{
|
||||
for (uint8 effIndex = 0; effIndex <= EFFECT_2; effIndex++)
|
||||
{
|
||||
@@ -205,8 +212,6 @@ bool OpenLootAction::CanOpenLock(LootObject& lootObject, SpellInfo const* spellI
|
||||
if (!lockInfo)
|
||||
return false;
|
||||
|
||||
bool reqKey = false; // some locks not have reqs
|
||||
|
||||
for (uint8 j = 0; j < 8; ++j)
|
||||
{
|
||||
switch (lockInfo->Type[j])
|
||||
@@ -369,7 +374,6 @@ bool StoreLootAction::Execute(Event event)
|
||||
uint32 itemcount;
|
||||
uint8 lootslot_type;
|
||||
uint8 itemindex;
|
||||
bool grab = false;
|
||||
|
||||
p >> itemindex;
|
||||
p >> itemid;
|
||||
@@ -506,7 +510,7 @@ bool StoreLootAction::IsLootAllowed(uint32 itemid, PlayerbotAI* botAI)
|
||||
return canLoot;
|
||||
}
|
||||
|
||||
bool ReleaseLootAction::Execute(Event event)
|
||||
bool ReleaseLootAction::Execute(Event /*event*/)
|
||||
{
|
||||
GuidVector gos = context->GetValue<GuidVector>("nearest game objects")->Get();
|
||||
for (ObjectGuid const guid : gos)
|
||||
|
||||
Reference in New Issue
Block a user