예제 #1
0
파일: TaskManage.cs 프로젝트: abel/sinan
 /// <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["Finish"] as IList;
     foreach (Variant k in finish)
     {
         string goodsid = k.GetStringOrDefault("GoodsID");
         int Cur = k.GetIntOrDefault("Cur");
         if (Cur == 0) continue;
         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))
                     return true;
                 pb.AddGoods(dic, GoodsSource.TaskGiveup);
                 break;
             case 10003:
             case 10009:
             case 10010:
                 BurdenManager.Remove(burden, goodsid, Cur);
                 break;
         }
         k["Cur"] = 0;
     }
     v["Status"] = 0;
     if (isremove)
     {
         task.Save();
     }
     pb.Call(TaskCommand.GiveupR, true, task.ID);
     return false;
 }
예제 #2
0
파일: ProBusiness.cs 프로젝트: abel/sinan
        /// <summary>
        /// 进入扣除
        /// </summary>
        /// <param name="player"></param>
        public override bool IntoPart(PlayerBusiness player)
        {
            if (BurdenManager.GoodsCount(player.B0, m_elements[0]) > 0)
            {
                //请先处理包袱中的【守护凭证】后再进入
                player.Call(ClientCommand.IntoSceneR, false, null,TipManager.GetMessage(ClientReturn.ProBusiness1));
                return false;
            }

            Dictionary<string, Variant> dic = new Dictionary<string, Variant>();
            Variant v = new Variant();
            v.Add("Number1", 1);
            v.Add("EndTime", this.EndTime.AddHours(1));//活动结束后一个小时道具过期

            dic.Add(m_elements[0], v);

            if (BurdenManager.IsFullBurden(player.B0, dic))
            {
                //包袱满,请整理你的包袱再进行该操作
                player.Call(ClientCommand.IntoSceneR, false, null, TipManager.GetMessage(ClientReturn.ProBusiness2));
                return false;
            }

            bool pass = (m_part.Coin == 0 && m_part.Score == 0);
            if ((!pass) && m_part.Score > 0)
            {
                pass = player.AddScore(-m_part.Score, FinanceType.Part);
            }
            if ((!pass) && m_part.Coin > 0)
            {
                pass = player.AddCoin(-m_part.Coin, FinanceType.Part);
            }
            if (!pass)
            {
                player.Call(ClientCommand.IntoSceneR, false, null, m_part.CoinMsg);
                return false;
            }

            if (m_part.MaxInto > 0)
            {
                m_playerInto.SetOrInc(player.PID, 1);
            }

            //进入场景成功,发送道具
            player.AddGoods(dic, GoodsSource.Pro);
            player.MoreFight = 0;
            player.NoFight = 0;
            player.Call(ActivityCommand.GetDefendCardR, MainScene.Players.Count);
            //进入守护战争,记录活跃度
            player.AddAcivity(ActivityType.Pro, 1);
            return true;
        }
예제 #3
0
파일: GoodsUse.cs 프로젝트: abel/sinan
        /// <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));
            }
        }
예제 #4
0
파일: BoxBusiness.cs 프로젝트: abel/sinan
 protected void GetAward(PlayerBusiness player)
 {
     player.WriteDaily(PlayerBusiness.DailyBox, m_box.ID);
     AwardBox award = m_box.GetAward();
     if (award.Score > 0)
     {
         player.AddScore(award.Score, FinanceType.OpenBox);
     }
     if (award.Bond > 0)
     {
         player.AddBond(award.Bond, FinanceType.OpenBox);
     }
     Dictionary<string, Variant> dic = new Dictionary<string, Variant>();
     foreach (var k in award.Goods)
     {
         Variant v = new Variant(1);
         v.Add("Number0", k.Value);
         dic.Add(k.Key, v);
     }
     player.AddGoods(dic, GoodsSource.OpenBox);
     //发送结果
     player.Call(ClientCommand.OpenBoxR, true, award);
 }
예제 #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;
 }