Ejemplo n.º 1
0
 public void CallAllExcludeOne(PlayerBusiness exclude, Sinan.Collections.BytesSegment buffer)
 {
     if (this.m_showAll)
     {
         foreach (var member in m_players.Values)
         {
             if (exclude != member)
             {
                 member.Call(buffer);
             }
         }
     }
     else
     {
         //副本场景.只发给本场景的组队成员
         long showID = exclude.ShowID;
         foreach (var member in m_players.Values)
         {
             if (member.ShowID == showID && exclude != member)
             {
                 member.Call(buffer);
             }
         }
     }
 }
Ejemplo n.º 2
0
        public bool Check(PlayerBusiness player, out string msg)
        {
            //次数限制
            if (this.m_maxInto > 0)
            {
                int addC = 0;
                int c = player.ReadDaily(PlayerBusiness.DailyMap, m_ectypeID);

                var d = GameConfigAccess.Instance.FindOneById(m_ectypeID);
                if (d != null)
                {
                    if (d.MainType == MainType.Map ||
                        (d.MainType == MainType.Ectype && (d.SubType == "Personal" || d.SubType == "Team")))
                    {
                        Variant v = MemberAccess.MemberInfo(player.MLevel);
                        if (v != null)
                        {
                            addC = v.GetIntOrDefault("MapSecret");
                        }
                    }
                }
                if (c >= this.m_maxInto + addC)
                {
                    msg = m_maxIntoMsg;
                    return false;
                }
            }
            msg = null;
            return true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 竞技场宠物疲劳值增加
        /// </summary>
        /// <param name="model"></param>
        /// <param name="user">角色</param>
        /// <param name="type">0表示负,1胜,2平</param>
        public static void AddFatigue(ArenaBase model, PlayerBusiness user, int type)
        {
            GameConfig gc = GameConfigAccess.Instance.FindOneById(model.ArenaID);
            if (gc == null)
                return;

            Variant t = gc.Value;
            Variant petLevel = t.GetValueOrDefault<Variant>("PetLevel").GetValueOrDefault<Variant>(model.PetMin + "-" + model.PetMax);
            if (petLevel == null)
                return;

            int addFatigue = 0;//战斗增加疲劳值
            switch (type)
            {
                case 0:
                    addFatigue = petLevel.GetIntOrDefault("Lose");
                    break;
                case 1:
                    addFatigue = petLevel.GetIntOrDefault("Win");
                    break;
                case 2:
                    addFatigue = petLevel.GetIntOrDefault("Ping");
                    break;
            }

            if (user.ID == model.PlayerID)
            {
                addFatigue = Convert.ToInt32(addFatigue * (1 - petLevel.GetDoubleOrDefault("FarmLv")));
            }

            foreach (Pet p in model.Pets.Values)
            {
                if (p.PlayerID != user.ID)
                    continue;
                Variant v = p.Value;
                //取得宠物最大疲劳值
                int max = PetAccess.Instance.MaxFatigue(v.GetIntOrDefault("PetsLevel"));

                if (p.PlayerID == user.ID)
                {
                    if (v.GetIntOrDefault("Fatigue") + addFatigue >= max)
                    {
                        v["Fatigue"] = max;
                    }
                    else
                    {
                        v["Fatigue"] = v.GetIntOrDefault("Fatigue") + addFatigue;
                    }

                    p.SaveFatigue();

                    Variant tmp = new Variant();
                    tmp.Add("ID",p.ID);
                    tmp.Add("Fatigue", v.GetIntOrDefault("Fatigue"));
                    user.Call(PetsCommand.UpdatePetR, true, tmp);
                    //Console.WriteLine("宠物名称:" + p.Name + ",当前疲劳值:" + v.GetIntOrDefault("Fatigue") + ",增加量:" + addFatigue + ",输赢:" + type);
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 任务触发d
 /// </summary>
 /// <param name="pb"></param>
 /// <param name="gc"></param>
 public static void TaskBack(PlayerBusiness pb, GameConfig gc)
 {
     Task task = TaskAccess.Instance.TaskBase(pb.ID, pb.Name, gc, 0, 0);
     if (task != null)
     {
         pb.Call(TaskCommand.TaskActivationR, TaskAccess.Instance.GetTaskInfo(task));
     }
 }
Ejemplo n.º 5
0
 public bool Rollback(PlayerBusiness player)
 {
     //退回绑金
     if (m_bond > 0)
     {
         player.AddBond(m_bond, FinanceType.IntoScene);
     }
     return true;
 }
Ejemplo n.º 6
0
 public bool Rollback(PlayerBusiness player)
 {
     //退回晶币
     if (m_coin > 0)
     {
         player.AddCoin(m_coin, FinanceType.IntoScene);
     }
     return true;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 创建队伍
 /// </summary>
 /// <param name="player"></param>
 public PlayerTeam(PlayerBusiness player)
 {
     if (player.SetTeam(this, TeamJob.Captain))
     {
         int id = Interlocked.Increment(ref T) & 0x00ffffff;
         this.m_id = Sinan.Extensions.StringFormat.ToHexString(id);
         m_members[0] = player;
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 发送给场景上其它的用户
 /// </summary>
 /// <param name="excludeID"></param>
 /// <param name="command"></param>
 /// <param name="objs"></param>
 public void CallAllExcludeOne(PlayerBusiness exclude, string command, params object[] objs)
 {
     SceneBusiness scene = m_scene;
     if (scene != null)
     {
         var buffer = AmfCodec.Encode(command, objs);
         scene.CallAllExcludeOne(exclude, buffer);
     }
 }
Ejemplo n.º 9
0
 public bool Rollback(PlayerBusiness player)
 {
     //退回石币
     if (m_score > 0)
     {
         player.AddScore(m_score, FinanceType.IntoScene);
     }
     return true;
 }
Ejemplo n.º 10
0
 public bool Check(PlayerBusiness player, out string msg)
 {
     if (player.Bond >= m_bond)
     {
         msg = null;
         return true;
     }
     msg = m_msg;
     return false;
 }
Ejemplo n.º 11
0
 public bool Execute(PlayerBusiness player, out string msg)
 {
     //扣除物品
     if (!string.IsNullOrEmpty(m_holdGoods))
     {
         BurdenManager.Remove(player.B0, m_holdGoods, 1);
     }
     msg = null;
     return true;
 }
Ejemplo n.º 12
0
 public bool Check(PlayerBusiness player, out string msg)
 {
     if (player.Score >= m_score)
     {
         msg = null;
         return true;
     }
     msg = m_msg;
     return false;
 }
Ejemplo n.º 13
0
 public bool Check(PlayerBusiness player, out string msg)
 {
     if (player.Coin >= m_coin)
     {
         msg = null;
         return true;
     }
     msg = m_msg;
     return false;
 }
Ejemplo n.º 14
0
 private static bool CreateOrder(PlayerBusiness player, string token)
 {
     Order log = new Order();
     log.Created = DateTime.UtcNow;
     log.token = token;
     log.openid = player.UserID;
     log.pid = player.PID;
     log.zoneid = ServerLogger.zoneid;
     bool result = OrderAccess.Instance.Save(log);
     return result;
 }
Ejemplo n.º 15
0
 protected override Variant CreateSceneInfo(PlayerBusiness player, bool newlogin)
 {
     Variant scene = base.CreateSceneInfo(player, newlogin);
     var t = player.TeamInstance;
     if (t != null && t.OverTime.HasValue)
     {
         player.ShowID = t.ID;
         scene["OverTime"] = t.OverTime;
     }
     return scene;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 退出场景(玩家仍在线)
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public override bool ExitScene(PlayerBusiness player)
 {
     string playerID = player.ID;
     if (m_players.TryRemove(playerID, out player) && player != null)
     {
         //发送通知
         CallAll(player.ShowID, ClientCommand.ExitSceneR, new object[] { playerID });
         return true;
     }
     return false;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// 行走
 /// </summary>
 /// <param name="note"></param>
 protected override bool WalkEvent(PlayerBusiness player)
 {
     var t = player.TeamInstance;
     if (t != null && t.OverTime.HasValue && t.OverTime < DateTime.UtcNow)
     {
         player.TeamInstance = null;
         //超时结束副本
         t.Over();
         return false;
     }
     return true;
 }
Ejemplo n.º 18
0
 protected override bool FillPlayers(PlayerTeam team, PlayerBusiness player, out string msg)
 {
     //通过完成家族任务获得此副本
     if (team != null)
     {
         msg = TipManager.GetMessage(ClientReturn.IntoLimit1);
         return false;
     }
     m_members = new PlayerBusiness[1] { player };
     msg = null;
     return true;
 }
Ejemplo n.º 19
0
        /// <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;
        }
Ejemplo n.º 20
0
 protected override string CheckBox(PlayerBusiness player)
 {
     string msg = base.CheckBox(player);
     if (msg == null)
     {
         if (Interlocked.Exchange(ref m_open, 1) != 0)
         {
             //return "已达最大开启数,不能开启";
             return TipManager.GetMessage(ClientReturn.CheckBox5);
         }
     }
     return msg;
 }
Ejemplo n.º 21
0
 public bool Execute(PlayerBusiness player, out string msg)
 {
     //消耗晶币
     if (m_coin > 0)
     {
         if (!player.AddCoin(-m_coin, FinanceType.IntoScene))
         {
             msg = m_msg;
             return false;
         }
     }
     msg = null;
     return true;
 }
Ejemplo n.º 22
0
 public bool Execute(PlayerBusiness player, out string msg)
 {
     //消耗绑金
     if (m_bond > 0)
     {
         if (!player.AddBond(-m_bond, FinanceType.IntoScene))
         {
             msg = m_msg;
             return false;
         }
     }
     msg = null;
     return true;
 }
Ejemplo n.º 23
0
 public bool Execute(PlayerBusiness player, out string msg)
 {
     //消耗石币
     if (m_score > 0)
     {
         if (!player.AddScore(-m_score, FinanceType.IntoScene))
         {
             msg = m_msg;
             return false;
         }
     }
     msg = null;
     return true;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// 登录可以得到的成长度数量
        /// </summary>
        /// <param name="note"></param>
        /// <returns></returns>
        public static void LoginCZD(PlayerBusiness pb)
        {
            string soleid = pb.ID + "LoginCZD";
            if (!m_dic.TryAdd(soleid, soleid))
                return;
            try
            {
                //上次登陆时间
                PlayerEx member = pb.Member;
                Variant v = member.Value;
                int czd = 0;

                int num = 0;//天数
                DateTime dt = DateTime.UtcNow;

                if (v.ContainsKey("MemberTime"))
                {
                    DateTime mt = v.GetDateTimeOrDefault("MemberTime");
                    num = Convert.ToInt32((dt.Date - mt.Date).TotalDays);
                }
                else
                {
                    DateTime created = pb.Created;
                    num = Convert.ToInt32((dt.Date - created.Date).TotalDays);
                }
                if (num < 1)
                    return;

                Variant mv = MemberAccess.MemberInfo(pb.MLevel);
                if (mv != null)
                {
                    //每天增加量
                    int b = mv.GetIntOrDefault("B");
                    czd = b * num;
                    if (czd > 0)
                    {
                        pb.AddCZD(czd, GoodsSource.LoginCZD);
                    }
                }
                v["MemberTime"] = DateTime.UtcNow;
                member.Save();

                //更新会员扩展
                pb.Call(ClientCommand.UpdateActorR, new PlayerExDetail(member));
            }
            finally
            {
                m_dic.TryRemove(soleid, out soleid);
            }
        }
Ejemplo n.º 25
0
 public bool Check(PlayerBusiness player, out string msg)
 {
     //物品限制
     if (!string.IsNullOrEmpty(m_holdGoods))
     {
         if (BurdenManager.GoodsCount(player.B0, m_holdGoods) <= 0)
         {
             msg = m_holdGoodsMsg;
             return false;
         }
     }
     msg = null;
     return true;
 }
Ejemplo n.º 26
0
 protected FightPlayer(PlayerBusiness player)
 {
     m_player = player;
     m_skills = player.Skill.Value;
     PlayerEx assist = player.Assist;
     if (assist != null && assist.Value != null)
     {
         m_wg = GetAssistInt(assist.Value.GetVariantOrDefault("WG"));
         m_mg = GetAssistInt(assist.Value.GetVariantOrDefault("MG"));
         m_wf = GetAssistInt(assist.Value.GetVariantOrDefault("WF"));
         m_mf = GetAssistInt(assist.Value.GetVariantOrDefault("MF"));
         m_cp = GetAssistDouble(assist.Value.GetVariantOrDefault("CP"));
         m_expa = GetDouleExp(assist.Value);
     }
 }
Ejemplo n.º 27
0
 public bool Check(PlayerBusiness player, out string msg)
 {
     if (m_minLev > player.Level)
     {
         msg = m_minLevMsg;
         return false;
     }
     if (m_maxLev > 0 && m_maxLev < player.Level)
     {
         msg = m_maxLevMsg;
         return false;
     }
     msg = null;
     return true;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// 场景切换检查
 /// </summary>
 /// <param name="player"></param>
 /// <param name="inScene"></param>
 /// <param name="transmitType">0:道具/超时回城, 1:死亡回城 , 2:转送阵, 3: NPC</param>
 /// <returns></returns>
 public override bool TransferCheck(PlayerBusiness player, SceneBusiness inScene, TransmitType transmitType)
 {
     //检查必杀的怪是否完成..
     if (transmitType == TransmitType.Pin)
     {
         IList killed = player.Ectype.Value.GetValue<IList>("Killed");
         string needKill = NpcManager.Instance.MustKill(this.ID, killed);
         if (needKill != null)
         {
             string msg = string.Format(TipManager.GetMessage(ClientReturn.SceneEctype4), needKill);
             player.Call(ClientCommand.IntoSceneR, false, null, msg);
             return false;
         }
     }
     return base.TransferCheck(player, inScene, transmitType);
 }
Ejemplo n.º 29
0
 public FightPlayer(int p, PlayerBusiness player)
     : this(player)
 {
     this.P = p;
     this.ID = player.ID;
     this.Level = player.Level;
     this.Name = player.Name;
     this.Life = player.Life;
     m_hp = player.HP;
     m_mp = player.MP;
     this.Skin = player.RoleID.ToString();
     this.m_fixBuffer = player.FixBuffer;
     player.UseClapnet = 0;
     player.CheckAutoFight();
     FResult = FightResult.Lose;
 }
Ejemplo n.º 30
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;
        }