public static InventoryCard ReadNew(BinaryReader r) { var cardId = new CardId(r.ReadUInt32()); InventoryCard card = cardId.Type switch { CardType.Item => new InventoryItem(), CardType.Spell => new InventorySpell(), CardType.Fairy => new InventoryFairy(), _ => throw new InvalidDataException($"Invalid inventory card type: {cardId.Type}") }; card.cardId = cardId; card.atIndex = r.ReadUInt32(); card.dbUID = UID.ReadNew(r); card.amount = r.ReadUInt32(); card.isInUse = r.ReadBoolean(); card.ReadSub(r); return(card); }
public static ForeignKey ReadNew(BinaryReader reader) { return(new ForeignKey(UID.ReadNew(reader), UID.ReadNew(reader))); }
public ForeignKey(UID uid = new UID(), UID type = new UID()) { this.uid = uid; this.type = type; }