public void givePcCafePoint(final L2PcInstance player, final long givedexp) {
    if (!Config.PC_BANG_ENABLED) return;

    if (player.isInsideZone(L2Character.ZONE_PEACE)
        || player.isInsideZone(L2Character.ZONE_PVP)
        || player.isInsideZone(L2Character.ZONE_SIEGE)
        || player.isOnlineInt() == 0
        || player.isInJail()) return;
    if (player.getPcBangPoints() >= Config.MAX_PC_BANG_POINTS) {
      final SystemMessage sm =
          SystemMessage.getSystemMessage(
              SystemMessageId
                  .THE_MAXMIMUM_ACCUMULATION_ALLOWED_OF_PC_CAFE_POINTS_HAS_BEEN_EXCEEDED);
      player.sendPacket(sm);
      return;
    }
    int _points = (int) (givedexp * 0.0001 * Config.PC_BANG_POINT_RATE);
    if (player.getActiveClass() == ClassId.archmage.getId()
        || player.getActiveClass() == ClassId.soultaker.getId()
        || player.getActiveClass() == ClassId.stormScreamer.getId()
        || player.getActiveClass() == ClassId.mysticMuse.getId()) _points /= 2;
    if (Config.RANDOM_PC_BANG_POINT) _points = Rnd.get(_points / 2, _points);
    boolean doublepoint = false;
    SystemMessage sm = null;
    if (_points > 0) {
      if (Config.ENABLE_DOUBLE_PC_BANG_POINTS
          && Rnd.get(100) < Config.DOUBLE_PC_BANG_POINTS_CHANCE) {
        _points *= 2;
        sm = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_PCPOINT_DOUBLE);
        doublepoint = true;
      } else {
        sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ACQUIRED_S1_PC_CAFE_POINTS);
      }
      if (player.getPcBangPoints() + _points > Config.MAX_PC_BANG_POINTS)
        _points = Config.MAX_PC_BANG_POINTS - player.getPcBangPoints();
      sm.addNumber(_points);
      player.sendPacket(sm);
      player.setPcBangPoints(player.getPcBangPoints() + _points);
      player.sendPacket(
          new ExPCCafePointInfo(player.getPcBangPoints(), _points, true, doublepoint, 1));
    }
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) {
    L2PcInstance partyMember = getRandomPartyMember(player, "1");
    if (partyMember == null) return null;
    final QuestState st = partyMember.getQuestState(qn);
    int chance = Rnd.get(1000);
    boolean giveItem = false;

    switch (npc.getNpcId()) {
      case 22771: // Tanta Lizardman Berserker
        if (chance < 159) giveItem = true;
        break;
      case 22770: // Tanta Lizardman Soldier
        if (chance < 123) giveItem = true;
        break;
      case 22774: // Tanta Lizardman Summoner
        if (chance < 261) giveItem = true;
        break;
      case 22769: // Tanta Lizardman Warrior
        if (chance < 689) giveItem = true;
        break;
      case 22772: // Tanta Lizardman Archer
        if (chance < 739) giveItem = true;
        break;
      case 22768: // Tanta Lizardman Scout
        if (chance < 509) giveItem = true;
        break;
      case 22773: // Tanta Lizardman Magician
        if (chance < 737) giveItem = true;
        break;
    }

    if (giveItem) {
      st.giveItems(VialOfTantaBlood, 1);
      st.playSound("ItemSound.quest_itemget");
    }
    return null;
  }
예제 #3
0
  /**
   * Spawn all NPCs in kamaloka
   *
   * @param world instanceWorld
   */
  @SuppressWarnings("all")
  private final void spawnKama(KamaWorld world) {
    int[] npcs;
    int[][] spawns;
    L2Npc npc;
    final int index = world.index;

    // first room
    npcs = FIRST_ROOM[index];
    spawns = FIRST_ROOM_SPAWNS[index];
    if (npcs != null) {
      world.firstRoom = new ArrayList<L2Spawn>(spawns.length - 1);
      int shaman = Rnd.get(spawns.length); // random position for shaman

      for (int i = 0; i < spawns.length; i++) {
        if (i == shaman) {
          // stealth shaman use same npcId as other mobs
          npc =
              addSpawn(
                  STEALTH_SHAMAN ? npcs[1] : npcs[0],
                  spawns[i][0],
                  spawns[i][1],
                  spawns[i][2],
                  0,
                  false,
                  0,
                  false,
                  world.instanceId);
          world.shaman = npc.getObjectId();
        } else {
          npc =
              addSpawn(
                  npcs[1],
                  spawns[i][0],
                  spawns[i][1],
                  spawns[i][2],
                  0,
                  false,
                  0,
                  false,
                  world.instanceId);
          L2Spawn spawn = npc.getSpawn();
          spawn.setRespawnDelay(FIRST_ROOM_RESPAWN_DELAY);
          spawn.setAmount(1);
          spawn.startRespawn();
          world.firstRoom.add(spawn); // store mobs spawns
        }
        npc.setIsNoRndWalk(true);
      }
    }

    // second room
    npcs = SECOND_ROOM[index];
    spawns = SECOND_ROOM_SPAWNS[index];
    if (npcs != null) {
      world.secondRoom = new ArrayList<Integer>(spawns.length);

      for (int i = 0; i < spawns.length; i++) {
        npc =
            addSpawn(
                npcs[0],
                spawns[i][0],
                spawns[i][1],
                spawns[i][2],
                0,
                false,
                0,
                false,
                world.instanceId);
        npc.setIsNoRndWalk(true);
        world.secondRoom.add(npc.getObjectId());
      }
    }

    // miniboss
    if (MINIBOSS[index] != null) {
      npc =
          addSpawn(
              MINIBOSS[index][0],
              MINIBOSS[index][1],
              MINIBOSS[index][2],
              MINIBOSS[index][3],
              0,
              false,
              0,
              false,
              world.instanceId);
      npc.setIsNoRndWalk(true);
      world.miniBoss = npc.getObjectId();
    }

    // escape teleporter
    if (TELEPORTERS[index] != null)
      addSpawn(
          TELEPORTER,
          TELEPORTERS[index][0],
          TELEPORTERS[index][1],
          TELEPORTERS[index][2],
          0,
          false,
          0,
          false,
          world.instanceId);

    // boss
    npc =
        addSpawn(
            BOSS[index][0],
            BOSS[index][1],
            BOSS[index][2],
            BOSS[index][3],
            0,
            false,
            0,
            false,
            world.instanceId);
    ((L2MonsterInstance) npc).setOnKillDelay(100);
    world.boss = npc;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    QuestState st = player.getQuestState(qn);

    if (st == null) return htmltext;

    if (event.equalsIgnoreCase("32742-03.htm")) {
      st.set("cond", "1");
      st.playSound("ItemSound.quest_accept");
      st.setState(State.STARTED);
    } else if (event.equalsIgnoreCase("Icarus")) {
      if (st.getQuestItemsCount(VialOfTantaBlood) >= 500) {
        st.takeItems(VialOfTantaBlood, 500);
        int i0 = Rnd.get(5);
        if (i0 == 0) st.giveItems(10381, 1);
        else if (i0 == 1) st.giveItems(10405, 1);
        else if (i0 == 2) st.giveItems(10405, 4);
        else if (i0 == 3) st.giveItems(10405, 4);
        else st.giveItems(10405, 6);
        st.playSound("ItemSound.quest_finish");
        htmltext = "32742-06.html";
      } else htmltext = "32742-07.html";
    } else if (event.equalsIgnoreCase("Moirai")) {
      if (st.getQuestItemsCount(VialOfTantaBlood) >= 100) {
        st.takeItems(VialOfTantaBlood, 100);
        int i0 = Rnd.get(10);
        if (i0 == 0) st.giveItems(15776, 1);
        else if (i0 == 1) st.giveItems(15779, 1);
        else if (i0 == 2) st.giveItems(15782, 1);
        else if (i0 == 3) {
          boolean i1 = Rnd.nextBoolean();
          if (!i1) st.giveItems(15785, 1);
          else st.giveItems(15788, 1);
        } else if (i0 == 4) {
          int i1 = Rnd.get(10);
          if (i1 < 4) st.giveItems(15812, 1);
          else if (i1 < 8) st.giveItems(15813, 1);
          else st.giveItems(15814, 1);
        } else if (i0 == 5) st.giveItems(15646, 5);
        else if (i0 == 6) st.giveItems(15649, 5);
        else if (i0 == 7) st.giveItems(15652, 5);
        else if (i0 == 8) {
          boolean i1 = Rnd.nextBoolean();
          if (!i1) st.giveItems(15655, 5);
          else st.giveItems(15658, 5);
        } else {
          int i1 = Rnd.get(10);
          if (i1 < 4) st.giveItems(15772, 1);
          else if (i1 < 7) st.giveItems(15773, 1);
          else st.giveItems(15774, 1);
        }
        st.playSound("ItemSound.quest_finish");
        htmltext = "32742-08.html";
      } else htmltext = "32742-09.html";
    } else if (event.equalsIgnoreCase("32742-11.html")) {
      if (st.hasQuestItems(VialOfTantaBlood)) htmltext = "32742-11.html";
      else {
        st.playSound("ItemSound.quest_finish");
        st.exitQuest(true);
        htmltext = "32742-12.html";
      }
    } else if (event.equalsIgnoreCase("32742-13.html")) {
      st.takeItems(VialOfTantaBlood, -1);
      st.playSound("ItemSound.quest_finish");
      st.exitQuest(true);
      htmltext = "32742-12.html";
    }
    return htmltext;
  }