예제 #1
0
  public void makeSubQuests() {
    Player player = getSelf();
    if (player == null) {
      return;
    }
    Quest q = QuestManager.getQuest(_234_FatesWhisper.class);
    QuestState qs = player.getQuestState(q.getClass());
    if (qs != null) {
      qs.exitCurrentQuest(true);
    }
    q.newQuestState(player, Quest.COMPLETED);

    if (player.getRace() == Race.kamael) {
      q = QuestManager.getQuest("_236_SeedsOfChaos");
      qs = player.getQuestState(q.getClass());
      if (qs != null) {
        qs.exitCurrentQuest(true);
      }
      q.newQuestState(player, Quest.COMPLETED);
    } else {
      q = QuestManager.getQuest("_235_MimirsElixir");
      qs = player.getQuestState(q.getClass());
      if (qs != null) {
        qs.exitCurrentQuest(true);
      }
      q.newQuestState(player, Quest.COMPLETED);
    }
  }
예제 #2
0
 /** Используется для однодневных квестов */
 public void exitCurrentQuest(Quest quest) {
   Player player = getPlayer();
   exitCurrentQuest(true);
   quest.newQuestState(player, Quest.DELAYED);
   QuestState qs = player.getQuestState(quest.getClass());
   qs.setRestartTime();
 }
예제 #3
0
 private boolean cmd_Show(Quest _quest, String[] wordList, Player activeChar) {
   // quest id|name SHOW [target]
   Player targetChar = getTargetChar(wordList, 3, activeChar);
   QuestState qs = targetChar.getQuestState(_quest.getName());
   if (qs == null) {
     activeChar.sendMessage(
         "Player " + targetChar.getName() + " havn't Quest [" + _quest.getName() + "]");
     return false;
   }
   return ShowQuestState(qs, activeChar);
 }
예제 #4
0
 private boolean cmd_Clear(Quest _quest, String[] wordList, Player activeChar) {
   // quest id|name CLEAR [target]
   Player targetChar = getTargetChar(wordList, 3, activeChar);
   QuestState qs = targetChar.getQuestState(_quest.getName());
   if (qs == null) {
     activeChar.sendMessage(
         "Player " + targetChar.getName() + " havn't Quest [" + _quest.getName() + "]");
     return false;
   }
   qs.exitCurrentQuest(true);
   return ShowQuestList(targetChar, activeChar);
 }
예제 #5
0
 @Override
 public void onZoneEnter(Zone zone, Creature cha) {
   if (cha.isPlayer()) {
     Player player = cha.getPlayer();
     if (!player.getVarB("@ti_present_video")) {
       QuestState qs = player.getQuestState(_10320_LetsGototheCentralSquare.class);
       if (qs != null && qs.getCond() == 1) player.showQuestMovie(SceneMovie.si_illusion_02_que);
       else player.showQuestMovie(SceneMovie.si_illusion_01_que);
       player.setVar("@ti_present_video", "true", -1);
     }
   }
 }
예제 #6
0
 private boolean checkPartyMember(Player member, int state, int maxrange, GameObject rangefrom) {
   if (member == null) {
     return false;
   }
   if ((rangefrom != null) && (maxrange > 0) && !member.isInRange(rangefrom, maxrange)) {
     return false;
   }
   QuestState qs = member.getQuestState(getQuest().getName());
   if ((qs == null) || (qs.getState() != state)) {
     return false;
   }
   return true;
 }
예제 #7
0
  private boolean cmd_Var(Quest _quest, String[] wordList, Player activeChar) {
    if (wordList.length < 5) {
      activeChar.sendMessage("USAGE: //quest id|name VAR varname newvalue [target]");
      return false;
    }

    Player targetChar = getTargetChar(wordList, 5, activeChar);
    QuestState qs = targetChar.getQuestState(_quest.getName());
    if (qs == null) {
      activeChar.sendMessage(
          "Player "
              + targetChar.getName()
              + " havn't Quest ["
              + _quest.getName()
              + "], init quest by command:");
      activeChar.sendMessage("//quest id|name STATE 1|2|3 [target]");
      return false;
    }
    if (wordList[4].equalsIgnoreCase("~") || wordList[4].equalsIgnoreCase("#"))
      qs.unset(wordList[3]);
    else qs.set(wordList[3], wordList[4]);
    return ShowQuestState(qs, activeChar);
  }
예제 #8
0
  private boolean cmd_State(Quest _quest, String[] wordList, Player activeChar) {
    if (wordList.length < 4) {
      activeChar.sendMessage("USAGE: //quest id|name STATE 1|2|3 [target]");
      return false;
    }

    int state = 0;
    try {
      state = Integer.parseInt(wordList[3]);
    } catch (Exception e) {
      activeChar.sendMessage("Wrong State ID: " + wordList[3]);
      return false;
    }

    Player targetChar = getTargetChar(wordList, 4, activeChar);
    QuestState qs = targetChar.getQuestState(_quest.getName());
    if (qs == null) {
      activeChar.sendMessage("Init Quest [" + _quest.getName() + "] for " + targetChar.getName());
      qs = _quest.newQuestState(targetChar, state);
      qs.set("cond", "1");
    } else qs.setState(state);

    return ShowQuestState(qs, activeChar);
  }
예제 #9
0
    @Override
    public void onKill(Creature actor, Creature victim) {
      if (!victim.isPlayer()) {
        return;
      }

      Player actorPlayer = (Player) actor;
      List<Player> players = null;
      switch (_quest.getParty()) {
        case Quest.PARTY_NONE:
          players = Collections.singletonList(actorPlayer);
          break;
        case Quest.PARTY_ALL:
          if (actorPlayer.getParty() == null) {
            players = Collections.singletonList(actorPlayer);
          } else {
            players = new ArrayList<Player>(actorPlayer.getParty().getMemberCount());
            for (Player member : actorPlayer.getParty().getPartyMembers()) {
              if (member.isInRange(actorPlayer, Creature.INTERACTION_DISTANCE)) {
                players.add(member);
              }
            }
          }
          break;
        default:
          players = Collections.emptyList();
          break;
      }

      for (Player player : players) {
        QuestState questState = player.getQuestState(_quest.getClass());
        if ((questState != null) && !questState.isCompleted()) {
          _quest.notifyKill((Player) victim, questState);
        }
      }
    }