[10299] Add new script call ProcessEventId

Let script library know when some event is about to start. Event id's may be found in several sources, such as spells, GO's and transport/taxi paths.
Database scripts may be prevented by returning true from script side whenever needed. If false, DB script will run like normal.
New database table event_id_scripts will need a ScriptName for the event id, in same way as for example areatrigger_scripts.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-07-31 17:51:49 +02:00
parent 28d1ac66c3
commit 2ad9cd34b2
16 changed files with 180 additions and 11 deletions

View file

@ -288,6 +288,17 @@ bool AreaTrigger ( Player *player, AreaTriggerEntry* atEntry )
return tmpscript->pAreaTrigger(player, atEntry);
}
MANGOS_DLL_EXPORT
bool ProcessEventId(uint32 eventId, Object* source, Object* target, bool data)
{
Script *tmpscript = m_scripts[GetEventIdScriptId(eventId)];
if (!tmpscript || !tmpscript->pProcessEventId)
return false;
// data normally false, true for taxi event id where it's a departure
return tmpscript->pProcessEventId(eventId, source, target, data);
}
MANGOS_DLL_EXPORT
bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets)
{

View file

@ -42,7 +42,7 @@ struct Script
pGossipHello(NULL), pGOGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGOGossipSelect(NULL),
pGossipSelectWithCode(NULL), pGOGossipSelectWithCode(NULL),
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL),
pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
pItemHello(NULL), pGOHello(NULL), pProcessEventId(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL),
pGOChooseReward(NULL), pItemUse(NULL), pEffectDummyGameObj(NULL), pEffectDummyCreature(NULL),
pEffectDummyItem(NULL), pEffectAuraDummy(NULL), GetAI(NULL)
{}
@ -65,6 +65,7 @@ struct Script
bool (*pItemHello )(Player *player, Item *_Item, Quest const*_Quest );
bool (*pGOHello )(Player *player, GameObject *_GO );
bool (*pAreaTrigger )(Player *player, AreaTriggerEntry* at);
bool (*pProcessEventId )(uint32 eventId, Object* source, Object* target, bool data);
bool (*pItemQuestAccept )(Player *player, Item *_Item, Quest const*_Quest );
bool (*pGOQuestAccept )(Player *player, GameObject *_GO, Quest const*_Quest );
bool (*pGOChooseReward )(Player *player, GameObject *_GO, Quest const*_Quest, uint32 opt );