From 21745a6aa8c583210d66a813e0cd33dc9e1690dc Mon Sep 17 00:00:00 2001 From: TheManii Date: Fri, 8 Apr 2016 00:48:34 -0700 Subject: [PATCH 1/6] Added relative warps --- FFXIVClassic Map Server/CommandProcessor.cs | 217 +++++++++++------- .../Properties/Resources.Designer.cs | 5 +- .../Properties/Resources.resx | 2 + 3 files changed, 139 insertions(+), 85 deletions(-) diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index d815467a..86c095d0 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -95,11 +95,11 @@ namespace FFXIVClassic_Lobby_Server } } - /// - /// Teleports player to a location on a predefined list - /// - /// The current player - /// Predefined list: <ffxiv_database>\server_zones_spawnlocations + /// + /// Teleports player to a location on a predefined list + /// + /// The current player + /// Predefined list: <ffxiv_database>\server_zones_spawnlocations public void doWarp(ConnectedPlayer client, string entranceId) { uint id; @@ -133,39 +133,39 @@ namespace FFXIVClassic_Lobby_Server public void doWarp(ConnectedPlayer client, string zone, string privateArea, string sx, string sy, string sz) { uint zoneId; - float x,y,z; - + float x,y,z; + x = Single.Parse(sx); y = Single.Parse(sy); z = Single.Parse(sz); - if (zone == null) - { - if (client != null) - mWorldManager.DoZoneChange(client.getActor(), 0, privateArea, 0x2, x, y, z, 0.0f); + if (zone == null) + { + if (client != null) + mWorldManager.DoZoneChange(client.getActor(), 0, privateArea, 0x2, x, y, z, 0.0f); } - else - { - if (zone.ToLower().StartsWith("0x")) - zoneId = Convert.ToUInt32(zone, 16); - else - zoneId = Convert.ToUInt32(zone); - - if (mWorldManager.GetZone(zoneId) == null) - { - if (client != null) - client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone does not exist or setting isn't valid."), true, false)); - Log.error("Zone does not exist or setting isn't valid."); - } - - if (client != null) - mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); - else - { - foreach (KeyValuePair entry in mConnectedPlayerList) - { - mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); - } + else + { + if (zone.ToLower().StartsWith("0x")) + zoneId = Convert.ToUInt32(zone, 16); + else + zoneId = Convert.ToUInt32(zone); + + if (mWorldManager.GetZone(zoneId) == null) + { + if (client != null) + client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone does not exist or setting isn't valid."), true, false)); + Log.error("Zone does not exist or setting isn't valid."); + } + + if (client != null) + mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); + else + { + foreach (KeyValuePair entry in mConnectedPlayerList) + { + mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); + } } } } @@ -351,6 +351,64 @@ namespace FFXIVClassic_Lobby_Server } } + private void parseWarp(ConnectedPlayer client, string[] split) + { + //bool relx = false, + // rely = false, + // relz = false; + float x = 0, + y = 0, + z = 0; + + if (split.Length == 2) // Predefined list + doWarp(client, split[1]); + else if (split.Length == 4) // X/Y/Z + { + #region relativewarp + if (split[1].StartsWith("@")) + { + //relx = true; + split[1] = split[1].Replace("@", string.Empty); + + if (String.IsNullOrEmpty(split[1])) + split[1] = "0"; + + x = Single.Parse(split[1]) + client.getActor().positionX; + split[1] = x.ToString(); + } + if (split[2].StartsWith("@")) + { + //rely = true; + split[2] = split[2].Replace("@", string.Empty); + + if (String.IsNullOrEmpty(split[2])) + split[2] = "0"; + + y = Single.Parse(split[2]) + client.getActor().positionY; + split[2] = y.ToString(); + } + if (split[3].StartsWith("@")) + { + //relz = true; + split[3] = split[3].Replace("@", string.Empty); + + if (String.IsNullOrEmpty(split[3])) + split[3] = "0"; + + z = Single.Parse(split[3]) + client.getActor().positionZ; + split[3] = z.ToString(); + } + #endregion + //sendMessage(client, String.Format("relx: {0}, rely: {1}, relz: {2}, x: {3}, y: {4}, z: {5}, fx: {6}, fy: {7}, fz: {8}", relx, rely, relz, split[1], split[2], split[3], x, y ,z)); + sendMessage(client, String.Format("Warping to: X: {0}, Y: {1}, Z: {2}", split[1], split[2], split[3])); + doWarp(client, null, null, split[1], split[2], split[3]); + } + else if (split.Length == 5) // Zone + X/Y/Z + doWarp(client, split[1], null, split[2], split[3], split[4]); + else if (split.Length == 6) // Zone + instance + X/Y/Z + doWarp(client, split[1], split[2], split[3], split[4], split[5]); + } + /// /// We only use the default options for SendMessagePacket. /// May as well make it less unwieldly to view @@ -370,11 +428,11 @@ namespace FFXIVClassic_Lobby_Server input = input.Substring(1); String[] split = input.Split(' '); - split = split.Select(temp => temp.ToLower()).ToArray(); // Ignore case on commands - split = split.Where(temp => temp != "").ToArray(); // strips extra whitespace from commands - - // Debug - //sendMessage(client, string.Join(",", split)); + split = split.Select(temp => temp.ToLower()).ToArray(); // Ignore case on commands + split = split.Where(temp => temp != "").ToArray(); // strips extra whitespace from commands + + // Debug + //sendMessage(client, string.Join(",", split)); if (split.Length >= 1) { @@ -422,9 +480,9 @@ namespace FFXIVClassic_Lobby_Server } return true; - } + } #endregion - + #region !mypos else if (split[0].Equals("mypos")) { @@ -437,9 +495,9 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not load packet: " + e); } - } + } #endregion - + #region !reloadzones else if (split[0].Equals("reloadzones")) { @@ -453,9 +511,9 @@ namespace FFXIVClassic_Lobby_Server } mWorldManager.reloadZone(client.getActor().zoneId); return true; - } + } #endregion - + #region !reloaditems else if (split[0].Equals("reloaditems")) { @@ -466,9 +524,9 @@ namespace FFXIVClassic_Lobby_Server Log.info(String.Format("Loaded {0} items.", gamedataItems.Count)); sendMessage(client, String.Format("Loaded {0} items.", gamedataItems.Count)); return true; - } + } #endregion - + #region !sendpacket else if (split[0].Equals("sendpacket")) { @@ -484,9 +542,9 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not load packet: " + e); } - } + } #endregion - + #region !graphic else if (split[0].Equals("graphic")) { @@ -500,9 +558,9 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not give item."); } - } + } #endregion - + #region !giveitem else if (split[0].Equals("giveitem")) { @@ -520,10 +578,10 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not give item."); } - } + } #endregion - - #region !removeitem + + #region !removeitem else if (split[0].Equals("removeitem")) { if (split.Length < 2) @@ -543,10 +601,10 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not remove item."); } - } + } #endregion - - #region !givekeyitem + + #region !givekeyitem else if (split[0].Equals("givekeyitem")) { try @@ -558,10 +616,10 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not give keyitem."); } - } + } #endregion - - #region !removekeyitem + + #region !removekeyitem else if (split[0].Equals("removekeyitem")) { if (split.Length < 2) @@ -577,10 +635,10 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not remove keyitem."); } - } + } #endregion - - #region !givecurrency + + #region !givecurrency else if (split[0].Equals("givecurrency")) { try @@ -594,10 +652,10 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not give currency."); } - } + } #endregion - - #region !removecurrency + + #region !removecurrency else if (split[0].Equals("removecurrency")) { if (split.Length < 2) @@ -615,9 +673,9 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not remove currency."); } - } + } #endregion - + #region !music else if (split[0].Equals("music")) { @@ -633,24 +691,17 @@ namespace FFXIVClassic_Lobby_Server { Log.error("Could not change music: " + e); } - } + } #endregion - + #region !warp else if (split[0].Equals("warp")) - { - if (split.Length == 2) // Predefined list - doWarp(client, split[1]); - else if (split.Length == 4) // X/Y/Z - doWarp(client, null, null, split[1], split[2], split[3]); - else if (split.Length == 5) // Zone + X/Y/Z - doWarp(client, split[1], null, split[2], split[3], split[4]); - else if (split.Length == 6) // Zone + instance + X/Y/Z - doWarp(client, split[1], split[2], split[3], split[4], split[5]); + { + parseWarp(client, split); return true; - } + } #endregion - + #region !property else if (split[0].Equals("property")) { @@ -659,9 +710,9 @@ namespace FFXIVClassic_Lobby_Server changeProperty(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]); } return true; - } + } #endregion - + #region !property2 else if (split[0].Equals("property2")) { @@ -670,7 +721,7 @@ namespace FFXIVClassic_Lobby_Server changeProperty(Convert.ToUInt32(split[1], 16), Convert.ToUInt32(split[2], 16), split[3]); } return true; - } + } #endregion } return false; diff --git a/FFXIVClassic Map Server/Properties/Resources.Designer.cs b/FFXIVClassic Map Server/Properties/Resources.Designer.cs index cea7c949..3a6f068b 100644 --- a/FFXIVClassic Map Server/Properties/Resources.Designer.cs +++ b/FFXIVClassic Map Server/Properties/Resources.Designer.cs @@ -239,13 +239,14 @@ namespace FFXIVClassic_Map_Server.Properties { /// /// Looks up a localized string similar to Teleports the player to the specified location /// + ///*Note: You teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name + /// ///*Syntax: warp <location list> /// warp <X coordinate> <Y coordinate> <Z coordinate> /// warp <zone id> <X coordinate> <Y coordinate> <Z coordinate> /// warp <zone id> <instance> <X coordinate> <Y coordinate> <Z coordinate> ///<location list> is a pre-defined list of locations from the server database - ///<zone id> is the zone's id as defined in the server database - ///<instance> is an instanced copy of the desired zone that's only visible to the current player. + ///<zone id> is the zon [rest of string was truncated]";. /// public static string CPwarp { get { diff --git a/FFXIVClassic Map Server/Properties/Resources.resx b/FFXIVClassic Map Server/Properties/Resources.resx index 71b54066..a038aae6 100644 --- a/FFXIVClassic Map Server/Properties/Resources.resx +++ b/FFXIVClassic Map Server/Properties/Resources.resx @@ -206,6 +206,8 @@ Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, remo Teleports the player to the specified location +*Note: You teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name + *Syntax: warp <location list> warp <X coordinate> <Y coordinate> <Z coordinate> warp <zone id> <X coordinate> <Y coordinate> <Z coordinate> From 3790920db3351c39f57835b7b023f8a29e1e1683 Mon Sep 17 00:00:00 2001 From: TheManii Date: Fri, 8 Apr 2016 00:51:34 -0700 Subject: [PATCH 2/6] Typo --- FFXIVClassic Map Server/Properties/Resources.Designer.cs | 4 ++-- FFXIVClassic Map Server/Properties/Resources.resx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FFXIVClassic Map Server/Properties/Resources.Designer.cs b/FFXIVClassic Map Server/Properties/Resources.Designer.cs index 3a6f068b..d0cae89c 100644 --- a/FFXIVClassic Map Server/Properties/Resources.Designer.cs +++ b/FFXIVClassic Map Server/Properties/Resources.Designer.cs @@ -239,14 +239,14 @@ namespace FFXIVClassic_Map_Server.Properties { /// /// Looks up a localized string similar to Teleports the player to the specified location /// - ///*Note: You teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name + ///*Note: You can teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name /// ///*Syntax: warp <location list> /// warp <X coordinate> <Y coordinate> <Z coordinate> /// warp <zone id> <X coordinate> <Y coordinate> <Z coordinate> /// warp <zone id> <instance> <X coordinate> <Y coordinate> <Z coordinate> ///<location list> is a pre-defined list of locations from the server database - ///<zone id> is the zon [rest of string was truncated]";. + ///<zone id> is the [rest of string was truncated]";. /// public static string CPwarp { get { diff --git a/FFXIVClassic Map Server/Properties/Resources.resx b/FFXIVClassic Map Server/Properties/Resources.resx index a038aae6..f121876e 100644 --- a/FFXIVClassic Map Server/Properties/Resources.resx +++ b/FFXIVClassic Map Server/Properties/Resources.resx @@ -206,7 +206,7 @@ Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, remo Teleports the player to the specified location -*Note: You teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name +*Note: You can teleport relative to your current position by putting a @ in front of a value, cannot be combined with a zone id or instance name *Syntax: warp <location list> warp <X coordinate> <Y coordinate> <Z coordinate> From 2eb40a0d7c9b12909c7f91f8b153fb8f81fe5881 Mon Sep 17 00:00:00 2001 From: TheManii Date: Sat, 9 Apr 2016 11:28:21 -0700 Subject: [PATCH 3/6] Save player rotation for relative warps Make !warp more robust with error handling --- FFXIVClassic Map Server/CommandProcessor.cs | 183 +++++++++++++------- 1 file changed, 119 insertions(+), 64 deletions(-) diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index 86c095d0..ee468f19 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -130,26 +130,30 @@ namespace FFXIVClassic_Lobby_Server } } - public void doWarp(ConnectedPlayer client, string zone, string privateArea, string sx, string sy, string sz) + public void doWarp(ConnectedPlayer client, string zone, string privateArea, float x, float y, float z, float r) { uint zoneId; - float x,y,z; - - x = Single.Parse(sx); - y = Single.Parse(sy); - z = Single.Parse(sz); if (zone == null) { if (client != null) - mWorldManager.DoZoneChange(client.getActor(), 0, privateArea, 0x2, x, y, z, 0.0f); + mWorldManager.DoZoneChange(client.getActor(), 0, privateArea, 0x2, x, y, z, r); } else { - if (zone.ToLower().StartsWith("0x")) - zoneId = Convert.ToUInt32(zone, 16); - else - zoneId = Convert.ToUInt32(zone); + if (zone.ToLower().StartsWith("0x")) + { + try {zoneId = Convert.ToUInt32(zone, 16);} + catch (FormatException e) + {return;} + } + else + { + try {zoneId = Convert.ToUInt32(zone);} + catch (FormatException e) + {return;} + } + if (mWorldManager.GetZone(zoneId) == null) { @@ -159,12 +163,12 @@ namespace FFXIVClassic_Lobby_Server } if (client != null) - mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); + mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, r); else { foreach (KeyValuePair entry in mConnectedPlayerList) { - mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); + mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, 0x2, x, y, z, r); } } } @@ -351,62 +355,113 @@ namespace FFXIVClassic_Lobby_Server } } - private void parseWarp(ConnectedPlayer client, string[] split) - { - //bool relx = false, - // rely = false, - // relz = false; - float x = 0, - y = 0, - z = 0; - + private void parseWarp(ConnectedPlayer client, string[] split) + { + //bool relx = false, + // rely = false, + // relz = false; + float x = 0, y = 0, z = 0, r = 0.0f; + string zone = null, privatearea = null; + + if (split.Length == 2) // Predefined list - doWarp(client, split[1]); - else if (split.Length == 4) // X/Y/Z { - #region relativewarp - if (split[1].StartsWith("@")) - { - //relx = true; - split[1] = split[1].Replace("@", string.Empty); - - if (String.IsNullOrEmpty(split[1])) - split[1] = "0"; - - x = Single.Parse(split[1]) + client.getActor().positionX; - split[1] = x.ToString(); - } - if (split[2].StartsWith("@")) - { - //rely = true; - split[2] = split[2].Replace("@", string.Empty); - - if (String.IsNullOrEmpty(split[2])) - split[2] = "0"; - - y = Single.Parse(split[2]) + client.getActor().positionY; - split[2] = y.ToString(); - } - if (split[3].StartsWith("@")) - { - //relz = true; - split[3] = split[3].Replace("@", string.Empty); - - if (String.IsNullOrEmpty(split[3])) + // TODO: Handle !warp Playername + doWarp(client, split[1]); + } + else if (split.Length == 4) + { + #region !warp X Y Z + if (split[1].StartsWith("@")) + { + //relx = true; + split[1] = split[1].Replace("@", string.Empty); + + if (String.IsNullOrEmpty(split[1])) + split[1] = "0"; + + try { x = Single.Parse(split[1]) + client.getActor().positionX; } + catch (FormatException e) + { return; } + split[1] = x.ToString(); + } + if (split[2].StartsWith("@")) + { + //rely = true; + split[2] = split[2].Replace("@", string.Empty); + + if (String.IsNullOrEmpty(split[2])) + split[2] = "0"; + + try { y = Single.Parse(split[2]) + client.getActor().positionY; } + catch (FormatException e) + { return; } + split[2] = y.ToString(); + } + if (split[3].StartsWith("@")) + { + //relz = true; + split[3] = split[3].Replace("@", string.Empty); + + if (String.IsNullOrEmpty(split[3])) split[3] = "0"; - z = Single.Parse(split[3]) + client.getActor().positionZ; - split[3] = z.ToString(); + try { z = Single.Parse(split[3]) + client.getActor().positionZ; } + catch (FormatException e) + { return; } + split[3] = z.ToString(); } - #endregion - //sendMessage(client, String.Format("relx: {0}, rely: {1}, relz: {2}, x: {3}, y: {4}, z: {5}, fx: {6}, fy: {7}, fz: {8}", relx, rely, relz, split[1], split[2], split[3], x, y ,z)); + + try + { + x = Single.Parse(split[1]); + y = Single.Parse(split[2]); + z = Single.Parse(split[3]); + } + catch (FormatException e) + { return; } + + r = client.getActor().rotation; + + //sendMessage(client, String.Format("relx: {0}, rely: {1}, relz: {2}, x: {3}, y: {4}, z: {5}, fx: {6}, fy: {7}, fz: {8}", relx, rely, relz, split[1], split[2], split[3], x, y ,z)); sendMessage(client, String.Format("Warping to: X: {0}, Y: {1}, Z: {2}", split[1], split[2], split[3])); - doWarp(client, null, null, split[1], split[2], split[3]); - } - else if (split.Length == 5) // Zone + X/Y/Z - doWarp(client, split[1], null, split[2], split[3], split[4]); - else if (split.Length == 6) // Zone + instance + X/Y/Z - doWarp(client, split[1], split[2], split[3], split[4], split[5]); + #endregion + } + else if (split.Length == 5) + { + #region !warp Zone X Y Z + try + { + x = Single.Parse(split[2]); + y = Single.Parse(split[3]); + z = Single.Parse(split[4]); + } + catch (FormatException e) + { return; } + + zone = split[1]; + #endregion + } + else if (split.Length == 6) + { + #region !warp Zone Instance X Y Z + try + { + x = Single.Parse(split[3]); + y = Single.Parse(split[4]); + z = Single.Parse(split[5]); + } + catch (FormatException e) + { return; } + + zone = split[1]; + privatearea = split[2]; + #endregion + } + else + return; // catch any invalid warps here + + doWarp(client, zone, privatearea, x, y, z, r); } /// @@ -696,7 +751,7 @@ namespace FFXIVClassic_Lobby_Server #region !warp else if (split[0].Equals("warp")) - { + { parseWarp(client, split); return true; } From 06606c5f01497917f62f350cf072827d5725369d Mon Sep 17 00:00:00 2001 From: TheManii Date: Sat, 9 Apr 2016 12:27:04 -0700 Subject: [PATCH 4/6] *Revert changes to worldmanager.cs, not needed anymore *Made !warp silently catch all exceptions so they dont crash server/don't change player state if invalid *Moved rest of !warp parsing logic into parseWarp(), doWarp() now purely handles actual act of warping --- FFXIVClassic Map Server/CommandProcessor.cs | 220 ++++++++++---------- FFXIVClassic Map Server/WorldManager.cs | 38 ++-- 2 files changed, 119 insertions(+), 139 deletions(-) diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index ee468f19..650d9289 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -99,77 +99,41 @@ namespace FFXIVClassic_Lobby_Server /// Teleports player to a location on a predefined list /// /// The current player - /// Predefined list: <ffxiv_database>\server_zones_spawnlocations - public void doWarp(ConnectedPlayer client, string entranceId) + /// Predefined list: <ffxiv_database>\server_zones_spawnlocations + public void doWarp(ConnectedPlayer client, uint id) { - uint id; - - try - { - if (entranceId.ToLower().StartsWith("0x")) - id = Convert.ToUInt32(entranceId, 16); - else - id = Convert.ToUInt32(entranceId); - } - catch(FormatException e) - {return;} - FFXIVClassic_Map_Server.WorldManager.ZoneEntrance ze = mWorldManager.getZoneEntrance(id); if (ze == null) return; if (client != null) - mWorldManager.DoZoneChange(client.getActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, 0.0f); + mWorldManager.DoZoneChange(client.getActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation); else { foreach (KeyValuePair entry in mConnectedPlayerList) { - mWorldManager.DoZoneChange(entry.Value.getActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, 0.0f); + mWorldManager.DoZoneChange(entry.Value.getActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation); } } } - public void doWarp(ConnectedPlayer client, string zone, string privateArea, float x, float y, float z, float r) + public void doWarp(ConnectedPlayer client, uint zoneId, string privateArea, float x, float y, float z, float r) { - uint zoneId; - - if (zone == null) + if (mWorldManager.GetZone(zoneId) == null) { if (client != null) - mWorldManager.DoZoneChange(client.getActor(), 0, privateArea, 0x2, x, y, z, r); + client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone does not exist or setting isn't valid."), true, false)); + Log.error("Zone does not exist or setting isn't valid."); } + + if (client != null) + mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, r); else { - if (zone.ToLower().StartsWith("0x")) - { - try {zoneId = Convert.ToUInt32(zone, 16);} - catch (FormatException e) - {return;} - } - else - { - try {zoneId = Convert.ToUInt32(zone);} - catch (FormatException e) - {return;} - } - - - if (mWorldManager.GetZone(zoneId) == null) + foreach (KeyValuePair entry in mConnectedPlayerList) { - if (client != null) - client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone does not exist or setting isn't valid."), true, false)); - Log.error("Zone does not exist or setting isn't valid."); - } - - if (client != null) - mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, r); - else - { - foreach (KeyValuePair entry in mConnectedPlayerList) - { - mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, 0x2, x, y, z, r); - } + mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, 0x2, x, y, z, r); } } } @@ -357,111 +321,137 @@ namespace FFXIVClassic_Lobby_Server private void parseWarp(ConnectedPlayer client, string[] split) { - //bool relx = false, - // rely = false, - // relz = false; - float x = 0, y = 0, z = 0, r = 0.0f; - string zone = null, privatearea = null; + float x = 0, y = 0, z = 0, r = 0.0f; + uint zoneId = 0; + string privatearea = null; - - if (split.Length == 2) // Predefined list + if (split.Length == 2) // Predefined list { // TODO: Handle !warp Playername - doWarp(client, split[1]); + #region !warp (predefined list) + try + { + if (split[1].ToLower().StartsWith("0x")) + zoneId = Convert.ToUInt32(split[1], 16); + else + zoneId = Convert.ToUInt32(split[1]); + } + catch{return;} + #endregion + + doWarp(client, zoneId); } - else if (split.Length == 4) + else if (split.Length == 4) { #region !warp X Y Z if (split[1].StartsWith("@")) { - //relx = true; split[1] = split[1].Replace("@", string.Empty); if (String.IsNullOrEmpty(split[1])) split[1] = "0"; try { x = Single.Parse(split[1]) + client.getActor().positionX; } - catch (FormatException e) - { return; } - split[1] = x.ToString(); + catch{return;} + + split[1] = x.ToString(); } if (split[2].StartsWith("@")) { - //rely = true; split[2] = split[2].Replace("@", string.Empty); if (String.IsNullOrEmpty(split[2])) split[2] = "0"; - try { y = Single.Parse(split[2]) + client.getActor().positionY; } - catch (FormatException e) - { return; } - split[2] = y.ToString(); + try { y = Single.Parse(split[2]) + client.getActor().positionY; } + catch{return;} + + split[2] = y.ToString(); } if (split[3].StartsWith("@")) { - //relz = true; split[3] = split[3].Replace("@", string.Empty); if (String.IsNullOrEmpty(split[3])) - split[3] = "0"; - - try { z = Single.Parse(split[3]) + client.getActor().positionZ; } - catch (FormatException e) - { return; } + split[3] = "0"; + + try { z = Single.Parse(split[3]) + client.getActor().positionZ; } + catch{return;} + split[3] = z.ToString(); - } - - try - { - x = Single.Parse(split[1]); - y = Single.Parse(split[2]); - z = Single.Parse(split[3]); - } - catch (FormatException e) - { return; } + } + try + { + x = Single.Parse(split[1]); + y = Single.Parse(split[2]); + z = Single.Parse(split[3]); + } + catch{return;} + + zoneId = client.getActor().zoneId; r = client.getActor().rotation; - - //sendMessage(client, String.Format("relx: {0}, rely: {1}, relz: {2}, x: {3}, y: {4}, z: {5}, fx: {6}, fy: {7}, fz: {8}", relx, rely, relz, split[1], split[2], split[3], x, y ,z)); - sendMessage(client, String.Format("Warping to: X: {0}, Y: {1}, Z: {2}", split[1], split[2], split[3])); #endregion + + sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); + doWarp(client, zoneId, privatearea, x, y, z, r); } - else if (split.Length == 5) - { - #region !warp Zone X Y Z - try - { - x = Single.Parse(split[2]); - y = Single.Parse(split[3]); - z = Single.Parse(split[4]); - } - catch (FormatException e) - { return; } + else if (split.Length == 5) + { + #region !warp Zone X Y Z + try + { + x = Single.Parse(split[2]); + y = Single.Parse(split[3]); + z = Single.Parse(split[4]); + } + catch{return;} - zone = split[1]; - #endregion + if (split[1].ToLower().StartsWith("0x")) + { + try { zoneId = Convert.ToUInt32(split[1], 16); } + catch{return;} + } + else + { + try { zoneId = Convert.ToUInt32(split[1]); } + catch{return;} + } + #endregion + + sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); + doWarp(client, zoneId, privatearea, x, y, z, r); } - else if (split.Length == 6) - { - #region !warp Zone Instance X Y Z - try - { - x = Single.Parse(split[3]); - y = Single.Parse(split[4]); - z = Single.Parse(split[5]); - } - catch (FormatException e) - { return; } + else if (split.Length == 6) + { + #region !warp Zone Instance X Y Z + try + { + x = Single.Parse(split[3]); + y = Single.Parse(split[4]); + z = Single.Parse(split[5]); + } + catch{return;} - zone = split[1]; - privatearea = split[2]; - #endregion + if (split[1].ToLower().StartsWith("0x")) + { + try { zoneId = Convert.ToUInt32(split[1], 16); } + catch{return;} + } + else + { + try { zoneId = Convert.ToUInt32(split[1]); } + catch{return;} + } + + privatearea = split[2]; + #endregion + + sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); + doWarp(client, zoneId, privatearea, x, y, z, r); } else return; // catch any invalid warps here - - doWarp(client, zone, privatearea, x, y, z, r); } /// diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index 32e19250..3d5d33c5 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -372,35 +372,25 @@ namespace FFXIVClassic_Map_Server } //Add player to new zone and update - Area newArea; - - if (destinationZoneId != 0) - { - if (destinationPrivateArea == null) - newArea = GetZone(destinationZoneId); - else - newArea = GetZone(destinationZoneId).getPrivateArea(destinationPrivateArea, 0); - } + Area newArea; + + if (destinationPrivateArea == null) + newArea = GetZone(destinationZoneId); else - { - if (destinationPrivateArea == null) - newArea = GetZone(player.zoneId); - else - newArea = GetZone(player.zoneId).getPrivateArea(destinationPrivateArea, 0); - } + newArea = GetZone(destinationZoneId).getPrivateArea(destinationPrivateArea, 0); //This server does not contain that zoneId if (newArea == null) return; - newArea.addActorToZone(player); - - //Update player actor's properties - player.zoneId = newArea.actorId; - player.zone = newArea; - player.positionX = spawnX; - player.positionY = spawnY; - player.positionZ = spawnZ; - player.rotation = spawnRotation; + newArea.addActorToZone(player); + + //Update player actor's properties + player.zoneId = newArea.actorId; + player.zone = newArea; + player.positionX = spawnX; + player.positionY = spawnY; + player.positionZ = spawnZ; + player.rotation = spawnRotation; //Send packets player.playerSession.queuePacket(DeleteAllActorsPacket.buildPacket(player.actorId), true, false); From c38fbc0c0912d0f2995b1974bc5881ea0a30d342 Mon Sep 17 00:00:00 2001 From: TheManii Date: Sat, 9 Apr 2016 12:35:29 -0700 Subject: [PATCH 5/6] *Revert ea1e16a, should be done globally and not simply here --- FFXIVClassic Map Server/CommandProcessor.cs | 76 +++++++------- FFXIVClassic Map Server/PacketProcessor.cs | 6 +- FFXIVClassic Map Server/Server.cs | 98 +++++++++---------- .../actors/chara/npc/Npc.cs | 2 +- .../actors/chara/player/Player.cs | 16 +-- FFXIVClassic Map Server/lua/LuaEngine.cs | 18 ++-- 6 files changed, 108 insertions(+), 108 deletions(-) diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index 650d9289..2170338e 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -24,7 +24,7 @@ namespace FFXIVClassic_Lobby_Server class CommandProcessor { private Dictionary mConnectedPlayerList; - private static WorldManager mWorldManager = Server.getWorldManager(); + private static WorldManager mWorldManager = Server.GetWorldManager(); private static Dictionary gamedataItems = Server.getItemGamedataList(); // For the moment, this is the only predefined item @@ -322,23 +322,23 @@ namespace FFXIVClassic_Lobby_Server private void parseWarp(ConnectedPlayer client, string[] split) { float x = 0, y = 0, z = 0, r = 0.0f; - uint zoneId = 0; + uint zoneId = 0; string privatearea = null; if (split.Length == 2) // Predefined list - { - // TODO: Handle !warp Playername - #region !warp (predefined list) - try - { - if (split[1].ToLower().StartsWith("0x")) - zoneId = Convert.ToUInt32(split[1], 16); - else - zoneId = Convert.ToUInt32(split[1]); - } - catch{return;} + { + // TODO: Handle !warp Playername + #region !warp (predefined list) + try + { + if (split[1].ToLower().StartsWith("0x")) + zoneId = Convert.ToUInt32(split[1], 16); + else + zoneId = Convert.ToUInt32(split[1]); + } + catch{return;} #endregion - + doWarp(client, zoneId); } else if (split.Length == 4) @@ -393,7 +393,7 @@ namespace FFXIVClassic_Lobby_Server r = client.getActor().rotation; #endregion - sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); + sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); doWarp(client, zoneId, privatearea, x, y, z, r); } else if (split.Length == 5) @@ -406,20 +406,20 @@ namespace FFXIVClassic_Lobby_Server z = Single.Parse(split[4]); } catch{return;} - - if (split[1].ToLower().StartsWith("0x")) - { - try { zoneId = Convert.ToUInt32(split[1], 16); } - catch{return;} - } - else - { - try { zoneId = Convert.ToUInt32(split[1]); } - catch{return;} + + if (split[1].ToLower().StartsWith("0x")) + { + try { zoneId = Convert.ToUInt32(split[1], 16); } + catch{return;} + } + else + { + try { zoneId = Convert.ToUInt32(split[1]); } + catch{return;} } #endregion - sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); + sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); doWarp(client, zoneId, privatearea, x, y, z, r); } else if (split.Length == 6) @@ -431,23 +431,23 @@ namespace FFXIVClassic_Lobby_Server y = Single.Parse(split[4]); z = Single.Parse(split[5]); } - catch{return;} - - if (split[1].ToLower().StartsWith("0x")) - { - try { zoneId = Convert.ToUInt32(split[1], 16); } - catch{return;} - } - else - { - try { zoneId = Convert.ToUInt32(split[1]); } - catch{return;} + catch{return;} + + if (split[1].ToLower().StartsWith("0x")) + { + try { zoneId = Convert.ToUInt32(split[1], 16); } + catch{return;} + } + else + { + try { zoneId = Convert.ToUInt32(split[1]); } + catch{return;} } privatearea = split[2]; #endregion - sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); + sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, x, y)); doWarp(client, zoneId, privatearea, x, y, z, r); } else diff --git a/FFXIVClassic Map Server/PacketProcessor.cs b/FFXIVClassic Map Server/PacketProcessor.cs index 9f922c55..5d04595e 100644 --- a/FFXIVClassic Map Server/PacketProcessor.cs +++ b/FFXIVClassic Map Server/PacketProcessor.cs @@ -188,7 +188,7 @@ namespace FFXIVClassic_Lobby_Server subpacket.debugPrintSubPacket(); client.queuePacket(_0x2Packet.buildPacket(player.actorID), true, false); - Server.getWorldManager().DoLogin(player.getActor()); + Server.GetWorldManager().DoLogin(player.getActor()); break; @@ -267,7 +267,7 @@ namespace FFXIVClassic_Lobby_Server if (ownerActor == null) { //Is it a instance actor? - ownerActor = Server.getWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); + ownerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); if (ownerActor == null) { //Is it a Director? @@ -298,7 +298,7 @@ namespace FFXIVClassic_Lobby_Server Actor updateOwnerActor = Server.getStaticActors(player.getActor().eventCurrentOwner); if (updateOwnerActor == null) { - updateOwnerActor = Server.getWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); + updateOwnerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().eventCurrentOwner); if (player.getActor().currentDirector != null && player.getActor().eventCurrentOwner == player.getActor().currentDirector.actorId) updateOwnerActor = player.getActor().currentDirector; diff --git a/FFXIVClassic Map Server/Server.cs b/FFXIVClassic Map Server/Server.cs index 206de92f..4a9e7e44 100644 --- a/FFXIVClassic Map Server/Server.cs +++ b/FFXIVClassic Map Server/Server.cs @@ -83,8 +83,8 @@ namespace FFXIVClassic_Lobby_Server mConnectionHealthThread.Name = "MapThread:Health"; //mConnectionHealthThread.Start(); - mStaticActors = new StaticActors(STATIC_ACTORS_PATH); - + mStaticActors = new StaticActors(STATIC_ACTORS_PATH); + gamedataItems = Database.getItemGamedata(); Log.info(String.Format("Loaded {0} items.", gamedataItems.Count)); @@ -95,9 +95,9 @@ namespace FFXIVClassic_Lobby_Server IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_MAP_PORT); - try + try { - mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); } catch (Exception e) { @@ -146,8 +146,8 @@ namespace FFXIVClassic_Lobby_Server private void acceptCallback(IAsyncResult result) { ClientConnection conn = null; - Socket socket = (System.Net.Sockets.Socket)result.AsyncState; - + Socket socket = (System.Net.Sockets.Socket)result.AsyncState; + try { @@ -169,8 +169,8 @@ namespace FFXIVClassic_Lobby_Server catch (SocketException) { if (conn != null) - { - + { + lock (mConnectionList) { mConnectionList.Remove(conn); @@ -181,7 +181,7 @@ namespace FFXIVClassic_Lobby_Server catch (Exception) { if (conn != null) - { + { lock (mConnectionList) { mConnectionList.Remove(conn); @@ -225,7 +225,7 @@ namespace FFXIVClassic_Lobby_Server lock (mConnectionList) { mConnectionList.Remove(conn); - } + } if (conn.connType == BasePacket.TYPE_ZONE) Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); return; @@ -243,36 +243,36 @@ namespace FFXIVClassic_Lobby_Server //Build packets until can no longer or out of data while (true) - { - BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead); - - //If can't build packet, break, else process another - if (basePacket == null) - break; - else - mProcessor.processPacket(conn, basePacket); - } - - //Not all bytes consumed, transfer leftover to beginning + { + BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead); + + //If can't build packet, break, else process another + if (basePacket == null) + break; + else + mProcessor.processPacket(conn, basePacket); + } + + //Not all bytes consumed, transfer leftover to beginning if (offset < bytesRead) Array.Copy(conn.buffer, offset, conn.buffer, 0, bytesRead - offset); conn.lastPartialSize = bytesRead - offset; //Build any queued subpackets into basepackets and send - conn.flushQueuedSendPackets(); - - if (offset < bytesRead) - //Need offset since not all bytes consumed + conn.flushQueuedSendPackets(); + + if (offset < bytesRead) + //Need offset since not all bytes consumed conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(receiveCallback), conn); - else - //All bytes consumed, full buffer available + else + //All bytes consumed, full buffer available conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn); } else { - Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); - + Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); + lock (mConnectionList) { mConnectionList.Remove(conn); @@ -280,15 +280,15 @@ namespace FFXIVClassic_Lobby_Server } } catch (SocketException) - { + { if (conn.socket != null) { - Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); - + Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner)); + lock (mConnectionList) { mConnectionList.Remove(conn); - } + } } } } @@ -326,23 +326,23 @@ namespace FFXIVClassic_Lobby_Server } return newPacket; - } - - #endregion - - public static WorldManager getWorldManager() - { - return mWorldManager; } - public Dictionary getConnectedPlayerList() - { - return mConnectedPlayerList; - } - - public static Dictionary getItemGamedataList() - { - return gamedataItems; - } + #endregion + + public static WorldManager GetWorldManager() + { + return mWorldManager; + } + + public Dictionary getConnectedPlayerList() + { + return mConnectedPlayerList; + } + + public static Dictionary getItemGamedataList() + { + return gamedataItems; + } } } \ No newline at end of file diff --git a/FFXIVClassic Map Server/actors/chara/npc/Npc.cs b/FFXIVClassic Map Server/actors/chara/npc/Npc.cs index e78444cf..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.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 e535cbf0..76d1de0a 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -703,34 +703,34 @@ namespace FFXIVClassic_Map_Server.Actors { if (msgParams.Length == 0) { - queuePacket(GameMessagePacket.buildPacket(Server.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.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.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.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.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.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.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.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) diff --git a/FFXIVClassic Map Server/lua/LuaEngine.cs b/FFXIVClassic Map Server/lua/LuaEngine.cs index 27631503..a9d18ee5 100644 --- a/FFXIVClassic Map Server/lua/LuaEngine.cs +++ b/FFXIVClassic Map Server/lua/LuaEngine.cs @@ -43,7 +43,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.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); @@ -82,9 +82,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["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(luaPath); @@ -125,9 +125,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["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(luaPath); @@ -158,9 +158,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["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(luaPath); @@ -175,9 +175,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["getWorldManager"] = (Func)Server.GetWorldManager; script.Globals["getStaticActor"] = (Func)Server.getStaticActors; - script.Globals["getWorldMaster"] = (Func)Server.getWorldManager().GetActor; + script.Globals["getWorldMaster"] = (Func)Server.GetWorldManager().GetActor; script.Globals["getItemGamedata"] = (Func)Server.getItemGamedata; script.DoFile(FILEPATH_PLAYER); From 5c7ca212aa2626da1732912eb98136be4f7c89b1 Mon Sep 17 00:00:00 2001 From: TheManii Date: Sat, 9 Apr 2016 12:38:15 -0700 Subject: [PATCH 6/6] 2nd half of previous commit --- FFXIVClassic Map Server/CommandProcessor.cs | 2 +- FFXIVClassic Map Server/Server.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index 2170338e..be11e8ea 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -25,7 +25,7 @@ namespace FFXIVClassic_Lobby_Server { private Dictionary mConnectedPlayerList; private static WorldManager mWorldManager = Server.GetWorldManager(); - private static Dictionary gamedataItems = Server.getItemGamedataList(); + private static Dictionary gamedataItems = Server.GetGamedataItems(); // For the moment, this is the only predefined item // TODO: make a list/enum in the future so that items can be given by name, instead of by id diff --git a/FFXIVClassic Map Server/Server.cs b/FFXIVClassic Map Server/Server.cs index 4a9e7e44..52e6480b 100644 --- a/FFXIVClassic Map Server/Server.cs +++ b/FFXIVClassic Map Server/Server.cs @@ -340,7 +340,7 @@ namespace FFXIVClassic_Lobby_Server return mConnectedPlayerList; } - public static Dictionary getItemGamedataList() + public static Dictionary GetGamedataItems() { return gamedataItems; }