Пример #1
0
        public IDictionary <Maps, MapInfo> GetMaps()
        {
            var cache = _cache.Get <IDictionary <Maps, MapInfo> >("Maps");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_Maps));
                cache = _loader.LoadMaps().ToDictionary(x => (Maps)x.Map);
                _cache.Set("Maps", cache);
            }

            return(cache);
        }
Пример #2
0
        public IDictionary <HeroClass, CharacterInfo> GetDefChar()
        {
            var cache = _cache.Get <IDictionary <HeroClass, CharacterInfo> >("DefClass");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_DefClass));
                cache = _loader.LoadDefCharacter().ToDictionary(x => x.Class);
                _cache.Set("DefClass", cache);
            }

            return(cache);
        }
Пример #3
0
        public IDictionary <ushort, ItemInfo> GetItems()
        {
            var cache = _cache.Get <IDictionary <ushort, ItemInfo> >("Items");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_Items));
                cache = _loader.LoadItems().ToDictionary(x => x.Number);
                _cache.Set("Items", cache);
            }

            return(cache);
        }
Пример #4
0
        public IDictionary <Spell, SpellInfo> GetSkills()
        {
            var cache = _cache.Get <IDictionary <Spell, SpellInfo> >("Spells");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_Spells));
                cache = _loader.LoadSkills().ToDictionary(x => x.Number);
                _cache.Set("Spells", cache);
            }

            return(cache);
        }
Пример #5
0
        public Storage GetPCPointShop()
        {
            var cache = _cache.Get <Storage>("PCPoint");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_Shops));
                cache = _loader.LoadPCPointShop();
                _cache.Set("PCPoint", cache);
            }

            return(cache);
        }
Пример #6
0
        public ChaosMixInfo GetChaosMixInfo()
        {
            var cache = _cache.Get <ChaosMixInfo>("ChaosMix");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_ChaosMixs));
                cache = _loader.LoadChaosBox();
                _cache.Set("ChaosMix", cache);
            }

            return(cache);
        }
Пример #7
0
        public IDictionary <int, QuestInfo> GetQuests()
        {
            var cache = _cache.Get <IDictionary <int, QuestInfo> >("Quests");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_Quests));
                cache = _loader.LoadQuests().ToDictionary(x => x.Index);
                _cache.Set("Quests", cache);
            }

            return(cache);
        }
Пример #8
0
        public IDictionary <int, Gate> GetGates()
        {
            var cache = _cache.Get <IDictionary <int, Gate> >("Gates");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_Gates));
                cache = _loader.LoadGates().ToDictionary(x => x.Number);
                _cache.Set("Gates", cache);
            }

            return(cache);
        }
Пример #9
0
        public JOHDto GetJOH()
        {
            var cache = _cache.Get <JOHDto>("JOH");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_JoHs));
                cache = _loader.LoadJOH();//.ToDictionary(x => (byte)(x.Type << 4 | x.Index));
                _cache.Set("JOH", cache);
            }

            return(cache);
        }
Пример #10
0
        public IDictionary <ushort, NPCInfo> GetNPCs()
        {
            var cache = _cache.Get <IDictionary <ushort, NPCInfo> >("NPCs");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_NPCs));
                cache = _loader.LoadNPCs().ToDictionary(x => x.NPC);
                _cache.Set("NPCs", cache);
            }

            return(cache);
        }
Пример #11
0
        public IDictionary <ushort, ShopInfo> GetShops()
        {
            var cache = _cache.Get <IDictionary <ushort, ShopInfo> >("Shops");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_Shops));
                cache = _loader.LoadShops().ToDictionary(x => x.Shop);
                _cache.Set("Shops", cache);
            }

            return(cache);
        }
Пример #12
0
        public IEnumerable <Bag> GetItemBags()
        {
            var cache = _cache.Get <IEnumerable <Bag> >("ItemBags");

            if (cache == null)
            {
                Logger.Information(ServerMessages.GetMessage(Messages.RCache_Loading_ItemBags));
                cache = _loader.LoadItembags();
                cache.ToList();
                _cache.Set("ItemBags", cache);
            }

            return(cache);
        }
Пример #13
0
        public static void Initialize(string root)
        {
            if (Instance != null)
            {
                throw new Exception(ServerMessages.GetMessage(Messages.RCache_Initialized));
            }

            Instance = new ResourceCache(root);

            Instance.GetItems();
            Instance.GetSkills();
            Instance.GetMaps();
            Instance.GetDefChar();
            Instance.GetShops();
            Instance.GetNPCs();
            Instance.GetJOH();
            Instance.GetGates();
            Instance.GetQuests();
            Instance.GetChaosMixInfo();
            Instance.GetItemBags();
            Instance.GetPCPointShop();
        }