diff options
Diffstat (limited to 'src/scripts/custom')
| -rw-r--r-- | src/scripts/custom/custom_example.cpp | 278 | ||||
| -rw-r--r-- | src/scripts/custom/custom_gossip_codebox.cpp | 89 | ||||
| -rw-r--r-- | src/scripts/custom/npc_acherus_taxi.cpp | 35 | ||||
| -rw-r--r-- | src/scripts/custom/npc_wyrmresttempel_taxi.cpp | 112 | ||||
| -rw-r--r-- | src/scripts/custom/on_events.cpp | 108 | ||||
| -rw-r--r-- | src/scripts/custom/test.cpp | 218 |
6 files changed, 0 insertions, 840 deletions
diff --git a/src/scripts/custom/custom_example.cpp b/src/scripts/custom/custom_example.cpp deleted file mode 100644 index 0e230ba901d..00000000000 --- a/src/scripts/custom/custom_example.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Custom_Example -SD%Complete: 100 -SDComment: Short custom scripting example -SDCategory: Script Examples -EndScriptData */ - -#include "precompiled.h" - -// **** This script is designed as an example for others to build on **** -// **** Please modify whatever you'd like to as this script is only for developement **** - -// **** Script Info **** -// This script is written in a way that it can be used for both friendly and hostile monsters -// Its primary purpose is to show just how much you can really do with scripts -// I recommend trying it out on both an agressive NPC and on friendly npc - -// **** Quick Info **** -// Functions with Handled Function marked above them are functions that are called automatically by the core -// Functions that are marked Custom Function are functions I've created to simplify code - -#define SPELL_BUFF 25661 -#define SPELL_ONE 12555 -#define SPELL_ONE_ALT 24099 -#define SPELL_TWO 10017 -#define SPELL_THREE 26027 -#define SPELL_ENRAGE 23537 -#define SPELL_BESERK 32309 - -#define SAY_AGGRO "Let the games begin." -#define SAY_RANDOM_0 "I see endless suffering. I see torment. I see rage. I see everything." -#define SAY_RANDOM_1 "Muahahahaha" -#define SAY_RANDOM_2 "These mortal infedels my lord, they have invaded your sanctum and seek to steal your secrets." -#define SAY_RANDOM_3 "You are already dead." -#define SAY_RANDOM_4 "Where to go? What to do? So many choices that all end in pain, end in death." -#define SAY_BESERK "$N, I sentance you to death!" -#define SAY_PHASE "The suffering has just begun!" - -#define GOSSIP_ITEM "I'm looking for a fight" -#define SAY_DANCE "I always thought I was a good dancer" -#define SAY_SALUTE "Move out Soldier!" - -struct TRINITY_DLL_DECL custom_exampleAI : public ScriptedAI -{ - //*** HANDLED FUNCTION *** - //This is the constructor, called only once when the Creature is first created - custom_exampleAI(Creature *c) : ScriptedAI(c) {} - - //*** CUSTOM VARIABLES **** - //These variables are for use only by this individual script. - //Nothing else will ever call them but us. - - uint32 Say_Timer; //Timer for random chat - uint32 Rebuff_Timer; //Timer for rebuffing - uint32 Spell_1_Timer; //Timer for spell 1 when in combat - uint32 Spell_2_Timer; //Timer for spell 1 when in combat - uint32 Spell_3_Timer; //Timer for spell 1 when in combat - uint32 Beserk_Timer; //Timer until we go into Beserk (enraged) mode - uint32 Phase; //The current battle phase we are in - uint32 Phase_Timer; //Timer until phase transition - - //*** HANDLED FUNCTION *** - //This is called whenever the core decides we need to evade - void Reset() - { - Phase = 1; //Start in phase 1 - Phase_Timer = 60000; //60 seconds - Spell_1_Timer = 5000; //5 seconds - Spell_2_Timer = 37000; //37 seconds - Spell_3_Timer = 19000; //19 seconds - Beserk_Timer = 120000; //2 minutes - } - - //*** HANDLED FUNCTION *** - //Attack Start is called whenever someone hits us. - void Aggro(Unit *who) - { - //Say some stuff - DoSay(SAY_AGGRO,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me,8280); - } - - //*** HANDLED FUNCTION *** - //Update AI is called Every single map update (roughly once every 100ms if a player is within the grid) - void UpdateAI(const uint32 diff) - { - //Out of combat timers - if (!me->getVictim()) - { - //Random Say timer - if (Say_Timer < diff) - { - //Random switch between 5 outcomes - switch (rand()%5) - { - case 0: - DoYell(SAY_RANDOM_0,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me,8831); //8831 is the index of the sound we are playing. You find these numbers in SoundEntries.dbc - break; - - case 1: - DoYell(SAY_RANDOM_1,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me,8818); - break; - - case 2: - DoYell(SAY_RANDOM_2,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me,8041); - break; - - case 3: - DoYell(SAY_RANDOM_3,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me,8581); - break; - - case 4: - DoYell(SAY_RANDOM_4,LANG_UNIVERSAL,NULL); - DoPlaySoundToSet(me,8791); - break; - } - - Say_Timer = 45000; //Say something agian in 45 seconds - }else Say_Timer -= diff; - - //Rebuff timer - if (Rebuff_Timer < diff) - { - DoCast(me,SPELL_BUFF); - Rebuff_Timer = 900000; //Rebuff agian in 15 minutes - }else Rebuff_Timer -= diff; - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - //Spell 1 timer - if (Spell_1_Timer < diff) - { - //Cast spell one on our current target. - if (rand()%50 > 10) - DoCast(me->getVictim(),SPELL_ONE_ALT); - else if (me->IsWithinDist(me->getVictim(), 25)) - DoCast(me->getVictim(),SPELL_ONE); - - Spell_1_Timer = 5000; - }else Spell_1_Timer -= diff; - - //Spell 2 timer - if (Spell_2_Timer < diff) - { - //Cast spell one on our current target. - DoCast(me->getVictim(),SPELL_TWO); - - Spell_2_Timer = 37000; - }else Spell_2_Timer -= diff; - - //Spell 3 timer - if (Phase > 1) - if (Spell_3_Timer < diff) - { - //Cast spell one on our current target. - DoCast(me->getVictim(),SPELL_THREE); - - Spell_3_Timer = 19000; - }else Spell_3_Timer -= diff; - - //Beserk timer - if (Phase > 1) - if (Beserk_Timer < diff) - { - //Say our line then cast uber death spell - DoPlaySoundToSet(me,8588); - DoYell(SAY_BESERK,LANG_UNIVERSAL,me->getVictim()); - DoCast(me->getVictim(),SPELL_BESERK); - - //Cast our beserk spell agian in 12 seconds if we didn't kill everyone - Beserk_Timer = 12000; - }else Beserk_Timer -= diff; - - //Phase timer - if (Phase == 1) - if (Phase_Timer < diff) - { - //Go to next phase - Phase++; - DoYell(SAY_PHASE,LANG_UNIVERSAL,NULL); - DoCast(me,SPELL_ENRAGE); - }else Phase_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -//This is the GetAI method used by all scripts that involve AI -//It is called every time a new Creature using this script is created -CreatureAI* GetAI_custom_example(Creature* pCreature) -{ - return new custom_exampleAI (pCreature); -} - -//This function is called when the player clicks an option on the gossip menu -void SendDefaultMenu_custom_example(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time - { - //Set our faction to hostile twoards all - pCreature->setFaction(24); - pCreature->Attack(pPlayer, true); - pPlayer->PlayerTalkClass->CloseGossip(); - } -} - -//This function is called when the player clicks an option on the gossip menu -bool GossipSelect_custom_example(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiSender == GOSSIP_SENDER_MAIN) - SendDefaultMenu_custom_example(pPlayer, pCreature, uiAction); - - return true; -} - -//This function is called when the player opens the gossip menu -bool GossipHello_custom_example(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID()); - - return true; -} - -//Our Recive emote function -bool ReceiveEmote_custom_example(Player* pPlayer, Creature* pCreature, uint32 emote) -{ - pCreature->HandleEmoteCommand(emote); - - if (emote == TEXTEMOTE_DANCE) - ((custom_exampleAI*)_Creature->AI())->DoSay(SAY_DANCE,LANG_UNIVERSAL,NULL); - - if (emote == TEXTEMOTE_SALUTE) - ((custom_exampleAI*)_Creature->AI())->DoSay(SAY_SALUTE,LANG_UNIVERSAL,NULL); - - return true; -} - -//This is the actual function called only once durring InitScripts() -//It must define all handled functions that are to be run in this script -//For example if you want this Script to handle Emotes you must include -//newscript->ReciveEmote = My_Emote_Function; -void AddSC_custom_example() -{ - Script *newscript; - - newscript = new Script; - newscript->Name="custom_example"; - newscript->GetAI = &GetAI_custom_example; - newscript->pGossipHello = &GossipHello_custom_example; - newscript->pGossipSelect = &GossipSelect_custom_example; - newscript->pReceiveEmote = &ReceiveEmote_custom_example; - newscript->RegisterSelf(); -} - diff --git a/src/scripts/custom/custom_gossip_codebox.cpp b/src/scripts/custom/custom_gossip_codebox.cpp deleted file mode 100644 index a00d2b7031f..00000000000 --- a/src/scripts/custom/custom_gossip_codebox.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Custom_Gossip_Codebox -SD%Complete: 100 -SDComment: Show a codebox in gossip option -SDCategory: Script Examples -EndScriptData */ - -#include "precompiled.h" -#include <cstring> - -#define GOSSIP_ITEM_EXTENDED "A quiz: what's your name?" -#define GOSSIP_ITEM "I'm not interested" - -#define SAY_NOT_INTERESTED "Normal select, guess you're not interested." -#define SAY_WRONG "Wrong!" -#define SAY_RIGHT "You're right, you are allowed to see my inner secrets." - -//This function is called when the player opens the gossip menubool -bool GossipHello_custom_gossip_codebox(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - - pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID()); - return true; -} - -//This function is called when the player clicks an option on the gossip menubool -bool GossipSelect_custom_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pCreature->Say(SAY_NOT_INTERESTED, LANG_UNIVERSAL, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - } - return true; -} - -bool GossipSelectWithCode_custom_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) -{ - if (uiSender == GOSSIP_SENDER_MAIN) - { - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - if (std::strcmp(sCode, pPlayer->GetName())!=0) - { - pCreature->Say(SAY_WRONG, LANG_UNIVERSAL, 0); - pCreature->CastSpell(pPlayer, 12826, true); - } - else - { - pCreature->Say(SAY_RIGHT, LANG_UNIVERSAL, 0); - pCreature->CastSpell(pPlayer, 26990, true); - } - pPlayer->CLOSE_GOSSIP_MENU(); - return true; - } - } - return false; -} - -void AddSC_custom_gossip_codebox() -{ - Script *newscript; - - newscript = new Script; - newscript->Name="custom_gossip_codebox"; - newscript->pGossipHello = &GossipHello_custom_gossip_codebox; - newscript->pGossipSelect = &GossipSelect_custom_gossip_codebox; - newscript->pGossipSelectWithCode = &GossipSelectWithCode_custom_gossip_codebox; - newscript->RegisterSelf(); -} - diff --git a/src/scripts/custom/npc_acherus_taxi.cpp b/src/scripts/custom/npc_acherus_taxi.cpp deleted file mode 100644 index 6e00e365e8e..00000000000 --- a/src/scripts/custom/npc_acherus_taxi.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "ScriptedPch.h" -#include "WorldPacket.h" - -#define GOSSIP_FLIGHT "I need a ride" - -bool GossipHello_npc_acherus_taxi(Player *pPlayer, Creature *pCreature) -{ - pPlayer->SetTaxiCheater(true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(9978, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_acherus_taxi(Player *pPlayer, Creature * /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - if (pPlayer->GetPositionZ() >= 316) - pPlayer->GetSession()->SendDoFlight(24446, 1053); - else - pPlayer->GetSession()->SendDoFlight(24446, 1054); - } - return true; -} - -void AddSC_npc_acherus_taxi() -{ - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_acherus_taxi"; - newscript->pGossipHello = &GossipHello_npc_acherus_taxi; - newscript->pGossipSelect = &GossipSelect_npc_acherus_taxi; - newscript->RegisterSelf(); -} diff --git a/src/scripts/custom/npc_wyrmresttempel_taxi.cpp b/src/scripts/custom/npc_wyrmresttempel_taxi.cpp deleted file mode 100644 index d4c2cb5ab74..00000000000 --- a/src/scripts/custom/npc_wyrmresttempel_taxi.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "ScriptedPch.h" -#include "WorldPacket.h" - -#define GOSSIP_UP "My Lord, I must go to the upper floor of the temple." -#define GOSSIP_DOWN "I would like to take a flight to the ground, Lord Afrasastrasz." -#define GOSSIP_MIDDLE "Can you spare a drake to travel to Lord Afrasastrasz, in the middle of the temple?" -#define GOSSIP_TOP "Please, Let me take one of these dragons to the top floor of the temple." -#define GOSSIP_BOTTOM "Yes, Please. I would like to return to the ground floor of the temple." -#define GOSSIP_ONEDOWN "I would like to see Lord Afrasastrasz, in the middle of the temple." - -bool GossipHello_npc_wyrmresttempel_middle_taxi(Player* pPlayer, Creature* pCreature) -{ -pPlayer->SetTaxiCheater(true); - -pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); -pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DOWN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(12887, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_wyrmresttempel_middle_taxi(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->GetSession()->SendDoFlight(6376, 881); - } - - if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) - { - pPlayer->GetSession()->SendDoFlight(6376, 882); - - } -return true; -} - -bool GossipHello_npc_wyrmresttempel_bottom_taxi(Player* pPlayer, Creature* pCreature) -{ -pPlayer->SetTaxiCheater(true); - -pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TOP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); -pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MIDDLE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(12713, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_wyrmresttempel_bottom_taxi(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 4) - { - pPlayer->GetSession()->SendDoFlight(6376, 878); - } - - if (uiAction == GOSSIP_ACTION_INFO_DEF + 3) - { - pPlayer->GetSession()->SendDoFlight(6376, 883); - - } -return true; -} - -bool GossipHello_npc_wyrmresttempel_top_taxi(Player* pPlayer, Creature* pCreature) -{ -pPlayer->SetTaxiCheater(true); - -pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOTTOM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); -pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ONEDOWN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(12714, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_wyrmresttempel_top_taxi(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 5) - { - pPlayer->GetSession()->SendDoFlight(6376, 879); - } - - if (uiAction == GOSSIP_ACTION_INFO_DEF + 6) - - { - pPlayer->GetSession()->SendDoFlight(6376, 880); - - } -return true; -} - -void AddSC_npc_wyrmresttempel_taxi() -{ - Script *newscript; - -newscript = new Script; -newscript->Name = "npc_wyrmresttempelmiddle_taxi"; -newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_middle_taxi; -newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_middle_taxi; -newscript->RegisterSelf(); - -newscript = new Script; -newscript->Name = "npc_wyrmresttempelbottom_taxi"; -newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_bottom_taxi; -newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_bottom_taxi; -newscript->RegisterSelf(); - -newscript = new Script; -newscript->Name = "npc_wyrmresttempeltop_taxi"; -newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_top_taxi; -newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_top_taxi; -newscript->RegisterSelf(); - -} diff --git a/src/scripts/custom/on_events.cpp b/src/scripts/custom/on_events.cpp deleted file mode 100644 index 94e54a07fba..00000000000 --- a/src/scripts/custom/on_events.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "ScriptedPch.h" -#include <cstring> - -//This function is called when the player logs in (every login) -void OnLogin(Player * /*pPlayer*/) -{ - -} - -//This function is called when the player logs out -void OnLogout(Player * /*pPlayer*/) -{ - -} - -//This function is called when the player kills another player -void OnPVPKill(Player * /*killer*/, Player * /*killed*/) -{ - -} - -//This function is called when a players AreaID changes -void OnAreaChange(Player * /*pPlayer*/, AreaTableEntry const * /*pArea*/) -{ - -} - -//This is called when a player kills a creature (non pvp) -void OnCreatureKill(Player * /*pPlayer*/, Creature * /*pCreature*/) -{ - -} - -//This function is called when a player has a money exchange -int32 OnGetMoney(Player * /*pPlayer*/, int32 amount) -{ - return amount; -} - -//This function is called whenever a player gets XP -uint32 OnGetXP(Player * /*pPlayer*/, uint32 amount) -{ - return amount; -} - -//This function is called when a player clicks a GO Object -bool OnGoClick(Player * /*pPlayer*/, GameObject * /*pGameObject*/) -{ - return true; -} - -//This function is called when a player clicks and item -bool OnItemClick(Player * /*pPlayer*/, Item * /*pItem*/) -{ - return true; -} - -//This function is called when a player opens an item (like a clam) -bool OnItemOpen(Player * /*pPlayer*/, Item * /*pItem*/) -{ - return true; -} - -//This function is called when a player sends a chat message -bool OnPlayerChat(Player * /*pPlayer*/, const char * /*text*/) -{ - return true; -} - -//this function is called when the server starts -void OnServerStartup() -{ - -} -//this function is called when the server shuts down -void OnServerShutdown() -{ - -} - -//this function is called when a player casts a spell -bool OnSpellCast(Unit * /*pUnitTarget*/, Item * /*pItemTarget*/, GameObject * /*pGoTarget*/, uint32 /*i*/, SpellEntry const * /*spell*/) -{ - return true; -} - - void AddSC_onevents() -{ - Script *newscript; - newscript = new Script; - newscript->Name = "scripted_on_events"; - newscript->pOnLogin = &OnLogin; - newscript->pOnLogout = &OnLogout; - newscript->pOnPVPKill = &OnPVPKill; - newscript->pOnAreaChange = &OnAreaChange; - newscript->pOnCreatureKill = &OnCreatureKill; - newscript->pOnGetMoney = &OnGetMoney; - newscript->pOnGetXP = &OnGetXP; - newscript->pOnGoClick = &OnGoClick; - newscript->pOnItemClick = &OnItemClick; - newscript->pOnItemOpen = &OnItemOpen; - newscript->pOnPlayerChat = &OnPlayerChat; - newscript->pOnServerShutdown = &OnServerShutdown; - newscript->pOnServerStartup = &OnServerStartup; - newscript->pOnSpellCast = &OnSpellCast; - - newscript->RegisterSelf(); -} diff --git a/src/scripts/custom/test.cpp b/src/scripts/custom/test.cpp deleted file mode 100644 index aa9e6879075..00000000000 --- a/src/scripts/custom/test.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Test -SD%Complete: 100 -SDComment: Script used for testing escortAI -SDCategory: Script Examples -EndScriptData */ - -#include "precompiled.h" -#include "escort_ai.h" - -#define SAY_WALK "Hmm a nice day for a walk alright" -#define SAY_ATTACK "Wild Felboar attack!" -#define SAY_TIME_TO_GO "Time for me to go! See ya around $N!" -#define SAY_BYE "Bye Bye!" -#define SAY_AGGRO1 "Help $N! I'm under attack!" -#define SAY_AGGRO2 "Die scum!" -#define WHISPER_TOO_FAR "How dare you leave me like that! I hate you! =*(" -#define SAY_DIE1 "...no...how could you let me die $N" -#define SAY_DIE2 "ugh..." -#define SAY_DEATHCOIL "Taste death!" -#define SAY_FIREWORKS "Fireworks!" -#define SAY_BUFF "Hmm, I think I could use a buff" - -#define GOSSIP_TEXT1 "Click to Test Escort(Attack, Defend, Run)" -#define GOSSIP_TEXT2 "Click to Test Escort(NoAttack, NoDefend, Walk)" -#define GOSSIP_TEXT3 "Click to Test Escort(NoAttack, Defend, Walk)" - -struct TRINITY_DLL_DECL npc_testAI : public npc_escortAI -{ - public: - - // CreatureAI functions - npc_testAI(Creature *c) : npc_escortAI(c) {} - - uint32 DeathCoilTimer; - uint32 ChatTimer; - - // Pure Virtual Functions - void WaypointReached(uint32 i) - { - switch (i) - { - case 1: - me->Say(SAY_WALK, LANG_UNIVERSAL, 0); - break; - - case 3: - { - me->Say(SAY_ATTACK, LANG_UNIVERSAL, 0); - Creature* temp = me->SummonCreature(21878, me->GetPositionX()+5, me->GetPositionY()+7, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); - if (temp) - temp->AI()->AttackStart(me); - } - break; - - case 4: - { - me->Say(SAY_TIME_TO_GO, LANG_UNIVERSAL, PlayerGUID); - me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); - - Unit* temp = Unit::GetUnit(*me, PlayerGUID); - if (temp) - { - temp->MonsterSay(SAY_BYE, LANG_UNIVERSAL, 0); - temp->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); - } - } - break; - } - } - - void Aggro(Unit*) - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - me->Say(SAY_AGGRO1, LANG_UNIVERSAL, PlayerGUID); - else me->Say(SAY_AGGRO2, LANG_UNIVERSAL, 0); - } - - void Reset() - { - DeathCoilTimer = 4000; - ChatTimer = 4000; - } - - void JustDied(Unit* killer) - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - //killer = me when player got to far from creature - if (killer == me) - { - Unit *pTemp = Unit::GetUnit(*me,PlayerGUID); - if (pTemp) - DoWhisper(WHISPER_TOO_FAR, pTemp); - } - else me->Say(SAY_DIE1, LANG_UNIVERSAL, PlayerGUID); - } - else me->Say(SAY_DIE2, LANG_UNIVERSAL, 0); - } - - void UpdateAI(const uint32 diff) - { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - - //Combat check - if (me->isInCombat() && me->getVictim()) - { - if (DeathCoilTimer < diff) - { - me->Say(SAY_DEATHCOIL, LANG_UNIVERSAL, 0); - me->CastSpell(me->getVictim(), 33130, false); - - DeathCoilTimer = 4000; - }else DeathCoilTimer -= diff; - }else - { - //Out of combat but being escorted - if (HasEscortState(STATE_ESCORT_ESCORTING)) - if (ChatTimer < diff) - { - if (me->HasAura(3593, 0)) - { - me->Say(SAY_FIREWORKS, LANG_UNIVERSAL, 0); - me->CastSpell(me, 11540, false); - }else - { - me->Say(SAY_BUFF, LANG_UNIVERSAL, 0); - me->CastSpell(me, 3593, false); - } - - ChatTimer = 12000; - }else ChatTimer -= diff; - } - } -}; - -CreatureAI* GetAI_test(Creature* pCreature) -{ - npc_testAI* testAI = new npc_testAI(pCreature); - - testAI->AddWaypoint(0, 1231, -4419, 23); - testAI->AddWaypoint(1, 1198, -4440, 23, 0); - testAI->AddWaypoint(2, 1208, -4392, 23); - testAI->AddWaypoint(3, 1231, -4419, 23, 5000); - testAI->AddWaypoint(4, 1208, -4392, 23, 5000); - - return (CreatureAI*)testAI; -} - -bool GossipHello_npc_test(Player* pPlayer, Creature* pCreature) -{ - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->prepareGossipMenu(pPlayer,0); - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - - pCreature->sendPreparedGossip(pPlayer); - return true; -} - -bool GossipSelect_npc_test(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - ((npc_escortAI*)(pCreature->AI()))->Start(true, true, pPlayer->GetGUID()); - - return true; // prevent Trinity core handling - } - - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); - ((npc_escortAI*)(pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); - - return true; // prevent Trinity core handling - } - - if (uiAction == GOSSIP_ACTION_INFO_DEF+3) - { - pPlayer->CLOSE_GOSSIP_MENU(); - ((npc_escortAI*)(pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); - - return true; // prevent Trinity core handling - } - return false; -} - -void AddSC_test() -{ - Script *newscript; - newscript = new Script; - newscript->Name="test"; - newscript->GetAI = &GetAI_test; - newscript->pGossipHello = &GossipHello_npc_test; - newscript->pGossipSelect = &GossipSelect_npc_test; - newscript->RegisterSelf(); -} - |
