Ejemplo n.º 1
0
        private string GetPerf(EncType enc, CombatantData combatant, double encdpshps)
        {
            string job = combatant.GetColumnByName("Job");

            if (job == string.Empty)
            {
                return(string.Empty);
            }

            string perfdpshps = enc == EncType.DPS ? "dps" : "hps";

            EncounterData encounter = combatant.Parent;
            string        zonename  = encounter.ZoneName;
            string        bossname  = encounter.GetStrongestEnemy("YOU");

            PerfKey key  = CreateKey(zonename, bossname);
            dynamic perf = null;

            if (cache.TryGetValue(key, out perf))
            {
                double[] perfarry = (double[])perf[perfdpshps][job];

                if (encdpshps < perfarry[6])
                {
                    return("10-");
                }
                if (encdpshps < perfarry[5])
                {
                    return("10+");
                }
                if (encdpshps < perfarry[4])
                {
                    return("25+");
                }
                if (encdpshps < perfarry[3])
                {
                    return("50+");
                }
                if (encdpshps < perfarry[2])
                {
                    return("75+");
                }
                if (encdpshps < perfarry[1])
                {
                    return("95+");
                }
                if (encdpshps < perfarry[0])
                {
                    return("99+");
                }
                return("100");
            }
            return(string.Empty);
        }
Ejemplo n.º 2
0
        private void LoadJson()
        {
            try
            {
                if (File.Exists(PERF_FILE_NAME))
                {
                    Log("load start.");

                    cache.Clear();

                    dynamic Json = DynamicJson.Parse(File.ReadAllText(PERF_FILE_NAME));

                    foreach (var zone in Json["zones"])
                    {
                        foreach (var boss in zone["boss"])
                        {
                            foreach (var name in boss["name"])
                            {
                                PerfKey key = CreateKey(zone["name"], name);
                                cache.Add(key, boss["perf"]);

                                Log(key.Zone + " <> " + key.Boss);
                            }
                        }
                    }
                    Log("load success.");
                }
                else
                {
                    Log("file not found. please Update");
                }
            }
            catch (Exception ex)
            {
                Log("load error.");
                Log(ex.StackTrace);
            }
        }