コード例 #1
0
ファイル: MatchDataHelper.cs プロジェクト: cool8868/H5Nball
        public static List <NBSolutionTeammember> GetSolutionTeammembers(Guid managerId, bool onlyMain = false, bool withHire = true, string siteId = "")
        {
            var buffView = BuffDataCore.Instance().GetMembers(managerId, true, siteId);

            if (buffView == null)
            {
                return(null);
            }
            return(GetSolutionTeammembers(managerId, buffView, onlyMain, withHire, siteId));
        }
コード例 #2
0
ファイル: MatchDataHelper.cs プロジェクト: cool8868/H5Nball
        public static int GetManagerKpi(Guid managerId, string siteId = "")
        {
            var buffView = BuffDataCore.Instance().GetMembers(managerId, true, siteId);

            if (buffView != null)
            {
                return(buffView.Kpi);
            }
            return(0);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: cool8868/H5Nball
        static void Main(string[] args)
        {
            Console.WriteLine("start.");
            Guid mid  = new Guid("5F8BEB96-6110-4C92-AD35-A60E013147B1");
            var  data = BuffDataCore.Instance().GetMembers(mid);

            data.Kpi.GetHashCode();
            ScoutingLoopTest();
            Console.WriteLine("end.");
            Console.ReadLine();
        }
コード例 #4
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);
        }
コード例 #5
0
        /// <summary>
        /// 获取射门属性最搞的球员属性
        /// </summary>
        /// <param name="managerId"></param>
        /// <returns></returns>
        int GetShooterId(Guid managerId)
        {
            int shootProp = 0;
            var buffView  = BuffDataCore.Instance().GetMembers(managerId);

            foreach (var item in buffView.BuffMembers.Values)
            {
                if (shootProp >= item.TotalShoot)
                {
                    continue;
                }
                shootProp = (int)item.TotalShoot;
            }
            return(shootProp);
        }
コード例 #6
0
ファイル: KpiHandler.cs プロジェクト: cool8868/H5Nball
 void doRebuildKpi(Guid managerId)
 {
     try
     {
         var buffView = BuffDataCore.Instance().RebuildMembers(managerId);
         if (buffView != null)
         {
             // ChatHelper.SendUpdateKpi(managerId, buffView.Kpi);
             MatchDataHelper.UpdateManagerKpi(managerId, buffView.Kpi);
         }
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("doRebuildKpi", ex);
     }
 }
コード例 #7
0
ファイル: MatchDataHelper.cs プロジェクト: cool8868/H5Nball
        /// <summary>
        /// 序列化球员卡和装备
        /// </summary>
        /// <param name="managerId"></param>
        /// <returns></returns>
        public static List <TeammemberEntity> GetTeammembers(Guid managerId, DTOBuffMemberView buffView = null, bool withHire = false, string siteId = "")
        {
            if (null == buffView)
            {
                buffView = BuffDataCore.Instance().GetMembers(managerId, true, siteId);
            }
            var members = GetRawMembers4View(managerId, buffView, withHire, siteId);

            if (members != null)
            {
                foreach (var entity in members)
                {
                    BuildTeammemberProperty(entity, buffView);
                }
            }
            return(members);
        }
コード例 #8
0
 public static ManagerInput BuildTransferManager(MatchManagerInfo managerInfo, bool isGuide = false, DTOBuffMemberView buffView = null, string siteId = "")
 {
     try
     {
         if (managerInfo.IsNpc)
         {
             return(GetTransferNpc(managerInfo));
         }
         if (null == buffView)
         {
             buffView = BuffDataCore.Instance().GetMembers(managerInfo.ManagerId, true, siteId);
         }
         return(CreateTransferManager(managerInfo, buffView, isGuide, siteId));
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("BuildTransferManager", ex);
         throw;
     }
 }
コード例 #9
0
        public Match_FightinfoResponse GetFightInfoWithoutNpc(Guid managerId, Guid awayId, bool isHomeBot, bool isAwayBot, bool syncAwayFlag = false, string homeSiteId = "", string awaySiteId = "")
        {
            DTOBuffMemberView homeView, awayView;

            BuffDataCore.Instance().GetMembers(out homeView, out awayView,
                                               homeSiteId, managerId, false, awaySiteId, awayId, false, true, syncAwayFlag);
            Match_FightManagerinfo home = MatchDataHelper.GetFightinfo(managerId, isHomeBot, homeView, homeSiteId);
            Match_FightManagerinfo 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);
        }
コード例 #10
0
        public static DTOBuffMemberView GetMemberView(DicNpcEntity npcEntity)
        {
            if (npcEntity.Type == 1 || npcEntity.Type == 2 || npcEntity.Type == 3 || npcEntity.Type == 4 || npcEntity.Type == 5 || npcEntity.Type == 6)//球星启示录计算真实kpi
            {
                npcEntity.KpiBuff = npcEntity.Buff;
                npcEntity.Buff    = 100;// npcEntity.Buff;
            }
            else
            {
                npcEntity.KpiBuff = 100;
            }
            var data = new DTOBuffMemberView();
            //TODO: CombLevel

            var managerSBMList = new List <string>();
            //套装字典 套装id->数量
            var suitDic = new Dictionary <int, List <int> >();
            //套装id->套装类型
            var suitTypeDic      = new Dictionary <int, int>();
            var formationDetails = CacheFactory.FormationCache.GetFormationDetail(npcEntity.FormationId);
            int i = 0;

            var buffPlayers = new Dictionary <Guid, DTOBuffPlayer>(PLAERCOUNT);

            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP1, npcEntity.TE1, npcEntity.TS1, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP2, npcEntity.TE2, npcEntity.TS2, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP3, npcEntity.TE3, npcEntity.TS3, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP4, npcEntity.TE4, npcEntity.TS4, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP5, npcEntity.TE5, npcEntity.TS5, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP6, npcEntity.TE6, npcEntity.TS6, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            buffPlayers.Add(Guid.NewGuid(), BuildPlayer(npcEntity, npcEntity.TP7, npcEntity.TE7, npcEntity.TS7, formationDetails[i++].Position, npcEntity.KpiBuff, ref suitDic, ref suitTypeDic));
            //套装
            TeammemberDataHelper.FillSuitData(suitDic, suitTypeDic, ref managerSBMList);
            //阵型加成
            TeammemberDataHelper.FillFormationData(npcEntity.FormationId, npcEntity.FormationLevel, ref managerSBMList);
            //TODO:球员组合
            BuffDataCore.Instance().FillBuffView(data, buffPlayers, true, 1, npcEntity.FormationId);
            data.BuffPlayers = buffPlayers;
            return(data);
        }
コード例 #11
0
        public static PlayerInput BuildPlayerInputForGuide(int playerId, int strength, string skillCode)
        {
            var         player      = BuffDataCore.Instance().BuildBuffPlayerForGuide(playerId, strength);
            var         cachePlayer = CacheFactory.PlayersdicCache.GetPlayer(playerId);
            PlayerInput dstData     = new PlayerInput();

            dstData.FamilyName = cachePlayer.Name;
            dstData.Pid        = playerId;
            dstData.Plus       = (byte)strength;
            dstData.Skills     = new List <string>(2);
            if (!String.IsNullOrEmpty(skillCode))
            {
                dstData.Skills.Add(skillCode);
            }
            if (!String.IsNullOrEmpty(player.StarSkill))
            {
                dstData.Skills.Add(player.StarSkill);
            }
            var props = player.Props;
            int i     = 0;

            dstData.Speed        = props[i++].TotalValue + 200;
            dstData.Shooting     = props[i++].TotalValue + 200;
            dstData.FreeKick     = props[i++].TotalValue + 200;
            dstData.Balance      = props[i++].TotalValue + 200;
            dstData.Stamina      = props[i++].TotalValue + 200;
            dstData.Strength     = props[i++].TotalValue + 200;
            dstData.Aggression   = props[i++].TotalValue + 200;
            dstData.Disturb      = props[i++].TotalValue + 200;
            dstData.Interception = props[i++].TotalValue + 200;
            dstData.Dribble      = props[i++].TotalValue + 200;
            dstData.Passing      = props[i++].TotalValue + 200;
            dstData.Mentality    = props[i++].TotalValue + 200;
            dstData.Reflexes     = props[i++].TotalValue + 200;
            dstData.Positioning  = props[i++].TotalValue + 200;
            dstData.Handling     = props[i++].TotalValue + 200;
            dstData.Acceleration = props[i].TotalValue + 200;
            return(dstData);
        }
コード例 #12
0
        public static MatchInput BuildTransferMatch(BaseMatchData matchData)
        {
            MatchInput match = new MatchInput();

            match.MatchId   = matchData.MatchId;
            match.MatchType = matchData.MatchType;
            match.TranTime  = 120;
            if (matchData.IsGuide)
            {
                matchData.Home.BuffScale = 400;
                // match.ForceType = EnumForceWinType.HomeWin;
            }
            else if (matchData.NoDraw)
            {
                match.ForceType = EnumForceWinType.NoDraw;
            }
            bool   isHomeNpc  = matchData.Home.IsNpc;
            bool   isAwayNpc  = matchData.Away.IsNpc;
            string homeSiteId = matchData.Home.ZoneName;
            string awaySiteId = matchData.Away.ZoneName;

            if (isHomeNpc || isAwayNpc)
            {
                if (matchData.MatchType == (int)EnumMatchType.Arena)
                {
                    ArenaTeammemberFrame homeFrame = null;
                    ArenaTeammemberFrame awayFrame = null;
                    if (!isHomeNpc)
                    {
                        homeFrame = new ArenaTeammemberFrame(matchData.Home.ManagerId, (EnumArenaType)matchData.Home.ArenaType, homeSiteId);
                    }
                    if (!isAwayNpc)
                    {
                        awayFrame = new ArenaTeammemberFrame(matchData.Away.ManagerId, (EnumArenaType)matchData.Away.ArenaType, awaySiteId);
                    }

                    match.HomeManager = BuildTransferManagerArena(matchData.Home, homeFrame, matchData.IsGuide, null, homeSiteId);
                    match.AwayManager = BuildTransferManagerArena(matchData.Away, awayFrame, false, null, awaySiteId);
                }
                else
                {
                    match.HomeManager = BuildTransferManager(matchData.Home, matchData.IsGuide, null, homeSiteId);
                    match.AwayManager = BuildTransferManager(matchData.Away, false, null, awaySiteId);
                }
                return(match);
            }
            DTOBuffMemberView homeView, awayView;

            if (matchData.MatchType == (int)EnumMatchType.Arena)
            {
                ArenaTeammemberFrame homeFrame = new ArenaTeammemberFrame(matchData.Home.ManagerId, (EnumArenaType)matchData.Home.ArenaType, homeSiteId);
                ArenaTeammemberFrame awayFrame = new ArenaTeammemberFrame(matchData.Away.ManagerId, (EnumArenaType)matchData.Away.ArenaType, awaySiteId);
                ArenaBuffDataCore.Instance().GetMembers(out homeView, out awayView, homeSiteId, matchData.Home.ManagerId, isHomeNpc, awaySiteId,
                                                        matchData.Away.ManagerId, homeFrame, awayFrame, isAwayNpc, true, false);
                match.HomeManager = BuildTransferManagerArena(matchData.Home, homeFrame, matchData.IsGuide, homeView, homeSiteId);
                match.AwayManager = BuildTransferManagerArena(matchData.Away, awayFrame, false, awayView, awaySiteId);
            }
            else
            {
                BuffDataCore.Instance().GetMembers(out homeView, out awayView,
                                                   homeSiteId, matchData.Home.ManagerId, isHomeNpc,
                                                   awaySiteId, matchData.Away.ManagerId, isAwayNpc, true, false);
                match.HomeManager = BuildTransferManager(matchData.Home, matchData.IsGuide, homeView, homeSiteId);
                match.AwayManager = BuildTransferManager(matchData.Away, false, awayView, awaySiteId);
            }
            return(match);
        }
コード例 #13
0
        public static DTOBuffMemberView GetMemberView(LocalTransferManagerEntity localManager)
        {
            var data = new DTOBuffMemberView();
            //TODO: CombLevel

            var managerSBMList = new List <string>();
            //套装字典 套装id->数量
            var suitDic = new Dictionary <int, int>();
            //套装id->套装类型
            var suitTypeDic = new Dictionary <int, int>();

            var buffPlayers = new Dictionary <Guid, DTOBuffPlayer>(PLAERCOUNT);

            foreach (var playerEntity in localManager.Players)
            {
                buffPlayers.Add(Guid.NewGuid(), BuildPlayer(playerEntity));
            }

            //套装
            //TeammemberDataHelper.FillSuitData(suitDic, suitTypeDic, ref managerSBMList);
            //阵型加成
            TeammemberDataHelper.FillFormationData(localManager.FormationId, localManager.FormationLevel, ref managerSBMList);
            //天赋意志处理
            var skills = new List <string>();

            string[] subSkills = new string[2];
            //天赋
            if (localManager.TalentId > 0)
            {
                var localTalent = LocalHelper.TalentList.Talents.Find(d => d.Id == localManager.TalentId);
                if (localTalent != null)
                {
                    string            talent    = string.Empty;
                    LocalTalentEntity talentCfg = null;
                    int len = 0;
                    foreach (var talentdata in localTalent.Talentdatas)
                    {
                        talent    = talentdata.Id;
                        talentCfg = LocalHelper.LocalCache.Talents.Find(i => i.Id == talent);
                        if (null == talentCfg)
                        {
                            continue;
                        }
                        if (talentCfg.DriveType == 0 || len >= 2)
                        {
                            skills.Add(talent);
                        }
                        else
                        {
                            subSkills[len++] = talent;
                        }
                    }
                }
            }
            //意志 组合
            if (localManager.WillId > 0)
            {
                var localWill = LocalHelper.WillList.Wills.Find(d => d.Id == localManager.WillId);
                if (localWill != null)
                {
                    foreach (var willdata in localWill.Willdatas)
                    {
                        skills.Add(willdata.Id);
                    }
                }
            }
            //套装效果
            if (localManager.SuitId > 0)
            {
                var locaSuit = LocalHelper.SuitList.Suits.Find(d => d.Id == localManager.SuitId);
                if (locaSuit != null)
                {
                    foreach (var suitdata in locaSuit.Suitdatas)
                    {
                        skills.Add(suitdata.Id.ToString());
                    }
                }
            }
            var rankSkills = BuffCache.Instance().GetRankedSkillList(skills);

            foreach (var item in skills)
            {
                if (item.Substring(0, 1).ToUpper() == "H")
                {
                    rankSkills[1].Add(item);
                }
            }
            var        buffPack = new DTOBuffPack();
            const bool homeFlag = true;

            buffPack.SetBuffPlayers(homeFlag, buffPlayers);
            buffPack.SetOnBuffPlayers(homeFlag, buffPlayers.Values.ToList());
            BuffFlowFacade.ProcManagerBuff(buffPack, homeFlag, rankSkills[2], false);
            data.ReadySkillList = rankSkills[0];
            data.LiveSkillList  = rankSkills[1];
            data.SubSkills      = subSkills;
            BuffDataCore.Instance().FillBuffView(data, buffPlayers, true, 1);
            //TODO:球员组合
            //DTOBuffPlayer player = null;
            //foreach (var member in data.BuffMembers.Values)
            //{
            //    if (!buffPlayers.TryGetValue(member.Tid, out player))
            //        continue;
            //    if (string.IsNullOrEmpty(player.StarSkill))
            //        continue;
            //    if (null == member.LiveSkillList)
            //        member.LiveSkillList = new List<string>();
            //    member.LiveSkillList.Add(player.StarSkill);
            //}
            return(data);
        }