Skip to content

Commit

Permalink
NPCBots v5.4.165a. Enhancement.
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Mar 19, 2024
1 parent b6ae76e commit 1c19687
Show file tree
Hide file tree
Showing 4 changed files with 305 additions and 27 deletions.
174 changes: 158 additions & 16 deletions AC/NPCBots.patch
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
...8_13_00_creature_template_npcbot_appearance.sql | 2 +
.../sql/custom/db_world/2024_03_12_00_npc_text.sql | 7 +
.../sql/custom/db_world/2024_03_18_00_npc_text.sql | 2 +
.../sql/custom/db_world/2024_03_19_00_npc_text.sql | 17 +
deps/git-subrepo | 1 +
src/common/Common.h | 2 +-
src/common/Utilities/EventProcessor.h | 1 +
Expand All @@ -67,7 +68,7 @@
src/server/game/AI/CreatureAI.h | 5 +
src/server/game/AI/NpcBots/bot_Events.h | 74 +
src/server/game/AI/NpcBots/bot_GridNotifiers.h | 1408 ++
src/server/game/AI/NpcBots/bot_ai.cpp | 19807 +++++++++++++++++++
src/server/game/AI/NpcBots/bot_ai.cpp | 19859 +++++++++++++++++++
src/server/game/AI/NpcBots/bot_ai.h | 806 +
src/server/game/AI/NpcBots/bot_archmage_ai.cpp | 417 +
src/server/game/AI/NpcBots/bot_bm_ai.cpp | 962 +
Expand Down Expand Up @@ -103,8 +104,8 @@
src/server/game/AI/NpcBots/botmgr.cpp | 2948 +++
src/server/game/AI/NpcBots/botmgr.h | 345 +
src/server/game/AI/NpcBots/botspell.cpp | 1899 ++
src/server/game/AI/NpcBots/botspell.h | 303 +
src/server/game/AI/NpcBots/bottext.h | 414 +
src/server/game/AI/NpcBots/botspell.h | 317 +
src/server/game/AI/NpcBots/bottext.h | 425 +
src/server/game/AI/NpcBots/botwanderful.cpp | 340 +
src/server/game/AI/NpcBots/botwanderful.h | 168 +
src/server/game/AI/NpcBots/bpet_ai.cpp | 2634 +++
Expand Down Expand Up @@ -143,7 +144,7 @@
src/server/game/Entities/Creature/CreatureData.h | 20 +
src/server/game/Entities/Creature/GossipDef.h | 2 +-
.../game/Entities/Creature/TemporarySummon.cpp | 19 +
src/server/game/Entities/GameObject/GameObject.cpp | 79 +
src/server/game/Entities/GameObject/GameObject.cpp | 105 +
src/server/game/Entities/Object/Object.cpp | 45 +-
src/server/game/Entities/Object/Object.h | 13 +-
src/server/game/Entities/Player/KillRewarder.cpp | 29 +
Expand Down Expand Up @@ -213,7 +214,7 @@
src/server/shared/DataStores/DBCStructure.h | 6 +-
src/server/shared/DataStores/DBCfmt.h | 2 +-
src/server/shared/SharedDefines.h | 23 +
215 files changed, 92641 insertions(+), 69 deletions(-)
216 files changed, 92761 insertions(+), 69 deletions(-)
create mode 100644 data/sql/Bots/locales/esES/npc_text_locale.sql
create mode 100644 data/sql/Bots/locales/esMX/npc_text_locale.sql
create mode 100644 data/sql/Bots/locales/ruRU/npc_text_locale.sql
Expand Down Expand Up @@ -269,6 +270,7 @@
create mode 100644 data/sql/custom/db_world/2023_08_13_00_creature_template_npcbot_appearance.sql
create mode 100644 data/sql/custom/db_world/2024_03_12_00_npc_text.sql
create mode 100644 data/sql/custom/db_world/2024_03_18_00_npc_text.sql
create mode 100644 data/sql/custom/db_world/2024_03_19_00_npc_text.sql
create mode 160000 deps/git-subrepo
create mode 100644 src/server/game/AI/NpcBots/bot_Events.h
create mode 100644 src/server/game/AI/NpcBots/bot_GridNotifiers.h
Expand Down Expand Up @@ -11648,6 +11650,29 @@ index 0000000000..ad440f8312
@@ -0,0 +1,2 @@
+--
+UPDATE `npc_text` SET `text0_0`='You exceed max npcbots for your level (%u)' WHERE (`ID`='70532');
diff --git a/data/sql/custom/db_world/2024_03_19_00_npc_text.sql b/data/sql/custom/db_world/2024_03_19_00_npc_text.sql
new file mode 100644
index 0000000000..d69d525675
--- /dev/null
+++ b/data/sql/custom/db_world/2024_03_19_00_npc_text.sql
@@ -0,0 +1,17 @@
+--
+SET @LOCALIZED_STRINGS_START = 70674;
+SET @LOCALIZED_STRINGS_END = 70684;
+
+DELETE FROM `npc_text` WHERE ID BETWEEN @LOCALIZED_STRINGS_START and @LOCALIZED_STRINGS_END;
+INSERT INTO `npc_text` (`ID`,`text0_0`,`VerifiedBuild`) VALUES
+(70674,'I need a portal','-1'),
+(70675,'Stormwind','-1'),
+(70676,'Ironforge','-1'),
+(70677,'Darnassus','-1'),
+(70678,'Exordar','-1'),
+(70679,'Orgrimmar','-1'),
+(70680,'Undercity','-1'),
+(70681,'Thunder Bluff','-1'),
+(70682,'Silvermoon','-1'),
+(70683,'Shattrath','-1'),
+(70684,'Dalaran','-1');
diff --git a/deps/git-subrepo b/deps/git-subrepo
new file mode 160000
index 0000000000..2f6859642a
Expand Down Expand Up @@ -13848,10 +13873,10 @@ index 0000000000..fdda703289
+#endif
diff --git a/src/server/game/AI/NpcBots/bot_ai.cpp b/src/server/game/AI/NpcBots/bot_ai.cpp
new file mode 100644
index 0000000000..04355412eb
index 0000000000..171445caa0
--- /dev/null
+++ b/src/server/game/AI/NpcBots/bot_ai.cpp
@@ -0,0 +1,19807 @@
@@ -0,0 +1,19859 @@
+#include "Battleground.h"
+#include "BattlegroundAB.h"
+#include "BattlegroundAV.h"
Expand Down Expand Up @@ -21581,6 +21606,12 @@ index 0000000000..04355412eb
+ //class-specific for owner: poisons, enchants, etc.
+ switch (_botclass)
+ {
+ case BOT_CLASS_MAGE:
+ {
+ if (me->GetLevel() >= 40)
+ AddGossipItemFor(player, GOSSIP_ICON_TALK, LocalizedNpcText(player, BOT_TEXT_I_NEED_A_PORTAL), GOSSIP_SENDER_CLASS, GOSSIP_ACTION_INFO_DEF + 4);
+ break;
+ }
+ case BOT_CLASS_ROGUE:
+ {
+ if (me->GetLevel() >= 20)
Expand Down Expand Up @@ -21823,6 +21854,32 @@ index 0000000000..04355412eb
+ BotWhisper(LocalizedNpcText(player, BOT_TEXT_DONE), player);
+ break;
+ }
+ else if (option == 4) // portal
+ {
+ subMenu = true;
+
+ if (player->GetTeamId() == TEAM_ALLIANCE)
+ {
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_STORMWIND), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_STORMWIND));
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_IRONFORGE), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_IRONFORGE));
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_DARNASSUS), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_DARNASSUS));
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_EXORDAR), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_EXODAR));
+ if (me->GetLevel() >= 65)
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_SHATTRATH), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_SHATTRATH_A));
+ }
+ else
+ {
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_ORGRIMMAR), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_ORGRIMMAR));
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_UNDERCITY), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_UNDERCITY));
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_THUNDER_BLUFF), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_THUNDERBLUFF));
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_SILVERMOON), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_SILVERMOON));
+ if (me->GetLevel() >= 65)
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_SHATTRATH), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_SHATTRATH_H));
+ }
+ if (me->GetLevel() >= 74)
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_DALARAN), GOSSIP_SENDER_CLASS_ACTION1, GOSSIP_ACTION_INFO_DEF + uint32(PORTAL_DALARAN));
+ AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_BACK), 1, GOSSIP_ACTION_INFO_DEF + 7);
+ }
+ break;
+ }
+ case BOT_CLASS_ROGUE:
Expand Down Expand Up @@ -22225,6 +22282,26 @@ index 0000000000..04355412eb
+ {
+ switch (_botclass)
+ {
+ case BOT_CLASS_MAGE:
+ {
+ if (!IsCasting())
+ {
+ uint32 portal_spell_id = action - GOSSIP_ACTION_INFO_DEF;
+ if (!portal_spell_id)
+ break;
+
+ if (!IsSpellReady(portal_spell_id, lastdiff, false))
+ {
+ BotWhisper(LocalizedNpcText(player, BOT_TEXT_NOT_READY_YET), player);
+ return OnGossipSelect(player, creature, GOSSIP_SENDER_CLASS, GOSSIP_ACTION_INFO_DEF + 4);
+ }
+
+ //CastSpellExtraArgs args;
+ //args.SetOriginalCaster(player->GetGUID());
+ me->CastCustomSpell(me, portal_spell_id, nullptr, nullptr, nullptr, false, nullptr, nullptr, player->GetGUID());
+ }
+ break;
+ }
+ case BOT_CLASS_ROGUE:
+ {
+ if (!IsCasting())
Expand Down Expand Up @@ -78915,10 +78992,10 @@ index 0000000000..bb2861208f
+}
diff --git a/src/server/game/AI/NpcBots/botspell.h b/src/server/game/AI/NpcBots/botspell.h
new file mode 100644
index 0000000000..802e19c8fa
index 0000000000..80ebc06472
--- /dev/null
+++ b/src/server/game/AI/NpcBots/botspell.h
@@ -0,0 +1,303 @@
@@ -0,0 +1,317 @@
+#ifndef _BOTSPELL_H
+#define _BOTSPELL_H
+
Expand All @@ -78943,6 +79020,20 @@ index 0000000000..802e19c8fa
+ WANDERER_HEARTHSTONE = 54318,//"Hearthsone" no CD
+ SUMMONING_STONE_EFFECT = 59782,//Cast time 5s + Channeled 2m
+ SHOOT_WAND = 5019,
+///Portals
+ PORTAL_STORMWIND = 10059,
+ PORTAL_IRONFORGE = 11416,
+ PORTAL_DARNASSUS = 11419,
+ PORTAL_EXODAR = 32266,
+ PORTAL_SHATTRATH_A = 33691,
+ PORTAL_THERAMORE = 49360,
+ PORTAL_ORGRIMMAR = 11417,
+ PORTAL_UNDERCITY = 11418,
+ PORTAL_THUNDERBLUFF = 11420,
+ PORTAL_SILVERMOON = 32267,
+ PORTAL_SHATTRATH_H = 35717,
+ PORTAL_STONARD = 49361,
+ PORTAL_DALARAN = 53142,
+///Passives
+ DAMAGE_REDUCTION = 68066,//Vigilance, Blessing of Sanctuary, etc.
+///Passives for Pets
Expand Down Expand Up @@ -79224,10 +79315,10 @@ index 0000000000..802e19c8fa
+#endif //_BOTSPELL_H
diff --git a/src/server/game/AI/NpcBots/bottext.h b/src/server/game/AI/NpcBots/bottext.h
new file mode 100644
index 0000000000..1e915774bb
index 0000000000..b064d343e3
--- /dev/null
+++ b/src/server/game/AI/NpcBots/bottext.h
@@ -0,0 +1,414 @@
@@ -0,0 +1,425 @@
+#ifndef BOTTEXT_H
+#define BOTTEXT_H
+
Expand Down Expand Up @@ -79638,7 +79729,18 @@ index 0000000000..1e915774bb
+ BOT_TEXT_REFLECT = 70671, //"Reflect"
+ BOT_TEXT_LOCUSTS = 70672, //"Locusts"
+ BOT_TEXT_HEAL_TARGET_HEALTH_THRESHOLD = 70673, //"Heal target health threshold"
+ //70674-70799 reserved for custom localization strings
+ BOT_TEXT_I_NEED_A_PORTAL = 70674, //"I need a portal"
+ BOT_TEXT_STORMWIND = 70675, //"Stormwind"
+ BOT_TEXT_IRONFORGE = 70676, //"Ironforge"
+ BOT_TEXT_DARNASSUS = 70677, //"Darnassus"
+ BOT_TEXT_EXORDAR = 70678, //"Exordar"
+ BOT_TEXT_ORGRIMMAR = 70679, //"Orgrimmar"
+ BOT_TEXT_UNDERCITY = 70680, //"Undercity"
+ BOT_TEXT_THUNDER_BLUFF = 70681, //"Thunder Bluff"
+ BOT_TEXT_SILVERMOON = 70682, //"Silvermoon"
+ BOT_TEXT_SHATTRATH = 70683, //"Shattrath"
+ BOT_TEXT_DALARAN = 70684, //"Dalaran"
+ //70685-70799 reserved for custom localization strings
+};
+
+#endif //BOTTEXT_H
Expand Down Expand Up @@ -90576,10 +90678,21 @@ index 673eedc926..48d381e462 100644
{
SetCreatorGUID(owner->GetGUID());
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index a488acc932..f9dbb1c059 100644
index a488acc932..5db50c9ae5 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -1817,6 +1817,39 @@ void GameObject::Use(Unit* user)
@@ -39,6 +39,10 @@
#include <G3D/CoordinateFrame.h>
#include <G3D/Quat.h>

+//npcbot
+#include "botmgr.h"
+//end npcbot
+
GameObject::GameObject() : WorldObject(false), MovableMapObject(),
m_model(nullptr), m_goValue(), m_AI(nullptr)
{
@@ -1817,6 +1821,39 @@ void GameObject::Use(Unit* user)

case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
{
Expand Down Expand Up @@ -90619,7 +90732,36 @@ index a488acc932..f9dbb1c059 100644
if (user->GetTypeId() != TYPEID_PLAYER)
return;

@@ -1929,6 +1962,20 @@ void GameObject::Use(Unit* user)
@@ -1886,6 +1923,28 @@ void GameObject::Use(Unit* user)
if (info->spellcaster.partyOnly)
{
Player const* caster = ObjectAccessor::FindConnectedPlayer(GetOwnerGUID());
+ //npcbot
+ if (!caster && GetOwnerGUID().IsCreature() && user->IsPlayer())
+ {
+ if (Creature const* bot = user->ToPlayer()->GetBotMgr()->GetBot(GetOwnerGUID()))
+ caster = user->ToPlayer();
+ else if (Group const* group = user->ToPlayer()->GetGroup())
+ {
+ for (GroupReference const* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
+ {
+ if (Player const* player = itr->GetSource())
+ {
+ bot = player->GetBotMgr()->GetBot(GetOwnerGUID());
+ if (bot)
+ {
+ caster = player;
+ break;
+ }
+ }
+ }
+ }
+ }
+ //end npcbot
if (!caster || user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster))
return;
}
@@ -1929,6 +1988,20 @@ void GameObject::Use(Unit* user)

case GAMEOBJECT_TYPE_FLAGSTAND: // 24
{
Expand All @@ -90640,7 +90782,7 @@ index a488acc932..f9dbb1c059 100644
if (user->GetTypeId() != TYPEID_PLAYER)
return;

@@ -1973,6 +2020,38 @@ void GameObject::Use(Unit* user)
@@ -1973,6 +2046,38 @@ void GameObject::Use(Unit* user)

case GAMEOBJECT_TYPE_FLAGDROP: // 26
{
Expand Down
17 changes: 17 additions & 0 deletions AC/SQL/updates/world/2024_03_19_00_npc_text.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--
SET @LOCALIZED_STRINGS_START = 70674;
SET @LOCALIZED_STRINGS_END = 70684;

DELETE FROM `npc_text` WHERE ID BETWEEN @LOCALIZED_STRINGS_START and @LOCALIZED_STRINGS_END;
INSERT INTO `npc_text` (`ID`,`text0_0`,`VerifiedBuild`) VALUES
(70674,'I need a portal','-1'),
(70675,'Stormwind','-1'),
(70676,'Ironforge','-1'),
(70677,'Darnassus','-1'),
(70678,'Exordar','-1'),
(70679,'Orgrimmar','-1'),
(70680,'Undercity','-1'),
(70681,'Thunder Bluff','-1'),
(70682,'Silvermoon','-1'),
(70683,'Shattrath','-1'),
(70684,'Dalaran','-1');
Loading

0 comments on commit 1c19687

Please sign in to comment.