コード例 #1
0
        public static string Sell(Shop shop, ItemData data, ArcadeUser user)
        {
            if (!CanSell(shop, data))
            {
                return(Format.Warning($"**{shop.Name}** does not accept this item."));
            }

            Item item = ItemHelper.GetItem(data.Id);

            ItemHelper.TakeItem(user, data);

            long value = shop.SellDeduction > 0
                ? (long)Math.Floor(item.Value * (1 - shop.SellDeduction / (double)100))
                : item.Value;

            user.Give(value, item.Currency);
            string icon = (Check.NotNull(item.GetIcon()) ? $"{item.GetIcon()} " : "");
            string name = $"{icon}**{(Check.NotNull(icon) ? item.Name : item.GetName())}**";

            return($"> You have received {Icons.IconOf(item.Currency)} **{value:##,0}** for {name}.");
        }
コード例 #2
0
 public static string WriteCost(long value, CurrencyType currency)
 => value <= 0 ? "**Unknown Cost**" : $"{Icons.IconOf(currency)} **{value:##,0}**";