Esempio n. 1
0
 private void ReinstallCardProducts()
 {
     int index = 1;
     foreach (var monsterConfig in ConfigData.MonsterDict.Values)
     {
         if (monsterConfig.IsSpecial > 0)
             continue;
         Monster mon = new Monster(monsterConfig.Id);
         int rate = GetSellRate(monsterConfig.Id);
         CardProductMarkTypes mark = CardProductMarkTypes.Null;
         if (monsterConfig.IsNew > 0)
         {
             rate = 100;
             mark = CardProductMarkTypes.New;
         }
         if (MathTool.GetRandom(100) < rate)
         {
             if (mark == 0)
             {
                 mark = mon.GetSellMark();
             }
             CardProducts.Add(new CardProduct(index++, mon.Id, (int)mark));
         }
     }
     foreach (var weaponConfig in ConfigData.WeaponDict.Values)
     {
         if (weaponConfig.IsSpecial > 0)
             continue;
         Weapon wpn = new Weapon(weaponConfig.Id);
         int rate = GetSellRate(weaponConfig.Id);
         CardProductMarkTypes mark = CardProductMarkTypes.Null;
         if (weaponConfig.IsNew > 0)
         {
             rate = 100;
             mark = CardProductMarkTypes.New;
         }
         if (MathTool.GetRandom(100) < rate)
         {
             if (mark == 0)
             {
                 mark = wpn.GetSellMark();
             }
             CardProducts.Add(new CardProduct(index++, wpn.Id, (int)mark));
         }
     }
     foreach (var spellConfig in ConfigData.SpellDict.Values)
     {
         if (spellConfig.IsSpecial > 0)
             continue;
         Spell spl = new Spell(spellConfig.Id);
         int rate = GetSellRate(spellConfig.Id);
         CardProductMarkTypes mark = CardProductMarkTypes.Null;
         if (spellConfig.IsNew > 0)
         {
             rate = 100;
             mark = CardProductMarkTypes.New;
         }
         if (MathTool.GetRandom(100) < rate)
         {
             if (mark == 0)
             {
                 mark = spl.GetSellMark();
             }
             CardProducts.Add(new CardProduct(index++, spl.Id, (int)mark));
         }
     }
 }