1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-22 12:47:46 +00:00

Started to implement private areas. Works mostly, but only one instance is created. All the push triggers work more or less except bounding box.

This commit is contained in:
Filip Maj 2016-03-20 19:29:38 -04:00
parent 67fed3dba5
commit 0876b293e8
13 changed files with 200 additions and 81 deletions

View file

@ -408,17 +408,17 @@ namespace FFXIVClassic_Lobby_Server
return; return;
if (client != null) 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 else
{ {
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList) foreach (KeyValuePair<uint, ConnectedPlayer> 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; uint zoneId;
float x,y,z; float x,y,z;
@ -427,7 +427,7 @@ namespace FFXIVClassic_Lobby_Server
zoneId = Convert.ToUInt32(zone, 16); zoneId = Convert.ToUInt32(zone, 16);
else else
zoneId = Convert.ToUInt32(zone); zoneId = Convert.ToUInt32(zone);
if (mWorldManager.GetZone(zoneId) == null) if (mWorldManager.GetZone(zoneId) == null)
{ {
if (client != null) if (client != null)
@ -440,12 +440,12 @@ namespace FFXIVClassic_Lobby_Server
z = Single.Parse(sz); z = Single.Parse(sz);
if (client != null) 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 else
{ {
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList) foreach (KeyValuePair<uint, ConnectedPlayer> 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) if (split.Length == 2)
doWarp(client, split[1]); doWarp(client, split[1]);
else if (split.Length == 5) 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; return true;
} }
else if (split[0].Equals("property")) else if (split[0].Equals("property"))

View file

@ -35,7 +35,9 @@ namespace FFXIVClassic_Map_Server
public void LoadZoneList() public void LoadZoneList()
{ {
zoneList = new Dictionary<uint, Zone>(); zoneList = new Dictionary<uint, Zone>();
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))) 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 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)); 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; 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() public void LoadZoneEntranceList()
@ -100,7 +149,8 @@ namespace FFXIVClassic_Map_Server
spawnX, spawnX,
spawnY, spawnY,
spawnZ, spawnZ,
spawnRotation spawnRotation,
privateAreaName
FROM server_zones_spawnlocations"; FROM server_zones_spawnlocations";
MySqlCommand cmd = new MySqlCommand(query, conn); MySqlCommand cmd = new MySqlCommand(query, conn);
@ -110,7 +160,12 @@ namespace FFXIVClassic_Map_Server
while (reader.Read()) while (reader.Read())
{ {
uint id = reader.GetUInt32(0); 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; zoneEntranceList[id] = entance;
count++; 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. //Moves the actor to the new zone if exists. No packets are sent nor position changed.
public void DoSeamlessZoneChange(Player player, uint destinationZoneId) public void DoSeamlessZoneChange(Player player, uint destinationZoneId)
{ {
Zone oldZone; Area oldZone;
if (player.zone != null) if (player.zone != null)
{ {
@ -301,13 +356,13 @@ namespace FFXIVClassic_Map_Server
} }
ZoneEntrance ze = zoneEntranceList[zoneEntrance]; 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. //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 //Remove player from currentZone if transfer else it's login
if (player.zone != null) if (player.zone != null)
@ -317,17 +372,22 @@ namespace FFXIVClassic_Map_Server
} }
//Add player to new zone and update //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 //This server does not contain that zoneId
if (newZone == null) if (newArea == null)
return; return;
newZone.addActorToZone(player); newArea.addActorToZone(player);
//Update player actor's properties //Update player actor's properties
player.zoneId = newZone.actorId; player.zoneId = newArea.actorId;
player.zone = newZone; player.zone = newArea;
player.positionX = spawnX; player.positionX = spawnX;
player.positionY = spawnY; player.positionY = spawnY;
player.positionZ = spawnZ; player.positionZ = spawnZ;
@ -432,15 +492,17 @@ namespace FFXIVClassic_Map_Server
public class ZoneEntrance public class ZoneEntrance
{ {
public uint zoneId; public uint zoneId;
public string privateAreaName;
public byte spawnType; public byte spawnType;
public float spawnX; public float spawnX;
public float spawnY; public float spawnY;
public float spawnZ; public float spawnZ;
public float spawnRotation; 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.zoneId = zoneId;
this.privateAreaName = privateAreaName;
this.spawnType = spawnType; this.spawnType = spawnType;
this.spawnX = x; this.spawnX = x;
this.spawnY = y; this.spawnY = y;

View file

@ -33,7 +33,7 @@ namespace FFXIVClassic_Map_Server.Actors
public float[] moveSpeeds = new float[5]; public float[] moveSpeeds = new float[5];
public uint zoneId; public uint zoneId;
public Zone zone = null; public Area zone = null;
public bool isZoning = false; public bool isZoning = false;
public bool spawnedFirstTime = 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)); 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; return subpackets;
} }
@ -161,6 +179,24 @@ namespace FFXIVClassic_Map_Server.Actors
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, 1, 1, condition.conditionName)); 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); return BasePacket.createPacket(subpackets, true, false);
} }

View file

@ -39,30 +39,26 @@ namespace FFXIVClassic_Map_Server.actors
public class PushCircleEventCondition public class PushCircleEventCondition
{ {
public byte unknown1; public string conditionName = "";
public byte unknown2; public float radius = 30.0f;
public byte unknown4; public bool outwards = false;
public byte emoteId; public bool silent = true;
public float radius;
public int unknown5;
public float unknown6;
public string conditionName;
} }
public class PushFanEventCondition public class PushFanEventCondition
{ {
byte unknown1; public string conditionName;
byte unknown2; public float radius = 30.0f;
byte emoteId; public bool outwards = false;
string conditionName; public bool silent = true;
} }
public class PushBoxEventCondition public class PushBoxEventCondition
{ {
byte unknown1; public string conditionName = "";
byte unknown2; public float size = 30.0f;
byte emoteId; public bool outwards = false;
string conditionName; public bool silent = true;
} }
} }
} }

View file

@ -22,11 +22,22 @@ namespace FFXIVClassic_Map_Server.actors.area
this.privateAreaName = privateAreaName; this.privateAreaName = privateAreaName;
} }
public string getPrivateAreaName()
{
return privateAreaName;
}
public Zone getParentZone()
{
return parentZone;
}
public override SubPacket createScriptBindPacket(uint playerActorId) public override SubPacket createScriptBindPacket(uint playerActorId)
{ {
List<LuaParam> lParams; List<LuaParam> 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); return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
} }
} }
} }

View file

@ -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<uint, PrivateArea>();
privateAreas[pa.getPrivateAreaName()][0] = pa;
}
}
public PrivateArea getPrivateArea(string type, uint number) public PrivateArea getPrivateArea(string type, uint number)
{ {
if (privateAreas.ContainsKey(type)) if (privateAreas.ContainsKey(type))

View file

@ -636,7 +636,7 @@ namespace FFXIVClassic_Map_Server.Actors
Log.info(String.Format("{0} has been logged out and saved.", this.customDisplayName)); Log.info(String.Format("{0} has been logged out and saved.", this.customDisplayName));
} }
public Zone getZone() public Area getZone()
{ {
return zone; return zone;
} }

View file

@ -22,8 +22,8 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
{ {
using (BinaryWriter binWriter = new BinaryWriter(mem)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
int value1 = 0x10; //Instance ID? int value1 = 0x02; //Instance ID?
int value2 = 0x3980; int value2 = 0x2bc0;
binWriter.Write((Int16)value1); binWriter.Write((Int16)value1);
binWriter.Write((Int16)value2); binWriter.Write((Int16)value2);
binWriter.Write(Encoding.ASCII.GetBytes(objectName), 0, Encoding.ASCII.GetByteCount(objectName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(objectName)); binWriter.Write(Encoding.ASCII.GetBytes(objectName), 0, Encoding.ASCII.GetByteCount(objectName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(objectName));

View file

@ -1,4 +1,5 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -13,7 +14,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
public const ushort OPCODE = 0x016B; public const ushort OPCODE = 0x016B;
public const uint PACKET_SIZE = 0x48; 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]; 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)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
binWriter.Write((Byte)unknown1); binWriter.Write((Byte)condition.unknown1);
binWriter.Write((Byte)unknown2); binWriter.Write((Byte)condition.unknown2);
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(conditionName)); binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
} }
} }

View file

@ -1,4 +1,5 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -13,24 +14,22 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
public const ushort OPCODE = 0x016F; public const ushort OPCODE = 0x016F;
public const uint PACKET_SIZE = 0x58; 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]; byte[] data = new byte[PACKET_SIZE - 0x20];
string eventName = "";
using (MemoryStream mem = new MemoryStream(data)) using (MemoryStream mem = new MemoryStream(data))
{ {
using (BinaryWriter binWriter = new BinaryWriter(mem)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
binWriter.Write((Single)0.0f); binWriter.Write((Single)condition.radius);
binWriter.Write((UInt32)0); binWriter.Write((UInt32)0x44533088);
binWriter.Write((Single)0.0f); binWriter.Write((Single)100.0f);
binWriter.Seek(4, SeekOrigin.Current); 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((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger
binWriter.Write((Byte)0); binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
binWriter.Write(Encoding.ASCII.GetBytes(eventName), 0, Encoding.ASCII.GetByteCount(eventName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(eventName));
} }
} }

View file

@ -1,4 +1,5 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -13,27 +14,27 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
public const ushort OPCODE = 0x0170; public const ushort OPCODE = 0x0170;
public const uint PACKET_SIZE = 0x60; 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]; byte[] data = new byte[PACKET_SIZE - 0x20];
string eventName = "";
using (MemoryStream mem = new MemoryStream(data)) using (MemoryStream mem = new MemoryStream(data))
{ {
using (BinaryWriter binWriter = new BinaryWriter(mem)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
binWriter.Write((Single)0.0f); binWriter.Write((Single)condition.radius);
binWriter.Write((UInt32)0); binWriter.Write((UInt32)0xbfc90fdb);
binWriter.Write((Single)0.0f); binWriter.Write((UInt32)0x3f860a92);
binWriter.Write((UInt32)sourceActorID); //Actor Id
binWriter.Write((Single)10.0f);
binWriter.Seek(4, SeekOrigin.Current); 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((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger
binWriter.Write((Byte)0); binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
binWriter.Write(Encoding.ASCII.GetBytes(eventName), 0, Encoding.ASCII.GetByteCount(eventName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(eventName));
} }
} }
new SubPacket(OPCODE, sourceActorID, playerActorID, data).debugPrintSubPacket();
return new SubPacket(OPCODE, sourceActorID, playerActorID, data); return new SubPacket(OPCODE, sourceActorID, playerActorID, data);
} }
} }

View file

@ -1,4 +1,5 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -11,26 +12,24 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
class SetPushEventConditionWithTriggerBox class SetPushEventConditionWithTriggerBox
{ {
public const ushort OPCODE = 0x0175; 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]; byte[] data = new byte[PACKET_SIZE - 0x20];
string eventName = "";
using (MemoryStream mem = new MemoryStream(data)) using (MemoryStream mem = new MemoryStream(data))
{ {
using (BinaryWriter binWriter = new BinaryWriter(mem)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
binWriter.Write((Single)0.0f); binWriter.Write((UInt32)condition.size);
binWriter.Write((UInt32)0); binWriter.Write((UInt32)0x1A5);
binWriter.Write((Single)0.0f); binWriter.Write((UInt32)4);
binWriter.Seek(4, SeekOrigin.Current); 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((Byte)(condition.silent ? 0x1 : 0x0)); //Silent Trigger;
binWriter.Write((Byte)0); binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
binWriter.Write(Encoding.ASCII.GetBytes(eventName), 0, Encoding.ASCII.GetByteCount(eventName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(eventName));
} }
} }

View file

@ -1,4 +1,5 @@
using FFXIVClassic_Lobby_Server.packets; using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.actors;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -13,7 +14,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
public const ushort OPCODE = 0x012E; public const ushort OPCODE = 0x012E;
public const uint PACKET_SIZE = 0x48; 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]; 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)) using (BinaryWriter binWriter = new BinaryWriter(mem))
{ {
binWriter.Write((Byte)unknown1); binWriter.Write((Byte)condition.unknown1);
binWriter.Write((Byte)unknown2); binWriter.Write((Byte)condition.unknown2);
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(conditionName)); binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
} }
} }