Example #1
0
 /**
  * Constructs new <tt>SM_MESSAGE </tt> packet
  *
  * @param player who sent message
  * @param message actual message
  * @param chatType what chat type should be used
  */
 public SM_MESSAGE(Player player, String message, ChatType chatType) {
   this.player = player;
   this.senderObjectId = player.getObjectId();
   this.senderName = player.getName();
   this.message = message;
   this.race = player.getCommonData().getRace();
   this.chatType = chatType;
   this.x = player.getX();
   this.y = player.getY();
   this.z = player.getZ();
 }
 public void SpawnFront(Player player) {
   double radian = Math.toRadians(MathUtil.convertHeadingToDegree(player.getHeading()));
   float x1 = (float) (Math.cos(Math.PI * 0 + radian) * 5);
   float y1 = (float) (Math.sin(Math.PI * 0 + radian) * 5);
   attacktransformedPlayer(
       player,
       (Npc)
           spawn(
               231193,
               (player.getX() + x1),
               (player.getY() + y1),
               player.getZ(),
               (byte) player.getHeading()));
 }
  /** @param player */
  public static void onPlayerLogin(Player player) {
    int worldId = player.getWorldId();

    WorldMapTemplate worldTemplate = DataManager.WORLD_MAPS_DATA.getTemplate(worldId);
    if (worldTemplate.isInstance()) {
      PortalTemplate portalTemplate =
          DataManager.PORTAL_DATA.getInstancePortalTemplate(
              worldId, player.getCommonData().getRace());

      if (portalTemplate == null) {
        log.error("No portal template found for " + worldId);
        return;
      }

      int lookupId = player.getObjectId();
      if (portalTemplate.isGroup() && player.getPlayerGroup() != null) {
        lookupId = player.getPlayerGroup().getGroupId();
      }

      WorldMapInstance registeredInstance = getRegisteredInstance(worldId, lookupId);
      if (registeredInstance != null) {
        World.getInstance()
            .setPosition(
                player,
                worldId,
                registeredInstance.getInstanceId(),
                player.getX(),
                player.getY(),
                player.getZ(),
                player.getHeading());
        return;
      }

      moveToEntryPoint(player, portalTemplate, false);
    }
  }
Example #4
0
  public void executeCommand(Player admin, String[] params) {
    if (params == null || params.length < 1) {
      PacketSendUtility.sendMessage(admin, "syntax //bind < all | elyos | asmos >");
      return;
    }

    if (params[0].equals("all")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLALL) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          teleportService.teleportTo(
              p,
              admin.getWorldId(),
              admin.getInstanceId(),
              admin.getX(),
              admin.getY(),
              admin.getZ(),
              admin.getHeading(),
              5);
          PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

          PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
          PacketSendUtility.sendMessage(p, "Vous avez ete teleporte par " + admin.getName() + ".");
        }
      }
    }

    if (params[0].equals("elyos")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLELYOS) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          if (p.getCommonData().getRace() == Race.ELYOS) {
            teleportService.teleportTo(
                p,
                admin.getWorldId(),
                admin.getInstanceId(),
                admin.getX(),
                admin.getY(),
                admin.getZ(),
                admin.getHeading(),
                5);
            PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

            PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
            PacketSendUtility.sendMessage(
                p, "Vous avez ete teleporte par " + admin.getName() + ".");
          }
        }
      }
    }

    if (params[0].equals("asmos")) {
      if (admin.getAccessLevel() < AdminConfig.COMMAND_MOVETOMEALLASMOS) {
        PacketSendUtility.sendMessage(admin, "You dont have enough rights to execute this command");
        return;
      }

      World world = admin.getActiveRegion().getWorld();
      Iterator<Player> players = world.getPlayersIterator();
      while (players.hasNext()) {
        Player p = players.next();
        if (!p.equals(admin)) {
          if (p.getCommonData().getRace() == Race.ASMODIANS) {
            teleportService.teleportTo(
                p,
                admin.getWorldId(),
                admin.getInstanceId(),
                admin.getX(),
                admin.getY(),
                admin.getZ(),
                admin.getHeading(),
                5);
            PacketSendUtility.sendPacket(p, new SM_PLAYER_SPAWN(p));

            PacketSendUtility.sendMessage(admin, "Player " + p.getName() + " teleported.");
            PacketSendUtility.sendMessage(
                p, "Vous avez ete teleporte par " + admin.getName() + ".");
          }
        }
      }
    }
  }