Esempio n. 1
0
        static void Main(string[] args)
        {
            FFProcess       process  = new FFProcess(FFProcess.DX11_DEFAULT_NAME, true);
            DiscordPresence presence = new DiscordPresence(DISCORD_CLIENT_ID);

            bool shutdown = false;

            new Thread(x => {
                while (!shutdown)
                {
                    if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                    {
                        shutdown = true;
                        Console.WriteLine("Stopping application...");
                    }
                }
            }).Start();

            Console.WriteLine("Press ESC to stop");
            do
            {
                while (Scanner.Instance.IsScanning)
                {
                    Thread.Sleep(1000);
                    Console.WriteLine("Scanning...");
                }
                CurrentPlayer currentPlayer = Reader.GetCurrentPlayer().CurrentPlayer;
                ActorItem     player        = null /*ActorItem.CurrentUser*/;
                if (player == null)
                {
                    ActorResult aResult = Reader.GetActors();
                    KeyValuePair <uint, ActorItem> playerKeyValue = aResult.CurrentPCs.ToList().Find(x => x.Value.Name == currentPlayer.Name);
                    ActorItem playerItem = playerKeyValue.Value;

                    player = playerItem;
                }

                if (player != null)
                {
                    presence.playerName = player.Name;
                    presence.lvl        = player.Level.ToString();
                    presence.job        = player.Job.ToString();

                    uint    mapID = player.MapTerritory;
                    MapItem zone  = ZoneLookup.GetZoneInfo(mapID);
                    presence.place = zone.Name.English;

                    presence.UpdatePresence();
                }
                Thread.Sleep(5000);
            } while (!shutdown);

            presence.Deinitialize();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var stringReader = new StringReader(XElement.Load("./Bootstrapper.exe.nlog").ToString());

            using (XmlReader xmlReader = XmlReader.Create(stringReader)) {
                LogManager.Configuration = new XmlLoggingConfiguration(xmlReader, null);
            }

            ActionLookup.GetActionInfo(2);
            StatusEffectLookup.GetStatusInfo(2);
            ZoneLookup.GetZoneInfo(138);

            ActionItem action = ActionLookup.GetActionInfo(2);
            StatusItem status = StatusEffectLookup.GetStatusInfo(2);
            MapItem    zone   = ZoneLookup.GetZoneInfo(138);

            Process process = Process.GetProcessesByName("ffxiv_dx11").FirstOrDefault();

            if (process != null)
            {
                MemoryHandler.Instance.SetProcess(
                    new ProcessModel {
                    IsWin64 = true,
                    Process = process,
                });

                while (Scanner.Instance.IsScanning)
                {
                    Thread.Sleep(1000);
                    Console.WriteLine("Scanning...");
                }

                MemoryHandler.Instance.SignaturesFoundEvent += delegate(object sender, SignaturesFoundEvent e) {
                    foreach (KeyValuePair <string, Signature> kvp in e.Signatures)
                    {
                        Console.WriteLine($"{kvp.Key} => {kvp.Value.GetAddress():X}");
                    }
                };
            }

            Console.WriteLine("To exit this application press \"Enter\".");
            Console.ReadLine();
        }
Esempio n. 3
0
            public static JsonParse ConvertParse()
            {
                var hasDamage      = ParseControl.Instance.Timeline.Overall.Stats.GetStatValue("TotalOverallDamage") > 0;
                var hasHealing     = ParseControl.Instance.Timeline.Overall.Stats.GetStatValue("TotalOverallHealing") > 0;
                var hasDamageTaken = ParseControl.Instance.Timeline.Overall.Stats.GetStatValue("TotalOverallDamageTaken") > 0;

                if (!hasDamage && !hasHealing && !hasDamageTaken)
                {
                    return(new JsonParse());
                }

                StatContainer currentOverallStats       = ParseControl.Instance.Timeline.Overall.Stats;
                Dictionary <string, object> historyItem = new Dictionary <string, object>();
                Dictionary <string, object> timeline    = new Dictionary <string, object>();
                Dictionary <string, object> overall     = new Dictionary <string, object> {
                    {
                        "Stats", new Dictionary <string, object>()
                    }
                };

                foreach (Stat <double> stat in currentOverallStats)
                {
                    ((Dictionary <string, object>)overall["Stats"]).Add(stat.Name, stat.Value);
                }

                timeline.Add("Overall", overall);
                StatGroup[] playerList = ParseControl.Instance.Timeline.Party.ToArray();
                Dictionary <string, object> players = new Dictionary <string, object>();

                foreach (StatGroup player in playerList)
                {
                    Dictionary <string, object> playerItem = new Dictionary <string, object> {
                        {
                            "Stats", new Dictionary <string, object>()
                        }, {
                            "Last20DamageActions", ((Player)player).Last20DamageActions.ToList()
                        }, {
                            "Last20DamageTakenActions", ((Player)player).Last20DamageTakenActions.ToList()
                        }, {
                            "Last20HealingActions", ((Player)player).Last20HealingActions.ToList()
                        }, {
                            "Last20Items", ((Player)player).Last20Items.ToList()
                        }
                    };
                    foreach (Stat <double> stat in player.Stats)
                    {
                        ((Dictionary <string, object>)playerItem["Stats"]).Add(stat.Name, stat.Value);
                    }

                    players.Add(player.Name, playerItem);
                    RabbitHoleCopy(ref playerItem, player);
                }

                timeline.Add("Party", players);
                StatGroup[] monsterList = ParseControl.Instance.Timeline.Monster.ToArray();
                Dictionary <string, object> monsters = new Dictionary <string, object>();

                foreach (StatGroup monster in monsterList)
                {
                    Dictionary <string, object> monsterItem = new Dictionary <string, object> {
                        {
                            "Stats", new Dictionary <string, object>()
                        }, {
                            "Last20DamageActions", ((Monster)monster).Last20DamageActions.ToList()
                        }, {
                            "Last20DamageTakenActions", ((Monster)monster).Last20DamageTakenActions.ToList()
                        }, {
                            "Last20HealingActions", ((Monster)monster).Last20HealingActions.ToList()
                        }, {
                            "Last20Items", ((Monster)monster).Last20Items.ToList()
                        }
                    };
                    foreach (Stat <double> stat in monster.Stats)
                    {
                        ((Dictionary <string, object>)monsterItem["Stats"]).Add(stat.Name, stat.Value);
                    }

                    monsters.Add(monster.Name, monsterItem);
                    RabbitHoleCopy(ref monsterItem, monster);
                }

                timeline.Add("Monster", monsters);
                historyItem.Add("Timeline", timeline);



                DateTime start            = ParseControl.Instance.StartTime;
                DateTime end              = DateTime.Now;
                TimeSpan parseLength      = end - start;
                var      parseTimeDetails = $"{start} -> {end} [{parseLength}]";
                var      zone             = "UNKNOWN";

                if (XIVInfoViewModel.Instance.CurrentUser != null)
                {
                    var     mapIndex = XIVInfoViewModel.Instance.CurrentUser.MapIndex;
                    MapItem mapItem  = ZoneLookup.GetZoneInfo(mapIndex);
                    switch (Constants.GameLanguage)
                    {
                    case "French":
                        zone = mapItem.Name.French;
                        break;

                    case "Japanese":
                        zone = mapItem.Name.Japanese;
                        break;

                    case "German":
                        zone = mapItem.Name.German;
                        break;

                    case "Chinese":
                        zone = mapItem.Name.Chinese;
                        break;

                    case "Korean":
                        zone = mapItem.Name.Korean;
                        break;

                    default:
                        zone = mapItem.Name.English;
                        break;
                    }
                }

                var monsterName = "NULL";

                try {
                    StatGroup biggestMonster = null;
                    foreach (StatGroup monster in ParseControl.Instance.Timeline.Monster)
                    {
                        if (biggestMonster == null)
                        {
                            biggestMonster = monster;
                        }
                        else
                        {
                            if (monster.Stats.GetStatValue("TotalOverallDamage") > biggestMonster.Stats.GetStatValue("TotalOverallDamage"))
                            {
                                biggestMonster = monster;
                            }
                        }
                    }

                    if (biggestMonster != null)
                    {
                        monsterName = biggestMonster.Name;
                    }
                }
                catch (Exception ex) {
                    Logging.Log(Logger, new LogItem(ex, true));
                }



                return(new JsonParse {
                    Name = $"{zone} [{monsterName}] {parseTimeDetails}",
                    Parse = JsonConvert.SerializeObject(
                        historyItem,
                        new JsonSerializerSettings {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    })
                });
            }
        private void InitializeHistory()
        {
            var hasDamage      = this.ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamage") > 0;
            var hasHealing     = this.ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallHealing") > 0;
            var hasDamageTaken = this.ParseControl.Timeline.Overall.Stats.GetStatValue("TotalOverallDamageTaken") > 0;

            if (hasDamage || hasHealing || hasDamageTaken)
            {
                StatContainer  currentOverallStats = this.ParseControl.Timeline.Overall.Stats;
                var            historyItem         = new ParseHistoryItem();
                HistoryControl historyController   = historyItem.HistoryControl = new HistoryControl();
                foreach (Stat <double> stat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(stat.Name, stat.Value);
                }

                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDPS", currentOverallStats.GetStatValue("DPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDOTPS", currentOverallStats.GetStatValue("DOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHPS", currentOverallStats.GetStatValue("HPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOHPS", currentOverallStats.GetStatValue("HOHPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHOTPS", currentOverallStats.GetStatValue("HOTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerHMPS", currentOverallStats.GetStatValue("HMPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTPS", currentOverallStats.GetStatValue("DTPS"));
                historyController.Timeline.Overall.Stats.EnsureStatValue("StaticPlayerDTOTPS", currentOverallStats.GetStatValue("DTOTPS"));
                StatGroup[] playerList = this.ParseControl.Timeline.Party.ToArray();
                foreach (StatGroup player in playerList)
                {
                    HistoryGroup playerInstance = historyController.Timeline.GetSetPlayer(player.Name);
                    playerInstance.Last20DamageActions      = ((Player)player).Last20DamageActions.ToList();
                    playerInstance.Last20DamageTakenActions = ((Player)player).Last20DamageTakenActions.ToList();
                    playerInstance.Last20HealingActions     = ((Player)player).Last20HealingActions.ToList();
                    playerInstance.Last20Items = ((Player)player).Last20Items.ToList();
                    foreach (Stat <double> stat in player.Stats)
                    {
                        playerInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }

                    this.RabbitHoleCopy(ref playerInstance, player);
                }

                StatGroup[] monsterList = this.ParseControl.Timeline.Monster.ToArray();
                foreach (StatGroup monster in monsterList)
                {
                    HistoryGroup monsterInstance = historyController.Timeline.GetSetMonster(monster.Name);
                    monsterInstance.Last20DamageActions      = ((Monster)monster).Last20DamageActions.ToList();
                    monsterInstance.Last20DamageTakenActions = ((Monster)monster).Last20DamageTakenActions.ToList();
                    monsterInstance.Last20HealingActions     = ((Monster)monster).Last20HealingActions.ToList();
                    monsterInstance.Last20Items = ((Monster)monster).Last20Items.ToList();
                    foreach (Stat <double> stat in monster.Stats)
                    {
                        monsterInstance.Stats.EnsureStatValue(stat.Name, stat.Value);
                    }

                    this.RabbitHoleCopy(ref monsterInstance, monster);
                }

                historyItem.Start       = this.ParseControl.StartTime;
                historyItem.End         = DateTime.Now;
                historyItem.ParseLength = historyItem.End - historyItem.Start;
                var parseTimeDetails = $"{historyItem.Start} -> {historyItem.End} [{historyItem.ParseLength}]";
                var zone             = "UNKNOWN";
                if (XIVInfoViewModel.Instance.CurrentUser != null)
                {
                    var     mapIndex = XIVInfoViewModel.Instance.CurrentUser.MapIndex;
                    MapItem mapItem  = ZoneLookup.GetZoneInfo(mapIndex);
                    switch (Constants.GameLanguage)
                    {
                    case "French":
                        zone = mapItem.Name.French;
                        break;

                    case "Japanese":
                        zone = mapItem.Name.Japanese;
                        break;

                    case "German":
                        zone = mapItem.Name.German;
                        break;

                    case "Chinese":
                        zone = mapItem.Name.Chinese;
                        break;

                    case "Korean":
                        zone = mapItem.Name.Korean;
                        break;

                    default:
                        zone = mapItem.Name.English;
                        break;
                    }
                }

                var monsterName = "NULL";
                try {
                    StatGroup biggestMonster = null;
                    foreach (StatGroup monster in this.ParseControl.Timeline.Monster)
                    {
                        if (biggestMonster == null)
                        {
                            biggestMonster = monster;
                        }
                        else
                        {
                            if (monster.Stats.GetStatValue("TotalOverallDamage") > biggestMonster.Stats.GetStatValue("TotalOverallDamage"))
                            {
                                biggestMonster = monster;
                            }
                        }
                    }

                    if (biggestMonster != null)
                    {
                        monsterName = biggestMonster.Name;
                    }
                }
                catch (Exception ex) {
                    Logging.Log(Logger, new LogItem(ex, true));
                }

                foreach (Stat <double> oStat in currentOverallStats)
                {
                    historyController.Timeline.Overall.Stats.EnsureStatValue(oStat.Name, oStat.Value);
                }

                historyItem.Name = $"{zone} [{monsterName}] {parseTimeDetails}";
                DispatcherHelper.Invoke(() => MainViewModel.Instance.ParseHistory.Insert(1, historyItem));
            }
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var stringReader = new StringReader(XElement.Load("./Bootstrapper.exe.nlog").ToString());

            using (XmlReader xmlReader = XmlReader.Create(stringReader)) {
                LogManager.Configuration = new XmlLoggingConfiguration(xmlReader, null);
            }

            ActionLookup.GetActionInfo(2);
            StatusEffectLookup.GetStatusInfo(2);
            ZoneLookup.GetZoneInfo(138);

            ActionItem action = ActionLookup.GetActionInfo(2);
            StatusItem status = StatusEffectLookup.GetStatusInfo(2);
            MapItem    zone   = ZoneLookup.GetZoneInfo(138);

            var processName = "ffxiv_dx11";

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                processName = "ffxiv_dx11.exe";
            }

            Process process = Process.GetProcessesByName(processName).FirstOrDefault();

            if (process == null && RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                var ps = new Process();
                ps.StartInfo = new ProcessStartInfo("ps", "-Ao pid,command");
                ps.StartInfo.RedirectStandardOutput = true;
                ps.Start();
                var content = ps.StandardOutput.ReadToEnd();
                ps.WaitForExit(2000);

                var pid = content.Split(Environment.NewLine).Where(x => x.Contains(processName)).Select(x => Enumerable.FirstOrDefault(x.Split(' '))).FirstOrDefault(x => x != null);
                if (!string.IsNullOrEmpty(pid))
                {
                    process = Process.GetProcessById(int.Parse(pid));
                }
            }

            if (process != null)
            {
                MemoryHandler.Instance.SetProcess(
                    new ProcessModel {
                    IsWin64 = true,
                    Process = process,
                });

                MemoryHandler.Instance.SignaturesFoundEvent += delegate(object sender, SignaturesFoundEvent e) {
                    foreach (KeyValuePair <string, Signature> kvp in e.Signatures)
                    {
                        Console.WriteLine($"{kvp.Key} => {kvp.Value.GetAddress():X}");
                    }
                };

                while (Scanner.Instance.IsScanning)
                {
                    Thread.Sleep(1000);
                    Console.WriteLine("Scanning...");
                }
            }

            Console.WriteLine("To exit this application press \"Enter\".");
            Console.ReadLine();
        }