コード例 #1
0
ファイル: ItemDisplay.cs プロジェクト: khadoran/reanimator
        public static string[] GetDisplayStrings(Unit unit, bool inherent = false)
        {
            if (Manager == null) throw new Exception("FileManager Null");

            var strings = new List<string>();
            var itemDisplay = Manager.GetDataTable("ITEMDISPLAY");
            Evaluator = new Evaluator {Unit = unit, Context = new Context(), Manager = Manager};

            DataRow last = null;

            foreach (DataRow row in itemDisplay.Rows)
            {
                if (inherent)
                {
                    if (((int)row["toolTipArea"]) != 20)
                        continue;
                }
                else
                {
                    if (((int)row["toolTipArea"]) != 0 && !row["exampleDescription"].ToString().Contains("thorns"))
                        continue;
                }

                var rule1 = (Display.Rule)row["rule1"];
                var rule2 = (Display.Rule)row["rule2"];
                var rule3 = (Display.Rule)row["rule3"];

                if (rule1 == Display.Rule.Ditto) row["displayCondition1"] = last["displayCondition1"];
                if (rule2 == Display.Rule.Ditto) row["displayCondition2"] = last["displayCondition2"];
                if (rule3 == Display.Rule.Ditto) row["displayCondition3"] = last["displayCondition3"];

                var condition1 = (string) row["displayCondition1"];
                var condition2 = (string) row["displayCondition2"];
                var condition3 = (string) row["displayCondition3"];

                last = row;

                if (IsConditionMet(condition1) == false) continue;
                if (IsConditionMet(condition2) == false) continue;
                if (IsConditionMet(condition3) == false) continue;

                var result = GetDisplayString(row);
                if (String.IsNullOrEmpty(result)) continue;

                if (result.Contains("Thorns"))
                    result = FormatThorns(result);

                strings.Add(result);
            }

            string skill = GetSkillBonus(unit);
            if (!String.IsNullOrWhiteSpace(skill))
                strings.Add(skill);

            return strings.ToArray();
        }
コード例 #2
0
ファイル: MonsterAffixes.cs プロジェクト: khadoran/reanimator
        private string AddOtherProperties(Unit unit)
        {
            string props = string.Empty;
            int num = 0;

            //procs
            //spawning
            num = (int)unit.GetStat("proc_chance_on_got_killed", "Spawning");
            if (num > 0)
                props += "Spawns additional monsters of its type when killed<br />";
            //cascading
            num = (int)unit.GetStat("proc_chance_on_got_killed", "Cascade");
            if (num > 0)
                props += num + "% chance to spawn two smaller clones when killed<br />";
            //teleporting
            num = (int)unit.GetStat("proc_chance_on_got_hit", "Teleport");
            if (num > 0)
                props += num + "% chance to teleport when hit<br />";
            //bug hive
            num = (int)unit.GetStat("proc_chance_on_got_hit", "BugHive");
            if (num > 0)
                props += num + "% chance to release a Bug Hive when hit<br />";

            //skills
            //regenerating (specific hp replenish doesn't seem to do anything)
            num = (int)unit.GetStat("skill_level", "Monster_Affix_Healing");
            if (num > 0)
                props += "Can fully heal when below 25% health, with a cooldown of 30 seconds<br />";

            //fire "field" (nova) (not sure what eventparam is for)
            num = (int)unit.GetStat("skill_level", "Monster_Affix_Field_Fire");
            if (num > 0)
                props += "Constant Fire Nova that does (" + ((10 + 5 * num) / 100.0) + " * mlevel_damage) in a 5m radius<br />";
            //fire effect on death
            num = (int)unit.GetStat("skill_level", "Monster_Affix_FireDeath");
            if (num > 0)
                props += "When killed, causes a fire field that does (" + ((5 + 5 * num) / 100.0) + " * mlevel_damage) damage in a 10m radius for 5 seconds<br />";

            //physical "field" (nova) (not sure what eventparam is for)
            num = (int)unit.GetStat("skill_level", "Monster_Affix_Field_Physical");
            if (num > 0)
                props += "Constant Physical Nova that does (" + ((10 + 5 * num) / 100.0) + " * mlevel_damage) in a 5m radius<br />";
            //physical effect on death
            num = (int)unit.GetStat("skill_level", "Monster_Affix_PhysicalDeath");
            if (num > 0)
                props += "When killed, causes a physical field that does (" + ((5 + 5 * num) / 100.0) + " * mlevel_damage) damage in a 10m radius for 5 seconds<br />";

            //electric "field" (nova) (not sure what eventparam is for)
            num = (int)unit.GetStat("skill_level", "Monster_Affix_Field_Electric");
            if (num > 0)
                props += "Constant Electric Nova that does (" + ((10 + 5 * num) / 100.0) + " * mlevel_damage) in a 5m radius<br />";
            //electric effect on death
            num = (int)unit.GetStat("skill_level", "Monster_Affix_ElectricDeath");
            if (num > 0)
                props += "When killed, causes an electric field that does (" + ((5 + 5 * num) / 100.0) + " * mlevel_damage) damage in a 10m radius for 5 seconds<br />";

            //spectral "field" (nova) (not sure what eventparam is for)
            num = (int)unit.GetStat("skill_level", "Monster_Affix_Field_Spectral");
            if (num > 0)
                props += "Constant Spectral Nova that does (" + ((10 + 5 * num) / 100.0) + " * mlevel_damage) in a 5m radius<br />";
            //spectral effect on death
            num = (int)unit.GetStat("skill_level", "Monster_Affix_SpectralDeath");
            if (num > 0)
                props += "When killed, causes a spectral field that does (" + ((5 + 5 * num) / 100.0) + " * mlevel_damage) damage in a 10m radius for 5 seconds<br />";

            //toxic "field" (nova) (not sure what eventparam is for)
            num = (int)unit.GetStat("skill_level", "Monster_Affix_Field_Toxic");
            if (num > 0)
                props += "Constant Toxic Nova that does (" + ((10 + 5 * num) / 100.0) + " * mlevel_damage) in a 5m radius<br />";
            //toxic effect on death
            num = (int)unit.GetStat("skill_level", "Monster_Affix_ToxicDeath");
            if (num > 0)
                props += "When killed, causes a toxic field that does (" + ((5 + 5 * num) / 100.0) + " * mlevel_damage) damage in a 10m radius for 5 seconds<br />";

            return props;
        }
コード例 #3
0
ファイル: Items.cs プロジェクト: khadoran/reanimator
        private string GetDefence(DataRow item, Unit unit)
        {
            //looks like armor and shields can round either way (not sure about sfx atk/def and stuff)
            int level = (int)unit.GetStat("level");// = !string.IsNullOrEmpty(item["fixedLevel"].ToString()) ?  Int32.Parse(item["fixedLevel"].ToString().Replace(";", "")) : (int)item["level"];
            var strings = new List<string>();

            var armor = (int) item["armor"];
            var buffer = (int) Manager.GetDataTable("ITEM_LEVELS").Rows[level]["armor"];
            object bonus;
            if (unit.GetStat("armor_bonus") is int)
                bonus = 0;
            else
                bonus = ((Dictionary<string, object>) unit.GetStat("armor_bonus"))["all"];
            if (bonus is Evaluator.Range)
            {
                armor = (int)Math.Round(armor * buffer / 100.0);
                Evaluator.Range range = (Evaluator.Range) bonus + armor;
                if (range.ToString() != "0") strings.Add(GetImage("armor.png", _height) + " Armor: " + range);
            }
            else
            {
                armor = (int)Math.Round(armor * buffer / 100.0);
                if (bonus.ToString() != "0") armor += Convert.ToInt32(bonus);
                if (armor.ToString() != "0") strings.Add(GetImage("armor.png", _height) + " Armor: " + armor);
            }

            var shields = (int)item["shields"];
            buffer = (int)Manager.GetDataTable("ITEM_LEVELS").Rows[level]["shields"];
            bonus = unit.GetStat("shields_bonus");
            if (bonus is Evaluator.Range)
            {
                shields = (int)Math.Round(shields * buffer / 100.0);
                Evaluator.Range range = (Evaluator.Range)bonus + shields;
                if (range.ToString() != "0") strings.Add(GetImage("shields.png", _height) + " Shields: " + range);
            }
            else
            {
                shields = (int)Math.Round(shields * buffer / 100.0);
                if (bonus.ToString() != "0") shields += Convert.ToInt32(bonus);
                if (shields.ToString() != "0") strings.Add(GetImage("shields.png", _height) + " Shields: " + shields);
            }

            return ConcatStrings(strings);
        }
コード例 #4
0
ファイル: Items.cs プロジェクト: khadoran/reanimator
        private string GetDamage(DataRow item,Unit unit)
        {
            if (string.IsNullOrEmpty(item["minBaseDmg"].ToString())) return string.Empty;

            //var unit = new Item();
            var evaluator = new Evaluator { Unit = unit, Manager = Manager, Game3 = new Game3() };
            //var level = !string.IsNullOrEmpty(item["fixedLevel"].ToString()) ? Int32.Parse(item["fixedLevel"].ToString().Replace(";", "")) : (int)item["level"];
            //if (item["itemQuality"].ToString() == "12") level = 63; //manually correct mythic (although it seems to use a different ilvl anyway)
            var dmgMin = Int32.Parse(item["minBaseDmg"].ToString().Replace(";", ""));
            var dmgMax = Int32.Parse(item["maxBaseDmg"].ToString().Replace(";", ""));
            var dmgIncrement = (int) item["dmgIncrement"];
            var radialIncrement = (int) item["radialDmgIncrement"];
            var fieldIncrement = (int) item["fieldDmgIncrement"];
            //var dotIncrement = (int) item["dotDmgIncrement"]; // doesnt seem to be used
            //custom stuff for beam and hive damage (temporary until the type stuff is redone)
            //beam - direct damage of any element, or HARP
            bool isBeam = item["unitType_string"].ToString().Contains("beam") || item["unitType_string"].ToString().Contains("harp");
            //hive - any hive/funky bug thing weapon, used for eel (direct) and swarm (splash, never used)
            bool isHive = item["unitType_string"].ToString().Contains("hive") || item["unitType_string"].ToString().Contains("cabalist_bug2h_achiev");
            unit.SetStat("isBeam", isBeam ? 1 : 0);
            unit.SetStat("isHive", isHive ? 1 : 0);

            unit.SetStat("damage_min", dmgMin);
            unit.SetStat("damage_max", dmgMax);
            //unit.SetStat("level", level);
            unit.SetStat("dmg_increment", dmgIncrement);
            unit.SetStat("radial_increment", radialIncrement);
            unit.SetStat("field_increment", fieldIncrement);

            var scripts = item["props1"].ToString() + item["props2"] + item["props3"] + item["props4"] + item["props5"];
            evaluator.Evaluate(scripts);

            var builder = new StringBuilder();

            var values = unit.GetStat("dmg_fire");
            if (!(values is int))
            {
                string fireDmg;
                if (isBeam)
                    fireDmg = FormatBeamDmg((Dictionary<string, object>)values, "Fire");
                else
                    fireDmg = FormatDirectDmg((Dictionary<string, object>)values, "Fire");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dmg_spec");
            if (!(values is int))
            {
                string fireDmg;
                if (isBeam)
                    fireDmg = FormatBeamDmg((Dictionary<string, object>)values, "Spectral");
                else
                    fireDmg = FormatDirectDmg((Dictionary<string, object>)values, "Spectral");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dmg_phys");
            if (!(values is int))
            {
                string fireDmg;
                if (isBeam)
                    fireDmg = FormatBeamDmg((Dictionary<string, object>)values, "Physical");
                else
                    fireDmg = FormatDirectDmg((Dictionary<string, object>)values, "Physical");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dmg_toxic");
            if (!(values is int))
            {
                string fireDmg;
                if (isBeam)
                    fireDmg = FormatBeamDmg((Dictionary<string, object>)values, "Toxic");
                else
                    fireDmg = FormatDirectDmg((Dictionary<string, object>)values, "Toxic");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dmg_elec");
            if (!(values is int))
            {
                string fireDmg;
                if (isBeam)
                    fireDmg = FormatBeamDmg((Dictionary<string, object>)values, "Electricity");
                else if (isHive)
                    fireDmg = FormatEelDmg((Dictionary<string, object>)values, "Electricity");  //item display says it uses splash, but IT LIES
                else
                    fireDmg = FormatDirectDmg((Dictionary<string, object>)values, "Electricity");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("rad_fire");
            if (!(values is int))
            {
                var fireDmg = FormatSplashDmg((Dictionary<string, object>)values, "Fire");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("rad_spec");
            if (!(values is int))
            {
                var fireDmg = FormatSplashDmg((Dictionary<string, object>)values, "Spectral");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("rad_phys");
            if (!(values is int))
            {
                var fireDmg = FormatSplashDmg((Dictionary<string, object>)values, "Physical");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("rad_toxic");
            if (!(values is int))
            {
                string fireDmg;
                if (isHive)
                    fireDmg = FormatSwarmDmg((Dictionary<string, object>)values, "Toxic");
                else
                    fireDmg = FormatSplashDmg((Dictionary<string, object>)values, "Toxic");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("rad_elec");
            if (!(values is int))
            {
                string fireDmg;
                //if (isHive)
                    //fireDmg = FormatEelDmg((Dictionary<string, object>)values, "Electricity");
                //else
                    fireDmg = FormatSplashDmg((Dictionary<string, object>)values, "Electricity");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("field_fire");
            if (!(values is int))
            {
                var fireDmg = FormatFieldDmg((Dictionary<string, object>)values, "Fire");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("field_spec");
            if (!(values is int))
            {
                var fireDmg = FormatFieldDmg((Dictionary<string, object>)values, "Spectral");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("field_phys");
            if (!(values is int))
            {
                var fireDmg = FormatFieldDmg((Dictionary<string, object>)values, "Physical");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("field_toxic");
            if (!(values is int))
            {
                var fireDmg = FormatFieldDmg((Dictionary<string, object>)values, "Toxic");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("field_elec");
            if (!(values is int))
            {
                var fireDmg = FormatFieldDmg((Dictionary<string, object>)values, "Electricity");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dot_fire");
            if (!(values is int))
            {
                var fireDmg = FormatDotDmg((Dictionary<string, object>)values, "Fire");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dot_spec");
            if (!(values is int))
            {
                var fireDmg = FormatDotDmg((Dictionary<string, object>)values, "Spectral");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dot_phys");
            if (!(values is int))
            {
                var fireDmg = FormatDotDmg((Dictionary<string, object>)values, "Physical");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dot_toxic");
            if (!(values is int))
            {
                var fireDmg = FormatDotDmg((Dictionary<string, object>)values, "Toxic");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("dot_elec");
            if (!(values is int))
            {
                var fireDmg = FormatDotDmg((Dictionary<string, object>)values, "Electricity");
                builder.Append(fireDmg);
            }

            values = unit.GetStat("rad_toxic_hive");
            if (!(values is int))
            {
                var fireDmg = FormatSwarmDmg((Dictionary<string, object>)values, "Toxic");
                builder.Append(fireDmg);
            }

            //if there's no damage to display, it must be a focus item that has power damage
            if (builder.Length == 0)
            {
                DataRow lvlRow = Manager.GetDataTable("ITEM_LEVELS").Rows[(int)unit.GetStat("level")];
                builder.Append(string.Format("'''Power''': {0}-{1}",
                    (int)(dmgMin / 100.0 * (int)lvlRow["baseDamageMultiplyer"]),
                    (int)(dmgMax / 100.0 * (int)lvlRow["baseDamageMultiplyer"])
                    ));
            }

            return builder.ToString();
        }
コード例 #5
0
ファイル: Items.cs プロジェクト: khadoran/reanimator
        private IList<string> GetAffixes(DataRow item, Unit unit)
        {
            var evaluator = new Evaluator {Unit = unit, Manager = Manager, Game3 = new Game3()};
            var table = Manager.GetDataTable("AFFIXES");
            var affixes = item["affix"].ToString();

            //var level = !string.IsNullOrEmpty(item["fixedLevel"].ToString()) ?  Int32.Parse(item["fixedLevel"].ToString().Replace(";", "")) : (int)item["level"];
            //if (level == 0) level = 55;
            //evaluator.Unit.SetStat("level", level);

            string[] split = affixes.Split(',');
            foreach (var i in split)
            {
                var affix = int.Parse(i);
                if (affix == -1) break; // no more affixes
                var script = table.Rows[affix]["property1"].ToString();
                script += table.Rows[affix]["property2"].ToString();
                script += table.Rows[affix]["property3"].ToString();
                script += table.Rows[affix]["property4"].ToString();
                script += table.Rows[affix]["property5"].ToString();
                script += table.Rows[affix]["property6"].ToString();
                script = RemoveLevelSetters(script);
                if (String.IsNullOrEmpty(script)) continue; // no affix script
                evaluator.Evaluate(script);
            }

            return ItemDisplay.GetDisplayStrings(evaluator.Unit);
        }
コード例 #6
0
ファイル: Items.cs プロジェクト: khadoran/reanimator
        private IList<string> GetInherentAffixes(DataRow item, Unit baseUnit)
        {
            Unit unit = new Item();
            unit.SetStat("level", baseUnit.GetStat("level"));   //copy the level into a new unit so it won't re-display everything
            var evaluator = new Evaluator { Unit = unit, Manager = Manager, Game3 = new Game3() };
            var scripts = item["props1"].ToString() + item["props2"] + item["props3"] + item["props4"] + item["props5"];

            //it might be hidden but it's a fraction that's likely rounded to 0, so it's not worth displaying
            scripts = scripts.Replace("SetStat673('hp_regen', 1);", "").Replace("SetStat673('power_regen', 1);", "");
            //also get rid of any explicit level-setting
            scripts = RemoveLevelSetters(scripts);

            //var level = !string.IsNullOrEmpty(item["fixedLevel"].ToString()) ?  Int32.Parse(item["fixedLevel"].ToString().Replace(";", "")) : (int)item["level"];
            //evaluator.Unit.SetStat("level", level);

            evaluator.Evaluate(scripts);
            return ItemDisplay.GetDisplayStrings(evaluator.Unit);
        }
コード例 #7
0
ファイル: Items.cs プロジェクト: khadoran/reanimator
        private string GetFeeds(int itemid, Unit unit)
        {
            //Unit unit = new Item();
            var evaluator = new Evaluator { Unit = unit, Manager = Manager };
            var item = Manager.GetDataTable("ITEMS").Rows[itemid];
            var table = Manager.GetDataTable("AFFIXES");
            var affixes = item["affix"].ToString();
            var scripts = item["perLevelProps1"].ToString();
            scripts += item["perLevelProps2"].ToString();

            //var level = !string.IsNullOrEmpty(item["fixedLevel"].ToString()) ?  Int32.Parse(item["fixedLevel"].ToString().Replace(";", "")) : (int)item["level"];
            //evaluator.Unit.SetStat("level", level);

            string[] split = affixes.Split(',');
            foreach (var i in split)
            {
                var affix = int.Parse(i);
                if (affix == -1) break; // no more affixes
                var script = table.Rows[affix]["property1"].ToString();
                script += table.Rows[affix]["property2"].ToString();
                script += table.Rows[affix]["property3"].ToString();
                script += table.Rows[affix]["property4"].ToString();
                script += table.Rows[affix]["property5"].ToString();
                script += table.Rows[affix]["property6"].ToString();
                script = RemoveLevelSetters(script);
                if (String.IsNullOrEmpty(script)) continue; // no affix script
                evaluator.Evaluate(script);
            }

            if (scripts != string.Empty) evaluator.Evaluate(scripts);

            var strings = new List<string>();

            string feed = string.Empty;

            var accuracy = unit.GetStat("accuracy_feed");
            if ((accuracy is double && (double)accuracy != 0)
                || accuracy is string || accuracy is Evaluator.Range)
            {
                feed = ItemDisplay.FormatFeed(accuracy);
                strings.Add(feed + " Acc");
            }

            var strength = unit.GetStat("strength_feed");
            if ((strength is double && (double)strength != 0)
                || strength is string || strength is Evaluator.Range)
            {
                feed = ItemDisplay.FormatFeed(strength);
                strings.Add(feed + " Str");
            }

            var stamina = unit.GetStat("stamina_feed");
            if ((stamina is double && (double)stamina != 0)
                || stamina is string || stamina is Evaluator.Range)
            {
                feed = ItemDisplay.FormatFeed(stamina);
                strings.Add(feed + " Stam");
            }

            var willpower = unit.GetStat("willpower_feed");
            if ((willpower is double && (double)willpower != 0)
                || willpower is string || willpower is Evaluator.Range)
            {
                feed = ItemDisplay.FormatFeed(willpower);
                strings.Add(feed + " Will");
            }

            if (strings.Count == 0) return string.Empty;
            return "<div class=\"simple_line\"></div><div class=\"item_feed\">" + GetCSVString(strings) + "</div>";
        }
コード例 #8
0
ファイル: ItemDisplay.cs プロジェクト: khadoran/reanimator
        public static string[] GetFeedCosts(Unit unit)
        {
            var strings = new List<string>();

            string feed = string.Empty;

            var accuracy = unit.GetStat("accuracy_feed");
            if ((accuracy is double && (double)accuracy != 0)
                || accuracy is string || accuracy is Evaluator.Range)
            {
                feed = FormatFeed(accuracy);
                strings.Add(feed + " Acc");
            }

            var strength = unit.GetStat("strength_feed");
            if ((strength is double && (double)strength != 0)
                || strength is string || strength is Evaluator.Range)
            {
                feed = FormatFeed(strength);
                strings.Add(feed + " Str");
            }

            var stamina = unit.GetStat("stamina_feed");
            if ((stamina is double && (double)stamina != 0)
                || stamina is string || stamina is Evaluator.Range)
            {
                feed = FormatFeed(stamina);
                strings.Add(feed + " Stam");
            }

            var willpower = unit.GetStat("willpower_feed");
            if ((willpower is double && (double)willpower != 0)
                || willpower is string || willpower is Evaluator.Range)
            {
                feed = FormatFeed(willpower);
                strings.Add(feed + " Will");
            }

            return strings.ToArray();
        }
コード例 #9
0
ファイル: ItemDisplay.cs プロジェクト: khadoran/reanimator
        internal static string[] GetModSlots(Unit unit)
        {
            var strings = new List<string>();
            var itemSlots = unit.GetStat("item_slots");
            if (itemSlots is int) return strings.ToArray();

            foreach (var slot in (Dictionary<string, object>) itemSlots)
            {
                switch (slot.Key)
                {
                    case "fuel":
                        strings.Add(WikiScript.GetImage("fuel", 15) + " " + slot.Value);
                        break;
                    case "relic":
                        strings.Add(WikiScript.GetImage("relic", 15) + " " + slot.Value);
                        break;
                    case "tech":
                        strings.Add(WikiScript.GetImage("tech", 15) + " " + slot.Value);
                        break;
                    case "battery":
                        strings.Add(WikiScript.GetImage("battery", 15) + " " + slot.Value);
                        break;
                    case "ammo":
                        strings.Add(WikiScript.GetImage("ammo", 15) + " " + slot.Value);
                        break;
                    case "rockets":
                        strings.Add(WikiScript.GetImage("rocket", 15) + " " + slot.Value);
                        break;
                    default:
                        throw new Exception("Unknown mod slot: " + slot.Key);
                }
            }
            return strings.ToArray();
        }
コード例 #10
0
ファイル: ItemDisplay.cs プロジェクト: khadoran/reanimator
 public static string GetSkillBonus(Unit unit)
 {
     string bonus = unit.GetStat("skill_bonus").ToString();
     if (String.Compare(bonus, "0") == 0)
         return string.Empty;
     return bonus;
 }