コード例 #1
0
        private static void AddSkillModifier(List <string> modifiers, KeyValuePair <string, List <string> > stat)
        {
            var match = Regex.Match(stat.Key, "augmentSkillName[0-9]+");

            if (match.Success && stat.Value != null && stat.Value.Count > 0)
            {
                ItemRaw augmentSkill = ItemCache.Instance.GetItem(stat.Value.First());

                string skillName = null;
                if (augmentSkill.StringParametersRaw.ContainsKey("skillDisplayName"))
                {
                    skillName = augmentSkill.StringParametersRaw["skillDisplayName"];
                }
                else if (augmentSkill.StringParametersRaw.ContainsKey("buffSkillName"))
                {
                    ItemRaw actualSkill = ItemCache.Instance.GetItem(augmentSkill.StringParametersRaw["buffSkillName"]);
                    skillName = actualSkill.StringParametersRaw["skillDisplayName"];
                }

                if (skillName == null)
                {
                    return;
                }

                var s = StringsCache.Instance.GetString(skillName);
                if (s != null)
                {
                    modifiers.Add("+ to " + s);
                }
            }
        }
コード例 #2
0
        //"Cheat sheet" for item parameters:
        //offensiveAetherGlobal: Damage type Aether is given a chance to be afflicted among other global damage types. For instance - prismatic eviscerator: "10% chance of: X, Y or Z" (where X, Y or Z are all global)
        //offensiveAetherChance: Chance component of flat damage(?)
        //offensiveAetherMin X/offensiveAetherMax Y: flat damage (between X and Y)
        //offensiveAetherModifier X: +X% to Aether damage
        //offensiveAetherModifierChance Y: Y% chance of +X% to Aether damage
        //offensiveAetherXOR: Who knows??
        public static List <string> GetStats(Item item, ItemRaw itemDef)
        {
            var combinedStats            = GetCombinedNumericalParameters(item, itemDef);
            var combinedStringParameters = GetCombinedStringParameters(item, itemDef);

            return(GetStatsCore(combinedStats, combinedStringParameters));
        }
コード例 #3
0
        //Returns the item definition that is used for stats (relevant in case of blueprints, where the item itself doesn't have stats, but the crafted item does)
        public static string GetItemStatSource(ItemRaw itemDef)
        {
            if (GetItemType(itemDef) == "ItemArtifactFormula" && itemDef.StringParametersRaw.ContainsKey("artifactName"))
            {
                return(itemDef.StringParametersRaw["artifactName"]);
            }

            return(null);
        }
コード例 #4
0
        private static string GetItemUpgradeLevel(ItemRaw itemDef)
        {
            if (itemDef.StringParametersRaw.ContainsKey("itemStyleTag") && !string.IsNullOrEmpty(itemDef.StringParametersRaw["itemStyleTag"]))
            {
                return(StringsCache.Instance.GetString(itemDef.StringParametersRaw["itemStyleTag"]));
            }

            return(null);
        }
コード例 #5
0
        public static string GetItemType(ItemRaw itemDef)
        {
            if (itemDef.StringParametersRaw.ContainsKey("Class"))
            {
                return(itemDef.StringParametersRaw["Class"]);
            }

            return(null);
        }
コード例 #6
0
        private static string GetAffixName(ItemRaw itemDef)
        {
            if (!itemDef.StringParametersRaw.ContainsKey("lootRandomizerName"))
            {
                return(null);
            }

            var tagName = itemDef.StringParametersRaw["lootRandomizerName"];

            return(StringsCache.Instance.GetString(tagName));
        }
コード例 #7
0
        private static void AddMasteryModifier(List <string> modifiers, KeyValuePair <string, List <string> > stat)
        {
            var match = Regex.Match(stat.Key, "augmentMasteryName[0-9]+");

            if (match.Success && stat.Value != null && stat.Value.Count > 0)
            {
                ItemRaw augmentMastery = ItemCache.Instance.GetItem(stat.Value.First());

                var s = StringsCache.Instance.GetString(augmentMastery.StringParametersRaw["skillDisplayName"]);
                if (s != null)
                {
                    modifiers.Add("+ to all skills in " + s);
                }
            }
        }
コード例 #8
0
        private static bool IsComponentBlueprint(ItemRaw itemDef)
        {
            if (GetItemType(itemDef) != "ItemArtifactFormula")
            {
                return(false);
            }

            var targetItem = ItemCache.Instance.GetItem(itemDef.StringParametersRaw["artifactName"]);

            if (targetItem == null)
            {
                return(false);
            }

            return(targetItem.StringParametersRaw["Class"] == "ItemRelic");
        }
コード例 #9
0
        public static string GetItemRarity(ItemRaw itemDef)
        {
            string rarity = null;

            if (itemDef.StringParametersRaw.ContainsKey("itemClassification"))
            {
                rarity = itemDef.StringParametersRaw["itemClassification"];
            }

            if (IsComponentBlueprint(itemDef))
            {
                rarity = "Component Blueprint";
            }

            return(rarity);
        }
コード例 #10
0
        private static string GetItemBasename(Item item, ItemRaw itemDef)
        {
            if (itemDef.StringParametersRaw.ContainsKey("itemNameTag"))
            {
                return(StringsCache.Instance.GetString(itemDef.StringParametersRaw["itemNameTag"]));
            }

            if (itemDef.StringParametersRaw["Class"] != "ItemRelic" && itemDef.StringParametersRaw.ContainsKey("FileDescription"))
            {
                return(itemDef.StringParametersRaw["FileDescription"]);
            }

            if (itemDef.StringParametersRaw.ContainsKey("description"))
            {
                return(StringsCache.Instance.GetString(itemDef.StringParametersRaw["description"]));
            }

            return("");
        }
コード例 #11
0
ファイル: ItemCache.cs プロジェクト: hallgeirl/gd-item-search
        private void PopulateAllItems(string path, Action <string> stateChangeCallback)
        {
            var itemsDirs = new string[] {
                Path.Combine(path, "records", "items"),
                Path.Combine(path, "records", "skills"),
                Path.Combine(path, "records", "storyelements"),
                Path.Combine(path, "records", "storyelementsgdx2"),
                Path.Combine(path, "records", "endlessdungeon", "items")
            };

            int i = 0;

            foreach (var itemsDir in itemsDirs)
            {
                if (!Directory.Exists(itemsDir))
                {
                    continue;
                }

                foreach (var f in Directory.EnumerateFiles(itemsDir, "*.dbr", SearchOption.AllDirectories))
                {
                    if (++i % 1000 == 0)
                    {
                        stateChangeCallback("Read item #" + i);
                    }

                    var relativePath = f.Replace(path, "").Trim('\\').Trim('/').Replace('\\', '/');
                    var item         = new ItemRaw();
                    item.Read(f);

                    _cache.Items[relativePath] = item;
                }
            }

            stateChangeCallback("Read item " + i + " of " + i);
        }
コード例 #12
0
        public static string GetFullItemName(Item item, ItemRaw itemDef)
        {
            string baseName = GetItemBasename(item, itemDef);

            var upgradeLevel = GetItemUpgradeLevel(itemDef);

            List <string> nameComponents = new List <string>();

            nameComponents.Add(upgradeLevel);

            if (!itemDef.NumericalParametersRaw.ContainsKey("hidePrefixName") || itemDef.NumericalParametersRaw["hidePrefixName"] != 0)
            {
                AddAffixNameToNameComponents(item.prefixName, nameComponents);
            }

            nameComponents.Add(baseName);

            if (!itemDef.NumericalParametersRaw.ContainsKey("hideSuffixName") || itemDef.NumericalParametersRaw["hideSuffixName"] != 0)
            {
                AddAffixNameToNameComponents(item.suffixName, nameComponents);
            }

            return(string.Join(" ", nameComponents.Where(x => x != null)));
        }
コード例 #13
0
        /// <summary>
        /// Returns all numerical stat parameters, combining the item's and affixes.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="itemDef"></param>
        /// <returns></returns>
        private static Dictionary <string, List <string> > GetCombinedStringParameters(Item item, ItemRaw itemDef)
        {
            Dictionary <string, List <string> > combinedStats = new Dictionary <string, List <string> >();

            foreach (var s in itemDef.StringParametersRaw)
            {
                combinedStats.Add(s.Key, new List <string>()
                {
                    s.Value
                });
            }

            if (!string.IsNullOrEmpty(item.prefixName))
            {
                AddStringStatsFromItemOrSuffix(item.prefixName, combinedStats);
            }

            if (!string.IsNullOrEmpty(item.suffixName))
            {
                AddStringStatsFromItemOrSuffix(item.suffixName, combinedStats);
            }

            return(combinedStats);
        }