Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: TradeItem

[12:7] extends: FxObj

Wraps FXGL's TradeItem, a generic value type representing an item that can be bought or sold in a Shop. Carries a name, description, buy / sell price, and underlying item key.

Methods

  • TradeItem (Item = null, string Name = "", string Description = "", int SellPrice = 0, int BuyPrice = 0, int Quantity = 1)

    Creates a new TradeItem for the given underlying item.

    • @p Item is the underlying item key (string, enum, etc).
    • @p Name is the display name.
    • @p Description is the item description.
    • @p SellPrice is the value when sold.
    • @p BuyPrice is the cost to buy.
    • @p Quantity is the trade-item quantity (defaults to 1).
  • adopt (object Ajo)

    Wraps an existing TradeItem AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a TradeItem.
    • @r A new wrapper.
  • getName ()

    Returns the trade item name.

    • @r A string.
  • getBuyPrice ()

    Returns the buy price.

    • @r An int.
  • getSellPrice ()

    Returns the sell price.

    • @r An int.
  • getQuantity ()

    Returns the quantity.

    • @r An int.
  • getItem ()

    Returns the underlying item key.

    • @r The item key (string, enum, etc).
  • getDescription ()

    Returns the item description.

    • @r A string.
  • setItem (Item)

    Updates the underlying item key.

    • @p Item is the new item key.
    • @r this object
  • setName (string Name)

    Updates the display name.

    • @p Name is the new name.
    • @r this object
  • setDescription (string Description)

    Updates the description.

    • @p Description is the new description.
    • @r this object
  • setSellPrice (int SellPrice)

    Updates the sell price.

    • @p SellPrice is the new sell price.
    • @r this object
  • setBuyPrice (int BuyPrice)

    Updates the buy price.

    • @p BuyPrice is the new buy price.
    • @r this object
  • setQuantity (int Quantity)

    Updates the quantity (e.g. when partially sold).

    • @p Quantity is the new quantity.
    • @r this object
  • copy ()

    Returns a fresh copy of this TradeItem.

    • @r A new TradeItem wrapper.