Rewrote the BattleActionPacket classes to standardize them. Added a method in Character.cs to fire off BattleActions.

This commit is contained in:
Filip Maj 2017-08-28 20:26:21 -04:00
parent 6c74222b68
commit 37b8203dae
5 changed files with 39 additions and 15 deletions

View file

@ -2,8 +2,6 @@
using System;
using System.IO;
using FFXIVClassic.Common;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
class BattleActionX00Packet
@ -11,7 +9,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x013C;
public const uint PACKET_SIZE = 0x48;
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, ushort commandId)
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId, uint animationId, ushort commandId)
{
byte[] data = new byte[PACKET_SIZE - 0x20];

View file

@ -98,7 +98,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x0139;
public const uint PACKET_SIZE = 0x58;
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, uint effectId, ushort worldMasterTextId, ushort commandId, ushort amount, byte param)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, BattleAction action)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -116,14 +116,14 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
binWriter.Write((UInt16)commandId);
binWriter.Write((UInt16)0x810); //?
binWriter.Write((UInt32)targetActorId);
binWriter.Write((UInt32)action.targetId);
binWriter.Write((UInt16)amount);
binWriter.Write((UInt16)worldMasterTextId);
binWriter.Write((UInt16)action.amount);
binWriter.Write((UInt16)action.worldMasterTextId);
binWriter.Write((UInt32)effectId);
binWriter.Write((UInt32)action.effectId);
binWriter.Write((Byte)param);
binWriter.Write((Byte)action.param);
binWriter.Write((Byte)1); //?
}
}

View file

@ -2,7 +2,7 @@
using System;
using System.IO;
using FFXIVClassic.Common;
using System.Collections.Generic;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
@ -11,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x013A;
public const uint PACKET_SIZE = 0xD8;
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<BattleAction> actionList, ref int currentIndex)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -25,7 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
//Missing... last value is float, string in here as well?
binWriter.Seek(0x20, SeekOrigin.Begin);
binWriter.Write((UInt32) actionList.Length); //Num actions (always 1 for this)
binWriter.Write((UInt32)actionList.Count); //Num actions (always 1 for this)
binWriter.Write((UInt16)commandId);
binWriter.Write((UInt16)0x810); //?

View file

@ -2,7 +2,7 @@
using System;
using System.IO;
using FFXIVClassic.Common;
using System.Collections.Generic;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
@ -11,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public const ushort OPCODE = 0x013B;
public const uint PACKET_SIZE = 0x148;
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<BattleAction> actionList, ref int currentIndex)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -25,7 +25,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
//Missing... last value is float, string in here as well?
binWriter.Seek(0x20, SeekOrigin.Begin);
binWriter.Write((UInt32) actionList.Length); //Num actions (always 1 for this)
binWriter.Write((UInt32)actionList.Count); //Num actions (always 1 for this)
binWriter.Write((UInt16)commandId);
binWriter.Write((UInt16)0x810); //?