// Client doesn't seem to be sending this //[ClientPacketHandler(RealmServerOpCode.CMSG_EMOTE)] //public static void HandleEmote(IRealmClient client, RealmPacketIn packet) //{ // var emote = (EmoteType)packet.ReadUInt32(); // if (emote != EmoteType.None) // { // var chr = client.ActiveCharacter; // if (chr.CanMove && chr.CanInteract) // { // SendEmote(chr, emote); // } // } //} public static void SendTextEmote(WorldObject obj, TextEmote emote, INamed target) { var len = (target == null) ? 20 : target.Name.Length + 21; using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TEXT_EMOTE, len)) { packet.Write(obj.EntityId); packet.WriteUInt((uint)emote); packet.WriteInt(-1); packet.WriteUIntPascalString(target != null ? target.Name : ""); obj.SendPacketToArea(packet, true); } }
/// <summary> /// Correct 3.0.9 /// </summary> public static void SendSpellMiss(SpellId spell, WorldObject caster, bool doIt, ICollection<CastMiss> missedTargets) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLLOGMISS, 34)) { packet.Write((uint)spell); packet.Write(caster.EntityId); packet.Write(doIt);// TODO: test this value. Its a bool that seems to determine whether to display this packet in the combat log packet.Write(missedTargets.Count); foreach (var miss in missedTargets) { packet.Write(miss.Target.EntityId); packet.Write((byte)miss.Reason); } caster.SendPacketToArea(packet); } }
/// <summary> /// Used for Periodic leech effects, mostly Cannibalism /// </summary> /// <returns></returns> public static void SendPeriodicDamage(WorldObject caster, WorldObject target, uint spellId, AuraTickFlags type, int amount) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PERIODICAURALOG, 32)) { caster.EntityId.WritePacked(packet); target.EntityId.WritePacked(packet); packet.WriteUInt(spellId); packet.WriteUInt(1); // count packet.WriteUInt((uint)type); packet.WriteUInt(amount); target.SendPacketToArea(packet, true); } }
/// <summary> /// Used for any PeriodicAura (repeating ticks) /// </summary> /// <param name="extra">Always seems to be one</param> public static void SendPeriodicAuraLog(IPacketReceiver client, WorldObject caster, WorldObject target, uint spellId, uint extra, AuraTickFlags flags, int amount) { // TODO: Update struct for 3.0.2 using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PERIODICAURALOG, 32)) { caster.EntityId.WritePacked(packet); target.EntityId.WritePacked(packet); packet.WriteUInt(spellId); packet.WriteUInt(extra); packet.WriteUInt((uint)flags); packet.WriteUInt(amount); target.SendPacketToArea(packet, true); } }
/// <summary> /// Sends a monster message. /// </summary> /// <param name="obj">the monster the message is being sent from</param> /// <param name="chatType">the type of message</param> /// <param name="language">the language to send the message in</param> /// <param name="message">the message to send</param> /// <param name="radius">The radius or -1 to be heard by everyone in the Map</param> public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string message, float radius) { if (obj == null || !obj.IsAreaActive) return; using (var packetOut = CreateObjectChatMessage(chatType, language, obj, message, obj is Unit ? ((Unit)obj).ChatTag : ChatTag.None)) { obj.SendPacketToArea(packetOut, radius, true); } }
/// <summary> /// Shows a spell Impact animation /// </summary> public static void SendImpact(WorldObject target, uint visualId) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PLAY_SPELL_IMPACT, 12)) { //target.EntityId.WritePacked(packet); packet.Write(target.EntityId); packet.Write(visualId); target.SendPacketToArea(packet, true); } }
/// <summary> /// Changes the time of the channel /// </summary> public static void SendChannelUpdate(WorldObject caster, uint delay) { if (caster == null) return; using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_CHANNEL_UPDATE, 12)) { caster.EntityId.WritePacked(packet); packet.Write(delay); caster.SendPacketToArea(packet, true); } }
/// <summary> /// Starts Channeling /// </summary> public static void SendChannelStart(WorldObject caster, SpellId spellId, int duration) { if (caster == null) return; using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_CHANNEL_START, 12)) { caster.EntityId.WritePacked(packet); packet.Write((uint)spellId); packet.Write(duration); caster.SendPacketToArea(packet, true); } }
/// <summary> /// Delays the spell-cast /// </summary> public static void SendCastDelayed(WorldObject caster, int delay) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELL_DELAYED, 12)) { caster.EntityId.WritePacked(packet); packet.Write(delay); caster.SendPacketToArea(packet, true); } }
public static void SendPlayMusic(WorldObject obj, uint sound, float range) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PLAY_MUSIC, 4)) { packet.WriteUInt(sound); obj.SendPacketToArea(packet, range != 0 ? range : WorldObject.BroadcastRange, true); } }
public static void SendPlayObjectSound(WorldObject obj, uint sound) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PLAY_OBJECT_SOUND, 13)) { packet.Write(sound); packet.Write(obj.EntityId); obj.SendPacketToArea(packet, true); } }
public static void SendEmote(WorldObject obj, EmoteType emote) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_EMOTE, 12)) { packet.WriteUInt((uint)emote); packet.Write(obj.EntityId); obj.SendPacketToArea(packet, true); } }
public static void SendMagicDamage(WorldObject victim, IEntity attacker, SpellId spell, uint damage, uint overkill, DamageSchoolMask schools, uint absorbed, uint resisted, uint blocked, bool unkBool, SpellLogFlags flags) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLNONMELEEDAMAGELOG, 40)) { victim.EntityId.WritePacked(packet); if (attacker != null) { attacker.EntityId.WritePacked(packet); } else { packet.Write((byte)0); } packet.Write((uint)spell); packet.Write(damage); packet.Write(overkill); packet.Write((byte)schools); packet.Write(absorbed); packet.Write(resisted); packet.Write(0); // apparently always 0 packet.Write(unkBool); // 0 or 1 packet.Write(blocked); // also flags 0x8, 0x10, packet.Write((uint)flags); packet.Write((byte)0);// unused by client victim.SendPacketToArea(packet, true); } }
/// <summary> /// Usually caused by jumping too high, diving too long, standing too close to fire etc /// </summary> public static void SendEnvironmentalDamage(WorldObject target, EnviromentalDamageType type, uint totalDamage) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ENVIRONMENTALDAMAGELOG, 21)) { target.EntityId.WritePacked(packet); packet.WriteByte((byte)type); packet.WriteUInt(totalDamage); packet.WriteULong(0); target.SendPacketToArea(packet, true); } }
/// <summary> /// Correct for 3.0.9 /// </summary> /// <param name="caster"></param> /// <param name="target"></param> /// <param name="spellId"></param> /// <param name="powerType"></param> /// <param name="value"></param> public static void SendEnergizeLog(WorldObject caster, Unit target, uint spellId, PowerType powerType, int value) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLENERGIZELOG, 25)) { target.EntityId.WritePacked(packet); caster.EntityId.WritePacked(packet); packet.Write(spellId); packet.Write(value); packet.Write((int)powerType); caster.SendPacketToArea(packet, true); } }