[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

@ -912,7 +912,9 @@ void GameObject::Use(Unit* user)
if (GetGOInfo()->chest.eventId)
{
DEBUG_LOG("Chest ScriptStart id %u for GO %u", GetGOInfo()->chest.eventId, GetDBTableGUIDLow());
GetMap()->ScriptsStart(sEventScripts, GetGOInfo()->chest.eventId, user, this);
if (!Script->ProcessEventId(GetGOInfo()->chest.eventId, user, this, false))
GetMap()->ScriptsStart(sEventScripts, GetGOInfo()->chest.eventId, user, this);
}
// triggering linked GO
@ -1016,7 +1018,9 @@ void GameObject::Use(Unit* user)
if (info->goober.eventId)
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow());
GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this);
if (!Script->ProcessEventId(info->goober.eventId, player, this, false))
GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this);
}
// possible quest objective for active quests
@ -1077,7 +1081,10 @@ void GameObject::Use(Unit* user)
player->SendCinematicStart(info->camera.cinematicId);
if (info->camera.eventID)
GetMap()->ScriptsStart(sEventScripts, info->camera.eventID, player, this);
{
if (!Script->ProcessEventId(info->camera.eventID, player, this, false))
GetMap()->ScriptsStart(sEventScripts, info->camera.eventID, player, this);
}
return;
}