mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-20 10:00:02 +01:00
Warnings PR 1: Event warnings and headers (#2106)
# Pull Request
This is the first in a series of PRs intended to eliminate warnings in
the module. The design intent is to eliminate the calling event when not
needed in the body of the function. Based off of SmashingQuasars work.
---
## How to Test the Changes
- Step-by-step instructions to test the change
- Any required setup (e.g. multiple players, bots, specific
configuration)
- Expected behavior and how to verify it
## Complexity & Impact
- Does this change add new decision branches?
- [x] No
- [ ] Yes (**explain below**)
- Does this change increase per-bot or per-tick processing?
- [x] No
- [ ] Yes (**describe and justify impact**)
- Could this logic scale poorly under load?
- [x] No
- [ ] Yes (**explain why**)
---
## Defaults & Configuration
- Does this change modify default bot behavior?
- [x] No
- [ ] Yes (**explain why**)
If this introduces more advanced or AI-heavy logic:
- [ ] Lightweight mode remains the default
- [ ] More complex behavior is optional and thereby configurable
---
## AI Assistance
- Was AI assistance (e.g. ChatGPT or similar tools) used while working
on this change?
- [x] No
- [ ] Yes (**explain below**)
---
## Final Checklist
- [x] Stability is not compromised
- [x] Performance impact is understood, tested, and acceptable
- [x] Added logic complexity is justified and explained
- [x] Documentation updated if needed
---
## Notes for Reviewers
Anything that significantly improves realism at the cost of stability or
performance should be carefully discussed
before merging.
---------
Co-authored-by: bashermens <31279994+hermensbas@users.noreply.github.com>
This commit is contained in:
parent
80aeeda0e8
commit
441f9f7552
@ -6,9 +6,9 @@
|
|||||||
#include "AcceptBattlegroundInvitationAction.h"
|
#include "AcceptBattlegroundInvitationAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool AcceptBgInvitationAction::Execute(Event event)
|
bool AcceptBgInvitationAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint8 type = 0; // arenatype if arena
|
uint8 type = 0; // arenatype if arena
|
||||||
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||||
@ -18,9 +18,9 @@ bool AcceptBgInvitationAction::Execute(Event event)
|
|||||||
|
|
||||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||||
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
||||||
// packet << bgTypeId_ << action;
|
|
||||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||||
|
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ bool AddLootAction::Execute(Event event)
|
|||||||
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddAllLootAction::Execute(Event event)
|
bool AddAllLootAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ bool ReachAreaTriggerAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AreaTriggerAction::Execute(Event event)
|
bool AreaTriggerAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,20 @@
|
|||||||
#include "AutoMaintenanceOnLevelupAction.h"
|
#include "AutoMaintenanceOnLevelupAction.h"
|
||||||
|
|
||||||
#include "GuildMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
|
|
||||||
bool AutoMaintenanceOnLevelupAction::Execute(Event event)
|
bool AutoMaintenanceOnLevelupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
AutoPickTalents();
|
AutoPickTalents();
|
||||||
AutoLearnSpell();
|
AutoLearnSpell();
|
||||||
AutoUpgradeEquip();
|
AutoUpgradeEquip();
|
||||||
AutoTeleportForLevel();
|
AutoTeleportForLevel();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,9 +13,8 @@
|
|||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PositionValue.h"
|
#include "PositionValue.h"
|
||||||
#include "UpdateTime.h"
|
|
||||||
|
|
||||||
bool BGJoinAction::Execute(Event event)
|
bool BGJoinAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 queueType = AI_VALUE(uint32, "bg type");
|
uint32 queueType = AI_VALUE(uint32, "bg type");
|
||||||
if (!queueType) // force join to fill bg
|
if (!queueType) // force join to fill bg
|
||||||
@ -653,7 +652,7 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BGLeaveAction::Execute(Event event)
|
bool BGLeaveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
||||||
return false;
|
return false;
|
||||||
@ -1064,7 +1063,7 @@ bool BGStatusAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BGStatusCheckAction::Execute(Event event)
|
bool BGStatusCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsBeingTeleported())
|
if (bot->IsBeingTeleported())
|
||||||
return false;
|
return false;
|
||||||
@ -1080,7 +1079,7 @@ bool BGStatusCheckAction::Execute(Event event)
|
|||||||
|
|
||||||
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||||
|
|
||||||
bool BGStrategyCheckAction::Execute(Event event)
|
bool BGStrategyCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
||||||
;
|
;
|
||||||
|
|||||||
@ -1557,7 +1557,7 @@ bool BGTactics::eyJumpDown()
|
|||||||
//
|
//
|
||||||
// actual bg tactics below
|
// actual bg tactics below
|
||||||
//
|
//
|
||||||
bool BGTactics::Execute(Event event)
|
bool BGTactics::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Battleground* bg = bot->GetBattleground();
|
Battleground* bg = bot->GetBattleground();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
@ -4249,7 +4249,7 @@ bool BGTactics::IsLockedInsideKeep()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArenaTactics::Execute(Event event)
|
bool ArenaTactics::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->InBattleground())
|
if (!bot->InBattleground())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,7 +18,7 @@ bool BossFireResistanceAction::isUseful()
|
|||||||
return bossFireResistanceTrigger.IsActive();
|
return bossFireResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossFireResistanceAction::Execute(Event event)
|
bool BossFireResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinFireResistanceStrategy paladinFireResistanceStrategy(botAI);
|
PaladinFireResistanceStrategy paladinFireResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFireResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFireResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@ -32,7 +32,7 @@ bool BossFrostResistanceAction::isUseful()
|
|||||||
return bossFrostResistanceTrigger.IsActive();
|
return bossFrostResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossFrostResistanceAction::Execute(Event event)
|
bool BossFrostResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinFrostResistanceStrategy paladinFrostResistanceStrategy(botAI);
|
PaladinFrostResistanceStrategy paladinFrostResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFrostResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFrostResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@ -46,7 +46,7 @@ bool BossNatureResistanceAction::isUseful()
|
|||||||
return bossNatureResistanceTrigger.IsActive();
|
return bossNatureResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossNatureResistanceAction::Execute(Event event)
|
bool BossNatureResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
HunterNatureResistanceStrategy hunterNatureResistanceStrategy(botAI);
|
HunterNatureResistanceStrategy hunterNatureResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@ -60,7 +60,7 @@ bool BossShadowResistanceAction::isUseful()
|
|||||||
return bossShadowResistanceTrigger.IsActive();
|
return bossShadowResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossShadowResistanceAction::Execute(Event event)
|
bool BossShadowResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
|
|||||||
@ -7,12 +7,14 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool CancelChannelAction::Execute(Event event)
|
bool CancelChannelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||||
{
|
{
|
||||||
bot->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
bot->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -334,7 +334,7 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
|
|||||||
return botAI->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
|
return botAI->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisEnchantRandomItemAction::Execute(Event event)
|
bool DisEnchantRandomItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::vector<Item*> items =
|
std::vector<Item*> items =
|
||||||
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||||
|
|||||||
@ -10,9 +10,9 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "AiObjectContext.h"
|
#include "AiObjectContext.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
|
||||||
bool ChangeTalentsAction::Execute(Event event)
|
bool ChangeTalentsAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
@ -368,11 +368,11 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
|||||||
// return nullptr;
|
// return nullptr;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
bool AutoSetTalentsAction::Execute(Event event)
|
bool AutoSetTalentsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig.autoPickTalents || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!PlayerbotAIConfig::instance().autoPickTalents || !RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bot->GetFreeTalentPoints() <= 0)
|
if (bot->GetFreeTalentPoints() <= 0)
|
||||||
|
|||||||
@ -42,7 +42,7 @@ void PositionsResetAction::SetStayPosition(float x, float y, float z)
|
|||||||
posMap["stay"] = pos;
|
posMap["stay"] = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FollowChatShortcutAction::Execute(Event event)
|
bool FollowChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -116,7 +116,7 @@ bool FollowChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StayChatShortcutAction::Execute(Event event)
|
bool StayChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -133,7 +133,7 @@ bool StayChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveFromGroupChatShortcutAction::Execute(Event event)
|
bool MoveFromGroupChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -148,7 +148,7 @@ bool MoveFromGroupChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeChatShortcutAction::Execute(Event event)
|
bool FleeChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -171,7 +171,7 @@ bool FleeChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GoawayChatShortcutAction::Execute(Event event)
|
bool GoawayChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -188,7 +188,7 @@ bool GoawayChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GrindChatShortcutAction::Execute(Event event)
|
bool GrindChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -204,7 +204,7 @@ bool GrindChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TankAttackChatShortcutAction::Execute(Event event)
|
bool TankAttackChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -224,7 +224,7 @@ bool TankAttackChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaxDpsChatShortcutAction::Execute(Event event)
|
bool MaxDpsChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@ -241,7 +241,7 @@ bool MaxDpsChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BwlChatShortcutAction::Execute(Event event)
|
bool BwlChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
|
|||||||
@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildTaskMgr.h"
|
#include "GuildTaskMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool CheckMailAction::Execute(Event event)
|
bool CheckMailAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p;
|
WorldPacket p;
|
||||||
bot->GetSession()->HandleQueryNextMailTime(p);
|
bot->GetSession()->HandleQueryNextMailTime(p);
|
||||||
@ -28,7 +29,7 @@ bool CheckMailAction::Execute(Event event)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 account = owner->GetSession()->GetAccountId();
|
uint32 account = owner->GetSession()->GetAccountId();
|
||||||
if (sPlayerbotAIConfig.IsInRandomAccountList(account))
|
if (PlayerbotAIConfig::instance().IsInRandomAccountList(account))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ProcessMail(mail, owner, trans);
|
ProcessMail(mail, owner, trans);
|
||||||
|
|||||||
@ -6,12 +6,15 @@
|
|||||||
#include "CheckValuesAction.h"
|
#include "CheckValuesAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "TravelNode.h"
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
||||||
|
|
||||||
bool CheckValuesAction::Execute(Event event)
|
bool CheckValuesAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "BattlegroundMgr.h"
|
|
||||||
#include "BudgetValues.h"
|
#include "BudgetValues.h"
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
@ -14,7 +13,6 @@
|
|||||||
#include "GuildCreateActions.h"
|
#include "GuildCreateActions.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RpgSubActions.h"
|
#include "RpgSubActions.h"
|
||||||
#include "Util.h"
|
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "PossibleRpgTargetsValue.h"
|
#include "PossibleRpgTargetsValue.h"
|
||||||
|
|
||||||
@ -112,7 +110,7 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP)
|
|||||||
return floor((maxRelevance - 1.0) * 1000.0f);
|
return floor((maxRelevance - 1.0) * 1000.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChooseRpgTargetAction::Execute(Event event)
|
bool ChooseRpgTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
//TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
//TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
||||||
Player* master = botAI->GetMaster();
|
Player* master = botAI->GetMaster();
|
||||||
|
|||||||
@ -30,7 +30,7 @@ bool AttackEnemyFlagCarrierAction::isUseful()
|
|||||||
PlayerHasFlag::IsCapturingFlag(bot);
|
PlayerHasFlag::IsCapturingFlag(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DropTargetAction::Execute(Event event)
|
bool DropTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
||||||
if (target && target->isDead())
|
if (target && target->isDead())
|
||||||
@ -137,7 +137,7 @@ bool DpsAssistAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AttackRtiTargetAction::Execute(Event event)
|
bool AttackRtiTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* rtiTarget = AI_VALUE(Unit*, "rti target");
|
Unit* rtiTarget = AI_VALUE(Unit*, "rti target");
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool ChooseTravelTargetAction::Execute(Event event)
|
bool ChooseTravelTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); //not used, line marked for removal.
|
// Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); //not used, line marked for removal.
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,11 @@
|
|||||||
|
|
||||||
#include "ChooseTravelTargetAction.h"
|
#include "ChooseTravelTargetAction.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "TravelMgr.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "SpellMgr.h"
|
||||||
|
#include "Spell.h"
|
||||||
|
|
||||||
bool DebugAction::Execute(Event event)
|
bool DebugAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,15 +6,19 @@
|
|||||||
#include "DelayAction.h"
|
#include "DelayAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
#include "PlayerbotAIConfig.h"
|
||||||
|
|
||||||
bool DelayAction::Execute(Event event)
|
bool DelayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 delay = sPlayerbotAIConfig.passiveDelay + sPlayerbotAIConfig.globalCoolDown;
|
const uint32 delay = PlayerbotAIConfig::instance().passiveDelay + PlayerbotAIConfig::instance().globalCoolDown;
|
||||||
|
|
||||||
botAI->SetNextCheckDelay(delay);
|
botAI->SetNextCheckDelay(delay);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DelayAction::isUseful() { return !botAI->AllowActivity(ALL_ACTIVITY); }
|
bool DelayAction::isUseful()
|
||||||
|
{
|
||||||
|
return !botAI->AllowActivity(ALL_ACTIVITY);
|
||||||
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ void DestroyItemAction::DestroyItem(FindItemVisitor* visitor)
|
|||||||
|
|
||||||
bool SmartDestroyItemAction::isUseful() { return !botAI->HasActivePlayerMaster(); }
|
bool SmartDestroyItemAction::isUseful() { return !botAI->HasActivePlayerMaster(); }
|
||||||
|
|
||||||
bool SmartDestroyItemAction::Execute(Event event)
|
bool SmartDestroyItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint8 bagSpace = AI_VALUE(uint8, "bag space");
|
uint8 bagSpace = AI_VALUE(uint8, "bag space");
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include "EmoteAction.h"
|
#include "EmoteAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
@ -787,7 +786,7 @@ bool EmoteAction::isUseful()
|
|||||||
return time(nullptr) >= lastEmote;
|
return time(nullptr) >= lastEmote;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TalkAction::Execute(Event event)
|
bool TalkAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = botAI->GetUnit(AI_VALUE(ObjectGuid, "talk target"));
|
Unit* target = botAI->GetUnit(AI_VALUE(ObjectGuid, "talk target"));
|
||||||
if (!target)
|
if (!target)
|
||||||
|
|||||||
@ -406,7 +406,7 @@ bool EquipUpgradesTriggeredAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipUpgradeAction::Execute(Event event)
|
bool EquipUpgradeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
ItemIds items = SelectInventoryItemsToEquip();
|
ItemIds items = SelectInventoryItemsToEquip();
|
||||||
EquipItems(items);
|
EquipItems(items);
|
||||||
|
|||||||
@ -246,7 +246,7 @@ WorldPosition FindFishingHole(PlayerbotAI* botAI)
|
|||||||
return WorldPosition();
|
return WorldPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveNearWaterAction::Execute(Event event)
|
bool MoveNearWaterAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPosition landSpot = AI_VALUE(WorldPosition, "fishing spot");
|
WorldPosition landSpot = AI_VALUE(WorldPosition, "fishing spot");
|
||||||
if (landSpot.IsValid())
|
if (landSpot.IsValid())
|
||||||
@ -336,7 +336,7 @@ bool MoveNearWaterAction::isPossible()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipFishingPoleAction::Execute(Event event)
|
bool EquipFishingPoleAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!_pole)
|
if (!_pole)
|
||||||
return false;
|
return false;
|
||||||
@ -463,7 +463,7 @@ bool UseBobberAction::isUseful()
|
|||||||
return AI_VALUE(bool, "can use fishing bobber");
|
return AI_VALUE(bool, "can use fishing bobber");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UseBobberAction::Execute(Event event)
|
bool UseBobberAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector gos = AI_VALUE(GuidVector, "nearest game objects no los");
|
GuidVector gos = AI_VALUE(GuidVector, "nearest game objects no los");
|
||||||
for (auto const& guid : gos)
|
for (auto const& guid : gos)
|
||||||
@ -485,7 +485,7 @@ bool UseBobberAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EndMasterFishingAction::Execute(Event event)
|
bool EndMasterFishingAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->ChangeStrategy("-master fishing", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("-master fishing", BOT_STATE_NON_COMBAT);
|
||||||
return true;
|
return true;
|
||||||
@ -503,7 +503,7 @@ bool EndMasterFishingAction::isUseful()
|
|||||||
return !nearWater.IsValid();
|
return !nearWater.IsValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoveBobberStrategyAction::Execute(Event event)
|
bool RemoveBobberStrategyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->ChangeStrategy("-use bobber", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("-use bobber", BOT_STATE_NON_COMBAT);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -5,17 +5,14 @@
|
|||||||
|
|
||||||
#include "FollowActions.h"
|
#include "FollowActions.h"
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Formations.h"
|
#include "Formations.h"
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "SharedDefines.h"
|
|
||||||
|
|
||||||
bool FollowAction::Execute(Event event)
|
bool FollowAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Formation* formation = AI_VALUE(Formation*, "formation");
|
Formation* formation = AI_VALUE(Formation*, "formation");
|
||||||
std::string const target = formation->GetTargetName();
|
std::string const target = formation->GetTargetName();
|
||||||
@ -116,7 +113,7 @@ bool FollowAction::CanDeadFollow(Unit* target)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeToGroupLeaderAction::Execute(Event event)
|
bool FleeToGroupLeaderAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
||||||
bool canFollow = Follow(fTarget);
|
bool canFollow = Follow(fTarget);
|
||||||
|
|||||||
@ -11,8 +11,6 @@
|
|||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "CharmInfo.h"
|
#include "CharmInfo.h"
|
||||||
#include "SharedDefines.h"
|
|
||||||
#include "ObjectGuid.h"
|
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -54,7 +52,7 @@ bool MeleeAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TogglePetSpellAutoCastAction::Execute(Event event)
|
bool TogglePetSpellAutoCastAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Pet* pet = bot->GetPet();
|
Pet* pet = bot->GetPet();
|
||||||
if (!pet)
|
if (!pet)
|
||||||
@ -119,7 +117,7 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
|
|||||||
return toggled;
|
return toggled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetAttackAction::Execute(Event event)
|
bool PetAttackAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Guardian* pet = bot->GetGuardianPet();
|
Guardian* pet = bot->GetGuardianPet();
|
||||||
if (!pet)
|
if (!pet)
|
||||||
|
|||||||
@ -17,19 +17,17 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Language.h"
|
|
||||||
#include "GenericBuffUtils.h"
|
#include "GenericBuffUtils.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
using ai::buff::MakeAuraQualifierForBuff;
|
using ai::buff::MakeAuraQualifierForBuff;
|
||||||
using ai::buff::UpgradeToGroupIfAppropriate;
|
|
||||||
|
|
||||||
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell)
|
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell)
|
||||||
: Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
: Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CastSpellAction::Execute(Event event)
|
bool CastSpellAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (spell == "conjure food" || spell == "conjure water")
|
if (spell == "conjure food" || spell == "conjure water")
|
||||||
{
|
{
|
||||||
@ -232,7 +230,7 @@ Value<Unit*>* BuffOnPartyAction::GetTargetValue()
|
|||||||
return context->GetValue<Unit*>("party member without aura", MakeAuraQualifierForBuff(spell));
|
return context->GetValue<Unit*>("party member without aura", MakeAuraQualifierForBuff(spell));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuffOnPartyAction::Execute(Event event)
|
bool BuffOnPartyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::string castName = spell; // default = mono
|
std::string castName = spell; // default = mono
|
||||||
|
|
||||||
@ -289,7 +287,7 @@ Value<Unit*>* CastSnareSpellAction::GetTargetValue() { return context->GetValue<
|
|||||||
|
|
||||||
Value<Unit*>* CastCrowdControlSpellAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
Value<Unit*>* CastCrowdControlSpellAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
||||||
|
|
||||||
bool CastCrowdControlSpellAction::Execute(Event event) { return botAI->CastSpell(getName(), GetTarget()); }
|
bool CastCrowdControlSpellAction::Execute(Event /*event*/) { return botAI->CastSpell(getName(), GetTarget()); }
|
||||||
|
|
||||||
bool CastCrowdControlSpellAction::isPossible() { return botAI->CanCastSpell(getName(), GetTarget()); }
|
bool CastCrowdControlSpellAction::isPossible() { return botAI->CanCastSpell(getName(), GetTarget()); }
|
||||||
|
|
||||||
@ -307,13 +305,13 @@ bool CastVehicleSpellAction::isPossible()
|
|||||||
|
|
||||||
bool CastVehicleSpellAction::isUseful() { return botAI->IsInVehicle(false, true); }
|
bool CastVehicleSpellAction::isUseful() { return botAI->IsInVehicle(false, true); }
|
||||||
|
|
||||||
bool CastVehicleSpellAction::Execute(Event event)
|
bool CastVehicleSpellAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", spell);
|
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", spell);
|
||||||
return botAI->CastVehicleSpell(spellId, GetTarget());
|
return botAI->CastVehicleSpell(spellId, GetTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UseTrinketAction::Execute(Event event)
|
bool UseTrinketAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Item* trinket1 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1);
|
Item* trinket1 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1);
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
std::vector<std::string> split(std::string const s, char delim);
|
std::vector<std::string> split(std::string const s, char delim);
|
||||||
|
|
||||||
bool GiveItemAction::Execute(Event event)
|
bool GiveItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
if (!target)
|
if (!target)
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet") {}
|
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet") {}
|
||||||
|
|
||||||
bool GreetAction::Execute(Event event)
|
bool GreetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
ObjectGuid guid = AI_VALUE(ObjectGuid, "new player nearby");
|
ObjectGuid guid = AI_VALUE(ObjectGuid, "new player nearby");
|
||||||
if (!guid || !guid.IsPlayer())
|
if (!guid || !guid.IsPlayer())
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
#include "GuildBankAction.h"
|
#include "GuildBankAction.h"
|
||||||
|
|
||||||
#include "GuildMgr.h"
|
#include "GuildMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool GuildBankAction::Execute(Event event)
|
bool GuildBankAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,9 +12,9 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RandomPlayerbotFactory.h"
|
#include "RandomPlayerbotFactory.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "SharedDefines.h" // GOLD
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
bool BuyPetitionAction::Execute(Event event)
|
bool BuyPetitionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
||||||
bool vendored = false, result = false;
|
bool vendored = false, result = false;
|
||||||
@ -152,7 +152,7 @@ bool PetitionOfferAction::Execute(Event event)
|
|||||||
|
|
||||||
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
|
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
|
||||||
|
|
||||||
bool PetitionOfferNearbyAction::Execute(Event event)
|
bool PetitionOfferNearbyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 found = 0;
|
uint32 found = 0;
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ bool PetitionOfferNearbyAction::isUseful()
|
|||||||
AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetitionTurnInAction::Execute(Event event)
|
bool PetitionTurnInAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
||||||
bool vendored = false, result = false;
|
bool vendored = false, result = false;
|
||||||
@ -297,7 +297,7 @@ bool PetitionTurnInAction::isUseful()
|
|||||||
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuyTabardAction::Execute(Event event)
|
bool BuyTabardAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool canBuy = botAI->DoSpecificAction("buy", Event("buy tabard", "Hitem:5976:"));
|
bool canBuy = botAI->DoSpecificAction("buy", Event("buy tabard", "Hitem:5976:"));
|
||||||
if (canBuy && AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)))
|
if (canBuy && AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)))
|
||||||
|
|||||||
@ -128,7 +128,7 @@ bool GuildRemoveAction::PlayerIsValid(Player* member)
|
|||||||
return member->GetGuildId() == bot->GetGuildId() && GetRankId(bot) < GetRankId(member);
|
return member->GetGuildId() == bot->GetGuildId() && GetRankId(bot) < GetRankId(member);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool GuildManageNearbyAction::Execute(Event event)
|
bool GuildManageNearbyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 found = 0;
|
uint32 found = 0;
|
||||||
|
|
||||||
@ -149,7 +149,6 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
// Promote or demote nearby members based on chance.
|
// Promote or demote nearby members based on chance.
|
||||||
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId())
|
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId())
|
||||||
{
|
{
|
||||||
Guild::Member* member = guild->GetMember(player->GetGUID());
|
|
||||||
uint32 dCount = AI_VALUE(uint32, "death count");
|
uint32 dCount = AI_VALUE(uint32, "death count");
|
||||||
|
|
||||||
if (!urand(0, 30) && dCount < 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_PROMOTE)
|
if (!urand(0, 30) && dCount < 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_PROMOTE)
|
||||||
|
|||||||
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
#include "ChatActionContext.h"
|
#include "ChatActionContext.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help") { chatContext = new ChatActionContext(); }
|
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help") { chatContext = new ChatActionContext(); }
|
||||||
|
|
||||||
HelpAction::~HelpAction() { delete chatContext; }
|
HelpAction::~HelpAction() { delete chatContext; }
|
||||||
|
|
||||||
bool HelpAction::Execute(Event event)
|
bool HelpAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
TellChatCommands();
|
TellChatCommands();
|
||||||
TellStrategies();
|
TellStrategies();
|
||||||
|
|||||||
@ -6,15 +6,16 @@
|
|||||||
#include "HireAction.h"
|
#include "HireAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool HireAction::Execute(Event event)
|
bool HireAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 account = master->GetSession()->GetAccountId();
|
uint32 account = master->GetSession()->GetAccountId();
|
||||||
@ -39,7 +40,7 @@ bool HireAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 discount = sRandomPlayerbotMgr.GetTradeDiscount(bot, master);
|
uint32 discount = RandomPlayerbotMgr::instance().GetTradeDiscount(bot, master);
|
||||||
uint32 m = 1 + (bot->GetLevel() / 10);
|
uint32 m = 1 + (bot->GetLevel() / 10);
|
||||||
uint32 moneyReq = m * 5000 * bot->GetLevel();
|
uint32 moneyReq = m * 5000 * bot->GetLevel();
|
||||||
if (discount < moneyReq)
|
if (discount < moneyReq)
|
||||||
@ -54,7 +55,7 @@ bool HireAction::Execute(Event event)
|
|||||||
botAI->TellMaster("I will join you at your next relogin");
|
botAI->TellMaster("I will join you at your next relogin");
|
||||||
|
|
||||||
bot->SetMoney(moneyReq);
|
bot->SetMoney(moneyReq);
|
||||||
sRandomPlayerbotMgr.Remove(bot);
|
RandomPlayerbotMgr::instance().Remove(bot);
|
||||||
CharacterDatabase.Execute("UPDATE characters SET account = {} WHERE guid = {}", account,
|
CharacterDatabase.Execute("UPDATE characters SET account = {} WHERE guid = {}", account,
|
||||||
bot->GetGUID().GetCounter());
|
bot->GetGUID().GetCounter());
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
ImbueWithPoisonAction::ImbueWithPoisonAction(PlayerbotAI* botAI) : Action(botAI, "apply poison") {}
|
ImbueWithPoisonAction::ImbueWithPoisonAction(PlayerbotAI* botAI) : Action(botAI, "apply poison") {}
|
||||||
|
|
||||||
bool ImbueWithPoisonAction::Execute(Event event)
|
bool ImbueWithPoisonAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@ -103,7 +103,7 @@ bool ImbueWithPoisonAction::Execute(Event event)
|
|||||||
// Search and apply stone to weapons
|
// Search and apply stone to weapons
|
||||||
ImbueWithStoneAction::ImbueWithStoneAction(PlayerbotAI* botAI) : Action(botAI, "apply stone") {}
|
ImbueWithStoneAction::ImbueWithStoneAction(PlayerbotAI* botAI) : Action(botAI, "apply stone") {}
|
||||||
|
|
||||||
bool ImbueWithStoneAction::Execute(Event event)
|
bool ImbueWithStoneAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@ -148,7 +148,7 @@ bool ImbueWithStoneAction::Execute(Event event)
|
|||||||
// Search and apply oil to weapons
|
// Search and apply oil to weapons
|
||||||
ImbueWithOilAction::ImbueWithOilAction(PlayerbotAI* botAI) : Action(botAI, "apply oil") {}
|
ImbueWithOilAction::ImbueWithOilAction(PlayerbotAI* botAI) : Action(botAI, "apply oil") {}
|
||||||
|
|
||||||
bool ImbueWithOilAction::Execute(Event event)
|
bool ImbueWithOilAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@ -201,7 +201,7 @@ static const uint32 uPrioritizedHealingItemIds[19] = {
|
|||||||
|
|
||||||
TryEmergencyAction::TryEmergencyAction(PlayerbotAI* botAI) : Action(botAI, "try emergency") {}
|
TryEmergencyAction::TryEmergencyAction(PlayerbotAI* botAI) : Action(botAI, "try emergency") {}
|
||||||
|
|
||||||
bool TryEmergencyAction::Execute(Event event)
|
bool TryEmergencyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Do not use consumable if bot can heal self
|
// Do not use consumable if bot can heal self
|
||||||
if ((botAI->IsHeal(bot)) && (bot->GetPowerPct(POWER_MANA) > 20))
|
if ((botAI->IsHeal(bot)) && (bot->GetPowerPct(POWER_MANA) > 20))
|
||||||
|
|||||||
@ -351,9 +351,7 @@ uint32 InventoryAction::GetItemCount(FindItemVisitor* visitor, IterateItemsMask
|
|||||||
|
|
||||||
std::vector<Item*>& items = visitor->GetResult();
|
std::vector<Item*>& items = visitor->GetResult();
|
||||||
for (Item* item : items)
|
for (Item* item : items)
|
||||||
{
|
|
||||||
count += item->GetCount();
|
count += item->GetCount();
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildMgr.h"
|
#include "GuildMgr.h"
|
||||||
#include "Log.h"
|
|
||||||
#include "PlayerbotOperations.h"
|
#include "PlayerbotOperations.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PlayerbotWorldThreadProcessor.h"
|
#include "PlayerbotWorldThreadProcessor.h"
|
||||||
@ -44,7 +43,7 @@ bool InviteToGroupAction::Invite(Player* inviter, Player* player)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InviteNearbyToGroupAction::Execute(Event event)
|
bool InviteNearbyToGroupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
|
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
|
||||||
for (auto& i : nearGuids)
|
for (auto& i : nearGuids)
|
||||||
@ -62,7 +61,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
if (player->GetGroup())
|
if (player->GetGroup())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig.randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
if (!PlayerbotAIConfig::instance().randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
@ -88,7 +87,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
|
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.sightDistance)
|
if (ServerFacade::instance().GetDistance2d(bot, player) > PlayerbotAIConfig::instance().sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// When inviting the 5th member of the group convert to raid for future invites.
|
// When inviting the 5th member of the group convert to raid for future invites.
|
||||||
@ -99,7 +98,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig.inviteChat && sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (PlayerbotAIConfig::instance().inviteChat && RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> placeholders;
|
std::map<std::string, std::string> placeholders;
|
||||||
placeholders["%player"] = player->GetName();
|
placeholders["%player"] = player->GetName();
|
||||||
@ -120,7 +119,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
|
|
||||||
bool InviteNearbyToGroupAction::isUseful()
|
bool InviteNearbyToGroupAction::isUseful()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig.randomBotGroupNearby)
|
if (!PlayerbotAIConfig::instance().randomBotGroupNearby)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
@ -166,7 +165,7 @@ std::vector<Player*> InviteGuildToGroupAction::getGuildMembers()
|
|||||||
return worker.GetResult();
|
return worker.GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InviteGuildToGroupAction::Execute(Event event)
|
bool InviteGuildToGroupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
|
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
|
||||||
|
|
||||||
@ -186,7 +185,7 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
if (player->isDND())
|
if (player->isDND())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig.randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
if (!PlayerbotAIConfig::instance().randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player->IsBeingTeleported())
|
if (player->IsBeingTeleported())
|
||||||
@ -221,7 +220,7 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
|
player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!playerAi && ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.sightDistance)
|
if (!playerAi && ServerFacade::instance().GetDistance2d(bot, player) > PlayerbotAIConfig::instance().sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
@ -233,8 +232,8 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig.inviteChat &&
|
if (PlayerbotAIConfig::instance().inviteChat &&
|
||||||
(sRandomPlayerbotMgr.IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
(RandomPlayerbotMgr::instance().IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
||||||
{
|
{
|
||||||
BroadcastHelper::BroadcastGuildGroupOrRaidInvite(botAI, bot, player, group);
|
BroadcastHelper::BroadcastGuildGroupOrRaidInvite(botAI, bot, player, group);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,7 @@ bool LeaveGroupAction::Leave()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LeaveFarAwayAction::Execute(Event event)
|
bool LeaveFarAwayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// allow bot to leave party when they want
|
// allow bot to leave party when they want
|
||||||
return Leave();
|
return Leave();
|
||||||
|
|||||||
@ -8,11 +8,11 @@
|
|||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "LFGPackets.h"
|
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
|
||||||
using namespace lfg;
|
using namespace lfg;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
|
|||||||
|
|
||||||
uint32 LfgJoinAction::GetRoles()
|
uint32 LfgJoinAction::GetRoles()
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
if (botAI->IsTank(bot))
|
if (botAI->IsTank(bot))
|
||||||
return PLAYER_ROLE_TANK;
|
return PLAYER_ROLE_TANK;
|
||||||
@ -101,7 +101,7 @@ bool LfgJoinAction::JoinLFG()
|
|||||||
LfgDungeonSet list;
|
LfgDungeonSet list;
|
||||||
std::vector<uint32> selected;
|
std::vector<uint32> selected;
|
||||||
|
|
||||||
std::vector<uint32> dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeamId()];
|
std::vector<uint32> dungeons = RandomPlayerbotMgr::instance().LfgDungeons[bot->GetTeamId()];
|
||||||
if (!dungeons.size())
|
if (!dungeons.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ bool LfgJoinAction::JoinLFG()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LfgRoleCheckAction::Execute(Event event)
|
bool LfgRoleCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
{
|
{
|
||||||
@ -216,9 +216,9 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
*packet << id << true;
|
*packet << id << true;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr.IsRandomBot(bot) && !bot->GetGroup())
|
if (RandomPlayerbotMgr::instance().IsRandomBot(bot) && !bot->GetGroup())
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr.Refresh(bot);
|
RandomPlayerbotMgr::instance().Refresh(bot);
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,9 +251,9 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
*packet << id << true;
|
*packet << id << true;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr.IsRandomBot(bot) && !bot->GetGroup())
|
if (RandomPlayerbotMgr::instance().IsRandomBot(bot) && !bot->GetGroup())
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr.Refresh(bot);
|
RandomPlayerbotMgr::instance().Refresh(bot);
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LfgLeaveAction::Execute(Event event)
|
bool LfgLeaveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Don't leave if lfg strategy enabled
|
// Don't leave if lfg strategy enabled
|
||||||
// if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
|
// if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
|
||||||
@ -337,7 +337,7 @@ bool LfgJoinAction::isUseful()
|
|||||||
if (bot->isDead())
|
if (bot->isDead())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Map* map = bot->GetMap();
|
Map* map = bot->GetMap();
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool LootRollAction::Execute(Event event)
|
bool LootRollAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
|
|||||||
@ -11,20 +11,16 @@
|
|||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool MoveToRpgTargetAction::Execute(Event event)
|
bool MoveToRpgTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
Unit* unit = botAI->GetUnit(guidP);
|
Unit* unit = botAI->GetUnit(guidP);
|
||||||
if (unit && !unit->IsInWorld())
|
if (unit && !unit->IsInWorld())
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
GameObject* go = botAI->GetGameObject(guidP);
|
GameObject* go = botAI->GetGameObject(guidP);
|
||||||
if (go && !go->IsInWorld())
|
if (go && !go->IsInWorld())
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Player* player = guidP.GetPlayer();
|
|
||||||
|
|
||||||
WorldObject* wo = nullptr;
|
WorldObject* wo = nullptr;
|
||||||
if (unit)
|
if (unit)
|
||||||
|
|||||||
@ -7,10 +7,9 @@
|
|||||||
|
|
||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "PathGenerator.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool MoveToTravelTargetAction::Execute(Event event)
|
bool MoveToTravelTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
#include "FleeManager.h"
|
#include "FleeManager.h"
|
||||||
#include "G3D/Vector3.h"
|
#include "G3D/Vector3.h"
|
||||||
#include "GameObject.h"
|
#include "GameObject.h"
|
||||||
#include "Geometry.h"
|
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
@ -36,9 +35,7 @@
|
|||||||
#include "SpellAuraEffects.h"
|
#include "SpellAuraEffects.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include "Stances.h"
|
#include "Stances.h"
|
||||||
#include "TargetedMovementGenerator.h"
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Transport.h"
|
|
||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "WaypointMovementGenerator.h"
|
#include "WaypointMovementGenerator.h"
|
||||||
@ -67,18 +64,14 @@ bool MovementAction::JumpTo(uint32 mapId, float x, float y, float z, MovementPri
|
|||||||
{
|
{
|
||||||
UpdateMovementState();
|
UpdateMovementState();
|
||||||
if (!IsMovingAllowed(mapId, x, y, z))
|
if (!IsMovingAllowed(mapId, x, y, z))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (IsDuplicateMove(mapId, x, y, z))
|
if (IsDuplicateMove(mapId, x, y, z))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (IsWaitingForLastMove(priority))
|
if (IsWaitingForLastMove(priority))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
float botZ = bot->GetPositionZ();
|
|
||||||
float speed = bot->GetSpeed(MOVE_RUN);
|
float speed = bot->GetSpeed(MOVE_RUN);
|
||||||
MotionMaster& mm = *bot->GetMotionMaster();
|
MotionMaster& mm = *bot->GetMotionMaster();
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
@ -1846,7 +1839,7 @@ void MovementAction::DoMovePoint(Unit* unit, float x, float y, float z, bool gen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeAction::Execute(Event event)
|
bool FleeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
return MoveAway(AI_VALUE(Unit*, "current target"), sPlayerbotAIConfig.fleeDistance, true);
|
return MoveAway(AI_VALUE(Unit*, "current target"), sPlayerbotAIConfig.fleeDistance, true);
|
||||||
}
|
}
|
||||||
@ -1854,9 +1847,8 @@ bool FleeAction::Execute(Event event)
|
|||||||
bool FleeAction::isUseful()
|
bool FleeAction::isUseful()
|
||||||
{
|
{
|
||||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (target && target->IsInWorld() && !bot->IsWithinMeleeRange(target))
|
if (target && target->IsInWorld() && !bot->IsWithinMeleeRange(target))
|
||||||
return false;
|
return false;
|
||||||
@ -1864,12 +1856,10 @@ bool FleeAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeWithPetAction::Execute(Event event)
|
bool FleeWithPetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Pet* pet = bot->GetPet())
|
if (Pet* pet = bot->GetPet())
|
||||||
{
|
|
||||||
botAI->PetFollow();
|
botAI->PetFollow();
|
||||||
}
|
|
||||||
|
|
||||||
return Flee(AI_VALUE(Unit*, "current target"));
|
return Flee(AI_VALUE(Unit*, "current target"));
|
||||||
}
|
}
|
||||||
@ -1877,15 +1867,14 @@ bool FleeWithPetAction::Execute(Event event)
|
|||||||
bool AvoidAoeAction::isUseful()
|
bool AvoidAoeAction::isUseful()
|
||||||
{
|
{
|
||||||
if (getMSTime() - moveInterval < lastMoveTimer)
|
if (getMSTime() - moveInterval < lastMoveTimer)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
GuidVector traps = AI_VALUE(GuidVector, "nearest trap with damage");
|
GuidVector traps = AI_VALUE(GuidVector, "nearest trap with damage");
|
||||||
GuidVector triggers = AI_VALUE(GuidVector, "possible triggers");
|
GuidVector triggers = AI_VALUE(GuidVector, "possible triggers");
|
||||||
return AI_VALUE(Aura*, "area debuff") || !traps.empty() || !triggers.empty();
|
return AI_VALUE(Aura*, "area debuff") || !traps.empty() || !triggers.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvoidAoeAction::Execute(Event event)
|
bool AvoidAoeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Case #1: Aura with dynamic object (e.g. rain of fire)
|
// Case #1: Aura with dynamic object (e.g. rain of fire)
|
||||||
if (AvoidAuraWithDynamicObj())
|
if (AvoidAuraWithDynamicObj())
|
||||||
@ -2309,17 +2298,15 @@ bool MovementAction::CheckLastFlee(float curAngle, std::list<FleeInfo>& infoList
|
|||||||
bool CombatFormationMoveAction::isUseful()
|
bool CombatFormationMoveAction::isUseful()
|
||||||
{
|
{
|
||||||
if (getMSTime() - moveInterval < lastMoveTimer)
|
if (getMSTime() - moveInterval < lastMoveTimer)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CombatFormationMoveAction::Execute(Event event)
|
bool CombatFormationMoveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float dis = AI_VALUE(float, "disperse distance");
|
float dis = AI_VALUE(float, "disperse distance");
|
||||||
if (dis <= 0.0f || (!bot->IsInCombat() && botAI->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT)) ||
|
if (dis <= 0.0f || (!bot->IsInCombat() && botAI->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT)) ||
|
||||||
@ -2450,7 +2437,7 @@ Player* CombatFormationMoveAction::NearestGroupMember(float dis)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TankFaceAction::Execute(Event event)
|
bool TankFaceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@ -2534,7 +2521,7 @@ bool RearFlankAction::isUseful()
|
|||||||
return inFront || inRear;
|
return inFront || inRear;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RearFlankAction::Execute(Event event)
|
bool RearFlankAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@ -2645,9 +2632,9 @@ bool DisperseSetAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunAwayAction::Execute(Event event) { return Flee(AI_VALUE(Unit*, "group leader")); }
|
bool RunAwayAction::Execute(Event /*event*/) { return Flee(AI_VALUE(Unit*, "group leader")); }
|
||||||
|
|
||||||
bool MoveToLootAction::Execute(Event event)
|
bool MoveToLootAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
LootObject loot = AI_VALUE(LootObject, "loot target");
|
LootObject loot = AI_VALUE(LootObject, "loot target");
|
||||||
if (!loot.IsLootPossible(bot))
|
if (!loot.IsLootPossible(bot))
|
||||||
@ -2656,7 +2643,7 @@ bool MoveToLootAction::Execute(Event event)
|
|||||||
return MoveNear(loot.GetWorldObject(bot), sPlayerbotAIConfig.contactDistance);
|
return MoveNear(loot.GetWorldObject(bot), sPlayerbotAIConfig.contactDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveOutOfEnemyContactAction::Execute(Event event)
|
bool MoveOutOfEnemyContactAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@ -2667,7 +2654,7 @@ bool MoveOutOfEnemyContactAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveOutOfEnemyContactAction::isUseful() { return AI_VALUE2(bool, "inside target", "current target"); }
|
bool MoveOutOfEnemyContactAction::isUseful() { return AI_VALUE2(bool, "inside target", "current target"); }
|
||||||
|
|
||||||
bool SetFacingTargetAction::Execute(Event event)
|
bool SetFacingTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@ -2693,7 +2680,7 @@ bool SetFacingTargetAction::isPossible()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetBehindTargetAction::Execute(Event event)
|
bool SetBehindTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@ -2753,7 +2740,7 @@ bool SetBehindTargetAction::Execute(Event event)
|
|||||||
false, true, MovementPriority::MOVEMENT_COMBAT);
|
false, true, MovementPriority::MOVEMENT_COMBAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveOutOfCollisionAction::Execute(Event event)
|
bool MoveOutOfCollisionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float angle = M_PI * 2000 / frand(1.f, 1000.f);
|
float angle = M_PI * 2000 / frand(1.f, 1000.f);
|
||||||
float distance = sPlayerbotAIConfig.followDistance;
|
float distance = sPlayerbotAIConfig.followDistance;
|
||||||
@ -2771,7 +2758,7 @@ bool MoveOutOfCollisionAction::isUseful()
|
|||||||
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get().size() < 15;
|
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get().size() < 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveRandomAction::Execute(Event event)
|
bool MoveRandomAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float distance = sPlayerbotAIConfig.tooCloseDistance + urand(10, 30);
|
float distance = sPlayerbotAIConfig.tooCloseDistance + urand(10, 30);
|
||||||
|
|
||||||
@ -2803,9 +2790,9 @@ bool MoveRandomAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveRandomAction::isUseful() { return !AI_VALUE(GuidPosition, "rpg target"); }
|
bool MoveRandomAction::isUseful() { return !AI_VALUE(GuidPosition, "rpg target"); }
|
||||||
|
|
||||||
bool MoveInsideAction::Execute(Event event) { return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance); }
|
bool MoveInsideAction::Execute(Event /*event*/) { return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance); }
|
||||||
|
|
||||||
bool RotateAroundTheCenterPointAction::Execute(Event event)
|
bool RotateAroundTheCenterPointAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 next_point = GetCurrWaypoint();
|
uint32 next_point = GetCurrWaypoint();
|
||||||
if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ(), false,
|
if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ(), false,
|
||||||
@ -2825,10 +2812,9 @@ bool MoveFromGroupAction::Execute(Event event)
|
|||||||
return MoveFromGroup(distance);
|
return MoveFromGroup(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveAwayFromCreatureAction::Execute(Event event)
|
bool MoveAwayFromCreatureAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector targets = AI_VALUE(GuidVector, "nearest npcs");
|
GuidVector targets = AI_VALUE(GuidVector, "nearest npcs");
|
||||||
Creature* nearestCreature = bot->FindNearestCreature(creatureId, range, alive);
|
|
||||||
|
|
||||||
// Find all creatures with the specified Id
|
// Find all creatures with the specified Id
|
||||||
std::vector<Unit*> creatures;
|
std::vector<Unit*> creatures;
|
||||||
@ -2906,16 +2892,14 @@ bool MoveAwayFromCreatureAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveAwayFromCreatureAction::isPossible() { return bot->CanFreeMove(); }
|
bool MoveAwayFromCreatureAction::isPossible() { return bot->CanFreeMove(); }
|
||||||
|
|
||||||
bool MoveAwayFromPlayerWithDebuffAction::Execute(Event event)
|
bool MoveAwayFromPlayerWithDebuffAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* closestPlayer = nullptr;
|
Player* closestPlayer = nullptr;
|
||||||
float minDistance = 0.0f;
|
float minDistance = 0.0f;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Player*> debuffedPlayers;
|
std::vector<Player*> debuffedPlayers;
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "AiObjectContext.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool OpenItemAction::Execute(Event event)
|
bool OpenItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool foundOpenable = false;
|
bool foundOpenable = false;
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,9 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotOperations.h"
|
#include "PlayerbotOperations.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "PlayerbotWorldThreadProcessor.h"
|
#include "PlayerbotWorldThreadProcessor.h"
|
||||||
|
|
||||||
bool PassLeadershipToMasterAction::Execute(Event event)
|
bool PassLeadershipToMasterAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Player* master = GetMaster())
|
if (Player* master = GetMaster())
|
||||||
if (master && master != bot && bot->GetGroup() && bot->GetGroup()->IsMember(master->GetGUID()))
|
if (master && master != bot && bot->GetGroup() && bot->GetGroup()->IsMember(master->GetGUID()))
|
||||||
|
|||||||
@ -9,8 +9,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "PlayerbotFactory.h"
|
|
||||||
#include "Unit.h"
|
|
||||||
|
|
||||||
class PlayerbotAI;
|
class PlayerbotAI;
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ bool PositionAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveToPositionAction::Execute(Event event)
|
bool MoveToPositionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
||||||
if (!pos.isSet())
|
if (!pos.isSet())
|
||||||
@ -123,7 +123,7 @@ bool MoveToPositionAction::isUseful()
|
|||||||
return pos.isSet() && distance > sPlayerbotAIConfig.followDistance && distance < sPlayerbotAIConfig.reactDistance;
|
return pos.isSet() && distance > sPlayerbotAIConfig.followDistance && distance < sPlayerbotAIConfig.reactDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetReturnPositionAction::Execute(Event event)
|
bool SetReturnPositionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
||||||
PositionInfo returnPos = posMap["return"];
|
PositionInfo returnPos = posMap["return"];
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
void QueryQuestAction::TellObjective(std::string const name, uint32 available, uint32 required)
|
void QueryQuestAction::TellObjective(std::string const name, uint32 available, uint32 required)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "QuestAction.h"
|
#include "QuestAction.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
@ -116,7 +117,8 @@ bool QuestAction::CompleteQuest(Player* player, uint32 entry)
|
|||||||
player->CastedCreatureOrGO(creature, ObjectGuid(), spell_id);
|
player->CastedCreatureOrGO(creature, ObjectGuid(), spell_id);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
/*else*/ if (creature > 0)
|
/*else*/
|
||||||
|
if (creature > 0)
|
||||||
{
|
{
|
||||||
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature))
|
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature))
|
||||||
for (uint16 z = 0; z < creaturecount; ++z)
|
for (uint16 z = 0; z < creaturecount; ++z)
|
||||||
@ -432,7 +434,7 @@ bool QuestItemPushResultAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestUpdateFailedAction::Execute(Event event)
|
bool QuestUpdateFailedAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
//opcode SMSG_QUESTUPDATE_FAILED is never sent...(yet?)
|
//opcode SMSG_QUESTUPDATE_FAILED is never sent...(yet?)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool RandomBotUpdateAction::Execute(Event event)
|
bool RandomBotUpdateAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
bool ReachTargetAction::Execute(Event event) { return ReachCombatTo(AI_VALUE(Unit*, GetTargetName()), distance); }
|
bool ReachTargetAction::Execute(Event /*event*/) { return ReachCombatTo(AI_VALUE(Unit*, GetTargetName()), distance); }
|
||||||
|
|
||||||
bool ReachTargetAction::isUseful()
|
bool ReachTargetAction::isUseful()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -78,7 +78,7 @@ void ReleaseSpiritAction::LogRelease(const std::string& releaseMsg, bool isAutoR
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AutoReleaseSpiritAction implementation
|
// AutoReleaseSpiritAction implementation
|
||||||
bool AutoReleaseSpiritAction::Execute(Event event)
|
bool AutoReleaseSpiritAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
IncrementDeathCount();
|
IncrementDeathCount();
|
||||||
bot->DurabilityRepairAll(false, 1.0f, false);
|
bot->DurabilityRepairAll(false, 1.0f, false);
|
||||||
@ -214,7 +214,7 @@ bool AutoReleaseSpiritAction::ShouldDelayBattlegroundRelease() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RepopAction::Execute(Event event)
|
bool RepopAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
const GraveyardStruct* graveyard = GetGrave(
|
const GraveyardStruct* graveyard = GetGrave(
|
||||||
AI_VALUE(uint32, "death count") > 10 ||
|
AI_VALUE(uint32, "death count") > 10 ||
|
||||||
@ -250,7 +250,7 @@ void RepopAction::PerformGraveyardTeleport(const GraveyardStruct* graveyard) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelfResurrectAction implementation for Warlock's Soulstone Resurrection/Shaman's Reincarnation
|
// SelfResurrectAction implementation for Warlock's Soulstone Resurrection/Shaman's Reincarnation
|
||||||
bool SelfResurrectAction::Execute(Event event)
|
bool SelfResurrectAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->IsAlive() && bot->GetUInt32Value(PLAYER_SELF_RES_SPELL))
|
if (!bot->IsAlive() && bot->GetUInt32Value(PLAYER_SELF_RES_SPELL))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool RememberTaxiAction::Execute(Event event)
|
bool RememberTaxiAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool RepairAllAction::Execute(Event event)
|
bool RepairAllAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
||||||
for (ObjectGuid const guid : npcs)
|
for (ObjectGuid const guid : npcs)
|
||||||
|
|||||||
@ -5,14 +5,13 @@
|
|||||||
|
|
||||||
#include "ResetInstancesAction.h"
|
#include "ResetInstancesAction.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool ResetInstancesAction::Execute(Event event)
|
bool ResetInstancesAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket packet(CMSG_RESET_INSTANCES, 0);
|
WorldPacket packet(CMSG_RESET_INSTANCES, 0);
|
||||||
bot->GetSession()->HandleResetInstancesOpcode(packet);
|
bot->GetSession()->HandleResetInstancesOpcode(packet);
|
||||||
|
|
||||||
botAI->TellMaster("Resetting all instances");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,11 +10,11 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "NearestGameObjects.h"
|
#include "NearestGameObjects.h"
|
||||||
|
|
||||||
bool RevealGatheringItemAction::Execute(Event event)
|
bool RevealGatheringItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->GetGroup())
|
if (!bot->GetGroup())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
#include "FleeManager.h"
|
#include "FleeManager.h"
|
||||||
#include "GameGraveyard.h"
|
#include "GameGraveyard.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "PlayerbotFactory.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
@ -74,7 +73,7 @@ bool ReviveFromCorpseAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindCorpseAction::Execute(Event event)
|
bool FindCorpseAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
return false;
|
return false;
|
||||||
@ -293,7 +292,7 @@ GraveyardStruct const* SpiritHealerAction::GetGrave(bool startZone)
|
|||||||
return ClosestGrave;
|
return ClosestGrave;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpiritHealerAction::Execute(Event event)
|
bool SpiritHealerAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Corpse* corpse = bot->GetCorpse();
|
Corpse* corpse = bot->GetCorpse();
|
||||||
if (!corpse)
|
if (!corpse)
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "BattlegroundMgr.h"
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "EmoteAction.h"
|
#include "EmoteAction.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
@ -16,7 +15,7 @@
|
|||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "RpgSubActions.h"
|
#include "RpgSubActions.h"
|
||||||
|
|
||||||
bool RpgAction::Execute(Event event)
|
bool RpgAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
if (!guidP && botAI->GetMaster())
|
if (!guidP && botAI->GetMaster())
|
||||||
|
|||||||
@ -99,7 +99,7 @@ Event RpgSubAction::ActionEvent(Event event) { return event; }
|
|||||||
|
|
||||||
bool RpgStayAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgStayAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgStayAction::Execute(Event event)
|
bool RpgStayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bot->PlayerTalkClass->SendCloseGossip();
|
bot->PlayerTalkClass->SendCloseGossip();
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ bool RpgStayAction::Execute(Event event)
|
|||||||
|
|
||||||
bool RpgWorkAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgWorkAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgWorkAction::Execute(Event event)
|
bool RpgWorkAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bot->HandleEmoteCommand(EMOTE_STATE_USE_STANDING);
|
bot->HandleEmoteCommand(EMOTE_STATE_USE_STANDING);
|
||||||
rpg->AfterExecute();
|
rpg->AfterExecute();
|
||||||
@ -118,7 +118,7 @@ bool RpgWorkAction::Execute(Event event)
|
|||||||
|
|
||||||
bool RpgEmoteAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgEmoteAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgEmoteAction::Execute(Event event)
|
bool RpgEmoteAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 type = TalkAction::GetRandomEmote(rpg->guidP().GetUnit());
|
uint32 type = TalkAction::GetRandomEmote(rpg->guidP().GetUnit());
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ bool RpgEmoteAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgCancelAction::Execute(Event event)
|
bool RpgCancelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||||
rpg->OnExecute("");
|
rpg->OnExecute("");
|
||||||
@ -142,7 +142,7 @@ bool RpgCancelAction::Execute(Event event)
|
|||||||
|
|
||||||
bool RpgTaxiAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgTaxiAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgTaxiAction::Execute(Event event)
|
bool RpgTaxiAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = rpg->guidP();
|
GuidPosition guidP = rpg->guidP();
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ bool RpgTaxiAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgDiscoverAction::Execute(Event event)
|
bool RpgDiscoverAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = rpg->guidP();
|
GuidPosition guidP = rpg->guidP();
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ bool RpgDiscoverAction::Execute(Event event)
|
|||||||
|
|
||||||
std::string const RpgStartQuestAction::ActionName() { return "accept all quests"; }
|
std::string const RpgStartQuestAction::ActionName() { return "accept all quests"; }
|
||||||
|
|
||||||
Event RpgStartQuestAction::ActionEvent(Event event)
|
Event RpgStartQuestAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p(CMSG_QUESTGIVER_ACCEPT_QUEST);
|
WorldPacket p(CMSG_QUESTGIVER_ACCEPT_QUEST);
|
||||||
p << rpg->guid();
|
p << rpg->guid();
|
||||||
@ -232,7 +232,7 @@ Event RpgStartQuestAction::ActionEvent(Event event)
|
|||||||
|
|
||||||
std::string const RpgEndQuestAction::ActionName() { return "talk to quest giver"; }
|
std::string const RpgEndQuestAction::ActionName() { return "talk to quest giver"; }
|
||||||
|
|
||||||
Event RpgEndQuestAction::ActionEvent(Event event)
|
Event RpgEndQuestAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p(CMSG_QUESTGIVER_COMPLETE_QUEST);
|
WorldPacket p(CMSG_QUESTGIVER_COMPLETE_QUEST);
|
||||||
p << rpg->guid();
|
p << rpg->guid();
|
||||||
@ -242,17 +242,17 @@ Event RpgEndQuestAction::ActionEvent(Event event)
|
|||||||
|
|
||||||
std::string const RpgBuyAction::ActionName() { return "buy"; }
|
std::string const RpgBuyAction::ActionName() { return "buy"; }
|
||||||
|
|
||||||
Event RpgBuyAction::ActionEvent(Event event) { return Event("rpg action", "vendor"); }
|
Event RpgBuyAction::ActionEvent(Event /*event*/) { return Event("rpg action", "vendor"); }
|
||||||
|
|
||||||
std::string const RpgSellAction::ActionName() { return "sell"; }
|
std::string const RpgSellAction::ActionName() { return "sell"; }
|
||||||
|
|
||||||
Event RpgSellAction::ActionEvent(Event event) { return Event("rpg action", "vendor"); }
|
Event RpgSellAction::ActionEvent(Event /*event*/) { return Event("rpg action", "vendor"); }
|
||||||
|
|
||||||
std::string const RpgRepairAction::ActionName() { return "repair"; }
|
std::string const RpgRepairAction::ActionName() { return "repair"; }
|
||||||
|
|
||||||
std::string const RpgTrainAction::ActionName() { return "trainer"; }
|
std::string const RpgTrainAction::ActionName() { return "trainer"; }
|
||||||
|
|
||||||
bool RpgHealAction::Execute(Event event)
|
bool RpgHealAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
|
|
||||||
@ -287,21 +287,21 @@ std::string const RpgBuyPetitionAction::ActionName() { return "buy petition"; }
|
|||||||
|
|
||||||
std::string const RpgUseAction::ActionName() { return "use"; }
|
std::string const RpgUseAction::ActionName() { return "use"; }
|
||||||
|
|
||||||
Event RpgUseAction::ActionEvent(Event event)
|
Event RpgUseAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const RpgSpellAction::ActionName() { return "cast random spell"; }
|
std::string const RpgSpellAction::ActionName() { return "cast random spell"; }
|
||||||
|
|
||||||
Event RpgSpellAction::ActionEvent(Event event)
|
Event RpgSpellAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const RpgCraftAction::ActionName() { return "craft random item"; }
|
std::string const RpgCraftAction::ActionName() { return "craft random item"; }
|
||||||
|
|
||||||
Event RpgCraftAction::ActionEvent(Event event)
|
Event RpgCraftAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ std::vector<Item*> RpgTradeUsefulAction::CanGiveItems(GuidPosition guidPosition)
|
|||||||
return giveItems;
|
return giveItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgTradeUsefulAction::Execute(Event event)
|
bool RpgTradeUsefulAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ bool RpgDuelAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgDuelAction::Execute(Event event)
|
bool RpgDuelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ bool RpgMountAnimAction::isUseful()
|
|||||||
return AI_VALUE2(bool, "mounted", "self target") && !AI_VALUE2(bool, "moving", "self target");
|
return AI_VALUE2(bool, "mounted", "self target") && !AI_VALUE2(bool, "moving", "self target");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgMountAnimAction::Execute(Event event)
|
bool RpgMountAnimAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p;
|
WorldPacket p;
|
||||||
bot->GetSession()->HandleMountSpecialAnimOpcode(p);
|
bot->GetSession()->HandleMountSpecialAnimOpcode(p);
|
||||||
|
|||||||
@ -55,7 +55,7 @@ void RtiAction::AppendRti(std::ostringstream& out, std::string const type)
|
|||||||
out << " (" << target->GetName() << ")";
|
out << " (" << target->GetName() << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MarkRtiAction::Execute(Event event)
|
bool MarkRtiAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
|
|||||||
@ -9,9 +9,7 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "ChannelMgr.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildMgr.h"
|
|
||||||
#include "PlayerbotTextMgr.h"
|
#include "PlayerbotTextMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
@ -56,7 +54,7 @@ static const std::unordered_set<std::string> noReplyMsgStarts = {"e ", "accept "
|
|||||||
|
|
||||||
SayAction::SayAction(PlayerbotAI* botAI) : Action(botAI, "say"), Qualified() {}
|
SayAction::SayAction(PlayerbotAI* botAI) : Action(botAI, "say"), Qualified() {}
|
||||||
|
|
||||||
bool SayAction::Execute(Event event)
|
bool SayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::string text = "";
|
std::string text = "";
|
||||||
std::map<std::string, std::string> placeholders;
|
std::map<std::string, std::string> placeholders;
|
||||||
@ -92,7 +90,6 @@ bool SayAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set delay before next say
|
// set delay before next say
|
||||||
time_t lastSaid = AI_VALUE2(time_t, "last said", qualifier);
|
|
||||||
uint32 nextTime = time(nullptr) + urand(1, 30);
|
uint32 nextTime = time(nullptr) + urand(1, 30);
|
||||||
botAI->GetAiObjectContext()->GetValue<time_t>("last said", qualifier)->Set(nextTime);
|
botAI->GetAiObjectContext()->GetValue<time_t>("last said", qualifier)->Set(nextTime);
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ bool SecurityCheckAction::isUseful()
|
|||||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER && !GET_PLAYERBOT_AI(botAI->GetMaster());
|
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER && !GET_PLAYERBOT_AI(botAI->GetMaster());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecurityCheckAction::Execute(Event event)
|
bool SecurityCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Formations.h"
|
#include "Formations.h"
|
||||||
#include "PathGenerator.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RTSCValues.h"
|
#include "RTSCValues.h"
|
||||||
#include "RtscAction.h"
|
#include "RtscAction.h"
|
||||||
|
|||||||
@ -49,9 +49,7 @@ bool SetCraftAction::Execute(Event event)
|
|||||||
if (skillSpells.empty())
|
if (skillSpells.empty())
|
||||||
{
|
{
|
||||||
for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
|
for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
|
||||||
{
|
|
||||||
skillSpells[skillLine->Spell] = skillLine;
|
skillSpells[skillLine->Spell] = skillLine;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.required.clear();
|
data.required.clear();
|
||||||
@ -78,9 +76,7 @@ bool SetCraftAction::Execute(Event event)
|
|||||||
for (uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x)
|
for (uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x)
|
||||||
{
|
{
|
||||||
if (spellInfo->Reagent[x] <= 0)
|
if (spellInfo->Reagent[x] <= 0)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
uint32 itemid = spellInfo->Reagent[x];
|
uint32 itemid = spellInfo->Reagent[x];
|
||||||
uint32 reagentsRequired = spellInfo->ReagentCount[x];
|
uint32 reagentsRequired = spellInfo->ReagentCount[x];
|
||||||
@ -132,9 +128,8 @@ void SetCraftAction::TellCraft()
|
|||||||
if (ItemTemplate const* reagent = sObjectMgr->GetItemTemplate(item))
|
if (ItemTemplate const* reagent = sObjectMgr->GetItemTemplate(item))
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
{
|
|
||||||
first = false;
|
first = false;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
out << ", ";
|
out << ", ";
|
||||||
|
|
||||||
@ -142,9 +137,7 @@ void SetCraftAction::TellCraft()
|
|||||||
|
|
||||||
uint32 given = data.obtained[item];
|
uint32 given = data.obtained[item];
|
||||||
if (given)
|
if (given)
|
||||||
{
|
|
||||||
out << "|cffffff00(x" << given << " given)|r ";
|
out << "|cffffff00(x" << given << " given)|r ";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool SetHomeAction::Execute(Event event)
|
bool SetHomeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
|
|
||||||
|
|||||||
@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool StatsAction::Execute(Event event)
|
bool StatsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ bool StayActionBase::Stay()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StayAction::Execute(Event event) { return Stay(); }
|
bool StayAction::Execute(Event /*event*/) { return Stay(); }
|
||||||
|
|
||||||
bool StayAction::isUseful()
|
bool StayAction::isUseful()
|
||||||
{
|
{
|
||||||
@ -49,9 +49,7 @@ bool StayAction::isUseful()
|
|||||||
{
|
{
|
||||||
const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z);
|
const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z);
|
||||||
if (sPlayerbotAIConfig.followDistance)
|
if (sPlayerbotAIConfig.followDistance)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// move from group takes priority over stay as it's added and removed automatically
|
// move from group takes priority over stay as it's added and removed automatically
|
||||||
@ -64,7 +62,7 @@ bool StayAction::isUseful()
|
|||||||
return AI_VALUE2(bool, "moving", "self target");
|
return AI_VALUE2(bool, "moving", "self target");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SitAction::Execute(Event event)
|
bool SitAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->isMoving())
|
if (bot->isMoving())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -7,25 +7,19 @@
|
|||||||
|
|
||||||
#include "SuggestWhatToDoAction.h"
|
#include "SuggestWhatToDoAction.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "ChannelMgr.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
|
||||||
#include "Config.h"
|
|
||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "ChannelMgr.h"
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Config.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildMgr.h"
|
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
#include "Channel.h"
|
||||||
|
|
||||||
enum eTalkType
|
enum eTalkType
|
||||||
{
|
{
|
||||||
@ -62,7 +56,7 @@ bool SuggestWhatToDoAction::isUseful()
|
|||||||
return (time(0) - lastSaid) > 30;
|
return (time(0) - lastSaid) > 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SuggestWhatToDoAction::Execute(Event event)
|
bool SuggestWhatToDoAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 index = rand() % suggestions.size();
|
uint32 index = rand() % suggestions.size();
|
||||||
auto fnct_ptr = suggestions[index];
|
auto fnct_ptr = suggestions[index];
|
||||||
@ -258,7 +252,7 @@ private:
|
|||||||
|
|
||||||
SuggestDungeonAction::SuggestDungeonAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest dungeon") {}
|
SuggestDungeonAction::SuggestDungeonAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest dungeon") {}
|
||||||
|
|
||||||
bool SuggestDungeonAction::Execute(Event event)
|
bool SuggestDungeonAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// TODO: use PlayerbotDungeonRepository::instance()
|
// TODO: use PlayerbotDungeonRepository::instance()
|
||||||
|
|
||||||
@ -325,7 +319,7 @@ bool SuggestDungeonAction::Execute(Event event)
|
|||||||
|
|
||||||
SuggestTradeAction::SuggestTradeAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest trade") {}
|
SuggestTradeAction::SuggestTradeAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest trade") {}
|
||||||
|
|
||||||
bool SuggestTradeAction::Execute(Event event)
|
bool SuggestTradeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 quality = urand(0, 100);
|
uint32 quality = urand(0, 100);
|
||||||
if (quality > 95)
|
if (quality > 95)
|
||||||
|
|||||||
@ -6,12 +6,10 @@
|
|||||||
#include "TameAction.h"
|
#include "TameAction.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <iomanip>
|
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "Log.h"
|
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
|||||||
@ -7,9 +7,12 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "SpellMgr.h"
|
||||||
|
#include "Spell.h"
|
||||||
|
|
||||||
bool TeleportAction::Execute(Event event)
|
bool TeleportAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// List of allowed portal entries (you can populate this dynamically)
|
// List of allowed portal entries (you can populate this dynamically)
|
||||||
@ -74,7 +77,7 @@ bool TeleportAction::Execute(Event event)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 spellId = goInfo->spellcaster.spellId;
|
uint32 spellId = goInfo->spellcaster.spellId;
|
||||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
SpellInfo const* spellInfo = SpellMgr::instance()->GetSpellInfo(spellId);
|
||||||
if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS))
|
if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TellLosAction.h"
|
#include "TellLosAction.h"
|
||||||
#include <istream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "DBCStores.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "ItemTemplate.h"
|
#include "ItemTemplate.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
@ -77,7 +75,7 @@ void TellLosAction::ListGameObjects(std::string const title, GuidVector gos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TellAuraAction::Execute(Event event)
|
bool TellAuraAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->TellMaster("--- Auras ---");
|
botAI->TellMaster("--- Auras ---");
|
||||||
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "--- Auras ---");
|
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "--- Auras ---");
|
||||||
@ -130,7 +128,7 @@ bool TellAuraAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TellEstimatedDpsAction::Execute(Event event)
|
bool TellEstimatedDpsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float dps = AI_VALUE(float, "estimated group dps");
|
float dps = AI_VALUE(float, "estimated group dps");
|
||||||
botAI->TellMaster("Estimated Group DPS: " + std::to_string(dps));
|
botAI->TellMaster("Estimated Group DPS: " + std::to_string(dps));
|
||||||
|
|||||||
@ -8,13 +8,13 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool TellMasterAction::Execute(Event event)
|
bool TellMasterAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->TellMaster(text);
|
botAI->TellMaster(text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutOfReactRangeAction::Execute(Event event)
|
bool OutOfReactRangeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->TellMaster("Wait for me!");
|
botAI->TellMaster("Wait for me!");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -6,10 +6,10 @@
|
|||||||
#include "TellReputationAction.h"
|
#include "TellReputationAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "ReputationMgr.h"
|
#include "ReputationMgr.h"
|
||||||
|
|
||||||
bool TellReputationAction::Execute(Event event)
|
bool TellReputationAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
|
|||||||
@ -6,10 +6,11 @@
|
|||||||
#include "TellTargetAction.h"
|
#include "TellTargetAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "ThreatMgr.h"
|
#include "ThreatMgr.h"
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool TellTargetAction::Execute(Event event)
|
bool TellTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
||||||
if (target)
|
if (target)
|
||||||
@ -24,7 +25,7 @@ bool TellTargetAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TellAttackersAction::Execute(Event event)
|
bool TellAttackersAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->TellMaster("--- Attackers ---");
|
botAI->TellMaster("--- Attackers ---");
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "ItemCountValue.h"
|
#include "ItemCountValue.h"
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool TradeAction::Execute(Event event)
|
bool TradeAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
@ -106,9 +106,7 @@ bool TradeAction::TradeItem(Item const* item, int8 slot)
|
|||||||
for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT && tradeSlot == -1; i++)
|
for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT && tradeSlot == -1; i++)
|
||||||
{
|
{
|
||||||
if (pTrade->GetItem(TradeSlots(i)) == nullptr)
|
if (pTrade->GetItem(TradeSlots(i)) == nullptr)
|
||||||
{
|
|
||||||
tradeSlot = i;
|
tradeSlot = i;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -276,14 +276,11 @@ bool TradeStatusAction::CheckTrade()
|
|||||||
botAI->PlaySound(TEXT_EMOTE_NO);
|
botAI->PlaySound(TEXT_EMOTE_NO);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
@ -340,9 +337,7 @@ int32 TradeStatusAction::CalculateCost(Player* player, bool sell)
|
|||||||
if (!craftData.IsEmpty())
|
if (!craftData.IsEmpty())
|
||||||
{
|
{
|
||||||
if (player == trader && !sell && craftData.IsRequired(proto->ItemId))
|
if (player == trader && !sell && craftData.IsRequired(proto->ItemId))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (player == bot && sell && craftData.itemId == proto->ItemId && craftData.IsFulfilled())
|
if (player == bot && sell && craftData.itemId == proto->ItemId && craftData.IsFulfilled())
|
||||||
{
|
{
|
||||||
@ -352,13 +347,11 @@ int32 TradeStatusAction::CalculateCost(Player* player, bool sell)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sell)
|
if (sell)
|
||||||
{
|
|
||||||
sum += item->GetCount() * proto->SellPrice * sRandomPlayerbotMgr.GetSellMultiplier(bot);
|
sum += item->GetCount() * proto->SellPrice * sRandomPlayerbotMgr.GetSellMultiplier(bot);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sum += item->GetCount() * proto->BuyPrice * sRandomPlayerbotMgr.GetBuyMultiplier(bot);
|
sum += item->GetCount() * proto->BuyPrice * sRandomPlayerbotMgr.GetBuyMultiplier(bot);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sum;
|
return sum;
|
||||||
|
|||||||
@ -155,7 +155,7 @@ void TrainerAction::TellFooter(uint32 totalCost)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaintenanceAction::Execute(Event event)
|
bool MaintenanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig.maintenanceCommand)
|
if (!sPlayerbotAIConfig.maintenanceCommand)
|
||||||
{
|
{
|
||||||
@ -255,7 +255,7 @@ bool MaintenanceAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoveGlyphAction::Execute(Event event)
|
bool RemoveGlyphAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
for (uint32 slotIndex = 0; slotIndex < MAX_GLYPH_SLOT_INDEX; ++slotIndex)
|
for (uint32 slotIndex = 0; slotIndex < MAX_GLYPH_SLOT_INDEX; ++slotIndex)
|
||||||
{
|
{
|
||||||
@ -265,7 +265,7 @@ bool RemoveGlyphAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoGearAction::Execute(Event event)
|
bool AutoGearAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig.autoGearCommand)
|
if (!sPlayerbotAIConfig.autoGearCommand)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool TravelAction::Execute(Event event)
|
bool TravelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
||||||
|
|
||||||
@ -60,12 +60,14 @@ bool TravelAction::isUseful()
|
|||||||
(!AI_VALUE(GuidPosition, "rpg target") || !AI_VALUE(ObjectGuid, "pull target"));
|
(!AI_VALUE(GuidPosition, "rpg target") || !AI_VALUE(ObjectGuid, "pull target"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveToDarkPortalAction::Execute(Event event)
|
bool MoveToDarkPortalAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->GetGroup())
|
if (bot->GetGroup())
|
||||||
|
{
|
||||||
if (bot->GetGroup()->GetLeaderGUID() != bot->GetGUID() &&
|
if (bot->GetGroup()->GetLeaderGUID() != bot->GetGUID() &&
|
||||||
!GET_PLAYERBOT_AI(GET_PLAYERBOT_AI(bot)->GetGroupLeader()))
|
!GET_PLAYERBOT_AI(GET_PLAYERBOT_AI(bot)->GetGroupLeader()))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (bot->GetLevel() > 57)
|
if (bot->GetLevel() > 57)
|
||||||
{
|
{
|
||||||
@ -111,7 +113,7 @@ bool MoveToDarkPortalAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveToDarkPortalAction::isUseful() { return bot->GetLevel() > 54; }
|
bool MoveToDarkPortalAction::isUseful() { return bot->GetLevel() > 54; }
|
||||||
|
|
||||||
bool DarkPortalAzerothAction::Execute(Event event)
|
bool DarkPortalAzerothAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->GetLevel() > 57)
|
if (bot->GetLevel() > 57)
|
||||||
{
|
{
|
||||||
@ -126,7 +128,7 @@ bool DarkPortalAzerothAction::Execute(Event event)
|
|||||||
|
|
||||||
bool DarkPortalAzerothAction::isUseful() { return bot->GetLevel() > 57; }
|
bool DarkPortalAzerothAction::isUseful() { return bot->GetLevel() > 57; }
|
||||||
|
|
||||||
bool MoveFromDarkPortalAction::Execute(Event event)
|
bool MoveFromDarkPortalAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
#include "UnlockItemAction.h"
|
#include "UnlockItemAction.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "ItemTemplate.h"
|
#include "ItemTemplate.h"
|
||||||
#include "WorldPacket.h"
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
|
|
||||||
#define PICK_LOCK_SPELL_ID 1804
|
inline constexpr uint32_t PICK_LOCK_SPELL_ID = 1804;
|
||||||
|
|
||||||
bool UnlockItemAction::Execute(Event event)
|
bool UnlockItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool foundLockedItem = false;
|
bool foundLockedItem = false;
|
||||||
|
|
||||||
@ -32,7 +31,5 @@ void UnlockItemAction::UnlockItem(Item* item)
|
|||||||
botAI->TellMaster(out.str());
|
botAI->TellMaster(out.str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
botAI->TellError("Failed to cast Pick Lock.");
|
botAI->TellError("Failed to cast Pick Lock.");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
#include "UnlockTradedItemAction.h"
|
#include "UnlockTradedItemAction.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "TradeData.h"
|
#include "TradeData.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
|
|
||||||
#define PICK_LOCK_SPELL_ID 1804
|
inline constexpr uint32_t PICK_LOCK_SPELL_ID = 1804;
|
||||||
|
|
||||||
bool UnlockTradedItemAction::Execute(Event event)
|
bool UnlockTradedItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* trader = bot->GetTrader();
|
Player* trader = bot->GetTrader();
|
||||||
if (!trader)
|
if (!trader)
|
||||||
|
|||||||
@ -416,7 +416,7 @@ bool UseHearthStone::Execute(Event event)
|
|||||||
|
|
||||||
bool UseHearthStone::isUseful() { return !bot->InBattleground(); }
|
bool UseHearthStone::isUseful() { return !bot->InBattleground(); }
|
||||||
|
|
||||||
bool UseRandomRecipe::Execute(Event event)
|
bool UseRandomRecipe::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::vector<Item*> recipes = AI_VALUE2(std::vector<Item*>, "inventory items", "recipe");
|
std::vector<Item*> recipes = AI_VALUE2(std::vector<Item*>, "inventory items", "recipe");
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ bool UseRandomRecipe::isUseful()
|
|||||||
|
|
||||||
bool UseRandomRecipe::isPossible() { return AI_VALUE2(uint32, "item count", "recipe") > 0; }
|
bool UseRandomRecipe::isPossible() { return AI_VALUE2(uint32, "item count", "recipe") > 0; }
|
||||||
|
|
||||||
bool UseRandomQuestItem::Execute(Event event)
|
bool UseRandomQuestItem::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* unitTarget = nullptr;
|
Unit* unitTarget = nullptr;
|
||||||
ObjectGuid goTarget;
|
ObjectGuid goTarget;
|
||||||
|
|||||||
@ -55,16 +55,14 @@ bool UseMeetingStoneAction::Execute(Event event)
|
|||||||
return Teleport(master, bot, false);
|
return Teleport(master, bot, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SummonAction::Execute(Event event)
|
bool SummonAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Pet* pet = bot->GetPet())
|
if (Pet* pet = bot->GetPet())
|
||||||
{
|
|
||||||
botAI->PetFollow();
|
botAI->PetFollow();
|
||||||
}
|
|
||||||
|
|
||||||
if (master->GetSession()->GetSecurity() >= SEC_PLAYER)
|
if (master->GetSession()->GetSecurity() >= SEC_PLAYER)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -95,7 +95,7 @@ bool EnterVehicleAction::EnterVehicle(Unit* vehicleBase, bool moveIfFar)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LeaveVehicleAction::Execute(Event event)
|
bool LeaveVehicleAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Vehicle* myVehicle = bot->GetVehicle();
|
Vehicle* myVehicle = bot->GetVehicle();
|
||||||
if (!myVehicle)
|
if (!myVehicle)
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "ChatCommandHandlerStrategy.h"
|
#include "ChatCommandHandlerStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
class ChatCommandActionNodeFactoryInternal : public NamedObjectFactory<ActionNode>
|
class ChatCommandActionNodeFactoryInternal : public NamedObjectFactory<ActionNode>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "CombatStrategy.h"
|
#include "CombatStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "Strategy.h"
|
#include "Strategy.h"
|
||||||
|
|
||||||
void CombatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void CombatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "DuelStrategy.h"
|
#include "DuelStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
void DuelStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void DuelStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
PassTroughStrategy::InitTriggers(triggers);
|
PassTroughStrategy::InitTriggers(triggers);
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "FollowMasterStrategy.h"
|
#include "FollowMasterStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
std::vector<NextAction> FollowMasterStrategy::getDefaultActions()
|
std::vector<NextAction> FollowMasterStrategy::getDefaultActions()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "GuardStrategy.h"
|
#include "GuardStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
std::vector<NextAction> GuardStrategy::getDefaultActions()
|
std::vector<NextAction> GuardStrategy::getDefaultActions()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "NonCombatStrategy.h"
|
#include "NonCombatStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
void NonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
void NonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||||
{
|
{
|
||||||
triggers.push_back(new TriggerNode("random", { NextAction("clean quest log", 1.0f) }));
|
triggers.push_back(new TriggerNode("random", { NextAction("clean quest log", 1.0f) }));
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "RTSCStrategy.h"
|
#include "RTSCStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
RTSCStrategy::RTSCStrategy(PlayerbotAI* botAI) : Strategy(botAI) {}
|
RTSCStrategy::RTSCStrategy(PlayerbotAI* botAI) : Strategy(botAI) {}
|
||||||
|
|
||||||
void RTSCStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) {}
|
void RTSCStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) {}
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "RacialsStrategy.h"
|
#include "RacialsStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
class RacialsStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
|
class RacialsStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "UsePotionsStrategy.h"
|
#include "UsePotionsStrategy.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
class UsePotionsStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
|
class UsePotionsStrategyActionNodeFactory : public NamedObjectFactory<ActionNode>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -7,9 +7,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "BattlegroundWS.h"
|
|
||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "GameTime.h"
|
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "LastSpellCastValue.h"
|
#include "LastSpellCastValue.h"
|
||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
|
|||||||
@ -201,7 +201,6 @@ bool PartyMemberToHealOutOfSpellRangeTrigger::IsActive()
|
|||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
|
||||||
return target && (ServerFacade::instance().GetDistance2d(bot, target) > (distance + sPlayerbotAIConfig.contactDistance) ||
|
return target && (ServerFacade::instance().GetDistance2d(bot, target) > (distance + sPlayerbotAIConfig.contactDistance) ||
|
||||||
!bot->IsWithinLOSInMap(target));
|
!bot->IsWithinLOSInMap(target));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
#include "Arrow.h"
|
#include "Arrow.h"
|
||||||
|
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
#include "Group.h"
|
||||||
|
|
||||||
WorldLocation ArrowFormation::GetLocationInternal()
|
WorldLocation ArrowFormation::GetLocationInternal()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,9 @@
|
|||||||
#include "CcTargetValue.h"
|
#include "CcTargetValue.h"
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
#include "Group.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
class FindTargetForCcStrategy : public FindTargetStrategy
|
class FindTargetForCcStrategy : public FindTargetStrategy
|
||||||
|
|||||||
@ -4,8 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CurrentCcTargetValue.h"
|
#include "CurrentCcTargetValue.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
|
|
||||||
class FindCurrentCcTargetStrategy : public FindTargetStrategy
|
class FindCurrentCcTargetStrategy : public FindTargetStrategy
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,7 +29,6 @@ public:
|
|||||||
foundHighPriority = true;
|
foundHighPriority = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unit* victim = attacker->GetVictim();
|
|
||||||
if (!result || CalcThreatGap(attacker, threatMgr) > CalcThreatGap(result, &result->GetThreatMgr()))
|
if (!result || CalcThreatGap(attacker, threatMgr) > CalcThreatGap(result, &result->GetThreatMgr()))
|
||||||
result = attacker;
|
result = attacker;
|
||||||
}
|
}
|
||||||
@ -144,7 +143,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override
|
void CheckAttacker(Unit* attacker, ThreatMgr*) override
|
||||||
{
|
{
|
||||||
if (Group* group = botAI->GetBot()->GetGroup())
|
if (Group* group = botAI->GetBot()->GetGroup())
|
||||||
{
|
{
|
||||||
@ -195,7 +194,6 @@ public:
|
|||||||
}
|
}
|
||||||
int32_t GetIntervalLevel(Unit* unit)
|
int32_t GetIntervalLevel(Unit* unit)
|
||||||
{
|
{
|
||||||
float time = unit->GetHealth() / dps_;
|
|
||||||
float dis = unit->GetDistance(botAI->GetBot());
|
float dis = unit->GetDistance(botAI->GetBot());
|
||||||
float attackRange =
|
float attackRange =
|
||||||
botAI->IsRanged(botAI->GetBot()) ? sPlayerbotAIConfig.spellDistance : sPlayerbotAIConfig.meleeDistance;
|
botAI->IsRanged(botAI->GetBot()) ? sPlayerbotAIConfig.spellDistance : sPlayerbotAIConfig.meleeDistance;
|
||||||
@ -218,7 +216,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override
|
void CheckAttacker(Unit* attacker, ThreatMgr*) override
|
||||||
{
|
{
|
||||||
if (Group* group = botAI->GetBot()->GetGroup())
|
if (Group* group = botAI->GetBot()->GetGroup())
|
||||||
{
|
{
|
||||||
@ -276,7 +274,6 @@ public:
|
|||||||
}
|
}
|
||||||
int32_t GetIntervalLevel(Unit* unit)
|
int32_t GetIntervalLevel(Unit* unit)
|
||||||
{
|
{
|
||||||
float time = unit->GetHealth() / dps_;
|
|
||||||
float dis = unit->GetDistance(botAI->GetBot());
|
float dis = unit->GetDistance(botAI->GetBot());
|
||||||
float attackRange =
|
float attackRange =
|
||||||
botAI->IsRanged(botAI->GetBot()) ? sPlayerbotAIConfig.spellDistance : sPlayerbotAIConfig.meleeDistance;
|
botAI->IsRanged(botAI->GetBot()) ? sPlayerbotAIConfig.spellDistance : sPlayerbotAIConfig.meleeDistance;
|
||||||
@ -322,7 +319,7 @@ class FindMaxHpTargetStrategy : public FindTargetStrategy
|
|||||||
public:
|
public:
|
||||||
FindMaxHpTargetStrategy(PlayerbotAI* botAI) : FindTargetStrategy(botAI), maxHealth(0) {}
|
FindMaxHpTargetStrategy(PlayerbotAI* botAI) : FindTargetStrategy(botAI), maxHealth(0) {}
|
||||||
|
|
||||||
void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override
|
void CheckAttacker(Unit* attacker, ThreatMgr*) override
|
||||||
{
|
{
|
||||||
if (Group* group = botAI->GetBot()->GetGroup())
|
if (Group* group = botAI->GetBot()->GetGroup())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "ItemCountValue.h"
|
#include "ItemCountValue.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
std::vector<Item*> InventoryItemValueBase::Find(std::string const qualifier)
|
std::vector<Item*> InventoryItemValueBase::Find(std::string const qualifier)
|
||||||
{
|
{
|
||||||
@ -25,9 +25,7 @@ uint32 ItemCountValue::Calculate()
|
|||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
std::vector<Item*> items = Find(qualifier);
|
std::vector<Item*> items = Find(qualifier);
|
||||||
for (Item* item : items)
|
for (Item* item : items)
|
||||||
{
|
|
||||||
count += item->GetCount();
|
count += item->GetCount();
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
LastMovement::LastMovement() { clear(); }
|
LastMovement::LastMovement() { clear(); }
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include "LeastHpTargetValue.h"
|
#include "LeastHpTargetValue.h"
|
||||||
|
|
||||||
#include "AttackersValue.h"
|
#include "AttackersValue.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy
|
class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#ifndef _PLAYERBOT_LOGLEVELVALUE_H
|
#ifndef _PLAYERBOT_LOGLEVELVALUE_H
|
||||||
#define _PLAYERBOT_LOGLEVELVALUE_H
|
#define _PLAYERBOT_LOGLEVELVALUE_H
|
||||||
|
|
||||||
|
#include "LogCommon.h"
|
||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
|
|
||||||
class PlayerbotAI;
|
class PlayerbotAI;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user