Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
großer svn merge
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp.dallig committed May 24, 2011
1 parent 4376d0e commit 50f9acb
Show file tree
Hide file tree
Showing 201 changed files with 5,377 additions and 8,597 deletions.
72 changes: 72 additions & 0 deletions ScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,31 @@
#include "../system/ScriptLoader.h"
#include "../system/system.h"
#include "../../../game/ScriptMgr.h"
#include "World.h"

typedef std::vector<Script*> SDScriptVec;
int num_sc_scripts;
SDScriptVec m_scripts;

Config SD2Config;

/**********************************************************************
+additions for windows compiler
**********************************************************************/
template<> bool MaNGOS::Singleton<World>::si_destroyed;
template<> bool MaNGOS::Singleton<ObjectMgr>::si_destroyed;
template<> World *MaNGOS::Singleton<World>::si_instance;
World::World()
{
}
World::~World()
{
}
ObjectMgr::~ObjectMgr()
{
}
/***********************************************************************/

QueryResult* strSD2Pquery(char* str)
{
return SD2Database.Query(str);
Expand Down Expand Up @@ -253,6 +271,9 @@ char const* GetScriptLibraryVersion()
MANGOS_DLL_EXPORT
bool GossipHello(Player* pPlayer, Creature* pCreature)
{
if (!pCreature)
return false;

Script *tmpscript = m_scripts[pCreature->GetScriptId()];

if (!tmpscript || !tmpscript->pGossipHello)
Expand All @@ -266,6 +287,9 @@ bool GossipHello(Player* pPlayer, Creature* pCreature)
MANGOS_DLL_EXPORT
bool GOGossipHello(Player *pPlayer, GameObject *pGo)
{
if (!pGo)
return false;

Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pGossipHelloGO)
Expand All @@ -281,6 +305,9 @@ bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32
{
debug_log("SD2: Gossip selection, sender: %u, action: %u", uiSender, uiAction);

if (!pCreature)
return false;

Script *tmpscript = m_scripts[pCreature->GetScriptId()];

if (!tmpscript || !tmpscript->pGossipSelect)
Expand All @@ -298,6 +325,9 @@ bool GOGossipSelect(Player *pPlayer, GameObject *pGo, uint32 sender, uint32 acti
{
debug_log("SD2: GO Gossip selection, sender: %u, action: %u", sender, action);

if (!pGo)
return false;

Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pGossipSelectGO)
Expand All @@ -313,6 +343,9 @@ bool GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender,
{
debug_log("SD2: Gossip selection with code, sender: %u, action: %u", uiSender, uiAction);

if (!pCreature)
return false;

Script *tmpscript = m_scripts[pCreature->GetScriptId()];

if (!tmpscript || !tmpscript->pGossipSelectWithCode)
Expand All @@ -328,6 +361,9 @@ bool GOGossipSelectWithCode(Player *pPlayer, GameObject *pGo, uint32 sender, uin
{
debug_log("SD2: GO Gossip selection with code, sender: %u, action: %u", sender, action);

if (!pGo)
return false;

Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pGossipSelectGOWithCode)
Expand All @@ -341,6 +377,9 @@ bool GOGossipSelectWithCode(Player *pPlayer, GameObject *pGo, uint32 sender, uin
MANGOS_DLL_EXPORT
bool QuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (!pCreature)
return false;

Script *tmpscript = m_scripts[pCreature->GetScriptId()];

if (!tmpscript || !tmpscript->pQuestAcceptNPC)
Expand All @@ -354,6 +393,9 @@ bool QuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
MANGOS_DLL_EXPORT
bool QuestRewarded(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
{
if (!pCreature)
return false;

Script *tmpscript = m_scripts[pCreature->GetScriptId()];

if (!tmpscript || !tmpscript->pQuestRewardedNPC)
Expand All @@ -380,6 +422,9 @@ uint32 GetNPCDialogStatus(Player* pPlayer, Creature* pCreature)
MANGOS_DLL_EXPORT
uint32 GetGODialogStatus(Player* pPlayer, GameObject* pGo)
{
if (!pGo)
return false;

Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pDialogStatusGO)
Expand All @@ -393,6 +438,9 @@ uint32 GetGODialogStatus(Player* pPlayer, GameObject* pGo)
MANGOS_DLL_EXPORT
bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
{
if (!pItem)
return false;

Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId];

if (!tmpscript || !tmpscript->pQuestAcceptItem)
Expand All @@ -406,6 +454,9 @@ bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
MANGOS_DLL_EXPORT
bool GOUse(Player* pPlayer, GameObject* pGo)
{
if (!pGo)
return false;

Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pGOUse)
Expand All @@ -417,6 +468,9 @@ bool GOUse(Player* pPlayer, GameObject* pGo)
MANGOS_DLL_EXPORT
bool GOQuestAccept(Player* pPlayer, GameObject* pGo, const Quest* pQuest)
{
if (!pGo)
return false;

Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pQuestAcceptGO)
Expand All @@ -430,6 +484,9 @@ bool GOQuestAccept(Player* pPlayer, GameObject* pGo, const Quest* pQuest)
MANGOS_DLL_EXPORT
bool GOQuestRewarded(Player* pPlayer, GameObject* pGo, Quest const* pQuest)
{
if (!pGo)
return false;

Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pQuestRewardedGO)
Expand Down Expand Up @@ -466,6 +523,9 @@ bool ProcessEvent(uint32 uiEventId, Object* pSource, Object* pTarget, bool bIsSt
MANGOS_DLL_EXPORT
CreatureAI* GetCreatureAI(Creature* pCreature)
{
if (!pCreature)
return false;

Script *tmpscript = m_scripts[pCreature->GetScriptId()];

if (!tmpscript || !tmpscript->GetAI)
Expand All @@ -477,6 +537,9 @@ CreatureAI* GetCreatureAI(Creature* pCreature)
MANGOS_DLL_EXPORT
bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
{
if (!pItem)
return false;

Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId];

if (!tmpscript || !tmpscript->pItemUse)
Expand All @@ -488,6 +551,9 @@ bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
MANGOS_DLL_EXPORT
bool EffectDummyCreature(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget)
{
if (!pTarget)
return false;

Script *tmpscript = m_scripts[pTarget->GetScriptId()];

if (!tmpscript || !tmpscript->pEffectDummyNPC)
Expand All @@ -499,6 +565,9 @@ bool EffectDummyCreature(Unit* pCaster, uint32 spellId, SpellEffectIndex effInde
MANGOS_DLL_EXPORT
bool EffectDummyGameObject(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget)
{
if (!pTarget)
return false;

Script *tmpscript = m_scripts[pTarget->GetGOInfo()->ScriptId];

if (!tmpscript || !tmpscript->pEffectDummyGO)
Expand All @@ -510,6 +579,9 @@ bool EffectDummyGameObject(Unit* pCaster, uint32 spellId, SpellEffectIndex effIn
MANGOS_DLL_EXPORT
bool EffectDummyItem(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget)
{
if (!pTarget)
return false;

Script *tmpscript = m_scripts[pTarget->GetProto()->ScriptId];

if (!tmpscript || !tmpscript->pEffectDummyItem)
Expand Down
1 change: 1 addition & 0 deletions ScriptMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ QueryResult* strSD2Pquery(char*);

// Not registered scripts storage
Script* GetScriptByName(std::string scriptName);

// *********************************************************
// **************** Internal hook mechanics ****************

Expand Down
Loading

0 comments on commit 50f9acb

Please sign in to comment.