修正实例数据头
This commit is contained in:
parent
35430cf607
commit
edd0feda14
@ -1016,7 +1016,7 @@ namespace PSO2SERVER
|
||||
PSOObject obj = new PSOObject
|
||||
{
|
||||
Name = args[2],
|
||||
Header = new ObjectHeader((uint)Int32.Parse(args[3]), EntityType.Object),
|
||||
Header = new ObjectHeader((uint)Int32.Parse(args[3]), ObjectType.Object),
|
||||
Position = new PSOLocation(float.Parse(args[4]), float.Parse(args[5]), float.Parse(args[6]), float.Parse(args[7]), float.Parse(args[8]), float.Parse(args[9]), float.Parse(args[10])),
|
||||
Things = new PSOObject.PSOObjectThing[0]
|
||||
};
|
||||
|
@ -6,24 +6,42 @@ using System.Text;
|
||||
|
||||
namespace PSO2SERVER.Models
|
||||
{
|
||||
public enum EntityType : UInt16
|
||||
public enum ObjectType : UInt16
|
||||
{
|
||||
Player = 0x04,
|
||||
Map = 0x05,
|
||||
Object = 0x06
|
||||
Unknown = 0,
|
||||
Player = 4,
|
||||
Map = 5,
|
||||
Object = 6,
|
||||
StaticObject = 7,
|
||||
Quest = 11,
|
||||
Party = 13,
|
||||
World = 16,
|
||||
APC = 22,
|
||||
Undefined = 0xFFFF
|
||||
}
|
||||
|
||||
public struct ObjectHeader
|
||||
{
|
||||
/// Id of the object.
|
||||
public UInt32 ID;
|
||||
public UInt32 padding; // Always is padding
|
||||
public EntityType EntityType; // Maybe...
|
||||
public UInt16 Unknown_A;
|
||||
/// Type of the object.
|
||||
public ObjectType ObjectType;
|
||||
/// Zone id of the object. Not set for players.
|
||||
public UInt16 MapID;
|
||||
|
||||
public ObjectHeader(uint id, EntityType type) : this()
|
||||
public ObjectHeader(uint id, ObjectType type) : this()
|
||||
{
|
||||
this.ID = id;
|
||||
this.EntityType = type;
|
||||
ID = id;
|
||||
ObjectType = type;
|
||||
}
|
||||
|
||||
/// Zone id of the object. Not set for players.
|
||||
public ObjectHeader(uint id, ObjectType type, UInt16 mapid) : this()
|
||||
{
|
||||
ID = id;
|
||||
ObjectType = type;
|
||||
MapID = mapid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace PSO2SERVER.Models
|
||||
internal static PSOObject FromDBObject(GameObject dbObject)
|
||||
{
|
||||
PSOObject psoObj = new PSOObject();
|
||||
psoObj.Header = new ObjectHeader((uint)dbObject.ObjectID, EntityType.Object);
|
||||
psoObj.Header = new ObjectHeader((uint)dbObject.ObjectID, ObjectType.Object);
|
||||
psoObj.Name = dbObject.ObjectName;
|
||||
psoObj.Position = new PSOLocation(dbObject.RotX, dbObject.RotY, dbObject.RotZ, dbObject.RotW, dbObject.PosX, dbObject.PosY, dbObject.PosZ);
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace PSO2SERVER.Object
|
||||
foreach (NPC npc in dbNpcs)
|
||||
{
|
||||
PSONPC dNpc = new PSONPC();
|
||||
dNpc.Header = new ObjectHeader((uint)npc.EntityID, EntityType.Object);
|
||||
dNpc.Header = new ObjectHeader((uint)npc.EntityID, ObjectType.Object);
|
||||
dNpc.Position = new PSOLocation(npc.RotX, npc.RotY, npc.RotZ, npc.RotW, npc.PosX, npc.PosY, npc.PosZ);
|
||||
dNpc.Name = npc.NPCName;
|
||||
|
||||
@ -135,7 +135,7 @@ namespace PSO2SERVER.Object
|
||||
if (!allTheObjects.ContainsKey(ID))
|
||||
{
|
||||
Logger.WriteWarning("[OBJ] 客户端请求的对象 {0} 服务端未解析. 等待分析.", ID);
|
||||
return new PSOObject() { Header = new ObjectHeader(ID, EntityType.Object), Name = "Unknown" };
|
||||
return new PSOObject() { Header = new ObjectHeader(ID, ObjectType.Object), Name = "Unknown" };
|
||||
}
|
||||
|
||||
return allTheObjects[ID];
|
||||
|
@ -35,11 +35,11 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
}
|
||||
if (theFlags.HasFlag(PackedData.ENT1_TYPE))
|
||||
{
|
||||
dstData.entity1.EntityType = (EntityType)reader.ReadUInt16();
|
||||
dstData.entity1.ObjectType = (ObjectType)reader.ReadUInt16();
|
||||
}
|
||||
if (theFlags.HasFlag(PackedData.ENT1_A))
|
||||
{
|
||||
dstData.entity1.Unknown_A = reader.ReadUInt16();
|
||||
dstData.entity1.MapID = reader.ReadUInt16();
|
||||
}
|
||||
if (theFlags.HasFlag(PackedData.ENT2_ID))
|
||||
{
|
||||
@ -47,11 +47,11 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
}
|
||||
if (theFlags.HasFlag(PackedData.ENT2_TYPE))
|
||||
{
|
||||
dstData.entity1.EntityType = (EntityType)reader.ReadUInt16();
|
||||
dstData.entity1.ObjectType = (ObjectType)reader.ReadUInt16();
|
||||
}
|
||||
if (theFlags.HasFlag(PackedData.ENT2_A))
|
||||
{
|
||||
dstData.entity1.Unknown_A = reader.ReadUInt16();
|
||||
dstData.entity1.MapID = reader.ReadUInt16();
|
||||
}
|
||||
if (theFlags.HasFlag(PackedData.TIMESTAMP))
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
if (c == context || c.Character == null || c.CurrentZone != context.CurrentZone)
|
||||
continue;
|
||||
//PacketWriter output = new PacketWriter();
|
||||
//output.WriteStruct(new ObjectHeader((uint)context._account.AccountId, EntityType.Account));
|
||||
//output.WriteStruct(new ObjectHeader((uint)context._account.AccountId, ObjectType.Account));
|
||||
//output.WriteStruct(preformer);
|
||||
//output.Write(preData);
|
||||
//output.WriteAscii(command, 0x4315, 0x7A);
|
||||
|
@ -22,11 +22,11 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
reader.ReadBytes(16); // Not sure what this is yet
|
||||
string command = reader.ReadAscii(0xD711, 0xCA);
|
||||
PSOObject srcObj;
|
||||
if(srcObject.EntityType == EntityType.Object)
|
||||
if(srcObject.ObjectType == ObjectType.Object)
|
||||
{
|
||||
srcObj = ObjectManager.Instance.getObjectByID(context.CurrentZone.Name, srcObject.ID);
|
||||
}
|
||||
else if(srcObject.EntityType == EntityType.Player)
|
||||
else if(srcObject.ObjectType == ObjectType.Player)
|
||||
{
|
||||
srcObj = new PSOObject
|
||||
{
|
||||
@ -39,7 +39,7 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
srcObj = null;
|
||||
}
|
||||
|
||||
Logger.WriteInternal("[OBJ] {0} (ID {1}) <{2}> --> Ent {3} (ID {4})", srcObj.Name, srcObj.Header.ID, command, (EntityType)dstObject.EntityType, dstObject.ID);
|
||||
Logger.WriteInternal("[OBJ] {0} (ID {1}) <{2}> --> Ent {3} (ID {4})", srcObj.Name, srcObj.Header.ID, command, (ObjectType)dstObject.ObjectType, dstObject.ID);
|
||||
|
||||
// TODO: Delete this code and do this COMPLETELY correctly!!!
|
||||
if (command == "Transfer" && context.CurrentZone.Name == "lobby")
|
||||
@ -80,9 +80,9 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
|
||||
if (command == "READY")
|
||||
{
|
||||
context.SendPacket(new ObjectActionPacket(new ObjectHeader((uint)context._account.AccountId, EntityType.Player), srcObj.Header, srcObj.Header,
|
||||
context.SendPacket(new ObjectActionPacket(new ObjectHeader((uint)context._account.AccountId, ObjectType.Player), srcObj.Header, srcObj.Header,
|
||||
new ObjectHeader(), "FavsNeutral"));
|
||||
context.SendPacket(new ObjectActionPacket(new ObjectHeader((uint)context._account.AccountId, EntityType.Player), srcObj.Header, srcObj.Header,
|
||||
context.SendPacket(new ObjectActionPacket(new ObjectHeader((uint)context._account.AccountId, ObjectType.Player), srcObj.Header, srcObj.Header,
|
||||
new ObjectHeader(), "AP")); // Short for Appear, Thanks Zapero!
|
||||
}
|
||||
|
||||
@ -93,8 +93,8 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
if (client.Character == null || client == context)
|
||||
continue;
|
||||
|
||||
client.SendPacket(new ObjectActionPacket(new ObjectHeader((uint)client._account.AccountId, EntityType.Player), srcObj.Header,
|
||||
new ObjectHeader(dstObject.ID, EntityType.Player), new ObjectHeader(), "SitSuccess"));
|
||||
client.SendPacket(new ObjectActionPacket(new ObjectHeader((uint)client._account.AccountId, ObjectType.Player), srcObj.Header,
|
||||
new ObjectHeader(dstObject.ID, ObjectType.Player), new ObjectHeader(), "SitSuccess"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
if (c == context || c.Character == null || c.CurrentZone != context.CurrentZone)
|
||||
continue;
|
||||
//PacketWriter writer = new PacketWriter();
|
||||
//writer.WriteStruct(new ObjectHeader((uint)c._account.AccountId, EntityType.Account));
|
||||
//writer.WriteStruct(new ObjectHeader((uint)c._account.AccountId, ObjectType.Account));
|
||||
//writer.WriteStruct(actor);
|
||||
//writer.Write(rest);
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using PSO2SERVER.Models;
|
||||
using PSO2SERVER.Packets.PSOPackets;
|
||||
|
||||
namespace PSO2SERVER.Packets.Handlers
|
||||
{
|
||||
[PacketHandlerAttr(0x0E, 0x19)]
|
||||
class ChatStatusHandler : PacketHandler
|
||||
{
|
||||
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
|
||||
{
|
||||
var info = string.Format("[<--] 接收到的数据 (hex): ");
|
||||
Logger.WriteHex(info, data);
|
||||
|
||||
var reader = new PacketReader(data);
|
||||
var obj = reader.ReadStruct<ObjectHeader>();
|
||||
var status = reader.ReadUInt32();
|
||||
|
||||
context.SendPacket(new ChatStatusPacket(obj.ID, status));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using PSO2SERVER.Models;
|
||||
using PSO2SERVER.Packets.PSOPackets;
|
||||
|
||||
namespace PSO2SERVER.Packets.Handlers
|
||||
{
|
||||
// [PacketHandlerAttr(0x0E, 0x19)]
|
||||
// class _0E_19_UNK : PacketHandler
|
||||
// {
|
||||
// public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
|
||||
// {
|
||||
// //var info = string.Format("[<--] 接收到的数据 (hex): ");
|
||||
// //Logger.WriteHex(info, data);
|
||||
// }
|
||||
// }
|
||||
}
|
@ -12,7 +12,7 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
{
|
||||
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
|
||||
{
|
||||
context.SendPacket(new SymbolArtListPacket(new Models.ObjectHeader((uint)context._account.AccountId, Models.EntityType.Player)));
|
||||
context.SendPacket(new SymbolArtListPacket(new Models.ObjectHeader((uint)context._account.AccountId, Models.ObjectType.Player)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
public override byte[] Build()
|
||||
{
|
||||
PacketWriter writer = new PacketWriter();
|
||||
writer.WriteStruct(new ObjectHeader(3, EntityType.Map));
|
||||
writer.WriteStruct(new ObjectHeader((uint)_playerid, EntityType.Player));
|
||||
writer.WriteStruct(new ObjectHeader(3, ObjectType.Map));
|
||||
writer.WriteStruct(new ObjectHeader((uint)_playerid, ObjectType.Player));
|
||||
writer.Write(0x1); // 8 Zeros
|
||||
writer.Write(0); // 8 Zeros
|
||||
writer.Write(~(uint)_map.Type); // F4 FF FF FF
|
||||
|
@ -22,8 +22,8 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
public override byte[] Build()
|
||||
{
|
||||
PacketWriter writer = new PacketWriter();
|
||||
writer.WriteStruct(new ObjectHeader((uint)_other_playerid, EntityType.Player));
|
||||
writer.WriteStruct(new ObjectHeader((uint)_user_playerid, EntityType.Player));
|
||||
writer.WriteStruct(new ObjectHeader((uint)_other_playerid, ObjectType.Player));
|
||||
writer.WriteStruct(new ObjectHeader((uint)_user_playerid, ObjectType.Player));
|
||||
return writer.ToArray();
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
public override byte[] Build()
|
||||
{
|
||||
PacketWriter output = new PacketWriter();
|
||||
output.WriteStruct(new ObjectHeader((uint)_user_playerid, EntityType.Player));
|
||||
output.WriteStruct(new ObjectHeader((uint)_user_playerid, ObjectType.Player));
|
||||
output.WriteStruct(_preformer);
|
||||
output.Write(_preData);
|
||||
output.WriteAscii(_command, 0x4315, 0x7A);
|
||||
|
@ -26,7 +26,7 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
public override byte[] Build()
|
||||
{
|
||||
PacketWriter writer = new PacketWriter();
|
||||
writer.WriteStruct(new ObjectHeader((uint)_user_playerid, EntityType.Player));
|
||||
writer.WriteStruct(new ObjectHeader((uint)_user_playerid, ObjectType.Player));
|
||||
writer.WriteStruct(_actor);
|
||||
writer.Write(_rest);
|
||||
|
||||
|
@ -22,12 +22,12 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
// xor: 0xD863, sub: 0xA9
|
||||
PacketWriter writer = new PacketWriter();
|
||||
writer.WriteBytes(0, 12); // Unknown 12 bytes, not obj header
|
||||
writer.WriteStruct(new ObjectHeader((uint)members[0].Account.AccountId, EntityType.Player)); // Account receiving the thing
|
||||
writer.WriteStruct(new ObjectHeader((uint)members[0].Account.AccountId, ObjectType.Player)); // Account receiving the thing
|
||||
writer.WriteStruct(members.Length); // Likely partymembercount
|
||||
|
||||
for(int i = 0; i < members.Length; i++)
|
||||
{
|
||||
writer.WriteStruct(new ObjectHeader((uint)members[i].Account.AccountId, EntityType.Player)); // Header of player
|
||||
writer.WriteStruct(new ObjectHeader((uint)members[i].Account.AccountId, ObjectType.Player)); // Header of player
|
||||
writer.WriteUtf16(members[i].Name, 0xD863, 0xA9);
|
||||
writer.WriteUtf16(members[i].Account.Nickname, 0xD863, 0xA9);
|
||||
writer.Write((byte)members[i].Jobs.entries.hunter.level); // Active class level
|
||||
|
@ -8,9 +8,15 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
{
|
||||
public class ChatStatusPacket : Packet
|
||||
{
|
||||
/// Object of the player (not set for C -> S).
|
||||
public ObjectHeader Obj { get; set; }
|
||||
/// Chat status.
|
||||
public UInt32 Status { get; set; }
|
||||
|
||||
public ChatStatusPacket()
|
||||
public ChatStatusPacket(UInt32 sender_id, UInt32 status)
|
||||
{
|
||||
Obj = new ObjectHeader() { ID = sender_id, ObjectType = ObjectType.Player };
|
||||
Status = status;
|
||||
}
|
||||
|
||||
#region implemented abstract members of Packet
|
||||
@ -18,12 +24,14 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
public override byte[] Build()
|
||||
{
|
||||
var pkt = new PacketWriter();
|
||||
pkt.WriteStruct(Obj);
|
||||
pkt.Write(Status);
|
||||
return pkt.ToArray();
|
||||
}
|
||||
|
||||
public override PacketHeader GetHeader()
|
||||
{
|
||||
return new PacketHeader(0x0E, 0x19, PacketFlags.None);
|
||||
return new PacketHeader(0x0E, 0x19, PacketFlags.OBJECT_RELATED);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -26,7 +26,7 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
writer.Write((ushort)0);
|
||||
writer.Write((ushort)0);
|
||||
writer.Write((ushort)1);
|
||||
writer.WriteStruct(new ObjectHeader((uint)p.AccountId, EntityType.Player));
|
||||
writer.WriteStruct(new ObjectHeader((uint)p.AccountId, ObjectType.Player));
|
||||
writer.Write(0);
|
||||
writer.Write((ushort)0);
|
||||
writer.Write((ushort)0);
|
||||
|
@ -28,7 +28,7 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
public override byte[] Build()
|
||||
{
|
||||
var pkt = new PacketWriter();
|
||||
pkt.WriteStruct(new ObjectHeader((uint)_user_playerid, EntityType.Player));
|
||||
pkt.WriteStruct(new ObjectHeader((uint)_user_playerid, ObjectType.Player));
|
||||
pkt.Write((uint)_state);
|
||||
return pkt.ToArray();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
|
||||
// TODO: Explore this data! Some if it seems really important. (May contain level cap setting + more)
|
||||
|
||||
resp.WriteStruct(new ObjectHeader(userid, EntityType.Player));
|
||||
resp.WriteStruct(new ObjectHeader(userid, ObjectType.Player));
|
||||
resp.WriteFixedLengthUtf16(blockName, 0x20); // This is right
|
||||
// Set things to "default" values; Dunno these purposes yet.
|
||||
resp.Write(0x42700000); //0
|
||||
|
@ -193,7 +193,7 @@
|
||||
<Compile Include="Packets\Handlers\--UNK.cs" />
|
||||
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-29-PlayerIsNotBusyState.cs" />
|
||||
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-28-PlayerIsBusyState.cs" />
|
||||
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-19-UNK.cs" />
|
||||
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-19-ChatStatusHandler.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-B8-CharacterShipTransferRightsRequest.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-06-DeleteCharacter.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-0D-PingTimestampResponse.cs" />
|
||||
|
@ -109,8 +109,8 @@ namespace PSO2SERVER.Zone
|
||||
else
|
||||
{
|
||||
//PacketWriter writer = new PacketWriter();
|
||||
//writer.WriteStruct(new ObjectHeader(3, EntityType.Map));
|
||||
//writer.WriteStruct(new ObjectHeader((uint)c._account.AccountId, EntityType.Account));
|
||||
//writer.WriteStruct(new ObjectHeader(3, ObjectType.Map));
|
||||
//writer.WriteStruct(new ObjectHeader((uint)c._account.AccountId, ObjectType.Account));
|
||||
//writer.Write(0x1); // 8 Zeros
|
||||
//writer.Write(0); // 8 Zeros
|
||||
//writer.Write(~(uint)Type); // F4 FF FF FF
|
||||
@ -195,8 +195,8 @@ namespace PSO2SERVER.Zone
|
||||
foreach (Client other in Clients)
|
||||
{
|
||||
//PacketWriter writer = new PacketWriter();
|
||||
//writer.WriteStruct(new ObjectHeader((uint)other._account.AccountId, EntityType.Account));
|
||||
//writer.WriteStruct(new ObjectHeader((uint)c._account.AccountId, EntityType.Account));
|
||||
//writer.WriteStruct(new ObjectHeader((uint)other._account.AccountId, ObjectType.Account));
|
||||
//writer.WriteStruct(new ObjectHeader((uint)c._account.AccountId, ObjectType.Account));
|
||||
//other.SendPacket(0x4, 0x3B, 0x40, writer.ToArray());
|
||||
other.SendPacket(new DespawnPlayerPacket(other._account.AccountId, c._account.AccountId));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ namespace ServerTest
|
||||
var testObject = new PSOObject
|
||||
{
|
||||
Name = "testobj",
|
||||
Header = new ObjectHeader { ID = 1337, EntityType = EntityType.Object },
|
||||
Header = new ObjectHeader { ID = 1337, ObjectType = ObjectType.Object },
|
||||
Position = new PSOLocation
|
||||
{
|
||||
RotX = (float)3.3,
|
||||
|
Loading…
Reference in New Issue
Block a user