@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 == 799032) // Gefeios
      {
        if (env.getDialogId() == 26) {
          return sendQuestDialog(env, 1011);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs == null || qs.getStatus() == QuestStatus.COMPLETE) {
      if (targetId == 799032) // Gefeios
      {
        if (env.getDialogId() == 26) {
          return sendQuestDialog(env, 1011);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 799032: // Gefeios
          switch (env.getDialogId()) {
            case 26:
              return sendQuestDialog(env, 2375);
            case 2034:
              return sendQuestDialog(env, 2034);
            case 34:
              // Siel's Supreme Mace (1)
              // Noxallon Ingot (1)
              if (QuestService.collectItemCheck(env, true)) {
                player.getInventory().removeFromBagByItemId(100100679, 1); // Siel's Supreme Mace
                player.getInventory().removeFromBagByItemId(186000095, 1); // Noxallon Ingot
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 5);
              } else {
                //
                return sendQuestDialog(env, 2716);
              }
          }
          break;
          //
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799032) // Gefeios
      return defaultQuestEndDialog(env);
    }
    return false;
  }
  @Override
  public boolean onKillEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

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

    switch (targetId) {
      case 216592:
        if (qs.getQuestVarById(0) == 8) {
          @SuppressWarnings("unused")
          final int instanceId = player.getInstanceId();
          QuestService.addNewSpawn(
              300150000,
              player.getInstanceId(),
              799341,
              (float) 561.8763,
              (float) 192.25128,
              (float) 135.88919,
              (byte) 30,
              true);
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          return true;
        }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (defaultQuestNoneDialog(env, 798384, 182206109, 1)) return true;

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.START) {
      switch (env.getTargetId()) {
        case 203740:
          switch (env.getDialogId()) {
            case 26:
              if (var == 0) return sendQuestDialog(env, 1352);
            case 10000:
              return defaultCloseDialog(env, 0, 1, 0, 0, 182206109, 1);
          }
          break;
        case 798384:
          switch (env.getDialogId()) {
            case 26:
              if (var == 1) return sendQuestDialog(env, 2375);
            case 34:
              return defaultQuestItemCheck(env, 1, 2, true, 5, 2716);
          }
          break;
      }
    }
    return defaultQuestRewardDialog(env, 798384, 0);
  }
  @Override
  public boolean onKillEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

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

    switch (targetId) {
      case 216590:
        if (qs.getQuestVarById(0) == 1) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          QuestService.questTimerEnd(env);
          updateQuestStatus(env);
          return true;
        }
        break;
      case 216735:
        if (qs.getQuestVarById(0) == 2) {
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return true;
        }
    }
    return false;
  }
  @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 == 0) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 278556) {
      if (qs != null) {
        if (env.getDialogId() == 26 && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == 1009) {
          player.getInventory().removeFromBagByItemId(182206038, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return defaultQuestEndDialog(env);
        } else 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();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   QuestTemplate template = questsData.getQuestById(questId);
   if (targetId == 278639) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 2) {
         PlayerClass playerClass = player.getCommonData().getPlayerClass();
         PlayerClass startPC = null;
         try {
           startPC = PlayerClass.getStartingClassFor(playerClass);
         } catch (IllegalArgumentException e) {
           startPC = playerClass; // already a start class
         }
         if (startPC == PlayerClass.MAGE || startPC == PlayerClass.PRIEST) {
           QuestService.startQuest(env, QuestStatus.START);
           return sendQuestDialog(env, 1011);
         } else {
           return sendQuestDialog(env, 3739);
         }
       }
     } else if (qs != null && qs.getStatus() == QuestStatus.START) {
       if (env.getDialogId() == 2) {
         return sendQuestDialog(env, 1011);
       } else if (env.getDialogId() == 1011) {
         if (player.getInventory().getItemCountByItemId(186000003) >= 16) {
           qs.setQuestVarById(0, 0);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 5);
         } else {
           return sendQuestDialog(env, 1009);
         }
       } else if (env.getDialogId() == 1352) {
         if (player.getInventory().getItemCountByItemId(186000003) >= 32) {
           qs.setQuestVarById(0, 1);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 6);
         } else {
           return sendQuestDialog(env, 1009);
         }
       }
     } else if (qs.getStatus() == QuestStatus.COMPLETE) {
       if (env.getDialogId() == 2) {
         if ((qs.getCompleteCount() <= template.getMaxRepeatCount())) {
           QuestService.startQuest(env, QuestStatus.START);
           return sendQuestDialog(env, 1011);
         } else return sendQuestDialog(env, 1008);
       }
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       return defaultQuestEndDialog(env, qs.getQuestVarById(0));
     }
   }
   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 == 278152) // Darkhum
      {
        if (env.getDialogId() == 26) {
          return sendQuestDialog(env, 1011);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs == null || qs.getStatus() == QuestStatus.COMPLETE) {
      if (targetId == 278152) // Darkhum
      {
        if (env.getDialogId() == 26) {
          return sendQuestDialog(env, 1011);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 278152: // Darkhum
          switch (env.getDialogId()) {
            case 26:
              return sendQuestDialog(env, 2375);
            case 2034:
              return sendQuestDialog(env, 2034);
            case 34:
              // Collect Crystal Fragment (1)
              if (QuestService.collectItemCheck(env, true)) {
                player.getInventory().removeFromBagByItemId(182209834, 1); // Crystal Fragment
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 5);
              } else {
                //
                return sendQuestDialog(env, 2716);
              }
          }
          break;
          //
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 278152) // Darkhum
      return defaultQuestEndDialog(env);
    }
    return false;
  }
 @Override
 public boolean onLvlUpEvent(QuestCookie env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   boolean lvlCheck =
       QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel());
   if (qs != null || !lvlCheck) return false;
   QuestService.startQuest(env, QuestStatus.START);
   return true;
 }
 @Override
 public HandlerResult onBonusApplyEvent(QuestCookie env, int index, AbstractInventoryBonus bonus) {
   if (!(bonus instanceof CoinBonus)) return HandlerResult.UNKNOWN;
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
     if (index == 0 && qs.getQuestVarById(0) == 0 || index == 1 && qs.getQuestVarById(0) == 1)
       return HandlerResult.SUCCESS;
   }
   return HandlerResult.FAILED;
 }
Esempio n. 10
0
  @Override
  public void act(final Player player, final Item parentItem, Item targetItem) {
    PacketSendUtility.sendPacket(
        player,
        new SM_ITEM_USAGE_ANIMATION(
            player.getObjectId(),
            parentItem.getObjectId(),
            parentItem.getItemTemplate().getTemplateId(),
            5000,
            0,
            0));
    player.getController().cancelTask(TaskId.ITEM_USE);
    player
        .getController()
        .addNewTask(
            TaskId.ITEM_USE,
            ThreadPoolManager.getInstance()
                .schedule(
                    new Runnable() {
                      @Override
                      public void run() {
                        PacketSendUtility.sendPacket(
                            player,
                            new SM_ITEM_USAGE_ANIMATION(
                                player.getObjectId(),
                                parentItem.getObjectId(),
                                parentItem.getItemTemplate().getTemplateId(),
                                0,
                                1,
                                0));

                        Storage inventory = player.getInventory();
                        inventory.removeFromBagByObjectId(parentItem.getObjectId(), 1);
                        int decomposedId = parentItem.getItemId() - 1;
                        switch (parentItem.getItemId()) {
                          case 152000112:
                          case 152000328:
                            decomposedId -= 2;
                            break;
                          case 152000213:
                          case 152000327:
                            decomposedId -= 3;
                            break;
                          case 152000326:
                            decomposedId -= 4;
                        }
                        ItemService.addItem(player, decomposedId, 3);
                      }
                    },
                    5000));
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    int removeItem = 0;
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    int var = 0;

    if (qs != null) var = qs.getQuestVarById(0);

    if (qs == null
        || qs.getStatus() == QuestStatus.NONE
        || qs.getStatus() == QuestStatus.COMPLETE) {
      if (env.getTargetId() == 278645) {
        switch (env.getDialogId()) {
          case 26:
            if (QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel()))
              return sendQuestDialog(env, 1011);
            else return sendQuestDialog(env, 3398);
          case 1011:
          case 1352:
          case 1693:
          case 2034:
            int i = 0;
            for (int id : Items[0]) {
              if (id == env.getDialogId()) break;
              i++;
            }
            removeItem = Items[1][i];
            var = i;

            if (player.getInventory().getItemCountByItemId(removeItem) > 0) {
              if (qs == null) {
                qs = new QuestState(questId, QuestStatus.REWARD, 0, 0);
                player.getQuestStateList().addQuest(questId, qs);
              } else qs.setStatus(QuestStatus.REWARD);
              qs.setQuestVar(var);
              defaultQuestRemoveItem(env, removeItem, 1);
              return sendQuestDialog(env, var + 5);
            } else return sendQuestDialog(env, 1009);
        }
      }
    }

    if (qs == null) return false;

    return defaultQuestRewardDialog(env, 278645, 0, var);
  }
 @Override
 public boolean onMovieEndEvent(QuestCookie env, int movieId) {
   if (movieId != 442) return false;
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() != QuestStatus.START || qs.getQuestVars().getQuestVars() != 8)
     return false;
   QuestService.addNewSpawn(
       300150000,
       player.getInstanceId(),
       216592,
       (float) 561.8763,
       (float) 192.25128,
       (float) 135.88919,
       (byte) 30,
       true);
   return true;
 }
  @Override
  public boolean onDieEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;
    int var = qs.getQuestVars().getQuestVars();
    if (var == 8) {
      qs.setQuestVar(7);
      updateQuestStatus(env);
      PacketSendUtility.sendPacket(
          player,
          new SM_SYSTEM_MESSAGE(
              SystemMessageId.QUEST_FAILED_$1,
              DataManager.QUEST_DATA.getQuestById(questId).getName()));
    }

    return false;
  }
  @Override
  public boolean set(Skill skill) {
    skill.setFirstTargetProperty(value);
    switch (value) {
      case ME:
        skill.setFirstTarget(skill.getEffector());
        break;
      case TARGETORME:
        if (skill.getFirstTarget() == null) skill.setFirstTarget(skill.getEffector());
        break;
      case TARGET:
        if (skill.getFirstTarget() == null || skill.getFirstTarget() == skill.getEffector())
          return false;
        break;
      case MYPET:
        Creature effector = skill.getEffector();
        if (effector instanceof Player) {
          Summon summon = ((Player) effector).getSummon();
          if (summon != null) skill.setFirstTarget(summon);
          else return false;
        } else return false;
        break;
      case PASSIVE:
        skill.setFirstTarget(skill.getEffector());
        break;
      case TARGET_MYPARTY_NONVISIBLE:
        if (!(skill.getFirstTarget() instanceof Player)) return false;

        Player effected = (Player) skill.getFirstTarget();

        if (effected == null
            || !GroupService.getInstance().isGroupMember(effected.getObjectId())
            || skill.getEffector().getWorldId() != effected.getWorldId()) return false;
        skill.setFirstTargetRangeCheck(false);
        break;
      case POINT:
        skill.setFirstTarget(null);
        break;
    }

    if (skill.getFirstTarget() != null)
      skill.getEffectedList().add(new CreatureWithDistance(skill.getFirstTarget(), 0));
    return true;
  }
  @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 == 204777) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 4762);
        else return defaultQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204777) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 10002);
        else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5);
        else return defaultQuestEndDialog(env);
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 700324) {
      switch (env.getDialogId()) {
        case -1:
          if (var >= 0 && var < 4) {
            if (player.getInventory().getItemCountByItemId(182204489) >= 1) {
              qs.setQuestVarById(0, var + 1);
              updateQuestStatus(env);
              return true;
            }
          } else if (var == 4) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return true;
          }
          return false;
      }
    }
    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 (targetId == 798946) {
      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 == 799521) {
      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));
          QuestService.questTimerStart(env, 300);
          @SuppressWarnings("unused")
          final int instanceId = player.getInstanceId();
          QuestService.addNewSpawn(
              300170000,
              player.getInstanceId(),
              216590,
              (float) 938.3348,
              (float) 240.31474,
              (float) 227.6818,
              (byte) 28,
              true);
          return true;
        } else return defaultQuestStartDialog(env);
      }
    }

    return false;
  }
Esempio n. 17
0
  private void writeImplTitleList(ByteBuffer buf) {
    Player player = titleList.getOwner();
    TitleService.removeExpiredTitles(player);

    if (GSConfig.SERVER_VERSION.startsWith("2.")) writeH(buf, 0); // unk
    else writeC(buf, 0); // unk

    writeH(buf, titleList.size());

    for (final Title title : titleList.getTitles()) {
      writeD(buf, title.getTitleId());
      writeD(buf, (int) title.getTitleTimeLeft());
    }

    if (player.getCommonData().getTitleId() > 0) {
      if (titleList.canAddTitle(player.getCommonData().getTitleId())) {
        player.getCommonData().setTitleId(0);
        PacketSendUtility.sendMessage(player, "The usage time of title has expired.");
      }
    }
  }
 @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 == 799032) {
     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() == -1) {
         if (QuestService.collectItemCheck(env, false)) return sendQuestDialog(env, 2716);
       } 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);
     }
   }
   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 == 798926) // Outremus Start
      {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else qs.setStatus(QuestStatus.REWARD);
        updateQuestStatus(env);
        return defaultQuestStartDialog(env);
      }
    }
    if (qs == null) return false;
    if (targetId == 798941 && qs.getStatus() == QuestStatus.REWARD) // Pilomenes
    {
      return sendQuestDialog(env, 2375);
    }
    return false;
  }
Esempio n. 20
0
  @Override
  protected void runImpl() {
    Player player = getConnection().getActivePlayer();

    if (itemCount < -1 || kinahCount < 0) {
      log.info("[ANTICHEAT] Player trying to abuse CM_MAIL packet: " + player.getName());
      return;
    }

    if (player.isTrading() || kinahCount > 999999999) return;

    MailService.getInstance()
        .sendMail(
            player,
            recipientName,
            title,
            message,
            itemObjId,
            itemCount,
            kinahCount,
            express == 1,
            false);
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    if (!super.defaultQuestOnDialogInitStart(env)) return false;

    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.START) {
      if (env.getTargetId() == 203081) {
        switch (env.getDialogId()) {
          case 26:
            if (var == 0) return sendQuestDialog(env, 1011);
            else if (var == 13) return sendQuestDialog(env, 1352);
          case 10000:
            return defaultCloseDialog(env, 0, 1);
          case 10001:
            return defaultCloseDialog(env, 13, 14);
        }
      }
    }
    return defaultQuestRewardDialog(env, 203081, 0);
  }
Esempio n. 22
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_ADDCUBE) {
      PacketSendUtility.sendMessage(
          admin, LanguageHandler.translate(CustomMessageId.COMMAND_NOT_ENOUGH_RIGHTS));
      return;
    }

    if (params.length != 1) {
      PacketSendUtility.sendMessage(
          admin, LanguageHandler.translate(CustomMessageId.COMMAND_ADDCUBE_SYNTAX));
      return;
    }

    Player receiver = null;

    receiver = World.getInstance().findPlayer(Util.convertName(params[0]));

    if (receiver == null) {
      PacketSendUtility.sendMessage(
          admin,
          LanguageHandler.translate(
              CustomMessageId.PLAYER_NOT_ONLINE, Util.convertName(params[0])));
      return;
    }

    if (receiver != null) {
      if (receiver.getCubeSize() < 9) {
        CubeExpandService.expand(receiver);
        PacketSendUtility.sendMessage(
            admin,
            LanguageHandler.translate(
                CustomMessageId.COMMAND_ADDCUBE_ADMIN_SUCCESS, receiver.getName()));
        PacketSendUtility.sendMessage(
            receiver,
            LanguageHandler.translate(
                CustomMessageId.COMMAND_ADDCUBE_PLAYER_SUCCESS, admin.getName()));
      } else {
        PacketSendUtility.sendMessage(
            admin,
            LanguageHandler.translate(CustomMessageId.COMMAND_ADDCUBE_FAILURE, receiver.getName()));
        return;
      }
    }
  }
  @Override
  public boolean onDialogEvent(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 (targetId == 799523) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else return defaultQuestStartDialog(env);
      }
    } else if (targetId == 798029) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
        else if (env.getDialogId() == 34) {
          if (QuestService.collectItemCheck(env, true)) {
            qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 5);
          } else return sendQuestDialog(env, 2716);
        } else return defaultQuestStartDialog(env);
      } else if (qs != null && qs.getStatus() == QuestStatus.REWARD)
        return defaultQuestEndDialog(env);
    } else if (targetId == 700853) {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialogId() == -1
            && (player.getInventory().getItemCountByItemId(185000103) > 0
                && player.getInventory().getItemCountByItemId(185000107) >= 3)) {
          if (!ItemService.addItems(
              player, Collections.singletonList(new QuestItems(182212020, 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);
          player.getInventory().removeFromBagByItemId(185000103, 1);
          player.getInventory().removeFromBagByItemId(185000107, 3);
        }
      }
    }

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

    if (id == 186000107) {
      if (!ZoneService.getInstance().isInsideZone(player, ZoneName.DEBILKARIM_FORGE_300160000))
        return HandlerResult.FAILED;
      if (qs == null) return HandlerResult.UNKNOWN;
      if (qs.getQuestVarById(0) != 0) return HandlerResult.FAILED;
      if (player.getInventory().getItemCountByItemId(100900716) == 0
          || player.getInventory().getItemCountByItemId(186000099) == 0
          || player.getInventory().getItemCountByItemId(186000106) < 20
          || player.getInventory().getItemCountByItemId(186000107) == 0)
        return HandlerResult.FAILED;
      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() {
                  ItemService.addItems(
                      player, Collections.singletonList(new QuestItems(182209634, 1)));
                  PacketSendUtility.broadcastPacket(
                      player,
                      new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0),
                      true);
                  player.getInventory().removeFromBagByItemId(186000099, 1);
                  player.getInventory().removeFromBagByItemId(186000106, 20);
                  player.getInventory().removeFromBagByItemId(186000107, 1);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                }
              },
              3000);
      return HandlerResult.SUCCESS;
    }
    return HandlerResult.UNKNOWN;
  }
  @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 //Garath
    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 798208) // Garath
      {
        // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
        if (env.getDialogId() == 26)
          // Send HTML_PAGE_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) {
        case 799322: // Herka
          switch (env.getDialogId()) {
              // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
            case 26:
              // 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;
          }
        case 799506: // Faithful Respondent Utra
          if (var == 1) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 26:
                // Send select2 to eddit-HtmlPages.xml
                return sendQuestDialog(env, 1352);
                // Get HACTION_SETPRO2 in the eddit-HyperLinks.xml
              case 10001:
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          // Report The Result To Garath.
        case 798208: // Garath
          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:
              // Collect Spirit's Incense Burner (1)
              // Collect Scroll Of Repose (1)
              if (QuestService.collectItemCheck(env, true)) {
                player.getInventory().removeFromBagByItemId(182209718, 1);
                player.getInventory().removeFromBagByItemId(182209719, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 5);
              } else {
                // Send check_user_item_fail to eddit-HtmlPages.xml
                return sendQuestDialog(env, 2716);
              }
          }
          break;
          // No match
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798208) // Garath
      return defaultQuestEndDialog(env);
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    if (player.getLevel() <= 46) return false;
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    QuestTemplate template = questsData.getQuestById(questId);

    if (targetId == 798174) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 2) {
          PlayerClass playerClass = player.getCommonData().getPlayerClass();
          if (playerClass == PlayerClass.MAGE
              || playerClass == PlayerClass.SORCERER
              || playerClass == PlayerClass.SPIRIT_MASTER) {
            QuestService.startQuest(env, QuestStatus.START);
            return sendQuestDialog(env, 1011);
          } else {
            return sendQuestDialog(env, 3739);
          }
        }
      } else if (qs != null && qs.getStatus() == QuestStatus.START) {
        if (env.getDialogId() == 2) {
          return sendQuestDialog(env, 1011);
        } else if (env.getDialogId() == 10000) {
          if (player.getInventory().getItemCountByItemId(186000005) >= 2000) {
            qs.setQuestVarById(1, 0);
            player.getInventory().removeFromBagByItemId(186000005, 2000);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 5);
          } else {
            return sendQuestDialog(env, 1009);
          }
        } else if (env.getDialogId() == 10001) {
          if (player.getInventory().getItemCountByItemId(186000005) >= 400) {
            qs.setQuestVarById(1, 1);
            player.getInventory().removeFromBagByItemId(186000005, 400);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 6);
          } else {
            return sendQuestDialog(env, 1009);
          }
        } else if (env.getDialogId() == 10002) {
          if (player.getInventory().getItemCountByItemId(186000005) >= 1000) {
            qs.setQuestVarById(1, 2);
            player.getInventory().removeFromBagByItemId(186000005, 1000);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 7);
          } else {
            return sendQuestDialog(env, 1009);
          }
        } else if (env.getDialogId() == 10003) {
          if (player.getInventory().getItemCountByItemId(186000005) >= 200) {
            qs.setQuestVarById(1, 3);
            player.getInventory().removeFromBagByItemId(186000005, 200);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 8);
          } else {
            return sendQuestDialog(env, 1009);
          }
        }
      } else if (qs.getStatus() == QuestStatus.COMPLETE) {
        if (env.getDialogId() == 2) {
          if ((qs.getCompleteCount() <= template.getMaxRepeatCount())) {
            QuestService.startQuest(env, QuestStatus.START);
            return sendQuestDialog(env, 1011);
          } else return sendQuestDialog(env, 1008);
        }
      } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
        return defaultQuestEndDialog(env, qs.getQuestVarById(1));
      }
    }
    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 == 799340) // Athana
     {
       switch (env.getDialogId()) {
         case 26:
           return sendQuestDialog(env, 4762);
         case 1007:
           return sendQuestDialog(env, 4);
         case 1002:
           if (!ItemService.addItems(
               player, Collections.singletonList(new QuestItems(182207932, 1))))
             ; // Piece Of Zikel
           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 == 798317) // Usener
     {
       if (env.getDialogId() == 26) {
         return sendQuestDialog(env, 1352);
       } else return defaultQuestStartDialog(env);
     }
   }
   if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
         // Usener
       case 798317:
         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 Zikel (1)
             // Athana's Dagger (1)
             // Kinah (8000000)
             if (QuestService.collectItemCheck(env, true)) {
               player.getInventory().removeFromBagByItemId(182207932, 1); // Piece Of Zikel
               player.getInventory().removeFromBagByItemId(100200845, 1); // Athana's Dagger
               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 == 798317) // Usener
     return defaultQuestEndDialog(env);
   }
   return false;
 }
Esempio n. 28
0
  @Override
  public void executeCommand(Player admin, String[] params) {
    if (admin.getAccessLevel() < AdminConfig.COMMAND_APPLY_PRESET) {
      PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
      return;
    }

    if (params.length == 0 || params.length > 1) {
      PacketSendUtility.sendMessage(admin, "syntax //preset <name>");
      return;
    }

    VisibleObject target = admin.getTarget();
    Player player = null;

    if (target == null) player = admin;
    else if (!(target instanceof Player)) {
      PacketSendUtility.sendMessage(admin, "Presets can be applied only on players!");
      return;
    } else {
      player = (Player) target;
    }

    String presetName = params[0];

    PresetTemplate template = DataManager.CUSTOM_PRESET_DATA.getPresetTemplate(presetName);
    if (template == null) {
      PacketSendUtility.sendMessage(admin, "No such preset!");
      return;
    }
    if (template.getGender().ordinal() != player.getCommonData().getGender().ordinal()
        || template.getRace().ordinal() != player.getCommonData().getRace().ordinal()) {
      PacketSendUtility.sendMessage(admin, "Preset can not be applied on current gender or race!");
      return;
    }

    PlayerAppearance.loadDetails(player.getPlayerAppearance(), template.getDetail());
    if (template.getFaceType() > 0) player.getPlayerAppearance().setFace(template.getFaceType());
    if (template.getHairType() > 0) player.getPlayerAppearance().setHair(template.getHairType());
    if (template.getHairRGB() != null)
      player.getPlayerAppearance().setHairRGB(getDyeColor(template.getHairRGB()));
    if (template.getLipsRGB() != null)
      player.getPlayerAppearance().setLipRGB(getDyeColor(template.getLipsRGB()));
    if (template.getSkinRGB() != null)
      player.getPlayerAppearance().setSkinRGB(getDyeColor(template.getSkinRGB()));
    if (template.getHeight() > 0) player.getPlayerAppearance().setHeight(template.getHeight());

    DAOManager.getDAO(PlayerAppearanceDAO.class).store(player);

    player.clearKnownlist();
    PacketSendUtility.sendPacket(player, new SM_PLAYER_INFO(player, false));
    player.updateKnownlist();
  }
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   int targetId = 0;
   if (player.getCommonData().getLevel() < 21) return false;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   if (targetId == 798125) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
       else return defaultQuestStartDialog(env);
     } else if (qs.getStatus() == QuestStatus.START) {
       long itemCount;
       long itemCount1;
       long itemCount2;
       if (env.getDialogId() == 26 && qs.getQuestVarById(0) == 0) {
         return sendQuestDialog(env, 2375);
       } else if (env.getDialogId() == 34 && qs.getQuestVarById(0) == 0) {
         itemCount = player.getInventory().getItemCountByItemId(182204227);
         itemCount1 = player.getInventory().getItemCountByItemId(182204228);
         itemCount2 = player.getInventory().getItemCountByItemId(182204229);
         if (itemCount > 4 && itemCount1 > 4 && itemCount2 > 4) {
           player.getInventory().removeFromBagByItemId(182204227, 5);
           player.getInventory().removeFromBagByItemId(182204228, 5);
           player.getInventory().removeFromBagByItemId(182204229, 5);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 5);
         } else {
           return sendQuestDialog(env, 2716);
         }
       } else return defaultQuestEndDialog(env);
     } else if (qs.getStatus() == QuestStatus.REWARD) {
       if (env.getDialogId() == 26 && qs.getQuestVarById(0) == 5) {
         return sendQuestDialog(env, 5);
       } else if (env.getDialogId() == 26 && qs.getQuestVarById(0) == 6) {
         return sendQuestDialog(env, 6);
       } else if (env.getDialogId() == 26 && qs.getQuestVarById(0) == 7) {
         return sendQuestDialog(env, 7);
       } else {
         return defaultQuestEndDialog(env);
       }
     } else {
       return defaultQuestEndDialog(env);
     }
   } else if (targetId == 700317) {
     long itemCount;
     itemCount = player.getInventory().getItemCountByItemId(182204227);
     if (qs != null
         && qs.getStatus() == QuestStatus.START
         && qs.getQuestVarById(0) == 0
         && itemCount < 5) {
       final int targetObjectId = env.getVisibleObject().getObjectId();
       PacketSendUtility.broadcastPacket(
           player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
       ThreadPoolManager.getInstance()
           .schedule(
               new Runnable() {
                 @Override
                 public void run() {
                   PacketSendUtility.broadcastPacket(
                       player,
                       new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                       true);
                 }
               },
               3000);
       return true;
     } else {
       return defaultQuestEndDialog(env);
     }
   } else if (targetId == 700318) {
     long itemCount1;
     itemCount1 = player.getInventory().getItemCountByItemId(182204228);
     if (qs != null
         && qs.getStatus() == QuestStatus.START
         && qs.getQuestVarById(0) == 0
         && itemCount1 < 5) {
       final int targetObjectId = env.getVisibleObject().getObjectId();
       PacketSendUtility.broadcastPacket(
           player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
       ThreadPoolManager.getInstance()
           .schedule(
               new Runnable() {
                 @Override
                 public void run() {
                   PacketSendUtility.broadcastPacket(
                       player,
                       new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                       true);
                 }
               },
               3000);
       return true;
     } else {
       return defaultQuestEndDialog(env);
     }
   } else if (targetId == 700319) {
     long itemCount2;
     itemCount2 = player.getInventory().getItemCountByItemId(182204229);
     if (qs != null
         && qs.getStatus() == QuestStatus.START
         && qs.getQuestVarById(0) == 0
         && itemCount2 < 5) {
       final int targetObjectId = env.getVisibleObject().getObjectId();
       PacketSendUtility.broadcastPacket(
           player, new SM_EMOTION(player, EmotionType.NEUTRALMODE2, 0, targetObjectId), true);
       ThreadPoolManager.getInstance()
           .schedule(
               new Runnable() {
                 @Override
                 public void run() {
                   PacketSendUtility.broadcastPacket(
                       player,
                       new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                       true);
                 }
               },
               3000);
       return true;
     } else {
       return defaultQuestEndDialog(env);
     }
   } else {
     return defaultQuestEndDialog(env);
   }
 }
  @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 == 799226) {
        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.START) {
      return false;
    }
    if (targetId == 799226) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 0) return sendQuestDialog(env, 1011);
          else if (var == 3) return sendQuestDialog(env, 2034);
        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;
          }
        case 10003:
          if (var == 3) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 799292) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 1) return sendQuestDialog(env, 1352);
          else if (var == 2) return sendQuestDialog(env, 1693);
          else if (var == 5) return sendQuestDialog(env, 2716);
          else if (var == 11) return sendQuestDialog(env, 1608);
          break;
        case 34:
          if (QuestService.collectItemCheck(env, 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, 10001);
        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 10005:
          if (var == 5) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10255:
          if (var == 11) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 700810) {
      if (var == 2) return true;
    } else if (targetId == 204057) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 4) return sendQuestDialog(env, 2375);
        case 10004:
          if (var == 4) {
            if (!ItemService.addItems(
                player, Collections.singletonList(new QuestItems(182207611, 1)))) return true;
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 799341) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 9) return sendQuestDialog(env, 4080);
        case 10009:
          if (var == 9) {
            if (!ItemService.addItems(
                player, Collections.singletonList(new QuestItems(182207613, 1)))) return true;
            player.getInventory().removeFromBagByItemId(182207611, 1);
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 799513
        || targetId == 799514
        || targetId == 799515
        || targetId == 799516) // FIXME: Var !
    {
      switch (env.getDialogId()) {
        case 26:
          if (var == 7) return sendQuestDialog(env, 4080);
        case 10009:
          if (var == 7) {
            PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 442));
            qs.setQuestVar(8);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 730243) {
      switch (env.getDialogId()) {
        case -1:
          if (var >= 6) return sendQuestDialog(env, 3057);
          break;
        case 26:
          if (var == 6) return sendQuestDialog(env, 3057);
          break;
        case 10006:
          if (var == 6) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            WorldMapInstance newInstance = InstanceService.getNextAvailableInstance(300150000);
            InstanceService.registerPlayerWithInstance(newInstance, player);
            TeleportService.teleportTo(
                player,
                300150000,
                newInstance.getInstanceId(),
                561.8651f,
                221.91483f,
                134.53333f,
                (byte) 90);
            return true;
          } else if (var > 6) {
            WorldMapInstance newInstance = InstanceService.getNextAvailableInstance(300150000);
            InstanceService.registerPlayerWithInstance(newInstance, player);
            TeleportService.teleportTo(
                player,
                300150000,
                newInstance.getInstanceId(),
                561.8651f,
                221.91483f,
                134.53333f,
                (byte) 90);
            return true;
          }
      }
    } else if (targetId == 700706) {
      switch (env.getDialogId()) {
        case -1:
          if (var == 10) {
            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(11);
            updateQuestStatus(env);
            TeleportService.teleportTo(
                player, 300150000, 561.8651f, 221.91483f, 134.53333f, (byte) 90);
          }
      }
    }

    return false;
  }