mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-24 13:47:46 +00:00
Rewrote the BattleActionPacket classes to standardize them. Added a method in Character.cs to fire off BattleActions.
This commit is contained in:
parent
6c74222b68
commit
37b8203dae
5 changed files with 39 additions and 15 deletions
|
@ -178,6 +178,32 @@ namespace FFXIVClassic_Map_Server.Actors
|
||||||
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DoBattleAction(ushort commandId, uint animationId, uint target)
|
||||||
|
{
|
||||||
|
zone.BroadcastPacketAroundActor(this, BattleActionX00Packet.BuildPacket(actorId, target, animationId, commandId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoBattleAction(ushort commandId, uint animationId, List<BattleAction> actions)
|
||||||
|
{
|
||||||
|
int currentIndex = 0;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (actions.Count - currentIndex >= 18)
|
||||||
|
BattleActionX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex);
|
||||||
|
else if (actions.Count - currentIndex >= 1)
|
||||||
|
BattleActionX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex);
|
||||||
|
else if (actions.Count - currentIndex == 1)
|
||||||
|
{
|
||||||
|
BattleActionX01Packet.BuildPacket(actorId, animationId, commandId, actions[currentIndex]);
|
||||||
|
currentIndex++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
animationId = 0; //If more than one packet is sent out, only send the animation once to avoid double playing.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region ai stuff
|
#region ai stuff
|
||||||
public void PathTo(float x, float y, float z, float stepSize = 0.70f, int maxPath = 40, float polyRadius = 0.0f)
|
public void PathTo(float x, float y, float z, float stepSize = 0.70f, int maxPath = 40, float polyRadius = 0.0f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using FFXIVClassic.Common;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
||||||
{
|
{
|
||||||
class BattleActionX00Packet
|
class BattleActionX00Packet
|
||||||
|
@ -11,7 +9,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
||||||
public const ushort OPCODE = 0x013C;
|
public const ushort OPCODE = 0x013C;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
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];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
||||||
public const ushort OPCODE = 0x0139;
|
public const ushort OPCODE = 0x0139;
|
||||||
public const uint PACKET_SIZE = 0x58;
|
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];
|
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)commandId);
|
||||||
binWriter.Write((UInt16)0x810); //?
|
binWriter.Write((UInt16)0x810); //?
|
||||||
|
|
||||||
binWriter.Write((UInt32)targetActorId);
|
binWriter.Write((UInt32)action.targetId);
|
||||||
|
|
||||||
binWriter.Write((UInt16)amount);
|
binWriter.Write((UInt16)action.amount);
|
||||||
binWriter.Write((UInt16)worldMasterTextId);
|
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); //?
|
binWriter.Write((Byte)1); //?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using FFXIVClassic.Common;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
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 ushort OPCODE = 0x013A;
|
||||||
public const uint PACKET_SIZE = 0xD8;
|
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];
|
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?
|
//Missing... last value is float, string in here as well?
|
||||||
|
|
||||||
binWriter.Seek(0x20, SeekOrigin.Begin);
|
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)commandId);
|
||||||
binWriter.Write((UInt16)0x810); //?
|
binWriter.Write((UInt16)0x810); //?
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using FFXIVClassic.Common;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
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 ushort OPCODE = 0x013B;
|
||||||
public const uint PACKET_SIZE = 0x148;
|
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];
|
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?
|
//Missing... last value is float, string in here as well?
|
||||||
|
|
||||||
binWriter.Seek(0x20, SeekOrigin.Begin);
|
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)commandId);
|
||||||
binWriter.Write((UInt16)0x810); //?
|
binWriter.Write((UInt16)0x810); //?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue