See More

/* Copyright (C) 2006 - 2011 ScriptDev2 * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ #ifndef SC_SCRIPTMGR_H #define SC_SCRIPTMGR_H #include "Common.h" #include "DBCStructure.h" #include "Database/DatabaseEnv.h" class Player; class Creature; class CreatureAI; class InstanceData; class Quest; class Item; class GameObject; class SpellCastTargets; class Map; class Unit; class WorldObject; class Aura; class Object; #define MAX_SCRIPTS 5000 //72 bytes each (approx 351kb) #define VISIBLE_RANGE (166.0f) //MAX visible range (size of grid) #define DEFAULT_TEXT "" struct Script { Script() : pGossipHello(NULL), pGossipHelloGO(NULL), pGossipSelect(NULL), pGossipSelectGO(NULL), pGossipSelectWithCode(NULL), pGossipSelectGOWithCode(NULL), pDialogStatusNPC(NULL), pDialogStatusGO(NULL), pQuestAcceptNPC(NULL), pQuestAcceptGO(NULL), pQuestAcceptItem(NULL), pQuestRewardedNPC(NULL), pQuestRewardedGO(NULL), pGOUse(NULL), pItemUse(NULL), pAreaTrigger(NULL), pProcessEventId(NULL), pEffectDummyNPC(NULL), pEffectDummyGO(NULL), pEffectDummyItem(NULL), pEffectAuraDummy(NULL), GetAI(NULL), GetInstanceData(NULL) {} std::string Name; bool (*pGossipHello )(Player*, Creature*); bool (*pGossipHelloGO )(Player*, GameObject*); bool (*pGossipSelect )(Player*, Creature*, uint32, uint32); bool (*pGossipSelectGO )(Player*, GameObject*, uint32, uint32); bool (*pGossipSelectWithCode )(Player*, Creature*, uint32, uint32, const char*); bool (*pGossipSelectGOWithCode )(Player*, GameObject*, uint32, uint32, const char*); uint32 (*pDialogStatusNPC )(Player*, Creature*); uint32 (*pDialogStatusGO )(Player*, GameObject*); bool (*pQuestAcceptNPC )(Player*, Creature*, Quest const*); bool (*pQuestAcceptGO )(Player*, GameObject*, Quest const*); bool (*pQuestAcceptItem )(Player*, Item*, Quest const*); bool (*pQuestRewardedNPC )(Player*, Creature*, Quest const*); bool (*pQuestRewardedGO )(Player*, GameObject*, Quest const*); bool (*pGOUse )(Player*, GameObject*); bool (*pItemUse )(Player*, Item*, SpellCastTargets const&); bool (*pAreaTrigger )(Player*, AreaTriggerEntry const*); bool (*pProcessEventId )(uint32, Object*, Object*, bool); bool (*pEffectDummyNPC )(Unit*, uint32, SpellEffectIndex, Creature*); bool (*pEffectDummyGO )(Unit*, uint32, SpellEffectIndex, GameObject*); bool (*pEffectDummyItem )(Unit*, uint32, SpellEffectIndex, Item*); bool (*pEffectAuraDummy )(const Aura*, bool); CreatureAI* (*GetAI )(Creature*); InstanceData* (*GetInstanceData )(Map*); void RegisterSelf(bool bReportError = true); }; //Generic scripting text function void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget = NULL); //DB query QueryResult* strSD2Pquery(char*); // Not registered scripts storage Script* GetScriptByName(std::string scriptName); #if COMPILER == COMPILER_GNU #define FUNC_PTR(name,callconvention,returntype,parameters) typedef returntype(*name)parameters __attribute__ ((callconvention)); #else #define FUNC_PTR(name, callconvention, returntype, parameters) typedef returntype(callconvention *name)parameters; #endif #endif