Renamed BattleActionPacket -> CommandResultPacket as it better defines what these packets do. A command fires -> here is what happened due to it.

This commit is contained in:
Filip Maj 2019-01-29 00:02:09 -05:00
parent 7c7742fb35
commit e236e1d207
17 changed files with 199 additions and 199 deletions

View file

@ -224,7 +224,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
}*/
class BattleAction
class CommandResult
{
public uint targetId;
public ushort amount;
@ -252,7 +252,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public double hitRate = 0.0;
public double critRate = 0.0;
public BattleAction(uint targetId, ushort worldMasterTextId, uint effectId, ushort amount = 0, byte param = 0, byte hitNum = 1)
public CommandResult(uint targetId, ushort worldMasterTextId, uint effectId, ushort amount = 0, byte param = 0, byte hitNum = 1)
{
this.targetId = targetId;
this.worldMasterTextId = worldMasterTextId;
@ -265,7 +265,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
this.commandType = (byte) CommandType.None;
}
public BattleAction(uint targetId, BattleCommand command, byte param = 0, byte hitNum = 1)
public CommandResult(uint targetId, BattleCommand command, byte param = 0, byte hitNum = 1)
{
this.targetId = targetId;
this.worldMasterTextId = command.worldMasterTextId;
@ -288,16 +288,16 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
//Additional effects that are a part of the skill itself or weapon in case of auto attacks take place like status effects
//Certain buffs that alter the whole skill fall off (Resonance, Excruciate)
public void DoAction(Character caster, Character target, BattleCommand skill, BattleActionContainer battleActions)
public void DoAction(Character caster, Character target, BattleCommand skill, CommandResultContainer results)
{
//First calculate rates for hit/block/etc
CalcRates(caster, target, skill);
//Next, modify those rates based on preaction buffs
//Still not sure how we shouldh andle these
PreAction(caster, target, skill, battleActions);
PreAction(caster, target, skill, results);
BattleUtils.DoAction(caster, target, skill, this, battleActions);
BattleUtils.DoAction(caster, target, skill, this, results);
}
@ -312,17 +312,17 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
}
//These are buffs that activate before the action hits. Usually they change things like hit or crit rates or damage
public void PreAction(Character caster, Character target, BattleCommand skill, BattleActionContainer battleActions)
public void PreAction(Character caster, Character target, BattleCommand skill, CommandResultContainer results)
{
target.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionTarget, "onPreAction", caster, target, skill, this, battleActions);
target.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionTarget, "onPreAction", caster, target, skill, this, results);
caster.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionCaster, "onPreAction", caster, target, skill, this, battleActions);
caster.statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnPreactionCaster, "onPreAction", caster, target, skill, this, results);
}
//Try and apply a status effect
public void TryStatus(Character caster, Character target, BattleCommand skill, BattleActionContainer battleActions, bool isAdditional = true)
public void TryStatus(Character caster, Character target, BattleCommand skill, CommandResultContainer results, bool isAdditional = true)
{
BattleUtils.TryStatus(caster, target, skill, this, battleActions, isAdditional);
BattleUtils.TryStatus(caster, target, skill, this, results, isAdditional);
}
public ushort GetHitType()

View file

@ -6,21 +6,21 @@ using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
class BattleActionContainer
class CommandResultContainer
{
private List<BattleAction> actionsList = new List<BattleAction>();
private List<CommandResult> actionsList = new List<CommandResult>();
//EXP messages are always the last mesages in battlea ction packets, so they get appended after all the rest of the actions are done.
private List<BattleAction> expActionList = new List<BattleAction>();
private List<CommandResult> expActionList = new List<CommandResult>();
public BattleActionContainer()
public CommandResultContainer()
{
}
public void AddAction(uint targetId, ushort worldMasterTextId, uint effectId, ushort amount = 0, byte param = 0, byte hitNum = 0)
{
AddAction(new BattleAction(targetId, worldMasterTextId, effectId, amount, param, hitNum));
AddAction(new CommandResult(targetId, worldMasterTextId, effectId, amount, param, hitNum));
}
//Just to make scripting simpler
@ -42,23 +42,23 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
AddAction(targetId, worldMasterTextId, effectId, amount);
}
public void AddAction(BattleAction action)
public void AddAction(CommandResult action)
{
if (action != null)
actionsList.Add(action);
}
public void AddActions(List<BattleAction> actions)
public void AddActions(List<CommandResult> actions)
{
actionsList.AddRange(actions);
}
public void AddEXPAction(BattleAction action)
public void AddEXPAction(CommandResult action)
{
expActionList.Add(action);
}
public void AddEXPActions(List<BattleAction> actionList)
public void AddEXPActions(List<CommandResult> actionList)
{
expActionList.AddRange(actionList);
}
@ -68,7 +68,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
actionsList.AddRange(expActionList);
}
public List<BattleAction> GetList()
public List<CommandResult> GetList()
{
return actionsList;
}

View file

@ -4,7 +4,7 @@ using System.IO;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
class BattleActionX00Packet
class CommandResultX00Packet
{
public const ushort OPCODE = 0x013C;
public const uint PACKET_SIZE = 0x48;

View file

@ -5,18 +5,18 @@ using System.IO;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
// see xtx_command
enum BattleActionX01PacketCommand : ushort
enum CommandResultX01PacketCommand : ushort
{
Disengage = 12002,
Attack = 22104,
}
class BattleActionX01Packet
class CommandResultX01Packet
{
public const ushort OPCODE = 0x0139;
public const uint PACKET_SIZE = 0x58;
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, BattleAction action)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult action)
{
byte[] data = new byte[PACKET_SIZE - 0x20];

View file

@ -6,12 +6,12 @@ using System.Collections.Generic;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
class BattleActionX10Packet
class CommandResultX10Packet
{
public const ushort OPCODE = 0x013A;
public const uint PACKET_SIZE = 0xD8;
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList, ref int listOffset)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult[] actionList, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -66,7 +66,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
return new SubPacket(OPCODE, sourceActorId, data);
}
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<BattleAction> actionList, ref int listOffset)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<CommandResult> actionList, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];

View file

@ -6,12 +6,12 @@ using System.Collections.Generic;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{
class BattleActionX18Packet
class CommandResultX18Packet
{
public const ushort OPCODE = 0x013B;
public const uint PACKET_SIZE = 0x148;
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList, ref int listOffset)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, CommandResult[] actionList, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
@ -66,7 +66,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
return new SubPacket(OPCODE, sourceActorId, data);
}
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<BattleAction> actionList, ref int listOffset)
public static SubPacket BuildPacket(uint sourceActorId, uint animationId, ushort commandId, List<CommandResult> actionList, ref int listOffset)
{
byte[] data = new byte[PACKET_SIZE - 0x20];