Refactored Demo's battle action code and cleaned things up.

This commit is contained in:
Filip Maj
2017-08-28 21:45:01 -04:00
parent 71d5bbc9ff
commit 7ad40f625a
14 changed files with 217 additions and 122 deletions

View File

@@ -179,9 +179,35 @@ namespace FFXIVClassic_Map_Server.Actors
zone.BroadcastPacketAroundActor(this, PlayAnimationOnActorPacket.BuildPacket(actorId, animId));
}
public void DoBattleAction(ushort commandId, uint animationId, uint target)
public void DoBattleAction(ushort commandId, uint animationId)
{
zone.BroadcastPacketAroundActor(this, BattleActionX00Packet.BuildPacket(actorId, target, animationId, commandId));
zone.BroadcastPacketAroundActor(this, BattleActionX00Packet.BuildPacket(actorId, animationId, commandId));
}
public void DoBattleAction(ushort commandId, uint animationId, BattleAction action)
{
zone.BroadcastPacketAroundActor(this, BattleActionX01Packet.BuildPacket(actorId, animationId, commandId, action));
}
public void DoBattleAction(ushort commandId, uint animationId, BattleAction[] actions)
{
int currentIndex = 0;
while (true)
{
if (actions.Length - currentIndex >= 18)
BattleActionX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex);
else if (actions.Length - currentIndex >= 1)
BattleActionX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex);
else if (actions.Length - 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.
}
}
public void DoBattleAction(ushort commandId, uint animationId, List<BattleAction> actions)
@@ -284,7 +310,7 @@ namespace FFXIVClassic_Map_Server.Actors
}
}
public virtual bool IsValidTarget(Character target, ValidTarget validTarget, ref SubPacket errorPacket)
public virtual bool IsValidTarget(Character target, ValidTarget validTarget)
{
return true;
}
@@ -294,17 +320,17 @@ namespace FFXIVClassic_Map_Server.Actors
return true;
}
public virtual bool CanCast(Character target, BattleCommand spell, ref SubPacket errorPacket)
public virtual bool CanCast(Character target, BattleCommand spell)
{
return false;
}
public virtual bool CanWeaponSkill(Character target, BattleCommand skill, ref SubPacket errorPacket)
public virtual bool CanWeaponSkill(Character target, BattleCommand skill)
{
return false;
}
public virtual bool CanUseAbility(Character target, BattleCommand ability, ref SubPacket errorPacket)
public virtual bool CanUseAbility(Character target, BattleCommand ability)
{
return false;
}
@@ -500,14 +526,14 @@ namespace FFXIVClassic_Map_Server.Actors
return moveSpeeds[2] + GetMod((uint)Modifier.Speed);
}
public virtual void OnAttack(State state, BattleAction action, ref SubPacket errorPacket)
public virtual void OnAttack(State state, BattleAction action, ref BattleAction error)
{
// todo: change animation based on equipped weapon
action.effectId |= (uint)HitEffect.HitVisual1; // melee
var target = state.GetTarget();
// todo: get hitrate and shit, handle protect effect and whatever
if (BattleUtils.TryAttack(this, target, action, ref errorPacket))
if (BattleUtils.TryAttack(this, target, action, ref error))
{
action.amount = BattleUtils.CalculateAttackDamage(this, target, action);
//var packet = BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, target.actorId, (uint)0x19001000, (uint)0x8000604, (ushort)0x765D, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, (byte)0x1);

View File

@@ -97,7 +97,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
return castTimeSeconds == 0;
}
public bool IsValidTarget(Character user, Character target, ref SubPacket errorPacket)
public bool IsValidTarget(Character user, Character target)
{
// todo: set box length..
targetFind = new TargetFind(user);
@@ -129,18 +129,21 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
if ((validTarget & (ValidTarget.Corpse | ValidTarget.CorpseOnly)) == 0 && target.IsDead())
{
// cannot be perfomed on
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32512, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32512, 0x20, (uint)id);
return false;
}
if (level > user.charaWork.parameterSave.state_mainSkillLevel)
{
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32527, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32527, 0x20, (uint)id);
return false;
}
if (tpCost > user.GetTP())
{
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32546, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32546, 0x20, (uint)id);
return false;
}
@@ -149,7 +152,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
if (BattleUtils.CalculateSpellCost(user, target, this) > user.GetMP())
{
// todo: error message
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32545, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32545, 0x20, (uint)id);
return false;
}
@@ -159,7 +163,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
if (false)
{
// Unable to execute [@SHEET(xtx/command,$E8(1),2)]. Conditions for use are not met.
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32556, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32556, 0x20, (uint)id);
return false;
}
}
@@ -169,7 +174,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
{
if (target != null && target.IsAlive())
{
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32513, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32513, 0x20, (uint)id);
return false;
}
}
@@ -180,7 +186,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
target.currentSubState != (user.currentSubState == SetActorStatePacket.SUB_STATE_MONSTER ?
SetActorStatePacket.SUB_STATE_PLAYER : SetActorStatePacket.SUB_STATE_MONSTER))
{
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32519, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32519, 0x20, (uint)id);
return false;
}
}
@@ -189,7 +196,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
{
if (target == null || target.currentSubState != user.currentSubState )
{
errorPacket = user.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32516, 0x20, (uint)id);
if (user is Player)
((Player)user).SendGameMessage(Server.GetWorldManager().GetActor(), 32516, 0x20, (uint)id);
return false;
}
}

View File

@@ -87,15 +87,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnComplete()
{
// todo: possible underflow
BattleAction action = new BattleAction();
errorPacket = null;
BattleAction action = new BattleAction(target.actorId, 0x765D, (uint) HitEffect.Hit, 0, (byte) HitDirection.None);
errorResult = null;
//var packet = BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, target.actorId, (uint)0x19001000, (uint)0x8000604, (ushort)0x765D, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, (byte)0x1);
action.animation = 0x19001000;
action.targetId = target.actorId;
action.effectId = (uint)HitEffect.Hit;
action.worldMasterTextId = 0x765D;
action.param = (byte)HitDirection.None; // HitDirection (auto attack shouldnt need this afaik)
// HitDirection (auto attack shouldnt need this afaik)
// todo: implement auto attack damage bonus in Character.OnAttack
/*
@@ -111,14 +108,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
* The above damage bonus also applies to “Shot” attacks by archers.
*/
owner.OnAttack(this, action, ref errorPacket);
owner.OnAttack(this, action, ref errorResult);
// handle paralyze/intimidate/sleep/whatever in character thing
if (errorPacket == null)
owner.zone.BroadcastPacketAroundActor(owner, BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, action.targetId, action.animation,
0x8000000 | action.effectId, action.worldMasterTextId, (ushort)BattleActionX01PacketCommand.Attack, action.amount, action.param)
);
else
owner.zone.BroadcastPacketAroundActor(owner, errorPacket);
owner.DoBattleAction((ushort)BattleActionX01PacketCommand.Attack, 0x19001000, errorResult != null ? action : errorResult);
//this.errorPacket = BattleActionX01Packet.BuildPacket(target.actorId, owner.actorId, target.actorId, 0, effectId, 0, (ushort)BattleActionX01PacketCommand.Attack, (ushort)damage, 0);
}

View File

@@ -28,22 +28,14 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicPrepare", owner, target, spell);
// todo: check recast
if (returnCode == 0 && owner.CanCast(target, spell, ref errorPacket))
if (returnCode == 0 && owner.CanCast(target, spell))
{
// todo: Azia can fix, check the recast time and send error
OnStart();
}
else
{
if (owner is Player)
{
// "Your battle command fails to activate"
if (errorPacket == null)
errorPacket = owner.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), (ushort)(returnCode == -1 ? 32410 : returnCode), 0x20, owner.actorId);
((Player)owner).QueuePacket(errorPacket);
}
errorPacket = null;
{
errorResult = null;
interrupt = true;
}
}
@@ -55,7 +47,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
if (returnCode != 0)
{
interrupt = true;
errorPacket = BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, owner.actorId, 0, 0, (ushort)(returnCode == -1 ? 32558 : returnCode), spell.id, 0, 1);
errorResult = new BattleAction(target.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0, 0, 0, 1);
}
else
{
@@ -106,9 +98,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnInterrupt()
{
// todo: send paralyzed/sleep message etc.
if (errorPacket != null)
if (errorResult != null)
{
owner.zone.BroadcastPacketAroundActor(owner, errorPacket);
//owner.zone.BroadcastPacketAroundActor(owner, errorResult);
}
}
@@ -123,23 +115,14 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
var i = 0;
foreach (var chara in targets)
{
var action = new BattleAction();
action.effectId = spell.effectAnimation;
action.param = (byte)HitDirection.None; // HitDirection (magic shouldnt need this afaik)
action.unknown = 1;
action.targetId = chara.actorId;
action.worldMasterTextId = spell.worldMasterTextId;
action.animation = spell.battleAnimation;
var action = new BattleAction(target.actorId, spell.worldMasterTextId, spell.effectAnimation, 0, (byte) HitDirection.None, 1);
action.amount = (ushort)lua.LuaEngine.CallLuaBattleCommandFunction(owner, spell, "magic", "onMagicFinish", owner, chara, spell, action);
actions[i++] = action;
//packets.Add(BattleActionX01Packet.BuildPacket(chara.actorId, owner.actorId, action.targetId, spell.battleAnimation, action.effectId, action.worldMasterTextId, spell.id, action.amount, action.param));
}
owner.zone.BroadcastPacketAroundActor(owner,
spell.aoeType != TargetFindAOEType.None ? (BattleActionX10Packet.BuildPacket(owner.actorId, owner.actorId, actions[0].animation, spell.id, actions)) :
BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, target.actorId, spell.battleAnimation, actions[0].effectId, actions[0].worldMasterTextId, spell.id, actions[0].amount, actions[0].param)
);
//owner.zone.BroadcastPacketsAroundActor(owner, packets);
owner.DoBattleAction(spell.id, spell.effectAnimation, actions);
}
public override void TryInterrupt()
@@ -170,7 +153,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
private bool CanCast()
{
return owner.CanCast(target, spell, ref errorPacket) && !HasMoved();
return owner.CanCast(target, spell) && !HasMoved();
}
private bool HasMoved()

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using FFXIVClassic_Map_Server.Actors;
using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.packets.send.actor.battle;
namespace FFXIVClassic_Map_Server.actors.chara.ai.state
{
@@ -18,7 +19,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
protected DateTime startTime;
protected SubPacket errorPacket;
protected BattleAction errorResult;
protected bool isCompleted;

View File

@@ -25,22 +25,14 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
var returnCode = lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onSkillPrepare", owner, target, skill);
// todo: check recast
if (returnCode == 0 && owner.CanWeaponSkill(target, skill, ref errorPacket))
if (returnCode == 0 && owner.CanWeaponSkill(target, skill))
{
// todo: Azia can fix, check the recast time and send error
OnStart();
}
else
{
if (owner is Player)
{
// "Your battle command fails to activate"
if (errorPacket == null)
errorPacket = owner.CreateGameMessagePacket(Server.GetWorldManager().GetActor(), (ushort)(returnCode == -1 ? 32410 : returnCode), 0x20, owner.actorId, owner.actorId, owner.actorId, owner.actorId);
((Player)owner).QueuePacket(errorPacket);
}
errorPacket = null;
errorResult = null;
interrupt = true;
}
}
@@ -52,7 +44,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
if (returnCode != 0)
{
interrupt = true;
errorPacket = BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, owner.actorId, 0, 0, (ushort)(returnCode == -1 ? 32558 : returnCode), skill.id, 0, 1);
errorResult = new BattleAction(owner.actorId, (ushort)(returnCode == -1 ? 32558 : returnCode), 0);
}
else
{
@@ -89,9 +81,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
public override void OnInterrupt()
{
// todo: send paralyzed/sleep message etc.
if (errorPacket != null)
if (errorResult != null)
{
owner.zone.BroadcastPacketAroundActor(owner, errorPacket);
owner.DoBattleAction(skill.id, 0, errorResult);
}
}
@@ -107,13 +99,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
var i = 0;
foreach (var chara in targets)
{
var action = new BattleAction();
action.effectId = (uint)HitEffect.Hit;
action.param = 1; // HitDirection
action.unknown = 1;
action.targetId = chara.actorId;
action.worldMasterTextId = skill.worldMasterTextId;
action.animation = skill.battleAnimation;
var action = new BattleAction(chara.actorId, skill.worldMasterTextId, (uint)HitEffect.Hit, 0, 1, 1);
// evasion, miss, dodge, etc to be handled in script, calling helpers from scripts/weaponskills.lua
action.amount = (ushort)lua.LuaEngine.CallLuaBattleCommandFunction(owner, skill, "weaponskill", "onSkillFinish", owner, target, skill, action);
actions[i++] = action;
@@ -121,10 +107,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
//packets.Add(BattleActionX01Packet.BuildPacket(chara.actorId, owner.actorId, action.targetId, skill.battleAnimation, action.effectId, action.worldMasterTextId, skill.id, action.amount, action.param));
}
owner.zone.BroadcastPacketAroundActor(owner,
skill.aoeType != TargetFindAOEType.None ? (BattleActionX10Packet.BuildPacket(owner.target.actorId, owner.actorId, actions[0].animation, skill.id, actions)) :
BattleActionX01Packet.BuildPacket(owner.actorId, owner.actorId, target.actorId, skill.battleAnimation, actions[0].effectId, actions[0].worldMasterTextId, skill.id, actions[0].amount, actions[0].param)
);
owner.DoBattleAction(skill.id, 0, actions);
}
public override void TryInterrupt()
@@ -155,7 +138,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
private bool CanUse()
{
return owner.CanWeaponSkill(target, skill, ref errorPacket);
return owner.CanWeaponSkill(target, skill);
}
public BattleCommand GetWeaponSkill()

View File

@@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
{
static class BattleUtils
{
public static bool TryAttack(Character attacker, Character defender, BattleAction action, ref SubPacket errorPacket)
public static bool TryAttack(Character attacker, Character defender, BattleAction action, ref BattleAction error)
{
// todo: get hit rate, hit count, set hit effect
action.effectId |= (uint)(HitEffect.RecoilLv2 | HitEffect.Hit | HitEffect.HitVisual1);

View File

@@ -107,19 +107,19 @@ namespace FFXIVClassic_Map_Server.Actors
return true;
}
public override bool CanCast(Character target, BattleCommand spell, ref SubPacket errorPacket)
public override bool CanCast(Character target, BattleCommand spell)
{
// todo:
return false;
}
public override bool CanWeaponSkill(Character target, BattleCommand skill, ref SubPacket errorPacket)
public override bool CanWeaponSkill(Character target, BattleCommand skill)
{
// todo:
return false;
}
public override bool CanUseAbility(Character target, BattleCommand ability, ref SubPacket errorPacket)
public override bool CanUseAbility(Character target, BattleCommand ability)
{
// todo:
return false;
@@ -204,9 +204,9 @@ namespace FFXIVClassic_Map_Server.Actors
return this.isAtSpawn = Utils.DistanceSquared(positionX, positionY, positionZ, spawnX, spawnY, spawnZ) <= 2500.0f;
}
public override void OnAttack(State state, BattleAction action, ref SubPacket errorPacket)
public override void OnAttack(State state, BattleAction action, ref BattleAction error)
{
base.OnAttack(state, action, ref errorPacket);
base.OnAttack(state, action, ref error);
}
}
}

View File

@@ -1956,18 +1956,19 @@ namespace FFXIVClassic_Map_Server.Actors
return firstSlot;
}
/*
public void SendBattleActionX01Packet(uint anim, uint effect, uint text = 0x756D, uint command = 27260, uint param = 0x01, uint idek = 0x01)
{
var packet = BattleActionX01Packet.BuildPacket(actorId, actorId, currentTarget != 0xC0000000 ? currentTarget : currentLockedTarget, (uint)anim, (uint)effect, (ushort)text, (ushort)command, (ushort)param, (byte)idek);
QueuePacket(packet);
}
}*/
public override bool IsValidTarget(Character target, ValidTarget validTarget, ref SubPacket errorPacket)
public override bool IsValidTarget(Character target, ValidTarget validTarget)
{
if (target == null)
{
// Target does not exist.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32511, 0x20);
SendGameMessage(Server.GetWorldManager().GetActor(), 32511, 0x20);
return false;
}
@@ -1977,21 +1978,21 @@ namespace FFXIVClassic_Map_Server.Actors
if (target.currentSubState == SetActorStatePacket.SUB_STATE_NONE)
{
// That command cannot be performed on the current target.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32547, 0x20);
SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20);
return false;
}
if (currentParty != null && target.currentParty == currentParty)
{
// That command cannot be performed on a party member.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32548, 0x20);
SendGameMessage(Server.GetWorldManager().GetActor(), 32548, 0x20);
return false;
}
// todo: pvp?
if (target.currentSubState == currentSubState)
{
// That command cannot be performed on an ally.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32549, 0x20);
SendGameMessage(Server.GetWorldManager().GetActor(), 32549, 0x20);
return false;
}
}
@@ -1999,7 +2000,7 @@ namespace FFXIVClassic_Map_Server.Actors
if ((validTarget & ValidTarget.Ally) != 0 && target.currentSubState != currentSubState)
{
// That command cannot be performed on the current target.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32547, 0x20);
SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20);
return false;
}
@@ -2011,29 +2012,29 @@ namespace FFXIVClassic_Map_Server.Actors
if (target is Player && ((Player)target).playerSession.isUpdatesLocked)
{
// That command cannot be performed on the current target.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32547, 0x20);
SendGameMessage(Server.GetWorldManager().GetActor(), 32547, 0x20);
return false;
}
return true;
}
public override bool CanCast(Character target, BattleCommand spell, ref SubPacket errorPacket)
public override bool CanCast(Character target, BattleCommand spell)
{
// todo: move the ability specific stuff to ability.cs
if (target == null)
{
// Target does not exist.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32511, 0x20, (uint)spell.id);
SendGameMessage(Server.GetWorldManager().GetActor(), 32511, 0x20, (uint)spell.id);
return false;
}
if (Utils.Distance(positionX, positionY, positionZ, target.positionX, target.positionY, target.positionZ) > spell.range)
{
// The target is out of range.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32539, 0x20, spell.id);
SendGameMessage(Server.GetWorldManager().GetActor(), 32539, 0x20, spell.id);
return false;
}
if (!IsValidTarget(target, spell.validTarget, ref errorPacket) || !spell.IsValidTarget(this, target, ref errorPacket))
if (!IsValidTarget(target, spell.validTarget) || !spell.IsValidTarget(this, target))
{
// error packet is set in IsValidTarget
return false;
@@ -2041,22 +2042,22 @@ namespace FFXIVClassic_Map_Server.Actors
return true;
}
public override bool CanWeaponSkill(Character target, BattleCommand skill, ref SubPacket errorPacket)
public override bool CanWeaponSkill(Character target, BattleCommand skill)
{
// todo: see worldmaster ids 32558~32557 for proper ko message and stuff
if (target == null)
{
// Target does not exist.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32511, 0x20, (uint)skill.id);
SendGameMessage(Server.GetWorldManager().GetActor(), 32511, 0x20, (uint)skill.id);
return false;
}
if (Utils.Distance(positionX, positionY, positionZ, target.positionX, target.positionY, target.positionZ) > skill.range)
{
// The target is out of range.
errorPacket = CreateGameMessagePacket(Server.GetWorldManager().GetActor(), 32539, 0x20, (uint)skill.id);
SendGameMessage(Server.GetWorldManager().GetActor(), 32539, 0x20, (uint)skill.id);
return false;
}
if (!IsValidTarget(target, skill.validTarget, ref errorPacket) || !skill.IsValidTarget(this, target, ref errorPacket))
if (!IsValidTarget(target, skill.validTarget) || !skill.IsValidTarget(this, target))
{
// error packet is set in IsValidTarget
return false;
@@ -2064,14 +2065,14 @@ namespace FFXIVClassic_Map_Server.Actors
return true;
}
public override void OnAttack(State state, BattleAction action, ref SubPacket errorPacket)
public override void OnAttack(State state, BattleAction action, ref BattleAction error)
{
base.OnAttack(state, action, ref errorPacket);
base.OnAttack(state, action, ref error);
if (errorPacket == null)
if (error == null)
{
// melee attack animation
action.animation = 0x19001000;
//action.animation = 0x19001000;
}
var target = state.GetTarget();
//if (target is BattleNpc)