@Override
 public void QuestUseNpcInsideFunction(QuestCookie env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   qs.setStatus(QuestStatus.REWARD);
   updateQuestStatus(env);
 }
Esempio n. 2
0
  @Override
  public boolean onDialogEvent(QuestEnv 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);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 278055) {
      if (qs != null) {
        if (env.getDialog() == QuestDialog.START_DIALOG && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == 1009
            && qs.getStatus() != QuestStatus.COMPLETE
            && qs.getStatus() != QuestStatus.NONE) {
          removeQuestItem(env, 182207044, 1);
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return sendQuestEndDialog(env);
        } else return sendQuestEndDialog(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 (targetId == 203965) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else return defaultQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 203966) {
        if (env.getDialogId() == 26) {
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return sendQuestDialog(env, 1352);
        }
      }
      return false;
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203966) {
        if (env.getDialogId() == 1009) return sendQuestDialog(env, 5);
        else return defaultQuestEndDialog(env);
      }
      return false;
    }
    return false;
  }
Esempio n. 4
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      } else PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
    }
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798316) {
        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 == 278591) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 0) return sendQuestDialog(env, 1352);
        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;
          }
          return false;
      }
    } else if (targetId == 278624) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 1) return sendQuestDialog(env, 1693);
        case 10001:
          if (var == 1) {
            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 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 203665:
          switch (env.getDialogId()) {
            case 25:
              if (var == 0) return sendQuestDialog(env, 1011);
              break;
            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;
              }
          }
          break;
        case 203668:
          switch (env.getDialogId()) {
            case 25:
              if (var == 1) return sendQuestDialog(env, 1352);
              else if (var == 5) return sendQuestDialog(env, 1693);
              else if (var == 6) return sendQuestDialog(env, 2034);
              break;
            case 10001:
            case 10002:
              if (var == 1 || var == 5) {
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
              }
            case 33:
              if (var == 6) {
                if (QuestService.collectItemCheck(env, true)) {
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 5);
                } else return sendQuestDialog(env, 2120);
              }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203668) return defaultQuestEndDialog(env);
    }
    return false;
  }
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   if (env.getPlayer().getTribe().equals("PC")) {
     final Player player = env.getPlayer();
     int targetId = 0;
     if (env.getVisibleObject() instanceof Npc)
       targetId = ((Npc) env.getVisibleObject()).getNpcId();
     QuestTemplate template = DataManager.QUEST_DATA.getQuestById(questId);
     QuestState qs = player.getQuestStateList().getQuestState(questId);
     if (targetId == 730329) {
       PlayerClass playerClass = player.getCommonData().getPlayerClass();
       if (playerClass == PlayerClass.MAGE
           || playerClass == PlayerClass.PRIEST
           || playerClass == PlayerClass.GLADIATOR
           || playerClass == PlayerClass.WARRIOR
           || playerClass == PlayerClass.SCOUT) {
         if (qs == null
             || qs.getStatus() == QuestStatus.NONE
             || (qs.getStatus() == QuestStatus.COMPLETE
                 && (qs.getCompliteCount() <= template.getMaxRepeatCount()))) {
           if (env.getDialogId() == -1) return sendQuestDialog(env, 1011);
           else return defaultQuestStartDialog(env);
         } else if (qs != null
             && qs.getStatus() == QuestStatus.START
             && qs.getQuestVarById(0) == 0) {
           if (env.getDialogId() == -1) return sendQuestDialog(env, 2375);
           else if (env.getDialogId() == 33) {
             if (player.getInventory().getItemCountByItemId(185000102) >= 1) {
               player.getInventory().removeFromBagByItemId(185000102, 1);
               qs.setStatus(QuestStatus.REWARD);
               qs.setQuestVar(1);
               qs.setCompliteCount(0);
               updateQuestStatus(env);
               return sendQuestDialog(env, 5);
             } else return sendQuestDialog(env, 2716);
           }
         } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
           int var = qs.getQuestVarById(0);
           switch (env.getDialogId()) {
             case -1:
               if (var == 1) return sendQuestDialog(env, 5);
             case 17:
               QuestService.questFinish(env, qs.getQuestVars().getQuestVars() - 1);
               PacketSendUtility.sendPacket(
                   player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
               return true;
           }
         }
       }
       return false;
     }
     return false;
   } else {
     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;
 }
Esempio n. 8
0
  @Override
  public boolean onDialogEvent(QuestEnv 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 == 799025) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011);
        else return sendQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799025) {
        return sendQuestEndDialog(env);
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 799026) {
      switch (env.getDialog()) {
        case START_DIALOG:
          if (var == 0) return sendQuestDialog(env, 1352);
        case STEP_TO_1:
          if (var == 0) {
            if (giveQuestItem(env, 182206858, 1)) qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 799025) {
      switch (env.getDialog()) {
        case START_DIALOG:
          if (var == 1) return sendQuestDialog(env, 2375);
        case SELECT_REWARD:
          if (var == 1) {
            removeQuestItem(env, 182206858, 1);
            qs.setQuestVarById(0, var + 1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 5);
          }
          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 == 204193) {
     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(182207006, 1))))
           return defaultQuestStartDialog(env);
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 204170) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       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(), 0));
         return true;
       }
     }
   } else if (targetId == 798065) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1693);
       else if (env.getDialogId() == 10001) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
         return true;
       }
     }
   } else if (targetId == 204173) {
     if (qs != null) {
       if (env.getDialogId() == 26 && qs.getStatus() == QuestStatus.START)
         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);
     }
   }
   return false;
 }
Esempio n. 10
0
 @Override
 public boolean onDialogEvent(QuestEnv 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 == 798126) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203940) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1352);
       else if (env.getDialog() == QuestDialog.STEP_TO_1) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203944) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
       if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1352);
       else if (env.getDialog() == QuestDialog.STEP_TO_1) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 1693));
         return true;
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 798127) {
     if (qs != null) {
       if (env.getDialog() == QuestDialog.START_DIALOG && qs.getStatus() == QuestStatus.START)
         return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == 1009
           && qs.getStatus() != QuestStatus.COMPLETE
           && qs.getStatus() != QuestStatus.NONE) {
         qs.setQuestVar(3);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     }
   }
   return false;
 }
  @Override
  public boolean onKillEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs.getStatus() != QuestStatus.START) return false;

    final int instanceId = player.getInstanceId();
    int var = qs.getQuestVarById(0);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    final Npc npc = (Npc) env.getVisibleObject();

    switch (targetId) {
      case 216739:
      case 216740:
        if (var == 0) {
          ThreadPoolManager.getInstance()
              .schedule(
                  new Runnable() {
                    @Override
                    public void run() {
                      QuestService.addNewSpawn(
                          300170000,
                          instanceId,
                          216239,
                          (float) npc.getX(),
                          (float) npc.getY(),
                          (float) npc.getZ(),
                          (byte) 0,
                          true);
                    }
                  },
                  2000);

          return true;
        }
        break;
      case 216239:
        if (var == 0) {
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return true;
        }
    }
    return false;
  }
Esempio n. 12
0
  @Override
  public boolean onDialogEvent(QuestEnv 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 (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204110) {
        if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011);
        else return sendQuestStartDialog(env);
      }
    }

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 204110:
          {
            switch (env.getDialog()) {
              case START_DIALOG:
                {
                  long itemCount1 = player.getInventory().getItemCountByItemId(182207966);
                  if (itemCount1 > 0) {
                    removeQuestItem(env, 182207966, 1);
                    qs.setStatus(QuestStatus.REWARD);
                    updateQuestStatus(env);
                    return sendQuestDialog(env, 2375);
                  } else return sendQuestDialog(env, 2716);
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204110) {
        if (env.getDialogId() == 34) return sendQuestDialog(env, 5);
        else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
Esempio n. 13
0
  @Override
  public boolean onKillEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

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

    if (qs.getStatus() != QuestStatus.START) return false;
    if (targetId == 210202) {
      if (var == 1) {
        qs.setStatus(QuestStatus.REWARD);
        updateQuestStatus(env);
        PacketSendUtility.sendPacket(
            player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
        return true;
      }
    }
    return false;
  }
Esempio n. 14
0
 @Override
 public boolean onDialogEvent(QuestEnv 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 == 730019) // Lodas
   {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.START) {
       if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == 1009) {
         qs.setQuestVar(2);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       if (env.getDialog() == QuestDialog.USE_OBJECT) return sendQuestDialog(env, 2375);
       return sendQuestEndDialog(env);
     }
   } else if (targetId == 730008) // Daminu
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1352);
       else if (env.getDialog() == QuestDialog.STEP_TO_1
           || env.getDialog() == QuestDialog.STEP_TO_2) {
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return sendQuestStartDialog(env);
     }
   }
   return false;
 }
  @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 (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 278003) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 278091) {
        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 == 278086) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
        else if (env.getDialogId() == 1009) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return defaultQuestEndDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD && targetId == 278086) {
      return defaultQuestEndDialog(env);
    }
    return false;
  }
  @Override
  public void QuestUseNpcInsideFunction(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    int var = qs.getQuestVarById(0);

    switch (var) {
      case 5:
        qs.setQuestVar(6);
        break;
      case 6:
        qs.setQuestVar(7);
        break;
      case 7:
        qs.setQuestVar(8);
        break;
      case 8:
        defaultQuestMovie(env, 21);
        qs.setQuestVar(9);
        qs.setStatus(QuestStatus.REWARD);
        break;
    }
    updateQuestStatus(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 == 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 onDialogEvent(final QuestCookie env) {
    // Instanceof
    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);

    // ------------------------------------------------------------
    // NPC Quest :
    // 0 - Vergelmir start
    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 203711) // Miriya
      {
        // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
        if (env.getDialogId() == 25)
          // 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) {

          // Xenophon
        case 203833:
          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.setQuestVar(1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          }
          // 2 / 4- Talk with Koruchinerk
        case 798321:
          if (var == 1) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select1 to eddit-HtmlPages.xml
                return sendQuestDialog(env, 1352);
                // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml
              case 10001:
                qs.setQuestVar(2);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
                return true;
            }
          } else if (var == 2) {
            switch (env.getDialogId()) {
                // Get HACTION_QUEST_SELECT in the eddit-HyperLinks.xml
              case 25:
                // Send select1 to eddit-HtmlPages.xml
                return sendQuestDialog(env, 1693);
                // Get HACTION_SETPRO1 in the eddit-HyperLinks.xml
              case 33:
                if (player.getInventory().getItemCountByItemId(182206075) < 1) {
                  // player doesn't own required item
                  return sendQuestDialog(env, 10001);
                }
                player.getInventory().removeFromBagByItemId(182206075, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 10000);
            }
          }
          return false;
        case 700562:
          if (var == 2) {
            ThreadPoolManager.getInstance()
                .schedule(
                    new Runnable() {
                      @Override
                      public void run() {
                        updateQuestStatus(env);
                      }
                    },
                    3000);
            return true;
          }
          break;
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203711) // Miriya
      {
        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 == 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;
 }
Esempio n. 20
0
  @Override
  public boolean onDialogEvent(QuestEnv 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 == 204734) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialog() == QuestDialog.START_DIALOG) return sendQuestDialog(env, 1011);
        else return sendQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204734) {
        return sendQuestEndDialog(env);
      }
    } else if (qs.getStatus() != QuestStatus.START) {
      return false;
    }
    if (targetId == 798119) {
      switch (env.getDialog()) {
        case START_DIALOG:
          if (var == 0) return sendQuestDialog(env, 1352);
        case STEP_TO_1:
          if (var == 0) {
            if (giveQuestItem(env, 182204528, 1)) ;
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 700512) {
      switch (env.getDialog()) {
        case USE_OBJECT:
          if (var == 1) {
            if (player.getInventory().getItemCountByItemId(182204528) == 1) {
              removeQuestItem(env, 182204528, 1);
              QuestService.addNewSpawn(
                  220040000,
                  1,
                  215383,
                  (float) 1140.78,
                  (float) 432.85,
                  (float) 341.0825,
                  (byte) 0);
              return true;
            }
          }
          return false;
      }
    } else if (targetId == 204734) {
      switch (env.getDialog()) {
        case START_DIALOG:
          if (var == 1) return sendQuestDialog(env, 2375);
        case SELECT_REWARD:
          if (var == 1) {
            removeQuestItem(env, 182204529, 1);
            qs.setQuestVarById(0, var + 1);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 5);
          }
          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 == 278054) {
        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 == 278126) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 0) return sendQuestDialog(env, 1011);
        case 1013:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 282));
          break;
        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;
          }
          return false;
      }
    } else if (targetId == 278127) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 1) return sendQuestDialog(env, 1352);
        case 1353:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 283));
          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;
          }
          return false;
      }
    } else if (targetId == 278128) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 2) return sendQuestDialog(env, 1693);
        case 1694:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 284));
          break;
        case 10002:
          if (var == 2) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 278129) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 3) return sendQuestDialog(env, 2034);
        case 2035:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 285));
          break;
        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;
          }
          return false;
      }
    } else if (targetId == 278130) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 4) return sendQuestDialog(env, 2375);
        case 2376:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 286));
          break;
        case 10004:
          if (var == 4) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
          return false;
      }
    } else if (targetId == 278131) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 5) return sendQuestDialog(env, 2716);
        case 2717:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 287));
          break;
        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;
          }
          return false;
      }
    } else if (targetId == 278136) {
      switch (env.getDialogId()) {
        case 25:
          if (var == 6) return sendQuestDialog(env, 3057);
        case 3058:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 288));
          break;
        case 10255:
          if (var == 6) {
            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 boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

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

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 203516:
          switch (env.getDialogId()) {
            case 25:
              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(), 0));
                return true;
              }
          }
          break;
        case 203519:
          switch (env.getDialogId()) {
            case 25:
              if (var == 1) return sendQuestDialog(env, 1352);
            case 10001:
              if (var == 1) {
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                return true;
              }
          }
          break;
        case 203539:
          switch (env.getDialogId()) {
            case 25:
              if (var == 2) return sendQuestDialog(env, 1693);
            case 1694:
              PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 55));
              break;
            case 10002:
              if (var == 2) {
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                return true;
              }
          }
          break;
        case 203552:
          switch (env.getDialogId()) {
            case 25:
              if (var == 3) return sendQuestDialog(env, 2034);
            case 10003:
              if (var == 3) {
                qs.setQuestVarById(0, var + 1);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                return true;
              }
          }
          break;
        case 203554:
          switch (env.getDialogId()) {
            case 25:
              if (var == 4) return sendQuestDialog(env, 2375);
              else if (var == 8) return sendQuestDialog(env, 2716);
            case 10004:
              if (var == 4) {
                qs.setQuestVar(5);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                return true;
              }
              break;
            case 10005:
              if (var == 8) {
                qs.setQuestVar(9);
                updateQuestStatus(env);
                qs.setQuestVar(8);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                PacketSendUtility.sendPacket(
                    player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                return true;
              }
          }
          break;
        case 700081:
          if (var == 5) {
            destroy(6, env);
            return false;
          }
          break;
        case 700082:
          if (var == 6) {
            destroy(7, env);
            return false;
          }
          break;
        case 700083:
          if (var == 7) {
            destroy(-1, env);
            return false;
          }
          break;
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203516) {
        if (env.getDialogId() == -1) {
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 58));
          return sendQuestDialog(env, 3057);
        } 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();
   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;
 }
Esempio n. 24
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;
  }
  @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;
  }