added status effect loading

- todo: populate table (and test this doesnt break everything ever), send charawork and message packets
This commit is contained in:
Tahir Akhlaq 2017-07-15 19:33:47 +01:00
parent 13af16ec0e
commit d9d185d7e6
12 changed files with 360 additions and 379 deletions

View file

@ -16,6 +16,7 @@ using FFXIVClassic_Map_Server.lua;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.actors.area;
using System.Threading;
using FFXIVClassic_Map_Server.actors.chara.ai;
namespace FFXIVClassic_Map_Server.lua
{
@ -163,6 +164,33 @@ namespace FFXIVClassic_Map_Server.lua
}
}
public static int CallLuaStatusEffectFunction(Character actor, StatusEffect effect, string functionName, params object[] args)
{
string path = $"./scripts/effects/{effect.GetName()}.lua";
if (File.Exists(path))
{
var script = LoadGlobals();
try
{
script.DoFile(path);
}
catch (Exception e)
{
Program.Log.Error($"LuaEngine.CallLuaStatusEffectFunction [{functionName}] {e.Message}");
}
DynValue res = new DynValue();
if (!script.Globals.Get(functionName).IsNil())
{
res = script.Call(script.Globals.Get(functionName), args);
return (int)res.Number;
}
}
return -1;
}
private static string GetScriptPath(Actor target)
{
if (target is Player)