Esempio n. 1
0
        private void MenuItemCheckNpc_Click(object sender, RoutedEventArgs e)
        {
            var allarenaNpc = ConfigArenanpclinkMgr.GetAll();

            foreach (var item in allarenaNpc)
            {
                var info = DicNpcMgr.GetById(item.NpcId);
                var data = NpcDataHelper.GetMemberView(info);
                item.Kpi = data.Kpi;
                ConfigArenanpclinkMgr.Update(item);
            }
        }
Esempio n. 2
0
        private void InitCache()
        {
            LogHelper.Insert("ArenaCache cache init start", LogType.Info);

            _arenaUpFormationAskFor = new Dictionary <int, ArenaUpFormationAskFor>();
            var arenaUpFormationAskFor =
                CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.ArenaUpFormationPlayer);

            if (arenaUpFormationAskFor.Length > 0)
            {
                var s = arenaUpFormationAskFor.Split('|');
                foreach (var s1 in s)
                {
                    var s2 = s1.Split(',');
                    _arenaUpFormationAskFor.Add(ConvertHelper.ConvertToInt(s2[0]),
                                                new ArenaUpFormationAskFor(ConvertHelper.ConvertToInt(s2[0]), ConvertHelper.ConvertToInt(s2[1]),
                                                                           s2[2].ToString()));
                }
            }

            arenaMaxStamina = CacheFactory.AppsettingCache.GetAppSettingToInt(EnumAppsetting.ArenaMaxStamina, 20);

            _allDangrading = ConfigArenadangradingMgr.GetAll();
            _dangradingDic = _allDangrading.ToDictionary(r => r.Idx, r => r);

            _npcDic = new Dictionary <int, List <ConfigArenanpclinkEntity> >();
            var allNpc         = ConfigArenanpclinkMgr.GetAll();
            var allNpcOpponent = ConfigArenanpcopponentMgr.GetAll();

            foreach (var item in allNpcOpponent)
            {
                var key = GetKey(item.Idx, item.Opponent);
                if (!_npcDic.ContainsKey(key))
                {
                    _npcDic.Add(key, new List <ConfigArenanpclinkEntity>());
                }
                var npcList = allNpc.FindAll(r => r.DanGrading == item.GroupId);
                _npcDic[key] = npcList;
            }
            //解析购买体力配置
            var buyStaminaConfig = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.ArenaBuyStaminaConfig);
            var configGroup      = buyStaminaConfig.Split('|');

            _buyStaminaDic = new Dictionary <int, int>();
            foreach (var s in configGroup)
            {
                var ss      = s.Split(',');
                var number  = ss[0].Split('^');
                int point   = ConvertHelper.ConvertToInt(ss[1]);
                int number1 = ConvertHelper.ConvertToInt(number[0]);
                int number2 = ConvertHelper.ConvertToInt(number[1]);
                for (int i = number1; i <= number2; i++)
                {
                    if (!_buyStaminaDic.ContainsKey(i))
                    {
                        _buyStaminaDic.Add(i, point);
                    }
                }
            }
            var arenaStaminaRestore = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.ArenaStaminaRestore);
            var restoreGroup        = arenaStaminaRestore.Split('|');

            _staminaRestoreDic = new Dictionary <int, int>();
            foreach (var s in restoreGroup)
            {
                var value    = s.Split(',');
                var vipLevel = ConvertHelper.ConvertToInt(value[0]);
                var times    = ConvertHelper.ConvertToInt(value[1]);
                if (!_staminaRestoreDic.ContainsKey(vipLevel))
                {
                    _staminaRestoreDic.Add(vipLevel, times);
                }
            }

            //获取所有奖励
            _prizeDic = new Dictionary <int, List <ConfigArenaprizeEntity> >();
            var allPrize = ConfigArenaprizeMgr.GetAll();

            foreach (var item in allPrize)
            {
                for (int i = item.StartRank; i <= item.EndRank; i++)
                {
                    if (!_prizeDic.ContainsKey(i))
                    {
                        _prizeDic.Add(i, new List <ConfigArenaprizeEntity>());
                    }
                    _prizeDic[i].Add(item);
                }
            }

            _shopList = ConfigArenashopMgr.GetAll();

            //刷新商店配置
            _arenaRefreshShop = new Dictionary <int, int>();
            var arenaRefreshShop = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.ArenaRefreshShop);
            var shopConfig       = arenaRefreshShop.Split('|');

            foreach (var item in shopConfig)
            {
                var points = item.Split(',');
                var number = ConvertHelper.ConvertToInt(points[0]);
                var point  = ConvertHelper.ConvertToInt(points[1]);
                _arenaRefreshShop.Add(number, point);
            }


            var allZoneInfo = CacheFactory.ZoneCache.GetAllZone();

            _siteDic   = new Dictionary <string, EnumArenaDomainType>();
            _domainDic = new Dictionary <EnumArenaDomainType, List <string> >();
            _domainDic.Add(EnumArenaDomainType.Small, new List <string>());
            _domainDic.Add(EnumArenaDomainType.Big, new List <string>());
            _domainDic.Add(EnumArenaDomainType.Alone, new List <string>());
            foreach (var item in allZoneInfo)
            {
                int platzoneId = ConvertHelper.ConvertToInt(item.PlatformZoneName);
                //1和2放到大混服
                if (platzoneId == 1 || platzoneId == 2)
                {
                    if (!_siteDic.ContainsKey(item.ZoneName))
                    {
                        _siteDic.Add(item.ZoneName, EnumArenaDomainType.Big);
                    }
                    _domainDic[EnumArenaDomainType.Big].Add(item.ZoneName);
                }
                else if (platzoneId < 1000)//小混服
                {
                    if (!_siteDic.ContainsKey(item.ZoneName))
                    {
                        _siteDic.Add(item.ZoneName, EnumArenaDomainType.Small);
                    }
                    _domainDic[EnumArenaDomainType.Small].Add(item.ZoneName);
                }
                else if (platzoneId > 10000) //大混服
                {
                    if (!_siteDic.ContainsKey(item.ZoneName))
                    {
                        _siteDic.Add(item.ZoneName, EnumArenaDomainType.Big);
                    }
                    _domainDic[EnumArenaDomainType.Big].Add(item.ZoneName);
                }
                else//独服
                {
                    if (!_siteDic.ContainsKey(item.ZoneName))
                    {
                        _siteDic.Add(item.ZoneName, EnumArenaDomainType.Alone);
                    }
                    _domainDic[EnumArenaDomainType.Alone].Add(item.ZoneName);
                }
            }

            LogHelper.Insert("ArenaCache cache init end", LogType.Info);
        }