예제 #1
0
 public void ResetCache()
 {
     worldData     = null;
     perfData      = null;
     charIdData    = null;
     actorsData    = null;
     chatLogData   = null;
     chatInputData = null;
 }
예제 #2
0
        public override bool Equals(object obj)
        {
            SigPerfData data = (obj as SigPerfData);

            if (data == null)
            {
                return(false);
            }
            int perf1c = 0;
            int perf2c = 0;

            for (uint i = 0; i < Performances.Count; i++)
            {
                perf1c += (int)Performances[i].Instrument;
                perf2c += (int)data.Performances[i].Instrument;
            }
            return(perf1c == perf2c);
        }
        public override object GetData(HookProcess process)
        {
            var result = new SigPerfData();

            int entrySize  = 12;
            int numEntries = 99;

            byte[] performanceData = process.GetByteArray(baseAddress, entrySize * numEntries);

            for (int i = 0; i < numEntries; i++)
            {
                int offset = (i * entrySize);

                float animation  = BitConverter.TryToSingle(performanceData, offset + 0);
                byte  id         = performanceData[offset + 4];
                byte  unknown1   = performanceData[offset + 5];
                byte  variant    = performanceData[offset + 6];             // Animation (hand to left or right)
                byte  type       = performanceData[offset + 7];
                byte  status     = performanceData[offset + 8];
                byte  instrument = performanceData[offset + 9];
                int   unknown2   = BitConverter.TryToInt16(performanceData, offset + 10);

                if (id >= 0 && id <= 99)
                {
                    PerformanceData item = new PerformanceData();
                    item.Animation  = animation;
                    item.Unknown1   = (byte)unknown1;
                    item.Id         = (byte)id;
                    item.Variant    = (byte)variant;
                    item.Type       = (byte)type;
                    item.Status     = (Performance.Status)status;
                    item.Instrument = (Performance.Instrument)instrument;

                    if (!result.Performances.ContainsKey(id))
                    {
                        result.Performances[id] = item;
                    }
                }
            }
            return(result);
        }
예제 #4
0
 public void MemoryLoop()
 {
     //Console.Clear();
     if (GetSignature("WORLD", out var worldSig))
     {
         SigWorldData data = (SigWorldData)worldSig.GetData(ffxivProcess);
         if (worldData == null || !data.Equals(worldData))
         {
             dataPipe.PushMessage(CreatePipeData(data));
             Console.WriteLine("World: " + data.world);
             worldData = data;
         }
     }
     if (GetSignature("PERFSTATUS", out var perfSig))
     {
         SigPerfData data = (SigPerfData)perfSig.GetData(ffxivProcess);
         if (data != null)
         {
             if (perfData == null || !data.Equals(perfData))
             {
                 dataPipe.PushMessage(CreatePipeData(data));
                 Console.WriteLine("Performance change " + data.IsUp());
                 perfData = data;
             }
         }
     }
     if (GetSignature("CHARID", out var charidSig))
     {
         SigCharIdData data = (SigCharIdData)charidSig.GetData(ffxivProcess);
         if (data != null)
         {
             if (charIdData == null || !data.Equals(charIdData))
             {
                 dataPipe.PushMessage(CreatePipeData(data));
                 Console.WriteLine("New charid: " + data.id);
                 charIdData = 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));
             }
             if (data.addedActors.Count > 0 || data.removedActors.Count > 0)
             {
                 dataPipe.PushMessage(CreatePipeData(data));
                 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)
             {
                 dataPipe.PushMessage(CreatePipeData(data));
                 Console.WriteLine(string.Format("Chatlog: {0} new", data.chatMessages.Count));
             }
         }
     }
 }