diff --git a/FFXIVClassic Map Server/Server.cs b/FFXIVClassic Map Server/Server.cs index 6839a823..ccc3d29e 100644 --- a/FFXIVClassic Map Server/Server.cs +++ b/FFXIVClassic Map Server/Server.cs @@ -408,17 +408,17 @@ namespace FFXIVClassic_Lobby_Server return; if (client != null) - mWorldManager.DoZoneChange(client.getActor(), ze.zoneId, 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, 0.0f); else { foreach (KeyValuePair entry in mConnectedPlayerList) { - mWorldManager.DoZoneChange(entry.Value.getActor(), ze.zoneId, 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, 0.0f); } } } - public void doWarp(ConnectedPlayer client, string zone, string sx, string sy, string sz) + public void doWarp(ConnectedPlayer client, string zone, string privateArea, string sx, string sy, string sz) { uint zoneId; float x,y,z; @@ -427,7 +427,7 @@ namespace FFXIVClassic_Lobby_Server zoneId = Convert.ToUInt32(zone, 16); else zoneId = Convert.ToUInt32(zone); - + if (mWorldManager.GetZone(zoneId) == null) { if (client != null) @@ -440,12 +440,12 @@ namespace FFXIVClassic_Lobby_Server z = Single.Parse(sz); if (client != null) - mWorldManager.DoZoneChange(client.getActor(), zoneId, 0x2, x, y, z, 0.0f); + mWorldManager.DoZoneChange(client.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); else { foreach (KeyValuePair entry in mConnectedPlayerList) { - mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, 0x2, x, y, z, 0.0f); + mWorldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, 0x2, x, y, z, 0.0f); } } } @@ -827,7 +827,9 @@ namespace FFXIVClassic_Lobby_Server if (split.Length == 2) doWarp(client, split[1]); else if (split.Length == 5) - doWarp(client, split[1], split[2], split[3], split[4]); + doWarp(client, split[1], null, split[2], split[3], split[4]); + else if (split.Length == 6) + doWarp(client, split[1], split[2], split[3], split[4], split[5]); return true; } else if (split[0].Equals("property")) diff --git a/FFXIVClassic Map Server/WorldManager.cs b/FFXIVClassic Map Server/WorldManager.cs index fb54d8aa..d71988ce 100644 --- a/FFXIVClassic Map Server/WorldManager.cs +++ b/FFXIVClassic Map Server/WorldManager.cs @@ -35,7 +35,9 @@ namespace FFXIVClassic_Map_Server public void LoadZoneList() { zoneList = new Dictionary(); - int count = 0; + int count1 = 0; + int count2 = 0; + 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 @@ -67,7 +69,7 @@ namespace FFXIVClassic_Map_Server { Zone zone = new Zone(reader.GetUInt32(0), reader.GetString(1), reader.GetUInt16(2), reader.GetString(3), reader.GetUInt16(4), reader.GetUInt16(5), reader.GetUInt16(6), reader.GetBoolean(7), reader.GetBoolean(8), reader.GetBoolean(9), reader.GetBoolean(10), reader.GetBoolean(11)); zoneList[zone.actorId] = zone; - count++; + count1++; } } } @@ -79,7 +81,54 @@ namespace FFXIVClassic_Map_Server } } - Log.info(String.Format("Loaded {0} zones.", count)); + 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(); + + string query = @" + SELECT + id, + parentZoneId, + privateAreaName, + className, + dayMusic, + nightMusic, + battleMusic + FROM server_zones_privateareas + WHERE privateAreaName IS NOT NULL"; + + MySqlCommand cmd = new MySqlCommand(query, conn); + + using (MySqlDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + uint parentZoneId = reader.GetUInt32("parentZoneId"); + + if (zoneList.ContainsKey(parentZoneId)) + { + Zone parent = zoneList[parentZoneId]; + PrivateArea privArea = new PrivateArea(parent, reader.GetUInt32("id"), reader.GetString("className"), reader.GetString("privateAreaName"), reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic")); + parent.addPrivateArea(privArea); + } + else + continue; + + count2++; + } + } + } + catch (MySqlException e) + { Console.WriteLine(e); } + finally + { + conn.Dispose(); + } + } + + Log.info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2)); } public void LoadZoneEntranceList() @@ -100,7 +149,8 @@ namespace FFXIVClassic_Map_Server spawnX, spawnY, spawnZ, - spawnRotation + spawnRotation, + privateAreaName FROM server_zones_spawnlocations"; MySqlCommand cmd = new MySqlCommand(query, conn); @@ -110,7 +160,12 @@ namespace FFXIVClassic_Map_Server while (reader.Read()) { uint id = reader.GetUInt32(0); - ZoneEntrance entance = new ZoneEntrance(reader.GetUInt32(1), reader.GetByte(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6)); + string privArea = null; + + if (!reader.IsDBNull(7)) + privArea = reader.GetString(7); + + ZoneEntrance entance = new ZoneEntrance(reader.GetUInt32(1), privArea, reader.GetByte(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6)); zoneEntranceList[id] = entance; count++; } @@ -271,7 +326,7 @@ namespace FFXIVClassic_Map_Server //Moves the actor to the new zone if exists. No packets are sent nor position changed. public void DoSeamlessZoneChange(Player player, uint destinationZoneId) { - Zone oldZone; + Area oldZone; if (player.zone != null) { @@ -301,13 +356,13 @@ namespace FFXIVClassic_Map_Server } ZoneEntrance ze = zoneEntranceList[zoneEntrance]; - DoZoneChange(player, destinationZoneId, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation); + DoZoneChange(player, destinationZoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation); } //Moves actor to new zone, and sends packets to spawn at the given coords. - public void DoZoneChange(Player player, uint destinationZoneId, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation) + public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation) { - Zone oldZone; + Area oldZone; //Remove player from currentZone if transfer else it's login if (player.zone != null) @@ -317,17 +372,22 @@ namespace FFXIVClassic_Map_Server } //Add player to new zone and update - Zone newZone = GetZone(destinationZoneId); + Area newArea; + + if (destinationPrivateArea == null) + newArea = GetZone(destinationZoneId); + else + newArea = GetZone(destinationZoneId).getPrivateArea(destinationPrivateArea, 0); //This server does not contain that zoneId - if (newZone == null) + if (newArea == null) return; - newZone.addActorToZone(player); + newArea.addActorToZone(player); //Update player actor's properties - player.zoneId = newZone.actorId; - player.zone = newZone; + player.zoneId = newArea.actorId; + player.zone = newArea; player.positionX = spawnX; player.positionY = spawnY; player.positionZ = spawnZ; @@ -432,15 +492,17 @@ namespace FFXIVClassic_Map_Server public class ZoneEntrance { public uint zoneId; + public string privateAreaName; public byte spawnType; public float spawnX; public float spawnY; public float spawnZ; public float spawnRotation; - public ZoneEntrance(uint zoneId, byte spawnType, float x, float y, float z, float rot) + public ZoneEntrance(uint zoneId, string privateAreaName, byte spawnType, float x, float y, float z, float rot) { this.zoneId = zoneId; + this.privateAreaName = privateAreaName; this.spawnType = spawnType; this.spawnX = x; this.spawnY = y; diff --git a/FFXIVClassic Map Server/actors/Actor.cs b/FFXIVClassic Map Server/actors/Actor.cs index 00a23a6c..427a592d 100644 --- a/FFXIVClassic Map Server/actors/Actor.cs +++ b/FFXIVClassic Map Server/actors/Actor.cs @@ -33,7 +33,7 @@ namespace FFXIVClassic_Map_Server.Actors public float[] moveSpeeds = new float[5]; public uint zoneId; - public Zone zone = null; + public Area zone = null; public bool isZoning = false; public bool spawnedFirstTime = false; @@ -132,6 +132,24 @@ namespace FFXIVClassic_Map_Server.Actors subpackets.Add(SetEmoteEventCondition.buildPacket(playerActorId, actorId, condition.unknown1, condition.unknown2, condition.emoteId, condition.conditionName)); } + if (eventConditions.pushWithCircleEventConditions != null) + { + foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions) + subpackets.Add(SetPushEventConditionWithCircle.buildPacket(playerActorId, actorId, condition)); + } + + if (eventConditions.pushWithFanEventConditions != null) + { + foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions) + subpackets.Add(SetPushEventConditionWithFan.buildPacket(playerActorId, actorId, condition)); + } + + if (eventConditions.pushWithBoxEventConditions != null) + { + foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions) + subpackets.Add(SetPushEventConditionWithTriggerBox.buildPacket(playerActorId, actorId, condition)); + } + return subpackets; } @@ -161,6 +179,24 @@ namespace FFXIVClassic_Map_Server.Actors subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 1, condition.conditionName)); } + if (eventConditions.pushWithCircleEventConditions != null) + { + foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions) + subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 2, condition.conditionName)); + } + + if (eventConditions.pushWithFanEventConditions != null) + { + foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions) + subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 2, condition.conditionName)); + } + + if (eventConditions.pushWithBoxEventConditions != null) + { + foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions) + subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 2, condition.conditionName)); + } + return BasePacket.createPacket(subpackets, true, false); } diff --git a/FFXIVClassic Map Server/actors/EventList.cs b/FFXIVClassic Map Server/actors/EventList.cs index ae633288..fc2c780e 100644 --- a/FFXIVClassic Map Server/actors/EventList.cs +++ b/FFXIVClassic Map Server/actors/EventList.cs @@ -39,30 +39,26 @@ namespace FFXIVClassic_Map_Server.actors public class PushCircleEventCondition { - public byte unknown1; - public byte unknown2; - public byte unknown4; - public byte emoteId; - public float radius; - public int unknown5; - public float unknown6; - public string conditionName; + public string conditionName = ""; + public float radius = 30.0f; + public bool outwards = false; + public bool silent = true; } public class PushFanEventCondition { - byte unknown1; - byte unknown2; - byte emoteId; - string conditionName; + public string conditionName; + public float radius = 30.0f; + public bool outwards = false; + public bool silent = true; } public class PushBoxEventCondition { - byte unknown1; - byte unknown2; - byte emoteId; - string conditionName; + public string conditionName = ""; + public float size = 30.0f; + public bool outwards = false; + public bool silent = true; } } } diff --git a/FFXIVClassic Map Server/actors/area/PrivateArea.cs b/FFXIVClassic Map Server/actors/area/PrivateArea.cs index 9f9e821a..ab788357 100644 --- a/FFXIVClassic Map Server/actors/area/PrivateArea.cs +++ b/FFXIVClassic Map Server/actors/area/PrivateArea.cs @@ -22,11 +22,22 @@ namespace FFXIVClassic_Map_Server.actors.area this.privateAreaName = privateAreaName; } + public string getPrivateAreaName() + { + return privateAreaName; + } + + public Zone getParentZone() + { + return parentZone; + } + public override SubPacket createScriptBindPacket(uint playerActorId) { List lParams; - lParams = LuaUtils.createLuaParamList("/Area/PrivateArea/" + className, false, true, zoneName, privateAreaName, 0xE1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false); + lParams = LuaUtils.createLuaParamList("/Area/PrivateArea/" + className, false, true, zoneName, privateAreaName, 0x9E, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false); return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams); } + } } diff --git a/FFXIVClassic Map Server/actors/area/Zone.cs b/FFXIVClassic Map Server/actors/area/Zone.cs index 73c909d2..90e716d2 100644 --- a/FFXIVClassic Map Server/actors/area/Zone.cs +++ b/FFXIVClassic Map Server/actors/area/Zone.cs @@ -20,6 +20,17 @@ namespace FFXIVClassic_Map_Server.actors.area } + public void addPrivateArea(PrivateArea pa) + { + if (privateAreas.ContainsKey(pa.getPrivateAreaName())) + privateAreas[pa.getPrivateAreaName()][0] = pa; + else + { + privateAreas[pa.getPrivateAreaName()] = new Dictionary(); + privateAreas[pa.getPrivateAreaName()][0] = pa; + } + } + public PrivateArea getPrivateArea(string type, uint number) { if (privateAreas.ContainsKey(type)) diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index a222e4d2..16d86bb1 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -636,7 +636,7 @@ namespace FFXIVClassic_Map_Server.Actors Log.info(String.Format("{0} has been logged out and saved.", this.customDisplayName)); } - public Zone getZone() + public Area getZone() { return zone; } diff --git a/FFXIVClassic Map Server/packets/send/Actor/ActorInstantiatePacket.cs b/FFXIVClassic Map Server/packets/send/Actor/ActorInstantiatePacket.cs index b7fa6d20..4b0a0d29 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/ActorInstantiatePacket.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/ActorInstantiatePacket.cs @@ -22,8 +22,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - int value1 = 0x10; //Instance ID? - int value2 = 0x3980; + int value1 = 0x02; //Instance ID? + int value2 = 0x2bc0; binWriter.Write((Int16)value1); binWriter.Write((Int16)value2); binWriter.Write(Encoding.ASCII.GetBytes(objectName), 0, Encoding.ASCII.GetByteCount(objectName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(objectName)); diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs index d30dabe5..3677841c 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetNoticeEventCondition.cs @@ -1,4 +1,5 @@ using FFXIVClassic_Lobby_Server.packets; +using FFXIVClassic_Map_Server.actors; using System; using System.Collections.Generic; using System.IO; @@ -13,7 +14,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x016B; public const uint PACKET_SIZE = 0x48; - public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, byte unknown1, byte unknown2, string conditionName) + public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.NoticeEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -21,9 +22,9 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - binWriter.Write((Byte)unknown1); - binWriter.Write((Byte)unknown2); - binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(conditionName)); + binWriter.Write((Byte)condition.unknown1); + binWriter.Write((Byte)condition.unknown2); + binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs index c7545c24..5866b3eb 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithCircle.cs @@ -1,4 +1,5 @@ using FFXIVClassic_Lobby_Server.packets; +using FFXIVClassic_Map_Server.actors; using System; using System.Collections.Generic; using System.IO; @@ -13,24 +14,22 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x016F; public const uint PACKET_SIZE = 0x58; - public static SubPacket buildPacket(uint playerActorID, uint sourceActorID) + public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.PushCircleEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; - string eventName = ""; - using (MemoryStream mem = new MemoryStream(data)) { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - binWriter.Write((Single)0.0f); - binWriter.Write((UInt32)0); - binWriter.Write((Single)0.0f); + binWriter.Write((Single)condition.radius); + binWriter.Write((UInt32)0x44533088); + binWriter.Write((Single)100.0f); binWriter.Seek(4, SeekOrigin.Current); + binWriter.Write((Byte)(condition.outwards ? 0x11 : 0x1)); //If == 0x10, Inverted Bounding Box binWriter.Write((Byte)0); - binWriter.Write((Byte)0); - binWriter.Write((Byte)0); - binWriter.Write(Encoding.ASCII.GetBytes(eventName), 0, Encoding.ASCII.GetByteCount(eventName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(eventName)); + binWriter.Write((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger + binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs index c37ac803..700b0321 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithFan.cs @@ -1,4 +1,5 @@ using FFXIVClassic_Lobby_Server.packets; +using FFXIVClassic_Map_Server.actors; using System; using System.Collections.Generic; using System.IO; @@ -13,27 +14,27 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x0170; public const uint PACKET_SIZE = 0x60; - public static SubPacket buildPacket(uint playerActorID, uint sourceActorID) + public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.PushFanEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; - string eventName = ""; - using (MemoryStream mem = new MemoryStream(data)) { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - binWriter.Write((Single)0.0f); - binWriter.Write((UInt32)0); - binWriter.Write((Single)0.0f); + binWriter.Write((Single)condition.radius); + binWriter.Write((UInt32)0xbfc90fdb); + binWriter.Write((UInt32)0x3f860a92); + binWriter.Write((UInt32)sourceActorID); //Actor Id + binWriter.Write((Single)10.0f); binWriter.Seek(4, SeekOrigin.Current); + binWriter.Write((Byte)(condition.outwards ? 0x11 : 0x1)); //If == 0x10, Inverted Bounding Box binWriter.Write((Byte)0); - binWriter.Write((Byte)0); - binWriter.Write((Byte)0); - binWriter.Write(Encoding.ASCII.GetBytes(eventName), 0, Encoding.ASCII.GetByteCount(eventName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(eventName)); + binWriter.Write((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger + binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } } - + new SubPacket(OPCODE, sourceActorID, playerActorID, data).debugPrintSubPacket(); return new SubPacket(OPCODE, sourceActorID, playerActorID, data); } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs index ae84ba4f..c338b1b8 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetPushEventConditionWithTriggerBox.cs @@ -1,4 +1,5 @@ using FFXIVClassic_Lobby_Server.packets; +using FFXIVClassic_Map_Server.actors; using System; using System.Collections.Generic; using System.IO; @@ -11,26 +12,24 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events class SetPushEventConditionWithTriggerBox { public const ushort OPCODE = 0x0175; - public const uint PACKET_SIZE = 0x58; + public const uint PACKET_SIZE = 0x60; - public static SubPacket buildPacket(uint playerActorID, uint sourceActorID) + public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.PushBoxEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; - string eventName = ""; - using (MemoryStream mem = new MemoryStream(data)) { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - binWriter.Write((Single)0.0f); - binWriter.Write((UInt32)0); - binWriter.Write((Single)0.0f); - binWriter.Seek(4, SeekOrigin.Current); + binWriter.Write((UInt32)condition.size); + binWriter.Write((UInt32)0x1A5); + binWriter.Write((UInt32)4); + binWriter.Seek(8, SeekOrigin.Current); + binWriter.Write((Byte)(condition.outwards ? 0x11 : 0x1)); //If == 0x10, Inverted Bounding Box binWriter.Write((Byte)0); - binWriter.Write((Byte)0); - binWriter.Write((Byte)0); - binWriter.Write(Encoding.ASCII.GetBytes(eventName), 0, Encoding.ASCII.GetByteCount(eventName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(eventName)); + binWriter.Write((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger; + binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } } diff --git a/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs b/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs index a84cf87b..9e4d8b0a 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/events/SetTalkEventCondition.cs @@ -1,4 +1,5 @@ using FFXIVClassic_Lobby_Server.packets; +using FFXIVClassic_Map_Server.actors; using System; using System.Collections.Generic; using System.IO; @@ -13,7 +14,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events public const ushort OPCODE = 0x012E; public const uint PACKET_SIZE = 0x48; - public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, byte unknown1, byte unknown2, string conditionName) + public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.TalkEventCondition condition) { byte[] data = new byte[PACKET_SIZE - 0x20]; @@ -21,9 +22,9 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - binWriter.Write((Byte)unknown1); - binWriter.Write((Byte)unknown2); - binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(conditionName)); + binWriter.Write((Byte)condition.unknown1); + binWriter.Write((Byte)condition.unknown2); + binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName)); } }