refactor(wonderking): item data adjustments
This commit is contained in:
parent
4042654856
commit
2aedc9dae9
3 changed files with 18 additions and 30 deletions
|
@ -36,9 +36,9 @@ public class ItemObjectPoolService : IHostedService
|
||||||
{
|
{
|
||||||
throw new KeyNotFoundException($"Failed to add item {itemObject.ItemID} to the item object pool");
|
throw new KeyNotFoundException($"Failed to add item {itemObject.ItemID} to the item object pool");
|
||||||
}
|
}
|
||||||
|
_logger.LogTrace("Item with id:{ID} and name: '{Name}' has been added", itemObject.ItemID, itemObject.Name);
|
||||||
_logger.LogTrace("Item with {ID} has been added", itemObject.ItemID);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_logger.LogInformation("A total of {AmountOfEntries} items have been added to the item object pool",
|
_logger.LogInformation("A total of {AmountOfEntries} items have been added to the item object pool",
|
||||||
_itemObjectPool.Count);
|
_itemObjectPool.Count);
|
||||||
|
|
||||||
|
|
|
@ -128,10 +128,10 @@ public struct ItemObject
|
||||||
[JsonConverter(typeof(ByteArrayConverter))]
|
[JsonConverter(typeof(ByteArrayConverter))]
|
||||||
public byte[] R16C { get; set; }
|
public byte[] R16C { get; set; }
|
||||||
|
|
||||||
public int InventoryX { get; set; }
|
public int SheetX { get; set; }
|
||||||
public int InventoryY { get; set; }
|
public int SheetY { get; set; }
|
||||||
public int InventoryWidth { get; set; }
|
public int SheetWidth { get; set; }
|
||||||
public int InventoryHeight { get; set; }
|
public int SheetHeight { get; set; }
|
||||||
public int SheetID { get; set; }
|
public int SheetID { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
@ -169,4 +169,7 @@ public struct ItemObject
|
||||||
|
|
||||||
[JsonConverter(typeof(ByteArrayConverter))]
|
[JsonConverter(typeof(ByteArrayConverter))]
|
||||||
public byte[] Unknown21_2 { get; set; }
|
public byte[] Unknown21_2 { get; set; }
|
||||||
|
|
||||||
|
public int RearWearItemIndex { get; set; }
|
||||||
|
public int FrontWearItemIndex { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Wonderking.Game.Data;
|
using Wonderking.Game.Data;
|
||||||
using Wonderking.Game.Data.Item;
|
using Wonderking.Game.Data.Item;
|
||||||
|
@ -81,11 +82,13 @@ public class ItemReader(string path) : DataReader<ItemObject>(path)
|
||||||
item.R14C = data.Slice(356, 4).ToArray(); // 356 -> 360
|
item.R14C = data.Slice(356, 4).ToArray(); // 356 -> 360
|
||||||
item.CraftResultItem = BitConverter.ToUInt32(data.Slice(360, 4)); // 360 -> 364
|
item.CraftResultItem = BitConverter.ToUInt32(data.Slice(360, 4)); // 360 -> 364
|
||||||
item.R15C = data.Slice(364, 4).ToArray(); // 364 -> 368
|
item.R15C = data.Slice(364, 4).ToArray(); // 364 -> 368
|
||||||
item.R16C = data.Slice(368, 20).ToArray(); // 368 -> 388
|
item.R16C = data.Slice(368, 12).ToArray(); // 368 -> 380
|
||||||
item.InventoryX = BitConverter.ToInt32(data.Slice(388, 4)); // 388 -> 392
|
item.FrontWearItemIndex = BitConverter.ToInt32(data.Slice(380, 4));
|
||||||
item.InventoryY = BitConverter.ToInt32(data.Slice(392, 4)); // 392 -> 396
|
item.RearWearItemIndex = BitConverter.ToInt32(data.Slice(380, 4));
|
||||||
item.InventoryWidth = BitConverter.ToInt32(data.Slice(396, 4)); // 396 -> 400
|
item.SheetX = BitConverter.ToInt32(data.Slice(388, 4)); // 388 -> 392
|
||||||
item.InventoryHeight = BitConverter.ToInt32(data.Slice(400, 4)); // 400 -> 404
|
item.SheetY = BitConverter.ToInt32(data.Slice(392, 4)); // 392 -> 396
|
||||||
|
item.SheetWidth = BitConverter.ToInt32(data.Slice(396, 4)); // 396 -> 400
|
||||||
|
item.SheetHeight = BitConverter.ToInt32(data.Slice(400, 4)); // 400 -> 404
|
||||||
item.SheetID = BitConverter.ToInt32(data.Slice(404, 4)); // 404 -> 408
|
item.SheetID = BitConverter.ToInt32(data.Slice(404, 4)); // 404 -> 408
|
||||||
item.Name = Encoding.ASCII.GetString(data.Slice(408, 20)); // 408 -> 428
|
item.Name = Encoding.ASCII.GetString(data.Slice(408, 20)); // 408 -> 428
|
||||||
item.Description = Encoding.ASCII.GetString(data.Slice(428, 85)); // 428 -> 513
|
item.Description = Encoding.ASCII.GetString(data.Slice(428, 85)); // 428 -> 513
|
||||||
|
@ -213,24 +216,6 @@ public class ItemReader(string path) : DataReader<ItemObject>(path)
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static ElementalStats ReadElementalStats(ref Span<byte> data)
|
private static ElementalStats ReadElementalStats(ref Span<byte> data)
|
||||||
{
|
{
|
||||||
return new ElementalStats
|
return MemoryMarshal.Cast<byte, ElementalStats>(data.Slice(140, 64))[0];
|
||||||
{
|
|
||||||
MinimumFireDamage = BitConverter.ToInt32(data.Slice(140, 4)), // 140 -> 144
|
|
||||||
MinimumWaterDamage = BitConverter.ToInt32(data.Slice(144, 4)), // 144 -> 148
|
|
||||||
MinimumDarkDamage = BitConverter.ToInt32(data.Slice(148, 4)), // 148 -> 152
|
|
||||||
MinimumHolyDamage = BitConverter.ToInt32(data.Slice(152, 4)), // 152 -> 156
|
|
||||||
MaximumFireDamage = BitConverter.ToInt32(data.Slice(156, 4)), // 156 -> 160
|
|
||||||
MaximumWaterDamage = BitConverter.ToInt32(data.Slice(160, 4)), // 160 -> 164
|
|
||||||
MaximumDarkDamage = BitConverter.ToInt32(data.Slice(164, 4)), // 164 -> 168
|
|
||||||
MaximumHolyDamage = BitConverter.ToInt32(data.Slice(168, 4)), // 168 -> 172
|
|
||||||
ElementFire = BitConverter.ToUInt32(data.Slice(172, 4)), // 172 -> 176
|
|
||||||
ElementWater = BitConverter.ToUInt32(data.Slice(176, 4)), // 176 -> 180
|
|
||||||
ElementDark = BitConverter.ToUInt32(data.Slice(180, 4)), // 180 -> 184
|
|
||||||
ElementHoly = BitConverter.ToUInt32(data.Slice(184, 4)), // 184 -> 188
|
|
||||||
FireResistance = BitConverter.ToInt32(data.Slice(188, 4)), // 188 -> 192
|
|
||||||
WaterResistance = BitConverter.ToInt32(data.Slice(192, 4)), // 192 -> 196
|
|
||||||
DarkResistance = BitConverter.ToInt32(data.Slice(196, 4)), // 196 -> 200
|
|
||||||
HolyResistance = BitConverter.ToInt32(data.Slice(200, 4)) // 200 -> 204
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue