mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Redid the database, actor_class and npclist was combined. Added commands to the lua engine. Script will default to a PopulaceStandard if no script detected to avoid crashing. Static Actors now loaded from the static actors file.
This commit is contained in:
		| @@ -18,7 +18,7 @@ namespace FFXIVClassic_Map_Server.lua | ||||
| { | ||||
|     class LuaEngine | ||||
|     { | ||||
|         const string FILEPATH_COMMANDS = "./scripts/command/{0}.lua"; | ||||
|         const string FILEPATH_COMMANDS = "./scripts/commands/{0}.lua"; | ||||
|         const string FILEPATH_NPCS = "./scripts/zones/{0}/npcs/{1}.lua"; | ||||
|  | ||||
|         public LuaEngine() | ||||
| @@ -38,7 +38,7 @@ namespace FFXIVClassic_Map_Server.lua | ||||
|                     Script script = new Script(); | ||||
|                     script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors; | ||||
|                     script.DoFile(luaPath); | ||||
|                     DynValue result = script.Call(script.Globals["onInstantiate"], player, target); | ||||
|                     DynValue result = script.Call(script.Globals["onInstantiate"], target); | ||||
|                     List<LuaParam> lparams = LuaUtils.createLuaParamList(result); | ||||
|                     return lparams; | ||||
|                 } | ||||
| @@ -109,7 +109,16 @@ namespace FFXIVClassic_Map_Server.lua | ||||
|                     Script script = new Script(); | ||||
|                     script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors; | ||||
|                     script.DoFile(luaPath); | ||||
|                     DynValue result = script.Call(script.Globals["onEventUpdate"], player, target, eventUpdate.step, eventUpdate.luaParams); | ||||
|  | ||||
|                     //Have to do this to combine LuaParams | ||||
|                     List<Object> objects = new List<Object>(); | ||||
|                     objects.Add(player); | ||||
|                     objects.Add(target); | ||||
|                     objects.Add(eventUpdate.step); | ||||
|                     objects.AddRange(LuaUtils.createLuaParamObjectList(eventUpdate.luaParams)); | ||||
|  | ||||
|                     //Run Script | ||||
|                     DynValue result = script.Call(script.Globals["onEventUpdate"], objects.ToArray()); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
| @@ -117,7 +126,7 @@ namespace FFXIVClassic_Map_Server.lua | ||||
|                     sendError.Add(EndEventPacket.buildPacket(player.actorId, player.playerSession.eventCurrentOwner, player.playerSession.eventCurrentStarter)); | ||||
|                     player.sendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, "", String.Format("ERROR: Could not find script for actor {0}.", target.getName())); | ||||
|                     player.playerSession.queuePacket(BasePacket.createPacket(sendError, true, false)); | ||||
|                 } | ||||
|                 }        | ||||
|             } | ||||
|             else if (target is Npc) | ||||
|             { | ||||
|   | ||||
| @@ -267,6 +267,11 @@ namespace FFXIVClassic_Map_Server | ||||
|             else if (o is int) | ||||
|             { | ||||
|                 luaParams.Add(new LuaParam(0x0, (int)o)); | ||||
|             }                 | ||||
|             else if (o is double) | ||||
|             { | ||||
|                 if (((double)o) % 1 == 0) | ||||
|                     luaParams.Add(new LuaParam(0x0, (uint)(double)o)); | ||||
|             } | ||||
|             else if (o is string) | ||||
|             { | ||||
| @@ -302,6 +307,9 @@ namespace FFXIVClassic_Map_Server | ||||
|        | ||||
|         public static string dumpParams(List<LuaParam> lParams) | ||||
|         { | ||||
|             if (lParams == null) | ||||
|                 return "Param list was null?"; | ||||
|  | ||||
|             string dumpString = ""; | ||||
|             for (int i = 0; i < lParams.Count; i++) | ||||
|             { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user