diff --git a/FFXIVClassic Lobby Server/ClientConnection.cs b/FFXIVClassic Lobby Server/ClientConnection.cs index 1a24974a..76e77fd9 100644 --- a/FFXIVClassic Lobby Server/ClientConnection.cs +++ b/FFXIVClassic Lobby Server/ClientConnection.cs @@ -76,6 +76,7 @@ namespace FFXIVClassic_Lobby_Server public void disconnect() { + socket.Shutdown(SocketShutdown.Both); socket.Disconnect(false); } } diff --git a/FFXIVClassic Lobby Server/Server.cs b/FFXIVClassic Lobby Server/Server.cs index 3f81fbbc..47bfd73d 100644 --- a/FFXIVClassic Lobby Server/Server.cs +++ b/FFXIVClassic Lobby Server/Server.cs @@ -51,9 +51,9 @@ namespace FFXIVClassic_Lobby_Server #region Socket Handling public bool startServer() { - cleanupThread = new Thread(new ThreadStart(socketCleanup)); - cleanupThread.Name = "LobbyThread:Cleanup"; - cleanupThread.Start(); + //cleanupThread = new Thread(new ThreadStart(socketCleanup)); + //cleanupThread.Name = "LobbyThread:Cleanup"; + //cleanupThread.Start(); IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_LOBBY_PORT); @@ -147,7 +147,7 @@ namespace FFXIVClassic_Lobby_Server bytesRead += conn.lastPartialSize; - if (bytesRead >= 0) + if (bytesRead > 0) { int offset = 0; @@ -187,6 +187,7 @@ namespace FFXIVClassic_Lobby_Server lock (mConnectionList) { + conn.disconnect(); mConnectionList.Remove(conn); } } diff --git a/FFXIVClassic Map Server/PacketProcessor.cs b/FFXIVClassic Map Server/PacketProcessor.cs index 2632cc4c..9e63b549 100644 --- a/FFXIVClassic Map Server/PacketProcessor.cs +++ b/FFXIVClassic Map Server/PacketProcessor.cs @@ -178,7 +178,7 @@ namespace FFXIVClassic_Lobby_Server case 0x0002: client.queuePacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "-------- Login Message --------\nWelcome to the 1.0 Dev Server"), true, false); - mServer.GetWorldManager().DoLogin(player.getActor()); + Server.GetWorldManager().DoLogin(player.getActor()); break; @@ -239,23 +239,23 @@ namespace FFXIVClassic_Lobby_Server } */ player.getActor().eventCurrentOwner = eventStart.scriptOwnerActorID; - player.getActor().eventCurrentStarter = eventStart.eventStarter; + player.getActor().eventCurrentStarter = eventStart.triggerName; //Is it a static actor? If not look in the player's instance Actor ownerActor = Server.getStaticActors(player.getActor().eventCurrentOwner); if (ownerActor == null) { - ownerActor = mServer.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); + ownerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); if (ownerActor == null) { - Log.debug(String.Format("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.eventStarter, LuaUtils.dumpParams(eventStart.luaParams))); + Log.debug(String.Format("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams))); break; } } LuaEngine.doActorOnEventStarted(player.getActor(), ownerActor, eventStart); - Log.debug(String.Format("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.eventStarter, LuaUtils.dumpParams(eventStart.luaParams))); + Log.debug(String.Format("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams))); break; //Event Result case 0x012E: @@ -267,7 +267,7 @@ namespace FFXIVClassic_Lobby_Server Actor updateOwnerActor = Server.getStaticActors(player.getActor().eventCurrentOwner); if (updateOwnerActor == null) { - updateOwnerActor = mServer.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); + updateOwnerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); if (updateOwnerActor == null) break; } diff --git a/FFXIVClassic Map Server/Server.cs b/FFXIVClassic Map Server/Server.cs index ccc3d29e..edcee854 100644 --- a/FFXIVClassic Map Server/Server.cs +++ b/FFXIVClassic Map Server/Server.cs @@ -37,7 +37,7 @@ namespace FFXIVClassic_Lobby_Server private List mConnectionList = new List(); private LuaEngine mLuaEngine = new LuaEngine(); - private WorldManager mWorldManager; + private static WorldManager mWorldManager; private static Dictionary gamedataItems; private static StaticActors mStaticActors; @@ -450,7 +450,7 @@ namespace FFXIVClassic_Lobby_Server } } - public WorldManager GetWorldManager() + public static WorldManager GetWorldManager() { return mWorldManager; } diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index d71988ce..d161efcf 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -403,6 +403,46 @@ namespace FFXIVClassic_Map_Server LuaEngine.onZoneIn(player); } + //Moves actor within zone to spawn position + public void DoPlayerMoveInZone(Player player, uint zoneEntrance) + { + if (!zoneEntranceList.ContainsKey(zoneEntrance)) + { + Log.error("Given zone entrance was not found: " + zoneEntrance); + return; + } + + ZoneEntrance ze = zoneEntranceList[zoneEntrance]; + + if (ze.zoneId != player.zoneId) + return; + + DoPlayerMoveInZone(player, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation); + } + + //Moves actor within the zone + public void DoPlayerMoveInZone(Player player, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation) + { + //Remove player from currentZone if transfer else it's login + if (player.zone != null) + { + player.zone.removeActorFromZone(player); + player.zone.addActorToZone(player); + + //Update player actor's properties; + player.positionX = spawnX; + player.positionY = spawnY; + player.positionZ = spawnZ; + player.rotation = spawnRotation; + + //Send packets + player.playerSession.queuePacket(_0xE2Packet.buildPacket(player.actorId, 0x0), true, false); + player.playerSession.queuePacket(player.createSpawnTeleportPacket(player.actorId, 0x0f), true, false); + player.sendInstanceUpdate(); + + } + } + //Login Zone In public void DoLogin(Player player) { diff --git a/FFXIVClassic Map Server/actors/Actor.cs b/FFXIVClassic Map Server/actors/Actor.cs index dcb6bd89..e66c34df 100644 --- a/FFXIVClassic Map Server/actors/Actor.cs +++ b/FFXIVClassic Map Server/actors/Actor.cs @@ -93,6 +93,22 @@ namespace FFXIVClassic_Map_Server.Actors //return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); spawnedFirstTime = true; + + spawnPacket.debugPrintSubPacket(); + + return spawnPacket; + } + + public SubPacket createSpawnTeleportPacket(uint playerActorId, uint spawnType) + { + SubPacket spawnPacket; + + spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, false); + + //return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE); + + spawnPacket.debugPrintSubPacket(); + return spawnPacket; } @@ -176,7 +192,7 @@ namespace FFXIVClassic_Map_Server.Actors if (eventConditions.emoteEventConditions != null) { foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions) - subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 1, condition.conditionName)); + subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 3, condition.conditionName)); } if (eventConditions.pushWithCircleEventConditions != null) diff --git a/FFXIVClassic Map Server/actors/EventList.cs b/FFXIVClassic Map Server/actors/EventList.cs index fc2c780e..b1559522 100644 --- a/FFXIVClassic Map Server/actors/EventList.cs +++ b/FFXIVClassic Map Server/actors/EventList.cs @@ -18,7 +18,7 @@ namespace FFXIVClassic_Map_Server.actors public class TalkEventCondition { public byte unknown1; - public byte unknown2; + public bool isDisabled = false; public string conditionName; } diff --git a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs index 70eed95f..9e43c677 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs @@ -49,7 +49,7 @@ namespace FFXIVClassic_Map_Server.Actors { List lParams; - Player player = Server.getServer().GetWorldManager().GetPCInWorld(playerActorId); + Player player = Server.GetWorldManager().GetPCInWorld(playerActorId); lParams = LuaEngine.doActorOnInstantiate(player, this); if (lParams == null) diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index 16d86bb1..7617882c 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -118,6 +118,10 @@ namespace FFXIVClassic_Map_Server.Actors private int lastPosition = 0; private int lastStep = 0; + //Quest Actors (MUST MATCH playerWork.questScenario/questGuildleve) + public Quest[] questScenario = new Quest[16]; + public Quest[] questGuildleve = new Quest[8]; + public PlayerWork playerWork = new PlayerWork(); public ConnectedPlayer playerSession; @@ -704,34 +708,34 @@ namespace FFXIVClassic_Map_Server.Actors { if (msgParams.Length == 0) { - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log)); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log)); } else - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams))); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams))); } public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, params object[] msgParams) { if (msgParams.Length == 0) - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log)); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log)); else - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams))); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.createLuaParamList(msgParams))); } public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, string customSender, params object[] msgParams) { if (msgParams.Length == 0) - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log)); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log)); else - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.createLuaParamList(msgParams))); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.createLuaParamList(msgParams))); } public void sendGameMessage(Actor textIdOwner, ushort textId, byte log, uint displayId, params object[] msgParams) { if (msgParams.Length == 0) - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log)); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log)); else - queuePacket(GameMessagePacket.buildPacket(Server.getServer().GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.createLuaParamList(msgParams))); + queuePacket(GameMessagePacket.buildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.createLuaParamList(msgParams))); } public void broadcastWorldMessage(ushort worldMasterId, params object[] msgParams) @@ -920,7 +924,7 @@ namespace FFXIVClassic_Map_Server.Actors Database.savePlayerAppearance(this); broadcastPacket(createAppearancePacket(actorId), true); - } + } public Inventory getInventory(ushort type) { diff --git a/FFXIVClassic Map Server/actors/quest/Quest.cs b/FFXIVClassic Map Server/actors/quest/Quest.cs index e15fb7bd..c125548e 100644 --- a/FFXIVClassic Map Server/actors/quest/Quest.cs +++ b/FFXIVClassic Map Server/actors/quest/Quest.cs @@ -1,13 +1,14 @@ -using System; +using FFXIVClassic_Lobby_Server.common; +using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace FFXIVClassic_Map_Server.Actors { class Quest : Actor { + private int currentPhase = 0; + private uint questFlags = 0; + private Dictionary questData = new Dictionary(); public Quest(uint actorID, string name) : base(actorID) @@ -15,5 +16,70 @@ namespace FFXIVClassic_Map_Server.Actors actorName = name; } + public void InitQuestData(string dataName, object initialValue) + { + questData[dataName] = initialValue; + } + + public void UpdateQuestData(string dataName, object data) + { + if (questData.ContainsKey(dataName)) + questData[dataName] = data; + + //Inform update + } + + public object GetQuestData(string dataName) + { + if (questData.ContainsKey(dataName)) + return questData[dataName]; + else + return null; + } + + public uint GetQuestId() + { + return actorId; + } + + public void SetQuestFlag(int bitIndex, bool value) + { + if (bitIndex >= 32) + { + Log.error(String.Format("Tried to access bit flag >= 32 for questId: {0}", actorId)); + return; + } + + int mask = 1 << bitIndex; + + if (value) + questFlags |= (uint)(1 << bitIndex); + else + questFlags &= (uint)~(1 << bitIndex); + + //Inform update + } + + public bool GetQuestFlag(int bitIndex) + { + if (bitIndex >= 32) + { + Log.error(String.Format("Tried to access bit flag >= 32 for questId: {0}", actorId)); + return false; + } + else + return (questFlags & (1 << bitIndex)) == 1; + } + + public int GetPhase() + { + return currentPhase; + } + + public void NextPhase() + { + currentPhase++; + } + } } diff --git a/FFXIVClassic Map Server/lua/LuaEngine.cs b/FFXIVClassic Map Server/lua/LuaEngine.cs index 59e7a782..2801a6fb 100644 --- a/FFXIVClassic Map Server/lua/LuaEngine.cs +++ b/FFXIVClassic Map Server/lua/LuaEngine.cs @@ -41,7 +41,7 @@ namespace FFXIVClassic_Map_Server.lua Script script = new Script(); ((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" }; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getServer().GetWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(luaPath); DynValue result = script.Call(script.Globals["onInstantiate"], target); @@ -76,8 +76,9 @@ namespace FFXIVClassic_Map_Server.lua { Script script = new Script(); ((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" }; + script.Globals["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getServer().GetWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(luaPath); @@ -85,6 +86,7 @@ namespace FFXIVClassic_Map_Server.lua List objects = new List(); objects.Add(player); objects.Add(target); + objects.Add(eventStart.triggerName); objects.AddRange(LuaUtils.createLuaParamObjectList(eventStart.luaParams)); //Run Script @@ -113,8 +115,9 @@ namespace FFXIVClassic_Map_Server.lua { Script script = new Script(); ((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" }; + script.Globals["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getServer().GetWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(luaPath); @@ -145,8 +148,9 @@ namespace FFXIVClassic_Map_Server.lua { Script script = new Script(); ((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" }; + script.Globals["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getServer().GetWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(luaPath); @@ -161,8 +165,9 @@ namespace FFXIVClassic_Map_Server.lua { Script script = new Script(); ((ScriptLoaderBase)script.Options.ScriptLoader).ModulePaths = new string[] { "./scripts/?", "./scripts/?.lua" }; + script.Globals["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getServer().GetWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(FILEPATH_PLAYER); diff --git a/FFXIVClassic Map Server/packets/receive/events/EventStartPacket.cs b/FFXIVClassic Map Server/packets/receive/events/EventStartPacket.cs index 835972fc..3f5e7993 100644 --- a/FFXIVClassic Map Server/packets/receive/events/EventStartPacket.cs +++ b/FFXIVClassic Map Server/packets/receive/events/EventStartPacket.cs @@ -26,7 +26,7 @@ namespace FFXIVClassic_Map_Server.packets.receive.events public uint errorNum; public string error = null; - public string eventStarter; + public string triggerName; public List luaParams; @@ -62,7 +62,7 @@ namespace FFXIVClassic_Map_Server.packets.receive.events { strList.Add(curByte); } - eventStarter = Encoding.ASCII.GetString(strList.ToArray()); + triggerName = Encoding.ASCII.GetString(strList.ToArray()); binReader.BaseStream.Seek(0x31, SeekOrigin.Begin); diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs index da84c606..64a6ba49 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetEmoteEventCondition.cs @@ -22,9 +22,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - binWriter.Write((Byte)condition.unknown1); - binWriter.Write((Byte)condition.unknown2); - binWriter.Write((UInt16)condition.emoteId); + binWriter.Write((Byte)condition.unknown1); //4 + binWriter.Write((UInt16)condition.emoteId); //82, 76, 6E binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs index 9e4d8b0a..67a4a3dd 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs @@ -22,8 +22,9 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events { using (BinaryWriter binWriter = new BinaryWriter(mem)) { + condition.unknown1 = 4; binWriter.Write((Byte)condition.unknown1); - binWriter.Write((Byte)condition.unknown2); + binWriter.Write((Byte)(condition.isDisabled ? 0x1 : 0x0)); binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } } diff --git a/scripts/commands/ActivateCommand.lua b/scripts/commands/ActivateCommand.lua index 347ce39d..898665c6 100644 --- a/scripts/commands/ActivateCommand.lua +++ b/scripts/commands/ActivateCommand.lua @@ -6,7 +6,7 @@ Switches between active and passive mode states --]] -function onEventStarted(player, actor) +function onEventStarted(player, actor, triggerName) if (player:getState() == 0) then player:changeState(2); diff --git a/scripts/commands/AttackWeaponSkill.lua b/scripts/commands/AttackWeaponSkill.lua index 83af12dc..7329b613 100644 --- a/scripts/commands/AttackWeaponSkill.lua +++ b/scripts/commands/AttackWeaponSkill.lua @@ -8,7 +8,7 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti -function onEventStarted(player, actor) +function onEventStarted(player, actor, triggerName) worldMaster = getWorldMaster(); diff --git a/scripts/commands/BonusPointCommand.lua b/scripts/commands/BonusPointCommand.lua index b73477b0..d6e95444 100644 --- a/scripts/commands/BonusPointCommand.lua +++ b/scripts/commands/BonusPointCommand.lua @@ -8,7 +8,7 @@ operateUI(pointsAvailable, pointsLimit, str, vit, dex, int, min, pie) --]] -function onEventStarted(player, actor) +function onEventStarted(player, actor, triggerName) --local points = player:getAttributePoints(); --player:runEventFunction("delegateCommand", actor, "operateUI", points.available, points.limit, points.inSTR, points.inVIT, points.inDEX, points.inINT, points.inMIN, points.inPIT); player:runEventFunction("delegateCommand", actor, "operateUI", 10, 10, 10, 10, 10, 10, 10, 10); diff --git a/scripts/commands/CheckCommand.lua b/scripts/commands/CheckCommand.lua index f5c20c0a..6800f279 100644 --- a/scripts/commands/CheckCommand.lua +++ b/scripts/commands/CheckCommand.lua @@ -6,7 +6,7 @@ Handles player examining someone --]] -function onEventStarted(player, commandactor, arg1, arg2, arg3, arg4, checkedActorId) +function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId) actor = player:getActorInInstance(checkedActorId); diff --git a/scripts/commands/ChocoboRideCommand.lua b/scripts/commands/ChocoboRideCommand.lua index 5d3814d5..3c95e3da 100644 --- a/scripts/commands/ChocoboRideCommand.lua +++ b/scripts/commands/ChocoboRideCommand.lua @@ -6,7 +6,7 @@ Handles mounting and dismounting the Chocobo and Goobbue --]] -function onEventStarted(player, actor, isGoobbue) +function onEventStarted(player, actor, triggerName, isGoobbue) if (player:getState() == 0) then diff --git a/scripts/commands/DiceCommand.lua b/scripts/commands/DiceCommand.lua index 00dfdce8..b48e4e37 100644 --- a/scripts/commands/DiceCommand.lua +++ b/scripts/commands/DiceCommand.lua @@ -4,7 +4,7 @@ DiceCommand Script --]] -function onEventStarted(player, actor, maxNumber) +function onEventStarted(player, actor, triggerName, maxNumber) if (maxNumber == nil) then maxNumber = 999; diff --git a/scripts/commands/EmoteSitCommand.lua b/scripts/commands/EmoteSitCommand.lua index 19296a12..e244a436 100644 --- a/scripts/commands/EmoteSitCommand.lua +++ b/scripts/commands/EmoteSitCommand.lua @@ -4,7 +4,7 @@ EmoteSitCommand Script --]] -function onEventStarted(player, actor, emoteId) +function onEventStarted(player, actor, triggerName, emoteId) if (player:getState() == 0) then if (emoteId == 0x2712) then diff --git a/scripts/commands/EmoteStandardCommand.lua b/scripts/commands/EmoteStandardCommand.lua index b481b027..dac96794 100644 --- a/scripts/commands/EmoteStandardCommand.lua +++ b/scripts/commands/EmoteStandardCommand.lua @@ -9,7 +9,7 @@ emoteTable = { }; -function onEventStarted(player, actor, emoteId) +function onEventStarted(player, actor, triggerName, emoteId) if (player:getState() == 0) then player:doEmote(emoteId); diff --git a/scripts/commands/EquipCommand.lua b/scripts/commands/EquipCommand.lua index 5e7d93c3..d9c4ad02 100644 --- a/scripts/commands/EquipCommand.lua +++ b/scripts/commands/EquipCommand.lua @@ -53,7 +53,7 @@ GRAPHICSLOT_L_RINGFINGER = 24; GRAPHICSLOT_R_INDEXFINGER = 25; GRAPHICSLOT_L_INDEXFINGER = 26; -function onEventStarted(player, actor, invActionInfo, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds) +function onEventStarted(player, actor, triggerName, invActionInfo, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds) equipSlot = equipSlot-1; --Equip Item diff --git a/scripts/commands/ItemWasteCommand.lua b/scripts/commands/ItemWasteCommand.lua index d208124b..78e568c8 100644 --- a/scripts/commands/ItemWasteCommand.lua +++ b/scripts/commands/ItemWasteCommand.lua @@ -9,7 +9,7 @@ The param "itemDBIds" has the vars: item1 and item2. --]] -function onEventStarted(player, actor, invActionInfo, param1, param2, param3, param4, param5, param6, param7, param8, itemDBIds) +function onEventStarted(player, actor, triggerName, invActionInfo, param1, param2, param3, param4, param5, param6, param7, param8, itemDBIds) player:getInventory(0x00):removeItem(invActionInfo.slot); player:endEvent(); end diff --git a/scripts/commands/LogoutCommand.lua b/scripts/commands/LogoutCommand.lua index 727e5a95..9ccd3deb 100644 --- a/scripts/commands/LogoutCommand.lua +++ b/scripts/commands/LogoutCommand.lua @@ -20,7 +20,7 @@ function onEventStarted(player, command) player:runEventFunction("delegateCommand", command, "eventConfirm"); end -function onEventUpdate(player, command, step, arg1, arg2) +function onEventUpdate(player, command, triggerName, step, arg1, arg2) currentMenuId = player:getCurrentMenuId(); diff --git a/scripts/commands/RequestInformationCommand.lua b/scripts/commands/RequestInformationCommand.lua index c16e66ce..1b13672d 100644 --- a/scripts/commands/RequestInformationCommand.lua +++ b/scripts/commands/RequestInformationCommand.lua @@ -8,6 +8,6 @@ function onEventStarted(player, actor, questId) -- player:sendRequestedInfo("requestedData", "glHist", 10, 0x1D4F2, 1009, 12464, 11727, 12485, 12526); end -function onEventUpdate(player, actor, step, arg1) +function onEventUpdate(player, actor, triggerName, step, arg1) end \ No newline at end of file diff --git a/scripts/commands/RequestQuestJournalCommand.lua b/scripts/commands/RequestQuestJournalCommand.lua index e90a91ba..85ec082e 100644 --- a/scripts/commands/RequestQuestJournalCommand.lua +++ b/scripts/commands/RequestQuestJournalCommand.lua @@ -7,6 +7,6 @@ function onEventStarted(player, actor, questId) player:sendRequestedInfo("requestedData", "qtdata", 0x1D4F2); end -function onEventUpdate(player, actor, step, arg1) +function onEventUpdate(player, actor, triggerName, step, arg1) end \ No newline at end of file diff --git a/scripts/commands/TeleportCommand.lua b/scripts/commands/TeleportCommand.lua index ddcdcb0c..05b893c9 100644 --- a/scripts/commands/TeleportCommand.lua +++ b/scripts/commands/TeleportCommand.lua @@ -16,7 +16,7 @@ Confirm Menu: 2 --]] -function onEventStarted(player, actor, isTeleport) +function onEventStarted(player, actor, triggerName, isTeleport) if (isTeleport == 0) then player:setCurrentMenuId(0); player:runEventFunction("delegateCommand", actor, "eventRegion", 100); diff --git a/scripts/zones/133/npcs/aetheryteP_01@08500.lua b/scripts/zones/133/npcs/aetheryteP_01@08500.lua index 8f5b879e..e252c1d1 100644 --- a/scripts/zones/133/npcs/aetheryteP_01@08500.lua +++ b/scripts/zones/133/npcs/aetheryteP_01@08500.lua @@ -24,7 +24,7 @@ function onInstantiate(npc) return "/Chara/Npc/Object/Aetheryte/AetheryteParent", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST"; end -function onEventStarted(player, npc) +function onEventStarted(player, npc, triggerName) player:runEventFunction("eventAetheryteParentSelect", 0x0, false, 0x61, 0x0,0,0,0,0); end diff --git a/scripts/zones/166/npcs/openingStop_fstBtl03_03@0A600.lua b/scripts/zones/166/npcs/openingStop_fstBtl03_03@0A600.lua new file mode 100644 index 00000000..3e1d2f67 --- /dev/null +++ b/scripts/zones/166/npcs/openingStop_fstBtl03_03@0A600.lua @@ -0,0 +1,13 @@ +function onInstantiate(npc) + return "/Chara/Npc/Object/OpeningStoperF0B1", false, false, false, false, false, 0x10A350, false, false, 0, 1, "TEST"; +end + +function onEventStarted(player, npc, triggerName) + if (triggerName == "caution") then + worldMaster = getWorldMaster(); + player:sendGameMessage(player, worldMaster, 34109, 0x20); + elseif (triggerName == "exit") then + getWorldManager():DoPlayerMoveInZone(player, 5); + end + player:endEvent(); +end \ No newline at end of file diff --git a/scripts/zones/166/zone.lua b/scripts/zones/166/zone.lua new file mode 100644 index 00000000..703d61b9 --- /dev/null +++ b/scripts/zones/166/zone.lua @@ -0,0 +1,10 @@ + + +function onZoneInit(zone) +end + +function onZoneIn(zone, player) +end + +function onZoneOut(zone, player) +end \ No newline at end of file diff --git a/scripts/zones/193/npcs/pplStd_11@0C100.lua b/scripts/zones/193/npcs/pplStd_11@0C100.lua index 7448d456..8d43ebf5 100644 --- a/scripts/zones/193/npcs/pplStd_11@0C100.lua +++ b/scripts/zones/193/npcs/pplStd_11@0C100.lua @@ -2,7 +2,7 @@ function onInstantiate(npc) return "/Chara/Npc/Populace/PopulaceTutorial", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST"; end -function onEventStarted(player, npc) +function onEventStarted(player, npc, triggerName) man0l0Quest = getStaticActor("Man0l0"); player:runEventFunction("delegateEvent", player, man0l0Quest, "processTtrNomal003", nil, nil, nil); --player:runEventFunction("delegateEvent", player, defaultSea, "defaultTalkWithFrithuric_002", nil, nil, nil); --LTW diff --git a/scripts/zones/244/npcs/objBed_01@0F400.lua b/scripts/zones/244/npcs/objBed_01@0F400.lua index 3f0cce38..de11bf32 100644 --- a/scripts/zones/244/npcs/objBed_01@0F400.lua +++ b/scripts/zones/244/npcs/objBed_01@0F400.lua @@ -2,7 +2,7 @@ function onInstantiate(npc) return "/Chara/Npc/Object/ObjectBed", false, false, false, false, false, 0x1250FB, false, false, 0, 1, "TEST"; end -function onEventStarted(player, npc) +function onEventStarted(player, npc, triggerName) player:runEventFunction("askLogout", player); end diff --git a/scripts/zones/244/npcs/objInnDoor_01@0F400.lua b/scripts/zones/244/npcs/objInnDoor_01@0F400.lua index 59e9eb69..0f279f41 100644 --- a/scripts/zones/244/npcs/objInnDoor_01@0F400.lua +++ b/scripts/zones/244/npcs/objInnDoor_01@0F400.lua @@ -2,7 +2,7 @@ function onInstantiate(npc) return "/Chara/Npc/Object/ObjectInnDoor", false, false, false, false, false, 0x1250F8, false, false, 0, 1, "TEST"; end -function onEventStarted(player, npc) +function onEventStarted(player, npc, triggerName) end function onEventUpdate(player, npc) diff --git a/scripts/zones/244/npcs/objItemStore_01@0F400.lua b/scripts/zones/244/npcs/objItemStore_01@0F400.lua index ab605060..7a9c2b74 100644 --- a/scripts/zones/244/npcs/objItemStore_01@0F400.lua +++ b/scripts/zones/244/npcs/objItemStore_01@0F400.lua @@ -2,7 +2,7 @@ function onInstantiate(npc) return "/Chara/Npc/Object/ObjectItemStorage", false, false, false, false, false, 0x1250F8, false, false, 0, 1, "TEST"; end -function onEventStarted(player, npc) +function onEventStarted(player, npc, triggerName) end function onEventUpdate(player, npc) diff --git a/scripts/zones/244/npcs/pplCutscene_01@0F400.lua b/scripts/zones/244/npcs/pplCutscene_01@0F400.lua index ee33a00b..7162a996 100644 --- a/scripts/zones/244/npcs/pplCutscene_01@0F400.lua +++ b/scripts/zones/244/npcs/pplCutscene_01@0F400.lua @@ -2,7 +2,7 @@ function onInstantiate(npc) return "/Chara/Npc/Populace/PopulaceCutScenePlayer", false, false, false, false, false, 0x107B38, false, false, 0, 1, "TEST"; end -function onEventStarted(player, npc) +function onEventStarted(player, npc, triggerName) end function onEventUpdate(player, npc) diff --git a/scripts/zones/244/npcs/test1.lua b/scripts/zones/244/npcs/test1.lua index 8c67d57d..e3943072 100644 --- a/scripts/zones/244/npcs/test1.lua +++ b/scripts/zones/244/npcs/test1.lua @@ -2,7 +2,7 @@ function onInstantiate(npc) return "/Chara/Npc/Populace/PopulaceStandard", false, false, false, false, false, npc.getActorClassId(), false, false, 0, 1, "TEST"; end -function onEventStarted(player, npc) +function onEventStarted(player, npc, triggerName) end function onEventUpdate(player, npc)