aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/Examples')
-rw-r--r--src/server/scripts/Examples/example_commandscript.cpp2
-rw-r--r--src/server/scripts/Examples/example_creature.cpp20
-rw-r--r--src/server/scripts/Examples/example_escort.cpp38
-rw-r--r--src/server/scripts/Examples/example_gossip_codebox.cpp19
-rw-r--r--src/server/scripts/Examples/example_misc.cpp6
-rw-r--r--src/server/scripts/Examples/example_spell.cpp38
6 files changed, 66 insertions, 57 deletions
diff --git a/src/server/scripts/Examples/example_commandscript.cpp b/src/server/scripts/Examples/example_commandscript.cpp
index a87b8c5a555..0c10cec5155 100644
--- a/src/server/scripts/Examples/example_commandscript.cpp
+++ b/src/server/scripts/Examples/example_commandscript.cpp
@@ -43,7 +43,7 @@ class example_commandscript : public CommandScript
return true;
}
- ChatCommand* GetCommands() const
+ ChatCommand* GetCommands() const OVERRIDE
{
static ChatCommand HelloWorldCommandTable[] =
{
diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp
index 78c66750c5c..92c248c1fc9 100644
--- a/src/server/scripts/Examples/example_creature.cpp
+++ b/src/server/scripts/Examples/example_creature.cpp
@@ -72,7 +72,7 @@ enum Spells
SPELL_BERSERK = 32965,
};
-enum eEnums
+enum Factions
{
// any other constants
FACTION_WORGEN = 24
@@ -111,7 +111,7 @@ class example_creature : public CreatureScript
// *** HANDLED FUNCTION ***
//This is called after spawn and whenever the core decides we need to evade
- void Reset()
+ void Reset() OVERRIDE
{
m_uiPhase = 1; // Start in phase 1
m_uiPhaseTimer = 60000; // 60 seconds
@@ -125,7 +125,7 @@ class example_creature : public CreatureScript
// *** HANDLED FUNCTION ***
// Enter Combat called once per combat
- void EnterCombat(Unit* who)
+ void EnterCombat(Unit* who) OVERRIDE
{
//Say some stuff
Talk(SAY_AGGRO, who->GetGUID());
@@ -134,21 +134,21 @@ class example_creature : public CreatureScript
// *** HANDLED FUNCTION ***
// Attack Start is called when victim change (including at start of combat)
// By default, attack who and start movement toward the victim.
- //void AttackStart(Unit* who)
+ //void AttackStart(Unit* who) OVERRIDE
//{
// ScriptedAI::AttackStart(who);
//}
// *** HANDLED FUNCTION ***
// Called when going out of combat. Reset is called just after.
- void EnterEvadeMode()
+ void EnterEvadeMode() OVERRIDE
{
Talk(SAY_EVADE);
}
// *** HANDLED FUNCTION ***
//Our Receive emote function
- void ReceiveEmote(Player* /*player*/, uint32 uiTextEmote)
+ void ReceiveEmote(Player* /*player*/, uint32 uiTextEmote) OVERRIDE
{
me->HandleEmoteCommand(uiTextEmote);
@@ -165,7 +165,7 @@ class example_creature : public CreatureScript
// *** HANDLED FUNCTION ***
//Update AI is called Every single map update (roughly once every 50ms if a player is within the grid)
- void UpdateAI(uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff) OVERRIDE
{
//Out of combat timers
if (!me->GetVictim())
@@ -262,12 +262,12 @@ class example_creature : public CreatureScript
}
};
- CreatureAI* GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new example_creatureAI(creature);
}
- bool OnGossipHello(Player* player, Creature* creature)
+ bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
@@ -275,7 +275,7 @@ class example_creature : public CreatureScript
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF+1)
diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp
index f4cb5c24e18..8cbd2fc4933 100644
--- a/src/server/scripts/Examples/example_escort.cpp
+++ b/src/server/scripts/Examples/example_escort.cpp
@@ -30,14 +30,8 @@ EndScriptData */
#include "Player.h"
#include "CreatureTextMgr.h"
-enum eEnums
+enum Yells
{
- NPC_FELBOAR = 21878,
-
- SPELL_DEATH_COIL = 33130,
- SPELL_ELIXIR_OF_FORTITUDE = 3593,
- SPELL_BLUE_FIREWORK = 11540,
-
SAY_AGGRO1 = 0,
SAY_AGGRO2 = 1,
SAY_WP_1 = 2,
@@ -52,6 +46,18 @@ enum eEnums
SAY_RAND_2 = 11
};
+enum Spells
+{
+ SPELL_DEATH_COIL = 33130,
+ SPELL_ELIXIR_OF_FORTITUDE = 3593,
+ SPELL_BLUE_FIREWORK = 11540
+};
+
+enum Creatures
+{
+ NPC_FELBOAR = 21878
+};
+
#define GOSSIP_ITEM_1 "Click to Test Escort(Attack, Run)"
#define GOSSIP_ITEM_2 "Click to Test Escort(NoAttack, Walk)"
#define GOSSIP_ITEM_3 "Click to Test Escort(NoAttack, Run)"
@@ -73,13 +79,13 @@ class example_escort : public CreatureScript
uint32 m_uiDeathCoilTimer;
uint32 m_uiChatTimer;
- void JustSummoned(Creature* summoned)
+ void JustSummoned(Creature* summoned) OVERRIDE
{
summoned->AI()->AttackStart(me);
}
// Pure Virtual Functions (Have to be implemented)
- void WaypointReached(uint32 waypointId)
+ void WaypointReached(uint32 waypointId) OVERRIDE
{
switch (waypointId)
{
@@ -102,7 +108,7 @@ class example_escort : public CreatureScript
}
}
- void EnterCombat(Unit* /*who*/)
+ void EnterCombat(Unit* /*who*/) OVERRIDE
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
@@ -113,13 +119,13 @@ class example_escort : public CreatureScript
Talk(SAY_AGGRO2);
}
- void Reset()
+ void Reset() OVERRIDE
{
m_uiDeathCoilTimer = 4000;
m_uiChatTimer = 4000;
}
- void JustDied(Unit* killer)
+ void JustDied(Unit* killer) OVERRIDE
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
@@ -136,7 +142,7 @@ class example_escort : public CreatureScript
Talk(SAY_DEATH_3);
}
- void UpdateAI(uint32 uiDiff)
+ void UpdateAI(uint32 uiDiff) OVERRIDE
{
//Must update npc_escortAI
npc_escortAI::UpdateAI(uiDiff);
@@ -180,12 +186,12 @@ class example_escort : public CreatureScript
}
};
- CreatureAI* GetAI(Creature* creature) const
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new example_escortAI(creature);
}
- bool OnGossipHello(Player* player, Creature* creature)
+ bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
{
player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
player->PrepareGossipMenu(creature, 0);
@@ -199,7 +205,7 @@ class example_escort : public CreatureScript
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
{
player->PlayerTalkClass->ClearMenus();
npc_escortAI* pEscortAI = CAST_AI(example_escort::example_escortAI, creature->AI());
diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp
index 1cfc1ef23ae..90aae21f807 100644
--- a/src/server/scripts/Examples/example_gossip_codebox.cpp
+++ b/src/server/scripts/Examples/example_gossip_codebox.cpp
@@ -29,17 +29,20 @@ EndScriptData */
#include "Player.h"
#include <cstring>
-enum eEnums
+enum Yells
{
- SPELL_POLYMORPH = 12826,
- SPELL_MARK_OF_THE_WILD = 26990,
-
- //These texts must be added to the creature texts of the npc for which the script is assigned.
+ // 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."
};
+enum Spells
+{
+ SPELL_POLYMORPH = 12826,
+ SPELL_MARK_OF_THE_WILD = 26990
+};
+
#define GOSSIP_ITEM_1 "A quiz: what's your name?"
#define GOSSIP_ITEM_2 "I'm not interested"
@@ -52,7 +55,7 @@ class example_gossip_codebox : public CreatureScript
{
}
- bool OnGossipHello(Player* player, Creature* creature)
+ bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
{
player->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
@@ -62,7 +65,7 @@ class example_gossip_codebox : public CreatureScript
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF+2)
@@ -75,7 +78,7 @@ class example_gossip_codebox : public CreatureScript
return true;
}
- bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code)
+ bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code) OVERRIDE
{
player->PlayerTalkClass->ClearMenus();
if (sender == GOSSIP_SENDER_MAIN)
diff --git a/src/server/scripts/Examples/example_misc.cpp b/src/server/scripts/Examples/example_misc.cpp
index 5f329e94a31..980d52c729c 100644
--- a/src/server/scripts/Examples/example_misc.cpp
+++ b/src/server/scripts/Examples/example_misc.cpp
@@ -35,7 +35,7 @@ class AT_example_areatrigger : public AreaTriggerScript
{
}
- bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) OVERRIDE
{
player->Kill(player);
return true;
@@ -51,7 +51,7 @@ class ItemUse_example_item : public ItemScript
{
}
- bool OnUse(Player* /*player*/, Item* /*item*/, SpellCastTargets const& /*targets*/)
+ bool OnUse(Player* /*player*/, Item* /*item*/, SpellCastTargets const& /*targets*/) OVERRIDE
{
sScriptMgr->LoadDatabase();
return true;
@@ -67,7 +67,7 @@ class GOHello_example_go_teleporter : public GameObjectScript
{
}
- bool OnGossipHello(Player* player, GameObject* /*go*/)
+ bool OnGossipHello(Player* player, GameObject* /*go*/) OVERRIDE
{
player->TeleportTo(0, 1807.07f, 336.105f, 70.3975f, 0.0f);
return false;
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index c3a56e7a2cb..30206ec555c 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -50,7 +50,7 @@ class spell_ex_5581 : public SpellScriptLoader
// function called on server startup
// checks if script has data required for it to work
- bool Validate(SpellInfo const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE
{
// check if spellid 70522 exists in dbc, we will trigger it later
if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
@@ -60,7 +60,7 @@ class spell_ex_5581 : public SpellScriptLoader
// function called just after script is added to spell
// we initialize local variables if needed
- bool Load()
+ bool Load() OVERRIDE
{
localVariable = "we're using local variable";
localVariable2 = new char();
@@ -73,7 +73,7 @@ class spell_ex_5581 : public SpellScriptLoader
// function called just before script delete
// we free allocated memory
- void Unload()
+ void Unload() OVERRIDE
{
delete localVariable2;
}
@@ -159,7 +159,7 @@ class spell_ex_5581 : public SpellScriptLoader
}
// register functions used in spell script - names of these functions do not matter
- void Register()
+ void Register() OVERRIDE
{
// we're registering our functions here
BeforeCast += SpellCastFn(spell_ex_5581SpellScript::HandleBeforeCast);
@@ -192,7 +192,7 @@ class spell_ex_5581 : public SpellScriptLoader
};
// function which creates SpellScript
- SpellScript* GetSpellScript() const
+ SpellScript* GetSpellScript() const OVERRIDE
{
return new spell_ex_5581SpellScript();
}
@@ -208,7 +208,7 @@ class spell_ex_66244 : public SpellScriptLoader
PrepareAuraScript(spell_ex_66244AuraScript);
// function called on server startup
// checks if script has data required for it to work
- bool Validate(SpellInfo const* /*spellEntry*/)
+ bool Validate(SpellInfo const* /*spellEntry*/) OVERRIDE
{
// check if spellid exists in dbc, we will trigger it later
if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
@@ -218,7 +218,7 @@ class spell_ex_66244 : public SpellScriptLoader
// function called in aura constructor
// we initialize local variables if needed
- bool Load()
+ bool Load() OVERRIDE
{
// do not load script if aura is casted by player or caster not avalible
if (Unit* caster = GetCaster())
@@ -316,7 +316,7 @@ class spell_ex_66244 : public SpellScriptLoader
}
// function registering
- void Register()
+ void Register() OVERRIDE
{
OnEffectApply += AuraEffectApplyFn(spell_ex_66244AuraScript::HandleOnEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_ex_66244AuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
@@ -347,7 +347,7 @@ class spell_ex_66244 : public SpellScriptLoader
};
// function which creates AuraScript
- AuraScript* GetAuraScript() const
+ AuraScript* GetAuraScript() const OVERRIDE
{
return new spell_ex_66244AuraScript();
}
@@ -379,7 +379,7 @@ class spell_ex_absorb_aura : public SpellScriptLoader
}
// function registering
- void Register()
+ void Register() OVERRIDE
{
OnEffectAbsorb += AuraEffectAbsorbFn(spell_ex_absorb_auraAuraScript::HandleOnEffectAbsorb, EFFECT_0);
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_ex_absorb_auraAuraScript::HandleAfterEffectAbsorb, EFFECT_0);
@@ -387,7 +387,7 @@ class spell_ex_absorb_aura : public SpellScriptLoader
};
// function which creates AuraScript
- AuraScript* GetAuraScript() const
+ AuraScript* GetAuraScript() const OVERRIDE
{
return new spell_ex_absorb_auraAuraScript();
}
@@ -408,14 +408,14 @@ class spell_ex_463 : public SpellScriptLoader
// in our script we allow only players to be affected
return target->GetTypeId() == TYPEID_PLAYER;
}
- void Register()
+ void Register() OVERRIDE
{
DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_ex_463AuraScript::CheckAreaTarget);
}
};
// function which creates AuraScript
- AuraScript* GetAuraScript() const
+ AuraScript* GetAuraScript() const OVERRIDE
{
return new spell_ex_463AuraScript();
}
@@ -440,18 +440,18 @@ class spell_ex : public SpellScriptLoader
{
PrepareSpellScript(spell_ex_SpellScript);
- //bool Validate(SpellInfo const* spellEntry){return true;}
+ //bool Validate(SpellInfo const* spellEntry){return true;} OVERRIDE
//bool Load(){return true;}
//void Unload(){}
//void Function(SpellEffIndex effIndex) //OnEffect += SpellEffectFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_EFFECT_ANY);
//void Function() //OnHit += SpellEffectFn(spell_ex_SpellScript::Function);
- void Register()
+ void Register() OVERRIDE
{
}
};
- SpellScript* GetSpellScript() const
+ SpellScript* GetSpellScript() const OVERRIDE
{
return new spell_ex_SpellScript();
}
@@ -467,7 +467,7 @@ class spell_ex : public SpellScriptLoader
class spell_ex_AuraScript : public AuraScript
{
PrepareAuraScript(spell_ex)
- //bool Validate(SpellInfo const* spellEntry){return true;}
+ //bool Validate(SpellInfo const* spellEntry){return true;} OVERRIDE
//bool Load(){return true;}
//void Unload(){}
@@ -478,12 +478,12 @@ class spell_ex : public SpellScriptLoader
//void spell_ex_SpellScript::Function(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated) //DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
//void spell_ex_SpellScript::Function(AuraEffect const* aurEff, bool& isPeriodic, int32& amplitude) //OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
//void spell_ex_SpellScript::Function(AuraEffect const* aurEff, SpellModifier*& spellMod) //OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
- void Register()
+ void Register() OVERRIDE
{
}
};
- AuraScript* GetAuraScript() const
+ AuraScript* GetAuraScript() const OVERRIDE
{
return new spell_ex_AuraScript();
}