@Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (targetId == 278519) {
      if (qs == null) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else if (env.getDialogId() == 1003) {
          if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182203131, 1))))
            return defaultQuestStartDialog(env);
          else return true;
        } else return defaultQuestStartDialog(env);
      }
    } else if (qs != null && qs.getStatus() == QuestStatus.START) {
      if (targetId == 278591) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1352);
        else if (env.getDialogId() == 10000) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        }
      } else if (targetId == 278599) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1693);
        else if (env.getDialogId() == 10001) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          qs.setStatus(QuestStatus.REWARD);
          ItemService.addItems(player, Collections.singletonList(new QuestItems(182202152, 1)));
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        }
      }
    } else if (qs != null && qs.getStatus() == QuestStatus.REWARD && targetId == 278594) {
      return defaultQuestEndDialog(env);
    }
    return false;
  }
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     if (targetId == 203590) {
       if (env.getDialogId() == 25) return sendQuestDialog(env, 1011);
       else if (env.getDialogId() == 1002) {
         if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182203257, 1))))
           return defaultQuestStartDialog(env);
         return true;
       } else return defaultQuestStartDialog(env);
     }
   }
   if (qs == null) return false;
   int var = qs.getQuestVarById(0);
   if (qs.getStatus() == QuestStatus.START || qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 203591) {
       if (var == 0) {
         if (env.getDialogId() == 25) return sendQuestDialog(env, 1352);
         else if (env.getDialogId() == 10000) {
           qs.setQuestVar(1);
           updateQuestStatus(env);
           PacketSendUtility.sendPacket(
               player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
           return true;
         }
       }
       if (var == 2 || var == 3) {
         if (env.getDialogId() == 25) return sendQuestDialog(env, 2375);
         else if (env.getDialogId() == 1009) {
           qs.setQuestVar(3);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return defaultQuestEndDialog(env);
         } else return defaultQuestEndDialog(env);
       }
     } else if (targetId == 203557) {
       if (var == 1) {
         if (env.getDialogId() == 25) return sendQuestDialog(env, 1693);
         else if (env.getDialogId() == 10001) {
           qs.setQuestVar(2);
           updateQuestStatus(env);
           player.getInventory().removeFromBagByItemId(182203257, 1);
           PacketSendUtility.sendPacket(
               player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
           return true;
         }
       }
     }
   }
   return false;
 }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);

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

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 790019) {
        switch (env.getDialogId()) {
          case 26:
            {
              return sendQuestDialog(env, 4762);
            }
          case 1002:
            {
              if (player.getInventory().getItemCountByItemId(182201783) == 0) {
                if (!ItemService.addItems(
                    player, Collections.singletonList(new QuestItems(182201783, 1)))) {
                  return true;
                }
              }
            }
          default:
            return defaultQuestStartDialog(env);
        }
      }
    }

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.REWARD) {
      switch (targetId) {
        case 790019:
          {
            switch (env.getDialogId()) {
              case 26:
                {
                  return sendQuestDialog(env, 10002);
                }
              case 1009:
                {
                  return sendQuestDialog(env, 5);
                }
              default:
                return defaultQuestEndDialog(env);
            }
          }
      }
    }
    return false;
  }
示例#4
0
  @Override
  protected void runImpl() {
    Player player = getConnection().getActivePlayer();

    // Temp Fix To Avoid Legion Warehouse Dupe Exploit
    /** if(sourceStorageType == 3) return; */
    if (player.isTrading()) {
      PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_INVENTORY_SPLIT_DURING_TRADE);
      return;
    }

    if (destinationItemObjId == 0)
      ItemService.splitItem(
          player, sourceItemObjId, itemAmount, slotNum, sourceStorageType, destinationStorageType);
    else
      ItemService.mergeItems(
          player,
          sourceItemObjId,
          itemAmount,
          destinationItemObjId,
          sourceStorageType,
          destinationStorageType);
  }
  /**
   * @param spawnGroup
   * @param instanceIndex
   */
  public static void spawnGroup(SpawnGroup spawnGroup, int instanceIndex) {
    VisibleObjectTemplate objectTemplate = ItemService.getItemTemplate(spawnGroup.getNpcid());
    if (objectTemplate == null) return;

    int pool = spawnGroup.getPool();
    for (int i = 0; i < pool; i++) {
      SpawnTemplate spawn = spawnGroup.getNextAvailableTemplate(instanceIndex);
      int objectId = IDFactory.getInstance().nextId();
      StaticObject staticObject =
          new StaticObject(objectId, new StaticObjectController(), spawn, objectTemplate);
      staticObject.setKnownlist(new KnownList(staticObject));
      bringIntoWorld(staticObject, spawn, instanceIndex);
    }
    spawnGroup.clearLastSpawnedTemplate();
  }
示例#6
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (targetId == 799075) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else if (env.getDialogId() == 1002) {
          if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182206863, 1))))
            return defaultQuestStartDialog(env);
          else return true;
        } else return defaultQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798979) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 2375);
        else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5);
        else return defaultQuestEndDialog(env);
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 798971) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 0) return sendQuestDialog(env, 1352);
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    }
    return false;
  }
 @Override
 public HandlerResult onBonusApplyEvent(QuestCookie env, int index, AbstractInventoryBonus bonus) {
   if (!(bonus instanceof CutSceneBonus)) return HandlerResult.UNKNOWN;
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
     int var1 = qs.getQuestVarById(1);
     int var2 = qs.getQuestVarById(2);
     qs.setQuestVarById(1, var1 + 1);
     // randomize movie
     if ((var1 == 1 && var2 == 0) || var1 == 0 && Rnd.get() * 100 < 50) {
       if (qs.getCompleteCount() == 9)
         ItemService.addItems(player, Collections.singletonList(new QuestItems(188051106, 1)));
       qs.setQuestVarById(2, 1);
       return HandlerResult.SUCCESS;
     }
   }
   return HandlerResult.FAILED;
 }
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (targetId == 798928) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 4762);
       else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       if (env.getDialogId() == -1) return sendQuestDialog(env, 10002);
       else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5);
       else return defaultQuestEndDialog(env);
     }
   } else if (targetId == 799069) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
       else if (env.getDialogId() == 10000) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 700948) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
       if (env.getDialogId() == -1) {
         if (!ItemService.addItems(
             player, Collections.singletonList(new QuestItems(182202193, 1)))) return true;
         final int targetObjectId = env.getVisibleObject().getObjectId();
         PacketSendUtility.sendPacket(
             player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
         PacketSendUtility.broadcastPacket(
             player, new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId), true);
         qs.setQuestVar(2);
         updateQuestStatus(env);
       }
     }
   }
   return false;
 }
示例#9
0
 @Override
 protected void onFailureFinish() {
   PacketSendUtility.sendPacket(
       requestor,
       new SM_CRAFT_UPDATE(
           recipeTemplate.getSkillid(),
           itemTemplate,
           currentSuccessValue,
           currentFailureValue,
           6));
   PacketSendUtility.broadcastPacket(
       requestor,
       new SM_CRAFT_ANIMATION(requestor.getObjectId(), responder.getObjectId(), 0, 3),
       true);
   PacketSendUtility.sendPacket(
       requestor,
       SM_SYSTEM_MESSAGE.STR_COMBINE_FAIL(
           new DescriptionId(
               ItemService.getItemTemplate(recipeTemplate.getProductid()).getNameId())));
 }
  @Override
  public boolean onDialogEvent(final QuestCookie 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.REWARD) {
      if (targetId == 204057) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 10002);
        else return defaultQuestEndDialog(env);
      }
      return false;
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 205150) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 0) return sendQuestDialog(env, 1011);
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 205192) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 1) return sendQuestDialog(env, 1352);
          else if (var == 2) return sendQuestDialog(env, 1693);
          else if (var == 3) return sendQuestDialog(env, 2034);
        case 2035:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 399));
          break;
        case 10001:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10002:
          if (var == 2) {
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10003:
          if (var == 3) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            ItemService.addItems(player, Collections.singletonList(new QuestItems(182209014, 1)));
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 34:
          if (var == 2) {
            if (QuestService.collectItemCheck(env, true)) {
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(env);
              return sendQuestDialog(env, 10000);
            } else return sendQuestDialog(env, 10001);
          }
      }
    } else if (targetId == 205155) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 5) return sendQuestDialog(env, 2716);
        case 10005:
          if (var == 5) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 730151) {
      switch (env.getDialogId()) {
        case -1:
          if (var == 4 || var == 5) {
            final int targetObjectId = env.getVisibleObject().getObjectId();
            PacketSendUtility.sendPacket(
                player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
            PacketSendUtility.broadcastPacket(
                player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
            ThreadPoolManager.getInstance()
                .schedule(
                    new Runnable() {
                      @Override
                      public void run() {
                        Npc npc = (Npc) player.getTarget();
                        if (npc == null || npc.getObjectId() != targetObjectId) return;
                        PacketSendUtility.sendPacket(
                            player,
                            new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                        PacketSendUtility.broadcastPacket(
                            player,
                            new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                            true);
                        if (player.getWorldId() == 220050000 && qs.getQuestVarById(0) == 4) {
                          WorldMapInstance newInstance =
                              InstanceService.getNextAvailableInstance(320130000);
                          InstanceService.registerPlayerWithInstance(newInstance, player);
                          TeleportService.teleportTo(
                              player, 320130000, newInstance.getInstanceId(), 338, 670, 169, 0);
                        } else if (player.getWorldId() == 320130000) {
                          TeleportService.teleportTo(player, 220050000, 1836, 887, 59, 30);
                        }
                      }
                    },
                    3000);
            return false;
          }
      }
    } else if (targetId == 730164) {
      switch (env.getDialogId()) {
        case -1:
          if (var == 6) {
            final int targetObjectId = env.getVisibleObject().getObjectId();
            PacketSendUtility.sendPacket(
                player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
            PacketSendUtility.broadcastPacket(
                player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
            ThreadPoolManager.getInstance()
                .schedule(
                    new Runnable() {
                      @Override
                      public void run() {
                        Npc npc = (Npc) player.getTarget();
                        if (npc == null || npc.getObjectId() != targetObjectId) return;
                        PacketSendUtility.sendPacket(
                            player,
                            new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                        PacketSendUtility.broadcastPacket(
                            player,
                            new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                            true);
                        PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 401));
                        qs.setStatus(QuestStatus.REWARD);
                        updateQuestStatus(env);
                      }
                    },
                    3000);
            return false;
          }
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestCookie 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.REWARD) {
      if (targetId == 798927) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 10002);
        else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5);
        else return defaultQuestEndDialog(env);
      }
      return false;
    } else if (qs.getStatus() == QuestStatus.COMPLETE) {
      if (targetId == 799022) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 2376);
        else if (env.getDialogId() == 10004) {
          if (player.getPlayerGroup() == null) {
            WorldMapTemplate world = DataManager.WORLD_MAPS_DATA.getTemplate(300190000);
            int mapname = DataManager.WORLD_MAPS_DATA.getTemplate(300190000).getMapNameId();
            if (!InstanceService.canEnterInstance(player, world.getInstanceMapId(), 0)) {
              int timeinMinutes =
                  InstanceService.getTimeInfo(player).get(world.getInstanceMapId()) / 60;
              if (timeinMinutes >= 60)
                PacketSendUtility.sendPacket(
                    player,
                    SM_SYSTEM_MESSAGE.STR_MSG_CANNOT_ENTER_INSTANCE_COOL_TIME_HOUR(
                        mapname, timeinMinutes / 60));
              else
                PacketSendUtility.sendPacket(
                    player,
                    SM_SYSTEM_MESSAGE.STR_MSG_CANNOT_ENTER_INSTANCE_COOL_TIME_MIN(
                        mapname, timeinMinutes));

              return false;
            }
            if (!hasItem(player, 182206627)) {
              if (!ItemService.addItems(
                  player, Collections.singletonList(new QuestItems(182206627, 1)))) return true;
            }
            if (!hasItem(player, 182206628)) {
              if (!ItemService.addItems(
                  player, Collections.singletonList(new QuestItems(182206628, 1)))) return true;
            }
            WorldMapInstance newInstance = InstanceService.getNextAvailableInstance(300190000);
            InstanceService.registerPlayerWithInstance(newInstance, player);
            TeleportService.teleportTo(
                player,
                300190000,
                newInstance.getInstanceId(),
                198.82353f,
                221.40387f,
                1098.4879f,
                (byte) 41);
            PortalController.setInstanceCooldown(player, 300190000, newInstance.getInstanceId());
            return true;
          } else return sendQuestDialog(env, 2546);
        } else return defaultQuestStartDialog(env);
      } else if (targetId == 799503) {
        switch (env.getDialogId()) {
          case 26:
            if (var == 1) return sendQuestDialog(env, 4080);
          case 1013:
          case 10000:
            if (var == 1) {
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
              TeleportService.teleportTo(
                  player, 210050000, 2888.9226f, 359.70108f, 298.73184f, (byte) 56);
              return true;
            }
        }
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 798927) // Versetti
    {
      switch (env.getDialogId()) {
        case 26:
          if (var == 0) return sendQuestDialog(env, 1011);
        case 10000:
          if (var == 0) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 798954) // Tialla
    {
      switch (env.getDialogId()) {
        case 26:
          if (var == 1) return sendQuestDialog(env, 1352);
          else if (var == 8) return sendQuestDialog(env, 3057);
        case 10001:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10255:
          if (var == 8) {
            qs.setQuestVarById(0, 11);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 799022) // Lothas
    {
      switch (env.getDialogId()) {
        case -1:
          if (var == 2) return sendQuestDialog(env, 1779);
          else if (var > 2 && var < 3) return sendQuestDialog(env, 2461);
          break;
        case 26:
          if (var == 3) {
            if (qs.getQuestVarById(1) == 0) return sendQuestDialog(env, 1693);
            else return sendQuestDialog(env, 2375);
          } else if (var == 7) {
            if (player.getInventory().getItemCountByItemId(182206602) == 0)
              return sendQuestDialog(env, 2461);
            else return sendQuestDialog(env, 2716);
          } else if (var == 14) return sendQuestDialog(env, 4336);
        case 10002:
          if (var == 14) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10003:
          if (var == 2) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
          }
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        case 10004:
          if (var == 3 || var < 7) {
            if (player.getPlayerGroup() == null) {
              if (!hasItem(player, 182206627)) {
                if (!ItemService.addItems(
                    player, Collections.singletonList(new QuestItems(182206627, 1)))) return true;
              }
              if (!hasItem(player, 182206628)) {
                if (!ItemService.addItems(
                    player, Collections.singletonList(new QuestItems(182206628, 1)))) return true;
              }
              if (var < 7) {
                qs.setQuestVarById(1, 0); // clear killed Brohums
                qs.setQuestVarById(2, 0); // clear used Tears
                qs.setQuestVarById(0, 5);
                updateQuestStatus(env);
              }
              WorldMapInstance newInstance = InstanceService.getNextAvailableInstance(300190000);
              InstanceService.registerPlayerWithInstance(newInstance, player);
              TeleportService.teleportTo(
                  player,
                  300190000,
                  newInstance.getInstanceId(),
                  198.82353f,
                  221.40387f,
                  1098.4879f,
                  (byte) 41);
              return true;
            } else return sendQuestDialog(env, 2546);
          }
        case 34:
          if (var == 7) {
            if (QuestService.collectItemCheck(env, true)) {
              long itemCount = player.getInventory().getItemCountByItemId(164000099);
              player.getInventory().removeFromBagByItemId(164000099, itemCount);
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(env);
              PacketSendUtility.sendPacket(
                  player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
              return sendQuestDialog(env, 10000);
            } else return sendQuestDialog(env, 10001);
          }
      }
    } else if (targetId == 730008 && var == 11) // Daminu
    {
      switch (env.getDialogId()) {
        case 26:
          return sendQuestDialog(env, 3398);
        case 10007:
          qs.setQuestVarById(0, var + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
      }
    } else if (targetId == 730019 && var == 12) // Lodas
    {
      switch (env.getDialogId()) {
        case 26:
          return sendQuestDialog(env, 3739);
        case 10008:
          qs.setQuestVarById(0, var + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
      }
    } else if (targetId == 730024 && var == 13) // Trajanus
    {
      switch (env.getDialogId()) {
        case 26:
          return sendQuestDialog(env, 4080);
        case 10009:
          qs.setQuestVarById(0, var + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
      }
    }

    return false;
  }
  @Override
  public boolean onItemUseEvent(final QuestCookie env, final Item item) {
    final Player player = env.getPlayer();
    final int id = item.getItemTemplate().getTemplateId();
    final int itemObjId = item.getObjectId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    final int var = qs.getQuestVarById(0);

    if (id != 182206627 && id != 182206628 && id != 164000137 && id != 164000138 && id != 164000139)
      return false;

    if (player.getWorldId() != 300190000) return false;

    if (qs != null && qs.getStatus() == QuestStatus.COMPLETE) {
      if (id == 182206628 && !hasItem(player, 182206628)) {
        if (!ItemService.addItems(player, Collections.singletonList(new QuestItems(182206628, 1))))
          return true;
      }
      if (id == 182206627 && !hasItem(player, 182206627)) {
        if (!ItemService.addItems(player, Collections.singletonList(new QuestItems(182207604, 1))))
          return true;
      }
      if (id == 164000137 && !hasItem(player, 164000137)) {
        if (!ItemService.addItems(player, Collections.singletonList(new QuestItems(164000137, 1))))
          return true;
      }
      if (id == 164000138 && !hasItem(player, 164000138)) {
        if (!ItemService.addItems(player, Collections.singletonList(new QuestItems(164000138, 1))))
          return true;
      }
      if (id == 164000139 && !hasItem(player, 164000139)) {
        if (!ItemService.addItems(player, Collections.singletonList(new QuestItems(164000139, 1))))
          return true;
      }
      useSkill(player, item);
    } else if (var == 5 || var == 6 || var == 7) {
      if (id == 182206627) {
        PacketSendUtility.broadcastPacket(
            player,
            new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 3000, 0, 0),
            true);
        ThreadPoolManager.getInstance()
            .schedule(
                new Runnable() {
                  @Override
                  public void run() {
                    int var = qs.getQuestVarById(0);
                    PacketSendUtility.broadcastPacket(
                        player,
                        new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0),
                        true);
                    if (var == 5) {
                      qs.setQuestVarById(0, var + 1);
                      updateQuestStatus(env);
                    }
                    useSkill(player, item);
                  }
                },
                3000);
      } else if (id == 182206628 && var > 5) {
        ThreadPoolManager.getInstance()
            .schedule(
                new Runnable() {
                  @Override
                  public void run() {
                    int var2 = qs.getQuestVarById(2);
                    if (var < 7 && var2 < 19) {
                      qs.setQuestVarById(2, var2 + 1);
                      if (!hasItem(player, 182206628)) ItemService.addItem(player, 182206628, 1);

                      updateQuestStatus(env);
                    } else if (var == 6 && var2 > 0) {
                      qs.setQuestVarById(2, 0); // Needed to continue
                      qs.setQuestVarById(0, var + 1);
                      updateQuestStatus(env);
                    }
                    useSkill(player, item);
                  }
                },
                100);
      }
    }
    return false; // don't remove from inventory
  }
示例#13
0
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (targetId == 204327) // Sveinn
   {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 4762);
       else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
       else if (env.getDialogId() == 10000) {
         qs.setQuestVar(2);
         ItemService.addItems(player, Collections.singletonList(new QuestItems(182204221, 1)));
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else if (env.getDialogId() == 10002) {
         qs.setQuestVar(2);
         ItemService.addItems(player, Collections.singletonList(new QuestItems(182204221, 1)));
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else if (env.getDialogId() == 10006) {
         qs.setQuestVar(2);
         ItemService.addItems(player, Collections.singletonList(new QuestItems(182204221, 1)));
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       player.getInventory().removeFromBagByItemId(182204222, 1);
       return defaultQuestEndDialog(env);
     }
   } else if (targetId == 204377) // Grall
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 2) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1693);
       else if (env.getDialogId() == 1009) {
         qs.setQuestVar(4);
         player.getInventory().removeFromBagByItemId(182204221, 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 798078) // Hugorunerk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 4) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2034);
       else if (env.getDialogId() == 10003) {
         qs.setQuestVar(5);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 798081) // Pararinirerk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 5) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == 10004) {
         qs.setQuestVar(6);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 798082) // Bicorunerk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 6) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2716);
       else if (env.getDialogId() == 10005) {
         qs.setQuestVar(8);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 204300) // Bolverk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 8) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 3057);
       else if (env.getDialogId() == 1009) // Need check Item
       {
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       player.getInventory().removeFromBagByItemId(182204222, 1);
       return defaultQuestEndDialog(env);
     }
   }
   return false;
 }
 @Override
 public boolean onDialogEvent(final QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     if (targetId == 203997) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
       else if (env.getDialogId() == 1013) {
         if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182201305, 1))))
           return sendQuestDialog(env, 4);
         else return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 700164:
         {
           if (qs.getQuestVarById(0) == 0 && env.getDialogId() == -1) {
             final int targetObjectId = env.getVisibleObject().getObjectId();
             PacketSendUtility.sendPacket(
                 player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 1));
             PacketSendUtility.broadcastPacket(
                 player,
                 new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId),
                 true);
             ThreadPoolManager.getInstance()
                 .schedule(
                     new Runnable() {
                       @Override
                       public void run() {
                         if (!player.isTargeting(targetObjectId)) return;
                         PacketSendUtility.sendPacket(
                             player,
                             new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                         PacketSendUtility.broadcastPacket(
                             player,
                             new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                             true);
                         player.getInventory().removeFromBagByItemId(182201305, 1);
                         qs.setStatus(QuestStatus.REWARD);
                         qs.setQuestVarById(0, 1);
                         updateQuestStatus(env);
                       }
                     },
                     3000);
           }
         }
       case 203997:
         {
           if (qs.getQuestVarById(0) == 1) {
             if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
             else if (env.getDialogId() == 33) {
               player.getInventory().removeFromBagByItemId(182201305, 1);
               qs.setStatus(QuestStatus.REWARD);
               updateQuestStatus(env);
               return sendQuestDialog(env, 5);
             } else return defaultQuestEndDialog(env);
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 203997) return defaultQuestEndDialog(env);
   }
   return false;
 }
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     if (targetId == 799038) // Laestrygos
     {
       switch (env.getDialogId()) {
         case 26:
           return sendQuestDialog(env, 1011);
         case 1007:
           return sendQuestDialog(env, 4);
         case 1002:
           if (!ItemService.addItems(
               player, Collections.singletonList(new QuestItems(182206883, 1))))
             ; // Piece Of Aegis
           if (QuestService.startQuest(env, QuestStatus.START)) return sendQuestDialog(env, 1003);
           else return false;
         case 1003:
           return sendQuestDialog(env, 1004);
       }
     }
   }
   if (qs == null || qs.getStatus() == QuestStatus.COMPLETE) {
     if (targetId == 798316) // Anusis
     {
       if (env.getDialogId() == 26) {
         return sendQuestDialog(env, 1352);
       } else return defaultQuestStartDialog(env);
     }
   }
   if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
         // Anusis
       case 798316:
         switch (env.getDialogId()) {
             // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
           case 26:
             // Send select1 to eddit-HtmlPages.xml
             return sendQuestDialog(env, 2375);
           case 2034:
             // Send select2 to eddit-HtmlPages.xml
             return sendQuestDialog(env, 2034);
             // Get HACTION_CHECK_USER_HAS_QUEST_ITEM in the eddit-HyperLinks.xml
           case 34:
             // Piece Of Aegis (1)
             // Laestrygos's Orb (1)
             // Kinah (8000000)
             if (QuestService.collectItemCheck(env, true)) {
               player.getInventory().removeFromBagByItemId(182206883, 1); // Piece Of Aegis
               player.getInventory().removeFromBagByItemId(100500731, 1); // Laestrygos's Orb
               player.getInventory().removeFromBagByItemId(182400001, 8000000); // Kinah
               qs.setStatus(QuestStatus.REWARD);
               updateQuestStatus(env);
               return sendQuestDialog(env, 5);
             } else {
               //
               return sendQuestDialog(env, 2716);
             }
         }
         break;
         // No match
       default:
         return defaultQuestStartDialog(env);
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 798316) // Anusis
     return defaultQuestEndDialog(env);
   }
   return false;
 }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    // Instanceof
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    // ------------------------------------------------------------
    // NPC Quest :
    // 0 - Start to Kvasir
    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204053) {
        // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
        if (env.getDialogId() == 25)
          // Send select_none to eddit-HtmlPages.xml
          return sendQuestDialog(env, 4762);
        else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.START) {

      switch (targetId) {
          // 1 - Talk with Latatusk
        case 204096:
          if (var == 0) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select1 to eddit-HtmlPages.xml
                return sendQuestDialog(env, 1011);
                // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml
              case 10000:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          // 3 - Collect the Light of Luck and take it to Latatusk
          if (var == 2) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select3 to eddit-HtmlPages.xml
                return sendQuestDialog(env, 1693);
                // Get HACTION_CHECK_USER_HAS_QUEST_ITEM in the eddit-HyperLinks.xml
              case 33:
                if (player.getInventory().getItemCountByItemId(182207124) >= 20) {
                  player.getInventory().removeFromBagByItemId(182207124, 20);
                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(env);
                  // Send check_user_item_ok to eddit-HtmlPages.xml
                  return sendQuestDialog(env, 10000);
                } else
                  // Send check_user_item_fail to eddit-HtmlPages.xml
                  return sendQuestDialog(env, 10001);
            }
          }
          break;
          // 2 - Talk with Relir.
        case 204097:
          if (var == 1) {
            log.info("Received dialog id :" + env.getDialogId());
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select2 to eddit-HtmlPages.xml
                return sendQuestDialog(env, 1352);
                // Get HACTION_SETPRO2 in the eddit-HyperLinks.xml
              case 1354:
                PacketSendUtility.sendMessage(
                    player, String.valueOf(player.getInventory().getKinahItem().getItemCount()));
                if (player.getInventory().getKinahItem().getItemCount() >= 3400000) {
                  player.getInventory().decreaseKinah(3400000);
                  PacketSendUtility.sendPacket(
                      player, new SM_UPDATE_ITEM(player.getInventory().getKinahItem()));

                  if (player.getInventory().getItemCountByItemId(182207123) == 0) {
                    if (!ItemService.addItems(
                        player, Collections.singletonList(new QuestItems(182207123, 1))))
                      return true;
                  }

                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                } else {
                  return sendQuestDialog(env, 1438);
                }
            }
          }
          break;
          // 4 - Better purify yourself! Take Glossy Holy Water and visit High Priest Balder
        case 204075:
          if (var == 3) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                if (player.getInventory().getItemCountByItemId(186000084) >= 1)
                  // Send select5 to eddit-HtmlPages.xml
                  return sendQuestDialog(env, 2034);
                else
                  // Send select5_2 to eddit-HtmlPages.xml
                  return sendQuestDialog(env, 2120);
                // Get HACTION_SET_SUCCEED in the eddit-HyperLinks.xml
              case 10255:
                // Send select_success to eddit-HtmlPages.xml
                return sendQuestDialog(env, 10002);
                // Get HACTION_SELECT_QUEST_REWARD in the eddit-HyperLinks.xml
              case 1009:
                player.getInventory().removeFromBagByItemId(186000084, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                // Send select_quest_reward1 to eddit-HtmlPages.xml
                return sendQuestDialog(env, 5);
            }
          }
          break;
          // No match
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      // 5 - Talk with Kvasir
      if (targetId == 204053) return defaultQuestEndDialog(env);
    }
    return false;
  }
示例#17
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

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

    if (targetId == 798945) {
      if (qs == null) {
        if (env.getDialogId() == 25) return sendQuestDialog(env, 1011);
        else if (env.getDialogId() == 1002) {
          if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182206700, 1))))
            return defaultQuestStartDialog(env);
          else return true;
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798918:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(env, 1352);
                }
              case 10000:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                }
            }
          }
        case 798946:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(env, 1693);
                }
              case 10001:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                }
            }
          }
        case 798943:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(env, 2034);
                }
              case 10002:
                {
                  qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                  return true;
                }
            }
          }
        case 798945:
          {
            switch (env.getDialogId()) {
              case 25:
                {
                  return sendQuestDialog(env, 2375);
                }
              case 1009:
                {
                  qs.setQuestVar(4);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  return defaultQuestEndDialog(env);
                }
              default:
                return defaultQuestEndDialog(env);
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798945) {
        switch (env.getDialogId()) {
          case 1009:
            {
              return sendQuestDialog(env, 5);
            }
          default:
            return defaultQuestEndDialog(env);
        }
      }
    }
    return false;
  }
示例#18
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    final 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 203631:
          switch (env.getDialogId()) {
            case 26:
              if (var == 0) return sendQuestDialog(env, 1011);
              else if (var == 6) return sendQuestDialog(env, 1352);
            case 10000:
            case 10001:
              if (var == 0 || var == 6) {
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
              }
          }
          break;
        case 203621:
          switch (env.getDialogId()) {
            case 26:
              if (var == 7) return sendQuestDialog(env, 1693);
              else if (var == 8) return sendQuestDialog(env, 2034);
              break;
            case 10002:
            case 10003:
              if (var == 7 || var == 9) {
                if (var == 9)
                  if (!ItemService.addItems(
                      player, Collections.singletonList(new QuestItems(182203019, 1)))) return true;
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
              }
              break;
            case 34:
              if (var == 8) {
                if (QuestService.collectItemCheck(env, true)) {
                  qs.setQuestVarById(0, var + 1);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 2035);
                } else return sendQuestDialog(env, 2120);
              }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203631) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 2375);
        else return defaultQuestEndDialog(env);
      }
    }
    return false;
  }