コード例 #1
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
 public void addMembers(L2Party party) {
   for (L2PcInstance player : party.getPartyMembersWithoutLeader()) {
     getMembers().add(player);
     player.setPartyRoom(this);
   }
   updateRoomStatus(true);
 }
コード例 #2
0
 public String onTalk(L2NpcInstance npc, L2PcInstance player) {
   String htmltext =
       "<html><body>Вы не взяли квест для этого NPC или просто не соответствуете его минимальным требованиям!</body></html>";
   QuestState st = player.getQuestState(qn);
   if (st == null) return htmltext;
   int id = st.getState();
   int cond = st.getInt("cond");
   if (id == State.COMPLETED) {
     return "<html><body>Данный квест уже выполнен.</body></html>";
   } else if (cond == 0) {
     if (player.getRace().ordinal() != 2) {
       htmltext = "30141-00.htm";
       st.exitQuest(true);
     } else if (player.getLevel() >= 16) {
       htmltext = "30141-02.htm";
     } else {
       htmltext = "30141-01.htm";
       st.exitQuest(true);
     }
   } else if (cond == 1) {
     htmltext = "30141-04.htm";
   } else if (cond == 2) {
     htmltext = "30141-06.htm";
     st.takeItems(ONYX_BEAST_EYE, -1);
     st.takeItems(TAINT_STONE, -1);
     st.takeItems(SUCCUBUS_BLOOD, -1);
     st.giveItems(956, 1);
     st.unset("cond");
     st.exitQuest(false);
     st.playSound("ItemSound.quest_finish");
   }
   return htmltext;
 }
コード例 #3
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
 public static final int getPartyRoomState(L2PcInstance player) {
   L2PartyRoom room = player.getPartyRoom();
   if (room == null) return 0;
   if (room.getLeader() == player) return 1;
   L2Party party = room.getParty();
   if (party != null && party == player.getParty()) return 2;
   return 0;
 }
コード例 #4
0
ファイル: Fort.java プロジェクト: rean1m5/lucera2
  private void updateOwnerInDB() {
    L2Clan clan = getOwnerClan();
    int clanId = 0;

    if (clan != null) {
      clanId = clan.getClanId();
      _lastOwnedTime = System.currentTimeMillis();
    } else _lastOwnedTime = 0;

    Connection con = null;
    try {
      con = L2DatabaseFactory.getInstance().getConnection(con);
      PreparedStatement statement;

      statement =
          con.prepareStatement(
              "UPDATE fort SET owner=?, lastOwnedTime=?, state=?, castleId=? WHERE id = ?");
      statement.setInt(1, clanId);
      statement.setLong(2, _lastOwnedTime);
      statement.setInt(3, 0);
      statement.setInt(4, 0);
      statement.setInt(5, getFortId());
      statement.execute();
      statement.close();

      // ============================================================================
      // Announce to clan memebers
      if (clan != null) {
        clan.setHasFort(getFortId()); // Set has fort flag for new owner
        SystemMessage sm;
        sm = new SystemMessage(SystemMessageId.S1);
        sm.addString(clan.getName() + " победил в битве за форт " + getName());
        Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
        for (L2PcInstance player : pls) player.sendPacket(sm);

        clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
        clan.broadcastToOnlineMembers(new PlaySound(1, "Siege_Victory", 0, 0, 0, 0, 0));
        ThreadPoolManager.getInstance()
            .scheduleGeneral(
                new FortUpdater(clan, 1), 3600000); // Schedule owner tasks to start running
      }
    } catch (Exception e) {
      _log.warn("Exception: updateOwnerInDB(L2Clan clan): " + e.getMessage());
      e.printStackTrace();
    } finally {
      try {
        con.close();
      } catch (Exception e) {
        _log.warn("" + e.getMessage());
        e.printStackTrace();
      }
    }
  }
コード例 #5
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
  public void addMember(L2PcInstance player) {
    if (getMembers().contains(player)) return;

    PartyRoomManager.getInstance().removeFromWaitingList(player);
    broadcastPacket(new ExManagePartyRoomMember(ExManagePartyRoomMember.ADDED, player));
    broadcastPacket(new SystemMessage(SystemMessageId.S1_ENTERED_PARTY_ROOM).addPcName(player));
    updateRoomStatus(false);
    getMembers().add(player);
    player.setPartyRoom(this);
    player.sendPacket(new PartyMatchDetail(this));
    player.sendPacket(new ExPartyRoomMember(this, getMemberCount() == 1));
  }
コード例 #6
0
ファイル: effects.java プロジェクト: rean1m5/lucera2
  private void adminAtmosphere(String type, String state, L2PcInstance admin) {
    L2GameServerPacket packet = null;

    if (type.equals("signsky")) {
      if (state.equals("dawn")) packet = new SSQInfo(2);
      else if (state.equals("dusk")) packet = new SSQInfo(1);
    } else if (type.equals("sky")) {
      if (state.equals("night")) packet = SunSet.STATIC_PACKET;
      else if (state.equals("day")) packet = SunRise.STATIC_PACKET;
      else if (state.equals("red")) packet = new ExRedSky(10);
    } else admin.sendMessage("Используйте: //atmosphere <signsky dawn|dusk>|<sky day|night|red>");
    if (packet != null)
      for (L2PcInstance player : L2World.getInstance().getAllPlayers()) player.sendPacket(packet);
  }
コード例 #7
0
ファイル: ClanHall.java プロジェクト: rean1m5/lucera2
  public boolean updateFunctions(
      L2PcInstance player, int type, int lvl, int lease, long rate, boolean addNew) {
    if (player == null) return false;

    if (_log.isDebugEnabled() || Config.DEBUG)
      _log.warn(
          "Called ClanHall.updateFunctions(int type, int lvl, int lease, long rate, boolean addNew) Owner : "
              + getOwnerId());

    if (lease > 0) {
      if (!player.destroyItemByItemId("Consume", 57, lease, null, true)) return false;
    }
    if (addNew) _functions.put(type, new ClanHallFunction(type, lvl, lease, 0, rate, 0, false));
    else {
      if (lvl == 0 && lease == 0) removeFunction(type);
      else {
        int diffLease = lease - _functions.get(type).getLease();
        if (_log.isDebugEnabled() || Config.DEBUG)
          _log.warn("Called ClanHall.updateFunctions diffLease : " + diffLease);
        if (diffLease > 0) {
          _functions.remove(type);
          _functions.put(type, new ClanHallFunction(type, lvl, lease, 0, rate, -1, false));
        } else {
          _functions.get(type).setLease(lease);
          _functions.get(type).setLvl(lvl);
          _functions.get(type).dbSave(false);
        }
      }
    }
    return true;
  }
コード例 #8
0
ファイル: Fort.java プロジェクト: rean1m5/lucera2
  public void removeOwner(boolean updateDB) {
    setFortState(0, 0);
    L2Clan clan = getOwnerClan();

    if (clan != null) {
      for (L2PcInstance member : clan.getOnlineMembers(0)) {
        removeResidentialSkills(member);
        member.sendSkillList();
      }

      clan.setHasFort(0);
      clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
      setOwnerClan(null);
      if (updateDB) updateOwnerInDB();
    }
  }
コード例 #9
0
  public String onKill(L2NpcInstance npc, L2PcInstance player, boolean isPet) {
    QuestState st = player.getQuestState(qn);
    if (st == null) return null;
    if (st.getState() != State.STARTED) return null;

    int npcId = npc.getNpcId();
    if (st.getInt("cond") == 1) {
      if (npcId == OMEN_BEAST && st.getQuestItemsCount(ONYX_BEAST_EYE) == 0) {
        st.giveItems(ONYX_BEAST_EYE, 1);
      } else if (contains(new int[] {TAINTED_ZOMBIE, STINK_ZOMBIE}, npcId)
          && st.getQuestItemsCount(TAINT_STONE) == 0) {
        st.giveItems(TAINT_STONE, 1);
      } else if (contains(
              new int[] {LESSER_SUCCUBUS, LESSER_SUCCUBUS_TUREN, LESSER_SUCCUBUS_TILFO}, npcId)
          && st.getQuestItemsCount(SUCCUBUS_BLOOD) == 0) {
        st.giveItems(SUCCUBUS_BLOOD, 1);
      }
      if (st.getQuestItemsCount(ONYX_BEAST_EYE) > 0
          && st.getQuestItemsCount(TAINT_STONE) > 0
          && st.getQuestItemsCount(SUCCUBUS_BLOOD) > 0) {
        st.set("cond", "2");
        st.playSound("ItemSound.quest_middle");
      } else st.playSound("ItemSound.quest_itemget");
    }
    return null;
  }
コード例 #10
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
  public void removeMember(L2PcInstance member, boolean oust) {
    // the last member (leader) cannot be removed
    if (getMemberCount() == 1 || !getMembers().remove(member)) return;

    member.setPartyRoom(null);
    member.sendPacket(ExClosePartyRoom.STATIC_PACKET);
    if (oust) member.sendPacket(SystemMessageId.OUSTED_FROM_PARTY_ROOM);
    else member.sendPacket(SystemMessageId.PARTY_ROOM_EXITED);

    SystemMessage sm;
    if (oust) sm = new SystemMessage(SystemMessageId.S1_KICKED_FROM_PARTY_ROOM);
    else sm = new SystemMessage(SystemMessageId.S1_LEFT_PARTY_ROOM);
    sm.addPcName(member);
    broadcastPacket(new ExManagePartyRoomMember(ExManagePartyRoomMember.REMOVED, member));
    broadcastPacket(sm);
    updateRoomStatus(false);
  }
コード例 #11
0
ファイル: FriendList.java プロジェクト: rean1m5/lucera2
  private void getFriendList() {
    Connection con = null;

    try {
      String sqlQuery =
          "SELECT friendId, friend_name FROM character_friends WHERE "
              + "charId="
              + _activeChar.getObjectId()
              + " ORDER BY friend_name ASC";

      con = L2DatabaseFactory.getInstance().getConnection(con);
      PreparedStatement statement = con.prepareStatement(sqlQuery);
      ResultSet rset = statement.executeQuery(sqlQuery);

      int friendId;
      String friendName;
      FriendStatus fs;
      while (rset.next()) {
        friendId = rset.getInt("friendId");
        friendName = rset.getString("friend_name");

        if (friendId == _activeChar.getObjectId()) continue;

        L2PcInstance friend = L2World.getInstance().getPlayer(friendName);

        fs = new FriendStatus(0x00030b7a, friendId, friendName, friend != null);
        _friends.add(fs);
      }

      rset.close();
      statement.close();
    } catch (Exception e) {
      _log.warn("Error found in " + _activeChar.getName() + "'s FriendList: " + e);
    } finally {
      try {
        con.close();
      } catch (Exception e) {
      }
    }
  }
コード例 #12
0
ファイル: effects.java プロジェクト: rean1m5/lucera2
  private void performSocial(int action, L2Object target, L2PcInstance admin) {
    if (target == null) return;

    try {
      if (target instanceof L2Character) {
        if (target instanceof L2ChestInstance) {
          admin.sendPacket(SystemMessageId.NOTHING_HAPPENED);
          return;
        }
        if ((target instanceof L2NpcInstance) && (action < 1 || action > 6)) {
          admin.sendPacket(SystemMessageId.NOTHING_HAPPENED);
          return;
        }
        if ((target.isPlayer()) && (action < 2 || action > 16)) {
          admin.sendPacket(SystemMessageId.NOTHING_HAPPENED);
          return;
        }
        L2Character character = (L2Character) target;
        character.broadcastPacket(new SocialAction(target.getObjectId(), action));
      } else return;
    } catch (Exception e) {
    }
    return;
  }
コード例 #13
0
 public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet) {
   int npcId = npc.getNpcId();
   if (npcId == ScarletStokateNoble && Rnd.get(100) < 20) {
     for (int i = 0; i < 1 + Rnd.get(5); i++) {
       L2Attackable mob =
           (L2Attackable)
               addSpawn(
                   ScarletStokateNobleB,
                   npc.getX(),
                   npc.getY(),
                   npc.getZ(),
                   npc.getHeading(),
                   true,
                   0);
       mob.addDamageHate(isPet ? killer.getPet() : killer, 0, 100);
     }
   }
   return null;
 }
コード例 #14
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
  /**
   * Verifies if player can join the given party room and either adds the player to the party room
   * or sends a message why the player could not join the room.<br>
   * <I>Parameters may be <CODE>null</CODE>, which guarantees <CODE>false</CODE></I>
   *
   * @param activeChar a player
   * @param room a party room
   * @param checkForParty whether check if the player is in party/[room]
   * @return true if player joined the given room, false otherwise
   */
  public static final boolean tryJoin(
      L2PcInstance activeChar, L2PartyRoom room, boolean checkForParty) {
    if (activeChar == null) return false;

    if (checkForParty) {
      if (activeChar.getPartyRoom() != null || activeChar.getParty() != null) {
        activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN);
        return false;
      }
    }

    if (room == null) {
      activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN);
      return false;
    } else if (!room.checkLevel(activeChar.getLevel())) {
      activeChar.sendPacket(SystemMessageId.CANT_ENTER_PARTY_ROOM);
      return false;
    } else if (room.getMemberCount() >= room.getMaxMembers()) {
      activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FULL);
      return false;
    }
    room.addMember(activeChar);
    return true;
  }
コード例 #15
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
 public void broadcastPacket(L2GameServerPacket toLeader, L2GameServerPacket toMember) {
   L2PcInstance leader = getLeader();
   for (L2PcInstance player : getMembers())
     if (player == leader) player.sendPacket(toLeader);
     else player.sendPacket(toMember);
 }
コード例 #16
0
ファイル: effects.java プロジェクト: rean1m5/lucera2
  @Override
  public void runCommand(L2PcInstance admin, String... params) {
    if (admin == null) return;

    final String command = params[0];

    if (command.equals("vis") || command.equals("visible")) {
      admin.getAppearance().setVisible();
      admin.broadcastUserInfo(true);
      return;
    } else if (command.equals("invis") || command.equals("invisible")) {
      admin.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      admin.setTarget(admin);
      admin.disableAllSkills();
      admin.getAppearance().setInvisible();
      admin.updateInvisibilityStatus();
      admin.enableAllSkills();
      return;
    } else if (command.equals("earthquake")) {
      try {
        int intensity = Integer.parseInt(params[1]);
        int duration = Integer.parseInt(params[2]);
        Earthquake eq =
            new Earthquake(admin.getX(), admin.getY(), admin.getZ(), intensity, duration);
        admin.broadcastPacket(eq);
      } catch (Exception e) {
        admin.sendMessage("Используйте: //earthquake <intensity> <duration>");
      }
      sendHtml(admin, "effects");
      return;
    } else if (command.equals("atmosphere")) {
      try {
        String type = params[1];
        String state = params[2];
        adminAtmosphere(type, state, admin);
      } catch (Exception ex) {
      }
      sendHtml(admin, "effects");
      return;
    } else if (command.equals("sounds")) {
      methods.showHelpPage(admin, "songs/songs.htm");
      return;
    } else if (command.equals("play_sounds")) {
      try {
        String cmd = "";
        for (int x = 1; x < params.length; x++) cmd += (" " + params[x]);
        methods.showHelpPage(admin, "songs/songs" + cmd + ".htm");
      } catch (StringIndexOutOfBoundsException e) {
      }
      return;
    } else if (command.startsWith("play_sound")) {
      try {
        String cmd = "";
        for (int x = 1; x < params.length; x++) cmd += (" " + params[x]);
        playAdminSound(admin, cmd);
      } catch (StringIndexOutOfBoundsException e) {
      }
      return;
    } else if (command.equals("para")) {
      String type = "1";
      if (params.length > 1) type = params[1];
      try {
        L2Object target = admin.getTarget();
        L2Character player = null;
        if (target instanceof L2Character) {
          player = (L2Character) target;
          if (type.equals("1")) player.startAbnormalEffect(AbnormalEffect.HOLD_1);
          else player.startAbnormalEffect(AbnormalEffect.HOLD_2);
          player.setIsParalyzed(true);
          StopMove sm = new StopMove(player);
          player.sendPacket(sm);
          player.broadcastPacket(sm);
        }
      } catch (Exception e) {
      }
    } else if (command.equals("unpara")) {
      try {
        L2Object target = admin.getTarget();
        L2Character player = null;
        if (target instanceof L2Character) {
          player = (L2Character) target;
          player.stopAbnormalEffect(AbnormalEffect.HOLD_1);
          player.stopAbnormalEffect(AbnormalEffect.HOLD_2);
          player.setIsParalyzed(false);
        }
      } catch (Exception e) {
      }
    } else if (command.equals("para_all") || command.equals("unpara_all")) {
      boolean para = command.equals("para_all");
      try {
        for (L2PcInstance player : admin.getKnownList().getKnownPlayers().values()) {
          if (!player.isGM()) {
            if (para) {
              player.startAbnormalEffect(AbnormalEffect.HOLD_1);
              player.setIsParalyzed(true);
              player.broadcastPacket(new StopMove(player));
            } else {
              player.stopAbnormalEffect(AbnormalEffect.HOLD_1);
              player.setIsParalyzed(false);
            }
          }
        }
      } catch (Exception e) {
      }
      sendHtml(admin, "effects");
      return;
    } else if (command.equals("bighead") || command.equals("shrinkhead")) {
      try {
        L2Object target = admin.getTarget();
        if (target == null) target = admin;
        if (target != null && target instanceof L2Character) {
          if (command.equals("shrinkhead"))
            ((L2Character) target).stopAbnormalEffect(AbnormalEffect.BIG_HEAD);
          else ((L2Character) target).startAbnormalEffect(AbnormalEffect.BIG_HEAD);
        }
      } catch (Exception e) {
      }
      sendHtml(admin, "effects");
      return;
    } else if (command.equals("gmspeed")) {
      try {
        int val = Integer.parseInt(params[1]);
        admin.stopSkillEffects(7029);
        if (val == 0 && admin.getFirstEffect(7029) != null)
          admin.sendPacket(
              new SystemMessage(SystemMessageId.EFFECT_S1_DISAPPEARED).addSkillName(7029));
        else if ((val >= 1) && (val <= 4)) {
          L2Skill gmSpeedSkill = SkillTable.getInstance().getInfo(7029, val);
          admin.doSimultaneousCast(gmSpeedSkill);
        }
      } catch (Exception e) {
        admin.sendMessage("Используйте: //gmspeed [0-4]");
      } finally {
        admin.updateEffectIcons();
      }
      return;
    } else if (command.equals("social") || command.equals("social_menu")) {
      if (command.equals("social_menu")) {
        sendHtml(admin, "submenus/social_menu");
        return;
      }

      try {
        if (params.length == 3) {
          int social = Integer.parseInt(params[1]);
          int radius = Integer.parseInt(params[2]);

          for (L2PcInstance pl : admin.getKnownList().getKnownPlayersInRadius(radius)) {
            if (pl == null
                || pl.isAlikeDead()
                || pl.isOfflineTrade()
                || pl.isTeleporting()
                || pl.inPrivateMode()) continue;
            performSocial(social, pl, admin);
          }
          admin.sendMessage("Социальное дествие отправлено всем в радиусе " + radius);
        } else if (params.length == 2) {
          int social = Integer.parseInt(params[1]);
          L2Object obj = admin.getTarget();
          if (obj == null) obj = admin;

          performSocial(social, obj, admin);
        }
      } catch (Exception e) {
        admin.sendMessage("Используйте: //social [id]");
      }
      sendHtml(admin, "submenus/social_menu");
      return;
    } else if (command.equals("abnormal") || command.equals("abnormal_menu")) {
      if (command.equals("abnormal_menu")) {
        sendHtml(admin, "submenus/abnormal_menu");
        return;
      }

      try {
        if (params.length == 3) {
          int abnormal = Integer.decode("0x" + params[1]);
          int radius = Integer.parseInt(params[2]);

          for (L2PcInstance pl : admin.getKnownList().getKnownPlayersInRadius(radius)) {
            if (pl == null
                || pl.isAlikeDead()
                || pl.isOfflineTrade()
                || pl.isTeleporting()
                || pl.inPrivateMode()) continue;
            performAbnormal(abnormal, pl);
          }
          admin.sendMessage("Эффект отправлен всем в радиусе " + radius);
        } else if (params.length == 2) {
          int abnormal = Integer.decode("0x" + params[1]);
          L2Object obj = admin.getTarget();
          if (obj == null) obj = admin;

          performAbnormal(abnormal, obj);
        }
      } catch (Exception e) {
        admin.sendMessage("Используйте: //social [id]");
      }
      sendHtml(admin, "submenus/abnormal_menu");
      return;
    }
  }
コード例 #17
0
ファイル: effects.java プロジェクト: rean1m5/lucera2
 private void sendHtml(L2PcInstance admin, String patch) {
   String name = (patch + ".htm");
   NpcHtmlMessage html = new NpcHtmlMessage(admin.getObjectId());
   html.setFile("data/html/admin/menus/" + name);
   admin.sendPacket(html);
 }
コード例 #18
0
ファイル: effects.java プロジェクト: rean1m5/lucera2
 private void playAdminSound(L2PcInstance admin, String sound) {
   PlaySound _snd = new PlaySound(1, sound);
   admin.sendPacket(_snd);
   admin.broadcastPacket(_snd);
   admin.sendMessage("Playing " + sound + ".");
 }
コード例 #19
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
 /**
  * Verifies is player is eligible to join this party room.<br>
  * Does not specify a reason, does not send a message.
  *
  * @param activeChar a player
  * @return whether the given player can join this room
  * @see #tryJoin(L2PcInstance, L2PartyRoom, boolean)
  */
 public final boolean canJoin(L2PcInstance activeChar) {
   return (activeChar.getPartyRoom() == null
       && activeChar.getParty() == null
       && checkLevel(activeChar.getLevel())
       && getMemberCount() < getMaxMembers());
 }
コード例 #20
0
ファイル: ClanHall.java プロジェクト: rean1m5/lucera2
 @Override
 public boolean checkBanish(L2PcInstance cha) {
   return cha.getClanId() != getOwnerId();
 }
コード例 #21
0
ファイル: ClanHall.java プロジェクト: rean1m5/lucera2
 public void openCloseDoors(L2PcInstance activeChar, boolean open) {
   if (activeChar != null && activeChar.getClanId() == getOwnerId()) openCloseDoors(open);
 }
コード例 #22
0
ファイル: L2PartyRoom.java プロジェクト: rean1m5/lucera2
 public void broadcastPacket(L2GameServerPacket packet) {
   for (L2PcInstance player : getMembers()) player.sendPacket(packet);
 }
コード例 #23
0
ファイル: Fort.java プロジェクト: rean1m5/lucera2
 public void removeResidentialSkills(L2PcInstance player) {
   if (_residentialSkills != null && _residentialSkills.size() > 0) {
     for (L2Skill sk : _residentialSkills) player.removeSkill(sk, false);
   }
 }
コード例 #24
0
ファイル: Fort.java プロジェクト: rean1m5/lucera2
  /**
   * This method will set owner for Fort
   *
   * @param clan
   * @param updateClanPoints
   */
  public boolean setOwner(L2Clan clan, boolean updateClansReputation) {
    ClanHall hall = ClanHallManager.getInstance().getClanHallByOwner(clan);
    if (hall != null) {
      clan.broadcastToOnlineMembers(
          new SystemMessage(SystemMessageId.S1)
              .addString("Вы потеряли ваш кланхолл " + hall.getName()));
      ClanHallManager.getInstance().setFree(hall.getId());
      AuctionManager.getInstance().initNPC(hall.getId());
    }
    if (clan.getAuctionBiddedAt() > 0) {
      Auction a = AuctionManager.getInstance().getAuction(clan.getAuctionBiddedAt());
      if (a != null) {
        a.cancelAuction();
        clan.broadcastToOnlineMembers(
            new SystemMessage(SystemMessageId.S1).addString("Ваше участие в аукционе отменено"));
      }
    }

    if (updateClansReputation) updateClansReputation(clan, false); // update reputation first

    for (L2PcInstance member : clan.getOnlineMembers(0)) {
      giveResidentialSkills(member);
      member.sendSkillList();
    }

    // Remove old owner
    if (getOwnerClan() != null && (clan != null && clan != getOwnerClan())) {
      updateClansReputation(clan, true);
      L2PcInstance oldLord = getOwnerClan().getLeader().getPlayerInstance();
      if (oldLord != null && oldLord.getMountType() == 2) oldLord.dismount();
      removeOwner(true);
    }
    setFortState(0, 0); // initialize fort state
    //	if clan already have castle, don't store him in fortress
    if (clan.getHasCastle() > 0) {
      getSiege()
          .announceToPlayer(
              new SystemMessage(SystemMessageId.S1).addString("Форт снова пренадлежит NPC"),
              0,
              false);
      return false;
    } else {
      getSpawnManager().spawnSpecialEnvoys();
      ThreadPoolManager.getInstance()
          .scheduleGeneral(
              new ScheduleSpecialEnvoysDeSpawn(this),
              1 * 60 * 60 * 1000); // Prepare 1hr task for special envoys despawn
      // if clan have already fortress, remove it
      if (clan.getHasFort() > 0) FortManager.getInstance().getFortByOwner(clan).removeOwner(true);

      setOwnerClan(clan);
      _ownerId = clan.getClanId();
      updateOwnerInDB(); // Update in database

      if (getSiege().getIsInProgress()) { // If siege in progress
        if (Config.FORTSIEGE_REWARD_ID > 0) {
          clan.getWarehouse()
              .addItem(
                  "Siege", Config.FORTSIEGE_REWARD_ID, Config.FORTSIEGE_REWARD_COUNT, null, null);
          if (clan.getLeader().getPlayerInstance() != null)
            clan.getLeader()
                .getPlayerInstance()
                .sendMessage(
                    "Your clan obtain "
                        + Config.FORTSIEGE_REWARD_COUNT
                        + " "
                        + ItemTable.getInstance().getItemName(Config.FORTSIEGE_REWARD_ID));
        }

        getSiege().endSiege();
      }
      return true;
    }
  }