Exemplo n.º 1
0
        public static bool CheckFunction(string siteId, Guid managerId, EnumOpenFunction enumOpenFunction)
        {
            var managerExtra = NbManagerextraMgr.GetById(managerId, siteId);
            var func         = managerExtra.FunctionList;

            return(CheckFunction(func, (int)enumOpenFunction));
        }
Exemplo n.º 2
0
        public static NBSolutionInfo GetSolutionInfo(Guid managerId)
        {
            var solution = GetSolution(managerId);

            if (solution == null)
            {
                return(null);
            }
            var manager = GetManager(managerId);

            if (manager == null)
            {
                return(null);
            }

            var solutionInfo = new NBSolutionInfo();

            solutionInfo.FormationId   = solution.FormationId;
            solutionInfo.PlayerString  = solution.PlayerString;
            solutionInfo.TeammemberMax = manager.TeammemberMax;
            solutionInfo.VeteranCount  = solution.VeteranCount;
            int veteranCount = NbManagerextraMgr.GetById(managerId).VeteranNumber;

            solutionInfo.MaxVeteranCount = veteranCount < _maxVeteranCount ? _maxVeteranCount : veteranCount;
            solutionInfo.ClothId         = BuffPoolCore.Instance().GetManagerClothId(managerId, null);
            solutionInfo.Teammembers     = GetSolutionTeammembers(managerId);
            return(solutionInfo);
        }
Exemplo n.º 3
0
        DTOBuffMemberView GetMembers4Db(Guid managerId, ManagerSkillUseWrap use)
        {
            if (!FrameConfig.SWAPBuffDataReadDb ||
                null == use || use.Raw.SyncFlag != 0)
            {
                return(null);
            }
            var             rawMembers = BuffUtil.GetRawMembers(managerId, true);
            var             members    = NbManagerbuffmemberMgr.GetByMid(managerId, ShareUtil.GetTableMod(managerId));
            var             extra      = NbManagerextraMgr.GetById(managerId);
            var             dic        = new Dictionary <Guid, NbManagerbuffmemberEntity>(members.Count);
            DicPlayerEntity cfg        = null;

            foreach (var item in members)
            {
                cfg = PlayersdicCache.Instance.GetPlayer(Math.Abs(item.Pid));
                if (null == cfg)
                {
                    continue;
                }
                FillBuffMemberProp(item, cfg);
                item.ReadySkillList = item.ReadySkills.Split(',').ToList();
                item.LiveSkillList  = item.LiveSkills.Split(',').ToList();
            }
            var data = CreateBuffView(managerId, use, rawMembers.ToDictionary(i => i.Idx, i => i));

            data.Kpi          = extra.Kpi;
            data.SyncIdleFlag = false;
            data.BuffMembers  = dic;
            return(data);
        }
Exemplo n.º 4
0
        public static int GetTalentType(Guid managerId, string siteId = "")
        {
            var extra = NbManagerextraMgr.GetById(managerId, siteId);

            if (null == extra)
            {
                return(0);
            }
            return(extra.SkillType);
        }
Exemplo n.º 5
0
        public static int GetKpi(Guid managerId, string siteId = "")
        {
            var extra = NbManagerextraMgr.GetById(managerId, siteId);

            if (extra != null)
            {
                return(extra.Kpi);
            }
            return(0);
        }
Exemplo n.º 6
0
        public MessageCode BackSaveSolution(Guid managerId, NbSolutionEntity solution, int[] newPids, List <TeammemberEntity> members)
        {
            if (null == solution)
            {
                return(MessageCode.Success);
            }
            if (newPids.Length != SystemConstants.TeammemberCount)
            {
                return(MessageCode.TeammemberInvalidCount);
            }
            if (null == members)
            {
                members = MatchDataHelper.GetTeammembers(managerId, null, true);
            }
            List <int> tempPids     = new List <int>(newPids.Length);
            int        veteranCount = 0;
            int        orangeCount  = 0;
            int        combCount    = 0;

            foreach (var pId in newPids)
            {
                int id = ConvertHelper.ConvertToInt(pId);
                if (!members.Exists(d => d.PlayerId == id))
                {
                    return(MessageCode.TeammemberInvalidPlayer);
                }
                if (tempPids.Contains(id))
                {
                    return(MessageCode.TeammemberSolutionPlayerRepeat);
                }
                tempPids.Add(id);
                var player = CacheFactory.PlayersdicCache.GetPlayer(id);
                if (player.CardLevel == (int)EnumPlayerCardLevel.Gold || player.CardLevel == (int)EnumPlayerCardLevel.Silver)
                {
                    veteranCount++;
                }
                else if (player.CardLevel == (int)EnumPlayerCardLevel.Orange || player.CardLevel == (int)EnumPlayerCardLevel.BlackGold)
                {
                    orangeCount++;
                }
            }
            int veteranNumber = _maxVeteranCount;
            var manager       = NbManagerextraMgr.GetById(managerId);

            if (manager == null)
            {
                return(MessageCode.NbParameterError);
            }
            if (manager.VeteranNumber > _maxVeteranCount)
            {
                veteranNumber = manager.VeteranNumber;
            }
            if (veteranCount > veteranNumber)
            {
                return(MessageCode.TeammemberVeteranCountOver);
            }
            combCount = ManagerSkillCache.Instance().GetCombsNum(tempPids.ToArray());
            string playerString = string.Join(",", newPids);

            if (!TeammemberMgr.SaveSolution(managerId, solution.FormationId, playerString, veteranCount, orangeCount, combCount))
            {
                return(MessageCode.NbUpdateFail);
            }
            //DeleteSolutionCache(managerId, true);
            return(MessageCode.Success);
        }
Exemplo n.º 7
0
        public NBSolutionInfoResponse SaveSolution(Guid managerId, int formationId, string playerString, bool hasTask)
        {
            var solution = MatchDataHelper.GetSolution(managerId);

            if (solution == null)
            {
                return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>());
            }

            bool isChangePlayer = solution.PlayerString != playerString;

            string[] pIds = playerString.Split(',');
            if (pIds.Length != SystemConstants.TeammemberCount)
            {
                return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberInvalidCount));
            }
            var formation = CacheFactory.FormationCache.GetFormation(formationId);

            if (formation == null)
            {
                return(ResponseHelper.InvalidParameter <NBSolutionInfoResponse>());
            }

            var        teammembers  = MatchDataHelper.GetTeammembers(managerId, null, true);
            List <int> tempPids     = new List <int>(pIds.Length);
            int        veteranCount = 0;
            int        orangeCount  = 0;
            int        combCount    = 0;

            foreach (var pId in pIds)
            {
                int id = ConvertHelper.ConvertToInt(pId);
                if (!teammembers.Exists(d => d.PlayerId == id))
                {
                    return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberInvalidPlayer));
                }
                if (tempPids.Contains(id))
                {
                    return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberSolutionPlayerRepeat));
                }
                tempPids.Add(id);
                var player = CacheFactory.PlayersdicCache.GetPlayer(id);
                if (player.CardLevel == (int)EnumPlayerCardLevel.Gold || player.CardLevel == (int)EnumPlayerCardLevel.Silver)
                {
                    veteranCount++;
                }
                else if (player.CardLevel == (int)EnumPlayerCardLevel.Orange || player.CardLevel == (int)EnumPlayerCardLevel.BlackGold)
                {
                    orangeCount++;
                }
            }
            foreach (var tempPid in tempPids)
            {
                var linkList = CacheFactory.PlayersdicCache.GetLinkPlayerList(tempPid);
                if (linkList != null)
                {
                    foreach (var link in linkList)
                    {
                        if (tempPids.Exists(d => d == link))
                        {
                            return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberSolutionPlayerRepeat));
                        }
                    }
                }
            }
            int veteranNumber = _maxVeteranCount;
            var manager       = NbManagerextraMgr.GetById(managerId);

            if (manager == null)
            {
                return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.NbParameterError));
            }
            if (manager.VeteranNumber > _maxVeteranCount)
            {
                veteranNumber = manager.VeteranNumber;
            }
            if (veteranCount > veteranNumber)
            {
                return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.TeammemberVeteranCountOver));
            }
            combCount = ManagerSkillCache.Instance().GetCombsNum(tempPids.ToArray());
            if (TeammemberMgr.SaveSolution(managerId, formationId, playerString, veteranCount, orangeCount, combCount))
            {
                DeleteSolutionCache(managerId, true);
                ActivityExThread.Instance.TememberColect(managerId, 3, orangeCount);
                var response = SolutionAndTeammemberResponse(managerId);
                if (hasTask && isChangePlayer)
                {
                    var pop = TaskHandler.Instance.SolutionChangePlayer(managerId);
                    if (response.Data != null)
                    {
                        response.Data.PopMsg = pop;
                    }
                }
                return(response);
            }
            else
            {
                return(ResponseHelper.Create <NBSolutionInfoResponse>(MessageCode.NbUpdateFail));
            }
        }
Exemplo n.º 8
0
        void BindData()
        {
            var accountData = Master.GetAccount();

            if (accountData == null)
            {
                Master.ShowMessage("请先选择经理.");
                return;
            }
            var manager = NbManagerMgr.GetById(accountData.ManagerId, accountData.ZoneId);

            if (manager == null)
            {
                Master.ShowMessage("获取经理信息失败.");
                return;
            }
            ClearData();
            lblCoin.Text         = manager.Coin.ToString();
            lblExp.Text          = manager.EXP.ToString();
            lblLevel.Text        = manager.Level.ToString();
            lblLogo.Text         = manager.Logo.ToString();
            lblName.Text         = manager.Name;
            lblReiki.Text        = manager.Reiki.ToString();
            lblSophisticate.Text = manager.Sophisticate.ToString();
            lblStatus.Text       = CacheDataHelper.Instance.GetEnumDescription("EnumManagerStatus", manager.Status);
            lblSubstitute.Text   = (manager.TeammemberMax - 11).ToString();
            lblVipLevel.Text     = manager.VipLevel.ToString();

            var payAccount = PayUserMgr.GetById(accountData.Account, accountData.ZoneId);

            if (payAccount != null)
            {
                lblCash.Text  = payAccount.TotalCash.ToString();
                lblPoint.Text = string.Format("{0}+{1}(赠送)={2}", payAccount.Point, payAccount.Bonus, payAccount.TotalPoint);
            }

            var user = NbUserMgr.GetById(accountData.Account, accountData.ZoneId);

            if (user != null)
            {
                lblLastLoginTime.Text = user.LastLoginTime.ToString(AdminMgr.TimeFormat);
                lblRegisterTime.Text  = user.RowTime.ToString(AdminMgr.TimeFormat);
                lblLoginday.Text      = user.ContinuingLoginDay.ToString();
            }
            var onlineEntity = OnlineInfoMgr.GetById(accountData.ManagerId, accountData.ZoneId);

            if (onlineEntity != null)
            {
                lblOnlineStatus.Text = onlineEntity.IsOnline ? "在线" : "不在线";
                var total  = onlineEntity.RealTotalMinutes;
                var day    = total / 1440;
                var hour   = (total % 1440) / 60;
                var minute = ((total % 1440) % 60);
                lblOnlineTotal.Text = string.Format("{0} 天 {1} 小时 {2} 分钟", day, hour, minute);
                lblOnlineCur.Text   = onlineEntity.TodayMinutes + " 分钟";
            }
            else
            {
                lblOnlineStatus.Text = "无记录";
            }
            var    solution     = NbSolutionMgr.GetById(accountData.ManagerId, accountData.ZoneId);
            string playerString = "";

            if (solution != null)
            {
                var formation = CacheFactory.FormationCache.GetFormation(solution.FormationId);
                lblSolution.Text = formation == null?solution.FormationId.ToString() : formation.Name;

                lblSolutionPlayer.Text = solution.PlayerString;
                lblSolutionSkill.Text  = solution.SkillString;
                playerString           = solution.PlayerString;
            }

            var managerExtra = NbManagerextraMgr.GetById(accountData.ManagerId, accountData.ZoneId);

            if (managerExtra != null)
            {
                ManagerUtil.CalCurrentStamina(managerExtra, manager.Level, manager.VipLevel);
                lblStamina.Text = managerExtra.Stamina.ToString();
            }

            var teammembers = TeammemberMgr.GetByManager(accountData.ManagerId, accountData.Mod, accountData.ZoneId);

            if (teammembers != null)
            {
                foreach (var teammember in teammembers)
                {
                    teammember.Name   = AdminCache.Instance.GetPlayerName(teammember.PlayerId);
                    teammember.IsMain = playerString.Contains(teammember.PlayerId.ToString());
                }
                datagrid1.DataSource = teammembers;
                datagrid1.DataBind();
            }

            var list = FriendinviteMgr.InviteManagerList(manager.Account, accountData.ZoneId);

            if (list != null)
            {
                var friendInviteString = "";
                foreach (var item in list)
                {
                    friendInviteString += item.Name + ",";
                }
                lblFriendInvite.Text = friendInviteString;
            }
        }