Class TradingUtility

java.lang.Object
games.stendhal.server.maps.semos.tavern.market.TradingUtility

public class TradingUtility extends Object
helper class for handling adding and prolonging offers
Author:
madmetzger
  • Constructor Details

    • TradingUtility

      public TradingUtility()
  • Method Details

    • substractTradingFee

      public static boolean substractTradingFee(Player player, int price)
      substracts the trading fee from the player depending on the given price
      Parameters:
      player -
      price -
      Returns:
      true iff player dropped the amount of money
    • canPlayerAffordTradingFee

      public static boolean canPlayerAffordTradingFee(Player player, int price)
      checks if a player can afford the trading fee depending on price
      Parameters:
      player -
      price -
      Returns:
      true iff player has enough money
    • calculateFee

      public static BigDecimal calculateFee(Player player, int price)
      calculates the trading fee a player has to pay when selling for a certain price
      Parameters:
      player -
      price -
      Returns:
      the trading fee
    • isPlayerWithinOfferLimit

      public static boolean isPlayerWithinOfferLimit(Player player)
      checks if a player has not already placed the max number of offers
      Parameters:
      player -
      Returns:
      true if the player is within the limit, false otherwise