Пример #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 L2ClanMember(L2Clan clan, L2PcInstance player) {
   _clan = clan;
   _name = player.getName();
   _level = player.getLevel();
   _classId = player.getBaseClassId();
   _objectId = player.getObjectId();
   _pledgeType = player.getPledgeType();
   _powerGrade = player.getPowerGrade();
   _title = player.getTitle();
   _sponsor = 0;
   _apprentice = 0;
   _sex = player.getAppearance().getSex();
   _raceOrdinal = player.getRace().ordinal();
 }
Пример #3
0
 public L2ClanMember(L2PcInstance player) {
   if (player.getClan() == null) {
     throw new IllegalArgumentException("Can not create a ClanMember if player has a null clan.");
   }
   _clan = player.getClan();
   _player = player;
   _name = _player.getName();
   _level = _player.getLevel();
   _classId = _player.getBaseClassId();
   _objectId = _player.getObjectId();
   _powerGrade = _player.getPowerGrade();
   _pledgeType = _player.getPledgeType();
   _title = _player.getTitle();
   _apprentice = 0;
   _sponsor = 0;
   _sex = _player.getAppearance().getSex();
   _raceOrdinal = _player.getRace().ordinal();
 }
Пример #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;
  }
Пример #5
0
 public int getPledgeType() {
   if (_player != null) {
     return _player.getPledgeType();
   }
   return _pledgeType;
 }