From fbf6810c5c35a0d8134e567acee6907f3a1c6ca0 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 15 Jun 2016 20:06:08 -0400 Subject: [PATCH 1/4] Fixed logs on lobby. --- FFXIVClassic Lobby Server/ConfigConstants.cs | 6 +- FFXIVClassic Lobby Server/Program.cs | 123 +++++++++---------- FFXIVClassic Lobby Server/Server.cs | 2 +- data/lobby_config.ini | 2 +- data/map_config.ini | 2 +- 5 files changed, 66 insertions(+), 69 deletions(-) diff --git a/FFXIVClassic Lobby Server/ConfigConstants.cs b/FFXIVClassic Lobby Server/ConfigConstants.cs index 02332dc0..358ceb96 100644 --- a/FFXIVClassic Lobby Server/ConfigConstants.cs +++ b/FFXIVClassic Lobby Server/ConfigConstants.cs @@ -18,11 +18,11 @@ namespace FFXIVClassic_Lobby_Server public static bool Load() { - Program.Log.Info("Loading lobby_config.ini file... "); + Program.Log.Info("Loading lobby_config.ini file"); if (!File.Exists("./lobby_config.ini")) { - Program.Log.Error("[FILE NOT FOUND]"); + Program.Log.Error("FILE NOT FOUND!"); return false; } @@ -38,8 +38,6 @@ namespace FFXIVClassic_Lobby_Server ConfigConstants.DATABASE_USERNAME = configIni.GetValue("Database", "username", ""); ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", ""); - Program.Log.Info("[OK]"); - return true; } } diff --git a/FFXIVClassic Lobby Server/Program.cs b/FFXIVClassic Lobby Server/Program.cs index c5967a87..0bfb56ee 100644 --- a/FFXIVClassic Lobby Server/Program.cs +++ b/FFXIVClassic Lobby Server/Program.cs @@ -1,66 +1,65 @@ -using System; -using System.Diagnostics; -using System.Threading; -using MySql.Data.MySqlClient; -using System.Reflection; -using FFXIVClassic.Common; -using NLog; -namespace FFXIVClassic_Lobby_Server -{ - class Program - { - public static Logger Log; - - static void Main(string[] args) +using System; +using System.Diagnostics; +using System.Threading; +using MySql.Data.MySqlClient; +using System.Reflection; +using FFXIVClassic.Common; +using NLog; +namespace FFXIVClassic_Lobby_Server +{ + class Program + { + public static Logger Log; + + static void Main(string[] args) { // set up logging - Log = LogManager.GetCurrentClassLogger(); -#if DEBUG - TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out); + Log = LogManager.GetCurrentClassLogger(); +#if DEBUG + TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out); Debug.Listeners.Add(myWriter); -#endif - Program.Log.Info("--------FFXIV 1.0 Lobby Server--------"); - - bool startServer = true; - - //Load Config - if (!ConfigConstants.Load()) - startServer = false; - - Assembly assem = Assembly.GetExecutingAssembly(); - Version vers = assem.GetName().Version; - Program.Log.Info("Version: " + vers.ToString()); - - //Test DB Connection - Program.Log.Info("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST); - using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) - { - try - { - conn.Open(); - conn.Close(); - - Program.Log.Info("Connection ok."); - } - catch (MySqlException e) - { - Program.Log.Error(e.ToString()); - startServer = false; - } - } - - //Start Server if A-OK - if (startServer) - { - Server server = new Server(); - server.StartServer(); - } - - Program.Log.Info("Press any key to continue..."); - Console.ReadKey(); - } - - - } -} +#endif + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine("--------FFXIV 1.0 Lobby Server--------"); + Console.ForegroundColor = ConsoleColor.Gray; + + bool startServer = true; + + //Load Config + if (!ConfigConstants.Load()) + startServer = false; + + //Test DB Connection + Program.Log.Info("Testing DB connection to \"{0}\"", ConfigConstants.DATABASE_HOST); + using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) + { + try + { + conn.Open(); + conn.Close(); + + Program.Log.Info("Connection ok."); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + startServer = false; + } + } + + //Start Server if A-OK + if (startServer) + { + Server server = new Server(); + server.StartServer(); + while (true) Thread.Sleep(10000); + } + + Program.Log.Info("Press any key to continue..."); + Console.ReadKey(); + } + + + } +} diff --git a/FFXIVClassic Lobby Server/Server.cs b/FFXIVClassic Lobby Server/Server.cs index 20b08be8..e596ec26 100644 --- a/FFXIVClassic Lobby Server/Server.cs +++ b/FFXIVClassic Lobby Server/Server.cs @@ -81,7 +81,7 @@ namespace FFXIVClassic_Lobby_Server } Console.ForegroundColor = ConsoleColor.White; - Program.Log.Debug("Lobby Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port); + Program.Log.Info("Lobby Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port); Console.ForegroundColor = ConsoleColor.Gray; mProcessor = new PacketProcessor(); diff --git a/data/lobby_config.ini b/data/lobby_config.ini index f8aa676b..2251736f 100644 --- a/data/lobby_config.ini +++ b/data/lobby_config.ini @@ -8,4 +8,4 @@ host=127.0.0.1 port=3306 database=ffxiv_server username=root -password=root +password= diff --git a/data/map_config.ini b/data/map_config.ini index f8aa676b..2251736f 100644 --- a/data/map_config.ini +++ b/data/map_config.ini @@ -8,4 +8,4 @@ host=127.0.0.1 port=3306 database=ffxiv_server username=root -password=root +password= From 8eaa920751da535f5494bea7d3f7d0299837a03e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 15 Jun 2016 20:09:53 -0400 Subject: [PATCH 2/4] Fixed logs on map. --- FFXIVClassic Map Server/ConfigConstants.cs | 6 +- FFXIVClassic Map Server/Program.cs | 166 ++++++++++----------- FFXIVClassic Map Server/Server.cs | 2 +- 3 files changed, 85 insertions(+), 89 deletions(-) diff --git a/FFXIVClassic Map Server/ConfigConstants.cs b/FFXIVClassic Map Server/ConfigConstants.cs index fde393f4..cf4006e6 100644 --- a/FFXIVClassic Map Server/ConfigConstants.cs +++ b/FFXIVClassic Map Server/ConfigConstants.cs @@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server if (!File.Exists("./map_config.ini")) { - Program.Log.Error("[FILE NOT FOUND]"); + Program.Log.Error("FILE NOT FOUND"); return false; } @@ -39,9 +39,7 @@ namespace FFXIVClassic_Map_Server ConfigConstants.DATABASE_NAME = configIni.GetValue("Database", "database", ""); ConfigConstants.DATABASE_USERNAME = configIni.GetValue("Database", "username", ""); ConfigConstants.DATABASE_PASSWORD = configIni.GetValue("Database", "password", ""); - - Program.Log.Info("[OK]"); - + return true; } } diff --git a/FFXIVClassic Map Server/Program.cs b/FFXIVClassic Map Server/Program.cs index eaaa6981..c18ef0c9 100644 --- a/FFXIVClassic Map Server/Program.cs +++ b/FFXIVClassic Map Server/Program.cs @@ -1,87 +1,85 @@ -using System; -using System.Diagnostics; -using System.Threading; -using System.Text; -using MySql.Data.MySqlClient; -using System.Reflection; -using FFXIVClassic_Map_Server.dataobjects; -using FFXIVClassic.Common; -using NLog; -using NLog.Targets; -using NLog.Targets.Wrappers; -using NLog.Config; - -namespace FFXIVClassic_Map_Server -{ - class Program - { - public static Logger Log; - - static void Main(string[] args) +using System; +using System.Diagnostics; +using System.Threading; +using System.Text; +using MySql.Data.MySqlClient; +using System.Reflection; +using FFXIVClassic_Map_Server.dataobjects; +using FFXIVClassic.Common; +using NLog; +using NLog.Targets; +using NLog.Targets.Wrappers; +using NLog.Config; + +namespace FFXIVClassic_Map_Server +{ + class Program + { + public static Logger Log; + + static void Main(string[] args) { // set up logging - Log = LogManager.GetCurrentClassLogger(); -#if DEBUG - TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out); - Debug.Listeners.Add(myWriter); -#endif - bool startServer = true; - - Program.Log.Info("---------FFXIV 1.0 Map Server---------"); - - //Load Config - if (!ConfigConstants.Load()) - startServer = false; - - Assembly assem = Assembly.GetExecutingAssembly(); - Version vers = assem.GetName().Version; - Program.Log.Info("Version: " + vers.ToString()); - - //Test DB Connection - Program.Log.Info("Testing DB connection... "); - using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) - { - try - { - conn.Open(); - conn.Close(); - - Program.Log.Info("Connection ok."); - } - catch (MySqlException e) - { - Program.Log.Error(e.ToString()); - startServer = false; - } - } - - //Check World ID - DBWorld thisWorld = Database.GetServer(ConfigConstants.DATABASE_WORLDID); - if (thisWorld != null) - Program.Log.Info("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name); - else - Program.Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed."); - - //Start server if A-OK - if (startServer) - { - Server server = new Server(); - CommandProcessor cp = new CommandProcessor(server.GetConnectedPlayerList()); - server.StartServer(); - - while (startServer) - { - String input = Console.ReadLine(); - Log.Info("[Console Input] " + input); - cp.DoCommand(input, null); - } - } - - Program.Log.Info("Press any key to continue..."); - Console.ReadKey(); - } - - - } -} + Log = LogManager.GetCurrentClassLogger(); +#if DEBUG + TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out); + Debug.Listeners.Add(myWriter); +#endif + bool startServer = true; + + Console.ForegroundColor = ConsoleColor.Cyan; + Console.WriteLine("---------FFXIV 1.0 Map Server---------"); + Console.ForegroundColor = ConsoleColor.Gray; + + //Load Config + if (!ConfigConstants.Load()) + startServer = false; + + //Test DB Connection + Program.Log.Info("Testing DB connection... "); + using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) + { + try + { + conn.Open(); + conn.Close(); + + Program.Log.Info("Connection ok."); + } + catch (MySqlException e) + { + Program.Log.Error(e.ToString()); + startServer = false; + } + } + + //Check World ID + DBWorld thisWorld = Database.GetServer(ConfigConstants.DATABASE_WORLDID); + if (thisWorld != null) + Program.Log.Info("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name); + else + Program.Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed."); + + //Start server if A-OK + if (startServer) + { + Server server = new Server(); + CommandProcessor cp = new CommandProcessor(server.GetConnectedPlayerList()); + server.StartServer(); + + while (startServer) + { + String input = Console.ReadLine(); + Log.Info("[Console Input] " + input); + cp.DoCommand(input, null); + } + } + + Program.Log.Info("Press any key to continue..."); + Console.ReadKey(); + } + + + } +} diff --git a/FFXIVClassic Map Server/Server.cs b/FFXIVClassic Map Server/Server.cs index f5005496..e7f1f1be 100644 --- a/FFXIVClassic Map Server/Server.cs +++ b/FFXIVClassic Map Server/Server.cs @@ -116,7 +116,7 @@ namespace FFXIVClassic_Map_Server } Console.ForegroundColor = ConsoleColor.White; - Program.Log.Debug("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port); + Program.Log.Info("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port); Console.ForegroundColor = ConsoleColor.Gray; mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList); From ac01224769d9cfd5647c2d9c59e844b709273cca Mon Sep 17 00:00:00 2001 From: Tahir Akhlaq Date: Thu, 16 Jun 2016 03:01:10 +0100 Subject: [PATCH 3/4] fixed derps causing client/server crashes --- FFXIVClassic Common Class Lib/packages.config | 2 +- FFXIVClassic Map Server/CommandProcessor.cs | 2 +- FFXIVClassic Map Server/WorldManager.cs | 2 +- FFXIVClassic Map Server/actors/Actor.cs | 2 +- FFXIVClassic Map Server/actors/area/Area.cs | 2 +- .../actors/chara/npc/Npc.cs | 10 ++--- .../actors/chara/player/Player.cs | 4 +- .../base/chara/npc/object/ObjectBed.lua | 4 +- data/scripts/commands/ActivateCommand.lua | 6 +-- data/scripts/commands/ChocoboRideCommand.lua | 14 +++---- data/scripts/commands/EmoteSitCommand.lua | 6 +-- .../scripts/commands/EmoteStandardCommand.lua | 2 +- data/scripts/commands/EquipCommand.lua | 42 +++++++++---------- data/scripts/commands/ItemWasteCommand.lua | 2 +- data/scripts/commands/LogoutCommand.lua | 8 ++-- data/scripts/player.lua | 12 +++--- 16 files changed, 60 insertions(+), 60 deletions(-) diff --git a/FFXIVClassic Common Class Lib/packages.config b/FFXIVClassic Common Class Lib/packages.config index c171747f..dac938f3 100644 --- a/FFXIVClassic Common Class Lib/packages.config +++ b/FFXIVClassic Common Class Lib/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index 23ea3d7c..5b0ccc73 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -622,7 +622,7 @@ namespace FFXIVClassic_Map_Server client.GetActor().SendInstanceUpdate(); client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Reseting zone {0}...", client.GetActor().zoneId)), true, false)); } - Server.GetWorldManager().reloadZone(client.GetActor().zoneId); + Server.GetWorldManager().ReloadZone(client.GetActor().zoneId); return true; } #endregion diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index 9f551555..f0c87fde 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -464,7 +464,7 @@ namespace FFXIVClassic_Map_Server LuaEngine.OnZoneIn(player); } - public void reloadZone(uint zoneId) + public void ReloadZone(uint zoneId) { if (!zoneList.ContainsKey(zoneId)) return; diff --git a/FFXIVClassic Map Server/actors/Actor.cs b/FFXIVClassic Map Server/actors/Actor.cs index 5db8a9dd..51b31570 100644 --- a/FFXIVClassic Map Server/actors/Actor.cs +++ b/FFXIVClassic Map Server/actors/Actor.cs @@ -302,7 +302,7 @@ namespace FFXIVClassic_Map_Server.Actors zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket); } - public void generateActorName(int actorNumber) + public void GenerateActorName(int actorNumber) { //Format Class Name string className = this.className.Replace("Populace", "Ppl") diff --git a/FFXIVClassic Map Server/actors/area/Area.cs b/FFXIVClassic Map Server/actors/area/Area.cs index 5b510fce..bb93ca13 100644 --- a/FFXIVClassic Map Server/actors/area/Area.cs +++ b/FFXIVClassic Map Server/actors/area/Area.cs @@ -347,7 +347,7 @@ namespace FFXIVClassic_Map_Server.Actors return; Npc npc = new Npc(mActorList.Count + 1, actorClass.actorClassId, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, actorClass.displayNameId, null, actorClass.classPath); - npc.loadEventConditions(actorClass.eventConditions); + npc.LoadEventConditions(actorClass.eventConditions); AddActorToZone(npc); } diff --git a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs index eb4aea77..69e43813 100644 --- a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs +++ b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs @@ -3,7 +3,7 @@ using FFXIVClassic_Map_Server.actors; using FFXIVClassic_Map_Server.Actors.Chara; using FFXIVClassic_Map_Server.dataobjects; using FFXIVClassic_Map_Server.lua; -using FFXIVClassic_Map_Server.packets; +using FFXIVClassic_Map_Server.packets; using FFXIVClassic_Map_Server.packets.receive.events; using FFXIVClassic_Map_Server.packets.send.actor; using FFXIVClassic_Map_Server.utils; @@ -45,7 +45,7 @@ namespace FFXIVClassic_Map_Server.Actors this.actorClassId = classId; - loadNpcAppearance(classId); + LoadNpcAppearance(classId); this.classPath = classPath; className = classPath.Substring(classPath.LastIndexOf("/")+1); @@ -73,7 +73,7 @@ namespace FFXIVClassic_Map_Server.Actors npcWork.pushCommand = 0x271D; npcWork.pushCommandPriority = 1; - generateActorName((int)actorNumber); + GenerateActorName((int)actorNumber); } public SubPacket CreateAddActorPacket(uint playerActorId) @@ -186,7 +186,7 @@ namespace FFXIVClassic_Map_Server.Actors return actorClassId; } - public void loadNpcAppearance(uint id) + public void LoadNpcAppearance(uint id) { using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD))) { @@ -288,7 +288,7 @@ namespace FFXIVClassic_Map_Server.Actors } } - public void loadEventConditions(string eventConditions) + public void LoadEventConditions(string eventConditions) { EventList conditions = JsonConvert.DeserializeObject(eventConditions); this.eventConditions = conditions; diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index 82f801de..53be333c 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -241,7 +241,7 @@ namespace FFXIVClassic_Map_Server.Actors packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x4, "commandContent")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x6, "commandJudgeMode")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "commandRequest")); - packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "widGetCreate")); + packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "widgetCreate")); packets.Add(_0x132Packet.BuildPacket(playerActorId, 0x100, "macroRequest")); return packets; } @@ -386,7 +386,7 @@ namespace FFXIVClassic_Map_Server.Actors for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++) { if (charaWork.additionalCommandAcquired[i] != false) - propPacketUtil.AddProperty(String.Format("charaWork.AdditionalCommandAcquired[{0}]", i)); + propPacketUtil.AddProperty(String.Format("charaWork.additionalCommandAcquired[{0}]", i)); } for (int i = 0; i < charaWork.parameterSave.commandSlot_compatibility.Length; i++) diff --git a/data/scripts/base/chara/npc/object/ObjectBed.lua b/data/scripts/base/chara/npc/object/ObjectBed.lua index a0e5976e..17640c17 100644 --- a/data/scripts/base/chara/npc/object/ObjectBed.lua +++ b/data/scripts/base/chara/npc/object/ObjectBed.lua @@ -13,9 +13,9 @@ function onEventUpdate(player, npc, eventStep, menuOptionSelected) player:EndEvent(); return; elseif (menuOptionSelected == 2) then - player:quitGame(); + player:QuitGame(); elseif (menuOptionSelected == 3) then - player:logout(); + player:Logout(); elseif (menuOptionSelected == 4) then player:SendMessage(33, "", "Heck the bed"); end diff --git a/data/scripts/commands/ActivateCommand.lua b/data/scripts/commands/ActivateCommand.lua index 29b11659..2c9b022d 100644 --- a/data/scripts/commands/ActivateCommand.lua +++ b/data/scripts/commands/ActivateCommand.lua @@ -9,15 +9,15 @@ Switches between active and passive mode states function onEventStarted(player, command, triggerName) if (player:GetState() == 0) then - player:changeState(2); + player:ChangeState(2); elseif (player:GetState() == 2) then - player:changeState(0); + player:ChangeState(0); end player:EndCommand(); --For Opening Tutorial - if (player:hasQuest("Man0l0") or player:hasQuest("Man0g0") or player:hasQuest("Man0u0")) then + if (player:HasQuest("Man0l0") or player:HasQuest("Man0g0") or player:HasQuest("Man0u0")) then player:GetDirector():OnCommand(command); end diff --git a/data/scripts/commands/ChocoboRideCommand.lua b/data/scripts/commands/ChocoboRideCommand.lua index 3f3784ba..37267720 100644 --- a/data/scripts/commands/ChocoboRideCommand.lua +++ b/data/scripts/commands/ChocoboRideCommand.lua @@ -13,21 +13,21 @@ function onEventStarted(player, actor, triggerName, isGoobbue) worldMaster = GetWorldMaster(); if (isGoobbue ~= true) then - player:changeMusic(83); + player:ChangeMusic(83); player:SendChocoboAppearance(); player:SendGameMessage(player, worldMaster, 26001, 0x20); player:SetMountState(1); else - player:changeMusic(98); + player:ChangeMusic(98); player:SendGoobbueAppearance(); player:SendGameMessage(player, worldMaster, 26019, 0x20); player:SetMountState(2); end - player:changeSpeed(0.0, 5.0, 10.0); - player:changeState(15); + player:ChangeSpeed(0.0, 5.0, 10.0); + player:ChangeState(15); else - player:changeMusic(player:GetZone().bgmDay); + player:ChangeMusic(player:GetZone().bgmDay); worldMaster = GetWorldMaster(); @@ -38,8 +38,8 @@ function onEventStarted(player, actor, triggerName, isGoobbue) end player:SetMountState(0); - player:changeSpeed(0.0, 2.0, 5.0) - player:changeState(0); + player:ChangeSpeed(0.0, 2.0, 5.0) + player:ChangeState(0); end player:EndCommand(); diff --git a/data/scripts/commands/EmoteSitCommand.lua b/data/scripts/commands/EmoteSitCommand.lua index 380d1f8c..5694c9b5 100644 --- a/data/scripts/commands/EmoteSitCommand.lua +++ b/data/scripts/commands/EmoteSitCommand.lua @@ -8,12 +8,12 @@ function onEventStarted(player, actor, triggerName, emoteId) if (player:GetState() == 0) then if (emoteId == 0x2712) then - player:changeState(11); + player:ChangeState(11); else - player:changeState(13); + player:ChangeState(13); end else - player:changeState(0); + player:ChangeState(0); end player:EndCommand(); diff --git a/data/scripts/commands/EmoteStandardCommand.lua b/data/scripts/commands/EmoteStandardCommand.lua index 47cfe728..82d36f72 100644 --- a/data/scripts/commands/EmoteStandardCommand.lua +++ b/data/scripts/commands/EmoteStandardCommand.lua @@ -12,7 +12,7 @@ emoteTable = { function onEventStarted(player, actor, triggerName, emoteId) if (player:GetState() == 0) then - player:doEmote(emoteId); + player:DoEmote(emoteId); end player:EndCommand(); diff --git a/data/scripts/commands/EquipCommand.lua b/data/scripts/commands/EquipCommand.lua index d5f79f92..dc838845 100644 --- a/data/scripts/commands/EquipCommand.lua +++ b/data/scripts/commands/EquipCommand.lua @@ -137,7 +137,7 @@ function equipItem(player, equipSlot, item) if (classId ~= nil) then player:SendGameMessage(player, worldMaster, 30103, 0x20, 0, 0, player, classId); - player:prepareClassChange(classId); + player:PrepareClassChange(classId); end end @@ -161,23 +161,23 @@ function equipItem(player, equipSlot, item) --Graphic Slot was set, otherwise it's a special case if (graphicSlot ~= nil) then - player:graphicChange(graphicSlot, item); - if (graphicSlot == GRAPHICSLOT_MAINHAND) then player:graphicChange(GRAPHICSLOT_OFFHAND, nil); end + player:GraphicChange(graphicSlot, item); + if (graphicSlot == GRAPHICSLOT_MAINHAND) then player:GraphicChange(GRAPHICSLOT_OFFHAND, nil); end elseif (gItem:IsNailWeapon()) then - player:graphicChange(GRAPHICSLOT_MAINHAND, item); - player:graphicChange(GRAPHICSLOT_OFFHAND, item); + player:GraphicChange(GRAPHICSLOT_MAINHAND, item); + player:GraphicChange(GRAPHICSLOT_OFFHAND, item); elseif (gItem:IsBowWeapon()) then - player:graphicChange(GRAPHICSLOT_MAINHAND, item); - --player:graphicChange(GRAPHICSLOT_OFFHAND, item); + player:GraphicChange(GRAPHICSLOT_MAINHAND, item); + --player:GraphicChange(GRAPHICSLOT_OFFHAND, item); elseif (equipSlot == EQUIPSLOT_EARS) then - player:graphicChange(GRAPHICSLOT_R_EAR, item); - player:graphicChange(GRAPHICSLOT_L_EAR, item); + player:GraphicChange(GRAPHICSLOT_R_EAR, item); + player:GraphicChange(GRAPHICSLOT_L_EAR, item); end --Load gearset for new class and begin class change if (classId ~= nil) then loadGearset(player, classId); - player:doClassChange(classId); + player:DoClassChange(classId); end end @@ -194,20 +194,20 @@ function unequipItem(player, equipSlot, item) if (equipSlot == EQUIPSLOT_BODY) then --Show Undershirt item = player:GetEquipment():GetItemAtSlot(EQUIPSLOT_UNDERSHIRT); - player:graphicChange(GRAPHICSLOT_BODY, item); + player:GraphicChange(GRAPHICSLOT_BODY, item); elseif (equipSlot == EQUIPSLOT_LEGS) then --Show Undergarment item = player:GetEquipment():GetItemAtSlot(EQUIPSLOT_UNDERGARMENT); - player:graphicChange(GRAPHICSLOT_LEGS, item); - elseif (equipSlot == EQUIPSLOT_HANDS) then player:graphicChange(15, 0, 1, 0, 0); - elseif (equipSlot == EQUIPSLOT_FEET) then player:graphicChange(16, 0, 1, 0, 0); + player:GraphicChange(GRAPHICSLOT_LEGS, item); + elseif (equipSlot == EQUIPSLOT_HANDS) then player:GraphicChange(15, 0, 1, 0, 0); + elseif (equipSlot == EQUIPSLOT_FEET) then player:GraphicChange(16, 0, 1, 0, 0); else - if (equipSlot == EQUIPSLOT_MAINHAND) then player:graphicChange(GRAPHICSLOT_MAINHAND, nil); - elseif (equipSlot == EQUIPSLOT_OFFHAND) then player:graphicChange(GRAPHICSLOT_OFFHAND, nil); - elseif (equipSlot == EQUIPSLOT_HEAD) then player:graphicChange(GRAPHICSLOT_HEAD, nil); - elseif (equipSlot == EQUIPSLOT_WAIST) then player:graphicChange(GRAPHICSLOT_WAIST, nil); - elseif (equipSlot == EQUIPSLOT_EARS) then player:graphicChange(GRAPHICSLOT_L_EAR, nil); player:graphicChange(GRAPHICSLOT_R_EAR, nil); - elseif (equipSlot == EQUIPSLOT_RFINGER) then player:graphicChange(GRAPHICSLOT_RFINGER, nil); - elseif (equipSlot == EQUIPSLOT_LFINGER) then player:graphicChange(GRAPHICSLOT_LFINGER, nil); + if (equipSlot == EQUIPSLOT_MAINHAND) then player:GraphicChange(GRAPHICSLOT_MAINHAND, nil); + elseif (equipSlot == EQUIPSLOT_OFFHAND) then player:GraphicChange(GRAPHICSLOT_OFFHAND, nil); + elseif (equipSlot == EQUIPSLOT_HEAD) then player:GraphicChange(GRAPHICSLOT_HEAD, nil); + elseif (equipSlot == EQUIPSLOT_WAIST) then player:GraphicChange(GRAPHICSLOT_WAIST, nil); + elseif (equipSlot == EQUIPSLOT_EARS) then player:GraphicChange(GRAPHICSLOT_L_EAR, nil); player:GraphicChange(GRAPHICSLOT_R_EAR, nil); + elseif (equipSlot == EQUIPSLOT_RFINGER) then player:GraphicChange(GRAPHICSLOT_RFINGER, nil); + elseif (equipSlot == EQUIPSLOT_LFINGER) then player:GraphicChange(GRAPHICSLOT_LFINGER, nil); end end return true; diff --git a/data/scripts/commands/ItemWasteCommand.lua b/data/scripts/commands/ItemWasteCommand.lua index b0c42ae6..073576c1 100644 --- a/data/scripts/commands/ItemWasteCommand.lua +++ b/data/scripts/commands/ItemWasteCommand.lua @@ -10,6 +10,6 @@ The param "itemDBIds" has the vars: item1 and item2. --]] function onEventStarted(player, actor, triggerName, invActionInfo, param1, param2, param3, param4, param5, param6, param7, param8, itemDBIds) - player:GetInventory(0x00):removeItem(invActionInfo.slot); + player:GetInventory(0x00):RemoveItem(invActionInfo.slot); player:EndCommand(); end diff --git a/data/scripts/commands/LogoutCommand.lua b/data/scripts/commands/LogoutCommand.lua index 65124597..037e70b9 100644 --- a/data/scripts/commands/LogoutCommand.lua +++ b/data/scripts/commands/LogoutCommand.lua @@ -18,7 +18,7 @@ Countdown: 1 function onEventStarted(player, command) --player:SetCurrentMenuId(0); --player:RunEventFunction("delegateCommand", command, "eventConfirm"); - player:logout(); + player:Logout(); end function onEventUpdate(player, command, triggerName, step, arg1, arg2) @@ -28,10 +28,10 @@ function onEventUpdate(player, command, triggerName, step, arg1, arg2) --Menu Dialog if (currentMenuId == 0) then if (arg1 == 1) then --Exit - player:quitGame(); + player:QuitGame(); player:EndCommand(); elseif (arg1 == 2) then --Character Screen - player:logout(); + player:Logout(); player:EndCommand(); --player:SetCurrentMenuId(1); --player:RunEventFunction("delegateCommand", command, "eventCountDown"); @@ -42,7 +42,7 @@ function onEventUpdate(player, command, triggerName, step, arg1, arg2) elseif (currentMenuId == 1) then if (arg2 == 1) then --Logout Complete - player:logout(); + player:Logout(); player:EndCommand(); elseif (arg2 == 2) then --Cancel Pressed player:EndCommand(); diff --git a/data/scripts/player.lua b/data/scripts/player.lua index b5d6167d..9fce66e5 100644 --- a/data/scripts/player.lua +++ b/data/scripts/player.lua @@ -6,18 +6,18 @@ function onBeginLogin(player) if (player:GetPlayTime(false) == 0) then initialTown = player:GetInitialTown(); - if (initialTown == 1 and player:hasQuest(110001) == false) then + if (initialTown == 1 and player:HasQuest(110001) == false) then player:AddQuest(110001); - elseif (initialTown == 2 and player:hasQuest(110005) == false) then + elseif (initialTown == 2 and player:HasQuest(110005) == false) then player:AddQuest(110005); - elseif (initialTown == 3 and player:hasQuest(110009) == false) then + elseif (initialTown == 3 and player:HasQuest(110009) == false) then player:AddQuest(110009); end end --For Opening. Set Director and reset position incase d/c - if (player:hasQuest(110001) == true) then + if (player:HasQuest(110001) == true) then --player:SetDirector("openingDirector", false); player.positionX = 0.016; player.positionY = 10.35; @@ -26,7 +26,7 @@ function onBeginLogin(player) player.rotation = 0.025; player:GetQuest(110001):ClearQuestData(); player:GetQuest(110001):ClearQuestFlags(); - elseif (player:hasQuest(110005) == true) then + elseif (player:HasQuest(110005) == true) then player:SetDirector("openingDirector", false); player.positionX = 369.5434; player.positionY = 4.21; @@ -34,7 +34,7 @@ function onBeginLogin(player) player.rotation = -1.26721; player:GetQuest(110005):ClearQuestData(); player:GetQuest(110005):ClearQuestFlags(); - elseif (player:hasQuest(110009) == true) then + elseif (player:HasQuest(110009) == true) then player:SetDirector("openingDirector", false); player.positionX = 5.364327; player.positionY = 196.0; From cdf4b3a2f2ad97b1ad67b5a9331eff063f6ca950 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 16 Jun 2016 22:44:50 -0400 Subject: [PATCH 4/4] GuildShop script done. --- .../npc/populace/shop/PopulaceGuildShop.lua | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 data/scripts/base/chara/npc/populace/shop/PopulaceGuildShop.lua diff --git a/data/scripts/base/chara/npc/populace/shop/PopulaceGuildShop.lua b/data/scripts/base/chara/npc/populace/shop/PopulaceGuildShop.lua new file mode 100644 index 00000000..dcdb098b --- /dev/null +++ b/data/scripts/base/chara/npc/populace/shop/PopulaceGuildShop.lua @@ -0,0 +1,61 @@ +function init(npc) + return false, false, 0, 0; +end + +function onEventStarted(player, npc) + + saySheetId = 1; + + if (npc:GetActorClassId() == 1000157) then + saySheetId = 9; + elseif (npc:GetActorClassId() == 1000158) then + saySheetId = 24; + elseif (npc:GetActorClassId() == 1000162) then + saySheetId = 18; + elseif (npc:GetActorClassId() == 1000164) then + saySheetId = 16; + elseif (npc:GetActorClassId() == 1000459) then + saySheetId = 21; + elseif (npc:GetActorClassId() == 1000460) then + saySheetId = 13; + elseif (npc:GetActorClassId() == 1000461) then + saySheetId = 15; + elseif (npc:GetActorClassId() == 1000462) then + saySheetId = 11; + elseif (npc:GetActorClassId() == 1000464) then + saySheetId = 10; + elseif (npc:GetActorClassId() == 1000466) then + saySheetId = 17; + elseif (npc:GetActorClassId() == 1000631) then + saySheetId = 8; + elseif (npc:GetActorClassId() == 1000632) then + saySheetId = 7; + elseif (npc:GetActorClassId() == 1000633) then + saySheetId = 12; + elseif (npc:GetActorClassId() == 1000634) then + saySheetId = 23; + elseif (npc:GetActorClassId() == 1000635) then + saySheetId = 20; + elseif (npc:GetActorClassId() == 1000636) then + saySheetId = 22; + elseif (npc:GetActorClassId() == 1000637) then + saySheetId = 14; + elseif (npc:GetActorClassId() == 1001461) then + saySheetId = 19; + end + + player:RunEventFunction("welcomeTalk", nil, saySheetId, player); +end + +function onEventUpdate(player, npc, step, menuOptionSelected) + + --player:RunEventFunction("cashbackTalkCommand", 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004, 22004); --Refund Abilities??? + --player:RunEventFunction("cashbackTalk", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); --Refund items??? + + if (menuOptionSelected == 4) then + player:EndEvent(); + else + player:RunEventFunction("selectMode", nil, npc:GetActorClassId(), false, 1000001); --Step 2, state your business + end + +end \ No newline at end of file