public static void SendAnimateSkillStrikeResponse(Character caster, short spellRealId, DamageAction[] actions, Unit initialTarget) { 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}", initialTarget, 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(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(unk12); } action.OnFinished(); } } } else if (character != null) { packet.WriteUInt16(character.SessionId); packet.WriteInt32(0); packet.WriteInt32(3); packet.WriteInt32(0); packet.WriteSkip(unk12); } caster.SendPacketToArea(packet, true, false, Locale.Any, new float?()); } }
public static void SendEnterWorldIpeResponseResponse(IRealmClient client) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.EnterWorldIpeResponse)) { packet.WriteInt32(-1); if (client.AddrTemp.Contains("192.168.")) { packet.WriteFixedAsciiString(RealmServerConfiguration.ExternalAddress, 20, Locale.Start); } else { packet.WriteFixedAsciiString(RealmServerConfiguration.RealExternalAddress, 20, Locale.Start); } packet.WriteUInt16(RealmServerConfiguration.Port); packet.WriteInt16((short)client.ActiveCharacter.MapId); packet.WriteInt16(Convert.ToInt16(client.ActiveCharacter.Position.X)); packet.WriteInt16(Convert.ToInt16(client.ActiveCharacter.Position.Y)); Aura[] auraArray = new Aura[28]; int num1 = 0; foreach (Aura activeAura in client.ActiveCharacter.Auras.ActiveAuras) { if (activeAura.TicksLeft > 0) { auraArray[num1++] = activeAura; if (auraArray.Length <= num1) { break; } } } for (int index = 0; index < 28; ++index) { Aura aura = auraArray[index]; packet.WriteInt16(aura == null ? -1 : aura.Spell.RealId); packet.WriteInt16(aura == null ? -1 : aura.Spell.RealId); packet.WriteByte(aura == null ? 0 : 1); packet.WriteByte(0); packet.WriteByte(2); packet.WriteInt16(aura == null ? 0 : aura.Duration / 1000); packet.WriteByte(1); packet.WriteInt16(1); } FunctionItemBuff[] functionItemBuffArray = new FunctionItemBuff[15]; int num2 = 0; foreach (KeyValuePair <Asda2ItemCategory, FunctionItemBuff> premiumBuff in client.ActiveCharacter .PremiumBuffs) { if (!premiumBuff.Value.IsLongTime) { functionItemBuffArray[num2++] = premiumBuff.Value; } } for (int index = 0; index < 15; ++index) { FunctionItemBuff functionItemBuff = functionItemBuffArray[index]; packet.WriteInt32(-1); packet.WriteInt32(-1); packet.WriteInt16(-1); packet.WriteInt32(-1); packet.WriteInt32(0); packet.WriteInt16(-1); } client.Send(packet, false); } }
public static void SendEnterWorldIpeResponseResponse(IRealmClient client) { using (var packet = new RealmPacketOut(RealmServerOpCode.EnterWorldIpeResponse)) //1021 { packet.WriteInt32(-1); //value name : unk4 default value : -1Len : 4 if (client.AddrTemp.Contains("192.168.")) { packet.WriteFixedAsciiString(RealmServerConfiguration.ExternalAddress, 20); } else { packet.WriteFixedAsciiString(RealmServerConfiguration.RealExternalAddress, 20); //"127.0.0.1", 20);//"10.8.0.10", 20);//RealmServerConfiguration.ExternalAddress, 20);//{ip}default value : Len : 20 } packet.WriteUInt16(RealmServerConfiguration.Port); //15001);//RealmServerConfiguration.Port);//{port}default value : 15603 Len : 2 packet.WriteInt16((short)client.ActiveCharacter.Map.MapTemplate.RealId); //{location}default value : 3 Len : 2 packet.WriteInt16((short)(client.ActiveCharacter.Asda2Position.X)); //{x}default value : 0 Len : 2 packet.WriteInt16((short)(client.ActiveCharacter.Asda2Position.Y)); //{y}default value : 0 Len : 2 var auras = new Spells.Auras.Aura[28]; var it = 0; foreach (var visibleAura in client.ActiveCharacter.Auras.ActiveAuras) { if (visibleAura.TicksLeft <= 0) { continue; } auras[it++] = visibleAura; if (auras.Length <= it) { break; } } for (int i = 0; i < 28; i += 1) { var spell = auras[i]; packet.WriteInt16(spell == null ? -1 : spell.Spell.RealId); //{guid}default value : 0 Len : 2 packet.WriteInt16(spell == null ? -1 : spell.Spell.RealId); //{durationSec}default value : 0 Len : 2 packet.WriteByte(spell == null ? 0 : 1); //value name : unk1 default value : 0Len : 1 packet.WriteByte(0); //value name : unk1 default value : 0Len : 1 packet.WriteByte(2); //value name : unk1 default value : 2Len : 1 packet.WriteInt16(spell == null ? 0 : spell.Duration / 1000); //{skillId}default value : -1 Len : 2 packet.WriteByte(1); //value name : unk14 default value : 1Len : 1 packet.WriteInt16(1); //value name : unk2 default value : 1Len : 2 } var pbs = new FunctionItemBuff[15]; var interator = 0; foreach (var functionItemBuff in client.ActiveCharacter.PremiumBuffs) { if (functionItemBuff.Value.IsLongTime) { continue; } pbs[interator++] = functionItemBuff.Value; } for (int i = 0; i < 15; i += 1) { var buff = pbs[i]; packet.WriteInt32(-1); //buff == null?-1:buff.ItemId);//{itemId}default value : 0 Len : 4 packet.WriteInt32(-1); //(int) (buff == null ? -1 : buff.Duration));//{duration}default value : 0 Len : 4 packet.WriteInt16(-1); //buff == null ? -1 : buff.Template.ValueOnUse);//{funcValue}default value : 0 Len : 2 packet.WriteInt32(-1); //value name : unk4 default value : -1Len : 4 packet.WriteInt32(0); //value name : unk4 default value : 0Len : 4 packet.WriteInt16(-1); //value name : unk2 default value : -1Len : 2 } client.Send(packet); } }