*Fix the startup with trinityinterface.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2009-05-25 22:07:08 +02:00
parent 6e9af44a8b
commit 2a658a5134
3 changed files with 69 additions and 28 deletions

View File

@@ -88,7 +88,6 @@ char const* ScriptsVersion()
{
return "Default Trinity scripting library";
}
TRINITY_DLL_EXPORT
bool GossipHello ( Player * player, Creature *_Creature )
{
@@ -289,12 +288,34 @@ bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets)
}
TRINITY_DLL_EXPORT
bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote )
bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget )
{
Script *tmpscript = m_scripts[_Creature->GetScriptId()];
if (!tmpscript || !tmpscript->pReceiveEmote) return false;
Script *tmpscript = m_scripts[crTarget->GetScriptId()];
return tmpscript->pReceiveEmote(player, _Creature, emote);
if (!tmpscript || !tmpscript->pEffectDummyCreature) return false;
return tmpscript->pEffectDummyCreature(caster, spellId,effIndex,crTarget);
}
TRINITY_DLL_EXPORT
bool EffectDummyGameObj(Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget )
{
Script *tmpscript = m_scripts[gameObjTarget->GetGOInfo()->ScriptId];
if (!tmpscript || !tmpscript->pEffectDummyGameObj) return false;
return tmpscript->pEffectDummyGameObj(caster, spellId,effIndex,gameObjTarget);
}
TRINITY_DLL_EXPORT
bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget )
{
Script *tmpscript = m_scripts[itemTarget->GetProto()->ScriptId];
if (!tmpscript || !tmpscript->pEffectDummyItem) return false;
return tmpscript->pEffectDummyItem(caster, spellId,effIndex,itemTarget);
}
TRINITY_DLL_EXPORT

View File

@@ -39,40 +39,42 @@ class Map;
struct Script
{
Script() :
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL), pGOSelect(NULL), pGOSelectWithCode(NULL),
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL), pGOSelect(NULL), pGOSelectWithCode(NULL),
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL),
pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
pGOChooseReward(NULL), pReceiveEmote(NULL), pItemUse(NULL), GetAI(NULL)
{}
pGOChooseReward(NULL), pItemUse(NULL), pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL),
pEffectDummyItem(NULL), GetAI(NULL), GetInstanceData(NULL)
{}
std::string Name;
// -- Quest/gossip Methods to be scripted --
//Methods to be scripted
bool (*pGossipHello )(Player*, Creature*);
bool (*pQuestAccept )(Player*, Creature*, Quest const*);
bool (*pGossipSelect )(Player*, Creature*, uint32, uint32);
bool (*pGossipSelectWithCode)(Player*, Creature*, uint32, uint32, const char*);
bool (*pGOSelect )(Player*, GameObject*, uint32, uint32);
bool (*pGOSelectWithCode )(Player*, GameObject*, uint32, uint32, const char*);
bool (*pQuestSelect )(Player*, Creature*, Quest const*);
bool (*pQuestComplete )(Player*, Creature*, Quest const*);
uint32 (*pNPCDialogStatus )(Player*, Creature*);
uint32 (*pGODialogStatus )(Player*, GameObject*);
bool (*pChooseReward )(Player*, Creature*, Quest const*, uint32);
bool (*pItemHello )(Player*, Item*, Quest const*);
bool (*pGOHello )(Player*, GameObject*);
bool (*pAreaTrigger )(Player*, AreaTriggerEntry*);
bool (*pItemQuestAccept )(Player*, Item*, Quest const*);
bool (*pGOQuestAccept )(Player*, GameObject*, Quest const*);
bool (*pGOChooseReward )(Player*, GameObject*, Quest const*, uint32);
bool (*pReceiveEmote )(Player*, Creature*, uint32);
bool (*pItemUse )(Player*, Item*, SpellCastTargets const&);
bool (*pQuestAccept )(Player*, Creature*, Quest const* );
bool (*pGossipSelect )(Player*, Creature*, uint32 , uint32 );
bool (*pGossipSelectWithCode)(Player*, Creature*, uint32 , uint32 , const char* );
bool (*pGOSelect )(Player*, GameObject*, uint32 , uint32 );
bool (*pGOSelectWithCode )(Player*, GameObject*, uint32 , uint32 , const char* );
bool (*pQuestSelect )(Player*, Creature*, Quest const* );
bool (*pQuestComplete )(Player*, Creature*, Quest const* );
uint32 (*pNPCDialogStatus )(Player*, Creature* );
uint32 (*pGODialogStatus )(Player*, GameObject* );
bool (*pChooseReward )(Player*, Creature*, Quest const*, uint32 );
bool (*pItemHello )(Player*, Item*, Quest const* );
bool (*pGOHello )(Player*, GameObject* );
bool (*pAreaTrigger )(Player*, AreaTriggerEntry* );
bool (*pItemQuestAccept )(Player*, Item *, Quest const* );
bool (*pGOQuestAccept )(Player*, GameObject*, Quest const* );
bool (*pGOChooseReward )(Player*, GameObject*, Quest const*, uint32 );
bool (*pItemUse )(Player*, Item*, SpellCastTargets const& );
bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature* );
bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* );
bool (*pEffectDummyItem )(Unit*, uint32, uint32, Item* );
CreatureAI* (*GetAI)(Creature*);
InstanceData* (*GetInstanceData)(Map*);
void RegisterSelf();
};
class InstanceDataScript

View File

@@ -105,6 +105,21 @@ bool AreaTrigger_default(Player* /*player*/, AreaTriggerEntry* /*atEntry*/ )
return false;
}
bool EffectDummyCreature_default(Unit* /*caster*/, uint32 /*spellId*/, uint32 /*effIndex*/, Creature* /*crTarget*/ )
{
return false;
}
bool EffectDummyGameObj_default(Unit* /*caster*/, uint32 /*spellId*/, uint32 /*effIndex*/, GameObject* /*gameObjTarget*/ )
{
return false;
}
bool EffectDummyItem_default(Unit* /*caster*/, uint32 /*spellId*/, uint32 /*effIndex*/, Item* /*itemTarget*/ )
{
return false;
}
void AddSC_default()
{
Script *newscript;
@@ -128,6 +143,9 @@ void AddSC_default()
newscript->pItemQuestAccept = &ItemQuestAccept_default;
newscript->pGOQuestAccept = &GOQuestAccept_default;
newscript->pGOChooseReward = &GOChooseReward_default;
newscript->pEffectDummyCreature = &EffectDummyCreature_default;
newscript->pEffectDummyGameObj = &EffectDummyGameObj_default;
newscript->pEffectDummyItem = &EffectDummyItem_default;
newscript->RegisterSelf();
}