public override OrderReceipt Transfer3(AvatarState seller, AvatarState buyer, long blockIndex) { if (seller.inventory.TryGetLockedItem(new OrderLock(OrderId), out var inventoryItem)) { if (inventoryItem.item is INonFungibleItem nonFungibleItem) { nonFungibleItem.RequiredBlockIndex = blockIndex; seller.inventory.RemoveItem(inventoryItem); if (nonFungibleItem is Costume costume) { buyer.UpdateFromAddCostume(costume, false); } else { buyer.UpdateFromAddItem2((ItemUsable)nonFungibleItem, false); } } return(new OrderReceipt(OrderId, buyer.agentAddress, buyer.address, blockIndex)); } throw new ItemDoesNotExistException( $"Aborted because the tradable item({TradableId}) was failed to load from avatar's inventory."); }
public override OrderReceipt Transfer2(AvatarState seller, AvatarState buyer, long blockIndex) { if (seller.inventory.TryGetTradableItem(TradableId, ExpiredBlockIndex, ItemCount, out Inventory.Item inventoryItem)) { TradableMaterial tradableItem = (TradableMaterial)inventoryItem.item; seller.inventory.RemoveTradableItem(tradableItem, ItemCount); TradableMaterial copy = (TradableMaterial)tradableItem.Clone(); copy.RequiredBlockIndex = blockIndex; buyer.UpdateFromAddItem2(copy, ItemCount, false); return(new OrderReceipt(OrderId, buyer.agentAddress, buyer.address, blockIndex)); } throw new ItemDoesNotExistException( $"Aborted because the tradable item({TradableId}) was failed to load from seller's inventory."); }