@Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (npcId == THEODRIC) {
     if (cond == 0) {
       if (st.getPlayer().getLevel() < 84) htmltext = "antharas_watchman_theodric_q10504_00.htm";
       else if (st.getQuestItemsCount(PORTAL_STONE) < 1)
         htmltext = "antharas_watchman_theodric_q10504_00a.htm";
       else if (st.isNowAvailable()) htmltext = "antharas_watchman_theodric_q10504_01.htm";
       else htmltext = "antharas_watchman_theodric_q10504_09.htm";
     } else if (cond == 1) {
       if (st.getQuestItemsCount(CLEAR_CRYSTAL) < 1) {
         htmltext = "antharas_watchman_theodric_q10504_08.htm";
         st.giveItems(CLEAR_CRYSTAL, 1);
       } else htmltext = "antharas_watchman_theodric_q10504_05.htm";
     } else if (cond == 2) {
       if (st.getQuestItemsCount(FILLED_CRYSTAL_ANTHARAS) >= 1) {
         htmltext = "antharas_watchman_theodric_q10504_07.htm";
         st.takeAllItems(FILLED_CRYSTAL_ANTHARAS);
         st.giveItems(JEWEL_OF_ANTHARAS, 1);
         st.playSound(SOUND_FINISH);
         st.exitCurrentQuest(this);
       } else htmltext = "antharas_watchman_theodric_q10504_06.htm";
     }
   }
   return htmltext;
 }
  @Override
  public String onKill(NpcInstance npc, QuestState st) {
    int npcId = npc.getNpcId();
    int cond = st.getCond();

    if (cond == 3 && ArrayUtils.contains(MOBS_1, npcId) && Rnd.chance(70)) {
      st.giveItems(ELCARDIAS_MARK, 1);
      if (st.getQuestItemsCount(ELCARDIAS_MARK) < 10) st.playSound(SOUND_ITEMGET);
      else {
        st.playSound(SOUND_MIDDLE);
        st.setCond(4);
      }
    } else if (npcId == CREATURE_OF_THE_DUSK_1) {
      st.set("CreatureOfTheDusk1", 2);
      if (st.get("CreatureOfTheDusk2") != null
          && Integer.parseInt(st.get("CreatureOfTheDusk2")) == 2) {
        st.playSound(SOUND_MIDDLE);
        st.setCond(6);
      }
    } else if (npcId == CREATURE_OF_THE_DUSK_2) {
      st.set("CreatureOfTheDusk2", 2);
      if (st.get("CreatureOfTheDusk1") != null
          && Integer.parseInt(st.get("CreatureOfTheDusk1")) == 2) {
        st.playSound(SOUND_MIDDLE);
        st.setCond(6);
      }
    }
    return null;
  }
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    String htmltext = "noquest";
    int npcId = npc.getNpcId();
    int cond = st.getCond();

    if (npcId == Droph)
      if (cond == 0) {
        if (st.getPlayer().getLevel() >= 79) htmltext = "droph_q307_1.htm";
        else {
          htmltext = "droph_q307_0.htm";
          st.exitCurrentQuest(true);
        }
      } else if (cond == 1) {
        if (st.getQuestItemsCount(CaveExplorationText1Sheet) >= 1
            && st.getQuestItemsCount(CaveExplorationText2Sheet) >= 1
            && st.getQuestItemsCount(CaveExplorationText3Sheet) >= 1)
          if (ServerVariables.getLong("HekatonPrimeRespawn", 0) < System.currentTimeMillis())
            htmltext = "droph_q307_3.htm";
          else htmltext = "droph_q307_4.htm";
        else htmltext = "droph_q307_2a.htm";
      } else if (cond == 2) {
        htmltext = "droph_q307_5.htm";
        st.giveItems(DrophsSupportItems, 1);
        st.playSound(SOUND_FINISH);
        st.exitCurrentQuest(true);
      }
    return htmltext;
  }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (cond == 1 && npcId == HekatonPrime) st.setCond(2);
   return null;
 }
Exemple #5
0
 @Override
 public void onDeath(Creature self, Creature killer) {
   if (self.isNpc()) {
     if (self.getNpcId() == HallAlarmDevice) {
       for (int i = 0; i < hallADoors.length; i++) openDoor(hallADoors[i]);
       blockUnblockNpcs(false, blockANpcs);
       for (NpcInstance n : getNpcs())
         if (ArrayUtils.contains(blockANpcs, n.getNpcId()))
           n.getAI()
               .notifyEvent(
                   CtrlEvent.EVT_AGGRESSION,
                   getPlayers().get(Rnd.get(getPlayers().size())),
                   200);
     } else if (ArrayUtils.contains(blockANpcs, self.getNpcId())) {
       // ToCheck: find easier way
       for (NpcInstance n : getNpcs())
         if (ArrayUtils.contains(blockANpcs, n.getNpcId()) && !n.isDead()) return;
       for (int i = 0; i < corridorADoors.length; i++) openDoor(corridorADoors[i]);
       blockUnblockNpcs(true, blockBNpcs);
     } else if (self.getNpcId() == DarkChoirPlayer) {
       for (NpcInstance n : getNpcs())
         if (n.getNpcId() == DarkChoirPlayer && !n.isDead()) return;
       for (int i = 0; i < hallBDoors.length; i++) openDoor(hallBDoors[i]);
       blockUnblockNpcs(false, blockBNpcs);
     } else if (ArrayUtils.contains(blockBNpcs, self.getNpcId())) {
       if (Rnd.chance(10)) ((NpcInstance) self).dropItem(killer.getPlayer(), DewdropItem, 1);
       // ToCheck: find easier way
       for (NpcInstance n : getNpcs())
         if ((ArrayUtils.contains(blockBNpcs, n.getNpcId())
                 || ArrayUtils.contains(blockANpcs, n.getNpcId()))
             && !n.isDead()) return;
       for (int i = 0; i < corridorBDoors.length; i++) openDoor(corridorBDoors[i]);
       ThreadPoolManager.getInstance().schedule(new FrintezzaStart(), battleStartDelay);
     } else if (self.getNpcId() == _weakScarletId) {
       self.decayMe();
       return;
     } else if (self.getNpcId() == _strongScarletId) {
       ThreadPoolManager.getInstance().schedule(new Die(1), 10);
       setReenterTime(System.currentTimeMillis());
     }
   }
 }
  @Override
  public String onKill(NpcInstance npc, QuestState st) {
    int npcId = npc.getNpcId();
    int cond = st.getCond();

    if (cond == 1 && npcId == ULTIMATE_ANTHARAS) {
      st.takeAllItems(CLEAR_CRYSTAL);
      st.giveItems(FILLED_CRYSTAL_ANTHARAS, 1);
      st.setCond(2);
    }
    return null;
  }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   int id = st.getState();
   Player player = st.getPlayer();
   if (!player.isBaseClassActive()) return "no_subclass_allowed.htm";
   switch (npcId) {
     case WOOD:
       if (cond == 0) {
         QuestState qs = player.getQuestState(_198_SevenSignsEmbryo.class);
         if (player.getLevel() >= 81 && qs != null && qs.isCompleted())
           htmltext = "priest_wood_q10292_0.htm";
         else {
           htmltext = "priest_wood_q10292_0n.htm";
           st.exitCurrentQuest(true);
         }
       } else if (cond == 1) htmltext = "priest_wood_q10292_3.htm";
       else if (cond > 1 && !st.isCompleted())
         htmltext = "priest_wood_q10292_5.htm"; // TODO: Отредактировать диалог по оффу
       else if (st.isCompleted()) htmltext = "priest_wood_q10292_6.htm";
       break;
     case FRANZ:
       if (cond == 1) htmltext = "witness_of_dawn_q10292_0.htm";
       else if (cond == 2) htmltext = "witness_of_dawn_q10292_4.htm";
       break;
     case ELCARDIA:
       if (cond == 2) htmltext = "elcadia_abyssal_saintess_q10292_0.htm";
       else if (cond == 3) htmltext = "elcadia_abyssal_saintess_q10292_2.htm";
       else if (cond == 4) {
         htmltext = "elcadia_abyssal_saintess_q10292_3.htm";
         st.takeItems(ELCARDIAS_MARK, -1);
         st.playSound(SOUND_MIDDLE);
         st.setCond(5);
       } else if (cond == 5) htmltext = "elcadia_abyssal_saintess_q10292_5.htm";
       else if (cond == 6) htmltext = "elcadia_abyssal_saintess_q10292_6.htm";
       else if (cond == 7) htmltext = "elcadia_abyssal_saintess_q10292_9.htm";
       else if (cond == 8) {
         htmltext = "elcadia_abyssal_saintess_q10292_10.htm";
         st.addExpAndSp(10000000, 1000000);
         st.setState(COMPLETED);
         st.exitCurrentQuest(false);
         st.playSound(SOUND_FINISH);
       }
       break;
     case HARDIN:
       if (cond == 7) htmltext = "hardin_q10292_0.htm";
       else if (cond == 8) htmltext = "hardin_q10292_2.htm";
       break;
   }
   return htmltext;
 }
Exemple #8
0
 // Hack: ToRemove when doors will operate normally in reflections
 private void blockUnblockNpcs(boolean block, int[] npcArray) {
   for (NpcInstance n : getNpcs())
     if (ArrayUtils.contains(npcArray, n.getNpcId())) {
       if (block) {
         n.block();
         n.setIsInvul(true);
       } else {
         n.unblock();
         n.setIsInvul(false);
       }
     }
 }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (npcId == GUILLOTINE_OF_DEATH) {
     if (cond == 1) {
       st.setCond(2);
       st.playSound(SOUND_MIDDLE);
     }
   }
   return null;
 }
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    String htmltext = "noquest";
    int npcId = npc.getNpcId();
    int cond = st.getCond();
    if (npcId == HOLLINT) {
      if (cond == 1) {
        htmltext = "30191-1.htm";
      } else if (cond == 2) htmltext = "30191-3.htm";
    } else if (npcId == ANDY && st.getCond() == 2) {
      htmltext = "33845-1.htm";
    }

    return htmltext;
  }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   String htmltext = "noquest";
   if (npcId == ENDRIGO) {
     if (st.isCompleted()) htmltext = "warden_endrigo_q10380_03.htm";
     else if (st.isStarted()) {
       if (cond == 1) htmltext = "warden_endrigo_q10380_07.htm";
       else if (cond == 2) htmltext = "warden_endrigo_q10380_08.htm";
     } else {
       if (checkStartCondition(st.getPlayer())) htmltext = "warden_endrigo_q10380_01.htm";
       else htmltext = "warden_endrigo_q10380_02.htm";
     }
   }
   return htmltext;
 }
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    int _state = st.getState();
    int npcId = npc.getNpcId();
    if (_state == CREATED) {
      if (npcId != Jeremy) return "noquest";
      if (st.getPlayer().getLevel() < 73) {
        st.exitCurrentQuest(true);
        return "jeremy_q0625_0103.htm";
      }
      if (st.getQuestItemsCount(Soy_Sauce_Jar) == 0) {
        st.exitCurrentQuest(true);
        return "jeremy_q0625_0102.htm";
      }
      st.setCond(0);
      return "jeremy_q0625_0101.htm";
    }

    if (_state != STARTED) return "noquest";
    int cond = st.getCond();

    if (npcId == Jeremy) {
      if (cond == 1) return "jeremy_q0625_0105.htm";
      if (cond == 2) return "jeremy_q0625_0202.htm";
      if (cond == 3) return "jeremy_q0625_0201.htm";
    }

    if (npcId == Yetis_Table) {
      if (ServerVariables.getLong(_625_TheFinestIngredientsPart2.class.getSimpleName(), 0)
              + 3 * 60 * 60 * 1000
          > System.currentTimeMillis()) return "yetis_table_q0625_0204.htm";
      if (cond == 1) return "yetis_table_q0625_0101.htm";
      if (cond == 2) {
        if (BumbalumpSpawned()) return "yetis_table_q0625_0202.htm";
        ThreadPoolManager.getInstance().schedule(new BumbalumpSpawner(), 1000);
        return "yetis_table_q0625_0201.htm";
      }
      if (cond == 3) return "yetis_table_q0625_0204.htm";
    }

    return "noquest";
  }
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();
    Creature target = actor.getFollowTarget();

    if (target == null || !(target instanceof Player)) {
      if (actor != null) actor.deleteMe();
      return false;
    }

    int npcId = actor.getNpcId();
    int[][] coords;
    NpcString string;
    NpcString end_String;
    // Select coords
    switch (npcId) {
      case SEARCHING_MYST_POWER_SOLDIER:
        coords = SMP_COORDS;
        string = SEARCHING_MYST_POWER_STRING;
        end_String = NpcString.S1_THAT_MAN_IN_FRONT_IS_IBANE;
        break;
      case BACKUP_SEEKERS_ASSASSIN:
        coords = BS_COORDS;
        string = BACKUP_SEEKERS_STRING;
        end_String = NpcString.TALK_TO_THAT_APPRENTICE_AND_GET_ON_KOOKARU;
        break;
      case GOING_INTO_REAL_WAR_SOLDIER:
        double distLeft =
            target.getDistance(GRW_COORDS_LEFT[0][0], GRW_COORDS_LEFT[0][1], GRW_COORDS_LEFT[0][2]);
        double distRight =
            target.getDistance(
                GRW_COORDS_RIGHT[0][0], GRW_COORDS_RIGHT[0][1], GRW_COORDS_RIGHT[0][2]);
        if (distLeft <= distRight) coords = GRW_COORDS_LEFT;
        else coords = GRW_COORDS_RIGHT;
        string = GOING_INTO_REAL_WAR_STRING;
        end_String = NpcString.S1_THAT_MAN_IN_FRONT_IS_HOLDEN;
        break;
      default:
        return false;
    }

    // Нужно всё это переписать.
    // This NPC is running
    actor.setRunning();
    if (actor.getDistance(target) < 100 || currentState == 0 || currentState >= coords.length) {
      if (currentState < coords.length) {
        actor.moveToLocation(
            coords[currentState][0],
            coords[currentState][1],
            coords[currentState][2],
            Rnd.get(0, 50),
            true);
        if (actor.getDestination() == null) {
          ++currentState;
        }
      } else {
        Functions.npcSay(actor, end_String, target.getName());
        actor.deleteMe();
      }
    } else if (lastSayTime + SAY_INTERVAL < System.currentTimeMillis()
        && actor.getDestination() == null) {
      int heading = actor.calcHeading(target.getX(), target.getY());
      actor.setHeading(heading);
      actor.broadcastPacket(new ExRotation(actor.getObjectId(), heading));
      lastSayTime = System.currentTimeMillis();
      Functions.npcSay(actor, string, target.getName());
    }

    return true;
  }