From 7accb42cc4e6959586dd783c2b3a542faf1f2018 Mon Sep 17 00:00:00 2001 From: Gacko Date: Mon, 26 Nov 2012 15:32:30 +0100 Subject: Core/DB: Convert 25 more scripts to creature text --- src/server/scripts/Examples/example_creature.cpp | 37 ++++++++-------- src/server/scripts/Examples/example_escort.cpp | 49 +++++++++++----------- .../scripts/Examples/example_gossip_codebox.cpp | 16 ++++--- src/server/scripts/Examples/example_misc.cpp | 7 +--- 4 files changed, 55 insertions(+), 54 deletions(-) (limited to 'src/server/scripts/Examples') diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp index 1ef15c0ca61..0baa9814970 100644 --- a/src/server/scripts/Examples/example_creature.cpp +++ b/src/server/scripts/Examples/example_creature.cpp @@ -45,17 +45,18 @@ enum Yells //List of text id's. The text is stored in database, also in a localized version //(if translation not exist for the textId, default english text will be used) //Not required to define in this way, but simplify if changes are needed. - SAY_AGGRO = -1999900, - SAY_RANDOM_0 = -1999901, - SAY_RANDOM_1 = -1999902, - SAY_RANDOM_2 = -1999903, - SAY_RANDOM_3 = -1999904, - SAY_RANDOM_4 = -1999905, - SAY_BERSERK = -1999906, - SAY_PHASE = -1999907, - SAY_DANCE = -1999908, - SAY_SALUTE = -1999909, - SAY_EVADE = -1999910, + //These texts must be added to the creature texts of the npc for which the script is assigned. + SAY_AGGRO = 0, // "Let the games begin." + SAY_RANDOM = 1, // "I see endless suffering. I see torment. I see rage. I see everything.", + // "Muahahahaha", + // "These mortal infedels my lord, they have invaded your sanctum and seek to steal your secrets.", + // "You are already dead.", + // "Where to go? What to do? So many choices that all end in pain, end in death." + SAY_BERSERK = 2, // "$N, I sentance you to death!" + SAY_PHASE = 3, // "The suffering has just begun!" + SAY_DANCE = 4, // "I always thought I was a good dancer." + SAY_SALUTE = 5, // "Move out Soldier!" + SAY_EVADE = 6 // "Help $N! I'm under attack!" }; enum Spells @@ -127,7 +128,7 @@ class example_creature : public CreatureScript void EnterCombat(Unit* who) { //Say some stuff - DoScriptText(SAY_AGGRO, me, who); + Talk(SAY_AGGRO, who->GetGUID()); } // *** HANDLED FUNCTION *** @@ -142,7 +143,7 @@ class example_creature : public CreatureScript // Called when going out of combat. Reset is called just after. void EnterEvadeMode() { - DoScriptText(SAY_EVADE, me); + Talk(SAY_EVADE); } // *** HANDLED FUNCTION *** @@ -154,10 +155,10 @@ class example_creature : public CreatureScript switch (uiTextEmote) { case TEXT_EMOTE_DANCE: - DoScriptText(SAY_DANCE, me); + Talk(SAY_DANCE); break; case TEXT_EMOTE_SALUTE: - DoScriptText(SAY_SALUTE, me); + Talk(SAY_SALUTE); break; } } @@ -173,7 +174,7 @@ class example_creature : public CreatureScript if (m_uiSayTimer <= uiDiff) { //Random switch between 5 outcomes - DoScriptText(RAND(SAY_RANDOM_0, SAY_RANDOM_1, SAY_RANDOM_2, SAY_RANDOM_3, SAY_RANDOM_4), me); + Talk(SAY_RANDOM); m_uiSayTimer = 45000; //Say something agian in 45 seconds } @@ -235,7 +236,7 @@ class example_creature : public CreatureScript if (m_uiBeserkTimer <= uiDiff) { //Say our line then cast uber death spell - DoScriptText(SAY_BERSERK, me, me->getVictim()); + Talk(SAY_BERSERK, me->getVictim() ? me->getVictim()->GetGUID() : 0); DoCast(me->getVictim(), SPELL_BERSERK); //Cast our beserk spell agian in 12 seconds if we didn't kill everyone @@ -250,7 +251,7 @@ class example_creature : public CreatureScript { //Go to next phase ++m_uiPhase; - DoScriptText(SAY_PHASE, me); + Talk(SAY_PHASE); DoCast(me, SPELL_FRENZY); } else diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp index 8cf0dad25d2..cd680b31577 100644 --- a/src/server/scripts/Examples/example_escort.cpp +++ b/src/server/scripts/Examples/example_escort.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "Player.h" +#include "CreatureTextMgr.h" enum eEnums { @@ -37,18 +38,18 @@ enum eEnums SPELL_ELIXIR_OF_FORTITUDE = 3593, SPELL_BLUE_FIREWORK = 11540, - SAY_AGGRO1 = -1999910, - SAY_AGGRO2 = -1999911, - SAY_WP_1 = -1999912, - SAY_WP_2 = -1999913, - SAY_WP_3 = -1999914, - SAY_WP_4 = -1999915, - SAY_DEATH_1 = -1999916, - SAY_DEATH_2 = -1999917, - SAY_DEATH_3 = -1999918, - SAY_SPELL = -1999919, - SAY_RAND_1 = -1999920, - SAY_RAND_2 = -1999921 + SAY_AGGRO1 = 0, + SAY_AGGRO2 = 1, + SAY_WP_1 = 2, + SAY_WP_2 = 3, + SAY_WP_3 = 4, + SAY_WP_4 = 5, + SAY_DEATH_1 = 6, + SAY_DEATH_2 = 7, + SAY_DEATH_3 = 8, + SAY_SPELL = 9, + SAY_RAND_1 = 10, + SAY_RAND_2 = 11 }; #define GOSSIP_ITEM_1 "Click to Test Escort(Attack, Run)" @@ -83,19 +84,19 @@ class example_escort : public CreatureScript switch (waypointId) { case 1: - DoScriptText(SAY_WP_1, me); + Talk(SAY_WP_1); break; case 3: - DoScriptText(SAY_WP_2, me); + Talk(SAY_WP_2); me->SummonCreature(NPC_FELBOAR, me->GetPositionX()+5.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); break; case 4: if (Player* player = GetPlayerForEscort()) { //pTmpPlayer is the target of the text - DoScriptText(SAY_WP_3, me, player); + Talk(SAY_WP_3, player->GetGUID()); //pTmpPlayer is the source of the text - DoScriptText(SAY_WP_4, player); + sCreatureTextMgr->SendChat(me, SAY_WP_4, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); } break; } @@ -106,10 +107,10 @@ class example_escort : public CreatureScript if (HasEscortState(STATE_ESCORT_ESCORTING)) { if (Player* player = GetPlayerForEscort()) - DoScriptText(SAY_AGGRO1, me, player); + Talk(SAY_AGGRO1, player->GetGUID()); } else - DoScriptText(SAY_AGGRO2, me); + Talk(SAY_AGGRO2); } void Reset() @@ -126,13 +127,13 @@ class example_escort : public CreatureScript { // not a likely case, code here for the sake of example if (killer == me) - DoScriptText(SAY_DEATH_1, me, player); + Talk(SAY_DEATH_1, player->GetGUID()); else - DoScriptText(SAY_DEATH_2, me, player); + Talk(SAY_DEATH_2, player->GetGUID()); } } else - DoScriptText(SAY_DEATH_3, me); + Talk(SAY_DEATH_3); } void UpdateAI(const uint32 uiDiff) @@ -145,7 +146,7 @@ class example_escort : public CreatureScript { if (m_uiDeathCoilTimer <= uiDiff) { - DoScriptText(SAY_SPELL, me); + Talk(SAY_SPELL); DoCast(me->getVictim(), SPELL_DEATH_COIL, false); m_uiDeathCoilTimer = 4000; } @@ -161,12 +162,12 @@ class example_escort : public CreatureScript { if (me->HasAura(SPELL_ELIXIR_OF_FORTITUDE, 0)) { - DoScriptText(SAY_RAND_1, me); + Talk(SAY_RAND_1); DoCast(me, SPELL_BLUE_FIREWORK, false); } else { - DoScriptText(SAY_RAND_2, me); + Talk(SAY_RAND_2); DoCast(me, SPELL_ELIXIR_OF_FORTITUDE, false); } diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp index 352c43fc1de..b6be4ce3ce1 100644 --- a/src/server/scripts/Examples/example_gossip_codebox.cpp +++ b/src/server/scripts/Examples/example_gossip_codebox.cpp @@ -34,9 +34,10 @@ enum eEnums SPELL_POLYMORPH = 12826, SPELL_MARK_OF_THE_WILD = 26990, - SAY_NOT_INTERESTED = -1999922, - SAY_WRONG = -1999923, - SAY_CORRECT = -1999924 + //These texts must be added to the creature texts of the npc for which the script is assigned. + SAY_NOT_INTERESTED = 0, // "Normal select, guess you're not interested." + SAY_WRONG = 1, // "Wrong!" + SAY_CORRECT = 2 // "You're right, you are allowed to see my inner secrets." }; #define GOSSIP_ITEM_1 "A quiz: what's your name?" @@ -66,7 +67,8 @@ class example_gossip_codebox : public CreatureScript player->PlayerTalkClass->ClearMenus(); if (action == GOSSIP_ACTION_INFO_DEF+2) { - DoScriptText(SAY_NOT_INTERESTED, creature); + //Read comment in enum + creature->AI()->Talk(SAY_NOT_INTERESTED); player->CLOSE_GOSSIP_MENU(); } @@ -83,12 +85,14 @@ class example_gossip_codebox : public CreatureScript case GOSSIP_ACTION_INFO_DEF+1: if (player->GetName() != code) { - DoScriptText(SAY_WRONG, creature); + //Read comment in enum + creature->AI()->Talk(SAY_WRONG); creature->CastSpell(player, SPELL_POLYMORPH, true); } else { - DoScriptText(SAY_CORRECT, creature); + //Read comment in enum + creature->AI()->Talk(SAY_CORRECT); creature->CastSpell(player, SPELL_MARK_OF_THE_WILD, true); } player->CLOSE_GOSSIP_MENU(); diff --git a/src/server/scripts/Examples/example_misc.cpp b/src/server/scripts/Examples/example_misc.cpp index 5ff66c4a7ed..68986b44496 100644 --- a/src/server/scripts/Examples/example_misc.cpp +++ b/src/server/scripts/Examples/example_misc.cpp @@ -26,11 +26,6 @@ EndScriptData */ #include "ScriptMgr.h" #include "Player.h" -enum eSay -{ - SAY_HI = -1999925 -}; - class AT_example_areatrigger : public AreaTriggerScript { public: @@ -42,7 +37,7 @@ class AT_example_areatrigger : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) { - DoScriptText(SAY_HI, player); + player->Kill(player); return true; } }; -- cgit v1.2.3