mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Non-npc stuff is now also using script system. Wrote new scripts for all sidemenu commands.
This commit is contained in:
		| @@ -246,12 +246,8 @@ namespace FFXIVClassic_Map_Server | |||||||
|                             */ |                             */ | ||||||
|  |  | ||||||
|                             Actor ownerActor = Server.GetStaticActors(eventStart.scriptOwnerActorID); |                             Actor ownerActor = Server.GetStaticActors(eventStart.scriptOwnerActorID); | ||||||
|                             if (ownerActor != null && ownerActor is Command) |                              | ||||||
|                             { |                             if (ownerActor != null)            | ||||||
|                                 player.GetActor().currentCommand = eventStart.scriptOwnerActorID; |  | ||||||
|                                 player.GetActor().currentCommandName = eventStart.triggerName; |  | ||||||
|                             } |  | ||||||
|                             else |  | ||||||
|                             { |                             { | ||||||
|                                 player.GetActor().currentEventOwner = eventStart.scriptOwnerActorID; |                                 player.GetActor().currentEventOwner = eventStart.scriptOwnerActorID; | ||||||
|                                 player.GetActor().currentEventName = eventStart.triggerName; |                                 player.GetActor().currentEventName = eventStart.triggerName; | ||||||
|   | |||||||
| @@ -82,9 +82,6 @@ namespace FFXIVClassic_Map_Server.Actors | |||||||
|         public uint currentEventOwner = 0; |         public uint currentEventOwner = 0; | ||||||
|         public string currentEventName = ""; |         public string currentEventName = ""; | ||||||
|  |  | ||||||
|         public uint currentCommand = 0; |  | ||||||
|         public string currentCommandName = ""; |  | ||||||
|  |  | ||||||
|         public Coroutine currentEventRunning; |         public Coroutine currentEventRunning; | ||||||
|  |  | ||||||
|         //Player Info |         //Player Info | ||||||
| @@ -1137,7 +1134,11 @@ namespace FFXIVClassic_Map_Server.Actors | |||||||
|                 currentEventRunning.Resume(objects.ToArray()); |                 currentEventRunning.Resume(objects.ToArray()); | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|                 LuaEngine.DoActorOnEventStarted(this, owner, start); |             { | ||||||
|  |                 currentEventRunning = LuaEngine.DoActorOnEventStarted(this, owner, start); | ||||||
|  |                 currentEventRunning.Resume(objects.ToArray()); | ||||||
|  |             } | ||||||
|  |                  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public void UpdateEvent(EventUpdatePacket update) |         public void UpdateEvent(EventUpdatePacket update) | ||||||
| @@ -1181,18 +1182,9 @@ namespace FFXIVClassic_Map_Server.Actors | |||||||
|  |  | ||||||
|             currentEventOwner = 0; |             currentEventOwner = 0; | ||||||
|             currentEventName = ""; |             currentEventName = ""; | ||||||
|  |             currentEventRunning = null; | ||||||
|         } |         } | ||||||
|  |          | ||||||
|         public void EndCommand() |  | ||||||
|         { |  | ||||||
|             SubPacket p = EndEventPacket.BuildPacket(actorId, currentCommand, currentCommandName); |  | ||||||
|             p.DebugPrintSubPacket(); |  | ||||||
|             QueuePacket(p); |  | ||||||
|  |  | ||||||
|             currentCommand = 0; |  | ||||||
|             currentCommandName = ""; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         public void SendInstanceUpdate() |         public void SendInstanceUpdate() | ||||||
|         { |         { | ||||||
|             |             | ||||||
|   | |||||||
| @@ -54,9 +54,9 @@ namespace FFXIVClassic_Map_Server.lua | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             return null; |             return null; | ||||||
|         }        |         } | ||||||
|  |  | ||||||
|         public static void DoActorOnEventStarted(Player player, Actor target, EventStartPacket eventStart) |         public static Coroutine DoActorOnEventStarted(Player player, Actor target, EventStartPacket eventStart) | ||||||
|         {            |         {            | ||||||
|             string luaPath; |             string luaPath; | ||||||
|  |  | ||||||
| @@ -76,24 +76,17 @@ namespace FFXIVClassic_Map_Server.lua | |||||||
|                 Script script = LoadScript(luaPath); |                 Script script = LoadScript(luaPath); | ||||||
|  |  | ||||||
|                 if (script == null) |                 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()) |                 if (!script.Globals.Get("onEventStarted").IsNil()) | ||||||
|                     script.Call(script.Globals["onEventStarted"], objects.ToArray()); |                     return script.CreateCoroutine(script.Globals["onEventStarted"]).Coroutine; | ||||||
|  |                 else | ||||||
|  |                     return null; | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName())); |                 SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName())); | ||||||
|  |                 return null; | ||||||
|             } |             } | ||||||
|             |             | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ function init(npc) | |||||||
| 	return false, false, 0, 0;	 | 	return false, false, 0, 0;	 | ||||||
| end | end | ||||||
|  |  | ||||||
| function onEventStarted(player, npc) | function onEventStarted(player, npc, triggerName) | ||||||
|  |  | ||||||
| 	require("/unique/".. npc.zone.zoneName .."/PopulaceShopSalesman/" .. npc:GetUniqueId()) | 	require("/unique/".. npc.zone.zoneName .."/PopulaceShopSalesman/" .. npc:GetUniqueId()) | ||||||
| 	 | 	 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user