mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-24 12:34:36 +00:00
Compare commits
47 Commits
3e21563669
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f0a557655 | ||
|
|
d1cac8d027 | ||
|
|
3c62a45fad | ||
|
|
295f2d2784 | ||
|
|
441f9f7552 | ||
|
|
80aeeda0e8 | ||
|
|
25800f54e8 | ||
|
|
9748e36ad6 | ||
|
|
17b8d7f68b | ||
|
|
a0a50204ec | ||
|
|
80b3823f12 | ||
|
|
ee2a399ac8 | ||
|
|
a6a6af1b4d | ||
|
|
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 |
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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "codestyle-${{ github.event.pull_request.number }}"
|
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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "core-build-${{ github.event.pull_request.number }}"
|
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
|
name: macos-build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "macos-build-${{ github.event.pull_request.number }}"
|
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
|
name: windows-build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "master" ]
|
branches: [ "master", "test-staging" ]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "windows-build-${{ github.event.pull_request.number }}"
|
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.
|
||||||
@@ -544,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
|
# Max iLVL Phase 1(MC, Ony, ZG) = 78 | Phase 2(BWL) = 83 | Phase 2.5(AQ40) = 88 | Phase 3(Naxx40) = 92
|
||||||
# TBC
|
# TBC
|
||||||
# Max iLVL Tier 4 = 120 | Tier 5 = 133 | Tier 6 = 164
|
# 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
|
# 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 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
|
# Max iLVL Phase 1(Naxx) = 224 | Phase 2(Ulduar) = 245 | Phase 3(ToC) = 258 | Phase 4(ICC) = 290
|
||||||
# Default: 0 (no limit)
|
# Default: 0 (no limit)
|
||||||
@@ -558,7 +558,7 @@ AiPlayerbot.AutoGearScoreLimit = 0
|
|||||||
# "mana" (bots have infinite mana)
|
# "mana" (bots have infinite mana)
|
||||||
# "power" (bots have infinite energy, rage, and runic power)
|
# "power" (bots have infinite energy, rage, and runic power)
|
||||||
# "taxi" (bots may use all flight paths, though they will not actually learn them)
|
# "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")
|
# 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
|
# Default: food, taxi, and raid are enabled
|
||||||
AiPlayerbot.BotCheats = "food,taxi,raid"
|
AiPlayerbot.BotCheats = "food,taxi,raid"
|
||||||
@@ -736,7 +736,7 @@ AiPlayerbot.RandomGearQualityLimit = 3
|
|||||||
# TBC
|
# TBC
|
||||||
# Max iLVL Tier 4 = 120 | Tier 5 = 133 | Tier 6 = 164
|
# 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
|
# 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 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
|
# Max iLVL Phase 1(Naxx) = 224 | Phase 2(Ulduar) = 245 | Phase 3(ToC) = 258 | Phase 4(ICC) = 290
|
||||||
# Default: 0 (no limit)
|
# Default: 0 (no limit)
|
||||||
@@ -990,7 +990,7 @@ AiPlayerbot.ZoneBracket.3433 = 10,22
|
|||||||
AiPlayerbot.ZoneBracket.3525 = 10,21
|
AiPlayerbot.ZoneBracket.3525 = 10,21
|
||||||
|
|
||||||
# Classic WoW - High-level zones:
|
# 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)
|
# Wetlands (Zone ID: 11 Default Min,Max: 21,30)
|
||||||
# Redridge Mountains (Zone ID: 44 Default Min,Max: 16,28)
|
# Redridge Mountains (Zone ID: 44 Default Min,Max: 16,28)
|
||||||
# Hillsbrad Foothills (Zone ID: 267 Default Min,Max: 20,34)
|
# Hillsbrad Foothills (Zone ID: 267 Default Min,Max: 20,34)
|
||||||
@@ -1624,7 +1624,7 @@ AiPlayerbot.PremadeSpecLink.9.1.60 = -003203301135112530135201051
|
|||||||
AiPlayerbot.PremadeSpecLink.9.1.70 = -003203301135112530135201051-55
|
AiPlayerbot.PremadeSpecLink.9.1.70 = -003203301135112530135201051-55
|
||||||
AiPlayerbot.PremadeSpecLink.9.1.80 = -003203301135112530135221351-55000005
|
AiPlayerbot.PremadeSpecLink.9.1.80 = -003203301135112530135221351-55000005
|
||||||
AiPlayerbot.PremadeSpecName.9.2 = destro pve
|
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.60 = --05203215200231051305031151
|
||||||
AiPlayerbot.PremadeSpecLink.9.2.80 = 23-0302-05203215220331051335231351
|
AiPlayerbot.PremadeSpecLink.9.2.80 = 23-0302-05203215220331051335231351
|
||||||
AiPlayerbot.PremadeSpecName.9.3 = affli pvp
|
AiPlayerbot.PremadeSpecName.9.3 = affli pvp
|
||||||
@@ -2182,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.
|
# 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
|
# Buffs will be applied on PP, Sindragosa and Lich King
|
||||||
|
|
||||||
AiPlayerbot.EnableICCBuffs = 1
|
AiPlayerbot.EnableICCBuffs = 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 "AcceptBattlegroundInvitationAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool AcceptBgInvitationAction::Execute(Event event)
|
bool AcceptBgInvitationAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint8 type = 0; // arenatype if arena
|
uint8 type = 0; // arenatype if arena
|
||||||
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||||
@@ -18,9 +18,9 @@ bool AcceptBgInvitationAction::Execute(Event event)
|
|||||||
|
|
||||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||||
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
||||||
// packet << bgTypeId_ << action;
|
|
||||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||||
|
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ bool AcceptInvitationAction::Execute(Event event)
|
|||||||
if (!bot->GetGroup() || !bot->GetGroup()->IsMember(inviter->GetGUID()))
|
if (!bot->GetGroup() || !bot->GetGroup()->IsMember(inviter->GetGUID()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
botAI->SetMaster(inviter);
|
botAI->SetMaster(inviter);
|
||||||
// else
|
// else
|
||||||
// sPlayerbotRepository->Save(botAI);
|
// PlayerbotRepository::instance().Save(botAI);
|
||||||
|
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
botAI->ChangeStrategy("+follow,-lfg,-bg", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("+follow,-lfg,-bg", BOT_STATE_NON_COMBAT);
|
||||||
@@ -57,7 +57,7 @@ bool AcceptInvitationAction::Execute(Event event)
|
|||||||
|
|
||||||
botAI->TellMaster("Hello");
|
botAI->TellMaster("Hello");
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance)
|
if (sPlayerbotAIConfig.summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig.sightDistance)
|
||||||
{
|
{
|
||||||
Teleport(inviter, bot, true);
|
Teleport(inviter, bot, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ bool AddLootAction::Execute(Event event)
|
|||||||
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddAllLootAction::Execute(Event event)
|
bool AddAllLootAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ bool ReachAreaTriggerAction::Execute(Event event)
|
|||||||
/*forceDestination*/ false);
|
/*forceDestination*/ false);
|
||||||
|
|
||||||
float distance = bot->GetDistance(at->x, at->y, at->z);
|
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->TellError("Wait for me");
|
||||||
botAI->SetNextCheckDelay(delay);
|
botAI->SetNextCheckDelay(delay);
|
||||||
context->GetValue<LastMovement&>("last area trigger")->Get().lastAreaTrigger = triggerId;
|
context->GetValue<LastMovement&>("last area trigger")->Get().lastAreaTrigger = triggerId;
|
||||||
@@ -58,7 +58,7 @@ bool ReachAreaTriggerAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AreaTriggerAction::Execute(Event event)
|
bool AreaTriggerAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
// Check if bot OR target is in prohibited zone/area (skip for duels)
|
||||||
if ((target->IsPlayer() || target->IsPet()) &&
|
if ((target->IsPlayer() || target->IsPet()) &&
|
||||||
(!bot->duel || bot->duel->Opponent != target) &&
|
(!bot->duel || bot->duel->Opponent != target) &&
|
||||||
(sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId()) ||
|
(sPlayerbotAIConfig.IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId()) ||
|
||||||
sPlayerbotAIConfig->IsPvpProhibited(target->GetZoneId(), target->GetAreaId())))
|
sPlayerbotAIConfig.IsPvpProhibited(target->GetZoneId(), target->GetAreaId())))
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
botAI->TellError("I cannot attack other players in PvP prohibited areas.");
|
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))
|
if (botAI->CanMove() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target))
|
||||||
sServerFacade->SetFacingTo(bot, target);
|
ServerFacade::instance().SetFacingTo(bot, target);
|
||||||
|
|
||||||
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,26 @@
|
|||||||
#include "AutoMaintenanceOnLevelupAction.h"
|
#include "AutoMaintenanceOnLevelupAction.h"
|
||||||
|
|
||||||
#include "GuildMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
|
|
||||||
bool AutoMaintenanceOnLevelupAction::Execute(Event event)
|
bool AutoMaintenanceOnLevelupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
AutoPickTalents();
|
AutoPickTalents();
|
||||||
AutoLearnSpell();
|
AutoLearnSpell();
|
||||||
AutoUpgradeEquip();
|
AutoUpgradeEquip();
|
||||||
AutoTeleportForLevel();
|
AutoTeleportForLevel();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoMaintenanceOnLevelupAction::AutoTeleportForLevel()
|
void AutoMaintenanceOnLevelupAction::AutoTeleportForLevel()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!sPlayerbotAIConfig.autoTeleportForLevel || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -27,13 +28,13 @@ void AutoMaintenanceOnLevelupAction::AutoTeleportForLevel()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sRandomPlayerbotMgr->RandomTeleportForLevel(bot);
|
sRandomPlayerbotMgr.RandomTeleportForLevel(bot);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoMaintenanceOnLevelupAction::AutoPickTalents()
|
void AutoMaintenanceOnLevelupAction::AutoPickTalents()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->autoPickTalents || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!sPlayerbotAIConfig.autoPickTalents || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bot->GetFreeTalentPoints() <= 0)
|
if (bot->GetFreeTalentPoints() <= 0)
|
||||||
@@ -65,10 +66,10 @@ void AutoMaintenanceOnLevelupAction::AutoLearnSpell()
|
|||||||
void AutoMaintenanceOnLevelupAction::LearnSpells(std::ostringstream* out)
|
void AutoMaintenanceOnLevelupAction::LearnSpells(std::ostringstream* out)
|
||||||
{
|
{
|
||||||
BroadcastHelper::BroadcastLevelup(botAI, bot);
|
BroadcastHelper::BroadcastLevelup(botAI, bot);
|
||||||
if (sPlayerbotAIConfig->autoLearnTrainerSpells && sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (sPlayerbotAIConfig.autoLearnTrainerSpells && sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
LearnTrainerSpells(out);
|
LearnTrainerSpells(out);
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->autoLearnQuestSpells && sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (sPlayerbotAIConfig.autoLearnQuestSpells && sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
LearnQuestSpells(out);
|
LearnQuestSpells(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +167,7 @@ std::string const AutoMaintenanceOnLevelupAction::FormatSpell(SpellInfo const* s
|
|||||||
|
|
||||||
void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!sPlayerbotAIConfig.autoUpgradeEquip || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||||
@@ -180,9 +181,9 @@ void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
|
|||||||
factory.InitConsumables();
|
factory.InitConsumables();
|
||||||
factory.InitPotions();
|
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);
|
factory.InitEquipment(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,8 @@
|
|||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PositionValue.h"
|
#include "PositionValue.h"
|
||||||
#include "UpdateTime.h"
|
|
||||||
|
|
||||||
bool BGJoinAction::Execute(Event event)
|
bool BGJoinAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 queueType = AI_VALUE(uint32, "bg type");
|
uint32 queueType = AI_VALUE(uint32, "bg type");
|
||||||
if (!queueType) // force join to fill bg
|
if (!queueType) // force join to fill bg
|
||||||
@@ -89,7 +88,7 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
|||||||
// continue;
|
// continue;
|
||||||
|
|
||||||
if (offline)
|
if (offline)
|
||||||
sRandomPlayerbotMgr->AddPlayerBot(itr->Guid, 0);
|
sRandomPlayerbotMgr.AddPlayerBot(itr->Guid, 0);
|
||||||
|
|
||||||
if (member)
|
if (member)
|
||||||
{
|
{
|
||||||
@@ -100,7 +99,7 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
|||||||
if (member->GetGroup() && memberBotAI->HasRealPlayerMaster())
|
if (member->GetGroup() && memberBotAI->HasRealPlayerMaster())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->IsInRandomAccountList(member->GetSession()->GetAccountId()))
|
if (!sPlayerbotAIConfig.IsInRandomAccountList(member->GetSession()->GetAccountId()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (member->IsInCombat())
|
if (member->IsInCombat())
|
||||||
@@ -250,13 +249,13 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
|||||||
TeamSize = (uint32)type;
|
TeamSize = (uint32)type;
|
||||||
|
|
||||||
// Check if bots should join Rated Arena (Only captains can queue)
|
// 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 =
|
uint32 ratedArenaPlayerCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||||
uint32 ratedArenaInstanceCount =
|
uint32 ratedArenaInstanceCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||||
uint32 activeRatedArenaQueue =
|
uint32 activeRatedArenaQueue =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||||
|
|
||||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||||
@@ -265,7 +264,7 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
|||||||
{
|
{
|
||||||
if (sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type))
|
if (sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type))
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
||||||
ratedList.push_back(queueTypeId);
|
ratedList.push_back(queueTypeId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -274,13 +273,13 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
|||||||
// Check if bots should join Skirmish Arena
|
// 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.
|
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||||
uint32 skirmishArenaBotCount =
|
uint32 skirmishArenaBotCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||||
uint32 skirmishArenaPlayerCount =
|
uint32 skirmishArenaPlayerCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||||
uint32 skirmishArenaInstanceCount =
|
uint32 skirmishArenaInstanceCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||||
uint32 activeSkirmishArenaQueue =
|
uint32 activeSkirmishArenaQueue =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||||
if (maxRequiredSkirmishBots != 0)
|
if (maxRequiredSkirmishBots != 0)
|
||||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||||
@@ -294,12 +293,12 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if bots should join Battleground
|
// Check if bots should join Battleground
|
||||||
uint32 bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
uint32 bgAllianceBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
||||||
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
||||||
uint32 bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
uint32 bgHordeBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
||||||
uint32 bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
uint32 bgHordePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
||||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
uint32 activeBgQueue = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
uint32 bgInstanceCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||||
|
|
||||||
if (teamId == TEAM_ALLIANCE)
|
if (teamId == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
@@ -318,7 +317,7 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
|||||||
bool BGJoinAction::isUseful()
|
bool BGJoinAction::isUseful()
|
||||||
{
|
{
|
||||||
// do not try if BG bots disabled
|
// do not try if BG bots disabled
|
||||||
if (!sPlayerbotAIConfig->randomBotJoinBG)
|
if (!sPlayerbotAIConfig.randomBotJoinBG)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// can't queue while in BG/Arena
|
// can't queue while in BG/Arena
|
||||||
@@ -440,7 +439,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
|||||||
|
|
||||||
// get battlemaster
|
// get battlemaster
|
||||||
// Unit* unit = botAI->GetUnit(AI_VALUE2(CreatureData const*, "bg master", bgTypeId));
|
// 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)
|
if (!unit && isArena)
|
||||||
{
|
{
|
||||||
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(0);
|
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.
|
// This breaks groups as refresh includes a remove from group function call.
|
||||||
// refresh food/regs
|
// refresh food/regs
|
||||||
// sRandomPlayerbotMgr->Refresh(bot);
|
// sRandomPlayerbotMgr.Refresh(bot);
|
||||||
|
|
||||||
bool joinAsGroup = bot->GetGroup() && bot->GetGroup()->GetLeaderGUID() == bot->GetGUID();
|
bool joinAsGroup = bot->GetGroup() && bot->GetGroup()->GetLeaderGUID() == bot->GetGUID();
|
||||||
|
|
||||||
@@ -523,23 +522,23 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
|||||||
{
|
{
|
||||||
if (!isRated)
|
if (!isRated)
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount++;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!joinAsGroup)
|
else if (!joinAsGroup)
|
||||||
{
|
{
|
||||||
if (teamId == TEAM_ALLIANCE)
|
if (teamId == TEAM_ALLIANCE)
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount++;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount++;
|
||||||
else
|
else
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount++;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (teamId == TEAM_ALLIANCE)
|
if (teamId == TEAM_ALLIANCE)
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount +=
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount +=
|
||||||
bot->GetGroup()->GetMembersCount();
|
bot->GetGroup()->GetMembersCount();
|
||||||
else
|
else
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount +=
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount +=
|
||||||
bot->GetGroup()->GetMembersCount();
|
bot->GetGroup()->GetMembersCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,13 +587,13 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
|||||||
TeamSize = (uint32)type;
|
TeamSize = (uint32)type;
|
||||||
|
|
||||||
// Check if bots should join Rated Arena (Only captains can queue)
|
// 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 =
|
uint32 ratedArenaPlayerCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||||
uint32 ratedArenaInstanceCount =
|
uint32 ratedArenaInstanceCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||||
uint32 activeRatedArenaQueue =
|
uint32 activeRatedArenaQueue =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||||
|
|
||||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||||
@@ -603,7 +602,7 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
|||||||
{
|
{
|
||||||
if (sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type))
|
if (sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type))
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount += TeamSize;
|
||||||
ratedList.push_back(queueTypeId);
|
ratedList.push_back(queueTypeId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -612,13 +611,13 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
|||||||
// Check if bots should join Skirmish Arena
|
// 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.
|
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||||
uint32 skirmishArenaBotCount =
|
uint32 skirmishArenaBotCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||||
uint32 skirmishArenaPlayerCount =
|
uint32 skirmishArenaPlayerCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||||
uint32 skirmishArenaInstanceCount =
|
uint32 skirmishArenaInstanceCount =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||||
uint32 activeSkirmishArenaQueue =
|
uint32 activeSkirmishArenaQueue =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||||
if (maxRequiredSkirmishBots != 0)
|
if (maxRequiredSkirmishBots != 0)
|
||||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||||
@@ -632,12 +631,12 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if bots should join Battleground
|
// Check if bots should join Battleground
|
||||||
uint32 bgAllianceBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
uint32 bgAllianceBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount;
|
||||||
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
uint32 bgAlliancePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgAlliancePlayerCount;
|
||||||
uint32 bgHordeBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
uint32 bgHordeBotCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordeBotCount;
|
||||||
uint32 bgHordePlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
uint32 bgHordePlayerCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgHordePlayerCount;
|
||||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
uint32 activeBgQueue = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
uint32 bgInstanceCount = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||||
|
|
||||||
if (teamId == TEAM_ALLIANCE)
|
if (teamId == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
@@ -653,7 +652,7 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BGLeaveAction::Execute(Event event)
|
bool BGLeaveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
||||||
return false;
|
return false;
|
||||||
@@ -670,7 +669,7 @@ bool BGLeaveAction::Execute(Event event)
|
|||||||
uint16 unk = 0x1F90;
|
uint16 unk = 0x1F90;
|
||||||
uint8 unk2 = 0x0;
|
uint8 unk2 = 0x0;
|
||||||
bool isArena = false;
|
bool isArena = false;
|
||||||
bool IsRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
|
bool IsRandomBot = sRandomPlayerbotMgr.IsRandomBot(bot);
|
||||||
|
|
||||||
ArenaType arenaType = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId));
|
ArenaType arenaType = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId));
|
||||||
if (arenaType)
|
if (arenaType)
|
||||||
@@ -709,7 +708,7 @@ bool BGStatusAction::LeaveBG(PlayerbotAI* botAI)
|
|||||||
if (!bg)
|
if (!bg)
|
||||||
return false;
|
return false;
|
||||||
bool isArena = bg->isArena();
|
bool isArena = bg->isArena();
|
||||||
bool isRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
|
bool isRandomBot = sRandomPlayerbotMgr.IsRandomBot(bot);
|
||||||
|
|
||||||
if (isRandomBot)
|
if (isRandomBot)
|
||||||
botAI->SetMaster(nullptr);
|
botAI->SetMaster(nullptr);
|
||||||
@@ -805,7 +804,7 @@ bool BGStatusAction::Execute(Event event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsRandomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
|
bool IsRandomBot = sRandomPlayerbotMgr.IsRandomBot(bot);
|
||||||
BattlegroundQueueTypeId queueTypeId = bot->GetBattlegroundQueueTypeId(QueueSlot);
|
BattlegroundQueueTypeId queueTypeId = bot->GetBattlegroundQueueTypeId(QueueSlot);
|
||||||
BattlegroundTypeId _bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
BattlegroundTypeId _bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
||||||
if (!queueTypeId)
|
if (!queueTypeId)
|
||||||
@@ -958,10 +957,10 @@ bool BGStatusAction::Execute(Event event)
|
|||||||
//TeamId teamId = bot->GetTeamId(); //not used, line marked for removal.
|
//TeamId teamId = bot->GetTeamId(); //not used, line marked for removal.
|
||||||
bool realPlayers = false;
|
bool realPlayers = false;
|
||||||
if (isRated)
|
if (isRated)
|
||||||
realPlayers = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount > 0;
|
realPlayers = sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount > 0;
|
||||||
else
|
else
|
||||||
realPlayers =
|
realPlayers =
|
||||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
sRandomPlayerbotMgr.BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
||||||
|
|
||||||
if (realPlayers)
|
if (realPlayers)
|
||||||
return false;
|
return false;
|
||||||
@@ -1064,7 +1063,7 @@ bool BGStatusAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BGStatusCheckAction::Execute(Event event)
|
bool BGStatusCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsBeingTeleported())
|
if (bot->IsBeingTeleported())
|
||||||
return false;
|
return false;
|
||||||
@@ -1080,7 +1079,7 @@ bool BGStatusCheckAction::Execute(Event event)
|
|||||||
|
|
||||||
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||||
|
|
||||||
bool BGStrategyCheckAction::Execute(Event event)
|
bool BGStrategyCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1276,7 +1276,7 @@ static std::pair<uint32, uint32> IC_AttackObjectives[] = {
|
|||||||
// useful commands for fixing BG bugs and checking waypoints/paths
|
// useful commands for fixing BG bugs and checking waypoints/paths
|
||||||
bool BGTactics::HandleConsoleCommand(ChatHandler* handler, char const* args)
|
bool BGTactics::HandleConsoleCommand(ChatHandler* handler, char const* args)
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->enabled)
|
if (!sPlayerbotAIConfig.enabled)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
|
handler->PSendSysMessage("|cffff0000Playerbot system is currently disabled!");
|
||||||
return true;
|
return true;
|
||||||
@@ -1557,7 +1557,7 @@ bool BGTactics::eyJumpDown()
|
|||||||
//
|
//
|
||||||
// actual bg tactics below
|
// actual bg tactics below
|
||||||
//
|
//
|
||||||
bool BGTactics::Execute(Event event)
|
bool BGTactics::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Battleground* bg = bot->GetBattleground();
|
Battleground* bg = bot->GetBattleground();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
@@ -2219,7 +2219,7 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
if (urand(0, 99) < 20 && teamFC)
|
if (urand(0, 99) < 20 && teamFC)
|
||||||
{
|
{
|
||||||
target.Relocate(teamFC->GetPositionX(), teamFC->GetPositionY(), teamFC->GetPositionZ());
|
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);
|
Follow(teamFC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2227,8 +2227,8 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
}
|
}
|
||||||
// Graveyard Camping if in lead
|
// Graveyard Camping if in lead
|
||||||
else if (!hasFlag && role < 8 &&
|
else if (!hasFlag && role < 8 &&
|
||||||
(team == TEAM_ALLIANCE && allianceScore == 2 && hordeScore == 0) ||
|
((team == TEAM_ALLIANCE && allianceScore == 2 && hordeScore == 0) ||
|
||||||
(team == TEAM_HORDE && hordeScore == 2 && allianceScore == 0))
|
(team == TEAM_HORDE && hordeScore == 2 && allianceScore == 0)))
|
||||||
{
|
{
|
||||||
if (team == TEAM_ALLIANCE)
|
if (team == TEAM_ALLIANCE)
|
||||||
SetSafePos(WS_GY_CAMPING_HORDE, 10.0f);
|
SetSafePos(WS_GY_CAMPING_HORDE, 10.0f);
|
||||||
@@ -2263,7 +2263,7 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
if (urand(0, 99) < 70)
|
if (urand(0, 99) < 70)
|
||||||
{
|
{
|
||||||
target.Relocate(teamFC->GetPositionX(), teamFC->GetPositionY(), teamFC->GetPositionZ());
|
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);
|
Follow(teamFC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2284,7 +2284,7 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
{
|
{
|
||||||
// Assist own FC if not pursuing enemy FC
|
// Assist own FC if not pursuing enemy FC
|
||||||
target.Relocate(teamFC->GetPositionX(), teamFC->GetPositionY(), teamFC->GetPositionZ());
|
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);
|
Follow(teamFC);
|
||||||
}
|
}
|
||||||
else if (urand(0, 99) < 5)
|
else if (urand(0, 99) < 5)
|
||||||
@@ -3197,11 +3197,11 @@ bool BGTactics::moveToObjective(bool ignoreDist)
|
|||||||
return true;
|
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;
|
// std::ostringstream out;
|
||||||
// out << "It is too far away! " << pos.x << ", " << pos.y << ", Distance: " <<
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3213,7 +3213,7 @@ bool BGTactics::moveToObjective(bool ignoreDist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// std::ostringstream out; out << "Moving to objective " << pos.x << ", " << pos.y << ", Distance: " <<
|
// 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
|
// 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);
|
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: ";
|
// out << "WP: ";
|
||||||
// reverse ? out << currPoint << " <<< -> " << nPoint : out << currPoint << ">>> ->" << nPoint;
|
// reverse ? out << currPoint << " <<< -> " << nPoint : out << currPoint << ">>> ->" << nPoint;
|
||||||
// out << ", " << nextPoint.x << ", " << nextPoint.y << " Path Size: " << currentPath->size() << ", Dist: " <<
|
// 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);
|
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())
|
if (closeObjects.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool needRegen = bot->GetHealthPct() < sPlayerbotAIConfig->mediumHealth ||
|
bool needRegen = bot->GetHealthPct() < sPlayerbotAIConfig.mediumHealth ||
|
||||||
(AI_VALUE2(bool, "has mana", "self target") &&
|
(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) ||
|
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)) ||
|
bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG) || bot->HasAura(BG_EY_NETHERSTORM_FLAG_SPELL)) ||
|
||||||
!(teamFlagTaken() || flagTaken());
|
!(teamFlagTaken() || flagTaken());
|
||||||
@@ -4057,7 +4057,7 @@ bool BGTactics::useBuff()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// use speed buff only if close
|
// 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))
|
go->GetEntry() == Buff_Entries[0] ? 20.0f : 50.0f))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -4107,7 +4107,7 @@ uint32 BGTactics::getPlayersInArea(TeamId teamId, Position point, float range, b
|
|||||||
if (!combat && player->IsInCombat())
|
if (!combat && player->IsInCombat())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sServerFacade->GetDistance2d(player, point.GetPositionX(), point.GetPositionY()) < range)
|
if (ServerFacade::instance().GetDistance2d(player, point.GetPositionX(), point.GetPositionY()) < range)
|
||||||
++defCount;
|
++defCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4191,9 +4191,9 @@ bool BGTactics::IsLockedInsideKeep()
|
|||||||
// get closest portal
|
// get closest portal
|
||||||
if (bot->GetTeamId() == TEAM_ALLIANCE && go->GetEntry() == GO_TELEPORTER_4)
|
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;
|
closestDistance = tempDist;
|
||||||
closestPortal = go;
|
closestPortal = go;
|
||||||
@@ -4204,9 +4204,9 @@ bool BGTactics::IsLockedInsideKeep()
|
|||||||
// get closest portal
|
// get closest portal
|
||||||
if (bot->GetTeamId() == TEAM_HORDE && go->GetEntry() == GO_TELEPORTER_2)
|
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;
|
closestDistance = tempDist;
|
||||||
closestPortal = go;
|
closestPortal = go;
|
||||||
@@ -4249,11 +4249,11 @@ bool BGTactics::IsLockedInsideKeep()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArenaTactics::Execute(Event event)
|
bool ArenaTactics::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->InBattleground())
|
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_COMBAT);
|
||||||
botAI->ChangeStrategy("-arena", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("-arena", BOT_STATE_NON_COMBAT);
|
||||||
botAI->ResetStrategies(!IsRandomBot);
|
botAI->ResetStrategies(!IsRandomBot);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ bool BossFireResistanceAction::isUseful()
|
|||||||
return bossFireResistanceTrigger.IsActive();
|
return bossFireResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossFireResistanceAction::Execute(Event event)
|
bool BossFireResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinFireResistanceStrategy paladinFireResistanceStrategy(botAI);
|
PaladinFireResistanceStrategy paladinFireResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFireResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFireResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@@ -32,7 +32,7 @@ bool BossFrostResistanceAction::isUseful()
|
|||||||
return bossFrostResistanceTrigger.IsActive();
|
return bossFrostResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossFrostResistanceAction::Execute(Event event)
|
bool BossFrostResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinFrostResistanceStrategy paladinFrostResistanceStrategy(botAI);
|
PaladinFrostResistanceStrategy paladinFrostResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFrostResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFrostResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@@ -46,7 +46,7 @@ bool BossNatureResistanceAction::isUseful()
|
|||||||
return bossNatureResistanceTrigger.IsActive();
|
return bossNatureResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossNatureResistanceAction::Execute(Event event)
|
bool BossNatureResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
HunterNatureResistanceStrategy hunterNatureResistanceStrategy(botAI);
|
HunterNatureResistanceStrategy hunterNatureResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@@ -60,7 +60,7 @@ bool BossShadowResistanceAction::isUseful()
|
|||||||
return bossShadowResistanceTrigger.IsActive();
|
return bossShadowResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossShadowResistanceAction::Execute(Event event)
|
bool BossShadowResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ bool BuyAction::Execute(Event event)
|
|||||||
|
|
||||||
if (needMoneyFor == NeedMoneyFor::gear)
|
if (needMoneyFor == NeedMoneyFor::gear)
|
||||||
{
|
{
|
||||||
botAI->DoSpecificAction("equip upgrades");
|
botAI->DoSpecificAction("equip upgrades packet action");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ bool BuyAction::Execute(Event event)
|
|||||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP ||
|
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP ||
|
||||||
usage == ITEM_USAGE_BAD_EQUIP || usage == ITEM_USAGE_BROKEN_EQUIP)
|
usage == ITEM_USAGE_BAD_EQUIP || usage == ITEM_USAGE_BROKEN_EQUIP)
|
||||||
{
|
{
|
||||||
botAI->DoSpecificAction("equip upgrades");
|
botAI->DoSpecificAction("equip upgrades packet action");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,14 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool CancelChannelAction::Execute(Event event)
|
bool CancelChannelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||||
{
|
{
|
||||||
bot->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
bot->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,10 +130,10 @@ bool CastCustomSpellAction::Execute(Event event)
|
|||||||
return false;
|
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);
|
ServerFacade::instance().SetFacingTo(bot, target);
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.reactDelay);
|
||||||
|
|
||||||
msg << "cast " << text;
|
msg << "cast " << text;
|
||||||
botAI->HandleCommand(CHAT_MSG_WHISPER, msg.str(), master);
|
botAI->HandleCommand(CHAT_MSG_WHISPER, msg.str(), master);
|
||||||
@@ -286,7 +286,7 @@ bool CastRandomSpellAction::Execute(Event event)
|
|||||||
|
|
||||||
if (isCast)
|
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;
|
std::ostringstream cmd;
|
||||||
cmd << "castnc " << chat->FormatWorldobject(wo) + " " << spellId << " " << 19;
|
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());
|
return botAI->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisEnchantRandomItemAction::Execute(Event event)
|
bool DisEnchantRandomItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::vector<Item*> items =
|
std::vector<Item*> items =
|
||||||
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ bool ChangeCombatStrategyAction::Execute(Event event)
|
|||||||
case '+':
|
case '+':
|
||||||
case '-':
|
case '-':
|
||||||
case '~':
|
case '~':
|
||||||
sPlayerbotRepository->Save(botAI);
|
PlayerbotRepository::instance().Save(botAI);
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
break;
|
break;
|
||||||
@@ -40,7 +40,7 @@ bool ChangeNonCombatStrategyAction::Execute(Event event)
|
|||||||
std::string const text = event.getParam();
|
std::string const text = event.getParam();
|
||||||
|
|
||||||
uint32 account = bot->GetSession()->GetAccountId();
|
uint32 account = bot->GetSession()->GetAccountId();
|
||||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account) && botAI->GetMaster() &&
|
if (sPlayerbotAIConfig.IsInRandomAccountList(account) && botAI->GetMaster() &&
|
||||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||||
{
|
{
|
||||||
if (text.find("loot") != std::string::npos || text.find("gather") != std::string::npos)
|
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 '-':
|
case '-':
|
||||||
case '~':
|
case '~':
|
||||||
sPlayerbotRepository->Save(botAI);
|
PlayerbotRepository::instance().Save(botAI);
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "AiObjectContext.h"
|
#include "AiObjectContext.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
|
||||||
bool ChangeTalentsAction::Execute(Event event)
|
bool ChangeTalentsAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
@@ -110,20 +110,20 @@ std::string ChangeTalentsAction::SpecList()
|
|||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||||
{
|
{
|
||||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
if (sPlayerbotAIConfig.premadeSpecName[cls][specNo].size() == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
specFound++;
|
specFound++;
|
||||||
std::ostringstream out;
|
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;
|
std::unordered_map<int, int> tabCount;
|
||||||
tabCount[0] = tabCount[1] = tabCount[2] = 0;
|
tabCount[0] = tabCount[1] = tabCount[2] = 0;
|
||||||
for (auto& item : parsed)
|
for (auto& item : parsed)
|
||||||
{
|
{
|
||||||
tabCount[item[0]] += item[3];
|
tabCount[item[0]] += item[3];
|
||||||
}
|
}
|
||||||
out << specFound << ". " << sPlayerbotAIConfig->premadeSpecName[cls][specNo] << " (";
|
out << specFound << ". " << sPlayerbotAIConfig.premadeSpecName[cls][specNo] << " (";
|
||||||
out << tabCount[0] << "-" << tabCount[1] << "-" << tabCount[2] << ")";
|
out << tabCount[0] << "-" << tabCount[1] << "-" << tabCount[2] << ")";
|
||||||
botAI->TellMasterNoFacing(out.str());
|
botAI->TellMasterNoFacing(out.str());
|
||||||
}
|
}
|
||||||
@@ -137,11 +137,11 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
|||||||
// int specFound = 0; //not used, line marked for removal.
|
// int specFound = 0; //not used, line marked for removal.
|
||||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||||
{
|
{
|
||||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
if (sPlayerbotAIConfig.premadeSpecName[cls][specNo].size() == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo] == param)
|
if (sPlayerbotAIConfig.premadeSpecName[cls][specNo] == param)
|
||||||
{
|
{
|
||||||
PlayerbotFactory::InitTalentsBySpecNo(bot, specNo, true);
|
PlayerbotFactory::InitTalentsBySpecNo(bot, specNo, true);
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
|||||||
factory.InitGlyphs(false);
|
factory.InitGlyphs(false);
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Picking " << sPlayerbotAIConfig->premadeSpecName[cls][specNo];
|
out << "Picking " << sPlayerbotAIConfig.premadeSpecName[cls][specNo];
|
||||||
return out.str();
|
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*> ChangeTalentsAction::getPremadePaths(std::string const findName)
|
||||||
// {
|
// {
|
||||||
// std::vector<TalentPath*> ret;
|
// 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)
|
// // 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*> ChangeTalentsAction::getPremadePaths(TalentSpec* oldSpec)
|
||||||
// {
|
// {
|
||||||
// std::vector<TalentPath*> ret;
|
// 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);
|
// // TalentSpec newSpec = *GetBestPremadeSpec(path.id);
|
||||||
// // newSpec.CropTalents(bot->GetLevel());
|
// // 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)
|
// 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)
|
// // 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;
|
// return nullptr;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -270,9 +270,9 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
|||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// uint32 specNo = sRandomPlayerbotMgr->GetValue(bot->GetGUID().GetCounter(), "specNo");
|
// uint32 specNo = sRandomPlayerbotMgr.GetValue(bot->GetGUID().GetCounter(), "specNo");
|
||||||
// uint32 specId = specNo - 1;
|
// 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
|
// //Continue the current spec
|
||||||
// if (specNo > 0)
|
// if (specNo > 0)
|
||||||
@@ -319,15 +319,15 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
|||||||
// specId = -1;
|
// specId = -1;
|
||||||
// // specLink = "";
|
// // specLink = "";
|
||||||
// }
|
// }
|
||||||
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig->autoPickTalents*/ &&
|
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig.autoPickTalents*/ &&
|
||||||
// !sRandomPlayerbotMgr->IsRandomBot(bot))
|
// !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
// {
|
// {
|
||||||
// *out << "Found multiple specs: ";
|
// *out << "Found multiple specs: ";
|
||||||
// listPremadePaths(paths, out);
|
// listPremadePaths(paths, out);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// specId = PickPremadePath(paths, sRandomPlayerbotMgr->IsRandomBot(bot))->id;
|
// specId = PickPremadePath(paths, sRandomPlayerbotMgr.IsRandomBot(bot))->id;
|
||||||
// TalentSpec newSpec = *GetBestPremadeSpec(specId);
|
// TalentSpec newSpec = *GetBestPremadeSpec(specId);
|
||||||
// specLink = newSpec.GetTalentLink();
|
// specLink = newSpec.GetTalentLink();
|
||||||
// newSpec.CropTalents(bot->GetLevel());
|
// 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)
|
// if (!specLink.empty() && specId == -1)
|
||||||
// sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specLink", 1, specLink);
|
// sRandomPlayerbotMgr.SetValue(bot->GetGUID().GetCounter(), "specLink", 1, specLink);
|
||||||
// else
|
// else
|
||||||
// sRandomPlayerbotMgr->SetValue(bot->GetGUID().GetCounter(), "specLink", 0);
|
// sRandomPlayerbotMgr.SetValue(bot->GetGUID().GetCounter(), "specLink", 0);
|
||||||
|
|
||||||
// return (specNo == 0) ? false : true;
|
// return (specNo == 0) ? false : true;
|
||||||
// }
|
// }
|
||||||
@@ -364,15 +364,15 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
|||||||
// if (path->talentSpec.size())
|
// if (path->talentSpec.size())
|
||||||
// return &path->talentSpec.back();
|
// return &path->talentSpec.back();
|
||||||
|
|
||||||
// // return &sPlayerbotAIConfig->classSpecs[bot->getClassMask()].baseSpec;
|
// // return &sPlayerbotAIConfig.classSpecs[bot->getClassMask()].baseSpec;
|
||||||
// return nullptr;
|
// return nullptr;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
bool AutoSetTalentsAction::Execute(Event event)
|
bool AutoSetTalentsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->autoPickTalents || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!PlayerbotAIConfig::instance().autoPickTalents || !RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bot->GetFreeTalentPoints() <= 0)
|
if (bot->GetFreeTalentPoints() <= 0)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void PositionsResetAction::SetStayPosition(float x, float y, float z)
|
|||||||
posMap["stay"] = pos;
|
posMap["stay"] = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FollowChatShortcutAction::Execute(Event event)
|
bool FollowChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -96,7 +96,7 @@ bool FollowChatShortcutAction::Execute(Event event)
|
|||||||
|
|
||||||
/* Default mechanics takes care of this now.
|
/* Default mechanics takes care of this now.
|
||||||
if (bot->GetMapId() != master->GetMapId() || (master && bot->GetDistance(master) >
|
if (bot->GetMapId() != master->GetMapId() || (master && bot->GetDistance(master) >
|
||||||
sPlayerbotAIConfig->sightDistance))
|
sPlayerbotAIConfig.sightDistance))
|
||||||
{
|
{
|
||||||
if (bot->isDead())
|
if (bot->isDead())
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ bool FollowChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StayChatShortcutAction::Execute(Event event)
|
bool StayChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -133,7 +133,7 @@ bool StayChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveFromGroupChatShortcutAction::Execute(Event event)
|
bool MoveFromGroupChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -148,7 +148,7 @@ bool MoveFromGroupChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeChatShortcutAction::Execute(Event event)
|
bool FleeChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -161,7 +161,7 @@ bool FleeChatShortcutAction::Execute(Event event)
|
|||||||
ResetReturnPosition();
|
ResetReturnPosition();
|
||||||
ResetStayPosition();
|
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");
|
botAI->TellError("I will not flee with you - too far away");
|
||||||
return true;
|
return true;
|
||||||
@@ -171,7 +171,7 @@ bool FleeChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GoawayChatShortcutAction::Execute(Event event)
|
bool GoawayChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -188,7 +188,7 @@ bool GoawayChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GrindChatShortcutAction::Execute(Event event)
|
bool GrindChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -204,7 +204,7 @@ bool GrindChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TankAttackChatShortcutAction::Execute(Event event)
|
bool TankAttackChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -224,7 +224,7 @@ bool TankAttackChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaxDpsChatShortcutAction::Execute(Event event)
|
bool MaxDpsChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -241,7 +241,7 @@ bool MaxDpsChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BwlChatShortcutAction::Execute(Event event)
|
bool BwlChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void CheatAction::ListCheats()
|
|||||||
for (int i = 0; i < log2((uint32)BotCheatMask::maxMask); i++)
|
for (int i = 0; i < log2((uint32)BotCheatMask::maxMask); i++)
|
||||||
{
|
{
|
||||||
BotCheatMask cheatMask = BotCheatMask(1 << i);
|
BotCheatMask cheatMask = BotCheatMask(1 << i);
|
||||||
if ((uint32)cheatMask & (uint32)sPlayerbotAIConfig->botCheatMask)
|
if ((uint32)cheatMask & (uint32)sPlayerbotAIConfig.botCheatMask)
|
||||||
out << "[conf:" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
out << "[conf:" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||||
else if (botAI->HasCheat(cheatMask))
|
else if (botAI->HasCheat(cheatMask))
|
||||||
out << "[" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
out << "[" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildTaskMgr.h"
|
#include "GuildTaskMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool CheckMailAction::Execute(Event event)
|
bool CheckMailAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p;
|
WorldPacket p;
|
||||||
bot->GetSession()->HandleQueryNextMailTime(p);
|
bot->GetSession()->HandleQueryNextMailTime(p);
|
||||||
@@ -28,7 +29,7 @@ bool CheckMailAction::Execute(Event event)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 account = owner->GetSession()->GetAccountId();
|
uint32 account = owner->GetSession()->GetAccountId();
|
||||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account))
|
if (PlayerbotAIConfig::instance().IsInRandomAccountList(account))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ProcessMail(mail, owner, trans);
|
ProcessMail(mail, owner, trans);
|
||||||
@@ -80,7 +81,7 @@ void CheckMailAction::ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTr
|
|||||||
if (!item)
|
if (!item)
|
||||||
continue;
|
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;
|
std::ostringstream body;
|
||||||
body << "Hello, " << owner->GetName() << ",\n";
|
body << "Hello, " << owner->GetName() << ",\n";
|
||||||
|
|||||||
@@ -55,63 +55,6 @@ MountData CollectMountData(const Player* bot)
|
|||||||
return data;
|
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*/)
|
bool CheckMountStateAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Determine if there are no attackers
|
// Determine if there are no attackers
|
||||||
@@ -182,6 +125,63 @@ bool CheckMountStateAction::Execute(Event /*event*/)
|
|||||||
return false;
|
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()
|
bool CheckMountStateAction::Mount()
|
||||||
{
|
{
|
||||||
// Remove current Shapeshift if need be
|
// 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),
|
// 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.
|
// 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);
|
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;
|
return bot->getClass() == CLASS_WARRIOR ? std::max(18.0f, dismountDistance) : dismountDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +413,7 @@ float CheckMountStateAction::CalculateMountDistance() const
|
|||||||
// seconds:
|
// seconds:
|
||||||
// 21 / 7 = 21 / 14 + 1.5 = 3 (7 = dismounted speed 14 = epic-mount speed 1.5 = mount-spell cast time)
|
// 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);
|
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);
|
return std::max(21.0f, baseDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +440,7 @@ int32 CheckMountStateAction::CalculateMasterMountSpeed(Player* master, const Mou
|
|||||||
int32 ridingSkill = bot->GetPureSkillValue(SKILL_RIDING);
|
int32 ridingSkill = bot->GetPureSkillValue(SKILL_RIDING);
|
||||||
int32 botLevel = bot->GetLevel();
|
int32 botLevel = bot->GetLevel();
|
||||||
|
|
||||||
if (ridingSkill <= 75 && botLevel < static_cast<int32>(sPlayerbotAIConfig->useFastGroundMountAtMinLevel))
|
if (ridingSkill <= 75 && botLevel < static_cast<int32>(sPlayerbotAIConfig.useFastGroundMountAtMinLevel))
|
||||||
return 59;
|
return 59;
|
||||||
|
|
||||||
// If there is a master and bot not in BG, use master's aura effects.
|
// If there is a master and bot not in BG, use master's aura effects.
|
||||||
|
|||||||
@@ -6,12 +6,15 @@
|
|||||||
#include "CheckValuesAction.h"
|
#include "CheckValuesAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "TravelNode.h"
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
||||||
|
|
||||||
bool CheckValuesAction::Execute(Event event)
|
bool CheckValuesAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||||
{
|
{
|
||||||
@@ -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))
|
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");
|
GuidVector possible_targets = *context->GetValue<GuidVector>("possible targets");
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "BattlegroundMgr.h"
|
|
||||||
#include "BudgetValues.h"
|
#include "BudgetValues.h"
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
#include "GuildCreateActions.h"
|
#include "GuildCreateActions.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RpgSubActions.h"
|
#include "RpgSubActions.h"
|
||||||
#include "Util.h"
|
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "PossibleRpgTargetsValue.h"
|
#include "PossibleRpgTargetsValue.h"
|
||||||
|
|
||||||
@@ -112,7 +110,7 @@ float ChooseRpgTargetAction::getMaxRelevance(GuidPosition guidP)
|
|||||||
return floor((maxRelevance - 1.0) * 1000.0f);
|
return floor((maxRelevance - 1.0) * 1000.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChooseRpgTargetAction::Execute(Event event)
|
bool ChooseRpgTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
//TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
//TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
||||||
Player* master = botAI->GetMaster();
|
Player* master = botAI->GetMaster();
|
||||||
@@ -248,7 +246,7 @@ bool ChooseRpgTargetAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::mt19937 gen(time(0));
|
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());
|
GuidPosition guidP(guidps.front());
|
||||||
if (!guidP)
|
if (!guidP)
|
||||||
@@ -279,7 +277,7 @@ bool ChooseRpgTargetAction::isUseful()
|
|||||||
|
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
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;
|
return false;
|
||||||
|
|
||||||
// TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
// TravelTarget* travelTarget = AI_VALUE(TravelTarget*, "travel target"); //not used, line marked for removal.
|
||||||
@@ -320,7 +318,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
|||||||
inDungeon = true;
|
inDungeon = true;
|
||||||
|
|
||||||
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() &&
|
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() &&
|
||||||
(realMaster->GetMapId() != pos.getMapId()))
|
(realMaster->GetMapId() != pos.GetMapId()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,17 +328,17 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
|||||||
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (bot->GetDistance(groupLeader) > sPlayerbotAIConfig->rpgDistance * 2)
|
if (bot->GetDistance(groupLeader) > sPlayerbotAIConfig.rpgDistance * 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Formation* formation = AI_VALUE(Formation*, "formation");
|
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)
|
if (!botAI->HasActivePlayerMaster() && distance < 50.0f)
|
||||||
{
|
{
|
||||||
Player* player = groupLeader;
|
Player* player = groupLeader;
|
||||||
if (groupLeader && !groupLeader->isMoving() ||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,48 +20,17 @@ bool AttackEnemyPlayerAction::isUseful()
|
|||||||
if (PlayerHasFlag::IsCapturingFlag(bot))
|
if (PlayerHasFlag::IsCapturingFlag(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId());
|
return !sPlayerbotAIConfig.IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AttackEnemyFlagCarrierAction::isUseful()
|
bool AttackEnemyFlagCarrierAction::isUseful()
|
||||||
{
|
{
|
||||||
Unit* target = context->GetValue<Unit*>("enemy flag carrier")->Get();
|
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);
|
PlayerHasFlag::IsCapturingFlag(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AttackAnythingAction::isUseful()
|
bool DropTargetAction::Execute(Event /*event*/)
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
||||||
if (target && target->isDead())
|
if (target && target->isDead())
|
||||||
@@ -127,7 +96,38 @@ bool AttackAnythingAction::Execute(Event event)
|
|||||||
return result;
|
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()
|
bool DpsAssistAction::isUseful()
|
||||||
{
|
{
|
||||||
@@ -137,7 +137,7 @@ bool DpsAssistAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AttackRtiTargetAction::Execute(Event event)
|
bool AttackRtiTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* rtiTarget = AI_VALUE(Unit*, "rti target");
|
Unit* rtiTarget = AI_VALUE(Unit*, "rti target");
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool ChooseTravelTargetAction::Execute(Event event)
|
bool ChooseTravelTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); //not used, line marked for removal.
|
// Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); //not used, line marked for removal.
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ bool ChooseTravelTargetAction::getBestDestination(std::vector<TravelDestination*
|
|||||||
|
|
||||||
WorldPosition botLocation(bot);
|
WorldPosition botLocation(bot);
|
||||||
std::vector<WorldPosition*> availablePoints =
|
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.
|
if (availablePoints.empty()) // No points available.
|
||||||
return false;
|
return false;
|
||||||
@@ -488,7 +488,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
|||||||
if (newQuests)
|
if (newQuests)
|
||||||
{
|
{
|
||||||
// Prefer new quests near the player at lower levels.
|
// 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)
|
if (activeQuests || completedQuests)
|
||||||
{
|
{
|
||||||
@@ -510,7 +510,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Find quest takers or objectives
|
//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.
|
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())
|
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))
|
if (botAI->HasStrategy("debug travel", BotState::BOT_STATE_NON_COMBAT))
|
||||||
botAI->TellMasterNoFacing(std::to_string(activeDestinations.size()) + " quest destinations found.");
|
botAI->TellMasterNoFacing(std::to_string(activeDestinations.size()) + " quest destinations found.");
|
||||||
@@ -547,7 +547,7 @@ bool ChooseTravelTargetAction::SetNewQuestTarget(TravelTarget* target)
|
|||||||
|
|
||||||
// Find quest givers.
|
// Find quest givers.
|
||||||
std::vector<TravelDestination*> TravelDestinations =
|
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());
|
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||||
|
|
||||||
@@ -576,7 +576,7 @@ bool ChooseTravelTargetAction::SetRpgTarget(TravelTarget* target)
|
|||||||
|
|
||||||
// Find rpg npcs
|
// Find rpg npcs
|
||||||
std::vector<TravelDestination*> TravelDestinations =
|
std::vector<TravelDestination*> TravelDestinations =
|
||||||
sTravelMgr->getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
TravelMgr::instance().getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||||
|
|
||||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||||
|
|
||||||
@@ -605,7 +605,7 @@ bool ChooseTravelTargetAction::SetGrindTarget(TravelTarget* target)
|
|||||||
|
|
||||||
// Find grind mobs.
|
// Find grind mobs.
|
||||||
std::vector<TravelDestination*> TravelDestinations =
|
std::vector<TravelDestination*> TravelDestinations =
|
||||||
sTravelMgr->getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
TravelMgr::instance().getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||||
|
|
||||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||||
|
|
||||||
@@ -634,7 +634,7 @@ bool ChooseTravelTargetAction::SetBossTarget(TravelTarget* target)
|
|||||||
|
|
||||||
// Find boss mobs.
|
// Find boss mobs.
|
||||||
std::vector<TravelDestination*> TravelDestinations =
|
std::vector<TravelDestination*> TravelDestinations =
|
||||||
sTravelMgr->getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
TravelMgr::instance().getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||||
|
|
||||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||||
|
|
||||||
@@ -662,7 +662,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
|||||||
WorldPosition botLocation(bot);
|
WorldPosition botLocation(bot);
|
||||||
|
|
||||||
// Find quest givers.
|
// 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());
|
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||||
/*
|
/*
|
||||||
@@ -681,7 +681,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
|||||||
|
|
||||||
if (activePoints.empty())
|
if (activePoints.empty())
|
||||||
{
|
{
|
||||||
TravelDestinations = sTravelMgr->getExploreTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
TravelDestinations = TravelMgr::instance().getExploreTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||||
|
|
||||||
for (auto& activeTarget : activeDestinations)
|
for (auto& activeTarget : activeDestinations)
|
||||||
{
|
{
|
||||||
@@ -710,7 +710,7 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
|||||||
|
|
||||||
std::vector<TravelDestination*> dests;
|
std::vector<TravelDestination*> dests;
|
||||||
|
|
||||||
for (auto& d : sTravelMgr->getRpgTravelDestinations(bot, true, true))
|
for (auto& d : TravelMgr::instance().getRpgTravelDestinations(bot, true, true))
|
||||||
{
|
{
|
||||||
if (!d->getEntry())
|
if (!d->getEntry())
|
||||||
continue;
|
continue;
|
||||||
@@ -813,7 +813,7 @@ std::vector<TravelDestination*> TravelMgr::getBossTravelDestinations(Player* bot
|
|||||||
|
|
||||||
bool ChooseTravelTargetAction::SetNullTarget(TravelTarget* target)
|
bool ChooseTravelTargetAction::SetNullTarget(TravelTarget* target)
|
||||||
{
|
{
|
||||||
target->setTarget(sTravelMgr->nullTravelDestination, sTravelMgr->nullWorldPosition, true);
|
target->setTarget(TravelMgr::instance().nullTravelDestination, TravelMgr::instance().nullWorldPosition, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -832,7 +832,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
|||||||
//Quests
|
//Quests
|
||||||
if (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()))
|
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||||
dests.push_back(d);
|
dests.push_back(d);
|
||||||
@@ -842,7 +842,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
|||||||
//Zones
|
//Zones
|
||||||
if (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()))
|
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||||
dests.push_back(d);
|
dests.push_back(d);
|
||||||
@@ -852,7 +852,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
|||||||
//Npcs
|
//Npcs
|
||||||
if (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()))
|
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||||
dests.push_back(d);
|
dests.push_back(d);
|
||||||
@@ -862,7 +862,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
|||||||
//Mobs
|
//Mobs
|
||||||
if (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()))
|
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||||
dests.push_back(d);
|
dests.push_back(d);
|
||||||
@@ -872,7 +872,7 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
|||||||
//Bosses
|
//Bosses
|
||||||
if (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()))
|
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||||
dests.push_back(d);
|
dests.push_back(d);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ bool SwitchToMeleeAction::isUseful()
|
|||||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) &&
|
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) &&
|
||||||
((bot->IsInCombat() && target &&
|
((bot->IsInCombat() && target &&
|
||||||
(target->GetVictim() == bot && (!bot->GetGroup() || lastFlee) &&
|
(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()));
|
(!bot->IsInCombat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ bool SwitchToRangedAction::isUseful()
|
|||||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT) && hasAmmo &&
|
return botAI->HasStrategy("close", BOT_STATE_COMBAT) && hasAmmo &&
|
||||||
((bot->IsInCombat() && target &&
|
((bot->IsInCombat() && target &&
|
||||||
((target->GetVictim() != bot || target->GetTarget() != bot->GetGUID()) ||
|
((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()));
|
(!bot->IsInCombat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,11 @@
|
|||||||
|
|
||||||
#include "ChooseTravelTargetAction.h"
|
#include "ChooseTravelTargetAction.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "TravelMgr.h"
|
||||||
|
#include "Player.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "SpellMgr.h"
|
||||||
|
#include "Spell.h"
|
||||||
|
|
||||||
bool DebugAction::Execute(Event event)
|
bool DebugAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
@@ -19,7 +23,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
|
|
||||||
if (text == "scan")
|
if (text == "scan")
|
||||||
{
|
{
|
||||||
sPlayerbotAIConfig->openLog("scan.csv", "w");
|
sPlayerbotAIConfig.openLog("scan.csv", "w");
|
||||||
|
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
for (auto p : WorldPosition().getCreaturesNear())
|
for (auto p : WorldPosition().getCreaturesNear())
|
||||||
@@ -28,23 +32,23 @@ bool DebugAction::Execute(Event event)
|
|||||||
|
|
||||||
uint32 areaId = 0;
|
uint32 areaId = 0;
|
||||||
uint32 zoneId = 0;
|
uint32 zoneId = 0;
|
||||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(),
|
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.GetMapId(), pos.GetPositionX(), pos.GetPositionY(),
|
||||||
pos.getZ());
|
pos.GetPositionZ());
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << zoneId << "," << areaId << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ",";
|
out << zoneId << "," << areaId << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ",";
|
||||||
|
|
||||||
pos.printWKT(out);
|
pos.printWKT(out);
|
||||||
|
|
||||||
sPlayerbotAIConfig->log("scan.csv", out.str().c_str());
|
sPlayerbotAIConfig.log("scan.csv", out.str().c_str());
|
||||||
|
|
||||||
if (zoneId == 0 && areaId == 0)
|
if (zoneId == 0 && areaId == 0)
|
||||||
{
|
{
|
||||||
sPlayerbotAIConfig->log("x", out.str().c_str());
|
sPlayerbotAIConfig.log("x", out.str().c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sPlayerbotAIConfig->log("y", out.str().c_str());
|
sPlayerbotAIConfig.log("y", out.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
i = zoneId;
|
i = zoneId;
|
||||||
@@ -53,8 +57,8 @@ bool DebugAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
else if (text.find("printmap") != std::string::npos)
|
else if (text.find("printmap") != std::string::npos)
|
||||||
{
|
{
|
||||||
sTravelNodeMap->printMap();
|
TravelNodeMap::instance().printMap();
|
||||||
sTravelNodeMap->printNodeStore();
|
TravelNodeMap::instance().printNodeStore();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (text.find("travel ") != std::string::npos)
|
else if (text.find("travel ") != std::string::npos)
|
||||||
@@ -72,7 +76,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::vector<WorldPosition> beginPath, endPath;
|
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;
|
std::ostringstream out;
|
||||||
out << "Traveling to " << dest->getTitle() << ": ";
|
out << "Traveling to " << dest->getTitle() << ": ";
|
||||||
@@ -108,7 +112,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
|
|
||||||
out << quest->GetTitle() << ": ";
|
out << quest->GetTitle() << ": ";
|
||||||
|
|
||||||
QuestContainer* cont = sTravelMgr->quests[questId];
|
QuestContainer* cont = TravelMgr::instance().quests[questId];
|
||||||
|
|
||||||
for (auto g : cont->questGivers)
|
for (auto g : cont->questGivers)
|
||||||
{
|
{
|
||||||
@@ -135,11 +139,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
else if (text.find("quest") != std::string::npos)
|
else if (text.find("quest") != std::string::npos)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << sTravelMgr->quests.size() << " quests ";
|
out << TravelMgr::instance().quests.size() << " quests ";
|
||||||
|
|
||||||
uint32 noT = 0, noG = 0, noO = 0;
|
uint32 noT = 0, noG = 0, noO = 0;
|
||||||
|
|
||||||
for (auto q : sTravelMgr->quests)
|
for (auto q : TravelMgr::instance().quests)
|
||||||
{
|
{
|
||||||
if (q.second->questGivers.empty())
|
if (q.second->questGivers.empty())
|
||||||
noG++;
|
noG++;
|
||||||
@@ -164,7 +168,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
|
|
||||||
// uint32 noT = 0, noG = 0, noO = 0; //not used, line marked for removal.
|
// 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);
|
Quest const* quest = sObjectMgr->GetQuestTemplate(q.first);
|
||||||
|
|
||||||
@@ -194,16 +198,16 @@ bool DebugAction::Execute(Event event)
|
|||||||
|
|
||||||
std::string const name = "USER:" + text.substr(9);
|
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);
|
endNode->setLinked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
botAI->TellMasterNoFacing("Node " + name + " created.");
|
botAI->TellMasterNoFacing("Node " + name + " created.");
|
||||||
|
|
||||||
sTravelNodeMap->setHasToGen();
|
TravelNodeMap::instance().setHasToGen();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -211,7 +215,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
WorldPosition pos(bot);
|
WorldPosition pos(bot);
|
||||||
|
|
||||||
TravelNode* startNode = sTravelNodeMap->getNode(pos, nullptr, 50);
|
TravelNode* startNode = TravelNodeMap::instance().getNode(pos, nullptr, 50);
|
||||||
|
|
||||||
if (!startNode)
|
if (!startNode)
|
||||||
return false;
|
return false;
|
||||||
@@ -221,24 +225,24 @@ bool DebugAction::Execute(Event event)
|
|||||||
botAI->TellMasterNoFacing("Node can not be removed.");
|
botAI->TellMasterNoFacing("Node can not be removed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
sTravelNodeMap->m_nMapMtx.lock();
|
TravelNodeMap::instance().m_nMapMtx.lock();
|
||||||
sTravelNodeMap->removeNode(startNode);
|
TravelNodeMap::instance().removeNode(startNode);
|
||||||
botAI->TellMasterNoFacing("Node removed.");
|
botAI->TellMasterNoFacing("Node removed.");
|
||||||
sTravelNodeMap->m_nMapMtx.unlock();
|
TravelNodeMap::instance().m_nMapMtx.unlock();
|
||||||
|
|
||||||
sTravelNodeMap->setHasToGen();
|
TravelNodeMap::instance().setHasToGen();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (text.find("reset node") != std::string::npos)
|
else if (text.find("reset node") != std::string::npos)
|
||||||
{
|
{
|
||||||
for (auto& node : sTravelNodeMap->getNodes())
|
for (auto& node : TravelNodeMap::instance().getNodes())
|
||||||
node->setLinked(false);
|
node->setLinked(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (text.find("reset path") != std::string::npos)
|
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())
|
for (auto& path : *node->getLinks())
|
||||||
node->removeLinkTo(path.first, true);
|
node->removeLinkTo(path.first, true);
|
||||||
return true;
|
return true;
|
||||||
@@ -246,23 +250,23 @@ bool DebugAction::Execute(Event event)
|
|||||||
else if (text.find("gen node") != std::string::npos)
|
else if (text.find("gen node") != std::string::npos)
|
||||||
{
|
{
|
||||||
// Pathfinder
|
// Pathfinder
|
||||||
sTravelNodeMap->generateNodes();
|
TravelNodeMap::instance().generateNodes();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (text.find("gen path") != std::string::npos)
|
else if (text.find("gen path") != std::string::npos)
|
||||||
{
|
{
|
||||||
sTravelNodeMap->generatePaths();
|
TravelNodeMap::instance().generatePaths();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (text.find("crop path") != std::string::npos)
|
else if (text.find("crop path") != std::string::npos)
|
||||||
{
|
{
|
||||||
sTravelNodeMap->removeUselessPaths();
|
TravelNodeMap::instance().removeUselessPaths();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (text.find("save node") != std::string::npos)
|
else if (text.find("save node") != std::string::npos)
|
||||||
{
|
{
|
||||||
sTravelNodeMap->printNodeStore();
|
TravelNodeMap::instance().printNodeStore();
|
||||||
sTravelNodeMap->saveNodeStore();
|
TravelNodeMap::instance().saveNodeStore();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (text.find("load node") != std::string::npos)
|
else if (text.find("load node") != std::string::npos)
|
||||||
@@ -270,8 +274,8 @@ bool DebugAction::Execute(Event event)
|
|||||||
std::thread t(
|
std::thread t(
|
||||||
[]
|
[]
|
||||||
{
|
{
|
||||||
sTravelNodeMap->removeNodes();
|
TravelNodeMap::instance().removeNodes();
|
||||||
sTravelNodeMap->loadNodeStore();
|
TravelNodeMap::instance().loadNodeStore();
|
||||||
});
|
});
|
||||||
|
|
||||||
t.detach();
|
t.detach();
|
||||||
@@ -282,7 +286,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
WorldPosition pos(bot);
|
WorldPosition pos(bot);
|
||||||
|
|
||||||
std::vector<TravelNode*> nodes = sTravelNodeMap->getNodes(pos, 500);
|
std::vector<TravelNode*> nodes = TravelNodeMap::instance().getNodes(pos, 500);
|
||||||
|
|
||||||
for (auto& node : nodes)
|
for (auto& node : nodes)
|
||||||
{
|
{
|
||||||
@@ -298,7 +302,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
for (auto p : ppath)
|
for (auto p : ppath)
|
||||||
{
|
{
|
||||||
Creature* wpCreature =
|
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);
|
// addAura(246, wpCreature);
|
||||||
units.push_back(wpCreature->GetGUID());
|
units.push_back(wpCreature->GetGUID());
|
||||||
|
|
||||||
@@ -325,11 +329,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
WorldPosition botPos1 = botPos;
|
WorldPosition botPos1 = botPos;
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||||
botPos.setZ(botPos.getHeight() + 2);
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
FakeSpell(spellEffect, wpCreature, wpCreature, prev->GetGUID(), {}, {}, botPos, botPos);
|
FakeSpell(spellEffect, wpCreature, wpCreature, prev->GetGUID(), {}, {}, botPos, botPos);
|
||||||
@@ -352,11 +356,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
WorldPosition botPos1 = botPos;
|
WorldPosition botPos1 = botPos;
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||||
botPos.setZ(botPos.getHeight() + 2);
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
if (wpCreature)
|
if (wpCreature)
|
||||||
@@ -383,11 +387,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
WorldPosition botPos1 = botPos;
|
WorldPosition botPos1 = botPos;
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||||
botPos.setZ(botPos.getHeight() + 2);
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
|
||||||
wpCreature->SetObjectScale(0.5f);
|
wpCreature->SetObjectScale(0.5f);
|
||||||
|
|
||||||
@@ -411,11 +415,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
|
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + cos(ang) * dist);
|
botPos.setX(botPos.GetPositionX() + cos(ang) * dist);
|
||||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
botPos.setY(botPos.GetPositionY() + sin(ang) * dist);
|
||||||
botPos.setZ(botPos.getHeight() + 2);
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
units.push_back(wpCreature->GetGUID());
|
units.push_back(wpCreature->GetGUID());
|
||||||
@@ -480,13 +484,13 @@ bool DebugAction::Execute(Event event)
|
|||||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
botPos.setZ(botPos.getHeight());
|
||||||
|
|
||||||
Creature* wpCreature =
|
Creature* wpCreature =
|
||||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
if (wpCreature)
|
if (wpCreature)
|
||||||
{
|
{
|
||||||
@@ -512,11 +516,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,8 +536,8 @@ bool DebugAction::Execute(Event event)
|
|||||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
botPos.setZ(botPos.getHeight());
|
||||||
|
|
||||||
FakeSpell(effect, bot, nullptr, ObjectGuid::Empty, {}, {}, botPos, botPos, true);
|
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;
|
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
if (wpCreature)
|
if (wpCreature)
|
||||||
@@ -568,7 +572,7 @@ bool DebugAction::Execute(Event event)
|
|||||||
// wpCreature->SendMessageToSet(&data, true);
|
// wpCreature->SendMessageToSet(&data, true);
|
||||||
datMap.push_back(data);
|
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);
|
// true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -600,13 +604,13 @@ bool DebugAction::Execute(Event event)
|
|||||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
botPos.setZ(botPos.getHeight());
|
||||||
|
|
||||||
Creature* wpCreature =
|
Creature* wpCreature =
|
||||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
if (wpCreature)
|
if (wpCreature)
|
||||||
{
|
{
|
||||||
@@ -646,12 +650,12 @@ bool DebugAction::Execute(Event event)
|
|||||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
botPos.setZ(botPos.getHeight());
|
||||||
|
|
||||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(),
|
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(),
|
||||||
botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
botPos.GetPositionY(), botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
if (wpCreature && lCreature)
|
if (wpCreature && lCreature)
|
||||||
{
|
{
|
||||||
@@ -675,11 +679,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
if (wpCreature)
|
if (wpCreature)
|
||||||
@@ -708,11 +712,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
all_targets.push_back(wpCreature->GetGUID());
|
all_targets.push_back(wpCreature->GetGUID());
|
||||||
@@ -788,11 +792,11 @@ bool DebugAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
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);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
all_targets.push_back(wpCreature->GetGUID());
|
all_targets.push_back(wpCreature->GetGUID());
|
||||||
@@ -868,13 +872,13 @@ bool DebugAction::Execute(Event event)
|
|||||||
uint32 effect = dx + dy * 10 + soundEffects * 100;
|
uint32 effect = dx + dy * 10 + soundEffects * 100;
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
|
|
||||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
botPos.setX(botPos.GetPositionX() + (dx - 5) * 5);
|
||||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
botPos.setY(botPos.GetPositionY() + (dy - 5) * 5);
|
||||||
botPos.setZ(botPos.getHeight());
|
botPos.setZ(botPos.getHeight());
|
||||||
|
|
||||||
Creature* wpCreature =
|
Creature* wpCreature =
|
||||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.GetPositionX(), botPos.GetPositionY(),
|
||||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
botPos.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
|
|
||||||
wpCreature->PlayDistanceSound(effect);
|
wpCreature->PlayDistanceSound(effect);
|
||||||
}
|
}
|
||||||
@@ -964,7 +968,7 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
|
|||||||
m_targets.SetDst(dest);
|
m_targets.SetDst(dest);
|
||||||
|
|
||||||
if ((spellInfo && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION) || forceDest)
|
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 (!forceDest && target)
|
||||||
if (!spellInfo ||
|
if (!spellInfo ||
|
||||||
|
|||||||
@@ -6,15 +6,19 @@
|
|||||||
#include "DelayAction.h"
|
#include "DelayAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
#include "PlayerbotAIConfig.h"
|
||||||
|
|
||||||
bool DelayAction::Execute(Event event)
|
bool DelayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 delay = sPlayerbotAIConfig->passiveDelay + sPlayerbotAIConfig->globalCoolDown;
|
const uint32 delay = PlayerbotAIConfig::instance().passiveDelay + PlayerbotAIConfig::instance().globalCoolDown;
|
||||||
|
|
||||||
botAI->SetNextCheckDelay(delay);
|
botAI->SetNextCheckDelay(delay);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DelayAction::isUseful() { return !botAI->AllowActivity(ALL_ACTIVITY); }
|
bool DelayAction::isUseful()
|
||||||
|
{
|
||||||
|
return !botAI->AllowActivity(ALL_ACTIVITY);
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ void DestroyItemAction::DestroyItem(FindItemVisitor* visitor)
|
|||||||
|
|
||||||
bool SmartDestroyItemAction::isUseful() { return !botAI->HasActivePlayerMaster(); }
|
bool SmartDestroyItemAction::isUseful() { return !botAI->HasActivePlayerMaster(); }
|
||||||
|
|
||||||
bool SmartDestroyItemAction::Execute(Event event)
|
bool SmartDestroyItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint8 bagSpace = AI_VALUE(uint8, "bag space");
|
uint8 bagSpace = AI_VALUE(uint8, "bag space");
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ bool CleanQuestLogAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->dropObsoleteQuests)
|
if (!sPlayerbotAIConfig.dropObsoleteQuests)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "EmoteAction.h"
|
#include "EmoteAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
@@ -88,7 +87,7 @@ void EmoteActionBase::InitEmotes()
|
|||||||
|
|
||||||
bool EmoteActionBase::Emote(Unit* target, uint32 type, bool textEmote)
|
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);
|
bot->SetFacingToObject(target);
|
||||||
|
|
||||||
ObjectGuid oldSelection = bot->GetTarget();
|
ObjectGuid oldSelection = bot->GetTarget();
|
||||||
@@ -100,7 +99,7 @@ bool EmoteActionBase::Emote(Unit* target, uint32 type, bool textEmote)
|
|||||||
if (player)
|
if (player)
|
||||||
{
|
{
|
||||||
PlayerbotAI* playerBotAI = GET_PLAYERBOT_AI(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);
|
player->SetFacingToObject(bot);
|
||||||
}
|
}
|
||||||
@@ -133,7 +132,7 @@ Unit* EmoteActionBase::GetTarget()
|
|||||||
for (GuidVector::iterator i = nfp.begin(); i != nfp.end(); ++i)
|
for (GuidVector::iterator i = nfp.begin(); i != nfp.end(); ++i)
|
||||||
{
|
{
|
||||||
Unit* unit = botAI->GetUnit(*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);
|
targets.push_back(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,8 +617,8 @@ bool EmoteActionBase::ReceiveEmote(Player* source, uint32 emote, bool verbal)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source && !bot->isMoving() && !bot->HasInArc(static_cast<float>(M_PI), source, sPlayerbotAIConfig->farDistance))
|
if (source && !bot->isMoving() && !bot->HasInArc(static_cast<float>(M_PI), source, sPlayerbotAIConfig.farDistance))
|
||||||
sServerFacade->SetFacingTo(bot, source);
|
ServerFacade::instance().SetFacingTo(bot, source);
|
||||||
|
|
||||||
if (verbal)
|
if (verbal)
|
||||||
{
|
{
|
||||||
@@ -689,7 +688,7 @@ bool EmoteAction::Execute(Event event)
|
|||||||
p >> emoteId >> source;
|
p >> emoteId >> source;
|
||||||
|
|
||||||
pSource = ObjectAccessor::FindPlayer(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)
|
emoteId != EMOTE_ONESHOT_NONE)
|
||||||
{
|
{
|
||||||
if ((pSource->GetGUID() != bot->GetGUID()) &&
|
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.
|
// time_t lastEmote = AI_VALUE2(time_t, "last emote", qualifier); //not used, line marked for removal.
|
||||||
botAI->GetAiObjectContext()
|
botAI->GetAiObjectContext()
|
||||||
->GetValue<time_t>("last emote", qualifier)
|
->GetValue<time_t>("last emote", qualifier)
|
||||||
->Set(time(nullptr) + urand(1000, sPlayerbotAIConfig->repeatDelay) / 1000);
|
->Set(time(nullptr) + urand(1000, sPlayerbotAIConfig.repeatDelay) / 1000);
|
||||||
param = qualifier;
|
param = qualifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -787,7 +786,7 @@ bool EmoteAction::isUseful()
|
|||||||
return time(nullptr) >= lastEmote;
|
return time(nullptr) >= lastEmote;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TalkAction::Execute(Event event)
|
bool TalkAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = botAI->GetUnit(AI_VALUE(ObjectGuid, "talk target"));
|
Unit* target = botAI->GetUnit(AI_VALUE(ObjectGuid, "talk target"));
|
||||||
if (!target)
|
if (!target)
|
||||||
|
|||||||
@@ -328,12 +328,48 @@ void EquipAction::EquipItem(Item* item)
|
|||||||
botAI->TellMaster(out);
|
botAI->TellMaster(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipUpgradesAction::Execute(Event event)
|
ItemIds EquipAction::SelectInventoryItemsToEquip()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot))
|
CollectItemsVisitor visitor;
|
||||||
return false;
|
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||||
|
|
||||||
if (event.GetSource() == "trade status")
|
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 EquipUpgradesPacketAction::Execute(Event event)
|
||||||
|
{
|
||||||
|
if (!sPlayerbotAIConfig.autoEquipUpgradeLoot && !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
|
return false;
|
||||||
|
std::string const source = event.GetSource();
|
||||||
|
if (source == "trade status")
|
||||||
{
|
{
|
||||||
WorldPacket p(event.getPacket());
|
WorldPacket p(event.getPacket());
|
||||||
p.rpos(0);
|
p.rpos(0);
|
||||||
@@ -344,7 +380,7 @@ bool EquipUpgradesAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.GetSource() == "item push result")
|
else if (source == "item push result")
|
||||||
{
|
{
|
||||||
WorldPacket p(event.getPacket());
|
WorldPacket p(event.getPacket());
|
||||||
p.rpos(0);
|
p.rpos(0);
|
||||||
@@ -361,72 +397,18 @@ bool EquipUpgradesAction::Execute(Event event)
|
|||||||
p >> itemId;
|
p >> itemId;
|
||||||
|
|
||||||
ItemTemplate const* item = sObjectMgr->GetItemTemplate(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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectItemsVisitor visitor;
|
ItemIds items = SelectInventoryItemsToEquip();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EquipItems(items);
|
EquipItems(items);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipUpgradeAction::Execute(Event event)
|
bool EquipUpgradeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
CollectItemsVisitor visitor;
|
ItemIds items = SelectInventoryItemsToEquip();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EquipItems(items);
|
EquipItems(items);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "InventoryAction.h"
|
#include "InventoryAction.h"
|
||||||
|
#include "Item.h"
|
||||||
|
|
||||||
class FindItemVisitor;
|
class FindItemVisitor;
|
||||||
class Item;
|
class Item;
|
||||||
@@ -20,6 +21,7 @@ public:
|
|||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
void EquipItems(ItemIds ids);
|
void EquipItems(ItemIds ids);
|
||||||
|
ItemIds SelectInventoryItemsToEquip();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EquipItem(FindItemVisitor* visitor);
|
void EquipItem(FindItemVisitor* visitor);
|
||||||
@@ -27,10 +29,10 @@ private:
|
|||||||
void EquipItem(Item* item);
|
void EquipItem(Item* item);
|
||||||
};
|
};
|
||||||
|
|
||||||
class EquipUpgradesAction : public EquipAction
|
class EquipUpgradesPacketAction : public EquipAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EquipUpgradesAction(PlayerbotAI* botAI, std::string const name = "equip upgrades") : EquipAction(botAI, name) {}
|
explicit EquipUpgradesPacketAction(PlayerbotAI* botAI, std::string const name = "equip upgrades packet action") : EquipAction(botAI, name) {}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
};
|
};
|
||||||
@@ -38,7 +40,7 @@ public:
|
|||||||
class EquipUpgradeAction : public EquipAction
|
class EquipUpgradeAction : public EquipAction
|
||||||
{
|
{
|
||||||
public:
|
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;
|
bool Execute(Event event) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ WorldPosition FindFishingHole(PlayerbotAI* botAI)
|
|||||||
return WorldPosition();
|
return WorldPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveNearWaterAction::Execute(Event event)
|
bool MoveNearWaterAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPosition landSpot = AI_VALUE(WorldPosition, "fishing spot");
|
WorldPosition landSpot = AI_VALUE(WorldPosition, "fishing spot");
|
||||||
if (landSpot.IsValid())
|
if (landSpot.IsValid())
|
||||||
@@ -272,9 +272,9 @@ bool MoveNearWaterAction::isPossible()
|
|||||||
float fishingSearchWindow;
|
float fishingSearchWindow;
|
||||||
|
|
||||||
if (master)
|
if (master)
|
||||||
fishingSearchWindow = sPlayerbotAIConfig->fishingDistanceFromMaster;
|
fishingSearchWindow = sPlayerbotAIConfig.fishingDistanceFromMaster;
|
||||||
else
|
else
|
||||||
fishingSearchWindow = sPlayerbotAIConfig->fishingDistance;
|
fishingSearchWindow = sPlayerbotAIConfig.fishingDistance;
|
||||||
|
|
||||||
WorldPosition fishingHole = FindFishingHole(botAI);
|
WorldPosition fishingHole = FindFishingHole(botAI);
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ bool MoveNearWaterAction::isPossible()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipFishingPoleAction::Execute(Event event)
|
bool EquipFishingPoleAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!_pole)
|
if (!_pole)
|
||||||
return false;
|
return false;
|
||||||
@@ -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
|
bot->StoreNewItemInBestSlots(FISHING_POLE, 1); // Try to get a fishing pole
|
||||||
return true;
|
return true;
|
||||||
@@ -396,7 +396,7 @@ bool EquipFishingPoleAction::isUseful()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string masterName = master->GetName();
|
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",{});
|
"no_fishing_pole_error", "I don't have a Fishing Pole",{});
|
||||||
botAI->Whisper(text, masterName);
|
botAI->Whisper(text, masterName);
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ bool UseBobberAction::isUseful()
|
|||||||
return AI_VALUE(bool, "can use fishing bobber");
|
return AI_VALUE(bool, "can use fishing bobber");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UseBobberAction::Execute(Event event)
|
bool UseBobberAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector gos = AI_VALUE(GuidVector, "nearest game objects no los");
|
GuidVector gos = AI_VALUE(GuidVector, "nearest game objects no los");
|
||||||
for (auto const& guid : gos)
|
for (auto const& guid : gos)
|
||||||
@@ -485,7 +485,7 @@ bool UseBobberAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EndMasterFishingAction::Execute(Event event)
|
bool EndMasterFishingAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->ChangeStrategy("-master fishing", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("-master fishing", BOT_STATE_NON_COMBAT);
|
||||||
return true;
|
return true;
|
||||||
@@ -499,11 +499,11 @@ bool EndMasterFishingAction::isUseful()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
WorldPosition nearWater = FindWaterRadial(bot, bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(),
|
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();
|
return !nearWater.IsValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoveBobberStrategyAction::Execute(Event event)
|
bool RemoveBobberStrategyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->ChangeStrategy("-use bobber", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("-use bobber", BOT_STATE_NON_COMBAT);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -7,22 +7,24 @@
|
|||||||
#define _PLAYERBOT_FISHINGACTION_H
|
#define _PLAYERBOT_FISHINGACTION_H
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "MovementActions.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
#include "MovementActions.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
extern const uint32 FISHING_SPELL;
|
extern const uint32 FISHING_SPELL;
|
||||||
extern const uint32 FISHING_POLE;
|
extern const uint32 FISHING_POLE;
|
||||||
extern const uint32 FISHING_BOBBER;
|
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 PlayerbotAI;
|
||||||
|
|
||||||
class FishingAction : public Action
|
class FishingAction : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FishingAction(PlayerbotAI* botAI) : Action(botAI, "go fishing"){}
|
FishingAction(PlayerbotAI* botAI) : Action(botAI, "go fishing") {}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override;
|
bool isUseful() override;
|
||||||
};
|
};
|
||||||
@@ -31,8 +33,10 @@ class EquipFishingPoleAction : public Action
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EquipFishingPoleAction(PlayerbotAI* botAI) : Action(botAI, "equip fishing pole") {}
|
EquipFishingPoleAction(PlayerbotAI* botAI) : Action(botAI, "equip fishing pole") {}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override;
|
bool isUseful() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Item* _pole = nullptr;
|
Item* _pole = nullptr;
|
||||||
};
|
};
|
||||||
@@ -40,7 +44,8 @@ private:
|
|||||||
class MoveNearWaterAction : public MovementAction
|
class MoveNearWaterAction : public MovementAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MoveNearWaterAction(PlayerbotAI* botAI): MovementAction(botAI, "move near water") {}
|
MoveNearWaterAction(PlayerbotAI* botAI) : MovementAction(botAI, "move near water") {}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override;
|
bool isUseful() override;
|
||||||
bool isPossible() override;
|
bool isPossible() override;
|
||||||
@@ -50,6 +55,7 @@ class UseBobberAction : public Action
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UseBobberAction(PlayerbotAI* botAI) : Action(botAI, "use fishing bobber") {}
|
UseBobberAction(PlayerbotAI* botAI) : Action(botAI, "use fishing bobber") {}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override;
|
bool isUseful() override;
|
||||||
};
|
};
|
||||||
@@ -58,6 +64,7 @@ class EndMasterFishingAction : public Action
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EndMasterFishingAction(PlayerbotAI* botAI) : Action(botAI, "end master fishing") {}
|
EndMasterFishingAction(PlayerbotAI* botAI) : Action(botAI, "end master fishing") {}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isUseful() override;
|
bool isUseful() override;
|
||||||
};
|
};
|
||||||
@@ -66,6 +73,8 @@ class RemoveBobberStrategyAction : public Action
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RemoveBobberStrategyAction(PlayerbotAI* botAI) : Action(botAI, "remove bobber strategy") {}
|
RemoveBobberStrategyAction(PlayerbotAI* botAI) : Action(botAI, "remove bobber strategy") {}
|
||||||
|
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,17 +5,14 @@
|
|||||||
|
|
||||||
#include "FollowActions.h"
|
#include "FollowActions.h"
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Formations.h"
|
#include "Formations.h"
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "SharedDefines.h"
|
|
||||||
|
|
||||||
bool FollowAction::Execute(Event event)
|
bool FollowAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Formation* formation = AI_VALUE(Formation*, "formation");
|
Formation* formation = AI_VALUE(Formation*, "formation");
|
||||||
std::string const target = formation->GetTargetName();
|
std::string const target = formation->GetTargetName();
|
||||||
@@ -44,7 +41,7 @@ bool FollowAction::Execute(Event event)
|
|||||||
// botAI->PetFollow();
|
// botAI->PetFollow();
|
||||||
// }
|
// }
|
||||||
// if (moved)
|
// if (moved)
|
||||||
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
// botAI->SetNextCheckDelay(sPlayerbotAIConfig.reactDelay);
|
||||||
|
|
||||||
return moved;
|
return moved;
|
||||||
}
|
}
|
||||||
@@ -98,9 +95,9 @@ bool FollowAction::isUseful()
|
|||||||
distance = bot->GetDistance(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ());
|
distance = bot->GetDistance(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ());
|
||||||
}
|
}
|
||||||
if (botAI->HasStrategy("master fishing", BOT_STATE_NON_COMBAT))
|
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)
|
bool FollowAction::CanDeadFollow(Unit* target)
|
||||||
@@ -116,7 +113,7 @@ bool FollowAction::CanDeadFollow(Unit* target)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeToGroupLeaderAction::Execute(Event event)
|
bool FleeToGroupLeaderAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
||||||
bool canFollow = Follow(fTarget);
|
bool canFollow = Follow(fTarget);
|
||||||
@@ -130,7 +127,7 @@ bool FleeToGroupLeaderAction::Execute(Event event)
|
|||||||
WorldPosition bosPos(bot);
|
WorldPosition bosPos(bot);
|
||||||
float distance = bosPos.fDist(targetPos);
|
float distance = bosPos.fDist(targetPos);
|
||||||
|
|
||||||
if (distance < sPlayerbotAIConfig->reactDistance * 3)
|
if (distance < sPlayerbotAIConfig.reactDistance * 3)
|
||||||
{
|
{
|
||||||
if (!urand(0, 3))
|
if (!urand(0, 3))
|
||||||
botAI->TellMaster("I am close, wait for me!");
|
botAI->TellMaster("I am close, wait for me!");
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "CharmInfo.h"
|
#include "CharmInfo.h"
|
||||||
#include "SharedDefines.h"
|
|
||||||
#include "ObjectGuid.h"
|
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -54,7 +52,7 @@ bool MeleeAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TogglePetSpellAutoCastAction::Execute(Event event)
|
bool TogglePetSpellAutoCastAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Pet* pet = bot->GetPet();
|
Pet* pet = bot->GetPet();
|
||||||
if (!pet)
|
if (!pet)
|
||||||
@@ -113,13 +111,13 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Debug message if pet spells have been toggled and debug is enabled
|
// 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.");
|
botAI->TellMaster("Pet autocast spells have been toggled.");
|
||||||
|
|
||||||
return toggled;
|
return toggled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetAttackAction::Execute(Event event)
|
bool PetAttackAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Guardian* pet = bot->GetGuardianPet();
|
Guardian* pet = bot->GetGuardianPet();
|
||||||
if (!pet)
|
if (!pet)
|
||||||
@@ -185,7 +183,7 @@ bool SetPetStanceAction::Execute(Event /*event*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the default pet stance from the configuration
|
// Get the default pet stance from the configuration
|
||||||
int32 stance = sPlayerbotAIConfig->defaultPetStance;
|
int32 stance = sPlayerbotAIConfig.defaultPetStance;
|
||||||
ReactStates react = REACT_DEFENSIVE;
|
ReactStates react = REACT_DEFENSIVE;
|
||||||
std::string stanceText = "defensive (from config, fallback)";
|
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 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).");
|
botAI->TellMaster("Pet stance set to " + stanceText + " (applied to all pets/guardians).");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace ai::buff
|
|||||||
{
|
{
|
||||||
std::string castName = baseName;
|
std::string castName = baseName;
|
||||||
Group* g = bot->GetGroup();
|
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
|
return castName; // Group too small: stay in solo mode
|
||||||
|
|
||||||
if (std::string const groupName = GroupVariantFor(baseName); !groupName.empty())
|
if (std::string const groupName = GroupVariantFor(baseName); !groupName.empty())
|
||||||
@@ -114,7 +114,7 @@ namespace ai::buff
|
|||||||
time_t now = std::time(nullptr);
|
time_t now = std::time(nullptr);
|
||||||
uint32 botLow = static_cast<uint32>(bot->GetGUID().GetCounter());
|
uint32 botLow = static_cast<uint32>(bot->GetGUID().GetCounter());
|
||||||
time_t& last = s_lastWarn[ std::make_pair(botLow, groupName) ];
|
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
|
// DB Key choice in regard of the buff
|
||||||
std::string key;
|
std::string key;
|
||||||
@@ -132,7 +132,7 @@ namespace ai::buff
|
|||||||
placeholders["%group_spell"] = groupName;
|
placeholders["%group_spell"] = groupName;
|
||||||
placeholders["%base_spell"] = baseName;
|
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);
|
"Out of components for %group_spell. Using %base_spell!", placeholders);
|
||||||
|
|
||||||
announce(announceText);
|
announce(announceText);
|
||||||
|
|||||||
@@ -17,19 +17,17 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Language.h"
|
|
||||||
#include "GenericBuffUtils.h"
|
#include "GenericBuffUtils.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
using ai::buff::MakeAuraQualifierForBuff;
|
using ai::buff::MakeAuraQualifierForBuff;
|
||||||
using ai::buff::UpgradeToGroupIfAppropriate;
|
|
||||||
|
|
||||||
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell)
|
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell)
|
||||||
: Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
: Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CastSpellAction::Execute(Event event)
|
bool CastSpellAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (spell == "conjure food" || spell == "conjure water")
|
if (spell == "conjure food" || spell == "conjure water")
|
||||||
{
|
{
|
||||||
@@ -78,34 +76,6 @@ bool CastSpellAction::Execute(Event event)
|
|||||||
return botAI->CastSpell(spell, GetTarget());
|
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()
|
bool CastSpellAction::isUseful()
|
||||||
{
|
{
|
||||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||||
@@ -127,13 +97,40 @@ bool CastSpellAction::isUseful()
|
|||||||
if (!spellTarget->IsInWorld() || spellTarget->GetMapId() != bot->GetMapId())
|
if (!spellTarget->IsInWorld() || spellTarget->GetMapId() != bot->GetMapId())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// float combatReach = bot->GetCombatReach() + spellTarget->GetCombatReach();
|
// float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||||
// if (!botAI->IsRanged(bot))
|
// if (!botAI->IsRanged(bot))
|
||||||
// combatReach += 4.0f / 3.0f;
|
// combatReach += 4.0f / 3.0f;
|
||||||
|
|
||||||
return spellTarget &&
|
return AI_VALUE2(bool, "spell cast useful", spell);
|
||||||
AI_VALUE2(bool, "spell cast useful",
|
// && ServerFacade::instance().GetDistance2d(bot, target) <= (range + combatReach);
|
||||||
spell); // && sServerFacade->GetDistance2d(bot, spellTarget) <= (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)
|
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));
|
return context->GetValue<Unit*>("party member without aura", MakeAuraQualifierForBuff(spell));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuffOnPartyAction::Execute(Event event)
|
bool BuffOnPartyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::string castName = spell; // default = mono
|
std::string castName = spell; // default = mono
|
||||||
|
|
||||||
@@ -290,7 +287,7 @@ Value<Unit*>* CastSnareSpellAction::GetTargetValue() { return context->GetValue<
|
|||||||
|
|
||||||
Value<Unit*>* CastCrowdControlSpellAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
Value<Unit*>* CastCrowdControlSpellAction::GetTargetValue() { return context->GetValue<Unit*>("cc target", getName()); }
|
||||||
|
|
||||||
bool CastCrowdControlSpellAction::Execute(Event event) { return botAI->CastSpell(getName(), GetTarget()); }
|
bool CastCrowdControlSpellAction::Execute(Event /*event*/) { return botAI->CastSpell(getName(), GetTarget()); }
|
||||||
|
|
||||||
bool CastCrowdControlSpellAction::isPossible() { return botAI->CanCastSpell(getName(), GetTarget()); }
|
bool CastCrowdControlSpellAction::isPossible() { return botAI->CanCastSpell(getName(), GetTarget()); }
|
||||||
|
|
||||||
@@ -308,13 +305,13 @@ bool CastVehicleSpellAction::isPossible()
|
|||||||
|
|
||||||
bool CastVehicleSpellAction::isUseful() { return botAI->IsInVehicle(false, true); }
|
bool CastVehicleSpellAction::isUseful() { return botAI->IsInVehicle(false, true); }
|
||||||
|
|
||||||
bool CastVehicleSpellAction::Execute(Event event)
|
bool CastVehicleSpellAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", spell);
|
uint32 spellId = AI_VALUE2(uint32, "vehicle spell id", spell);
|
||||||
return botAI->CastVehicleSpell(spellId, GetTarget());
|
return botAI->CastVehicleSpell(spellId, GetTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UseTrinketAction::Execute(Event event)
|
bool UseTrinketAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Item* trinket1 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1);
|
Item* trinket1 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET1);
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public:
|
|||||||
|
|
||||||
std::string const GetTargetName() override { return "current target"; };
|
std::string const GetTargetName() override { return "current target"; };
|
||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
bool isPossible() override;
|
|
||||||
bool isUseful() override;
|
bool isUseful() override;
|
||||||
|
bool isPossible() override;
|
||||||
ActionThreatType getThreatType() override { return ActionThreatType::Single; }
|
ActionThreatType getThreatType() override { return ActionThreatType::Single; }
|
||||||
|
|
||||||
std::vector<NextAction> getPrerequisites() override
|
std::vector<NextAction> getPrerequisites() override
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
std::vector<std::string> split(std::string const s, char delim);
|
std::vector<std::string> split(std::string const s, char delim);
|
||||||
|
|
||||||
bool GiveItemAction::Execute(Event event)
|
bool GiveItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -64,7 +64,7 @@ Unit* GiveItemAction::GetTarget() { return AI_VALUE2(Unit*, "party member withou
|
|||||||
|
|
||||||
bool GiveItemAction::isUseful()
|
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"); }
|
Unit* GiveFoodAction::GetTarget() { return AI_VALUE(Unit*, "party member without food"); }
|
||||||
@@ -74,7 +74,7 @@ bool GiveFoodAction::isUseful()
|
|||||||
if (!GetTarget())
|
if (!GetTarget())
|
||||||
return false;
|
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));
|
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ bool GiveWaterAction::isUseful()
|
|||||||
if (!GetTarget())
|
if (!GetTarget())
|
||||||
return false;
|
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));
|
return !isRandomBot || (isRandomBot && !botAI->HasCheat(BotCheatMask::food));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ bool GoAction::Execute(Event event)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
botAI->TellMasterNoFacing("Clearing travel target");
|
botAI->TellMasterNoFacing("Clearing travel target");
|
||||||
target->setTarget(sTravelMgr->nullTravelDestination, sTravelMgr->nullWorldPosition);
|
target->setTarget(TravelMgr::instance().nullTravelDestination, TravelMgr::instance().nullWorldPosition);
|
||||||
target->setForced(false);
|
target->setForced(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -75,8 +75,8 @@ bool GoAction::Execute(Event event)
|
|||||||
if (GameObject* go = botAI->GetGameObject(guid))
|
if (GameObject* go = botAI->GetGameObject(guid))
|
||||||
if (go->isSpawned())
|
if (go->isSpawned())
|
||||||
{
|
{
|
||||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, go),
|
if (ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, go),
|
||||||
sPlayerbotAIConfig->reactDistance))
|
sPlayerbotAIConfig.reactDistance))
|
||||||
{
|
{
|
||||||
botAI->TellError("It is too far away");
|
botAI->TellError("It is too far away");
|
||||||
return false;
|
return false;
|
||||||
@@ -86,7 +86,7 @@ bool GoAction::Execute(Event event)
|
|||||||
out << "Moving to " << ChatHelper::FormatGameobject(go);
|
out << "Moving to " << ChatHelper::FormatGameobject(go);
|
||||||
botAI->TellMasterNoFacing(out.str());
|
botAI->TellMasterNoFacing(out.str());
|
||||||
return MoveNear(bot->GetMapId(), go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 0.5f,
|
return MoveNear(bot->GetMapId(), go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 0.5f,
|
||||||
sPlayerbotAIConfig->followDistance);
|
sPlayerbotAIConfig.followDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -106,7 +106,7 @@ bool GoAction::Execute(Event event)
|
|||||||
out << "Moving to " << unit->GetName();
|
out << "Moving to " << unit->GetName();
|
||||||
botAI->TellMasterNoFacing(out.str());
|
botAI->TellMasterNoFacing(out.str());
|
||||||
return MoveNear(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(),
|
return MoveNear(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(),
|
||||||
unit->GetPositionZ() + 0.5f, sPlayerbotAIConfig->followDistance);
|
unit->GetPositionZ() + 0.5f, sPlayerbotAIConfig.followDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +176,8 @@ bool GoAction::Execute(Event event)
|
|||||||
float z = bot->GetPositionZ();
|
float z = bot->GetPositionZ();
|
||||||
bot->UpdateAllowedPositionZ(x, y, z);
|
bot->UpdateAllowedPositionZ(x, y, z);
|
||||||
|
|
||||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, x, y),
|
if (ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, x, y),
|
||||||
sPlayerbotAIConfig->reactDistance))
|
sPlayerbotAIConfig.reactDistance))
|
||||||
{
|
{
|
||||||
botAI->TellMaster("It is too far away");
|
botAI->TellMaster("It is too far away");
|
||||||
return false;
|
return false;
|
||||||
@@ -203,14 +203,14 @@ bool GoAction::Execute(Event event)
|
|||||||
out << "Moving to " << x1 << "," << y1;
|
out << "Moving to " << x1 << "," << y1;
|
||||||
botAI->TellMasterNoFacing(out.str());
|
botAI->TellMasterNoFacing(out.str());
|
||||||
|
|
||||||
return MoveNear(bot->GetMapId(), x, y, z + 0.5f, sPlayerbotAIConfig->followDistance);
|
return MoveNear(bot->GetMapId(), x, y, z + 0.5f, sPlayerbotAIConfig.followDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[param];
|
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[param];
|
||||||
if (pos.isSet())
|
if (pos.isSet())
|
||||||
{
|
{
|
||||||
if (sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, pos.x, pos.y),
|
if (ServerFacade::instance().IsDistanceGreaterThan(ServerFacade::instance().GetDistance2d(bot, pos.x, pos.y),
|
||||||
sPlayerbotAIConfig->reactDistance))
|
sPlayerbotAIConfig.reactDistance))
|
||||||
{
|
{
|
||||||
botAI->TellError("It is too far away");
|
botAI->TellError("It is too far away");
|
||||||
return false;
|
return false;
|
||||||
@@ -219,7 +219,7 @@ bool GoAction::Execute(Event event)
|
|||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Moving to position " << param;
|
out << "Moving to position " << param;
|
||||||
botAI->TellMasterNoFacing(out.str());
|
botAI->TellMasterNoFacing(out.str());
|
||||||
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z + 0.5f, sPlayerbotAIConfig->followDistance);
|
return MoveNear(bot->GetMapId(), pos.x, pos.y, pos.z + 0.5f, sPlayerbotAIConfig.followDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
botAI->TellMaster("Whisper 'go x,y', 'go [game object]', 'go unit' or 'go position' and I will go there");
|
botAI->TellMaster("Whisper 'go x,y', 'go [game object]', 'go unit' or 'go position' and I will go there");
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet") {}
|
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet") {}
|
||||||
|
|
||||||
bool GreetAction::Execute(Event event)
|
bool GreetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
ObjectGuid guid = AI_VALUE(ObjectGuid, "new player nearby");
|
ObjectGuid guid = AI_VALUE(ObjectGuid, "new player nearby");
|
||||||
if (!guid || !guid.IsPlayer())
|
if (!guid || !guid.IsPlayer())
|
||||||
@@ -20,7 +20,7 @@ bool GreetAction::Execute(Event event)
|
|||||||
if (!player)
|
if (!player)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, player, sPlayerbotAIConfig->sightDistance))
|
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, player, sPlayerbotAIConfig.sightDistance))
|
||||||
bot->SetFacingToObject(player);
|
bot->SetFacingToObject(player);
|
||||||
|
|
||||||
ObjectGuid oldSel = bot->GetTarget();
|
ObjectGuid oldSel = bot->GetTarget();
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
#include "GuildBankAction.h"
|
#include "GuildBankAction.h"
|
||||||
|
|
||||||
#include "GuildMgr.h"
|
#include "GuildMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool GuildBankAction::Execute(Event event)
|
bool GuildBankAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RandomPlayerbotFactory.h"
|
#include "RandomPlayerbotFactory.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "SharedDefines.h" // GOLD
|
#include "SharedDefines.h"
|
||||||
|
|
||||||
bool BuyPetitionAction::Execute(Event event)
|
bool BuyPetitionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
||||||
bool vendored = false, result = false;
|
bool vendored = false, result = false;
|
||||||
@@ -152,7 +152,7 @@ bool PetitionOfferAction::Execute(Event event)
|
|||||||
|
|
||||||
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
|
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
|
||||||
|
|
||||||
bool PetitionOfferNearbyAction::Execute(Event event)
|
bool PetitionOfferNearbyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 found = 0;
|
uint32 found = 0;
|
||||||
|
|
||||||
@@ -184,11 +184,11 @@ bool PetitionOfferNearbyAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->randomBotGroupNearby)
|
if (!sPlayerbotAIConfig.randomBotGroupNearby)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
|
if (ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Parse rpg target to quest action.
|
// Parse rpg target to quest action.
|
||||||
@@ -209,7 +209,7 @@ bool PetitionOfferNearbyAction::isUseful()
|
|||||||
AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
AI_VALUE(uint8, "petition signs") < sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetitionTurnInAction::Execute(Event event)
|
bool PetitionTurnInAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
GuidVector vendors = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
|
||||||
bool vendored = false, result = false;
|
bool vendored = false, result = false;
|
||||||
@@ -297,7 +297,7 @@ bool PetitionTurnInAction::isUseful()
|
|||||||
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuyTabardAction::Execute(Event event)
|
bool BuyTabardAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool canBuy = botAI->DoSpecificAction("buy", Event("buy tabard", "Hitem:5976:"));
|
bool canBuy = botAI->DoSpecificAction("buy", Event("buy tabard", "Hitem:5976:"));
|
||||||
if (canBuy && AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)))
|
if (canBuy && AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)))
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ bool GuildRemoveAction::PlayerIsValid(Player* member)
|
|||||||
return member->GetGuildId() == bot->GetGuildId() && GetRankId(bot) < GetRankId(member);
|
return member->GetGuildId() == bot->GetGuildId() && GetRankId(bot) < GetRankId(member);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool GuildManageNearbyAction::Execute(Event event)
|
bool GuildManageNearbyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 found = 0;
|
uint32 found = 0;
|
||||||
|
|
||||||
@@ -149,7 +149,6 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
// Promote or demote nearby members based on chance.
|
// Promote or demote nearby members based on chance.
|
||||||
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId())
|
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId())
|
||||||
{
|
{
|
||||||
Guild::Member* member = guild->GetMember(player->GetGUID());
|
|
||||||
uint32 dCount = AI_VALUE(uint32, "death count");
|
uint32 dCount = AI_VALUE(uint32, "death count");
|
||||||
|
|
||||||
if (!urand(0, 30) && dCount < 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_PROMOTE)
|
if (!urand(0, 30) && dCount < 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_PROMOTE)
|
||||||
@@ -171,7 +170,7 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->randomBotGuildNearby)
|
if (!sPlayerbotAIConfig.randomBotGuildNearby)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (guild->GetMemberSize() > 1000)
|
if (guild->GetMemberSize() > 1000)
|
||||||
@@ -185,7 +184,7 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
|
|
||||||
PlayerbotAI* botAi = GET_PLAYERBOT_AI(player);
|
PlayerbotAI* botAi = GET_PLAYERBOT_AI(player);
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->randomBotInvitePlayer && botAi && botAi->IsRealPlayer())
|
if (!sPlayerbotAIConfig.randomBotInvitePlayer && botAi && botAi->IsRealPlayer())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (botAi)
|
if (botAi)
|
||||||
@@ -193,16 +192,16 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
if (botAi->GetGuilderType() == GuilderType::SOLO && !botAi->HasRealPlayerMaster()) //Do not invite solo players.
|
if (botAi->GetGuilderType() == GuilderType::SOLO && !botAi->HasRealPlayerMaster()) //Do not invite solo players.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (botAi->HasActivePlayerMaster() && !sRandomPlayerbotMgr->IsRandomBot(player)) //Do not invite alts of active players.
|
if (botAi->HasActivePlayerMaster() && !sRandomPlayerbotMgr.IsRandomBot(player)) //Do not invite alts of active players.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sameGroup = bot->GetGroup() && bot->GetGroup()->IsMember(player->GetGUID());
|
bool sameGroup = bot->GetGroup() && bot->GetGroup()->IsMember(player->GetGUID());
|
||||||
|
|
||||||
if (!sameGroup && sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->spellDistance)
|
if (!sameGroup && ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.spellDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->inviteChat && (sRandomPlayerbotMgr->IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
if (sPlayerbotAIConfig.inviteChat && (sRandomPlayerbotMgr.IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
||||||
{
|
{
|
||||||
/* std::map<std::string, std::string> placeholders;
|
/* std::map<std::string, std::string> placeholders;
|
||||||
placeholders["%name"] = player->GetName();
|
placeholders["%name"] = player->GetName();
|
||||||
@@ -210,8 +209,8 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
placeholders["%guildname"] = guild->GetName();
|
placeholders["%guildname"] = guild->GetName();
|
||||||
AreaTableEntry const* current_area = botAI->GetCurrentArea();
|
AreaTableEntry const* current_area = botAI->GetCurrentArea();
|
||||||
AreaTableEntry const* current_zone = botAI->GetCurrentZone();
|
AreaTableEntry const* current_zone = botAI->GetCurrentZone();
|
||||||
placeholders["%area_name"] = current_area ? current_area->area_name[BroadcastHelper::GetLocale()] : BOT_TEXT1("string_unknown_area");
|
placeholders["%area_name"] = current_area ? current_area->area_name[BroadcastHelper::GetLocale()] : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
placeholders["%zone_name"] = current_zone ? current_zone->area_name[BroadcastHelper::GetLocale()] : BOT_TEXT1("string_unknown_area");
|
placeholders["%zone_name"] = current_zone ? current_zone->area_name[BroadcastHelper::GetLocale()] : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
|
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
|
|
||||||
@@ -219,45 +218,45 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
switch ((urand(0, 10) * urand(0, 10)) / 10)
|
switch ((urand(0, 10) * urand(0, 10)) / 10)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
lines.push_back(BOT_TEXT2("Hey %name do you want to join my guild?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("Hey %name do you want to join my guild?", placeholders));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
lines.push_back(BOT_TEXT2("Hey man you wanna join my guild %name?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("Hey man you wanna join my guild %name?", placeholders));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
lines.push_back(BOT_TEXT2("I think you would be a good contribution to %guildname. Would you like to join %name?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("I think you would be a good contribution to %guildname. Would you like to join %name?", placeholders));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
lines.push_back(BOT_TEXT2("My guild %guildname has %members quality members. Would you like to make it 1 more %name?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("My guild %guildname has %members quality members. Would you like to make it 1 more %name?", placeholders));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
lines.push_back(BOT_TEXT2("Hey %name do you want to join %guildname? We have %members members and looking to become number 1 of the server.", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("Hey %name do you want to join %guildname? We have %members members and looking to become number 1 of the server.", placeholders));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
lines.push_back(BOT_TEXT2("I'm not really good at smalltalk. Do you wanna join my guild %name/r?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("I'm not really good at smalltalk. Do you wanna join my guild %name/r?", placeholders));
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
lines.push_back(BOT_TEXT2("Welcome to %zone_name.... do you want to join my guild %name?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("Welcome to %zone_name.... do you want to join my guild %name?", placeholders));
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
lines.push_back(BOT_TEXT2("%name, you should join my guild!", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("%name, you should join my guild!", placeholders));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
lines.push_back(BOT_TEXT2("%name, I got this guild....", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("%name, I got this guild....", placeholders));
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
lines.push_back(BOT_TEXT2("You are actually going to join my guild %name?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("You are actually going to join my guild %name?", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("Haha.. you are the man! We are going to raid Molten...", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("Haha.. you are the man! We are going to raid Molten...", placeholders));
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
lines.push_back(BOT_TEXT2("Hey Hey! do you guys wanna join my gild????", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("Hey Hey! do you guys wanna join my gild????", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("We've got a bunch of high levels and we are really super friendly..", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("We've got a bunch of high levels and we are really super friendly..", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("..and watch your dog and do your homework...", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("..and watch your dog and do your homework...", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("..and we raid once a week and are working on MC raids...", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("..and we raid once a week and are working on MC raids...", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("..and we have more members than just me...", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("..and we have more members than just me...", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("..and please stop I'm lonenly and we can get a ride the whole time...", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("..and please stop I'm lonenly and we can get a ride the whole time...", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("..and it's really beautifull and I feel like crying...", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("..and it's really beautifull and I feel like crying...", placeholders));
|
||||||
lines.push_back(BOT_TEXT2("So what do you guys say are you going to join are you going to join?", placeholders));
|
lines.push_back(PlayerbotTextMgr::instance().GetBotText("So what do you guys say are you going to join are you going to join?", placeholders));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +273,7 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
|
|
||||||
if (botAI->DoSpecificAction("guild invite", Event("guild management", guid), true))
|
if (botAI->DoSpecificAction("guild invite", Event("guild management", guid), true))
|
||||||
{
|
{
|
||||||
if (sPlayerbotAIConfig->inviteChat)
|
if (sPlayerbotAIConfig.inviteChat)
|
||||||
return true;
|
return true;
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
#include "ChatActionContext.h"
|
#include "ChatActionContext.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help") { chatContext = new ChatActionContext(); }
|
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help") { chatContext = new ChatActionContext(); }
|
||||||
|
|
||||||
HelpAction::~HelpAction() { delete chatContext; }
|
HelpAction::~HelpAction() { delete chatContext; }
|
||||||
|
|
||||||
bool HelpAction::Execute(Event event)
|
bool HelpAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
TellChatCommands();
|
TellChatCommands();
|
||||||
TellStrategies();
|
TellStrategies();
|
||||||
|
|||||||
@@ -6,15 +6,16 @@
|
|||||||
#include "HireAction.h"
|
#include "HireAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool HireAction::Execute(Event event)
|
bool HireAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 account = master->GetSession()->GetAccountId();
|
uint32 account = master->GetSession()->GetAccountId();
|
||||||
@@ -39,7 +40,7 @@ bool HireAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 discount = sRandomPlayerbotMgr->GetTradeDiscount(bot, master);
|
uint32 discount = RandomPlayerbotMgr::instance().GetTradeDiscount(bot, master);
|
||||||
uint32 m = 1 + (bot->GetLevel() / 10);
|
uint32 m = 1 + (bot->GetLevel() / 10);
|
||||||
uint32 moneyReq = m * 5000 * bot->GetLevel();
|
uint32 moneyReq = m * 5000 * bot->GetLevel();
|
||||||
if (discount < moneyReq)
|
if (discount < moneyReq)
|
||||||
@@ -54,7 +55,7 @@ bool HireAction::Execute(Event event)
|
|||||||
botAI->TellMaster("I will join you at your next relogin");
|
botAI->TellMaster("I will join you at your next relogin");
|
||||||
|
|
||||||
bot->SetMoney(moneyReq);
|
bot->SetMoney(moneyReq);
|
||||||
sRandomPlayerbotMgr->Remove(bot);
|
RandomPlayerbotMgr::instance().Remove(bot);
|
||||||
CharacterDatabase.Execute("UPDATE characters SET account = {} WHERE guid = {}", account,
|
CharacterDatabase.Execute("UPDATE characters SET account = {} WHERE guid = {}", account,
|
||||||
bot->GetGUID().GetCounter());
|
bot->GetGUID().GetCounter());
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
ImbueWithPoisonAction::ImbueWithPoisonAction(PlayerbotAI* botAI) : Action(botAI, "apply poison") {}
|
ImbueWithPoisonAction::ImbueWithPoisonAction(PlayerbotAI* botAI) : Action(botAI, "apply poison") {}
|
||||||
|
|
||||||
bool ImbueWithPoisonAction::Execute(Event event)
|
bool ImbueWithPoisonAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@@ -103,7 +103,7 @@ bool ImbueWithPoisonAction::Execute(Event event)
|
|||||||
// Search and apply stone to weapons
|
// Search and apply stone to weapons
|
||||||
ImbueWithStoneAction::ImbueWithStoneAction(PlayerbotAI* botAI) : Action(botAI, "apply stone") {}
|
ImbueWithStoneAction::ImbueWithStoneAction(PlayerbotAI* botAI) : Action(botAI, "apply stone") {}
|
||||||
|
|
||||||
bool ImbueWithStoneAction::Execute(Event event)
|
bool ImbueWithStoneAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@@ -148,7 +148,7 @@ bool ImbueWithStoneAction::Execute(Event event)
|
|||||||
// Search and apply oil to weapons
|
// Search and apply oil to weapons
|
||||||
ImbueWithOilAction::ImbueWithOilAction(PlayerbotAI* botAI) : Action(botAI, "apply oil") {}
|
ImbueWithOilAction::ImbueWithOilAction(PlayerbotAI* botAI) : Action(botAI, "apply oil") {}
|
||||||
|
|
||||||
bool ImbueWithOilAction::Execute(Event event)
|
bool ImbueWithOilAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@@ -201,7 +201,7 @@ static const uint32 uPrioritizedHealingItemIds[19] = {
|
|||||||
|
|
||||||
TryEmergencyAction::TryEmergencyAction(PlayerbotAI* botAI) : Action(botAI, "try emergency") {}
|
TryEmergencyAction::TryEmergencyAction(PlayerbotAI* botAI) : Action(botAI, "try emergency") {}
|
||||||
|
|
||||||
bool TryEmergencyAction::Execute(Event event)
|
bool TryEmergencyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Do not use consumable if bot can heal self
|
// Do not use consumable if bot can heal self
|
||||||
if ((botAI->IsHeal(bot)) && (bot->GetPowerPct(POWER_MANA) > 20))
|
if ((botAI->IsHeal(bot)) && (bot->GetPowerPct(POWER_MANA) > 20))
|
||||||
|
|||||||
@@ -351,9 +351,7 @@ uint32 InventoryAction::GetItemCount(FindItemVisitor* visitor, IterateItemsMask
|
|||||||
|
|
||||||
std::vector<Item*>& items = visitor->GetResult();
|
std::vector<Item*>& items = visitor->GetResult();
|
||||||
for (Item* item : items)
|
for (Item* item : items)
|
||||||
{
|
|
||||||
count += item->GetCount();
|
count += item->GetCount();
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildMgr.h"
|
#include "GuildMgr.h"
|
||||||
#include "Log.h"
|
|
||||||
#include "PlayerbotOperations.h"
|
#include "PlayerbotOperations.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PlayerbotWorldThreadProcessor.h"
|
#include "PlayerbotWorldThreadProcessor.h"
|
||||||
@@ -31,7 +30,7 @@ bool InviteToGroupAction::Invite(Player* inviter, Player* player)
|
|||||||
if (!group->isRaidGroup() && group->GetMembersCount() > 4)
|
if (!group->isRaidGroup() && group->GetMembersCount() > 4)
|
||||||
{
|
{
|
||||||
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(inviter->GetGUID());
|
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(inviter->GetGUID());
|
||||||
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ bool InviteToGroupAction::Invite(Player* inviter, Player* player)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InviteNearbyToGroupAction::Execute(Event event)
|
bool InviteNearbyToGroupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
|
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
|
||||||
for (auto& i : nearGuids)
|
for (auto& i : nearGuids)
|
||||||
@@ -62,7 +61,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
if (player->GetGroup())
|
if (player->GetGroup())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
if (!PlayerbotAIConfig::instance().randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
@@ -88,7 +87,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
|
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
|
if (ServerFacade::instance().GetDistance2d(bot, player) > PlayerbotAIConfig::instance().sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// When inviting the 5th member of the group convert to raid for future invites.
|
// When inviting the 5th member of the group convert to raid for future invites.
|
||||||
@@ -96,19 +95,19 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
bot->GetGroup()->GetMembersCount() > 3)
|
bot->GetGroup()->GetMembersCount() > 3)
|
||||||
{
|
{
|
||||||
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(bot->GetGUID());
|
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(bot->GetGUID());
|
||||||
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->inviteChat && sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (PlayerbotAIConfig::instance().inviteChat && RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> placeholders;
|
std::map<std::string, std::string> placeholders;
|
||||||
placeholders["%player"] = player->GetName();
|
placeholders["%player"] = player->GetName();
|
||||||
|
|
||||||
if (group && group->isRaidGroup())
|
if (group && group->isRaidGroup())
|
||||||
bot->Say(BOT_TEXT2("join_raid", placeholders),
|
bot->Say(PlayerbotTextMgr::instance().GetBotText("join_raid", placeholders),
|
||||||
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
||||||
else
|
else
|
||||||
bot->Say(BOT_TEXT2("join_group", placeholders),
|
bot->Say(PlayerbotTextMgr::instance().GetBotText("join_group", placeholders),
|
||||||
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +119,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
|
|
||||||
bool InviteNearbyToGroupAction::isUseful()
|
bool InviteNearbyToGroupAction::isUseful()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->randomBotGroupNearby)
|
if (!PlayerbotAIConfig::instance().randomBotGroupNearby)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
@@ -166,7 +165,7 @@ std::vector<Player*> InviteGuildToGroupAction::getGuildMembers()
|
|||||||
return worker.GetResult();
|
return worker.GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InviteGuildToGroupAction::Execute(Event event)
|
bool InviteGuildToGroupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
|
Guild* guild = sGuildMgr->GetGuildById(bot->GetGuildId());
|
||||||
|
|
||||||
@@ -186,7 +185,7 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
if (player->isDND())
|
if (player->isDND())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
if (!PlayerbotAIConfig::instance().randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (player->IsBeingTeleported())
|
if (player->IsBeingTeleported())
|
||||||
@@ -221,7 +220,7 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
|
player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!playerAi && sServerFacade->GetDistance2d(bot, player) > sPlayerbotAIConfig->sightDistance)
|
if (!playerAi && ServerFacade::instance().GetDistance2d(bot, player) > PlayerbotAIConfig::instance().sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
@@ -230,11 +229,11 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
bot->GetGroup()->GetMembersCount() > 3)
|
bot->GetGroup()->GetMembersCount() > 3)
|
||||||
{
|
{
|
||||||
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(bot->GetGUID());
|
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(bot->GetGUID());
|
||||||
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->inviteChat &&
|
if (PlayerbotAIConfig::instance().inviteChat &&
|
||||||
(sRandomPlayerbotMgr->IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
(RandomPlayerbotMgr::instance().IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
||||||
{
|
{
|
||||||
BroadcastHelper::BroadcastGuildGroupOrRaidInvite(botAI, bot, player, group);
|
BroadcastHelper::BroadcastGuildGroupOrRaidInvite(botAI, bot, player, group);
|
||||||
}
|
}
|
||||||
@@ -373,7 +372,7 @@ bool LfgAction::Execute(Event event)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(requester->GetGUID());
|
auto convertOp = std::make_unique<GroupConvertToRaidOperation>(requester->GetGUID());
|
||||||
sPlayerbotWorldProcessor->QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ bool PartyCommandAction::Execute(Event event)
|
|||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (master && member == master->GetName())
|
if (master && member == master->GetName())
|
||||||
{
|
{
|
||||||
if (sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
Player* newMaster = botAI->FindNewMaster();
|
Player* newMaster = botAI->FindNewMaster();
|
||||||
if (newMaster || bot->InBattleground())
|
if (newMaster || bot->InBattleground())
|
||||||
@@ -92,7 +92,7 @@ bool LeaveGroupAction::Leave()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LeaveFarAwayAction::Execute(Event event)
|
bool LeaveFarAwayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// allow bot to leave party when they want
|
// allow bot to leave party when they want
|
||||||
return Leave();
|
return Leave();
|
||||||
@@ -150,7 +150,7 @@ bool LeaveFarAwayAction::isUseful()
|
|||||||
if (abs(int32(groupLeader->GetLevel() - bot->GetLevel())) > 4)
|
if (abs(int32(groupLeader->GetLevel() - bot->GetLevel())) > 4)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (bot->GetMapId() != groupLeader->GetMapId() || bot->GetDistance2d(groupLeader) >= 2 * sPlayerbotAIConfig->rpgDistance)
|
if (bot->GetMapId() != groupLeader->GetMapId() || bot->GetDistance2d(groupLeader) >= 2 * sPlayerbotAIConfig.rpgDistance)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "LFGPackets.h"
|
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
|
||||||
using namespace lfg;
|
using namespace lfg;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
|
|||||||
|
|
||||||
uint32 LfgJoinAction::GetRoles()
|
uint32 LfgJoinAction::GetRoles()
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
if (botAI->IsTank(bot))
|
if (botAI->IsTank(bot))
|
||||||
return PLAYER_ROLE_TANK;
|
return PLAYER_ROLE_TANK;
|
||||||
@@ -101,7 +101,7 @@ bool LfgJoinAction::JoinLFG()
|
|||||||
LfgDungeonSet list;
|
LfgDungeonSet list;
|
||||||
std::vector<uint32> selected;
|
std::vector<uint32> selected;
|
||||||
|
|
||||||
std::vector<uint32> dungeons = sRandomPlayerbotMgr->LfgDungeons[bot->GetTeamId()];
|
std::vector<uint32> dungeons = RandomPlayerbotMgr::instance().LfgDungeons[bot->GetTeamId()];
|
||||||
if (!dungeons.size())
|
if (!dungeons.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ bool LfgJoinAction::JoinLFG()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LfgRoleCheckAction::Execute(Event event)
|
bool LfgRoleCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
{
|
{
|
||||||
@@ -216,9 +216,9 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
*packet << id << true;
|
*packet << id << true;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr->IsRandomBot(bot) && !bot->GetGroup())
|
if (RandomPlayerbotMgr::instance().IsRandomBot(bot) && !bot->GetGroup())
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr->Refresh(bot);
|
RandomPlayerbotMgr::instance().Refresh(bot);
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,9 +251,9 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
*packet << id << true;
|
*packet << id << true;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr->IsRandomBot(bot) && !bot->GetGroup())
|
if (RandomPlayerbotMgr::instance().IsRandomBot(bot) && !bot->GetGroup())
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr->Refresh(bot);
|
RandomPlayerbotMgr::instance().Refresh(bot);
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LfgLeaveAction::Execute(Event event)
|
bool LfgLeaveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Don't leave if lfg strategy enabled
|
// Don't leave if lfg strategy enabled
|
||||||
// if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
|
// if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
|
||||||
@@ -306,7 +306,7 @@ bool LfgTeleportAction::Execute(Event event)
|
|||||||
|
|
||||||
bool LfgJoinAction::isUseful()
|
bool LfgJoinAction::isUseful()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig->randomBotJoinLfg)
|
if (!sPlayerbotAIConfig.randomBotJoinLfg)
|
||||||
{
|
{
|
||||||
// botAI->ChangeStrategy("-lfg", BOT_STATE_NON_COMBAT);
|
// botAI->ChangeStrategy("-lfg", BOT_STATE_NON_COMBAT);
|
||||||
return false;
|
return false;
|
||||||
@@ -337,7 +337,7 @@ bool LfgJoinAction::isUseful()
|
|||||||
if (bot->isDead())
|
if (bot->isDead())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Map* map = bot->GetMap();
|
Map* map = bot->GetMap();
|
||||||
|
|||||||
@@ -107,14 +107,14 @@ uint32 ListQuestsAction::ListQuests(bool completed, bool silent, QuestTravelDeta
|
|||||||
if (travelDetail == QUEST_TRAVEL_DETAIL_SUMMARY)
|
if (travelDetail == QUEST_TRAVEL_DETAIL_SUMMARY)
|
||||||
{
|
{
|
||||||
std::vector<TravelDestination*> allDestinations =
|
std::vector<TravelDestination*> allDestinations =
|
||||||
sTravelMgr->getQuestTravelDestinations(bot, questId, true, true, -1);
|
TravelMgr::instance().getQuestTravelDestinations(bot, questId, true, true, -1);
|
||||||
std::vector<TravelDestination*> availDestinations =
|
std::vector<TravelDestination*> availDestinations =
|
||||||
sTravelMgr->getQuestTravelDestinations(bot, questId, botAI->GetMaster(), false, -1);
|
TravelMgr::instance().getQuestTravelDestinations(bot, questId, botAI->GetMaster(), false, -1);
|
||||||
|
|
||||||
uint32 desTot = allDestinations.size();
|
uint32 desTot = allDestinations.size();
|
||||||
uint32 desAvail = availDestinations.size();
|
uint32 desAvail = availDestinations.size();
|
||||||
uint32 desFull = desAvail - sTravelMgr->getQuestTravelDestinations(bot, questId, false, false, -1).size();
|
uint32 desFull = desAvail - TravelMgr::instance().getQuestTravelDestinations(bot, questId, false, false, -1).size();
|
||||||
uint32 desRange = desAvail - sTravelMgr->getQuestTravelDestinations(bot, questId, false, false).size();
|
uint32 desRange = desAvail - TravelMgr::instance().getQuestTravelDestinations(bot, questId, false, false).size();
|
||||||
|
|
||||||
uint32 tpoints = 0;
|
uint32 tpoints = 0;
|
||||||
uint32 apoints = 0;
|
uint32 apoints = 0;
|
||||||
@@ -140,7 +140,7 @@ uint32 ListQuestsAction::ListQuests(bool completed, bool silent, QuestTravelDeta
|
|||||||
{
|
{
|
||||||
uint32 limit = 0;
|
uint32 limit = 0;
|
||||||
std::vector<TravelDestination*> allDestinations =
|
std::vector<TravelDestination*> allDestinations =
|
||||||
sTravelMgr->getQuestTravelDestinations(bot, questId, true, true, -1);
|
TravelMgr::instance().getQuestTravelDestinations(bot, questId, true, true, -1);
|
||||||
|
|
||||||
std::sort(allDestinations.begin(), allDestinations.end(),
|
std::sort(allDestinations.begin(), allDestinations.end(),
|
||||||
[botPos](TravelDestination* i, TravelDestination* j) {
|
[botPos](TravelDestination* i, TravelDestination* j) {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ std::vector<std::pair<uint32, std::string>> ListSpellsAction::GetSpellList(std::
|
|||||||
if (spellInfo->IsPassive())
|
if (spellInfo->IsPassive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SkillLineAbilityEntry const* skillLine = sPlayerbotSpellRepository->GetSkillLine(itr->first);
|
SkillLineAbilityEntry const* skillLine = PlayerbotSpellRepository::Instance().GetSkillLine(itr->first);
|
||||||
if (skill != SKILL_NONE && (!skillLine || skillLine->SkillLine != skill))
|
if (skill != SKILL_NONE && (!skillLine || skillLine->SkillLine != skill))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ std::vector<std::pair<uint32, std::string>> ListSpellsAction::GetSpellList(std::
|
|||||||
|
|
||||||
FindItemByIdVisitor visitor(itemid);
|
FindItemByIdVisitor visitor(itemid);
|
||||||
uint32 reagentsInInventory = InventoryAction::GetItemCount(&visitor);
|
uint32 reagentsInInventory = InventoryAction::GetItemCount(&visitor);
|
||||||
bool buyable = sPlayerbotSpellRepository->IsItemBuyable(itemid);
|
bool buyable = PlayerbotSpellRepository::Instance().IsItemBuyable(itemid);
|
||||||
if (!buyable)
|
if (!buyable)
|
||||||
{
|
{
|
||||||
uint32 craftable = reagentsInInventory / reagentsRequired;
|
uint32 craftable = reagentsInInventory / reagentsRequired;
|
||||||
@@ -303,4 +303,4 @@ bool ListSpellsAction::Execute(Event event)
|
|||||||
botAI->TellMasterNoFacing(i->second);
|
botAI->TellMasterNoFacing(i->second);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ bool LootAction::Execute(Event /*event*/)
|
|||||||
|
|
||||||
LootObject prevLoot = AI_VALUE(LootObject, "loot target");
|
LootObject prevLoot = AI_VALUE(LootObject, "loot target");
|
||||||
LootObject const& lootObject =
|
LootObject const& lootObject =
|
||||||
AI_VALUE(LootObjectStack*, "available loot")->GetLoot(sPlayerbotAIConfig->lootDistance);
|
AI_VALUE(LootObjectStack*, "available loot")->GetLoot(sPlayerbotAIConfig.lootDistance);
|
||||||
|
|
||||||
if (!prevLoot.IsEmpty() && prevLoot.guid != lootObject.guid)
|
if (!prevLoot.IsEmpty() && prevLoot.guid != lootObject.guid)
|
||||||
{
|
{
|
||||||
@@ -37,7 +37,7 @@ bool LootAction::Execute(Event /*event*/)
|
|||||||
|
|
||||||
// Provide a system to check if the game object id is disallowed in the user configurable list or not.
|
// Provide a system to check if the game object id is disallowed in the user configurable list or not.
|
||||||
// Check if the game object id is disallowed in the user configurable list or not.
|
// Check if the game object id is disallowed in the user configurable list or not.
|
||||||
if (sPlayerbotAIConfig->disallowedGameObjects.find(lootObject.guid.GetEntry()) != sPlayerbotAIConfig->disallowedGameObjects.end())
|
if (sPlayerbotAIConfig.disallowedGameObjects.find(lootObject.guid.GetEntry()) != sPlayerbotAIConfig.disallowedGameObjects.end())
|
||||||
{
|
{
|
||||||
return false; // Game object ID is disallowed, so do not proceed
|
return false; // Game object ID is disallowed, so do not proceed
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ bool LootAction::Execute(Event /*event*/)
|
|||||||
|
|
||||||
bool LootAction::isUseful()
|
bool LootAction::isUseful()
|
||||||
{
|
{
|
||||||
return sPlayerbotAIConfig->freeMethodLoot || !bot->GetGroup() || bot->GetGroup()->GetLootMethod() != FREE_FOR_ALL;
|
return sPlayerbotAIConfig.freeMethodLoot || !bot->GetGroup() || bot->GetGroup()->GetLootMethod() != FREE_FOR_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ProfessionSpells
|
enum ProfessionSpells
|
||||||
@@ -95,7 +95,7 @@ bool OpenLootAction::DoLoot(LootObject& lootObject)
|
|||||||
if (bot->IsMounted())
|
if (bot->IsMounted())
|
||||||
{
|
{
|
||||||
bot->Dismount();
|
bot->Dismount();
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->lootDelay); // Small delay to avoid animation issues
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.lootDelay); // Small delay to avoid animation issues
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creature && creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
|
if (creature && creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
|
||||||
@@ -104,7 +104,7 @@ bool OpenLootAction::DoLoot(LootObject& lootObject)
|
|||||||
*packet << lootObject.guid;
|
*packet << lootObject.guid;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
// bot->GetSession()->HandleLootOpcode(packet);
|
// bot->GetSession()->HandleLootOpcode(packet);
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->lootDelay);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.lootDelay);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ uint32 OpenLootAction::GetOpeningSpell(LootObject& lootObject, GameObject* go)
|
|||||||
return spellId;
|
return spellId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sPlayerbotAIConfig->openGoSpell;
|
return sPlayerbotAIConfig.openGoSpell;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenLootAction::CanOpenLock(LootObject& /*lootObject*/, SpellInfo const* spellInfo, GameObject* go)
|
bool OpenLootAction::CanOpenLock(LootObject& /*lootObject*/, SpellInfo const* spellInfo, GameObject* go)
|
||||||
@@ -294,7 +294,7 @@ bool StoreLootAction::AuctionItem(uint32 itemId)
|
|||||||
|
|
||||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(ahEntry);
|
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(ahEntry);
|
||||||
|
|
||||||
uint32 price = oldItem->GetCount() * proto->BuyPrice * sRandomPlayerbotMgr->GetBuyMultiplier(bot);
|
uint32 price = oldItem->GetCount() * proto->BuyPrice * sRandomPlayerbotMgr.GetBuyMultiplier(bot);
|
||||||
|
|
||||||
uint32 stackCount = urand(1, proto->GetMaxStackSize());
|
uint32 stackCount = urand(1, proto->GetMaxStackSize());
|
||||||
if (!price || !stackCount)
|
if (!price || !stackCount)
|
||||||
@@ -426,28 +426,28 @@ bool StoreLootAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player* master = botAI->GetMaster();
|
Player* master = botAI->GetMaster();
|
||||||
if (sRandomPlayerbotMgr->IsRandomBot(bot) && master)
|
if (sRandomPlayerbotMgr.IsRandomBot(bot) && master)
|
||||||
{
|
{
|
||||||
uint32 price = itemcount * proto->BuyPrice * sRandomPlayerbotMgr->GetBuyMultiplier(bot) + gold;
|
uint32 price = itemcount * proto->BuyPrice * sRandomPlayerbotMgr.GetBuyMultiplier(bot) + gold;
|
||||||
if (price)
|
if (price)
|
||||||
sRandomPlayerbotMgr->AddTradeDiscount(bot, master, price);
|
sRandomPlayerbotMgr.AddTradeDiscount(bot, master, price);
|
||||||
|
|
||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
|
||||||
if (ref->GetSource() != bot)
|
if (ref->GetSource() != bot)
|
||||||
sGuildTaskMgr->CheckItemTask(itemid, itemcount, ref->GetSource(), bot);
|
GuildTaskMgr::instance().CheckItemTask(itemid, itemcount, ref->GetSource(), bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldPacket* packet = new WorldPacket(CMSG_AUTOSTORE_LOOT_ITEM, 1);
|
WorldPacket* packet = new WorldPacket(CMSG_AUTOSTORE_LOOT_ITEM, 1);
|
||||||
*packet << itemindex;
|
*packet << itemindex;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
// bot->GetSession()->HandleAutostoreLootItemOpcode(packet);
|
// bot->GetSession()->HandleAutostoreLootItemOpcode(packet);
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->lootDelay);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.lootDelay);
|
||||||
|
|
||||||
if (proto->Quality > ITEM_QUALITY_NORMAL && !urand(0, 50) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT) && sPlayerbotAIConfig->randomBotEmote)
|
if (proto->Quality > ITEM_QUALITY_NORMAL && !urand(0, 50) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT) && sPlayerbotAIConfig.randomBotEmote)
|
||||||
botAI->PlayEmote(TEXT_EMOTE_CHEER);
|
botAI->PlayEmote(TEXT_EMOTE_CHEER);
|
||||||
|
|
||||||
if (proto->Quality >= ITEM_QUALITY_RARE && !urand(0, 1) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT) && sPlayerbotAIConfig->randomBotEmote)
|
if (proto->Quality >= ITEM_QUALITY_RARE && !urand(0, 1) && botAI->HasStrategy("emote", BOT_STATE_NON_COMBAT) && sPlayerbotAIConfig.randomBotEmote)
|
||||||
botAI->PlayEmote(TEXT_EMOTE_CHEER);
|
botAI->PlayEmote(TEXT_EMOTE_CHEER);
|
||||||
|
|
||||||
BroadcastHelper::BroadcastLootingItem(botAI, bot, proto);
|
BroadcastHelper::BroadcastLootingItem(botAI, bot, proto);
|
||||||
@@ -498,7 +498,7 @@ bool StoreLootAction::IsLootAllowed(uint32 itemid, PlayerbotAI* botAI)
|
|||||||
{
|
{
|
||||||
// if (AI_VALUE2(uint32, "item count", proto->Name1) < quest->RequiredItemCount[i])
|
// if (AI_VALUE2(uint32, "item count", proto->Name1) < quest->RequiredItemCount[i])
|
||||||
// {
|
// {
|
||||||
// if (botAI->GetMaster() && sPlayerbotAIConfig->syncQuestWithPlayer)
|
// if (botAI->GetMaster() && sPlayerbotAIConfig.syncQuestWithPlayer)
|
||||||
// return false; //Quest is autocomplete for the bot so no item needed.
|
// return false; //Quest is autocomplete for the bot so no item needed.
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ bool StoreLootAction::IsLootAllowed(uint32 itemid, PlayerbotAI* botAI)
|
|||||||
|
|
||||||
bool canLoot = lootStrategy->CanLoot(proto, context);
|
bool canLoot = lootStrategy->CanLoot(proto, context);
|
||||||
// if (canLoot && proto->Bonding == BIND_WHEN_PICKED_UP && botAI->HasActivePlayerMaster())
|
// if (canLoot && proto->Bonding == BIND_WHEN_PICKED_UP && botAI->HasActivePlayerMaster())
|
||||||
// canLoot = sPlayerbotAIConfig->IsInRandomAccountList(botAI->GetBot()->GetSession()->GetAccountId());
|
// canLoot = sPlayerbotAIConfig.IsInRandomAccountList(botAI->GetBot()->GetSession()->GetAccountId());
|
||||||
|
|
||||||
return canLoot;
|
return canLoot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool LootRollAction::Execute(Event event)
|
bool LootRollAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
@@ -84,12 +84,14 @@ bool LootRollAction::Execute(Event event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sPlayerbotAIConfig->lootRollLevel == 0)
|
if (sPlayerbotAIConfig.lootRollLevel == 0)
|
||||||
{
|
{
|
||||||
vote = PASS;
|
vote = PASS;
|
||||||
}
|
}
|
||||||
else if (sPlayerbotAIConfig->lootRollLevel == 1)
|
else if (sPlayerbotAIConfig.lootRollLevel == 1)
|
||||||
{
|
{
|
||||||
|
// Level 1 = "greed" mode: bots greed on useful items but never need
|
||||||
|
// Only downgrade NEED to GREED, preserve GREED votes as-is
|
||||||
if (vote == NEED)
|
if (vote == NEED)
|
||||||
{
|
{
|
||||||
if (RollUniqueCheck(proto, bot))
|
if (RollUniqueCheck(proto, bot))
|
||||||
@@ -101,10 +103,6 @@ bool LootRollAction::Execute(Event event)
|
|||||||
vote = GREED;
|
vote = GREED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vote == GREED)
|
|
||||||
{
|
|
||||||
vote = PASS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
switch (group->GetLootMethod())
|
switch (group->GetLootMethod())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,20 +11,16 @@
|
|||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool MoveToRpgTargetAction::Execute(Event event)
|
bool MoveToRpgTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
Unit* unit = botAI->GetUnit(guidP);
|
Unit* unit = botAI->GetUnit(guidP);
|
||||||
if (unit && !unit->IsInWorld())
|
if (unit && !unit->IsInWorld())
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
GameObject* go = botAI->GetGameObject(guidP);
|
GameObject* go = botAI->GetGameObject(guidP);
|
||||||
if (go && !go->IsInWorld())
|
if (go && !go->IsInWorld())
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Player* player = guidP.GetPlayer();
|
|
||||||
|
|
||||||
WorldObject* wo = nullptr;
|
WorldObject* wo = nullptr;
|
||||||
if (unit)
|
if (unit)
|
||||||
@@ -61,7 +57,7 @@ bool MoveToRpgTargetAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((unit && unit->isMoving() && !urand(0, 20)) || !ChooseRpgTargetAction::isFollowValid(bot, wo) ||
|
if ((unit && unit->isMoving() && !urand(0, 20)) || !ChooseRpgTargetAction::isFollowValid(bot, wo) ||
|
||||||
guidP.distance(bot) > sPlayerbotAIConfig->reactDistance * 2 || !urand(0, 50))
|
guidP.distance(bot) > sPlayerbotAIConfig.reactDistance * 2 || !urand(0, 50))
|
||||||
{
|
{
|
||||||
AI_VALUE(GuidSet&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target"));
|
AI_VALUE(GuidSet&, "ignore rpg target").insert(AI_VALUE(GuidPosition, "rpg target"));
|
||||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||||
@@ -73,7 +69,7 @@ bool MoveToRpgTargetAction::Execute(Event event)
|
|||||||
float z = wo->GetPositionZ();
|
float z = wo->GetPositionZ();
|
||||||
float mapId = wo->GetMapId();
|
float mapId = wo->GetMapId();
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->randombotsWalkingRPG)
|
if (sPlayerbotAIConfig.randombotsWalkingRPG)
|
||||||
if (!bot->IsOutdoors())
|
if (!bot->IsOutdoors())
|
||||||
bot->m_movementInfo.AddMovementFlag(MOVEMENTFLAG_WALKING);
|
bot->m_movementInfo.AddMovementFlag(MOVEMENTFLAG_WALKING);
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,9 @@
|
|||||||
|
|
||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "PathGenerator.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool MoveToTravelTargetAction::Execute(Event event)
|
bool MoveToTravelTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ bool MoveToTravelTargetAction::Execute(Event event)
|
|||||||
|
|
||||||
if (memberDistance < 50.0f)
|
if (memberDistance < 50.0f)
|
||||||
continue;
|
continue;
|
||||||
if (memberDistance > sPlayerbotAIConfig->reactDistance * 20)
|
if (memberDistance > sPlayerbotAIConfig.reactDistance * 20)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// float memberAngle = botLocation.getAngleBetween(targetPos, memberPos);
|
// float memberAngle = botLocation.getAngleBetween(targetPos, memberPos);
|
||||||
@@ -65,9 +64,9 @@ bool MoveToTravelTargetAction::Execute(Event event)
|
|||||||
botAI->TellMasterNoFacing(out);
|
botAI->TellMasterNoFacing(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
target->setExpireIn(target->getTimeLeft() + sPlayerbotAIConfig->maxWaitForMove);
|
target->setExpireIn(target->getTimeLeft() + sPlayerbotAIConfig.maxWaitForMove);
|
||||||
|
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->maxWaitForMove);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.maxWaitForMove);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -80,7 +79,7 @@ bool MoveToTravelTargetAction::Execute(Event event)
|
|||||||
|
|
||||||
if (target->getMaxTravelTime() > target->getTimeLeft()) // The bot is late. Speed it up.
|
if (target->getMaxTravelTime() > target->getTimeLeft()) // The bot is late. Speed it up.
|
||||||
{
|
{
|
||||||
// distance = sPlayerbotAIConfig->fleeDistance;
|
// distance = sPlayerbotAIConfig.fleeDistance;
|
||||||
// angle = bot->GetAngle(location.GetPositionX(), location.GetPositionY());
|
// angle = bot->GetAngle(location.GetPositionX(), location.GetPositionY());
|
||||||
// location = botLocation.getLocation();
|
// location = botLocation.getLocation();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "FleeManager.h"
|
#include "FleeManager.h"
|
||||||
#include "G3D/Vector3.h"
|
#include "G3D/Vector3.h"
|
||||||
#include "GameObject.h"
|
#include "GameObject.h"
|
||||||
#include "Geometry.h"
|
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
@@ -36,9 +35,7 @@
|
|||||||
#include "SpellAuraEffects.h"
|
#include "SpellAuraEffects.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include "Stances.h"
|
#include "Stances.h"
|
||||||
#include "TargetedMovementGenerator.h"
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Transport.h"
|
|
||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "WaypointMovementGenerator.h"
|
#include "WaypointMovementGenerator.h"
|
||||||
@@ -51,7 +48,7 @@ MovementAction::MovementAction(PlayerbotAI* botAI, std::string const name) : Act
|
|||||||
void MovementAction::CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important)
|
void MovementAction::CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important)
|
||||||
{
|
{
|
||||||
float dist = wpOwner->GetDistance(x, y, z);
|
float dist = wpOwner->GetDistance(x, y, z);
|
||||||
float delay = 1000.0f * dist / wpOwner->GetSpeed(MOVE_RUN) + sPlayerbotAIConfig->reactDelay;
|
float delay = 1000.0f * dist / wpOwner->GetSpeed(MOVE_RUN) + sPlayerbotAIConfig.reactDelay;
|
||||||
|
|
||||||
// if (!important)
|
// if (!important)
|
||||||
// delay *= 0.25;
|
// delay *= 0.25;
|
||||||
@@ -67,18 +64,14 @@ bool MovementAction::JumpTo(uint32 mapId, float x, float y, float z, MovementPri
|
|||||||
{
|
{
|
||||||
UpdateMovementState();
|
UpdateMovementState();
|
||||||
if (!IsMovingAllowed(mapId, x, y, z))
|
if (!IsMovingAllowed(mapId, x, y, z))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (IsDuplicateMove(mapId, x, y, z))
|
if (IsDuplicateMove(mapId, x, y, z))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (IsWaitingForLastMove(priority))
|
if (IsWaitingForLastMove(priority))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
float botZ = bot->GetPositionZ();
|
|
||||||
float speed = bot->GetSpeed(MOVE_RUN);
|
float speed = bot->GetSpeed(MOVE_RUN);
|
||||||
MotionMaster& mm = *bot->GetMotionMaster();
|
MotionMaster& mm = *bot->GetMotionMaster();
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
@@ -195,8 +188,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
|
|
||||||
bool generatePath = !bot->IsFlying() && !bot->isSwimming();
|
bool generatePath = !bot->IsFlying() && !bot->isSwimming();
|
||||||
bool disableMoveSplinePath =
|
bool disableMoveSplinePath =
|
||||||
sPlayerbotAIConfig->disableMoveSplinePath >= 2 ||
|
sPlayerbotAIConfig.disableMoveSplinePath >= 2 ||
|
||||||
(sPlayerbotAIConfig->disableMoveSplinePath == 1 && bot->InBattleground());
|
(sPlayerbotAIConfig.disableMoveSplinePath == 1 && bot->InBattleground());
|
||||||
if (Vehicle* vehicle = bot->GetVehicle())
|
if (Vehicle* vehicle = bot->GetVehicle())
|
||||||
{
|
{
|
||||||
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(bot);
|
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(bot);
|
||||||
@@ -216,7 +209,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
delay -= botAI->GetReactDelay();
|
delay -= botAI->GetReactDelay();
|
||||||
}
|
}
|
||||||
delay = std::max(.0f, delay);
|
delay = std::max(.0f, delay);
|
||||||
delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, delay);
|
delay = std::min((float)sPlayerbotAIConfig.maxWaitForMove, delay);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay, priority);
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay, priority);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -241,7 +234,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
delay -= botAI->GetReactDelay();
|
delay -= botAI->GetReactDelay();
|
||||||
}
|
}
|
||||||
delay = std::max(.0f, delay);
|
delay = std::max(.0f, delay);
|
||||||
delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, delay);
|
delay = std::min((float)sPlayerbotAIConfig.maxWaitForMove, delay);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay, priority);
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay, priority);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -250,7 +243,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
{
|
{
|
||||||
float modifiedZ;
|
float modifiedZ;
|
||||||
Movement::PointsArray path =
|
Movement::PointsArray path =
|
||||||
SearchForBestPath(x, y, z, modifiedZ, sPlayerbotAIConfig->maxMovementSearchTime, normal_only);
|
SearchForBestPath(x, y, z, modifiedZ, sPlayerbotAIConfig.maxMovementSearchTime, normal_only);
|
||||||
if (modifiedZ == INVALID_HEIGHT)
|
if (modifiedZ == INVALID_HEIGHT)
|
||||||
return false;
|
return false;
|
||||||
float distance = bot->GetExactDist(x, y, modifiedZ);
|
float distance = bot->GetExactDist(x, y, modifiedZ);
|
||||||
@@ -272,7 +265,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
delay -= botAI->GetReactDelay();
|
delay -= botAI->GetReactDelay();
|
||||||
}
|
}
|
||||||
delay = std::max(.0f, delay);
|
delay = std::max(.0f, delay);
|
||||||
delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, delay);
|
delay = std::min((float)sPlayerbotAIConfig.maxWaitForMove, delay);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay, priority);
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay, priority);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -308,8 +301,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// float minDist = sPlayerbotAIConfig->targetPosRecalcDistance; //Minium distance a bot should move.
|
// float minDist = sPlayerbotAIConfig.targetPosRecalcDistance; //Minium distance a bot should move.
|
||||||
// float maxDist = sPlayerbotAIConfig->reactDistance; //Maxium distance a bot can move in one single
|
// float maxDist = sPlayerbotAIConfig.reactDistance; //Maxium distance a bot can move in one single
|
||||||
// action. float originalZ = z; // save original destination height to check
|
// action. float originalZ = z; // save original destination height to check
|
||||||
// if bot needs to fly up
|
// if bot needs to fly up
|
||||||
|
|
||||||
@@ -370,11 +363,11 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// {
|
// {
|
||||||
// movePosition = endPosition;
|
// movePosition = endPosition;
|
||||||
|
|
||||||
// if (startPosition.getMapId() != endPosition.getMapId() || totalDistance > maxDist)
|
// if (startPosition.GetMapId() != endPosition.GetMapId() || totalDistance > maxDist)
|
||||||
// {
|
// {
|
||||||
// if (!sTravelNodeMap->getNodes().empty() && !bot->InBattleground())
|
// if (!TravelNodeMap::instance().getNodes().empty() && !bot->InBattleground())
|
||||||
// {
|
// {
|
||||||
// if (sPlayerbotAIConfig->tweakValue)
|
// if (sPlayerbotAIConfig.tweakValue)
|
||||||
// {
|
// {
|
||||||
// if (lastMove.future.valid())
|
// if (lastMove.future.valid())
|
||||||
// {
|
// {
|
||||||
@@ -388,12 +381,12 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// movePath = sTravelNodeMap->getFullPath(startPosition, endPosition, bot);
|
// movePath = TravelNodeMap::instance().getFullPath(startPosition, endPosition, bot);
|
||||||
|
|
||||||
// if (movePath.empty())
|
// if (movePath.empty())
|
||||||
// {
|
// {
|
||||||
// //We have no path. Beyond 450yd the standard PathGenerator will probably move the wrong way.
|
// //We have no path. Beyond 450yd the standard PathGenerator will probably move the wrong way.
|
||||||
// if (sServerFacade->IsDistanceGreaterThan(totalDistance, maxDist * 3))
|
// if (ServerFacade::instance().IsDistanceGreaterThan(totalDistance, maxDist * 3))
|
||||||
// {
|
// {
|
||||||
// movePath.clear();
|
// movePath.clear();
|
||||||
// movePath.addPoint(endPosition);
|
// movePath.addPoint(endPosition);
|
||||||
@@ -402,7 +395,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// bot->StopMoving();
|
// bot->StopMoving();
|
||||||
// if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
// if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||||
// botAI->TellMasterNoFacing("I have no path");
|
// botAI->TellMasterNoFacing("I have no path");
|
||||||
// LOG_DEBUG("playerbots", "sServerFacade->IsDistanceGreaterThan(totalDistance, maxDist * 3)");
|
// LOG_DEBUG("playerbots", "ServerFacade::instance().IsDistanceGreaterThan(totalDistance, maxDist * 3)");
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -421,7 +414,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// {
|
// {
|
||||||
// //Use standard PathGenerator to find a route.
|
// //Use standard PathGenerator to find a route.
|
||||||
// PathGenerator path(mover);
|
// PathGenerator path(mover);
|
||||||
// path.CalculatePath(movePosition.getX(), movePosition.getY(), movePosition.getZ(), false);
|
// path.CalculatePath(movePosition.GetPositionX(), movePosition.GetPositionY(), movePosition.GetPositionZ(), false);
|
||||||
// PathType type = path.GetPathType();
|
// PathType type = path.GetPathType();
|
||||||
// Movement::PointsArray const& points = path.GetPath();
|
// Movement::PointsArray const& points = path.GetPath();
|
||||||
// movePath.addPath(startPosition.fromPointsArray(points));
|
// movePath.addPath(startPosition.fromPointsArray(points));
|
||||||
@@ -450,7 +443,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// if (pathType == TravelNodePathType::portal) // && !botAI->isRealPlayer())
|
// if (pathType == TravelNodePathType::portal) // && !botAI->isRealPlayer())
|
||||||
// {
|
// {
|
||||||
// //Log bot movement
|
// //Log bot movement
|
||||||
// if (sPlayerbotAIConfig->hasLog("bot_movement.csv"))
|
// if (sPlayerbotAIConfig.hasLog("bot_movement.csv"))
|
||||||
// {
|
// {
|
||||||
// WorldPosition telePos;
|
// WorldPosition telePos;
|
||||||
// if (entry)
|
// if (entry)
|
||||||
@@ -463,7 +456,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// telePos = movePosition;
|
// telePos = movePosition;
|
||||||
|
|
||||||
// std::ostringstream out;
|
// std::ostringstream out;
|
||||||
// out << sPlayerbotAIConfig->GetTimestampStr() << "+00,";
|
// out << sPlayerbotAIConfig.GetTimestampStr() << "+00,";
|
||||||
// out << bot->GetName() << ",";
|
// out << bot->GetName() << ",";
|
||||||
// if (telePos && telePos.GetExactDist(movePosition) > 0.001)
|
// if (telePos && telePos.GetExactDist(movePosition) > 0.001)
|
||||||
// startPosition.printWKT({ startPosition, movePosition, telePos }, out, 1);
|
// startPosition.printWKT({ startPosition, movePosition, telePos }, out, 1);
|
||||||
@@ -475,7 +468,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// out << bot->GetLevel() << ",";
|
// out << bot->GetLevel() << ",";
|
||||||
// out << (entry ? -1 : entry);
|
// out << (entry ? -1 : entry);
|
||||||
|
|
||||||
// sPlayerbotAIConfig->log("bot_movement.csv", out.str().c_str());
|
// sPlayerbotAIConfig.log("bot_movement.csv", out.str().c_str());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (entry)
|
// if (entry)
|
||||||
@@ -485,8 +478,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// LOG_DEBUG("playerbots", "!entry");
|
// LOG_DEBUG("playerbots", "!entry");
|
||||||
// return bot->TeleportTo(movePosition.getMapId(), movePosition.getX(), movePosition.getY(),
|
// return bot->TeleportTo(movePosition.GetMapId(), movePosition.GetPositionX(), movePosition.GetPositionY(),
|
||||||
// movePosition.getZ(), movePosition.getO(), 0);
|
// movePosition.GetPositionZ(), movePosition.GetOrientation(), 0);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -563,14 +556,14 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
|
|
||||||
// AI_VALUE(LastMovement&, "last movement").setPath(movePath);
|
// AI_VALUE(LastMovement&, "last movement").setPath(movePath);
|
||||||
|
|
||||||
// if (!movePosition || movePosition.getMapId() != bot->GetMapId())
|
// if (!movePosition || movePosition.GetMapId() != bot->GetMapId())
|
||||||
// {
|
// {
|
||||||
// movePath.clear();
|
// movePath.clear();
|
||||||
// AI_VALUE(LastMovement&, "last movement").setPath(movePath);
|
// AI_VALUE(LastMovement&, "last movement").setPath(movePath);
|
||||||
|
|
||||||
// if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
// if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||||
// botAI->TellMasterNoFacing("No point. Rebuilding.");
|
// botAI->TellMasterNoFacing("No point. Rebuilding.");
|
||||||
// LOG_DEBUG("playerbots", "!movePosition || movePosition.getMapId() != bot->GetMapId()");
|
// LOG_DEBUG("playerbots", "!movePosition || movePosition.GetMapId() != bot->GetMapId()");
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -609,22 +602,22 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// float cz = z;
|
// float cz = z;
|
||||||
// for (auto i : movePath.getPath())
|
// for (auto i : movePath.getPath())
|
||||||
// {
|
// {
|
||||||
// CreateWp(bot, i.point.getX(), i.point.getY(), i.point.getZ(), 0.f, 2334);
|
// CreateWp(bot, i.point.GetPositionX(), i.point.GetPositionY(), i.point.GetPositionZ(), 0.f, 2334);
|
||||||
|
|
||||||
// cx = i.point.getX();
|
// cx = i.point.GetPositionX();
|
||||||
// cy = i.point.getY();
|
// cy = i.point.GetPositionY();
|
||||||
// cz = i.point.getZ();
|
// cz = i.point.GetPositionZ();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// CreateWp(bot, movePosition.getX(), movePosition.getY(), movePosition.getZ(), 0, 2334, true);
|
// CreateWp(bot, movePosition.GetPositionX(), movePosition.GetPositionY(), movePosition.GetPositionZ(), 0, 2334, true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// //Log bot movement
|
// //Log bot movement
|
||||||
// if (sPlayerbotAIConfig->hasLog("bot_movement.csv") && lastMove.lastMoveShort.GetExactDist(movePosition) > 0.001)
|
// if (sPlayerbotAIConfig.hasLog("bot_movement.csv") && lastMove.lastMoveShort.GetExactDist(movePosition) > 0.001)
|
||||||
// {
|
// {
|
||||||
// std::ostringstream out;
|
// std::ostringstream out;
|
||||||
// out << sPlayerbotAIConfig->GetTimestampStr() << "+00,";
|
// out << sPlayerbotAIConfig.GetTimestampStr() << "+00,";
|
||||||
// out << bot->GetName() << ",";
|
// out << bot->GetName() << ",";
|
||||||
// startPosition.printWKT({ startPosition, movePosition }, out, 1);
|
// startPosition.printWKT({ startPosition, movePosition }, out, 1);
|
||||||
// out << std::to_string(bot->getRace()) << ",";
|
// out << std::to_string(bot->getRace()) << ",";
|
||||||
@@ -632,10 +625,10 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// out << bot->GetLevel();
|
// out << bot->GetLevel();
|
||||||
// out << 0;
|
// out << 0;
|
||||||
|
|
||||||
// sPlayerbotAIConfig->log("bot_movement.csv", out.str().c_str());
|
// sPlayerbotAIConfig.log("bot_movement.csv", out.str().c_str());
|
||||||
// }
|
// }
|
||||||
// // LOG_DEBUG("playerbots", "({}, {}) -> ({}, {})", startPosition.getX(), startPosition.getY(),
|
// // LOG_DEBUG("playerbots", "({}, {}) -> ({}, {})", startPosition.GetPositionX(), startPosition.GetPositionY(),
|
||||||
// movePosition.getX(), movePosition.getY()); if (!react)
|
// movePosition.GetPositionX(), movePosition.GetPositionY()); if (!react)
|
||||||
// if (totalDistance > maxDist)
|
// if (totalDistance > maxDist)
|
||||||
// WaitForReach(startPosition.distance(movePosition) - 10.0f);
|
// WaitForReach(startPosition.distance(movePosition) - 10.0f);
|
||||||
// else
|
// else
|
||||||
@@ -671,7 +664,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// // else
|
// // else
|
||||||
// // {
|
// // {
|
||||||
// // mover->GetMotionMaster()->GetDestination(x, y, z);
|
// // mover->GetMotionMaster()->GetDestination(x, y, z);
|
||||||
// // if (movePosition.distance(WorldPosition(movePosition.getMapId(), x, y, z, 0)) > minDist)
|
// // if (movePosition.distance(WorldPosition(movePosition.GetMapId(), x, y, z, 0)) > minDist)
|
||||||
// // {
|
// // {
|
||||||
// // mover->StopMoving();
|
// // mover->StopMoving();
|
||||||
// // mover->GetMotionMaster()->Clear();
|
// // mover->GetMotionMaster()->Clear();
|
||||||
@@ -685,8 +678,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
|
|
||||||
// AI_VALUE(LastMovement&, "last movement").nextTeleport = now +
|
// AI_VALUE(LastMovement&, "last movement").nextTeleport = now +
|
||||||
// (time_t)MoveDelay(startPosition.distance(movePosition)); LOG_DEBUG("playerbots", "totalDistance > maxDist &&
|
// (time_t)MoveDelay(startPosition.distance(movePosition)); LOG_DEBUG("playerbots", "totalDistance > maxDist &&
|
||||||
// !detailedMove && !botAI->HasPlayerNearby(&movePosition)"); return bot->TeleportTo(movePosition.getMapId(),
|
// !detailedMove && !botAI->HasPlayerNearby(&movePosition)"); return bot->TeleportTo(movePosition.GetMapId(),
|
||||||
// movePosition.getX(), movePosition.getY(), movePosition.getZ(), startPosition.getAngleTo(movePosition));
|
// movePosition.GetPositionX(), movePosition.GetPositionY(), movePosition.GetPositionZ(), startPosition.getAngleTo(movePosition));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // walk if master walks and is close
|
// // walk if master walks and is close
|
||||||
@@ -694,7 +687,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// if (botAI->GetMaster())
|
// if (botAI->GetMaster())
|
||||||
// {
|
// {
|
||||||
// if (botAI->GetMaster()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING) &&
|
// if (botAI->GetMaster()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING) &&
|
||||||
// sServerFacade->GetDistance2d(bot, botAI->GetMaster()) < 20.0f)
|
// ServerFacade::instance().GetDistance2d(bot, botAI->GetMaster()) < 20.0f)
|
||||||
// masterWalking = true;
|
// masterWalking = true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@@ -708,9 +701,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// if (!bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY))
|
// if (!bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !bot->HasAuraType(SPELL_AURA_FLY))
|
||||||
// {
|
// {
|
||||||
// bot->SetWalk(masterWalking);
|
// bot->SetWalk(masterWalking);
|
||||||
// bot->GetMotionMaster()->MovePoint(movePosition.getMapId(), movePosition.getX(), movePosition.getY(),
|
// bot->GetMotionMaster()->MovePoint(movePosition.GetMapId(), movePosition.GetPositionX(), movePosition.GetPositionY(),
|
||||||
// movePosition.getZ(), generatePath); WaitForReach(startPosition.distance(movePosition));
|
// movePosition.GetPositionZ(), generatePath); WaitForReach(startPosition.distance(movePosition));
|
||||||
// // LOG_DEBUG("playerbots", "Movepoint to ({}, {})", movePosition.getX(), movePosition.getY());
|
// // LOG_DEBUG("playerbots", "Movepoint to ({}, {})", movePosition.GetPositionX(), movePosition.GetPositionY());
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
@@ -756,9 +749,9 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// bot->GetMotionMaster()->MovePoint(movePosition.getMapId(), Position(movePosition.getX(), movePosition.getY(),
|
// bot->GetMotionMaster()->MovePoint(movePosition.GetMapId(), Position(movePosition.GetPositionX(), movePosition.GetPositionY(),
|
||||||
// movePosition.getZ(), 0.f)); WaitForReach(startPosition.distance(movePosition)); LOG_DEBUG("playerbots",
|
// movePosition.GetPositionZ(), 0.f)); WaitForReach(startPosition.distance(movePosition)); LOG_DEBUG("playerbots",
|
||||||
// "Movepoint to ({}, {})", movePosition.getX(), movePosition.getY());
|
// "Movepoint to ({}, {})", movePosition.GetPositionX(), movePosition.GetPositionY());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// AI_VALUE(LastMovement&, "last movement").setShort(movePosition);
|
// AI_VALUE(LastMovement&, "last movement").setShort(movePosition);
|
||||||
@@ -787,7 +780,7 @@ bool MovementAction::MoveTo(WorldObject* target, float distance, MovementPriorit
|
|||||||
float angle = bot->GetAngle(target);
|
float angle = bot->GetAngle(target);
|
||||||
float needToGo = distanceToTarget - distance;
|
float needToGo = distanceToTarget - distance;
|
||||||
|
|
||||||
float maxDistance = sPlayerbotAIConfig->spellDistance;
|
float maxDistance = sPlayerbotAIConfig.spellDistance;
|
||||||
if (needToGo > 0 && needToGo > maxDistance)
|
if (needToGo > 0 && needToGo > maxDistance)
|
||||||
needToGo = maxDistance;
|
needToGo = maxDistance;
|
||||||
else if (needToGo < 0 && needToGo < -maxDistance)
|
else if (needToGo < 0 && needToGo < -maxDistance)
|
||||||
@@ -898,8 +891,8 @@ bool MovementAction::IsMovingAllowed(WorldObject* target)
|
|||||||
if (bot->GetMapId() != target->GetMapId())
|
if (bot->GetMapId() != target->GetMapId())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// float distance = sServerFacade->GetDistance2d(bot, target);
|
// float distance = ServerFacade::instance().GetDistance2d(bot, target);
|
||||||
// if (!bot->InBattleground() && distance > sPlayerbotAIConfig->reactDistance)
|
// if (!bot->InBattleground() && distance > sPlayerbotAIConfig.reactDistance)
|
||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
return IsMovingAllowed();
|
return IsMovingAllowed();
|
||||||
@@ -923,7 +916,7 @@ bool MovementAction::IsDuplicateMove(uint32 mapId, float x, float y, float z)
|
|||||||
LastMovement& lastMove = *context->GetValue<LastMovement&>("last movement");
|
LastMovement& lastMove = *context->GetValue<LastMovement&>("last movement");
|
||||||
|
|
||||||
// heuristic 5s
|
// heuristic 5s
|
||||||
if (lastMove.msTime + sPlayerbotAIConfig->maxWaitForMove < getMSTime() ||
|
if (lastMove.msTime + sPlayerbotAIConfig.maxWaitForMove < getMSTime() ||
|
||||||
lastMove.lastMoveShort.GetExactDist(x, y, z) > 0.01f)
|
lastMove.lastMoveShort.GetExactDist(x, y, z) > 0.01f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -953,68 +946,70 @@ bool MovementAction::Follow(Unit* target, float distance) { return Follow(target
|
|||||||
|
|
||||||
void MovementAction::UpdateMovementState()
|
void MovementAction::UpdateMovementState()
|
||||||
{
|
{
|
||||||
const bool isCurrentlyRestricted = // see if the bot is currently slowed, rooted, or otherwise unable to move
|
const bool isCurrentlyRestricted = // see if the bot is currently slowed, rooted, or otherwise unable to move
|
||||||
bot->HasUnitState(UNIT_STATE_LOST_CONTROL) ||
|
bot->HasUnitState(UNIT_STATE_LOST_CONTROL) || bot->IsRooted() || bot->isFrozen() || bot->IsPolymorphed();
|
||||||
bot->IsRooted() ||
|
|
||||||
bot->isFrozen() ||
|
|
||||||
bot->IsPolymorphed();
|
|
||||||
|
|
||||||
// no update movement flags while movement is current restricted.
|
// no update movement flags while movement is current restricted.
|
||||||
if (!isCurrentlyRestricted && bot->IsAlive())
|
if (!isCurrentlyRestricted && bot->IsAlive())
|
||||||
{
|
{
|
||||||
// state flags
|
// state flags
|
||||||
const auto master = botAI ? botAI->GetMaster() : nullptr; // real player or not
|
const auto master = botAI ? botAI->GetMaster() : nullptr;
|
||||||
const bool masterIsFlying = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) : true;
|
const auto liquidState = bot->GetLiquidData().Status;
|
||||||
const bool masterIsSwimming = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) : true;
|
|
||||||
const auto liquidState = bot->GetLiquidData().Status; // default LIQUID_MAP_NO_WATER
|
|
||||||
const float gZ = bot->GetMapWaterOrGroundLevel(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ());
|
const float gZ = bot->GetMapWaterOrGroundLevel(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ());
|
||||||
const bool wantsToFly = bot->HasIncreaseMountedFlightSpeedAura() || bot->HasFlyAura();
|
const bool onGroundZ = bot->GetPositionZ() < gZ + 1.f;
|
||||||
|
const bool canSwim = liquidState == LIQUID_MAP_IN_WATER || liquidState == LIQUID_MAP_UNDER_WATER;
|
||||||
|
const bool canFly = bot->HasIncreaseMountedFlightSpeedAura() || bot->HasFlyAura();
|
||||||
|
const bool canWaterWalk = bot->HasWaterWalkAura();
|
||||||
|
const bool isMasterFlying = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) : true;
|
||||||
|
const bool isMasterSwimming = master ? master->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) : true;
|
||||||
const bool isFlying = bot->HasUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
const bool isFlying = bot->HasUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||||
const bool isWaterArea = liquidState != LIQUID_MAP_NO_WATER;
|
|
||||||
const bool isUnderWater = liquidState == LIQUID_MAP_UNDER_WATER;
|
|
||||||
const bool isInWater = liquidState == LIQUID_MAP_IN_WATER;
|
|
||||||
const bool isWaterWalking = bot->HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
|
||||||
const bool isSwimming = bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
const bool isSwimming = bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
||||||
const bool wantsToWaterWalk = bot->HasWaterWalkAura();
|
const bool isWaterWalking = bot->HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||||
const bool wantsToSwim = isInWater || isUnderWater;
|
|
||||||
const bool onGroundZ = (bot->GetPositionZ() < gZ + 1.f) && !isWaterArea;
|
|
||||||
bool movementFlagsUpdated = false;
|
bool movementFlagsUpdated = false;
|
||||||
|
|
||||||
// handle water state
|
// handle water (fragile logic do not alter without testing every detail, animation and transition)
|
||||||
if (isWaterArea && !isFlying)
|
if (liquidState != LIQUID_MAP_NO_WATER && !isFlying)
|
||||||
{
|
{
|
||||||
// water walking
|
if (canWaterWalk && !isMasterSwimming && !isWaterWalking)
|
||||||
if (wantsToWaterWalk && !isWaterWalking && !masterIsSwimming)
|
|
||||||
{
|
{
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
bot->SetSwim(false);
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
bot->AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||||
movementFlagsUpdated = true;
|
movementFlagsUpdated = true;
|
||||||
}
|
}
|
||||||
// swimming
|
else if ((!canWaterWalk || isMasterSwimming) && isWaterWalking)
|
||||||
else if (wantsToSwim && !isSwimming && masterIsSwimming)
|
|
||||||
{
|
{
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
if (canSwim)
|
||||||
|
bot->SetSwim(true);
|
||||||
|
movementFlagsUpdated = true;
|
||||||
|
}
|
||||||
|
else if (!canSwim && isSwimming)
|
||||||
|
{
|
||||||
|
bot->SetSwim(false);
|
||||||
movementFlagsUpdated = true;
|
movementFlagsUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isSwimming || isWaterWalking)
|
|
||||||
|
// reset when not around water while swimming or water walking
|
||||||
|
if (liquidState == LIQUID_MAP_NO_WATER && (isSwimming || isWaterWalking))
|
||||||
{
|
{
|
||||||
// reset water flags
|
bot->SetSwim(false);
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
|
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
|
||||||
movementFlagsUpdated = true;
|
movementFlagsUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle flying state
|
// handle flying
|
||||||
if (wantsToFly && !isFlying && masterIsFlying)
|
if ((canFly && !isFlying) && isMasterFlying)
|
||||||
{
|
{
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
bot->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
bot->AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||||
bot->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
bot->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
|
||||||
movementFlagsUpdated = true;
|
|
||||||
|
// required for transition and state monitoring.
|
||||||
|
if (MotionMaster* mm = bot->GetMotionMaster())
|
||||||
|
mm->MoveTakeoff(0, {bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ() + 1.F}, 0.F, true);
|
||||||
}
|
}
|
||||||
else if ((!wantsToFly || onGroundZ) && isFlying)
|
else if ((!canFly && !isWaterWalking && isFlying) || (!isMasterFlying && isFlying && onGroundZ))
|
||||||
{
|
{
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
|
||||||
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
bot->RemoveUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
|
||||||
@@ -1022,15 +1017,16 @@ void MovementAction::UpdateMovementState()
|
|||||||
movementFlagsUpdated = true;
|
movementFlagsUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect if movement restrictions have been lifted, CC just ended.
|
// detect if movement/CC restrictions have been ended, refresh movement state for animations.
|
||||||
if (wasMovementRestricted)
|
if (wasMovementRestricted)
|
||||||
movementFlagsUpdated = true; // refresh movement state to ensure animations play correctly
|
movementFlagsUpdated = true;
|
||||||
|
|
||||||
|
// movement flags should only be updated between state changes, if not it will break certain effects.
|
||||||
if (movementFlagsUpdated)
|
if (movementFlagsUpdated)
|
||||||
bot->SendMovementFlagUpdate();
|
bot->SendMovementFlagUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save current state for the next check
|
// Save current state for the next check
|
||||||
wasMovementRestricted = isCurrentlyRestricted;
|
wasMovementRestricted = isCurrentlyRestricted;
|
||||||
|
|
||||||
// Temporary speed increase in group
|
// Temporary speed increase in group
|
||||||
@@ -1046,7 +1042,7 @@ void MovementAction::UpdateMovementState()
|
|||||||
// if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE && bot->CanNotReachTarget() &&
|
// if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE && bot->CanNotReachTarget() &&
|
||||||
// !bot->InBattleground())
|
// !bot->InBattleground())
|
||||||
// {
|
// {
|
||||||
// if (Unit* pTarget = sServerFacade->GetChaseTarget(bot))
|
// if (Unit* pTarget = ServerFacade::instance().GetChaseTarget(bot))
|
||||||
// {
|
// {
|
||||||
// if (!bot->IsWithinMeleeRange(pTarget) && pTarget->IsCreature())
|
// if (!bot->IsWithinMeleeRange(pTarget) && pTarget->IsCreature())
|
||||||
// {
|
// {
|
||||||
@@ -1080,7 +1076,7 @@ void MovementAction::UpdateMovementState()
|
|||||||
// bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) && bot->CanNotReachTarget()
|
// bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) && bot->CanNotReachTarget()
|
||||||
// && !bot->InBattleground())
|
// && !bot->InBattleground())
|
||||||
// {
|
// {
|
||||||
// if (Unit* pTarget = sServerFacade->GetChaseTarget(bot))
|
// if (Unit* pTarget = ServerFacade::instance().GetChaseTarget(bot))
|
||||||
// {
|
// {
|
||||||
// if (pTarget != botAI->GetGroupLeader())
|
// if (pTarget != botAI->GetGroupLeader())
|
||||||
// return;
|
// return;
|
||||||
@@ -1117,8 +1113,8 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!bot->InBattleground() && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target),
|
if (!bot->InBattleground() && ServerFacade::instance().IsDistanceLessOrEqualThan(ServerFacade::instance().GetDistance2d(bot, target),
|
||||||
sPlayerbotAIConfig->followDistance))
|
sPlayerbotAIConfig.followDistance))
|
||||||
{
|
{
|
||||||
// botAI->TellError("No need to follow");
|
// botAI->TellError("No need to follow");
|
||||||
return false;
|
return false;
|
||||||
@@ -1126,9 +1122,9 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
if (!bot->InBattleground()
|
if (!bot->InBattleground()
|
||||||
&& sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target->GetPositionX(),
|
&& ServerFacade::instance().IsDistanceLessOrEqualThan(ServerFacade::instance().GetDistance2d(bot, target->GetPositionX(),
|
||||||
target->GetPositionY()), sPlayerbotAIConfig->sightDistance)
|
target->GetPositionY()), sPlayerbotAIConfig.sightDistance)
|
||||||
&& abs(bot->GetPositionZ() - target->GetPositionZ()) >= sPlayerbotAIConfig->spellDistance &&
|
&& abs(bot->GetPositionZ() - target->GetPositionZ()) >= sPlayerbotAIConfig.spellDistance &&
|
||||||
botAI->HasRealPlayerMaster()
|
botAI->HasRealPlayerMaster()
|
||||||
&& (target->GetMapId() && bot->GetMapId() != target->GetMapId()))
|
&& (target->GetMapId() && bot->GetMapId() != target->GetMapId()))
|
||||||
{
|
{
|
||||||
@@ -1189,13 +1185,13 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
WorldPosition cPos(corpse);
|
WorldPosition cPos(corpse);
|
||||||
|
|
||||||
if (botPos.fDist(cPos) > sPlayerbotAIConfig->spellDistance)
|
if (botPos.fDist(cPos) > sPlayerbotAIConfig.spellDistance)
|
||||||
return MoveTo(cPos.getMapId(), cPos.getX(), cPos.getY(), cPos.getZ());
|
return MoveTo(cPos.GetMapId(), cPos.GetPositionX(), cPos.GetPositionY(), cPos.GetPositionZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sServerFacade->IsDistanceGreaterOrEqualThan(sServerFacade->GetDistance2d(bot, target),
|
if (ServerFacade::instance().IsDistanceGreaterOrEqualThan(ServerFacade::instance().GetDistance2d(bot, target),
|
||||||
sPlayerbotAIConfig->sightDistance))
|
sPlayerbotAIConfig.sightDistance))
|
||||||
{
|
{
|
||||||
if (target->GetGUID().IsPlayer())
|
if (target->GetGUID().IsPlayer())
|
||||||
{
|
{
|
||||||
@@ -1217,7 +1213,7 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
if ((lDist * 1.5 < tDist && ang < static_cast<float>(M_PI) / 2) ||
|
if ((lDist * 1.5 < tDist && ang < static_cast<float>(M_PI) / 2) ||
|
||||||
target->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
target->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||||
{
|
{
|
||||||
return MoveTo(longMove.getMapId(), longMove.getX(), longMove.getY(), longMove.getZ());
|
return MoveTo(longMove.GetMapId(), longMove.GetPositionX(), longMove.GetPositionY(), longMove.GetPositionZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1238,11 +1234,11 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!target->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
if (!target->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||||
return MoveTo(target, sPlayerbotAIConfig->followDistance);
|
return MoveTo(target, sPlayerbotAIConfig.followDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target),
|
if (ServerFacade::instance().IsDistanceLessOrEqualThan(ServerFacade::instance().GetDistance2d(bot, target),
|
||||||
sPlayerbotAIConfig->followDistance))
|
sPlayerbotAIConfig.followDistance))
|
||||||
{
|
{
|
||||||
// botAI->TellError("No need to follow");
|
// botAI->TellError("No need to follow");
|
||||||
return false;
|
return false;
|
||||||
@@ -1251,8 +1247,8 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
if (target->IsFriendlyTo(bot) && bot->IsMounted() && AI_VALUE(GuidVector, "all targets").empty())
|
if (target->IsFriendlyTo(bot) && bot->IsMounted() && AI_VALUE(GuidVector, "all targets").empty())
|
||||||
distance += angle;
|
distance += angle;
|
||||||
|
|
||||||
if (!bot->InBattleground() && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target),
|
if (!bot->InBattleground() && ServerFacade::instance().IsDistanceLessOrEqualThan(ServerFacade::instance().GetDistance2d(bot, target),
|
||||||
sPlayerbotAIConfig->followDistance))
|
sPlayerbotAIConfig.followDistance))
|
||||||
{
|
{
|
||||||
// botAI->TellError("No need to follow");
|
// botAI->TellError("No need to follow");
|
||||||
return false;
|
return false;
|
||||||
@@ -1274,7 +1270,7 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
|
|
||||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
|
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
|
||||||
{
|
{
|
||||||
Unit* currentTarget = sServerFacade->GetChaseTarget(bot);
|
Unit* currentTarget = ServerFacade::instance().GetChaseTarget(bot);
|
||||||
if (currentTarget && currentTarget->GetGUID() == target->GetGUID())
|
if (currentTarget && currentTarget->GetGUID() == target->GetGUID())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1347,13 +1343,13 @@ void MovementAction::WaitForReach(float distance)
|
|||||||
{
|
{
|
||||||
float delay = 1000.0f * MoveDelay(distance);
|
float delay = 1000.0f * MoveDelay(distance);
|
||||||
|
|
||||||
if (delay > sPlayerbotAIConfig->maxWaitForMove)
|
if (delay > sPlayerbotAIConfig.maxWaitForMove)
|
||||||
delay = sPlayerbotAIConfig->maxWaitForMove;
|
delay = sPlayerbotAIConfig.maxWaitForMove;
|
||||||
|
|
||||||
Unit* target = *botAI->GetAiObjectContext()->GetValue<Unit*>("current target");
|
Unit* target = *botAI->GetAiObjectContext()->GetValue<Unit*>("current target");
|
||||||
Unit* player = *botAI->GetAiObjectContext()->GetValue<Unit*>("enemy player target");
|
Unit* player = *botAI->GetAiObjectContext()->GetValue<Unit*>("enemy player target");
|
||||||
if ((player || target) && delay > sPlayerbotAIConfig->globalCoolDown)
|
if ((player || target) && delay > sPlayerbotAIConfig.globalCoolDown)
|
||||||
delay = sPlayerbotAIConfig->globalCoolDown;
|
delay = sPlayerbotAIConfig.globalCoolDown;
|
||||||
|
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
delay = 0;
|
delay = 0;
|
||||||
@@ -1378,7 +1374,7 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig->fleeingEnabled)
|
if (!sPlayerbotAIConfig.fleeingEnabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!IsMovingAllowed())
|
if (!IsMovingAllowed())
|
||||||
@@ -1390,7 +1386,7 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
bool foundFlee = false;
|
bool foundFlee = false;
|
||||||
time_t lastFlee = AI_VALUE(LastMovement&, "last movement").lastFlee;
|
time_t lastFlee = AI_VALUE(LastMovement&, "last movement").lastFlee;
|
||||||
time_t now = time(0);
|
time_t now = time(0);
|
||||||
uint32 fleeDelay = urand(2, sPlayerbotAIConfig->returnDelay / 1000);
|
uint32 fleeDelay = urand(2, sPlayerbotAIConfig.returnDelay / 1000);
|
||||||
|
|
||||||
if (lastFlee)
|
if (lastFlee)
|
||||||
{
|
{
|
||||||
@@ -1406,7 +1402,7 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
{
|
{
|
||||||
Unit* fleeTarget = nullptr;
|
Unit* fleeTarget = nullptr;
|
||||||
float fleeDistance = sPlayerbotAIConfig->sightDistance;
|
float fleeDistance = sPlayerbotAIConfig.sightDistance;
|
||||||
|
|
||||||
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
|
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
|
||||||
{
|
{
|
||||||
@@ -1416,8 +1412,8 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
|
|
||||||
if (botAI->IsTank(player))
|
if (botAI->IsTank(player))
|
||||||
{
|
{
|
||||||
float distanceToTank = sServerFacade->GetDistance2d(bot, player);
|
float distanceToTank = ServerFacade::instance().GetDistance2d(bot, player);
|
||||||
float distanceToTarget = sServerFacade->GetDistance2d(bot, target);
|
float distanceToTarget = ServerFacade::instance().GetDistance2d(bot, target);
|
||||||
if (distanceToTank < fleeDistance)
|
if (distanceToTank < fleeDistance)
|
||||||
{
|
{
|
||||||
fleeTarget = player;
|
fleeTarget = player;
|
||||||
@@ -1460,10 +1456,10 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
|
|
||||||
if ((isHealer && botAI->IsHeal(player)) || needHealer)
|
if ((isHealer && botAI->IsHeal(player)) || needHealer)
|
||||||
{
|
{
|
||||||
float distanceToHealer = sServerFacade->GetDistance2d(bot, player);
|
float distanceToHealer = ServerFacade::instance().GetDistance2d(bot, player);
|
||||||
float distanceToTarget = sServerFacade->GetDistance2d(player, target);
|
float distanceToTarget = ServerFacade::instance().GetDistance2d(player, target);
|
||||||
if (distanceToHealer < fleeDistance &&
|
if (distanceToHealer < fleeDistance &&
|
||||||
distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig->followDistance) &&
|
distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig.followDistance) &&
|
||||||
(needHealer || player->IsWithinLOSInMap(target)))
|
(needHealer || player->IsWithinLOSInMap(target)))
|
||||||
{
|
{
|
||||||
fleeTarget = player;
|
fleeTarget = player;
|
||||||
@@ -1473,10 +1469,10 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
}
|
}
|
||||||
else if (isRanged && botAI->IsRanged(player))
|
else if (isRanged && botAI->IsRanged(player))
|
||||||
{
|
{
|
||||||
float distanceToRanged = sServerFacade->GetDistance2d(bot, player);
|
float distanceToRanged = ServerFacade::instance().GetDistance2d(bot, player);
|
||||||
float distanceToTarget = sServerFacade->GetDistance2d(player, target);
|
float distanceToTarget = ServerFacade::instance().GetDistance2d(player, target);
|
||||||
if (distanceToRanged < fleeDistance &&
|
if (distanceToRanged < fleeDistance &&
|
||||||
distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig->followDistance) &&
|
distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig.followDistance) &&
|
||||||
player->IsWithinLOSInMap(target))
|
player->IsWithinLOSInMap(target))
|
||||||
{
|
{
|
||||||
fleeTarget = player;
|
fleeTarget = player;
|
||||||
@@ -1485,10 +1481,10 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remember any group member in case no one else found
|
// remember any group member in case no one else found
|
||||||
float distanceToFlee = sServerFacade->GetDistance2d(bot, player);
|
float distanceToFlee = ServerFacade::instance().GetDistance2d(bot, player);
|
||||||
float distanceToTarget = sServerFacade->GetDistance2d(player, target);
|
float distanceToTarget = ServerFacade::instance().GetDistance2d(player, target);
|
||||||
if (distanceToFlee < spareDistance &&
|
if (distanceToFlee < spareDistance &&
|
||||||
distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig->followDistance) &&
|
distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig.followDistance) &&
|
||||||
player->IsWithinLOSInMap(target))
|
player->IsWithinLOSInMap(target))
|
||||||
{
|
{
|
||||||
spareTarget = player;
|
spareTarget = player;
|
||||||
@@ -1508,8 +1504,8 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
|
|
||||||
if ((!fleeTarget || !foundFlee) && master && master->IsAlive() && master->IsWithinLOSInMap(target))
|
if ((!fleeTarget || !foundFlee) && master && master->IsAlive() && master->IsWithinLOSInMap(target))
|
||||||
{
|
{
|
||||||
float distanceToTarget = sServerFacade->GetDistance2d(master, target);
|
float distanceToTarget = ServerFacade::instance().GetDistance2d(master, target);
|
||||||
if (distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig->followDistance))
|
if (distanceToTarget > (botAI->GetRange("shoot") / 2 + sPlayerbotAIConfig.followDistance))
|
||||||
foundFlee = MoveNear(master);
|
foundFlee = MoveNear(master);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1813,12 +1809,11 @@ void MovementAction::DoMovePoint(Unit* unit, float x, float y, float z, bool gen
|
|||||||
if (!mm)
|
if (!mm)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// enable water walking
|
// bot water collision correction
|
||||||
if (unit->HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING))
|
if (unit->HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING) && unit->HasWaterWalkAura())
|
||||||
{
|
{
|
||||||
float gZ = unit->GetMapWaterOrGroundLevel(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
|
float gZ = unit->GetMapWaterOrGroundLevel(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
|
||||||
unit->UpdatePosition(unit->GetPositionX(), unit->GetPositionY(), gZ, false);
|
unit->UpdatePosition(unit->GetPositionX(), unit->GetPositionY(), gZ, false);
|
||||||
// z = gZ; no overwrite Z axe otherwise you cant steer the bots into swimming when water walking.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mm->Clear();
|
mm->Clear();
|
||||||
@@ -1844,17 +1839,16 @@ void MovementAction::DoMovePoint(Unit* unit, float x, float y, float z, bool gen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeAction::Execute(Event event)
|
bool FleeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
return MoveAway(AI_VALUE(Unit*, "current target"), sPlayerbotAIConfig->fleeDistance, true);
|
return MoveAway(AI_VALUE(Unit*, "current target"), sPlayerbotAIConfig.fleeDistance, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeAction::isUseful()
|
bool FleeAction::isUseful()
|
||||||
{
|
{
|
||||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (target && target->IsInWorld() && !bot->IsWithinMeleeRange(target))
|
if (target && target->IsInWorld() && !bot->IsWithinMeleeRange(target))
|
||||||
return false;
|
return false;
|
||||||
@@ -1862,12 +1856,10 @@ bool FleeAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeWithPetAction::Execute(Event event)
|
bool FleeWithPetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Pet* pet = bot->GetPet())
|
if (Pet* pet = bot->GetPet())
|
||||||
{
|
|
||||||
botAI->PetFollow();
|
botAI->PetFollow();
|
||||||
}
|
|
||||||
|
|
||||||
return Flee(AI_VALUE(Unit*, "current target"));
|
return Flee(AI_VALUE(Unit*, "current target"));
|
||||||
}
|
}
|
||||||
@@ -1875,15 +1867,14 @@ bool FleeWithPetAction::Execute(Event event)
|
|||||||
bool AvoidAoeAction::isUseful()
|
bool AvoidAoeAction::isUseful()
|
||||||
{
|
{
|
||||||
if (getMSTime() - moveInterval < lastMoveTimer)
|
if (getMSTime() - moveInterval < lastMoveTimer)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
GuidVector traps = AI_VALUE(GuidVector, "nearest trap with damage");
|
GuidVector traps = AI_VALUE(GuidVector, "nearest trap with damage");
|
||||||
GuidVector triggers = AI_VALUE(GuidVector, "possible triggers");
|
GuidVector triggers = AI_VALUE(GuidVector, "possible triggers");
|
||||||
return AI_VALUE(Aura*, "area debuff") || !traps.empty() || !triggers.empty();
|
return AI_VALUE(Aura*, "area debuff") || !traps.empty() || !triggers.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AvoidAoeAction::Execute(Event event)
|
bool AvoidAoeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Case #1: Aura with dynamic object (e.g. rain of fire)
|
// Case #1: Aura with dynamic object (e.g. rain of fire)
|
||||||
if (AvoidAuraWithDynamicObj())
|
if (AvoidAuraWithDynamicObj())
|
||||||
@@ -1924,8 +1915,8 @@ bool AvoidAoeAction::AvoidAuraWithDynamicObj()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sPlayerbotAIConfig->aoeAvoidSpellWhitelist.find(spellInfo->Id) !=
|
if (sPlayerbotAIConfig.aoeAvoidSpellWhitelist.find(spellInfo->Id) !=
|
||||||
sPlayerbotAIConfig->aoeAvoidSpellWhitelist.end())
|
sPlayerbotAIConfig.aoeAvoidSpellWhitelist.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DynamicObject* dynOwner = aura->GetDynobjOwner();
|
DynamicObject* dynOwner = aura->GetDynobjOwner();
|
||||||
@@ -1934,7 +1925,7 @@ bool AvoidAoeAction::AvoidAuraWithDynamicObj()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
float radius = dynOwner->GetRadius();
|
float radius = dynOwner->GetRadius();
|
||||||
if (!radius || radius > sPlayerbotAIConfig->maxAoeAvoidRadius)
|
if (!radius || radius > sPlayerbotAIConfig.maxAoeAvoidRadius)
|
||||||
return false;
|
return false;
|
||||||
if (bot->GetDistance(dynOwner) > radius)
|
if (bot->GetDistance(dynOwner) > radius)
|
||||||
{
|
{
|
||||||
@@ -1944,7 +1935,7 @@ bool AvoidAoeAction::AvoidAuraWithDynamicObj()
|
|||||||
name << spellInfo->SpellName[LOCALE_enUS]; // << "] (aura)";
|
name << spellInfo->SpellName[LOCALE_enUS]; // << "] (aura)";
|
||||||
if (FleePosition(dynOwner->GetPosition(), radius))
|
if (FleePosition(dynOwner->GetPosition(), radius))
|
||||||
{
|
{
|
||||||
if (sPlayerbotAIConfig->tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10)
|
if (sPlayerbotAIConfig.tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10)
|
||||||
{
|
{
|
||||||
lastTellTimer = time(NULL);
|
lastTellTimer = time(NULL);
|
||||||
lastMoveTimer = getMSTime();
|
lastMoveTimer = getMSTime();
|
||||||
@@ -1990,8 +1981,8 @@ bool AvoidAoeAction::AvoidGameObjectWithDamage()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig->aoeAvoidSpellWhitelist.find(spellId) !=
|
if (sPlayerbotAIConfig.aoeAvoidSpellWhitelist.find(spellId) !=
|
||||||
sPlayerbotAIConfig->aoeAvoidSpellWhitelist.end())
|
sPlayerbotAIConfig.aoeAvoidSpellWhitelist.end())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||||
@@ -2001,7 +1992,7 @@ bool AvoidAoeAction::AvoidGameObjectWithDamage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
float radius = (float)goInfo->trap.diameter / 2 + go->GetCombatReach();
|
float radius = (float)goInfo->trap.diameter / 2 + go->GetCombatReach();
|
||||||
if (!radius || radius > sPlayerbotAIConfig->maxAoeAvoidRadius)
|
if (!radius || radius > sPlayerbotAIConfig.maxAoeAvoidRadius)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (bot->GetDistance(go) > radius)
|
if (bot->GetDistance(go) > radius)
|
||||||
@@ -2012,7 +2003,7 @@ bool AvoidAoeAction::AvoidGameObjectWithDamage()
|
|||||||
name << spellInfo->SpellName[LOCALE_enUS]; // << "] (object)";
|
name << spellInfo->SpellName[LOCALE_enUS]; // << "] (object)";
|
||||||
if (FleePosition(go->GetPosition(), radius))
|
if (FleePosition(go->GetPosition(), radius))
|
||||||
{
|
{
|
||||||
if (sPlayerbotAIConfig->tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10)
|
if (sPlayerbotAIConfig.tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10)
|
||||||
{
|
{
|
||||||
lastTellTimer = time(NULL);
|
lastTellTimer = time(NULL);
|
||||||
lastMoveTimer = getMSTime();
|
lastMoveTimer = getMSTime();
|
||||||
@@ -2061,8 +2052,8 @@ bool AvoidAoeAction::AvoidUnitWithDamageAura()
|
|||||||
sSpellMgr->GetSpellInfo(spellInfo->Effects[aurEff->GetEffIndex()].TriggerSpell);
|
sSpellMgr->GetSpellInfo(spellInfo->Effects[aurEff->GetEffIndex()].TriggerSpell);
|
||||||
if (!triggerSpellInfo)
|
if (!triggerSpellInfo)
|
||||||
continue;
|
continue;
|
||||||
if (sPlayerbotAIConfig->aoeAvoidSpellWhitelist.find(triggerSpellInfo->Id) !=
|
if (sPlayerbotAIConfig.aoeAvoidSpellWhitelist.find(triggerSpellInfo->Id) !=
|
||||||
sPlayerbotAIConfig->aoeAvoidSpellWhitelist.end())
|
sPlayerbotAIConfig.aoeAvoidSpellWhitelist.end())
|
||||||
return false;
|
return false;
|
||||||
for (int j = 0; j < MAX_SPELL_EFFECTS; j++)
|
for (int j = 0; j < MAX_SPELL_EFFECTS; j++)
|
||||||
{
|
{
|
||||||
@@ -2073,13 +2064,13 @@ bool AvoidAoeAction::AvoidUnitWithDamageAura()
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!radius || radius > sPlayerbotAIConfig->maxAoeAvoidRadius)
|
if (!radius || radius > sPlayerbotAIConfig.maxAoeAvoidRadius)
|
||||||
continue;
|
continue;
|
||||||
std::ostringstream name;
|
std::ostringstream name;
|
||||||
name << triggerSpellInfo->SpellName[LOCALE_enUS]; //<< "] (unit)";
|
name << triggerSpellInfo->SpellName[LOCALE_enUS]; //<< "] (unit)";
|
||||||
if (FleePosition(unit->GetPosition(), radius))
|
if (FleePosition(unit->GetPosition(), radius))
|
||||||
{
|
{
|
||||||
if (sPlayerbotAIConfig->tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10)
|
if (sPlayerbotAIConfig.tellWhenAvoidAoe && lastTellTimer < time(NULL) - 10)
|
||||||
{
|
{
|
||||||
lastTellTimer = time(NULL);
|
lastTellTimer = time(NULL);
|
||||||
lastMoveTimer = getMSTime();
|
lastMoveTimer = getMSTime();
|
||||||
@@ -2134,7 +2125,7 @@ Position MovementAction::BestPositionForMeleeToFlee(Position pos, float radius)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool strict = checkAngle.strict;
|
bool strict = checkAngle.strict;
|
||||||
float fleeDis = std::min(radius + 1.0f, sPlayerbotAIConfig->fleeDistance);
|
float fleeDis = std::min(radius + 1.0f, sPlayerbotAIConfig.fleeDistance);
|
||||||
float dx = bot->GetPositionX() + cos(angle) * fleeDis;
|
float dx = bot->GetPositionX() + cos(angle) * fleeDis;
|
||||||
float dy = bot->GetPositionY() + sin(angle) * fleeDis;
|
float dy = bot->GetPositionY() + sin(angle) * fleeDis;
|
||||||
float dz = bot->GetPositionZ();
|
float dz = bot->GetPositionZ();
|
||||||
@@ -2146,7 +2137,7 @@ Position MovementAction::BestPositionForMeleeToFlee(Position pos, float radius)
|
|||||||
Position fleePos{dx, dy, dz};
|
Position fleePos{dx, dy, dz};
|
||||||
if (strict && currentTarget &&
|
if (strict && currentTarget &&
|
||||||
fleePos.GetExactDist(currentTarget) - currentTarget->GetCombatReach() >
|
fleePos.GetExactDist(currentTarget) - currentTarget->GetCombatReach() >
|
||||||
sPlayerbotAIConfig->tooCloseDistance &&
|
sPlayerbotAIConfig.tooCloseDistance &&
|
||||||
bot->IsWithinMeleeRange(currentTarget))
|
bot->IsWithinMeleeRange(currentTarget))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -2197,7 +2188,7 @@ Position MovementAction::BestPositionForRangedToFlee(Position pos, float radius)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool strict = checkAngle.strict;
|
bool strict = checkAngle.strict;
|
||||||
float fleeDis = std::min(radius + 1.0f, sPlayerbotAIConfig->fleeDistance);
|
float fleeDis = std::min(radius + 1.0f, sPlayerbotAIConfig.fleeDistance);
|
||||||
float dx = bot->GetPositionX() + cos(angle) * fleeDis;
|
float dx = bot->GetPositionX() + cos(angle) * fleeDis;
|
||||||
float dy = bot->GetPositionY() + sin(angle) * fleeDis;
|
float dy = bot->GetPositionY() + sin(angle) * fleeDis;
|
||||||
float dz = bot->GetPositionZ();
|
float dz = bot->GetPositionZ();
|
||||||
@@ -2208,13 +2199,13 @@ Position MovementAction::BestPositionForRangedToFlee(Position pos, float radius)
|
|||||||
}
|
}
|
||||||
Position fleePos{dx, dy, dz};
|
Position fleePos{dx, dy, dz};
|
||||||
if (strict && currentTarget &&
|
if (strict && currentTarget &&
|
||||||
fleePos.GetExactDist(currentTarget) - currentTarget->GetCombatReach() > sPlayerbotAIConfig->spellDistance)
|
fleePos.GetExactDist(currentTarget) - currentTarget->GetCombatReach() > sPlayerbotAIConfig.spellDistance)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strict && currentTarget &&
|
if (strict && currentTarget &&
|
||||||
fleePos.GetExactDist(currentTarget) - currentTarget->GetCombatReach() <
|
fleePos.GetExactDist(currentTarget) - currentTarget->GetCombatReach() <
|
||||||
(sPlayerbotAIConfig->tooCloseDistance))
|
(sPlayerbotAIConfig.tooCloseDistance))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2307,17 +2298,15 @@ bool MovementAction::CheckLastFlee(float curAngle, std::list<FleeInfo>& infoList
|
|||||||
bool CombatFormationMoveAction::isUseful()
|
bool CombatFormationMoveAction::isUseful()
|
||||||
{
|
{
|
||||||
if (getMSTime() - moveInterval < lastMoveTimer)
|
if (getMSTime() - moveInterval < lastMoveTimer)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CombatFormationMoveAction::Execute(Event event)
|
bool CombatFormationMoveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float dis = AI_VALUE(float, "disperse distance");
|
float dis = AI_VALUE(float, "disperse distance");
|
||||||
if (dis <= 0.0f || (!bot->IsInCombat() && botAI->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT)) ||
|
if (dis <= 0.0f || (!bot->IsInCombat() && botAI->HasStrategy("stay", BotState::BOT_STATE_NON_COMBAT)) ||
|
||||||
@@ -2357,7 +2346,7 @@ Position CombatFormationMoveAction::AverageGroupPos(float dis, bool ranged, bool
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!member->IsAlive() || member->GetMapId() != bot->GetMapId() || member->IsCharmed() ||
|
if (!member->IsAlive() || member->GetMapId() != bot->GetMapId() || member->IsCharmed() ||
|
||||||
sServerFacade->GetDistance2d(bot, member) > dis)
|
ServerFacade::instance().GetDistance2d(bot, member) > dis)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
averageX += member->GetPositionX();
|
averageX += member->GetPositionX();
|
||||||
@@ -2395,7 +2384,7 @@ float CombatFormationMoveAction::AverageGroupAngle(Unit* from, bool ranged, bool
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!member->IsAlive() || member->GetMapId() != bot->GetMapId() || member->IsCharmed() ||
|
if (!member->IsAlive() || member->GetMapId() != bot->GetMapId() || member->IsCharmed() ||
|
||||||
sServerFacade->GetDistance2d(bot, member) > sPlayerbotAIConfig->sightDistance)
|
ServerFacade::instance().GetDistance2d(bot, member) > sPlayerbotAIConfig.sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cnt++;
|
cnt++;
|
||||||
@@ -2437,7 +2426,7 @@ Player* CombatFormationMoveAction::NearestGroupMember(float dis)
|
|||||||
{
|
{
|
||||||
Player* member = ObjectAccessor::FindPlayer(itr->guid);
|
Player* member = ObjectAccessor::FindPlayer(itr->guid);
|
||||||
if (!member || !member->IsAlive() || member == bot || member->GetMapId() != bot->GetMapId() ||
|
if (!member || !member->IsAlive() || member == bot || member->GetMapId() != bot->GetMapId() ||
|
||||||
member->IsCharmed() || sServerFacade->GetDistance2d(bot, member) > dis)
|
member->IsCharmed() || ServerFacade::instance().GetDistance2d(bot, member) > dis)
|
||||||
continue;
|
continue;
|
||||||
if (nearestDis > bot->GetExactDist(member))
|
if (nearestDis > bot->GetExactDist(member))
|
||||||
{
|
{
|
||||||
@@ -2448,7 +2437,7 @@ Player* CombatFormationMoveAction::NearestGroupMember(float dis)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TankFaceAction::Execute(Event event)
|
bool TankFaceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -2532,7 +2521,7 @@ bool RearFlankAction::isUseful()
|
|||||||
return inFront || inRear;
|
return inFront || inRear;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RearFlankAction::Execute(Event event)
|
bool RearFlankAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -2643,29 +2632,29 @@ bool DisperseSetAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunAwayAction::Execute(Event event) { return Flee(AI_VALUE(Unit*, "group leader")); }
|
bool RunAwayAction::Execute(Event /*event*/) { return Flee(AI_VALUE(Unit*, "group leader")); }
|
||||||
|
|
||||||
bool MoveToLootAction::Execute(Event event)
|
bool MoveToLootAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
LootObject loot = AI_VALUE(LootObject, "loot target");
|
LootObject loot = AI_VALUE(LootObject, "loot target");
|
||||||
if (!loot.IsLootPossible(bot))
|
if (!loot.IsLootPossible(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return MoveNear(loot.GetWorldObject(bot), sPlayerbotAIConfig->contactDistance);
|
return MoveNear(loot.GetWorldObject(bot), sPlayerbotAIConfig.contactDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveOutOfEnemyContactAction::Execute(Event event)
|
bool MoveOutOfEnemyContactAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return MoveTo(target, sPlayerbotAIConfig->contactDistance);
|
return MoveTo(target, sPlayerbotAIConfig.contactDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveOutOfEnemyContactAction::isUseful() { return AI_VALUE2(bool, "inside target", "current target"); }
|
bool MoveOutOfEnemyContactAction::isUseful() { return AI_VALUE2(bool, "inside target", "current target"); }
|
||||||
|
|
||||||
bool SetFacingTargetAction::Execute(Event event)
|
bool SetFacingTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -2674,8 +2663,8 @@ bool SetFacingTargetAction::Execute(Event event)
|
|||||||
if (bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
if (bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
sServerFacade->SetFacingTo(bot, target);
|
ServerFacade::instance().SetFacingTo(bot, target);
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.reactDelay);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2691,7 +2680,7 @@ bool SetFacingTargetAction::isPossible()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetBehindTargetAction::Execute(Event event)
|
bool SetBehindTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -2751,10 +2740,10 @@ bool SetBehindTargetAction::Execute(Event event)
|
|||||||
false, true, MovementPriority::MOVEMENT_COMBAT);
|
false, true, MovementPriority::MOVEMENT_COMBAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveOutOfCollisionAction::Execute(Event event)
|
bool MoveOutOfCollisionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float angle = M_PI * 2000 / frand(1.f, 1000.f);
|
float angle = M_PI * 2000 / frand(1.f, 1000.f);
|
||||||
float distance = sPlayerbotAIConfig->followDistance;
|
float distance = sPlayerbotAIConfig.followDistance;
|
||||||
return MoveTo(bot->GetMapId(), bot->GetPositionX() + cos(angle) * distance,
|
return MoveTo(bot->GetMapId(), bot->GetPositionX() + cos(angle) * distance,
|
||||||
bot->GetPositionY() + sin(angle) * distance, bot->GetPositionZ());
|
bot->GetPositionY() + sin(angle) * distance, bot->GetPositionZ());
|
||||||
}
|
}
|
||||||
@@ -2769,9 +2758,9 @@ bool MoveOutOfCollisionAction::isUseful()
|
|||||||
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get().size() < 15;
|
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get().size() < 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveRandomAction::Execute(Event event)
|
bool MoveRandomAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float distance = sPlayerbotAIConfig->tooCloseDistance + urand(10, 30);
|
float distance = sPlayerbotAIConfig.tooCloseDistance + urand(10, 30);
|
||||||
|
|
||||||
Map* map = bot->GetMap();
|
Map* map = bot->GetMap();
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
@@ -2801,9 +2790,9 @@ bool MoveRandomAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveRandomAction::isUseful() { return !AI_VALUE(GuidPosition, "rpg target"); }
|
bool MoveRandomAction::isUseful() { return !AI_VALUE(GuidPosition, "rpg target"); }
|
||||||
|
|
||||||
bool MoveInsideAction::Execute(Event event) { return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance); }
|
bool MoveInsideAction::Execute(Event /*event*/) { return MoveInside(bot->GetMapId(), x, y, bot->GetPositionZ(), distance); }
|
||||||
|
|
||||||
bool RotateAroundTheCenterPointAction::Execute(Event event)
|
bool RotateAroundTheCenterPointAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 next_point = GetCurrWaypoint();
|
uint32 next_point = GetCurrWaypoint();
|
||||||
if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ(), false,
|
if (MoveTo(bot->GetMapId(), waypoints[next_point].first, waypoints[next_point].second, bot->GetPositionZ(), false,
|
||||||
@@ -2823,10 +2812,9 @@ bool MoveFromGroupAction::Execute(Event event)
|
|||||||
return MoveFromGroup(distance);
|
return MoveFromGroup(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveAwayFromCreatureAction::Execute(Event event)
|
bool MoveAwayFromCreatureAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector targets = AI_VALUE(GuidVector, "nearest npcs");
|
GuidVector targets = AI_VALUE(GuidVector, "nearest npcs");
|
||||||
Creature* nearestCreature = bot->FindNearestCreature(creatureId, range, alive);
|
|
||||||
|
|
||||||
// Find all creatures with the specified Id
|
// Find all creatures with the specified Id
|
||||||
std::vector<Unit*> creatures;
|
std::vector<Unit*> creatures;
|
||||||
@@ -2904,16 +2892,14 @@ bool MoveAwayFromCreatureAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveAwayFromCreatureAction::isPossible() { return bot->CanFreeMove(); }
|
bool MoveAwayFromCreatureAction::isPossible() { return bot->CanFreeMove(); }
|
||||||
|
|
||||||
bool MoveAwayFromPlayerWithDebuffAction::Execute(Event event)
|
bool MoveAwayFromPlayerWithDebuffAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* closestPlayer = nullptr;
|
Player* closestPlayer = nullptr;
|
||||||
float minDistance = 0.0f;
|
float minDistance = 0.0f;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Player*> debuffedPlayers;
|
std::vector<Player*> debuffedPlayers;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool JumpTo(uint32 mapId, float x, float y, float z, MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
bool JumpTo(uint32 mapId, float x, float y, float z, MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
||||||
bool MoveNear(uint32 mapId, float x, float y, float z, float distance = sPlayerbotAIConfig->contactDistance,
|
bool MoveNear(uint32 mapId, float x, float y, float z, float distance = sPlayerbotAIConfig.contactDistance,
|
||||||
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
||||||
bool MoveToLOS(WorldObject* target, bool ranged = false);
|
bool MoveToLOS(WorldObject* target, bool ranged = false);
|
||||||
bool MoveTo(uint32 mapId, float x, float y, float z, bool idle = false, bool react = false,
|
bool MoveTo(uint32 mapId, float x, float y, float z, bool idle = false, bool react = false,
|
||||||
@@ -38,10 +38,10 @@ protected:
|
|||||||
bool backwards = false);
|
bool backwards = false);
|
||||||
bool MoveTo(WorldObject* target, float distance = 0.0f,
|
bool MoveTo(WorldObject* target, float distance = 0.0f,
|
||||||
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
||||||
bool MoveNear(WorldObject* target, float distance = sPlayerbotAIConfig->contactDistance,
|
bool MoveNear(WorldObject* target, float distance = sPlayerbotAIConfig.contactDistance,
|
||||||
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
||||||
float GetFollowAngle();
|
float GetFollowAngle();
|
||||||
bool Follow(Unit* target, float distance = sPlayerbotAIConfig->followDistance);
|
bool Follow(Unit* target, float distance = sPlayerbotAIConfig.followDistance);
|
||||||
bool Follow(Unit* target, float distance, float angle);
|
bool Follow(Unit* target, float distance, float angle);
|
||||||
bool ChaseTo(WorldObject* obj, float distance = 0.0f, float angle = 0.0f);
|
bool ChaseTo(WorldObject* obj, float distance = 0.0f, float angle = 0.0f);
|
||||||
bool ReachCombatTo(Unit* target, float distance = 0.0f);
|
bool ReachCombatTo(Unit* target, float distance = 0.0f);
|
||||||
@@ -56,10 +56,10 @@ protected:
|
|||||||
bool Flee(Unit* target);
|
bool Flee(Unit* target);
|
||||||
void ClearIdleState();
|
void ClearIdleState();
|
||||||
void UpdateMovementState();
|
void UpdateMovementState();
|
||||||
bool MoveAway(Unit* target, float distance = sPlayerbotAIConfig->fleeDistance, bool backwards = false);
|
bool MoveAway(Unit* target, float distance = sPlayerbotAIConfig.fleeDistance, bool backwards = false);
|
||||||
bool MoveFromGroup(float distance);
|
bool MoveFromGroup(float distance);
|
||||||
bool Move(float angle, float distance);
|
bool Move(float angle, float distance);
|
||||||
bool MoveInside(uint32 mapId, float x, float y, float z, float distance = sPlayerbotAIConfig->followDistance,
|
bool MoveInside(uint32 mapId, float x, float y, float z, float distance = sPlayerbotAIConfig.followDistance,
|
||||||
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
MovementPriority priority = MovementPriority::MOVEMENT_NORMAL);
|
||||||
void CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important = false);
|
void CreateWp(Player* wpOwner, float x, float y, float z, float o, uint32 entry, bool important = false);
|
||||||
Position BestPositionForMeleeToFlee(Position pos, float radius);
|
Position BestPositionForMeleeToFlee(Position pos, float radius);
|
||||||
@@ -86,7 +86,7 @@ private:
|
|||||||
class FleeAction : public MovementAction
|
class FleeAction : public MovementAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FleeAction(PlayerbotAI* botAI, float distance = sPlayerbotAIConfig->spellDistance)
|
FleeAction(PlayerbotAI* botAI, float distance = sPlayerbotAIConfig.spellDistance)
|
||||||
: MovementAction(botAI, "flee"), distance(distance)
|
: MovementAction(botAI, "flee"), distance(distance)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -138,8 +138,8 @@ public:
|
|||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Position AverageGroupPos(float dis = sPlayerbotAIConfig->sightDistance, bool ranged = false, bool self = false);
|
Position AverageGroupPos(float dis = sPlayerbotAIConfig.sightDistance, bool ranged = false, bool self = false);
|
||||||
Player* NearestGroupMember(float dis = sPlayerbotAIConfig->sightDistance);
|
Player* NearestGroupMember(float dis = sPlayerbotAIConfig.sightDistance);
|
||||||
float AverageGroupAngle(Unit* from, bool ranged = false, bool self = false);
|
float AverageGroupAngle(Unit* from, bool ranged = false, bool self = false);
|
||||||
Position GetNearestPosition(const std::vector<Position>& positions);
|
Position GetNearestPosition(const std::vector<Position>& positions);
|
||||||
int lastMoveTimer = 0;
|
int lastMoveTimer = 0;
|
||||||
|
|||||||
@@ -49,18 +49,16 @@ bool DrinkAction::Execute(Event event)
|
|||||||
|
|
||||||
bool DrinkAction::isUseful()
|
bool DrinkAction::isUseful()
|
||||||
{
|
{
|
||||||
return UseItemAction::isUseful() &&
|
return UseItemAction::isUseful() && AI_VALUE2(bool, "has mana", "self target") &&
|
||||||
AI_VALUE2(bool, "has mana", "self target") &&
|
AI_VALUE2(uint8, "mana", "self target") < 100;
|
||||||
AI_VALUE2(uint8, "mana", "self target") < 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrinkAction::isPossible()
|
bool DrinkAction::isPossible()
|
||||||
{
|
{
|
||||||
return !bot->IsInCombat() &&
|
return !bot->IsInCombat() && !bot->IsMounted() &&
|
||||||
!bot->IsMounted() &&
|
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form",
|
||||||
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form",
|
"flight form", "swift flight form", nullptr) &&
|
||||||
"aquatic form","flight form", "swift flight form", nullptr) &&
|
(botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
|
||||||
(botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EatAction::Execute(Event event)
|
bool EatAction::Execute(Event event)
|
||||||
@@ -76,7 +74,7 @@ bool EatAction::Execute(Event event)
|
|||||||
if (bot->isMoving())
|
if (bot->isMoving())
|
||||||
{
|
{
|
||||||
bot->StopMoving();
|
bot->StopMoving();
|
||||||
// botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
|
// botAI->SetNextCheckDelay(sPlayerbotAIConfig.globalCoolDown);
|
||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,17 +100,12 @@ bool EatAction::Execute(Event event)
|
|||||||
return UseItemAction::Execute(event);
|
return UseItemAction::Execute(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EatAction::isUseful()
|
bool EatAction::isUseful() { return UseItemAction::isUseful() && AI_VALUE2(uint8, "health", "self target") < 100; }
|
||||||
{
|
|
||||||
return UseItemAction::isUseful() &&
|
|
||||||
AI_VALUE2(uint8, "health", "self target") < 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EatAction::isPossible()
|
bool EatAction::isPossible()
|
||||||
{
|
{
|
||||||
return !bot->IsInCombat() &&
|
return !bot->IsInCombat() && !bot->IsMounted() &&
|
||||||
!bot->IsMounted() &&
|
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form",
|
||||||
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form",
|
"flight form", "swift flight form", nullptr) &&
|
||||||
"aquatic form","flight form", "swift flight form", nullptr) &&
|
(botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
|
||||||
(botAI->HasCheat(BotCheatMask::food) || UseItemAction::isPossible());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "AiObjectContext.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool OpenItemAction::Execute(Event event)
|
bool OpenItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool foundOpenable = false;
|
bool foundOpenable = false;
|
||||||
|
|
||||||
|
|||||||
@@ -7,21 +7,20 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotOperations.h"
|
#include "PlayerbotOperations.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "PlayerbotWorldThreadProcessor.h"
|
#include "PlayerbotWorldThreadProcessor.h"
|
||||||
|
|
||||||
bool PassLeadershipToMasterAction::Execute(Event event)
|
bool PassLeadershipToMasterAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Player* master = GetMaster())
|
if (Player* master = GetMaster())
|
||||||
if (master && master != bot && bot->GetGroup() && bot->GetGroup()->IsMember(master->GetGUID()))
|
if (master && master != bot && bot->GetGroup() && bot->GetGroup()->IsMember(master->GetGUID()))
|
||||||
{
|
{
|
||||||
auto setLeaderOp = std::make_unique<GroupSetLeaderOperation>(bot->GetGUID(), master->GetGUID());
|
auto setLeaderOp = std::make_unique<GroupSetLeaderOperation>(bot->GetGUID(), master->GetGUID());
|
||||||
sPlayerbotWorldProcessor->QueueOperation(std::move(setLeaderOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(setLeaderOp));
|
||||||
|
|
||||||
if (!message.empty())
|
if (!message.empty())
|
||||||
botAI->TellMasterNoFacing(message);
|
botAI->TellMasterNoFacing(message);
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
botAI->Reset();
|
botAI->Reset();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ bool PetsAction::Execute(Event event)
|
|||||||
if (param.empty())
|
if (param.empty())
|
||||||
{
|
{
|
||||||
// If no parameter is provided, show usage instructions and return.
|
// If no parameter is provided, show usage instructions and return.
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_usage_error", "Usage: pet <aggressive|defensive|passive|stance|attack|follow|stay>", {});
|
"pet_usage_error", "Usage: pet <aggressive|defensive|passive|stance|attack|follow|stay>", {});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
return false;
|
return false;
|
||||||
@@ -52,7 +52,7 @@ bool PetsAction::Execute(Event event)
|
|||||||
// If no pets or guardians are found, notify and return.
|
// If no pets or guardians are found, notify and return.
|
||||||
if (targets.empty())
|
if (targets.empty())
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_no_pet_error", "You have no pet or guardian pet.", {});
|
"pet_no_pet_error", "You have no pet or guardian pet.", {});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
return false;
|
return false;
|
||||||
@@ -65,19 +65,19 @@ bool PetsAction::Execute(Event event)
|
|||||||
if (param == "aggressive")
|
if (param == "aggressive")
|
||||||
{
|
{
|
||||||
react = REACT_AGGRESSIVE;
|
react = REACT_AGGRESSIVE;
|
||||||
stanceText = sPlayerbotTextMgr->GetBotTextOrDefault(
|
stanceText = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_aggressive", "aggressive", {});
|
"pet_stance_aggressive", "aggressive", {});
|
||||||
}
|
}
|
||||||
else if (param == "defensive")
|
else if (param == "defensive")
|
||||||
{
|
{
|
||||||
react = REACT_DEFENSIVE;
|
react = REACT_DEFENSIVE;
|
||||||
stanceText = sPlayerbotTextMgr->GetBotTextOrDefault(
|
stanceText = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_defensive", "defensive", {});
|
"pet_stance_defensive", "defensive", {});
|
||||||
}
|
}
|
||||||
else if (param == "passive")
|
else if (param == "passive")
|
||||||
{
|
{
|
||||||
react = REACT_PASSIVE;
|
react = REACT_PASSIVE;
|
||||||
stanceText = sPlayerbotTextMgr->GetBotTextOrDefault(
|
stanceText = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_passive", "passive", {});
|
"pet_stance_passive", "passive", {});
|
||||||
}
|
}
|
||||||
// The "stance" command simply reports the current stance of each pet/guardian.
|
// The "stance" command simply reports the current stance of each pet/guardian.
|
||||||
@@ -86,30 +86,30 @@ bool PetsAction::Execute(Event event)
|
|||||||
for (Creature* target : targets)
|
for (Creature* target : targets)
|
||||||
{
|
{
|
||||||
std::string type = target->IsPet() ?
|
std::string type = target->IsPet() ?
|
||||||
sPlayerbotTextMgr->GetBotTextOrDefault("pet_type_pet", "pet", {}) :
|
PlayerbotTextMgr::instance().GetBotTextOrDefault("pet_type_pet", "pet", {}) :
|
||||||
sPlayerbotTextMgr->GetBotTextOrDefault("pet_type_guardian", "guardian", {});
|
PlayerbotTextMgr::instance().GetBotTextOrDefault("pet_type_guardian", "guardian", {});
|
||||||
std::string name = target->GetName();
|
std::string name = target->GetName();
|
||||||
std::string stance;
|
std::string stance;
|
||||||
switch (target->GetReactState())
|
switch (target->GetReactState())
|
||||||
{
|
{
|
||||||
case REACT_AGGRESSIVE:
|
case REACT_AGGRESSIVE:
|
||||||
stance = sPlayerbotTextMgr->GetBotTextOrDefault(
|
stance = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_aggressive", "aggressive", {});
|
"pet_stance_aggressive", "aggressive", {});
|
||||||
break;
|
break;
|
||||||
case REACT_DEFENSIVE:
|
case REACT_DEFENSIVE:
|
||||||
stance = sPlayerbotTextMgr->GetBotTextOrDefault(
|
stance = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_defensive", "defensive", {});
|
"pet_stance_defensive", "defensive", {});
|
||||||
break;
|
break;
|
||||||
case REACT_PASSIVE:
|
case REACT_PASSIVE:
|
||||||
stance = sPlayerbotTextMgr->GetBotTextOrDefault(
|
stance = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_passive", "passive", {});
|
"pet_stance_passive", "passive", {});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stance = sPlayerbotTextMgr->GetBotTextOrDefault(
|
stance = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_unknown", "unknown", {});
|
"pet_stance_unknown", "unknown", {});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_report", "Current stance of %type \"%name\": %stance.",
|
"pet_stance_report", "Current stance of %type \"%name\": %stance.",
|
||||||
{{"type", type}, {"name", name}, {"stance", stance}});
|
{{"type", type}, {"name", name}, {"stance", stance}});
|
||||||
botAI->TellMaster(text);
|
botAI->TellMaster(text);
|
||||||
@@ -133,30 +133,30 @@ bool PetsAction::Execute(Event event)
|
|||||||
// If no valid target is selected, show an error and return.
|
// If no valid target is selected, show an error and return.
|
||||||
if (!targetUnit)
|
if (!targetUnit)
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_no_target_error", "No valid target selected by master.", {});
|
"pet_no_target_error", "No valid target selected by master.", {});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!targetUnit->IsAlive())
|
if (!targetUnit->IsAlive())
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_target_dead_error", "Target is not alive.", {});
|
"pet_target_dead_error", "Target is not alive.", {});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!bot->IsValidAttackTarget(targetUnit))
|
if (!bot->IsValidAttackTarget(targetUnit))
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_invalid_target_error", "Target is not a valid attack target for the bot.", {});
|
"pet_invalid_target_error", "Target is not a valid attack target for the bot.", {});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId()) &&
|
if (sPlayerbotAIConfig.IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId()) &&
|
||||||
(targetUnit->IsPlayer() || targetUnit->IsPet()) &&
|
(targetUnit->IsPlayer() || targetUnit->IsPet()) &&
|
||||||
(!bot->duel || bot->duel->Opponent != targetUnit))
|
(!bot->duel || bot->duel->Opponent != targetUnit))
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_pvp_prohibited_error", "I cannot command my pet to attack players in PvP prohibited areas.", {});
|
"pet_pvp_prohibited_error", "I cannot command my pet to attack players in PvP prohibited areas.", {});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
return false;
|
return false;
|
||||||
@@ -208,15 +208,15 @@ bool PetsAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Inform the master if the command succeeded or failed.
|
// Inform the master if the command succeeded or failed.
|
||||||
if (didAttack && sPlayerbotAIConfig->petChatCommandDebug == 1)
|
if (didAttack && sPlayerbotAIConfig.petChatCommandDebug == 1)
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_attack_success", "Pet commanded to attack your target.", {});
|
"pet_attack_success", "Pet commanded to attack your target.", {});
|
||||||
botAI->TellMaster(text);
|
botAI->TellMaster(text);
|
||||||
}
|
}
|
||||||
else if (!didAttack)
|
else if (!didAttack)
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_attack_failed", "Pet did not attack. (Already attacking or unable to attack target)", {});
|
"pet_attack_failed", "Pet did not attack. (Already attacking or unable to attack target)", {});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
}
|
}
|
||||||
@@ -226,9 +226,9 @@ bool PetsAction::Execute(Event event)
|
|||||||
else if (param == "follow")
|
else if (param == "follow")
|
||||||
{
|
{
|
||||||
botAI->PetFollow();
|
botAI->PetFollow();
|
||||||
if (sPlayerbotAIConfig->petChatCommandDebug == 1)
|
if (sPlayerbotAIConfig.petChatCommandDebug == 1)
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_follow_success", "Pet commanded to follow.", {});
|
"pet_follow_success", "Pet commanded to follow.", {});
|
||||||
botAI->TellMaster(text);
|
botAI->TellMaster(text);
|
||||||
}
|
}
|
||||||
@@ -267,9 +267,9 @@ bool PetsAction::Execute(Event event)
|
|||||||
charmInfo->SetForcedTargetGUID();
|
charmInfo->SetForcedTargetGUID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sPlayerbotAIConfig->petChatCommandDebug == 1)
|
if (sPlayerbotAIConfig.petChatCommandDebug == 1)
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stay_success", "Pet commanded to stay.", {});
|
"pet_stay_success", "Pet commanded to stay.", {});
|
||||||
botAI->TellMaster(text);
|
botAI->TellMaster(text);
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ bool PetsAction::Execute(Event event)
|
|||||||
// Unknown command: show usage instructions and return.
|
// Unknown command: show usage instructions and return.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_unknown_command_error", "Unknown pet command: %param. Use: pet <aggressive|defensive|passive|stance|attack|follow|stay>",
|
"pet_unknown_command_error", "Unknown pet command: %param. Use: pet <aggressive|defensive|passive|stance|attack|follow|stay>",
|
||||||
{{"param", param}});
|
{{"param", param}});
|
||||||
botAI->TellError(text);
|
botAI->TellError(text);
|
||||||
@@ -295,13 +295,13 @@ bool PetsAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inform the master of the new stance if debug is enabled.
|
// Inform the master of the new stance if debug is enabled.
|
||||||
if (sPlayerbotAIConfig->petChatCommandDebug == 1)
|
if (sPlayerbotAIConfig.petChatCommandDebug == 1)
|
||||||
{
|
{
|
||||||
std::string text = sPlayerbotTextMgr->GetBotTextOrDefault(
|
std::string text = PlayerbotTextMgr::instance().GetBotTextOrDefault(
|
||||||
"pet_stance_set_success", "Pet stance set to %stance.",
|
"pet_stance_set_success", "Pet stance set to %stance.",
|
||||||
{{"stance", stanceText}});
|
{{"stance", stanceText}});
|
||||||
botAI->TellMaster(text);
|
botAI->TellMaster(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "PlayerbotFactory.h"
|
|
||||||
#include "Unit.h"
|
|
||||||
|
|
||||||
class PlayerbotAI;
|
class PlayerbotAI;
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ bool PositionAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveToPositionAction::Execute(Event event)
|
bool MoveToPositionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
||||||
if (!pos.isSet())
|
if (!pos.isSet())
|
||||||
@@ -120,10 +120,10 @@ bool MoveToPositionAction::isUseful()
|
|||||||
{
|
{
|
||||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
||||||
float distance = AI_VALUE2(float, "distance", std::string("position_") + qualifier);
|
float distance = AI_VALUE2(float, "distance", std::string("position_") + qualifier);
|
||||||
return pos.isSet() && distance > sPlayerbotAIConfig->followDistance && distance < sPlayerbotAIConfig->reactDistance;
|
return pos.isSet() && distance > sPlayerbotAIConfig.followDistance && distance < sPlayerbotAIConfig.reactDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetReturnPositionAction::Execute(Event event)
|
bool SetReturnPositionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
||||||
PositionInfo returnPos = posMap["return"];
|
PositionInfo returnPos = posMap["return"];
|
||||||
@@ -131,7 +131,7 @@ bool SetReturnPositionAction::Execute(Event event)
|
|||||||
if (returnPos.isSet() && !randomPos.isSet())
|
if (returnPos.isSet() && !randomPos.isSet())
|
||||||
{
|
{
|
||||||
float angle = 2 * M_PI * urand(0, 1000) / 100.0f;
|
float angle = 2 * M_PI * urand(0, 1000) / 100.0f;
|
||||||
float dist = sPlayerbotAIConfig->followDistance * urand(0, 1000) / 1000.0f;
|
float dist = sPlayerbotAIConfig.followDistance * urand(0, 1000) / 1000.0f;
|
||||||
float x = returnPos.x + cos(angle) * dist;
|
float x = returnPos.x + cos(angle) * dist;
|
||||||
float y = returnPos.y + sin(angle) * dist;
|
float y = returnPos.y + sin(angle) * dist;
|
||||||
float z = bot->GetPositionZ();
|
float z = bot->GetPositionZ();
|
||||||
@@ -157,7 +157,7 @@ bool SetReturnPositionAction::isUseful()
|
|||||||
bool ReturnAction::isUseful()
|
bool ReturnAction::isUseful()
|
||||||
{
|
{
|
||||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
||||||
return pos.isSet() && AI_VALUE2(float, "distance", "position_random") > sPlayerbotAIConfig->followDistance;
|
return pos.isSet() && AI_VALUE2(float, "distance", "position_random") > sPlayerbotAIConfig.followDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReturnToStayPositionAction::isPossible()
|
bool ReturnToStayPositionAction::isPossible()
|
||||||
@@ -167,7 +167,7 @@ bool ReturnToStayPositionAction::isPossible()
|
|||||||
if (stayPosition.isSet())
|
if (stayPosition.isSet())
|
||||||
{
|
{
|
||||||
const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z);
|
const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z);
|
||||||
if (distance > sPlayerbotAIConfig->reactDistance)
|
if (distance > sPlayerbotAIConfig.reactDistance)
|
||||||
{
|
{
|
||||||
botAI->TellMaster("The stay position is too far to return. I am going to stay where I am now");
|
botAI->TellMaster("The stay position is too far to return. I am going to stay where I am now");
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ std::string const QueryItemUsageAction::QueryItemUsage(ItemTemplate const* item)
|
|||||||
|
|
||||||
std::string const QueryItemUsageAction::QueryItemPrice(ItemTemplate const* item)
|
std::string const QueryItemUsageAction::QueryItemPrice(ItemTemplate const* item)
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (item->Bonding == BIND_WHEN_PICKED_UP)
|
if (item->Bonding == BIND_WHEN_PICKED_UP)
|
||||||
@@ -133,7 +133,7 @@ std::string const QueryItemUsageAction::QueryItemPrice(ItemTemplate const* item)
|
|||||||
{
|
{
|
||||||
Item* sell = *i;
|
Item* sell = *i;
|
||||||
int32 price =
|
int32 price =
|
||||||
sell->GetCount() * sell->GetTemplate()->SellPrice * sRandomPlayerbotMgr->GetSellMultiplier(bot);
|
sell->GetCount() * sell->GetTemplate()->SellPrice * sRandomPlayerbotMgr.GetSellMultiplier(bot);
|
||||||
if (!sellPrice || sellPrice > price)
|
if (!sellPrice || sellPrice > price)
|
||||||
sellPrice = price;
|
sellPrice = price;
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ std::string const QueryItemUsageAction::QueryItemPrice(ItemTemplate const* item)
|
|||||||
if (usage == ITEM_USAGE_NONE)
|
if (usage == ITEM_USAGE_NONE)
|
||||||
return msg.str();
|
return msg.str();
|
||||||
|
|
||||||
int32 buyPrice = item->BuyPrice * sRandomPlayerbotMgr->GetBuyMultiplier(bot);
|
int32 buyPrice = item->BuyPrice * sRandomPlayerbotMgr.GetBuyMultiplier(bot);
|
||||||
if (buyPrice)
|
if (buyPrice)
|
||||||
{
|
{
|
||||||
if (sellPrice)
|
if (sellPrice)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
void QueryQuestAction::TellObjective(std::string const name, uint32 available, uint32 required)
|
void QueryQuestAction::TellObjective(std::string const name, uint32 available, uint32 required)
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ bool QueryQuestAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
uint32 limit = 0;
|
uint32 limit = 0;
|
||||||
std::vector<TravelDestination*> allDestinations =
|
std::vector<TravelDestination*> allDestinations =
|
||||||
sTravelMgr->getQuestTravelDestinations(bot, questId, true, true, -1);
|
TravelMgr::instance().getQuestTravelDestinations(bot, questId, true, true, -1);
|
||||||
|
|
||||||
std::sort(allDestinations.begin(), allDestinations.end(), [ptr_botpos](TravelDestination* i, TravelDestination* j) {return i->distanceTo(ptr_botpos) < j->distanceTo(ptr_botpos); });
|
std::sort(allDestinations.begin(), allDestinations.end(), [ptr_botpos](TravelDestination* i, TravelDestination* j) {return i->distanceTo(ptr_botpos) < j->distanceTo(ptr_botpos); });
|
||||||
for (auto dest : allDestinations)
|
for (auto dest : allDestinations)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "QuestAction.h"
|
#include "QuestAction.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
@@ -116,7 +117,8 @@ bool QuestAction::CompleteQuest(Player* player, uint32 entry)
|
|||||||
player->CastedCreatureOrGO(creature, ObjectGuid(), spell_id);
|
player->CastedCreatureOrGO(creature, ObjectGuid(), spell_id);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
/*else*/ if (creature > 0)
|
/*else*/
|
||||||
|
if (creature > 0)
|
||||||
{
|
{
|
||||||
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature))
|
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature))
|
||||||
for (uint16 z = 0; z < creaturecount; ++z)
|
for (uint16 z = 0; z < creaturecount; ++z)
|
||||||
@@ -182,7 +184,7 @@ bool QuestAction::ProcessQuests(WorldObject* questGiver)
|
|||||||
{
|
{
|
||||||
ObjectGuid guid = questGiver->GetGUID();
|
ObjectGuid guid = questGiver->GetGUID();
|
||||||
|
|
||||||
if (bot->GetDistance(questGiver) > INTERACTION_DISTANCE && !sPlayerbotAIConfig->syncQuestWithPlayer)
|
if (bot->GetDistance(questGiver) > INTERACTION_DISTANCE && !sPlayerbotAIConfig.syncQuestWithPlayer)
|
||||||
{
|
{
|
||||||
//if (botAI->HasStrategy("debug", BotState::BOT_STATE_COMBAT) || botAI->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT))
|
//if (botAI->HasStrategy("debug", BotState::BOT_STATE_COMBAT) || botAI->HasStrategy("debug", BotState::BOT_STATE_NON_COMBAT))
|
||||||
|
|
||||||
@@ -190,7 +192,7 @@ bool QuestAction::ProcessQuests(WorldObject* questGiver)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, questGiver, sPlayerbotAIConfig->sightDistance))
|
if (!bot->HasInArc(CAST_ANGLE_IN_FRONT, questGiver, sPlayerbotAIConfig.sightDistance))
|
||||||
bot->SetFacingToObject(questGiver);
|
bot->SetFacingToObject(questGiver);
|
||||||
|
|
||||||
bot->SetTarget(guid);
|
bot->SetTarget(guid);
|
||||||
@@ -238,7 +240,7 @@ bool QuestAction::AcceptQuest(Quest const* quest, ObjectGuid questGiver)
|
|||||||
p.rpos(0);
|
p.rpos(0);
|
||||||
bot->GetSession()->HandleQuestgiverAcceptQuestOpcode(p);
|
bot->GetSession()->HandleQuestgiverAcceptQuestOpcode(p);
|
||||||
|
|
||||||
if (bot->GetQuestStatus(questId) == QUEST_STATUS_NONE && sPlayerbotAIConfig->syncQuestWithPlayer)
|
if (bot->GetQuestStatus(questId) == QUEST_STATUS_NONE && sPlayerbotAIConfig.syncQuestWithPlayer)
|
||||||
{
|
{
|
||||||
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*bot, questGiver,
|
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*bot, questGiver,
|
||||||
TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
||||||
@@ -366,7 +368,7 @@ bool QuestUpdateAddItemAction::Execute(Event event)
|
|||||||
placeholders["%quest_obj_required"] = std::to_string(requiredItemsCount);
|
placeholders["%quest_obj_required"] = std::to_string(requiredItemsCount);
|
||||||
if (botAI->HasStrategy("debug quest", BotState::BOT_STATE_COMBAT) || botAI->HasStrategy("debug quest", BotState::BOT_STATE_NON_COMBAT))
|
if (botAI->HasStrategy("debug quest", BotState::BOT_STATE_COMBAT) || botAI->HasStrategy("debug quest", BotState::BOT_STATE_NON_COMBAT))
|
||||||
{
|
{
|
||||||
const auto text = BOT_TEXT2("%quest_link - %item_link %quest_obj_available/%quest_obj_required", placeholders);
|
const auto text = PlayerbotTextMgr::instance().GetBotText("%quest_link - %item_link %quest_obj_available/%quest_obj_required", placeholders);
|
||||||
botAI->Say(text);
|
botAI->Say(text);
|
||||||
LOG_INFO("playerbots", "{} => {}", bot->GetName(), text);
|
LOG_INFO("playerbots", "{} => {}", bot->GetName(), text);
|
||||||
}
|
}
|
||||||
@@ -432,7 +434,7 @@ bool QuestItemPushResultAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestUpdateFailedAction::Execute(Event event)
|
bool QuestUpdateFailedAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
//opcode SMSG_QUESTUPDATE_FAILED is never sent...(yet?)
|
//opcode SMSG_QUESTUPDATE_FAILED is never sent...(yet?)
|
||||||
return false;
|
return false;
|
||||||
@@ -454,7 +456,7 @@ bool QuestUpdateFailedTimerAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
std::map<std::string, std::string> placeholders;
|
std::map<std::string, std::string> placeholders;
|
||||||
placeholders["%quest_link"] = botAI->GetChatHelper()->FormatQuest(qInfo);
|
placeholders["%quest_link"] = botAI->GetChatHelper()->FormatQuest(qInfo);
|
||||||
botAI->TellMaster(BOT_TEXT2("Failed timer for %quest_link, abandoning", placeholders));
|
botAI->TellMaster(PlayerbotTextMgr::instance().GetBotText("Failed timer for %quest_link, abandoning", placeholders));
|
||||||
BroadcastHelper::BroadcastQuestUpdateFailedTimer(botAI, bot, qInfo);
|
BroadcastHelper::BroadcastQuestUpdateFailedTimer(botAI, bot, qInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ bool QuestConfirmAcceptAction::Execute(Event event)
|
|||||||
botAI->TellMaster(out);
|
botAI->TellMaster(out);
|
||||||
bot->GetSession()->HandleQuestConfirmAccept(sendPacket);
|
bot->GetSession()->HandleQuestConfirmAccept(sendPacket);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ public:
|
|||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool RandomBotUpdateAction::Execute(Event event)
|
bool RandomBotUpdateAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr->IsRandomBot(bot))
|
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bot->GetGroup() && botAI->GetGroupLeader())
|
if (bot->GetGroup() && botAI->GetGroupLeader())
|
||||||
@@ -20,10 +20,10 @@ bool RandomBotUpdateAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (botAI->HasPlayerNearby(sPlayerbotAIConfig->grindDistance))
|
if (botAI->HasPlayerNearby(sPlayerbotAIConfig.grindDistance))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return sRandomPlayerbotMgr->ProcessBot(bot);
|
return sRandomPlayerbotMgr.ProcessBot(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RandomBotUpdateAction::isUseful() { return AI_VALUE(bool, "random bot update"); }
|
bool RandomBotUpdateAction::isUseful() { return AI_VALUE(bool, "random bot update"); }
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
bool ReachTargetAction::Execute(Event event) { return ReachCombatTo(AI_VALUE(Unit*, GetTargetName()), distance); }
|
bool ReachTargetAction::Execute(Event /*event*/) { return ReachCombatTo(AI_VALUE(Unit*, GetTargetName()), distance); }
|
||||||
|
|
||||||
bool ReachTargetAction::isUseful()
|
bool ReachTargetAction::isUseful()
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ bool ReachTargetAction::isUseful()
|
|||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
// float dis = distance + CONTACT_DISTANCE;
|
// float dis = distance + CONTACT_DISTANCE;
|
||||||
return target &&
|
return target &&
|
||||||
!bot->IsWithinCombatRange(target, distance); // sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float,
|
!bot->IsWithinCombatRange(target, distance); // ServerFacade::instance().IsDistanceGreaterThan(AI_VALUE2(float,
|
||||||
// "distance", GetTargetName()), distance);
|
// "distance", GetTargetName()), distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,8 +42,8 @@ bool CastReachTargetSpellAction::isUseful()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"),
|
return ServerFacade::instance().IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"),
|
||||||
(distance + sPlayerbotAIConfig->contactDistance));
|
(distance + sPlayerbotAIConfig.contactDistance));
|
||||||
}
|
}
|
||||||
|
|
||||||
ReachSpellAction::ReachSpellAction(PlayerbotAI* botAI)
|
ReachSpellAction::ReachSpellAction(PlayerbotAI* botAI)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ protected:
|
|||||||
class ReachMeleeAction : public ReachTargetAction
|
class ReachMeleeAction : public ReachTargetAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ReachMeleeAction(PlayerbotAI* botAI) : ReachTargetAction(botAI, "reach melee", sPlayerbotAIConfig->meleeDistance) {}
|
ReachMeleeAction(PlayerbotAI* botAI) : ReachTargetAction(botAI, "reach melee", sPlayerbotAIConfig.meleeDistance) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReachSpellAction : public ReachTargetAction
|
class ReachSpellAction : public ReachTargetAction
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class HealthChecker : public ReadyChecker
|
|||||||
public:
|
public:
|
||||||
bool Check(PlayerbotAI* botAI, AiObjectContext* context) override
|
bool Check(PlayerbotAI* botAI, AiObjectContext* context) override
|
||||||
{
|
{
|
||||||
return AI_VALUE2(uint8, "health", "self target") > sPlayerbotAIConfig->almostFullHealth;
|
return AI_VALUE2(uint8, "health", "self target") > sPlayerbotAIConfig.almostFullHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const getName() override { return "HP"; }
|
std::string const getName() override { return "HP"; }
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
bool Check(PlayerbotAI* botAI, AiObjectContext* context) override
|
bool Check(PlayerbotAI* botAI, AiObjectContext* context) override
|
||||||
{
|
{
|
||||||
return !AI_VALUE2(bool, "has mana", "self target") ||
|
return !AI_VALUE2(bool, "has mana", "self target") ||
|
||||||
AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig->mediumHealth;
|
AI_VALUE2(uint8, "mana", "self target") > sPlayerbotAIConfig.mediumHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const getName() override { return "MP"; }
|
std::string const getName() override { return "MP"; }
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
Player* bot = botAI->GetBot();
|
Player* bot = botAI->GetBot();
|
||||||
if (Player* master = botAI->GetMaster())
|
if (Player* master = botAI->GetMaster())
|
||||||
{
|
{
|
||||||
bool distance = bot->GetDistance(master) <= sPlayerbotAIConfig->sightDistance;
|
bool distance = bot->GetDistance(master) <= sPlayerbotAIConfig.sightDistance;
|
||||||
if (!distance)
|
if (!distance)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void ReleaseSpiritAction::LogRelease(const std::string& releaseMsg, bool isAutoR
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AutoReleaseSpiritAction implementation
|
// AutoReleaseSpiritAction implementation
|
||||||
bool AutoReleaseSpiritAction::Execute(Event event)
|
bool AutoReleaseSpiritAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
IncrementDeathCount();
|
IncrementDeathCount();
|
||||||
bot->DurabilityRepairAll(false, 1.0f, false);
|
bot->DurabilityRepairAll(false, 1.0f, false);
|
||||||
@@ -183,9 +183,9 @@ bool AutoReleaseSpiritAction::ShouldAutoRelease() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sServerFacade->IsDistanceGreaterThan(
|
return ServerFacade::instance().IsDistanceGreaterThan(
|
||||||
AI_VALUE2(float, "distance", "group leader"),
|
AI_VALUE2(float, "distance", "group leader"),
|
||||||
sPlayerbotAIConfig->sightDistance);
|
sPlayerbotAIConfig.sightDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoReleaseSpiritAction::ShouldDelayBattlegroundRelease() const
|
bool AutoReleaseSpiritAction::ShouldDelayBattlegroundRelease() const
|
||||||
@@ -214,7 +214,7 @@ bool AutoReleaseSpiritAction::ShouldDelayBattlegroundRelease() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RepopAction::Execute(Event event)
|
bool RepopAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
const GraveyardStruct* graveyard = GetGrave(
|
const GraveyardStruct* graveyard = GetGrave(
|
||||||
AI_VALUE(uint32, "death count") > 10 ||
|
AI_VALUE(uint32, "death count") > 10 ||
|
||||||
@@ -250,7 +250,7 @@ void RepopAction::PerformGraveyardTeleport(const GraveyardStruct* graveyard) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelfResurrectAction implementation for Warlock's Soulstone Resurrection/Shaman's Reincarnation
|
// SelfResurrectAction implementation for Warlock's Soulstone Resurrection/Shaman's Reincarnation
|
||||||
bool SelfResurrectAction::Execute(Event event)
|
bool SelfResurrectAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->IsAlive() && bot->GetUInt32Value(PLAYER_SELF_RES_SPELL))
|
if (!bot->IsAlive() && bot->GetUInt32Value(PLAYER_SELF_RES_SPELL))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool RememberTaxiAction::Execute(Event event)
|
bool RememberTaxiAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool RepairAllAction::Execute(Event event)
|
bool RepairAllAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
||||||
for (ObjectGuid const guid : npcs)
|
for (ObjectGuid const guid : npcs)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ bool ResetAiAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sPlayerbotRepository->Reset(botAI);
|
PlayerbotRepository::instance().Reset(botAI);
|
||||||
botAI->ResetStrategies(false);
|
botAI->ResetStrategies(false);
|
||||||
botAI->TellMaster("AI was reset to defaults");
|
botAI->TellMaster("AI was reset to defaults");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -5,14 +5,13 @@
|
|||||||
|
|
||||||
#include "ResetInstancesAction.h"
|
#include "ResetInstancesAction.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool ResetInstancesAction::Execute(Event event)
|
bool ResetInstancesAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket packet(CMSG_RESET_INSTANCES, 0);
|
WorldPacket packet(CMSG_RESET_INSTANCES, 0);
|
||||||
bot->GetSession()->HandleResetInstancesOpcode(packet);
|
bot->GetSession()->HandleResetInstancesOpcode(packet);
|
||||||
|
|
||||||
botAI->TellMaster("Resetting all instances");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,26 +10,26 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "NearestGameObjects.h"
|
#include "NearestGameObjects.h"
|
||||||
|
|
||||||
bool RevealGatheringItemAction::Execute(Event event)
|
bool RevealGatheringItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->GetGroup())
|
if (!bot->GetGroup())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::list<GameObject*> targets;
|
std::list<GameObject*> targets;
|
||||||
AnyGameObjectInObjectRangeCheck u_check(bot, sPlayerbotAIConfig->grindDistance);
|
AnyGameObjectInObjectRangeCheck u_check(bot, sPlayerbotAIConfig.grindDistance);
|
||||||
Acore::GameObjectListSearcher<AnyGameObjectInObjectRangeCheck> searcher(bot, targets, u_check);
|
Acore::GameObjectListSearcher<AnyGameObjectInObjectRangeCheck> searcher(bot, targets, u_check);
|
||||||
Cell::VisitObjects(bot, searcher, sPlayerbotAIConfig->reactDistance);
|
Cell::VisitObjects(bot, searcher, sPlayerbotAIConfig.reactDistance);
|
||||||
|
|
||||||
std::vector<GameObject*> result;
|
std::vector<GameObject*> result;
|
||||||
for (GameObject* go : targets)
|
for (GameObject* go : targets)
|
||||||
{
|
{
|
||||||
if (!go || !go->isSpawned() ||
|
if (!go || !go->isSpawned() ||
|
||||||
sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, go),
|
ServerFacade::instance().IsDistanceLessOrEqualThan(ServerFacade::instance().GetDistance2d(bot, go),
|
||||||
sPlayerbotAIConfig->lootDistance))
|
sPlayerbotAIConfig.lootDistance))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->GetLockId()))
|
if (LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->GetLockId()))
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "FleeManager.h"
|
#include "FleeManager.h"
|
||||||
#include "GameGraveyard.h"
|
#include "GameGraveyard.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "PlayerbotFactory.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
@@ -24,8 +23,8 @@ bool ReviveFromCorpseAction::Execute(Event event)
|
|||||||
WorldPacket& p = event.getPacket();
|
WorldPacket& p = event.getPacket();
|
||||||
if (!p.empty() && p.GetOpcode() == CMSG_RECLAIM_CORPSE && groupLeader && !corpse && bot->IsAlive())
|
if (!p.empty() && p.GetOpcode() == CMSG_RECLAIM_CORPSE && groupLeader && !corpse && bot->IsAlive())
|
||||||
{
|
{
|
||||||
if (sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
if (ServerFacade::instance().IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
||||||
sPlayerbotAIConfig->farDistance))
|
sPlayerbotAIConfig.farDistance))
|
||||||
{
|
{
|
||||||
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
if (!botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))
|
||||||
{
|
{
|
||||||
@@ -46,8 +45,8 @@ bool ReviveFromCorpseAction::Execute(Event event)
|
|||||||
if (groupLeader)
|
if (groupLeader)
|
||||||
{
|
{
|
||||||
if (!GET_PLAYERBOT_AI(groupLeader) && groupLeader->isDead() && groupLeader->GetCorpse() &&
|
if (!GET_PLAYERBOT_AI(groupLeader) && groupLeader->isDead() && groupLeader->GetCorpse() &&
|
||||||
sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
ServerFacade::instance().IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
||||||
sPlayerbotAIConfig->farDistance))
|
sPlayerbotAIConfig.farDistance))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +73,7 @@ bool ReviveFromCorpseAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindCorpseAction::Execute(Event event)
|
bool FindCorpseAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
return false;
|
return false;
|
||||||
@@ -87,8 +86,8 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
// if (groupLeader)
|
// if (groupLeader)
|
||||||
// {
|
// {
|
||||||
// if (!GET_PLAYERBOT_AI(groupLeader) &&
|
// if (!GET_PLAYERBOT_AI(groupLeader) &&
|
||||||
// sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
// ServerFacade::instance().IsDistanceLessThan(AI_VALUE2(float, "distance", "group leader"),
|
||||||
// sPlayerbotAIConfig->farDistance)) return false;
|
// sPlayerbotAIConfig.farDistance)) return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
uint32 dCount = AI_VALUE(uint32, "death count");
|
uint32 dCount = AI_VALUE(uint32, "death count");
|
||||||
@@ -101,8 +100,8 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
// bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
// bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||||
// bot->GetName().c_str());
|
// bot->GetName().c_str());
|
||||||
context->GetValue<uint32>("death count")->Set(0);
|
context->GetValue<uint32>("death count")->Set(0);
|
||||||
// sRandomPlayerbotMgr->RandomTeleportForLevel(bot);
|
// sRandomPlayerbotMgr.RandomTeleportForLevel(bot);
|
||||||
sRandomPlayerbotMgr->Revive(bot);
|
sRandomPlayerbotMgr.Revive(bot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +122,7 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
if (moveToLeader) // We are near group leader.
|
if (moveToLeader) // We are near group leader.
|
||||||
{
|
{
|
||||||
if (botPos.fDist(leaderPos) < sPlayerbotAIConfig->spellDistance)
|
if (botPos.fDist(leaderPos) < sPlayerbotAIConfig.spellDistance)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (deadTime > 8 * MINUTE) // We have walked too long already.
|
else if (deadTime > 8 * MINUTE) // We have walked too long already.
|
||||||
@@ -138,7 +137,7 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we are getting close move to a save ressurrection spot instead of just the corpse.
|
// If we are getting close move to a save ressurrection spot instead of just the corpse.
|
||||||
if (corpseDist < sPlayerbotAIConfig->reactDistance)
|
if (corpseDist < sPlayerbotAIConfig.reactDistance)
|
||||||
{
|
{
|
||||||
if (moveToLeader)
|
if (moveToLeader)
|
||||||
moveToPos = leaderPos;
|
moveToPos = leaderPos;
|
||||||
@@ -150,7 +149,7 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
float rx, ry, rz;
|
float rx, ry, rz;
|
||||||
if (manager.CalculateDestination(&rx, &ry, &rz))
|
if (manager.CalculateDestination(&rx, &ry, &rz))
|
||||||
moveToPos = WorldPosition(moveToPos.getMapId(), rx, ry, rz, 0.0);
|
moveToPos = WorldPosition(moveToPos.GetMapId(), rx, ry, rz, 0.0);
|
||||||
else if (!moveToPos.GetReachableRandomPointOnGround(bot, reclaimDist, urand(0, 1)))
|
else if (!moveToPos.GetReachableRandomPointOnGround(bot, reclaimDist, urand(0, 1)))
|
||||||
moveToPos = corpsePos;
|
moveToPos = corpsePos;
|
||||||
}
|
}
|
||||||
@@ -162,7 +161,7 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
|
|
||||||
if (!botAI->AllowActivity(ALL_ACTIVITY))
|
if (!botAI->AllowActivity(ALL_ACTIVITY))
|
||||||
{
|
{
|
||||||
uint32 delay = sServerFacade->GetDistance2d(bot, corpse) /
|
uint32 delay = ServerFacade::instance().GetDistance2d(bot, corpse) /
|
||||||
bot->GetSpeed(MOVE_RUN); // Time a bot would take to travel to it's corpse.
|
bot->GetSpeed(MOVE_RUN); // Time a bot would take to travel to it's corpse.
|
||||||
delay = std::min(delay, uint32(10 * MINUTE)); // Cap time to get to corpse at 10 minutes.
|
delay = std::min(delay, uint32(10 * MINUTE)); // Cap time to get to corpse at 10 minutes.
|
||||||
|
|
||||||
@@ -170,7 +169,7 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
bot->GetMotionMaster()->Clear();
|
bot->GetMotionMaster()->Clear();
|
||||||
bot->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TELEPORTED | AURA_INTERRUPT_FLAG_CHANGE_MAP);
|
bot->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TELEPORTED | AURA_INTERRUPT_FLAG_CHANGE_MAP);
|
||||||
bot->TeleportTo(moveToPos.getMapId(), moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), 0);
|
bot->TeleportTo(moveToPos.GetMapId(), moveToPos.GetPositionX(), moveToPos.GetPositionY(), moveToPos.GetPositionZ(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
moved = true;
|
moved = true;
|
||||||
@@ -184,7 +183,7 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
if (deadTime < 10 * MINUTE && dCount < 5) // Look for corpse up to 30 minutes.
|
if (deadTime < 10 * MINUTE && dCount < 5) // Look for corpse up to 30 minutes.
|
||||||
{
|
{
|
||||||
moved =
|
moved =
|
||||||
MoveTo(moveToPos.getMapId(), moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), false, false);
|
MoveTo(moveToPos.GetMapId(), moveToPos.GetPositionX(), moveToPos.GetPositionY(), moveToPos.GetPositionZ(), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moved)
|
if (!moved)
|
||||||
@@ -237,10 +236,10 @@ GraveyardStruct const* SpiritHealerAction::GetGrave(bool startZone)
|
|||||||
{
|
{
|
||||||
uint32 areaId = 0;
|
uint32 areaId = 0;
|
||||||
uint32 zoneId = 0;
|
uint32 zoneId = 0;
|
||||||
sMapMgr->GetZoneAndAreaId(bot->GetPhaseMask(), zoneId, areaId, travelPos.getMapId(), travelPos.getX(),
|
sMapMgr->GetZoneAndAreaId(bot->GetPhaseMask(), zoneId, areaId, travelPos.GetMapId(), travelPos.GetPositionX(),
|
||||||
travelPos.getY(), travelPos.getZ());
|
travelPos.GetPositionY(), travelPos.GetPositionZ());
|
||||||
ClosestGrave = sGraveyard->GetClosestGraveyard(travelPos.getMapId(), travelPos.getX(), travelPos.getY(),
|
ClosestGrave = sGraveyard->GetClosestGraveyard(travelPos.GetMapId(), travelPos.GetPositionX(), travelPos.GetPositionY(),
|
||||||
travelPos.getZ(), bot->GetTeamId(), areaId, zoneId,
|
travelPos.GetPositionZ(), bot->GetTeamId(), areaId, zoneId,
|
||||||
bot->getClass() == CLASS_DEATH_KNIGHT);
|
bot->getClass() == CLASS_DEATH_KNIGHT);
|
||||||
|
|
||||||
if (ClosestGrave)
|
if (ClosestGrave)
|
||||||
@@ -293,7 +292,7 @@ GraveyardStruct const* SpiritHealerAction::GetGrave(bool startZone)
|
|||||||
return ClosestGrave;
|
return ClosestGrave;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SpiritHealerAction::Execute(Event event)
|
bool SpiritHealerAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Corpse* corpse = bot->GetCorpse();
|
Corpse* corpse = bot->GetCorpse();
|
||||||
if (!corpse)
|
if (!corpse)
|
||||||
@@ -308,7 +307,7 @@ bool SpiritHealerAction::Execute(Event event)
|
|||||||
GraveyardStruct const* ClosestGrave =
|
GraveyardStruct const* ClosestGrave =
|
||||||
GetGrave(dCount > 10 || deadTime > 15 * MINUTE || AI_VALUE(uint8, "durability") < 10);
|
GetGrave(dCount > 10 || deadTime > 15 * MINUTE || AI_VALUE(uint8, "durability") < 10);
|
||||||
|
|
||||||
if (bot->GetDistance2d(ClosestGrave->x, ClosestGrave->y) < sPlayerbotAIConfig->sightDistance)
|
if (bot->GetDistance2d(ClosestGrave->x, ClosestGrave->y) < sPlayerbotAIConfig.sightDistance)
|
||||||
{
|
{
|
||||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
||||||
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
|
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "BattlegroundMgr.h"
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "EmoteAction.h"
|
#include "EmoteAction.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "RpgSubActions.h"
|
#include "RpgSubActions.h"
|
||||||
|
|
||||||
bool RpgAction::Execute(Event event)
|
bool RpgAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
if (!guidP && botAI->GetMaster())
|
if (!guidP && botAI->GetMaster())
|
||||||
@@ -85,7 +84,7 @@ bool RpgAction::SetNextRpgAction()
|
|||||||
isChecked = true;
|
isChecked = true;
|
||||||
|
|
||||||
Action* action = botAI->GetAiObjectContext()->GetAction(nextAction.getName());
|
Action* action = botAI->GetAiObjectContext()->GetAction(nextAction.getName());
|
||||||
if (!dynamic_cast<RpgEnabled*>(action) || !action->isPossible() || !action->isUseful())
|
if (!dynamic_cast<RpgEnabled*>(action) || !action->isUseful() || !action->isPossible())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
actions.push_back(action);
|
actions.push_back(action);
|
||||||
@@ -130,7 +129,7 @@ bool RpgAction::SetNextRpgAction()
|
|||||||
|
|
||||||
std::mt19937 gen(time(0));
|
std::mt19937 gen(time(0));
|
||||||
|
|
||||||
sTravelMgr->weighted_shuffle(actions.begin(), actions.end(), relevances.begin(), relevances.end(), gen);
|
TravelMgr::instance().weighted_shuffle(actions.begin(), actions.end(), relevances.begin(), relevances.end(), gen);
|
||||||
|
|
||||||
Action* action = actions.front();
|
Action* action = actions.front();
|
||||||
|
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ void RpgHelper::setFacing(GuidPosition guidPosition)
|
|||||||
void RpgHelper::setDelay(bool waitForGroup)
|
void RpgHelper::setDelay(bool waitForGroup)
|
||||||
{
|
{
|
||||||
if (!botAI->HasRealPlayerMaster() || (waitForGroup && botAI->GetGroupLeader() == bot && bot->GetGroup()))
|
if (!botAI->HasRealPlayerMaster() || (waitForGroup && botAI->GetGroupLeader() == bot && bot->GetGroup()))
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.rpgDelay);
|
||||||
else
|
else
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay / 5);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.rpgDelay / 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgSubAction::isPossible() { return rpg->guidP() && rpg->guidP().GetWorldObject(); }
|
bool RpgSubAction::isPossible() { return rpg->guidP() && rpg->guidP().GetWorldObject(); }
|
||||||
@@ -99,7 +99,7 @@ Event RpgSubAction::ActionEvent(Event event) { return event; }
|
|||||||
|
|
||||||
bool RpgStayAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgStayAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgStayAction::Execute(Event event)
|
bool RpgStayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bot->PlayerTalkClass->SendCloseGossip();
|
bot->PlayerTalkClass->SendCloseGossip();
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ bool RpgStayAction::Execute(Event event)
|
|||||||
|
|
||||||
bool RpgWorkAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgWorkAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgWorkAction::Execute(Event event)
|
bool RpgWorkAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bot->HandleEmoteCommand(EMOTE_STATE_USE_STANDING);
|
bot->HandleEmoteCommand(EMOTE_STATE_USE_STANDING);
|
||||||
rpg->AfterExecute();
|
rpg->AfterExecute();
|
||||||
@@ -118,7 +118,7 @@ bool RpgWorkAction::Execute(Event event)
|
|||||||
|
|
||||||
bool RpgEmoteAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgEmoteAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgEmoteAction::Execute(Event event)
|
bool RpgEmoteAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 type = TalkAction::GetRandomEmote(rpg->guidP().GetUnit());
|
uint32 type = TalkAction::GetRandomEmote(rpg->guidP().GetUnit());
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ bool RpgEmoteAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgCancelAction::Execute(Event event)
|
bool RpgCancelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||||
rpg->OnExecute("");
|
rpg->OnExecute("");
|
||||||
@@ -142,7 +142,7 @@ bool RpgCancelAction::Execute(Event event)
|
|||||||
|
|
||||||
bool RpgTaxiAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
bool RpgTaxiAction::isUseful() { return rpg->InRange() && !botAI->HasRealPlayerMaster(); }
|
||||||
|
|
||||||
bool RpgTaxiAction::Execute(Event event)
|
bool RpgTaxiAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = rpg->guidP();
|
GuidPosition guidP = rpg->guidP();
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ bool RpgTaxiAction::Execute(Event event)
|
|||||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||||
|
|
||||||
uint32 node =
|
uint32 node =
|
||||||
sObjectMgr->GetNearestTaxiNode(guidP.getX(), guidP.getY(), guidP.getZ(), guidP.getMapId(), bot->GetTeamId());
|
sObjectMgr->GetNearestTaxiNode(guidP.GetPositionX(), guidP.GetPositionY(), guidP.GetPositionZ(), guidP.GetMapId(), bot->GetTeamId());
|
||||||
|
|
||||||
std::vector<uint32> nodes;
|
std::vector<uint32> nodes;
|
||||||
for (uint32 i = 0; i < sTaxiPathStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sTaxiPathStore.GetNumRows(); ++i)
|
||||||
@@ -203,12 +203,12 @@ bool RpgTaxiAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgDiscoverAction::Execute(Event event)
|
bool RpgDiscoverAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = rpg->guidP();
|
GuidPosition guidP = rpg->guidP();
|
||||||
|
|
||||||
uint32 node =
|
uint32 node =
|
||||||
sObjectMgr->GetNearestTaxiNode(guidP.getX(), guidP.getY(), guidP.getZ(), guidP.getMapId(), bot->GetTeamId());
|
sObjectMgr->GetNearestTaxiNode(guidP.GetPositionX(), guidP.GetPositionY(), guidP.GetPositionZ(), guidP.GetMapId(), bot->GetTeamId());
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return false;
|
return false;
|
||||||
@@ -222,7 +222,7 @@ bool RpgDiscoverAction::Execute(Event event)
|
|||||||
|
|
||||||
std::string const RpgStartQuestAction::ActionName() { return "accept all quests"; }
|
std::string const RpgStartQuestAction::ActionName() { return "accept all quests"; }
|
||||||
|
|
||||||
Event RpgStartQuestAction::ActionEvent(Event event)
|
Event RpgStartQuestAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p(CMSG_QUESTGIVER_ACCEPT_QUEST);
|
WorldPacket p(CMSG_QUESTGIVER_ACCEPT_QUEST);
|
||||||
p << rpg->guid();
|
p << rpg->guid();
|
||||||
@@ -232,7 +232,7 @@ Event RpgStartQuestAction::ActionEvent(Event event)
|
|||||||
|
|
||||||
std::string const RpgEndQuestAction::ActionName() { return "talk to quest giver"; }
|
std::string const RpgEndQuestAction::ActionName() { return "talk to quest giver"; }
|
||||||
|
|
||||||
Event RpgEndQuestAction::ActionEvent(Event event)
|
Event RpgEndQuestAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p(CMSG_QUESTGIVER_COMPLETE_QUEST);
|
WorldPacket p(CMSG_QUESTGIVER_COMPLETE_QUEST);
|
||||||
p << rpg->guid();
|
p << rpg->guid();
|
||||||
@@ -242,17 +242,17 @@ Event RpgEndQuestAction::ActionEvent(Event event)
|
|||||||
|
|
||||||
std::string const RpgBuyAction::ActionName() { return "buy"; }
|
std::string const RpgBuyAction::ActionName() { return "buy"; }
|
||||||
|
|
||||||
Event RpgBuyAction::ActionEvent(Event event) { return Event("rpg action", "vendor"); }
|
Event RpgBuyAction::ActionEvent(Event /*event*/) { return Event("rpg action", "vendor"); }
|
||||||
|
|
||||||
std::string const RpgSellAction::ActionName() { return "sell"; }
|
std::string const RpgSellAction::ActionName() { return "sell"; }
|
||||||
|
|
||||||
Event RpgSellAction::ActionEvent(Event event) { return Event("rpg action", "vendor"); }
|
Event RpgSellAction::ActionEvent(Event /*event*/) { return Event("rpg action", "vendor"); }
|
||||||
|
|
||||||
std::string const RpgRepairAction::ActionName() { return "repair"; }
|
std::string const RpgRepairAction::ActionName() { return "repair"; }
|
||||||
|
|
||||||
std::string const RpgTrainAction::ActionName() { return "trainer"; }
|
std::string const RpgTrainAction::ActionName() { return "trainer"; }
|
||||||
|
|
||||||
bool RpgHealAction::Execute(Event event)
|
bool RpgHealAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
|
|
||||||
@@ -287,21 +287,21 @@ std::string const RpgBuyPetitionAction::ActionName() { return "buy petition"; }
|
|||||||
|
|
||||||
std::string const RpgUseAction::ActionName() { return "use"; }
|
std::string const RpgUseAction::ActionName() { return "use"; }
|
||||||
|
|
||||||
Event RpgUseAction::ActionEvent(Event event)
|
Event RpgUseAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const RpgSpellAction::ActionName() { return "cast random spell"; }
|
std::string const RpgSpellAction::ActionName() { return "cast random spell"; }
|
||||||
|
|
||||||
Event RpgSpellAction::ActionEvent(Event event)
|
Event RpgSpellAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const RpgCraftAction::ActionName() { return "craft random item"; }
|
std::string const RpgCraftAction::ActionName() { return "craft random item"; }
|
||||||
|
|
||||||
Event RpgCraftAction::ActionEvent(Event event)
|
Event RpgCraftAction::ActionEvent(Event /*event*/)
|
||||||
{
|
{
|
||||||
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
return Event("rpg action", chat->FormatWorldobject(rpg->guidP().GetWorldObject()));
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ std::vector<Item*> RpgTradeUsefulAction::CanGiveItems(GuidPosition guidPosition)
|
|||||||
return giveItems;
|
return giveItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgTradeUsefulAction::Execute(Event event)
|
bool RpgTradeUsefulAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ bool RpgTradeUsefulAction::Execute(Event event)
|
|||||||
bot->Say("Start trade with" + chat->FormatWorldobject(player),
|
bot->Say("Start trade with" + chat->FormatWorldobject(player),
|
||||||
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
(bot->GetTeamId() == TEAM_ALLIANCE ? LANG_COMMON : LANG_ORCISH));
|
||||||
|
|
||||||
botAI->SetNextCheckDelay(sPlayerbotAIConfig->rpgDelay);
|
botAI->SetNextCheckDelay(sPlayerbotAIConfig.rpgDelay);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ bool RpgTradeUsefulAction::Execute(Event event)
|
|||||||
bool RpgDuelAction::isUseful()
|
bool RpgDuelAction::isUseful()
|
||||||
{
|
{
|
||||||
// do not offer duel in non pvp areas
|
// do not offer duel in non pvp areas
|
||||||
if (sPlayerbotAIConfig->IsInPvpProhibitedZone(bot->GetZoneId()))
|
if (sPlayerbotAIConfig.IsInPvpProhibitedZone(bot->GetZoneId()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities)
|
// Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities)
|
||||||
@@ -416,7 +416,7 @@ bool RpgDuelAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgDuelAction::Execute(Event event)
|
bool RpgDuelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
|
|
||||||
@@ -434,10 +434,10 @@ bool RpgMountAnimAction::isUseful()
|
|||||||
return AI_VALUE2(bool, "mounted", "self target") && !AI_VALUE2(bool, "moving", "self target");
|
return AI_VALUE2(bool, "mounted", "self target") && !AI_VALUE2(bool, "moving", "self target");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgMountAnimAction::Execute(Event event)
|
bool RpgMountAnimAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p;
|
WorldPacket p;
|
||||||
bot->GetSession()->HandleMountSpecialAnimOpcode(p);
|
bot->GetSession()->HandleMountSpecialAnimOpcode(p);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void RtiAction::AppendRti(std::ostringstream& out, std::string const type)
|
|||||||
out << " (" << target->GetName() << ")";
|
out << " (" << target->GetName() << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MarkRtiAction::Execute(Event event)
|
bool MarkRtiAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
|
|||||||
@@ -80,8 +80,9 @@ bool RTSCAction::Execute(Event event)
|
|||||||
SET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName, spellPosition);
|
SET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName, spellPosition);
|
||||||
|
|
||||||
Creature* wpCreature =
|
Creature* wpCreature =
|
||||||
bot->SummonCreature(15631, spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(),
|
bot->SummonCreature(15631, spellPosition.GetPositionX(), spellPosition.GetPositionY(),
|
||||||
spellPosition.getO(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
spellPosition.GetPositionZ(), spellPosition.GetOrientation(), TEMPSUMMON_TIMED_DESPAWN,
|
||||||
|
2000.0f);
|
||||||
wpCreature->SetObjectScale(0.5f);
|
wpCreature->SetObjectScale(0.5f);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -110,8 +111,9 @@ bool RTSCAction::Execute(Event event)
|
|||||||
if (spellPosition)
|
if (spellPosition)
|
||||||
{
|
{
|
||||||
Creature* wpCreature =
|
Creature* wpCreature =
|
||||||
bot->SummonCreature(15631, spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(),
|
bot->SummonCreature(15631, spellPosition.GetPositionX(), spellPosition.GetPositionY(),
|
||||||
spellPosition.getO(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
spellPosition.GetPositionZ(), spellPosition.GetOrientation(),
|
||||||
|
TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
||||||
wpCreature->SetObjectScale(0.5f);
|
wpCreature->SetObjectScale(0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "ChannelMgr.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildMgr.h"
|
|
||||||
#include "PlayerbotTextMgr.h"
|
#include "PlayerbotTextMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
@@ -56,7 +54,7 @@ static const std::unordered_set<std::string> noReplyMsgStarts = {"e ", "accept "
|
|||||||
|
|
||||||
SayAction::SayAction(PlayerbotAI* botAI) : Action(botAI, "say"), Qualified() {}
|
SayAction::SayAction(PlayerbotAI* botAI) : Action(botAI, "say"), Qualified() {}
|
||||||
|
|
||||||
bool SayAction::Execute(Event event)
|
bool SayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::string text = "";
|
std::string text = "";
|
||||||
std::map<std::string, std::string> placeholders;
|
std::map<std::string, std::string> placeholders;
|
||||||
@@ -92,7 +90,6 @@ bool SayAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set delay before next say
|
// set delay before next say
|
||||||
time_t lastSaid = AI_VALUE2(time_t, "last said", qualifier);
|
|
||||||
uint32 nextTime = time(nullptr) + urand(1, 30);
|
uint32 nextTime = time(nullptr) + urand(1, 30);
|
||||||
botAI->GetAiObjectContext()->GetValue<time_t>("last said", qualifier)->Set(nextTime);
|
botAI->GetAiObjectContext()->GetValue<time_t>("last said", qualifier)->Set(nextTime);
|
||||||
|
|
||||||
@@ -134,7 +131,7 @@ bool SayAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load text based on chance
|
// load text based on chance
|
||||||
if (!sPlayerbotTextMgr->GetBotText(qualifier, text, placeholders))
|
if (!PlayerbotTextMgr::instance().GetBotText(qualifier, text, placeholders))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (text.find("/y ") == 0)
|
if (text.find("/y ") == 0)
|
||||||
@@ -206,7 +203,7 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
//toxic links
|
//toxic links
|
||||||
if (msg.starts_with(sPlayerbotAIConfig->toxicLinksPrefix)
|
if (msg.starts_with(sPlayerbotAIConfig.toxicLinksPrefix)
|
||||||
&& (GET_PLAYERBOT_AI(bot)->GetChatHelper()->ExtractAllItemIds(msg).size() > 0 || GET_PLAYERBOT_AI(bot)->GetChatHelper()->ExtractAllQuestIds(msg).size() > 0))
|
&& (GET_PLAYERBOT_AI(bot)->GetChatHelper()->ExtractAllItemIds(msg).size() > 0 || GET_PLAYERBOT_AI(bot)->GetChatHelper()->ExtractAllQuestIds(msg).size() > 0))
|
||||||
{
|
{
|
||||||
HandleToxicLinksReply(bot, chatChannelSource, msg, name);
|
HandleToxicLinksReply(bot, chatChannelSource, msg, name);
|
||||||
@@ -230,7 +227,7 @@ bool ChatReplyAction::HandleThunderfuryReply(Player* bot, ChatChannelSource chat
|
|||||||
const auto thunderfury = sObjectMgr->GetItemTemplate(19019);
|
const auto thunderfury = sObjectMgr->GetItemTemplate(19019);
|
||||||
placeholders["%thunderfury_link"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatItem(thunderfury);
|
placeholders["%thunderfury_link"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatItem(thunderfury);
|
||||||
|
|
||||||
std::string responseMessage = BOT_TEXT2("thunderfury_spam", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("thunderfury_spam", placeholders);
|
||||||
|
|
||||||
switch (chatChannelSource)
|
switch (chatChannelSource)
|
||||||
{
|
{
|
||||||
@@ -271,8 +268,8 @@ bool ChatReplyAction::HandleToxicLinksReply(Player* bot, ChatChannelSource chatC
|
|||||||
std::vector<Item*> botItems = GET_PLAYERBOT_AI(bot)->GetInventoryAndEquippedItems();
|
std::vector<Item*> botItems = GET_PLAYERBOT_AI(bot)->GetInventoryAndEquippedItems();
|
||||||
|
|
||||||
std::map<std::string, std::string> placeholders;
|
std::map<std::string, std::string> placeholders;
|
||||||
placeholders["%random_inventory_item_link"] = botItems.size() > 0 ? GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatItem(botItems[rand() % botItems.size()]->GetTemplate()) : BOT_TEXT1("string_empty_link");
|
placeholders["%random_inventory_item_link"] = botItems.size() > 0 ? GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatItem(botItems[rand() % botItems.size()]->GetTemplate()) : PlayerbotTextMgr::instance().GetBotText("string_empty_link");
|
||||||
placeholders["%prefix"] = sPlayerbotAIConfig->toxicLinksPrefix;
|
placeholders["%prefix"] = sPlayerbotAIConfig.toxicLinksPrefix;
|
||||||
|
|
||||||
if (incompleteQuests.size() > 0)
|
if (incompleteQuests.size() > 0)
|
||||||
{
|
{
|
||||||
@@ -287,8 +284,8 @@ bool ChatReplyAction::HandleToxicLinksReply(Player* bot, ChatChannelSource chatC
|
|||||||
placeholders["%my_role"] = ChatHelper::FormatClass(bot, AiFactory::GetPlayerSpecTab(bot));
|
placeholders["%my_role"] = ChatHelper::FormatClass(bot, AiFactory::GetPlayerSpecTab(bot));
|
||||||
AreaTableEntry const* current_area = GET_PLAYERBOT_AI(bot)->GetCurrentArea();
|
AreaTableEntry const* current_area = GET_PLAYERBOT_AI(bot)->GetCurrentArea();
|
||||||
AreaTableEntry const* current_zone = GET_PLAYERBOT_AI(bot)->GetCurrentZone();
|
AreaTableEntry const* current_zone = GET_PLAYERBOT_AI(bot)->GetCurrentZone();
|
||||||
placeholders["%area_name"] = current_area ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_area) : BOT_TEXT1("string_unknown_area");
|
placeholders["%area_name"] = current_area ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_area) : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
placeholders["%zone_name"] = current_zone ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_zone) : BOT_TEXT1("string_unknown_area");
|
placeholders["%zone_name"] = current_zone ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_zone) : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
placeholders["%my_class"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatClass(bot->getClass());
|
placeholders["%my_class"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatClass(bot->getClass());
|
||||||
placeholders["%my_race"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatRace(bot->getRace());
|
placeholders["%my_race"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatRace(bot->getRace());
|
||||||
placeholders["%my_level"] = std::to_string(bot->GetLevel());
|
placeholders["%my_level"] = std::to_string(bot->GetLevel());
|
||||||
@@ -297,17 +294,17 @@ bool ChatReplyAction::HandleToxicLinksReply(Player* bot, ChatChannelSource chatC
|
|||||||
{
|
{
|
||||||
case ChatChannelSource::SRC_WORLD:
|
case ChatChannelSource::SRC_WORLD:
|
||||||
{
|
{
|
||||||
GET_PLAYERBOT_AI(bot)->SayToWorld(BOT_TEXT2("suggest_toxic_links", placeholders));
|
GET_PLAYERBOT_AI(bot)->SayToWorld(PlayerbotTextMgr::instance().GetBotText("suggest_toxic_links", placeholders));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatChannelSource::SRC_GENERAL:
|
case ChatChannelSource::SRC_GENERAL:
|
||||||
{
|
{
|
||||||
GET_PLAYERBOT_AI(bot)->SayToChannel(BOT_TEXT2("suggest_toxic_links", placeholders), ChatChannelId::GENERAL);
|
GET_PLAYERBOT_AI(bot)->SayToChannel(PlayerbotTextMgr::instance().GetBotText("suggest_toxic_links", placeholders), ChatChannelId::GENERAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChatChannelSource::SRC_GUILD:
|
case ChatChannelSource::SRC_GUILD:
|
||||||
{
|
{
|
||||||
GET_PLAYERBOT_AI(bot)->SayToGuild(BOT_TEXT2("suggest_toxic_links", placeholders));
|
GET_PLAYERBOT_AI(bot)->SayToGuild(PlayerbotTextMgr::instance().GetBotText("suggest_toxic_links", placeholders));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -343,8 +340,8 @@ bool ChatReplyAction::HandleWTBItemsReply(Player* bot, ChatChannelSource chatCha
|
|||||||
placeholders["%other_name"] = name;
|
placeholders["%other_name"] = name;
|
||||||
AreaTableEntry const* current_area = GET_PLAYERBOT_AI(bot)->GetCurrentArea();
|
AreaTableEntry const* current_area = GET_PLAYERBOT_AI(bot)->GetCurrentArea();
|
||||||
AreaTableEntry const* current_zone = GET_PLAYERBOT_AI(bot)->GetCurrentZone();
|
AreaTableEntry const* current_zone = GET_PLAYERBOT_AI(bot)->GetCurrentZone();
|
||||||
placeholders["%area_name"] = current_area ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_area) : BOT_TEXT1("string_unknown_area");
|
placeholders["%area_name"] = current_area ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_area) : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
placeholders["%zone_name"] = current_zone ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_zone) : BOT_TEXT1("string_unknown_area");
|
placeholders["%zone_name"] = current_zone ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_zone) : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
placeholders["%my_class"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatClass(bot->getClass());
|
placeholders["%my_class"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatClass(bot->getClass());
|
||||||
placeholders["%my_race"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatRace(bot->getRace());
|
placeholders["%my_race"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatRace(bot->getRace());
|
||||||
placeholders["%my_level"] = std::to_string(bot->GetLevel());
|
placeholders["%my_level"] = std::to_string(bot->GetLevel());
|
||||||
@@ -365,12 +362,12 @@ bool ChatReplyAction::HandleWTBItemsReply(Player* bot, ChatChannelSource chatCha
|
|||||||
//may reply to the same channel or whisper
|
//may reply to the same channel or whisper
|
||||||
if (urand(0, 1))
|
if (urand(0, 1))
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_wtb_items_channel", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_wtb_items_channel", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->SayToWorld(responseMessage);
|
GET_PLAYERBOT_AI(bot)->SayToWorld(responseMessage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_wtb_items_whisper", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_wtb_items_whisper", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -380,12 +377,12 @@ bool ChatReplyAction::HandleWTBItemsReply(Player* bot, ChatChannelSource chatCha
|
|||||||
//may reply to the same channel or whisper
|
//may reply to the same channel or whisper
|
||||||
if (urand(0, 1))
|
if (urand(0, 1))
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_wtb_items_channel", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_wtb_items_channel", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->SayToChannel(responseMessage, ChatChannelId::GENERAL);
|
GET_PLAYERBOT_AI(bot)->SayToChannel(responseMessage, ChatChannelId::GENERAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_wtb_items_whisper", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_wtb_items_whisper", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -395,12 +392,12 @@ bool ChatReplyAction::HandleWTBItemsReply(Player* bot, ChatChannelSource chatCha
|
|||||||
//may reply to the same channel or whisper
|
//may reply to the same channel or whisper
|
||||||
if (urand(0, 1))
|
if (urand(0, 1))
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_wtb_items_channel", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_wtb_items_channel", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->SayToChannel(responseMessage, ChatChannelId::TRADE);
|
GET_PLAYERBOT_AI(bot)->SayToChannel(responseMessage, ChatChannelId::TRADE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_wtb_items_whisper", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_wtb_items_whisper", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -438,8 +435,8 @@ bool ChatReplyAction::HandleLFGQuestsReply(Player* bot, ChatChannelSource chatCh
|
|||||||
placeholders["%other_name"] = name;
|
placeholders["%other_name"] = name;
|
||||||
AreaTableEntry const* current_area = GET_PLAYERBOT_AI(bot)->GetCurrentArea();
|
AreaTableEntry const* current_area = GET_PLAYERBOT_AI(bot)->GetCurrentArea();
|
||||||
AreaTableEntry const* current_zone = GET_PLAYERBOT_AI(bot)->GetCurrentZone();
|
AreaTableEntry const* current_zone = GET_PLAYERBOT_AI(bot)->GetCurrentZone();
|
||||||
placeholders["%area_name"] = current_area ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_area) : BOT_TEXT1("string_unknown_area");
|
placeholders["%area_name"] = current_area ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_area) : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
placeholders["%zone_name"] = current_zone ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_zone) : BOT_TEXT1("string_unknown_area");
|
placeholders["%zone_name"] = current_zone ? GET_PLAYERBOT_AI(bot)->GetLocalizedAreaName(current_zone) : PlayerbotTextMgr::instance().GetBotText("string_unknown_area");
|
||||||
placeholders["%my_class"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatClass(bot->getClass());
|
placeholders["%my_class"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatClass(bot->getClass());
|
||||||
placeholders["%my_race"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatRace(bot->getRace());
|
placeholders["%my_race"] = GET_PLAYERBOT_AI(bot)->GetChatHelper()->FormatRace(bot->getRace());
|
||||||
placeholders["%my_level"] = std::to_string(bot->GetLevel());
|
placeholders["%my_level"] = std::to_string(bot->GetLevel());
|
||||||
@@ -458,12 +455,12 @@ bool ChatReplyAction::HandleLFGQuestsReply(Player* bot, ChatChannelSource chatCh
|
|||||||
//may reply to the same channel or whisper
|
//may reply to the same channel or whisper
|
||||||
if (urand(0, 1))
|
if (urand(0, 1))
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_lfg_quests_channel", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_lfg_quests_channel", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->SayToWorld(responseMessage);
|
GET_PLAYERBOT_AI(bot)->SayToWorld(responseMessage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_lfg_quests_whisper", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_lfg_quests_whisper", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -473,12 +470,12 @@ bool ChatReplyAction::HandleLFGQuestsReply(Player* bot, ChatChannelSource chatCh
|
|||||||
//may reply to the same channel or whisper
|
//may reply to the same channel or whisper
|
||||||
if (urand(0, 1))
|
if (urand(0, 1))
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_lfg_quests_channel", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_lfg_quests_channel", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->SayToChannel(responseMessage, ChatChannelId::GENERAL);
|
GET_PLAYERBOT_AI(bot)->SayToChannel(responseMessage, ChatChannelId::GENERAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string responseMessage = BOT_TEXT2("response_lfg_quests_whisper", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_lfg_quests_whisper", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -487,7 +484,7 @@ bool ChatReplyAction::HandleLFGQuestsReply(Player* bot, ChatChannelSource chatCh
|
|||||||
{
|
{
|
||||||
//do not reply to the chat
|
//do not reply to the chat
|
||||||
//may whisper
|
//may whisper
|
||||||
std::string responseMessage = BOT_TEXT2("response_lfg_quests_whisper", placeholders);
|
std::string responseMessage = PlayerbotTextMgr::instance().GetBotText("response_lfg_quests_whisper", placeholders);
|
||||||
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
GET_PLAYERBOT_AI(bot)->Whisper(responseMessage, name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1042,7 +1039,7 @@ std::string ChatReplyAction::GenerateReplyMessage(Player* bot, std::string& inco
|
|||||||
// load text if needed
|
// load text if needed
|
||||||
if (respondsText.empty())
|
if (respondsText.empty())
|
||||||
{
|
{
|
||||||
respondsText = BOT_TEXT2(replyType, name);
|
respondsText = PlayerbotTextMgr::instance().GetBotText(replyType, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (respondsText.size() > 255)
|
if (respondsText.size() > 255)
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
bool SecurityCheckAction::isUseful()
|
bool SecurityCheckAction::isUseful()
|
||||||
{
|
{
|
||||||
return sRandomPlayerbotMgr->IsRandomBot(bot) && botAI->GetMaster() &&
|
return sRandomPlayerbotMgr.IsRandomBot(bot) && botAI->GetMaster() &&
|
||||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER && !GET_PLAYERBOT_AI(botAI->GetMaster());
|
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER && !GET_PLAYERBOT_AI(botAI->GetMaster());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecurityCheckAction::Execute(Event event)
|
bool SecurityCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Formations.h"
|
#include "Formations.h"
|
||||||
#include "PathGenerator.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RTSCValues.h"
|
#include "RTSCValues.h"
|
||||||
#include "RtscAction.h"
|
#include "RtscAction.h"
|
||||||
@@ -20,7 +19,7 @@ Creature* SeeSpellAction::CreateWps(Player* wpOwner, float x, float y, float z,
|
|||||||
bool important)
|
bool important)
|
||||||
{
|
{
|
||||||
float dist = wpOwner->GetDistance(x, y, z);
|
float dist = wpOwner->GetDistance(x, y, z);
|
||||||
float delay = 1000.0f * dist / wpOwner->GetSpeed(MOVE_RUN) + sPlayerbotAIConfig->reactDelay;
|
float delay = 1000.0f * dist / wpOwner->GetSpeed(MOVE_RUN) + sPlayerbotAIConfig.reactDelay;
|
||||||
|
|
||||||
if (!important)
|
if (!important)
|
||||||
delay *= 0.25;
|
delay *= 0.25;
|
||||||
@@ -61,7 +60,7 @@ bool SeeSpellAction::Execute(Event event)
|
|||||||
|
|
||||||
if (FISHING_SPELLS.find(spellId) != FISHING_SPELLS.end())
|
if (FISHING_SPELLS.find(spellId) != FISHING_SPELLS.end())
|
||||||
{
|
{
|
||||||
if (AI_VALUE(bool, "can fish") && sPlayerbotAIConfig->enableFishingWithMaster)
|
if (AI_VALUE(bool, "can fish") && sPlayerbotAIConfig.enableFishingWithMaster)
|
||||||
{
|
{
|
||||||
botAI->ChangeStrategy("+master fishing", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("+master fishing", BOT_STATE_NON_COMBAT);
|
||||||
return true;
|
return true;
|
||||||
@@ -134,8 +133,8 @@ bool SeeSpellAction::Execute(Event event)
|
|||||||
SET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName, spellPosition);
|
SET_AI_VALUE2(WorldPosition, "RTSC saved location", locationName, spellPosition);
|
||||||
|
|
||||||
Creature* wpCreature =
|
Creature* wpCreature =
|
||||||
bot->SummonCreature(15631, spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(),
|
bot->SummonCreature(15631, spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(),
|
||||||
spellPosition.getO(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
spellPosition.GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 2000.0f);
|
||||||
wpCreature->SetObjectScale(0.5f);
|
wpCreature->SetObjectScale(0.5f);
|
||||||
RESET_AI_VALUE(std::string, "RTSC next spell action");
|
RESET_AI_VALUE(std::string, "RTSC next spell action");
|
||||||
|
|
||||||
@@ -167,14 +166,14 @@ bool SeeSpellAction::MoveToSpell(WorldPosition& spellPosition, bool inFormation)
|
|||||||
PositionMap& posMap = AI_VALUE(PositionMap&, "position");
|
PositionMap& posMap = AI_VALUE(PositionMap&, "position");
|
||||||
PositionInfo stayPosition = posMap["stay"];
|
PositionInfo stayPosition = posMap["stay"];
|
||||||
|
|
||||||
stayPosition.Set(spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(), spellPosition.getMapId());
|
stayPosition.Set(spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(), spellPosition.GetMapId());
|
||||||
posMap["stay"] = stayPosition;
|
posMap["stay"] = stayPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot->IsWithinLOS(spellPosition.getX(), spellPosition.getY(), spellPosition.getZ()))
|
if (bot->IsWithinLOS(spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ()))
|
||||||
return MoveNear(spellPosition.getMapId(), spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(), 0);
|
return MoveNear(spellPosition.GetMapId(), spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(), 0);
|
||||||
|
|
||||||
return MoveTo(spellPosition.getMapId(), spellPosition.getX(), spellPosition.getY(), spellPosition.getZ(), false,
|
return MoveTo(spellPosition.GetMapId(), spellPosition.GetPositionX(), spellPosition.GetPositionY(), spellPosition.GetPositionZ(), false,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
bool SendMailAction::Execute(Event event)
|
bool SendMailAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
uint32 account = bot->GetSession()->GetAccountId();
|
uint32 account = bot->GetSession()->GetAccountId();
|
||||||
bool randomBot = sPlayerbotAIConfig->IsInRandomAccountList(account);
|
bool randomBot = sPlayerbotAIConfig.IsInRandomAccountList(account);
|
||||||
|
|
||||||
GuidVector gos = *context->GetValue<GuidVector>("nearest game objects");
|
GuidVector gos = *context->GetValue<GuidVector>("nearest game objects");
|
||||||
bool mailboxFound = false;
|
bool mailboxFound = false;
|
||||||
|
|||||||
@@ -49,9 +49,7 @@ bool SetCraftAction::Execute(Event event)
|
|||||||
if (skillSpells.empty())
|
if (skillSpells.empty())
|
||||||
{
|
{
|
||||||
for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
|
for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
|
||||||
{
|
|
||||||
skillSpells[skillLine->Spell] = skillLine;
|
skillSpells[skillLine->Spell] = skillLine;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.required.clear();
|
data.required.clear();
|
||||||
@@ -78,9 +76,7 @@ bool SetCraftAction::Execute(Event event)
|
|||||||
for (uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x)
|
for (uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x)
|
||||||
{
|
{
|
||||||
if (spellInfo->Reagent[x] <= 0)
|
if (spellInfo->Reagent[x] <= 0)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
uint32 itemid = spellInfo->Reagent[x];
|
uint32 itemid = spellInfo->Reagent[x];
|
||||||
uint32 reagentsRequired = spellInfo->ReagentCount[x];
|
uint32 reagentsRequired = spellInfo->ReagentCount[x];
|
||||||
@@ -132,9 +128,8 @@ void SetCraftAction::TellCraft()
|
|||||||
if (ItemTemplate const* reagent = sObjectMgr->GetItemTemplate(item))
|
if (ItemTemplate const* reagent = sObjectMgr->GetItemTemplate(item))
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
{
|
|
||||||
first = false;
|
first = false;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
out << ", ";
|
out << ", ";
|
||||||
|
|
||||||
@@ -142,9 +137,7 @@ void SetCraftAction::TellCraft()
|
|||||||
|
|
||||||
uint32 given = data.obtained[item];
|
uint32 given = data.obtained[item];
|
||||||
if (given)
|
if (given)
|
||||||
{
|
|
||||||
out << "|cffffff00(x" << given << " given)|r ";
|
out << "|cffffff00(x" << given << " given)|r ";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool SetHomeAction::Execute(Event event)
|
bool SetHomeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
|
|
||||||
|
|||||||
@@ -109,4 +109,4 @@ bool AutoShareQuestAction::Execute(Event event)
|
|||||||
bool AutoShareQuestAction::isUseful()
|
bool AutoShareQuestAction::isUseful()
|
||||||
{
|
{
|
||||||
return bot->GetGroup() && !botAI->HasActivePlayerMaster();
|
return bot->GetGroup() && !botAI->HasActivePlayerMaster();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool StatsAction::Execute(Event event)
|
bool StatsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user