Package games.stendhal.server.entity.trade

Examples of games.stendhal.server.entity.trade.Market


import marauroa.common.game.RPObject;

public class MarketTransformer implements Transformer {

  public RPObject transform(RPObject object) {
    return (RPObject)new Market(object);
  }
View Full Code Here


  private static final int COORDINATE_Y = 13;
  private static final int COORDINATE_X = 10;

  public void configureZone(StendhalRPZone zone,
      Map<String, String> attributes) {
    Market market = addShopToZone(zone);
    // start checking for expired offers
    new OfferExpirer(market);
   
    buildTradeCenterAdvisor(zone);
  }
View Full Code Here

   
    buildTradeCenterAdvisor(zone);
  }

  private Market addShopToZone(StendhalRPZone zone) {
    Market market = getMarketFromZone(zone);
    if (market == null) {
      market = Market.createShop();
      market.setVisibility(0);
      zone.add(market, false);
    }
   
    return market;
  }
View Full Code Here

  public static boolean isPlayerWithinOfferLimit(Player player) {
    return countOffers(player)< MAX_NUMBER_OFF_OFFERS;
  }
 
  private static int countOffers(Player player) {
    Market shopFromZone = TradeCenterZoneConfigurator.getShopFromZone(player.getZone());
    if(shopFromZone != null) {
      int numberOfOffers = shopFromZone.countOffersOfPlayer(player);
      return numberOfOffers;
    }
    return 0;
  }
View Full Code Here

      handleSentence(player, npc);
    }
  }

  private void handleSentence(Player player, EventRaiser npc) {
    Market market = TradeCenterZoneConfigurator.getShopFromZone(player.getZone());
    Set<Earning> earnings = market.fetchEarnings(player);
    int collectedSum = 0;
    for (Earning earning : earnings) {
      collectedSum += earning.getValue().intValue();
    }
    if (collectedSum > 0) {
View Full Code Here

     * @param player the player to be checked
     * @param offer the offer the player wants to prolong
     * @return true if prolonging the offer should be denied
     */
    private boolean wouldOverflowMaxOffers(Player player, Offer offer) {
      Market market = TradeCenterZoneConfigurator.getShopFromZone(player.getZone());
     
      if ((market.countOffersOfPlayer(player) == TradingUtility.MAX_NUMBER_OFF_OFFERS)
          && market.getExpiredOffers().contains(offer)) {
        return true;
      }
     
      return false;
    }
View Full Code Here

     
      return false;
    }
   
    private boolean prolongOffer(Player player, Offer o) {
      Market market = TradeCenterZoneConfigurator.getShopFromZone(player.getZone());
      if (market != null) {
        if (market.prolongOffer(o) != null) {
          String messageNumberOfOffers = "You now have put "+Integer.valueOf(market.countOffersOfPlayer(player)).toString()+" offers.";
          player.sendPrivateText(messageNumberOfOffers);
         
          return true;
        }
      }
View Full Code Here

   
    boolean onlyMyOffers = checkForMineFilter(sentence);
    boolean onlyMyExpiredOffers = checkForMyExpiredFilter(sentence);
    boolean filterForMine = false;
   
    Market market = TradeCenterZoneConfigurator.getShopFromZone(player.getZone());
   
    // Figure out what to look for
    RPSlot offersSlot = market.getSlot(Market.OFFERS_SLOT_NAME);
    if (onlyMyExpiredOffers) {
      offersSlot = market.getSlot(Market.EXPIRED_OFFERS_SLOT_NAME);
      filterForMine = true;
    }
    if (onlyMyOffers) {
      filterForMine = true;
    }
View Full Code Here

* @author madmetzger
*/
public class PlayerHasEarningsToCollectCondition implements ChatCondition {
 
  public boolean fire(Player player, Sentence sentence, Entity npc) {
    Market market = TradeCenterZoneConfigurator.getShopFromZone(npc.getZone());
    if(market != null) {
      return market.hasEarningsFor(player);
    }
    return false;
  }
View Full Code Here

  /**
   * show a list of all items for which offers exist.
   */
  public void fire(Player player, Sentence sentence, EventRaiser npc) {
    Market market = TradeCenterZoneConfigurator.getShopFromZone(player.getZone());
    RPSlot offersSlot = market.getSlot(Market.OFFERS_SLOT_NAME);
    List<Offer> offers = getOffers(offersSlot);
    if (offers.isEmpty()) {
      npc.say("Sorry, there are currently no offers.");
    } else {
      String text = buildItemListText(buildItemList(offers));
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.trade.Market

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.