forked from nt153133/__LlamaLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResourceManager.cs
47 lines (42 loc) · 2.87 KB
/
ResourceManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using ff14bot.Enums;
using LlamaLibrary.Helpers.Housing;
using LlamaLibrary.JsonObjects;
using LlamaLibrary.Properties;
using LlamaLibrary.Retainers;
using Newtonsoft.Json;
namespace LlamaLibrary
{
public static class ResourceManager
{
public static readonly Lazy<Dictionary<int, List<MateriaItem>>> MateriaList;
public static readonly Lazy<SortedDictionary<int, StoredHuntLocation>> DailyHunts;
public static readonly Lazy<List<RetainerTaskData>> VentureData;
public static readonly Lazy<List<CustomDeliveryNpc>> CustomDeliveryNpcs;
public static readonly Dictionary<HousingZone, Lazy<Dictionary<int, RecordedPlot>>> HousingPlots;
public static readonly Dictionary<GrandCompany, List<GCShopItemStored>> GCShopItems;
public static readonly Dictionary<uint, List<StoredRecipe>> Recipes_Anden;
static ResourceManager()
{
VentureData = new Lazy<List<RetainerTaskData>>(() => LoadResource<List<RetainerTaskData>>(Resources.Ventures));
MateriaList = new Lazy<Dictionary<int, List<MateriaItem>>>(() => LoadResource<Dictionary<int, List<MateriaItem>>>(Resources.Materia));
DailyHunts = new Lazy<SortedDictionary<int, StoredHuntLocation>>(() => LoadResource<SortedDictionary<int, StoredHuntLocation>>(Resources.AllHunts));
CustomDeliveryNpcs = new Lazy<List<CustomDeliveryNpc>>(() => LoadResource<List<CustomDeliveryNpc>>(Resources.CustomDeliveryNpcs));
GCShopItems = new Lazy<Dictionary<GrandCompany, List<GCShopItemStored>>>(() => LoadResource<Dictionary<GrandCompany, List<GCShopItemStored>>>(Resources.GCShopItems)).Value;
Recipes_Anden = new Lazy<Dictionary<uint, List<StoredRecipe>>>(() => LoadResource<Dictionary<uint, List<StoredRecipe>>>(Resources.Recipes_Anden)).Value;
HousingPlots = new Dictionary<HousingZone, Lazy<Dictionary<int, RecordedPlot>>>
{
{ HousingZone.Mist, new Lazy<Dictionary<int, RecordedPlot>>(() => LoadResource<Dictionary<int, RecordedPlot>>(Resources.MistPlots)) },
{ HousingZone.Goblet, new Lazy<Dictionary<int, RecordedPlot>>(() => LoadResource<Dictionary<int, RecordedPlot>>(Resources.GobletPlots)) },
{ HousingZone.LavenderBeds, new Lazy<Dictionary<int, RecordedPlot>>(() => LoadResource<Dictionary<int, RecordedPlot>>(Resources.LavenderBedsPlots)) },
{ HousingZone.Shirogane, new Lazy<Dictionary<int, RecordedPlot>>(() => LoadResource<Dictionary<int, RecordedPlot>>(Resources.ShiroganePlots)) },
{ HousingZone.Empyreum, new Lazy<Dictionary<int, RecordedPlot>>(() => LoadResource<Dictionary<int, RecordedPlot>>(Resources.EmpyreumPlots)) }
};
}
public static T LoadResource<T>(string text)
{
return JsonConvert.DeserializeObject<T>(text);
}
}
}