@Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    UndergroundColiseumEvent coliseumEvent =
        EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, _coliseumId);

    if (command.equals("register")) {
      Party party = player.getParty();
      if (party == null) showChatWindow(player, "events/kerthang_manager008.htm");
      else if (party.getPartyLeader() != player)
        showChatWindow(player, "events/kerthang_manager004.htm");
      else
        for (Player $player : party)
          if ($player.getLevel() < coliseumEvent.getMinLevel()
              || $player.getLevel() > coliseumEvent.getMaxLevel()) {
            showChatWindow(player, "events/kerthang_manager011.htm", "%name%", $player.getName());
            return;
          }
    } else if (command.equals("viewTeams")) {

      List<Player> reg = coliseumEvent.getRegisteredPlayers();

      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("events/kerthang_manager003.htm");
      for (int i = 0; i < 5; i++) {
        Player $player = CollectionUtils.safeGet(reg, i);

        msg.replace("%team" + i + "%", $player == null ? StringUtils.EMPTY : $player.getName());
      }

      player.sendPacket(msg);
    } else super.onBypassFeedback(player, command);
  }
  @Override
  protected void runImpl() {
    Player activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    if (_mode < 0 || _mode > Party.ITEM_ORDER_SPOIL) return;

    Party party = activeChar.getParty();
    if (party == null
        || _mode == party.getLootDistribution()
        || party.getPartyLeader() != activeChar) return;

    party.requestLootChange(_mode);
  }
Ejemplo n.º 3
0
 /**
  * Этот метод рассчитывает количество дропнутых вещей в зависимости от рейтов. <br>
  * <br>
  * Следует учесть, что контроль за верхним пределом вещей в квестах, в которых нужно набить
  * определенное количество предметов не осуществляется. <br>
  * <br>
  * Ни один из передаваемых параметров не должен быть равен 0
  *
  * @param min минимальное количество при рейтах 1х
  * @param max максимальное количество при рейтах 1х
  * @param calcChance шанс при рейтах 1х, в процентах
  * @return количество вещей для дропа, может быть 0
  */
 public int rollDrop(int min, int max, double calcChance) {
   if ((calcChance <= 0) || (min <= 0) || (max <= 0)) {
     return 0;
   }
   int dropmult = 1;
   calcChance *= getRateQuestsDrop();
   if (getQuest().getParty() > Quest.PARTY_NONE) {
     Player player = getPlayer();
     if (player.getParty() != null) {
       calcChance *=
           Config.ALT_PARTY_BONUS[
               player.getParty().getMemberCountInRange(player, Config.ALT_PARTY_DISTRIBUTION_RANGE)
                   - 1];
     }
   }
   if (calcChance > 100) {
     if ((int) Math.ceil(calcChance / 100) <= (calcChance / 100)) {
       calcChance = Math.nextUp(calcChance);
     }
     dropmult = (int) Math.ceil(calcChance / 100);
     calcChance = calcChance / dropmult;
   }
   return Rnd.chance(calcChance) ? Rnd.get(min * dropmult, max * dropmult) : 0;
 }
Ejemplo n.º 4
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);
        }
      }
    }
Ejemplo n.º 5
0
  public static boolean checkPlayer(Player player) {
    if (player.isDead()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledDead", player), player);
      return false;
    }

    if (player.getTeam() != TeamType.NONE) {
      show(new CustomMessage("scripts.events.Hitman.CancelledOtherEvent", player), player);
      return false;
    }

    if (player.isMounted()) {
      show(new CustomMessage("scripts.events.Hitman.Cancelled", player), player);
      return false;
    }

    if (player.isCursedWeaponEquipped()) {
      show(new CustomMessage("scripts.events.Hitman.Cancelled", player), player);
      return false;
    }

    if (player.isInDuel()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledDuel", player), player);
      return false;
    }

    if (player.getOlympiadGame() != null || Olympiad.isRegistered(player)) {
      show(new CustomMessage("scripts.events.Hitman.CancelledOlympiad", player), player);
      return false;
    }

    if (player.isInParty() && player.getParty().isInDimensionalRift()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledOtherEvent", player), player);
      return false;
    }

    if (player.isInObserverMode()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledObserver", player), player);
      return false;
    }

    if (player.isTeleporting()) {
      show(new CustomMessage("scripts.events.Hitman.CancelledTeleport", player), player);
      return false;
    }

    return true;
  }
Ejemplo n.º 6
0
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();
    if (actor == null) {
      return true;
    }

    for (Player player : World.getAroundPlayers(actor, 500, 500)) {
      if (player == null || !player.isInParty()) {
        continue;
      }

      if (player.getParty().getMemberCount() >= 5 && _tele) {
        _tele = false;
        player.teleToLocation(Rnd.get(locs));
      }
    }

    return true;
  }