mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-15 16:16:11 +00:00
Compare commits
50 Commits
aeaaee15da
...
test-stagi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
441f9f7552 | ||
|
|
80aeeda0e8 | ||
|
|
25800f54e8 | ||
|
|
9748e36ad6 | ||
|
|
17b8d7f68b | ||
|
|
a0a50204ec | ||
|
|
80b3823f12 | ||
|
|
ee2a399ac8 | ||
|
|
610fdc16d7 | ||
|
|
c9c936d5c1 | ||
|
|
cfb2ed4bf3 | ||
|
|
e9e79ad696 | ||
|
|
3db2a5a193 | ||
|
|
8585f10f48 | ||
|
|
79fb3a5bbc | ||
|
|
6ed3f24ecb | ||
|
|
76b6df9ea3 | ||
|
|
026df0dabe | ||
|
|
b31bda85ee | ||
|
|
bebac60c51 | ||
|
|
52d4191b43 | ||
|
|
254055ff32 | ||
|
|
31765c77fa | ||
|
|
c86032f43b | ||
|
|
ba835250c8 | ||
|
|
8c2a27b9fe | ||
|
|
8e316cd321 | ||
|
|
cafb95e7bd | ||
|
|
8529654f8f | ||
|
|
6ee1684e9b | ||
|
|
9546363d41 | ||
|
|
00d19dbf9c | ||
|
|
caae524a0a | ||
|
|
13fff46fa0 | ||
|
|
a92886032c | ||
|
|
f5711dc6f7 | ||
|
|
43e8e31980 | ||
|
|
c59a02ed89 | ||
|
|
7abd836971 | ||
|
|
5365ba86b5 | ||
|
|
378254af3f | ||
|
|
3d467ce3bb | ||
|
|
3e21563669 | ||
|
|
bf456ee07f | ||
|
|
a5bd0b9a41 | ||
|
|
34bab48dd4 | ||
|
|
41c53365ae | ||
|
|
fd07e02a8a | ||
|
|
6cf7f1aaef | ||
|
|
9f54d7e702 |
21
.github/workflows/check_pr_source.yml
vendored
Normal file
21
.github/workflows/check_pr_source.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Enforce test-staging → master
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- test-staging
|
||||
|
||||
jobs:
|
||||
require-test-staging:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.event.pull_request.base.ref == 'master'
|
||||
steps:
|
||||
- name: Ensure PR source is test-staging
|
||||
run: |
|
||||
echo "Base: ${{ github.event.pull_request.base.ref }}"
|
||||
echo "Head: ${{ github.event.pull_request.head.ref }}"
|
||||
if [ "${{ github.event.pull_request.head.ref }}" != "test-staging" ]; then
|
||||
echo "✖ Pull request must come from test-staging"
|
||||
exit 1
|
||||
fi
|
||||
4
.github/workflows/code_style.yml
vendored
4
.github/workflows/code_style.yml
vendored
@@ -2,9 +2,9 @@ name: Codestyle
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
|
||||
concurrency:
|
||||
group: "codestyle-${{ github.event.pull_request.number }}"
|
||||
|
||||
4
.github/workflows/core_build.yml
vendored
4
.github/workflows/core_build.yml
vendored
@@ -2,9 +2,9 @@ name: ubuntu-build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
|
||||
concurrency:
|
||||
group: "core-build-${{ github.event.pull_request.number }}"
|
||||
|
||||
4
.github/workflows/macos_build.yml
vendored
4
.github/workflows/macos_build.yml
vendored
@@ -1,9 +1,9 @@
|
||||
name: macos-build
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
|
||||
concurrency:
|
||||
group: "macos-build-${{ github.event.pull_request.number }}"
|
||||
|
||||
4
.github/workflows/windows_build.yml
vendored
4
.github/workflows/windows_build.yml
vendored
@@ -1,9 +1,9 @@
|
||||
name: windows-build
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches: [ "master", "test-staging" ]
|
||||
|
||||
concurrency:
|
||||
group: "windows-build-${{ github.event.pull_request.number }}"
|
||||
|
||||
124
PULL_REQUEST_TEMPLATE.md
Normal file
124
PULL_REQUEST_TEMPLATE.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# 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)
|
||||
@@ -557,7 +558,7 @@ AiPlayerbot.AutoGearScoreLimit = 0
|
||||
# "mana" (bots have infinite mana)
|
||||
# "power" (bots have infinite energy, rage, and runic power)
|
||||
# "taxi" (bots may use all flight paths, though they will not actually learn them)
|
||||
# "raid" (bots use cheats implemented into raid strategies (currently only for Ulduar))
|
||||
# "raid" (bots use cheats implemented into raid strategies (currently only for SSC and Ulduar))
|
||||
# To use multiple cheats, separate them by commas below (e.g., to enable all, use "gold,health,mana,power,raid,taxi")
|
||||
# Default: food, taxi, and raid are enabled
|
||||
AiPlayerbot.BotCheats = "food,taxi,raid"
|
||||
@@ -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)
|
||||
@@ -989,7 +990,7 @@ AiPlayerbot.ZoneBracket.3433 = 10,22
|
||||
AiPlayerbot.ZoneBracket.3525 = 10,21
|
||||
|
||||
# Classic WoW - High-level zones:
|
||||
# Deadwind Pass (Zone ID: 10 Default Min,Max: 19,33)
|
||||
# Duskwood (Zone ID: 10 Default Min,Max: 19,33)
|
||||
# Wetlands (Zone ID: 11 Default Min,Max: 21,30)
|
||||
# Redridge Mountains (Zone ID: 44 Default Min,Max: 16,28)
|
||||
# Hillsbrad Foothills (Zone ID: 267 Default Min,Max: 20,34)
|
||||
@@ -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
|
||||
@@ -2181,4 +2182,4 @@ AiPlayerbot.SummonAtInnkeepersEnabled = 1
|
||||
# 30% more damage, 40% damage reduction (tank bots), increased all resistances, reduced threat for non tank bots, increased threat for tank bots.
|
||||
# Buffs will be applied on PP, Sindragosa and Lich King
|
||||
|
||||
AiPlayerbot.EnableICCBuffs = 1
|
||||
AiPlayerbot.EnableICCBuffs = 1
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Temporarily disables innodb_strict_mode for the session to allow the script to complete even if legacy table definitions contain InnoDB-incompatible attributes
|
||||
SET SESSION innodb_strict_mode = 0;
|
||||
|
||||
-- Change the tables to InnoDB
|
||||
ALTER TABLE playerbots_guild_names ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_names ENGINE=InnoDB;
|
||||
|
||||
-- Re-enables innodb_strict_mode
|
||||
SET SESSION innodb_strict_mode = 1;
|
||||
@@ -0,0 +1,18 @@
|
||||
-- Temporarily disables innodb_strict_mode for the session to allow the script to complete even if legacy table definitions contain InnoDB-incompatible attributes
|
||||
SET SESSION innodb_strict_mode = 0;
|
||||
|
||||
-- Change the tables to InnoDB
|
||||
ALTER TABLE playerbots_dungeon_suggestion_abbrevation ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_dungeon_suggestion_definition ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_dungeon_suggestion_strategy ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_equip_cache ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_item_info_cache ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_rarity_cache ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_rnditem_cache ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_tele_cache ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_travelnode ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_travelnode_link ENGINE=InnoDB;
|
||||
ALTER TABLE playerbots_travelnode_path ENGINE=InnoDB;
|
||||
|
||||
-- Re-enables innodb_strict_mode
|
||||
SET SESSION innodb_strict_mode = 1;
|
||||
@@ -0,0 +1,101 @@
|
||||
-- #########################################################
|
||||
-- Playerbots - Add PVP / Arena texts for TellPvpAction
|
||||
-- Localized for all WotLK locales (koKR, frFR, deDE, zhCN,
|
||||
-- zhTW, esES, esMX, ruRU)
|
||||
-- #########################################################
|
||||
|
||||
-- ---------------------------------------------------------
|
||||
-- pvp_currency
|
||||
-- [PVP] Arena points: %arena_points | Honor Points: %honor_points
|
||||
-- ---------------------------------------------------------
|
||||
INSERT INTO `ai_playerbot_texts`
|
||||
(`name`, `text`, `say_type`, `reply_type`,
|
||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||
SELECT
|
||||
'pvp_currency',
|
||||
'[PVP] Arena points: %arena_points | Honor Points: %honor_points',
|
||||
0, 0,
|
||||
-- koKR
|
||||
'[PVP] 투기장 점수: %arena_points | 명예 점수: %honor_points',
|
||||
-- frFR
|
||||
'[PVP] Points d''arène : %arena_points | Points d''honneur : %honor_points',
|
||||
-- deDE
|
||||
'[PVP] Arenapunkte: %arena_points | Ehrenpunkte: %honor_points',
|
||||
-- zhCN
|
||||
'[PVP] 竞技场点数:%arena_points | 荣誉点数:%honor_points',
|
||||
-- zhTW
|
||||
'[PVP] 競技場點數:%arena_points | 榮譽點數:%honor_points',
|
||||
-- esES
|
||||
'[PVP] Puntos de arena: %arena_points | Puntos de honor: %honor_points',
|
||||
-- esMX
|
||||
'[PVP] Puntos de arena: %arena_points | Puntos de honor: %honor_points',
|
||||
-- ruRU
|
||||
'[PVP] Очки арены: %arena_points | Очки чести: %honor_points'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `ai_playerbot_texts` WHERE `name` = 'pvp_currency'
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------
|
||||
-- pvp_arena_team
|
||||
-- [PVP] %bracket: <%team_name> (rating %team_rating)
|
||||
-- ---------------------------------------------------------
|
||||
INSERT INTO `ai_playerbot_texts`
|
||||
(`name`, `text`, `say_type`, `reply_type`,
|
||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||
SELECT
|
||||
'pvp_arena_team',
|
||||
'[PVP] %bracket: <%team_name> (rating %team_rating)',
|
||||
0, 0,
|
||||
-- koKR
|
||||
'[PVP] %bracket: <%team_name> (평점 %team_rating)',
|
||||
-- frFR
|
||||
'[PVP] %bracket : <%team_name> (cote %team_rating)',
|
||||
-- deDE
|
||||
'[PVP] %bracket: <%team_name> (Wertung %team_rating)',
|
||||
-- zhCN
|
||||
'[PVP] %bracket: <%team_name> (评分 %team_rating)',
|
||||
-- zhTW
|
||||
'[PVP] %bracket: <%team_name> (評分 %team_rating)',
|
||||
-- esES
|
||||
'[PVP] %bracket: <%team_name> (índice %team_rating)',
|
||||
-- esMX
|
||||
'[PVP] %bracket: <%team_name> (índice %team_rating)',
|
||||
-- ruRU
|
||||
'[PVP] %bracket: <%team_name> (рейтинг %team_rating)'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `ai_playerbot_texts` WHERE `name` = 'pvp_arena_team'
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------
|
||||
-- pvp_no_arena_team
|
||||
-- [PVP] I have no Arena Team.
|
||||
-- ---------------------------------------------------------
|
||||
INSERT INTO `ai_playerbot_texts`
|
||||
(`name`, `text`, `say_type`, `reply_type`,
|
||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||
SELECT
|
||||
'pvp_no_arena_team',
|
||||
'[PVP] I have no Arena Team.',
|
||||
0, 0,
|
||||
-- koKR
|
||||
'[PVP] 투기장 팀이 없습니다.',
|
||||
-- frFR
|
||||
'[PVP] Je n''ai aucune équipe d''arène.',
|
||||
-- deDE
|
||||
'[PVP] Ich habe kein Arenateam.',
|
||||
-- zhCN
|
||||
'[PVP] 我没有竞技场战队。',
|
||||
-- zhTW
|
||||
'[PVP] 我沒有競技場隊伍。',
|
||||
-- esES
|
||||
'[PVP] No tengo equipo de arena.',
|
||||
-- esMX
|
||||
'[PVP] No tengo equipo de arena.',
|
||||
-- ruRU
|
||||
'[PVP] У меня нет команды арены.'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `ai_playerbot_texts` WHERE `name` = 'pvp_no_arena_team'
|
||||
);
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "AcceptBattlegroundInvitationAction.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 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);
|
||||
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
||||
// packet << bgTypeId_ << action;
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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
|
||||
// sPlayerbotRepository->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);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ bool AddLootAction::Execute(Event event)
|
||||
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
||||
}
|
||||
|
||||
bool AddAllLootAction::Execute(Event event)
|
||||
bool AddAllLootAction::Execute(Event /*event*/)
|
||||
{
|
||||
bool added = false;
|
||||
|
||||
@@ -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;
|
||||
@@ -58,7 +58,7 @@ bool ReachAreaTriggerAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AreaTriggerAction::Execute(Event event)
|
||||
bool AreaTriggerAction::Execute(Event /*event*/)
|
||||
{
|
||||
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#include "AutoMaintenanceOnLevelupAction.h"
|
||||
|
||||
#include "GuildMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "Playerbots.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "BroadcastHelper.h"
|
||||
|
||||
bool AutoMaintenanceOnLevelupAction::Execute(Event event)
|
||||
bool AutoMaintenanceOnLevelupAction::Execute(Event /*event*/)
|
||||
{
|
||||
AutoPickTalents();
|
||||
AutoLearnSpell();
|
||||
AutoUpgradeEquip();
|
||||
AutoTeleportForLevel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AutoMaintenanceOnLevelupAction::AutoTeleportForLevel()
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!sPlayerbotAIConfig.autoTeleportForLevel || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -27,13 +28,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 +66,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 +167,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 +181,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);
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,8 @@
|
||||
#include "PlayerbotAI.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
#include "UpdateTime.h"
|
||||
|
||||
bool BGJoinAction::Execute(Event event)
|
||||
bool BGJoinAction::Execute(Event /*event*/)
|
||||
{
|
||||
uint32 queueType = AI_VALUE(uint32, "bg type");
|
||||
if (!queueType) // force join to fill bg
|
||||
@@ -89,7 +88,7 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
// continue;
|
||||
|
||||
if (offline)
|
||||
sRandomPlayerbotMgr->AddPlayerBot(itr->Guid, 0);
|
||||
sRandomPlayerbotMgr.AddPlayerBot(itr->Guid, 0);
|
||||
|
||||
if (member)
|
||||
{
|
||||
@@ -100,7 +99,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 +249,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 +264,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 +273,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 +293,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 +317,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 +439,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 +449,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 +522,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 +587,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 +602,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 +611,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 +631,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)
|
||||
{
|
||||
@@ -653,7 +652,7 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BGLeaveAction::Execute(Event event)
|
||||
bool BGLeaveAction::Execute(Event /*event*/)
|
||||
{
|
||||
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
||||
return false;
|
||||
@@ -670,7 +669,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 +708,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 +804,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 +957,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;
|
||||
@@ -1064,7 +1063,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BGStatusCheckAction::Execute(Event event)
|
||||
bool BGStatusCheckAction::Execute(Event /*event*/)
|
||||
{
|
||||
if (bot->IsBeingTeleported())
|
||||
return false;
|
||||
@@ -1080,7 +1079,7 @@ bool BGStatusCheckAction::Execute(Event event)
|
||||
|
||||
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||
|
||||
bool BGStrategyCheckAction::Execute(Event event)
|
||||
bool BGStrategyCheckAction::Execute(Event /*event*/)
|
||||
{
|
||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
||||
;
|
||||
@@ -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;
|
||||
@@ -1557,7 +1557,7 @@ bool BGTactics::eyJumpDown()
|
||||
//
|
||||
// actual bg tactics below
|
||||
//
|
||||
bool BGTactics::Execute(Event event)
|
||||
bool BGTactics::Execute(Event /*event*/)
|
||||
{
|
||||
Battleground* bg = bot->GetBattleground();
|
||||
if (!bg)
|
||||
@@ -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
|
||||
@@ -2227,8 +2227,8 @@ bool BGTactics::selectObjective(bool reset)
|
||||
}
|
||||
// Graveyard Camping if in lead
|
||||
else if (!hasFlag && role < 8 &&
|
||||
(team == TEAM_ALLIANCE && allianceScore == 2 && hordeScore == 0) ||
|
||||
(team == TEAM_HORDE && hordeScore == 2 && allianceScore == 0))
|
||||
((team == TEAM_ALLIANCE && allianceScore == 2 && hordeScore == 0) ||
|
||||
(team == TEAM_HORDE && hordeScore == 2 && allianceScore == 0)))
|
||||
{
|
||||
if (team == TEAM_ALLIANCE)
|
||||
SetSafePos(WS_GY_CAMPING_HORDE, 10.0f);
|
||||
@@ -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;
|
||||
@@ -4249,11 +4249,11 @@ bool BGTactics::IsLockedInsideKeep()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ArenaTactics::Execute(Event event)
|
||||
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);
|
||||
@@ -18,7 +18,7 @@ bool BossFireResistanceAction::isUseful()
|
||||
return bossFireResistanceTrigger.IsActive();
|
||||
}
|
||||
|
||||
bool BossFireResistanceAction::Execute(Event event)
|
||||
bool BossFireResistanceAction::Execute(Event /*event*/)
|
||||
{
|
||||
PaladinFireResistanceStrategy paladinFireResistanceStrategy(botAI);
|
||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFireResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||
@@ -32,7 +32,7 @@ bool BossFrostResistanceAction::isUseful()
|
||||
return bossFrostResistanceTrigger.IsActive();
|
||||
}
|
||||
|
||||
bool BossFrostResistanceAction::Execute(Event event)
|
||||
bool BossFrostResistanceAction::Execute(Event /*event*/)
|
||||
{
|
||||
PaladinFrostResistanceStrategy paladinFrostResistanceStrategy(botAI);
|
||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFrostResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||
@@ -46,7 +46,7 @@ bool BossNatureResistanceAction::isUseful()
|
||||
return bossNatureResistanceTrigger.IsActive();
|
||||
}
|
||||
|
||||
bool BossNatureResistanceAction::Execute(Event event)
|
||||
bool BossNatureResistanceAction::Execute(Event /*event*/)
|
||||
{
|
||||
HunterNatureResistanceStrategy hunterNatureResistanceStrategy(botAI);
|
||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||
@@ -60,7 +60,7 @@ bool BossShadowResistanceAction::isUseful()
|
||||
return bossShadowResistanceTrigger.IsActive();
|
||||
}
|
||||
|
||||
bool BossShadowResistanceAction::Execute(Event event)
|
||||
bool BossShadowResistanceAction::Execute(Event /*event*/)
|
||||
{
|
||||
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||
@@ -7,12 +7,14 @@
|
||||
#include "Player.h"
|
||||
#include "PlayerbotAI.h"
|
||||
|
||||
bool CancelChannelAction::Execute(Event event)
|
||||
bool CancelChannelAction::Execute(Event /*event*/)
|
||||
{
|
||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
{
|
||||
bot->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -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;
|
||||
@@ -334,7 +334,7 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
|
||||
return botAI->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
|
||||
}
|
||||
|
||||
bool DisEnchantRandomItemAction::Execute(Event event)
|
||||
bool DisEnchantRandomItemAction::Execute(Event /*event*/)
|
||||
{
|
||||
std::vector<Item*> items =
|
||||
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||
@@ -24,7 +24,7 @@ bool ChangeCombatStrategyAction::Execute(Event event)
|
||||
case '+':
|
||||
case '-':
|
||||
case '~':
|
||||
sPlayerbotRepository->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 '~':
|
||||
sPlayerbotRepository->Save(botAI);
|
||||
PlayerbotRepository::instance().Save(botAI);
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "Event.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "Playerbots.h"
|
||||
#include "AiObjectContext.h"
|
||||
#include "Log.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
|
||||
bool ChangeTalentsAction::Execute(Event event)
|
||||
{
|
||||
@@ -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)
|
||||
// // {
|
||||
@@ -184,14 +184,14 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// return std::move(ret);
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
// std::vector<TalentPath*> ChangeTalentsAction::getPremadePaths(TalentSpec* oldSpec)
|
||||
// {
|
||||
// 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());
|
||||
@@ -201,12 +201,12 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// return std::move(ret);
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
// 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,15 +364,15 @@ 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;
|
||||
// }
|
||||
|
||||
bool AutoSetTalentsAction::Execute(Event event)
|
||||
bool AutoSetTalentsAction::Execute(Event /*event*/)
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
if (!sPlayerbotAIConfig->autoPickTalents || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
if (!PlayerbotAIConfig::instance().autoPickTalents || !RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||
return false;
|
||||
|
||||
if (bot->GetFreeTalentPoints() <= 0)
|
||||
@@ -42,7 +42,7 @@ void PositionsResetAction::SetStayPosition(float x, float y, float z)
|
||||
posMap["stay"] = pos;
|
||||
}
|
||||
|
||||
bool FollowChatShortcutAction::Execute(Event event)
|
||||
bool FollowChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -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())
|
||||
{
|
||||
@@ -116,7 +116,7 @@ bool FollowChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StayChatShortcutAction::Execute(Event event)
|
||||
bool StayChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -133,7 +133,7 @@ bool StayChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MoveFromGroupChatShortcutAction::Execute(Event event)
|
||||
bool MoveFromGroupChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -148,7 +148,7 @@ bool MoveFromGroupChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FleeChatShortcutAction::Execute(Event event)
|
||||
bool FleeChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -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;
|
||||
@@ -171,7 +171,7 @@ bool FleeChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GoawayChatShortcutAction::Execute(Event event)
|
||||
bool GoawayChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -188,7 +188,7 @@ bool GoawayChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrindChatShortcutAction::Execute(Event event)
|
||||
bool GrindChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -204,7 +204,7 @@ bool GrindChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TankAttackChatShortcutAction::Execute(Event event)
|
||||
bool TankAttackChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -224,7 +224,7 @@ bool TankAttackChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MaxDpsChatShortcutAction::Execute(Event event)
|
||||
bool MaxDpsChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -241,7 +241,7 @@ bool MaxDpsChatShortcutAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BwlChatShortcutAction::Execute(Event event)
|
||||
bool BwlChatShortcutAction::Execute(Event /*event*/)
|
||||
{
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -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)) << "]";
|
||||
@@ -7,9 +7,10 @@
|
||||
|
||||
#include "Event.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;
|
||||
bot->GetSession()->HandleQueryNextMailTime(p);
|
||||
@@ -28,7 +29,7 @@ bool CheckMailAction::Execute(Event event)
|
||||
continue;
|
||||
|
||||
uint32 account = owner->GetSession()->GetAccountId();
|
||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account))
|
||||
if (PlayerbotAIConfig::instance().IsInRandomAccountList(account))
|
||||
continue;
|
||||
|
||||
ProcessMail(mail, owner, trans);
|
||||
@@ -80,7 +81,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";
|
||||
@@ -55,63 +55,6 @@ MountData CollectMountData(const Player* bot)
|
||||
return data;
|
||||
}
|
||||
|
||||
bool CheckMountStateAction::isUseful()
|
||||
{
|
||||
// Not useful when:
|
||||
if (botAI->IsInVehicle() || bot->isDead() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT) ||
|
||||
!bot->IsOutdoors() || bot->InArena())
|
||||
return false;
|
||||
|
||||
master = GetMaster();
|
||||
|
||||
// Get shapeshift states, only applicable when there's a master
|
||||
if (master)
|
||||
{
|
||||
botInShapeshiftForm = bot->GetShapeshiftForm();
|
||||
masterInShapeshiftForm = master->GetShapeshiftForm();
|
||||
}
|
||||
|
||||
// Not useful when in combat and not currently mounted / travel formed
|
||||
if ((bot->IsInCombat() || botAI->GetState() == BOT_STATE_COMBAT) &&
|
||||
!bot->IsMounted() && botInShapeshiftForm != FORM_TRAVEL && botInShapeshiftForm != FORM_FLIGHT && botInShapeshiftForm != FORM_FLIGHT_EPIC)
|
||||
return false;
|
||||
|
||||
// In addition to checking IsOutdoors, also check whether bot is clipping below floor slightly because that will
|
||||
// cause bot to falsly indicate they are outdoors. This fixes bug where bot tries to mount indoors (which seems
|
||||
// to mostly be an issue in tunnels of WSG and AV)
|
||||
float posZ = bot->GetPositionZ();
|
||||
float groundLevel = bot->GetMapWaterOrGroundLevel(bot->GetPositionX(), bot->GetPositionY(), posZ);
|
||||
if (!bot->IsMounted() && !bot->HasWaterWalkAura() && posZ < groundLevel)
|
||||
return false;
|
||||
|
||||
// Not useful when bot does not have mount strat and is not currently mounted
|
||||
if (!GET_PLAYERBOT_AI(bot)->HasStrategy("mount", BOT_STATE_NON_COMBAT) && !bot->IsMounted())
|
||||
return false;
|
||||
|
||||
// Not useful when level lower than minimum required
|
||||
if (bot->GetLevel() < sPlayerbotAIConfig->useGroundMountAtMinLevel)
|
||||
return false;
|
||||
|
||||
// Allow mounting while transformed only if the form allows it
|
||||
if (bot->HasAuraType(SPELL_AURA_TRANSFORM) && bot->IsInDisallowedMountForm())
|
||||
return false;
|
||||
|
||||
// BG Logic
|
||||
if (bot->InBattleground())
|
||||
{
|
||||
// Do not use when carrying BG Flags
|
||||
if (bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) || bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG) || bot->HasAura(BG_EY_NETHERSTORM_FLAG_SPELL))
|
||||
return false;
|
||||
|
||||
// Only mount if BG starts in less than 30 sec
|
||||
if (Battleground* bg = bot->GetBattleground())
|
||||
if (bg->GetStatus() == STATUS_WAIT_JOIN && bg->GetStartDelayTime() > BG_START_DELAY_30S)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckMountStateAction::Execute(Event /*event*/)
|
||||
{
|
||||
// Determine if there are no attackers
|
||||
@@ -182,6 +125,63 @@ bool CheckMountStateAction::Execute(Event /*event*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckMountStateAction::isUseful()
|
||||
{
|
||||
// Not useful when:
|
||||
if (botAI->IsInVehicle() || bot->isDead() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT) ||
|
||||
!bot->IsOutdoors() || bot->InArena())
|
||||
return false;
|
||||
|
||||
master = GetMaster();
|
||||
|
||||
// Get shapeshift states, only applicable when there's a master
|
||||
if (master)
|
||||
{
|
||||
botInShapeshiftForm = bot->GetShapeshiftForm();
|
||||
masterInShapeshiftForm = master->GetShapeshiftForm();
|
||||
}
|
||||
|
||||
// Not useful when in combat and not currently mounted / travel formed
|
||||
if ((bot->IsInCombat() || botAI->GetState() == BOT_STATE_COMBAT) &&
|
||||
!bot->IsMounted() && botInShapeshiftForm != FORM_TRAVEL && botInShapeshiftForm != FORM_FLIGHT && botInShapeshiftForm != FORM_FLIGHT_EPIC)
|
||||
return false;
|
||||
|
||||
// In addition to checking IsOutdoors, also check whether bot is clipping below floor slightly because that will
|
||||
// cause bot to falsly indicate they are outdoors. This fixes bug where bot tries to mount indoors (which seems
|
||||
// to mostly be an issue in tunnels of WSG and AV)
|
||||
float posZ = bot->GetPositionZ();
|
||||
float groundLevel = bot->GetMapWaterOrGroundLevel(bot->GetPositionX(), bot->GetPositionY(), posZ);
|
||||
if (!bot->IsMounted() && !bot->HasWaterWalkAura() && posZ < groundLevel)
|
||||
return false;
|
||||
|
||||
// Not useful when bot does not have mount strat and is not currently mounted
|
||||
if (!GET_PLAYERBOT_AI(bot)->HasStrategy("mount", BOT_STATE_NON_COMBAT) && !bot->IsMounted())
|
||||
return false;
|
||||
|
||||
// Not useful when level lower than minimum required
|
||||
if (bot->GetLevel() < sPlayerbotAIConfig.useGroundMountAtMinLevel)
|
||||
return false;
|
||||
|
||||
// Allow mounting while transformed only if the form allows it
|
||||
if (bot->HasAuraType(SPELL_AURA_TRANSFORM) && bot->IsInDisallowedMountForm())
|
||||
return false;
|
||||
|
||||
// BG Logic
|
||||
if (bot->InBattleground())
|
||||
{
|
||||
// Do not use when carrying BG Flags
|
||||
if (bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) || bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG) || bot->HasAura(BG_EY_NETHERSTORM_FLAG_SPELL))
|
||||
return false;
|
||||
|
||||
// Only mount if BG starts in less than 30 sec
|
||||
if (Battleground* bg = bot->GetBattleground())
|
||||
if (bg->GetStatus() == STATUS_WAIT_JOIN && bg->GetStartDelayTime() > BG_START_DELAY_30S)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckMountStateAction::Mount()
|
||||
{
|
||||
// Remove current Shapeshift if need be
|
||||
@@ -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.
|
||||
@@ -6,12 +6,15 @@
|
||||
#include "CheckValuesAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
#include "PlayerbotAI.h"
|
||||
#include "TravelNode.h"
|
||||
#include "AiObjectContext.h"
|
||||
|
||||
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))
|
||||
{
|
||||
@@ -20,7 +23,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");
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <random>
|
||||
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BudgetValues.h"
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
@@ -14,7 +13,6 @@
|
||||
#include "GuildCreateActions.h"
|
||||
#include "Playerbots.h"
|
||||
#include "RpgSubActions.h"
|
||||
#include "Util.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
|
||||
@@ -112,7 +110,7 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP)
|
||||
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.
|
||||
Player* master = botAI->GetMaster();
|
||||
@@ -248,7 +246,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 +277,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.
|
||||
@@ -320,7 +318,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
inDungeon = true;
|
||||
|
||||
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() &&
|
||||
(realMaster->GetMapId() != pos.getMapId()))
|
||||
(realMaster->GetMapId() != pos.GetMapId()))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -330,17 +328,17 @@ 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");
|
||||
float distance = groupLeader->GetDistance2d(pos.getX(), pos.getY());
|
||||
float distance = groupLeader->GetDistance2d(pos.GetPositionX(), pos.GetPositionY());
|
||||
|
||||
if (!botAI->HasActivePlayerMaster() && distance < 50.0f)
|
||||
{
|
||||
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,48 +20,17 @@ 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);
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isUseful()
|
||||
{
|
||||
if (!bot || !botAI) // Prevents invalid accesses
|
||||
return false;
|
||||
|
||||
if (!botAI->AllowActivity(GRIND_ACTIVITY)) // Bot cannot be active
|
||||
return false;
|
||||
|
||||
if (botAI->HasStrategy("stay", BOT_STATE_NON_COMBAT))
|
||||
return false;
|
||||
|
||||
if (bot->IsInCombat())
|
||||
return false;
|
||||
|
||||
Unit* target = GetTarget();
|
||||
if (!target || !target->IsInWorld()) // Checks if the target is valid and in the world
|
||||
return false;
|
||||
|
||||
std::string const name = std::string(target->GetName());
|
||||
if (!name.empty() &&
|
||||
(name.find("Dummy") != std::string::npos ||
|
||||
name.find("Charge Target") != std::string::npos ||
|
||||
name.find("Melee Target") != std::string::npos ||
|
||||
name.find("Ranged Target") != std::string::npos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DropTargetAction::Execute(Event event)
|
||||
bool DropTargetAction::Execute(Event /*event*/)
|
||||
{
|
||||
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
||||
if (target && target->isDead())
|
||||
@@ -127,7 +96,38 @@ bool AttackAnythingAction::Execute(Event event)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isPossible() { return AttackAction::isPossible() && GetTarget(); }
|
||||
bool AttackAnythingAction::isUseful()
|
||||
{
|
||||
if (!bot || !botAI) // Prevents invalid accesses
|
||||
return false;
|
||||
|
||||
if (!botAI->AllowActivity(GRIND_ACTIVITY)) // Bot cannot be active
|
||||
return false;
|
||||
|
||||
if (botAI->HasStrategy("stay", BOT_STATE_NON_COMBAT))
|
||||
return false;
|
||||
|
||||
if (bot->IsInCombat())
|
||||
return false;
|
||||
|
||||
Unit* target = GetTarget();
|
||||
if (!target || !target->IsInWorld()) // Checks if the target is valid and in the world
|
||||
return false;
|
||||
|
||||
std::string const name = std::string(target->GetName());
|
||||
if (!name.empty() &&
|
||||
(name.find("Dummy") != std::string::npos ||
|
||||
name.find("Charge Target") != std::string::npos ||
|
||||
name.find("Melee Target") != std::string::npos ||
|
||||
name.find("Ranged Target") != std::string::npos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isPossible() { return GetTarget() && AttackAction::isPossible(); }
|
||||
|
||||
bool DpsAssistAction::isUseful()
|
||||
{
|
||||
@@ -137,7 +137,7 @@ bool DpsAssistAction::isUseful()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttackRtiTargetAction::Execute(Event event)
|
||||
bool AttackRtiTargetAction::Execute(Event /*event*/)
|
||||
{
|
||||
Unit* rtiTarget = AI_VALUE(Unit*, "rti target");
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "LootObjectStack.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.
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
|
||||
#include "ChooseTravelTargetAction.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)
|
||||
{
|
||||
@@ -19,7 +23,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())
|
||||
@@ -28,23 +32,23 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
uint32 areaId = 0;
|
||||
uint32 zoneId = 0;
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(),
|
||||
pos.getZ());
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.GetMapId(), pos.GetPositionX(), pos.GetPositionY(),
|
||||
pos.GetPositionZ());
|
||||
|
||||
std::ostringstream out;
|
||||
out << zoneId << "," << areaId << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ",";
|
||||
|
||||
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 +57,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 +76,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 +112,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 +139,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 +168,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 +198,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 +215,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 +225,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 +250,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 +274,8 @@ bool DebugAction::Execute(Event event)
|
||||
std::thread t(
|
||||
[]
|
||||
{
|
||||
sTravelNodeMap->removeNodes();
|
||||
sTravelNodeMap->loadNodeStore();
|
||||
TravelNodeMap::instance().removeNodes();
|
||||
TravelNodeMap::instance().loadNodeStore();
|
||||
});
|
||||
|
||||
t.detach();
|
||||
@@ -282,7 +286,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)
|
||||
{
|
||||
@@ -298,7 +302,7 @@ bool DebugAction::Execute(Event event)
|
||||
for (auto p : ppath)
|
||||
{
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
bot->SummonCreature(1, p.GetPositionX(), p.GetPositionY(), p.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
// addAura(246, wpCreature);
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
|
||||
@@ -325,11 +329,11 @@ bool DebugAction::Execute(Event event)
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition botPos1 = botPos;
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
FakeSpell(spellEffect, wpCreature, wpCreature, prev->GetGUID(), {}, {}, botPos, botPos);
|
||||
@@ -352,11 +356,11 @@ bool DebugAction::Execute(Event event)
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition botPos1 = botPos;
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -383,11 +387,11 @@ bool DebugAction::Execute(Event event)
|
||||
WorldPosition botPos(bot);
|
||||
WorldPosition botPos1 = botPos;
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
|
||||
@@ -411,11 +415,11 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
@@ -480,13 +484,13 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -512,11 +516,11 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
}
|
||||
}
|
||||
@@ -532,8 +536,8 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
FakeSpell(effect, bot, nullptr, ObjectGuid::Empty, {}, {}, botPos, botPos, true);
|
||||
@@ -552,11 +556,11 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -568,7 +572,7 @@ bool DebugAction::Execute(Event event)
|
||||
// wpCreature->SendMessageToSet(&data, true);
|
||||
datMap.push_back(data);
|
||||
|
||||
// wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true,
|
||||
// wpCreature->MonsterMoveWithSpeed(botPos.GetPositionX(), botPos.GetPositionY() + 80, botPos.GetPositionZ(), 8.0f, true,
|
||||
// true);
|
||||
}
|
||||
}
|
||||
@@ -600,13 +604,13 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -646,12 +650,12 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(),
|
||||
botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(),
|
||||
botPos.GetPositionY(), botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature && lCreature)
|
||||
{
|
||||
@@ -675,11 +679,11 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -708,11 +712,11 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
@@ -788,11 +792,11 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
@@ -868,13 +872,13 @@ bool DebugAction::Execute(Event event)
|
||||
uint32 effect = dx + dy * 10 + soundEffects * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
wpCreature->PlayDistanceSound(effect);
|
||||
}
|
||||
@@ -964,7 +968,7 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
|
||||
m_targets.SetDst(dest);
|
||||
|
||||
if ((spellInfo && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION) || forceDest)
|
||||
m_targets.SetSrc(source.getX(), source.getY(), source.getZ());
|
||||
m_targets.SetSrc(source.GetPositionX(), source.GetPositionY(), source.GetPositionZ());
|
||||
|
||||
if (!forceDest && target)
|
||||
if (!spellInfo ||
|
||||
@@ -6,15 +6,19 @@
|
||||
#include "DelayAction.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);
|
||||
|
||||
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::Execute(Event event)
|
||||
bool SmartDestroyItemAction::Execute(Event /*event*/)
|
||||
{
|
||||
uint8 bagSpace = AI_VALUE(uint8, "bag space");
|
||||
|
||||
@@ -67,7 +67,7 @@ bool CleanQuestLogAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sPlayerbotAIConfig->dropObsoleteQuests)
|
||||
if (!sPlayerbotAIConfig.dropObsoleteQuests)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "EmoteAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "PlayerbotTextMgr.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
@@ -88,7 +87,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 +99,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 +132,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 +617,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 +688,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 +736,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;
|
||||
}
|
||||
|
||||
@@ -787,7 +786,7 @@ bool EmoteAction::isUseful()
|
||||
return time(nullptr) >= lastEmote;
|
||||
}
|
||||
|
||||
bool TalkAction::Execute(Event event)
|
||||
bool TalkAction::Execute(Event /*event*/)
|
||||
{
|
||||
Unit* target = botAI->GetUnit(AI_VALUE(ObjectGuid, "talk target"));
|
||||
if (!target)
|
||||
@@ -328,9 +328,45 @@ void EquipAction::EquipItem(Item* item)
|
||||
botAI->TellMaster(out);
|
||||
}
|
||||
|
||||
bool EquipUpgradesAction::Execute(Event event)
|
||||
ItemIds EquipAction::SelectInventoryItemsToEquip()
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
CollectItemsVisitor visitor;
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
|
||||
ItemIds items;
|
||||
for (auto i = visitor.items.begin(); i != visitor.items.end(); ++i)
|
||||
{
|
||||
Item* item = *i;
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
ItemTemplate const* itemTemplate = item->GetTemplate();
|
||||
if (!itemTemplate)
|
||||
continue;
|
||||
|
||||
//TODO Expand to Glyphs and Gems, that can be placed in equipment
|
||||
//Pre-filter non-equipable items
|
||||
if (itemTemplate->InventoryType == INVTYPE_NON_EQUIP)
|
||||
continue;
|
||||
|
||||
int32 randomProperty = item->GetItemRandomPropertyId();
|
||||
uint32 itemId = item->GetTemplate()->ItemId;
|
||||
std::string itemUsageParam;
|
||||
if (randomProperty != 0)
|
||||
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||
else
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item upgrade", itemUsageParam);
|
||||
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||
items.insert(itemId);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
bool EquipUpgradesTriggeredAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig.autoEquipUpgradeLoot && !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||
return false;
|
||||
|
||||
if (event.GetSource() == "trade status")
|
||||
@@ -361,72 +397,18 @@ bool EquipUpgradesAction::Execute(Event event)
|
||||
p >> itemId;
|
||||
|
||||
ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (item->Class == ITEM_CLASS_TRADE_GOODS && item->SubClass == ITEM_SUBCLASS_MEAT)
|
||||
if (item->InventoryType == INVTYPE_NON_EQUIP)
|
||||
return false;
|
||||
}
|
||||
|
||||
CollectItemsVisitor visitor;
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
|
||||
ItemIds items;
|
||||
for (auto i = visitor.items.begin(); i != visitor.items.end(); ++i)
|
||||
{
|
||||
Item* item = *i;
|
||||
if (!item)
|
||||
break;
|
||||
int32 randomProperty = item->GetItemRandomPropertyId();
|
||||
uint32 itemId = item->GetTemplate()->ItemId;
|
||||
std::string itemUsageParam;
|
||||
if (randomProperty != 0)
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
}
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
|
||||
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||
{
|
||||
items.insert(itemId);
|
||||
}
|
||||
}
|
||||
|
||||
ItemIds items = SelectInventoryItemsToEquip();
|
||||
EquipItems(items);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EquipUpgradeAction::Execute(Event event)
|
||||
bool EquipUpgradeAction::Execute(Event /*event*/)
|
||||
{
|
||||
CollectItemsVisitor visitor;
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
|
||||
ItemIds items;
|
||||
for (auto i = visitor.items.begin(); i != visitor.items.end(); ++i)
|
||||
{
|
||||
Item* item = *i;
|
||||
if (!item)
|
||||
break;
|
||||
int32 randomProperty = item->GetItemRandomPropertyId();
|
||||
uint32 itemId = item->GetTemplate()->ItemId;
|
||||
std::string itemUsageParam;
|
||||
if (randomProperty != 0)
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemUsageParam = std::to_string(itemId);
|
||||
}
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
|
||||
|
||||
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||
{
|
||||
items.insert(itemId);
|
||||
}
|
||||
}
|
||||
|
||||
ItemIds items = SelectInventoryItemsToEquip();
|
||||
EquipItems(items);
|
||||
return true;
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "InventoryAction.h"
|
||||
#include "Item.h"
|
||||
|
||||
class FindItemVisitor;
|
||||
class Item;
|
||||
@@ -20,6 +21,7 @@ public:
|
||||
|
||||
bool Execute(Event event) override;
|
||||
void EquipItems(ItemIds ids);
|
||||
ItemIds SelectInventoryItemsToEquip();
|
||||
|
||||
private:
|
||||
void EquipItem(FindItemVisitor* visitor);
|
||||
@@ -27,10 +29,10 @@ private:
|
||||
void EquipItem(Item* item);
|
||||
};
|
||||
|
||||
class EquipUpgradesAction : public EquipAction
|
||||
class EquipUpgradesTriggeredAction : public EquipAction
|
||||
{
|
||||
public:
|
||||
EquipUpgradesAction(PlayerbotAI* botAI, std::string const name = "equip upgrades") : EquipAction(botAI, name) {}
|
||||
explicit EquipUpgradesTriggeredAction(PlayerbotAI* botAI, std::string const name = "equip upgrades") : EquipAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
@@ -38,7 +40,7 @@ public:
|
||||
class EquipUpgradeAction : public EquipAction
|
||||
{
|
||||
public:
|
||||
EquipUpgradeAction(PlayerbotAI* botAI, std::string const name = "equip upgrade") : EquipAction(botAI, name) {}
|
||||
explicit EquipUpgradeAction(PlayerbotAI* botAI, std::string const name = "equip upgrade") : EquipAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
@@ -246,7 +246,7 @@ WorldPosition FindFishingHole(PlayerbotAI* botAI)
|
||||
return WorldPosition();
|
||||
}
|
||||
|
||||
bool MoveNearWaterAction::Execute(Event event)
|
||||
bool MoveNearWaterAction::Execute(Event /*event*/)
|
||||
{
|
||||
WorldPosition landSpot = AI_VALUE(WorldPosition, "fishing spot");
|
||||
if (landSpot.IsValid())
|
||||
@@ -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);
|
||||
|
||||
@@ -336,7 +336,7 @@ bool MoveNearWaterAction::isPossible()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EquipFishingPoleAction::Execute(Event event)
|
||||
bool EquipFishingPoleAction::Execute(Event /*event*/)
|
||||
{
|
||||
if (!_pole)
|
||||
return false;
|
||||
@@ -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);
|
||||
|
||||
@@ -463,7 +463,7 @@ bool UseBobberAction::isUseful()
|
||||
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");
|
||||
for (auto const& guid : gos)
|
||||
@@ -485,7 +485,7 @@ bool UseBobberAction::Execute(Event event)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EndMasterFishingAction::Execute(Event event)
|
||||
bool EndMasterFishingAction::Execute(Event /*event*/)
|
||||
{
|
||||
botAI->ChangeStrategy("-master fishing", BOT_STATE_NON_COMBAT);
|
||||
return true;
|
||||
@@ -499,11 +499,11 @@ 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();
|
||||
}
|
||||
|
||||
bool RemoveBobberStrategyAction::Execute(Event event)
|
||||
bool RemoveBobberStrategyAction::Execute(Event /*event*/)
|
||||
{
|
||||
botAI->ChangeStrategy("-use bobber", BOT_STATE_NON_COMBAT);
|
||||
return true;
|
||||
@@ -7,22 +7,24 @@
|
||||
#define _PLAYERBOT_FISHINGACTION_H
|
||||
|
||||
#include "Action.h"
|
||||
#include "MovementActions.h"
|
||||
#include "Event.h"
|
||||
#include "MovementActions.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
extern const uint32 FISHING_SPELL;
|
||||
extern const uint32 FISHING_POLE;
|
||||
extern const uint32 FISHING_BOBBER;
|
||||
|
||||
WorldPosition FindWaterRadial(Player* bot, float x, float y, float z, Map* map, uint32 phaseMask, float minDistance, float maxDistance, float increment, bool checkLOS=false, int numDirections = 16);
|
||||
WorldPosition FindWaterRadial(Player* bot, float x, float y, float z, Map* map, uint32 phaseMask, float minDistance,
|
||||
float maxDistance, float increment, bool checkLOS = false, int numDirections = 16);
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class FishingAction : public Action
|
||||
{
|
||||
public:
|
||||
FishingAction(PlayerbotAI* botAI) : Action(botAI, "go fishing"){}
|
||||
FishingAction(PlayerbotAI* botAI) : Action(botAI, "go fishing") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
@@ -31,8 +33,10 @@ class EquipFishingPoleAction : public Action
|
||||
{
|
||||
public:
|
||||
EquipFishingPoleAction(PlayerbotAI* botAI) : Action(botAI, "equip fishing pole") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
private:
|
||||
Item* _pole = nullptr;
|
||||
};
|
||||
@@ -40,7 +44,8 @@ private:
|
||||
class MoveNearWaterAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
MoveNearWaterAction(PlayerbotAI* botAI): MovementAction(botAI, "move near water") {}
|
||||
MoveNearWaterAction(PlayerbotAI* botAI) : MovementAction(botAI, "move near water") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
@@ -50,6 +55,7 @@ class UseBobberAction : public Action
|
||||
{
|
||||
public:
|
||||
UseBobberAction(PlayerbotAI* botAI) : Action(botAI, "use fishing bobber") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
@@ -58,6 +64,7 @@ class EndMasterFishingAction : public Action
|
||||
{
|
||||
public:
|
||||
EndMasterFishingAction(PlayerbotAI* botAI) : Action(botAI, "end master fishing") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
@@ -66,6 +73,8 @@ class RemoveBobberStrategyAction : public Action
|
||||
{
|
||||
public:
|
||||
RemoveBobberStrategyAction(PlayerbotAI* botAI) : Action(botAI, "remove bobber strategy") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5,17 +5,14 @@
|
||||
|
||||
#include "FollowActions.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "Event.h"
|
||||
#include "Formations.h"
|
||||
#include "LastMovementValue.h"
|
||||
#include "PlayerbotAI.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
bool FollowAction::Execute(Event event)
|
||||
bool FollowAction::Execute(Event /*event*/)
|
||||
{
|
||||
Formation* formation = AI_VALUE(Formation*, "formation");
|
||||
std::string const target = formation->GetTargetName();
|
||||
@@ -44,7 +41,7 @@ bool FollowAction::Execute(Event event)
|
||||
// botAI->PetFollow();
|
||||
// }
|
||||
// if (moved)
|
||||
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
||||
// botAI->SetNextCheckDelay(sPlayerbotAIConfig.reactDelay);
|
||||
|
||||
return moved;
|
||||
}
|
||||
@@ -98,9 +95,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)
|
||||
@@ -116,7 +113,7 @@ bool FollowAction::CanDeadFollow(Unit* target)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FleeToGroupLeaderAction::Execute(Event event)
|
||||
bool FleeToGroupLeaderAction::Execute(Event /*event*/)
|
||||
{
|
||||
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
||||
bool canFollow = Follow(fTarget);
|
||||
@@ -130,7 +127,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!");
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "CreatureAI.h"
|
||||
#include "Playerbots.h"
|
||||
#include "CharmInfo.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include <vector>
|
||||
@@ -54,7 +52,7 @@ bool MeleeAction::isUseful()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TogglePetSpellAutoCastAction::Execute(Event event)
|
||||
bool TogglePetSpellAutoCastAction::Execute(Event /*event*/)
|
||||
{
|
||||
Pet* pet = bot->GetPet();
|
||||
if (!pet)
|
||||
@@ -113,13 +111,13 @@ 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;
|
||||
}
|
||||
|
||||
bool PetAttackAction::Execute(Event event)
|
||||
bool PetAttackAction::Execute(Event /*event*/)
|
||||
{
|
||||
Guardian* pet = bot->GetGuardianPet();
|
||||
if (!pet)
|
||||
@@ -185,7 +183,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 +219,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);
|
||||
@@ -17,19 +17,17 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "Group.h"
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "GenericBuffUtils.h"
|
||||
#include "PlayerbotAI.h"
|
||||
|
||||
using ai::buff::MakeAuraQualifierForBuff;
|
||||
using ai::buff::UpgradeToGroupIfAppropriate;
|
||||
|
||||
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const 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")
|
||||
{
|
||||
@@ -78,34 +76,6 @@ bool CastSpellAction::Execute(Event event)
|
||||
return botAI->CastSpell(spell, GetTarget());
|
||||
}
|
||||
|
||||
bool CastSpellAction::isPossible()
|
||||
{
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}", bot->GetName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spell == "mount" && !bot->IsMounted() && !bot->IsInCombat())
|
||||
return true;
|
||||
|
||||
if (spell == "mount" && bot->IsInCombat())
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}", bot->GetName());
|
||||
}
|
||||
bot->Dismount();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Spell* currentSpell = bot->GetCurrentSpell(CURRENT_GENERIC_SPELL); //not used, line marked for removal.
|
||||
return botAI->CanCastSpell(spell, GetTarget());
|
||||
}
|
||||
|
||||
bool CastSpellAction::isUseful()
|
||||
{
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||
@@ -127,13 +97,40 @@ bool CastSpellAction::isUseful()
|
||||
if (!spellTarget->IsInWorld() || spellTarget->GetMapId() != bot->GetMapId())
|
||||
return false;
|
||||
|
||||
// float combatReach = bot->GetCombatReach() + spellTarget->GetCombatReach();
|
||||
// float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||
// if (!botAI->IsRanged(bot))
|
||||
// combatReach += 4.0f / 3.0f;
|
||||
|
||||
return spellTarget &&
|
||||
AI_VALUE2(bool, "spell cast useful",
|
||||
spell); // && sServerFacade->GetDistance2d(bot, spellTarget) <= (range + combatReach);
|
||||
return AI_VALUE2(bool, "spell cast useful", spell);
|
||||
// && ServerFacade::instance().GetDistance2d(bot, target) <= (range + combatReach);
|
||||
}
|
||||
|
||||
bool CastSpellAction::isPossible()
|
||||
{
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||
{
|
||||
if (!sPlayerbotAIConfig.logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}", bot->GetName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spell == "mount" && !bot->IsMounted() && !bot->IsInCombat())
|
||||
return true;
|
||||
|
||||
if (spell == "mount" && bot->IsInCombat())
|
||||
{
|
||||
if (!sPlayerbotAIConfig.logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster()))
|
||||
{
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}", bot->GetName());
|
||||
}
|
||||
bot->Dismount();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Spell* currentSpell = bot->GetCurrentSpell(CURRENT_GENERIC_SPELL); //not used, line marked for removal.
|
||||
return botAI->CanCastSpell(spell, GetTarget());
|
||||
}
|
||||
|
||||
CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||
@@ -233,7 +230,7 @@ Value<Unit*>* BuffOnPartyAction::GetTargetValue()
|
||||
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
|
||||
|
||||
@@ -290,7 +287,7 @@ Value<Unit*>* CastSnareSpellAction::GetTargetValue() { return context->GetValue<
|
||||
|
||||
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()); }
|
||||
|
||||
@@ -308,13 +305,13 @@ bool CastVehicleSpellAction::isPossible()
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -23,8 +23,8 @@ public:
|
||||
|
||||
std::string const GetTargetName() override { return "current target"; };
|
||||
bool Execute(Event event) override;
|
||||
bool isPossible() override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
ActionThreatType getThreatType() override { return ActionThreatType::Single; }
|
||||
|
||||
std::vector<NextAction> getPrerequisites() override
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
std::vector<std::string> split(std::string const s, char delim);
|
||||
|
||||
bool GiveItemAction::Execute(Event event)
|
||||
bool GiveItemAction::Execute(Event /*event*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (!target)
|
||||
@@ -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));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user