private void destroy(final int var, QuestEnv env) {
    final int targetObjectId = env.getVisibleObject().getObjectId();

    final Player player = env.getPlayer();
    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.getTarget().getObjectId() != targetObjectId) return;
                PacketSendUtility.sendPacket(
                    player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                PacketSendUtility.broadcastPacket(
                    player,
                    new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                    true);
                PacketSendUtility.broadcastPacket(
                    player.getTarget(),
                    new SM_EMOTION((Creature) player.getTarget(), EmotionType.EMOTE, 128, 0));
                QuestState qs = player.getQuestStateList().getQuestState(questId);
                if (var == -1) PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 56));
                qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                updateQuestStatus(player, qs);
              }
            },
            3000);
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 801022) {
        switch (dialog) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 1011);
            }
          case QUEST_ACCEPT_SIMPLE:
            {
              return sendQuestStartDialog(env, 182213313, 1);
            }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 801022) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2375);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
Ejemplo n.º 3
0
  private void destroy(final int var, final QuestEnv env) {
    final int targetObjectId = env.getVisibleObject().getObjectId();

    final Player player = env.getPlayer();
    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.getTarget() == null
                    || player.getTarget().getObjectId() != targetObjectId) return;
                PacketSendUtility.sendPacket(
                    player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                PacketSendUtility.broadcastPacket(
                    player,
                    new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                    true);
                sendEmotion(env, player, EmotionId.STAND, true);
                QuestState qs = player.getQuestStateList().getQuestState(questId);
                if (var != -1) qs.setQuestVarById(0, var);
                else {
                  playQuestMovie(env, 21);
                  qs.setStatus(QuestStatus.REWARD);
                }
                updateQuestStatus(env);
              }
            },
            3000);
  }
Ejemplo n.º 4
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 0) {
        if (dialog == DialogAction.QUEST_ACCEPT_1) {
          removeQuestItem(env, 182206844, 1);
          QuestService.startQuest(env);
          return closeDialogWindow(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799049) {
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 10002);
        } else if (dialog == DialogAction.SELECT_ACTION_2034) {
          return sendQuestDialog(env, 2034);
        } else if (dialog == DialogAction.SELECT_QUEST_REWARD) {
          if (player.getInventory().getKinah() >= 20000000) {
            player.getInventory().decreaseKinah(20000000);
            return sendQuestDialog(env, 5);
          } else return sendQuestDialog(env, 3739);
        } else return sendQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 5
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 799336) { // Tataka
        if (player.getInventory().getItemCountByItemId(102000690)
            >= 1) { // Noble Siel's Supreme Mace
          if (dialog == DialogAction.QUEST_SELECT) {
            return sendQuestDialog(env, 4762);
          } else {
            return sendQuestStartDialog(env);
          }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799336) { // Tataka
        if (dialog == DialogAction.USE_OBJECT) {
          if (player.getInventory().getItemCountByItemId(182213290) > 0) {
            return sendQuestDialog(env, 10002);
          }
        } else {
          removeQuestItem(env, 182213290, 1);
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 0) {
        if (dialog == DialogAction.QUEST_ACCEPT_1) {
          QuestService.startQuest(env);
          return closeDialogWindow(env);
        }
      } else if (targetId == 700009) {
        return giveQuestItem(env, 182200559, 1);
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 203098) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 2375);
        } else if (dialog == DialogAction.SELECT_QUEST_REWARD) {
          removeQuestItem(env, 182213168, 1);
          return defaultCloseDialog(env, 0, 1, true, true);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203098) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 7
0
  public boolean onKillEvent(QuestEnv env) {
    /** Checks * */
    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;

    switch (targetId) {
      case 210715: // Brute
        if (var > 0 && var < 4) // En tuer 4
        {
          qs.setQuestVarById(0, var + 1);
          updateQuestStatus(player, qs);
          return true;
        } else if (var == 4) // Au 4eme REWARD
        {
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(player, qs);
          return true;
        }
    }
    return false;
  }
Ejemplo n.º 8
0
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;
    int var = qs.getQuestVarById(0);
    int targetId = env.getTargetId();
    DialogAction dialog = env.getDialog();

    if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 203518) { // Boromer
        switch (dialog) {
          case QUEST_SELECT:
            {
              if (var == 0) {
                return sendQuestDialog(env, 1011);
              } else if (var == 1) {
                return sendQuestDialog(env, 1352);
              } else if (var == 2) {
                return sendQuestDialog(env, 1694);
              }
            }
          case SELECT_ACTION_1012:
            {
              playQuestMovie(env, 51);
              return sendQuestDialog(env, 1012);
            }
          case SETPRO1:
            {
              return defaultCloseDialog(env, 0, 1); // 1
            }
          case SETPRO3:
            {
              return defaultCloseDialog(env, 2, 3); // 3
            }
          case CHECK_USER_HAS_QUEST_ITEM:
            {
              return checkQuestItems(env, 1, 2, false, 1694, 1693);
            }
          case FINISH_DIALOG:
            {
              return sendQuestSelectionDialog(env);
            }
        }
      } else if (targetId == 700093) {
        return true; // just give quest drop on use
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203518) { // Boromer
        if (dialog == DialogAction.USE_OBJECT) {
          return sendQuestDialog(env, 2034);
        } else {
          return sendQuestEndDialog(env);
        }
      }
    }
    return false;
  }
 @Override
 public boolean onDialogEvent(QuestEnv 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) {
     if (targetId == 205130) {
       if (env.getDialogId() == 25)
         return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
       else return defaultQuestStartDialog(env);
     }
   } else if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 730107:
         {
           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, 37, 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, 38, 0, targetObjectId), true);
                         qs.setQuestVarById(0, 1);
                         updateQuestStatus(player, qs);
                       }
                     },
                     3000);
           }
         }
       case 205130:
         {
           if (qs.getQuestVarById(0) == 1) {
             if (env.getDialogId() == 25)
               return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 2375);
             else if (env.getDialogId() == 1009) {
               qs.setStatus(QuestStatus.REWARD);
               updateQuestStatus(player, qs);
               return defaultQuestEndDialog(env);
             } else return defaultQuestEndDialog(env);
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 205130) return defaultQuestEndDialog(env);
   }
   return false;
 }
Ejemplo n.º 10
0
 private boolean setPlayerClass(QuestEnv env, QuestState qs, PlayerClass playerClass) {
   Player player = env.getPlayer();
   player.getCommonData().setPlayerClass(playerClass);
   player.getCommonData().upgradePlayer();
   qs.setStatus(QuestStatus.REWARD);
   updateQuestStatus(player, qs);
   sendQuestDialog(player, env.getVisibleObject().getObjectId(), 5);
   return true;
 }
Ejemplo n.º 11
0
 @Override
 public boolean onDialogEvent(final QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null) return false;
   int var = qs.getQuestVarById(0);
   int targetId = env.getTargetId();
   DialogAction dialog = env.getDialog();
   if (qs.getStatus() == QuestStatus.START) {
     switch (targetId) {
       case 204342:
         { // Mirka
           switch (dialog) {
             case QUEST_SELECT:
               {
                 if (var == 0) {
                   return sendQuestDialog(env, 1011);
                 }
                 if (var == 4) return sendQuestDialog(env, 2375);
               }
             case SELECT_ACTION_1012:
               {
                 if (var == 0) {
                   playQuestMovie(env, 82);
                   return sendQuestDialog(env, 1012);
                 }
               }
             case SETPRO1:
               {
                 return defaultCloseDialog(env, 0, 1); // 1
               }
             case SET_SUCCEED:
               {
                 return defaultCloseDialog(env, 4, 4, true, false, 0, 0, 182204016, 1); // reward
               }
           }
           break;
         }
       case 700233:
         { // Pagimkin's Corpse
           if (dialog == DialogAction.USE_OBJECT && var == 1) {
             return useQuestObject(env, 1, 2, false, 0); // 2
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 204053) { // Kvasir
       if (env.getDialog() == DialogAction.USE_OBJECT) {
         return sendQuestDialog(env, 10002);
       } else {
         return sendQuestEndDialog(env);
       }
     }
   }
   return false;
 }
 @Override
 public boolean onEnterZoneEvent(QuestEnv env, ZoneName zoneName) {
   if (zoneName != ZoneName.MORHEIM_ICE_FORTRESS_220020000) return false;
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null) return false;
   env.setQuestId(questId);
   QuestService.startQuest(env, QuestStatus.START);
   return true;
 }
Ejemplo n.º 13
0
 @Override
 public boolean onLvlUpEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null) return false;
   if (player.getCommonData().getLevel() < 9) return false;
   env.setQuestId(questId);
   questService.startQuest(env, QuestStatus.START);
   return true;
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (targetId != 204301) return false;
    if (qs.getStatus() == QuestStatus.START) {
      if (env.getDialogId() == 25) {
        qs.setQuestVar(1);
        qs.setStatus(QuestStatus.REWARD);
        updateQuestStatus(player, qs);
        return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
      } else return defaultQuestStartDialog(env);
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (env.getDialogId() == 17) {
        int[] ids = {2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042};
        for (int id : ids) {
          QuestService.startQuest(
              new QuestEnv(env.getVisibleObject(), env.getPlayer(), id, env.getDialogId()),
              QuestStatus.LOCKED);
        }
      }
      return defaultQuestEndDialog(env);
    }
    return false;
  }
  @Override
  public boolean onLvlUpEvent(QuestEnv env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    boolean lvlCheck =
        QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel());
    if (qs != null || !lvlCheck) return false;

    env.setQuestId(questId);
    QuestService.startQuest(env, QuestStatus.START);
    return true;
  }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 799546) {
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      int var = qs.getQuestVarById(0);
      switch (targetId) {
        case 204108:
          {
            switch (dialog) {
              case QUEST_SELECT:
                {
                  if (var == 0) {
                    return sendQuestDialog(env, 1352);
                  } else if (var == 1) {
                    return sendQuestDialog(env, 2375);
                  }
                }
              case SETPRO1:
                {
                  return defaultCloseDialog(env, 0, 1);
                }
              case CHECK_USER_HAS_QUEST_ITEM_SIMPLE:
                {
                  if (QuestService.collectItemCheck(env, true)) {
                    changeQuestStep(env, 1, 1, true);
                    return sendQuestDialog(env, 5);
                  } else {
                    return closeDialogWindow(env);
                  }
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204108) {
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 17
0
 @Override
 public boolean onKillEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVarById(0);
     if (var == 2 && env.getTargetId() == 212879) {
       changeQuestStep(env, 2, 4, false); // 4
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 18
0
 @Override
 public boolean onEnterZoneEvent(QuestEnv env, ZoneName zoneName) {
   if (zoneName != ZoneName.Q1123) return false;
   final Player player = env.getPlayer();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getQuestVars().getQuestVars() != 0) return false;
   env.setQuestId(questId);
   PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 11));
   qs.setStatus(QuestStatus.REWARD);
   qs.getQuestVars().setQuestVarById(0, 1);
   updateQuestStatus(player, qs);
   return true;
 }
  @Override
  public boolean onDialogEvent(QuestEnv env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    DialogAction dialog = env.getDialog();
    int targetId = env.getTargetId();

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 204141) { // Deyla
        if (dialog == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 4762);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    } else if (qs.getStatus() == QuestStatus.START) {
      if (targetId == 204141) { // Deyla
        switch (dialog) {
          case QUEST_SELECT:
            {
              return sendQuestDialog(env, 1011);
            }
          case SETPRO1:
            {
              return sendQuestDialog(env, 1352);
            }
          case SETPRO2:
            {
              return sendQuestDialog(env, 1693);
            }
          case SETPRO11:
            {
              changeQuestStep(env, 0, 0, true); // reward
              choice = 0;
              return sendQuestDialog(env, 5);
            }
          case SETPRO12:
            {
              changeQuestStep(env, 0, 0, true); // reward
              choice = 1;
              return sendQuestDialog(env, 6);
            }
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 204141) { // Deyla
        return sendQuestEndDialog(env, choice);
      }
    }
    return false;
  }
Ejemplo 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 == 203607) {
     if (qs == null) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1011);
       else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203609) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialog() == DialogAction.QUEST_SELECT) return sendQuestDialog(env, 1352);
       else if (env.getDialog() == DialogAction.SETPRO1) {
         return defaultCloseDialog(env, 0, 1); // 1
       } else return sendQuestStartDialog(env);
     }
   } else if (targetId == 203631) {
     if (qs != null) {
       if (env.getDialog() == DialogAction.QUEST_SELECT && qs.getStatus() == QuestStatus.START)
         return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == DialogAction.SELECT_QUEST_REWARD.id()
           && qs.getStatus() != QuestStatus.COMPLETE
           && qs.getStatus() != QuestStatus.NONE) {
         qs.setQuestVar(2);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return sendQuestEndDialog(env);
       } else return sendQuestEndDialog(env);
     }
   }
   return false;
 }
  @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 == 798452) { // Darfen
        if (env.getDialog() == DialogAction.QUEST_SELECT) {
          return sendQuestDialog(env, 1011);
        } else {
          return sendQuestStartDialog(env);
        }
      }
    }

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798452:
          { // Darfen
            switch (env.getDialog()) {
              case QUEST_SELECT:
                {
                  return sendQuestDialog(env, 2375);
                }
              case CHECK_USER_HAS_QUEST_ITEM:
                {
                  if (QuestService.collectItemCheck(env, true)) {
                    changeQuestStep(env, 0, 0, true);
                    return sendQuestDialog(env, 5);
                  } else {
                    return sendQuestDialog(env, 2716);
                  }
                }
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798452) { // Darfen
        return sendQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 22
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 == 790001) {
     if (qs == null) {
       if (env.getDialogId() == 25)
         return sendQuestDialog(player, env.getVisibleObject().getObjectId(), 1011);
       else return defaultQuestStartDialog(env);
     } else if (qs.getStatus() == QuestStatus.REWARD) return defaultQuestEndDialog(env);
   }
   return false;
 }
Ejemplo n.º 23
0
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   if (player.getCommonData().getRace() != Race.ASMODIANS) return false;
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null) {
     env.setQuestId(questId);
     QuestService.startQuest(env);
   }
   qs = player.getQuestStateList().getQuestState(questId);
   if (qs.getStatus() == QuestStatus.START) {
     PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(1, 2));
     return true;
   }
   return false;
 }
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (var == 12) {
       if (player.getWorldId() == 300160000) {
         qs.setQuestVar(13);
         updateQuestStatus(env);
         return true;
       } else {
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           return giveQuestItem(env, 182206613, 1);
         }
       }
     } else if (var >= 13 && var < 16) {
       if (player.getWorldId() != 300160000) {
         changeQuestStep(env, var, 12, false);
         if (player.getInventory().getItemCountByItemId(182206613) == 0) {
           giveQuestItem(env, 182206613, 1);
         }
         return true;
       }
     }
   }
   return false;
 }
  @Override
  public HandlerResult onItemUseEvent(final QuestEnv 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 != 182206726) {
      return HandlerResult.UNKNOWN;
    }
    PacketSendUtility.broadcastPacket(
        player, new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 1000, 0, 0), true);
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {
              @Override
              public void run() {
                PacketSendUtility.broadcastPacket(
                    player,
                    new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0),
                    true);
                removeQuestItem(env, 182206726, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
              }
            },
            1000);
    return HandlerResult.SUCCESS;
  }
Ejemplo n.º 26
0
  @Override
  public boolean onItemUseEvent(QuestEnv env, Item item) {
    final Player player = env.getPlayer();
    final int id = item.getItemTemplate().getTemplateId();
    final int itemObjId = item.getObjectId();

    if (id != 182200007) return false;
    if (!zoneService.isInsideZone(player, ZoneName.ITEMUSE_Q1006)) return false;
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;
    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() {
                PacketSendUtility.broadcastPacket(
                    player,
                    new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0),
                    true);
                player.getInventory().removeFromBagByObjectId(itemObjId, 1);
                itemService.addItems(
                    player, Collections.singletonList(new QuestItems(182200008, 1)));
                qs.setQuestVarById(0, 2);
                updateQuestStatus(player, qs);
              }
            },
            3000);
    return true;
  }
Ejemplo n.º 27
0
 @Override
 public boolean onAttackEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() != QuestStatus.START || qs.getQuestVars().getQuestVars() != 4)
     return false;
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   if (targetId != 211043) return false;
   Npc npc = (Npc) env.getVisibleObject();
   if (npc.getLifeStats().getCurrentHp() < npc.getLifeStats().getMaxHp() / 2) {
     PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 151));
     npc.getController().onDelete();
   }
   return false;
 }
Ejemplo n.º 28
0
 @Override
 public boolean onKillEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVarById(0);
     if (var == 3) {
       int targetId = env.getTargetId();
       if (mobs.contains(targetId)) {
         spawn(player);
         return true;
       }
     }
   }
   return false;
 }
Ejemplo n.º 29
0
 @Override
 public boolean onEnterWorldEvent(QuestEnv env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.START) {
     int var = qs.getQuestVars().getQuestVars();
     if (player.getWorldId() != 320070000) {
       if (var >= 95 && var <= 99) {
         removeStigma(env);
         qs.setQuestVar(4);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player,
             new SM_SYSTEM_MESSAGE(
                 SystemMessageId.QUEST_FAILED_$1,
                 DataManager.QUEST_DATA.getQuestById(questId).getName()));
         return true;
       } else if (var == 9) {
         removeStigma(env);
         return true;
       }
     }
   }
   return false;
 }
Ejemplo n.º 30
0
 private void removeStigma(QuestEnv env) {
   Player player = env.getPlayer();
   for (Item item : player.getEquipment().getEquippedItemsByItemId(getStoneId(player))) {
     player.getEquipment().unEquipItem(item.getObjectId(), 0);
   }
   removeQuestItem(env, getStoneId(player), 1);
 }