示例#1
0
 public void ResetCache()
 {
     worldData     = null;
     perfData      = null;
     charIdData    = null;
     actorsData    = null;
     chatLogData   = null;
     chatInputData = null;
 }
        public override bool Equals(object obj)
        {
            SigChatInputData data = (obj as SigChatInputData);

            if (data == null)
            {
                return(false);
            }
            return((this.text != data.text) || (this.open != data.open));
        }
        public override object GetData(HookProcess process)
        {
            IntPtr pointer  = (IntPtr)process.GetInt64(baseAddress);
            string chattext = string.Empty;

            if (pointer != IntPtr.Zero)
            {
                int len = process.GetInt32(pointer, Offsets["OffsetInputLength"]);
                if (len <= 501)  // ???
                {
                    IntPtr pointer2 = (IntPtr)process.GetInt64(pointer, Offsets["OffsetInputText"]);
                    if (pointer2 != IntPtr.Zero)
                    {
                        chattext = process.GetString(pointer2, 0, len);
                    }
                }
            }
            SigChatInputData data = new SigChatInputData {
                open = (pointer != IntPtr.Zero),
                text = chattext,
            };

            return((object)data);
        }
示例#4
0
        public void MemoryLoop()
        {
            if (GetSignature("WORLD", out var worldSig))
            {
                SigWorldData data = (SigWorldData)worldSig.GetData(ffxivProcess);
                if (worldData == null || !data.Equals(worldData))
                {
                    this.OnDataUpdate(data);
                    //Console.WriteLine("World: " + data.world);
                    worldData = data;
                }
            }
            if (GetSignature("CHARID", out var charidSig))
            {
                SigCharIdData data = (SigCharIdData)charidSig.GetData(ffxivProcess);
                if (data != null)
                {
                    if (charIdData == null || !data.Equals(charIdData))
                    {
                        this.OnDataUpdate(data);
                        charIdData = data;
                    }
                }
            }
            if (GetSignature("PERFSTATUS", out var perfSig))
            {
                SigPerfData data = (SigPerfData)perfSig.GetData(ffxivProcess);
                if (data != null)
                {
                    if (perfData == null || !data.Equals(perfData))
                    {
                        this.OnDataUpdate(data);
                        perfData = data;
                    }
                }
            }
            if (GetSignature("CHARMAP", out var charSig))
            {
                SigActorsData data = (SigActorsData)charSig.GetData(ffxivProcess);
                if (data != null)
                {
                    /*
                     * if(data.currentActors.Values.Count > 0) {
                     *      ActorData me = data.currentActors.First().Value;
                     *      Console.WriteLine(string.Format("YOU: {0} {1}", me.name, me.id));
                     * }
                     */
                    this.OnDataUpdate(data);
                    actorsData = data;

                    if (data.addedActors.Count > 0 || data.removedActors.Count > 0)
                    {
                        //string added = String.Join("+", data.addedActors.Select(t => t.Value.name).ToArray());
                        //Console.WriteLine(string.Format("Players: {0} new, {1} removed: {2}", data.addedActors.Count, data.removedActors.Count, added));
                    }
                    if (false)
                    {
                        string added   = String.Join(",", data.addedActors.Select(t => t.Value.name).ToArray());
                        string current = String.Join(",", data.currentActors.Select(t => t.Value.name).ToArray());
                        string removed = String.Join(",", data.removedActors.Select(t => t.Value.name).ToArray());
                        Console.WriteLine(string.Format("--- {0} players", data.currentActors.Count()));
                        Console.WriteLine(string.Format("ADDED: {0}", added));
                        Console.WriteLine(string.Format("REMOVED: {0}", removed));
                        Console.WriteLine(string.Format("CURRENT: {0}", current));
                    }
                }
            }
            if (GetSignature("CHATLOG", out var chatlogSig))
            {
                SigChatLogData data = (SigChatLogData)chatlogSig.GetData(ffxivProcess);
                if (data != null)
                {
                    foreach (ChatLogItem msg in data.chatMessages)
                    {
                        Console.WriteLine(msg.Line);
                    }
                    if (data.chatMessages.Count > 0)
                    {
                        this.OnDataUpdate(data);
                        //Console.WriteLine(string.Format("Chatlog: {0} new", data.chatMessages.Count));
                    }
                }
            }
            if (GetSignature("CHATINPUT", out var chatinputSig))
            {
                SigChatInputData data = (SigChatInputData)chatinputSig.GetData(ffxivProcess);
                if (data != null)
                {
                    if (chatInputData == null || data != chatInputData)
                    {
                        this.OnDataUpdate(data);
                    }
                }
            }
        }