1.12.1 External Chat Reader Class [C#] menu

These ads disappear when you log in.

Results 1 to 3 of 3
  1. #1
    The_Bob's Avatar Member
    Reputation
    13
    Join Date
    Jul 2018
    Posts
    2
    Thanks G/R
    1/2
    Trade Feedback
    0 (0%)

    1.12.1 External Chat Reader Class [C#]

    Hey, I'm new here. I've been a memory editing hobbyist for a while, and recently got into WoW (1.12.1 especially). A friend of mine told me I should make an account and post some of my memory editing things. Hope someone finds some use!

    -WoW 1.12.1 External Chat Class-

    (For reading your in-game chat externally)


    How the chat seems to be stored:
    In 1.12.1, the client holds up to 60 messages in a buffer as it receives them. When a new message is received, its added to the end of the buffer. Upon reaching 60 messages, the buffer restarts at 0. The client uses this buffer to fill your chat log.

    How I read it:
    1. Check in an interval to see when the current position in the chat buffer changes, indicating a new message was sent.
    2. When this happens ^, read the buffer from the last read position (default 0) until the current buffer position. This will get all the messages between the last one we read, and the most recent one.
    3. When the current chat buffer position hits 60, read from where we are until position 60 and then restart reading at position 0.
    4. Save the current position and reference that as the "last read position" in step 2.


    Chat Offsets:
    Code:
    using System;
    
    public static class Offsets
    {
            //...
            internal static class Chat
            {
                internal static IntPtr chatBufferStart = (IntPtr)0xB50580; //Where our first message of the buffer is stored.
                internal static IntPtr NextMessage = (IntPtr)0x800; //Offset for next message.
                internal static IntPtr chatBufferPos = (IntPtr)0xB6E5D4; //Where the current chat buffer position is stored.
            }
            //...
    }
    Chat Enums:
    Code:
    using System;
    
    public static class Enums
    {
        //....
        public enum ChatType //ill find more later
        {
            Say = 0,
            Group = 1,
            Guild = 3,
            Yell = 5,
            Whisper = 6,
            Channel = 14
        }
        //....
    }
    ChatMessage Class
    • We will parse the messages into instances of this object. Contains a variable for all the parts of the message.
    • Can parse raw messages from the buffer, or you can create custom ones. (see below)
    • Custom ChatMessage Example
      Code:
      ChatMessage cm = new ChatMessage(Enums.ChatType.Channel, "DumbChannel", "Me", "Hello World."); 
      cm.ToString();
      
      --Output--
      "[DumbChannel] Me: Hello World."
    • You can also see from this example ^, there is a nice ToString() method.

    Code:
    using System;
    
    public class ChatMessage
    {
        public Enums.ChatType type = Enums.ChatType.Say;
        public string channel = "";
        public string sender = "";
        public string text = "";
    
        public ChatMessage(Enums.ChatType type, string channel, string sender, string text)
        {
            this.type = type;
            this.channel = channel;
            this.sender = sender;
            this.text = text;
        }
    
        public ChatMessage(string rawChatString)
        {
            rawChatString = rawChatString.Substring(7);
            int pFrom = 0;
            int pTo = rawChatString.IndexOf("], ");
            this.type = (Enums.ChatType)Int32.Parse(rawChatString.Substring(pFrom, pTo - pFrom));
            rawChatString = rawChatString.Substring(pTo + 13);
            pTo = rawChatString.IndexOf("], ");
            this.channel = rawChatString.Substring(pFrom, pTo - pFrom);
            rawChatString = rawChatString.Substring(pTo + 3);
            pFrom = rawChatString.IndexOf(": [") + 3;
            pTo = rawChatString.IndexOf("], ");
            this.sender = rawChatString.Substring(pFrom, pTo - pFrom);
            rawChatString = rawChatString.Substring(pTo + 10);
            this.text = rawChatString.Substring(0, rawChatString.Length - 1);
        }
    
        public override string ToString()
        {
            if (this.type == Enums.ChatType.Channel)
            {
                return String.Format("[{0}] {1}: {2}", this.channel, this.sender, this.text);
            }
            else if (this.type == Enums.ChatType.Group)
            {
                return String.Format("[Party] {0}: {1}", this.sender, this.text);
            }
            else if (this.type == Enums.ChatType.Guild)
            {
                return String.Format("[Guild] {0}: {1}", this.sender, this.text);
            }
            else if (this.type == Enums.ChatType.Say)
            {
                return String.Format("{0}: {1}", this.sender, this.text);
            }
            else if (this.type == Enums.ChatType.Whisper)
            {
                return String.Format("[Whisper] {0}: {1}", this.sender, this.text);
            }
            else if (this.type == Enums.ChatType.Yell)
            {
                return String.Format("<Yell>{0}: {1}", this.sender, this.text);
            }
            else
            {
                return "T:" + ((int)this.type).ToString() + ",C:" + this.channel + ",S:" + this.sender + ",M:" + this.text;
            }
        }
    }
    Chat Class:
    • The variable "wowReader" is an example memory reader with GreyMagic syntax, change this to whatever you read with.
    • The List<ChatMessage> "messageLog" holds your chatlog since your first use of UpdateLog().
    • Run "UpdateLog()" while logged in to add new chat messages, do it on a timer for auto chat-logging.

    Code:
    using System.Collections.Generic;
    using System;
    
    public static class Chat
    {
        public static int lastLoggedBuffer = 0;
        public static List<ChatMessage> chatLog = new List<ChatMessage>(); 
    
        public static string GetMessage(int pos) // start at 1
        {
            if (pos == 0)
            {
                return  wowReader.ReadString(Offsets.Chat.chatBufferStart,Encoding.ASCII, 512); //replace this with whatever you read with
            }
            return  wowReader.ReadString(IntPtr.Add(Offsets.Chat.chatBufferStart, ((int)Offsets.Chat.NextMessage * (pos - 1))),Encoding.ASCII, 512); //replace this with whatever you read with    
        }
    
        public static string GetLastMessage()
        {
            int bufferPos = wowReader.Read<int>(Offsets.Chat.chatBufferPos); //current buffer pos
            if (bufferPos == 0)
            {
                return  wowReader.ReadString(Offsets.Chat.chatBufferStart,Encoding.ASCII, 512); //replace this with whatever you read with
            }
            return  wowReader.ReadString(IntPtr.Add(Offsets.Chat.chatBufferStart, ((int)Offsets.Chat.NextMessage * (bufferPos - 1))),Encoding.ASCII, 512); //replace this with whatever you read with
        }
    
        public static void UpdateLog() //<---- Run this in short intervals to update your chatLog varaible.
        {
            int currBuffer = wowReader.Read<int>(Offsets.Chat.chatBufferPos); //current buffer pos
    
            if (currBuffer == lastLoggedBuffer) //no change
            {
                return;
            }
    
            int tmpBuffer = lastLoggedBuffer; //set temp buffer
    
            if (currBuffer < lastLoggedBuffer) //past 60
            {
                for (int i = lastLoggedBuffer + 1; i <= 60; i += 1) //add until 60
                {
                    chatLog.Add(new ChatMessage(GetMessage(i)));
                }
                tmpBuffer = 0; //reset to 0;
            }
    
            for (int i = tmpBuffer + 1; i <= currBuffer; i +=1)//add until last logged buffer
            {
                chatLog.Add(new ChatMessage(GetMessage(i)));
            }
    
            lastLoggedBuffer = currBuffer; //done
        }
    }
    (Sorry if the forums broke any alignment in the code previews.)
    Github Gist: WoW 1.12.1 External Chat Reader Class . GitHub (Thanks Corthezz :P)
    I hope someone can find use of this!
    Enjoy
    Last edited by The_Bob; 07-15-2018 at 02:37 AM. Reason: Added git

    These ads disappear when you log in.

  2. Thanks Corthezz, culino2 (2 members gave Thanks to The_Bob for this useful post)
  3. #2
    Corthezz's Avatar Elite User CoreCoins User Authenticator enabled
    Reputation
    373
    Join Date
    Nov 2011
    Posts
    308
    Thanks G/R
    101/90
    Trade Feedback
    0 (0%)
    Very cool release, thank you! For little code snippets or tools I can advice Discover gists . GitHub over pastebi on a sidenote.
    Check my blog: https://zzuks.blogspot.com

  4. Thanks The_Bob (1 members gave Thanks to Corthezz for this useful post)
  5. #3
    The_Bob's Avatar Member
    Reputation
    13
    Join Date
    Jul 2018
    Posts
    2
    Thanks G/R
    1/2
    Trade Feedback
    0 (0%)
    No Problem! And I had no idea that existed on Github haha! I updated the pastebin to that.
    Thanks man!

    Also, I updated the code to parse the message into a ChatMessage Class and store that in the messageLog list, instead of just a string. Updated the first Post.

Similar Threads

  1. [Request]WoW chat in external window
    By SnorlaxHF in forum WoW Bots Questions & Requests
    Replies: 6
    Last Post: 08-12-2011, 01:35 AM
  2. Replies: 5
    Last Post: 10-02-2009, 12:01 PM
  3. External chat program?
    By Athrin Onu in forum World of Warcraft General
    Replies: 3
    Last Post: 07-21-2009, 08:22 PM
  4. [Free Bot/Radar] MMOExtreme, All 12 Classes Ready to bot (Auto Combo!)
    By Hyru in forum Age of Conan Exploits|Hacks
    Replies: 34
    Last Post: 01-18-2009, 04:26 AM
  5. [Minor Guide]Increase melee class leveling from 1-12 dramatically!
    By kitash in forum World of Warcraft Guides
    Replies: 16
    Last Post: 05-27-2008, 02:15 AM
All times are GMT -5. The time now is 12:32 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2018 vBulletin Solutions, Inc. All rights reserved. Digital Point modules: Sphinx-based search