public static string GetStatString(this ItemDefinition item) { StringBuilder statsBuilder = new StringBuilder(); statsBuilder.AppendLine($"{item.Rarity} {item.Type}"); if (item.ItemData.Flags.Contains(ItemFlags.Stackable)) { statsBuilder.AppendLine($"Count: {item.StackSize}"); } if (item.ItemData.Flags.Contains(ItemFlags.Levelable)) { statsBuilder.AppendLine($"Level: {item.ItemLevel}"); } if (item.SetTags.Length > 0) { statsBuilder.AppendLine($"Tags: {item.SetTags.Aggregate((f, l) => f + "," + l)}"); } if (item.ItemData.Flags.Contains(ItemFlags.Sellable)) { statsBuilder.AppendLine($"Sell: {(int)item.GetCurrentSellPrice()}"); } if (item.ItemData.Flags.Contains(ItemFlags.Buyable)) { statsBuilder.AppendLine($"Buy: {(int)item.GetCurrentBuyPrice()}"); } return(statsBuilder.ToString()); }
private void SellItem(ItemDefinition soldItem) { float finalPrice = soldItem.GetCurrentSellPrice(); OnItemSold.Invoke((int)finalPrice); OnSpecificItemSold?.Invoke(soldItem); }