Exemple #1
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;
 }
Exemple #2
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);
        }
      }
    }