feat: add ClientOpCodes dict to DataManager

This commit is contained in:
goat 2020-04-28 18:03:37 +02:00
parent 832c5f758f
commit 10d91031dd
2 changed files with 18 additions and 4 deletions

View file

@ -22,7 +22,14 @@ namespace Dalamud.Data
/// This class provides data for Dalamud-internal features, but can also be used by plugins if needed. /// This class provides data for Dalamud-internal features, but can also be used by plugins if needed.
/// </summary> /// </summary>
public class DataManager { public class DataManager {
/// <summary>
/// OpCodes sent by the server to the client.
/// </summary>
public ReadOnlyDictionary<string, ushort> ServerOpCodes { get; private set; } public ReadOnlyDictionary<string, ushort> ServerOpCodes { get; private set; }
/// <summary>
/// OpCodes sent by the client to the server.
/// </summary>
public ReadOnlyDictionary<string, ushort> ClientOpCodes { get; private set; }
/// <summary> /// <summary>
/// An <see cref="ExcelModule"/> object which gives access to any of the game's sheet data. /// An <see cref="ExcelModule"/> object which gives access to any of the game's sheet data.
@ -55,13 +62,19 @@ namespace Dalamud.Data
{ {
try try
{ {
Log.Verbose("Starting data download..."); Log.Verbose("Starting data load...");
var opCodeDict = var zoneOpCodeDict =
JsonConvert.DeserializeObject<Dictionary<string, ushort>>(File.ReadAllText(Path.Combine(baseDir, "UIRes", "serveropcode.json"))); JsonConvert.DeserializeObject<Dictionary<string, ushort>>(File.ReadAllText(Path.Combine(baseDir, "UIRes", "serveropcode.json")));
this.ServerOpCodes = new ReadOnlyDictionary<string, ushort>(opCodeDict); ServerOpCodes = new ReadOnlyDictionary<string, ushort>(zoneOpCodeDict);
Log.Verbose("Loaded {0} ServerOpCodes.", opCodeDict.Count); Log.Verbose("Loaded {0} ServerOpCodes.", zoneOpCodeDict.Count);
var clientOpCodeDict =
JsonConvert.DeserializeObject<Dictionary<string, ushort>>(File.ReadAllText(Path.Combine(baseDir, "UIRes", "clientopcode.json")));
ClientOpCodes = new ReadOnlyDictionary<string, ushort>(clientOpCodeDict);
Log.Verbose("Loaded {0} ClientOpCodes.", clientOpCodeDict.Count);
var luminaOptions = new LuminaOptions var luminaOptions = new LuminaOptions

View file

@ -14,6 +14,7 @@ namespace Dalamud.Interface
private static readonly Dictionary<string, string> AssetDictionary = new Dictionary<string, string> { private static readonly Dictionary<string, string> AssetDictionary = new Dictionary<string, string> {
{AssetStoreUrl + "UIRes/serveropcode.json", "UIRes/serveropcode.json" }, {AssetStoreUrl + "UIRes/serveropcode.json", "UIRes/serveropcode.json" },
{AssetStoreUrl + "UIRes/clientopcode.json", "UIRes/clientopcode.json" },
{AssetStoreUrl + "UIRes/NotoSansCJKjp-Medium.otf", "UIRes/NotoSansCJKjp-Medium.otf" }, {AssetStoreUrl + "UIRes/NotoSansCJKjp-Medium.otf", "UIRes/NotoSansCJKjp-Medium.otf" },
{AssetStoreUrl + "UIRes/logo.png", "UIRes/logo.png" }, {AssetStoreUrl + "UIRes/logo.png", "UIRes/logo.png" },
{AssetStoreUrl + "UIRes/loc/dalamud/dalamud_de.json", "UIRes/loc/dalamud/dalamud_de.json" }, {AssetStoreUrl + "UIRes/loc/dalamud/dalamud_de.json", "UIRes/loc/dalamud/dalamud_de.json" },