private IPPather GetPather(Microsoft.Extensions.Logging.ILogger logger, DataConfig dataConfig)
        {
            var scp = new StartupConfigPathing();

            Configuration.GetSection(StartupConfigPathing.Position).Bind(scp);

            bool failed = false;

            if (scp.Type == StartupConfigPathing.Types.RemoteV3)
            {
                var worldmapAreaDb = new WorldMapAreaDB(logger, dataConfig);
                var api            = new RemotePathingAPIV3(logger, scp.hostv3, scp.portv3, worldmapAreaDb);
                if (api.PingServer().Result)
                {
                    Log.Information("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                    Log.Debug($"Using {StartupConfigPathing.Types.RemoteV3}({api.GetType().Name}) {scp.hostv3}:{scp.portv3}");
                    Log.Information("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                    return(api);
                }

                api.RequestDisconnect();
                failed = true;
            }

            if (scp.Type == StartupConfigPathing.Types.RemoteV1 || failed)
            {
                var api = new RemotePathingAPI(logger, scp.hostv1, scp.portv1);
                if (api.PingServer().Result)
                {
                    Log.Information("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");

                    if (scp.Type == StartupConfigPathing.Types.RemoteV3)
                    {
                        Log.Debug($"Unavailable {StartupConfigPathing.Types.RemoteV3} {scp.hostv3}:{scp.portv3} - Fallback to {StartupConfigPathing.Types.RemoteV1}");
                    }

                    Log.Debug($"Using {StartupConfigPathing.Types.RemoteV1}({api.GetType().Name}) {scp.hostv1}:{scp.portv1}");
                    Log.Information("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                    return(api);
                }

                failed = true;
            }

            Log.Information("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
            if (scp.Type != StartupConfigPathing.Types.Local)
            {
                Log.Debug($"{scp.Type} not available!");
            }
            Log.Information("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");

            var pathingService = new PPatherService(LogWrite, dataConfig);
            var localApi       = new LocalPathingApi(logger, pathingService);

            localApi.SelfTest();
            Log.Information($"Using {StartupConfigPathing.Types.Local}({localApi.GetType().Name}) pathing API.");
            Log.Information("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
            return(localApi);
        }
        public RemotePathingAPIV3(ILogger logger, string ip, int port, WorldMapAreaDB worldMapAreaDB)
        {
            this.logger         = logger;
            this.worldMapAreaDB = worldMapAreaDB;

            Client             = new AnTcpClient(ip, port);
            ConnectionWatchdog = new Thread(ObserveConnection);
            ConnectionWatchdog.Start();
        }
        public AddonReader(ILogger logger, DataConfig dataConfig, AreaDB areaDb, IAddonDataProvider addonDataProvider)
        {
            this.logger            = logger;
            this.addonDataProvider = addonDataProvider;

            this.squareReader = new SquareReader(this);

            this.itemDb     = new ItemDB(logger, dataConfig);
            this.creatureDb = new CreatureDB(logger, dataConfig);

            this.BagReader       = new BagReader(squareReader, 20, itemDb);
            this.equipmentReader = new EquipmentReader(squareReader, 30);
            this.PlayerReader    = new PlayerReader(squareReader, creatureDb);
            this.LevelTracker    = new LevelTracker(PlayerReader);

            this.areaDb         = areaDb;
            this.worldMapAreaDb = new WorldMapAreaDB(logger, dataConfig);
        }
Example #4
0
        public void InitDBs(AssetBundle nonLocalizedBundle, AssetBundle localizedBundle)
        {
            if (StaticDB.s_initialized)
            {
                Debug.Log("WARNING! ATTEMPTED TO INIT STATIC DBS THAT WERE ALREADY INITIALIZED!! IGNORING");
                return;
            }
            string str    = "Assets/BundleAssets/StaticDB/";
            string locale = Main.instance.GetLocale();

            this.m_azeriteEmpoweredItemDB = new AzeriteEmpoweredItemDB();
            if (!this.m_azeriteEmpoweredItemDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load AzeriteEmpoweredItem static DB");
            }
            this.m_charShipmentDB = new CharShipmentDB();
            if (!this.m_charShipmentDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load charShipmentDB static DB");
            }
            this.m_charShipmentContainerDB = new CharShipmentContainerDB();
            if (!this.m_charShipmentContainerDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load charShipmentContainerDB static DB");
            }
            this.m_chrClassesDB = new ChrClassesDB();
            if (!this.m_chrClassesDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load chrClasses static DB");
            }
            this.m_communityIconDB = new CommunityIconDB();
            if (!this.m_communityIconDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load CommunityIcon static DB");
            }
            this.m_creatureDB = new CreatureDB();
            if (!this.m_creatureDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load creature static DB");
            }
            this.m_currencyTypesDB = new CurrencyTypesDB();
            if (!this.m_currencyTypesDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load currencyTypes static DB");
            }
            this.m_currencyContainerDB = new CurrencyContainerDB();
            if (!this.m_currencyContainerDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load currencyContainer static DB");
            }
            this.m_factionDB = new FactionDB();
            if (!this.m_factionDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load faction static DB");
            }
            this.m_garrAbilityDB = new GarrAbilityDB();
            if (!this.m_garrAbilityDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrAbility static DB");
            }
            this.m_garrAbilityCategoryDB = new GarrAbilityCategoryDB();
            if (!this.m_garrAbilityCategoryDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrAbilityCategory static DB");
            }
            this.m_garrAbilityEffectDB = new GarrAbilityEffectDB();
            if (!this.m_garrAbilityEffectDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrAbilityEffect static DB");
            }
            this.m_garrClassSpecDB = new GarrClassSpecDB();
            if (!this.m_garrClassSpecDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrClassSpec static DB");
            }
            this.m_garrEncounterDB = new GarrEncounterDB();
            if (!this.m_garrEncounterDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrEncounter static DB");
            }
            this.m_garrEncounterSetXEncounterDB = new GarrEncounterSetXEncounterDB();
            if (!this.m_garrEncounterSetXEncounterDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrEncounterSetXEncounterDB static DB");
            }
            this.m_garrFollItemSetMemberDB = new GarrFollItemSetMemberDB();
            if (!this.m_garrFollItemSetMemberDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrFollItemSetMember static DB");
            }
            this.m_garrFollowerDB = new GarrFollowerDB();
            if (!this.m_garrFollowerDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrFollower static DB");
            }
            this.m_garrFollowerLevelXPDB = new GarrFollowerLevelXPDB();
            if (!this.m_garrFollowerLevelXPDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrFollowerLevelXP static DB");
            }
            this.m_garrFollowerTypeDB = new GarrFollowerTypeDB();
            if (!this.m_garrFollowerTypeDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load m_garrFollowerType static DB");
            }
            this.m_garrFollowerQualityDB = new GarrFollowerQualityDB();
            if (!this.m_garrFollowerQualityDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load m_garrFollowerQuality static DB");
            }
            this.m_garrFollowerXAbilityDB = new GarrFollowerXAbilityDB();
            if (!this.m_garrFollowerXAbilityDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load m_garrFollowerXAbilty static DB");
            }
            this.m_garrMechanicDB = new GarrMechanicDB();
            if (!this.m_garrMechanicDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrMechanic static DB");
            }
            this.m_garrMechanicTypeDB = new GarrMechanicTypeDB();
            if (!this.m_garrMechanicTypeDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrMechanicType static DB");
            }
            this.m_garrMissionDB = new GarrMissionDB();
            if (!this.m_garrMissionDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrMission static DB");
            }
            this.m_garrMissionRewardDB = new GarrMissionRewardDB();
            if (!this.m_garrMissionRewardDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrMissionReward static DB");
            }
            this.m_garrMissionTypeDB = new GarrMissionTypeDB();
            if (!this.m_garrMissionTypeDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrMissionType static DB");
            }
            this.m_garrMissionXEncounterDB = new GarrMissionXEncounterDB();
            if (!this.m_garrMissionXEncounterDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrMissionXEncounter static DB");
            }
            this.m_garrStringDB = new GarrStringDB();
            if (!this.m_garrStringDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrStringDB static DB");
            }
            this.m_garrTalentDB = new GarrTalentDB();
            if (!this.m_garrTalentDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrTalent static DB");
            }
            this.m_garrTalentTreeDB = new GarrTalentTreeDB();
            if (!this.m_garrTalentTreeDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load garrTalentTree static DB");
            }
            this.m_itemDB = new ItemDB();
            if (!this.m_itemDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load item static DB");
            }
            this.m_itemSubClassDB = new ItemSubClassDB();
            if (!this.m_itemSubClassDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load item sub class static DB");
            }
            this.m_itemEffectDB = new ItemEffectDB();
            if (!this.m_itemEffectDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load item effect static DB");
            }
            this.m_itemNameDescriptionDB = new ItemNameDescriptionDB();
            if (!this.m_itemNameDescriptionDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load item name description DB");
            }
            this.m_mobileStringsDB = new MobileStringsDB();
            if (!this.m_mobileStringsDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load MobileStrings static DB");
            }
            this.m_questDB = new QuestV2DB();
            if (!this.m_questDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load Quest static DB");
            }
            this.m_questInfoDB = new QuestInfoDB();
            if (!this.m_questInfoDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load QuestInfo static DB");
            }
            this.m_spellEffectDB = new SpellEffectDB();
            if (!this.m_spellEffectDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load SpellEffect static DB");
            }
            this.m_spellTooltipDB = new SpellTooltipDB();
            if (!this.m_spellTooltipDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load SpellTooltip static DB");
            }
            this.m_vw_mobileSpellDB = new VW_MobileSpellDB();
            if (!this.m_vw_mobileSpellDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load VW_MobileSpellDB static DB");
            }
            this.m_uiTextureAtlasMemberDB = new UiTextureAtlasMemberDB();
            if (!this.m_uiTextureAtlasMemberDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load uiTextureAtlasMember static DB");
            }
            this.m_uiTextureAtlasDB = new UiTextureAtlasDB();
            if (!this.m_uiTextureAtlasDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load uiTextureAtlas static DB");
            }
            this.m_uiTextureKitDB = new UiTextureKitDB();
            if (!this.m_uiTextureKitDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load uiTextureKit static DB");
            }
            this.m_worldMapAreaDB = new WorldMapAreaDB();
            if (!this.m_worldMapAreaDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load worldMapArea static DB");
            }
            this.m_rewardPackDB = new RewardPackDB();
            if (!this.m_rewardPackDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load rewardPack static DB");
            }
            this.m_rewardPackXItemDB = new RewardPackXItemDB();
            if (!this.m_rewardPackXItemDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load rewardPackXItem static DB");
            }
            this.m_rewardPackXCurrencyTypeDB = new RewardPackXCurrencyTypeDB();
            if (!this.m_rewardPackXCurrencyTypeDB.Load(str, nonLocalizedBundle, localizedBundle, locale))
            {
                Debug.Log("Failed to load rewardPackXCurrencyType static DB");
            }
            if (localizedBundle != null)
            {
                localizedBundle.Unload(true);
            }
            if (nonLocalizedBundle != null)
            {
                nonLocalizedBundle.Unload(true);
            }
            StaticDB.s_initialized = true;
        }