示例#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
  private void kill(L2PcInstance activeChar, L2Character target) {
    if (target instanceof L2PcInstance) {
      if (!target.isGM()) {
        target.stopAllEffects(); // e.g. invincibility effect
      }
      target.reduceCurrentHp(target.getMaxHp() + target.getMaxCp() + 1, activeChar, null);
    } else {
      boolean targetIsInvul = false;
      if (target.isInvul()) {
        targetIsInvul = true;
        target.setIsInvul(false);
      }

      target.reduceCurrentHp(target.getMaxHp() + 1, activeChar, null);

      if (targetIsInvul) {
        target.setIsInvul(true);
      }
    }
    if (Config.DEBUG) {
      _log.log(
          Level.DEBUG,
          "GM: "
              + activeChar.getName()
              + '('
              + activeChar.getObjectId()
              + ')'
              + " killed character "
              + target.getObjectId());
    }
  }
 @Override
 protected void writeImpl() {
   writeD(_activeChar.getObjectId());
   writeD(shipId);
   writeD(x);
   writeD(y);
   writeD(z);
   writeD(h);
 }
示例#4
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();
 }
示例#5
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();
 }
示例#6
0
  @Override
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets) {
    if (!(activeChar instanceof L2PcInstance)) {
      return;
    }

    boolean isMastersCall = skill.getId() == 23249;

    L2PcInstance activePlayer = activeChar.getActingPlayer();

    if (!isMastersCall && !activePlayer.getSummonFriendController().checkSummonerStatus()) {
      return;
    }

    try {
      for (L2Character target : (L2Character[]) targets) {
        if (target == null || activeChar.equals(target) || !target.isPlayer()) {
          continue;
        }

        if (isMastersCall) // Master's Call
        {
          L2Party party = target.getParty();
          if (party != null) {
            party
                .getMembers()
                .stream()
                .filter(partyMember -> !target.equals(partyMember))
                .forEach(
                    partyMember ->
                        partyMember.teleToLocation(
                            target.getX(), target.getY(), target.getZ(), true));
          } else {
            activePlayer.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                    .addSkillName(skill));
          }
        } else {
          if (skill.isClanSkill()) // Призыв Клана
          {
            if (!target.getActingPlayer().isInSameClan(activePlayer)) {
              activePlayer.sendPacket(
                  SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                      .addSkillName(skill));
              continue;
            } else if (!target.getActingPlayer().isInSameParty(activePlayer)) {
              activePlayer.sendPacket(
                  SystemMessage.getSystemMessage(SystemMessageId.S1_CANNOT_BE_USED)
                      .addSkillName(skill));
              continue;
            }
          }

          L2PcInstance targetPlayer = target.getActingPlayer();

          if (!Util.checkIfInRange(500, activeChar, target, false)) {
            if (!targetPlayer.getSummonFriendController().setSummoner(activePlayer, skill)) {
              SystemMessage sm =
                  SystemMessage.getSystemMessage(SystemMessageId.C1_ALREADY_SUMMONED);
              sm.addString(target.getName());
              activePlayer.sendPacket(sm);
            }

            ConfirmDlg confirm =
                new ConfirmDlg(
                    SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
            confirm.addCharName(activeChar);
            confirm.addZoneName(activeChar.getX(), activeChar.getY(), activeChar.getZ());
            confirm.addTime(30000);
            confirm.addRequesterId(activePlayer.getObjectId());
            target.sendPacket(confirm);
            // targetPlayer.getSummonFriendController().teleport();
          }
        }
      }
    } catch (Exception e) {
      _log.log(Level.ERROR, "", e);
    }
  }
 @Override
 public String onAsk(L2PcInstance player, L2Npc npc, QuestState st, int reply) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (npcId == Rafforty) {
     switch (reply) {
       case 1:
         return "repre_q10283_04.htm";
       case 2:
         if (cond == 1) {
           return "repre_q10283_07.htm";
         }
       case 3:
         if (cond == 1) {
           return "repre_q10283_08.htm";
         }
       case 4:
         if (cond == 1) {
           st.setCond(2);
           st.setMemoState(2);
           st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
           return "repre_q10283_09.htm";
         }
     }
   } else if (npcId == Kier) {
     switch (reply) {
       case 1:
         if (cond == 2) {
           return "keier_q10283_01.htm";
         }
       case 2:
         if (cond == 2) {
           if (currentTalkingWithKier == -1) {
             st.setCond(3);
             st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
             currentTalkingWithKier = player.getObjectId();
             L2Npc jinia = addSpawn(Jinia, 104476, -107535, -3688, 44954, false, 60000);
             jinia.setOwner(player);
             startQuestTimer("resetCurrentTalkingWithKier", 60000, npc, player);
           } else {
             return currentTalkingWithKier == player.getObjectId()
                 ? "keier_q10283_03.htm"
                 : "keier_q10283_02.htm";
           }
         }
     }
   } else if (npcId == Jinia) {
     switch (reply) {
       case 1:
         if (st.getMemoState() == 2) {
           return "jinia_npc_q10283_01.htm";
         }
         break;
       case 2:
         if (st.getMemoState() == 2) {
           return "jinia_npc_q10283_02.htm";
         }
         break;
       case 3:
         if (st.getMemoState() == 2) {
           st.giveAdena(190000, true);
           st.addExpAndSp(627000, 50300);
           st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
           st.exitQuest(QuestType.ONE_TIME);
           npc.getLocationController()
               .delete(); // TODO: myself->AddFleeDesire(talker,1000000); бежать в рандомном
           // направлении и deleteMe
           return "jinia_npc_q10283_03.htm";
         }
     }
   }
   return null;
 }
示例#8
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;
  }
示例#9
0
 /** @return the objectId. */
 public int getObjectId() {
   if (_player != null) {
     return _player.getObjectId();
   }
   return _objectId;
 }