static public CardPieceRate FromCardPiece(int id, int clevel) { CardPieceRate pieceRate = new CardPieceRate(); HItemConfig itemConfig = ConfigData.GetHItemConfig(id); int percent = rates[itemConfig.Rare - 1]; pieceRate.ItemId = id; pieceRate.Rate = CheckBound(clevel, itemConfig, percent); return pieceRate; }
public static CardPieceRate FromCardPiece(int id, int clevel) { CardPieceRate pieceRate = new CardPieceRate(); HItemConfig itemConfig = ConfigData.GetHItemConfig(id); int percent = rates[itemConfig.Rare - 1]; pieceRate.ItemId = id; pieceRate.Rate = CheckBound(clevel, itemConfig, percent); return(pieceRate); }
private static void TryUpdateCache(int id) { if (!pieces.ContainsKey(id)) { MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(id); pieces[id] = new List <CardPieceRate>(); if (monsterConfig.DropId1 > 0) { pieces[id].Add(CardPieceRate.FromCardPiece(monsterConfig.DropId1, monsterConfig.Star)); } if (monsterConfig.DropId2 > 0) { pieces[id].Add(CardPieceRate.FromCardPiece(monsterConfig.DropId2, monsterConfig.Star)); } foreach (CardPieceRaceConfig cardPieceConfig in ConfigData.CardPieceRaceDict.Values) { if (cardPieceConfig.Race != -1 && cardPieceConfig.Race != monsterConfig.Type) { continue; } if (cardPieceConfig.Attr != -1 && cardPieceConfig.Attr != monsterConfig.Attr) { continue; } if (monsterConfig.Star >= cardPieceConfig.DropStarMin && monsterConfig.Star <= cardPieceConfig.DropStarMax) { var rate = CardPieceRate.FromCardRacePiece(cardPieceConfig.Id, monsterConfig.Star); if (rate.Rate > 0) { pieces[id].Add(rate); } } } pieces[id].Sort((a, b) => b.Rate - a.Rate); } }