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

@ -216,11 +216,11 @@
<Compile Include="packets\send\actor\ActorDoEmotePacket.cs" /> <Compile Include="packets\send\actor\ActorDoEmotePacket.cs" />
<Compile Include="packets\send\actor\ActorInstantiatePacket.cs" /> <Compile Include="packets\send\actor\ActorInstantiatePacket.cs" />
<Compile Include="packets\send\actor\ActorSpecialGraphicPacket.cs" /> <Compile Include="packets\send\actor\ActorSpecialGraphicPacket.cs" />
<Compile Include="packets\send\actor\battle\BattleAction.cs" /> <Compile Include="packets\send\actor\battle\CommandResult.cs" />
<Compile Include="packets\send\actor\battle\BattleActionContainer.cs" /> <Compile Include="packets\send\actor\battle\CommandResultContainer.cs" />
<Compile Include="packets\send\actor\battle\BattleActionX00Packet.cs" /> <Compile Include="packets\send\actor\battle\CommandResultX00Packet.cs" />
<Compile Include="packets\send\actor\battle\BattleActionX18Packet.cs" /> <Compile Include="packets\send\actor\battle\CommandResultX18Packet.cs" />
<Compile Include="packets\send\actor\battle\BattleActionX10Packet.cs" /> <Compile Include="packets\send\actor\battle\CommandResultX10Packet.cs" />
<Compile Include="packets\send\actor\DeleteAllActorsPacket.cs" /> <Compile Include="packets\send\actor\DeleteAllActorsPacket.cs" />
<Compile Include="packets\send\actor\events\SetEventStatus.cs" /> <Compile Include="packets\send\actor\events\SetEventStatus.cs" />
<Compile Include="packets\send\actor\events\SetNoticeEventCondition.cs" /> <Compile Include="packets\send\actor\events\SetNoticeEventCondition.cs" />
@ -246,7 +246,7 @@
<Compile Include="packets\send\actor\PlayBGAnimation.cs" /> <Compile Include="packets\send\actor\PlayBGAnimation.cs" />
<Compile Include="packets\send\actor\_0x132Packet.cs" /> <Compile Include="packets\send\actor\_0x132Packet.cs" />
<Compile Include="packets\send\actor\SetActorIsZoningPacket.cs" /> <Compile Include="packets\send\actor\SetActorIsZoningPacket.cs" />
<Compile Include="packets\send\actor\battle\BattleActionX01Packet.cs" /> <Compile Include="packets\send\actor\battle\CommandResultX01Packet.cs" />
<Compile Include="packets\send\actor\inventory\EquipmentListX01Packet.cs" /> <Compile Include="packets\send\actor\inventory\EquipmentListX01Packet.cs" />
<Compile Include="packets\send\actor\inventory\InventoryBeginChangePacket.cs" /> <Compile Include="packets\send\actor\inventory\InventoryBeginChangePacket.cs" />
<Compile Include="packets\send\actor\inventory\InventoryEndChangePacket.cs" /> <Compile Include="packets\send\actor\inventory\InventoryEndChangePacket.cs" />

View File

@ -221,15 +221,15 @@ namespace FFXIVClassic_Map_Server.Actors
public void DoBattleAction(ushort commandId, uint animationId) public void DoBattleAction(ushort commandId, uint animationId)
{ {
zone.BroadcastPacketAroundActor(this, BattleActionX00Packet.BuildPacket(actorId, animationId, commandId)); zone.BroadcastPacketAroundActor(this, CommandResultX00Packet.BuildPacket(actorId, animationId, commandId));
} }
public void DoBattleAction(ushort commandId, uint animationId, BattleAction action) public void DoBattleAction(ushort commandId, uint animationId, CommandResult action)
{ {
zone.BroadcastPacketAroundActor(this, BattleActionX01Packet.BuildPacket(actorId, animationId, commandId, action)); zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, action));
} }
public void DoBattleAction(ushort commandId, uint animationId, BattleAction[] actions) public void DoBattleAction(ushort commandId, uint animationId, CommandResult[] actions)
{ {
int currentIndex = 0; int currentIndex = 0;
//AoE abilities only ever hit 16 people, so we probably won't need this loop anymore //AoE abilities only ever hit 16 people, so we probably won't need this loop anymore
@ -237,12 +237,12 @@ namespace FFXIVClassic_Map_Server.Actors
while (true) while (true)
{ {
if (actions.Length - currentIndex >= 10) if (actions.Length - currentIndex >= 10)
zone.BroadcastPacketAroundActor(this, BattleActionX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex)); zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
else if (actions.Length - currentIndex > 1) else if (actions.Length - currentIndex > 1)
zone.BroadcastPacketAroundActor(this, BattleActionX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex)); zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
else if (actions.Length - currentIndex == 1) else if (actions.Length - currentIndex == 1)
{ {
zone.BroadcastPacketAroundActor(this, BattleActionX01Packet.BuildPacket(actorId, animationId, commandId, actions[currentIndex])); zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, actions[currentIndex]));
currentIndex++; currentIndex++;
} }
else else
@ -253,19 +253,19 @@ namespace FFXIVClassic_Map_Server.Actors
} }
} }
public void DoBattleAction(ushort commandId, uint animationId, List<BattleAction> actions) public void DoBattleAction(ushort commandId, uint animationId, List<CommandResult> actions)
{ {
int currentIndex = 0; int currentIndex = 0;
while (true) while (true)
{ {
if (actions.Count - currentIndex >= 10) if (actions.Count - currentIndex >= 10)
zone.BroadcastPacketAroundActor(this, BattleActionX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex)); zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
else if (actions.Count - currentIndex > 1) else if (actions.Count - currentIndex > 1)
zone.BroadcastPacketAroundActor(this, BattleActionX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex)); zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
else if (actions.Count - currentIndex == 1) else if (actions.Count - currentIndex == 1)
{ {
zone.BroadcastPacketAroundActor(this, BattleActionX01Packet.BuildPacket(actorId, animationId, commandId, actions[currentIndex])); zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, actions[currentIndex]));
currentIndex++; currentIndex++;
} }
else else
@ -365,8 +365,8 @@ namespace FFXIVClassic_Map_Server.Actors
if ((updateFlags & ActorUpdateFlags.State) != 0) if ((updateFlags & ActorUpdateFlags.State) != 0)
{ {
packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, 0x0)); packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, 0x0));
packets.Add(BattleActionX00Packet.BuildPacket(actorId, 0x72000062, 0)); packets.Add(CommandResultX00Packet.BuildPacket(actorId, 0x72000062, 0));
packets.Add(BattleActionX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new BattleAction(actorId, 0, 1))); packets.Add(CommandResultX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new CommandResult(actorId, 0, 1)));
updateFlags &= ~ActorUpdateFlags.State; updateFlags &= ~ActorUpdateFlags.State;
//DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode //DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode
@ -375,8 +375,8 @@ namespace FFXIVClassic_Map_Server.Actors
if ((updateFlags & ActorUpdateFlags.SubState) != 0) if ((updateFlags & ActorUpdateFlags.SubState) != 0)
{ {
packets.Add(SetActorSubStatePacket.BuildPacket(actorId, currentSubState)); packets.Add(SetActorSubStatePacket.BuildPacket(actorId, currentSubState));
packets.Add(BattleActionX00Packet.BuildPacket(actorId, 0x72000062, 0)); packets.Add(CommandResultX00Packet.BuildPacket(actorId, 0x72000062, 0));
packets.Add(BattleActionX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new BattleAction(actorId, 0, 1))); packets.Add(CommandResultX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new CommandResult(actorId, 0, 1)));
updateFlags &= ~ActorUpdateFlags.SubState; updateFlags &= ~ActorUpdateFlags.SubState;
//DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode //DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode
@ -523,7 +523,7 @@ namespace FFXIVClassic_Map_Server.Actors
} }
//AdditionalActions is the list of actions that EXP/Chain messages are added to //AdditionalActions is the list of actions that EXP/Chain messages are added to
public virtual void Die(DateTime tick, BattleActionContainer actionContainer = null) public virtual void Die(DateTime tick, CommandResultContainer actionContainer = null)
{ {
// todo: actual despawn timer // todo: actual despawn timer
aiContainer.InternalDie(tick, 10); aiContainer.InternalDie(tick, 10);
@ -740,7 +740,7 @@ namespace FFXIVClassic_Map_Server.Actors
return (float) GetMod((uint)Modifier.Speed); return (float) GetMod((uint)Modifier.Speed);
} }
public virtual void OnAttack(State state, BattleAction action, ref BattleAction error) public virtual void OnAttack(State state, CommandResult action, ref CommandResult error)
{ {
var target = state.GetTarget(); var target = state.GetTarget();
// todo: change animation based on equipped weapon // todo: change animation based on equipped weapon
@ -756,13 +756,13 @@ namespace FFXIVClassic_Map_Server.Actors
target.AddTP(100); target.AddTP(100);
} }
public virtual void OnCast(State state, BattleAction[] actions, BattleCommand spell, ref BattleAction[] errors) public virtual void OnCast(State state, CommandResult[] actions, BattleCommand spell, ref CommandResult[] errors)
{ {
// damage is handled in script // damage is handled in script
var spellCost = spell.CalculateMpCost(this); var spellCost = spell.CalculateMpCost(this);
this.DelMP(spellCost); // mpCost can be set in script e.g. if caster has something for free spells this.DelMP(spellCost); // mpCost can be set in script e.g. if caster has something for free spells
foreach (BattleAction action in actions) foreach (CommandResult action in actions)
{ {
if (zone.FindActorInArea<Character>(action.targetId) is Character) if (zone.FindActorInArea<Character>(action.targetId) is Character)
{ {
@ -773,11 +773,11 @@ namespace FFXIVClassic_Map_Server.Actors
lua.LuaEngine.GetInstance().OnSignal("spellUsed"); lua.LuaEngine.GetInstance().OnSignal("spellUsed");
} }
public virtual void OnWeaponSkill(State state, BattleAction[] actions, BattleCommand skill, ref BattleAction[] errors) public virtual void OnWeaponSkill(State state, CommandResult[] actions, BattleCommand skill, ref CommandResult[] errors)
{ {
// damage is handled in script // damage is handled in script
foreach (BattleAction action in actions) foreach (CommandResult action in actions)
{ {
//Should we just store the character insteado f having to find it again? //Should we just store the character insteado f having to find it again?
if (zone.FindActorInArea<Character>(action.targetId) is Character) if (zone.FindActorInArea<Character>(action.targetId) is Character)
@ -789,7 +789,7 @@ namespace FFXIVClassic_Map_Server.Actors
this.DelTP(skill.tpCost); this.DelTP(skill.tpCost);
} }
public virtual void OnAbility(State state, BattleAction[] actions, BattleCommand ability, ref BattleAction[] errors) public virtual void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors)
{ {
foreach (var action in actions) foreach (var action in actions)
{ {
@ -815,7 +815,7 @@ namespace FFXIVClassic_Map_Server.Actors
} }
public virtual void OnDamageDealt(Character defender, BattleAction action, BattleActionContainer actionContainer = null) public virtual void OnDamageDealt(Character defender, CommandResult action, CommandResultContainer actionContainer = null)
{ {
switch (action.hitType) switch (action.hitType)
{ {
@ -838,7 +838,7 @@ namespace FFXIVClassic_Map_Server.Actors
} }
} }
public virtual void OnDamageTaken(Character attacker, BattleAction action, BattleActionContainer actionContainer = null) public virtual void OnDamageTaken(Character attacker, CommandResult action, CommandResultContainer actionContainer = null)
{ {
switch (action.hitType) switch (action.hitType)
{ {
@ -1007,34 +1007,34 @@ namespace FFXIVClassic_Map_Server.Actors
} }
//Called when this character evades attacker's action //Called when this character evades attacker's action
public void OnEvade(Character attacker, BattleAction action, BattleActionContainer actionContainer = null) public void OnEvade(Character attacker, CommandResult action, CommandResultContainer actionContainer = null)
{ {
SetProc((ushort)HitType.Evade); SetProc((ushort)HitType.Evade);
statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnEvade, "onEvade", attacker, this, action, actionContainer); statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnEvade, "onEvade", attacker, this, action, actionContainer);
} }
//Called when this character blocks attacker's action //Called when this character blocks attacker's action
public void OnBlock(Character attacker, BattleAction action, BattleActionContainer actionContainer = null) public void OnBlock(Character attacker, CommandResult action, CommandResultContainer actionContainer = null)
{ {
SetProc((ushort)HitType.Block); SetProc((ushort)HitType.Block);
statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnBlock, "onBlock", attacker, this, action, actionContainer); statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnBlock, "onBlock", attacker, this, action, actionContainer);
} }
//Called when this character parries attacker's action //Called when this character parries attacker's action
public void OnParry(Character attacker, BattleAction action, BattleActionContainer actionContainer = null) public void OnParry(Character attacker, CommandResult action, CommandResultContainer actionContainer = null)
{ {
SetProc((ushort)HitType.Parry); SetProc((ushort)HitType.Parry);
statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnParry, "onParry", attacker, this, action, actionContainer); statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnParry, "onParry", attacker, this, action, actionContainer);
} }
//Called when this character misses //Called when this character misses
public void OnMiss(Character defender, BattleAction action, BattleActionContainer actionContainer = null) public void OnMiss(Character defender, CommandResult action, CommandResultContainer actionContainer = null)
{ {
SetProc((ushort)HitType.Miss); SetProc((ushort)HitType.Miss);
statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnMiss, "onMiss", this, defender, action, actionContainer); statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnMiss, "onMiss", this, defender, action, actionContainer);
} }
public void OnHit(Character defender, BattleAction action, BattleActionContainer actionContainer = null) public void OnHit(Character defender, CommandResult action, CommandResultContainer actionContainer = null)
{ {
statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnHit, "onHit", this, defender, action, actionContainer); statusEffects.CallLuaFunctionByFlag((uint)StatusEffectFlags.ActivateOnHit, "onHit", this, defender, action, actionContainer);
} }
@ -1065,7 +1065,7 @@ namespace FFXIVClassic_Map_Server.Actors
public void DoBattleCommand(BattleCommand command, string folder) public void DoBattleCommand(BattleCommand command, string folder)
{ {
//List<BattleAction> actions = new List<BattleAction>(); //List<BattleAction> actions = new List<BattleAction>();
BattleActionContainer actions = new BattleActionContainer(); CommandResultContainer actions = new CommandResultContainer();
var targets = command.targetFind.GetTargets(); var targets = command.targetFind.GetTargets();
bool hitTarget = false; bool hitTarget = false;
@ -1080,7 +1080,7 @@ namespace FFXIVClassic_Map_Server.Actors
ushort totalDamage = 0; ushort totalDamage = 0;
for (int hitNum = 1; hitNum <= command.numHits; hitNum++) for (int hitNum = 1; hitNum <= command.numHits; hitNum++)
{ {
var action = new BattleAction(chara.actorId, command, (byte)GetHitDirection(chara), (byte) hitNum); var action = new CommandResult(chara.actorId, command, (byte)GetHitDirection(chara), (byte) hitNum);
//uncached script //uncached script
lua.LuaEngine.CallLuaBattleCommandFunction(this, command, folder, "onSkillFinish", this, chara, command, action, actions); lua.LuaEngine.CallLuaBattleCommandFunction(this, command, folder, "onSkillFinish", this, chara, command, action, actions);
@ -1099,7 +1099,7 @@ namespace FFXIVClassic_Map_Server.Actors
//30442: [hitCount]fold Attack! [chara] takes a total of totalDamage points of damage. //30442: [hitCount]fold Attack! [chara] takes a total of totalDamage points of damage.
//30450: All attacks miss! //30450: All attacks miss!
ushort textId = (ushort) (hitTarget ? 30442 : 30450); ushort textId = (ushort) (hitTarget ? 30442 : 30450);
actions.AddAction(new BattleAction(chara.actorId, textId, 0, totalDamage, (byte)hitCount)); actions.AddAction(new CommandResult(chara.actorId, textId, 0, totalDamage, (byte)hitCount));
} }
} }
@ -1107,7 +1107,7 @@ namespace FFXIVClassic_Map_Server.Actors
} }
else else
{ {
actions.AddAction(new BattleAction(actorId, 30202, 0)); actions.AddAction(new CommandResult(actorId, 30202, 0));
} }
//Now that we know if we hit the target we can check if the combo continues //Now that we know if we hit the target we can check if the combo continues
@ -1119,7 +1119,7 @@ namespace FFXIVClassic_Map_Server.Actors
((Player)this).SetCombos(); ((Player)this).SetCombos();
} }
BattleAction error = new BattleAction(actorId, 0, 0); CommandResult error = new CommandResult(actorId, 0, 0);
DelMP(command.CalculateMpCost(this)); DelMP(command.CalculateMpCost(this));
DelTP(command.CalculateTpCost(this)); DelTP(command.CalculateTpCost(this));
actions.CombineLists(); actions.CombineLists();

View File

@ -77,7 +77,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
//DoTs tick before regen and the full dot damage is displayed, even if some or all of it is nullified by regen. Only effects like stoneskin actually alter the number shown //DoTs tick before regen and the full dot damage is displayed, even if some or all of it is nullified by regen. Only effects like stoneskin actually alter the number shown
if (dotTick > 0) if (dotTick > 0)
{ {
BattleAction action = new BattleAction(owner.actorId, 30331, (uint)(HitEffect.HitEffectType | HitEffect.Hit), dotTick); CommandResult action = new CommandResult(owner.actorId, 30331, (uint)(HitEffect.HitEffectType | HitEffect.Hit), dotTick);
utils.BattleUtils.HandleStoneskin(owner, action); utils.BattleUtils.HandleStoneskin(owner, action);
// todo: figure out how to make red numbers appear for enemies getting hurt by dots // todo: figure out how to make red numbers appear for enemies getting hurt by dots
//owner.DelHP(action.amount); //owner.DelHP(action.amount);
@ -101,12 +101,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
return effects.ContainsKey((uint)id); return effects.ContainsKey((uint)id);
} }
public BattleAction AddStatusForBattleAction(uint id, byte tier = 1, ulong magnitude = 0, uint duration = 0) public CommandResult AddStatusForCommandResult(uint id, byte tier = 1, ulong magnitude = 0, uint duration = 0)
{ {
BattleAction action = null; CommandResult action = null;
if (AddStatusEffect(id, tier, magnitude, duration)) if (AddStatusEffect(id, tier, magnitude, duration))
action = new BattleAction(owner.actorId, 30328, id | (uint)HitEffect.StatusEffectType); action = new CommandResult(owner.actorId, 30328, id | (uint)HitEffect.StatusEffectType);
return action; return action;
} }
@ -225,7 +225,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
// send packet to client with effect remove message // send packet to client with effect remove message
if (!silent && !effect.GetSilent() && (effect.GetFlags() & (uint)StatusEffectFlags.Silent) == 0) if (!silent && !effect.GetSilent() && (effect.GetFlags() & (uint)StatusEffectFlags.Silent) == 0)
{ {
owner.DoBattleAction(0, 0, new BattleAction(owner.actorId, 30331, effect.GetStatusEffectId())); owner.DoBattleAction(0, 0, new CommandResult(owner.actorId, 30331, effect.GetStatusEffectId()));
} }
//hidden effects not in charawork //hidden effects not in charawork
@ -266,22 +266,22 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
} }
//Remove status effect and return the battleaction message instead of sending it immediately //Remove status effect and return the CommandResult message instead of sending it immediately
public BattleAction RemoveStatusEffectForBattleAction(uint effectId, ushort worldMasterTextId = 30331) public CommandResult RemoveStatusEffectForCommandResult(uint effectId, ushort worldMasterTextId = 30331)
{ {
BattleAction action = null; CommandResult action = null;
if (RemoveStatusEffect(effectId, true)) if (RemoveStatusEffect(effectId, true))
action = new BattleAction(owner.actorId, worldMasterTextId, effectId); action = new CommandResult(owner.actorId, worldMasterTextId, effectId);
return action; return action;
} }
//Remove status effect and return the battleaction message instead of sending it immediately //Remove status effect and return the CommandResult message instead of sending it immediately
public BattleAction RemoveStatusEffectForBattleAction(StatusEffect effect, ushort worldMasterTextId = 30331) public CommandResult RemoveStatusEffectForCommandResult(StatusEffect effect, ushort worldMasterTextId = 30331)
{ {
BattleAction action = null; CommandResult action = null;
if (RemoveStatusEffect(effect, true)) if (RemoveStatusEffect(effect, true))
action = new BattleAction(owner.actorId, worldMasterTextId, effect.GetStatusEffectId()); action = new CommandResult(owner.actorId, worldMasterTextId, effect.GetStatusEffectId());
return action; return action;
} }
@ -408,7 +408,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
//Doing this instead of simply calling remove then add so that the new effect is in the same slot as the old one //Doing this instead of simply calling remove then add so that the new effect is in the same slot as the old one
//There should be a better way to do this //There should be a better way to do this
//Currently causes the icons to blink whenb eing rpelaced //Currently causes the icons to blink whenb eing rpelaced
public BattleAction ReplaceEffect(StatusEffect effectToBeReplaced, uint newEffectId, byte tier, double magnitude, uint duration) public CommandResult ReplaceEffect(StatusEffect effectToBeReplaced, uint newEffectId, byte tier, double magnitude, uint duration)
{ {
StatusEffect newEffect = Server.GetWorldManager().GetStatusEffect(newEffectId); StatusEffect newEffect = Server.GetWorldManager().GetStatusEffect(newEffectId);
newEffect.SetTier(tier); newEffect.SetTier(tier);
@ -434,7 +434,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
SetStatusAtIndex(index, (ushort) (newEffectId - 200000)); SetStatusAtIndex(index, (ushort) (newEffectId - 200000));
SetTimeAtIndex(index, time); SetTimeAtIndex(index, time);
return new BattleAction(owner.actorId, 30328, (uint) HitEffect.StatusEffectType | newEffectId); return new CommandResult(owner.actorId, 30328, (uint) HitEffect.StatusEffectType | newEffectId);
} }
} }
} }

View File

@ -43,7 +43,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
if (returnCode != 0) if (returnCode != 0)
{ {
interrupt = true; interrupt = true;
errorResult = new BattleAction(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0); errorResult = new CommandResult(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0);
} }
else else
{ {
@ -60,7 +60,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
owner.GetSubState().chantId = 0xf0; owner.GetSubState().chantId = 0xf0;
owner.SubstateModified(); owner.SubstateModified();
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) //You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1)); owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new CommandResult(target.actorId, 30126, 1, 0, 1));
} }
} }
} }

View File

@ -74,7 +74,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
// todo: send paralyzed/sleep message etc. // todo: send paralyzed/sleep message etc.
if (errorResult != null) if (errorResult != null)
{ {
owner.zone.BroadcastPacketAroundActor(owner, BattleActionX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult)); owner.zone.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
errorResult = null; errorResult = null;
} }
} }
@ -103,12 +103,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
// todo: Change this to use a BattleCommand like the other states // todo: Change this to use a BattleCommand like the other states
//List<BattleAction> actions = new List<BattleAction>(); //List<BattleAction> actions = new List<BattleAction>();
BattleActionContainer actions = new BattleActionContainer(); CommandResultContainer actions = new CommandResultContainer();
var i = 0; var i = 0;
for (int hitNum = 0; hitNum < 1 /* owner.GetMod((uint) Modifier.HitCount)*/; hitNum++) for (int hitNum = 0; hitNum < 1 /* owner.GetMod((uint) Modifier.HitCount)*/; hitNum++)
{ {
BattleAction action = new BattleAction(target.actorId, 0x765D, (uint)HitEffect.Hit, 100, (byte)HitDirection.None, (byte) hitNum); CommandResult action = new CommandResult(target.actorId, 0x765D, (uint)HitEffect.Hit, 100, (byte)HitDirection.None, (byte) hitNum);
action.commandType = CommandType.AutoAttack; action.commandType = CommandType.AutoAttack;
action.actionType = ActionType.Physical; action.actionType = ActionType.Physical;
action.actionProperty = (ActionProperty) owner.GetMod(Modifier.AttackType); action.actionProperty = (ActionProperty) owner.GetMod(Modifier.AttackType);
@ -118,8 +118,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
} }
// todo: this is fuckin stupid, probably only need *one* error packet, not an error for each action // todo: this is fuckin stupid, probably only need *one* error packet, not an error for each action
BattleAction[] errors = (BattleAction[])actions.GetList().ToArray().Clone(); CommandResult[] errors = (CommandResult[])actions.GetList().ToArray().Clone();
BattleAction error = null;// new BattleAction(0, null, 0, 0); CommandResult error = null;// new BattleAction(0, null, 0, 0);
//owner.DoActions(null, actions.GetList(), ref error); //owner.DoActions(null, actions.GetList(), ref error);
//owner.OnAttack(this, actions[0], ref errorResult); //owner.OnAttack(this, actions[0], ref errorResult);
var anim = (uint)(17 << 24 | 1 << 12); var anim = (uint)(17 << 24 | 1 << 12);

View File

@ -42,7 +42,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
} }
else else
{ {
errorResult = new BattleAction(owner.actorId, 32553, 0); errorResult = new CommandResult(owner.actorId, 32553, 0);
interrupt = true; interrupt = true;
} }
} }
@ -54,7 +54,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
if (returnCode != 0) if (returnCode != 0)
{ {
interrupt = true; interrupt = true;
errorResult = new BattleAction(target.actorId, (ushort)(returnCode == -1 ? 32553 : returnCode), 0, 0, 0, 1); errorResult = new CommandResult(target.actorId, (ushort)(returnCode == -1 ? 32553 : returnCode), 0, 0, 0, 1);
} }
else else
{ {
@ -87,7 +87,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
} }
owner.GetSubState().chantId = 0xf0; owner.GetSubState().chantId = 0xf0;
owner.SubstateModified(); owner.SubstateModified();
owner.DoBattleAction(spell.id, (uint) 0x6F000000 | spell.castType, new BattleAction(target.actorId, 30128, 1, 0, 1)); //You begin casting (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) owner.DoBattleAction(spell.id, (uint) 0x6F000000 | spell.castType, new CommandResult(target.actorId, 30128, 1, 0, 1)); //You begin casting (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
} }
} }
} }
@ -163,7 +163,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
if (HasMoved()) if (HasMoved())
{ {
errorResult = new BattleAction(owner.actorId, 30211, 0); errorResult = new CommandResult(owner.actorId, 30211, 0);
errorResult.animation = 0x7F000002; errorResult.animation = 0x7F000002;
interrupt = true; interrupt = true;
return; return;

View File

@ -19,7 +19,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
protected DateTime startTime; protected DateTime startTime;
protected BattleAction errorResult; protected CommandResult errorResult;
protected bool isCompleted; protected bool isCompleted;

View File

@ -42,7 +42,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
if (returnCode != 0) if (returnCode != 0)
{ {
interrupt = true; interrupt = true;
errorResult = new BattleAction(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0); errorResult = new CommandResult(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0);
} }
else else
{ {
@ -90,7 +90,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
owner.GetSubState().chantId = 0xf0; owner.GetSubState().chantId = 0xf0;
owner.SubstateModified(); owner.SubstateModified();
//You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD) //You ready [skill] (6F000002: BLM, 6F000003: WHM, 0x6F000008: BRD)
owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new BattleAction(target.actorId, 30126, 1, 0, 1)); owner.DoBattleAction(skill.id, (uint)0x6F000000 | skill.castType, new CommandResult(target.actorId, 30126, 1, 0, 1));
} }
} }
} }

View File

@ -96,7 +96,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
270, 280, 290, 300, 310, 320, 330, 340, 350, 360, //Level <= 40 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, //Level <= 40
370, 380, 380, 390, 400, 410, 420, 430, 430, 440}; //Level <= 50 370, 380, 380, 390, 400, 410, 420, 430, 430, 440}; //Level <= 50
public static bool TryAttack(Character attacker, Character defender, BattleAction action, ref BattleAction error) public static bool TryAttack(Character attacker, Character defender, CommandResult action, ref CommandResult error)
{ {
// todo: get hit rate, hit count, set hit effect // todo: get hit rate, hit count, set hit effect
//action.effectId |= (uint)(HitEffect.RecoilLv2 | HitEffect.Hit | HitEffect.HitVisual1); //action.effectId |= (uint)(HitEffect.RecoilLv2 | HitEffect.Hit | HitEffect.HitVisual1);
@ -122,7 +122,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
//Damage calculations //Damage calculations
//Calculate damage of action //Calculate damage of action
//We could probably just do this when determining the action's hit type //We could probably just do this when determining the action's hit type
public static void CalculatePhysicalDamageTaken(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static void CalculatePhysicalDamageTaken(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
short dlvl = (short)(defender.GetLevel() - attacker.GetLevel()); short dlvl = (short)(defender.GetLevel() - attacker.GetLevel());
@ -137,7 +137,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
public static void CalculateSpellDamageTaken(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static void CalculateSpellDamageTaken(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
short dlvl = (short)(defender.GetLevel() - attacker.GetLevel()); short dlvl = (short)(defender.GetLevel() - attacker.GetLevel());
@ -158,7 +158,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
public static void CalculateBlockDamage(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static void CalculateBlockDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
double percentBlocked; double percentBlocked;
@ -177,7 +177,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
//don't know exact crit bonus formula //don't know exact crit bonus formula
public static void CalculateCritDamage(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static void CalculateCritDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
short dlvl = (short)(defender.GetLevel() - attacker.GetLevel()); short dlvl = (short)(defender.GetLevel() - attacker.GetLevel());
double bonus = (.04 * (dlvl * dlvl)) - 2 * dlvl; double bonus = (.04 * (dlvl * dlvl)) - 2 * dlvl;
@ -193,7 +193,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
action.amount = (ushort)(action.amount * bonus.Clamp(1.15, 1.75));//min bonus of 115, max bonus of 175 action.amount = (ushort)(action.amount * bonus.Clamp(1.15, 1.75));//min bonus of 115, max bonus of 175
} }
public static void CalculateParryDamage(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static void CalculateParryDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
double percentParry = 0.75; double percentParry = 0.75;
@ -204,7 +204,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
//There are 3 or 4 tiers of resist that are flat 25% decreases in damage. //There are 3 or 4 tiers of resist that are flat 25% decreases in damage.
//It's possible we could just calculate the damage at the same time as we determine the hit type (the same goes for the rest of the hit types) //It's possible we could just calculate the damage at the same time as we determine the hit type (the same goes for the rest of the hit types)
//Or we could have HitTypes for DoubleResist, TripleResist, and FullResist that get used here. //Or we could have HitTypes for DoubleResist, TripleResist, and FullResist that get used here.
public static void CalculateResistDamage(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static void CalculateResistDamage(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
double percentResist = 0.5; double percentResist = 0.5;
@ -214,7 +214,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
//It's weird that stoneskin is handled in C# and all other buffs are in scripts right now //It's weird that stoneskin is handled in C# and all other buffs are in scripts right now
//But it's because stoneskin acts like both a preaction and postaction buff in that it falls off after damage is dealt but impacts how much damage is dealt //But it's because stoneskin acts like both a preaction and postaction buff in that it falls off after damage is dealt but impacts how much damage is dealt
public static void HandleStoneskin(Character defender, BattleAction action) public static void HandleStoneskin(Character defender, CommandResult action)
{ {
var mitigation = Math.Min(action.amount, defender.GetMod(Modifier.Stoneskin)); var mitigation = Math.Min(action.amount, defender.GetMod(Modifier.Stoneskin));
@ -222,7 +222,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
defender.SubtractMod((uint)Modifier.Stoneskin, mitigation); defender.SubtractMod((uint)Modifier.Stoneskin, mitigation);
} }
public static void DamageTarget(Character attacker, Character defender, BattleAction action, BattleActionContainer actionContainer= null) public static void DamageTarget(Character attacker, Character defender, CommandResult action, CommandResultContainer actionContainer= null)
{ {
if (defender != null) if (defender != null)
{ {
@ -245,7 +245,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
} }
public static void HealTarget(Character caster, Character target, BattleAction action, BattleActionContainer actionContainer = null) public static void HealTarget(Character caster, Character target, CommandResult action, CommandResultContainer actionContainer = null)
{ {
if (target != null) if (target != null)
{ {
@ -259,7 +259,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
#region Rate Functions #region Rate Functions
//How is accuracy actually calculated? //How is accuracy actually calculated?
public static double GetHitRate(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static double GetHitRate(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
double hitRate = 80.0; double hitRate = 80.0;
@ -273,7 +273,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
//Whats the parry formula? //Whats the parry formula?
public static double GetParryRate(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static double GetParryRate(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
//Can't parry with shield, can't parry rear attacks //Can't parry with shield, can't parry rear attacks
if (defender.GetMod((uint)Modifier.HasShield) != 0 || action.param == (byte) HitDirection.Rear) if (defender.GetMod((uint)Modifier.HasShield) != 0 || action.param == (byte) HitDirection.Rear)
@ -286,7 +286,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
return parryRate + (defender.GetMod(Modifier.RawParryRate)); return parryRate + (defender.GetMod(Modifier.RawParryRate));
} }
public static double GetCritRate(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static double GetCritRate(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
if (action.actionType == ActionType.Status) if (action.actionType == ActionType.Status)
return 0.0; return 0.0;
@ -303,7 +303,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
//http://kanican.livejournal.com/55370.html //http://kanican.livejournal.com/55370.html
// todo: figure that out // todo: figure that out
public static double GetResistRate(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static double GetResistRate(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
// todo: add elemental stuff // todo: add elemental stuff
//Can only resist spells? //Can only resist spells?
@ -318,7 +318,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
//(2) Every point in "Block Rate" gives +0.2% rate //(2) Every point in "Block Rate" gives +0.2% rate
//(3) True block proc rate is capped at 75%. No clue on a possible floor. //(3) True block proc rate is capped at 75%. No clue on a possible floor.
//(4) The baseline rate is based on dLVL only(mob stats play no role). The baseline rate is summarized in this raw data sheet: https://imgbox.com/aasLyaJz //(4) The baseline rate is based on dLVL only(mob stats play no role). The baseline rate is summarized in this raw data sheet: https://imgbox.com/aasLyaJz
public static double GetBlockRate(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static double GetBlockRate(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
//Shields are required to block and can't block from rear. //Shields are required to block and can't block from rear.
if (defender.GetMod((uint)Modifier.HasShield) == 0 || action.param == (byte)HitDirection.Rear) if (defender.GetMod((uint)Modifier.HasShield) == 0 || action.param == (byte)HitDirection.Rear)
@ -336,7 +336,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
#endregion #endregion
public static bool TryCrit(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static bool TryCrit(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
if ((Program.Random.NextDouble() * 100) <= action.critRate) if ((Program.Random.NextDouble() * 100) <= action.critRate)
{ {
@ -352,7 +352,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
return false; return false;
} }
public static bool TryResist(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static bool TryResist(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
if ((Program.Random.NextDouble() * 100) <= action.resistRate) if ((Program.Random.NextDouble() * 100) <= action.resistRate)
{ {
@ -364,7 +364,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
return false; return false;
} }
public static bool TryBlock(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static bool TryBlock(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
if ((Program.Random.NextDouble() * 100) <= action.blockRate) if ((Program.Random.NextDouble() * 100) <= action.blockRate)
{ {
@ -376,7 +376,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
return false; return false;
} }
public static bool TryParry(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static bool TryParry(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
if ((Program.Random.NextDouble() * 100) <= action.parryRate) if ((Program.Random.NextDouble() * 100) <= action.parryRate)
{ {
@ -389,7 +389,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
//TryMiss instead of tryHit because hits are the default and don't change damage //TryMiss instead of tryHit because hits are the default and don't change damage
public static bool TryMiss(Character attacker, Character defender, BattleCommand skill, BattleAction action) public static bool TryMiss(Character attacker, Character defender, BattleCommand skill, CommandResult action)
{ {
if ((Program.Random.NextDouble() * 100) >= GetHitRate(attacker, defender, skill, action)) if ((Program.Random.NextDouble() * 100) >= GetHitRate(attacker, defender, skill, action))
{ {
@ -405,7 +405,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
/* /*
* Hit Effecthelpers. Different types of hit effects hits use some flags for different things, so they're split into physical, magical, heal, and status * Hit Effecthelpers. Different types of hit effects hits use some flags for different things, so they're split into physical, magical, heal, and status
*/ */
public static void DoAction(Character caster, Character target, BattleCommand skill, BattleAction action, BattleActionContainer actionContainer = null) public static void DoAction(Character caster, Character target, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null)
{ {
switch (action.actionType) switch (action.actionType)
{ {
@ -428,7 +428,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
//Determine the hit type, set the hit effect, modify damage based on stoneskin and hit type, hit target //Determine the hit type, set the hit effect, modify damage based on stoneskin and hit type, hit target
public static void FinishActionPhysical(Character attacker, Character defender, BattleCommand skill, BattleAction action, BattleActionContainer actionContainer = null) public static void FinishActionPhysical(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null)
{ {
//Figure out the hit type and change damage depending on hit type //Figure out the hit type and change damage depending on hit type
if (!TryMiss(attacker, defender, skill, action)) if (!TryMiss(attacker, defender, skill, action))
@ -454,7 +454,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
if (skill != null && skill.numHits > 1) if (skill != null && skill.numHits > 1)
{ {
if (action.hitNum == 1) if (action.hitNum == 1)
actionContainer?.AddAction(new BattleAction(attacker.actorId, 30441, 0)); actionContainer?.AddAction(new CommandResult(attacker.actorId, 30441, 0));
textIds = MultiHitTypeTextIds; textIds = MultiHitTypeTextIds;
} }
@ -474,7 +474,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
DamageTarget(attacker, defender, action, actionContainer); DamageTarget(attacker, defender, action, actionContainer);
} }
public static void FinishActionSpell(Character attacker, Character defender, BattleCommand skill, BattleAction action, BattleActionContainer actionContainer = null) public static void FinishActionSpell(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null)
{ {
//Determine the hit type of the action //Determine the hit type of the action
if (!TryMiss(attacker, defender, skill, action)) if (!TryMiss(attacker, defender, skill, action))
@ -500,7 +500,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
DamageTarget(attacker, defender, action, actionContainer); DamageTarget(attacker, defender, action, actionContainer);
} }
public static void FinishActionHeal(Character attacker, Character defender, BattleCommand skill, BattleAction action, BattleActionContainer actionContainer = null) public static void FinishActionHeal(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null)
{ {
//Set the hit effect //Set the hit effect
SetHitEffectHeal(attacker, defender, skill, action); SetHitEffectHeal(attacker, defender, skill, action);
@ -510,7 +510,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
HealTarget(attacker, defender, action, actionContainer); HealTarget(attacker, defender, action, actionContainer);
} }
public static void FinishActionStatus(Character attacker, Character defender, BattleCommand skill, BattleAction action, BattleActionContainer actionContainer = null) public static void FinishActionStatus(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null)
{ {
//Set the hit effect //Set the hit effect
SetHitEffectStatus(attacker, defender, skill, action); SetHitEffectStatus(attacker, defender, skill, action);
@ -520,7 +520,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
actionContainer.AddAction(action); actionContainer.AddAction(action);
} }
public static void SetHitEffectPhysical(Character attacker, Character defender, BattleCommand skill, BattleAction action, BattleActionContainer actionContainer) public static void SetHitEffectPhysical(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer)
{ {
var hitEffect = HitEffect.HitEffectType; var hitEffect = HitEffect.HitEffectType;
HitType hitType = action.hitType; HitType hitType = action.hitType;
@ -564,7 +564,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
action.effectId = (uint)hitEffect; action.effectId = (uint)hitEffect;
} }
public static void SetHitEffectSpell(Character attacker, Character defender, BattleCommand skill, BattleAction action, BattleActionContainer actionContainer = null) public static void SetHitEffectSpell(Character attacker, Character defender, BattleCommand skill, CommandResult action, CommandResultContainer actionContainer = null)
{ {
var hitEffect = HitEffect.MagicEffectType; var hitEffect = HitEffect.MagicEffectType;
HitType hitType = action.hitType; HitType hitType = action.hitType;
@ -606,7 +606,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
public static void SetHitEffectHeal(Character caster, Character receiver, BattleCommand skill, BattleAction action) public static void SetHitEffectHeal(Character caster, Character receiver, BattleCommand skill, CommandResult action)
{ {
var hitEffect = HitEffect.MagicEffectType | HitEffect.Heal; var hitEffect = HitEffect.MagicEffectType | HitEffect.Heal;
//Heals use recoil levels in some way as well. Possibly for very low health clutch heals or based on percentage of current health healed (not max health). //Heals use recoil levels in some way as well. Possibly for very low health clutch heals or based on percentage of current health healed (not max health).
@ -617,7 +617,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
action.effectId = (uint)hitEffect; action.effectId = (uint)hitEffect;
} }
public static void SetHitEffectStatus(Character caster, Character receiver, BattleCommand skill, BattleAction action) public static void SetHitEffectStatus(Character caster, Character receiver, BattleCommand skill, CommandResult action)
{ {
var hitEffect = (uint)HitEffect.StatusEffectType | skill.statusId; var hitEffect = (uint)HitEffect.StatusEffectType | skill.statusId;
action.effectId = hitEffect; action.effectId = hitEffect;
@ -646,7 +646,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
//For instance, Goring Blade's bleed effect requires another action so the first action can still show damage numbers //For instance, Goring Blade's bleed effect requires another action so the first action can still show damage numbers
//Sentinel doesn't require an additional action because it doesn't need to show those numbers //Sentinel doesn't require an additional action because it doesn't need to show those numbers
//this is stupid //this is stupid
public static void TryStatus(Character caster, Character target, BattleCommand skill, BattleAction action, BattleActionContainer battleActions, bool isAdditional = true) public static void TryStatus(Character caster, Character target, BattleCommand skill, CommandResult action, CommandResultContainer results, bool isAdditional = true)
{ {
double rand = Program.Random.NextDouble(); double rand = Program.Random.NextDouble();
@ -667,7 +667,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
{ {
//If we need an extra action to show the status text //If we need an extra action to show the status text
if (isAdditional) if (isAdditional)
battleActions.AddAction(target.actorId, 30328, skill.statusId | (uint) HitEffect.StatusEffectType); results.AddAction(target.actorId, 30328, skill.statusId | (uint) HitEffect.StatusEffectType);
} }
else else
action.worldMasterTextId = 32002;//Is this right? action.worldMasterTextId = 32002;//Is this right?
@ -679,7 +679,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
{ {
//If we need an extra action to show the status text //If we need an extra action to show the status text
if (isAdditional) if (isAdditional)
battleActions.AddAction(target.actorId, 30328, skill.statusId | (uint) HitEffect.StatusEffectType); results.AddAction(target.actorId, 30328, skill.statusId | (uint) HitEffect.StatusEffectType);
} }
else else
action.worldMasterTextId = 32002;//Is this right? action.worldMasterTextId = 32002;//Is this right?
@ -835,7 +835,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
} }
//Calculates bonus EXP for Links and Chains //Calculates bonus EXP for Links and Chains
public static void AddBattleBonusEXP(Player attacker, BattleNpc defender, BattleActionContainer actionContainer) public static void AddBattleBonusEXP(Player attacker, BattleNpc defender, CommandResultContainer actionContainer)
{ {
ushort baseExp = GetBaseEXP(attacker, defender); ushort baseExp = GetBaseEXP(attacker, defender);
@ -855,7 +855,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
{ {
expChainNumber = effect.GetTier(); expChainNumber = effect.GetTier();
timeLimit = (uint)(GetChainTimeLimit(expChainNumber)); timeLimit = (uint)(GetChainTimeLimit(expChainNumber));
actionContainer?.AddEXPAction(new BattleAction(attacker.actorId, 33919, 0, expChainNumber, (byte)timeLimit)); actionContainer?.AddEXPAction(new CommandResult(attacker.actorId, 33919, 0, expChainNumber, (byte)timeLimit));
} }
totalBonus += GetChainBonus(expChainNumber); totalBonus += GetChainBonus(expChainNumber);

View File

@ -271,7 +271,7 @@ namespace FFXIVClassic_Map_Server.Actors
updateFlags |= ActorUpdateFlags.AllNpc; updateFlags |= ActorUpdateFlags.AllNpc;
} }
public override void Die(DateTime tick, BattleActionContainer actionContainer = null) public override void Die(DateTime tick, CommandResultContainer actionContainer = null)
{ {
if (IsAlive()) if (IsAlive())
{ {
@ -286,7 +286,7 @@ namespace FFXIVClassic_Map_Server.Actors
//I think this is, or should be odne in DoBattleAction. Packet capture had the message in the same packet as an attack //I think this is, or should be odne in DoBattleAction. Packet capture had the message in the same packet as an attack
// <actor> defeat/defeats <target> // <actor> defeat/defeats <target>
if (actionContainer != null) if (actionContainer != null)
actionContainer.AddEXPAction(new BattleAction(actorId, 30108, 0)); actionContainer.AddEXPAction(new CommandResult(actorId, 30108, 0));
if (lastAttacker.currentParty != null && lastAttacker.currentParty is Party) if (lastAttacker.currentParty != null && lastAttacker.currentParty is Party)
{ {
foreach (var memberId in ((Party)lastAttacker.currentParty).members) foreach (var memberId in ((Party)lastAttacker.currentParty).members)
@ -367,7 +367,7 @@ namespace FFXIVClassic_Map_Server.Actors
return this.isAtSpawn = Utils.DistanceSquared(positionX, positionY, positionZ, spawnX, spawnY, spawnZ) <= 2500.0f; return this.isAtSpawn = Utils.DistanceSquared(positionX, positionY, positionZ, spawnX, spawnY, spawnZ) <= 2500.0f;
} }
public override void OnAttack(State state, BattleAction action, ref BattleAction error) public override void OnAttack(State state, CommandResult action, ref CommandResult error)
{ {
base.OnAttack(state, action, ref error); base.OnAttack(state, action, ref error);
// todo: move this somewhere else prolly and change based on model/appearance (so maybe in Character.cs instead) // todo: move this somewhere else prolly and change based on model/appearance (so maybe in Character.cs instead)
@ -377,7 +377,7 @@ namespace FFXIVClassic_Map_Server.Actors
lua.LuaEngine.CallLuaBattleFunction(this, "onAttack", this, state.GetTarget(), action.amount); lua.LuaEngine.CallLuaBattleFunction(this, "onAttack", this, state.GetTarget(), action.amount);
} }
public override void OnCast(State state, BattleAction[] actions, BattleCommand spell, ref BattleAction[] errors) public override void OnCast(State state, CommandResult[] actions, BattleCommand spell, ref CommandResult[] errors)
{ {
base.OnCast(state, actions, spell, ref errors); base.OnCast(state, actions, spell, ref errors);
@ -386,7 +386,7 @@ namespace FFXIVClassic_Map_Server.Actors
lua.LuaEngine.CallLuaBattleFunction(this, "onCast", this, zone.FindActorInArea<Character>(action.targetId), ((MagicState)state).GetSpell(), action); lua.LuaEngine.CallLuaBattleFunction(this, "onCast", this, zone.FindActorInArea<Character>(action.targetId), ((MagicState)state).GetSpell(), action);
} }
public override void OnAbility(State state, BattleAction[] actions, BattleCommand ability, ref BattleAction[] errors) public override void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors)
{ {
base.OnAbility(state, actions, ability, ref errors); base.OnAbility(state, actions, ability, ref errors);
@ -397,7 +397,7 @@ namespace FFXIVClassic_Map_Server.Actors
*/ */
} }
public override void OnWeaponSkill(State state, BattleAction[] actions, BattleCommand skill, ref BattleAction[] errors) public override void OnWeaponSkill(State state, CommandResult[] actions, BattleCommand skill, ref CommandResult[] errors)
{ {
base.OnWeaponSkill(state, actions, skill, ref errors); base.OnWeaponSkill(state, actions, skill, ref errors);
@ -453,7 +453,7 @@ namespace FFXIVClassic_Map_Server.Actors
mobModifiers.Add((MobModifier)mobModId, val); mobModifiers.Add((MobModifier)mobModId, val);
} }
public override void OnDamageTaken(Character attacker, BattleAction action, BattleActionContainer actionContainer = null) public override void OnDamageTaken(Character attacker, CommandResult action, CommandResultContainer actionContainer = null)
{ {
if (GetMobMod((uint)MobModifier.DefendScript) != 0) if (GetMobMod((uint)MobModifier.DefendScript) != 0)
lua.LuaEngine.CallLuaBattleFunction(this, "onDamageTaken", this, attacker, action.amount); lua.LuaEngine.CallLuaBattleFunction(this, "onDamageTaken", this, attacker, action.amount);

View File

@ -1793,7 +1793,7 @@ namespace FFXIVClassic_Map_Server.Actors
base.PostUpdate(tick, packets); base.PostUpdate(tick, packets);
} }
public override void Die(DateTime tick, BattleActionContainer actionContainer = null) public override void Die(DateTime tick, CommandResultContainer actionContainer = null)
{ {
// todo: death timer // todo: death timer
aiContainer.InternalDie(tick, 60); aiContainer.InternalDie(tick, 60);
@ -2122,7 +2122,7 @@ namespace FFXIVClassic_Map_Server.Actors
public override bool CanCast(Character target, BattleCommand spell) public override bool CanCast(Character target, BattleCommand spell)
{ {
//Might want to do these with a BattleAction instead to be consistent with the rest of command stuff //Might want to do these with a CommandResult instead to be consistent with the rest of command stuff
if (GetHotbarTimer(spell.id) > Utils.UnixTimeStampUTC()) if (GetHotbarTimer(spell.id) > Utils.UnixTimeStampUTC())
{ {
// todo: this needs confirming // todo: this needs confirming
@ -2227,7 +2227,7 @@ namespace FFXIVClassic_Map_Server.Actors
return true; return true;
} }
public override void OnAttack(State state, BattleAction action, ref BattleAction error) public override void OnAttack(State state, CommandResult action, ref CommandResult error)
{ {
var target = state.GetTarget(); var target = state.GetTarget();
@ -2248,7 +2248,7 @@ namespace FFXIVClassic_Map_Server.Actors
LuaEngine.GetInstance().OnSignal("playerAttack"); LuaEngine.GetInstance().OnSignal("playerAttack");
} }
public override void OnCast(State state, BattleAction[] actions, BattleCommand spell, ref BattleAction[] errors) public override void OnCast(State state, CommandResult[] actions, BattleCommand spell, ref CommandResult[] errors)
{ {
// todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap) // todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap)
base.OnCast(state, actions, spell, ref errors); base.OnCast(state, actions, spell, ref errors);
@ -2257,7 +2257,7 @@ namespace FFXIVClassic_Map_Server.Actors
//LuaEngine.GetInstance().OnSignal("spellUse"); //LuaEngine.GetInstance().OnSignal("spellUse");
} }
public override void OnWeaponSkill(State state, BattleAction[] actions, BattleCommand skill, ref BattleAction[] errors) public override void OnWeaponSkill(State state, CommandResult[] actions, BattleCommand skill, ref CommandResult[] errors)
{ {
// todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap) // todo: update hotbar timers to skill's recast time (also needs to be done on class change or equip crap)
base.OnWeaponSkill(state, actions, skill, ref errors); base.OnWeaponSkill(state, actions, skill, ref errors);
@ -2269,7 +2269,7 @@ namespace FFXIVClassic_Map_Server.Actors
LuaEngine.GetInstance().OnSignal("weaponskillUse"); LuaEngine.GetInstance().OnSignal("weaponskillUse");
} }
public override void OnAbility(State state, BattleAction[] actions, BattleCommand ability, ref BattleAction[] errors) public override void OnAbility(State state, CommandResult[] actions, BattleCommand ability, ref CommandResult[] errors)
{ {
base.OnAbility(state, actions, ability, ref errors); base.OnAbility(state, actions, ability, ref errors);
UpdateHotbarTimer(ability.id, ability.recastTimeMs); UpdateHotbarTimer(ability.id, ability.recastTimeMs);
@ -2277,16 +2277,16 @@ namespace FFXIVClassic_Map_Server.Actors
} }
//Handles exp being added, does not handle figuring out exp bonus from buffs or skill/link chains or any of that //Handles exp being added, does not handle figuring out exp bonus from buffs or skill/link chains or any of that
//Returns BattleActions that can be sent to display the EXP gained number and level ups //Returns CommandResults that can be sent to display the EXP gained number and level ups
//exp should be a ushort single the exp graphic overflows after ~65k //exp should be a ushort single the exp graphic overflows after ~65k
public List<BattleAction> AddExp(int exp, byte classId, byte bonusPercent = 0) public List<CommandResult> AddExp(int exp, byte classId, byte bonusPercent = 0)
{ {
List<BattleAction> actionList = new List<BattleAction>(); List<CommandResult> actionList = new List<CommandResult>();
exp += (int) Math.Ceiling((exp * bonusPercent / 100.0f)); exp += (int) Math.Ceiling((exp * bonusPercent / 100.0f));
//You earn [exp] (+[bonusPercent]%) experience points. //You earn [exp] (+[bonusPercent]%) experience points.
//In non-english languages there are unique messages for each language, hence the use of ClassExperienceTextIds //In non-english languages there are unique messages for each language, hence the use of ClassExperienceTextIds
actionList.Add(new BattleAction(actorId, BattleUtils.ClassExperienceTextIds[classId], 0, (ushort)exp, bonusPercent)); actionList.Add(new CommandResult(actorId, BattleUtils.ClassExperienceTextIds[classId], 0, (ushort)exp, bonusPercent));
bool leveled = false; bool leveled = false;
int diff = MAXEXP[GetLevel() - 1] - charaWork.battleSave.skillPoint[classId - 1]; int diff = MAXEXP[GetLevel() - 1] - charaWork.battleSave.skillPoint[classId - 1];
@ -2331,7 +2331,7 @@ namespace FFXIVClassic_Map_Server.Actors
} }
//Increaess level of current class and equips new abilities earned at that level //Increaess level of current class and equips new abilities earned at that level
public void LevelUp(byte classId, List<BattleAction> actionList = null) public void LevelUp(byte classId, List<CommandResult> actionList = null)
{ {
if (charaWork.battleSave.skillLevel[classId - 1] < charaWork.battleSave.skillLevelCap[classId]) if (charaWork.battleSave.skillLevel[classId - 1] < charaWork.battleSave.skillLevelCap[classId])
{ {
@ -2341,7 +2341,7 @@ namespace FFXIVClassic_Map_Server.Actors
//33909: You gain level [level] //33909: You gain level [level]
if (actionList != null) if (actionList != null)
actionList.Add(new BattleAction(actorId, 33909, 0, (ushort) charaWork.battleSave.skillLevel[classId - 1])); actionList.Add(new CommandResult(actorId, 33909, 0, (ushort) charaWork.battleSave.skillLevel[classId - 1]));
//If there's any abilites that unlocks at this level, equip them. //If there's any abilites that unlocks at this level, equip them.
List<uint> commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel()); List<uint> commandIds = Server.GetWorldManager().GetBattleCommandIdByLevel(classId, GetLevel());
@ -2356,7 +2356,7 @@ namespace FFXIVClassic_Map_Server.Actors
if (actionList != null) if (actionList != null)
{ {
if(classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob()) if(classId == GetCurrentClassOrJob() || jobId == GetCurrentClassOrJob())
actionList.Add(new BattleAction(actorId, 33926, commandId)); actionList.Add(new CommandResult(actorId, 33926, commandId));
} }
} }
} }

View File

@ -224,7 +224,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
}*/ }*/
class BattleAction class CommandResult
{ {
public uint targetId; public uint targetId;
public ushort amount; public ushort amount;
@ -252,7 +252,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
public double hitRate = 0.0; public double hitRate = 0.0;
public double critRate = 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.targetId = targetId;
this.worldMasterTextId = worldMasterTextId; this.worldMasterTextId = worldMasterTextId;
@ -265,7 +265,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
this.commandType = (byte) CommandType.None; 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.targetId = targetId;
this.worldMasterTextId = command.worldMasterTextId; 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 //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) //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 //First calculate rates for hit/block/etc
CalcRates(caster, target, skill); CalcRates(caster, target, skill);
//Next, modify those rates based on preaction buffs //Next, modify those rates based on preaction buffs
//Still not sure how we shouldh andle these //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 //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 //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() public ushort GetHitType()

View File

@ -6,21 +6,21 @@ using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle 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. //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) 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 //Just to make scripting simpler
@ -42,23 +42,23 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
AddAction(targetId, worldMasterTextId, effectId, amount); AddAction(targetId, worldMasterTextId, effectId, amount);
} }
public void AddAction(BattleAction action) public void AddAction(CommandResult action)
{ {
if (action != null) if (action != null)
actionsList.Add(action); actionsList.Add(action);
} }
public void AddActions(List<BattleAction> actions) public void AddActions(List<CommandResult> actions)
{ {
actionsList.AddRange(actions); actionsList.AddRange(actions);
} }
public void AddEXPAction(BattleAction action) public void AddEXPAction(CommandResult action)
{ {
expActionList.Add(action); expActionList.Add(action);
} }
public void AddEXPActions(List<BattleAction> actionList) public void AddEXPActions(List<CommandResult> actionList)
{ {
expActionList.AddRange(actionList); expActionList.AddRange(actionList);
} }
@ -68,7 +68,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
actionsList.AddRange(expActionList); actionsList.AddRange(expActionList);
} }
public List<BattleAction> GetList() public List<CommandResult> GetList()
{ {
return actionsList; return actionsList;
} }

View File

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

View File

@ -5,18 +5,18 @@ using System.IO;
namespace FFXIVClassic_Map_Server.packets.send.actor.battle namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{ {
// see xtx_command // see xtx_command
enum BattleActionX01PacketCommand : ushort enum CommandResultX01PacketCommand : ushort
{ {
Disengage = 12002, Disengage = 12002,
Attack = 22104, Attack = 22104,
} }
class BattleActionX01Packet class CommandResultX01Packet
{ {
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 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]; 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 namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{ {
class BattleActionX10Packet class CommandResultX10Packet
{ {
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 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]; 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); 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]; 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 namespace FFXIVClassic_Map_Server.packets.send.actor.battle
{ {
class BattleActionX18Packet class CommandResultX18Packet
{ {
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 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]; 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); 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]; byte[] data = new byte[PACKET_SIZE - 0x20];