示例#1
0
        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;
        }
示例#2
0
        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);
        }
示例#3
0
        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);
            }
        }