Example #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;
  }
Example #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());
    }
  }
Example #3
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();
 }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (npc.getNpcId() == EDRIC) {
      if (player.getLevel() < 75) {
        return "32527-00.htm";
      } else if (st.isCreated()) {
        return "32527-01.htm";
      } else if (player.isGM()) {
        st.startQuest();
        return "32527-10.html";
      } else if (st.getCond() == 1) {
        L2Party party = player.getParty();
        if (st.getInt("timeDiff") > 0) {
          if (giveReward(st, st.getInt("timeDiff"))) {
            // Clear quest
            st.unset("timeDiff");
            st.unset("cond");
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.REPEATABLE);
            return "32527-reward.html";
          } else {
            // Clear quest
            st.unset("timeDiff");
            st.unset("cond");
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.REPEATABLE);
            return "32527-noreward.html";
          }
        } else if (party == null) {
          return "32527-noparty.html";
        } else if (!party.getLeader().equals(player)) {
          return prepareHtml(player, "32527-noleader.html", party.getLeader().getName());
        } else {
          for (L2PcInstance pm : party.getMembers()) {
            QuestState state = pm.getQuestState(getClass());
            if (state == null || state.getCond() != 1) {
              return prepareHtml(player, "32527-noquest.html", pm.getName());
            }
          }
          return "32527-10.html";
        }
      }
    }
    return null;
  }
Example #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();
 }
 @Override
 public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
   QuestState st = player.getQuestState(getClass());
   if (st == null) {
     return null;
   }
   if (npc.getNpcId() == SHILENSEVIL && st.getCond() == 3) {
     npc.broadcastPacket(
         new NS(
                 npc.getObjectId(),
                 ChatType.NPC_ALL,
                 npc.getNpcId(),
                 NpcStringId.S1_YOU_MAY_HAVE_WON_THIS_TIME_BUT_NEXT_TIME_I_WILL_SURELY_CAPTURE_YOU)
             .addStringParameter(player.getName()));
     st.giveItems(SCULPTURE, 1);
     st.setCond(4);
   }
   return null;
 }
Example #7
0
 /** @return the name. */
 public String getName() {
   if (_player != null) {
     return _player.getName();
   }
   return _name;
 }