コード例 #1
0
ファイル: LimitMaxinto.cs プロジェクト: abel/sinan
        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;
        }
コード例 #2
0
ファイル: BoxBusiness.cs プロジェクト: abel/sinan
        protected virtual string CheckBox(PlayerBusiness player)
        {
            if (player.SceneID != m_box.SceneID)
            {
                //你已跨场景;
                return TipManager.GetMessage(ClientReturn.CheckBox1);
            }
            int x = m_point.X - player.X;
            int y = m_point.Y - player.Y;
            if (x * x + y * y > 50)
            {
                return TipManager.GetMessage(ClientReturn.CheckBox1);
            }

            int count = player.ReadDaily(PlayerBusiness.DailyBox, m_box.ID);
            if (count >= m_box.MaxOpen)
            {
                //当天开启数达到限制数;
                return TipManager.GetMessage(ClientReturn.CheckBox2);
            }
            bool needKey = (!string.IsNullOrEmpty(m_box.GoodsID));
            if (needKey && BurdenManager.GoodsCount(player.B0, m_box.GoodsID) == 0)
            {
                //缺少钥匙;
                return TipManager.GetMessage(ClientReturn.CheckBox3);
            }
            if (player.AState == ActionState.Fight)
            {
                //你已进入战斗中,无法打开宝箱;
                return TipManager.GetMessage(ClientReturn.CheckBox4);
            }
            return null;
        }