コード例 #1
0
ファイル: Fort.java プロジェクト: 3mRe/L2Java
 public void removeOwner(boolean updateDB) {
   L2Clan clan = getOwnerClan();
   if (clan != null) {
     for (L2PcInstance member : clan.getOnlineMembers(0)) {
       removeResidentialSkills(member);
       member.sendSkillList();
     }
     clan.setFortId(0);
     clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
     setOwnerClan(null);
     setSupplyLvL(0);
     saveFortVariables();
     removeAllFunctions();
     if (updateDB) {
       updateOwnerInDB();
     }
   }
 }
コード例 #2
0
ファイル: Options.java プロジェクト: 54k/L2J_Server
 public void remove(L2PcInstance player) {
   player.sendDebugMessage("Deactivating option id: " + _id);
   if (hasFuncs()) {
     player.removeStatsOwner(this);
   }
   if (hasActiveSkill()) {
     player.removeSkill(getActiveSkill().getSkill(), false, false);
     player.sendDebugMessage("Removing active skill: " + getActiveSkill());
   }
   if (hasPassiveSkill()) {
     player.removeSkill(getPassiveSkill().getSkill(), false, true);
     player.sendDebugMessage("Removing passive skill: " + getPassiveSkill());
   }
   if (hasActivationSkills()) {
     for (OptionsSkillHolder holder : _activationSkills) {
       player.removeTriggerSkill(holder);
       player.sendDebugMessage("Removing trigger skill: " + holder);
     }
   }
   player.sendSkillList();
 }
コード例 #3
0
ファイル: Options.java プロジェクト: 54k/L2J_Server
  public void apply(L2PcInstance player) {
    player.sendDebugMessage("Activating option id: " + _id);
    if (hasFuncs()) {
      player.addStatFuncs(getStatFuncs(null, player));
    }
    if (hasActiveSkill()) {
      addSkill(player, getActiveSkill().getSkill());
      player.sendDebugMessage("Adding active skill: " + getActiveSkill());
    }
    if (hasPassiveSkill()) {
      addSkill(player, getPassiveSkill().getSkill());
      player.sendDebugMessage("Adding passive skill: " + getPassiveSkill());
    }
    if (hasActivationSkills()) {
      for (OptionsSkillHolder holder : _activationSkills) {
        player.addTriggerSkill(holder);
        player.sendDebugMessage("Adding trigger skill: " + holder);
      }
    }

    player.sendSkillList();
  }
コード例 #4
0
ファイル: Fort.java プロジェクト: 3mRe/L2Java
  /**
   * This method will set owner for Fort
   *
   * @param clan
   * @param updateClansReputation
   * @return
   */
  public boolean setOwner(L2Clan clan, boolean updateClansReputation) {
    if (clan == null) {
      _log.warning(getClass().getSimpleName() + ": Updating Fort owner with null clan!!!");
      return false;
    }

    final SystemMessage sm =
        SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_OF_S1_HAS_FINISHED);
    sm.addCastleId(getResidenceId());
    getSiege().announceToPlayer(sm);

    final L2Clan oldowner = getOwnerClan();
    if ((oldowner != null) && (clan != oldowner)) {
      // Remove points from old owner
      updateClansReputation(oldowner, true);
      try {
        L2PcInstance oldleader = oldowner.getLeader().getPlayerInstance();
        if (oldleader != null) {
          if (oldleader.getMountType() == MountType.WYVERN) {
            oldleader.dismount();
          }
        }
      } catch (Exception e) {
        _log.log(Level.WARNING, "Exception in setOwner: " + e.getMessage(), e);
      }
      removeOwner(true);
    }
    setFortState(0, 0); // initialize fort state

    // if clan already have castle, don't store him in fortress
    if (clan.getCastleId() > 0) {
      getSiege()
          .announceToPlayer(
              SystemMessage.getSystemMessage(
                  SystemMessageId.THE_REBEL_ARMY_RECAPTURED_THE_FORTRESS));
      return false;
    }

    // Give points to new owner
    if (updateClansReputation) {
      updateClansReputation(clan, false);
    }

    spawnSpecialEnvoys();
    // if clan have already fortress, remove it
    if (clan.getFortId() > 0) {
      FortManager.getInstance().getFortByOwner(clan).removeOwner(true);
    }

    setSupplyLvL(0);
    setOwnerClan(clan);
    updateOwnerInDB(); // Update in database
    saveFortVariables();

    if (getSiege().isInProgress()) {
      getSiege().endSiege();
    }

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