示例#1
0
        public AppSettings(string dir)
        {
            XElement e = XElement.Parse(Utils.Read(dir));

            Xml = e;
            UseExternalPayments = e.GetValue <int>("UseExternalPayments");
            MaxStackablePotions = e.GetValue <int>("MaxStackablePotions");

            var newAccounts = e.Element("NewAccounts");

            NewAccounts = new NewAccounts(e.Element("NewAccounts"));
            newAccounts.Remove(); // don't export with /app/init

            var newCharacters = e.Element("NewCharacters");

            NewCharacters = new NewCharacters(e.Element("NewCharacters"));
            newCharacters.Remove();
        }
示例#2
0
        public AppSettings(string path)
        {
            log.Info("Loading app settings...");

            elem = XElement.Parse(File.ReadAllText(path));

            MenuMusic                  = GetStringValue("MenuMusic");
            DeadMusic                  = GetStringValue("DeadMusic");
            MapMinRank                 = GetIntValue("MapMinRank");
            SpriteMinRank              = GetIntValue("SpriteMinRank");
            CharacterSlotCost          = GetIntValue("CharacterSlotCost");
            CharacterSlotCurrency      = GetIntValue("CharacterSlotCurrency");
            VaultChestCost             = GetIntValue("VaultChestCost");
            MaxStackablePotions        = GetIntValue("MaxStackablePotions");
            PotionPurchaseCooldown     = GetIntValue("PotionPurchaseCooldown");
            PotionPurchaseCostCooldown = GetIntValue("PotionPurchaseCostCooldown");
            DisableRegistration        = GetBoolValue("DisableRegist");
            MysteryBoxRefresh          = GetIntValue("MysteryBoxRefresh");
            MaxPetCount                = GetIntValue("MaxPetCount");
            Accounts   = new NewAccounts(elem.Element("NewAccounts"));
            Characters = new NewCharacters(elem.Element("NewCharacters"));

            InventorySize = GetIntValue("InventorySize");
            if (InventorySize == 0)
            {
                InventorySize = 20;
            }

            if (Exists("PotionPurchaseCosts"))
            {
                var potCosts    = elem.Element("PotionPurchaseCosts");
                var potCostList = new List <int>();
                foreach (var e in potCosts.XPathSelectElements("//cost"))
                {
                    int cost = 0;
                    int.TryParse(e.Value, out cost);
                    potCostList.Add(cost);
                }
                PotionPurchaseCosts = potCostList.ToArray();
            }
        }