diff --git a/FFXIVClassic Map Server/CommandProcessor.cs b/FFXIVClassic Map Server/CommandProcessor.cs index 1e4de7a0..4c4d63d4 100644 --- a/FFXIVClassic Map Server/CommandProcessor.cs +++ b/FFXIVClassic Map Server/CommandProcessor.cs @@ -118,7 +118,7 @@ namespace FFXIVClassic_Lobby_Server } } - public void doWarp(ConnectedPlayer client, uint zoneId, string privateArea, float x, float y, float z, float r) + public void doWarp(ConnectedPlayer client, uint zoneId, string privateArea, byte spawnType, float x, float y, float z, float r) { if (mWorldManager.GetZone(zoneId) == null) { @@ -128,12 +128,12 @@ namespace FFXIVClassic_Lobby_Server } if (client != null) - mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, r); + mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, spawnType, 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, spawnType, x, y, z, r); } } } @@ -146,7 +146,7 @@ namespace FFXIVClassic_Lobby_Server client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation)), true, false)); } else - { + { foreach (KeyValuePair entry in mConnectedPlayerList) { Player p = entry.Value.getActor(); @@ -394,7 +394,7 @@ namespace FFXIVClassic_Lobby_Server #endregion sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z)); - doWarp(client, zoneId, privatearea, x, y, z, r); + doWarp(client, zoneId, privatearea, 0x00, x, y, z, r); } else if (split.Length == 5) { @@ -420,7 +420,7 @@ namespace FFXIVClassic_Lobby_Server #endregion sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z)); - doWarp(client, zoneId, privatearea, x, y, z, r); + doWarp(client, zoneId, privatearea, 0x2, x, y, z, r); } else if (split.Length == 6) { @@ -448,12 +448,42 @@ namespace FFXIVClassic_Lobby_Server #endregion sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z)); - doWarp(client, zoneId, privatearea, x, y, z, r); + doWarp(client, zoneId, privatearea, 0x2, x, y, z, r); } else return; // catch any invalid warps here } + private void doWeather(ConnectedPlayer client, string weatherID) + { + long weather = Convert.ToInt64(weatherID); + + if (client != null) + { + client.queuePacket(BasePacket.createPacket(SetWeatherPacket.buildPacket(client.actorID, weather), true, false)); + } + + /* + * WIP: Change weather serverside, currently only clientside + * + uint currentZoneID; + if (client != null) + { + currentZoneID = client.getActor().zoneId; + + foreach (KeyValuePair entry in mConnectedPlayerList) + { + // Change the weather for everyone in the same zone + if (currentZoneID == entry.Value.getActor().zoneId) + { + BasePacket weatherPacket = BasePacket.createPacket(SetWeatherPacket.buildPacket(entry.Value.actorID, weather), true, false); + entry.Value.queuePacket(weatherPacket); + } + } + } + */ + } + /// /// We only use the default options for SendMessagePacket. /// May as well make it less unwieldly to view @@ -521,13 +551,50 @@ namespace FFXIVClassic_Lobby_Server sendMessage(client, Resources.CPsendpacket); else if (split[1].Equals("setgraphic")) sendMessage(client, Resources.CPsetgraphic); - */ + */ + } + if (split.Length == 3) + { + if(split[1].Equals("test")) + { + if (split[2].Equals("weather")) + sendMessage(client, Resources.CPtestweather); + } } return true; - } + } #endregion - + + #region !test + else if (split[0].Equals("test")) + { + if (split.Length == 1) + { + // catch invalid commands + sendMessage(client, Resources.CPhelp); + } + else if (split.Length >= 2) + { + #region !test weather + if (split[1].Equals("weather")) + { + try + { + doWeather(client, split[2]); + return true; + } + catch (Exception e) + { + Log.error("Could not change weather: " + e); + } + } + #endregion + } + + } + #endregion + #region !mypos else if (split[0].Equals("mypos")) { diff --git a/FFXIVClassic Map Server/Properties/Resources.Designer.cs b/FFXIVClassic Map Server/Properties/Resources.Designer.cs index d0cae89c..62ed5ea5 100644 --- a/FFXIVClassic Map Server/Properties/Resources.Designer.cs +++ b/FFXIVClassic Map Server/Properties/Resources.Designer.cs @@ -64,7 +64,7 @@ namespace FFXIVClassic_Map_Server.Properties { /// Looks up a localized string similar to Adds the specified currency to the current player's inventory /// ///*Syntax: givecurrency <quantity> - /// givecurrency <quantity> <type> + /// givecurrency <type> <quantity> ///<type> is the specific type of currency desired, defaults to gil if no type specified. /// public static string CPgivecurrency { @@ -105,7 +105,8 @@ namespace FFXIVClassic_Map_Server.Properties { /// ///Available commands: ///Standard: mypos, music, warp - ///Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, removekeyitem, reloaditems, reloadzones. + ///Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, removekeyitem, reloaditems, reloadzones + ///Test: test weather. /// public static string CPhelp { get { @@ -117,7 +118,7 @@ namespace FFXIVClassic_Map_Server.Properties { /// Looks up a localized string similar to Changes the currently playing background music /// ///*Syntax: music <music id> - ///<music id> is the key item's specific id as defined in the server database. + ///<music id> is the music's specific id as defined in the client. /// public static string CPmusic { get { @@ -176,7 +177,7 @@ namespace FFXIVClassic_Map_Server.Properties { /// Looks up a localized string similar to Removes the specified currency from the current player's inventory /// ///*Syntax: removecurrency <quantity> - /// removecurrency <quantity> <type> + /// removecurrency <type> <quantity> ///<type> is the specific type of currency desired, defaults to gil if no type specified. /// public static string CPremovecurrency { @@ -236,6 +237,18 @@ namespace FFXIVClassic_Map_Server.Properties { } } + /// + /// Looks up a localized string similar to Changes the current weather + /// + ///*Syntax: test weather <weather id> + ///<weather id> is the weather's specific id as defined in the client. + /// + public static string CPtestweather { + get { + return ResourceManager.GetString("CPtestweather", resourceCulture); + } + } + /// /// Looks up a localized string similar to Teleports the player to the specified location /// diff --git a/FFXIVClassic Map Server/Properties/Resources.resx b/FFXIVClassic Map Server/Properties/Resources.resx index f121876e..0413ecca 100644 --- a/FFXIVClassic Map Server/Properties/Resources.resx +++ b/FFXIVClassic Map Server/Properties/Resources.resx @@ -121,7 +121,7 @@ Adds the specified currency to the current player's inventory *Syntax: givecurrency <quantity> - givecurrency <quantity> <type> + givecurrency <type> <quantity> <type> is the specific type of currency desired, defaults to gil if no type specified @@ -144,13 +144,14 @@ Available commands: Standard: mypos, music, warp -Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, removekeyitem, reloaditems, reloadzones +Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, removekeyitem, reloaditems, reloadzones +Test: test weather Changes the currently playing background music *Syntax: music <music id> -<music id> is the key item's specific id as defined in the server database +<music id> is the music's specific id as defined in the client Prints out your current location @@ -173,7 +174,7 @@ Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, remo Removes the specified currency from the current player's inventory *Syntax: removecurrency <quantity> - removecurrency <quantity> <type> + removecurrency <type> <quantity> <type> is the specific type of currency desired, defaults to gil if no type specified @@ -202,6 +203,12 @@ Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, remo *Syntax: sendpacket <slot> <wid> <eid> <vid> <cid> <w/e/v/c id> are as defined in the client game data + + + Changes the current weather + +*Syntax: test weather <weather id> +<weather id> is the weather's specific id as defined in the client Teleports the player to the specified location diff --git a/FFXIVClassic Map Server/packets/send/SetWeatherPacket.cs b/FFXIVClassic Map Server/packets/send/SetWeatherPacket.cs index 1eb9bc2e..44d7ae3a 100644 --- a/FFXIVClassic Map Server/packets/send/SetWeatherPacket.cs +++ b/FFXIVClassic Map Server/packets/send/SetWeatherPacket.cs @@ -9,30 +9,36 @@ namespace FFXIVClassic_Map_Server.packets.send { class SetWeatherPacket { - //TODO: Fix these ids! - public const uint WEATHER_CLEAR = 0x011F41; - public const uint WEATHER_FINE = 0x011F42; - public const uint WEATHER_CLOUDY = 0x011F3; - public const uint WEATHER_FOGGY = 0x011F4; - public const uint WEATHER_WINDY = 0x011F5; //NOT SUPPORTED in v1.23 - public const uint WEATHER_BLUSTERY = 0x011F6; - public const uint WEATHER_RAINY = 0x011F7; - public const uint WEATHER_SHOWERY = 0x011F8; //NOT SUPPORTED in v1.23 - public const uint WEATHER_THUNDERY = 0x011F9; //NOT SUPPORTED in v1.23 - public const uint WEATHER_STORMY = 0x011FA; - public const uint WEATHER_DUSTY = 0x011FB; //NOT SUPPORTED in v1.23 - public const uint WEATHER_SANDY = 0x011FC; - public const uint WEATHER_IFRIT = 0x011F4E; - public const uint WEATHER_GARUDA = 0x011F5C; - public const uint WEATHER_BLISTERIN = 0x011FD; //NOT SUPPORTED in v1.23 - public const uint WEATHER_SNOWY = 0x011FE; //NOT SUPPORTED in v1.23 - public const uint WEATHER_WINTRY = 0x011FF; //NOT SUPPORTED in v1.23 - public const uint WEATHER_GLOOMY = 0x01200; - public const uint WEATHER_PREDALAMUD = 0x011F5F; - public const uint WEATHER_DALAMUD = 0x011F5E; - public const uint WEATHER_SCARYDALAMUD = 0x011F60; - - public const ushort OPCODE = 0x000D; + // Use the first value to change without a transition, the second value to do a standard transition + public const uint WEATHER_CLEAR = 0x011F41; // 8001 / 73537 + public const uint WEATHER_FAIR = 0x011F42; // 8002 / 73538 + public const uint WEATHER_CLOUDY = 0x011F43; // 8003 / 73539 + public const uint WEATHER_FOGGY = 0x011F44; // 8004 / 73540 + public const uint WEATHER_WINDY = 0x011F45; // 8005 / 73541 - NOT SUPPORTED in v1.23b + public const uint WEATHER_BLUSTERY = 0x011F46; // 8006 / 73542 + public const uint WEATHER_RAINY = 0x011F47; // 8007 / 73543 + public const uint WEATHER_SHOWERY = 0x011F48; // 8008 / 73544 - NOT SUPPORTED in v1.23b + public const uint WEATHER_THUNDERY = 0x011F49; // 8009 / 73545 - NOT SUPPORTED in v1.23b + public const uint WEATHER_STORMY = 0x011F4A; // 8010 / 73546 + public const uint WEATHER_DUSTY = 0x011F4B; // 8011 / 73547 - NOT SUPPORTED in v1.23b + public const uint WEATHER_SANDY = 0x011F4C; // 8012 / 73548 + public const uint WEATHER_HOT = 0x011F4D; // 8013 / 73549 - NOT SUPPORTED in v1.23b + public const uint WEATHER_BLISTERING = 0x011F4E; // 8014 / 73550 - Bowl Of Embers Weather + public const uint WEATHER_SNOWY = 0x011F4F; // 8015 / 73551 - NOT SUPPORTED in v1.23b + public const uint WEATHER_WINTRY = 0x011F50; // 8016 / 73552 - NOT SUPPORTED in v1.23b + public const uint WEATHER_GLOOMY = 0x011F51; // 8017 / 73553 + // 8018 - 8026 / 73554 - 73562 - NOT SUPPORTED in v1.23b + public const uint WEATHER_SEASONAL = 0x011F5B; // 8027 / 73563 - Snow in Black Shroud, nothing elsewhere + public const uint WEATHER_PRIMAL = 0x011F5C; // 8028 / 73564 - Howling Eye and Thornmarch Weather + public const uint WEATHER_SEASONAL_FIREWORKS = 0x011F5D; // 8029 / 73565 - Plays fireworks between 20:00 - 21:00 ET + public const uint WEATHER_DALAMUD = 0x011F5E; // 8030 / 73566 + public const uint WEATHER_AURORA = 0x011F5F; // 8031 / 73567 + public const uint WEATHER_DALAMUD_THUNDER = 0x011F60; // 8032 / 73568 + // 8033 - 8064 / 73569 - 73600 - NOT SUPPORTED in v1.23b + public const uint WEATHER_DAY = 0x011F81; // 8065 / 73601 - Force skybox to show Day + Fair regardless of current ET + public const uint WEATHER_TWILIGHT = 0x011F82; // 8066 / 73602 - Force skybox to show Twilight + Clear regardless of current ET + + public const ushort OPCODE = 0x000D; public const uint PACKET_SIZE = 0x28; public static SubPacket buildPacket(uint playerActorID, long weatherId)