Example #1
0
        /// <inheritdoc />
        public void Load()
        {
            string expTablePath = GameResourcesConstants.Paths.ExpTablePath;

            if (!File.Exists(expTablePath))
            {
                _logger.LogWarning("Unable to load exp table. Reason: Cannot find '{0}' file.", expTablePath);
                return;
            }

            using (var expTableFile = new IncludeFile(expTablePath, @"([(){}=,;\n\r\t ])"))
            {
                var dropLuckBlock = expTableFile.GetBlock("expDropLuck");
                if (dropLuckBlock is null)
                {
                    _logger.LogWarning("Unable to load exp table. Reason: Cannot find drop luck data.");
                    return;
                }

                var expCharacterBlock = expTableFile.GetBlock("expCharacter");
                if (expCharacterBlock is null)
                {
                    _logger.LogWarning("Unable to load exp table. Reason: Cannot find character experience data.");
                    return;
                }

                IEnumerable <long[]> dropLuck = LoadDropLuck(dropLuckBlock);
                IReadOnlyDictionary <int, CharacterExpTableData> characterExperience = LoadCharacterExperience(expCharacterBlock);
                var expTableData = new ExpTableData(dropLuck, characterExperience);
                _cache.Set(GameResourcesConstants.ExpTables, expTableData);
            }

            _logger.LogInformation("-> Experience tables loaded.");
        }
Example #2
0
        /// <inheritdoc />
        public void Load()
        {
            if (!File.Exists(GameResources.ExpTablePath))
            {
                this._logger.LogWarning("Unable to load exp table. Reason: cannot find '{0}' file.", GameResources.ExpTablePath);
                return;
            }

            using (var expTableFile = new IncludeFile(GameResources.ExpTablePath, @"([(){}=,;\n\r\t ])"))
            {
                this.LoadDropLuck(expTableFile.GetBlock("expDropLuck"));
                this.LoadCharacterExperience(expTableFile.GetBlock("expCharacter"));
            }

            this._logger.LogInformation("-> Experience tables loaded.");
        }