Ejemplo n.º 1
0
 /** Method runImpl. */
 @Override
 protected final void runImpl() {
   final Player activeChar = getClient().getActiveChar();
   if (activeChar == null) {
     return;
   }
   ItemInstance adena = activeChar.getInventory().getItemByItemId(57);
   if ((_bid < 0) || (_bid > adena.getCount())) {
     return;
   }
   final ItemAuctionInstance instance =
       ItemAuctionManager.getInstance().getManagerInstance(_instanceId);
   NpcInstance broker = activeChar.getLastNpc();
   if ((broker == null)
       || (broker.getNpcId() != _instanceId)
       || (activeChar.getDistance(broker.getX(), broker.getY()) > Creature.INTERACTION_DISTANCE)) {
     return;
   }
   if (instance != null) {
     final ItemAuction auction = instance.getCurrentAuction();
     if (auction != null) {
       auction.registerBid(activeChar, _bid);
     }
   }
 }
Ejemplo n.º 2
0
  /**
   * Method checkPlayer.
   *
   * @param player Player
   * @param item ItemInstance
   */
  public void checkPlayer(Player player, ItemInstance item) {
    if ((player == null) || (item == null) || player.isInOlympiadMode()) {
      return;
    }

    CursedWeapon cw = _cursedWeaponsMap.get(item.getId());

    if (cw == null) {
      return;
    }

    if ((player.getObjectId() == cw.getPlayerId()) || (cw.getPlayerId() == 0) || cw.isDropped()) {
      activate(player, item);
      showUsageTime(player, cw);
    } else {
      _log.warn("CursedWeaponsManager: " + player + " tried to obtain " + item + " in wrong way");
      player.getInventory().destroyItem(item, item.getCount());
    }
  }