当前位置: 首页>>代码示例>>C#>>正文


C# ConfigCacheSet.GetRandomGold方法代码示例

本文整理汇总了C#中ConfigCacheSet.GetRandomGold方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigCacheSet.GetRandomGold方法的具体用法?C# ConfigCacheSet.GetRandomGold怎么用?C# ConfigCacheSet.GetRandomGold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigCacheSet的用法示例。


在下文中一共展示了ConfigCacheSet.GetRandomGold方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoPlotSweepPrize

        /// <summary>
        /// 副本扫荡奖励
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="plotID"></param>
        /// <param name="turnsNum"></param>
        /// <param name="battleNum"></param>
        /// <param name="npcCount"></param>
        internal static void DoPlotSweepPrize(string userID, int plotID, int turnsNum, int battleNum, int npcCount)
        {
            GameUser user = new GameDataCacheSet<GameUser>().FindKey(userID);
            if (user == null)
            {
                return;
            }

            int experience = 0;
            var npcList = new ConfigCacheSet<PlotNPCInfo>().FindAll(m => m.PlotID == plotID && m.NpcSeqNo == battleNum);
            if (npcList.Count == 0) return;
            PlotNPCInfo npcInfo = npcList[0];
            experience += npcInfo.Experience;
            var cacheSet = new GameDataCacheSet<UserSweepPool>();
            UserSweepPool sweepPool = cacheSet.FindKey(userID, turnsNum, battleNum);
            if (sweepPool == null)
            {
                sweepPool = new UserSweepPool
                {
                    UserID = userID,
                    CreateDate = DateTime.Now
                };
            }
            sweepPool.PlotID = plotID;
            sweepPool.TurnsNum = turnsNum;
            sweepPool.BattleNum = battleNum;
            sweepPool.Experience = npcInfo.Experience;
            sweepPool.ExpNum = npcInfo.ExpNum;
            sweepPool.GameCoin = npcInfo.GameCoin;
            sweepPool.Gold = npcInfo.GetRandomGold();
            sweepPool.PrizeItems = GetPlotMonsterItems(userID, npcInfo.PlotNpcID);
            sweepPool.IsSend = false;
            if (cacheSet.FindKey(userID, turnsNum, battleNum) == null)
            {
                cacheSet.Add(sweepPool, GameEnvironment.CacheUserPeriod);
            }
            //else
            //{
            //    sweepPool.Update();
            //}

            user.ExpNum = MathUtils.Addition(user.ExpNum, sweepPool.ExpNum, int.MaxValue);
            user.GameCoin = MathUtils.Addition(user.GameCoin, sweepPool.GameCoin + sweepPool.BlessPennyNum, int.MaxValue);
            user.ItemGold = MathUtils.Addition(user.ItemGold, sweepPool.Gold, int.MaxValue);

            if (battleNum == npcCount)
            {
                PlotInfo plotInfo = new ConfigCacheSet<PlotInfo>().FindKey(plotID);

                experience += plotInfo.Experience;
                //通关奖励
                int tempNum = 10;
                //var cacheSet = new GameDataCacheSet<UserSweepPool>();
                if (cacheSet.FindKey(userID, turnsNum, tempNum) == null)
                {
                    sweepPool = new UserSweepPool
                                    {
                                        UserID = userID,
                                        CreateDate = DateTime.Now
                                    };
                }
                sweepPool.PlotID = plotID;
                sweepPool.TurnsNum = turnsNum;
                sweepPool.BattleNum = tempNum;
                sweepPool.Experience = plotInfo.Experience;
                sweepPool.ExpNum = plotInfo.ExpNum;
                sweepPool.GameCoin = plotInfo.GameCoin;
                sweepPool.Gold = plotInfo.GetRandomGold();
                sweepPool.PrizeItems = GetPrizeItems(userID, plotInfo.ItemProbability, plotInfo.ItemRank, plotInfo.PlotID, null);
                sweepPool.IsSend = false;

                //祝福加金币

                if (UserHelper.GainBlessing(user, 0) > 0)
                {
                    UserHelper.GainBlessing(user, 1);
                    sweepPool.BlessPennyNum = (int)Math.Floor(plotInfo.GameCoin * new GuildMember().BlessingCionPercent);
                }
                if (!string.IsNullOrEmpty(user.MercenariesID))
                {
                    //公会技能加成
                    sweepPool.Experience = MathUtils.RoundCustom(sweepPool.Experience * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.Experience)).ToInt();
                    sweepPool.ExpNum = MathUtils.RoundCustom(sweepPool.ExpNum * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.ExpNum)).ToInt();
                    sweepPool.GameCoin = MathUtils.RoundCustom(sweepPool.GameCoin * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.CoinNum)).ToInt();
                }
                if (cacheSet.FindKey(userID, turnsNum, tempNum) == null)
                {
                    cacheSet.Add(sweepPool, GameEnvironment.CacheUserPeriod);
                }

                user.ExpNum = MathUtils.Addition(user.ExpNum, sweepPool.ExpNum, int.MaxValue);
                user.GameCoin = MathUtils.Addition(user.GameCoin, sweepPool.GameCoin, int.MaxValue);
//.........这里部分代码省略.........
开发者ID:0jpq0,项目名称:Scut,代码行数:101,代码来源:PlotHelper.cs

示例2: DoPlotPrize


//.........这里部分代码省略.........
                                        userPlot.PennyNum = plotInfo.GameCoin;
                                    }
                                }
                                else
                                {
                                    userPlot.ExpNum = (int)(plotInfo.ExpNum * 2);
                                    userPlot.PennyNum = (int)(plotInfo.GameCoin * 2);
                                }
                            }
                            else
                            {
                                userPlot.ExpNum = plotInfo.ExpNum;
                                userPlot.PennyNum = plotInfo.GameCoin;
                            }
                            honourNum = honourNum * starScore;
                        }
                        else
                        {
                            userPlot.ExpNum = plotInfo.ExpNum;
                            userPlot.PennyNum = plotInfo.GameCoin;
                        }
                        userPlot.HonourNum = honourNum;
                        GeneralEscalateHelper.AddUserLv(user, honourNum);
                    }
                    else
                    {
                        PlotFailureType plotFailureType;
                        GetFailure(npcGeneralNum, out plotFailureType);
                        userPlot.PlotFailureType = plotFailureType;

                    }

                    // userPlot.ExpNum = plotInfo.ExpNum;
                    userPlot.GoldNum = plotInfo.GetRandomGold();
                    if (!string.IsNullOrEmpty(user.MercenariesID))
                    {
                        //公会技能加成
                        userPlot.Experience = MathUtils.RoundCustom(userPlot.Experience * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.Experience)).ToInt();
                        userPlot.ExpNum = MathUtils.RoundCustom(userPlot.ExpNum * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.ExpNum)).ToInt();
                        userPlot.PennyNum = MathUtils.RoundCustom(userPlot.PennyNum * CombatHelper.GetGuildAbilityNum(user.UserID, GuildAbilityType.CoinNum)).ToInt();
                    }
                    CacheList<PrizeItemInfo> itemList = new CacheList<PrizeItemInfo>();
                    string itemName = string.Empty;
                    if (plotInfo.PlotType != PlotType.Kalpa)
                    {
                        var copyList = GetPrizeItems(userID, plotInfo.ItemProbability, plotInfo.ItemRank, plotInfo.PlotID, userPlot);
                        copyList.Foreach(item =>
                        {
                            if (item.Type == 0)
                            {
                                itemList.Add(item);
                            }
                            return true;
                        });

                        if (itemList.Count > 0)
                        {
                            userPlot.ItemID = itemList[0].ItemID;
                            var item = new ConfigCacheSet<ItemBaseInfo>().FindKey(userPlot.ItemID);
                            itemName = item != null ? item.ItemName : string.Empty;
                        }
                    }
                    if (!string.IsNullOrEmpty(plotInfo.EnchantID) && plotInfo.EnchantProbability > 0)
                    {
                        var copyList = GetKalpaPrizeItems(userID, plotInfo.ItemProbability, plotInfo.ItemRank, plotInfo.PlotID, userPlot);
                        copyList.Foreach(item =>
开发者ID:0jpq0,项目名称:Scut,代码行数:67,代码来源:PlotHelper.cs


注:本文中的ConfigCacheSet.GetRandomGold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。