Пример #1
0
        /// <summary>
        /// 道具摇奖
        /// </summary>
        /// <param name="player"></param>
        /// <param name="gc"></param>
        /// <param name="p"></param>
        private static void Lottery(PlayerBusiness player, GameConfig gc, Variant p)
        {
            PlayerEx ly = player.Lottery;
            Variant ex = ly.Value;

            Variant v = gc.Value;
            Variant libao = v.GetVariantOrDefault("LiBao");
            if (libao == null)
                return;
            if (ex != null && ex.Count > 0)
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.Lottery1));
                return;
            }

            if (player.RemoveGoods(p.GetIntOrDefault("P"), GoodsSource.DoubleUse))
            {
                Variant con = new Variant();
                int n = NumberRandom.Next(0, 12);
                //抽奖

                GetLotteryAward(con, libao, n, p.GetIntOrDefault("H"));

                ly.Value = con;
                ly.Save();
                player.UseGoodsR(true, gc.ID);
                player.Call(ClientCommand.UpdateActorR, new PlayerExDetail(ly));
            }
            else
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.UseGoods2));
            }
        }
Пример #2
0
        /// <summary>
        /// 星力空瓶的使用
        /// </summary>
        /// <param name="player"></param>
        /// <param name="gc"></param>
        /// <param name="p"></param>
        private static void Bottles(PlayerBusiness player, GameConfig gc, Variant p)
        {
            Variant v = gc.Value;
            //需要星力值
            int outstar = v.GetIntOrDefault("OutStar");
            if (player.StarPower < outstar)
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.GoodsWashing6));
                return;
            }
            Dictionary<string, Variant> dic = new Dictionary<string, Variant>();
            //目标道具
            string goodsid = v.GetStringOrDefault("GoodsID");

            Variant tmp = new Variant();
            tmp.SetOrInc("Number" + p.GetIntOrDefault("H"), 1);
            dic.Add(goodsid, tmp);

            if (BurdenManager.IsFullBurden(player.B0, dic))
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.BurdenB0Full));
                return;
            }

            if (!player.AddStarPower(-outstar, FinanceType.UseGoods))
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.GoodsWashing6));
                return;
            }

            if (player.RemoveGoods(p.GetIntOrDefault("P"), GoodsSource.DoubleUse))
            {
                player.AddGoods(dic, GoodsSource.Bottles);
                player.UseGoodsR(true, goodsid);
                player.FinishNote(FinishCommand.StarBottle);
            }
            else
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.UseGoods2));
            }
        }
Пример #3
0
        /// <summary>
        /// 添加星力
        /// </summary>
        /// <param name="player"></param>
        /// <param name="gc"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        private static void FullBottle(PlayerBusiness player, GameConfig gc, Variant p)
        {
            Variant v = gc.Value;

            int addStar = v.GetIntOrDefault("AddStar");

            int max = PartAccess.Instance.PowerMax();

            Variant mv = MemberAccess.MemberInfo(player.MLevel);
            if (mv != null)
            {
                max = mv.GetIntOrDefault("StarMax");
            }

            if (player.StarPower + addStar > max)
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.StarFull));
                return;
            }
            if (player.RemoveGoods(p.GetIntOrDefault("P"), GoodsSource.DoubleUse))
            {
                player.AddStarPower(addStar, FinanceType.UseGoods);
                player.UseGoodsR(true, gc.ID);
            }
            else
            {
                player.UseGoodsR(false, TipManager.GetMessage(GoodsReturn.UseGoods2));
            }
        }