[PacketHandler(RealmServerOpCode.AtackCharacter)]//4203 public static void AtackCharacterRequest(IRealmClient client, RealmPacketIn packet) { var targetSessId = packet.ReadUInt16();//default : 105Len : 2 var target = World.GetCharacterBySessionId(targetSessId); if (target == null || target == client.ActiveCharacter || !client.ActiveCharacter.CanHarm(target)) { StartAtackResponse(client.ActiveCharacter, target, 0); return; } client.ActiveCharacter.IsFighting = true; Asda2SpellHandler.SendSetAtackStateGuiResponse(client.ActiveCharacter); }
[PacketHandler(RealmServerOpCode.StartAtackCharacter)]//4201 public static void StartAtackCharacterRequest(IRealmClient client, RealmPacketIn packet) { var targetSessId = packet.ReadUInt16(); var victim = World.GetCharacterBySessionId(targetSessId); if (victim == null || !victim.IsAlive) { return; } client.ActiveCharacter.Target = victim; SendStartAtackCharacterResponseResponse(client.ActiveCharacter, victim); Asda2SpellHandler.SendSetAtackStateGuiResponse(client.ActiveCharacter); }
public static void AtackCharacterRequest(IRealmClient client, RealmPacketIn packet) { Character characterBySessionId = World.GetCharacterBySessionId(packet.ReadUInt16()); if (characterBySessionId == null || characterBySessionId == client.ActiveCharacter || !client.ActiveCharacter.CanHarm((WorldObject)characterBySessionId)) { Asda2CombatHandler.StartAtackResponse(client.ActiveCharacter, (Unit)characterBySessionId, (byte)0); } else { client.ActiveCharacter.IsFighting = true; Asda2SpellHandler.SendSetAtackStateGuiResponse(client.ActiveCharacter); } }
public static void StartAtackCharacterRequest(IRealmClient client, RealmPacketIn packet) { Character characterBySessionId = World.GetCharacterBySessionId(packet.ReadUInt16()); if (characterBySessionId == null || !characterBySessionId.IsAlive) { return; } if ((int)client.ActiveCharacter.Asda2FactionId == (int)characterBySessionId.Asda2FactionId && characterBySessionId.IsAsda2BattlegroundInProgress && client.ActiveCharacter.IsAsda2BattlegroundInProgress) { Asda2CombatHandler.SendStartAtackCharacterError(client.ActiveCharacter, characterBySessionId, Asda2CharacterAtackStatus.Fail); } else { client.ActiveCharacter.Target = (Unit)characterBySessionId; Asda2CombatHandler.SendStartAtackCharacterResponseResponse(client.ActiveCharacter, characterBySessionId); Asda2SpellHandler.SendSetAtackStateGuiResponse(client.ActiveCharacter); } }
public static void SendAnimateSkillStrikeResponse(Character caster, short spellRealId, DamageAction[] actions, Unit initialTarget) { Asda2SpellHandler.SendSetAtackStateGuiResponse(caster); using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.AnimateSkillStrike)) { NPC npc = initialTarget as NPC; Character character = initialTarget as Character; if (character == null && npc == null) { caster.SendSystemMessage(string.Format("Wrong spell target {0}. can't animate cast. SpellId {1}", (object)initialTarget, (object)spellRealId)); } packet.WriteInt16(caster.SessionId); packet.WriteInt16(spellRealId); packet.WriteInt16(6); packet.WriteByte(1); packet.WriteByte(npc == null ? (byte)1 : (byte)0); if (character != null && actions != null) { for (int index = 0; index < actions.Length; ++index) { DamageAction action = actions[index]; if (action != null) { SpellHitStatus spellHitStatus = SpellHitStatus.Ok; if (action.IsCritical) { spellHitStatus = SpellHitStatus.Crit; } else if (action.Damage == 0) { spellHitStatus = SpellHitStatus.Miss; } else if (action.Blocked > 0) { spellHitStatus = SpellHitStatus.Bloced; } if (index < 16) { packet.WriteUInt16(character.SessionId); packet.WriteInt32(action.ActualDamage); packet.WriteInt32((byte)spellHitStatus); packet.WriteInt32(797); packet.WriteSkip(Asda2SpellHandler.unk12); } action.OnFinished(); } } } else if (actions != null) { for (int index = 0; index < actions.Length; ++index) { DamageAction action = actions[index]; if (action != null) { SpellHitStatus spellHitStatus = SpellHitStatus.Ok; if (action.IsCritical) { spellHitStatus = SpellHitStatus.Crit; } else if (action.Damage == 0) { spellHitStatus = SpellHitStatus.Miss; } else if (action.Blocked > 0) { spellHitStatus = SpellHitStatus.Bloced; } ushort val = 0; if (initialTarget is NPC) { val = action.Victim == null || !(action.Victim is NPC) ? ushort.MaxValue : action.Victim.UniqIdOnMap; } if (index < 16) { packet.WriteUInt16(val); packet.WriteInt32(action.ActualDamage); packet.WriteInt32((byte)spellHitStatus); packet.WriteInt32(797); packet.WriteSkip(Asda2SpellHandler.unk12); } action.OnFinished(); } } } else if (character != null) { packet.WriteUInt16(character.SessionId); packet.WriteInt32(0); packet.WriteInt32(3); packet.WriteInt32(0); packet.WriteSkip(Asda2SpellHandler.unk12); } caster.SendPacketToArea(packet, true, false, Locale.Any, new float?()); } }