HASITEM.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. namespace OpenVIII.Fields.Scripts.Instructions
  2. {
  3. /// <summary>
  4. /// <para>Has item (or Get Item Count?)</para>
  5. /// <para>If the party has the item with the given ID, pushes 1 to temporary variable 0. Otherwise, pushes 0.</para>
  6. /// <para>It's possible this just returns the number of the item the party has.</para>
  7. /// </summary>
  8. /// <see cref="http://wiki.ffrtt.ru/index.php?title=FF8/Field/Script/Opcodes/170_UNKNOWN5"/>
  9. public sealed class HASITEM : JsmInstruction
  10. {
  11. #region Fields
  12. /// <summary>
  13. /// Item ID
  14. /// </summary>
  15. private readonly IJsmExpression _itemID;
  16. #endregion Fields
  17. #region Constructors
  18. public HASITEM(IJsmExpression itemID) => _itemID = itemID;
  19. public HASITEM(int parameter, IStack<IJsmExpression> stack)
  20. : this(
  21. itemID: stack.Pop())
  22. {
  23. }
  24. #endregion Constructors
  25. #region Methods
  26. public override string ToString() => $"{nameof(HASITEM)}({nameof(_itemID)}: {_itemID})";
  27. #endregion Methods
  28. }
  29. }