Non-npc stuff is now also using script system. Wrote new scripts for all sidemenu commands.

This commit is contained in:
Filip Maj 2016-06-18 12:26:29 -04:00
parent 4e69022072
commit 51bbf4ae2e
4 changed files with 17 additions and 36 deletions

View file

@ -54,9 +54,9 @@ namespace FFXIVClassic_Map_Server.lua
}
return null;
}
}
public static void DoActorOnEventStarted(Player player, Actor target, EventStartPacket eventStart)
public static Coroutine DoActorOnEventStarted(Player player, Actor target, EventStartPacket eventStart)
{
string luaPath;
@ -76,24 +76,17 @@ namespace FFXIVClassic_Map_Server.lua
Script script = LoadScript(luaPath);
if (script == null)
return;
return null;
//Have to Do this to combine LuaParams
List<Object> objects = new List<Object>();
objects.Add(player);
objects.Add(target);
objects.Add(eventStart.triggerName);
if (eventStart.luaParams != null)
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventStart.luaParams));
//Run Script
if (!script.Globals.Get("onEventStarted").IsNil())
script.Call(script.Globals["onEventStarted"], objects.ToArray());
return script.CreateCoroutine(script.Globals["onEventStarted"]).Coroutine;
else
return null;
}
else
{
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
return null;
}
}