示例#1
0
        internal static string CalculateModName(ModDefinition mod)
        {
            var modName = mod.DisplayName ?? mod.Name;

            if (mod.UseAcronym)
            {
                modName = Regex.Replace(modName, "[a-z]", "");
            }

            return(CalculateModName(modName));
        }
示例#2
0
        internal static string CalculateModName(ModDefinition mod, ModDefinition submod)
        {
            if (submod == null || !mod.HasSubMods && !mod.Expansion)
            {
                return(CalculateModName(mod));
            }

            var modName = "";

            if (mod.SubModsUseThisName)
            {
                modName = $"{CalculateModName(mod)} ";
            }

            return($"{modName}{CalculateModName(submod)}");
        }
示例#3
0
        private void InitConfigs(ConfigNode cfg)
        {
            StockMessage     = cfg.GetNode("Message").GetValue("stock");
            SubModMessage    = cfg.GetNode("Message").GetValue("submod");
            ModMessage       = cfg.GetNode("Message").GetValue("mod");
            ExpansionMessage = cfg.GetNode("Message").GetValue("expansion");

            Mods = new List <ModDefinition>();
            foreach (var c in cfg.GetNodes("Mod"))
            {
                var mod = new ModDefinition
                {
                    Name               = c.GetValue("name"),
                    DisplayName        = c.GetValue("displayName"),
                    UseAcronym         = bool.Parse(c.GetValue("useAcronym") ?? "false"),
                    HasSubMods         = bool.Parse(c.GetValue("hasSubMods") ?? "false"),
                    SubModsUseThisName = bool.Parse(c.GetValue("subModsUseThisName") ?? "false"),
                    Expansion          = bool.Parse(c.GetValue("expansion") ?? "false"),
                    Stock              = bool.Parse(c.GetValue("stock") ?? "false")
                };

                Mods.Add(mod);
            }
        }