示例#1
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;
  }
  @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 == 799336) // Tataka
      {
        if (env.getDialogId() == 26) {
          return sendQuestDialog(env, 1011);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

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

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 799336: // Tataka
          switch (env.getDialogId()) {
            case 26:
              return sendQuestDialog(env, 2375);
            case 2034:
              return sendQuestDialog(env, 2034);
            case 34:
              // Siel's Supreme Mace (1)
              // Noxallon Ingot (1)
              if (QuestService.collectItemCheck(env, true)) {
                player.getInventory().removeFromBagByItemId(100100679, 1); // Siel's Supreme Mace
                player.getInventory().removeFromBagByItemId(186000095, 1); // Noxallon Ingot
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 5);
              } else {
                // Send check_user_item_fail to eddit-HtmlPages.xml
                return sendQuestDialog(env, 2716);
              }
          }
          break;
          // No match
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799336) // Tataka
      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) {
     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) {
    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;
  }
  @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 == 799017) // Sulinia
      {
        if (env.getDialogId() == 26) {
          return sendQuestDialog(env, 1011);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

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

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 799017: // Sulinia
          switch (env.getDialogId()) {
            case 26:
              return sendQuestDialog(env, 2375);
            case 2034:
              return sendQuestDialog(env, 2034);
            case 34:
              // Collect Balic Outer Scale (30)
              // Collect Kinah (150000)
              if (QuestService.collectItemCheck(env, true)) {
                player.getInventory().removeFromBagByItemId(182206839, 30);
                player.getInventory().removeFromBagByItemId(182400001, 150000);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
                return sendQuestDialog(env, 5);
              } else {
                //
                return sendQuestDialog(env, 2716);
              }
          }
          break;
          //
        default:
          return defaultQuestStartDialog(env);
      }
    } else if (qs.getStatus() == QuestStatus.REWARD) {
      if (targetId == 799017) // Sulinia
      return defaultQuestEndDialog(env);
    }
    return false;
  }
 @Override
 public boolean onDialogEvent(QuestCookie env) {
   final Player player = env.getPlayer();
   int targetId = 0;
   if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
   final QuestState qs = player.getQuestStateList().getQuestState(questId);
   QuestTemplate template = questsData.getQuestById(questId);
   if (targetId == 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 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;
  }
 @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;
   }
 }
  @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 == 216527) // Lupukin
      {
        if (env.getDialogId() == 26) {
          return sendQuestDialog(env, 1011);
        } else return defaultQuestStartDialog(env);
      }
    }

    if (qs == null) return false;

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

    if (qs.getStatus() == QuestStatus.START) {
      switch (targetId) {
        case 216527: // Lupukin
          switch (env.getDialogId()) {
            case 26:
              return sendQuestDialog(env, 2375);
            case 2034:
              return sendQuestDialog(env, 2034);
            case 34:
              // Collect Balaur Relics (6)
              if (QuestService.collectItemCheck(env, true)) {
                player.getInventory().removeFromBagByItemId(182209621, 6); // Balaur Relics
                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 == 216527) // Lupukin
      return defaultQuestEndDialog(env);
    }
    return false;
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);

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

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

    if (qs == null) return false;

    if (qs.getStatus() == QuestStatus.REWARD) {
      switch (targetId) {
        case 790019:
          {
            switch (env.getDialogId()) {
              case 26:
                {
                  return sendQuestDialog(env, 10002);
                }
              case 1009:
                {
                  return sendQuestDialog(env, 5);
                }
              default:
                return defaultQuestEndDialog(env);
            }
          }
      }
    }
    return false;
  }
示例#11
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;
  }
示例#12
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);
  }
 @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;
 }
  @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);
  }
  @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) {
    final Player player = env.getPlayer();
    QuestState qs = player.getQuestStateList().getQuestState(questId);

    int targetId = 0;
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();
    if (targetId == 0) {
      if (env.getDialogId() == 1002) {
        QuestService.startQuest(env, QuestStatus.START);
        PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(0, 0));
        return true;
      }
    } else if (targetId == 799939) // Emma
    {
      if (qs != null) {
        if (env.getDialogId() == 26 && qs.getStatus() == QuestStatus.START) {
          return sendQuestDialog(env, 2375);
        } else if (env.getDialogId() == 1009) {
          qs.setQuestVar(1);
          qs.setStatus(QuestStatus.REWARD);
          updateQuestStatus(env);
          return defaultQuestEndDialog(env);
        } else return defaultQuestEndDialog(env);
      }
    }
    return false;
  }
  @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;
  }
示例#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 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 != 182201783 || qs == null) return HandlerResult.UNKNOWN;

    int var = qs.getQuestVars().getQuestVars();
    if (var != 0 || qs.getStatus() != QuestStatus.START) return HandlerResult.FAILED;

    if (MathUtil.getDistance(
            1677,
            2520,
            100,
            player.getPosition().getX(),
            player.getPosition().getY(),
            player.getPosition().getZ())
        > 5) return HandlerResult.FAILED;

    int itemId1 = 110100150;
    int itemId2 = 113100144;
    boolean CheckitemId1 = false;
    boolean CheckitemId2 = false;

    List<Item> items1 = player.getEquipment().getEquippedItemsByItemId(itemId1);
    for (@SuppressWarnings("unused") Item ListeCheckitemId1 : items1) {
      CheckitemId1 = true;
    }

    List<Item> items2 = player.getEquipment().getEquippedItemsByItemId(itemId2);
    for (@SuppressWarnings("unused") Item ListeCheckitemId2 : items2) {
      CheckitemId2 = true;
    }

    if (!CheckitemId1 && CheckitemId2
        || CheckitemId1 && !CheckitemId2
        || !CheckitemId1 && !CheckitemId2) 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().removeFromBagByObjectId(itemObjId, 1);
                qs.setStatus(QuestStatus.REWARD);
                updateQuestStatus(env);
              }
            },
            3000);
    return HandlerResult.SUCCESS;
  }
  @Override
  public boolean onDialogEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    int targetId = 0;
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId();

    if (targetId == mainNpcId) {
      if (qs == null || qs.getStatus() == QuestStatus.NONE) {
        if (env.getDialogId() == 26) return sendQuestDialog(env, 4762);
        else return defaultQuestStartDialog(env);
      } else if (qs.getStatus() == QuestStatus.REWARD) {
        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 (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;
 }
示例#22
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 onLvlUpEvent(QuestCookie env) {
    final Player player = env.getPlayer();
    final QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs != null) return false;

    QuestState qs2 = player.getQuestStateList().getQuestState(11008);
    if (qs2 == null || qs2.getStatus() != QuestStatus.COMPLETE) return false;
    env.setQuestId(questId);
    QuestService.startQuest(env, QuestStatus.START);
    return true;
  }
 @Override
 public boolean onLvlUpEvent(QuestCookie env) {
   Player player = env.getPlayer();
   QuestState qs = player.getQuestStateList().getQuestState(questId);
   if (qs == null || qs.getStatus() == QuestStatus.NONE) {
     boolean lvlCheck =
         QuestService.checkLevelRequirement(questId, player.getCommonData().getLevel());
     if (!lvlCheck) return false;
     QuestService.startQuest(env, QuestStatus.REWARD);
     return true;
   }
   return false;
 }
示例#25
0
 @Override
 protected void writeImpl(AionConnection con, ByteBuffer buf) {
   writeH(buf, 0x01);
   writeH(buf, (-1 * startedQuestList.size()) & 0xFFFF);
   for (QuestState qs : startedQuestList) // quest list size ( retail max is 30 )
   {
     writeH(buf, qs.getQuestId());
     writeH(buf, 0);
     writeC(buf, qs.getStatus().value());
     writeD(buf, qs.getQuestVars().getQuestVars());
     writeC(buf, 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;
 }
示例#27
0
  public static boolean checkNearBy(QuestCookie env, int levelDiff) {
    Player player = env.getPlayer();
    QuestTemplate template = questsData.getQuestById(env.getQuestId());

    if (template == null) return false;

    if (template.getRacePermitted() != null) {
      if (template.getRacePermitted().ordinal() != player.getCommonData().getRace().ordinal())
        return false;
    }

    // min level - 2 so that the gray quest arrow shows when quest is almost available
    if (player.getLevel() < template.getMinlevelPermitted() - levelDiff) return false;

    if (template.getMaxlevelPermitted() != 0 && player.getLevel() > template.getMaxlevelPermitted())
      return false;

    if (!template.isWeeklyActive()) return false;

    if (template.getClassPermitted().size() != 0) {
      if (!template.getClassPermitted().contains(player.getCommonData().getPlayerClass()))
        return false;
    }

    if (template.getGenderPermitted() != null) {
      if (template.getGenderPermitted().ordinal() != player.getGender().ordinal()) return false;
    }

    QuestState qs = player.getQuestStateList().getQuestState(template.getId());
    if (qs != null) {
      if (qs.canRepeat(template.getMaxRepeatCount())) return true;
      else if (qs.getStatus() != QuestStatus.LOCKED && qs.getStatus() != QuestStatus.NONE)
        return false;
    }
    return true;
  }
示例#28
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;
  }
示例#29
0
  /**
   * Check if a player is doing a quest for the given drop.
   *
   * @param player
   * @param drop
   * @return
   */
  private static boolean hasQuestForDrop(Player player, QuestDrop drop) {
    int questId = drop.getQuestId();
    QuestState qs = player.getQuestStateList().getQuestState(questId);
    if (qs == null || qs.getStatus() != QuestStatus.START) return false;
    QuestTemplate template = questsData.getQuestById(questId);
    CollectItems collectItems = template.getCollectItems();
    if (collectItems == null) return true;

    for (CollectItem collectItem : collectItems.getCollectItem()) {
      int collectItemId = collectItem.getItemId();
      int dropItemId = drop.getItemId();
      if (collectItemId != dropItemId) continue;
      long count = player.getInventory().getItemCountByItemId(collectItemId);
      if (collectItem.getCount() > count) return true;
    }
    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;
  }