コード例 #1
0
ファイル: Auction.java プロジェクト: impos89/l2emu
 /** End of auction */
 public void endAuction() {
   if (ClanHallManager.loaded()) {
     if (_highestBidderId == 0 && _sellerId == 0) {
       startAutoTask();
       return;
     }
     if (_highestBidderId == 0 && _sellerId > 0) {
       /** If seller haven't sell ClanHall, auction removed, THIS MUST BE CONFIRMED */
       int aucId = AuctionService.getInstance().getAuctionIndex(_id);
       AuctionService.getInstance().getAuctions().remove(aucId);
       return;
     }
     if (_sellerId > 0) {
       returnItem(_sellerClanName, PcInventory.ADENA_ID, _highestBidderMaxBid, true);
       returnItem(
           _sellerClanName,
           PcInventory.ADENA_ID,
           ClanHallManager.getInstance().getClanHallById(_itemId).getLease(),
           false);
     }
     deleteAuctionFromDB();
     L2Clan Clan =
         ClanTable.getInstance().getClanByName(_bidders.get(_highestBidderId).getClanName());
     _bidders.remove(_highestBidderId);
     Clan.setAuctionBiddedAt(0, true);
     removeBids();
     ClanHallManager.getInstance().setOwner(_itemId, Clan);
   } else {
     /** Task waiting ClanHallManager is loaded every 3s */
     ThreadPoolManager.getInstance().scheduleGeneral(new AutoEndTask(), 3000);
   }
 }
コード例 #2
0
ファイル: Auction.java プロジェクト: impos89/l2emu
 public Auction(int itemId, L2Clan Clan, long delay, int bid, String name) {
   _id = itemId;
   _endDate = System.currentTimeMillis() + delay;
   _itemId = itemId;
   _itemName = name;
   _itemType = "ClanHall";
   _sellerId = Clan.getLeaderId();
   _sellerName = Clan.getLeaderName();
   _sellerClanName = Clan.getName();
   _startingBid = bid;
 }
コード例 #3
0
ファイル: CrownManager.java プロジェクト: impos89/l2emu
  public static void checkCrowns(L2Player activeChar) {
    if (activeChar == null) return;

    int crownId = -1;
    boolean isLeader = false;

    final L2Clan clan = activeChar.getClan();

    if (clan != null) {
      final Castle castle = CastleManager.getInstance().getCastleByOwner(clan);

      if (castle != null) crownId = CrownTable.getCrownId(castle.getCastleId());

      if (clan.getLeaderId() == activeChar.getObjectId()) isLeader = true;
    }

    boolean alreadyFoundCirclet = false;
    boolean alreadyFoundCrown = false;

    for (L2ItemInstance item : activeChar.getInventory().getItems()) {
      if (ArrayUtils.contains(CrownTable.getCrownIds(), item.getItemId())) {
        if (crownId > 0) {
          if (item.getItemId() == crownId) {
            if (!alreadyFoundCirclet) {
              alreadyFoundCirclet = true;
              continue;
            }
          } else if (item.getItemId() == 6841 && isLeader) {
            if (!alreadyFoundCrown) {
              alreadyFoundCrown = true;
              continue;
            }
          }
        }

        // WRONG! The crown is not sellable/tradeable/dropable
        // And the circlets are sellable!!!, but not tradeable or dropable
        // Unequip is what happens
        if (item.getItemId() == 6841 || Config.ALT_REMOVE_CASTLE_CIRCLETS)
          activeChar.destroyItem("Removing Crown", item, activeChar, true);
        else if (item.isEquipped())
          activeChar.getInventory().unEquipItemInSlot(Inventory.PAPERDOLL_HAIR2);

        // No need to update every item in the inventory
        // activeChar.getInventory().updateDatabase();
      }
    }
  }
コード例 #4
0
ファイル: CrownManager.java プロジェクト: impos89/l2emu
  public static void checkCrowns(L2Clan clan) {
    if (clan == null) return;

    for (L2ClanMember member : clan.getMembers())
      if (member != null && member.isOnline()) checkCrowns(member.getPlayerInstance());
  }