Example #1
0
 public void killNpcByObjectId(int _objId) {
   NpcInstance npc = GameObjectsStorage.getNpc(_objId);
   if (npc != null) {
     npc.doDie(null);
   } else {
     _log.warn("Attemp to kill object that is not npc in quest " + getQuest().getQuestIntId());
   }
 }
Example #2
0
 @Override
 public void runImpl() {
   NpcInstance actor = getActor();
   int event_id = actor.getAISpawnParam();
   MonasteryFurnaceEvent furnace =
       EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, event_id);
   furnace.spawnAction(MonasteryFurnaceEvent.PROTECTOR_ROOM, true);
 }
Example #3
0
 @Override
 public void runImpl() throws Exception {
   for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) {
     if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) {
       ((FurnfaceInstance) npc).setActive2114001(i_ai9);
     }
   }
   PC_TURN = ThreadPoolManager.getInstance().schedule(new PC_TURN(), interval_time * 1000);
 }
Example #4
0
  @Override
  public void spawnObject(GlobalEvent event) {
    if (_flag == null) {
      _flag = new NpcInstance(IdFactory.getInstance().getNextId(), _flagTemplate);
      _flag.setCurrentHpMp(_flag.getMaxHp(), _flag.getMaxMp());
      _flag.setHasChatWindow(false);
      _flag.spawnMe(_flagLoc);
    } else if (_mob == null) {
      NpcTemplate template =
          _siegeClan == null || _siegeClan.getParam() == 0
              ? _mobTemplate
              : NpcHolder.getInstance().getTemplate((int) _siegeClan.getParam());

      _mob = (CTBBossInstance) template.getNewInstance();
      _mob.setCurrentHpMp(_mob.getMaxHp(), _mob.getMaxMp());
      _mob.setMatchTeamObject(this);
      _mob.addEvent(event);

      int x =
          (int) (_flagLoc.x + 300 * Math.cos(_mob.headingToRadians(_flag.getHeading() - 32768)));
      int y =
          (int) (_flagLoc.y + 300 * Math.sin(_mob.headingToRadians(_flag.getHeading() - 32768)));

      Location loc = new Location(x, y, _flag.getZ(), _flag.getHeading());
      _mob.setSpawnedLoc(loc);
      _mob.spawnMe(loc);
    } else throw new IllegalArgumentException("Cant spawn twice");
  }
Example #5
0
 @Override
 public void runImpl() throws Exception {
   NpcInstance npc1 = GameObjectsStorage.getAsNpc(_storedId);
   Functions.npcShout(npc1, NpcString.FURNFACE4);
   for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) {
     if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) {
       ((FurnfaceInstance) npc).setSCE_GAME_PLAYER_START();
     }
   }
   i_ai0 = 1;
 }
Example #6
0
  public void tele() {
    Player player = getSelf();
    NpcInstance npc = getNpc();

    if (player != null && npc != null)
      if (player.getLevel() < 75) show("teleporter/" + npc.getNpcId() + "-4.htm", player);
      else if (player.getAdena() >= 150000) {
        player.reduceAdena(150000, true);
        player.teleToLocation(-149406, 255247, -80);
      } else show("teleporter/" + npc.getNpcId() + "-2.htm", player);
  }
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();
    if (actor.isDead()) {
      return true;
    }

    if (_def_think) {
      doTask();
      return true;
    }

    if (actor.isMoving) {
      return true;
    }

    if (System.currentTimeMillis() > wait_timeout && (current_point > -1 || Rnd.chance(5))) {
      if (!wait) {
        switch (current_point) {
          case 0:
            wait_timeout = System.currentTimeMillis() + 30000;
            wait = true;
            return true;
          case 12:
            wait_timeout = System.currentTimeMillis() + 60000;
            wait = true;
            return true;
          case 21:
            wait_timeout = System.currentTimeMillis() + 30000;
            wait = true;
            return true;
        }
      }

      wait_timeout = 0;
      wait = false;
      current_point++;

      if (current_point >= points.length) {
        current_point = 0;
      }

      addTaskMove(points[current_point], false);
      doTask();
      return true;
    }

    if (randomAnimation()) {
      return true;
    }

    return false;
  }
Example #8
0
 private void startMoveTask() {
   NpcInstance npc = getActor();
   _lastPoint++;
   if (_lastPoint >= _points.length)
     if (!npc.getReflection().isDefault()) {
       ((HeartInfinityDefence) npc.getReflection()).notifyWagonArrived();
       npc.deleteMe();
       return;
     }
   addTaskMove(Location.findPointToStay(_points[_lastPoint], 250, npc.getGeoIndex()), true);
   doTask();
 }
Example #9
0
  @Override
  protected void onEvtAttacked(Creature attacker, int damage) {
    if (attacker == null || attacker.getPlayer() == null) return;

    for (NpcInstance minion : World.getAroundNpc(getActor(), 3000, 2000))
      if (minion.getNpcId() == 22358 || minion.getNpcId() == 22357)
        minion.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, attacker, 5000);

    if (!_attacked) {
      Functions.npcSay(getActor(), "Fool, you and your friends will die! Attack!");
      _attacked = true;
    }
  }
Example #10
0
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();
    if (actor == null || actor.isDead()) return true;

    if (_def_think) {
      doTask();
      return true;
    }

    if (diedTeredor < 3 || currentPoint >= MOVE_LOC.length - 1) {
      List<Creature> list =
          World.getAroundCharacters(
              getActor(), getActor().getAggroRange(), getActor().getAggroRange());
      for (Creature target : list) {
        if (target != null
            && !target.isDead()
            && ArrayUtils.contains(ATTACK_IDS, target.getNpcId())) {
          Skill sk = SkillTable.getInstance().getInfo(SKILL_ID, 1);
          if (lastCastTime + sk.getHitTime() + sk.getReuseDelay() <= System.currentTimeMillis()) {
            lastCastTime = System.currentTimeMillis();
            clearTasks();
            addTaskCast(target, sk);
            return true;
          }
          return false;
        }
      }
    } else if (diedTeredor >= 3 && currentPoint < MOVE_LOC.length - 1) {
      if (loc == null || getActor().getDistance(loc) <= 100) {
        currentPoint++;
        loc =
            new Location(
                MOVE_LOC[currentPoint].getX() + Rnd.get(50) - Rnd.get(50),
                MOVE_LOC[currentPoint].getY() + Rnd.get(50) - Rnd.get(50),
                MOVE_LOC[currentPoint].getZ() + Rnd.get(50) - Rnd.get(50));
        if (currentPoint == 0) {
          Reflection r = getActor().getReflection();
          if (r instanceof MemoryOfDisaster) {
            ((MemoryOfDisaster) r).spawnTransparentTeredor();
          }
        }
      }
      actor.setWalking();
      clearTasks();
      addTaskMove(loc, true);
      doTask();
      return true;
    }
    return false;
  }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   if (st.getState() == STARTED) {
     st.rollAndGive(CLAWS, 1, CHANCE[npc.getNpcId() - 21508][1]);
   }
   return null;
 }
  @Override
  protected void onDeath(Creature killer) {
    Reflection reflection = getReflection();
    if (reflection != ReflectionManager.DEFAULT) reflection.collapse();

    super.onDeath(killer);
  }
  @Override
  public String onKill(NpcInstance npc, QuestState st) {
    int npcId = npc.getNpcId();
    if ((npcId == 20517 || npcId == 20518 || npcId == 20455) && st.getCond() == 3) {
      if (st.getQuestItemsCount(CECKTINONS_VOUCHER2_ID) == 1
          && st.getQuestItemsCount(BONE_FRAGMENT1_ID) < 10) {
        if (Rnd.chance(33)) {
          st.giveItems(BONE_FRAGMENT1_ID, 1);
          if (st.getQuestItemsCount(BONE_FRAGMENT1_ID) == 10) {
            st.playSound(SOUND_MIDDLE);
            st.setCond(4);
          } else {
            st.playSound(SOUND_ITEMGET);
          }
        }
      }
    } else if ((npcId == 20015 || npcId == 20020) && st.getCond() == 6) {
      if (st.getQuestItemsCount(PRESERVE_OIL_ID) == 1) {
        if (Rnd.chance(33)) {
          st.giveItems(ZOMBIE_HEAD_ID, 1);
          st.playSound(SOUND_MIDDLE);
          st.takeItems(PRESERVE_OIL_ID, 1);
          st.setCond(7);
        }
      }
    }

    return null;
  }
Example #14
0
 private void recallNPC(Player activeChar) {
   GameObject obj = activeChar.getTarget();
   if (obj != null && obj.isNpc()) {
     obj.setLoc(activeChar.getLoc());
     ((NpcInstance) obj).broadcastCharInfo();
     activeChar.sendMessage(
         "You teleported npc " + obj.getName() + " to " + activeChar.getLoc().toString() + ".");
   } else activeChar.sendMessage("Target is't npc.");
 }
Example #15
0
  @Override
  protected void onEvtAttacked(Creature attacker, int damage) {
    NpcInstance actor = getActor();

    if (!_attacked) {
      for (int i = 0; i < 4; i++) {
        try {
          SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(18493));
          sp.setLoc(Location.findPointToStay(actor, 150, 250));
          sp.setReflection(actor.getReflection());
          sp.doSpawn(true);
          sp.stopRespawn();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      _attacked = true;
    }
  }
Example #16
0
 @Override
 public void despawnObject(GlobalEvent event) {
   if (_mob != null) {
     _mob.deleteMe();
     _mob = null;
   }
   if (_flag != null) {
     _flag.deleteMe();
     _flag = null;
   }
   _siegeClan = null;
 }
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (command.equalsIgnoreCase("request_coralg")) {
      ReflectionUtils.simpleEnterInstancedZone(player, CrystalCaverns.class, 10);
    } else {
      super.onBypassFeedback(player, command);
    }
  }
  @Override
  public String onKill(NpcInstance npc, QuestState qs) {
    if (qs.getState() != STARTED) return null;
    Integer chance = Medal_Chances.get(npc.getNpcId());
    if (chance != null && Rnd.chance(chance * Config.RATE_QUESTS_REWARD)) {
      qs.giveItems(Warehouse_Keepers_Medal, 1);
      qs.playSound(
          qs.getQuestItemsCount(Warehouse_Keepers_Medal) == 10 ? SOUND_MIDDLE : SOUND_ITEMGET);
    }

    return null;
  }
Example #19
0
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int cond = st.getCond();
   int npcId = npc.getNpcId();
   if (npcId == Sophia)
     switch (cond) {
       case 1:
         htmltext = "sophia_q464_01.htm";
         break;
       case 2:
         htmltext = "sophia_q464_05a.htm";
         break;
       case 3:
         htmltext = "sophia_q464_05b.htm";
         break;
       case 4:
         htmltext = "sophia_q464_05c.htm";
         break;
       case 5:
         htmltext = "sophia_q464_05d.htm";
         break;
       case 6:
         htmltext = "sophia_q464_05e.htm";
         break;
       case 7:
         htmltext = "sophia_q464_05f.htm";
         break;
       case 8:
         htmltext = "sophia_q464_05g.htm";
         break;
       case 9:
         htmltext = "sophia_q464_05h.htm";
         break;
     }
   else if (npcId == Seresin) {
     if (cond == 2) htmltext = "seresin_q464_01.htm";
   } else if (npcId == Holly) {
     if (cond == 3) htmltext = "holly_q464_01.htm";
   } else if (npcId == Flauen) {
     if (cond == 4) htmltext = "flauen_q464_01.htm";
   } else if (npcId == Dominic) {
     if (cond == 5) htmltext = "dominic_q464_01.htm";
   } else if (npcId == Chichirin) {
     if (cond == 6) htmltext = "chichirin_q464_01.htm";
   } else if (npcId == Tobias) {
     if (cond == 7) htmltext = "tobias_q464_01.htm";
   } else if (npcId == Blacksmith) {
     if (cond == 8) htmltext = "blacksmith_q464_01.htm";
   } else if (npcId == Agnes) if (cond == 9) htmltext = "agnes_q464_01.htm";
   return htmltext;
 }
Example #20
0
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   for (int i = 0; i < DROPLIST_COND.length; i++) {
     if (cond == DROPLIST_COND[i][0] && npcId == DROPLIST_COND[i][2]) {
       if (DROPLIST_COND[i][3] == 0 || st.getQuestItemsCount(DROPLIST_COND[i][3]) > 0) {
         if (DROPLIST_COND[i][5] == 0) {
           st.rollAndGive(DROPLIST_COND[i][4], DROPLIST_COND[i][7], DROPLIST_COND[i][6]);
         } else if (st.rollAndGive(
             DROPLIST_COND[i][4],
             DROPLIST_COND[i][7],
             DROPLIST_COND[i][7],
             DROPLIST_COND[i][5],
             DROPLIST_COND[i][6])) {
           if (DROPLIST_COND[i][1] != cond && DROPLIST_COND[i][1] != 0) {
             st.setCond(Integer.valueOf(DROPLIST_COND[i][1]));
             st.setState(STARTED);
           }
         }
       }
     }
   }
   if (cond == 3 && st.getQuestItemsCount(LeatherPouchFull1st) == 0) {
     st.takeItems(KashaBearClaw, -1);
     st.takeItems(LeatherPouch1st, -1);
     st.giveItems(LeatherPouchFull1st, 1);
   } else if (cond == 5 && st.getQuestItemsCount(LeatherPouchFull2st) == 0) {
     st.takeItems(KashaBladeSpiderTalon, -1);
     st.takeItems(LeatherPouch2st, -1);
     st.giveItems(LeatherPouchFull2st, 1);
   } else if (cond == 7 && st.getQuestItemsCount(LeatherPouchFull3st) == 0) {
     st.takeItems(ScarletSalamanderScale, -1);
     st.takeItems(LeatherPouch3st, -1);
     st.giveItems(LeatherPouchFull3st, 1);
   } else if (cond == 11
       && st.getQuestItemsCount(RatmanFang) >= 3
       && st.getQuestItemsCount(LangkLizardmanTooth) >= 3
       && st.getQuestItemsCount(FelimLizardmanTooth) >= 3
       && st.getQuestItemsCount(VukuOrcTusk) >= 3) {
     st.takeItems(VukuOrcTusk, -1);
     st.takeItems(RatmanFang, -1);
     st.takeItems(LangkLizardmanTooth, -1);
     st.takeItems(FelimLizardmanTooth, -1);
     st.takeItems(LeatherPouch4st, -1);
     st.giveItems(LeatherPouchFull4st, 1);
     st.setCond(12);
     st.setState(STARTED);
   }
   return null;
 }
Example #21
0
  @Override
  protected void onEvtAttacked(Creature attacker, int damage) {
    NpcInstance actor = getActor();
    if (actor == null) {
      return;
    }

    int event_id = actor.getAISpawnParam();
    MonasteryFurnaceEvent furnace =
        EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, event_id);

    if (_firstTimeAttacked && !furnace.isInProgress()) {
      _firstTimeAttacked = false;
      attacker.setTarget(null);
      actor.setTargetable(false, false);
      actor.setNpcState((byte) 1);
      Functions.npcShout(actor, NpcString.FURN1);
      furnace.registerActions();
      ThreadPoolManager.getInstance().schedule(new ScheduleTimerTask(), 15000);
    }

    super.onEvtAttacked(attacker, damage);
  }
  /*
   * благодаря ai.Quest421FairyTree вызовется только при атаке от L2PetInstance
   */
  @Override
  public String onAttack(NpcInstance npc, QuestState st) {
    if (st.getState() != STARTED
        || st.getCond() != 2
        || !HatchlingSummoned(st, true)
        || st.getQuestItemsCount(Fairy_Leaf) == 0) return null;

    String npcID = String.valueOf(npc.getNpcId());
    Integer attaked_times = st.getInt(npcID);
    if (CheckTree(st, npc.getNpcId())) return null;
    if (attaked_times > Min_Fairy_Tree_Attaks) {
      st.set(npcID, "1000000");
      Functions.npcSay(npc, "Give me the leaf!");
      st.takeItems(Fairy_Leaf, 1);
      if (CheckTree(st, Fairy_Tree_of_Wind)
          && CheckTree(st, Fairy_Tree_of_Star)
          && CheckTree(st, Fairy_Tree_of_Twilight)
          && CheckTree(st, Fairy_Tree_of_Abyss)) {
        st.setCond(3);
        st.playSound(SOUND_MIDDLE);
      } else st.playSound(SOUND_ITEMGET);
    } else st.set(npcID, String.valueOf(attaked_times + 1));
    return null;
  }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (npcId == 31517) {
     if (cond == 0)
       if (st.getPlayer().getLevel() >= 61) htmltext = "dark_presbyter_q0017_01.htm";
       else {
         htmltext = "dark_presbyter_q0017_03.htm";
         st.exitCurrentQuest(true);
       }
     else if (cond > 0 && cond < 5 && st.getQuestItemsCount(7168) > 0)
       htmltext = "dark_presbyter_q0017_05.htm";
     else if (cond > 0 && cond < 5 && st.getQuestItemsCount(7168) == 0) {
       htmltext = "dark_presbyter_q0017_06.htm";
       st.setCond(0);
       st.exitCurrentQuest(false);
     } else if (cond == 5 && st.getQuestItemsCount(7168) == 0) {
       htmltext = "dark_presbyter_q0017_07.htm";
       st.addExpAndSp(697040, 54887);
       st.playSound(SOUND_FINISH);
       st.exitCurrentQuest(false);
     }
   } else if (npcId == 31508) {
     if (cond == 1)
       if (st.getQuestItemsCount(7168) != 0) htmltext = "blessed_altar1_q0017_01.htm";
       else htmltext = "blessed_altar1_q0017_03.htm";
     else if (cond == 2) htmltext = "blessed_altar1_q0017_05.htm";
   } else if (npcId == 31509) {
     if (cond == 2)
       if (st.getQuestItemsCount(7168) != 0) htmltext = "blessed_altar2_q0017_01.htm";
       else htmltext = "blessed_altar2_q0017_03.htm";
     else if (cond == 3) htmltext = "blessed_altar2_q0017_05.htm";
   } else if (npcId == 31510) {
     if (cond == 3)
       if (st.getQuestItemsCount(7168) != 0) htmltext = "blessed_altar3_q0017_01.htm";
       else htmltext = "blessed_altar3_q0017_03.htm";
     else if (cond == 4) htmltext = "blessed_altar3_q0017_05.htm";
   } else if (npcId == 31511)
     if (cond == 4)
       if (st.getQuestItemsCount(7168) != 0) htmltext = "blessed_altar4_q0017_01.htm";
       else htmltext = "blessed_altar4_q0017_03.htm";
     else if (cond == 5) htmltext = "blessed_altar4_q0017_05.htm";
   return htmltext;
 }
Example #24
0
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   String htmltext = "noquest";
   int id = st.getState();
   if (id == CREATED) {
     if (st.getPlayer().getRace() != Race.human
         || st.getQuestItemsCount(MARK_OF_TRAVELER_ID) == 0) {
       htmltext = "galladuchi_q0045_0102.htm";
       st.exitCurrentQuest(true);
     } else if (st.getPlayer().getLevel() < 3) {
       htmltext = "galladuchi_q0045_0103.htm";
       st.exitCurrentQuest(true);
     } else {
       htmltext = "galladuchi_q0045_0101.htm";
     }
   } else if (npcId == 30097 && st.getCond() == 1) {
     htmltext = "galladuchi_q0045_0105.htm";
   } else if (npcId == 30097 && st.getCond() == 2) {
     htmltext = "galladuchi_q0045_0201.htm";
   } else if (npcId == 30097 && st.getCond() == 3) {
     htmltext = "galladuchi_q0045_0303.htm";
   } else if (npcId == 30097 && st.getCond() == 4) {
     htmltext = "galladuchi_q0045_0401.htm";
   } else if (npcId == 30097 && st.getCond() == 5) {
     htmltext = "galladuchi_q0045_0503.htm";
   } else if (npcId == 30097 && st.getCond() == 6) {
     htmltext = "galladuchi_q0045_0601.htm";
   } else if (npcId == 30094 && st.getCond() == 1) {
     htmltext = "gentler_q0045_0101.htm";
   } else if (npcId == 30094 && st.getCond() == 2) {
     htmltext = "gentler_q0045_0203.htm";
   } else if (npcId == 30090 && st.getCond() == 3) {
     htmltext = "sandra_q0045_0301.htm";
   } else if (npcId == 30090 && st.getCond() == 4) {
     htmltext = "sandra_q0045_0403.htm";
   } else if (npcId == 30116 && st.getCond() == 5) {
     htmltext = "dustin_q0045_0501.htm";
   } else if (npcId == 30116 && st.getCond() == 6) {
     htmltext = "dustin_q0045_0603.htm";
   }
   return htmltext;
 }
Example #25
0
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (npcId == LIZARDMAN_WARRIOR | npcId == LIZARDMAN_SCOUT | npcId == LIZARDMAN) {
     if (cond == 2 && st.getQuestItemsCount(LIZARD_CAPTAIN_ORDER_ID) < 1) {
       st.giveItems(LIZARD_CAPTAIN_ORDER_ID, 1);
       st.playSound(SOUND_MIDDLE);
       st.setCond(3);
     }
   } else if (npcId == TAMIL) {
     if (cond == 4 && st.getQuestItemsCount(TAMATOS_NECKLACE_ID) < 1) {
       st.giveItems(TAMATOS_NECKLACE_ID, 1);
       st.playSound(SOUND_MIDDLE);
       st.setCond(5);
     }
   }
   return null;
 }
Example #26
0
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   MonsterInstance mob = (MonsterInstance) npc;
   boolean cond = st.getCond() > 0;
   if (npcId == HunterBear) {
     if (cond
         && st.getQuestItemsCount(BEAR_PIC) == 1
         && st.getQuestItemsCount(HONEY_JAR) < 5
         && Rnd.chance(20)) {
       st.addSpawn(HoneyBear);
     }
   } else if (npcId == HoneyBear) {
     if (cond && st.getQuestItemsCount(BEAR_PIC) == 1 && st.getQuestItemsCount(HONEY_JAR) < 5) {
       if (mob.isSpoiled()) {
         st.giveItems(HONEY_JAR, 1);
         if (st.getQuestItemsCount(HONEY_JAR) == 5) {
           st.playSound(SOUND_MIDDLE);
           st.setCond(6);
         } else {
           st.playSound(SOUND_ITEMGET);
         }
       }
     }
   } else if (npcId == HunterTarantula || npcId == PlunderTarantula) {
     if (cond && st.getQuestItemsCount(TARANTULA_PIC) == 1 && st.getQuestItemsCount(BEAD) < 20) {
       if (mob.isSpoiled()) {
         if (Rnd.chance(50)) {
           st.giveItems(BEAD, 1);
           if (st.getQuestItemsCount(BEAD) == 20) {
             st.playSound(SOUND_MIDDLE);
             st.setCond(8);
           } else {
             st.playSound(SOUND_ITEMGET);
           }
         }
       }
     }
   }
   return null;
 }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (npcId == CADMON) {
     if (cond == 0) {
       if (st.getPlayer().getLevel() >= 74) htmltext = "guard_cadmon_q0012_0101.htm";
       else {
         htmltext = "guard_cadmon_q0012_0103.htm";
         st.exitCurrentQuest(true);
       }
     } else if (cond == 1) htmltext = "guard_cadmon_q0012_0105.htm";
   } else if (npcId == HELMUT) {
     if (cond == 1) htmltext = "trader_helmut_q0012_0101.htm";
     else if (cond == 2) htmltext = "trader_helmut_q0012_0202.htm";
   } else if (npcId == NARAN_ASHANUK)
     if (cond == 2 && st.getQuestItemsCount(MUNITIONS_BOX) > 0)
       htmltext = "herald_naran_q0012_0201.htm";
   return htmltext;
 }
Example #28
0
  @Override
  protected boolean maybeMoveToHome() {
    NpcInstance actor = getActor();
    if (System.currentTimeMillis() - _lastTeleport < 10000) {
      return false;
    }

    boolean randomWalk = actor.hasRandomWalk();
    Location sloc = actor.getSpawnedLoc();
    if (sloc == null) {
      return false;
    }

    // Random walk or not?
    if (randomWalk && (!Config.RND_WALK || Rnd.chance(Config.RND_WALK_RATE))) {
      return false;
    }

    if (!randomWalk && actor.isInRangeZ(sloc, Config.MAX_DRIFT_RANGE)) {
      return false;
    }

    int x = sloc.x + Rnd.get(-Config.MAX_DRIFT_RANGE, Config.MAX_DRIFT_RANGE);
    int y = sloc.y + Rnd.get(-Config.MAX_DRIFT_RANGE, Config.MAX_DRIFT_RANGE);
    int z = GeoEngine.getHeight(x, y, sloc.z, actor.getGeoIndex());

    if (sloc.z - z > 64) {
      return false;
    }

    SpawnRange spawnRange = actor.getSpawnRange();
    boolean isInside = true;
    if (spawnRange != null && spawnRange instanceof Territory) {
      isInside = ((Territory) spawnRange).isInside(x, y);
    }

    if (isInside) {
      actor.broadcastPacketToOthers(new MagicSkillUse(actor, actor, 4671, 1, 500, 0));
      ThreadPoolManager.getInstance().schedule(new Teleport(new Location(x, y, z)), 500);
      _lastTeleport = System.currentTimeMillis();
    }
    return isInside;
  }
Example #29
0
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   String htmltext = "noquest";
   int cond = st.getCond();
   if (npcId == MOIRA) {
     if (cond == 0) {
       if (st.getPlayer().getLevel() >= 20) {
         htmltext = "seer_moirase_q0122_0101.htm";
       } else {
         htmltext = "seer_moirase_q0122_0103.htm";
         st.exitCurrentQuest(true);
       }
     } else {
       htmltext = "seer_moirase_q0122_0104.htm";
     }
   } else if (npcId == KARUDA && cond == 1) {
     htmltext = "karuda_q0122_0101.htm";
   }
   return htmltext;
 }
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    int _state = st.getState();
    int npcId = npc.getNpcId();

    if (_state == CREATED) {
      if (npcId != Cliff) return "noquest";
      if (st.getPlayer().getLevel() < 40) {
        st.exitCurrentQuest(true);
        return "30182-04.htm";
      }
      st.setCond(0);
      return "30182-01.htm";
    }

    if (_state != STARTED) return "noquest";
    long medals = st.getQuestItemsCount(Warehouse_Keepers_Medal);

    if (medals >= 100) return String.valueOf(npcId) + "-06.htm";
    if (medals >= 10) return String.valueOf(npcId) + "-06a.htm";
    return String.valueOf(npcId) + "-06b.htm";
  }