Esempio n. 1
0
 /**
  * Method onEvtDead.
  *
  * @param killer Creature
  */
 @Override
 protected void onEvtDead(Creature killer) {
   final NpcInstance actor = getActor();
   final int npcId = actor.getNpcId();
   switch (npcId) {
     case 25605:
       {
         epidosIndex.put(1, epidosIndex.get(1) + 1);
         break;
       }
     case 25606:
       {
         epidosIndex.put(2, epidosIndex.get(2) + 1);
         break;
       }
     case 25607:
       {
         epidosIndex.put(3, epidosIndex.get(3) + 1);
         break;
       }
     case 25608:
       {
         epidosIndex.put(4, epidosIndex.get(4) + 1);
         break;
       }
     default:
       break;
   }
   if ((isBossSpawnCondMet() != 0) && !NaiaCoreManager.isBossSpawned()) {
     NaiaCoreManager.spawnEpidos(isBossSpawnCondMet());
   }
   super.onEvtDead(killer);
 }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   if (st.getState() != STARTED) {
     return null;
   }
   int npcId = npc.getNpcId();
   long album = st.getQuestItemsCount(COIN_ALBUM);
   long coin = st.getQuestItemsCount(KAILS_COIN);
   long clover = st.getQuestItemsCount(CLOVER_COIN);
   if ((npcId == ANCIENT_GARGOYLE) && (coin == 0)) {
     if (Rnd.chance(GARGOYLE_CHANCE)) {
       st.giveItems(KAILS_COIN, 1);
       if ((album > 0) || (clover > 0)) {
         st.playSound(SOUND_MIDDLE);
       } else {
         st.playSound(SOUND_ITEMGET);
       }
     }
   } else if ((npcId == VEGUS) && ((clover + album) == 0) && (st.getInt("id") != 0)) {
     if (Rnd.chance(VEGUS_CHANCE)) {
       st.giveItems(CLOVER_COIN, 1);
       if (coin > 0) {
         st.playSound(SOUND_MIDDLE);
       } else {
         st.playSound(SOUND_ITEMGET);
       }
     }
   }
   return null;
 }
 /** Method runImpl. */
 @Override
 protected final void runImpl() {
   final Player activeChar = getClient().getActiveChar();
   if (activeChar == null) {
     return;
   }
   ItemInstance adena = activeChar.getInventory().getItemByItemId(57);
   if ((_bid < 0) || (_bid > adena.getCount())) {
     return;
   }
   final ItemAuctionInstance instance =
       ItemAuctionManager.getInstance().getManagerInstance(_instanceId);
   NpcInstance broker = activeChar.getLastNpc();
   if ((broker == null)
       || (broker.getNpcId() != _instanceId)
       || (activeChar.getDistance(broker.getX(), broker.getY()) > Creature.INTERACTION_DISTANCE)) {
     return;
   }
   if (instance != null) {
     final ItemAuction auction = instance.getCurrentAuction();
     if (auction != null) {
       auction.registerBid(activeChar, _bid);
     }
   }
 }
Esempio n. 4
0
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int cond = st.getCond();
   if ((cond != 1) || (npc == null)) {
     return null;
   }
   if ((ArrayUtils.contains(Mobs, npc.getNpcId())) && (Rnd.chance(50))) {
     st.giveItems(19496, 1L);
   }
   if (st.getQuestItemsCount(19496) >= 45L) {
     st.setCond(2);
   }
   return null;
 }
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    int cond = st.getCond();
    int npcId = npc.getNpcId();
    String htmltext = "noquest";

    if (npcId == HORPINA) {
      if (st.isCreated() && !st.isNowAvailableByTime()) htmltext = "33031-04.htm";
      else if (cond == 0 && isAvailableFor(st.getPlayer())) htmltext = "33031-01.htm";
      else if (cond == 1) htmltext = "33031-03.htm";
      else if (cond == 2) htmltext = "33031-05.htm";
      else htmltext = "33032-07.htm";
    }
    return htmltext;
  }
Esempio n. 6
0
 @Override
 protected boolean thinkActive() {
   NpcInstance actor = getActor();
   if (actor.isDead()) {
     return false;
   }
   List<NpcInstance> around = actor.getAroundNpc(800, 500);
   if ((around != null) && (!around.isEmpty())) {
     for (NpcInstance npc : around) {
       if (npc.getNpcId() == 51030) {
         actor.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, npc, Integer.valueOf(500));
       }
     }
   }
   return true;
 }
Esempio n. 7
0
  private boolean checkTarget(Creature target) {
    if (target == null) return false;
    if (target.isPlayer()) return true;

    if (target.isNpc()) {
      NpcInstance npc = (NpcInstance) target;
      int _id = npc.getNpcId();
      if (_id == 27430
          || _id == 27431
          || _id == 27432
          || _id == 27433
          || _id == 27434
          || _id == 27425
          || _id == 33416) return false;
    }
    return true;
  }
Esempio n. 8
0
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();

    if (Rnd.chance(3)) {
      switch (actor.getNpcId()) {
        case 33172:
          Functions.npcSay(actor, NpcString.THE_ONLY_GOOD_SHILEN_CREATURE_IS_A_DEAD_ONE);
          break;
        case 33170:
          Functions.npcSay(actor, NpcString.GET_BEHIND_ME_GET_BEHIND_ME);
          break;
        default:
          break;
      }
    }
    return startAttack();
  }
Esempio n. 9
0
  private boolean checkTarget(NpcInstance target) {
    if (target == null) {
      return false;
    }
    int _id = target.getNpcId();

    if (_id == 33170
        || _id == 33171
        || _id == 33172
        || _id == 33173
        || _id == 33174
        || _id == 33414
        || _id == 33415
        || _id == 33416) {
      return false;
    }

    return true;
  }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   QuestState prevst = st.getPlayer().getQuestState("10302_TheShadowOfAnxiety");
   if (npc.getNpcId() == 32894) {
     switch (st.getState()) {
       case 2:
         htmltext = "32894-completed.htm";
         break;
       case 1:
         switch (st.getCond()) {
           case 1:
             if (st.getPlayer().getLevel() >= 90) {
               if ((prevst != null) && (prevst.isCompleted())) {
                 htmltext = "32894-00.htm";
               } else {
                 htmltext = "32894-noprev.htm";
                 st.exitCurrentQuest(true);
               }
             } else {
               htmltext = "32894-nolvl.htm";
               st.exitCurrentQuest(true);
             }
             break;
           case 2:
             htmltext = "32894-01a.htm";
             break;
           case 3:
           case 4:
           case 5:
           case 6:
           case 7:
           case 8:
             htmltext = "32894-02.htm";
             break;
           case 9:
             htmltext = "32894-03.htm";
         }
     }
   }
   return htmltext;
 }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int cond = st.getCond();
   int npcId = npc.getNpcId();
   long album = st.getQuestItemsCount(COIN_ALBUM);
   if (npcId == SORINT) {
     if (cond == 0) {
       htmltext = "warehouse_keeper_sorint_q0381_01.htm";
     } else if (cond == 1) {
       long coin = st.getQuestItemsCount(KAILS_COIN);
       if ((coin > 0) && (album > 0)) {
         st.takeItems(KAILS_COIN, -1);
         st.takeItems(COIN_ALBUM, -1);
         st.giveItems(ROYAL_MEMBERSHIP, 1);
         st.playSound(SOUND_FINISH);
         st.exitCurrentQuest(true);
         htmltext = "warehouse_keeper_sorint_q0381_06.htm";
       } else if (album == 0) {
         htmltext = "warehouse_keeper_sorint_q0381_05.htm";
       } else if (coin == 0) {
         htmltext = "warehouse_keeper_sorint_q0381_04.htm";
       }
     }
   } else {
     long clover = st.getQuestItemsCount(CLOVER_COIN);
     if (album > 0) {
       htmltext = "sandra_q0381_05.htm";
     } else if (clover > 0) {
       st.takeItems(CLOVER_COIN, -1);
       st.giveItems(COIN_ALBUM, 1);
       st.playSound(SOUND_ITEMGET);
       htmltext = "sandra_q0381_04.htm";
     } else if (st.getInt("id") == 0) {
       htmltext = "sandra_q0381_01.htm";
     } else {
       htmltext = "sandra_q0381_03.htm";
     }
   }
   return htmltext;
 }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (Mobs.contains(npcId)) {
     if ((cond == 4) && Rnd.chance(99)) {
       st.giveItems(LostSkullOfElf, 1);
       st.playSound(SOUND_MIDDLE);
       st.setCond(5);
     }
   }
   if (npcId == SoulOfWell) {
     if (cond == 10) {
       st.setCond(9);
       st.takeItems(JewelOfAdventurerGreen, -1);
       st.takeItems(JewelOfAdventurerRed, -1);
       st.cancelQuestTimer("attack_timer");
     }
   }
   return null;
 }
Esempio n. 13
0
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    Player player = st.getPlayer();
    int npcId = npc.getNpcId();
    int state = st.getState();
    int cond = st.getCond();
    if (npcId == 32759) {
      if (state == 1) {
        if ((npc.getFollowTarget() != null) && (npc.getFollowTarget() != player)) {
          return "lost_villager_q0457_01a.htm";
        }
        if (st.getPlayer().getLevel() >= 82) {
          if (st.isNowAvailableByTime()) {
            return "lost_villager_q0457_01.htm";
          }
          return "lost_villager_q0457_02.htm";
        }
        return "lost_villager_q0457_03.htm";
      }
      if (state == 2) {
        if ((npc.getFollowTarget() != null) && (npc.getFollowTarget() != player)) {
          return "lost_villager_q0457_01a.htm";
        }
        if (cond == 1) {
          return "lost_villager_q0457_08.htm";
        }
        if (cond == 2) {
          npc.deleteMe();

          st.giveItems(15716, 1L);
          st.unset("cond");
          st.playSound("ItemSound.quest_finish");
          st.exitCurrentQuest(this);
          return "lost_villager_q0457_09.htm";
        }
      }
    }
    return "noquest";
  }
Esempio n. 14
0
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   st.getPlayer();
   int npcId = npc.getNpcId();
   int state = st.getState();
   int cond = st.getCond();
   if (npcId == 33463) {
     if (state == 1) {
       if (!st.isNowAvailableByTime()) {
         return "33463-comp.htm";
       }
       return "33463.htm";
     }
     if (state == 2) {
       if (cond == 1) {
         return "33463-4.htm";
       }
       if (cond == 2) {
         return "33463-5.htm";
       }
     }
   }
   if ((npcId == 31282) && (state == 2)) {
     if (cond == 1) {
       return "31282-1.htm";
     }
     if (cond == 2) {
       st.giveItems(57, 334560L);
       st.addExpAndSp(8534700L, 8523390L);
       st.takeItems(19496, -1L);
       st.unset("cond");
       st.playSound("ItemSound.quest_finish");
       st.exitCurrentQuest(this);
       return "31282.htm";
     }
   }
   return "noquest";
 }
Esempio n. 15
0
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   Player player = st.getPlayer();
   String back = player.getVar("FestivalBackCoords");
   if (back == null) {
     back = "1";
   }
   String htmltext = "Started.htm";
   if (npcId == GLUDIN_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "1", -1);
     return htmltext;
   }
   if (npcId == GLUDIO_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "2", -1);
     return htmltext;
   }
   if (npcId == DION_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "3", -1);
     return htmltext;
   }
   if (npcId == GIRAN_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "4", -1);
     return htmltext;
   }
   if (npcId == OREN_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "5", -1);
     return htmltext;
   }
   if (npcId == ADEN_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "6", -1);
     return htmltext;
   }
   if (npcId == HEINE_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "7", -1);
     return htmltext;
   }
   if (npcId == GODDARD_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "8", -1);
     return htmltext;
   }
   if (npcId == RUNE_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "9", -1);
     return htmltext;
   }
   if (npcId == SCHUTTGART_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "10", -1);
     return htmltext;
   }
   if (npcId == HV_DAWN) {
     player.teleToLocation(-80157, 111344, -4901);
     player.setVar("id", "11", -1);
     return htmltext;
   }
   if (npcId == GLUDIN_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "1", -1);
     return htmltext;
   }
   if (npcId == GLUDIO_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "2", -1);
     return htmltext;
   }
   if (npcId == DION_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "3", -1);
     return htmltext;
   }
   if (npcId == GIRAN_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "4", -1);
     return htmltext;
   }
   if (npcId == OREN_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "5", -1);
     return htmltext;
   }
   if (npcId == ADEN_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "6", -1);
     return htmltext;
   }
   if (npcId == HEINE_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "7", -1);
     return htmltext;
   }
   if (npcId == GODDARD_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "8", -1);
     return htmltext;
   }
   if (npcId == RUNE_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "9", -1);
     return htmltext;
   }
   if (npcId == SCHUTTGART_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "10", -1);
     return htmltext;
   }
   if (npcId == HV_DUSK) {
     player.teleToLocation(-81261, 86531, -5157);
     player.setVar("id", "11", -1);
     return htmltext;
   }
   htmltext = "Completed.htm";
   if (back.equals("1")) {
     player.teleToLocation(-80826, 149775, -3043);
     return htmltext;
   }
   if (back.equals("2")) {
     player.teleToLocation(-12672, 122776, -3116);
     return htmltext;
   }
   if (back.equals("3")) {
     player.teleToLocation(15670, 142983, -2705);
     return htmltext;
   }
   if (back.equals("4")) {
     player.teleToLocation(83400, 147943, -3404);
     return htmltext;
   }
   if (back.equals("5")) {
     player.teleToLocation(82956, 53162, -1495);
     return htmltext;
   }
   if (back.equals("6")) {
     player.teleToLocation(146331, 25762, -2018);
     return htmltext;
   }
   if (back.equals("7")) {
     player.teleToLocation(111409, 219364, -3545);
     return htmltext;
   }
   if (back.equals("8")) {
     player.teleToLocation(147928, -55273, -2734);
     return htmltext;
   }
   if (back.equals("9")) {
     player.teleToLocation(43799, -47727, -798);
     return htmltext;
   }
   if (back.equals("10")) {
     player.teleToLocation(87386, -143246, -1293);
     return htmltext;
   }
   if (back.equals("11")) {
     player.teleToLocation(116819, 76994, -2714);
     return htmltext;
   }
   return htmltext;
 }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   TIntIntHashMap moblist = new TIntIntHashMap();
   if ((npc == null) || (st == null)) {
     return null;
   }
   int cond = st.getCond();
   if ((cond >= 2) && (cond < 9)) {
     int ONE = st.getInt("one");
     int TWO = st.getInt("two");
     int THREE = st.getInt("three");
     int FOUR = st.getInt("four");
     int FIVE = st.getInt("five");
     int SIX = st.getInt("six");
     int SEVEN = st.getInt("seven");
     int EIGHT = st.getInt("eight");
     if ((npc.getNpcId() == 25837) && (cond == 2)) {
       ONE++;
       st.set("one", String.valueOf(ONE));
       st.setCond(3);
       st.playSound("ItemSound.quest_middle");
     } else if ((npc.getNpcId() == 25840) && (cond == 3)) {
       TWO++;
       st.set("two", String.valueOf(TWO));
       st.setCond(4);
       st.playSound("ItemSound.quest_middle");
     } else if ((npc.getNpcId() == 25843) && (cond == 4)) {
       THREE++;
       st.set("three", String.valueOf(THREE));
       st.setCond(5);
       st.playSound("ItemSound.quest_middle");
     } else if ((npc.getNpcId() == 25841) && (cond == 5)) {
       FOUR++;
       st.set("four", String.valueOf(FOUR));
       st.setCond(6);
       st.playSound("ItemSound.quest_middle");
     }
     if (cond == 6) {
       if (npc.getNpcId() == 25838) {
         FIVE++;
         st.set("five", String.valueOf(FIVE));
       } else if (npc.getNpcId() == 25839) {
         SIX++;
         st.set("six", String.valueOf(SIX));
       }
       if ((FIVE > 0) && (SIX > 0)) {
         st.setCond(7);
         st.playSound("ItemSound.quest_middle");
       }
     } else if ((npc.getNpcId() == 25846) && (cond == 7)) {
       SEVEN++;
       st.set("seven", String.valueOf(SEVEN));
       st.setCond(8);
       st.playSound("ItemSound.quest_middle");
     } else if ((npc.getNpcId() == 25824) && (cond == 8)) {
       EIGHT++;
       st.set("eight", String.valueOf(EIGHT));
       st.setCond(9);
       st.playSound("ItemSound.quest_middle");
     }
     moblist.put(25837, ONE);
     moblist.put(25840, TWO);
     moblist.put(25845, THREE);
     moblist.put(25841, FOUR);
     moblist.put(25838, FIVE);
     moblist.put(25839, SIX);
     moblist.put(25846, SEVEN);
     moblist.put(25825, EIGHT);
   }
   return null;
 }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   String htmltext = "noquest";
   if (npcId == Tifaren) {
     if (cond == 0) {
       QuestState hiddenTruth = st.getPlayer().getQuestState(_021_HiddenTruth.class);
       if (hiddenTruth != null) {
         if (hiddenTruth.isCompleted()) {
           htmltext = "31334-01.htm";
         } else {
           htmltext = "<html><head><body>You not complite quest Hidden Truth...</body></html>";
         }
       } else {
         htmltext = "<html><head><body>You not complite quest Hidden Truth...</body></html>";
       }
     } else if (cond == 3) {
       return "31334-04.htm";
     } else if (cond == 4) {
       htmltext = "31334-06.htm";
     } else if (cond == 5) {
       if (st.getQuestItemsCount(LostSkullOfElf) != 0) {
         htmltext = "31334-07.htm";
       } else {
         st.setCond(4);
         htmltext = "31334-06.htm";
       }
     } else if (cond == 6) {
       htmltext = "31334-07.htm";
     } else if (cond == 7) {
       despawnGhostOfPriest();
       spawnGhostOfPriest(st);
       htmltext = "31334-09.htm";
     }
   } else if (npcId == GhostOfPriest) {
     if (cond == 7) {
       htmltext = "31528-00.htm";
     } else if (cond == 8) {
       htmltext = "31528-07.htm";
     }
   } else if (npcId == Innocentin) {
     if (cond == 0) {
       htmltext = "31328-17.htm";
     }
     if (cond == 8) {
       htmltext = "31328-00.htm";
     } else if (cond == 9) {
       htmltext = "31328-06.htm";
     } else if (cond == 14) {
       if (st.getQuestItemsCount(ReportBox) != 0) {
         htmltext = "31328-07.htm";
       } else {
         st.setCond(13);
         htmltext = "Go away!";
       }
     } else if (cond == 15) {
       if (!st.isRunningQuestTimer("wait_timer")) {
         st.setCond(16);
       }
       htmltext = "31328-09.htm";
     }
   } else if (npcId == GhostOfAdventurer) {
     if (cond == 9) {
       if (st.getQuestItemsCount(LetterOfInnocentin) != 0) {
         htmltext = "31529-00.htm";
       } else {
         htmltext =
             "You have no Letter of Innocentin! Are they Please returned to High Priest Innocentin...";
       }
     } else if (cond == 10) {
       despawnSoulOfWell();
       spawnSoulOfWell(st);
       st.startQuestTimer("attack_timer", 60000);
       st.takeItems(JewelOfAdventurerGreen, -1);
       st.takeItems(JewelOfAdventurerRed, -1);
       st.giveItems(JewelOfAdventurerGreen, 1);
       htmltext =
           "<html><body>Attack Soul of Well but do not kill while stone will not change colour...</body></html>";
     } else if (cond == 11) {
       if (st.getQuestItemsCount(JewelOfAdventurerRed) != 0) {
         htmltext = "31529-10.htm";
         st.takeItems(JewelOfAdventurerRed, 1);
         st.setCond(12);
       }
     } else if (cond == 12) {
       htmltext = "31529-09.htm";
     } else if (cond == 13) {
       if (st.getQuestItemsCount(SealedReportBox) != 0) {
         htmltext = "31529-11.htm";
         st.setCond(14);
         st.takeItems(SealedReportBox, 1);
         st.giveItems(ReportBox, 1);
       } else {
         st.setCond(12);
         htmltext = "31529-10.htm";
       }
     }
   } else if ((npcId == Well) && (cond == 12)) {
     htmltext = "31527-01.htm";
     st.setCond(13);
     st.giveItems(SealedReportBox, 1);
   }
   return htmltext;
 }