mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-03-06 17:17:48 +00:00
Compare commits
40 Commits
254055ff32
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
652c7a1996 | ||
|
|
d32b10de15 | ||
|
|
3b6cf5060e | ||
|
|
b7b67e0fd9 | ||
|
|
8519b10d39 | ||
|
|
439293e100 | ||
|
|
be2cf436ea | ||
|
|
d8c668cf96 | ||
|
|
1401657a6d | ||
|
|
e7d5eaabac | ||
|
|
1f3d11d1c4 | ||
|
|
ea60b38eb9 | ||
|
|
629aa19dbd | ||
|
|
2f7dfdbbfc | ||
|
|
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 |
4
.github/workflows/check_pr_source.yml
vendored
4
.github/workflows/check_pr_source.yml
vendored
@@ -1,13 +1,15 @@
|
|||||||
name: Enforce test-staging → main
|
name: Enforce test-staging → master
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- test-staging
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
require-test-staging:
|
require-test-staging:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
if: github.event.pull_request.base.ref == 'master'
|
||||||
steps:
|
steps:
|
||||||
- name: Ensure PR source is test-staging
|
- name: Ensure PR source is test-staging
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
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 }}"
|
||||||
|
|||||||
18
.github/workflows/codestyle_cpp.yml
vendored
18
.github/workflows/codestyle_cpp.yml
vendored
@@ -6,10 +6,6 @@ on:
|
|||||||
- reopened
|
- reopened
|
||||||
- synchronize
|
- synchronize
|
||||||
- ready_for_review
|
- ready_for_review
|
||||||
paths:
|
|
||||||
- src/**
|
|
||||||
- "!README.md"
|
|
||||||
- "!docs/**"
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "codestyle-cppcheck-${{ github.event.pull_request.number }}"
|
group: "codestyle-cppcheck-${{ github.event.pull_request.number }}"
|
||||||
@@ -22,13 +18,27 @@ jobs:
|
|||||||
if: github.event.pull_request.draft == false
|
if: github.event.pull_request.draft == false
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
cpp:
|
||||||
|
- 'src/**'
|
||||||
|
- '!README.md'
|
||||||
|
- '!docs/**'
|
||||||
|
|
||||||
- name: Setup python
|
- name: Setup python
|
||||||
|
if: steps.filter.outputs.cpp == 'true'
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- name: AzerothCore codestyle
|
- name: AzerothCore codestyle
|
||||||
|
if: steps.filter.outputs.cpp == 'true'
|
||||||
run: python ./apps/codestyle/codestyle-cpp.py
|
run: python ./apps/codestyle/codestyle-cpp.py
|
||||||
|
|
||||||
- name: C++ Advanced
|
- name: C++ Advanced
|
||||||
|
if: steps.filter.outputs.cpp == 'true'
|
||||||
run: |
|
run: |
|
||||||
sudo apt update -y
|
sudo apt update -y
|
||||||
sudo apt install -y cppcheck
|
sudo apt install -y cppcheck
|
||||||
|
|||||||
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 }}"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="icon.png" alt="Playerbots Icon" width="700px">
|
<img src="banner.png" alt="Playerbots Banner" width="700px">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|||||||
BIN
banner.png
Normal file
BIN
banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 204 KiB |
@@ -192,9 +192,12 @@ AiPlayerbot.AutoInitOnly = 0
|
|||||||
# Default: 1.0 (same with the player)
|
# Default: 1.0 (same with the player)
|
||||||
AiPlayerbot.AutoInitEquipLevelLimitRatio = 1.0
|
AiPlayerbot.AutoInitEquipLevelLimitRatio = 1.0
|
||||||
|
|
||||||
# Bot automatically trains spells when talking to trainer
|
#
|
||||||
# yes = train all available spells as long as the bot has the money, free = auto trains with no money cost, no = only list spells
|
# AllowLearnTrainerSpells
|
||||||
AiPlayerbot.AutoTrainSpells = yes
|
# Description: Allow the bot to learn trainers' spells as long as it has the money.
|
||||||
|
# Default: 1 - (Enabled)
|
||||||
|
# 0 - (Disabled)
|
||||||
|
AiPlayerbot.AllowLearnTrainerSpells = 1
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@@ -558,11 +561,39 @@ 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"
|
||||||
|
|
||||||
|
# Attunement quests (comma-separated list of quest IDs)
|
||||||
|
# Default:
|
||||||
|
# Caverns of Time - Part 1
|
||||||
|
# - 10279, To The Master's Lair
|
||||||
|
# - 10277, The Caverns of Time
|
||||||
|
#
|
||||||
|
# Caverns of Time - Part 2 (Escape from Durnholde Keep)
|
||||||
|
# - 10282, Old Hillsbrad
|
||||||
|
# - 10283, Taretha's Diversion
|
||||||
|
# - 10284, Escape from Durnholde
|
||||||
|
# - 10285, Return to Andormu
|
||||||
|
#
|
||||||
|
# Caverns of Time - Part 2 (The Black Morass)
|
||||||
|
# - 10296, The Black Morass
|
||||||
|
# - 10297, The Opening of the Dark Portal
|
||||||
|
# - 10298, Hero of the Brood
|
||||||
|
#
|
||||||
|
# Magister's Terrace Attunement
|
||||||
|
# - 11481, Crisis at the Sunwell
|
||||||
|
# - 11482, Duty Calls
|
||||||
|
# - 11488, Magisters' Terrace
|
||||||
|
# - 11490, The Scryer's Scryer
|
||||||
|
# - 11492, Hard to Kill
|
||||||
|
#
|
||||||
|
# Serpentshrine Cavern
|
||||||
|
# - 10901, The Cudgel of Kar'desh
|
||||||
|
AiPlayerbot.AttunementQuests = 10279,10277,10282,10283,10284,10285,10296,10297,10298,11481,11482,11488,11490,11492,10901
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@@ -990,7 +1021,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)
|
||||||
@@ -2182,4 +2213,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
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
-- Temporarily disables innodb_strict_mode for the session to allow the script to complete even if legacy table definitions contain InnoDB-incompatible attributes
|
|
||||||
SET SESSION innodb_strict_mode = 0;
|
|
||||||
|
|
||||||
-- Change the tables to InnoDB
|
|
||||||
ALTER TABLE playerbots_guild_names ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_names ENGINE=InnoDB;
|
|
||||||
|
|
||||||
-- Re-enables innodb_strict_mode
|
|
||||||
SET SESSION innodb_strict_mode = 1;
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
|||||||
-- Temporarily disables innodb_strict_mode for the session to allow the script to complete even if legacy table definitions contain InnoDB-incompatible attributes
|
|
||||||
SET SESSION innodb_strict_mode = 0;
|
|
||||||
|
|
||||||
-- Change the tables to InnoDB
|
|
||||||
ALTER TABLE playerbots_dungeon_suggestion_abbrevation ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_dungeon_suggestion_definition ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_dungeon_suggestion_strategy ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_equip_cache ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_item_info_cache ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_rarity_cache ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_rnditem_cache ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_tele_cache ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_travelnode ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_travelnode_link ENGINE=InnoDB;
|
|
||||||
ALTER TABLE playerbots_travelnode_path ENGINE=InnoDB;
|
|
||||||
|
|
||||||
-- Re-enables innodb_strict_mode
|
|
||||||
SET SESSION innodb_strict_mode = 1;
|
|
||||||
@@ -4,15 +4,19 @@
|
|||||||
-- zhTW, esES, esMX, ruRU)
|
-- zhTW, esES, esMX, ruRU)
|
||||||
-- #########################################################
|
-- #########################################################
|
||||||
|
|
||||||
|
DELETE FROM ai_playerbot_texts WHERE name IN ('pvp_currency', 'pvp_arena_team', 'pvp_no_arena_team');
|
||||||
|
DELETE FROM ai_playerbot_texts_chance WHERE name IN ('pvp_currency', 'pvp_arena_team', 'pvp_no_arena_team');
|
||||||
|
|
||||||
-- ---------------------------------------------------------
|
-- ---------------------------------------------------------
|
||||||
-- pvp_currency
|
-- pvp_currency
|
||||||
-- [PVP] Arena points: %arena_points | Honor Points: %honor_points
|
-- [PVP] Arena points: %arena_points | Honor Points: %honor_points
|
||||||
-- ---------------------------------------------------------
|
-- ---------------------------------------------------------
|
||||||
INSERT INTO `ai_playerbot_texts`
|
INSERT INTO `ai_playerbot_texts`
|
||||||
(`name`, `text`, `say_type`, `reply_type`,
|
(`id`, `name`, `text`, `say_type`, `reply_type`,
|
||||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||||
SELECT
|
VALUES (
|
||||||
|
1737,
|
||||||
'pvp_currency',
|
'pvp_currency',
|
||||||
'[PVP] Arena points: %arena_points | Honor Points: %honor_points',
|
'[PVP] Arena points: %arena_points | Honor Points: %honor_points',
|
||||||
0, 0,
|
0, 0,
|
||||||
@@ -31,20 +35,20 @@ SELECT
|
|||||||
-- esMX
|
-- esMX
|
||||||
'[PVP] Puntos de arena: %arena_points | Puntos de honor: %honor_points',
|
'[PVP] Puntos de arena: %arena_points | Puntos de honor: %honor_points',
|
||||||
-- ruRU
|
-- ruRU
|
||||||
'[PVP] Очки арены: %arena_points | Очки чести: %honor_points'
|
'[PVP] Очки арены: %arena_points | Очки чести: %honor_points');
|
||||||
WHERE NOT EXISTS (
|
|
||||||
SELECT 1 FROM `ai_playerbot_texts` WHERE `name` = 'pvp_currency'
|
INSERT INTO ai_playerbot_texts_chance (name, probability) VALUES ('pvp_currency', 100);
|
||||||
);
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------
|
-- ---------------------------------------------------------
|
||||||
-- pvp_arena_team
|
-- pvp_arena_team
|
||||||
-- [PVP] %bracket: <%team_name> (rating %team_rating)
|
-- [PVP] %bracket: <%team_name> (rating %team_rating)
|
||||||
-- ---------------------------------------------------------
|
-- ---------------------------------------------------------
|
||||||
INSERT INTO `ai_playerbot_texts`
|
INSERT INTO `ai_playerbot_texts`
|
||||||
(`name`, `text`, `say_type`, `reply_type`,
|
(`id`, `name`, `text`, `say_type`, `reply_type`,
|
||||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||||
SELECT
|
VALUES (
|
||||||
|
1738,
|
||||||
'pvp_arena_team',
|
'pvp_arena_team',
|
||||||
'[PVP] %bracket: <%team_name> (rating %team_rating)',
|
'[PVP] %bracket: <%team_name> (rating %team_rating)',
|
||||||
0, 0,
|
0, 0,
|
||||||
@@ -63,20 +67,20 @@ SELECT
|
|||||||
-- esMX
|
-- esMX
|
||||||
'[PVP] %bracket: <%team_name> (índice %team_rating)',
|
'[PVP] %bracket: <%team_name> (índice %team_rating)',
|
||||||
-- ruRU
|
-- ruRU
|
||||||
'[PVP] %bracket: <%team_name> (рейтинг %team_rating)'
|
'[PVP] %bracket: <%team_name> (рейтинг %team_rating)');
|
||||||
WHERE NOT EXISTS (
|
|
||||||
SELECT 1 FROM `ai_playerbot_texts` WHERE `name` = 'pvp_arena_team'
|
INSERT INTO ai_playerbot_texts_chance (name, probability) VALUES ('pvp_arena_team', 100);
|
||||||
);
|
|
||||||
|
|
||||||
-- ---------------------------------------------------------
|
-- ---------------------------------------------------------
|
||||||
-- pvp_no_arena_team
|
-- pvp_no_arena_team
|
||||||
-- [PVP] I have no Arena Team.
|
-- [PVP] I have no Arena Team.
|
||||||
-- ---------------------------------------------------------
|
-- ---------------------------------------------------------
|
||||||
INSERT INTO `ai_playerbot_texts`
|
INSERT INTO `ai_playerbot_texts`
|
||||||
(`name`, `text`, `say_type`, `reply_type`,
|
(`id`, `name`, `text`, `say_type`, `reply_type`,
|
||||||
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
`text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`,
|
||||||
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
`text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`)
|
||||||
SELECT
|
VALUES (
|
||||||
|
1739,
|
||||||
'pvp_no_arena_team',
|
'pvp_no_arena_team',
|
||||||
'[PVP] I have no Arena Team.',
|
'[PVP] I have no Arena Team.',
|
||||||
0, 0,
|
0, 0,
|
||||||
@@ -95,7 +99,6 @@ SELECT
|
|||||||
-- esMX
|
-- esMX
|
||||||
'[PVP] No tengo equipo de arena.',
|
'[PVP] No tengo equipo de arena.',
|
||||||
-- ruRU
|
-- ruRU
|
||||||
'[PVP] У меня нет команды арены.'
|
'[PVP] У меня нет команды арены.');
|
||||||
WHERE NOT EXISTS (
|
|
||||||
SELECT 1 FROM `ai_playerbot_texts` WHERE `name` = 'pvp_no_arena_team'
|
INSERT INTO ai_playerbot_texts_chance (name, probability) VALUES ('pvp_no_arena_team', 100);
|
||||||
);
|
|
||||||
|
|||||||
BIN
icon.png
BIN
icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 125 KiB |
@@ -125,6 +125,7 @@ public:
|
|||||||
creators["runaway"] = &ActionContext::runaway;
|
creators["runaway"] = &ActionContext::runaway;
|
||||||
creators["stay"] = &ActionContext::stay;
|
creators["stay"] = &ActionContext::stay;
|
||||||
creators["sit"] = &ActionContext::sit;
|
creators["sit"] = &ActionContext::sit;
|
||||||
|
creators["aggressive target"] = &ActionContext::aggressive_target;
|
||||||
creators["attack anything"] = &ActionContext::attack_anything;
|
creators["attack anything"] = &ActionContext::attack_anything;
|
||||||
creators["attack least hp target"] = &ActionContext::attack_least_hp_target;
|
creators["attack least hp target"] = &ActionContext::attack_least_hp_target;
|
||||||
creators["attack enemy player"] = &ActionContext::attack_enemy_player;
|
creators["attack enemy player"] = &ActionContext::attack_enemy_player;
|
||||||
@@ -315,6 +316,7 @@ private:
|
|||||||
static Action* suggest_what_to_do(PlayerbotAI* botAI) { return new SuggestWhatToDoAction(botAI); }
|
static Action* suggest_what_to_do(PlayerbotAI* botAI) { return new SuggestWhatToDoAction(botAI); }
|
||||||
static Action* suggest_trade(PlayerbotAI* botAI) { return new SuggestTradeAction(botAI); }
|
static Action* suggest_trade(PlayerbotAI* botAI) { return new SuggestTradeAction(botAI); }
|
||||||
static Action* suggest_dungeon(PlayerbotAI* botAI) { return new SuggestDungeonAction(botAI); }
|
static Action* suggest_dungeon(PlayerbotAI* botAI) { return new SuggestDungeonAction(botAI); }
|
||||||
|
static Action* aggressive_target(PlayerbotAI* botAI) { return new AggressiveTargetAction(botAI); }
|
||||||
static Action* attack_anything(PlayerbotAI* botAI) { return new AttackAnythingAction(botAI); }
|
static Action* attack_anything(PlayerbotAI* botAI) { return new AttackAnythingAction(botAI); }
|
||||||
static Action* attack_least_hp_target(PlayerbotAI* botAI) { return new AttackLeastHpTargetAction(botAI); }
|
static Action* attack_least_hp_target(PlayerbotAI* botAI) { return new AttackLeastHpTargetAction(botAI); }
|
||||||
static Action* attack_enemy_player(PlayerbotAI* botAI) { return new AttackEnemyPlayerAction(botAI); }
|
static Action* attack_enemy_player(PlayerbotAI* botAI) { return new AttackEnemyPlayerAction(botAI); }
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
#include "AcceptBattlegroundInvitationAction.h"
|
#include "AcceptBattlegroundInvitationAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool AcceptBgInvitationAction::Execute(Event event)
|
bool AcceptBgInvitationAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint8 type = 0; // arenatype if arena
|
uint8 type = 0; // arenatype if arena
|
||||||
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||||
@@ -18,9 +18,9 @@ bool AcceptBgInvitationAction::Execute(Event event)
|
|||||||
|
|
||||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||||
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
||||||
// packet << bgTypeId_ << action;
|
|
||||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||||
|
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ bool AddLootAction::Execute(Event event)
|
|||||||
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddAllLootAction::Execute(Event event)
|
bool AddAllLootAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ bool ReachAreaTriggerAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AreaTriggerAction::Execute(Event event)
|
bool AreaTriggerAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
#include "AutoMaintenanceOnLevelupAction.h"
|
#include "AutoMaintenanceOnLevelupAction.h"
|
||||||
|
|
||||||
#include "GuildMgr.h"
|
#include "SpellMgr.h"
|
||||||
|
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
|
|
||||||
bool AutoMaintenanceOnLevelupAction::Execute(Event event)
|
bool AutoMaintenanceOnLevelupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
AutoPickTalents();
|
AutoPickTalents();
|
||||||
AutoLearnSpell();
|
AutoLearnSpell();
|
||||||
AutoUpgradeEquip();
|
AutoUpgradeEquip();
|
||||||
AutoTeleportForLevel();
|
AutoTeleportForLevel();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,8 @@
|
|||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PositionValue.h"
|
#include "PositionValue.h"
|
||||||
#include "UpdateTime.h"
|
|
||||||
|
|
||||||
bool BGJoinAction::Execute(Event event)
|
bool BGJoinAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 queueType = AI_VALUE(uint32, "bg type");
|
uint32 queueType = AI_VALUE(uint32, "bg type");
|
||||||
if (!queueType) // force join to fill bg
|
if (!queueType) // force join to fill bg
|
||||||
@@ -25,8 +24,6 @@ bool BGJoinAction::Execute(Event event)
|
|||||||
|
|
||||||
BattlegroundQueueTypeId queueTypeId = (BattlegroundQueueTypeId)bgList[urand(0, bgList.size() - 1)];
|
BattlegroundQueueTypeId queueTypeId = (BattlegroundQueueTypeId)bgList[urand(0, bgList.size() - 1)];
|
||||||
BattlegroundTypeId bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
BattlegroundTypeId bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
||||||
BattlegroundBracketId bracketId;
|
|
||||||
bool isArena = false;
|
|
||||||
bool isRated = false;
|
bool isRated = false;
|
||||||
|
|
||||||
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
|
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
|
||||||
@@ -38,12 +35,8 @@ bool BGJoinAction::Execute(Event event)
|
|||||||
if (!pvpDiff)
|
if (!pvpDiff)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bracketId = pvpDiff->GetBracketId();
|
|
||||||
|
|
||||||
if (ArenaType type = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId)))
|
if (ArenaType type = ArenaType(BattlegroundMgr::BGArenaType(queueTypeId)))
|
||||||
{
|
{
|
||||||
isArena = true;
|
|
||||||
|
|
||||||
std::vector<uint32>::iterator i = find(ratedList.begin(), ratedList.end(), queueTypeId);
|
std::vector<uint32>::iterator i = find(ratedList.begin(), ratedList.end(), queueTypeId);
|
||||||
if (i != ratedList.end())
|
if (i != ratedList.end())
|
||||||
isRated = true;
|
isRated = true;
|
||||||
@@ -409,8 +402,6 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
|||||||
|
|
||||||
bracketId = pvpDiff->GetBracketId();
|
bracketId = pvpDiff->GetBracketId();
|
||||||
|
|
||||||
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
|
|
||||||
uint32 TeamSize = bg->GetMaxPlayersPerTeam();
|
|
||||||
TeamId teamId = bot->GetTeamId();
|
TeamId teamId = bot->GetTeamId();
|
||||||
|
|
||||||
// check if already in queue
|
// check if already in queue
|
||||||
@@ -487,8 +478,6 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
|||||||
if (isArena)
|
if (isArena)
|
||||||
{
|
{
|
||||||
isArena = true;
|
isArena = true;
|
||||||
BracketSize = type * 2;
|
|
||||||
TeamSize = type;
|
|
||||||
isRated = botAI->GetAiObjectContext()->GetValue<uint32>("arena type")->Get();
|
isRated = botAI->GetAiObjectContext()->GetValue<uint32>("arena type")->Get();
|
||||||
|
|
||||||
if (joinAsGroup)
|
if (joinAsGroup)
|
||||||
@@ -653,7 +642,7 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BGLeaveAction::Execute(Event event)
|
bool BGLeaveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
||||||
return false;
|
return false;
|
||||||
@@ -1064,7 +1053,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 +1069,7 @@ bool BGStatusCheckAction::Execute(Event event)
|
|||||||
|
|
||||||
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||||
|
|
||||||
bool BGStrategyCheckAction::Execute(Event event)
|
bool BGStrategyCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1557,7 +1557,7 @@ bool BGTactics::eyJumpDown()
|
|||||||
//
|
//
|
||||||
// actual bg tactics below
|
// actual bg tactics below
|
||||||
//
|
//
|
||||||
bool BGTactics::Execute(Event event)
|
bool BGTactics::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Battleground* bg = bot->GetBattleground();
|
Battleground* bg = bot->GetBattleground();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
@@ -2497,7 +2497,6 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
EYBotStrategy strategyHorde = static_cast<EYBotStrategy>(GetBotStrategyForTeam(bg, TEAM_HORDE));
|
EYBotStrategy strategyHorde = static_cast<EYBotStrategy>(GetBotStrategyForTeam(bg, TEAM_HORDE));
|
||||||
EYBotStrategy strategyAlliance = static_cast<EYBotStrategy>(GetBotStrategyForTeam(bg, TEAM_ALLIANCE));
|
EYBotStrategy strategyAlliance = static_cast<EYBotStrategy>(GetBotStrategyForTeam(bg, TEAM_ALLIANCE));
|
||||||
EYBotStrategy strategy = (team == TEAM_ALLIANCE) ? strategyAlliance : strategyHorde;
|
EYBotStrategy strategy = (team == TEAM_ALLIANCE) ? strategyAlliance : strategyHorde;
|
||||||
EYBotStrategy enemyStrategy = (team == TEAM_ALLIANCE) ? strategyHorde : strategyAlliance;
|
|
||||||
|
|
||||||
auto IsOwned = [&](uint32 nodeId) -> bool
|
auto IsOwned = [&](uint32 nodeId) -> bool
|
||||||
{ return eyeOfTheStormBG->GetCapturePointInfo(nodeId)._ownerTeamId == team; };
|
{ return eyeOfTheStormBG->GetCapturePointInfo(nodeId)._ownerTeamId == team; };
|
||||||
@@ -3231,7 +3230,6 @@ bool BGTactics::selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths)
|
|||||||
if (bgType == BATTLEGROUND_RB)
|
if (bgType == BATTLEGROUND_RB)
|
||||||
bgType = bg->GetBgTypeID(true);
|
bgType = bg->GetBgTypeID(true);
|
||||||
|
|
||||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
|
||||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()["bg objective"];
|
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()["bg objective"];
|
||||||
if (!pos.isSet())
|
if (!pos.isSet())
|
||||||
return false;
|
return false;
|
||||||
@@ -4249,7 +4247,7 @@ bool BGTactics::IsLockedInsideKeep()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArenaTactics::Execute(Event event)
|
bool ArenaTactics::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->InBattleground())
|
if (!bot->InBattleground())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ bool BossFireResistanceAction::isUseful()
|
|||||||
return bossFireResistanceTrigger.IsActive();
|
return bossFireResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossFireResistanceAction::Execute(Event event)
|
bool BossFireResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinFireResistanceStrategy paladinFireResistanceStrategy(botAI);
|
PaladinFireResistanceStrategy paladinFireResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFireResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFireResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@@ -32,7 +32,7 @@ bool BossFrostResistanceAction::isUseful()
|
|||||||
return bossFrostResistanceTrigger.IsActive();
|
return bossFrostResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossFrostResistanceAction::Execute(Event event)
|
bool BossFrostResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinFrostResistanceStrategy paladinFrostResistanceStrategy(botAI);
|
PaladinFrostResistanceStrategy paladinFrostResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFrostResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinFrostResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@@ -46,7 +46,7 @@ bool BossNatureResistanceAction::isUseful()
|
|||||||
return bossNatureResistanceTrigger.IsActive();
|
return bossNatureResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossNatureResistanceAction::Execute(Event event)
|
bool BossNatureResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
HunterNatureResistanceStrategy hunterNatureResistanceStrategy(botAI);
|
HunterNatureResistanceStrategy hunterNatureResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + hunterNatureResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
@@ -60,7 +60,7 @@ bool BossShadowResistanceAction::isUseful()
|
|||||||
return bossShadowResistanceTrigger.IsActive();
|
return bossShadowResistanceTrigger.IsActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossShadowResistanceAction::Execute(Event event)
|
bool BossShadowResistanceAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
PaladinShadowResistanceStrategy paladinShadowResistanceStrategy(botAI);
|
||||||
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
botAI->ChangeStrategy(ADD_STRATEGY_CHAR + paladinShadowResistanceStrategy.getName(), BotState::BOT_STATE_COMBAT);
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
|
|||||||
return botAI->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
|
return botAI->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisEnchantRandomItemAction::Execute(Event event)
|
bool DisEnchantRandomItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::vector<Item*> items =
|
std::vector<Item*> items =
|
||||||
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "PlayerbotFactory.h"
|
#include "PlayerbotFactory.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "AiObjectContext.h"
|
#include "AiObjectContext.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
|
||||||
bool ChangeTalentsAction::Execute(Event event)
|
bool ChangeTalentsAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
@@ -184,7 +184,7 @@ 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)
|
||||||
@@ -201,7 +201,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
|||||||
// // }
|
// // }
|
||||||
// // }
|
// // }
|
||||||
|
|
||||||
// return std::move(ret);
|
// return ret;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// TalentPath* ChangeTalentsAction::getPremadePath(uint32 id)
|
// TalentPath* ChangeTalentsAction::getPremadePath(uint32 id)
|
||||||
@@ -368,11 +368,11 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
|||||||
// return nullptr;
|
// return nullptr;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
bool AutoSetTalentsAction::Execute(Event event)
|
bool AutoSetTalentsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig.autoPickTalents || !sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!PlayerbotAIConfig::instance().autoPickTalents || !RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bot->GetFreeTalentPoints() <= 0)
|
if (bot->GetFreeTalentPoints() <= 0)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ void PositionsResetAction::SetStayPosition(float x, float y, float z)
|
|||||||
posMap["stay"] = pos;
|
posMap["stay"] = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FollowChatShortcutAction::Execute(Event event)
|
bool FollowChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -68,9 +68,7 @@ bool FollowChatShortcutAction::Execute(Event event)
|
|||||||
std::string const target = formation->GetTargetName();
|
std::string const target = formation->GetTargetName();
|
||||||
bool moved = false;
|
bool moved = false;
|
||||||
if (!target.empty())
|
if (!target.empty())
|
||||||
{
|
|
||||||
moved = Follow(AI_VALUE(Unit*, target));
|
moved = Follow(AI_VALUE(Unit*, target));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WorldLocation loc = formation->GetLocation();
|
WorldLocation loc = formation->GetLocation();
|
||||||
@@ -83,9 +81,7 @@ bool FollowChatShortcutAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Pet* pet = bot->GetPet())
|
if (Pet* pet = bot->GetPet())
|
||||||
{
|
|
||||||
botAI->PetFollow();
|
botAI->PetFollow();
|
||||||
}
|
|
||||||
|
|
||||||
if (moved)
|
if (moved)
|
||||||
{
|
{
|
||||||
@@ -116,7 +112,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 +129,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 +144,7 @@ bool MoveFromGroupChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeChatShortcutAction::Execute(Event event)
|
bool FleeChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
@@ -171,7 +167,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 +184,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 +200,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 +220,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 +237,7 @@ bool MaxDpsChatShortcutAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BwlChatShortcutAction::Execute(Event event)
|
bool BwlChatShortcutAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildTaskMgr.h"
|
#include "GuildTaskMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool CheckMailAction::Execute(Event event)
|
bool CheckMailAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p;
|
WorldPacket p;
|
||||||
bot->GetSession()->HandleQueryNextMailTime(p);
|
bot->GetSession()->HandleQueryNextMailTime(p);
|
||||||
@@ -28,7 +29,7 @@ bool CheckMailAction::Execute(Event event)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 account = owner->GetSession()->GetAccountId();
|
uint32 account = owner->GetSession()->GetAccountId();
|
||||||
if (sPlayerbotAIConfig.IsInRandomAccountList(account))
|
if (PlayerbotAIConfig::instance().IsInRandomAccountList(account))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ProcessMail(mail, owner, trans);
|
ProcessMail(mail, owner, trans);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -6,12 +6,15 @@
|
|||||||
#include "CheckValuesAction.h"
|
#include "CheckValuesAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "TravelNode.h"
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
||||||
|
|
||||||
bool CheckValuesAction::Execute(Event event)
|
bool CheckValuesAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
if (botAI->HasStrategy("debug move", BOT_STATE_NON_COMBAT))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "BattlegroundMgr.h"
|
|
||||||
#include "BudgetValues.h"
|
#include "BudgetValues.h"
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
#include "GuildCreateActions.h"
|
#include "GuildCreateActions.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RpgSubActions.h"
|
#include "RpgSubActions.h"
|
||||||
#include "Util.h"
|
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "PossibleRpgTargetsValue.h"
|
#include "PossibleRpgTargetsValue.h"
|
||||||
|
|
||||||
@@ -112,9 +110,8 @@ 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.
|
|
||||||
Player* master = botAI->GetMaster();
|
Player* master = botAI->GetMaster();
|
||||||
GuidPosition masterRpgTarget;
|
GuidPosition masterRpgTarget;
|
||||||
if (master && master != bot && GET_PLAYERBOT_AI(master) && master->GetMapId() == bot->GetMapId() && !master->IsBeingTeleported())
|
if (master && master != bot && GET_PLAYERBOT_AI(master) && master->GetMapId() == bot->GetMapId() && !master->IsBeingTeleported())
|
||||||
@@ -126,7 +123,6 @@ bool ChooseRpgTargetAction::Execute(Event event)
|
|||||||
master = nullptr;
|
master = nullptr;
|
||||||
|
|
||||||
std::unordered_map<ObjectGuid, uint32> targets;
|
std::unordered_map<ObjectGuid, uint32> targets;
|
||||||
// uint32 num = 0; //not used, line marked for removal.
|
|
||||||
GuidVector possibleTargets = AI_VALUE(GuidVector, "possible rpg targets");
|
GuidVector possibleTargets = AI_VALUE(GuidVector, "possible rpg targets");
|
||||||
GuidVector possibleObjects = AI_VALUE(GuidVector, "nearest game objects no los");
|
GuidVector possibleObjects = AI_VALUE(GuidVector, "nearest game objects no los");
|
||||||
GuidVector possiblePlayers = AI_VALUE(GuidVector, "nearest friendly players");
|
GuidVector possiblePlayers = AI_VALUE(GuidVector, "nearest friendly players");
|
||||||
@@ -320,7 +316,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +330,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
|||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,38 +30,15 @@ bool AttackEnemyFlagCarrierAction::isUseful()
|
|||||||
PlayerHasFlag::IsCapturingFlag(bot);
|
PlayerHasFlag::IsCapturingFlag(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AttackAnythingAction::isUseful()
|
bool AggressiveTargetAction::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())
|
if (bot->IsInCombat())
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DropTargetAction::Execute(Event event)
|
bool DropTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
Unit* target = context->GetValue<Unit*>("current target")->Get();
|
||||||
if (target && target->isDead())
|
if (target && target->isDead())
|
||||||
@@ -127,7 +104,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 +145,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");
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,15 @@ public:
|
|||||||
std::string const GetTargetName() override { return "tank target"; }
|
std::string const GetTargetName() override { return "tank target"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AggressiveTargetAction : public AttackAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AggressiveTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "aggressive target") {}
|
||||||
|
|
||||||
|
std::string const GetTargetName() override { return "aggressive target"; }
|
||||||
|
bool isUseful() override;
|
||||||
|
};
|
||||||
|
|
||||||
class AttackAnythingAction : public AttackAction
|
class AttackAnythingAction : public AttackAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
@@ -232,15 +232,6 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
|||||||
QuestTravelDestination* QuestDestination = (QuestTravelDestination*)destination;
|
QuestTravelDestination* QuestDestination = (QuestTravelDestination*)destination;
|
||||||
Quest const* quest = QuestDestination->GetQuestTemplate();
|
Quest const* quest = QuestDestination->GetQuestTemplate();
|
||||||
WorldPosition botLocation(bot);
|
WorldPosition botLocation(bot);
|
||||||
|
|
||||||
CreatureTemplate const* cInfo = nullptr;
|
|
||||||
GameObjectTemplate const* gInfo = nullptr;
|
|
||||||
|
|
||||||
if (destination->getEntry() > 0)
|
|
||||||
cInfo = sObjectMgr->GetCreatureTemplate(destination->getEntry());
|
|
||||||
else
|
|
||||||
gInfo = sObjectMgr->GetGameObjectTemplate(destination->getEntry() * -1);
|
|
||||||
|
|
||||||
std::string Sub;
|
std::string Sub;
|
||||||
|
|
||||||
if (newTarget->isGroupCopy())
|
if (newTarget->isGroupCopy())
|
||||||
@@ -823,10 +814,6 @@ char* strstri(char const* haystack, char const* needle);
|
|||||||
|
|
||||||
TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::string const name, bool zones, bool npcs, bool quests, bool mobs, bool bosses)
|
TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::string const name, bool zones, bool npcs, bool quests, bool mobs, bool bosses)
|
||||||
{
|
{
|
||||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
|
||||||
|
|
||||||
// AiObjectContext* context = botAI->GetAiObjectContext(); //not used, line marked for removal.
|
|
||||||
|
|
||||||
std::vector<TravelDestination*> dests;
|
std::vector<TravelDestination*> dests;
|
||||||
|
|
||||||
//Quests
|
//Quests
|
||||||
|
|||||||
@@ -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)
|
||||||
{
|
{
|
||||||
@@ -28,8 +32,8 @@ 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()) << ",";
|
||||||
@@ -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,12 +516,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());
|
||||||
|
|
||||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
bot->SummonCreature(effect, botPos.GetPositionX(), botPos.GetPositionY(), botPos.GetPositionZ(), 0,
|
||||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -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");
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "EmoteAction.h"
|
#include "EmoteAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
@@ -787,7 +786,7 @@ bool EmoteAction::isUseful()
|
|||||||
return time(nullptr) >= lastEmote;
|
return time(nullptr) >= lastEmote;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TalkAction::Execute(Event event)
|
bool TalkAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = botAI->GetUnit(AI_VALUE(ObjectGuid, "talk target"));
|
Unit* target = botAI->GetUnit(AI_VALUE(ObjectGuid, "talk target"));
|
||||||
if (!target)
|
if (!target)
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ void EquipAction::EquipItem(Item* item)
|
|||||||
if (itemProto->Class == ITEM_CLASS_CONTAINER)
|
if (itemProto->Class == ITEM_CLASS_CONTAINER)
|
||||||
{
|
{
|
||||||
// Attempt to equip as a bag
|
// Attempt to equip as a bag
|
||||||
Bag* pBag = reinterpret_cast<Bag*>(item);
|
|
||||||
uint8 newBagSlot = GetSmallestBagSlot();
|
uint8 newBagSlot = GetSmallestBagSlot();
|
||||||
|
|
||||||
if (newBagSlot > 0)
|
if (newBagSlot > 0)
|
||||||
{
|
{
|
||||||
uint16 src = ((bagIndex << 8) | slot);
|
uint16 src = ((bagIndex << 8) | slot);
|
||||||
@@ -328,12 +328,48 @@ void EquipAction::EquipItem(Item* item)
|
|||||||
botAI->TellMaster(out);
|
botAI->TellMaster(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipUpgradesAction::Execute(Event event)
|
ItemIds EquipAction::SelectInventoryItemsToEquip()
|
||||||
|
{
|
||||||
|
CollectItemsVisitor visitor;
|
||||||
|
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||||
|
|
||||||
|
ItemIds items;
|
||||||
|
for (auto i = visitor.items.begin(); i != visitor.items.end(); ++i)
|
||||||
|
{
|
||||||
|
Item* item = *i;
|
||||||
|
if (!item)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ItemTemplate const* itemTemplate = item->GetTemplate();
|
||||||
|
if (!itemTemplate)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//TODO Expand to Glyphs and Gems, that can be placed in equipment
|
||||||
|
//Pre-filter non-equipable items
|
||||||
|
if (itemTemplate->InventoryType == INVTYPE_NON_EQUIP)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int32 randomProperty = item->GetItemRandomPropertyId();
|
||||||
|
uint32 itemId = item->GetTemplate()->ItemId;
|
||||||
|
std::string itemUsageParam;
|
||||||
|
if (randomProperty != 0)
|
||||||
|
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
|
||||||
|
else
|
||||||
|
itemUsageParam = std::to_string(itemId);
|
||||||
|
|
||||||
|
ItemUsage usage = AI_VALUE2(ItemUsage, "item upgrade", itemUsageParam);
|
||||||
|
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
|
||||||
|
items.insert(itemId);
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EquipUpgradesPacketAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig.autoEquipUpgradeLoot && !sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!sPlayerbotAIConfig.autoEquipUpgradeLoot && !sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
std::string const source = event.GetSource();
|
||||||
if (event.GetSource() == "trade status")
|
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())
|
||||||
@@ -262,7 +262,7 @@ bool MoveNearWaterAction::isUseful()
|
|||||||
FishingSpotValue* fishingSpotValueObject = (FishingSpotValue*)context->GetValue<WorldPosition>("fishing spot");
|
FishingSpotValue* fishingSpotValueObject = (FishingSpotValue*)context->GetValue<WorldPosition>("fishing spot");
|
||||||
WorldPosition pos = fishingSpotValueObject->Get();
|
WorldPosition pos = fishingSpotValueObject->Get();
|
||||||
return !pos.IsValid() || fishingSpotValueObject->IsStale(FISHING_LOCATION_TIMEOUT) ||
|
return !pos.IsValid() || fishingSpotValueObject->IsStale(FISHING_LOCATION_TIMEOUT) ||
|
||||||
bot->GetExactDist(&pos) < 0.1f;
|
bot->GetExactDist(&pos) > 0.1f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +292,6 @@ bool MoveNearWaterAction::isPossible()
|
|||||||
// Water spot is out of range, lets look for a spot to move to for the fishing hole.
|
// Water spot is out of range, lets look for a spot to move to for the fishing hole.
|
||||||
if (distance > MAX_DISTANCE_TO_WATER || distance < MIN_DISTANCE_TO_WATER)
|
if (distance > MAX_DISTANCE_TO_WATER || distance < MIN_DISTANCE_TO_WATER)
|
||||||
{
|
{
|
||||||
float angle = bot->GetAngle(fishingHole.GetPositionX(), fishingHole.GetPositionY());
|
|
||||||
WorldPosition landSpot = FindLandRadialFromPosition(botAI, fishingHole, MIN_DISTANCE_TO_WATER, MAX_DISTANCE_TO_WATER, SEARCH_INCREMENT, fishingSearchWindow, 32);
|
WorldPosition landSpot = FindLandRadialFromPosition(botAI, fishingHole, MIN_DISTANCE_TO_WATER, MAX_DISTANCE_TO_WATER, SEARCH_INCREMENT, fishingSearchWindow, 32);
|
||||||
if (landSpot.IsValid())
|
if (landSpot.IsValid())
|
||||||
{
|
{
|
||||||
@@ -323,7 +322,6 @@ bool MoveNearWaterAction::isPossible()
|
|||||||
if (!water.IsValid())
|
if (!water.IsValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool hasLOS = bot->IsWithinLOS(water.GetPositionX(), water.GetPositionY(), water.GetPositionZ());
|
|
||||||
float angle = bot->GetAngle(water.GetPositionX(), water.GetPositionY());
|
float angle = bot->GetAngle(water.GetPositionX(), water.GetPositionY());
|
||||||
WorldPosition landSpot =
|
WorldPosition landSpot =
|
||||||
FindLandFromPosition(botAI, 0.0f, MAX_DISTANCE_TO_WATER, 1.0f, angle, water, fishingSearchWindow, false);
|
FindLandFromPosition(botAI, 0.0f, MAX_DISTANCE_TO_WATER, 1.0f, angle, water, fishingSearchWindow, false);
|
||||||
@@ -336,7 +334,7 @@ bool MoveNearWaterAction::isPossible()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipFishingPoleAction::Execute(Event event)
|
bool EquipFishingPoleAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!_pole)
|
if (!_pole)
|
||||||
return false;
|
return false;
|
||||||
@@ -463,7 +461,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 +483,7 @@ bool UseBobberAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EndMasterFishingAction::Execute(Event event)
|
bool EndMasterFishingAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->ChangeStrategy("-master fishing", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("-master fishing", BOT_STATE_NON_COMBAT);
|
||||||
return true;
|
return true;
|
||||||
@@ -503,7 +501,7 @@ bool EndMasterFishingAction::isUseful()
|
|||||||
return !nearWater.IsValid();
|
return !nearWater.IsValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoveBobberStrategyAction::Execute(Event event)
|
bool RemoveBobberStrategyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->ChangeStrategy("-use bobber", BOT_STATE_NON_COMBAT);
|
botAI->ChangeStrategy("-use bobber", BOT_STATE_NON_COMBAT);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -116,7 +113,7 @@ bool FollowAction::CanDeadFollow(Unit* target)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeToGroupLeaderAction::Execute(Event event)
|
bool FleeToGroupLeaderAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
Unit* fTarget = AI_VALUE(Unit*, "group leader");
|
||||||
bool canFollow = Follow(fTarget);
|
bool canFollow = Follow(fTarget);
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
#include "CreatureAI.h"
|
#include "CreatureAI.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "CharmInfo.h"
|
#include "CharmInfo.h"
|
||||||
#include "SharedDefines.h"
|
|
||||||
#include "ObjectGuid.h"
|
|
||||||
#include "SpellMgr.h"
|
#include "SpellMgr.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -54,7 +52,7 @@ bool MeleeAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TogglePetSpellAutoCastAction::Execute(Event event)
|
bool TogglePetSpellAutoCastAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Pet* pet = bot->GetPet();
|
Pet* pet = bot->GetPet();
|
||||||
if (!pet)
|
if (!pet)
|
||||||
@@ -119,7 +117,7 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
|
|||||||
return toggled;
|
return toggled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetAttackAction::Execute(Event event)
|
bool PetAttackAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Guardian* pet = bot->GetGuardianPet();
|
Guardian* pet = bot->GetGuardianPet();
|
||||||
if (!pet)
|
if (!pet)
|
||||||
|
|||||||
@@ -17,19 +17,17 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Language.h"
|
|
||||||
#include "GenericBuffUtils.h"
|
#include "GenericBuffUtils.h"
|
||||||
#include "PlayerbotAI.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
using ai::buff::MakeAuraQualifierForBuff;
|
using ai::buff::MakeAuraQualifierForBuff;
|
||||||
using ai::buff::UpgradeToGroupIfAppropriate;
|
|
||||||
|
|
||||||
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell)
|
CastSpellAction::CastSpellAction(PlayerbotAI* botAI, std::string const spell)
|
||||||
: Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
: Action(botAI, spell), range(botAI->GetRange("spell")), spell(spell)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CastSpellAction::Execute(Event event)
|
bool CastSpellAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (spell == "conjure food" || spell == "conjure water")
|
if (spell == "conjure food" || spell == "conjure water")
|
||||||
{
|
{
|
||||||
@@ -78,6 +76,35 @@ bool CastSpellAction::Execute(Event event)
|
|||||||
return botAI->CastSpell(spell, GetTarget());
|
return botAI->CastSpell(spell, GetTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CastSpellAction::isUseful()
|
||||||
|
{
|
||||||
|
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (spell == "mount" && !bot->IsMounted() && !bot->IsInCombat())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (spell == "mount" && bot->IsInCombat())
|
||||||
|
{
|
||||||
|
bot->Dismount();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Unit* spellTarget = GetTarget();
|
||||||
|
if (!spellTarget)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!spellTarget->IsInWorld() || spellTarget->GetMapId() != bot->GetMapId())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// float combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||||
|
// if (!botAI->IsRanged(bot))
|
||||||
|
// combatReach += 4.0f / 3.0f;
|
||||||
|
|
||||||
|
return AI_VALUE2(bool, "spell cast useful", spell);
|
||||||
|
// && ServerFacade::instance().GetDistance2d(bot, target) <= (range + combatReach);
|
||||||
|
}
|
||||||
|
|
||||||
bool CastSpellAction::isPossible()
|
bool CastSpellAction::isPossible()
|
||||||
{
|
{
|
||||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||||
@@ -106,36 +133,6 @@ bool CastSpellAction::isPossible()
|
|||||||
return botAI->CanCastSpell(spell, GetTarget());
|
return botAI->CanCastSpell(spell, GetTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CastSpellAction::isUseful()
|
|
||||||
{
|
|
||||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (spell == "mount" && !bot->IsMounted() && !bot->IsInCombat())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (spell == "mount" && bot->IsInCombat())
|
|
||||||
{
|
|
||||||
bot->Dismount();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unit* spellTarget = GetTarget();
|
|
||||||
if (!spellTarget)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!spellTarget->IsInWorld() || spellTarget->GetMapId() != bot->GetMapId())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// float combatReach = bot->GetCombatReach() + spellTarget->GetCombatReach();
|
|
||||||
// if (!botAI->IsRanged(bot))
|
|
||||||
// combatReach += 4.0f / 3.0f;
|
|
||||||
|
|
||||||
return spellTarget &&
|
|
||||||
AI_VALUE2(bool, "spell cast useful",
|
|
||||||
spell); // && ServerFacade::instance().GetDistance2d(bot, spellTarget) <= (range + combatReach);
|
|
||||||
}
|
|
||||||
|
|
||||||
CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||||
{
|
{
|
||||||
range = ATTACK_DISTANCE;
|
range = ATTACK_DISTANCE;
|
||||||
@@ -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)
|
||||||
@@ -28,7 +28,6 @@ bool GiveItemAction::Execute(Event event)
|
|||||||
if (receiverAi->GetAiObjectContext()->GetValue<uint32>("item count", item)->Get())
|
if (receiverAi->GetAiObjectContext()->GetValue<uint32>("item count", item)->Get())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool moved = false;
|
|
||||||
std::vector<Item*> items = InventoryAction::parseItems(item, ITERATE_ITEMS_IN_BAGS);
|
std::vector<Item*> items = InventoryAction::parseItems(item, ITERATE_ITEMS_IN_BAGS);
|
||||||
for (Item* item : items)
|
for (Item* item : items)
|
||||||
{
|
{
|
||||||
@@ -42,7 +41,6 @@ bool GiveItemAction::Execute(Event event)
|
|||||||
bot->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true);
|
bot->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true);
|
||||||
item->SetOwnerGUID(target->GetGUID());
|
item->SetOwnerGUID(target->GetGUID());
|
||||||
receiver->MoveItemToInventory(dest, item, true);
|
receiver->MoveItemToInventory(dest, item, true);
|
||||||
moved = true;
|
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Got " << chat->FormatItem(item->GetTemplate(), item->GetCount()) << " from " << bot->GetName();
|
out << "Got " << chat->FormatItem(item->GetTemplate(), item->GetCount()) << " from " << bot->GetName();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet") {}
|
GreetAction::GreetAction(PlayerbotAI* botAI) : Action(botAI, "greet") {}
|
||||||
|
|
||||||
bool GreetAction::Execute(Event event)
|
bool GreetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
ObjectGuid guid = AI_VALUE(ObjectGuid, "new player nearby");
|
ObjectGuid guid = AI_VALUE(ObjectGuid, "new player nearby");
|
||||||
if (!guid || !guid.IsPlayer())
|
if (!guid || !guid.IsPlayer())
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
#include "GuildBankAction.h"
|
#include "GuildBankAction.h"
|
||||||
|
|
||||||
#include "GuildMgr.h"
|
#include "GuildMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool GuildBankAction::Execute(Event event)
|
bool GuildBankAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,12 +12,11 @@
|
|||||||
#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;
|
|
||||||
for (GuidVector::iterator i = vendors.begin(); i != vendors.end(); ++i)
|
for (GuidVector::iterator i = vendors.begin(); i != vendors.end(); ++i)
|
||||||
{
|
{
|
||||||
ObjectGuid vendorguid = *i;
|
ObjectGuid vendorguid = *i;
|
||||||
@@ -97,7 +96,6 @@ bool BuyPetitionAction::canBuyPetition(Player* bot)
|
|||||||
|
|
||||||
bool PetitionOfferAction::Execute(Event event)
|
bool PetitionOfferAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
uint32 petitionEntry = 5863; // GUILD_CHARTER
|
|
||||||
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
|
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
|
||||||
|
|
||||||
if (petitions.empty())
|
if (petitions.empty())
|
||||||
@@ -152,7 +150,7 @@ bool PetitionOfferAction::Execute(Event event)
|
|||||||
|
|
||||||
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
|
bool PetitionOfferAction::isUseful() { return !bot->GetGuildId(); }
|
||||||
|
|
||||||
bool PetitionOfferNearbyAction::Execute(Event event)
|
bool PetitionOfferNearbyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 found = 0;
|
uint32 found = 0;
|
||||||
|
|
||||||
@@ -209,10 +207,9 @@ 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;
|
|
||||||
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
|
std::vector<Item*> petitions = AI_VALUE2(std::vector<Item*>, "inventory items", chat->FormatQItem(5863));
|
||||||
|
|
||||||
if (petitions.empty())
|
if (petitions.empty())
|
||||||
@@ -297,7 +294,7 @@ bool PetitionTurnInAction::isUseful()
|
|||||||
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
!context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuyTabardAction::Execute(Event event)
|
bool BuyTabardAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
bool canBuy = botAI->DoSpecificAction("buy", Event("buy tabard", "Hitem:5976:"));
|
bool canBuy = botAI->DoSpecificAction("buy", Event("buy tabard", "Hitem:5976:"));
|
||||||
if (canBuy && AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)))
|
if (canBuy && AI_VALUE2(uint32, "item count", chat->FormatQItem(5976)))
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ bool GuildRemoveAction::PlayerIsValid(Player* member)
|
|||||||
return member->GetGuildId() == bot->GetGuildId() && GetRankId(bot) < GetRankId(member);
|
return member->GetGuildId() == bot->GetGuildId() && GetRankId(bot) < GetRankId(member);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool GuildManageNearbyAction::Execute(Event event)
|
bool GuildManageNearbyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 found = 0;
|
uint32 found = 0;
|
||||||
|
|
||||||
@@ -149,7 +149,6 @@ bool GuildManageNearbyAction::Execute(Event event)
|
|||||||
// Promote or demote nearby members based on chance.
|
// Promote or demote nearby members based on chance.
|
||||||
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId())
|
if (player->GetGuildId() && player->GetGuildId() == bot->GetGuildId())
|
||||||
{
|
{
|
||||||
Guild::Member* member = guild->GetMember(player->GetGUID());
|
|
||||||
uint32 dCount = AI_VALUE(uint32, "death count");
|
uint32 dCount = AI_VALUE(uint32, "death count");
|
||||||
|
|
||||||
if (!urand(0, 30) && dCount < 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_PROMOTE)
|
if (!urand(0, 30) && dCount < 2 && guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_PROMOTE)
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
#include "ChatActionContext.h"
|
#include "ChatActionContext.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help") { chatContext = new ChatActionContext(); }
|
HelpAction::HelpAction(PlayerbotAI* botAI) : Action(botAI, "help") { chatContext = new ChatActionContext(); }
|
||||||
|
|
||||||
HelpAction::~HelpAction() { delete chatContext; }
|
HelpAction::~HelpAction() { delete chatContext; }
|
||||||
|
|
||||||
bool HelpAction::Execute(Event event)
|
bool HelpAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
TellChatCommands();
|
TellChatCommands();
|
||||||
TellStrategies();
|
TellStrategies();
|
||||||
|
|||||||
@@ -6,15 +6,16 @@
|
|||||||
#include "HireAction.h"
|
#include "HireAction.h"
|
||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool HireAction::Execute(Event event)
|
bool HireAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* master = GetMaster();
|
Player* master = GetMaster();
|
||||||
if (!master)
|
if (!master)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 account = master->GetSession()->GetAccountId();
|
uint32 account = master->GetSession()->GetAccountId();
|
||||||
@@ -39,7 +40,7 @@ bool HireAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 discount = sRandomPlayerbotMgr.GetTradeDiscount(bot, master);
|
uint32 discount = RandomPlayerbotMgr::instance().GetTradeDiscount(bot, master);
|
||||||
uint32 m = 1 + (bot->GetLevel() / 10);
|
uint32 m = 1 + (bot->GetLevel() / 10);
|
||||||
uint32 moneyReq = m * 5000 * bot->GetLevel();
|
uint32 moneyReq = m * 5000 * bot->GetLevel();
|
||||||
if (discount < moneyReq)
|
if (discount < moneyReq)
|
||||||
@@ -54,7 +55,7 @@ bool HireAction::Execute(Event event)
|
|||||||
botAI->TellMaster("I will join you at your next relogin");
|
botAI->TellMaster("I will join you at your next relogin");
|
||||||
|
|
||||||
bot->SetMoney(moneyReq);
|
bot->SetMoney(moneyReq);
|
||||||
sRandomPlayerbotMgr.Remove(bot);
|
RandomPlayerbotMgr::instance().Remove(bot);
|
||||||
CharacterDatabase.Execute("UPDATE characters SET account = {} WHERE guid = {}", account,
|
CharacterDatabase.Execute("UPDATE characters SET account = {} WHERE guid = {}", account,
|
||||||
bot->GetGUID().GetCounter());
|
bot->GetGUID().GetCounter());
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
ImbueWithPoisonAction::ImbueWithPoisonAction(PlayerbotAI* botAI) : Action(botAI, "apply poison") {}
|
ImbueWithPoisonAction::ImbueWithPoisonAction(PlayerbotAI* botAI) : Action(botAI, "apply poison") {}
|
||||||
|
|
||||||
bool ImbueWithPoisonAction::Execute(Event event)
|
bool ImbueWithPoisonAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@@ -103,7 +103,7 @@ bool ImbueWithPoisonAction::Execute(Event event)
|
|||||||
// Search and apply stone to weapons
|
// Search and apply stone to weapons
|
||||||
ImbueWithStoneAction::ImbueWithStoneAction(PlayerbotAI* botAI) : Action(botAI, "apply stone") {}
|
ImbueWithStoneAction::ImbueWithStoneAction(PlayerbotAI* botAI) : Action(botAI, "apply stone") {}
|
||||||
|
|
||||||
bool ImbueWithStoneAction::Execute(Event event)
|
bool ImbueWithStoneAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@@ -148,7 +148,7 @@ bool ImbueWithStoneAction::Execute(Event event)
|
|||||||
// Search and apply oil to weapons
|
// Search and apply oil to weapons
|
||||||
ImbueWithOilAction::ImbueWithOilAction(PlayerbotAI* botAI) : Action(botAI, "apply oil") {}
|
ImbueWithOilAction::ImbueWithOilAction(PlayerbotAI* botAI) : Action(botAI, "apply oil") {}
|
||||||
|
|
||||||
bool ImbueWithOilAction::Execute(Event event)
|
bool ImbueWithOilAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->IsInCombat())
|
if (bot->IsInCombat())
|
||||||
return false;
|
return false;
|
||||||
@@ -201,7 +201,7 @@ static const uint32 uPrioritizedHealingItemIds[19] = {
|
|||||||
|
|
||||||
TryEmergencyAction::TryEmergencyAction(PlayerbotAI* botAI) : Action(botAI, "try emergency") {}
|
TryEmergencyAction::TryEmergencyAction(PlayerbotAI* botAI) : Action(botAI, "try emergency") {}
|
||||||
|
|
||||||
bool TryEmergencyAction::Execute(Event event)
|
bool TryEmergencyAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Do not use consumable if bot can heal self
|
// Do not use consumable if bot can heal self
|
||||||
if ((botAI->IsHeal(bot)) && (bot->GetPowerPct(POWER_MANA) > 20))
|
if ((botAI->IsHeal(bot)) && (bot->GetPowerPct(POWER_MANA) > 20))
|
||||||
|
|||||||
@@ -351,9 +351,7 @@ uint32 InventoryAction::GetItemCount(FindItemVisitor* visitor, IterateItemsMask
|
|||||||
|
|
||||||
std::vector<Item*>& items = visitor->GetResult();
|
std::vector<Item*>& items = visitor->GetResult();
|
||||||
for (Item* item : items)
|
for (Item* item : items)
|
||||||
{
|
|
||||||
count += item->GetCount();
|
count += item->GetCount();
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildMgr.h"
|
#include "GuildMgr.h"
|
||||||
#include "Log.h"
|
|
||||||
#include "PlayerbotOperations.h"
|
#include "PlayerbotOperations.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PlayerbotWorldThreadProcessor.h"
|
#include "PlayerbotWorldThreadProcessor.h"
|
||||||
@@ -44,7 +43,7 @@ bool InviteToGroupAction::Invite(Player* inviter, Player* player)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InviteNearbyToGroupAction::Execute(Event event)
|
bool InviteNearbyToGroupAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
|
GuidVector nearGuids = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get();
|
||||||
for (auto& i : nearGuids)
|
for (auto& i : nearGuids)
|
||||||
@@ -62,7 +61,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
if (player->GetGroup())
|
if (player->GetGroup())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!sPlayerbotAIConfig.randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
if (!PlayerbotAIConfig::instance().randomBotInvitePlayer && GET_PLAYERBOT_AI(player)->IsRealPlayer())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
@@ -88,7 +87,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
|
if (abs(int32(player->GetLevel() - bot->GetLevel())) > 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.sightDistance)
|
if (ServerFacade::instance().GetDistance2d(bot, player) > PlayerbotAIConfig::instance().sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// When inviting the 5th member of the group convert to raid for future invites.
|
// When inviting the 5th member of the group convert to raid for future invites.
|
||||||
@@ -99,7 +98,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig.inviteChat && sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (PlayerbotAIConfig::instance().inviteChat && RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> placeholders;
|
std::map<std::string, std::string> placeholders;
|
||||||
placeholders["%player"] = player->GetName();
|
placeholders["%player"] = player->GetName();
|
||||||
@@ -120,7 +119,7 @@ bool InviteNearbyToGroupAction::Execute(Event event)
|
|||||||
|
|
||||||
bool InviteNearbyToGroupAction::isUseful()
|
bool InviteNearbyToGroupAction::isUseful()
|
||||||
{
|
{
|
||||||
if (!sPlayerbotAIConfig.randomBotGroupNearby)
|
if (!PlayerbotAIConfig::instance().randomBotGroupNearby)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
@@ -166,10 +165,8 @@ 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());
|
|
||||||
|
|
||||||
for (auto& member : getGuildMembers())
|
for (auto& member : getGuildMembers())
|
||||||
{
|
{
|
||||||
Player* player = member;
|
Player* player = member;
|
||||||
@@ -186,7 +183,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 +218,7 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
|
player->GetLevel() + 5) // Do not invite members that too low level or risk dragging them to deadly places.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!playerAi && ServerFacade::instance().GetDistance2d(bot, player) > sPlayerbotAIConfig.sightDistance)
|
if (!playerAi && ServerFacade::instance().GetDistance2d(bot, player) > PlayerbotAIConfig::instance().sightDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
@@ -233,8 +230,8 @@ bool InviteGuildToGroupAction::Execute(Event event)
|
|||||||
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
PlayerbotWorldThreadProcessor::instance().QueueOperation(std::move(convertOp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sPlayerbotAIConfig.inviteChat &&
|
if (PlayerbotAIConfig::instance().inviteChat &&
|
||||||
(sRandomPlayerbotMgr.IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
(RandomPlayerbotMgr::instance().IsRandomBot(bot) || !botAI->HasActivePlayerMaster()))
|
||||||
{
|
{
|
||||||
BroadcastHelper::BroadcastGuildGroupOrRaidInvite(botAI, bot, player, group);
|
BroadcastHelper::BroadcastGuildGroupOrRaidInvite(botAI, bot, player, group);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ bool LeaveGroupAction::Leave()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LeaveFarAwayAction::Execute(Event event)
|
bool LeaveFarAwayAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// allow bot to leave party when they want
|
// allow bot to leave party when they want
|
||||||
return Leave();
|
return Leave();
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "LFGPackets.h"
|
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
|
#include "RandomPlayerbotMgr.h"
|
||||||
|
|
||||||
using namespace lfg;
|
using namespace lfg;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
|
|||||||
|
|
||||||
uint32 LfgJoinAction::GetRoles()
|
uint32 LfgJoinAction::GetRoles()
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
{
|
{
|
||||||
if (botAI->IsTank(bot))
|
if (botAI->IsTank(bot))
|
||||||
return PLAYER_ROLE_TANK;
|
return PLAYER_ROLE_TANK;
|
||||||
@@ -101,7 +101,7 @@ bool LfgJoinAction::JoinLFG()
|
|||||||
LfgDungeonSet list;
|
LfgDungeonSet list;
|
||||||
std::vector<uint32> selected;
|
std::vector<uint32> selected;
|
||||||
|
|
||||||
std::vector<uint32> dungeons = sRandomPlayerbotMgr.LfgDungeons[bot->GetTeamId()];
|
std::vector<uint32> dungeons = RandomPlayerbotMgr::instance().LfgDungeons[bot->GetTeamId()];
|
||||||
if (!dungeons.size())
|
if (!dungeons.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ bool LfgJoinAction::JoinLFG()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LfgRoleCheckAction::Execute(Event event)
|
bool LfgRoleCheckAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Group* group = bot->GetGroup())
|
if (Group* group = bot->GetGroup())
|
||||||
{
|
{
|
||||||
@@ -216,9 +216,9 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
*packet << id << true;
|
*packet << id << true;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr.IsRandomBot(bot) && !bot->GetGroup())
|
if (RandomPlayerbotMgr::instance().IsRandomBot(bot) && !bot->GetGroup())
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr.Refresh(bot);
|
RandomPlayerbotMgr::instance().Refresh(bot);
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,9 +251,9 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
*packet << id << true;
|
*packet << id << true;
|
||||||
bot->GetSession()->QueuePacket(packet);
|
bot->GetSession()->QueuePacket(packet);
|
||||||
|
|
||||||
if (sRandomPlayerbotMgr.IsRandomBot(bot) && !bot->GetGroup())
|
if (RandomPlayerbotMgr::instance().IsRandomBot(bot) && !bot->GetGroup())
|
||||||
{
|
{
|
||||||
sRandomPlayerbotMgr.Refresh(bot);
|
RandomPlayerbotMgr::instance().Refresh(bot);
|
||||||
botAI->ResetStrategies();
|
botAI->ResetStrategies();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ bool LfgAcceptAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LfgLeaveAction::Execute(Event event)
|
bool LfgLeaveAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// Don't leave if lfg strategy enabled
|
// Don't leave if lfg strategy enabled
|
||||||
// if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
|
// if (botAI->HasStrategy("lfg", BOT_STATE_NON_COMBAT))
|
||||||
@@ -337,7 +337,7 @@ bool LfgJoinAction::isUseful()
|
|||||||
if (bot->isDead())
|
if (bot->isDead())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!RandomPlayerbotMgr::instance().IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Map* map = bot->GetMap();
|
Map* map = bot->GetMap();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "PlayerbotAIConfig.h"
|
#include "PlayerbotAIConfig.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool LootRollAction::Execute(Event event)
|
bool LootRollAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Group* group = bot->GetGroup();
|
Group* group = bot->GetGroup();
|
||||||
if (!group)
|
if (!group)
|
||||||
@@ -27,7 +27,6 @@ bool LootRollAction::Execute(Event event)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ObjectGuid guid = roll->itemGUID;
|
ObjectGuid guid = roll->itemGUID;
|
||||||
uint32 slot = roll->itemSlot;
|
|
||||||
uint32 itemId = roll->itemid;
|
uint32 itemId = roll->itemid;
|
||||||
int32 randomProperty = 0;
|
int32 randomProperty = 0;
|
||||||
if (roll->itemRandomPropId)
|
if (roll->itemRandomPropId)
|
||||||
@@ -90,6 +89,8 @@ bool LootRollAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
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 +102,6 @@ bool LootRollAction::Execute(Event event)
|
|||||||
vote = GREED;
|
vote = GREED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (vote == GREED)
|
|
||||||
{
|
|
||||||
vote = PASS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
switch (group->GetLootMethod())
|
switch (group->GetLootMethod())
|
||||||
{
|
{
|
||||||
@@ -186,7 +183,6 @@ bool MasterLootRollAction::Execute(Event event)
|
|||||||
if (!group)
|
if (!group)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RollVote vote = CalculateRollVote(proto);
|
|
||||||
group->CountRollVote(bot->GetGUID(), creatureGuid, CalculateRollVote(proto));
|
group->CountRollVote(bot->GetGUID(), creatureGuid, CalculateRollVote(proto));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ bool LootStrategyAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
std::string const strategy = event.getParam();
|
std::string const strategy = event.getParam();
|
||||||
|
|
||||||
LootObjectStack* lootItems = AI_VALUE(LootObjectStack*, "available loot");
|
|
||||||
std::set<uint32>& alwaysLootItems = AI_VALUE(std::set<uint32>&, "always loot list");
|
std::set<uint32>& alwaysLootItems = AI_VALUE(std::set<uint32>&, "always loot list");
|
||||||
Value<LootStrategy*>* lootStrategy = context->GetValue<LootStrategy*>("loot strategy");
|
Value<LootStrategy*>* lootStrategy = context->GetValue<LootStrategy*>("loot strategy");
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool CheckBagSpace(Player* bot)
|
bool CheckBagSpace(Player* bot)
|
||||||
{
|
{
|
||||||
uint32 totalused = 0, total = 16;
|
uint32 totalused = 0;
|
||||||
for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++)
|
for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++)
|
||||||
if (bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
if (bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||||
++totalused;
|
++totalused;
|
||||||
|
|||||||
@@ -11,20 +11,16 @@
|
|||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool MoveToRpgTargetAction::Execute(Event event)
|
bool MoveToRpgTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
Unit* unit = botAI->GetUnit(guidP);
|
Unit* unit = botAI->GetUnit(guidP);
|
||||||
if (unit && !unit->IsInWorld())
|
if (unit && !unit->IsInWorld())
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
GameObject* go = botAI->GetGameObject(guidP);
|
GameObject* go = botAI->GetGameObject(guidP);
|
||||||
if (go && !go->IsInWorld())
|
if (go && !go->IsInWorld())
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Player* player = guidP.GetPlayer();
|
|
||||||
|
|
||||||
WorldObject* wo = nullptr;
|
WorldObject* wo = nullptr;
|
||||||
if (unit)
|
if (unit)
|
||||||
|
|||||||
@@ -7,10 +7,9 @@
|
|||||||
|
|
||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "PathGenerator.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool MoveToTravelTargetAction::Execute(Event event)
|
bool MoveToTravelTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
TravelTarget* target = AI_VALUE(TravelTarget*, "travel target");
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "FleeManager.h"
|
#include "FleeManager.h"
|
||||||
#include "G3D/Vector3.h"
|
#include "G3D/Vector3.h"
|
||||||
#include "GameObject.h"
|
#include "GameObject.h"
|
||||||
#include "Geometry.h"
|
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
@@ -36,9 +35,7 @@
|
|||||||
#include "SpellAuraEffects.h"
|
#include "SpellAuraEffects.h"
|
||||||
#include "SpellInfo.h"
|
#include "SpellInfo.h"
|
||||||
#include "Stances.h"
|
#include "Stances.h"
|
||||||
#include "TargetedMovementGenerator.h"
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Transport.h"
|
|
||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "WaypointMovementGenerator.h"
|
#include "WaypointMovementGenerator.h"
|
||||||
@@ -67,18 +64,14 @@ bool MovementAction::JumpTo(uint32 mapId, float x, float y, float z, MovementPri
|
|||||||
{
|
{
|
||||||
UpdateMovementState();
|
UpdateMovementState();
|
||||||
if (!IsMovingAllowed(mapId, x, y, z))
|
if (!IsMovingAllowed(mapId, x, y, z))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (IsDuplicateMove(mapId, x, y, z))
|
if (IsDuplicateMove(mapId, x, y, z))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (IsWaitingForLastMove(priority))
|
if (IsWaitingForLastMove(priority))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
float botZ = bot->GetPositionZ();
|
|
||||||
float speed = bot->GetSpeed(MOVE_RUN);
|
float speed = bot->GetSpeed(MOVE_RUN);
|
||||||
MotionMaster& mm = *bot->GetMotionMaster();
|
MotionMaster& mm = *bot->GetMotionMaster();
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
@@ -100,9 +93,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior
|
|||||||
|
|
||||||
distance += target->GetCombatReach();
|
distance += target->GetCombatReach();
|
||||||
|
|
||||||
float x = target->GetPositionX();
|
|
||||||
float y = target->GetPositionY();
|
|
||||||
float z = target->GetPositionZ();
|
|
||||||
float followAngle = GetFollowAngle();
|
float followAngle = GetFollowAngle();
|
||||||
|
|
||||||
for (float angle = followAngle; angle <= followAngle + static_cast<float>(2 * M_PI);
|
for (float angle = followAngle; angle <= followAngle + static_cast<float>(2 * M_PI);
|
||||||
@@ -120,7 +110,6 @@ bool MovementAction::MoveNear(WorldObject* target, float distance, MovementPrior
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// botAI->TellError("All paths not in LOS");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,9 +118,6 @@ bool MovementAction::MoveToLOS(WorldObject* target, bool ranged)
|
|||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// std::ostringstream out; out << "Moving to LOS!";
|
|
||||||
// bot->Say(out.str(), LANG_UNIVERSAL);
|
|
||||||
|
|
||||||
float x = target->GetPositionX();
|
float x = target->GetPositionX();
|
||||||
float y = target->GetPositionY();
|
float y = target->GetPositionY();
|
||||||
float z = target->GetPositionZ();
|
float z = target->GetPositionZ();
|
||||||
@@ -264,7 +250,6 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// bot->CastStop();
|
// bot->CastStop();
|
||||||
// botAI->InterruptSpell();
|
// botAI->InterruptSpell();
|
||||||
// }
|
// }
|
||||||
G3D::Vector3 endP = path.back();
|
|
||||||
DoMovePoint(bot, x, y, z, generatePath, backwards);
|
DoMovePoint(bot, x, y, z, generatePath, backwards);
|
||||||
float delay = 1000.0f * MoveDelay(distance, backwards);
|
float delay = 1000.0f * MoveDelay(distance, backwards);
|
||||||
if (lessDelay)
|
if (lessDelay)
|
||||||
@@ -370,7 +355,7 @@ 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 (!TravelNodeMap::instance().getNodes().empty() && !bot->InBattleground())
|
// if (!TravelNodeMap::instance().getNodes().empty() && !bot->InBattleground())
|
||||||
// {
|
// {
|
||||||
@@ -421,7 +406,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));
|
||||||
@@ -485,8 +470,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 +548,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,15 +594,15 @@ 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
|
||||||
@@ -634,8 +619,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
|
|
||||||
// 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 +656,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 +670,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
|
||||||
@@ -708,9 +693,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 +741,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);
|
||||||
@@ -779,8 +764,6 @@ bool MovementAction::MoveTo(WorldObject* target, float distance, MovementPriorit
|
|||||||
float by = bot->GetPositionY();
|
float by = bot->GetPositionY();
|
||||||
float bz = bot->GetPositionZ();
|
float bz = bot->GetPositionZ();
|
||||||
|
|
||||||
float tx = target->GetPositionX();
|
|
||||||
float ty = target->GetPositionY();
|
|
||||||
float tz = target->GetPositionZ();
|
float tz = target->GetPositionZ();
|
||||||
|
|
||||||
float distanceToTarget = bot->GetDistance(target);
|
float distanceToTarget = bot->GetDistance(target);
|
||||||
@@ -812,10 +795,6 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
|
|||||||
if (!IsMovingAllowed(target))
|
if (!IsMovingAllowed(target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float bx = bot->GetPositionX();
|
|
||||||
float by = bot->GetPositionY();
|
|
||||||
float bz = bot->GetPositionZ();
|
|
||||||
|
|
||||||
float tx = target->GetPositionX();
|
float tx = target->GetPositionX();
|
||||||
float ty = target->GetPositionY();
|
float ty = target->GetPositionY();
|
||||||
float tz = target->GetPositionZ();
|
float tz = target->GetPositionZ();
|
||||||
@@ -953,68 +932,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 +1003,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
|
||||||
@@ -1190,7 +1172,7 @@ bool MovementAction::Follow(Unit* target, float distance, float angle)
|
|||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1217,7 +1199,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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1417,7 +1399,6 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
if (botAI->IsTank(player))
|
if (botAI->IsTank(player))
|
||||||
{
|
{
|
||||||
float distanceToTank = ServerFacade::instance().GetDistance2d(bot, player);
|
float distanceToTank = ServerFacade::instance().GetDistance2d(bot, player);
|
||||||
float distanceToTarget = ServerFacade::instance().GetDistance2d(bot, target);
|
|
||||||
if (distanceToTank < fleeDistance)
|
if (distanceToTank < fleeDistance)
|
||||||
{
|
{
|
||||||
fleeTarget = player;
|
fleeTarget = player;
|
||||||
@@ -1438,8 +1419,6 @@ bool MovementAction::Flee(Unit* target)
|
|||||||
else // bot is not targeted, try to flee dps/healers
|
else // bot is not targeted, try to flee dps/healers
|
||||||
{
|
{
|
||||||
bool isHealer = botAI->IsHeal(bot);
|
bool isHealer = botAI->IsHeal(bot);
|
||||||
bool isDps = !isHealer && !botAI->IsTank(bot);
|
|
||||||
bool isTank = botAI->IsTank(bot);
|
|
||||||
bool needHealer = !isHealer && AI_VALUE2(uint8, "health", "self target") < 50;
|
bool needHealer = !isHealer && AI_VALUE2(uint8, "health", "self target") < 50;
|
||||||
bool isRanged = botAI->IsRanged(bot);
|
bool isRanged = botAI->IsRanged(bot);
|
||||||
|
|
||||||
@@ -1813,12 +1792,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,7 +1822,7 @@ void MovementAction::DoMovePoint(Unit* unit, float x, float y, float z, bool gen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FleeAction::Execute(Event event)
|
bool FleeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
return MoveAway(AI_VALUE(Unit*, "current target"), sPlayerbotAIConfig.fleeDistance, true);
|
return MoveAway(AI_VALUE(Unit*, "current target"), sPlayerbotAIConfig.fleeDistance, true);
|
||||||
}
|
}
|
||||||
@@ -1852,9 +1830,8 @@ bool FleeAction::Execute(Event event)
|
|||||||
bool FleeAction::isUseful()
|
bool FleeAction::isUseful()
|
||||||
{
|
{
|
||||||
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (target && target->IsInWorld() && !bot->IsWithinMeleeRange(target))
|
if (target && target->IsInWorld() && !bot->IsWithinMeleeRange(target))
|
||||||
return false;
|
return false;
|
||||||
@@ -1862,12 +1839,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 +1850,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())
|
||||||
@@ -2307,17 +2281,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)) ||
|
||||||
@@ -2448,7 +2420,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 +2504,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,9 +2615,9 @@ bool DisperseSetAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunAwayAction::Execute(Event event) { return Flee(AI_VALUE(Unit*, "group leader")); }
|
bool RunAwayAction::Execute(Event /*event*/) { return Flee(AI_VALUE(Unit*, "group leader")); }
|
||||||
|
|
||||||
bool MoveToLootAction::Execute(Event event)
|
bool MoveToLootAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
LootObject loot = AI_VALUE(LootObject, "loot target");
|
LootObject loot = AI_VALUE(LootObject, "loot target");
|
||||||
if (!loot.IsLootPossible(bot))
|
if (!loot.IsLootPossible(bot))
|
||||||
@@ -2654,7 +2626,7 @@ bool MoveToLootAction::Execute(Event event)
|
|||||||
return MoveNear(loot.GetWorldObject(bot), sPlayerbotAIConfig.contactDistance);
|
return MoveNear(loot.GetWorldObject(bot), sPlayerbotAIConfig.contactDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveOutOfEnemyContactAction::Execute(Event event)
|
bool MoveOutOfEnemyContactAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -2665,7 +2637,7 @@ bool MoveOutOfEnemyContactAction::Execute(Event event)
|
|||||||
|
|
||||||
bool MoveOutOfEnemyContactAction::isUseful() { return AI_VALUE2(bool, "inside target", "current target"); }
|
bool MoveOutOfEnemyContactAction::isUseful() { return AI_VALUE2(bool, "inside target", "current target"); }
|
||||||
|
|
||||||
bool SetFacingTargetAction::Execute(Event event)
|
bool SetFacingTargetAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
Unit* target = AI_VALUE(Unit*, "current target");
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -2691,7 +2663,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,7 +2723,7 @@ bool SetBehindTargetAction::Execute(Event event)
|
|||||||
false, true, MovementPriority::MOVEMENT_COMBAT);
|
false, true, MovementPriority::MOVEMENT_COMBAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveOutOfCollisionAction::Execute(Event event)
|
bool MoveOutOfCollisionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float angle = M_PI * 2000 / frand(1.f, 1000.f);
|
float angle = M_PI * 2000 / frand(1.f, 1000.f);
|
||||||
float distance = sPlayerbotAIConfig.followDistance;
|
float distance = sPlayerbotAIConfig.followDistance;
|
||||||
@@ -2769,7 +2741,7 @@ bool MoveOutOfCollisionAction::isUseful()
|
|||||||
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get().size() < 15;
|
botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest friendly players")->Get().size() < 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveRandomAction::Execute(Event event)
|
bool MoveRandomAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float distance = sPlayerbotAIConfig.tooCloseDistance + urand(10, 30);
|
float distance = sPlayerbotAIConfig.tooCloseDistance + urand(10, 30);
|
||||||
|
|
||||||
@@ -2782,9 +2754,7 @@ bool MoveRandomAction::Execute(Event event)
|
|||||||
float angle = (float)rand_norm() * static_cast<float>(M_PI);
|
float angle = (float)rand_norm() * static_cast<float>(M_PI);
|
||||||
x += urand(0, distance) * cos(angle);
|
x += urand(0, distance) * cos(angle);
|
||||||
y += urand(0, distance) * sin(angle);
|
y += urand(0, distance) * sin(angle);
|
||||||
float ox = x;
|
|
||||||
float oy = y;
|
|
||||||
float oz = z;
|
|
||||||
if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(),
|
if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(),
|
||||||
bot->GetPositionZ(), x, y, z))
|
bot->GetPositionZ(), x, y, z))
|
||||||
continue;
|
continue;
|
||||||
@@ -2801,9 +2771,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 +2793,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 +2873,12 @@ 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;
|
Group* const group = bot->GetGroup();
|
||||||
float minDistance = 0.0f;
|
|
||||||
|
|
||||||
Group* group = bot->GetGroup();
|
|
||||||
if (!group)
|
if (!group)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Player*> debuffedPlayers;
|
std::vector<Player*> debuffedPlayers;
|
||||||
|
|
||||||
|
|||||||
@@ -332,7 +332,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
uint32 spellId;
|
uint32 spellId;
|
||||||
float range;
|
float range;
|
||||||
bool alive;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -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,10 +7,9 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "PlayerbotOperations.h"
|
#include "PlayerbotOperations.h"
|
||||||
#include "Playerbots.h"
|
|
||||||
#include "PlayerbotWorldThreadProcessor.h"
|
#include "PlayerbotWorldThreadProcessor.h"
|
||||||
|
|
||||||
bool PassLeadershipToMasterAction::Execute(Event event)
|
bool PassLeadershipToMasterAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (Player* master = GetMaster())
|
if (Player* master = GetMaster())
|
||||||
if (master && master != bot && bot->GetGroup() && bot->GetGroup()->IsMember(master->GetGUID()))
|
if (master && master != bot && bot->GetGroup() && bot->GetGroup()->IsMember(master->GetGUID()))
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Action.h"
|
#include "Action.h"
|
||||||
#include "PlayerbotFactory.h"
|
|
||||||
#include "Unit.h"
|
|
||||||
|
|
||||||
class PlayerbotAI;
|
class PlayerbotAI;
|
||||||
|
|
||||||
@@ -22,7 +20,6 @@ public:
|
|||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool warningEnabled = true;
|
|
||||||
std::string defaultCmd;
|
std::string defaultCmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ bool PositionAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveToPositionAction::Execute(Event event)
|
bool MoveToPositionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
||||||
if (!pos.isSet())
|
if (!pos.isSet())
|
||||||
@@ -123,7 +123,7 @@ bool MoveToPositionAction::isUseful()
|
|||||||
return pos.isSet() && distance > sPlayerbotAIConfig.followDistance && distance < sPlayerbotAIConfig.reactDistance;
|
return pos.isSet() && distance > sPlayerbotAIConfig.followDistance && distance < sPlayerbotAIConfig.reactDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetReturnPositionAction::Execute(Event event)
|
bool SetReturnPositionAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
||||||
PositionInfo returnPos = posMap["return"];
|
PositionInfo returnPos = posMap["return"];
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
void QueryQuestAction::TellObjective(std::string const name, uint32 available, uint32 required)
|
void QueryQuestAction::TellObjective(std::string const name, uint32 available, uint32 required)
|
||||||
{
|
{
|
||||||
@@ -16,7 +16,6 @@ void QueryQuestAction::TellObjective(std::string const name, uint32 available, u
|
|||||||
|
|
||||||
bool QueryQuestAction::Execute(Event event)
|
bool QueryQuestAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
|
||||||
Player* bot = botAI->GetBot();
|
Player* bot = botAI->GetBot();
|
||||||
WorldPosition botPos(bot);
|
WorldPosition botPos(bot);
|
||||||
WorldPosition* ptr_botpos = &botPos;
|
WorldPosition* ptr_botpos = &botPos;
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -350,7 +352,6 @@ bool QuestUpdateAddItemAction::Execute(Event event)
|
|||||||
uint32 itemId, count;
|
uint32 itemId, count;
|
||||||
p >> itemId >> count;
|
p >> itemId >> count;
|
||||||
|
|
||||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
|
||||||
auto const* itemPrototype = sObjectMgr->GetItemTemplate(itemId);
|
auto const* itemPrototype = sObjectMgr->GetItemTemplate(itemId);
|
||||||
if (itemPrototype)
|
if (itemPrototype)
|
||||||
{
|
{
|
||||||
@@ -405,8 +406,6 @@ bool QuestItemPushResultAction::Execute(Event event)
|
|||||||
if (!quest)
|
if (!quest)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QuestStatusData& q_status = bot->getQuestStatusMap().at(questId);
|
|
||||||
|
|
||||||
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
|
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
|
||||||
{
|
{
|
||||||
uint32 itemId = quest->RequiredItemId[i];
|
uint32 itemId = quest->RequiredItemId[i];
|
||||||
@@ -432,7 +431,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;
|
||||||
@@ -446,8 +445,6 @@ bool QuestUpdateFailedTimerAction::Execute(Event event)
|
|||||||
uint32 questId;
|
uint32 questId;
|
||||||
p >> questId;
|
p >> questId;
|
||||||
|
|
||||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
|
||||||
|
|
||||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
|
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
|
||||||
|
|
||||||
if (qInfo)
|
if (qInfo)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool RandomBotUpdateAction::Execute(Event event)
|
bool RandomBotUpdateAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
if (!sRandomPlayerbotMgr.IsRandomBot(bot))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
bool ReachTargetAction::Execute(Event event) { return ReachCombatTo(AI_VALUE(Unit*, GetTargetName()), distance); }
|
bool ReachTargetAction::Execute(Event /*event*/) { return ReachCombatTo(AI_VALUE(Unit*, GetTargetName()), distance); }
|
||||||
|
|
||||||
bool ReachTargetAction::isUseful()
|
bool ReachTargetAction::isUseful()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void ReleaseSpiritAction::LogRelease(const std::string& releaseMsg, bool isAutoR
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AutoReleaseSpiritAction implementation
|
// AutoReleaseSpiritAction implementation
|
||||||
bool AutoReleaseSpiritAction::Execute(Event event)
|
bool AutoReleaseSpiritAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
IncrementDeathCount();
|
IncrementDeathCount();
|
||||||
bot->DurabilityRepairAll(false, 1.0f, false);
|
bot->DurabilityRepairAll(false, 1.0f, false);
|
||||||
@@ -214,7 +214,7 @@ bool AutoReleaseSpiritAction::ShouldDelayBattlegroundRelease() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RepopAction::Execute(Event event)
|
bool RepopAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
const GraveyardStruct* graveyard = GetGrave(
|
const GraveyardStruct* graveyard = GetGrave(
|
||||||
AI_VALUE(uint32, "death count") > 10 ||
|
AI_VALUE(uint32, "death count") > 10 ||
|
||||||
@@ -250,7 +250,7 @@ void RepopAction::PerformGraveyardTeleport(const GraveyardStruct* graveyard) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelfResurrectAction implementation for Warlock's Soulstone Resurrection/Shaman's Reincarnation
|
// SelfResurrectAction implementation for Warlock's Soulstone Resurrection/Shaman's Reincarnation
|
||||||
bool SelfResurrectAction::Execute(Event event)
|
bool SelfResurrectAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->IsAlive() && bot->GetUInt32Value(PLAYER_SELF_RES_SPELL))
|
if (!bot->IsAlive() && bot->GetUInt32Value(PLAYER_SELF_RES_SPELL))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
|
||||||
bool RememberTaxiAction::Execute(Event event)
|
bool RememberTaxiAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ bool RememberTaxiAction::Execute(Event event)
|
|||||||
case CMSG_ACTIVATETAXIEXPRESS:
|
case CMSG_ACTIVATETAXIEXPRESS:
|
||||||
{
|
{
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
uint32 node_count, totalcost;
|
uint32 node_count;
|
||||||
p >> guid >> node_count;
|
p >> guid >> node_count;
|
||||||
|
|
||||||
LastMovement& movement = context->GetValue<LastMovement&>("last taxi")->Get();
|
LastMovement& movement = context->GetValue<LastMovement&>("last taxi")->Get();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool RepairAllAction::Execute(Event event)
|
bool RepairAllAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
||||||
for (ObjectGuid const guid : npcs)
|
for (ObjectGuid const guid : npcs)
|
||||||
|
|||||||
@@ -5,14 +5,16 @@
|
|||||||
|
|
||||||
#include "ResetInstancesAction.h"
|
#include "ResetInstancesAction.h"
|
||||||
|
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool ResetInstancesAction::Execute(Event event)
|
#include "InstancePackets.h"
|
||||||
|
|
||||||
|
bool ResetInstancesAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket packet(CMSG_RESET_INSTANCES, 0);
|
WorldPacket packet(CMSG_RESET_INSTANCES, 0);
|
||||||
bot->GetSession()->HandleResetInstancesOpcode(packet);
|
WorldPackets::Instance::ResetInstances resetInstance(std::move(packet));
|
||||||
|
bot->GetSession()->HandleResetInstancesOpcode(resetInstance);
|
||||||
|
|
||||||
botAI->TellMaster("Resetting all instances");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "NearestGameObjects.h"
|
#include "NearestGameObjects.h"
|
||||||
|
|
||||||
bool RevealGatheringItemAction::Execute(Event event)
|
bool RevealGatheringItemAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (!bot->GetGroup())
|
if (!bot->GetGroup())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "FleeManager.h"
|
#include "FleeManager.h"
|
||||||
#include "GameGraveyard.h"
|
#include "GameGraveyard.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
#include "PlayerbotFactory.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "RandomPlayerbotMgr.h"
|
#include "RandomPlayerbotMgr.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
@@ -74,7 +73,7 @@ bool ReviveFromCorpseAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindCorpseAction::Execute(Event event)
|
bool FindCorpseAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->InBattleground())
|
if (bot->InBattleground())
|
||||||
return false;
|
return false;
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "RpgSubActions.h"
|
#include "RpgSubActions.h"
|
||||||
|
|
||||||
|
#include "BudgetValues.h"
|
||||||
#include "ChooseRpgTargetAction.h"
|
#include "ChooseRpgTargetAction.h"
|
||||||
#include "EmoteAction.h"
|
#include "EmoteAction.h"
|
||||||
#include "Formations.h"
|
#include "Formations.h"
|
||||||
@@ -51,10 +52,15 @@ GuidPosition RpgHelper::guidP() { return AI_VALUE(GuidPosition, "rpg target"); }
|
|||||||
|
|
||||||
ObjectGuid RpgHelper::guid() { return (ObjectGuid)guidP(); }
|
ObjectGuid RpgHelper::guid() { return (ObjectGuid)guidP(); }
|
||||||
|
|
||||||
bool RpgHelper::InRange()
|
bool RpgHelper::InRange()
|
||||||
{
|
{
|
||||||
return guidP() ? (guidP().sqDistance2d(bot) < INTERACTION_DISTANCE * INTERACTION_DISTANCE) : false;
|
GuidPosition targetGuid = guidP();
|
||||||
}
|
if (!targetGuid)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return bot->GetExactDist2dSq(targetGuid.GetPositionX(), targetGuid.GetPositionY()) <
|
||||||
|
INTERACTION_DISTANCE * INTERACTION_DISTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
void RpgHelper::setFacingTo(GuidPosition guidPosition)
|
void RpgHelper::setFacingTo(GuidPosition guidPosition)
|
||||||
{
|
{
|
||||||
@@ -99,7 +105,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 +115,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 +124,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 +139,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 +148,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 +156,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 +209,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 +228,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 +238,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 +248,71 @@ 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"; }
|
||||||
|
|
||||||
|
bool RpgTrainAction::isUseful()
|
||||||
|
{
|
||||||
|
if (!rpg->InRange())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Creature* creature = rpg->guidP().GetCreature();
|
||||||
|
if (!creature)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!creature->IsInWorld() || creature->IsDuringRemoveFromWorld() || !creature->IsAlive())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RpgTrainAction::isPossible()
|
||||||
|
{
|
||||||
|
GuidPosition gp = rpg->guidP();
|
||||||
|
|
||||||
|
CreatureTemplate const* cinfo = gp.GetCreatureTemplate();
|
||||||
|
if (!cinfo)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Trainer::Trainer* trainer = sObjectMgr->GetTrainer(cinfo->Entry);
|
||||||
|
if (!trainer)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!trainer->IsTrainerValidForPlayer(bot))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cinfo->faction);
|
||||||
|
float reputationDiscount = bot->GetReputationPriceDiscount(factionTemplate);
|
||||||
|
uint32 currentGold = AI_VALUE2(uint32, "free money for", (uint32)NeedMoneyFor::spells);
|
||||||
|
|
||||||
|
for (auto& spell : trainer->GetSpells())
|
||||||
|
{
|
||||||
|
Trainer::Spell const* trainerSpell = trainer->GetSpell(spell.SpellId);
|
||||||
|
if (!trainerSpell)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!trainer->CanTeachSpell(bot, trainerSpell))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (currentGold < static_cast<uint32>(floor(trainerSpell->MoneyCost * reputationDiscount)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// we only check if at least one spell can be learned from the trainer;
|
||||||
|
// otherwise, the train action should not be allowed
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
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 +347,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 +401,7 @@ std::vector<Item*> RpgTradeUsefulAction::CanGiveItems(GuidPosition guidPosition)
|
|||||||
return giveItems;
|
return giveItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgTradeUsefulAction::Execute(Event event)
|
bool RpgTradeUsefulAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
|
|
||||||
@@ -416,7 +476,7 @@ bool RpgDuelAction::isUseful()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgDuelAction::Execute(Event event)
|
bool RpgDuelAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
GuidPosition guidP = AI_VALUE(GuidPosition, "rpg target");
|
||||||
|
|
||||||
@@ -434,7 +494,7 @@ bool RpgMountAnimAction::isUseful()
|
|||||||
return AI_VALUE2(bool, "mounted", "self target") && !AI_VALUE2(bool, "moving", "self target");
|
return AI_VALUE2(bool, "mounted", "self target") && !AI_VALUE2(bool, "moving", "self target");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RpgMountAnimAction::Execute(Event event)
|
bool RpgMountAnimAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
WorldPacket p;
|
WorldPacket p;
|
||||||
bot->GetSession()->HandleMountSpecialAnimOpcode(p);
|
bot->GetSession()->HandleMountSpecialAnimOpcode(p);
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ class RpgTrainAction : public RpgSubAction
|
|||||||
public:
|
public:
|
||||||
RpgTrainAction(PlayerbotAI* botAI, std::string const name = "rpg train") : RpgSubAction(botAI, name) {}
|
RpgTrainAction(PlayerbotAI* botAI, std::string const name = "rpg train") : RpgSubAction(botAI, name) {}
|
||||||
|
|
||||||
|
bool isPossible() override;
|
||||||
|
bool isUseful() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string const ActionName() override;
|
std::string const ActionName() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
@@ -159,7 +156,6 @@ bool SayAction::isUseful()
|
|||||||
|
|
||||||
void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint32& guid2, std::string& msg, std::string& chanName, std::string& name)
|
void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint32& guid2, std::string& msg, std::string& chanName, std::string& name)
|
||||||
{
|
{
|
||||||
ChatReplyType replyType = REPLY_NOT_UNDERSTAND; // default not understand
|
|
||||||
std::string respondsText = "";
|
std::string respondsText = "";
|
||||||
|
|
||||||
// if we're just commanding bots around, don't respond...
|
// if we're just commanding bots around, don't respond...
|
||||||
|
|||||||
@@ -10,11 +10,13 @@
|
|||||||
|
|
||||||
bool SecurityCheckAction::isUseful()
|
bool SecurityCheckAction::isUseful()
|
||||||
{
|
{
|
||||||
return sRandomPlayerbotMgr.IsRandomBot(bot) && botAI->GetMaster() &&
|
return RandomPlayerbotMgr::instance().IsRandomBot(bot)
|
||||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER && !GET_PLAYERBOT_AI(botAI->GetMaster());
|
&& 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"
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -68,7 +66,8 @@ bool SetCraftAction::Execute(Event event)
|
|||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (SkillLineAbilityEntry const* skillLine = skillSpells[spellId])
|
SkillLineAbilityEntry const* skillLine = skillSpells[spellId];
|
||||||
|
if (skillLine != nullptr)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < 3; ++i)
|
for (uint8 i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
@@ -78,9 +77,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 +129,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 +138,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();
|
||||||
|
|
||||||
@@ -26,20 +26,10 @@ bool SetHomeAction::Execute(Event event)
|
|||||||
if (Unit* unit = botAI->GetUnit(selection))
|
if (Unit* unit = botAI->GetUnit(selection))
|
||||||
if (unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
|
if (unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
|
||||||
{
|
{
|
||||||
if (isRpgAction)
|
Creature* creature = botAI->GetCreature(selection);
|
||||||
{
|
bot->GetSession()->SendBindPoint(creature);
|
||||||
Creature* creature = botAI->GetCreature(selection);
|
botAI->TellMaster("This inn is my new home");
|
||||||
bot->GetSession()->SendBindPoint(creature);
|
return true;
|
||||||
botAI->TellMaster("This inn is my new home");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Creature* creature = botAI->GetCreature(selection);
|
|
||||||
bot->GetSession()->SendBindPoint(creature);
|
|
||||||
botAI->TellMaster("This inn is my new home");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
|
||||||
|
|||||||
@@ -40,9 +40,8 @@ bool ShareQuestAction::Execute(Event event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoShareQuestAction::Execute(Event event)
|
bool AutoShareQuestAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
|
|
||||||
bool shared = false;
|
bool shared = false;
|
||||||
|
|
||||||
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "PlayerbotAI.h"
|
||||||
|
|
||||||
bool StatsAction::Execute(Event event)
|
bool StatsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ bool StayActionBase::Stay()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StayAction::Execute(Event event) { return Stay(); }
|
bool StayAction::Execute(Event /*event*/) { return Stay(); }
|
||||||
|
|
||||||
bool StayAction::isUseful()
|
bool StayAction::isUseful()
|
||||||
{
|
{
|
||||||
@@ -47,11 +47,8 @@ bool StayAction::isUseful()
|
|||||||
PositionInfo stayPosition = AI_VALUE(PositionMap&, "position")["stay"];
|
PositionInfo stayPosition = AI_VALUE(PositionMap&, "position")["stay"];
|
||||||
if (stayPosition.isSet())
|
if (stayPosition.isSet())
|
||||||
{
|
{
|
||||||
const float distance = bot->GetDistance(stayPosition.x, stayPosition.y, stayPosition.z);
|
|
||||||
if (sPlayerbotAIConfig.followDistance)
|
if (sPlayerbotAIConfig.followDistance)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// move from group takes priority over stay as it's added and removed automatically
|
// move from group takes priority over stay as it's added and removed automatically
|
||||||
@@ -64,7 +61,7 @@ bool StayAction::isUseful()
|
|||||||
return AI_VALUE2(bool, "moving", "self target");
|
return AI_VALUE2(bool, "moving", "self target");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SitAction::Execute(Event event)
|
bool SitAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
if (bot->isMoving())
|
if (bot->isMoving())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -7,25 +7,19 @@
|
|||||||
|
|
||||||
#include "SuggestWhatToDoAction.h"
|
#include "SuggestWhatToDoAction.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "ChannelMgr.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
|
||||||
#include "Config.h"
|
|
||||||
#include "BroadcastHelper.h"
|
#include "BroadcastHelper.h"
|
||||||
#include "AiFactory.h"
|
#include "AiFactory.h"
|
||||||
#include "ChannelMgr.h"
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "Config.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "GuildMgr.h"
|
|
||||||
#include "ItemVisitors.h"
|
#include "ItemVisitors.h"
|
||||||
#include "PlayerbotTextMgr.h"
|
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
#include "Channel.h"
|
||||||
|
|
||||||
enum eTalkType
|
enum eTalkType
|
||||||
{
|
{
|
||||||
@@ -62,14 +56,13 @@ bool SuggestWhatToDoAction::isUseful()
|
|||||||
return (time(0) - lastSaid) > 30;
|
return (time(0) - lastSaid) > 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SuggestWhatToDoAction::Execute(Event event)
|
bool SuggestWhatToDoAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 index = rand() % suggestions.size();
|
uint32 index = rand() % suggestions.size();
|
||||||
auto fnct_ptr = suggestions[index];
|
auto fnct_ptr = suggestions[index];
|
||||||
fnct_ptr();
|
fnct_ptr();
|
||||||
|
|
||||||
std::string const qualifier = "suggest what to do";
|
std::string const qualifier = "suggest what to do";
|
||||||
time_t lastSaid = AI_VALUE2(time_t, "last said", qualifier);
|
|
||||||
botAI->GetAiObjectContext()->GetValue<time_t>("last said", qualifier)->Set(time(nullptr) + urand(1, 60));
|
botAI->GetAiObjectContext()->GetValue<time_t>("last said", qualifier)->Set(time(nullptr) + urand(1, 60));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -227,7 +220,7 @@ void SuggestWhatToDoAction::thunderfury()
|
|||||||
class FindTradeItemsVisitor : public IterateItemsVisitor
|
class FindTradeItemsVisitor : public IterateItemsVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FindTradeItemsVisitor(uint32 quality) : quality(quality), IterateItemsVisitor() {}
|
FindTradeItemsVisitor(uint32 quality) : IterateItemsVisitor(), quality(quality) {}
|
||||||
|
|
||||||
bool Visit(Item* item) override
|
bool Visit(Item* item) override
|
||||||
{
|
{
|
||||||
@@ -258,7 +251,7 @@ private:
|
|||||||
|
|
||||||
SuggestDungeonAction::SuggestDungeonAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest dungeon") {}
|
SuggestDungeonAction::SuggestDungeonAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest dungeon") {}
|
||||||
|
|
||||||
bool SuggestDungeonAction::Execute(Event event)
|
bool SuggestDungeonAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
// TODO: use PlayerbotDungeonRepository::instance()
|
// TODO: use PlayerbotDungeonRepository::instance()
|
||||||
|
|
||||||
@@ -325,7 +318,7 @@ bool SuggestDungeonAction::Execute(Event event)
|
|||||||
|
|
||||||
SuggestTradeAction::SuggestTradeAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest trade") {}
|
SuggestTradeAction::SuggestTradeAction(PlayerbotAI* botAI) : SuggestWhatToDoAction(botAI, "suggest trade") {}
|
||||||
|
|
||||||
bool SuggestTradeAction::Execute(Event event)
|
bool SuggestTradeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
uint32 quality = urand(0, 100);
|
uint32 quality = urand(0, 100);
|
||||||
if (quality > 95)
|
if (quality > 95)
|
||||||
|
|||||||
@@ -231,7 +231,6 @@ void TalkToQuestGiverAction::AskToSelectReward(Quest const* quest, std::ostrings
|
|||||||
for (uint8 i = 0; i < quest->GetRewChoiceItemsCount(); ++i)
|
for (uint8 i = 0; i < quest->GetRewChoiceItemsCount(); ++i)
|
||||||
{
|
{
|
||||||
ItemTemplate const* item = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]);
|
ItemTemplate const* item = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]);
|
||||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", quest->RewardChoiceItemId[i]);
|
|
||||||
|
|
||||||
if (!forEquip || BestRewards(quest).count(i) > 0)
|
if (!forEquip || BestRewards(quest).count(i) > 0)
|
||||||
{
|
{
|
||||||
@@ -248,7 +247,6 @@ bool TurnInQueryQuestAction::Execute(Event event)
|
|||||||
WorldPacket pakcet = event.getPacket();
|
WorldPacket pakcet = event.getPacket();
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
uint32 questId;
|
uint32 questId;
|
||||||
ObjectGuid unk1;
|
|
||||||
pakcet >> guid >> questId;
|
pakcet >> guid >> questId;
|
||||||
Object* object =
|
Object* object =
|
||||||
ObjectAccessor::GetObjectByTypeMask(*bot, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
ObjectAccessor::GetObjectByTypeMask(*bot, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
|
||||||
|
|||||||
@@ -6,12 +6,10 @@
|
|||||||
#include "TameAction.h"
|
#include "TameAction.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <iomanip>
|
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "DBCStructure.h"
|
#include "DBCStructure.h"
|
||||||
#include "Log.h"
|
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Pet.h"
|
#include "Pet.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
@@ -53,7 +51,6 @@ bool TameAction::Execute(Event event)
|
|||||||
{
|
{
|
||||||
std::set<std::string> normalFamilies;
|
std::set<std::string> normalFamilies;
|
||||||
std::set<std::string> exoticFamilies;
|
std::set<std::string> exoticFamilies;
|
||||||
Player* bot = botAI->GetBot();
|
|
||||||
|
|
||||||
// Loop over all creature templates and collect tameable families
|
// Loop over all creature templates and collect tameable families
|
||||||
CreatureTemplateContainer const* creatures = sObjectMgr->GetCreatureTemplates();
|
CreatureTemplateContainer const* creatures = sObjectMgr->GetCreatureTemplates();
|
||||||
|
|||||||
@@ -31,8 +31,14 @@ bool TaxiAction::Execute(Event event)
|
|||||||
GuidVector units = *context->GetValue<GuidVector>("nearest npcs");
|
GuidVector units = *context->GetValue<GuidVector>("nearest npcs");
|
||||||
for (ObjectGuid const guid : units)
|
for (ObjectGuid const guid : units)
|
||||||
{
|
{
|
||||||
Creature* npc = bot->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
|
Creature* npc = ObjectAccessor::GetCreature(*bot, guid);
|
||||||
if (!npc)
|
if (!npc || !npc->IsAlive())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!(npc->GetNpcFlags() & UNIT_NPC_FLAG_FLIGHTMASTER))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (bot->GetDistance(npc) > sPlayerbotAIConfig.farDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 curloc = sObjectMgr->GetNearestTaxiNode(npc->GetPositionX(), npc->GetPositionY(), npc->GetPositionZ(),
|
uint32 curloc = sObjectMgr->GetNearestTaxiNode(npc->GetPositionX(), npc->GetPositionY(), npc->GetPositionZ(),
|
||||||
@@ -50,21 +56,17 @@ bool TaxiAction::Execute(Event event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// stagger bot takeoff
|
|
||||||
uint32 delayMin = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiDelayMinMs", 350u, false);
|
|
||||||
uint32 delayMax = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiDelayMaxMs", 5000u, false);
|
|
||||||
uint32 gapMs = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiGapMs", 200u, false);
|
|
||||||
uint32 gapJitterMs = sConfigMgr->GetOption<uint32>("AiPlayerbot.BotTaxiGapJitterMs", 100u, false);
|
|
||||||
|
|
||||||
// Only for follower bots
|
// Only for follower bots
|
||||||
if (botAI->HasRealPlayerMaster())
|
if (botAI->HasRealPlayerMaster())
|
||||||
{
|
{
|
||||||
uint32 index = botAI->GetGroupSlotIndex(bot);
|
uint32 index = botAI->GetGroupSlotIndex(bot);
|
||||||
uint32 delay = delayMin + index * gapMs + urand(0, gapJitterMs);
|
uint32 delay = sPlayerbotAIConfig.botTaxiDelayMin +
|
||||||
|
index * sPlayerbotAIConfig.botTaxiGapMs +
|
||||||
|
urand(0, sPlayerbotAIConfig.botTaxiGapJitterMs);
|
||||||
|
|
||||||
delay = std::min(delay, delayMax);
|
delay = std::min(delay, sPlayerbotAIConfig.botTaxiDelayMax);
|
||||||
|
|
||||||
// Store the npc’s GUID so we can re-acquire the pointer later
|
// Store the NPC's GUID so we can re-acquire the pointer later
|
||||||
ObjectGuid npcGuid = npc->GetGUID();
|
ObjectGuid npcGuid = npc->GetGUID();
|
||||||
|
|
||||||
// schedule the take-off
|
// schedule the take-off
|
||||||
|
|||||||
@@ -7,9 +7,12 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "LastMovementValue.h"
|
#include "LastMovementValue.h"
|
||||||
#include "Playerbots.h"
|
#include "AiObjectContext.h"
|
||||||
|
#include "PlayerbotAI.h"
|
||||||
|
#include "SpellMgr.h"
|
||||||
|
#include "Spell.h"
|
||||||
|
|
||||||
bool TeleportAction::Execute(Event event)
|
bool TeleportAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// List of allowed portal entries (you can populate this dynamically)
|
// List of allowed portal entries (you can populate this dynamically)
|
||||||
@@ -74,7 +77,7 @@ bool TeleportAction::Execute(Event event)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 spellId = goInfo->spellcaster.spellId;
|
uint32 spellId = goInfo->spellcaster.spellId;
|
||||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
SpellInfo const* spellInfo = SpellMgr::instance()->GetSpellInfo(spellId);
|
||||||
if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS))
|
if (!spellInfo || !spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TellLosAction.h"
|
#include "TellLosAction.h"
|
||||||
#include <istream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "ChatHelper.h"
|
#include "ChatHelper.h"
|
||||||
#include "DBCStores.h"
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "ItemTemplate.h"
|
#include "ItemTemplate.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
@@ -77,7 +75,7 @@ void TellLosAction::ListGameObjects(std::string const title, GuidVector gos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TellAuraAction::Execute(Event event)
|
bool TellAuraAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->TellMaster("--- Auras ---");
|
botAI->TellMaster("--- Auras ---");
|
||||||
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "--- Auras ---");
|
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG, "--- Auras ---");
|
||||||
@@ -97,7 +95,6 @@ bool TellAuraAction::Execute(Event event)
|
|||||||
std::string caster_name = caster ? caster->GetName() : "unknown";
|
std::string caster_name = caster ? caster->GetName() : "unknown";
|
||||||
bool is_area = aura->IsArea();
|
bool is_area = aura->IsArea();
|
||||||
int32 duration = aura->GetDuration();
|
int32 duration = aura->GetDuration();
|
||||||
const SpellInfo* spellInfo = aura->GetSpellInfo();
|
|
||||||
int32 spellId = aura->GetSpellInfo()->Id;
|
int32 spellId = aura->GetSpellInfo()->Id;
|
||||||
bool isPositive = aura->GetSpellInfo()->IsPositive();
|
bool isPositive = aura->GetSpellInfo()->IsPositive();
|
||||||
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG,
|
sLog->outMessage("playerbot", LOG_LEVEL_DEBUG,
|
||||||
@@ -130,7 +127,7 @@ bool TellAuraAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TellEstimatedDpsAction::Execute(Event event)
|
bool TellEstimatedDpsAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
float dps = AI_VALUE(float, "estimated group dps");
|
float dps = AI_VALUE(float, "estimated group dps");
|
||||||
botAI->TellMaster("Estimated Group DPS: " + std::to_string(dps));
|
botAI->TellMaster("Estimated Group DPS: " + std::to_string(dps));
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
|
||||||
bool TellMasterAction::Execute(Event event)
|
bool TellMasterAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->TellMaster(text);
|
botAI->TellMaster(text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OutOfReactRangeAction::Execute(Event event)
|
bool OutOfReactRangeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
botAI->TellMaster("Wait for me!");
|
botAI->TellMaster("Wait for me!");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user