Beispiel #1
0
 private void spawnHesibanata(Player player) {
   Npc spawn =
       (Npc)
           QuestService.spawnQuestNpc(
               300330000, player.getInstanceId(), 218890, 250.970f, 221.711f, 124.942f, (byte) 0);
   spawn.getAggroList().addHate(player, 1);
 }
Beispiel #2
0
 @Override
 public boolean onMovieEndEvent(QuestEnv env, int movieId) {
   if (movieId != 151) return false;
   Player player = env.getPlayer();
   int instanceId = player.getInstanceId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() != QuestStatus.START || qs.getQuestVars().getQuestVars() != 4)
     return false;
   questService.addNewSpawn(
       310010000, instanceId, 790001, (float) 220.6, (float) 247.8, (float) 206.0, (byte) 0, true);
   qs.setQuestVar(5);
   updateQuestStatus(player, qs);
   return true;
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204191:
          {
            switch (env.getDialogId()) {
              case 25:
                if (var == 0)
                  return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
                break;
              case 10000:
                if (var == 0) {
                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(player, qs);
                  TeleportService.teleportTo(
                      player, 220030000, player.getInstanceId(), 1748f, 1807f, 255f, 1000);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                }
            }
          }
        case 203559:
          switch (env.getDialogId()) {
            case 25:
              if (var == 1) {
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(player, qs);
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
              }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203559) {
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
Beispiel #4
0
 private void spawn(Player player) {
   int mobToSpawn = mobs.get(Rnd.get(0, 3));
   float x = 0;
   float y = 0;
   final float z = 124.942f;
   switch (mobToSpawn) {
     case 218760:
       {
         x = 250.081f;
         y = 268.308f;
         break;
       }
     case 218762:
       {
         x = 273.354f;
         y = 244.489f;
         break;
       }
     case 218761:
       {
         x = 272.994f;
         y = 244.674f;
         break;
       }
     case 218763:
       {
         x = 250.800f;
         y = 222.782f;
         break;
       }
   }
   Npc spawn =
       (Npc)
           QuestService.spawnQuestNpc(
               300330000, player.getInstanceId(), mobToSpawn, x, y, z, (byte) 0);
   Collection<Npc> allNpcs = World.getInstance().getNpcs();
   Npc target = null;
   for (Npc npc : allNpcs) {
     if (npc.getNpcId() == 730493) {
       target = npc;
     }
   }
   if (target != null) {
     spawn.getAggroList().addHate(target, 1);
   }
 }
Beispiel #5
0
  @Override
  public boolean onKillEvent(QuestEnv env) {
    Player player = env.getPlayer();
    int instanceId = player.getInstanceId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (targetId == 211042) {
      if (var >= 51 && var <= 53) {
        qs.setQuestVar(qs.getQuestVars().getQuestVars() + 1);
        updateQuestStatus(player, qs);
        return true;
      } else if (var == 54) {
        qs.setQuestVar(4);
        updateQuestStatus(player, qs);
        Npc mob =
            (Npc)
                questService.addNewSpawn(
                    310010000,
                    instanceId,
                    211043,
                    (float) 226.7,
                    (float) 251.5,
                    (float) 205.5,
                    (byte) 0,
                    true);
        // TODO: Tempt decrease P attack.
        mob.getGameStats()
            .setStat(
                StatEnum.MAIN_HAND_POWER,
                mob.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_POWER) / 3);
        mob.getAggroList().addDamage(player, 1000);
        return true;
      }
    }
    return false;
  }
  @Override
  public boolean onKillEvent(final QuestEnv env) {
    final Player player = env.getPlayer();
    final int instanceId = player.getInstanceId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

    final Npc npc = (Npc) env.getVisibleObject();

    switch (env.getTargetId()) {
      case 216531:
        if (qs.getQuestVarById(0) == 14 || qs.getQuestVarById(0) == 15) {
          QuestService.addNewSpawn(
              300160000, instanceId, 730229, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading());
          qs.setQuestVarById(0, 15);
          updateQuestStatus(env);
          return true;
        }
    }
    return false;
  }
Beispiel #7
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final int instanceId = player.getInstanceId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVars().getQuestVars();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 790001) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 0)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
            else if (var == 3)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1693);
            else if (var == 5)
              return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2034);
          case 10000:
            if (var == 0) {
              if (player.getInventory().getItemCountByItemId(182200007) == 0)
                if (!itemService.addItems(
                    player, Collections.singletonList(new QuestItems(182200007, 1)))) return true;
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
          case 10002:
            if (var == 3) {
              player.getInventory().removeFromBagByItemId(182200009, 1);
              qs.setQuestVar(99);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
              WorldMapInstance newInstance = instanceService.getNextAvailableInstance(310010000);
              instanceService.registerPlayerWithInstance(newInstance, player);
              teleportService.teleportTo(
                  player, 310010000, newInstance.getInstanceId(), 52, 174, 229, 0);
              return true;
            }
          case 10003:
            if (var == 5) {
              PlayerClass playerClass = player.getCommonData().getPlayerClass();
              if (playerClass == PlayerClass.WARRIOR)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
              else if (playerClass == PlayerClass.SCOUT)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2716);
              else if (playerClass == PlayerClass.MAGE)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3057);
              else if (playerClass == PlayerClass.PRIEST)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 3398);
            }
          case 10004:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.GLADIATOR);
          case 10005:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.TEMPLAR);
          case 10006:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.ASSASSIN);
          case 10007:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.RANGER);
          case 10008:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.SORCERER);
          case 10009:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.SPIRIT_MASTER);
          case 10010:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.CLERIC);
          case 10011:
            if (var == 5) return setPlayerClass(env, qs, PlayerClass.CHANTER);
        }
      } else if (targetId == 730008) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 2) {
              if (player.getInventory().getItemCountByItemId(182200008) != 0)
                return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1352);
              else return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1354);
            }
          case 1353:
            if (var == 2) {
              PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 14));
              player.getInventory().removeFromBagByItemId(182200008, 1);
              itemService.addItems(player, Collections.singletonList(new QuestItems(182200009, 1)));
            }
            return false;
          case 10001:
            if (var == 2) {
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(player, qs);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return true;
            }
        }
      } else if (targetId == 205000) {
        switch (env.getDialogId()) {
          case 25:
            if (var == 99) {
              PacketSendUtility.sendPacket(player, new SM_EMOTION(player, 6, 1001, 0));
              qs.setQuestVar(50);
              updateQuestStatus(player, qs);
              ThreadPoolManager.getInstance()
                  .schedule(
                      new Runnable() {
                        @Override
                        public void run() {
                          qs.setQuestVar(51);
                          updateQuestStatus(player, qs);
                          List<Npc> mobs = new ArrayList<Npc>();
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 224.073,
                                      (float) 239.1,
                                      (float) 206.7,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 233.5,
                                      (float) 241.04,
                                      (float) 206.365,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 229.6,
                                      (float) 265.7,
                                      (float) 205.7,
                                      (byte) 0,
                                      true));
                          mobs.add(
                              (Npc)
                                  questService.addNewSpawn(
                                      310010000,
                                      instanceId,
                                      211042,
                                      (float) 222.8,
                                      (float) 262.5,
                                      (float) 205.7,
                                      (byte) 0,
                                      true));
                          for (Npc mob : mobs) {
                            // TODO: Tempt decrease P attack.
                            mob.getGameStats()
                                .setStat(
                                    StatEnum.MAIN_HAND_POWER,
                                    mob.getGameStats().getCurrentStat(StatEnum.MAIN_HAND_POWER)
                                        / 3);
                            mob.getGameStats().setStat(StatEnum.PHYSICAL_DEFENSE, 0);
                            mob.getAggroList().addDamage(player, 1000);
                          }
                        }
                      },
                      43000);
              return true;
            }
            return false;
          default:
            return false;
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 790001) {
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) {
      return false;
    }
    int var = qs.getQuestVars().getQuestVars();
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204182:
          { // Heimdall
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1011);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1); // 1
                }
            }
            break;
          }
        case 203550:
          { // Munin
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 1) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 10) {
                    return sendQuestDialog(env, 4080);
                  }
                }
              case SETPRO2:
                {
                  return defaultCloseDialog(env, 1, 2); // 2
                }
              case SETPRO10:
                {
                  return defaultCloseDialog(env, 10, 10, true, false); // reward
                }
            }
            break;
          }
        case 790003:
          { // Urd
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 2) {
                    return sendQuestDialog(env, 1693);
                  }
                }
              case SETPRO3:
                {
                  return defaultCloseDialog(env, 2, 3); // 3
                }
            }
            break;
          }
        case 790002:
          { // Verdandi
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 3) {
                    return sendQuestDialog(env, 2034);
                  }
                }
              case SETPRO4:
                {
                  return defaultCloseDialog(env, 3, 4); // 4
                }
            }
            break;
          }
        case 203546:
          { // Skuld
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 4) {
                    return sendQuestDialog(env, 2375);
                  } else if (var == 9) {
                    return sendQuestDialog(env, 3739);
                  }
                }
              case SETPRO5:
                {
                  if (var == 4) {
                    changeQuestStep(env, 4, 95, false); // 95
                    WorldMapInstance newInstance =
                        InstanceService.getNextAvailableInstance(320070000);
                    InstanceService.registerPlayerWithInstance(newInstance, player);
                    TeleportService2.teleportTo(
                        player,
                        320070000,
                        newInstance.getInstanceId(),
                        268.47397f,
                        251.80275f,
                        125.8369f);
                    return closeDialogWindow(env);
                  }
                }
              case SETPRO9:
                {
                  changeQuestStep(env, 9, 10, false); // 10
                  TeleportService2.teleportTo(player, 220010000, 1, 383.0f, 1896.0f, 327.625f);
                  return closeDialogWindow(env);
                }
            }
            break;
          }
        case 204264:
          { // Skuld 2
            switch (dialog) {
              case USE_OBJECT:
                {
                  if (var == 99 && !isStigmaEquipped(env)) {
                    return sendQuestDialog(env, 3057);
                  }
                }
              case QUEST_SELECT:
                {
                  if (var == 95) {
                    return sendQuestDialog(env, 2716);
                  } else if (var == 96) {
                    return sendQuestDialog(env, 3057);
                  } else if (var == 97) {
                    return sendQuestDialog(env, 3398);
                  }
                }
              case SETPRO6:
                {
                  if (var == 95) {
                    playQuestMovie(env, 156);
                    return closeDialogWindow(env);
                  }
                }
              case SELECT_ACTION_3058:
                {
                  if (var == 96) {
                    if (giveQuestItem(env, getStoneId(player), 1) && !isStigmaEquipped(env)) {
                      long existendStigmaShards =
                          player.getInventory().getItemCountByItemId(141000001);
                      if (existendStigmaShards < 60) {
                        if (!player.getInventory().isFull()) {
                          ItemService.addItem(player, 141000001, 60 - existendStigmaShards);
                          changeQuestStep(env, 96, 99, false); // 99
                          return sendQuestDialog(env, 3058);
                        } else {
                          return closeDialogWindow(env);
                        }
                      } else {
                        changeQuestStep(env, 96, 99, false); // 99
                        return sendQuestDialog(env, 3058);
                      }
                    } else {
                      return closeDialogWindow(env);
                    }
                  } else if (var == 99) {
                    return sendQuestDialog(env, 3058);
                  }
                }
              case SETPRO7:
                {
                  if (var == 99) {
                    PacketSendUtility.sendPacket(
                        player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 1));
                    return true;
                  }
                }
              case SETPRO8:
                {
                  if (var == 97) {
                    changeQuestStep(env, 97, 98, false); // 98
                    QuestService.addNewSpawn(
                        320070000, player.getInstanceId(), 204263, 257.5f, 245f, 125f, (byte) 0);
                    return closeDialogWindow(env);
                  }
                }
            }
            break;
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204061) { // Aud
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
Beispiel #9
0
  public void executeCommand(Player admin, String[] params) {
    if (params == null || params.length < 1) {
      PacketSendUtility.sendMessage(admin, "syntax //bind < all | elyos | asmos >");
      return;
    }

    if (params[0].equals("all")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLALL) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          teleportService.teleportTo(
              p,
              admin.getWorldId(),
              admin.getInstanceId(),
              admin.getX(),
              admin.getY(),
              admin.getZ(),
              admin.getHeading(),
              5);
          PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

          PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
          PacketSendUtility.sendMessage(p, "Vous avez ete teleporte par " + admin.getName() + ".");
        }
      }
    }

    if (params[0].equals("elyos")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLELYOS) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          if (p.getCommonData().getRace() == Race.ELYOS) {
            teleportService.teleportTo(
                p,
                admin.getWorldId(),
                admin.getInstanceId(),
                admin.getX(),
                admin.getY(),
                admin.getZ(),
                admin.getHeading(),
                5);
            PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

            PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
            PacketSendUtility.sendMessage(
                p, "Vous avez ete teleporte par " + admin.getName() + ".");
          }
        }
      }
    }

    if (params[0].equals("asmos")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLASMOS) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          if (p.getCommonData().getRace() == Race.ASMODIANS) {
            teleportService.teleportTo(
                p,
                admin.getWorldId(),
                admin.getInstanceId(),
                admin.getX(),
                admin.getY(),
                admin.getZ(),
                admin.getHeading(),
                5);
            PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

            PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
            PacketSendUtility.sendMessage(
                p, "Vous avez ete teleporte par " + admin.getName() + ".");
          }
        }
      }
    }
  }