private static void UpdateShop(ItemObject itemObject, List <MessageEntry> newMessages, MessageTable messageTable) { var location = itemObject.NewLocation.Value; var shopInventories = location.GetAttributes <ShopInventoryAttribute>(); foreach (var shopInventory in shopInventories) { var messageId = ReadWriteUtils.ReadU16(shopInventory.ShopItemAddress + 0x0A); var oldMessage = messageTable.GetMessage((ushort)(messageId + 1)); var cost = ReadWriteUtils.Arr_ReadU16(oldMessage.Header, 5); newMessages.Add(new MessageEntryBuilder() .Id(messageId) .Message(it => { it.Red(() => { it.RuntimeItemName(itemObject.DisplayName(), location).Text(": ").Text(cost.ToString()).Text(" Rupees").NewLine(); }) .RuntimeWrap(() => { it.RuntimeItemDescription(itemObject.DisplayItem, shopInventory.Keeper, location); }) .DisableTextBoxClose() .EndFinalTextBox(); }) .Build() ); newMessages.Add(new MessageEntryBuilder() .Id((ushort)(messageId + 1)) .Message(it => { it.RuntimeItemName(itemObject.DisplayName(), location).Text(": ").Text(cost.ToString()).Text(" Rupees").NewLine() .Text(" ").NewLine() .StartGreenText() .TwoChoices() .Text("I'll buy ").RuntimePronoun(itemObject.DisplayItem, location).NewLine() .Text("No thanks") .EndFinalTextBox(); }) .Build() ); } }
public static string AlternateName(this ItemObject itemObject) { return(MessageUtils.GetAlternateName(itemObject.DisplayName())); }
private static void UpdateShop(ItemObject itemObject, List <MessageEntry> newMessages) { var location = itemObject.NewLocation.Value; GetItemEntry newItem; if (itemObject.Mimic != null) { newItem = RomData.GetItemList[itemObject.Mimic.Item.GetItemIndex().Value]; } else if (itemObject.Item.IsExclusiveItem()) { newItem = itemObject.Item.ExclusiveItemEntry(); } else { newItem = RomData.GetItemList[itemObject.Item.GetItemIndex().Value]; } var shopRooms = location.GetAttributes <ShopRoomAttribute>(); foreach (var shopRoom in shopRooms) { ReadWriteUtils.WriteToROM(shopRoom.RoomObjectAddress, (ushort)newItem.Object); } var shopInventories = location.GetAttributes <ShopInventoryAttribute>(); foreach (var shopInventory in shopInventories) { ReadWriteUtils.WriteToROM(shopInventory.ShopItemAddress, (ushort)newItem.Object); var index = newItem.Index > 0x7F ? (byte)(0xFF - newItem.Index) : (byte)(newItem.Index - 1); ReadWriteUtils.WriteToROM(shopInventory.ShopItemAddress + 0x03, index); var messageId = ReadWriteUtils.ReadU16(shopInventory.ShopItemAddress + 0x0A); newMessages.Add(new MessageEntryBuilder() .Id(messageId) .Message(it => { it.Red(() => { it.RuntimeItemName(itemObject.DisplayName(), location).Text(": ").Text("20 Rupees").NewLine(); }) .RuntimeWrap(() => { it.RuntimeItemDescription(itemObject.DisplayItem, shopInventory.Keeper, location); }) .DisableTextBoxClose() .EndFinalTextBox(); }) .Build() ); newMessages.Add(new MessageEntryBuilder() .Id((ushort)(messageId + 1)) .Message(it => { it.RuntimeItemName(itemObject.DisplayName(), location).Text(": ").Text("20 Rupees").NewLine() .Text(" ").NewLine() .StartGreenText() .TwoChoices() .Text("I'll buy ").RuntimePronoun(itemObject.DisplayItem, location).NewLine() .Text("No thanks") .EndFinalTextBox(); }) .Build() ); } }