mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-31 01:13:48 +00:00
Compare commits
22 Commits
hermensbas
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00d19dbf9c | ||
|
|
caae524a0a | ||
|
|
13fff46fa0 | ||
|
|
a92886032c | ||
|
|
f5711dc6f7 | ||
|
|
43e8e31980 | ||
|
|
c59a02ed89 | ||
|
|
7abd836971 | ||
|
|
5365ba86b5 | ||
|
|
378254af3f | ||
|
|
3d467ce3bb | ||
|
|
3e21563669 | ||
|
|
bf456ee07f | ||
|
|
a5bd0b9a41 | ||
|
|
34bab48dd4 | ||
|
|
41c53365ae | ||
|
|
fd07e02a8a | ||
|
|
6cf7f1aaef | ||
|
|
9f54d7e702 | ||
|
|
aeaaee15da | ||
|
|
a1137dbddc | ||
|
|
2eb98c3233 |
6
.github/workflows/windows_build.yml
vendored
6
.github/workflows/windows_build.yml
vendored
@@ -25,21 +25,25 @@ jobs:
|
||||
with:
|
||||
repository: 'mod-playerbots/azerothcore-wotlk'
|
||||
ref: 'Playerbot'
|
||||
path: 'ac'
|
||||
- name: Checkout Playerbot Module
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mod-playerbots/mod-playerbots'
|
||||
path: 'modules/mod-playerbots'
|
||||
#path: 'modules/mod-playerbots'
|
||||
path: ac/modules/mod-playerbots
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.13
|
||||
- name: Configure OS
|
||||
shell: bash
|
||||
working-directory: ac
|
||||
env:
|
||||
CONTINUOUS_INTEGRATION: true
|
||||
run: |
|
||||
./acore.sh install-deps
|
||||
- name: Build
|
||||
shell: bash
|
||||
working-directory: ac
|
||||
run: |
|
||||
export CTOOLS_BUILD=all
|
||||
./acore.sh compiler build
|
||||
|
||||
127
PULL_REQUEST_TEMPLATE.md
Normal file
127
PULL_REQUEST_TEMPLATE.md
Normal file
@@ -0,0 +1,127 @@
|
||||
# Pull Request
|
||||
|
||||
Describe what this change does and why it is needed...
|
||||
|
||||
---
|
||||
|
||||
## Design Philosophy
|
||||
|
||||
We prioritize **stability, performance, and predictability** over behavioral realism.
|
||||
Complex player-mimicking logic is intentionally limited due to its negative impact on scalability, maintainability, and
|
||||
long-term robustness.
|
||||
|
||||
Excessive processing overhead can lead to server hiccups, increased CPU usage, and degraded performance for all
|
||||
participants. Because every action and
|
||||
decision tree is executed **per bot and per trigger**, even small increases in logic complexity can scale poorly and
|
||||
negatively affect both players and
|
||||
world (random) bots. Bots are not expected to behave perfectly, and perfect simulation of human decision-making is not a
|
||||
project goal. Increased behavioral
|
||||
realism often introduces disproportionate cost, reduced predictability, and significantly higher maintenance overhead.
|
||||
|
||||
Every additional branch of logic increases long-term responsibility. All decision paths must be tested, validated, and
|
||||
maintained continuously as the system evolves.
|
||||
If advanced or AI-intensive behavior is introduced, the **default configuration must remain the lightweight decision
|
||||
model**. More complex behavior should only be
|
||||
available as an **explicit opt-in option**, clearly documented as having a measurable performance cost.
|
||||
|
||||
Principles:
|
||||
|
||||
- **Stability before intelligence**
|
||||
A stable system is always preferred over a smarter one.
|
||||
|
||||
- **Performance is a shared resource**
|
||||
Any increase in bot cost affects all players and all bots.
|
||||
|
||||
- **Simple logic scales better than smart logic**
|
||||
Predictable behavior under load is more valuable than perfect decisions.
|
||||
|
||||
- **Complexity must justify itself**
|
||||
If a feature cannot clearly explain its cost, it should not exist.
|
||||
|
||||
- **Defaults must be cheap**
|
||||
Expensive behavior must always be optional and clearly communicated.
|
||||
|
||||
- **Bots should look reasonable, not perfect**
|
||||
The goal is believable behavior, not human simulation.
|
||||
|
||||
Before submitting, confirm that this change aligns with those principles.
|
||||
|
||||
---
|
||||
|
||||
## Feature Evaluation
|
||||
|
||||
Please answer the following:
|
||||
|
||||
- Describe the **minimum logic** required to achieve the intended behavior?
|
||||
- Describe the **cheapest implementation** that produces an acceptable result?
|
||||
- Describe the **runtime cost** when this logic executes across many bots?
|
||||
|
||||
---
|
||||
|
||||
## 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?
|
||||
- [ ] No
|
||||
- [ ] Yes (**explain below**)
|
||||
|
||||
- Does this change increase per-bot or per-tick processing?
|
||||
- [ ] No
|
||||
- [ ] Yes (**describe and justify impact**)
|
||||
|
||||
- Could this logic scale poorly under load?
|
||||
- [ ] No
|
||||
- [ ] Yes (**explain why**)
|
||||
|
||||
---
|
||||
|
||||
## Defaults & Configuration
|
||||
|
||||
- Does this change modify default bot behavior?
|
||||
- [ ] 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?
|
||||
- [ ] No
|
||||
- [ ] Yes (**explain below**)
|
||||
|
||||
If yes, please specify:
|
||||
|
||||
- AI tool or model used (e.g. ChatGPT, GPT-4, Claude, etc.)
|
||||
- Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation)
|
||||
- Which parts of the change were influenced or generated
|
||||
- Whether the result was manually reviewed and adapted
|
||||
|
||||
AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor.
|
||||
Any AI-influenced changes must be verified against existing CORE and PB logic. We expect contributors to be honest
|
||||
about what they do and do not understand.
|
||||
|
||||
---
|
||||
|
||||
## Final Checklist
|
||||
|
||||
- [ ] Stability is not compromised
|
||||
- [ ] Performance impact is understood, tested, and acceptable
|
||||
- [ ] Added logic complexity is justified and explained
|
||||
- [ ] 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.
|
||||
@@ -3,8 +3,9 @@
|
||||
##################################################
|
||||
|
||||
# Overview
|
||||
# "Randombot": randomly generated bots that log in separately from players and populate the world. Depending on settings, randombots may automatically grind, quest, and upgrade equipment and can be invited to groups and given commands.
|
||||
# "Altbot": characters created on player accounts, which may be logged in by the player and invited to groups and given commands like randombots. Depending on settings, altbots can be limited to characters on the active player's account or in the active player's guild.
|
||||
# "Randombot": randomly generated bots that log in separately from players and populate the world. Randombots may automatically grind, quest, level up, and upgrade equipment and can be invited to groups and given commands.
|
||||
# "AddClass bot": bots from the AddClassAccountPoolSize accounts. They are used for quickly adding a leveled and geared bot of any class to your party. They are recommended for a quick formation of a party.
|
||||
# "Altbot": characters created on player accounts, which may be logged in by the player and invited to groups and given commands like randombots. They are best suited for long-progression playthroughs.
|
||||
# Information about commands to control bots and set their strategies can be found on the wiki at https://github.com/mod-playerbots/mod-playerbots/wiki/Playerbot-Commands.
|
||||
|
||||
####################################################################################################
|
||||
@@ -269,7 +270,7 @@ AiPlayerbot.UseFastFlyMountAtMinLevel = 70
|
||||
AiPlayerbot.RandomBotShowHelmet = 1
|
||||
AiPlayerbot.RandomBotShowCloak = 1
|
||||
|
||||
# Randombots and altbots automatically equip any items in their inventory that are sufficient upgrades
|
||||
# Toggles whether altbots will automatically equip items in their inventory that are sufficient upgrades
|
||||
# Default: 1 (enabled)
|
||||
AiPlayerbot.AutoEquipUpgradeLoot = 1
|
||||
|
||||
@@ -543,8 +544,8 @@ AiPlayerbot.AutoGearQualityLimit = 3
|
||||
# Max iLVL Phase 1(MC, Ony, ZG) = 78 | Phase 2(BWL) = 83 | Phase 2.5(AQ40) = 88 | Phase 3(Naxx40) = 92
|
||||
# TBC
|
||||
# Max iLVL Tier 4 = 120 | Tier 5 = 133 | Tier 6 = 164
|
||||
# Max iLVL Phase 1(Kara, Gruul, Mag) = 125 | Phase 1.5(ZA) = 138 | Phase 2(SC, TK) = 141 | Phase 3(Hyjal, BT) = 156 | Phase 4(Sunwell) = 164
|
||||
# Wotlk
|
||||
# Max iLVL Phase 1(Kara, Gruul, Mag) = 125 | Phase 2(SSC, TK, ZA) = 141 | Phase 3(Hyjal, BT) = 156 | Phase 4(Sunwell) = 164
|
||||
# WotLK
|
||||
# Max iLVL Tier 7(10/25) = 200/213 | Tier 8(10/25) = 225/232 | Tier 9(10/25) = 232/245 | Tier 10(10/25/HC) = 251/264/290
|
||||
# Max iLVL Phase 1(Naxx) = 224 | Phase 2(Ulduar) = 245 | Phase 3(ToC) = 258 | Phase 4(ICC) = 290
|
||||
# Default: 0 (no limit)
|
||||
@@ -669,7 +670,7 @@ AiPlayerbot.DisableDeathKnightLogin = 0
|
||||
# Default: 0 (disabled)
|
||||
AiPlayerbot.LimitTalentsExpansion = 0
|
||||
|
||||
# Configure randombots and addClass bot trading (0: Disabled, 1: Enabled, 2: Only Buy, 3: Only Sell)
|
||||
# Configure randombot trading (0: Disabled, 1: Enabled, 2: Only Buy, 3: Only Sell)
|
||||
# Default: 1 (enabled)
|
||||
AiPlayerbot.EnableRandomBotTrading = 1
|
||||
|
||||
@@ -735,7 +736,7 @@ AiPlayerbot.RandomGearQualityLimit = 3
|
||||
# TBC
|
||||
# Max iLVL Tier 4 = 120 | Tier 5 = 133 | Tier 6 = 164
|
||||
# Max iLVL Phase 1(Kara, Gruul, Mag) = 125 | Phase 2(SSC, TK, ZA) = 141 | Phase 3(Hyjal, BT) = 156 | Phase 4(Sunwell) = 164
|
||||
# Wotlk
|
||||
# WotLK
|
||||
# Max iLVL Tier 7(10/25) = 200/213 | Tier 8(10/25) = 225/232 | Tier 9(10/25) = 232/245 | Tier 10(10/25/HC) = 251/264/290
|
||||
# Max iLVL Phase 1(Naxx) = 224 | Phase 2(Ulduar) = 245 | Phase 3(ToC) = 258 | Phase 4(ICC) = 290
|
||||
# Default: 0 (no limit)
|
||||
@@ -1623,7 +1624,7 @@ AiPlayerbot.PremadeSpecLink.9.1.60 = -003203301135112530135201051
|
||||
AiPlayerbot.PremadeSpecLink.9.1.70 = -003203301135112530135201051-55
|
||||
AiPlayerbot.PremadeSpecLink.9.1.80 = -003203301135112530135221351-55000005
|
||||
AiPlayerbot.PremadeSpecName.9.2 = destro pve
|
||||
AiPlayerbot.PremadeSpecGlyph.9.2 = 45785,43390,50077,43394,43393,42454
|
||||
AiPlayerbot.PremadeSpecGlyph.9.2 = 45785,43390,42454,43394,43393,45785
|
||||
AiPlayerbot.PremadeSpecLink.9.2.60 = --05203215200231051305031151
|
||||
AiPlayerbot.PremadeSpecLink.9.2.80 = 23-0302-05203215220331051335231351
|
||||
AiPlayerbot.PremadeSpecName.9.3 = affli pvp
|
||||
|
||||
@@ -46,10 +46,10 @@ bool AcceptInvitationAction::Execute(Event event)
|
||||
if (!bot->GetGroup() || !bot->GetGroup()->IsMember(inviter->GetGUID()))
|
||||
return false;
|
||||
|
||||
if (sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
botAI->SetMaster(inviter);
|
||||
// else
|
||||
// sPlayerbotDbStore->Save(botAI);
|
||||
// PlayerbotRepository::instance().Save(botAI);
|
||||
|
||||
botAI->ResetStrategies();
|
||||
botAI->ChangeStrategy("+follow,-lfg,-bg", BOT_STATE_NON_COMBAT);
|
||||
@@ -57,7 +57,7 @@ bool AcceptInvitationAction::Execute(Event event)
|
||||
|
||||
botAI->TellMaster("Hello");
|
||||
|
||||
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance)
|
||||
if (sPlayerbotAIConfig.summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig.sightDistance)
|
||||
{
|
||||
Teleport(inviter, bot, true);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ bool ReachAreaTriggerAction::Execute(Event event)
|
||||
/*forceDestination*/ false);
|
||||
|
||||
float distance = bot->GetDistance(at->x, at->y, at->z);
|
||||
float delay = 1000.0f * distance / bot->GetSpeed(MOVE_RUN) + sPlayerbotAIConfig->reactDelay;
|
||||
float delay = 1000.0f * distance / bot->GetSpeed(MOVE_RUN) + sPlayerbotAIConfig.reactDelay;
|
||||
botAI->TellError("Wait for me");
|
||||
botAI->SetNextCheckDelay(delay);
|
||||
context->GetValue<LastMovement&>("last area trigger")->Get().lastAreaTrigger = triggerId;
|
||||
@@ -87,8 +87,8 @@ bool AttackAction::Attack(Unit* target, bool /*with_pet*/ /*true*/)
|
||||
// Check if bot OR target is in prohibited zone/area (skip for duels)
|
||||
if ((target->IsPlayer() || target->IsPet()) &&
|
||||
(!bot->duel || bot->duel->Opponent != target) &&
|
||||
(sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId()) ||
|
||||
sPlayerbotAIConfig->IsPvpProhibited(target->GetZoneId(), target->GetAreaId())))
|
||||
(sPlayerbotAIConfig.IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId()) ||
|
||||
sPlayerbotAIConfig.IsPvpProhibited(target->GetZoneId(), target->GetAreaId())))
|
||||
{
|
||||
if (verbose)
|
||||
botAI->TellError("I cannot attack other players in PvP prohibited areas.");
|
||||
@@ -160,7 +160,7 @@ bool AttackAction::Attack(Unit* target, bool /*with_pet*/ /*true*/)
|
||||
}
|
||||
|
||||
if (botAI->CanMove() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target))
|
||||
sServerFacade->SetFacingTo(bot, target);
|
||||
ServerFacade::instance().SetFacingTo(bot, target);
|
||||
|
||||
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
||||
|
||||
@@ -19,7 +19,7 @@ bool AutoMaintenanceOnLevelupAction::Execute(Event event)
|
||||
|
||||
void AutoMaintenanceOnLevelupAction::AutoTeleportForLevel()
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!sPlayerbotAIConfig.autoTeleportForLevel || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -27,13 +27,13 @@ void AutoMaintenanceOnLevelupAction::AutoTeleportForLevel()
|
||||
{
|
||||
return;
|
||||
}
|
||||
sRandomPlayerbotMgr->RandomTeleportForLevel(bot);
|
||||
sRandomPlayerbotMgr.RandomTeleportForLevel(bot);
|
||||
return;
|
||||
}
|
||||
|
||||
void AutoMaintenanceOnLevelupAction::AutoPickTalents()
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoPickTalents || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!sPlayerbotAIConfig.autoPickTalents || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
return;
|
||||
|
||||
if (bot->GetFreeTalentPoints() <= 0)
|
||||
@@ -65,10 +65,10 @@ void AutoMaintenanceOnLevelupAction::AutoLearnSpell()
|
||||
void AutoMaintenanceOnLevelupAction::LearnSpells(std::ostringstream* out)
|
||||
{
|
||||
BroadcastHelper::BroadcastLevelup(botAI, bot);
|
||||
if (sPlayerbotAIConfig->autoLearnTrainerSpells && sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (sPlayerbotAIConfig.autoLearnTrainerSpells && sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
LearnTrainerSpells(out);
|
||||
|
||||
if (sPlayerbotAIConfig->autoLearnQuestSpells && sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (sPlayerbotAIConfig.autoLearnQuestSpells && sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
LearnQuestSpells(out);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ std::string const AutoMaintenanceOnLevelupAction::FormatSpell(SpellInfo const* s
|
||||
|
||||
void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!sPlayerbotAIConfig.autoUpgradeEquip || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
return;
|
||||
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
@@ -180,9 +180,9 @@ void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
||||
factory.InitConsumables();
|
||||
factory.InitPotions();
|
||||
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||
if (!sPlayerbotAIConfig.equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig.equipmentPersistenceLevel)
|
||||
{
|
||||
if (sPlayerbotAIConfig->incrementalGearInit)
|
||||
if (sPlayerbotAIConfig.incrementalGearInit)
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
// continue;
|
||||
|
||||
if (offline)
|
||||
sRandomPlayerbotMgr->AddPlayerBot(itr->Guid, 0);
|
||||
sRandomPlayerbotMgr.AddPlayerBot(itr->Guid, 0);
|
||||
|
||||
if (member)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
if (member->GetGroup() && memberBotAI->HasRealPlayerMaster())
|
||||
continue;
|
||||
|
||||
if (!sPlayerbotAIConfig->IsInRandomAccountList(member->GetSession()->GetAccountId()))
|
||||
if (!sPlayerbotAIConfig.IsInRandomAccountList(member->GetSession()->GetAccountId()))
|
||||
continue;
|
||||
|
||||
if (member->IsInCombat())
|
||||
@@ -250,13 +250,13 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
TeamSize = (uint32)type;
|
||||
|
||||
// Check if bots should join Rated Arena (Only captains can queue)
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
@@ -265,7 +265,7 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
{
|
||||
if (sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type))
|
||||
{
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
||||
ratedList.push_back(queueTypeId);
|
||||
return true;
|
||||
}
|
||||
@@ -274,13 +274,13 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
// Check if bots should join Skirmish Arena
|
||||
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||
uint32 skirmishArenaBotCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||
if (maxRequiredSkirmishBots != 0)
|
||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||
@@ -294,12 +294,12 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
}
|
||||
|
||||
// Check if bots should join Battleground
|
||||
uint32 bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
||||
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
||||
uint32 bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
||||
uint32 bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
uint32 bgAllianceBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
||||
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
||||
uint32 bgHordeBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
||||
uint32 bgHordePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
@@ -318,7 +318,7 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
bool BGJoinAction::isUseful()
|
||||
{
|
||||
// do not try if BG bots disabled
|
||||
if (!sPlayerbotAIConfig->randomBotJoinBG)
|
||||
if (!sPlayerbotAIConfig.randomBotJoinBG)
|
||||
return false;
|
||||
|
||||
// can't queue while in BG/Arena
|
||||
@@ -440,7 +440,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
|
||||
// get battlemaster
|
||||
// Unit* unit = botAI->GetUnit(AI_VALUE2(CreatureData const*, "bg master", bgTypeId));
|
||||
Unit* unit = botAI->GetUnit(sRandomPlayerbotMgr->GetBattleMasterGUID(bot, bgTypeId));
|
||||
Unit* unit = botAI->GetUnit(sRandomPlayerbotMgr.GetBattleMasterGUID(bot, bgTypeId));
|
||||
if (!unit && isArena)
|
||||
{
|
||||
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(0);
|
||||
@@ -450,7 +450,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
|
||||
// This breaks groups as refresh includes a remove from group function call.
|
||||
// refresh food/regs
|
||||
// sRandomPlayerbotMgr->Refresh(bot);
|
||||
// sRandomPlayerbotMgr.Refresh(bot);
|
||||
|
||||
bool joinAsGroup = bot->GetGroup() && bot->GetGroup()->GetLeaderGUID() == bot->GetGUID();
|
||||
|
||||
@@ -523,23 +523,23 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
{
|
||||
if (!isRated)
|
||||
{
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount++;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount++;
|
||||
}
|
||||
}
|
||||
else if (!joinAsGroup)
|
||||
{
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount++;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount++;
|
||||
else
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount++;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount +=
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount +=
|
||||
bot->GetGroup()->GetMembersCount();
|
||||
else
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount +=
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount +=
|
||||
bot->GetGroup()->GetMembersCount();
|
||||
}
|
||||
|
||||
@@ -588,13 +588,13 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
TeamSize = (uint32)type;
|
||||
|
||||
// Check if bots should join Rated Arena (Only captains can queue)
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
@@ -603,7 +603,7 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
{
|
||||
if (sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type))
|
||||
{
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
||||
ratedList.push_back(queueTypeId);
|
||||
return true;
|
||||
}
|
||||
@@ -612,13 +612,13 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
// Check if bots should join Skirmish Arena
|
||||
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||
uint32 skirmishArenaBotCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||
if (maxRequiredSkirmishBots != 0)
|
||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||
@@ -632,12 +632,12 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
}
|
||||
|
||||
// Check if bots should join Battleground
|
||||
uint32 bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
||||
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
||||
uint32 bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
||||
uint32 bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
uint32 bgAllianceBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
||||
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
||||
uint32 bgHordeBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
||||
uint32 bgHordePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
@@ -670,7 +670,7 @@ bool BGLeaveAction::Execute(Event event)
|
||||
uint16 unk = 0x1F90;
|
||||
uint8 unk2 = 0x0;
|
||||
bool isArena = false;
|
||||
bool IsRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
|
||||
bool IsRandomBot = sRandomPlayerbotMgr.IsRandomBot(bot);
|
||||
|
||||
ArenaType arenaType = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId));
|
||||
if (arenaType)
|
||||
@@ -709,7 +709,7 @@ bool BGStatusAction::LeaveBG(PlayerbotAI* botAI)
|
||||
if (!bg)
|
||||
return false;
|
||||
bool isArena = bg->isArena();
|
||||
bool isRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
|
||||
bool isRandomBot = sRandomPlayerbotMgr.IsRandomBot(bot);
|
||||
|
||||
if (isRandomBot)
|
||||
botAI->SetMaster(nullptr);
|
||||
@@ -805,7 +805,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
break;
|
||||
}
|
||||
|
||||
bool IsRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
|
||||
bool IsRandomBot = sRandomPlayerbotMgr.IsRandomBot(bot);
|
||||
BattlegroundQueueTypeId queueTypeId = bot->GetBattlegroundQueueTypeId(QueueSlot);
|
||||
BattlegroundTypeId _bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
||||
if (!queueTypeId)
|
||||
@@ -958,10 +958,10 @@ bool BGStatusAction::Execute(Event event)
|
||||
//TeamId teamId = bot->GetTeamId(); //not used, line marked for removal.
|
||||
bool realPlayers = false;
|
||||
if (isRated)
|
||||
realPlayers = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount > 0;
|
||||
realPlayers = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount > 0;
|
||||
else
|
||||
realPlayers =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
||||
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
||||
|
||||
if (realPlayers)
|
||||
return false;
|
||||
@@ -1276,7 +1276,7 @@ static std::pair<uint32, uint32> IC_AttackObjectives[] = {
|
||||
// useful commands for fixing BG bugs and checking waypoints/paths
|
||||
bool BGTactics::HandleConsoleCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->enabled)
|
||||
if (!sPlayerbotAIConfig.enabled)
|
||||
{
|
||||
handler->PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
|
||||
return true;
|
||||
@@ -2219,7 +2219,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
if (urand(0, 99) < 20 && teamFC)
|
||||
{
|
||||
target.Relocate(teamFC->GetPositionX(), teamFC->GetPositionY(), teamFC->GetPositionZ());
|
||||
if (sServerFacade->GetDistance2d(bot, teamFC) < 33.0f)
|
||||
if (ServerFacade::instance().GetDistance2d(bot, teamFC) < 33.0f)
|
||||
Follow(teamFC);
|
||||
}
|
||||
else
|
||||
@@ -2263,7 +2263,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
if (urand(0, 99) < 70)
|
||||
{
|
||||
target.Relocate(teamFC->GetPositionX(), teamFC->GetPositionY(), teamFC->GetPositionZ());
|
||||
if (sServerFacade->GetDistance2d(bot, teamFC) < 33.0f)
|
||||
if (ServerFacade::instance().GetDistance2d(bot, teamFC) < 33.0f)
|
||||
Follow(teamFC);
|
||||
}
|
||||
}
|
||||
@@ -2284,7 +2284,7 @@ bool BGTactics::selectObjective(bool reset)
|
||||
{
|
||||
// Assist own FC if not pursuing enemy FC
|
||||
target.Relocate(teamFC->GetPositionX(), teamFC->GetPositionY(), teamFC->GetPositionZ());
|
||||
if (sServerFacade->GetDistance2d(bot, teamFC) < 33.0f)
|
||||
if (ServerFacade::instance().GetDistance2d(bot, teamFC) < 33.0f)
|
||||
Follow(teamFC);
|
||||
}
|
||||
else if (urand(0, 99) < 5)
|
||||
@@ -3197,11 +3197,11 @@ bool BGTactics::moveToObjective(bool ignoreDist)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ignoreDist && sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, pos.x, pos.y), 100.0f))
|
||||
if (!ignoreDist && ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, pos.x, pos.y), 100.0f))
|
||||
{
|
||||
// std::ostringstream out;
|
||||
// out << "It is too far away! " << pos.x << ", " << pos.y << ", Distance: " <<
|
||||
// sServerFacade->GetDistance2d(bot, pos.x, pos.y); bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
// ServerFacade::instance().GetDistance2d(bot, pos.x, pos.y); bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3213,7 +3213,7 @@ bool BGTactics::moveToObjective(bool ignoreDist)
|
||||
}
|
||||
|
||||
// std::ostringstream out; out << "Moving to objective " << pos.x << ", " << pos.y << ", Distance: " <<
|
||||
// sServerFacade->GetDistance2d(bot, pos.x, pos.y); bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
// ServerFacade::instance().GetDistance2d(bot, pos.x, pos.y); bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
|
||||
// dont increase from 1.5 will cause bugs with horde capping AV towers
|
||||
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z, 1.5f);
|
||||
@@ -3433,7 +3433,7 @@ bool BGTactics::moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 curr
|
||||
// out << "WP: ";
|
||||
// reverse ? out << currPoint << " <<< -> " << nPoint : out << currPoint << ">>> ->" << nPoint;
|
||||
// out << ", " << nextPoint.x << ", " << nextPoint.y << " Path Size: " << currentPath->size() << ", Dist: " <<
|
||||
// sServerFacade->GetDistance2d(bot, nextPoint.x, nextPoint.y); bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
// ServerFacade::instance().GetDistance2d(bot, nextPoint.x, nextPoint.y); bot->Say(out.str(), LANG_UNIVERSAL);
|
||||
|
||||
return MoveTo(bot->GetMapId(), nextPoint.x + frand(-2, 2), nextPoint.y + frand(-2, 2), nextPoint.z);
|
||||
}
|
||||
@@ -4039,9 +4039,9 @@ bool BGTactics::useBuff()
|
||||
if (closeObjects.empty())
|
||||
return false;
|
||||
|
||||
bool needRegen = bot->GetHealthPct() < sPlayerbotAIConfig->mediumHealth ||
|
||||
bool needRegen = bot->GetHealthPct() < sPlayerbotAIConfig.mediumHealth ||
|
||||
(AI_VALUE2(bool, "has mana", "self target") &&
|
||||
AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig->mediumMana);
|
||||
AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig.mediumMana);
|
||||
bool needSpeed = (bgType != BATTLEGROUND_WS || bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) ||
|
||||
bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG) || bot->HasAura(BG_EY_NETHERSTORM_FLAG_SPELL)) ||
|
||||
!(teamFlagTaken() || flagTaken());
|
||||
@@ -4057,7 +4057,7 @@ bool BGTactics::useBuff()
|
||||
continue;
|
||||
|
||||
// use speed buff only if close
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, go),
|
||||
if (ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, go),
|
||||
go->GetEntry() == Buff_Entries[0] ? 20.0f : 50.0f))
|
||||
continue;
|
||||
|
||||
@@ -4107,7 +4107,7 @@ uint32 BGTactics::getPlayersInArea(TeamId teamId, Position point, float range, b
|
||||
if (!combat && player->IsInCombat())
|
||||
continue;
|
||||
|
||||
if (sServerFacade->GetDistance2d(player, point.GetPositionX(), point.GetPositionY()) < range)
|
||||
if (ServerFacade::instance().GetDistance2d(player, point.GetPositionX(), point.GetPositionY()) < range)
|
||||
++defCount;
|
||||
}
|
||||
}
|
||||
@@ -4191,9 +4191,9 @@ bool BGTactics::IsLockedInsideKeep()
|
||||
// get closest portal
|
||||
if (bot->GetTeamId() == TEAM_ALLIANCE && go->GetEntry() == GO_TELEPORTER_4)
|
||||
{
|
||||
float tempDist = sServerFacade->GetDistance2d(bot, go->GetPositionX(), go->GetPositionY());
|
||||
float tempDist = ServerFacade::instance().GetDistance2d(bot, go->GetPositionX(), go->GetPositionY());
|
||||
|
||||
if (sServerFacade->IsDistanceLessThan(tempDist, closestDistance))
|
||||
if (ServerFacade::instance().IsDistanceLessThan(tempDist, closestDistance))
|
||||
{
|
||||
closestDistance = tempDist;
|
||||
closestPortal = go;
|
||||
@@ -4204,9 +4204,9 @@ bool BGTactics::IsLockedInsideKeep()
|
||||
// get closest portal
|
||||
if (bot->GetTeamId() == TEAM_HORDE && go->GetEntry() == GO_TELEPORTER_2)
|
||||
{
|
||||
float tempDist = sServerFacade->GetDistance2d(bot, go->GetPositionX(), go->GetPositionY());
|
||||
float tempDist = ServerFacade::instance().GetDistance2d(bot, go->GetPositionX(), go->GetPositionY());
|
||||
|
||||
if (sServerFacade->IsDistanceLessThan(tempDist, closestDistance))
|
||||
if (ServerFacade::instance().IsDistanceLessThan(tempDist, closestDistance))
|
||||
{
|
||||
closestDistance = tempDist;
|
||||
closestPortal = go;
|
||||
@@ -4253,7 +4253,7 @@ bool ArenaTactics::Execute(Event event)
|
||||
{
|
||||
if (!bot->InBattleground())
|
||||
{
|
||||
bool IsRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot->GetGUID().GetCounter());
|
||||
bool IsRandomBot = sRandomPlayerbotMgr.IsRandomBot(bot->GetGUID().GetCounter());
|
||||
botAI->ChangeStrategy("-arena", BOT_STATE_COMBAT);
|
||||
botAI->ChangeStrategy("-arena", BOT_STATE_NON_COMBAT);
|
||||
botAI->ResetStrategies(!IsRandomBot);
|
||||
@@ -130,10 +130,10 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target != bot && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target, sPlayerbotAIConfig->sightDistance))
|
||||
if (target != bot && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target, sPlayerbotAIConfig.sightDistance))
|
||||
{
|
||||
sServerFacade->SetFacingTo(bot, target);
|
||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
||||
ServerFacade::instance().SetFacingTo(bot, target);
|
||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig.reactDelay);
|
||||
|
||||
msg << "cast " << text;
|
||||
botAI->HandleCommand(CHAT_MSG_WHISPER, msg.str(), master);
|
||||
@@ -286,7 +286,7 @@ bool CastRandomSpellAction::Execute(Event event)
|
||||
|
||||
if (isCast)
|
||||
{
|
||||
if (MultiCast && ((wo && bot->HasInArc(CAST_ANGLE_IN_FRONT, wo, sPlayerbotAIConfig->sightDistance))))
|
||||
if (MultiCast && ((wo && bot->HasInArc(CAST_ANGLE_IN_FRONT, wo, sPlayerbotAIConfig.sightDistance))))
|
||||
{
|
||||
std::ostringstream cmd;
|
||||
cmd << "castnc " << chat->FormatWorldobject(wo) + " " << spellId << " " << 19;
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "ChangeStrategyAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "PlayerbotDbStore.h"
|
||||
#include "PlayerbotRepository.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool ChangeCombatStrategyAction::Execute(Event event)
|
||||
@@ -24,7 +24,7 @@ bool ChangeCombatStrategyAction::Execute(Event event)
|
||||
case '+':
|
||||
case '-':
|
||||
case '~':
|
||||
sPlayerbotDbStore->Save(botAI);
|
||||
PlayerbotRepository::instance().Save(botAI);
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
@@ -40,7 +40,7 @@ bool ChangeNonCombatStrategyAction::Execute(Event event)
|
||||
std::string const text = event.getParam();
|
||||
|
||||
uint32 account = bot->GetSession()->GetAccountId();
|
||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account) && botAI->GetMaster() &&
|
||||
if (sPlayerbotAIConfig.IsInRandomAccountList(account) && botAI->GetMaster() &&
|
||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
{
|
||||
if (text.find("loot") != std::string::npos || text.find("gather") != std::string::npos)
|
||||
@@ -62,7 +62,7 @@ bool ChangeNonCombatStrategyAction::Execute(Event event)
|
||||
case '+':
|
||||
case '-':
|
||||
case '~':
|
||||
sPlayerbotDbStore->Save(botAI);
|
||||
PlayerbotRepository::instance().Save(botAI);
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
@@ -110,20 +110,20 @@ std::string ChangeTalentsAction::SpecList()
|
||||
std::ostringstream out;
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||
{
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
||||
if (sPlayerbotAIConfig.premadeSpecName[cls][specNo].size() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
specFound++;
|
||||
std::ostringstream out;
|
||||
std::vector<std::vector<uint32>> parsed = sPlayerbotAIConfig->parsedSpecLinkOrder[cls][specNo][80];
|
||||
std::vector<std::vector<uint32>> parsed = sPlayerbotAIConfig.parsedSpecLinkOrder[cls][specNo][80];
|
||||
std::unordered_map<int, int> tabCount;
|
||||
tabCount[0] = tabCount[1] = tabCount[2] = 0;
|
||||
for (auto& item : parsed)
|
||||
{
|
||||
tabCount[item[0]] += item[3];
|
||||
}
|
||||
out << specFound << ". " << sPlayerbotAIConfig->premadeSpecName[cls][specNo] << " (";
|
||||
out << specFound << ". " << sPlayerbotAIConfig.premadeSpecName[cls][specNo] << " (";
|
||||
out << tabCount[0] << "-" << tabCount[1] << "-" << tabCount[2] << ")";
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
}
|
||||
@@ -137,11 +137,11 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
||||
// int specFound = 0; //not used, line marked for removal.
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||
{
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
||||
if (sPlayerbotAIConfig.premadeSpecName[cls][specNo].size() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo] == param)
|
||||
if (sPlayerbotAIConfig.premadeSpecName[cls][specNo] == param)
|
||||
{
|
||||
PlayerbotFactory::InitTalentsBySpecNo(bot, specNo, true);
|
||||
|
||||
@@ -149,7 +149,7 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
||||
factory.InitGlyphs(false);
|
||||
|
||||
std::ostringstream out;
|
||||
out << "Picking " << sPlayerbotAIConfig->premadeSpecName[cls][specNo];
|
||||
out << "Picking " << sPlayerbotAIConfig.premadeSpecName[cls][specNo];
|
||||
return out.str();
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// std::vector<TalentPath*> ChangeTalentsAction::getPremadePaths(std::string const findName)
|
||||
// {
|
||||
// std::vector<TalentPath*> ret;
|
||||
// // for (auto& path : sPlayerbotAIConfig->classSpecs[bot->getClass()].talentPath)
|
||||
// // for (auto& path : sPlayerbotAIConfig.classSpecs[bot->getClass()].talentPath)
|
||||
// // {
|
||||
// // if (findName.empty() || path.name.find(findName) != std::string::npos)
|
||||
// // {
|
||||
@@ -191,7 +191,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// {
|
||||
// std::vector<TalentPath*> ret;
|
||||
|
||||
// // for (auto& path : sPlayerbotAIConfig->classSpecs[bot->getClass()].talentPath)
|
||||
// // for (auto& path : sPlayerbotAIConfig.classSpecs[bot->getClass()].talentPath)
|
||||
// // {
|
||||
// // TalentSpec newSpec = *GetBestPremadeSpec(path.id);
|
||||
// // newSpec.CropTalents(bot->GetLevel());
|
||||
@@ -206,7 +206,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
|
||||
// TalentPath* ChangeTalentsAction::getPremadePath(uint32 id)
|
||||
// {
|
||||
// // for (auto& path : sPlayerbotAIConfig->classSpecs[bot->getClass()].talentPath)
|
||||
// // for (auto& path : sPlayerbotAIConfig.classSpecs[bot->getClass()].talentPath)
|
||||
// // {
|
||||
// // if (id == path.id)
|
||||
// // {
|
||||
@@ -214,7 +214,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // return &sPlayerbotAIConfig->classSpecs[bot->getClass()].talentPath[0];
|
||||
// // return &sPlayerbotAIConfig.classSpecs[bot->getClass()].talentPath[0];
|
||||
// return nullptr;
|
||||
// }
|
||||
|
||||
@@ -270,9 +270,9 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// uint32 specNo = sRandomPlayerbotMgr->GetValue(bot->GetGUID().GetCounter(), "specNo");
|
||||
// uint32 specNo = sRandomPlayerbotMgr.GetValue(bot->GetGUID().GetCounter(), "specNo");
|
||||
// uint32 specId = specNo - 1;
|
||||
// std::string specLink = sRandomPlayerbotMgr->GetData(bot->GetGUID().GetCounter(), "specLink");
|
||||
// std::string specLink = sRandomPlayerbotMgr.GetData(bot->GetGUID().GetCounter(), "specLink");
|
||||
|
||||
// //Continue the current spec
|
||||
// if (specNo > 0)
|
||||
@@ -319,15 +319,15 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// specId = -1;
|
||||
// // specLink = "";
|
||||
// }
|
||||
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig->autoPickTalents*/ &&
|
||||
// !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig.autoPickTalents*/ &&
|
||||
// !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
// {
|
||||
// *out << "Found multiple specs: ";
|
||||
// listPremadePaths(paths, out);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// specId = PickPremadePath(paths, sRandomPlayerbotMgr->IsRandomBot(bot))->id;
|
||||
// specId = PickPremadePath(paths, sRandomPlayerbotMgr.IsRandomBot(bot))->id;
|
||||
// TalentSpec newSpec = *GetBestPremadeSpec(specId);
|
||||
// specLink = newSpec.GetTalentLink();
|
||||
// newSpec.CropTalents(bot->GetLevel());
|
||||
@@ -341,12 +341,12 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// }
|
||||
// }
|
||||
|
||||
// sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specNo", specId + 1);
|
||||
// sRandomPlayerbotMgr.SetValue(bot->GetGUID().GetCounter(), "specNo", specId + 1);
|
||||
|
||||
// if (!specLink.empty() && specId == -1)
|
||||
// sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specLink", 1, specLink);
|
||||
// sRandomPlayerbotMgr.SetValue(bot->GetGUID().GetCounter(), "specLink", 1, specLink);
|
||||
// else
|
||||
// sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specLink", 0);
|
||||
// sRandomPlayerbotMgr.SetValue(bot->GetGUID().GetCounter(), "specLink", 0);
|
||||
|
||||
// return (specNo == 0) ? false : true;
|
||||
// }
|
||||
@@ -364,7 +364,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// if (path->talentSpec.size())
|
||||
// return &path->talentSpec.back();
|
||||
|
||||
// // return &sPlayerbotAIConfig->classSpecs[bot->getClassMask()].baseSpec;
|
||||
// // return &sPlayerbotAIConfig.classSpecs[bot->getClassMask()].baseSpec;
|
||||
// return nullptr;
|
||||
// }
|
||||
|
||||
@@ -372,7 +372,7 @@ bool AutoSetTalentsAction::Execute(Event event)
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
if (!sPlayerbotAIConfig->autoPickTalents || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!sPlayerbotAIConfig.autoPickTalents || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
return false;
|
||||
|
||||
if (bot->GetFreeTalentPoints() <= 0)
|
||||
@@ -96,7 +96,7 @@ bool FollowChatShortcutAction::Execute(Event event)
|
||||
|
||||
/* Default mechanics takes care of this now.
|
||||
if (bot->GetMapId() != master->GetMapId() || (master && bot->GetDistance(master) >
|
||||
sPlayerbotAIConfig->sightDistance))
|
||||
sPlayerbotAIConfig.sightDistance))
|
||||
{
|
||||
if (bot->isDead())
|
||||
{
|
||||
@@ -161,7 +161,7 @@ bool FleeChatShortcutAction::Execute(Event event)
|
||||
ResetReturnPosition();
|
||||
ResetStayPosition();
|
||||
|
||||
if (bot->GetMapId() != master->GetMapId() || bot->GetDistance(master) > sPlayerbotAIConfig->sightDistance)
|
||||
if (bot->GetMapId() != master->GetMapId() || bot->GetDistance(master) > sPlayerbotAIConfig.sightDistance)
|
||||
{
|
||||
botAI->TellError("I will not flee with you - too far away");
|
||||
return true;
|
||||
@@ -86,7 +86,7 @@ void CheatAction::ListCheats()
|
||||
for (int i = 0; i < log2((uint32)BotCheatMask::maxMask); i++)
|
||||
{
|
||||
BotCheatMask cheatMask = BotCheatMask(1 << i);
|
||||
if ((uint32)cheatMask & (uint32)sPlayerbotAIConfig->botCheatMask)
|
||||
if ((uint32)cheatMask & (uint32)sPlayerbotAIConfig.botCheatMask)
|
||||
out << "[conf:" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
else if (botAI->HasCheat(cheatMask))
|
||||
out << "[" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
@@ -28,7 +28,7 @@ bool CheckMailAction::Execute(Event event)
|
||||
continue;
|
||||
|
||||
uint32 account = owner->GetSession()->GetAccountId();
|
||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account))
|
||||
if (sPlayerbotAIConfig.IsInRandomAccountList(account))
|
||||
continue;
|
||||
|
||||
ProcessMail(mail, owner, trans);
|
||||
@@ -80,7 +80,7 @@ void CheckMailAction::ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTr
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
if (!sGuildTaskMgr->CheckItemTask(i->item_template, item->GetCount(), owner, bot, true))
|
||||
if (!GuildTaskMgr::instance().CheckItemTask(i->item_template, item->GetCount(), owner, bot, true))
|
||||
{
|
||||
std::ostringstream body;
|
||||
body << "Hello, " << owner->GetName() << ",\n";
|
||||
@@ -89,7 +89,7 @@ bool CheckMountStateAction::isUseful()
|
||||
return false;
|
||||
|
||||
// Not useful when level lower than minimum required
|
||||
if (bot->GetLevel() < sPlayerbotAIConfig->useGroundMountAtMinLevel)
|
||||
if (bot->GetLevel() < sPlayerbotAIConfig.useGroundMountAtMinLevel)
|
||||
return false;
|
||||
|
||||
// Allow mounting while transformed only if the form allows it
|
||||
@@ -402,7 +402,7 @@ float CheckMountStateAction::CalculateDismountDistance() const
|
||||
// Warrior bots should dismount far enough to charge (because it's important for generating some initial rage),
|
||||
// a real player would be riding toward enemy mashing the charge key but the bots won't cast charge while mounted.
|
||||
bool isMelee = PlayerbotAI::IsMelee(bot);
|
||||
float dismountDistance = isMelee ? sPlayerbotAIConfig->meleeDistance + 2.0f : sPlayerbotAIConfig->spellDistance + 2.0f;
|
||||
float dismountDistance = isMelee ? sPlayerbotAIConfig.meleeDistance + 2.0f : sPlayerbotAIConfig.spellDistance + 2.0f;
|
||||
return bot->getClass() == CLASS_WARRIOR ? std::max(18.0f, dismountDistance) : dismountDistance;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ float CheckMountStateAction::CalculateMountDistance() const
|
||||
// seconds:
|
||||
// 21 / 7 = 21 / 14 + 1.5 = 3 (7 = dismounted speed 14 = epic-mount speed 1.5 = mount-spell cast time)
|
||||
bool isMelee = PlayerbotAI::IsMelee(bot);
|
||||
float baseDistance = isMelee ? sPlayerbotAIConfig->meleeDistance + 10.0f : sPlayerbotAIConfig->spellDistance + 10.0f;
|
||||
float baseDistance = isMelee ? sPlayerbotAIConfig.meleeDistance + 10.0f : sPlayerbotAIConfig.spellDistance + 10.0f;
|
||||
return std::max(21.0f, baseDistance);
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ int32 CheckMountStateAction::CalculateMasterMountSpeed(Player* master, const Mou
|
||||
int32 ridingSkill = bot->GetPureSkillValue(SKILL_RIDING);
|
||||
int32 botLevel = bot->GetLevel();
|
||||
|
||||
if (ridingSkill <= 75 && botLevel < static_cast<int32>(sPlayerbotAIConfig->useFastGroundMountAtMinLevel))
|
||||
if (ridingSkill <= 75 && botLevel < static_cast<int32>(sPlayerbotAIConfig.useFastGroundMountAtMinLevel))
|
||||
return 59;
|
||||
|
||||
// If there is a master and bot not in BG, use master's aura effects.
|
||||
@@ -20,7 +20,7 @@ bool CheckValuesAction::Execute(Event event)
|
||||
|
||||
if (botAI->HasStrategy("map", BOT_STATE_NON_COMBAT) || botAI->HasStrategy("map full", BOT_STATE_NON_COMBAT))
|
||||
{
|
||||
sTravelNodeMap->manageNodes(bot, botAI->HasStrategy("map full", BOT_STATE_NON_COMBAT));
|
||||
TravelNodeMap::instance().manageNodes(bot, botAI->HasStrategy("map full", BOT_STATE_NON_COMBAT));
|
||||
}
|
||||
|
||||
GuidVector possible_targets = *context->GetValue<GuidVector>("possible targets");
|
||||
@@ -248,7 +248,7 @@ bool ChooseRpgTargetAction::Execute(Event event)
|
||||
}
|
||||
|
||||
std::mt19937 gen(time(0));
|
||||
sTravelMgr->weighted_shuffle(guidps.begin(), guidps.end(), relevances.begin(), relevances.end(), gen);
|
||||
TravelMgr::instance().weighted_shuffle(guidps.begin(), guidps.end(), relevances.begin(), relevances.end(), gen);
|
||||
|
||||
GuidPosition guidP(guidps.front());
|
||||
if (!guidP)
|
||||
@@ -279,7 +279,7 @@ bool ChooseRpgTargetAction::isUseful()
|
||||
|
||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||
|
||||
if (guidP && guidP.distance(bot) < sPlayerbotAIConfig->reactDistance * 2)
|
||||
if (guidP && guidP.distance(bot) < sPlayerbotAIConfig.reactDistance * 2)
|
||||
return false;
|
||||
|
||||
// TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
||||
@@ -330,7 +330,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
||||
return true;
|
||||
|
||||
if (bot->GetDistance(groupLeader) > sPlayerbotAIConfig->rpgDistance * 2)
|
||||
if (bot->GetDistance(groupLeader) > sPlayerbotAIConfig.rpgDistance * 2)
|
||||
return false;
|
||||
|
||||
Formation* formation = AI_VALUE(Formation*, "formation");
|
||||
@@ -340,7 +340,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
{
|
||||
Player* player = groupLeader;
|
||||
if (groupLeader && !groupLeader->isMoving() ||
|
||||
PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
|
||||
PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig.reactDistance)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ bool AttackEnemyPlayerAction::isUseful()
|
||||
if (PlayerHasFlag::IsCapturingFlag(bot))
|
||||
return false;
|
||||
|
||||
return !sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId());
|
||||
return !sPlayerbotAIConfig.IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId());
|
||||
}
|
||||
|
||||
bool AttackEnemyFlagCarrierAction::isUseful()
|
||||
{
|
||||
Unit* target = context->GetValue<Unit*>("enemy flag carrier")->Get();
|
||||
return target && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target), 100.0f) &&
|
||||
return target && ServerFacade::instance().IsDistanceLessOrEqualThan(ServerFacade::instance().GetDistance2d(bot, target), 100.0f) &&
|
||||
PlayerHasFlag::IsCapturingFlag(bot);
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ bool ChooseTravelTargetAction::getBestDestination(std::vector<TravelDestination*
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
std::vector<WorldPosition*> availablePoints =
|
||||
sTravelMgr->getNextPoint(&botLocation, *activePoints); // Pick a good point.
|
||||
TravelMgr::instance().getNextPoint(&botLocation, *activePoints); // Pick a good point.
|
||||
|
||||
if (availablePoints.empty()) // No points available.
|
||||
return false;
|
||||
@@ -488,7 +488,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
||||
if (newQuests)
|
||||
{
|
||||
// Prefer new quests near the player at lower levels.
|
||||
activeDestinations = sTravelMgr->getQuestTravelDestinations(bot, -1, true, false, 400 + bot->GetLevel() * 10);
|
||||
activeDestinations = TravelMgr::instance().getQuestTravelDestinations(bot, -1, true, false, 400 + bot->GetLevel() * 10);
|
||||
}
|
||||
if (activeQuests || completedQuests)
|
||||
{
|
||||
@@ -510,7 +510,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
||||
continue;
|
||||
|
||||
//Find quest takers or objectives
|
||||
std::vector<TravelDestination*> questDestinations = sTravelMgr->getQuestTravelDestinations(bot, questId, true, false, 0);
|
||||
std::vector<TravelDestination*> questDestinations = TravelMgr::instance().getQuestTravelDestinations(bot, questId, true, false, 0);
|
||||
|
||||
if (onlyClassQuest && activeDestinations.size() && questDestinations.size()) //Only do class quests if we have any.
|
||||
{
|
||||
@@ -525,7 +525,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
||||
}
|
||||
}
|
||||
if (newQuests && activeDestinations.empty())
|
||||
activeDestinations = sTravelMgr->getQuestTravelDestinations(bot, -1, true, false); //If we really don't find any new quests look futher away.
|
||||
activeDestinations = TravelMgr::instance().getQuestTravelDestinations(bot, -1, true, false); //If we really don't find any new quests look futher away.
|
||||
|
||||
if (botAI->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT))
|
||||
botAI->TellMasterNoFacing(std::to_string(activeDestinations.size()) + " quest destinations found.");
|
||||
@@ -547,7 +547,7 @@ bool ChooseTravelTargetAction::SetNewQuestTarget(TravelTarget* target)
|
||||
|
||||
// Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getQuestTravelDestinations(bot, -1, botAI->HasRealPlayerMaster());
|
||||
TravelMgr::instance().getQuestTravelDestinations(bot, -1, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
@@ -576,7 +576,7 @@ bool ChooseTravelTargetAction::SetRpgTarget(TravelTarget* target)
|
||||
|
||||
// Find rpg npcs
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
TravelMgr::instance().getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
@@ -605,7 +605,7 @@ bool ChooseTravelTargetAction::SetGrindTarget(TravelTarget* target)
|
||||
|
||||
// Find grind mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
TravelMgr::instance().getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
@@ -634,7 +634,7 @@ bool ChooseTravelTargetAction::SetBossTarget(TravelTarget* target)
|
||||
|
||||
// Find boss mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
TravelMgr::instance().getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
@@ -662,7 +662,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
// Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getExploreTravelDestinations(bot, true, true);
|
||||
std::vector<TravelDestination*> TravelDestinations = TravelMgr::instance().getExploreTravelDestinations(bot, true, true);
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
/*
|
||||
@@ -681,7 +681,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
||||
|
||||
if (activePoints.empty())
|
||||
{
|
||||
TravelDestinations = sTravelMgr->getExploreTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
TravelDestinations = TravelMgr::instance().getExploreTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
@@ -710,7 +710,7 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
||||
|
||||
std::vector<TravelDestination*> dests;
|
||||
|
||||
for (auto& d : sTravelMgr->getRpgTravelDestinations(bot, true, true))
|
||||
for (auto& d : TravelMgr::instance().getRpgTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (!d->getEntry())
|
||||
continue;
|
||||
@@ -813,7 +813,7 @@ std::vector<TravelDestination*> TravelMgr::getBossTravelDestinations(Player* bot
|
||||
|
||||
bool ChooseTravelTargetAction::SetNullTarget(TravelTarget* target)
|
||||
{
|
||||
target->setTarget(sTravelMgr->nullTravelDestination, sTravelMgr->nullWorldPosition, true);
|
||||
target->setTarget(TravelMgr::instance().nullTravelDestination, TravelMgr::instance().nullWorldPosition, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -832,7 +832,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
//Quests
|
||||
if (quests)
|
||||
{
|
||||
for (auto& d : sTravelMgr->getQuestTravelDestinations(bot, 0, true, true))
|
||||
for (auto& d : TravelMgr::instance().getQuestTravelDestinations(bot, 0, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
@@ -842,7 +842,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
//Zones
|
||||
if (zones)
|
||||
{
|
||||
for (auto& d : sTravelMgr->getExploreTravelDestinations(bot, true, true))
|
||||
for (auto& d : TravelMgr::instance().getExploreTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
@@ -852,7 +852,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
//Npcs
|
||||
if (npcs)
|
||||
{
|
||||
for (auto& d : sTravelMgr->getRpgTravelDestinations(bot, true, true))
|
||||
for (auto& d : TravelMgr::instance().getRpgTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
@@ -862,7 +862,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
//Mobs
|
||||
if (mobs)
|
||||
{
|
||||
for (auto& d : sTravelMgr->getGrindTravelDestinations(bot, true, true, 5000.0f))
|
||||
for (auto& d : TravelMgr::instance().getGrindTravelDestinations(bot, true, true, 5000.0f))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
@@ -872,7 +872,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
//Bosses
|
||||
if (bosses)
|
||||
{
|
||||
for (auto& d : sTravelMgr->getBossTravelDestinations(bot, true, true))
|
||||
for (auto& d : TravelMgr::instance().getBossTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
@@ -25,7 +25,7 @@ bool SwitchToMeleeAction::isUseful()
|
||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) &&
|
||||
((bot->IsInCombat() && target &&
|
||||
(target->GetVictim() == bot && (!bot->GetGroup() || lastFlee) &&
|
||||
sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
ServerFacade::instance().IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
(!bot->IsInCombat()));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ bool SwitchToRangedAction::isUseful()
|
||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT) && hasAmmo &&
|
||||
((bot->IsInCombat() && target &&
|
||||
((target->GetVictim() != bot || target->GetTarget() != bot->GetGUID()) ||
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
ServerFacade::instance().IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
(!bot->IsInCombat()));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
if (text == "scan")
|
||||
{
|
||||
sPlayerbotAIConfig->openLog("scan.csv", "w");
|
||||
sPlayerbotAIConfig.openLog("scan.csv", "w");
|
||||
|
||||
uint32 i = 0;
|
||||
for (auto p : WorldPosition().getCreaturesNear())
|
||||
@@ -36,15 +36,15 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
pos.printWKT(out);
|
||||
|
||||
sPlayerbotAIConfig->log("scan.csv", out.str().c_str());
|
||||
sPlayerbotAIConfig.log("scan.csv", out.str().c_str());
|
||||
|
||||
if (zoneId == 0 && areaId == 0)
|
||||
{
|
||||
sPlayerbotAIConfig->log("x", out.str().c_str());
|
||||
sPlayerbotAIConfig.log("x", out.str().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
sPlayerbotAIConfig->log("y", out.str().c_str());
|
||||
sPlayerbotAIConfig.log("y", out.str().c_str());
|
||||
}
|
||||
|
||||
i = zoneId;
|
||||
@@ -53,8 +53,8 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
else if (text.find("printmap") != std::string::npos)
|
||||
{
|
||||
sTravelNodeMap->printMap();
|
||||
sTravelNodeMap->printNodeStore();
|
||||
TravelNodeMap::instance().printMap();
|
||||
TravelNodeMap::instance().printNodeStore();
|
||||
return true;
|
||||
}
|
||||
else if (text.find("travel ") != std::string::npos)
|
||||
@@ -72,7 +72,7 @@ bool DebugAction::Execute(Event event)
|
||||
return false;
|
||||
|
||||
std::vector<WorldPosition> beginPath, endPath;
|
||||
TravelNodeRoute route = sTravelNodeMap->getRoute(botPos, *points.front(), beginPath, bot);
|
||||
TravelNodeRoute route = TravelNodeMap::instance().getRoute(botPos, *points.front(), beginPath, bot);
|
||||
|
||||
std::ostringstream out;
|
||||
out << "Traveling to " << dest->getTitle() << ": ";
|
||||
@@ -108,7 +108,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
out << quest->GetTitle() << ": ";
|
||||
|
||||
QuestContainer* cont = sTravelMgr->quests[questId];
|
||||
QuestContainer* cont = TravelMgr::instance().quests[questId];
|
||||
|
||||
for (auto g : cont->questGivers)
|
||||
{
|
||||
@@ -135,11 +135,11 @@ bool DebugAction::Execute(Event event)
|
||||
else if (text.find("quest") != std::string::npos)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << sTravelMgr->quests.size() << " quests ";
|
||||
out << TravelMgr::instance().quests.size() << " quests ";
|
||||
|
||||
uint32 noT = 0, noG = 0, noO = 0;
|
||||
|
||||
for (auto q : sTravelMgr->quests)
|
||||
for (auto q : TravelMgr::instance().quests)
|
||||
{
|
||||
if (q.second->questGivers.empty())
|
||||
noG++;
|
||||
@@ -164,7 +164,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
// uint32 noT = 0, noG = 0, noO = 0; //not used, line marked for removal.
|
||||
|
||||
for (auto q : sTravelMgr->quests)
|
||||
for (auto q : TravelMgr::instance().quests)
|
||||
{
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(q.first);
|
||||
|
||||
@@ -194,16 +194,16 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
std::string const name = "USER:" + text.substr(9);
|
||||
|
||||
/* TravelNode* startNode = */ sTravelNodeMap->addNode(pos, name, false, false); // startNode not used, but addNode as side effect, fragment marked for removal.
|
||||
/* TravelNode* startNode = */ TravelNodeMap::instance().addNode(pos, name, false, false); // startNode not used, but addNode as side effect, fragment marked for removal.
|
||||
|
||||
for (auto& endNode : sTravelNodeMap->getNodes(pos, 2000))
|
||||
for (auto& endNode : TravelNodeMap::instance().getNodes(pos, 2000))
|
||||
{
|
||||
endNode->setLinked(false);
|
||||
}
|
||||
|
||||
botAI->TellMasterNoFacing("Node " + name + " created.");
|
||||
|
||||
sTravelNodeMap->setHasToGen();
|
||||
TravelNodeMap::instance().setHasToGen();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
WorldPosition pos(bot);
|
||||
|
||||
TravelNode* startNode = sTravelNodeMap->getNode(pos, nullptr, 50);
|
||||
TravelNode* startNode = TravelNodeMap::instance().getNode(pos, nullptr, 50);
|
||||
|
||||
if (!startNode)
|
||||
return false;
|
||||
@@ -221,24 +221,24 @@ bool DebugAction::Execute(Event event)
|
||||
botAI->TellMasterNoFacing("Node can not be removed.");
|
||||
}
|
||||
|
||||
sTravelNodeMap->m_nMapMtx.lock();
|
||||
sTravelNodeMap->removeNode(startNode);
|
||||
TravelNodeMap::instance().m_nMapMtx.lock();
|
||||
TravelNodeMap::instance().removeNode(startNode);
|
||||
botAI->TellMasterNoFacing("Node removed.");
|
||||
sTravelNodeMap->m_nMapMtx.unlock();
|
||||
TravelNodeMap::instance().m_nMapMtx.unlock();
|
||||
|
||||
sTravelNodeMap->setHasToGen();
|
||||
TravelNodeMap::instance().setHasToGen();
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (text.find("reset node") != std::string::npos)
|
||||
{
|
||||
for (auto& node : sTravelNodeMap->getNodes())
|
||||
for (auto& node : TravelNodeMap::instance().getNodes())
|
||||
node->setLinked(false);
|
||||
return true;
|
||||
}
|
||||
else if (text.find("reset path") != std::string::npos)
|
||||
{
|
||||
for (auto& node : sTravelNodeMap->getNodes())
|
||||
for (auto& node : TravelNodeMap::instance().getNodes())
|
||||
for (auto& path : *node->getLinks())
|
||||
node->removeLinkTo(path.first, true);
|
||||
return true;
|
||||
@@ -246,23 +246,23 @@ bool DebugAction::Execute(Event event)
|
||||
else if (text.find("gen node") != std::string::npos)
|
||||
{
|
||||
// Pathfinder
|
||||
sTravelNodeMap->generateNodes();
|
||||
TravelNodeMap::instance().generateNodes();
|
||||
return true;
|
||||
}
|
||||
else if (text.find("gen path") != std::string::npos)
|
||||
{
|
||||
sTravelNodeMap->generatePaths();
|
||||
TravelNodeMap::instance().generatePaths();
|
||||
return true;
|
||||
}
|
||||
else if (text.find("crop path") != std::string::npos)
|
||||
{
|
||||
sTravelNodeMap->removeUselessPaths();
|
||||
TravelNodeMap::instance().removeUselessPaths();
|
||||
return true;
|
||||
}
|
||||
else if (text.find("save node") != std::string::npos)
|
||||
{
|
||||
sTravelNodeMap->printNodeStore();
|
||||
sTravelNodeMap->saveNodeStore();
|
||||
TravelNodeMap::instance().printNodeStore();
|
||||
TravelNodeMap::instance().saveNodeStore();
|
||||
return true;
|
||||
}
|
||||
else if (text.find("load node") != std::string::npos)
|
||||
@@ -270,8 +270,8 @@ bool DebugAction::Execute(Event event)
|
||||
std::thread t(
|
||||
[]
|
||||
{
|
||||
sTravelNodeMap->removeNodes();
|
||||
sTravelNodeMap->loadNodeStore();
|
||||
TravelNodeMap::instance().removeNodes();
|
||||
TravelNodeMap::instance().loadNodeStore();
|
||||
});
|
||||
|
||||
t.detach();
|
||||
@@ -282,7 +282,7 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
WorldPosition pos(bot);
|
||||
|
||||
std::vector<TravelNode*> nodes = sTravelNodeMap->getNodes(pos, 500);
|
||||
std::vector<TravelNode*> nodes = TravelNodeMap::instance().getNodes(pos, 500);
|
||||
|
||||
for (auto& node : nodes)
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
bool DelayAction::Execute(Event event)
|
||||
{
|
||||
uint32 delay = sPlayerbotAIConfig->passiveDelay + sPlayerbotAIConfig->globalCoolDown;
|
||||
uint32 delay = sPlayerbotAIConfig.passiveDelay + sPlayerbotAIConfig.globalCoolDown;
|
||||
|
||||
botAI->SetNextCheckDelay(delay);
|
||||
|
||||
@@ -67,7 +67,7 @@ bool CleanQuestLogAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sPlayerbotAIConfig->dropObsoleteQuests)
|
||||
if (!sPlayerbotAIConfig.dropObsoleteQuests)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ void EmoteActionBase::InitEmotes()
|
||||
|
||||
bool EmoteActionBase::Emote(Unit* target, uint32 type, bool textEmote)
|
||||
{
|
||||
if (target && !bot->HasInArc(static_cast<float>(M_PI), target, sPlayerbotAIConfig->sightDistance))
|
||||
if (target && !bot->HasInArc(static_cast<float>(M_PI), target, sPlayerbotAIConfig.sightDistance))
|
||||
bot->SetFacingToObject(target);
|
||||
|
||||
ObjectGuid oldSelection = bot->GetTarget();
|
||||
@@ -100,7 +100,7 @@ bool EmoteActionBase::Emote(Unit* target, uint32 type, bool textEmote)
|
||||
if (player)
|
||||
{
|
||||
PlayerbotAI* playerBotAI = GET_PLAYERBOT_AI(player);
|
||||
if (playerBotAI && !player->HasInArc(static_cast<float>(M_PI), bot, sPlayerbotAIConfig->sightDistance))
|
||||
if (playerBotAI && !player->HasInArc(static_cast<float>(M_PI), bot, sPlayerbotAIConfig.sightDistance))
|
||||
{
|
||||
player->SetFacingToObject(bot);
|
||||
}
|
||||
@@ -133,7 +133,7 @@ Unit* EmoteActionBase::GetTarget()
|
||||
for (GuidVector::iterator i = nfp.begin(); i != nfp.end(); ++i)
|
||||
{
|
||||
Unit* unit = botAI->GetUnit(*i);
|
||||
if (unit && sServerFacade->GetDistance2d(bot, unit) < sPlayerbotAIConfig->tooCloseDistance)
|
||||
if (unit && ServerFacade::instance().GetDistance2d(bot, unit) < sPlayerbotAIConfig.tooCloseDistance)
|
||||
targets.push_back(unit);
|
||||
}
|
||||
|
||||
@@ -618,8 +618,8 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
||||
break;
|
||||
}
|
||||
|
||||
if (source && !bot->isMoving() && !bot->HasInArc(static_cast<float>(M_PI), source, sPlayerbotAIConfig->farDistance))
|
||||
sServerFacade->SetFacingTo(bot, source);
|
||||
if (source && !bot->isMoving() && !bot->HasInArc(static_cast<float>(M_PI), source, sPlayerbotAIConfig.farDistance))
|
||||
ServerFacade::instance().SetFacingTo(bot, source);
|
||||
|
||||
if (verbal)
|
||||
{
|
||||
@@ -689,7 +689,7 @@ bool EmoteAction::Execute(Event event)
|
||||
p >> emoteId >> source;
|
||||
|
||||
pSource = ObjectAccessor::FindPlayer(source);
|
||||
if (pSource && pSource != bot && sServerFacade->GetDistance2d(bot, pSource) < sPlayerbotAIConfig->farDistance &&
|
||||
if (pSource && pSource != bot && ServerFacade::instance().GetDistance2d(bot, pSource) < sPlayerbotAIConfig.farDistance &&
|
||||
emoteId != EMOTE_ONESHOT_NONE)
|
||||
{
|
||||
if ((pSource->GetGUID() != bot->GetGUID()) &&
|
||||
@@ -737,7 +737,7 @@ bool EmoteAction::Execute(Event event)
|
||||
// time_t lastEmote = AI_VALUE2(time_t, "last emote", qualifier); //not used, line marked for removal.
|
||||
botAI->GetAiObjectContext()
|
||||
->GetValue<time_t>("last emote", qualifier)
|
||||
->Set(time(nullptr) + urand(1000, sPlayerbotAIConfig->repeatDelay) / 1000);
|
||||
->Set(time(nullptr) + urand(1000, sPlayerbotAIConfig.repeatDelay) / 1000);
|
||||
param = qualifier;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ void EquipAction::EquipItem(Item* item)
|
||||
|
||||
bool EquipUpgradesAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!sPlayerbotAIConfig.autoEquipUpgradeLoot && !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
return false;
|
||||
|
||||
if (event.GetSource() == "trade status")
|
||||
@@ -272,9 +272,9 @@ bool MoveNearWaterAction::isPossible()
|
||||
float fishingSearchWindow;
|
||||
|
||||
if (master)
|
||||
fishingSearchWindow = sPlayerbotAIConfig->fishingDistanceFromMaster;
|
||||
fishingSearchWindow = sPlayerbotAIConfig.fishingDistanceFromMaster;
|
||||
else
|
||||
fishingSearchWindow = sPlayerbotAIConfig->fishingDistance;
|
||||
fishingSearchWindow = sPlayerbotAIConfig.fishingDistance;
|
||||
|
||||
WorldPosition fishingHole = FindFishingHole(botAI);
|
||||
|
||||
@@ -385,7 +385,7 @@ bool EquipFishingPoleAction::isUseful()
|
||||
}
|
||||
}
|
||||
|
||||
if (sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
{
|
||||
bot->StoreNewItemInBestSlots(FISHING_POLE, 1); // Try to get a fishing pole
|
||||
return true;
|
||||
@@ -396,7 +396,7 @@ bool EquipFishingPoleAction::isUseful()
|
||||
return false;
|
||||
|
||||
std::string masterName = master->GetName();
|
||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
||||
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||
"no_fishing_pole_error", "I don't have a Fishing Pole",{});
|
||||
botAI->Whisper(text, masterName);
|
||||
|
||||
@@ -499,7 +499,7 @@ bool EndMasterFishingAction::isUseful()
|
||||
return false;
|
||||
|
||||
WorldPosition nearWater = FindWaterRadial(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
||||
bot->GetMap(), bot->GetPhaseMask(), MIN_DISTANCE_TO_WATER, sPlayerbotAIConfig->endFishingWithMaster, 10.0f);
|
||||
bot->GetMap(), bot->GetPhaseMask(), MIN_DISTANCE_TO_WATER, sPlayerbotAIConfig.endFishingWithMaster, 10.0f);
|
||||
return !nearWater.IsValid();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ bool FollowAction::Execute(Event event)
|
||||
// botAI->PetFollow();
|
||||
// }
|
||||
// if (moved)
|
||||
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
||||
// botAI->SetNextCheckDelay(sPlayerbotAIConfig.reactDelay);
|
||||
|
||||
return moved;
|
||||
}
|
||||
@@ -98,9 +98,9 @@ bool FollowAction::isUseful()
|
||||
distance = bot->GetDistance(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ());
|
||||
}
|
||||
if (botAI->HasStrategy("master fishing", BOT_STATE_NON_COMBAT))
|
||||
return sServerFacade->IsDistanceGreaterThan(distance, sPlayerbotAIConfig->fishingDistanceFromMaster);
|
||||
return ServerFacade::instance().IsDistanceGreaterThan(distance, sPlayerbotAIConfig.fishingDistanceFromMaster);
|
||||
|
||||
return sServerFacade->IsDistanceGreaterThan(distance, formation->GetMaxDistance());
|
||||
return ServerFacade::instance().IsDistanceGreaterThan(distance, formation->GetMaxDistance());
|
||||
}
|
||||
|
||||
bool FollowAction::CanDeadFollow(Unit* target)
|
||||
@@ -130,7 +130,7 @@ bool FleeToGroupLeaderAction::Execute(Event event)
|
||||
WorldPosition bosPos(bot);
|
||||
float distance = bosPos.fDist(targetPos);
|
||||
|
||||
if (distance < sPlayerbotAIConfig->reactDistance * 3)
|
||||
if (distance < sPlayerbotAIConfig.reactDistance * 3)
|
||||
{
|
||||
if (!urand(0, 3))
|
||||
botAI->TellMaster("I am close, wait for me!");
|
||||
@@ -113,7 +113,7 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
|
||||
}
|
||||
|
||||
// Debug message if pet spells have been toggled and debug is enabled
|
||||
if (toggled && sPlayerbotAIConfig->petChatCommandDebug == 1)
|
||||
if (toggled && sPlayerbotAIConfig.petChatCommandDebug == 1)
|
||||
botAI->TellMaster("Pet autocast spells have been toggled.");
|
||||
|
||||
return toggled;
|
||||
@@ -185,7 +185,7 @@ bool SetPetStanceAction::Execute(Event /*event*/)
|
||||
}
|
||||
|
||||
// Get the default pet stance from the configuration
|
||||
int32 stance = sPlayerbotAIConfig->defaultPetStance;
|
||||
int32 stance = sPlayerbotAIConfig.defaultPetStance;
|
||||
ReactStates react = REACT_DEFENSIVE;
|
||||
std::string stanceText = "defensive (from config, fallback)";
|
||||
|
||||
@@ -221,7 +221,7 @@ bool SetPetStanceAction::Execute(Event /*event*/)
|
||||
}
|
||||
|
||||
// If debug is enabled in config, inform the master of the new stance
|
||||
if (sPlayerbotAIConfig->petChatCommandDebug == 1)
|
||||
if (sPlayerbotAIConfig.petChatCommandDebug == 1)
|
||||
botAI->TellMaster("Pet stance set to " + stanceText + " (applied to all pets/guardians).");
|
||||
|
||||
return true;
|
||||
@@ -87,7 +87,7 @@ namespace ai::buff
|
||||
{
|
||||
std::string castName = baseName;
|
||||
Group* g = bot->GetGroup();
|
||||
if (!g || g->GetMembersCount() < static_cast<uint32>(sPlayerbotAIConfig->minBotsForGreaterBuff))
|
||||
if (!g || g->GetMembersCount() < static_cast<uint32>(sPlayerbotAIConfig.minBotsForGreaterBuff))
|
||||
return castName; // Group too small: stay in solo mode
|
||||
|
||||
if (std::string const groupName = GroupVariantFor(baseName); !groupName.empty())
|
||||
@@ -114,7 +114,7 @@ namespace ai::buff
|
||||
time_t now = std::time(nullptr);
|
||||
uint32 botLow = static_cast<uint32>(bot->GetGUID().GetCounter());
|
||||
time_t& last = s_lastWarn[ std::make_pair(botLow, groupName) ];
|
||||
if (!last || now - last >= sPlayerbotAIConfig->rpWarningCooldown) // Configurable anti-spam
|
||||
if (!last || now - last >= sPlayerbotAIConfig.rpWarningCooldown) // Configurable anti-spam
|
||||
{
|
||||
// DB Key choice in regard of the buff
|
||||
std::string key;
|
||||
@@ -132,7 +132,7 @@ namespace ai::buff
|
||||
placeholders["%group_spell"] = groupName;
|
||||
placeholders["%base_spell"] = baseName;
|
||||
|
||||
std::string announceText = sPlayerbotTextMgr->GetBotTextOrDefault(key,
|
||||
std::string announceText = PlayerbotTextMgr::instance().GetBotTextOrDefault(key,
|
||||
"Out of components for %group_spell. Using %base_spell!", placeholders);
|
||||
|
||||
announce(announceText);
|
||||
@@ -82,7 +82,7 @@ bool CastSpellAction::isPossible()
|
||||
{
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
if (!sPlayerbotAIConfig.logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}", bot->GetName());
|
||||
}
|
||||
@@ -94,7 +94,7 @@ bool CastSpellAction::isPossible()
|
||||
|
||||
if (spell == "mount" && bot->IsInCombat())
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
if (!sPlayerbotAIConfig.logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}", bot->GetName());
|
||||
}
|
||||
@@ -133,7 +133,7 @@ bool CastSpellAction::isUseful()
|
||||
|
||||
return spellTarget &&
|
||||
AI_VALUE2(bool, "spell cast useful",
|
||||
spell); // && sServerFacade->GetDistance2d(bot, spellTarget) <= (range + combatReach);
|
||||
spell); // && ServerFacade::instance().GetDistance2d(bot, spellTarget) <= (range + combatReach);
|
||||
}
|
||||
|
||||
CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||
@@ -64,7 +64,7 @@ Unit* GiveItemAction::GetTarget() { return AI_VALUE2(Unit*, "party member withou
|
||||
|
||||
bool GiveItemAction::isUseful()
|
||||
{
|
||||
return GetTarget() && AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig->lowMana;
|
||||
return GetTarget() && AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig.lowMana;
|
||||
}
|
||||
|
||||
Unit* GiveFoodAction::GetTarget() { return AI_VALUE(Unit*, "party member without food"); }
|
||||
@@ -74,7 +74,7 @@ bool GiveFoodAction::isUseful()
|
||||
if (!GetTarget())
|
||||
return false;
|
||||
|
||||
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*)GetTarget());
|
||||
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr.IsRandomBot((Player*)GetTarget());
|
||||
|
||||
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
|
||||
}
|
||||
@@ -86,7 +86,7 @@ bool GiveWaterAction::isUseful()
|
||||
if (!GetTarget())
|
||||
return false;
|
||||
|
||||
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr->IsRandomBot((Player*)GetTarget());
|
||||
bool isRandomBot = GetTarget()->IsPlayer() && sRandomPlayerbotMgr.IsRandomBot((Player*)GetTarget());
|
||||
|
||||
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
|
||||
}
|
||||
@@ -61,7 +61,7 @@ bool GoAction::Execute(Event event)
|
||||
else
|
||||
{
|
||||
botAI->TellMasterNoFacing("Clearing travel target");
|
||||
target->setTarget(sTravelMgr->nullTravelDestination, sTravelMgr->nullWorldPosition);
|
||||
target->setTarget(TravelMgr::instance().nullTravelDestination, TravelMgr::instance().nullWorldPosition);
|
||||
target->setForced(false);
|
||||
return true;
|
||||
}
|
||||
@@ -75,8 +75,8 @@ bool GoAction::Execute(Event event)
|
||||
if (GameObject* go = botAI->GetGameObject(guid))
|
||||
if (go->isSpawned())
|
||||
{
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, go),
|
||||
sPlayerbotAIConfig->reactDistance))
|
||||
if (ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, go),
|
||||
sPlayerbotAIConfig.reactDistance))
|
||||
{
|
||||
botAI->TellError("It is too far away");
|
||||
return false;
|
||||
@@ -86,7 +86,7 @@ bool GoAction::Execute(Event event)
|
||||
out << "Moving to " << ChatHelper::FormatGameobject(go);
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
return MoveNear(bot->GetMapId(), go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 0.5f,
|
||||
sPlayerbotAIConfig->followDistance);
|
||||
sPlayerbotAIConfig.followDistance);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -106,7 +106,7 @@ bool GoAction::Execute(Event event)
|
||||
out << "Moving to " << unit->GetName();
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
return MoveNear(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(),
|
||||
unit->GetPositionZ() + 0.5f, sPlayerbotAIConfig->followDistance);
|
||||
unit->GetPositionZ() + 0.5f, sPlayerbotAIConfig.followDistance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,8 +176,8 @@ bool GoAction::Execute(Event event)
|
||||
float z = bot->GetPositionZ();
|
||||
bot->UpdateAllowedPositionZ(x, y, z);
|
||||
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, x, y),
|
||||
sPlayerbotAIConfig->reactDistance))
|
||||
if (ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, x, y),
|
||||
sPlayerbotAIConfig.reactDistance))
|
||||
{
|
||||
botAI->TellMaster("It is too far away");
|
||||
return false;
|
||||
@@ -203,14 +203,14 @@ bool GoAction::Execute(Event event)
|
||||
out << "Moving to " << x1 << "," << y1;
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
|
||||
return MoveNear(bot->GetMapId(), x, y, z + 0.5f, sPlayerbotAIConfig->followDistance);
|
||||
return MoveNear(bot->GetMapId(), x, y, z + 0.5f, sPlayerbotAIConfig.followDistance);
|
||||
}
|
||||
|
||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[param];
|
||||
if (pos.isSet())
|
||||
{
|
||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, pos.x, pos.y),
|
||||
sPlayerbotAIConfig->reactDistance))
|
||||
if (ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, pos.x, pos.y),
|
||||
sPlayerbotAIConfig.reactDistance))
|
||||
{
|
||||
botAI->TellError("It is too far away");
|
||||
return false;
|
||||
@@ -219,7 +219,7 @@ bool GoAction::Execute(Event event)
|
||||
std::ostringstream out;
|
||||
out << "Moving to position " << param;
|
||||
botAI->TellMasterNoFacing(out.str());
|
||||
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z + 0.5f, sPlayerbotAIConfig->followDistance);
|
||||
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z + 0.5f, sPlayerbotAIConfig.followDistance);
|
||||
}
|
||||
|
||||
botAI->TellMaster("Whisper 'go x,y', 'go [game object]', 'go unit' or 'go position' and I will go there");
|
||||
@@ -20,7 +20,7 @@ bool GreetAction::Execute(Event event)
|
||||
if (!player)
|
||||
return false;
|
||||
|
||||
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, player, sPlayerbotAIConfig->sightDistance))
|
||||
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, player, sPlayerbotAIConfig.sightDistance))
|
||||
bot->SetFacingToObject(player);
|
||||
|
||||
ObjectGuid oldSel = bot->GetTarget();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user