Fix League Points reading

This commit is contained in:
Manu 2023-01-06 16:38:53 +01:00
parent d1c08e5d1a
commit 82298429fe
3 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,7 @@ namespace SwitchGiftDataManager.Core
{
public object? Type { get; set; }
public ushort Item { get; set; }
public ushort Quantity { get; set; }
public uint Quantity { get; set; }
public ushort Opt { get; set; }
public string GetItemName() => GetItemName(Item, Type!, Opt);
@ -100,7 +100,7 @@ namespace SwitchGiftDataManager.Core
str = $"[{category}] {description}";
}
else
str = ((GiftType8A)type).ToString();
str = ((GiftType9)type).ToString();
}
return str;

View File

@ -70,7 +70,7 @@ namespace SwitchGiftDataManager.Core
for (int i = 0; i < MaxItemCount; i++)
{
ushort item = 0;
ushort quantity = 0;
uint quantity = 0;
ushort opt = 0;
var type = (GiftType9)Type!;
@ -82,7 +82,8 @@ namespace SwitchGiftDataManager.Core
else
{
item = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i)));
quantity = BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(QuantityOffset + (0x04 * i)));
quantity = type is GiftType9.LP ? BinaryPrimitives.ReadUInt32LittleEndian(Data.AsSpan(ItemOffset + (0x04 * i))) :
BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(QuantityOffset + (0x04 * i)));
}
var gift = new OtherGift

View File

@ -66,7 +66,7 @@
None = 0,
Pokemon = 1,
Item = 2,
BP = 3,
LP = 3,
Clothing = 4,
}