コード例 #1
0
ファイル: QuestState.java プロジェクト: Skunkk/l2j-universe
 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;
 }
コード例 #2
0
ファイル: QuestState.java プロジェクト: Skunkk/l2j-universe
    @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);
        }
      }
    }