Skip to content

Commit

Permalink
NPCBots: Mage: implement portals
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Mar 19, 2024
1 parent 4fe1862 commit 4cf6abb
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
17 changes: 17 additions & 0 deletions sql/Bots/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');
52 changes: 52 additions & 0 deletions src/server/game/AI/NpcBots/bot_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7712,6 +7712,12 @@ bool bot_ai::OnGossipHello(Player* player, uint32 /*option*/)
//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 @@ -7954,6 +7960,32 @@ bool bot_ai::OnGossipSelect(Player* player, Creature* creature/* == me*/, uint32
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 @@ -8356,6 +8388,26 @@ bool bot_ai::OnGossipSelect(Player* player, Creature* creature/* == me*/, uint32
{
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->CastSpell(me, portal_spell_id, args);
}
break;
}
case BOT_CLASS_ROGUE:
{
if (!IsCasting())
Expand Down
14 changes: 14 additions & 0 deletions src/server/game/AI/NpcBots/botspell.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ enum BotSpells : uint32
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
13 changes: 12 additions & 1 deletion src/server/game/AI/NpcBots/bottext.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,18 @@ enum BotTexts : uint32
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

0 comments on commit 4cf6abb

Please sign in to comment.