예제 #1
0
        /// <summary>
        /// 获取我的杯赛历程.
        /// </summary>
        /// <param name="managerId">The manager.</param>
        /// <returns></returns>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        public MyDailycupMatchResponse GetMyDailycupMatch(Guid managerId)
        {
            var response = ResponseHelper.CreateSuccess <MyDailycupMatchResponse>();

            response.Data = new MyDailycupMatchEntity();

            DailycupInfoEntity dailycup = DailycupInfoMgr.GetByDate(DateTime.Today);

            if (dailycup != null && dailycup.Status > (int)EnumDailycupStatus.Close)
            {
                //计算开始回合
                int beginRound = BeginRound(dailycup.Round);
                int endRound   = NowShowRound(beginRound, dailycup.Round, DateTime.Now);
                if (endRound < beginRound)
                {
                    response.Data        = new MyDailycupMatchEntity();
                    response.Data.Matchs = new List <DailycupMatchEntity>(0);
                    return(response);
                }
                //最新轮时间
                DateTime cTime = NowRoundEndTime(dailycup.Round, endRound);
                if (DateTime.Now < cTime)//最新轮是否隐藏
                {
                    endRound--;
                }
                List <DailycupMatchEntity> dailycupmatchs = DailycupMatchMgr.GetMatchByManager(dailycup.Idx, managerId, endRound);
                response.Data.Matchs = dailycupmatchs;
            }
            else
            {
                response.Data.Matchs = new List <DailycupMatchEntity>(0);
            }
            return(response);
        }
예제 #2
0
        /// <summary>
        /// 获取阵型列表
        /// </summary>
        /// <param name="managerId"></param>
        /// <returns></returns>
        public FormationListResponse GetFormationList(Guid managerId)
        {
            var solution      = GetSolution(managerId);
            var formationData = new FormationDataListEntity(solution.FormationData);
            var formationList = CacheFactory.FormationCache.GetFormationList();

            var response = ResponseHelper.CreateSuccess <FormationListResponse>();

            response.Data = new FormationList();
            response.Data.CurrentFormationId = solution.FormationId;
            response.Data.Formations         = new List <FormationOutEntity>(formationList.Count);
            var manager = ManagerCore.Instance.GetManager(managerId, true);

            if (manager != null)
            {
                response.Data.Kpi = manager.Kpi;
            }
            foreach (var entity in formationList)
            {
                int level        = formationData.GetLevel(entity.Idx);
                int sophisticate = CacheFactory.FormationCache.GetSophisticate(level);
                var outEntity    = new FormationOutEntity(entity.Idx, level, sophisticate);
                response.Data.Formations.Add(outEntity);
            }
            return(response);
        }
예제 #3
0
 public MatchProcessResponse GetMatchProcess(Guid matchId, int matchType)
 {
     try
     {
         var baseData = MemcachedFactory.MatchClient.Get <BaseMatchData>(matchId);
         if (baseData != null)
         {
             if (baseData.ErrorCode != (int)MessageCode.Success)
             {
                 return(ResponseHelper.Create <MatchProcessResponse>(baseData.ErrorCode));
             }
         }
         var process = MemcachedFactory.MatchProcessClient.Get <byte[]>(matchId);
         if (process == null)
         {
             process = proxy.GetMatchProcess(matchId, matchType);
             if (process == null)
             {
                 return(ResponseHelper.Create <MatchProcessResponse>(MessageCode.MatchMiss));
             }
         }
         var response = ResponseHelper.CreateSuccess <MatchProcessResponse>();
         response.Data = process;
         return(response);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("GetMatchProcess", ex);
         return(ResponseHelper.Exception <MatchProcessResponse>());
     }
 }
예제 #4
0
        public TeammemberResponse BuildTeammemberResponse(Guid managerId, Guid teammemberId, bool deleteCache = false)
        {
            if (deleteCache)
            {
                DeleteTeamembersCache(managerId, true);
            }
            var teammember = GetTeammember(managerId, teammemberId, true);

            if (teammember == null)
            {
                return(ResponseHelper.InvalidParameter <TeammemberResponse>());
            }
            var response  = ResponseHelper.CreateSuccess <TeammemberResponse>();
            var dicPlayer = CacheFactory.PlayersdicCache.GetPlayer(teammember.PlayerId);

            if (dicPlayer != null)
            {
                teammember.BaseProperty = new TeammemberPropertyEntity(dicPlayer);
            }
            else
            {
                teammember.BaseProperty = new TeammemberPropertyEntity();
            }
            response.Data = teammember;
            return(response);
        }
예제 #5
0
        public ScoutingInfoResponse GetScoutingInfo(Guid managerId)
        {
            var manager = ManagerCore.Instance.GetManager(managerId);

            if (manager == null)
            {
                return(ResponseHelper.InvalidParameter <ScoutingInfoResponse>());
            }
            var response = ResponseHelper.CreateSuccess <ScoutingInfoResponse>();

            response.Data                 = new ScoutingInfoEntity();
            response.Data.Coin            = manager.Coin;
            response.Data.Point           = PayCore.Instance.GetPoint(manager.Account);
            response.Data.FriendShipPoint = manager.FriendShipPoint;
            var list = CacheFactory.ScoutingCache.GetShowList(DateTime.Now);

            if (ActivityExThread.Instance.IsActivity(EnumActivityExEffectType.ScoutingHalfPrice, 0, 0))
            {
                foreach (var item in list)
                {
                    int price = item.CurrencyCount;
                    ActivityExThread.Instance.ScoutingHalfPrice(ref price);
                    item.CurrencyCount = price;
                }
            }
            response.Data.ShowList = list;
            var managerExtra = ManagerCore.Instance.GetManagerExtra(managerId);

            if (managerExtra != null)
            {
                response.Data.CoinFreeTimeTick            = ShareUtil.GetTimeTick(managerExtra.CoinScoutingUpdate);
                response.Data.PointFreeTimeTick           = ShareUtil.GetTimeTick(managerExtra.ScoutingUpdate);
                response.Data.FriendShipPointFreeTimeTick = ShareUtil.GetTimeTick(managerExtra.FriendScoutingUpdate);
            }
            var scoutingManager = GetById(managerId);

            if (scoutingManager != null)
            {
                response.Data.CoinNeedCount            = GetLotteryNeedCount(scoutingManager.CoinLotteryCount);
                response.Data.PointNeedCount           = GetLotteryNeedCount(scoutingManager.PointLotteryCount);
                response.Data.FriendShipPointNeedCount = GetLotteryNeedCount(scoutingManager.FriendLotteryCount);
            }
            else
            {
                response.Data.CoinNeedCount            = 10;
                response.Data.PointNeedCount           = 10;
                response.Data.FriendShipPointNeedCount = 10;
            }
            var scoutingGoldBar = ScoutingGoldbarMgr.GetById(managerId);

            response.Data.GoldBarNeedCount = 10;
            if (scoutingGoldBar != null)
            {
                response.Data.GoldBar          = scoutingGoldBar.GoldBarNumber;
                response.Data.GoldBarNeedCount = scoutingGoldBar.ScoutingNumber == 0
                    ? 10
                    : 10 - scoutingGoldBar.ScoutingNumber % 10;
            }
            return(response);
        }
예제 #6
0
        /// <summary>
        /// 获取排名信息
        /// </summary>
        /// <param name="managerId"></param>
        /// <param name="leagueId"></param>
        /// <returns></returns>
        public LeagueRankListResponse GetRank(Guid managerId, int leagueId)
        {
            try
            {
                var response     = ResponseHelper.CreateSuccess <LeagueRankListResponse>();
                var leagueRecord = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId);
                if (leagueRecord == null)
                {
                    SystemlogMgr.Error("获取联赛信息", "经理联赛记录未找到ManagerId:" + managerId);
                    return(ResponseHelper.InvalidParameter <LeagueRankListResponse>());
                }
                if (!leagueRecord.IsStart)
                {
                    return(ResponseHelper.Create <LeagueRankListResponse>(MessageCode.LeagueNotStart));
                }
                //获取排名
                var leagueFightMap = new LeagueFightMapFrame(managerId);
                int myRank         = 0;
                int myScore        = 0;
                var rankList       = leagueFightMap.GetRank(ref myRank, ref myScore);
                response.Data          = new LeagueRank();
                response.Data.RankList = rankList;
                response.Data.MyRank   = myRank;
                response.Data.MyScore  = myScore;

                return(response);
            }
            catch (Exception ex)
            {
                SystemlogMgr.Error("获取排名信息", ex);
                return(ResponseHelper.Create <LeagueRankListResponse>(MessageCode.NbParameterError));
            }
        }
예제 #7
0
        ItemPackageDataResponse BuildPackageResponse(ItemPackageFrame package, int itemType = 0)
        {
            var response = ResponseHelper.CreateSuccess <ItemPackageDataResponse>();

            response.Data = BuildPackageData(package, itemType);
            return(response);
        }
예제 #8
0
        public MessageCodeResponse PopupRead(Guid managerId, int recordId)
        {
            InformationPopupMgr.Delete(managerId, recordId);
            var response = ResponseHelper.CreateSuccess <MessageCodeResponse>();

            return(response);
        }
예제 #9
0
        //public Match_FightinfoResponse GetFightInfo(Guid managerId, Guid awayId, bool isHomeBot, bool isAwayBot, bool syncAwayFlag = false, string homeSiteId = "", string awaySiteId = "")
        //{
        //    DicNpcEntity homeNpc = null;
        //    DicNpcEntity awayNpc = null;
        //    if (string.IsNullOrEmpty(homeSiteId))
        //    {
        //        homeNpc = CacheFactory.NpcdicCache.GetNpc(managerId);
        //        awayNpc = CacheFactory.NpcdicCache.GetNpc(awayId);
        //    }
        //    bool isHomeNpc = null != homeNpc;
        //    bool isAwayNpc = null != awayNpc;
        //    DTOBuffMemberView homeView, awayView;
        //    BuffDataCore.Instance().GetMembers(out homeView, out awayView,
        //        homeSiteId, managerId, isHomeNpc, awaySiteId, awayId, isAwayNpc, true, syncAwayFlag);
        //    Match_FightManagerinfo home, away;
        //    if (isHomeNpc)
        //        home = MatchDataHelper.GetFightinfo(homeNpc, homeView);
        //    else
        //        home = MatchDataHelper.GetFightinfo(managerId, isHomeBot, homeView, homeSiteId);
        //    if (isAwayNpc)
        //        away = MatchDataHelper.GetFightinfo(awayNpc, awayView);
        //    else
        //        away = MatchDataHelper.GetFightinfo(awayId, isAwayBot, awayView, awaySiteId);
        //    if (home == null || away == null)
        //        return ResponseHelper.Create<Match_FightinfoResponse>(MessageCode.NbParameterError);

        //    var response = ResponseHelper.CreateSuccess<Match_FightinfoResponse>();
        //    response.Data = new Match_Fightinfo();
        //    response.Data.Home = home;
        //    response.Data.Away = away;
        //    return response;
        //}

        //public Match_FightManagerinfo GetFightManagerFightInfo(Guid managerId, bool isBot = false)
        //{
        //    if (CacheFactory.NpcdicCache.IsNpc(managerId))
        //    {
        //        return CacheFactory.NpcdicCache.GetFightManagerinfo(managerId);
        //    }
        //    else
        //    {
        //        return MatchDataHelper.GetFightinfo(managerId, isBot);
        //    }
        //}
        #endregion

        #region GetProcess
        public MatchProcessResponse GetCrossMatchProcess(Guid matchId, int matchType)
        {
            var baseData = MemcachedFactory.MatchClient.Get <BaseMatchData>(matchId);

            if (baseData != null)
            {
                if (baseData.ErrorCode != (int)MessageCode.Success)
                {
                    return(ResponseHelper.Create <MatchProcessResponse>(baseData.ErrorCode));
                }
            }
            var process = MemcachedFactory.MatchProcessClient.Get <byte[]>(matchId);

            if (null == process)
            {
                var dateChar = ShareUtil.GetDateFromComb(matchId);
                var match    = MatchprocessMgr.GetByMatchId(dateChar, matchType, matchId);
                if (null != match)
                {
                    process = match.Process;
                }
            }
            if (null == process)
            {
                return(ResponseHelper.Create <MatchProcessResponse>(MessageCode.MatchMiss));
            }
            var response = ResponseHelper.CreateSuccess <MatchProcessResponse>();

            response.Data = process;
            return(response);
        }
예제 #10
0
        public CrosscrowdMatchResponse GetMatch(Guid managerId, Guid matchId)
        {
            var match = MemcachedFactory.CrowdMatchClient.Get <CrosscrowdMatchEntity>(matchId);

            if (match == null)
            {
                match = CrosscrowdMatchMgr.GetById(matchId);
                if (match == null)
                {
                    return(ResponseHelper.InvalidParameter <CrosscrowdMatchResponse>());
                }
            }
            var pop = MemcachedFactory.CrowdMessageClient.Get <string>(managerId);

            if (pop == null)
            {
                pop = "";
            }
            //LogHelper.Insert(pop,LogType.Info);
            match.Pop = pop;
            var response = ResponseHelper.CreateSuccess <CrosscrowdMatchResponse>();

            response.Data = match;
            return(response);
        }
예제 #11
0
        public MyFriendsResponse GetMyFriends(Guid managerId, int pageIndex, int pageSize)
        {
            var managerExtra = ManagerCore.Instance.GetManagerExtra(managerId);
            var manager      = ManagerCore.Instance.GetManager(managerId);
            int maxHelpCount = CacheFactory.VipdicCache.GetEffectValue(manager.VipLevel,
                                                                       EnumVipEffect.TrainHelpFriendCount);
            bool canHelp    = managerExtra.HelpTrainCount < maxHelpCount;
            int  totalCount = 0;
            var  response   = ResponseHelper.CreateSuccess <MyFriendsResponse>();

            response.Data                   = new MyFriendsData();
            response.Data.Friends           = FriendManagerMgr.GetMyFriends(managerId, pageIndex, pageSize, ref totalCount);
            response.Data.TotalCount        = totalCount;
            response.Data.TotalPage         = ShareUtil.CalPageCount(totalCount, pageSize);
            response.Data.DayHelpTrainCount = maxHelpCount - managerExtra.HelpTrainCount;
            DateTime curDate = DateTime.Today;

            foreach (var entity in response.Data.Friends)
            {
                if (canHelp)
                {
                    CalMatchTimes(entity, curDate);
                }
                entity.IsTrain = PlayerTrain.Instance.GetIsHaveTrain(entity.FriendId);
            }
            return(response);
        }
예제 #12
0
        public LadderRefreshExchangeResponse RefreshExchange(Guid managerId)
        {
            var entity = GetLadderManager(managerId);

            entity.RefreshTimes++;
            var mallDirect = new MallDirectFrame(managerId, EnumConsumeSourceType.RefreshLadderExchange,
                                                 entity.RefreshTimes);
            var checkCode = mallDirect.Check();

            if (checkCode != MessageCode.Success)
            {
                return(ResponseHelper.Create <LadderRefreshExchangeResponse>(checkCode));
            }
            var equipmentProperties = "";
            var equipmentItemcode   = "";

            entity.ExchangeIds         = CacheFactory.LadderCache.GetExchanges(out equipmentItemcode, out equipmentProperties);
            entity.ExchangedIds        = "";
            entity.EquipmentProperties = equipmentProperties;
            entity.EquipmentItems      = equipmentItemcode;
            using (var transactionManager = new TransactionManager(Dal.ConnectionFactory.Instance.GetDefault()))
            {
                transactionManager.BeginTransaction();
                checkCode = mallDirect.Save(Guid.NewGuid().ToString(), transactionManager.TransactionObject);
                if (checkCode != MessageCode.Success)
                {
                    transactionManager.Rollback();
                    return(ResponseHelper.Create <LadderRefreshExchangeResponse>(checkCode));
                }
                if (!LadderManagerMgr.Update(entity, transactionManager.TransactionObject))
                {
                    transactionManager.Rollback();
                    return(ResponseHelper.Create <LadderRefreshExchangeResponse>(MessageCode.NbUpdateFail));
                }
                transactionManager.Commit();
            }
            var response = ResponseHelper.CreateSuccess <LadderRefreshExchangeResponse>();

            response.Data              = new LadderRefreshExchangeEntity();
            response.Data.ExchangeIds  = entity.ExchangeIds;
            response.Data.ManagerPoint = mallDirect.RemainPoint;
            response.Data.RefreshPoint =
                CacheFactory.MallCache.GetDirectPoint(EnumConsumeSourceType.RefreshLadderExchange,
                                                      entity.RefreshTimes + 1);
            response.Data.Honor = entity.Honor;
            if (DateTime.Now.Hour >= 21)
            {
                response.Data.ExchangeRefreshTick = ShareUtil.GetTimeTick(DateTime.Today.AddDays(1).AddHours(21));
            }
            else
            {
                response.Data.ExchangeRefreshTick = ShareUtil.GetTimeTick(DateTime.Today.AddHours(21));
            }

            response.Data.AllEquipmentProperties =
                CacheFactory.LadderCache.AnalysisProperties(entity.EquipmentProperties);
            response.Data.LadderCoin = entity.LadderCoin;
            return(response);
        }
예제 #13
0
        public LadderExchangeResponse Exchange(string siteId, Guid managerId, int exchangeIdx)
        {
            var response1 = GetLadderManager(siteId, managerId);

            if (response1.Code != ShareUtil.SuccessCode)
            {
                return(ResponseHelper.Create <LadderExchangeResponse>(response1.Code));
            }
            if (response1.Data == null)
            {
                return(ResponseHelper.InvalidParameter <LadderExchangeResponse>());
            }
            var manager       = response1.Data;
            var exchangeCache = CacheFactory.CrossLadderCache.GetExchangeEntity(exchangeIdx);

            if (exchangeCache == null)
            {
                return(ResponseHelper.InvalidParameter <LadderExchangeResponse>());
            }
            if (manager.Honor < exchangeCache.CostHonor)
            {
                return(ResponseHelper.Create <LadderExchangeResponse>(MessageCode.LadderExchangeHonorShortage));
            }
            var package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.CrossLadderExchange, siteId);
            var code    = package.AddItem(exchangeCache.ItemCode, true, false);

            if (code != MessageCode.Success)
            {
                return(ResponseHelper.Create <LadderExchangeResponse>(code));
            }
            manager.Honor      = manager.Honor - exchangeCache.CostHonor;
            manager.UpdateTime = DateTime.Now;
            var record = new CrossladderExchangerecordEntity()
            {
                SiteId    = siteId,
                CostHonor = exchangeCache.CostHonor,
                ItemCode  = exchangeCache.ItemCode,
                ManagerId = managerId,
                RowTime   = DateTime.Now
            };

            code = SaveExchange(manager, package, record);
            if (code != MessageCode.Success)
            {
                return(ResponseHelper.Create <LadderExchangeResponse>(code));
            }
            else
            {
                package.Shadow.Save();
                var response = ResponseHelper.CreateSuccess <LadderExchangeResponse>();
                response.Data = new LadderExchangeEntity()
                {
                    CurHonor = manager.Honor, ItemCode = exchangeCache.ItemCode
                };
                return(response);
            }
        }
예제 #14
0
        /// <summary>
        /// 天梯赛状态轮询.
        /// </summary>
        /// <param name="managerId">The manager id.</param>
        /// <returns></returns>
        public CrossLadderHeartResponse Heart(Guid managerId)
        {
            CrossLadderHeartResponse response;

            if (CompetitorDic.ContainsKey(managerId))
            {
                response = ResponseHelper.CreateSuccess <CrossLadderHeartResponse>();
            }
            else if (ManagerFightDic != null && ManagerFightDic.ContainsKey(managerId))
            {
                var heartEntity = ManagerFightDic[managerId];

                if (heartEntity == null)
                {
                    if (_status == EnumLadderStatus.Grouping)
                    {
                        response = ResponseHelper.Create <CrossLadderHeartResponse>(MessageCode.Success);
                    }
                    else
                    {
                        response = ResponseHelper.Create <CrossLadderHeartResponse>(MessageCode.Success);
                    }
                }
                else
                {
                    response      = ResponseHelper.Create <CrossLadderHeartResponse>(MessageCode.Success);
                    response.Data = heartEntity;
                }
            }
            else
            {
                var heartEntity = MemcachedFactory.LadderHeartClient.Get <CrossLadderHeartEntity>(managerId);
                if (heartEntity == null)
                {
                    return(ResponseHelper.Create <CrossLadderHeartResponse>(MessageCode.Success));
                }
                else
                {
                    response      = ResponseHelper.Create <CrossLadderHeartResponse>(MessageCode.Success);
                    response.Data = heartEntity;
                }
            }
            if (response.Data == null)
            {
                response.Data = new CrossLadderHeartEntity();
            }
            if (RecentlyAvgWaitSecond > 60)
            {
                response.Data.AvgWaitTime = 60;
            }
            else
            {
                response.Data.AvgWaitTime = RecentlyAvgWaitSecond;
            }

            return(response);
        }
예제 #15
0
        public InformationResponse GetInformation(Guid managerId)
        {
            var response = ResponseHelper.CreateSuccess <InformationResponse>();

            response.Data            = new InformationEntity();
            response.Data.TaskFinish = TaskCore.Instance.HasTaskComplete(managerId);
            //活动
            //response.Data.NewActivity = false;
            response.Data.NewFriend  = FriendCore.Instance.HasFriendRequest(managerId);
            response.Data.MailUnRead = MailCore.Instance.HasUnReadMail(managerId);
            var managerExtra = ManagerCore.Instance.GetManagerExtra(managerId);

            if (managerExtra != null)
            {
                response.Data.TalentUnUsed = managerExtra.SkillPoint > 0;
            }
            response.Data.ActivityComplete = new List <int>();

            var activityList = ActivityRecordMgr.GetCompleteByManager(managerId);

            foreach (var entity in activityList)
            {
                if (!response.Data.ActivityComplete.Contains(entity.ActivityId))
                {
                    response.Data.ActivityComplete.Add(entity.ActivityId);
                }
            }

            response.Data.ActivityExComplete = new List <int>();
            var activityExList = ActivityexRecordMgr.GetCompleteByManager(managerId);

            foreach (var entity in activityExList)
            {
                if (!response.Data.ActivityExComplete.Contains(entity.ExcitingId))
                {
                    response.Data.ActivityExComplete.Add(entity.ExcitingId);
                }
            }

            response.Data.IsHaveDailyAttendance = !DailyAttendance.Instance.GetIsAttendance(managerId);
            response.Data.IsHaveBuyPoint        = false;
            if (MallCore.Instance._buyPointPoss.ContainsKey(managerId))
            {
                response.Data.IsHaveBuyPoint = true;
                bool b = false;
                MallCore.Instance._buyPointPoss.TryRemove(managerId, out b);
            }

            var manager = ManagerCore.Instance.GetManager(managerId);

            if (manager != null)
            {
                response.Data.ManagerLevel = manager.Level;
                response.Data.ManagerExp   = manager.EXP;
            }
            return(response);
        }
예제 #16
0
 public CrossladderManagerResponse GetLadderManager(string siteId, Guid managerId)
 {
     try
     {
         var ladderManager = CrossladderManagerMgr.GetById(managerId);
         if (ladderManager == null)
         {
             if (!ManagerUtil.CheckFunction(siteId, managerId, EnumOpenFunction.CrossLadder))
             {
                 return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.NbFunctionNotOpen));
             }
             var nbManager = NbManagerMgr.GetById(managerId, siteId);
             if (nbManager == null)
             {
                 return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.MissManager));
             }
             int domainId = 0;
             int honor    = 0;
             CrossladderManagerMgr.GetOldHonor(managerId, ref honor);
             CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId);
             ladderManager                 = new CrossladderManagerEntity();
             ladderManager.DomainId        = domainId;
             ladderManager.SiteId          = siteId;
             ladderManager.SiteName        = CacheFactory.FunctionAppCache.GetCrossZoneName(siteId);
             ladderManager.ManagerId       = managerId;
             ladderManager.Name            = nbManager.Name;
             ladderManager.SiteId          = siteId;
             ladderManager.Logo            = nbManager.Logo;
             ladderManager.Score           = _ladderRegisterScore;
             ladderManager.LastExchageTime = ShareUtil.BaseTime;
             ladderManager.RowTime         = DateTime.Now;
             ladderManager.UpdateTime      = DateTime.Now;
             ladderManager.Honor           = honor;
             ladderManager.MaxScore        = _ladderRegisterScore;
             ladderManager.DailyMaxScore   = _ladderRegisterScore;
             ladderManager.Stamina         = 50;
             CrossladderManagerMgr.Insert(ladderManager);
         }
         if (ladderManager.Stamina < 0)
         {
             ladderManager.Stamina = 0;
         }
         if (ladderManager.StaminaBuy < 0)
         {
             ladderManager.StaminaBuy = 0;
         }
         var response = ResponseHelper.CreateSuccess <CrossladderManagerResponse>();
         response.Data = ladderManager;
         return(response);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("GetCrossLadderManager", ex);
         return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.Exception));
     }
 }
예제 #17
0
 /// <summary>
 /// 获取联赛情况
 /// </summary>
 /// <param name="managerId"></param>
 /// <param name="leagueId"></param>
 /// <param name="currectLeague"></param>
 /// <returns></returns>
 public GetLeagueInfoResponse GetLeagueInfo(Guid managerId, int leagueId, LeagueManagerrecordEntity currectLeague)
 {
     try
     {
         if (currectLeague == null)
         {
             currectLeague = LeagueManagerrecordMgr.GetManagerMarkInfo(managerId, leagueId);
         }
         if (currectLeague == null)
         {
             SystemlogMgr.Error("获取联赛信息", "经理联赛记录未找到ManagerId:" + managerId);
             return(ResponseHelper.InvalidParameter <GetLeagueInfoResponse>());
         }
         var leagueRecord = LeagueRecordMgr.GetById(currectLeague.LeagueRecordId);
         //获取胜场
         var leagueWincountRecord = LeagueWincountrecordMgr.GetRecord(managerId, currectLeague.LaegueId);
         var winConfig            = CacheFactory.LeagueCache.GetLeagueStar(leagueId);
         var winList     = new List <LeagueWinCountInfo>();
         var prizeStatus = leagueWincountRecord.PrizeStep.Split(',');
         foreach (var item in winConfig)
         {
             LeagueWinCountInfo entity = new LeagueWinCountInfo();
             entity.PrizeLevel = item.PrizeLevel;
             if (prizeStatus.Length >= item.PrizeLevel)
             {
                 entity.PrizeStatus = ConvertHelper.ConvertToInt(prizeStatus[item.PrizeLevel - 1]);
             }
             winList.Add(entity);
         }
         //获取排名
         var leagueFightMap = new LeagueFightMapFrame(managerId);
         int myRank         = 0;
         int myScore        = 0;
         var rankList       = leagueFightMap.GetRank(ref myRank, ref myScore);
         var response       = ResponseHelper.CreateSuccess <GetLeagueInfoResponse>();
         response.Data = new LeagueInfoEntity();
         if (leagueRecord.Schedule > currectLeague.MaxWheelNumber)
         {
             response.Data.IsHaveReturnMain = true;
             leagueRecord.Schedule          = currectLeague.MaxWheelNumber;
         }
         response.Data.LeagueInfo           = currectLeague;
         response.Data.MyWinCount           = leagueWincountRecord.MaxWinCount;
         response.Data.LeagueRecord         = leagueRecord;
         response.Data.LeagueWincountRecord = winList;
         response.Data.MyRank            = myRank;
         response.Data.RankList          = rankList;
         response.Data.IsHaveStartLeague = true;
         return(response);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("联赛-获取联赛信息", ex);
         return(ResponseHelper.InvalidParameter <GetLeagueInfoResponse>());
     }
 }
예제 #18
0
        /// <summary>
        /// 获取球员成长数据
        /// </summary>
        /// <param name="managerId">经理ID</param>
        /// <param name="teammemberId">球员ID</param>
        /// <returns></returns>
        public TeammemberGrowResponse GetTeammemberGrowInfo(Guid managerId, Guid teammemberId)
        {
            var response = ResponseHelper.CreateSuccess <TeammemberGrowResponse>();

            response.Data = GetTeammemberGrow(managerId, teammemberId);
            var manager = ManagerCore.Instance.GetManager(managerId);

            response.Data.ManagerReiki = manager.Reiki;
            return(response);
        }
예제 #19
0
        /// <summary>
        /// 发布一场比赛
        /// </summary>
        /// <param name="homeName"></param>
        /// <param name="awayName"></param>
        /// <param name="matchTime"></param>
        /// <returns></returns>
        public MessageCodeResponse ReleaseMatch(string homeName, string awayName, DateTime matchTime)
        {
            EuropeMatchEntity entity = new EuropeMatchEntity(0, homeName, awayName, matchTime.Date, matchTime, 0, 0, 0,
                                                             1, DateTime.Now, DateTime.Now);

            if (!EuropeMatchMgr.Insert(entity))
            {
                return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbUpdateFail));
            }
            return(ResponseHelper.CreateSuccess <MessageCodeResponse>());
        }
예제 #20
0
        DailycupFullDataResponse GetDailycupDataToday(Guid managerId, DailycupInfoEntity dailycup, DateTime curTime)
        {
            DailycupFullDataEntity dailycupData = new DailycupFullDataEntity();

            dailycupData.DailycupId  = dailycup.Idx;
            dailycupData.HasNext     = true;
            dailycupData.AttendState = GetAttendState(managerId) ? 1 : 0;
            if (dailycup.Status > (int)EnumDailycupStatus.Close)
            {
                //计算开始回合
                int beginRound = BeginRound(dailycup.Round);
                int endRound   = NowShowRound(beginRound, dailycup.Round, curTime);
                dailycupData.RoundType = CalRoundType(endRound, beginRound);
                if (endRound >= beginRound)
                {
                    GetDailycupData(dailycupData, managerId, beginRound, endRound);
                    //最新轮时间
                    DateTime cTime = NowRoundEndTime(dailycup.Round, endRound);
                    if (curTime < cTime) //最新轮比分是否隐藏
                    {
                        int  maxCount       = 0;
                        bool hasGambleRight = CheckGambleCount(dailycupData.MyGambleData.Count, managerId, out maxCount);
                        foreach (DailycupMatchEntity match in dailycupData.Matchs)
                        {
                            if (match.Round == endRound)
                            {
                                match.HomeScore = -1;
                                match.AwayScore = -1;
                                if (dailycupData.MyGambleData.Exists(gamble => gamble.MatchId == match.Idx))
                                {
                                    match.Status = (int)EnumDailycupMatchStatus.HasGamble;
                                }
                                else
                                {
                                    if (hasGambleRight)
                                    {
                                        match.Status = (int)EnumDailycupMatchStatus.Gamble;
                                    }
                                    else
                                    {
                                        match.Status = (int)EnumDailycupMatchStatus.NoGambel;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            var response = ResponseHelper.CreateSuccess <DailycupFullDataResponse>();

            response.Data = dailycupData;
            return(response);
        }
예제 #21
0
        public PlayerKillOpponentResponse GetOpponents(Guid managerId, string opponentName)
        {
            var info = InnerGetInfo(managerId);

            if (info == null)
            {
                return(ResponseHelper.InvalidParameter <PlayerKillOpponentResponse>("managerId"));
            }
            var manager = ManagerCore.Instance.GetManager(managerId, true);

            if (manager == null)
            {
                return(ResponseHelper.InvalidParameter <PlayerKillOpponentResponse>("managerId"));
            }

            if (manager.Coin < 200)
            {
                return(ResponseHelper.Create <PlayerKillOpponentResponse>(MessageCode.LackofCoin));
            }

            var response = ResponseHelper.CreateSuccess <PlayerKillOpponentResponse>();

            if (!string.IsNullOrEmpty(opponentName))
            {
                var opponent = PlayerkillInfoMgr.GetOpponentByName(opponentName, 1);
                if (opponent == null)
                {
                    return(ResponseHelper.Create <PlayerKillOpponentResponse>(MessageCode.MissManager));
                }
                else if (opponent.Level < _pkMinLevel)
                {
                    return(ResponseHelper.Create <PlayerKillOpponentResponse>(MessageCode.PlayerKillMinLevel));
                }
                PlayerKillOpponentListEntity opponentList = new PlayerKillOpponentListEntity();
                opponentList.Opponents = new List <PlayerKillOpponentEntity>(1);

                opponent.FormationId = TeammemberCore.Instance.GetSolution(opponent.ManagerId).FormationId;
                opponentList.Opponents.Add(opponent);
                response.Data = opponentList;
            }
            else
            {
                RefreshOpponent(info, manager.Kpi);
                response.Data           = new PlayerKillOpponentListEntity();
                response.Data.Opponents = info.Opponents;
            }
            if (response.Data != null && response.Data.Opponents.Count > 0)
            {
                //扣除金币
                ManagerCore.Instance.CostCoin(manager, 200, EnumCoinConsumeSourceType.PkMatchRefresh, ShareUtil.GenerateComb().ToString());
            }
            response.Data.OpponentRefreshTimeTick = ShareUtil.GetTimeTick(info.OpponentRefreshTime);
            return(response);
        }
예제 #22
0
 public MessageCodeResponse Read(Guid managerId, int recordId)
 {
     if (MailInfoMgr.Read(managerId, recordId))
     {
         return(ResponseHelper.CreateSuccess <MessageCodeResponse>());
     }
     else
     {
         return(ResponseHelper.InvalidParameter <MessageCodeResponse>());
     }
 }
예제 #23
0
        public MyBlacksResponse GetMyBlacks(Guid managerId, int pageIndex, int pageSize)
        {
            int totalCount = 0;
            var response   = ResponseHelper.CreateSuccess <MyBlacksResponse>();

            response.Data            = new MyBlacksData();
            response.Data.Blaks      = FriendManagerMgr.GetMyBlacks(managerId, pageIndex, pageSize, ref totalCount);
            response.Data.TotalCount = totalCount;
            response.Data.TotalPage  = ShareUtil.CalPageCount(totalCount, pageSize);
            return(response);
        }
예제 #24
0
        public MessageCodeResponse AddFriend(Guid managerId, string name, bool hasTask)
        {
            var byManager = ManagerCore.Instance.GetManagerByName(name);

            if (byManager == null)
            {
                return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.FriendNotExistsName));
            }
            if (managerId == byManager.Idx)
            {
                return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.FriendNotSelf));
            }
            var manager = ManagerCore.Instance.GetManager(managerId);
            var friend  = FriendManagerMgr.GetOne(managerId, byManager.Idx);

            if (friend != null)
            {
                if (friend.Status == 0)
                {
                    return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.FriendHasExists));
                }
                if (friend.Status == 2)
                {
                    return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.FriendIsByBlack));
                }
            }
            int returnCode = 0;

            FriendManagerMgr.AddFriend(managerId, byManager.Idx, _friendMaxCount, (int)MessageCode.FriendCountOver,
                                       (int)MessageCode.FriendHasExists, ref returnCode);
            if (returnCode == 1) //自己已在对方好友列表
            {
                returnCode = 0;
            }
            else
            {
                InformationHelper.SendAddFriendPop(byManager.Idx, manager.Name);
            }

            if (returnCode == 0)
            {
                var response = ResponseHelper.CreateSuccess <MessageCodeResponse>();
                response.Data = new MessageDataEntity();
                if (hasTask)
                {
                    //response.Data.PopMsg = TaskHandler.Instance.FriendAdd(managerId);
                }
                return(response);
            }
            else
            {
                return(ResponseHelper.Create <MessageCodeResponse>(returnCode));
            }
        }
예제 #25
0
        public FriendMatchResponse GetMatchResponse(Guid matchId)
        {
            var match = FriendMatchMgr.GetById(matchId);

            if (match == null)
            {
                return(ResponseHelper.InvalidParameter <FriendMatchResponse>());
            }
            var response = ResponseHelper.CreateSuccess <FriendMatchResponse>();

            response.Data = match;
            return(response);
        }
예제 #26
0
        public RobotResponse StopRobot(Guid managerId)
        {
            CrossrobotManagerEntity crossRobotManager = null;
            var code = StopCrossRobotManager(managerId, out crossRobotManager);

            if (code != MessageCode.Success)
            {
                return(ResponseHelper.Create <RobotResponse>(code));
            }
            var response = ResponseHelper.CreateSuccess <RobotResponse>();

            return(RobotCore.BuildRobotResponse(response, crossRobotManager));
        }
예제 #27
0
        public LeagueWincountrecordResponse GetWincountPrizeInfo(Guid managerId, int leagueId)
        {
            var leagueWincountRecord = LeagueWincountrecordMgr.GetRecord(managerId, leagueId);

            if (leagueWincountRecord == null)
            {
                return(ResponseHelper.InvalidParameter <LeagueWincountrecordResponse>());
            }
            var response = ResponseHelper.CreateSuccess <LeagueWincountrecordResponse>();

            response.Data = leagueWincountRecord;
            return(response);
        }
예제 #28
0
 public MessageCodeResponse StopHook(Guid managerId)
 {
     if (!IsExists(managerId))
     {
         return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.Success));
     }
     if (HookEnd(managerId, EnumHookStatus.Stop))
     {
         LadderCore.Instance.LeaveLadder(managerId);
         return(ResponseHelper.CreateSuccess <MessageCodeResponse>());
     }
     return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbUpdateFail));
 }
예제 #29
0
 /// <summary>
 /// Gets the full dailycup data by day.
 /// </summary>
 /// <param name="managerId">The manager.</param>
 /// <param name="dailycupId">The daily.</param>
 /// <returns></returns>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// </history>
 public DailycupFullDataResponse GetDailycupData(Guid managerId, int dailycupId, DateTime curTime)
 {
     try
     {
         DailycupInfoEntity dailycup = null;
         if (dailycupId == 0)
         {
             dailycup = DailycupInfoMgr.GetByDate(DateTime.Today);
             if (dailycup == null)
             {
                 return(ResponseHelper.Create <DailycupFullDataResponse>(MessageCode.DailycupNotExists));
             }
         }
         else
         {
             dailycup = DailycupInfoMgr.GetById(dailycupId);
         }
         if (dailycup == null)
         {
             return(ResponseHelper.InvalidParameter <DailycupFullDataResponse>());
         }
         if (dailycup.RunDate == DateTime.Today) //判断是否是当日杯赛,今天的杯赛是昨天创建
         {
             return(GetDailycupDataToday(managerId, dailycup, curTime));
         }
         else
         {
             //计算开始回合
             int beginRound = BeginRound(dailycup.Round);
             int endRound   = dailycup.Round;
             DailycupFullDataEntity dailycupData = new DailycupFullDataEntity();
             dailycupData.DailycupId = dailycup.Idx;
             GetDailycupData(dailycupData, managerId, beginRound, endRound);
             foreach (DailycupMatchEntity match in dailycupData.Matchs)
             {
                 match.Status = (int)EnumDailycupMatchStatus.ShowScore;
             }
             dailycupData.RoundType   = CalRoundType(endRound, beginRound);
             dailycupData.HasNext     = dailycup.RunDate < DateTime.Today.AddDays(1);
             dailycupData.AttendState = GetAttendState(managerId) ? 1 : 0;
             var response = ResponseHelper.CreateSuccess <DailycupFullDataResponse>();
             response.Data = dailycupData;
             return(response);
         }
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("GetDailycupData", ex);
         return(ResponseHelper.Create <DailycupFullDataResponse>(MessageCode.Exception));
     }
 }
예제 #30
0
        public Match_FightinfoResponse GetLeagueFightInfo(Guid matchId, Guid managerId)
        {
            LeagueEncounterEntity matchInfo = LeagueEncounterMgr.GetById(matchId);

            DicNpcEntity homeNpc = null;
            DicNpcEntity awayNpc = null;

            if (matchInfo.HomeIsNpc)
            {
                homeNpc = CacheFactory.NpcdicCache.GetNpc(matchInfo.HomeId);
            }
            if (matchInfo.AwayIsNpc)
            {
                awayNpc = CacheFactory.NpcdicCache.GetNpc(matchInfo.AwayId);
            }

            DTOBuffMemberView homeView, awayView;

            BuffDataCore.Instance().GetMembers(out homeView, out awayView,
                                               "", matchInfo.HomeId, matchInfo.HomeIsNpc, "", matchInfo.AwayId, matchInfo.AwayIsNpc, true, false);

            Match_FightManagerinfo home, away;

            if (matchInfo.HomeIsNpc)
            {
                home = MatchDataHelper.GetFightinfo(homeNpc, homeView);
            }
            else
            {
                home = MatchDataHelper.GetFightinfo(matchInfo.HomeId, false, homeView, "");
            }
            if (matchInfo.AwayIsNpc)
            {
                away = MatchDataHelper.GetFightinfo(awayNpc, awayView);
            }
            else
            {
                away = MatchDataHelper.GetFightinfo(matchInfo.AwayId, false, awayView, "");
            }
            if (home == null || away == null)
            {
                return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError));
            }

            var response = ResponseHelper.CreateSuccess <Match_FightinfoResponse>();

            response.Data      = new Match_Fightinfo();
            response.Data.Home = home;
            response.Data.Away = away;
            return(response);
        }