@Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getClass());
    if (st == null) {
      return getNoQuestMsg(player);
    }

    switch (event) {
      case "31331-0.html":
        st.startQuest();
        break;
      case "31331-1.html":
        st.set("raid", "1");
        player.sendPacket(new RadarControl(0, 2, 186304, -43744, -3193));
        break;
      case "31331-2.html":
        st.set("raid", "2");
        player.sendPacket(new RadarControl(0, 2, 134672, -115600, -1216));
        break;
      case "31331-3.html":
        st.set("raid", "3");
        player.sendPacket(new RadarControl(0, 2, 170000, -60000, -3500));
        break;
      case "31331-4.html":
        st.set("raid", "4");
        player.sendPacket(new RadarControl(0, 2, 93296, -75104, -1824));
        break;
      case "31331-5.html":
        st.exitQuest(QuestType.REPEATABLE);
        break;
    }
    return event;
  }
  @Override
  public String onEvent(String event, QuestState st) {
    String htmltext = event;

    switch (event) {
      case "32114-05.htm":
        st.startQuest();
        break;
      case "32114-12.htm":
        st.giveItems(GAZKHFRAG, 1);
        st.setCond(2);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32114-13.htm":
        st.setCond(2);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32117-08.htm":
        st.setCond(3);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32117-16.htm":
        st.setCond(5);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32119-20.htm":
        st.setCond(6);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32120-19.htm":
        st.setCond(7);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "32121-23.htm":
        st.giveItems(EPITAPH, 1);
        st.setCond(8);
        st.playSound(QuestSound.ITEMSOUND_QUEST_MIDDLE);
        break;
      case "T32119":
        htmltext = "32119-05.htm";
        if (st.getInt("T32119") < 1) {
          st.set("T32119", "1");
        }
        break;
      case "E32119":
        htmltext = "32119-06.htm";
        if (st.getInt("E32119") < 1) {
          st.set("E32119", "1");
        }
        break;
      case "P32119":
        htmltext = "32119-07.htm";
        if (st.getInt("P32119") < 1) {
          st.set("P32119", "1");
        }
        break;
      case "U32119":
        if (st.getInt("U32119") < 1) {
          st.set("U32119", "1");
        }
        htmltext = getWordText32119(st);
        break;
      case "T32120":
        htmltext = "32120-05.htm";
        if (st.getInt("T32120") < 1) {
          st.set("T32120", "1");
        }
        break;
      case "O32120":
        htmltext = "32120-06.htm";
        if (st.getInt("O32120") < 1) {
          st.set("O32120", "1");
        }
        break;
      case "O32120_2":
        htmltext = "32120-07.htm";
        if (st.getInt("O32120_2") < 1) {
          st.set("O32120_2", "1");
        }
        break;
      case "N32120":
        if (st.getInt("N32120") < 1) {
          st.set("N32120", "1");
        }
        htmltext = getWordText32120(st);
        break;
      case "W32121":
        htmltext = "32121-05.htm";
        if (st.getInt("W32121") < 1) {
          st.set("W32121", "1");
        }
        break;
      case "A32121":
        htmltext = "32121-06.htm";
        if (st.getInt("A32121") < 1) {
          st.set("A32121", "1");
        }
        break;
      case "G32121":
        htmltext = "32121-07.htm";
        if (st.getInt("G32121") < 1) {
          st.set("G32121", "1");
        }
        break;
      case "U32121":
        if (st.getInt("U32121") < 1) {
          st.set("U32121", "1");
        }
        htmltext = getWordText32121(st);
        break;
    }
    return htmltext;
  }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   QuestState st = player.getQuestState(getClass());
   if (st == null) {
     return null;
   }
   if (event.equalsIgnoreCase("Wilbert_IWantToPlay.htm")) {
     st.startQuest();
     st.set("round", "0");
   } else if (event.equalsIgnoreCase("Wilbert_ExitQuest.htm")) {
     st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
     st.exitQuest(QuestType.REPEATABLE);
   } else if (event.equalsIgnoreCase("Wilbert_IWantToPractice.htm")) {
     int beads = (int) st.getQuestItemsCount(SPIRIT_BEAD);
     if (beads < 1) {
       event = "Wilbert_Practice_NotEnoughBeads.htm";
     }
   } else if (event.equalsIgnoreCase("Wilbert_Practice.htm")) {
     int beads =
         (int) st.getQuestItemsCount(SPIRIT_BEAD); // получаем количество бусин, должно быть > 1
     if (beads < 1) {
       event = "Wilbert_Practice_NotEnoughBeads.htm";
     } else {
       st.takeItems(SPIRIT_BEAD, 1); // забираем одну бусину для теста на удачу
       int random = st.getRandom(100);
       event = random < WIN_ROUND_CHANCE ? "Wilbert_PracticeWon.htm" : "Wilbert_PracticeLost.htm";
     }
   } else if (event.equalsIgnoreCase("Wilbert_LetsPlay.htm")) {
     int beads = (int) st.getQuestItemsCount(SPIRIT_BEAD);
     if (beads < 50) {
       event = "Wilbert_Practice_NotEnoughBeads.htm";
     } else {
       event = "Wilbert_PlayRound1.htm";
       st.set("round", "0");
     }
   } else if (event.equalsIgnoreCase("Wilbert_PullCard.htm")) {
     int round = st.getInt("round");
     int beads = (int) st.getQuestItemsCount(SPIRIT_BEAD);
     if (beads < 50 && round == 0) {
       event = "Wilbert_Practice_NotEnoughBeads.htm";
     } else {
       if (round == 0) {
         st.takeItems(SPIRIT_BEAD, 50);
       }
       int random = st.getRandom(100);
       if (random > WIN_ROUND_CHANCE) {
         event = "Wilbert_PlayLose.htm";
         st.set("round", "0");
       } else {
         round += 1;
         event = st.showHtmlFile("Wilbert_PlayWin.htm").replace("NROUND", String.valueOf(round));
         switch (round) {
           case 1:
             event = event.replace("MYPRIZE", "40,000 Аден");
             break;
           case 2:
             event = event.replace("MYPRIZE", "80,000 Аден");
             break;
           case 3:
             event = event.replace("MYPRIZE", "110,000 Аден, D-grade Enchant Weapon Scroll");
             break;
           case 4:
             event = event.replace("MYPRIZE", "199,000 Аден, C-grade Enchant Weapon Scroll");
             break;
           case 5:
             event = event.replace("MYPRIZE", "388,000 Аден, 1 рецепт для a B-grade оружия");
             break;
           case 6:
             event = event.replace("MYPRIZE", "675,000 Аден, 1 индигриент для B-grade оружия");
             break;
           case 7:
             event =
                 event.replace(
                     "MYPRIZE",
                     "1,284,000 Аден, 2 B-grade Enchant Weapon Scrolls, 2 B-grade Enchat Armor Scrolls");
             break;
           case 8:
             round = 0;
             st.giveAdena(2384000, true);
             st.giveItems(EWA, 1); // Scroll: Enchant Weapon A
             st.giveItems(EAA, 2); // Scroll: Enchant Armor A
             event = "Wilbert_PlayWonRound8.htm";
             break;
         }
         st.set("round", String.valueOf(round));
       }
     }
   } else if (event.equalsIgnoreCase("Wilbert_TakePrize.htm")) {
     int round = st.getInt("round");
     if (round == 0) {
       event = "<html><body>Вы не выиграли ни одно раунда! Нет призов.</body></html>";
       return event;
     }
     if (round > 8) {
       st.set("round", "0");
       event = "<html><body>Читер цуко кыш кыш кыш :D</body></html>";
       return event;
     }
     st.set("round", "0");
     event = "Wilbert_PrizeTaken.htm";
     switch (round) {
       case 1:
         st.giveAdena(40000, true);
         break;
       case 2:
         st.giveAdena(80000, true);
         break;
       case 3:
         st.giveAdena(110000, true);
         st.giveItems(EWD, 1);
         break;
       case 4:
         st.giveAdena(199000, true);
         st.giveItems(EWC, 1);
         break;
       case 5:
         st.giveAdena(388000, true);
         st.giveItems(B_RECIPES[st.getRandom(B_RECIPES.length)], 1);
         break;
       case 6:
         st.giveAdena(675000, true);
         st.giveItems(B_KEYMATS[st.getRandom(B_KEYMATS.length)], 1);
         break;
       case 7:
         st.giveAdena(1284000, true);
         st.giveItems(EWB, 2);
         st.giveItems(EAB, 2);
         break;
     }
   }
   return event;
 }
예제 #4
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(getClass());
    if (st == null) {
      return event;
    }
    int cond = st.getCond();

    if (event.equals("32768-11.htm") && cond == 0) {
      st.set("grendel_kill", "0");
      st.set("buffalo_kill", "0");
      st.set("cougar_kill", "0");
      st.set("kookaburra_kill", "0");
      st.set("over_hit", "0"); // Общее кол-во оверхитов
      st.set(
          "over_tempcount", "0"); // Количество оверхитов подряд, до того как сфейлил след. оверхит
      st.set("count", "0"); // Записанное, максимальное количество сделанных подряд оверхитов
      st.startQuest();
    } else if (event.equals("rating")) // Подводим рейтинг
    {
      int overhits = st.getInt("over_hit");
      if (overhits >= 20) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14a.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<?number?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 20 && overhits >= 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14b.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<?number?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-14c.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<?number?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      }
    } else if (event.equals("rating")) // Подводим по оверхитам подряд
    {
      int overhits = st.getInt("count");
      if (overhits >= 20) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16a.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 20 && overhits >= 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16b.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      } else if (overhits < 7) {
        String content =
            HtmCache.getInstance()
                .getHtmQuest(player.getLang(), "quests/458_PerfectForm/32768-16c.htm");
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setHtml(content);
        html.replace("<\\?number\\?>", String.valueOf(String.valueOf(overhits)));
        player.sendPacket(html);
      }
    } else if (event.equals("32768-17.htm")) // Считаем награду и выставляем реюз квесту
    {
      calcReward(player);
      st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
      st.unset("cond");
      st.exitQuest(QuestType.DAILY);
    }
    return event;
  }
예제 #5
0
  @Override
  public String onKill(L2Npc npc, QuestState st) {
    int tempCount = st.getInt("over_tempcount");
    if (ArrayUtils.contains(_mobsGrendel, npc.getNpcId())) {
      int g0 = st.getInt("grendel_kill");
      int g1 = st.getInt("over_hit");

      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("grendel_kill", String.valueOf(g0));
        } else {
          st.set("grendel_kill", String.valueOf(g0)); // всего киллов моба
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    } else if (ArrayUtils.contains(_mobsBuffalo, npc.getNpcId())) {
      int g0 = st.getInt("buffalo_kill");
      int g1 = st.getInt("over_hit");

      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("buffalo_kill", String.valueOf(g0));
        } else {
          st.set("buffalo_kill", String.valueOf(g0));
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    } else if (ArrayUtils.contains(_mobsCougar, npc.getNpcId())) {
      int g0 = st.getInt("cougar_kill");
      int g1 = st.getInt("over_hit");
      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("cougar_kill", String.valueOf(g0));
        } else {
          st.set("cougar_kill", String.valueOf(g0));
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    } else if (ArrayUtils.contains(_mobsKookaburra, npc.getNpcId())) {
      int g0 = st.getInt("kookaburra_kill");
      int g1 = st.getInt("over_hit");
      if (g0 < 10) {
        g0++;
        if (((L2Attackable) npc).isOverhit()) {
          g1++;
          tempCount++;
          st.set("over_tempcount", String.valueOf(tempCount));
          st.set("over_hit", String.valueOf(g1));
          st.set("kookaburra_kill", String.valueOf(g0));
        } else {
          st.set("kookaburra_kill", String.valueOf(g0));
          st.set("count", String.valueOf(tempCount)); // записываем предыдущее комбо оверхитов
          st.set("over_tempcount", "0"); // Обнуляем временный счетчик оверхитов
        }
      }
    }
    if (st.getInt("grendel_kill")
            + st.getInt("buffalo_kill")
            + st.getInt("cougar_kill")
            + st.getInt("kookaburra_kill")
        >= 40) {
      st.setCond(2);
    }
    if (st.getInt("over_hit") == 40) // Заглушка на случай совершения 40 из 40 оверхитов
    {
      st.set("count", "40");
    }
    return super.onKill(npc, st);
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (st.getState() == COMPLETED) {
      return getAlreadyCompletedMsg(player, QuestType.ONE_TIME);
    }

    int npcId = npc.getNpcId();
    if (st.getState() == CREATED) {
      if (npcId != Glyvka) {
        return getNoQuestMsg(player);
      }
      if (player.getLevel() < 35) {
        st.exitQuest(QuestType.REPEATABLE);
        return "glyvka_q0134_02.htm";
      }
      st.setCond(0);
      return "glyvka_q0134_01.htm";
    }

    int cond = st.getCond();

    if (npcId == Glyvka && st.getState() == STARTED) {
      if (cond == 1) {
        return "glyvka_q0134_03.htm";
      }
      if (cond == 5) {
        if (st.getInt("Report") == 1) {
          return "glyvka_q0134_09.htm";
        }
        if (st.getQuestItemsCount(Roukes_Report) > 0) {
          st.takeItems(Roukes_Report, -1);
          st.set("Report", "1");
          return "glyvka_q0134_08.htm";
        }
        return getNoQuestMsg(player);
      }
      return "glyvka_q0134_07.htm";
    }

    if (npcId == Rouke && st.getState() == STARTED) {
      if (cond == 2) {
        return "scroll_seller_rouke_q0134_02.htm";
      }
      if (cond == 5) {
        return "scroll_seller_rouke_q0134_10.htm";
      }
      if (cond == 3) {
        long Tools = st.getQuestItemsCount(Giants_Experimental_Tool_Fragment) / 10;
        if (Tools < 1) {
          return "scroll_seller_rouke_q0134_04.htm";
        }
        st.takeItems(Giants_Experimental_Tool_Fragment, Tools * 10);
        st.giveItems(Giants_Experimental_Tool, Tools);
        return "scroll_seller_rouke_q0134_05.htm";
      }
      if (cond == 4) {
        if (st.getInt("Report") == 1) {
          return "scroll_seller_rouke_q0134_07.htm";
        }
        if (st.getQuestItemsCount(Giants_Technology_Report) > 2) {
          st.takeItems(Giants_Experimental_Tool_Fragment, -1);
          st.takeItems(Giants_Experimental_Tool, -1);
          st.takeItems(Giants_Technology_Report, -1);
          st.set("Report", "1");
          return "scroll_seller_rouke_q0134_06.htm";
        }
        return getNoQuestMsg(player);
      }
    }
    return getNoQuestMsg(player);
  }