public CardProductMarkTypes GetSellMark() { CardProductMarkTypes mark = CardProductMarkTypes.Null; var cardData = CardConfigManager.GetCardConfig(WeaponConfig.Id); if (cardData.Quality == CardQualityTypes.Legend) { mark = CardProductMarkTypes.Only; } else if (cardData.Quality < CardQualityTypes.Excel && MathTool.GetRandom(10) > 7) { mark = CardProductMarkTypes.Sale; } else { int roll = MathTool.GetRandom(10); if (roll == 0) { mark = CardProductMarkTypes.Hot; } else if (roll == 1) { mark = CardProductMarkTypes.Gold; } } return(mark); }
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 DbCardProduct(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 DbCardProduct(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 DbCardProduct(index++, spl.Id, (int)mark)); } } }