private void SendLookupPacket() { var data = new CDataStore(WoWClientServices.NetMessage.CMSG_DBLOOKUP); data.PutString("Test 0"); Manager.ClientServices.SendPacket(data); }
private static int LookupResultHandler(IntPtr param, WoWClientServices.NetMessage msgId, uint time, IntPtr pData) { var data = new CDataStore(pData); var received = data.GetString(256); Log.WriteLine("LookupResultHandler: param {0:8X}, time {1}, received {2}", param, time, received); return(1); }
public static uint ClientSend(IntPtr ptr, ref CDataStore dataStore, int args) { var ds = dataStore.Clone(); var pkt = new Packet(ds); PacketLog.Write(pkt, "ClientMessage"); Memory.Write(originalFunction, originalInstruction); var ret = (uint)originalDelegate.DynamicInvoke(new object[] { ptr, dataStore, args }); Memory.Write(originalFunction, hookInstruction); return((uint)ret); }
// https://github.com/cmangos/mangos-wotlk/blob/master/src/game/SpellHandler.cpp#L336 private void SendCastSpell() { var csp = new CastSpellPacket() { CastCount = 1, SpellID = 49276, // Lesser Healing Wave unkFlags = 0, TargetFlags = SpellCastTargetFlags.TARGET_FLAG_SELF, TargetGUID = (long)Manager.LocalPlayer.Guid, }; var data = new CDataStore(WoWClientServices.NetMessage.CMSG_CAST_SPELL); data.Write <byte>(csp.CastCount); data.Write <int>(csp.SpellID); data.Write <byte>(csp.unkFlags); data.Write <int>((int)csp.TargetFlags); data.Write <long>(csp.TargetGUID); Manager.ClientServices.SendPacket(data); }
// https://github.com/cmangos/mangos-wotlk/blob/master/src/game/Chat.cpp#L3512 private static int OnChatMessage(IntPtr param, WoWClientServices.NetMessage msgId, uint time, IntPtr pData) { var data = new CDataStore(pData); var sb = new StringBuilder(); var type = (ChatMsgType)data.Read <byte>(); sb.AppendFormat("[T:{0}] ", type); sb.AppendFormat("[L:{0}] ", data.Read <int>()); sb.AppendFormat("[SG:{0}] ", data.Read <long>()); data.Read <int>(); switch (type) { case ChatMsgType.CHAT_MSG_MONSTER_SAY: case ChatMsgType.CHAT_MSG_MONSTER_PARTY: case ChatMsgType.CHAT_MSG_MONSTER_YELL: case ChatMsgType.CHAT_MSG_MONSTER_WHISPER: case ChatMsgType.CHAT_MSG_MONSTER_EMOTE: case ChatMsgType.CHAT_MSG_RAID_BOSS_WHISPER: case ChatMsgType.CHAT_MSG_RAID_BOSS_EMOTE: case ChatMsgType.CHAT_MSG_BATTLENET: case ChatMsgType.CHAT_MSG_WHISPER_FOREIGN: // Sender length, name and target GUID sb.AppendFormat("[SN:{0}] ", data.GetString(data.Read <int>())); sb.AppendFormat("[TG:{0}] ", data.Read <long>()); /* * if (targetGuid && !targetGuid.IsPlayer() && !targetGuid.IsPet() && (msgtype != CHAT_MSG_WHISPER_FOREIGN)) * { * data << uint32(strlen(targetName) + 1); // target name length * data << targetName; // target name * } */ break; case ChatMsgType.CHAT_MSG_BG_SYSTEM_NEUTRAL: case ChatMsgType.CHAT_MSG_BG_SYSTEM_ALLIANCE: case ChatMsgType.CHAT_MSG_BG_SYSTEM_HORDE: // Target guid, sender length and name sb.AppendFormat("[TG:{0}] ", data.Read <long>()); /* * if (targetGuid && !targetGuid.IsPlayer()) * { * MANGOS_ASSERT(targetName); * data << uint32(strlen(targetName) + 1); // target name length * data << targetName; // target name * } */ //sb.AppendFormat("[SN:{0}] ", data.GetString(data.Read<int>())); break; case ChatMsgType.CHAT_MSG_ACHIEVEMENT: case ChatMsgType.CHAT_MSG_GUILD_ACHIEVEMENT: // Target GUID sb.AppendFormat("[TG:{0}] ", data.Read <long>()); break; case ChatMsgType.CHAT_MSG_CHANNEL: // Channel name, and target GUID sb.AppendFormat("[CN:{0}] ", data.GetString(64)); // verify length of channel name sb.AppendFormat("[TG:{0}] ", data.Read <long>()); break; default: // Target GUID sb.AppendFormat("[TG:{0}] ", data.Read <long>()); break; } // Message length and content, tag sb.AppendFormat("[M:{0}] ", data.GetString(data.Read <int>())); sb.AppendFormat("[T:{0}] ", (ChatTag)data.Read <byte>()); Log.WriteLine(sb.ToString()); // Call the WoW's internal chat message handler. data.Prepare(); return(_chatMessageHandler(param, msgId, time, pData)); }
public void SendPacket(CDataStore pData) { pData.Prepare(); if (_sendPacket2 == null) _sendPacket2 = Manager.Memory.RegisterDelegate<SendPacket2Delegate>(Pointers.ClientServices.SendPacket2.ToPointer()); _sendPacket2(GetCurrent(), pData.Pointer); }
public void SendGamePacket(CDataStore pData) { pData.Prepare(); if (_sendPacket == null) _sendPacket = Manager.Memory.RegisterDelegate<SendPacketDelegate>(Pointers.ClientServices.SendPacket.ToPointer()); _sendPacket(pData.Pointer); }
// https://github.com/cmangos/mangos-wotlk/blob/master/src/game/SpellHandler.cpp#L336 private void SendCastSpell() { var csp = new CastSpellPacket() { CastCount = 1, SpellID = 49276, // Lesser Healing Wave unkFlags = 0, TargetFlags = SpellCastTargetFlags.TARGET_FLAG_SELF, TargetGUID = (long)Manager.LocalPlayer.Guid, }; var data = new CDataStore(WoWClientServices.NetMessage.CMSG_CAST_SPELL); data.Write<byte>(csp.CastCount); data.Write<int>(csp.SpellID); data.Write<byte>(csp.unkFlags); data.Write<int>((int)csp.TargetFlags); data.Write<long>(csp.TargetGUID); Manager.ClientServices.SendPacket(data); }
// https://github.com/cmangos/mangos-wotlk/blob/master/src/game/Chat.cpp#L3512 private static int OnChatMessage(IntPtr param, WoWClientServices.NetMessage msgId, uint time, IntPtr pData) { var data = new CDataStore(pData); var sb = new StringBuilder(); var type = (ChatMsgType)data.Read<byte>(); sb.AppendFormat("[T:{0}] ", type); sb.AppendFormat("[L:{0}] ", data.Read<int>()); sb.AppendFormat("[SG:{0}] ", data.Read<long>()); data.Read<int>(); switch (type) { case ChatMsgType.CHAT_MSG_MONSTER_SAY: case ChatMsgType.CHAT_MSG_MONSTER_PARTY: case ChatMsgType.CHAT_MSG_MONSTER_YELL: case ChatMsgType.CHAT_MSG_MONSTER_WHISPER: case ChatMsgType.CHAT_MSG_MONSTER_EMOTE: case ChatMsgType.CHAT_MSG_RAID_BOSS_WHISPER: case ChatMsgType.CHAT_MSG_RAID_BOSS_EMOTE: case ChatMsgType.CHAT_MSG_BATTLENET: case ChatMsgType.CHAT_MSG_WHISPER_FOREIGN: // Sender length, name and target GUID sb.AppendFormat("[SN:{0}] ", data.GetString(data.Read<int>())); sb.AppendFormat("[TG:{0}] ", data.Read<long>()); /* if (targetGuid && !targetGuid.IsPlayer() && !targetGuid.IsPet() && (msgtype != CHAT_MSG_WHISPER_FOREIGN)) { data << uint32(strlen(targetName) + 1); // target name length data << targetName; // target name } */ break; case ChatMsgType.CHAT_MSG_BG_SYSTEM_NEUTRAL: case ChatMsgType.CHAT_MSG_BG_SYSTEM_ALLIANCE: case ChatMsgType.CHAT_MSG_BG_SYSTEM_HORDE: // Target guid, sender length and name sb.AppendFormat("[TG:{0}] ", data.Read<long>()); /* if (targetGuid && !targetGuid.IsPlayer()) { MANGOS_ASSERT(targetName); data << uint32(strlen(targetName) + 1); // target name length data << targetName; // target name } */ //sb.AppendFormat("[SN:{0}] ", data.GetString(data.Read<int>())); break; case ChatMsgType.CHAT_MSG_ACHIEVEMENT: case ChatMsgType.CHAT_MSG_GUILD_ACHIEVEMENT: // Target GUID sb.AppendFormat("[TG:{0}] ", data.Read<long>()); break; case ChatMsgType.CHAT_MSG_CHANNEL: // Channel name, and target GUID sb.AppendFormat("[CN:{0}] ", data.GetString(64)); // verify length of channel name sb.AppendFormat("[TG:{0}] ", data.Read<long>()); break; default: // Target GUID sb.AppendFormat("[TG:{0}] ", data.Read<long>()); break; } // Message length and content, tag sb.AppendFormat("[M:{0}] ", data.GetString(data.Read<int>())); sb.AppendFormat("[T:{0}] ", (ChatTag)data.Read<byte>()); Log.WriteLine(sb.ToString()); // Call the WoW's internal chat message handler. data.Prepare(); return _chatMessageHandler(param, msgId, time, pData); }
private static int LookupResultHandler(IntPtr param, WoWClientServices.NetMessage msgId, uint time, IntPtr pData) { var data = new CDataStore(pData); var received = data.GetString(256); Log.WriteLine("LookupResultHandler: param {0:8X}, time {1}, received {2}", param, time, received); return 1; }