diff options
| author | Nay <dnpd.dd@gmail.com> | 2012-01-07 17:13:42 +0000 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2012-01-07 17:13:42 +0000 |
| commit | 9c26ce8da559e1d7cd83011885f84f83360819fc (patch) | |
| tree | 3eb0164d9f93ccecf6ca737a902489a679b36b5b /src/server/scripts/Examples | |
| parent | ccf8b3889b8a67c18d5c5c79ce3c0cd32d7647f6 (diff) | |
| parent | a79ea3dcdfc865896bd120edc864105685fc43f4 (diff) | |
Merge branch 'master' into 4.x
Conflicts:
src/server/game/Achievements/AchievementMgr.cpp
src/server/game/Achievements/AchievementMgr.h
src/server/game/Entities/Corpse/Corpse.cpp
src/server/game/Entities/Unit/Unit.cpp
src/server/game/Quests/QuestDef.cpp
src/server/shared/Database/Implementation/CharacterDatabase.cpp
src/server/shared/Database/Implementation/CharacterDatabase.h
Diffstat (limited to 'src/server/scripts/Examples')
6 files changed, 43 insertions, 7 deletions
diff --git a/src/server/scripts/Examples/example_commandscript.cpp b/src/server/scripts/Examples/example_commandscript.cpp index 8513fbf8cf2..6b7a3d8def7 100644 --- a/src/server/scripts/Examples/example_commandscript.cpp +++ b/src/server/scripts/Examples/example_commandscript.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp index 1a030728218..f1b336f07f9 100644 --- a/src/server/scripts/Examples/example_creature.cpp +++ b/src/server/scripts/Examples/example_creature.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp index dfac4321a23..cae09266b49 100644 --- a/src/server/scripts/Examples/example_escort.cpp +++ b/src/server/scripts/Examples/example_escort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp index 13680a8ea9c..c288123f117 100644 --- a/src/server/scripts/Examples/example_gossip_codebox.cpp +++ b/src/server/scripts/Examples/example_gossip_codebox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/scripts/Examples/example_misc.cpp b/src/server/scripts/Examples/example_misc.cpp index 8619d03df30..d83a00ed82f 100644 --- a/src/server/scripts/Examples/example_misc.cpp +++ b/src/server/scripts/Examples/example_misc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 372abc45268..b1a8f17d16a 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> * * 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 @@ -76,6 +76,38 @@ class spell_ex_5581 : public SpellScriptLoader delete localVariable2; } + void HandleBeforeCast() + { + // this hook is executed before anything about casting the spell is done + // after this hook is executed all the machinery starts + sLog->outString("Caster just finished preparing the spell (cast bar has expired)"); + } + + void HandleOnCast() + { + // cast is validated and spell targets are selected at this moment + // this is a last place when the spell can be safely interrupted + sLog->outString("Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects"); + } + + void HandleAfterCast() + { + sLog->outString("All immediate actions for the spell are finished now"); + // this is a safe for triggering additional effects for a spell without interfering + // with visuals or with other effects of the spell + //GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); + } + + SpellCastResult CheckRequirement() + { + // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) + // in this case we're disallowing to select non-player as a target of the spell + //if (!GetTargetUnit() || GetTargetUnit()->ToPlayer()) + //return SPELL_FAILED_BAD_TARGETS; + return SPELL_CAST_OK; + } + + void HandleDummyLaunch(SpellEffIndex /*effIndex*/) { sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id); @@ -127,7 +159,11 @@ class spell_ex_5581 : public SpellScriptLoader // register functions used in spell script - names of these functions do not matter void Register() { - // we're registering our function here + // we're registering our functions here + BeforeCast += SpellCastFn(spell_ex_5581SpellScript::HandleBeforeCast); + OnCast += SpellCastFn(spell_ex_5581SpellScript::HandleOnCast); + AfterCast += SpellCastFn(spell_ex_5581SpellScript::HandleAfterCast); + OnCheckCast += SpellCheckCastFn(spell_ex_5581SpellScript::CheckRequirement); // function HandleDummy will be called when spell is launched, independant from targets selected for spell, just before default effect 0 launch handler OnEffectLaunch += SpellEffectFn(spell_ex_5581SpellScript::HandleDummyLaunch, EFFECT_0, SPELL_EFFECT_DUMMY); // function HandleDummy will be called when spell is launched at target, just before default effect 0 launch at target handler |
