[Code Release] Reading Chat menu

User Tag List

Results 1 to 1 of 1
  1. #1
    SwInY's Avatar Member
    Reputation
    29
    Join Date
    Jul 2009
    Posts
    97
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Code Release] Reading Chat

    Hey Guys,

    This is my chat manager from my old fishbot.
    it works like a "event" driven code. exept back then i didnt know how to do events. and still dont to this day haha


    basicly. it pulses Pulse(), the first time it runs it just runs to get the new _seq,
    so its a INIT. so it loops threw all and knows where we are up to, it DOESNT call Event_NewMessage so it doesn't spam.
    anything after INIT, will be called Event_NewMessage, this is and was my "event" as i dont know events. and having a new chat was basicly a event in my eyes.

    so you really shouldnt need to touch anything in there at all.

    only thing u should worry about is Event_NewMessage calling CHAT.
    chat is where you should have your own code. mine was purely so it would wake me up when noobs where whispering me while i was asleep.

    enjoy,

    chatmanager.cs
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using SwInYFisher.Managers;
    
    namespace SwInYFisher.Managers
    {
        static class ChatManager
        {
            // Public Declair
            private static bool _Init = false;
            private static int _LastSeq;
            private static List<cChatMessages> lMessages = new List<cChatMessages>();
    
    
    // THIS IS WHERE IT CALLS CHAT FUNCTION
    // THIS IS WHERE IT ACTS AS A EVENT
            private static void Event_NewMessage(cChatMessages Obj)
            {
               Chat.Event_NewMessage(Obj);
            }
    
    
        #region "Main Code"
    
            /// <summary>
            /// Refreshes list, Checks if chat is updated.
            /// </summary>
            public static void Pulse()
            {
                PulseList();
                CheckNewChat();
            }
    
            /// <summary>
            /// Refresh's the Chat List, and sorts by _Seq
            /// </summary>
            private static void PulseList()
            {
                // Declair
                uint CurObj;
    
                // Clear List
                lMessages.Clear();
    
                // Get all the chat messages
                for (int i = 0; i < 60; i++)
                {
                    // Get current object were at
                    CurObj = (uint)Addresses.ChatBuffer.ChatBuffer_Start + (uint)Addresses.ChatBuffer.ChatBuffer_Next * (uint)i;
    
                    // Create a new class
                    cChatMessages NewMessage = new cChatMessages();
                    NewMessage._Seq = GetSequence(CurObj);
                    NewMessage._Time = GetTime(CurObj);
                    NewMessage._PureText = GetPureText(CurObj);
                    NewMessage._FormattedMessage = GetFormattedMessage(CurObj);
    
                    // Add Class to the list
                    lMessages.Add(NewMessage);
                }
    
                // Sort
                lMessages.Sort();
            }
    
    
            /// <summary>
            /// Goes threw list and looks for new chat
            /// </summary>
            private static void CheckNewChat()
            {
                foreach (cChatMessages Messages in lMessages)
                {
                    // If theres a new message, Hey lets update.
                    if (Messages._Seq > _LastSeq)
                    {
                        // Call the New Message Event if INIT has been done
                        if (_Init) Event_NewMessage(Messages);
    
                        // Lets make new Seq our last
                        _LastSeq = Messages._Seq;
                    }
                }
    
                // Lets say we have done INIT
                if (_Init == false) _Init = true;
    
            }
    
        #endregion
    
    
        #region "Memory Reads"
            private static long GetTime(uint CurObj)
            {
                return ProcessManager.WoWProcess.ReadInt64((uint)CurObj + (uint)Addresses.ChatBuffer.Time);
            }
    
            private static int GetSequence(uint CurObj)
            {
                return ProcessManager.WoWProcess.ReadInt((uint)CurObj + (uint)Addresses.ChatBuffer.Sequence);
            }
    
            private static string GetPureText(uint CurObj)
            {
                return ProcessManager.WoWProcess.ReadASCIIString((uint)CurObj + (uint)Addresses.ChatBuffer.PureText,255);
            }
    
            private static string GetFormattedMessage(uint CurObj)
            {
                return ProcessManager.WoWProcess.ReadASCIIString((uint)CurObj + (uint)Addresses.ChatBuffer.FormattedMessage, 400);
            }
    
        #endregion
    
        }
    
    
    
        public class cChatMessages : IComparable<cChatMessages>
        {
            // Public Declair
            public string _FormattedMessage;
            public string _PureText;
            public long _Time;
            public int _Seq;
    
    
            public int CompareTo(cChatMessages Obj)
            {
                return _Seq.CompareTo(Obj._Seq);
            }
        }
    
    }

    this was my chat.cs
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using SwInYFisher.Managers;
    using System.Windows.Forms;
    
    namespace SwInYFisher
    {
        static class Chat
        {
            // Declair our Notify Icon
            private static NotifyIcon _Icon;
    
            /// <summary>
            /// Init, Pass our Notify Icon so we can bubble text
            /// </summary>
            /// <param name="Value"></param>
            public static void Init(NotifyIcon Value)
            {
                _Icon = Value;
            }
    
    
            public static void Event_NewMessage(cChatMessages Obj)
            {
                int Type;
                string Chanel;
                string PlayerName;
    
    
                int pos1 = Obj._FormattedMessage.IndexOf("Type: [") + 7;
                int pos2 = Obj._FormattedMessage.IndexOf("]", pos1);
                Type = Int32.Parse(Obj._FormattedMessage.Substring(pos1, pos2 - pos1));
    
                pos1 = Obj._FormattedMessage.IndexOf("Channel: [") + 10;
                pos2 = Obj._FormattedMessage.IndexOf("]", pos1);
                Chanel = Obj._FormattedMessage.Substring(pos1, pos2 - pos1);
    
                pos1 = Obj._FormattedMessage.IndexOf("Player Name: [") + 14;
                pos2 = Obj._FormattedMessage.IndexOf("]", pos1);
                PlayerName = Obj._FormattedMessage.Substring(pos1, pos2 - pos1);
    
    
                if (Type == 7)
                {
                    IncomingWhisper(PlayerName, Obj);
                }
    
                
    
            }
    
            private static void IncomingWhisper(String PlayerName, cChatMessages Obj)
            {
                _Icon.ShowBalloonTip(15000,
                        "SwInY Fisher - Incoming Whisper",
                        PlayerName + ": " + Obj._PureText.ToString(),
                        ToolTipIcon.Error);
    
                MessageSound();
    
                
            }
    
    
            private static void MessageSound()
            {
                System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
    
                string appPath = Path.GetDirectoryName(Application.ExecutablePath);
                myPlayer.SoundLocation = appPath + "\\nudge.wav";
                myPlayer.Play();
    
            }
    
        }
    }

    oh in my main form i had a timer set to 400ms
    just to keep the chat fresh and pulsing
    Code:
            private static Thread ChatPulse = new Thread(new ThreadStart(ChatManager.Pulse));
            private void tmrChat_Tick(object sender, EventArgs e)
            {
                if (Main.ChatPulse.IsAlive) return;
    
                Main.ChatPulse = null;
                Main.ChatPulse = new Thread(new ThreadStart(ChatManager.Pulse));
    
                ChatPulse.Start();
            }
            #endregion
    Last edited by SwInY; 03-29-2011 at 07:06 PM.

    [Code Release] Reading Chat

Similar Threads

  1. [HOT RELEASE] Player Chat Cmds
    By Silentnvd in forum WoW EMU General Releases
    Replies: 9
    Last Post: 10-31-2008, 08:17 PM
  2. [help] reading chat pane (for zeppelin arrivals)
    By korknob in forum WoW Memory Editing
    Replies: 2
    Last Post: 05-17-2008, 06:00 AM
  3. Memory Reading Chat, w/ help from an Add-On
    By Vector0 in forum WoW Memory Editing
    Replies: 6
    Last Post: 05-08-2008, 10:00 AM
All times are GMT -5. The time now is 08:42 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search