private static void Refresh() { bool flag = true; while (true) { try { for (int i = 0; i < 0x3b; i++) { uint baseMsg = (uint)(0xb75a60 + (i * 0x17c0)); if (Manager.Memory.Read <ulong>(new IntPtr(baseMsg)) != 0) { ChatMessageStruct item = ParseMsg(baseMsg); if (!WoWChat.Contains(item)) { OnMessageEventArgs e = new OnMessageEventArgs(item); if (!flag && (Event_OnNewMessageDelegate != null)) { Event_OnNewMessageDelegate(null, e); } WoWChat.Add(item); } } Thread.Sleep(10); } flag = false; } catch { } Thread.Sleep(100); } }
private static ChatMessageStruct ParseMsg(uint BaseMsg) { ChatMessageStruct struct2 = new ChatMessageStruct { FormattedMsg = Manager.Memory.ReadString(new IntPtr(BaseMsg + 60)), SenderGUID = Manager.Memory.Read <ulong>(new IntPtr(BaseMsg)), Type = (ChatType)Manager.Memory.Read <byte>(new IntPtr(BaseMsg + 0x17ac)), Timestamp = Manager.Memory.Read <int>(new IntPtr(BaseMsg + 0x17b8)) }; try { struct2.Channel = struct2.FormattedMsg.Split(new char[] { '[' })[2].Split(new char[] { ']' })[0]; struct2.Player = struct2.FormattedMsg.Split(new char[] { '[' })[3].Split(new char[] { ']' })[0]; struct2.Message = struct2.FormattedMsg.Split(new char[] { '[' })[6].Split(new char[] { ']' })[0]; } catch { } return(struct2); }