@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) {
     if (targetId == 205130) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 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, 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);
                         qs.setQuestVarById(0, 1);
                         updateQuestStatus(env);
                       }
                     },
                     3000);
           }
         }
       case 205130:
         {
           if (qs.getQuestVarById(0) == 1) {
             if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
             else if (env.getDialogId() == 1009) {
               qs.setStatus(QuestStatus.REWARD);
               updateQuestStatus(env);
               return defaultQuestEndDialog(env);
             } else return defaultQuestEndDialog(env);
           }
         }
     }
   } else if (qs.getStatus() == QuestStatus.REWARD) {
     if (targetId == 205130) return defaultQuestEndDialog(env);
   }
   return false;
 }
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   if (env.getPlayer().getTribe().equals("PC_DARK")) {
     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 == 730330) {
       PlayerClass playerClass = player.getCommonData().getPlayerClass();
       if (playerClass == PlayerClass.RANGER
           || playerClass == PlayerClass.ASSASSIN
           || 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.getCompleteCount() <= 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() == 34) {
             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;
   }
 }
Ejemplo n.º 3
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (targetId == 203550) // Munin
    {
      if (qs == null || qs.getStatus() == QuestStatus.START) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else if (env.getDialogId() == 10000) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) // Reward
      {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 10002);
        else if (env.getDialogId() == 1009) defaultQuestRemoveItem(env, 182207085, 1);
        return defaultQuestEndDialog(env);
      }
    } else if (targetId == 203546) // Skuld
    {

      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1352);
        else if (env.getDialogId() == 10001) {
          qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
          updateQuestStatus(env);
          PacketSendUtility.sendPacket(
              player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
          return true;
        } else return defaultQuestStartDialog(env);
      }

    } else if (targetId == 279034) // Baoninerk
    {
      if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 2) {
        switch (env.getDialogId()) {
          case 26:
            return sendQuestDialog(env, 1693);
          case 34:
            return defaultQuestItemCheck(env, 2, 0, true, 10000, 10001, 182207085, 1);
        }
      }
    } else if (qs != null && qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 700509: // Shining Box
        case 700510: // Balaur Supply Box
          {
            if (qs.getQuestVarById(0) == 2 && env.getDialogId() == -1) return true;
          }
      }
    }
    return false;
  }
Ejemplo n.º 4
0
 @Override
 public HandlerResult onBonusApplyEvent(QuestCookie env, int index, AbstractInventoryBonus bonus) {
   if (!(bonus instanceof CoinBonus)) return HandlerResult.UNKNOWN;
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
     if (index == 0 && qs.getQuestVarById(0) == 0 || index == 1 && qs.getQuestVarById(0) == 1)
       return HandlerResult.SUCCESS;
   }
   return HandlerResult.FAILED;
 }
 @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 == 278501) {
     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(182202151, 1))))
           return defaultQuestStartDialog(env);
         else return true;
       } else return defaultQuestStartDialog(env);
     } else if (qs.getStatus() == QuestStatus.START) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
     }
   } else if (targetId == 278503) {
     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(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 278502) {
     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.setQuestVar(2);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         player.getInventory().removeFromBagByItemId(182202151, 1);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 278518) {
     if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       return defaultQuestEndDialog(env);
     }
   }
   return false;
 }
Ejemplo n.º 6
0
  @Override
  public HandlerResult onItemUseEvent(final QuestCookie env, Item item) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    final int id = item.getItemTemplate().getTemplateId();
    final int itemObjId = item.getObjectId();

    if (id != 182204304 || qs == null) return HandlerResult.UNKNOWN;

    if (qs.getQuestVarById(0) != 15 || id != 182204304) return HandlerResult.FAILED;

    if (!ZoneService.getInstance().isInsideZone(player, ZoneName.BERITRAS_WEAPON_220040000))
      return HandlerResult.FAILED;

    PacketSendUtility.broadcastPacket(
        player, new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 3000, 0, 0), true);
    ThreadPoolManager.getInstance()
        .schedule(
            new Runnable() {
              @Override
              public void run() {
                PacketSendUtility.broadcastPacket(
                    player,
                    new SM_ITEM_USAGE_ANIMATION(player.getObjectId(), itemObjId, id, 0, 1, 0),
                    true);
                player.getInventory().removeFromBagByItemId(182204304, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
              }
            },
            3000);
    return HandlerResult.SUCCESS;
  }
  @Override
  public boolean onSkillUseEvent(QuestCookie env, int skillUsedId) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() != QuestStatus.START) return false;

    if (skillUsedId == skillId) {
      if (var >= 0 && var < 9) {
        qs.setQuestVarById(0, var + 1);
        updateQuestStatus(env);
        return true;
      } else if (var == 9) {
        qs.setQuestVarById(0, var + 1);
        updateQuestStatus(env);
        qs.setStatus(QuestStatus.REWARD);
        updateQuestStatus(env);
        return true;
      }
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    Player player = env.getPlayer();

    if (defaultQuestNoneDialog(env, 204050, 4762)) return true;

    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.START) {
      if (env.getTargetId() == 204050) {
        switch (env.getDialogId()) {
          case 26:
            if (var == 0) return sendQuestDialog(env, 1011);
            else if (var == 1) return sendQuestDialog(env, 1352);
          case 10000:
            return defaultCloseDialog(env, 0, 1);
          case 10001:
            return defaultCloseDialog(env, 1, 0);
          case 34:
            return defaultQuestItemCheck(env, 1, 0, true, 5, 10001);
        }
      }
    }
    return defaultQuestRewardDialog(env, 204050, 2375);
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    if (!super.defaultQuestOnDialogInitStart(env)) return false;

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

    if (qs.getStatus() == QuestStatus.START) {
      switch (env.getTargetId()) {
        case 203540:
          switch (env.getDialogId()) {
            case 26:
              if (var == 0) return sendQuestDialog(env, 1011);
              else if (var == 1) return sendQuestDialog(env, 1352);
            case 10000:
              return defaultCloseDialog(env, 0, 1);
            case 34:
              return defaultQuestItemCheck(env, 1, 0, true, 1438, 1353);
          }
          break;
        case 700095:
          if (env.getDialogId() == -1 && player.getInventory().getItemCountByItemId(182203008) < 7)
            return defaultQuestUseNpc(
                env, 1, 2, EmotionType.NEUTRALMODE2, EmotionType.START_LOOT, true);
          break;
      }
    }
    return defaultQuestRewardDialog(env, 203516, 1693);
  }
Ejemplo n.º 10
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    if (!super.defaultQuestOnDialogInitStart(env)) return false;

    QuestState qs = env.getPlayer().getQuestStateList().getQuestState(questId);
    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.START) {
      if (env.getTargetId() == 204052) {
        switch (env.getDialogId()) {
          case 26:
            if (var == 0) return sendQuestDialog(env, 1011);
          case 10255:
            return defaultCloseDialog(env, 0, 0, true, false);
        }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (env.getTargetId() == 798800) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 10002);
        else if (env.getDialogId() == 18)
          QuestService.startQuest(
              new QuestCookie(env.getVisibleObject(), env.getPlayer(), 20001, env.getDialogId()),
              QuestStatus.LOCKED);
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 11
0
  @Override
  public boolean onDialogEvent(QuestCookie 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) {
      if (targetId == 203178) {
        switch (env.getDialogId()) {
          case 26:
            if (var == 0) return sendQuestDialog(env, 1011);
          case 10000:
          case 10001:
            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 (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203178) return defaultQuestEndDialog(env);
    }
    return false;
  }
Ejemplo n.º 12
0
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   QuestTemplate template = questsData.getQuestById(questId);
   if (targetId == 204639) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 2) {
         PlayerClass playerClass = player.getCommonData().getPlayerClass();
         PlayerClass startPC = null;
         try {
           startPC = PlayerClass.getStartingClassFor(playerClass);
         } catch (IllegalArgumentException e) {
           startPC = playerClass; // already a start class
         }
         if (startPC == PlayerClass.MAGE || startPC == PlayerClass.PRIEST) {
           QuestService.startQuest(env, QuestStatus.START);
           return sendQuestDialog(env, 1011);
         } else {
           return sendQuestDialog(env, 3739);
         }
       }
     } else if (qs != null && qs.getStatus() == QuestStatus.START) {
       if (env.getDialogId() == 2) {
         return sendQuestDialog(env, 1011);
       } else if (env.getDialogId() == 1011) {
         if (player.getInventory().getItemCountByItemId(186000003) >= 16) {
           qs.setQuestVarById(0, 0);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 5);
         } else {
           return sendQuestDialog(env, 1009);
         }
       } else if (env.getDialogId() == 1352) {
         if (player.getInventory().getItemCountByItemId(186000003) >= 32) {
           qs.setQuestVarById(0, 1);
           qs.setStatus(QuestStatus.REWARD);
           updateQuestStatus(env);
           return sendQuestDialog(env, 6);
         } else {
           return sendQuestDialog(env, 1009);
         }
       }
     } else if (qs.getStatus() == QuestStatus.COMPLETE) {
       if (env.getDialogId() == 2) {
         if ((qs.getCompleteCount() <= template.getMaxRepeatCount())) {
           QuestService.startQuest(env, QuestStatus.START);
           return sendQuestDialog(env, 1011);
         } else return sendQuestDialog(env, 1008);
       }
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       return defaultQuestEndDialog(env, qs.getQuestVarById(0));
     }
   }
   return false;
 }
  @Override
  public boolean onKillEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

    int var1 = qs.getQuestVarById(1);
    int var2 = qs.getQuestVarById(2);
    int var3 = qs.getQuestVarById(3);
    int targetId = env.getTargetId();

    if ((targetId == 256617 || targetId == 253720 || targetId == 254513)
        && qs.getQuestVarById(0) == 2) {
      switch (targetId) {
        case 256617:
          if (var1 >= 0 && var1 < 60) {
            ++var1;
            qs.setQuestVarById(1, var1 + 1);
            updateQuestStatus(env);
          }
          break;
        case 253720:
          if (var2 >= 0 && var2 < 120) {
            ++var2;
            qs.setQuestVarById(2, var2 + 3);
            updateQuestStatus(env);
          }
          break;
        case 254513:
          if (var3 >= 0 && var3 < 240) {
            ++var3;
            qs.setQuestVarById(3, var3 + 7);
            updateQuestStatus(env);
          }
          break;
      }
    }
    if (qs.getQuestVarById(0) == 2 && var1 == 60 && var2 == 120 && var3 == 240) {
      qs.setQuestVarById(1, 60);
      updateQuestStatus(env);
      return true;
    }
    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 == 798928) {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 4762);
       else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       if (env.getDialogId() == -1) return sendQuestDialog(env, 10002);
       else if (env.getDialogId() == 1009) return sendQuestDialog(env, 5);
       else return defaultQuestEndDialog(env);
     }
   } else if (targetId == 799069) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
       else if (env.getDialogId() == 10000) {
         qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 700948) {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 1) {
       if (env.getDialogId() == -1) {
         if (!ItemService.addItems(
             player, Collections.singletonList(new QuestItems(182202193, 1)))) return true;
         final int targetObjectId = env.getVisibleObject().getObjectId();
         PacketSendUtility.sendPacket(
             player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
         PacketSendUtility.broadcastPacket(
             player, new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId), true);
         qs.setQuestVar(2);
         updateQuestStatus(env);
       }
     }
   }
   return false;
 }
Ejemplo n.º 15
0
  public boolean questComplite(QuestCookie env) {
    Player player = env.getPlayer();
    int id = env.getQuestId();
    QuestState qs = player.getQuestStateList().getQuestState(id);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

    qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
    qs.setStatus(QuestStatus.REWARD);
    PacketSendUtility.sendPacket(
        player, new SM_QUEST_ACCEPTED(2, id, qs.getStatus(), qs.getQuestVars().getQuestVars()));
    player.getController().updateNearbyQuests();
    return true;
  }
Ejemplo n.º 16
0
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (targetId == 799234) // Nep
   {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
       else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.START) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == 1009) {
         qs.setQuestVar(3);
         updateQuestStatus(env);
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         return defaultQuestEndDialog(env);
       } else return defaultQuestEndDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       return defaultQuestEndDialog(env);
     }
   } else if (targetId == 204433) // Kistig
   {
     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(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   }
   return false;
 }
Ejemplo n.º 17
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if ((qs == null || qs.getStatus() == QuestStatus.NONE) && !onLvlUpEvent(env)) return false;

    if (qs == null
        || qs.getStatus() == QuestStatus.NONE
        || qs.getStatus() == QuestStatus.COMPLETE && qs.getCompleteCount() < 10) {
      if (env.getTargetId() == 799778) {
        switch (env.getDialogId()) {
          case -1:
            return sendQuestDialog(env, 1011);
          case 1002:
            {
              PacketSendUtility.sendPacket(
                  player, new SM_QUEST_ACCEPTED(1, questId, QuestStatus.START, 0));
              if (qs == null) player.getQuestStateList().addQuest(questId, qs);
              else {
                qs.setStatus(QuestStatus.START);
                qs.setQuestVar(0);
              }
              player.getController().updateNearbyQuests();
              return sendQuestDialog(env, 1003);
            }
          default:
            return defaultQuestStartDialog(env);
        }
      }
      return false;
    }

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.START) {
      if (env.getTargetId() == 799778) {
        switch (env.getDialogId()) {
          case -1:
          case 26:
            if (var == 0) return sendQuestDialog(env, 2375);
          case 34:
            return defaultQuestItemCheck(env, 0, 1, true, 5, 2716);
        }
      }
    }

    return defaultQuestRewardDialog(env, 799778, 0);
  }
Ejemplo n.º 18
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (targetId == 798953) {
      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(182209507, 1))))
            return defaultQuestStartDialog(env);
          else return true;
        } else return defaultQuestStartDialog(env);
      }
    }
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798953) {
        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 == 203700) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 0) return sendQuestDialog(env, 1352);
        case 10000:
          if (var == 0) {
            player.getInventory().removeFromBagByItemId(182209507, 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 onKillEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;

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

    switch (targetId) {
      case 216886:
        if (qs.getQuestVarById(0) == 2) {
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return true;
        }
    }
    return false;
  }
Ejemplo n.º 20
0
 @Override
 public HandlerResult onBonusApplyEvent(QuestCookie env, int index, AbstractInventoryBonus bonus) {
   if (!(bonus instanceof CutSceneBonus)) return HandlerResult.UNKNOWN;
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
     int var1 = qs.getQuestVarById(1);
     int var2 = qs.getQuestVarById(2);
     qs.setQuestVarById(1, var1 + 1);
     // randomize movie
     if ((var1 == 1 && var2 == 0) || var1 == 0 && Rnd.get() * 100 < 50) {
       if (qs.getCompleteCount() == 9)
         ItemService.addItems(player, Collections.singletonList(new QuestItems(188051106, 1)));
       qs.setQuestVarById(2, 1);
       return HandlerResult.SUCCESS;
     }
   }
   return HandlerResult.FAILED;
 }
Ejemplo n.º 21
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (defaultQuestNoneDialog(env, 203893, 182206112, 1)) return true;

    if (qs == null) return false;

    int var = qs.getQuestVarById(0);

    if (qs.getStatus() == QuestStatus.START) {
      switch (env.getTargetId()) {
        case 798072:
          switch (env.getDialogId()) {
            case 26:
              if (var == 0) return sendQuestDialog(env, 1352);
            case 10000:
              return defaultCloseDialog(env, 0, 1, 182206113, 1, 0, 0);
          }
          break;
        case 279020:
          switch (env.getDialogId()) {
            case 26:
              if (var == 1) return sendQuestDialog(env, 1693);
            case 10001:
              return defaultCloseDialog(env, 1, 2, 182206114, 1, 0, 0);
          }
          break;
        case 798053:
          switch (env.getDialogId()) {
            case 26:
              if (var == 2) return sendQuestDialog(env, 2034);
            case 10002:
              return defaultCloseDialog(env, 2, 3, true, false, 182206115, 1, 0, 0);
          }
          break;
      }
    }
    return defaultQuestRewardDialog(env, 798386, 2375);
  }
Ejemplo n.º 22
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    Player player = env.getPlayer();

    if (defaultQuestNoneDialog(env, 203645)) return true;

    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.START) {
      if (env.getTargetId() == 798039) {
        switch (env.getDialogId()) {
          case 26:
            if (var == 0) return sendQuestDialog(env, 1352);
          case 10000:
            return defaultCloseDialog(env, 0, 1, true, false, 182203231, 1, 0, 0);
        }
      }
    }
    return defaultQuestRewardDialog(env, 203645, 2375);
  }
Ejemplo n.º 23
0
  @Override
  public boolean onDialogEvent(final QuestCookie env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);

    if (qs == null || qs.getStatus() == QuestStatus.NONE) {
      if (targetId == 798926) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else return defaultQuestStartDialog(env);
      }
      return false;
    } else if (targetId == 798926) {
      if (qs != null || qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
        else if (env.getDialogId() == 1007) return sendQuestDialog(env, 2375);
        else if (env.getDialogId() == 34) {
          if (player.getInventory().getItemCountByItemId(182209601) == 0) {
            return sendQuestDialog(env, 2716);
          } else {
            qs.setStatus(QuestStatus.REWARD);
            return sendQuestDialog(env, 5);
          }
        } else if (env.getDialogId() == 18) {
          player.getInventory().removeFromBagByItemId(182209601, 1);
          updateQuestStatus(env);
          return defaultQuestEndDialog(env);
        }
      }
      if (qs != null || qs.getStatus() == QuestStatus.REWARD) {
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 24
0
  @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 == 204715) {
        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 == 204715) {
      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 == 204801) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 1) return sendQuestDialog(env, 1352);
          else if (var == 12) return sendQuestDialog(env, 1693);
        case 10001:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10002:
          if (var == 12) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 204805) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 13) return sendQuestDialog(env, 2034);
          if (var == 14) return sendQuestDialog(env, 2375);
        case 34:
          if (QuestService.collectItemCheck(env, true)) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            ItemService.addItems(player, Collections.singletonList(new QuestItems(182204304, 1)));
            return sendQuestDialog(env, 10000);
          } else return sendQuestDialog(env, 10001);
        case 10003:
          if (var == 13) {
            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(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 == 798927) {
      if (qs == null) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
        else if (env.getDialogId() == 1002) {
          if (ItemService.addItems(player, Collections.singletonList(new QuestItems(182206710, 1))))
            return defaultQuestStartDialog(env);
          else return true;
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 798934:
          {
            switch (env.getDialogId()) {
              case 26:
                {
                  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 798997:
          {
            switch (env.getDialogId()) {
              case 26:
                {
                  return sendQuestDialog(env, 2375);
                }
              case 1009:
                {
                  qs.setQuestVar(2);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  return defaultQuestEndDialog(env);
                }
              default:
                return defaultQuestEndDialog(env);
            }
          }
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 798997) {
        switch (env.getDialogId()) {
          case 1009:
            {
              return sendQuestDialog(env, 5);
            }
          default:
            return defaultQuestEndDialog(env);
        }
      }
    }
    return false;
  }
Ejemplo n.º 26
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    Player player = env.getPlayer();

    if (defaultQuestNoneDialog(env, questStartNpc, 4762)) return true;

    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

    int var = qs.getQuestVarById(0);
    if (qs.getStatus() == QuestStatus.START) {
      switch (env.getTargetId()) {
        case secondNpc:
          switch (env.getDialogId()) {
            case 26:
              if (var == 0) return sendQuestDialog(env, 1011);
              else if (var == 1) return sendQuestDialog(env, 4081);
              else if (var == 3) return sendQuestDialog(env, 1352);
              else if (var == 4) return sendQuestDialog(env, 4166);
              else if (var == 6) return sendQuestDialog(env, 1693);
              else if (var == 7) return sendQuestDialog(env, 4251);
              else if (var == 9) return sendQuestDialog(env, 2034);
              else if (var == 10) return sendQuestDialog(env, 4336);
            case 10009:
              if (player.getInventory().decreaseKinah(6500))
                return defaultCloseDialog(env, var, 2, recipesItemIds[0], 1, 0, 0);
              else return sendQuestDialog(env, 4400);
            case 10019:
              if (player.getInventory().decreaseKinah(6500))
                return defaultCloseDialog(env, var, 5, recipesItemIds[1], 1, 0, 0);
              else return sendQuestDialog(env, 4400);
            case 10029:
              if (player.getInventory().decreaseKinah(6500))
                return defaultCloseDialog(env, var, 8, recipesItemIds[2], 1, 0, 0);
              else return sendQuestDialog(env, 4400);
            case 10039:
              if (player.getInventory().decreaseKinah(6500))
                return defaultCloseDialog(env, var, 11, recipesItemIds[3], 1, 0, 0);
              else return sendQuestDialog(env, 4400);
          }
          break;
        case questStartNpc:
          switch (env.getDialogId()) {
            case 26:
              if (var == 2) return sendQuestDialog(env, 1097);
              else if (var == 5) return sendQuestDialog(env, 1438);
              else if (var == 8) return sendQuestDialog(env, 1779);
              else if (var == 11) return sendQuestDialog(env, 2120);
            case 10010:
              if (var == 2) {
                if (player.getInventory().getItemCountByItemId(products[0]) > 0) {
                  player.getInventory().removeFromBagByItemId(products[0], 1);
                  qs.setQuestVar(3);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 1182);
                } else {
                  int checkFailId = 3398;
                  if (player.getRecipeList().isRecipePresent(recipesIds[0])) checkFailId = 2716;
                  else if (player.getInventory().getItemCountByItemId(recipesItemIds[0]) > 0)
                    checkFailId = 3057;

                  if (checkFailId == 3398) {
                    qs.setQuestVar(1);
                    updateQuestStatus(env);
                  }
                  return sendQuestDialog(env, checkFailId);
                }
              }
              break;
            case 10020:
              if (var == 5) {
                if (player.getInventory().getItemCountByItemId(products[1]) > 0) {
                  player.getInventory().removeFromBagByItemId(products[1], 1);
                  qs.setQuestVar(6);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 1523);
                } else {
                  int checkFailId = 3398;
                  if (player.getRecipeList().isRecipePresent(recipesIds[1])) checkFailId = 2716;
                  else if (player.getInventory().getItemCountByItemId(recipesItemIds[1]) > 0)
                    checkFailId = 3057;

                  if (checkFailId == 3398) {
                    qs.setQuestVar(4);
                    updateQuestStatus(env);
                  }
                  return sendQuestDialog(env, checkFailId);
                }
              }
              break;
            case 10030:
              if (var == 8) {
                if (player.getInventory().getItemCountByItemId(products[2]) > 0) {
                  player.getInventory().removeFromBagByItemId(products[2], 1);
                  qs.setQuestVar(9);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 1864);
                } else {
                  int checkFailId = 3398;
                  if (player.getRecipeList().isRecipePresent(recipesIds[2])) checkFailId = 2716;
                  else if (player.getInventory().getItemCountByItemId(recipesItemIds[2]) > 0)
                    checkFailId = 3057;

                  if (checkFailId == 3398) {
                    qs.setQuestVar(7);
                    updateQuestStatus(env);
                  }
                  return sendQuestDialog(env, checkFailId);
                }
              }
              break;
            case 10040:
              if (var == 11) {
                if (player.getInventory().getItemCountByItemId(products[3]) > 0) {
                  player.getInventory().removeFromBagByItemId(products[3], 1);
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 5);
                } else {
                  int checkFailId = 3398;
                  if (player.getRecipeList().isRecipePresent(recipesIds[3])) checkFailId = 2716;
                  else if (player.getInventory().getItemCountByItemId(recipesItemIds[3]) > 0)
                    checkFailId = 3057;

                  if (checkFailId == 3398) {
                    qs.setQuestVar(10);
                    updateQuestStatus(env);
                  }
                  return sendQuestDialog(env, checkFailId);
                }
              }
              break;
          }
      }
    }
    return defaultQuestRewardDialog(env, questStartNpc, 0);
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    if (player.getLevel() <= 50) return sendQuestDialog(env, 1008);
    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    QuestTemplate template = questsData.getQuestById(questId);

    if (targetId == 798914) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 2) {
          PlayerClass playerClass = player.getCommonData().getPlayerClass();
          if (playerClass == PlayerClass.GLADIATOR
              || playerClass == PlayerClass.TEMPLAR
              || playerClass == PlayerClass.WARRIOR) {
            env.setQuestId(questId);
            QuestService.startQuest(env, QuestStatus.START);
            return true;
          } else {
            return sendQuestDialog(env, 3739);
          }
        }
      } else if (qs != null && qs.getStatus() == QuestStatus.START) {
        if (env.getDialogId() == 2) {
          return sendQuestDialog(env, 1011);
        } else if (env.getDialogId() == 10000) {
          if (player.getInventory().getItemCountByItemId(186000018) >= 1800) {
            qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
            player.getInventory().removeFromBagByItemId(186000018, 1800);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 5);
          } else {
            return sendQuestDialog(env, 1009);
          }
        } else if (env.getDialogId() == 10001) {
          if (player.getInventory().getItemCountByItemId(186000018) >= 1200) {
            qs.setQuestVarById(0, qs.getQuestVarById(0) + 2);
            player.getInventory().removeFromBagByItemId(186000018, 1200);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 6);
          } else {
            return sendQuestDialog(env, 1009);
          }
        } else if (env.getDialogId() == 10002) {
          if (player.getInventory().getItemCountByItemId(186000018) >= 900) {
            qs.setQuestVarById(0, qs.getQuestVarById(0) + 3);
            player.getInventory().removeFromBagByItemId(186000018, 900);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 7);
          } else {
            return sendQuestDialog(env, 1009);
          }
        } else if (env.getDialogId() == 10003) {
          if (player.getInventory().getItemCountByItemId(186000018) >= 600) {
            qs.setQuestVarById(0, qs.getQuestVarById(0) + 4);
            player.getInventory().removeFromBagByItemId(186000018, 600);
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 8);
          } else {
            return sendQuestDialog(env, 1009);
          }
        }
      } else if (qs.getStatus() == QuestStatus.COMPLETE) {
        if (env.getDialogId() == 2) {
          if ((qs.getCompleteCount() <= template.getMaxRepeatCount())) {
            env.setQuestId(questId);
            QuestService.startQuest(env, QuestStatus.START);
            return true;
          } else return sendQuestDialog(env, 1008);
        }
      } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
        return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
Ejemplo n.º 28
0
  @Override
  public boolean onDialogEvent(final QuestCookie env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null) return false;

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

    if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 203903) {
        if (env.getDialogId() == -1) return sendQuestDialog(env, 2375);
        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 == 203903) {
      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 == 204032) {
      switch (env.getDialogId()) {
        case 26:
          if (var == 1) return sendQuestDialog(env, 1352);
          else if (var == 3) return sendQuestDialog(env, 1693);
          else if (var == 4) return sendQuestDialog(env, 2034);
        case 34:
          if (QuestService.collectItemCheck(env, true)) {
            qs.setStatus(QuestStatus.REWARD);
            updateQuestStatus(env);
            return sendQuestDialog(env, 2035);
          } else return sendQuestDialog(env, 2120);
        case 1353:
          PacketSendUtility.sendPacket(player, new SM_PLAY_MOVIE(0, 179));
          break;
        case 10001:
          if (var == 1) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
        case 10002:
          if (var == 3) {
            qs.setQuestVarById(0, var + 1);
            updateQuestStatus(env);
            PacketSendUtility.sendPacket(
                player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
            return true;
          }
      }
    } else if (targetId == 700149 && var == 2) {
      if (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.getQuestStateList().getQuestState(questId).getQuestVarById(0) == 2) {
                      PacketSendUtility.sendPacket(
                          player, new SM_USE_OBJECT(player.getObjectId(), targetObjectId, 3000, 0));
                      PacketSendUtility.broadcastPacket(
                          player,
                          new SM_EMOTION(player, EmotionType.START_LOOT, 0, targetObjectId),
                          true);
                      qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
                      updateQuestStatus(env);
                    }
                  }
                },
                3000);
      }
    }
    return false;
  }
Ejemplo n.º 29
0
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (targetId == 204327) // Sveinn
   {
     if (qs == null || qs.getStatus() == QuestStatus.NONE) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 4762);
       else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 0) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1011);
       else if (env.getDialogId() == 10000) {
         qs.setQuestVar(2);
         ItemService.addItems(player, Collections.singletonList(new QuestItems(182204221, 1)));
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else if (env.getDialogId() == 10002) {
         qs.setQuestVar(2);
         ItemService.addItems(player, Collections.singletonList(new QuestItems(182204221, 1)));
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else if (env.getDialogId() == 10006) {
         qs.setQuestVar(2);
         ItemService.addItems(player, Collections.singletonList(new QuestItems(182204221, 1)));
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       player.getInventory().removeFromBagByItemId(182204222, 1);
       return defaultQuestEndDialog(env);
     }
   } else if (targetId == 204377) // Grall
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 2) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 1693);
       else if (env.getDialogId() == 1009) {
         qs.setQuestVar(4);
         player.getInventory().removeFromBagByItemId(182204221, 1);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 798078) // Hugorunerk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 4) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2034);
       else if (env.getDialogId() == 10003) {
         qs.setQuestVar(5);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 798081) // Pararinirerk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 5) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2375);
       else if (env.getDialogId() == 10004) {
         qs.setQuestVar(6);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 798082) // Bicorunerk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 6) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 2716);
       else if (env.getDialogId() == 10005) {
         qs.setQuestVar(8);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     }
   } else if (targetId == 204300) // Bolverk
   {
     if (qs != null && qs.getStatus() == QuestStatus.START && qs.getQuestVarById(0) == 8) {
       if (env.getDialogId() == 26) return sendQuestDialog(env, 3057);
       else if (env.getDialogId() == 1009) // Need check Item
       {
         qs.setStatus(QuestStatus.REWARD);
         updateQuestStatus(env);
         PacketSendUtility.sendPacket(
             player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
         return true;
       } else return defaultQuestStartDialog(env);
     } else if (qs != null && qs.getStatus() == QuestStatus.REWARD) {
       player.getInventory().removeFromBagByItemId(182204222, 1);
       return defaultQuestEndDialog(env);
     }
   }
   return false;
 }
Ejemplo n.º 30
0
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    if (!super.defaultQuestOnDialogInitStart(env)) return false;

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

    if (qs.getStatus() == QuestStatus.START) {
      switch (env.getTargetId()) {
        case 204053:
          {
            switch (env.getDialogId()) {
              case 26:
                if (var == 0) return sendQuestDialog(env, 1011);
              case 10010:
                return defaultCloseDialog(env, 0, 1);
              case 10011:
                return defaultCloseDialog(env, 0, 4);
              case 10012:
                return defaultCloseDialog(env, 0, 9);
              case 34:
                if (var == 1 || var == 4 || var == 9) {
                  qs.setQuestVarById(0, 0);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 2375);
                }
            }
          }
          break;
        case 204301:
          {
            switch (env.getDialogId()) {
              case 26:
                if (var == 1) return sendQuestDialog(env, 1352);
                else if (var == 2) return sendQuestDialog(env, 3398);
                else if (var == 7) return sendQuestDialog(env, 3739);
                else return defaultQuestItemCheck(env, 9, 0, true, 7, 4080);
              case 10001:
                return defaultCloseDialog(env, 1, 2);
              case 1009:
                if (var == 2) {
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 5);
                }
                if (var == 7) {
                  qs.setStatus(QuestStatus.REWARD);
                  updateQuestStatus(env);
                  return sendQuestDialog(env, 6);
                }
            }
          }
          break;
        case 204089:
          {
            switch (env.getDialogId()) {
              case 26:
                if (var == 4) return sendQuestDialog(env, 1693);
                else if (var == 5) return sendQuestDialog(env, 2034);
              case 10002:
                if (defaultCloseDialog(env, 4, 5)) {
                  TeleportService.teleportTo(player, 320090000, 1, 276, 293, 163, (byte) 90, 500);
                  return true;
                } else return false;
              case 10003:
                if (var == 5) {
                  qs.setQuestVarById(0, 7);
                  updateQuestStatus(env);
                  PacketSendUtility.sendPacket(
                      player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 0));
                  return true;
                } else return false;
            }
          }
          break;
        case 700368:
        case 700369:
          if (env.getDialogId() == -1)
            return (defaultQuestUseNpc(
                env, 5, 6, EmotionType.NEUTRALMODE2, EmotionType.START_LOOT, false));
          break;
        case 700268:
          if (env.getDialogId() == -1)
            return (defaultQuestUseNpc(
                env, 9, 10, EmotionType.NEUTRALMODE2, EmotionType.START_LOOT, true));
          break;
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (var == 2) return defaultQuestRewardDialog(env, 204301, 3739);
      else if (var == 7) return defaultQuestRewardDialog(env, 204301, 3739, 1);
      else if (var == 9) return defaultQuestRewardDialog(env, 204301, 3739, 2);
    }
    return false;
  }