Пример #1
0
  public void setPlayerInstance(L2PcInstance player) {
    if (player == null && _player != null) {
      // this is here to keep the data when the player logs off
      _name = _player.getName();
      _level = _player.getLevel();
      _classId = _player.getBaseClassId();
      _objectId = _player.getObjectId();
      _powerGrade = _player.getPowerGrade();
      _pledgeType = _player.getPledgeType();
      _title = _player.getTitle();
      _apprentice = _player.getApprentice();
      _sponsor = _player.getSponsor();
      _sex = _player.getAppearance().getSex();
      _raceOrdinal = _player.getRace().ordinal();
    }

    if (player != null) {
      _clan.addSkillEffects(player);
      if (_clan.getLevel() > 3 && player.isClanLeader()) {
        CastleSiegeManager.getInstance().addSiegeSkills(player);
      }
      if (player.isClanLeader()) {
        _clan.setLeader(this);
      }
    }

    _player = player;
  }
Пример #2
0
  public String getApprenticeOrSponsorName() {
    if (_player != null) {
      _apprentice = _player.getApprentice();
      _sponsor = _player.getSponsor();
    }

    if (_apprentice != 0) {
      L2ClanMember apprentice = _clan.getClanMember(_apprentice);
      return apprentice != null ? apprentice.getName() : "Error";
    }
    if (_sponsor != 0) {
      L2ClanMember sponsor = _clan.getClanMember(_sponsor);
      return sponsor != null ? sponsor.getName() : "Error";
    }
    return "";
  }
Пример #3
0
 public ClanInfo(final L2Clan clan) {
   _clan = clan;
   _total = clan.getMembersCount();
   _online = clan.getOnlineMembersCount();
 }
Пример #4
0
  public int calculatePledgeClass(L2PcInstance player) {
    int pledgeClass = 0;

    if (player == null) {
      return pledgeClass;
    }

    L2Clan clan = player.getClan();
    if (clan != null) {
      switch (clan.getLevel()) {
        case 4:
          if (player.isClanLeader()) {
            pledgeClass = 3;
          }
          break;
        case 5:
          pledgeClass = player.isClanLeader() ? 4 : 2;
          break;
        case 6:
          switch (player.getPledgeType()) {
            case -1:
              pledgeClass = 1;
              break;
            case 100:
            case 200:
              pledgeClass = 2;
              break;
            case 0:
              if (player.isClanLeader()) {
                pledgeClass = 5;
              } else {
                switch (clan.getLeaderSubPledge(player.getObjectId())) {
                  case 100:
                  case 200:
                    pledgeClass = 4;
                    break;
                  case -1:
                  default:
                    pledgeClass = 3;
                    break;
                }
              }
              break;
          }
          break;
        case 7:
          switch (player.getPledgeType()) {
            case -1:
              pledgeClass = 1;
              break;
            case 100:
            case 200:
              pledgeClass = 3;
              break;
            case 1001:
            case 1002:
            case 2001:
            case 2002:
              pledgeClass = 2;
              break;
            case 0:
              if (player.isClanLeader()) {
                pledgeClass = 7;
              } else {
                switch (clan.getLeaderSubPledge(player.getObjectId())) {
                  case 100:
                  case 200:
                    pledgeClass = 6;
                    break;
                  case 1001:
                  case 1002:
                  case 2001:
                  case 2002:
                    pledgeClass = 5;
                    break;
                  case -1:
                  default:
                    pledgeClass = 4;
                    break;
                }
              }
              break;
          }
          break;
        case 8:
          switch (player.getPledgeType()) {
            case -1:
              pledgeClass = 1;
              break;
            case 100:
            case 200:
              pledgeClass = 4;
              break;
            case 1001:
            case 1002:
            case 2001:
            case 2002:
              pledgeClass = 3;
              break;
            case 0:
              if (player.isClanLeader()) {
                pledgeClass = 8;
              } else {
                switch (clan.getLeaderSubPledge(player.getObjectId())) {
                  case 100:
                  case 200:
                    pledgeClass = 7;
                    break;
                  case 1001:
                  case 1002:
                  case 2001:
                  case 2002:
                    pledgeClass = 6;
                    break;
                  case -1:
                  default:
                    pledgeClass = 5;
                    break;
                }
              }
              break;
          }
          break;
        case 9:
          switch (player.getPledgeType()) {
            case -1:
              pledgeClass = 1;
              break;
            case 100:
            case 200:
              pledgeClass = 5;
              break;
            case 1001:
            case 1002:
            case 2001:
            case 2002:
              pledgeClass = 4;
              break;
            case 0:
              if (player.isClanLeader()) {
                pledgeClass = 9;
              } else {
                switch (clan.getLeaderSubPledge(player.getObjectId())) {
                  case 100:
                  case 200:
                    pledgeClass = 8;
                    break;
                  case 1001:
                  case 1002:
                  case 2001:
                  case 2002:
                    pledgeClass = 7;
                    break;
                  case -1:
                  default:
                    pledgeClass = 6;
                    break;
                }
              }
              break;
          }
          break;
        case 10:
          switch (player.getPledgeType()) {
            case -1:
              pledgeClass = 1;
              break;
            case 100:
            case 200:
              pledgeClass = 6;
              break;
            case 1001:
            case 1002:
            case 2001:
            case 2002:
              pledgeClass = 5;
              break;
            case 0:
              if (player.isClanLeader()) {
                pledgeClass = 10;
              } else {
                switch (clan.getLeaderSubPledge(player.getObjectId())) {
                  case 100:
                  case 200:
                    pledgeClass = 9;
                    break;
                  case 1001:
                  case 1002:
                  case 2001:
                  case 2002:
                    pledgeClass = 8;
                    break;
                  case -1:
                  default:
                    pledgeClass = 7;
                    break;
                }
              }
              break;
          }
          break;
        case 11:
          switch (player.getPledgeType()) {
            case -1:
              pledgeClass = 1;
              break;
            case 100:
            case 200:
              pledgeClass = 7;
              break;
            case 1001:
            case 1002:
            case 2001:
            case 2002:
              pledgeClass = 6;
              break;
            case 0:
              if (player.isClanLeader()) {
                pledgeClass = 11;
              } else {
                switch (clan.getLeaderSubPledge(player.getObjectId())) {
                  case 100:
                  case 200:
                    pledgeClass = 10;
                    break;
                  case 1001:
                  case 1002:
                  case 2001:
                  case 2002:
                    pledgeClass = 9;
                    break;
                  case -1:
                  default:
                    pledgeClass = 8;
                    break;
                }
              }
              break;
          }
          break;
        default:
          pledgeClass = 1;
          break;
      }
    }
    return pledgeClass;
  }