Cleaned up script packets and added the InfoResponse packet (internally the DataPacket). Added more info to the music packets. More work on class changing.

This commit is contained in:
Filip Maj 2016-03-19 10:22:20 -04:00
parent 01eceee58f
commit a93843510e
7 changed files with 139 additions and 62 deletions

View file

@ -12,6 +12,13 @@ namespace FFXIVClassic_Map_Server.packets.send
public const ushort OPCODE = 0x000C;
public const uint PACKET_SIZE = 0x28;
public const ushort EFFECT_IMMEDIATE = 0x1;
public const ushort EFFECT_CROSSFADE = 0x2; //??
public const ushort EFFECT_LAYER = 0x3; //??
public const ushort EFFECT_FADEIN = 0x4;
public const ushort EFFECT_PLAY_NORMAL_CHANNEL = 0x5; //Only works for multi channeled music
public const ushort EFFECT_PLAY_BATTLE_CHANNEL = 0x6;
public static SubPacket buildPacket(uint playerActorID, ushort musicID, ushort musicTrackMode)
{
ulong combined = (ulong)(musicID | (musicTrackMode << 16));

View file

@ -32,43 +32,7 @@ namespace FFXIVClassic_Map_Server.packets.send.events
binWriter.Write(Encoding.ASCII.GetBytes(callFunction), 0, Encoding.ASCII.GetByteCount(callFunction) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(callFunction));
binWriter.Seek(0x49, SeekOrigin.Begin);
//Write out params
foreach (LuaParam p in luaParams)
{
binWriter.Write((Byte)p.typeID);
switch (p.typeID)
{
case 0x0: //Int32
binWriter.Write(Utils.swapEndian((Int32)p.value));
break;
case 0x1: //Int32
binWriter.Write(Utils.swapEndian((UInt32)p.value));
break;
case 0x2: //Null Termed String
string svalue = (string)p.value;
binWriter.Write(Encoding.ASCII.GetBytes(svalue), 0, Encoding.ASCII.GetByteCount(svalue));
if (svalue[svalue.Length - 1] != '\0')
binWriter.Write((Byte)0);
break;
case 0x3: //Boolean False
break;
case 0x4: //Boolean True
break;
case 0x5: //Nil
break;
case 0x6: //Actor (By Id)
binWriter.Write(Utils.swapEndian((UInt32)p.value));
break;
case 0xC: //Byte
binWriter.Write((Byte)p.value);
break;
case 0x1B: //Short?
//value = reader.ReadUInt16();
break;
}
}
binWriter.Write((Byte)0xF);
LuaUtils.writeLuaParams(binWriter, luaParams);
}
}

View file

@ -0,0 +1,33 @@
using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.lua;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.send.player
{
class InfoRequestResponsePacket
{
public const ushort OPCODE = 0x0133;
public const uint PACKET_SIZE = 0xE0;
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, List<LuaParam> luaParams)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
LuaUtils.writeLuaParams(binWriter, luaParams);
}
}
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
}
}
}