2010-10-07 15:35:36 +02:00
/*
2012-01-01 00:32:13 +01:00
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
2010-10-07 15:35:36 +02:00
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* 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, see <http://www.gnu.org/licenses/>.
2010-08-07 16:38:22 +02:00
*/
2009-10-17 15:51:44 -07:00
2010-06-07 16:21:52 -06:00
#include "ScriptPCH.h"
2011-07-27 14:52:59 +02:00
#include "ScriptMgr.h"
2010-06-08 17:01:03 -06:00
#include "Config.h"
#include "DatabaseEnv.h"
2009-03-27 09:58:20 -06:00
#include "DBCStores.h"
2008-10-11 14:16:25 -05:00
#include "ObjectMgr.h"
2010-09-14 16:37:40 +02:00
#include "OutdoorPvPMgr.h"
2010-01-19 11:36:05 +01:00
#include "ScriptLoader.h"
#include "ScriptSystem.h"
2010-09-14 16:37:40 +02:00
#include "Transport.h"
2011-08-03 12:28:42 +02:00
#include "Vehicle.h"
2010-09-14 16:37:40 +02:00
2011-07-27 14:52:59 +02:00
// This is the global static registry of scripts.
template < class TScript >
class ScriptRegistry
{
2011-08-14 13:45:42 +02:00
public :
2011-07-27 14:52:59 +02:00
2011-08-14 13:45:42 +02:00
typedef std :: map < uint32 , TScript *> ScriptMap ;
typedef typename ScriptMap :: iterator ScriptMapIterator ;
2011-07-27 14:52:59 +02:00
2011-08-14 13:45:42 +02:00
// The actual list of scripts. This will be accessed concurrently, so it must not be modified
// after server startup.
static ScriptMap ScriptPointerList ;
2011-07-27 14:52:59 +02:00
2011-08-14 13:45:42 +02:00
static void AddScript ( TScript * const script )
2011-07-27 14:52:59 +02:00
{
2011-08-14 13:45:42 +02:00
ASSERT ( script );
// See if the script is using the same memory as another script. If this happens, it means that
// someone forgot to allocate new memory for a script.
for ( ScriptMapIterator it = ScriptPointerList . begin (); it != ScriptPointerList . end (); ++ it )
2011-07-27 14:52:59 +02:00
{
2011-08-14 13:45:42 +02:00
if ( it -> second == script )
{
sLog -> outError ( "Script '%s' has same memory pointer as '%s'." ,
script -> GetName (). c_str (), it -> second -> GetName (). c_str ());
2011-07-27 14:52:59 +02:00
2011-08-14 13:45:42 +02:00
return ;
}
2011-07-27 14:52:59 +02:00
}
2011-08-14 13:45:42 +02:00
if ( script -> IsDatabaseBound ())
2011-07-27 14:52:59 +02:00
{
2011-08-14 13:45:42 +02:00
// Get an ID for the script. An ID only exists if it's a script that is assigned in the database
// through a script name (or similar).
uint32 id = sObjectMgr -> GetScriptId ( script -> GetName (). c_str ());
if ( id )
2011-07-27 14:52:59 +02:00
{
2011-08-14 13:45:42 +02:00
// Try to find an existing script.
bool existing = false ;
for ( ScriptMapIterator it = ScriptPointerList . begin (); it != ScriptPointerList . end (); ++ it )
2011-07-27 14:52:59 +02:00
{
2011-08-14 13:45:42 +02:00
// If the script names match...
if ( it -> second -> GetName () == script -> GetName ())
{
// ... It exists.
existing = true ;
break ;
}
2011-07-27 14:52:59 +02:00
}
2011-08-14 13:45:42 +02:00
// If the script isn't assigned -> assign it!
if ( ! existing )
{
ScriptPointerList [ id ] = script ;
sScriptMgr -> IncrementScriptCount ();
}
else
{
// If the script is already assigned -> delete it!
sLog -> outError ( "Script '%s' already assigned with the same script name, so the script can't work." ,
script -> GetName (). c_str ());
ASSERT ( false ); // Error that should be fixed ASAP.
}
2011-07-27 14:52:59 +02:00
}
else
{
2011-08-14 13:45:42 +02:00
// The script uses a script name from database, but isn't assigned to anything.
if ( script -> GetName (). find ( "example" ) == std :: string :: npos && script -> GetName (). find ( "Smart" ) == std :: string :: npos )
sLog -> outErrorDb ( "Script named '%s' does not have a script name assigned in database." ,
script -> GetName (). c_str ());
2011-07-27 14:52:59 +02:00
}
}
else
{
2011-08-14 13:45:42 +02:00
// We're dealing with a code-only script; just add it.
ScriptPointerList [ _scriptIdCounter ++ ] = script ;
sScriptMgr -> IncrementScriptCount ();
2011-07-27 14:52:59 +02:00
}
}
2011-08-14 13:45:42 +02:00
// Gets a script by its ID (assigned by ObjectMgr).
static TScript * GetScriptById ( uint32 id )
2011-07-27 14:52:59 +02:00
{
2011-08-14 13:45:42 +02:00
ScriptMapIterator it = ScriptPointerList . find ( id );
if ( it != ScriptPointerList . end ())
return it -> second ;
return NULL ;
2011-07-27 14:52:59 +02:00
}
2011-08-14 13:45:42 +02:00
private :
2011-07-27 14:52:59 +02:00
2011-08-14 13:45:42 +02:00
// Counter used for code-only scripts.
static uint32 _scriptIdCounter ;
2011-07-27 14:52:59 +02:00
};
2010-08-06 19:23:43 +02:00
// Utility macros to refer to the script registry.
#define SCR_REG_MAP(T) ScriptRegistry<T>::ScriptMap
2010-08-07 15:26:24 +02:00
#define SCR_REG_ITR(T) ScriptRegistry<T>::ScriptMapIterator
2010-08-06 19:23:43 +02:00
#define SCR_REG_LST(T) ScriptRegistry<T>::ScriptPointerList
// Utility macros for looping over scripts.
2011-04-29 20:47:02 +02:00
#define FOR_SCRIPTS(T, C, E) \
2010-08-06 19:23:43 +02:00
if (SCR_REG_LST(T).empty()) \
return; \
2010-08-07 15:26:24 +02:00
for (SCR_REG_ITR(T) C = SCR_REG_LST(T).begin(); \
2010-08-06 19:23:43 +02:00
C != SCR_REG_LST(T).end(); ++C)
2011-04-29 20:47:02 +02:00
#define FOR_SCRIPTS_RET(T, C, E, R) \
2010-08-06 19:23:43 +02:00
if (SCR_REG_LST(T).empty()) \
return R; \
2010-08-07 15:26:24 +02:00
for (SCR_REG_ITR(T) C = SCR_REG_LST(T).begin(); \
2010-08-06 19:23:43 +02:00
C != SCR_REG_LST(T).end(); ++C)
#define FOREACH_SCRIPT(T) \
FOR_SCRIPTS(T, itr, end) \
itr->second
// Utility macros for finding specific scripts.
2011-04-29 20:47:02 +02:00
#define GET_SCRIPT(T, I, V) \
2010-08-06 19:23:43 +02:00
T* V = ScriptRegistry<T>::GetScriptById(I); \
if (!V) \
return;
2011-04-29 20:47:02 +02:00
#define GET_SCRIPT_RET(T, I, V, R) \
2010-08-06 19:23:43 +02:00
T* V = ScriptRegistry<T>::GetScriptById(I); \
if (!V) \
return R;
2009-10-17 15:51:44 -07:00
2011-10-07 19:45:43 -05:00
void DoScriptText ( int32 iTextEntry , WorldObject * pSource , Unit * target )
2008-10-11 14:16:25 -05:00
{
if ( ! pSource )
{
2010-12-23 23:25:44 +01:00
sLog -> outError ( "TSCR: DoScriptText entry %i, invalid Source pointer." , iTextEntry );
2008-10-11 14:16:25 -05:00
return ;
}
2009-10-17 15:51:44 -07:00
2009-08-16 19:38:18 +02:00
if ( iTextEntry >= 0 )
2008-10-11 14:16:25 -05:00
{
2010-12-23 23:25:44 +01:00
sLog -> outError ( "TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative." , pSource -> GetEntry (), pSource -> GetTypeId (), pSource -> GetGUIDLow (), iTextEntry );
2008-10-11 14:16:25 -05:00
return ;
}
2009-10-17 15:51:44 -07:00
2010-12-22 21:25:23 +01:00
const StringTextData * pData = sScriptSystemMgr -> GetTextData ( iTextEntry );
2009-10-17 15:51:44 -07:00
2009-08-16 19:38:18 +02:00
if ( ! pData )
2008-10-11 14:16:25 -05:00
{
2010-12-23 23:25:44 +01:00
sLog -> outError ( "TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i." , pSource -> GetEntry (), pSource -> GetTypeId (), pSource -> GetGUIDLow (), iTextEntry );
2008-10-11 14:16:25 -05:00
return ;
}
2009-10-17 15:51:44 -07:00
2011-02-20 20:16:34 +01:00
sLog -> outDebug ( LOG_FILTER_TSCR , "TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u" , iTextEntry , pData -> uiSoundId , pData -> uiType , pData -> uiLanguage , pData -> uiEmote );
2009-10-17 15:51:44 -07:00
2010-04-07 19:14:10 +02:00
if ( pData -> uiSoundId )
2008-10-11 14:16:25 -05:00
{
2012-03-10 20:53:26 +01:00
if ( sSoundEntriesStore . LookupEntry ( pData -> uiSoundId ))
2009-08-16 19:38:18 +02:00
pSource -> SendPlaySound ( pData -> uiSoundId , false );
2008-10-11 14:16:25 -05:00
else
2010-12-23 23:25:44 +01:00
sLog -> outError ( "TSCR: DoScriptText entry %i tried to process invalid sound id %u." , iTextEntry , pData -> uiSoundId );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-04-07 19:14:10 +02:00
if ( pData -> uiEmote )
2009-02-09 08:16:34 -05:00
{
if ( pSource -> GetTypeId () == TYPEID_UNIT || pSource -> GetTypeId () == TYPEID_PLAYER )
2009-08-16 19:38:18 +02:00
(( Unit * ) pSource ) -> HandleEmoteCommand ( pData -> uiEmote );
2009-02-09 08:16:34 -05:00
else
2010-12-23 23:25:44 +01:00
sLog -> outError ( "TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u)." , iTextEntry , pSource -> GetTypeId ());
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
switch ( pData -> uiType )
2008-10-11 14:16:25 -05:00
{
case CHAT_TYPE_SAY :
2011-10-07 19:45:43 -05:00
pSource -> MonsterSay ( iTextEntry , pData -> uiLanguage , target ? target -> GetGUID () : 0 );
2008-10-11 14:16:25 -05:00
break ;
case CHAT_TYPE_YELL :
2011-10-07 19:45:43 -05:00
pSource -> MonsterYell ( iTextEntry , pData -> uiLanguage , target ? target -> GetGUID () : 0 );
2008-10-11 14:16:25 -05:00
break ;
case CHAT_TYPE_TEXT_EMOTE :
2011-10-07 19:45:43 -05:00
pSource -> MonsterTextEmote ( iTextEntry , target ? target -> GetGUID () : 0 );
2008-10-11 14:16:25 -05:00
break ;
case CHAT_TYPE_BOSS_EMOTE :
2011-10-07 19:45:43 -05:00
pSource -> MonsterTextEmote ( iTextEntry , target ? target -> GetGUID () : 0 , true );
2008-10-11 14:16:25 -05:00
break ;
case CHAT_TYPE_WHISPER :
2010-08-06 19:23:43 +02:00
{
2011-10-07 19:45:43 -05:00
if ( target && target -> GetTypeId () == TYPEID_PLAYER )
pSource -> MonsterWhisper ( iTextEntry , target -> GetGUID ());
2010-08-06 19:23:43 +02:00
else
2010-12-23 23:25:44 +01:00
sLog -> outError ( "TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER)." , iTextEntry );
2010-08-06 19:23:43 +02:00
2009-10-27 22:09:45 -07:00
break ;
2010-08-06 19:23:43 +02:00
}
2008-10-11 14:16:25 -05:00
case CHAT_TYPE_BOSS_WHISPER :
2010-08-06 19:23:43 +02:00
{
2011-10-07 19:45:43 -05:00
if ( target && target -> GetTypeId () == TYPEID_PLAYER )
pSource -> MonsterWhisper ( iTextEntry , target -> GetGUID (), true );
2010-08-06 19:23:43 +02:00
else
2010-12-23 23:25:44 +01:00
sLog -> outError ( "TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER)." , iTextEntry );
2010-08-06 19:23:43 +02:00
2009-10-27 22:09:45 -07:00
break ;
2010-08-06 19:23:43 +02:00
}
2009-04-03 16:54:20 -06:00
case CHAT_TYPE_ZONE_YELL :
2011-10-07 19:45:43 -05:00
pSource -> MonsterYellToZone ( iTextEntry , pData -> uiLanguage , target ? target -> GetGUID () : 0 );
2009-04-03 16:54:20 -06:00
break ;
2008-10-11 14:16:25 -05:00
}
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
ScriptMgr :: ScriptMgr ()
2011-04-13 12:07:20 +06:00
: _scriptCount ( 0 ), _scheduledScripts ( 0 )
2010-08-06 19:23:43 +02:00
{
}
ScriptMgr ::~ ScriptMgr ()
2011-03-14 09:44:02 +01:00
{
}
void ScriptMgr :: Initialize ()
{
uint32 oldMSTime = getMSTime ();
LoadDatabase ();
sLog -> outString ( "Loading C++ scripts" );
FillSpellSummary ();
AddScripts ();
sLog -> outString ( ">> Loaded %u C++ scripts in %u ms" , GetScriptCount (), GetMSTimeDiffToNow ( oldMSTime ));
sLog -> outString ();
}
void ScriptMgr :: Unload ()
2010-08-06 19:23:43 +02:00
{
#define SCR_CLEAR(T) \
2012-03-24 17:09:42 +01:00
for (SCR_REG_ITR(T) itr = SCR_REG_LST(T).begin(); itr != SCR_REG_LST(T).end(); ++itr) \
2010-08-06 19:23:43 +02:00
delete itr->second; \
SCR_REG_LST(T).clear();
// Clear scripts for every script type.
2010-08-24 00:10:49 +02:00
SCR_CLEAR ( SpellScriptLoader );
2010-08-06 19:23:43 +02:00
SCR_CLEAR ( ServerScript );
SCR_CLEAR ( WorldScript );
SCR_CLEAR ( FormulaScript );
SCR_CLEAR ( WorldMapScript );
SCR_CLEAR ( InstanceMapScript );
SCR_CLEAR ( BattlegroundMapScript );
SCR_CLEAR ( ItemScript );
SCR_CLEAR ( CreatureScript );
SCR_CLEAR ( GameObjectScript );
SCR_CLEAR ( AreaTriggerScript );
SCR_CLEAR ( BattlegroundScript );
SCR_CLEAR ( OutdoorPvPScript );
SCR_CLEAR ( CommandScript );
SCR_CLEAR ( WeatherScript );
SCR_CLEAR ( AuctionHouseScript );
SCR_CLEAR ( ConditionScript );
SCR_CLEAR ( VehicleScript );
SCR_CLEAR ( DynamicObjectScript );
SCR_CLEAR ( TransportScript );
2010-08-07 17:58:45 +02:00
SCR_CLEAR ( AchievementCriteriaScript );
2010-08-14 12:44:54 -07:00
SCR_CLEAR ( PlayerScript );
SCR_CLEAR ( GuildScript );
2010-09-14 16:37:54 +02:00
SCR_CLEAR ( GroupScript );
2010-08-06 19:23:43 +02:00
#undef SCR_CLEAR
}
void ScriptMgr :: LoadDatabase ()
{
2010-12-22 21:25:23 +01:00
sScriptSystemMgr -> LoadScriptTexts ();
sScriptSystemMgr -> LoadScriptTextsCustom ();
sScriptSystemMgr -> LoadScriptWaypoints ();
2010-08-06 19:23:43 +02:00
}
struct TSpellSummary
{
uint8 Targets ; // set of enum SelectTarget
uint8 Effects ; // set of enum SelectEffect
} * SpellSummary ;
void ScriptMgr :: FillSpellSummary ()
{
2011-07-26 23:09:28 +02:00
SpellSummary = new TSpellSummary [ sSpellMgr -> GetSpellInfoStoreSize ()];
2010-08-06 19:23:43 +02:00
2011-07-26 23:09:28 +02:00
SpellInfo const * pTempSpell ;
2010-08-06 19:23:43 +02:00
2011-07-26 23:09:28 +02:00
for ( uint32 i = 0 ; i < sSpellMgr -> GetSpellInfoStoreSize (); ++ i )
2010-05-14 20:07:45 +02:00
{
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Effects = 0 ;
SpellSummary [ i ]. Targets = 0 ;
2011-07-26 23:09:28 +02:00
pTempSpell = sSpellMgr -> GetSpellInfo ( i );
2011-08-14 13:45:42 +02:00
// This spell doesn't exist.
2010-08-06 19:23:43 +02:00
if ( ! pTempSpell )
continue ;
2010-09-28 08:21:51 +03:00
for ( uint32 j = 0 ; j < MAX_SPELL_EFFECTS ; ++ j )
2010-05-14 20:07:45 +02:00
{
2011-08-14 13:45:42 +02:00
// Spell targets self.
2011-07-27 12:35:59 +02:00
if ( pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_CASTER )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Targets |= 1 << ( SELECT_TARGET_SELF - 1 );
2011-08-14 13:45:42 +02:00
// Spell targets a single enemy.
2011-07-27 12:35:59 +02:00
if ( pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_TARGET_ENEMY ||
2011-08-16 19:44:18 +02:00
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_DEST_TARGET_ENEMY )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Targets |= 1 << ( SELECT_TARGET_SINGLE_ENEMY - 1 );
2011-08-14 13:45:42 +02:00
// Spell targets AoE at enemy.
2011-08-16 19:44:18 +02:00
if ( pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_SRC_AREA_ENEMY ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_DEST_AREA_ENEMY ||
2011-07-27 12:35:59 +02:00
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_SRC_CASTER ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_DEST_DYNOBJ_ENEMY )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Targets |= 1 << ( SELECT_TARGET_AOE_ENEMY - 1 );
2011-08-14 13:45:42 +02:00
// Spell targets an enemy.
2011-07-27 12:35:59 +02:00
if ( pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_TARGET_ENEMY ||
2011-08-16 19:44:18 +02:00
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_DEST_TARGET_ENEMY ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_SRC_AREA_ENEMY ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_DEST_AREA_ENEMY ||
2011-07-27 12:35:59 +02:00
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_SRC_CASTER ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_DEST_DYNOBJ_ENEMY )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Targets |= 1 << ( SELECT_TARGET_ANY_ENEMY - 1 );
2011-08-14 13:45:42 +02:00
// Spell targets a single friend (or self).
2011-07-27 12:35:59 +02:00
if ( pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_CASTER ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_TARGET_ALLY ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_TARGET_PARTY )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Targets |= 1 << ( SELECT_TARGET_SINGLE_FRIEND - 1 );
2011-08-14 13:45:42 +02:00
// Spell targets AoE friends.
2011-08-16 19:44:18 +02:00
if ( pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_CASTER_AREA_PARTY ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_LASTTARGET_AREA_PARTY ||
2011-07-27 12:35:59 +02:00
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_SRC_CASTER )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Targets |= 1 << ( SELECT_TARGET_AOE_FRIEND - 1 );
2011-08-14 13:45:42 +02:00
// Spell targets any friend (or self).
2011-07-27 12:35:59 +02:00
if ( pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_CASTER ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_TARGET_ALLY ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_TARGET_PARTY ||
2011-08-16 19:44:18 +02:00
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_CASTER_AREA_PARTY ||
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_UNIT_LASTTARGET_AREA_PARTY ||
2011-07-27 12:35:59 +02:00
pTempSpell -> Effects [ j ]. TargetA . GetTarget () == TARGET_SRC_CASTER )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Targets |= 1 << ( SELECT_TARGET_ANY_FRIEND - 1 );
2011-08-14 13:45:42 +02:00
// Make sure that this spell includes a damage effect.
2011-07-26 23:09:28 +02:00
if ( pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_SCHOOL_DAMAGE ||
pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_INSTAKILL ||
pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_HEALTH_LEECH )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Effects |= 1 << ( SELECT_EFFECT_DAMAGE - 1 );
2011-08-14 13:45:42 +02:00
// Make sure that this spell includes a healing effect (or an apply aura with a periodic heal).
2011-07-26 23:09:28 +02:00
if ( pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_HEAL ||
pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_HEAL_MAX_HEALTH ||
pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_HEAL_MECHANICAL ||
( pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_APPLY_AURA && pTempSpell -> Effects [ j ]. ApplyAuraName == 8 ))
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Effects |= 1 << ( SELECT_EFFECT_HEALING - 1 );
2011-08-14 13:45:42 +02:00
// Make sure that this spell applies an aura.
2011-07-26 23:09:28 +02:00
if ( pTempSpell -> Effects [ j ]. Effect == SPELL_EFFECT_APPLY_AURA )
2010-08-06 19:23:43 +02:00
SpellSummary [ i ]. Effects |= 1 << ( SELECT_EFFECT_AURA - 1 );
2010-05-14 20:07:45 +02:00
}
}
2010-08-06 19:23:43 +02:00
}
2010-05-14 20:07:45 +02:00
2011-08-14 13:45:42 +02:00
void ScriptMgr :: CreateSpellScripts ( uint32 spellId , std :: list < SpellScript *>& scriptVector )
2010-08-06 19:23:43 +02:00
{
2011-08-14 13:45:42 +02:00
SpellScriptsBounds bounds = sObjectMgr -> GetSpellScriptsBounds ( spellId );
2010-08-06 19:23:43 +02:00
2012-02-12 20:10:09 -05:00
for ( SpellScriptsContainer :: iterator itr = bounds . first ; itr != bounds . second ; ++ itr )
2008-10-11 14:16:25 -05:00
{
2010-08-24 00:10:49 +02:00
SpellScriptLoader * tmpscript = ScriptRegistry < SpellScriptLoader >:: GetScriptById ( itr -> second );
2010-08-06 19:23:43 +02:00
if ( ! tmpscript )
continue ;
2010-05-13 14:15:11 +02:00
2010-08-06 19:23:43 +02:00
SpellScript * script = tmpscript -> GetSpellScript ();
if ( ! script )
continue ;
2011-08-14 13:45:42 +02:00
script -> _Init ( & tmpscript -> GetName (), spellId );
2010-10-04 17:44:49 +02:00
2011-08-14 13:45:42 +02:00
scriptVector . push_back ( script );
2010-08-06 19:23:43 +02:00
}
}
2011-08-14 13:45:42 +02:00
void ScriptMgr :: CreateAuraScripts ( uint32 spellId , std :: list < AuraScript *>& scriptVector )
2010-08-06 19:23:43 +02:00
{
2011-08-14 13:45:42 +02:00
SpellScriptsBounds bounds = sObjectMgr -> GetSpellScriptsBounds ( spellId );
2010-08-06 19:23:43 +02:00
2012-02-12 20:10:09 -05:00
for ( SpellScriptsContainer :: iterator itr = bounds . first ; itr != bounds . second ; ++ itr )
2010-08-06 19:23:43 +02:00
{
2010-08-24 00:10:49 +02:00
SpellScriptLoader * tmpscript = ScriptRegistry < SpellScriptLoader >:: GetScriptById ( itr -> second );
2010-08-06 19:23:43 +02:00
if ( ! tmpscript )
continue ;
2010-08-24 00:10:49 +02:00
AuraScript * script = tmpscript -> GetAuraScript ();
2010-08-06 19:23:43 +02:00
if ( ! script )
continue ;
2011-08-14 13:45:42 +02:00
script -> _Init ( & tmpscript -> GetName (), spellId );
2010-10-04 17:44:49 +02:00
2011-08-14 13:45:42 +02:00
scriptVector . push_back ( script );
2010-08-24 00:10:49 +02:00
}
}
2012-02-12 20:10:09 -05:00
void ScriptMgr :: CreateSpellScriptLoaders ( uint32 spellId , std :: vector < std :: pair < SpellScriptLoader * , SpellScriptsContainer :: iterator > >& scriptVector )
2010-08-24 00:10:49 +02:00
{
2011-08-14 13:45:42 +02:00
SpellScriptsBounds bounds = sObjectMgr -> GetSpellScriptsBounds ( spellId );
scriptVector . reserve ( std :: distance ( bounds . first , bounds . second ));
2010-08-24 00:10:49 +02:00
2012-02-12 20:10:09 -05:00
for ( SpellScriptsContainer :: iterator itr = bounds . first ; itr != bounds . second ; ++ itr )
2010-08-24 00:10:49 +02:00
{
SpellScriptLoader * tmpscript = ScriptRegistry < SpellScriptLoader >:: GetScriptById ( itr -> second );
if ( ! tmpscript )
continue ;
2011-08-14 13:45:42 +02:00
scriptVector . push_back ( std :: make_pair ( tmpscript , itr ));
2009-02-20 14:14:16 +01:00
}
2010-08-06 19:23:43 +02:00
}
void ScriptMgr :: OnNetworkStart ()
{
FOREACH_SCRIPT ( ServerScript ) -> OnNetworkStart ();
}
void ScriptMgr :: OnNetworkStop ()
{
FOREACH_SCRIPT ( ServerScript ) -> OnNetworkStop ();
}
void ScriptMgr :: OnSocketOpen ( WorldSocket * socket )
{
ASSERT ( socket );
FOREACH_SCRIPT ( ServerScript ) -> OnSocketOpen ( socket );
}
void ScriptMgr :: OnSocketClose ( WorldSocket * socket , bool wasNew )
{
ASSERT ( socket );
FOREACH_SCRIPT ( ServerScript ) -> OnSocketClose ( socket , wasNew );
}
2010-08-07 17:58:45 +02:00
void ScriptMgr :: OnPacketReceive ( WorldSocket * socket , WorldPacket packet )
2010-08-06 19:23:43 +02:00
{
ASSERT ( socket );
FOREACH_SCRIPT ( ServerScript ) -> OnPacketReceive ( socket , packet );
}
2010-08-07 17:58:45 +02:00
void ScriptMgr :: OnPacketSend ( WorldSocket * socket , WorldPacket packet )
2010-08-06 19:23:43 +02:00
{
ASSERT ( socket );
FOREACH_SCRIPT ( ServerScript ) -> OnPacketSend ( socket , packet );
}
2010-08-07 17:58:45 +02:00
void ScriptMgr :: OnUnknownPacketReceive ( WorldSocket * socket , WorldPacket packet )
2010-08-06 19:23:43 +02:00
{
ASSERT ( socket );
FOREACH_SCRIPT ( ServerScript ) -> OnUnknownPacketReceive ( socket , packet );
}
void ScriptMgr :: OnOpenStateChange ( bool open )
{
FOREACH_SCRIPT ( WorldScript ) -> OnOpenStateChange ( open );
}
void ScriptMgr :: OnConfigLoad ( bool reload )
{
FOREACH_SCRIPT ( WorldScript ) -> OnConfigLoad ( reload );
}
void ScriptMgr :: OnMotdChange ( std :: string & newMotd )
{
FOREACH_SCRIPT ( WorldScript ) -> OnMotdChange ( newMotd );
}
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnShutdownInitiate ( ShutdownExitCode code , ShutdownMask mask )
2010-08-06 19:23:43 +02:00
{
2010-08-07 13:07:18 +02:00
FOREACH_SCRIPT ( WorldScript ) -> OnShutdownInitiate ( code , mask );
2010-08-06 19:23:43 +02:00
}
void ScriptMgr :: OnShutdownCancel ()
{
FOREACH_SCRIPT ( WorldScript ) -> OnShutdownCancel ();
}
void ScriptMgr :: OnWorldUpdate ( uint32 diff )
{
2011-03-26 09:19:54 +01:00
FOREACH_SCRIPT ( WorldScript ) -> OnUpdate ( diff );
2010-08-06 19:23:43 +02:00
}
2010-11-29 15:50:38 +06:00
void ScriptMgr :: OnHonorCalculation ( float & honor , uint8 level , float multiplier )
2010-08-06 19:23:43 +02:00
{
2010-11-29 15:50:38 +06:00
FOREACH_SCRIPT ( FormulaScript ) -> OnHonorCalculation ( honor , level , multiplier );
2010-08-06 19:23:43 +02:00
}
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnGrayLevelCalculation ( uint8 & grayLevel , uint8 playerLevel )
2010-08-06 19:23:43 +02:00
{
2010-08-07 13:07:18 +02:00
FOREACH_SCRIPT ( FormulaScript ) -> OnGrayLevelCalculation ( grayLevel , playerLevel );
2010-08-06 19:23:43 +02:00
}
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnColorCodeCalculation ( XPColorChar & color , uint8 playerLevel , uint8 mobLevel )
2010-08-06 19:23:43 +02:00
{
2010-08-07 13:07:18 +02:00
FOREACH_SCRIPT ( FormulaScript ) -> OnColorCodeCalculation ( color , playerLevel , mobLevel );
2010-08-06 19:23:43 +02:00
}
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnZeroDifferenceCalculation ( uint8 & diff , uint8 playerLevel )
2010-08-06 19:23:43 +02:00
{
2010-08-07 13:07:18 +02:00
FOREACH_SCRIPT ( FormulaScript ) -> OnZeroDifferenceCalculation ( diff , playerLevel );
2010-08-06 19:23:43 +02:00
}
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnBaseGainCalculation ( uint32 & gain , uint8 playerLevel , uint8 mobLevel , ContentLevels content )
2010-08-06 19:23:43 +02:00
{
2010-08-07 13:07:18 +02:00
FOREACH_SCRIPT ( FormulaScript ) -> OnBaseGainCalculation ( gain , playerLevel , mobLevel , content );
2010-08-06 19:23:43 +02:00
}
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnGainCalculation ( uint32 & gain , Player * player , Unit * unit )
2010-08-06 19:23:43 +02:00
{
ASSERT ( player );
ASSERT ( unit );
2010-08-07 13:07:18 +02:00
FOREACH_SCRIPT ( FormulaScript ) -> OnGainCalculation ( gain , player , unit );
2010-08-06 19:23:43 +02:00
}
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnGroupRateCalculation ( float & rate , uint32 count , bool isRaid )
2010-08-06 19:23:43 +02:00
{
2010-08-07 13:07:18 +02:00
FOREACH_SCRIPT ( FormulaScript ) -> OnGroupRateCalculation ( rate , count , isRaid );
2010-08-06 19:23:43 +02:00
}
2011-04-29 20:47:02 +02:00
#define SCR_MAP_BGN(M, V, I, E, C, T) \
2010-08-06 19:23:43 +02:00
if (V->GetEntry()->T()) \
{ \
FOR_SCRIPTS(M, I, E) \
{ \
MapEntry const* C = I->second->GetEntry(); \
if (!C) \
continue; \
if (entry->MapID == V->GetId()) \
{
#define SCR_MAP_END \
2010-08-09 11:07:23 +02:00
return; \
2010-08-06 19:23:43 +02:00
} \
} \
2009-02-20 14:14:16 +01:00
}
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnCreateMap ( Map * map )
{
ASSERT ( map );
2012-04-07 11:59:01 -05:00
SCR_MAP_BGN ( WorldMapScript , map , itr , end , entry , IsWorldMap );
2010-08-06 19:23:43 +02:00
itr -> second -> OnCreate ( map );
SCR_MAP_END ;
SCR_MAP_BGN ( InstanceMapScript , map , itr , end , entry , IsDungeon );
itr -> second -> OnCreate (( InstanceMap * ) map );
SCR_MAP_END ;
2010-08-08 04:37:24 +02:00
SCR_MAP_BGN ( BattlegroundMapScript , map , itr , end , entry , IsBattleground );
itr -> second -> OnCreate (( BattlegroundMap * ) map );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnDestroyMap ( Map * map )
2009-09-13 00:01:35 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( map );
2012-04-07 11:59:01 -05:00
SCR_MAP_BGN ( WorldMapScript , map , itr , end , entry , IsWorldMap );
2010-08-06 19:23:43 +02:00
itr -> second -> OnDestroy ( map );
SCR_MAP_END ;
SCR_MAP_BGN ( InstanceMapScript , map , itr , end , entry , IsDungeon );
itr -> second -> OnDestroy (( InstanceMap * ) map );
SCR_MAP_END ;
2010-08-08 04:37:24 +02:00
SCR_MAP_BGN ( BattlegroundMapScript , map , itr , end , entry , IsBattleground );
itr -> second -> OnDestroy (( BattlegroundMap * ) map );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2009-09-13 00:01:35 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnLoadGridMap ( Map * map , GridMap * gmap , uint32 gx , uint32 gy )
2009-09-13 00:01:35 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( map );
2010-08-07 17:58:45 +02:00
ASSERT ( gmap );
2010-08-06 19:23:43 +02:00
2012-04-07 11:59:01 -05:00
SCR_MAP_BGN ( WorldMapScript , map , itr , end , entry , IsWorldMap );
2010-08-07 13:07:18 +02:00
itr -> second -> OnLoadGridMap ( map , gmap , gx , gy );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
SCR_MAP_BGN ( InstanceMapScript , map , itr , end , entry , IsDungeon );
2010-08-07 13:07:18 +02:00
itr -> second -> OnLoadGridMap (( InstanceMap * ) map , gmap , gx , gy );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2010-08-08 04:37:24 +02:00
SCR_MAP_BGN ( BattlegroundMapScript , map , itr , end , entry , IsBattleground );
itr -> second -> OnLoadGridMap (( BattlegroundMap * ) map , gmap , gx , gy );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2009-09-13 00:01:35 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnUnloadGridMap ( Map * map , GridMap * gmap , uint32 gx , uint32 gy )
2009-09-13 00:01:35 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( map );
2010-08-07 17:58:45 +02:00
ASSERT ( gmap );
2010-08-06 19:23:43 +02:00
2012-04-07 11:59:01 -05:00
SCR_MAP_BGN ( WorldMapScript , map , itr , end , entry , IsWorldMap );
2010-08-07 13:07:18 +02:00
itr -> second -> OnUnloadGridMap ( map , gmap , gx , gy );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
SCR_MAP_BGN ( InstanceMapScript , map , itr , end , entry , IsDungeon );
2010-08-07 13:07:18 +02:00
itr -> second -> OnUnloadGridMap (( InstanceMap * ) map , gmap , gx , gy );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2010-08-08 04:37:24 +02:00
SCR_MAP_BGN ( BattlegroundMapScript , map , itr , end , entry , IsBattleground );
itr -> second -> OnUnloadGridMap (( BattlegroundMap * ) map , gmap , gx , gy );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2009-09-13 00:01:35 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnPlayerEnterMap ( Map * map , Player * player )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( map );
ASSERT ( player );
2012-04-07 11:59:01 -05:00
SCR_MAP_BGN ( WorldMapScript , map , itr , end , entry , IsWorldMap );
2010-08-06 19:23:43 +02:00
itr -> second -> OnPlayerEnter ( map , player );
SCR_MAP_END ;
SCR_MAP_BGN ( InstanceMapScript , map , itr , end , entry , IsDungeon );
itr -> second -> OnPlayerEnter (( InstanceMap * ) map , player );
SCR_MAP_END ;
2010-08-08 04:37:24 +02:00
SCR_MAP_BGN ( BattlegroundMapScript , map , itr , end , entry , IsBattleground );
itr -> second -> OnPlayerEnter (( BattlegroundMap * ) map , player );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-07 13:07:18 +02:00
void ScriptMgr :: OnPlayerLeaveMap ( Map * map , Player * player )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( map );
ASSERT ( player );
2012-04-07 11:59:01 -05:00
SCR_MAP_BGN ( WorldMapScript , map , itr , end , entry , IsWorldMap );
2010-08-06 19:23:43 +02:00
itr -> second -> OnPlayerLeave ( map , player );
SCR_MAP_END ;
SCR_MAP_BGN ( InstanceMapScript , map , itr , end , entry , IsDungeon );
itr -> second -> OnPlayerLeave (( InstanceMap * ) map , player );
SCR_MAP_END ;
2010-08-08 04:37:24 +02:00
SCR_MAP_BGN ( BattlegroundMapScript , map , itr , end , entry , IsBattleground );
itr -> second -> OnPlayerLeave (( BattlegroundMap * ) map , player );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnMapUpdate ( Map * map , uint32 diff )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( map );
2012-04-07 11:59:01 -05:00
SCR_MAP_BGN ( WorldMapScript , map , itr , end , entry , IsWorldMap );
2010-08-06 19:23:43 +02:00
itr -> second -> OnUpdate ( map , diff );
SCR_MAP_END ;
SCR_MAP_BGN ( InstanceMapScript , map , itr , end , entry , IsDungeon );
itr -> second -> OnUpdate (( InstanceMap * ) map , diff );
SCR_MAP_END ;
2010-08-08 04:37:24 +02:00
SCR_MAP_BGN ( BattlegroundMapScript , map , itr , end , entry , IsBattleground );
itr -> second -> OnUpdate (( BattlegroundMap * ) map , diff );
2010-08-06 19:23:43 +02:00
SCR_MAP_END ;
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
#undef SCR_MAP_BGN
#undef SCR_MAP_END
2010-08-08 22:54:58 +06:00
InstanceScript * ScriptMgr :: CreateInstanceData ( InstanceMap * map )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( map );
GET_SCRIPT_RET ( InstanceMapScript , map -> GetScriptId (), tmpscript , NULL );
2010-08-08 22:54:58 +06:00
return tmpscript -> GetInstanceScript ( map );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnDummyEffect ( Unit * caster , uint32 spellId , SpellEffIndex effIndex , Item * target )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( caster );
ASSERT ( target );
2010-08-07 15:26:24 +02:00
GET_SCRIPT_RET ( ItemScript , target -> GetScriptId (), tmpscript , false );
2010-08-06 19:23:43 +02:00
return tmpscript -> OnDummyEffect ( caster , spellId , effIndex , target );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnQuestAccept ( Player * player , Item * item , Quest const * quest )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( item );
ASSERT ( quest );
2010-08-07 15:26:24 +02:00
GET_SCRIPT_RET ( ItemScript , item -> GetScriptId (), tmpscript , false );
2010-08-06 19:23:43 +02:00
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnQuestAccept ( player , item , quest );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnItemUse ( Player * player , Item * item , SpellCastTargets const & targets )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( item );
2010-08-07 15:26:24 +02:00
GET_SCRIPT_RET ( ItemScript , item -> GetScriptId (), tmpscript , false );
2010-08-06 19:23:43 +02:00
return tmpscript -> OnUse ( player , item , targets );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2011-04-28 22:42:33 +02:00
bool ScriptMgr :: OnItemExpire ( Player * player , ItemTemplate const * proto )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( proto );
GET_SCRIPT_RET ( ItemScript , proto -> ScriptId , tmpscript , false );
return tmpscript -> OnExpire ( player , proto );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnDummyEffect ( Unit * caster , uint32 spellId , SpellEffIndex effIndex , Creature * target )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( caster );
ASSERT ( target );
GET_SCRIPT_RET ( CreatureScript , target -> GetScriptId (), tmpscript , false );
return tmpscript -> OnDummyEffect ( caster , spellId , effIndex , target );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnGossipHello ( Player * player , Creature * creature )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( creature );
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnGossipHello ( player , creature );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnGossipSelect ( Player * player , Creature * creature , uint32 sender , uint32 action )
2009-09-23 20:19:21 -07:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( creature );
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , false );
return tmpscript -> OnGossipSelect ( player , creature , sender , action );
2009-09-23 20:19:21 -07:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnGossipSelectCode ( Player * player , Creature * creature , uint32 sender , uint32 action , const char * code )
2008-11-20 16:16:57 -06:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( creature );
ASSERT ( code );
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , false );
return tmpscript -> OnGossipSelectCode ( player , creature , sender , action , code );
2008-11-20 16:16:57 -06:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnQuestAccept ( Player * player , Creature * creature , Quest const * quest )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( creature );
ASSERT ( quest );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnQuestAccept ( player , creature , quest );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnQuestSelect ( Player * player , Creature * creature , Quest const * quest )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( creature );
ASSERT ( quest );
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnQuestSelect ( player , creature , quest );
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnQuestComplete ( Player * player , Creature * creature , Quest const * quest )
{
ASSERT ( player );
ASSERT ( creature );
ASSERT ( quest );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnQuestComplete ( player , creature , quest );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnQuestReward ( Player * player , Creature * creature , Quest const * quest , uint32 opt )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( creature );
ASSERT ( quest );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnQuestReward ( player , creature , quest , opt );
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
uint32 ScriptMgr :: GetDialogStatus ( Player * player , Creature * creature )
{
ASSERT ( player );
ASSERT ( creature );
// TODO: 100 is a funny magic number to have hanging around here...
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , 100 );
player -> PlayerTalkClass -> ClearMenus ();
2010-08-07 13:07:18 +02:00
return tmpscript -> GetDialogStatus ( player , creature );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
CreatureAI * ScriptMgr :: GetCreatureAI ( Creature * creature )
2009-03-30 16:57:17 +02:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( creature );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( CreatureScript , creature -> GetScriptId (), tmpscript , NULL );
2010-08-07 13:07:18 +02:00
return tmpscript -> GetAI ( creature );
2010-08-06 19:23:43 +02:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnCreatureUpdate ( Creature * creature , uint32 diff )
{
ASSERT ( creature );
GET_SCRIPT ( CreatureScript , creature -> GetScriptId (), tmpscript );
tmpscript -> OnUpdate ( creature , diff );
2009-03-30 16:57:17 +02:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnGossipHello ( Player * player , GameObject * go )
2009-03-30 16:57:17 +02:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( go );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( GameObjectScript , go -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnGossipHello ( player , go );
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnGossipSelect ( Player * player , GameObject * go , uint32 sender , uint32 action )
{
ASSERT ( player );
ASSERT ( go );
GET_SCRIPT_RET ( GameObjectScript , go -> GetScriptId (), tmpscript , false );
return tmpscript -> OnGossipSelect ( player , go , sender , action );
2009-03-30 16:57:17 +02:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnGossipSelectCode ( Player * player , GameObject * go , uint32 sender , uint32 action , const char * code )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( go );
ASSERT ( code );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( GameObjectScript , go -> GetScriptId (), tmpscript , false );
return tmpscript -> OnGossipSelectCode ( player , go , sender , action , code );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnQuestAccept ( Player * player , GameObject * go , Quest const * quest )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( go );
ASSERT ( quest );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( GameObjectScript , go -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnQuestAccept ( player , go , quest );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnQuestReward ( Player * player , GameObject * go , Quest const * quest , uint32 opt )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( go );
ASSERT ( quest );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( GameObjectScript , go -> GetScriptId (), tmpscript , false );
player -> PlayerTalkClass -> ClearMenus ();
return tmpscript -> OnQuestReward ( player , go , quest , opt );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
uint32 ScriptMgr :: GetDialogStatus ( Player * player , GameObject * go )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( go );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
// TODO: 100 is a funny magic number to have hanging around here...
GET_SCRIPT_RET ( GameObjectScript , go -> GetScriptId (), tmpscript , 100 );
player -> PlayerTalkClass -> ClearMenus ();
2010-08-07 13:07:18 +02:00
return tmpscript -> GetDialogStatus ( player , go );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2011-07-22 21:22:05 +02:00
void ScriptMgr :: OnGameObjectDestroyed ( GameObject * go , Player * player )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( go );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT ( GameObjectScript , go -> GetScriptId (), tmpscript );
2011-07-22 21:22:05 +02:00
tmpscript -> OnDestroyed ( go , player );
2011-04-09 19:28:36 +02:00
}
2011-07-22 21:22:05 +02:00
void ScriptMgr :: OnGameObjectDamaged ( GameObject * go , Player * player )
2011-04-09 19:28:36 +02:00
{
ASSERT ( go );
GET_SCRIPT ( GameObjectScript , go -> GetScriptId (), tmpscript );
2011-07-22 21:22:05 +02:00
tmpscript -> OnDamaged ( go , player );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2012-05-16 08:47:43 -04:00
void ScriptMgr :: OnGameObjectLootStateChanged ( GameObject * go , uint32 state , Unit * unit )
{
ASSERT ( go );
GET_SCRIPT ( GameObjectScript , go -> GetScriptId (), tmpscript );
tmpscript -> OnLootStateChanged ( go , state , unit );
}
void ScriptMgr :: OnGameObjectStateChanged ( GameObject * go , uint32 state )
{
ASSERT ( go );
GET_SCRIPT ( GameObjectScript , go -> GetScriptId (), tmpscript );
tmpscript -> OnGameObjectStateChanged ( go , state );
}
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnGameObjectUpdate ( GameObject * go , uint32 diff )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( go );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT ( GameObjectScript , go -> GetScriptId (), tmpscript );
tmpscript -> OnUpdate ( go , diff );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
bool ScriptMgr :: OnDummyEffect ( Unit * caster , uint32 spellId , SpellEffIndex effIndex , GameObject * target )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( caster );
ASSERT ( target );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( GameObjectScript , target -> GetScriptId (), tmpscript , false );
return tmpscript -> OnDummyEffect ( caster , spellId , effIndex , target );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2012-04-14 17:49:51 +02:00
GameObjectAI * ScriptMgr :: GetGameObjectAI ( GameObject * go )
{
ASSERT ( go );
GET_SCRIPT_RET ( GameObjectScript , go -> GetScriptId (), tmpscript , NULL );
2012-04-14 18:26:16 +02:00
return tmpscript -> GetAI ( go );
2012-04-14 17:49:51 +02:00
}
2010-08-07 13:07:18 +02:00
bool ScriptMgr :: OnAreaTrigger ( Player * player , AreaTriggerEntry const * trigger )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( player );
ASSERT ( trigger );
2011-04-01 20:31:15 +02:00
GET_SCRIPT_RET ( AreaTriggerScript , sObjectMgr -> GetAreaTriggerScriptId ( trigger -> id ), tmpscript , false );
2010-08-06 19:23:43 +02:00
return tmpscript -> OnTrigger ( player , trigger );
}
2009-10-17 15:51:44 -07:00
2010-08-30 15:25:15 +02:00
Battleground * ScriptMgr :: CreateBattleground ( BattlegroundTypeId /*typeId*/ )
2010-08-06 19:23:43 +02:00
{
// TODO: Implement script-side battlegrounds.
ASSERT ( false );
return NULL ;
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
OutdoorPvP * ScriptMgr :: CreateOutdoorPvP ( OutdoorPvPData const * data )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( data );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT_RET ( OutdoorPvPScript , data -> ScriptId , tmpscript , NULL );
2010-08-07 13:07:18 +02:00
return tmpscript -> GetOutdoorPvP ();
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
std :: vector < ChatCommand *> ScriptMgr :: GetChatCommands ()
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
std :: vector < ChatCommand *> table ;
FOR_SCRIPTS_RET ( CommandScript , itr , end , table )
2010-08-07 13:07:18 +02:00
table . push_back ( itr -> second -> GetCommands ());
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
return table ;
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnWeatherChange ( Weather * weather , WeatherState state , float grade )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( weather );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
GET_SCRIPT ( WeatherScript , weather -> GetScriptId (), tmpscript );
tmpscript -> OnChange ( weather , state , grade );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnWeatherUpdate ( Weather * weather , uint32 diff )
2010-06-03 14:29:04 +02:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( weather );
GET_SCRIPT ( WeatherScript , weather -> GetScriptId (), tmpscript );
tmpscript -> OnUpdate ( weather , diff );
2010-06-03 14:29:04 +02:00
}
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnAuctionAdd ( AuctionHouseObject * ah , AuctionEntry * entry )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( ah );
ASSERT ( entry );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
FOREACH_SCRIPT ( AuctionHouseScript ) -> OnAuctionAdd ( ah , entry );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 21:49:39 -07:00
void ScriptMgr :: OnAuctionRemove ( AuctionHouseObject * ah , AuctionEntry * entry )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( ah );
ASSERT ( entry );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
FOREACH_SCRIPT ( AuctionHouseScript ) -> OnAuctionRemove ( ah , entry );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnAuctionSuccessful ( AuctionHouseObject * ah , AuctionEntry * entry )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( ah );
ASSERT ( entry );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
FOREACH_SCRIPT ( AuctionHouseScript ) -> OnAuctionSuccessful ( ah , entry );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnAuctionExpire ( AuctionHouseObject * ah , AuctionEntry * entry )
2009-08-04 01:44:14 +02:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( ah );
ASSERT ( entry );
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
FOREACH_SCRIPT ( AuctionHouseScript ) -> OnAuctionExpire ( ah , entry );
2009-08-04 01:44:14 +02:00
}
2009-10-17 15:51:44 -07:00
2012-02-10 23:40:38 +01:00
bool ScriptMgr :: OnConditionCheck ( Condition * condition , ConditionSourceInfo & sourceInfo )
2008-10-11 14:16:25 -05:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( condition );
2012-02-14 12:46:26 -05:00
GET_SCRIPT_RET ( ConditionScript , condition -> ScriptId , tmpscript , true );
2012-02-10 23:40:38 +01:00
return tmpscript -> OnConditionCheck ( condition , sourceInfo );
2010-08-06 19:23:43 +02:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnInstall ( Vehicle * veh )
{
ASSERT ( veh );
2010-08-07 15:26:24 +02:00
ASSERT ( veh -> GetBase () -> GetTypeId () == TYPEID_UNIT );
2009-10-17 15:51:44 -07:00
2010-08-07 15:26:24 +02:00
GET_SCRIPT ( VehicleScript , veh -> GetBase () -> ToCreature () -> GetScriptId (), tmpscript );
tmpscript -> OnInstall ( veh );
2008-10-11 14:16:25 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnUninstall ( Vehicle * veh )
2009-03-13 20:34:36 -06:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( veh );
2010-08-07 15:26:24 +02:00
ASSERT ( veh -> GetBase () -> GetTypeId () == TYPEID_UNIT );
2009-10-17 15:51:44 -07:00
2010-08-07 15:26:24 +02:00
GET_SCRIPT ( VehicleScript , veh -> GetBase () -> ToCreature () -> GetScriptId (), tmpscript );
tmpscript -> OnUninstall ( veh );
2010-08-06 19:23:43 +02:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnReset ( Vehicle * veh )
2009-03-13 20:34:36 -06:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( veh );
2010-08-07 15:26:24 +02:00
ASSERT ( veh -> GetBase () -> GetTypeId () == TYPEID_UNIT );
2010-08-06 19:23:43 +02:00
2010-08-07 15:26:24 +02:00
GET_SCRIPT ( VehicleScript , veh -> GetBase () -> ToCreature () -> GetScriptId (), tmpscript );
tmpscript -> OnReset ( veh );
2010-08-06 19:23:43 +02:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnInstallAccessory ( Vehicle * veh , Creature * accessory )
{
ASSERT ( veh );
2010-08-07 15:26:24 +02:00
ASSERT ( veh -> GetBase () -> GetTypeId () == TYPEID_UNIT );
2010-08-06 19:23:43 +02:00
ASSERT ( accessory );
2009-10-17 15:51:44 -07:00
2010-08-07 15:26:24 +02:00
GET_SCRIPT ( VehicleScript , veh -> GetBase () -> ToCreature () -> GetScriptId (), tmpscript );
tmpscript -> OnInstallAccessory ( veh , accessory );
2009-03-13 20:34:36 -06:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnAddPassenger ( Vehicle * veh , Unit * passenger , int8 seatId )
2009-03-13 20:34:36 -06:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( veh );
2010-08-07 15:26:24 +02:00
ASSERT ( veh -> GetBase () -> GetTypeId () == TYPEID_UNIT );
2010-08-06 19:23:43 +02:00
ASSERT ( passenger );
2009-10-17 15:51:44 -07:00
2010-08-07 15:26:24 +02:00
GET_SCRIPT ( VehicleScript , veh -> GetBase () -> ToCreature () -> GetScriptId (), tmpscript );
tmpscript -> OnAddPassenger ( veh , passenger , seatId );
2010-08-06 19:23:43 +02:00
}
2009-10-17 15:51:44 -07:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnRemovePassenger ( Vehicle * veh , Unit * passenger )
{
ASSERT ( veh );
2010-08-07 15:26:24 +02:00
ASSERT ( veh -> GetBase () -> GetTypeId () == TYPEID_UNIT );
2010-08-06 19:23:43 +02:00
ASSERT ( passenger );
2010-08-07 15:26:24 +02:00
GET_SCRIPT ( VehicleScript , veh -> GetBase () -> ToCreature () -> GetScriptId (), tmpscript );
tmpscript -> OnRemovePassenger ( veh , passenger );
2009-03-13 20:34:36 -06:00
}
2009-04-03 16:54:20 -06:00
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnDynamicObjectUpdate ( DynamicObject * dynobj , uint32 diff )
2010-07-24 22:41:42 +02:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( dynobj );
FOR_SCRIPTS ( DynamicObjectScript , itr , end )
itr -> second -> OnUpdate ( dynobj , diff );
2010-07-24 22:41:42 +02:00
}
2010-08-06 19:23:43 +02:00
void ScriptMgr :: OnAddPassenger ( Transport * transport , Player * player )
2010-07-24 22:41:42 +02:00
{
2010-08-06 19:23:43 +02:00
ASSERT ( transport );
ASSERT ( player );
GET_SCRIPT ( TransportScript , transport -> GetScriptId (), tmpscript );
tmpscript -> OnAddPassenger ( transport , player );
}
void ScriptMgr :: OnAddCreaturePassenger ( Transport * transport , Creature * creature )
{
ASSERT ( transport );
ASSERT ( creature );
GET_SCRIPT ( TransportScript , transport -> GetScriptId (), tmpscript );
tmpscript -> OnAddCreaturePassenger ( transport , creature );
}
void ScriptMgr :: OnRemovePassenger ( Transport * transport , Player * player )
{
ASSERT ( transport );
ASSERT ( player );
GET_SCRIPT ( TransportScript , transport -> GetScriptId (), tmpscript );
tmpscript -> OnRemovePassenger ( transport , player );
}
void ScriptMgr :: OnTransportUpdate ( Transport * transport , uint32 diff )
{
ASSERT ( transport );
GET_SCRIPT ( TransportScript , transport -> GetScriptId (), tmpscript );
tmpscript -> OnUpdate ( transport , diff );
}
2010-09-02 10:40:32 +02:00
void ScriptMgr :: OnRelocate ( Transport * transport , uint32 waypointId , uint32 mapId , float x , float y , float z )
2010-08-07 14:17:32 +02:00
{
GET_SCRIPT ( TransportScript , transport -> GetScriptId (), tmpscript );
2010-09-02 10:40:32 +02:00
tmpscript -> OnRelocate ( transport , waypointId , mapId , x , y , z );
2010-08-07 14:17:32 +02:00
}
2010-08-07 14:30:10 +02:00
void ScriptMgr :: OnStartup ()
{
FOREACH_SCRIPT ( WorldScript ) -> OnStartup ();
}
void ScriptMgr :: OnShutdown ()
{
FOREACH_SCRIPT ( WorldScript ) -> OnShutdown ();
}
2010-08-07 16:48:34 +02:00
bool ScriptMgr :: OnCriteriaCheck ( AchievementCriteriaData const * data , Player * source , Unit * target )
{
ASSERT ( source );
2010-08-07 17:58:45 +02:00
// target can be NULL.
2010-08-07 16:48:34 +02:00
GET_SCRIPT_RET ( AchievementCriteriaScript , data -> ScriptId , tmpscript , false );
return tmpscript -> OnCheck ( source , target );
}
2010-10-17 19:54:13 +06:00
// Player
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPVPKill ( Player * killer , Player * killed )
2010-08-11 19:52:58 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnPVPKill ( killer , killed );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnCreatureKill ( Player * killer , Creature * killed )
2010-08-11 19:52:58 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnCreatureKill ( killer , killed );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerKilledByCreature ( Creature * killer , Player * killed )
2010-08-11 19:52:58 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnPlayerKilledByCreature ( killer , killed );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerLevelChanged ( Player * player , uint8 oldLevel )
2010-08-11 19:52:58 -07:00
{
2011-05-29 22:49:05 +07:00
FOREACH_SCRIPT ( PlayerScript ) -> OnLevelChanged ( player , oldLevel );
2010-08-11 19:52:58 -07:00
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerFreeTalentPointsChanged ( Player * player , uint32 points )
2010-08-11 19:52:58 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnFreeTalentPointsChanged ( player , points );
}
2011-08-14 13:45:42 +02:00
void ScriptMgr :: OnPlayerTalentsReset ( Player * player , bool noCost )
2010-08-11 19:52:58 -07:00
{
2011-08-14 13:45:42 +02:00
FOREACH_SCRIPT ( PlayerScript ) -> OnTalentsReset ( player , noCost );
2010-08-11 19:52:58 -07:00
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerMoneyChanged ( Player * player , int32 & amount )
2010-08-11 22:53:31 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnMoneyChanged ( player , amount );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnGivePlayerXP ( Player * player , uint32 & amount , Unit * victim )
2010-08-11 22:53:31 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnGiveXP ( player , amount , victim );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerReputationChange ( Player * player , uint32 factionID , int32 & standing , bool incremental )
2010-08-11 22:53:31 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnReputationChange ( player , factionID , standing , incremental );
}
2011-09-15 14:08:17 +02:00
void ScriptMgr :: OnPlayerDuelRequest ( Player * target , Player * challenger )
2010-09-13 01:42:14 +03:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnDuelRequest ( target , challenger );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerDuelStart ( Player * player1 , Player * player2 )
2010-09-13 01:42:14 +03:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnDuelStart ( player1 , player2 );
}
2011-09-15 14:08:17 +02:00
void ScriptMgr :: OnPlayerDuelEnd ( Player * winner , Player * loser , DuelCompleteType type )
2010-09-13 01:42:14 +03:00
{
2010-11-14 23:46:34 +02:00
FOREACH_SCRIPT ( PlayerScript ) -> OnDuelEnd ( winner , loser , type );
2010-09-13 01:42:14 +03:00
}
2010-11-17 18:14:35 +06:00
void ScriptMgr :: OnPlayerChat ( Player * player , uint32 type , uint32 lang , std :: string & msg )
2010-08-11 22:53:31 -07:00
{
2010-09-04 12:49:39 -07:00
FOREACH_SCRIPT ( PlayerScript ) -> OnChat ( player , type , lang , msg );
}
2010-11-17 18:14:35 +06:00
void ScriptMgr :: OnPlayerChat ( Player * player , uint32 type , uint32 lang , std :: string & msg , Player * receiver )
2010-09-04 12:49:39 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnChat ( player , type , lang , msg , receiver );
}
2010-11-17 18:14:35 +06:00
void ScriptMgr :: OnPlayerChat ( Player * player , uint32 type , uint32 lang , std :: string & msg , Group * group )
2010-09-04 12:49:39 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnChat ( player , type , lang , msg , group );
}
2010-11-17 18:14:35 +06:00
void ScriptMgr :: OnPlayerChat ( Player * player , uint32 type , uint32 lang , std :: string & msg , Guild * guild )
2010-09-04 12:49:39 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnChat ( player , type , lang , msg , guild );
}
2010-11-17 18:14:35 +06:00
void ScriptMgr :: OnPlayerChat ( Player * player , uint32 type , uint32 lang , std :: string & msg , Channel * channel )
2010-09-04 12:49:39 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnChat ( player , type , lang , msg , channel );
2010-08-11 22:53:31 -07:00
}
2010-08-12 22:33:45 +06:00
void ScriptMgr :: OnPlayerEmote ( Player * player , uint32 emote )
2010-08-11 22:53:31 -07:00
{
2010-08-12 22:33:45 +06:00
FOREACH_SCRIPT ( PlayerScript ) -> OnEmote ( player , emote );
2010-08-11 22:53:31 -07:00
}
2011-08-14 13:45:42 +02:00
void ScriptMgr :: OnPlayerTextEmote ( Player * player , uint32 textEmote , uint32 emoteNum , uint64 guid )
2010-08-11 22:53:31 -07:00
{
2011-08-14 13:45:42 +02:00
FOREACH_SCRIPT ( PlayerScript ) -> OnTextEmote ( player , textEmote , emoteNum , guid );
2010-08-11 22:53:31 -07:00
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerSpellCast ( Player * player , Spell * spell , bool skipCheck )
2010-09-03 19:58:16 -07:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnSpellCast ( player , spell , skipCheck );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerLogin ( Player * player )
2010-09-15 13:23:07 +02:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnLogin ( player );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerLogout ( Player * player )
2010-09-15 13:23:07 +02:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnLogout ( player );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnPlayerCreate ( Player * player )
2010-09-15 13:23:07 +02:00
{
FOREACH_SCRIPT ( PlayerScript ) -> OnCreate ( player );
}
void ScriptMgr :: OnPlayerDelete ( uint64 guid )
{
FOREACH_SCRIPT ( PlayerScript ) -> OnDelete ( guid );
}
2010-12-23 06:06:21 +01:00
void ScriptMgr :: OnPlayerBindToInstance ( Player * player , Difficulty difficulty , uint32 mapid , bool permanent )
{
FOREACH_SCRIPT ( PlayerScript ) -> OnBindToInstance ( player , difficulty , mapid , permanent );
}
2012-03-02 09:42:17 -05:00
void ScriptMgr :: OnPlayerUpdateZone ( Player * player , uint32 newZone , uint32 newArea )
{
2012-03-02 09:49:44 -05:00
FOREACH_SCRIPT ( PlayerScript ) -> OnUpdateZone ( player , newZone , newArea );
2012-03-02 09:42:17 -05:00
}
2010-10-17 19:54:13 +06:00
// Guild
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnGuildAddMember ( Guild * guild , Player * player , uint8 & plRank )
2010-08-14 12:17:05 -07:00
{
FOREACH_SCRIPT ( GuildScript ) -> OnAddMember ( guild , player , plRank );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnGuildRemoveMember ( Guild * guild , Player * player , bool isDisbanding , bool isKicked )
2010-08-14 12:17:05 -07:00
{
FOREACH_SCRIPT ( GuildScript ) -> OnRemoveMember ( guild , player , isDisbanding , isKicked );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnGuildMOTDChanged ( Guild * guild , const std :: string & newMotd )
2010-08-14 12:17:05 -07:00
{
FOREACH_SCRIPT ( GuildScript ) -> OnMOTDChanged ( guild , newMotd );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnGuildInfoChanged ( Guild * guild , const std :: string & newInfo )
2010-08-14 12:17:05 -07:00
{
2010-10-17 19:54:13 +06:00
FOREACH_SCRIPT ( GuildScript ) -> OnInfoChanged ( guild , newInfo );
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnGuildCreate ( Guild * guild , Player * leader , const std :: string & name )
2010-10-17 19:54:13 +06:00
{
FOREACH_SCRIPT ( GuildScript ) -> OnCreate ( guild , leader , name );
2010-08-14 12:17:05 -07:00
}
2011-06-12 01:47:45 +02:00
void ScriptMgr :: OnGuildDisband ( Guild * guild )
2010-08-14 12:17:05 -07:00
{
FOREACH_SCRIPT ( GuildScript ) -> OnDisband ( guild );
}
2010-10-17 19:54:13 +06:00
void ScriptMgr :: OnGuildMemberWitdrawMoney ( Guild * guild , Player * player , uint32 & amount , bool isRepair )
{
FOREACH_SCRIPT ( GuildScript ) -> OnMemberWitdrawMoney ( guild , player , amount , isRepair );
}
void ScriptMgr :: OnGuildMemberDepositMoney ( Guild * guild , Player * player , uint32 & amount )
{
FOREACH_SCRIPT ( GuildScript ) -> OnMemberDepositMoney ( guild , player , amount );
}
2012-03-14 18:51:51 +01:00
void ScriptMgr :: OnGuildItemMove ( Guild * guild , Player * player , Item * pItem , bool isSrcBank , uint8 srcContainer , uint8 srcSlotId ,
2010-10-17 19:54:13 +06:00
bool isDestBank , uint8 destContainer , uint8 destSlotId )
{
2012-03-14 18:51:51 +01:00
FOREACH_SCRIPT ( GuildScript ) -> OnItemMove ( guild , player , pItem , isSrcBank , srcContainer , srcSlotId , isDestBank , destContainer , destSlotId );
2010-10-17 19:54:13 +06:00
}
void ScriptMgr :: OnGuildEvent ( Guild * guild , uint8 eventType , uint32 playerGuid1 , uint32 playerGuid2 , uint8 newRank )
{
FOREACH_SCRIPT ( GuildScript ) -> OnEvent ( guild , eventType , playerGuid1 , playerGuid2 , newRank );
}
void ScriptMgr :: OnGuildBankEvent ( Guild * guild , uint8 eventType , uint8 tabId , uint32 playerGuid , uint32 itemOrMoney , uint16 itemStackCount , uint8 destTabId )
{
FOREACH_SCRIPT ( GuildScript ) -> OnBankEvent ( guild , eventType , tabId , playerGuid , itemOrMoney , itemStackCount , destTabId );
}
// Group
2010-09-14 16:37:54 +02:00
void ScriptMgr :: OnGroupAddMember ( Group * group , uint64 guid )
{
2010-09-25 22:03:57 +02:00
ASSERT ( group );
2010-09-14 16:37:54 +02:00
FOREACH_SCRIPT ( GroupScript ) -> OnAddMember ( group , guid );
}
void ScriptMgr :: OnGroupInviteMember ( Group * group , uint64 guid )
{
2010-09-25 22:03:57 +02:00
ASSERT ( group );
2010-09-14 16:37:54 +02:00
FOREACH_SCRIPT ( GroupScript ) -> OnInviteMember ( group , guid );
}
2010-11-23 20:49:36 +01:00
void ScriptMgr :: OnGroupRemoveMember ( Group * group , uint64 guid , RemoveMethod method , uint64 kicker , const char * reason )
2010-09-14 16:37:54 +02:00
{
2010-09-25 22:03:57 +02:00
ASSERT ( group );
2010-11-23 20:49:36 +01:00
FOREACH_SCRIPT ( GroupScript ) -> OnRemoveMember ( group , guid , method , kicker , reason );
2010-09-14 16:37:54 +02:00
}
void ScriptMgr :: OnGroupChangeLeader ( Group * group , uint64 newLeaderGuid , uint64 oldLeaderGuid )
{
2010-09-25 22:03:57 +02:00
ASSERT ( group );
2010-09-14 16:37:54 +02:00
FOREACH_SCRIPT ( GroupScript ) -> OnChangeLeader ( group , newLeaderGuid , oldLeaderGuid );
}
void ScriptMgr :: OnGroupDisband ( Group * group )
{
2010-09-25 22:03:57 +02:00
ASSERT ( group );
2010-09-14 16:37:54 +02:00
FOREACH_SCRIPT ( GroupScript ) -> OnDisband ( group );
}
2010-08-24 00:10:49 +02:00
SpellScriptLoader :: SpellScriptLoader ( const char * name )
2010-08-09 19:53:21 +02:00
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < SpellScriptLoader >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
ServerScript :: ServerScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < ServerScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
WorldScript :: WorldScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < WorldScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
FormulaScript :: FormulaScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < FormulaScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
WorldMapScript :: WorldMapScript ( const char * name , uint32 mapId )
: ScriptObject ( name ), MapScript < Map > ( mapId )
2010-08-06 19:23:43 +02:00
{
2012-04-07 11:59:01 -05:00
if ( GetEntry () && ! GetEntry () -> IsWorldMap ())
2010-12-23 23:25:44 +01:00
sLog -> outError ( "WorldMapScript for map %u is invalid." , mapId );
2010-08-09 19:53:21 +02:00
2011-07-27 14:52:59 +02:00
ScriptRegistry < WorldMapScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
InstanceMapScript :: InstanceMapScript ( const char * name , uint32 mapId )
2010-08-09 16:07:03 -05:00
: ScriptObject ( name ), MapScript < InstanceMap > ( mapId )
2010-08-06 19:23:43 +02:00
{
2010-08-09 19:53:21 +02:00
if ( GetEntry () && ! GetEntry () -> IsDungeon ())
2010-12-23 23:25:44 +01:00
sLog -> outError ( "InstanceMapScript for map %u is invalid." , mapId );
2010-08-09 19:53:21 +02:00
2011-07-27 14:52:59 +02:00
ScriptRegistry < InstanceMapScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
BattlegroundMapScript :: BattlegroundMapScript ( const char * name , uint32 mapId )
: ScriptObject ( name ), MapScript < BattlegroundMap > ( mapId )
2010-08-06 19:23:43 +02:00
{
2010-08-09 19:53:21 +02:00
if ( GetEntry () && ! GetEntry () -> IsBattleground ())
2010-12-23 23:25:44 +01:00
sLog -> outError ( "BattlegroundMapScript for map %u is invalid." , mapId );
2010-08-06 19:23:43 +02:00
2011-07-27 14:52:59 +02:00
ScriptRegistry < BattlegroundMapScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
ItemScript :: ItemScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < ItemScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
CreatureScript :: CreatureScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < CreatureScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
GameObjectScript :: GameObjectScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < GameObjectScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
AreaTriggerScript :: AreaTriggerScript ( const char * name )
: ScriptObject ( name )
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < AreaTriggerScript >:: AddScript ( this );
2010-08-09 19:53:21 +02:00
}
BattlegroundScript :: BattlegroundScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < BattlegroundScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
OutdoorPvPScript :: OutdoorPvPScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < OutdoorPvPScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
CommandScript :: CommandScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < CommandScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
WeatherScript :: WeatherScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < WeatherScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
AuctionHouseScript :: AuctionHouseScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < AuctionHouseScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
ConditionScript :: ConditionScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < ConditionScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
VehicleScript :: VehicleScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < VehicleScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
DynamicObjectScript :: DynamicObjectScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < DynamicObjectScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
TransportScript :: TransportScript ( const char * name )
: ScriptObject ( name )
2010-08-06 19:23:43 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < TransportScript >:: AddScript ( this );
2010-08-06 19:23:43 +02:00
}
2010-08-09 19:53:21 +02:00
AchievementCriteriaScript :: AchievementCriteriaScript ( const char * name )
: ScriptObject ( name )
2010-08-07 16:48:34 +02:00
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < AchievementCriteriaScript >:: AddScript ( this );
2010-08-07 16:48:34 +02:00
}
2010-08-11 19:52:58 -07:00
PlayerScript :: PlayerScript ( const char * name )
: ScriptObject ( name )
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < PlayerScript >:: AddScript ( this );
2010-08-11 19:52:58 -07:00
}
2010-08-14 12:42:05 -07:00
GuildScript :: GuildScript ( const char * name )
: ScriptObject ( name )
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < GuildScript >:: AddScript ( this );
2010-08-14 12:42:05 -07:00
}
2010-09-14 16:37:54 +02:00
GroupScript :: GroupScript ( const char * name )
: ScriptObject ( name )
{
2011-07-27 14:52:59 +02:00
ScriptRegistry < GroupScript >:: AddScript ( this );
2010-09-14 16:37:54 +02:00
}
2011-07-27 14:52:59 +02:00
// Instantiate static members of ScriptRegistry.
template < class TScript > std :: map < uint32 , TScript *> ScriptRegistry < TScript >:: ScriptPointerList ;
template < class TScript > uint32 ScriptRegistry < TScript >:: _scriptIdCounter = 0 ;
2010-08-06 19:23:43 +02:00
// Specialize for each script type class like so:
2011-07-27 14:52:59 +02:00
template class ScriptRegistry < SpellScriptLoader > ;
template class ScriptRegistry < ServerScript > ;
template class ScriptRegistry < WorldScript > ;
template class ScriptRegistry < FormulaScript > ;
template class ScriptRegistry < WorldMapScript > ;
template class ScriptRegistry < InstanceMapScript > ;
template class ScriptRegistry < BattlegroundMapScript > ;
template class ScriptRegistry < ItemScript > ;
template class ScriptRegistry < CreatureScript > ;
template class ScriptRegistry < GameObjectScript > ;
template class ScriptRegistry < AreaTriggerScript > ;
template class ScriptRegistry < BattlegroundScript > ;
template class ScriptRegistry < OutdoorPvPScript > ;
template class ScriptRegistry < CommandScript > ;
template class ScriptRegistry < WeatherScript > ;
template class ScriptRegistry < AuctionHouseScript > ;
template class ScriptRegistry < ConditionScript > ;
template class ScriptRegistry < VehicleScript > ;
template class ScriptRegistry < DynamicObjectScript > ;
template class ScriptRegistry < TransportScript > ;
template class ScriptRegistry < AchievementCriteriaScript > ;
template class ScriptRegistry < PlayerScript > ;
template class ScriptRegistry < GuildScript > ;
template class ScriptRegistry < GroupScript > ;
2010-08-06 19:23:43 +02:00
// Undefine utility macros.
#undef GET_SCRIPT_RET
#undef GET_SCRIPT
#undef FOREACH_SCRIPT
#undef FOR_SCRIPTS_RET
#undef FOR_SCRIPTS
#undef SCR_REG_LST
2010-08-07 15:26:24 +02:00
#undef SCR_REG_ITR
2010-08-06 19:23:43 +02:00
#undef SCR_REG_MAP