Пример #1
0
        /// <summary>
        /// 增加每日日常任务
        /// </summary>
        /// <param name="player"></param>
        /// <param name="gc"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        private static int AddDayTask(PlayerBusiness player, GameConfig gc, int p)
        {
            PlayerEx dt = player.Value["DayTask"] as PlayerEx;
            Variant v_dt = dt.Value;
            //道具
            int daily = gc.Value.GetIntOrDefault("Daily");
            int total = v_dt.GetIntOrDefault("Total");
            int max = v_dt.GetIntOrDefault("Max");

            Variant mv = MemberAccess.MemberInfo(player.MLevel);
            if (mv != null)
            {
                max += mv.GetIntOrDefault("ShiBan") * 5;
            }

            if (total >= max)
            {
                //您今天的日常任务已经扩充到上限最大值,请明天再使用探险者石板
                return GoodsReturn.UseGoods8;
            }
            if (player.RemoveGoods(p, GoodsSource.DoubleUse))
            {
                if (total + daily <= max)
                {
                    v_dt.SetOrInc("Total", daily);
                }
                else
                {
                    v_dt["Total"] = max;
                }

                //如果不存在日常任务
                if (!TaskAccess.Instance.IsDayTask(player.ID, 2))
                {
                    GameConfig gn = GameConfigAccess.Instance.GetDayTaskOne(player.Level, 2);
                    if (gn != null)
                    {
                        DayTask(player, true);
                    }
                }
                dt.Save();
                player.Call(ClientCommand.UpdateActorR, new PlayerExDetail(dt));
                return 0;
            }
            return GoodsReturn.AnswerNoGood;
        }
Пример #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>
        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));
            }
        }
Пример #4
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));
            }
        }
Пример #5
0
 /// <summary>
 /// 任务放异
 /// </summary>
 /// <param name="note">角色信息</param>
 /// <param name="task">任务</param>
 /// <returns></returns>
 public static bool TaskGiveup(PlayerBusiness pb, Task task, bool isremove = true)
 {
     PlayerEx burden = pb.B0;
     Variant v = task.Value;
     //完成条件
     IList finish = v.GetValue<IList>("Finish");
     for (int i = 0; i < finish.Count; i++)
     {
         Variant k = finish[i] as Variant;
         if (k == null) continue;
         string goodsid = k.GetStringOrDefault("GoodsID");
         int Cur = k.GetIntOrDefault("Cur");
         switch (k.GetIntOrDefault("Type"))
         {
             case 10006:
                 Dictionary<string, Variant> dic = new Dictionary<string, Variant>();
                 Variant vn = new Variant();
                 vn.Add("Number1", Cur);
                 dic.Add(goodsid, vn);
                 if (BurdenManager.IsFullBurden(burden, dic))
                 {
                     pb.Call(TaskCommand.GiveupR, false, TipManager.GetMessage(BurdenReturn.BurdenFull));
                     return true;
                 }
                 pb.AddGoods(dic, GoodsSource.TaskGiveup);
                 break;
             case 10003:
             case 10009:
             case 10010:
                 //BurdenAccess.Remove(burden, goodsid, Cur);
                 pb.RemoveGoods(goodsid, Cur, GoodsSource.TaskGiveup);
                 break;
         }
         k["Cur"] = 0;
     }
     v["Status"] = 0;
     if (isremove)
     {
         task.Save();
     }
     pb.Call(TaskCommand.GiveupR, true, task.ID);
     return false;
 }