Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.Location


      private int _hp;

      public SiegeSpawn(int castle_id, int x, int y, int z, int heading, int npc_id)
      {
        _castleId = castle_id;
        _location = new Location(x,y,z,heading);
        _heading = heading;
        _npcId = npc_id;
      }
View Full Code Here


      }

      public SiegeSpawn(int castle_id, int x, int y, int z, int heading, int npc_id, int hp)
      {
        _castleId = castle_id;
        _location = new Location(x,y,z,heading);
        _heading = heading;
        _npcId = npc_id;
        _hp = hp;
      }
View Full Code Here

        {
            L2PcInstance player = ((L2PcInstance)activeChar);

            // If in Monster Derby Track
            if (player.isInsideZone(L2Character.ZONE_MONSTERTRACK))
                return new Location(12661, 181687, -3560);

            Castle castle = null;
            ClanHall clanhall = null;

            if (player.getClan() != null)
            {
              // If teleport to clan hall
              if (teleportWhere == TeleportWhereType.ClanHall)
                {

                  clanhall = ClanHallManager.getInstance().getClanHallByOwner(player.getClan());
                  if (clanhall != null)
                  {
                    L2ClanHallZone zone = clanhall.getZone();
                      if (zone != null)
                      {
                          return zone.getSpawn();
                      }
                  }
                }

              // If teleport to castle
              if (teleportWhere == TeleportWhereType.Castle) castle = CastleManager.getInstance().getCastleByOwner(player.getClan());

              // Check if player is on castle ground
                if (castle == null) castle = CastleManager.getInstance().getCastle(player);

              if (castle != null && castle.getCastleId() > 0)
                {
                // If Teleporting to castle or
                // If is on caslte with siege and player's clan is defender
                if (teleportWhere == TeleportWhereType.Castle || (teleportWhere == TeleportWhereType.Castle && castle.getSiege().getIsInProgress() && castle.getSiege().getDefenderClan(player.getClan()) != null))
                {
                   coord = castle.getZone().getSpawn();
                  return new Location(coord[0], coord[1], coord[2]);
                }

                if (teleportWhere == TeleportWhereType.SiegeFlag && castle.getSiege().getIsInProgress())
                    {
                        // Check if player's clan is attacker
                        List<L2NpcInstance> flags = castle.getSiege().getFlag(player.getClan());
                        if (flags != null && !flags.isEmpty())
                        {
                            // Spawn to flag - Need more work to get player to the nearest flag
                            L2NpcInstance flag = flags.get(0);
                            return new Location(flag.getX(), flag.getY(), flag.getZ());
                        }
                    }
                }
            }

            // teleport RED PK 5+ to Floran Village
            if(player.getPkKills() > 5 && player.getKarma() > 1) return new Location(17817, 170079, -3530);
      //Karma player land out of city
            if(player.getKarma() > 1)
            {
                int closest =  getMapRegion(activeChar.getX(), activeChar.getY());
                if(closest >= 0 && closest < _pointsWithKarmas.length)
                  return new Location(_pointsWithKarmas[closest][0], _pointsWithKarmas[closest][1], _pointsWithKarmas[closest][2]);
        return new Location(17817, 170079, -3530);
            }

            // Checking if in arena
            L2ArenaZone arena = ArenaManager.getInstance().getArena(player);
            if (arena != null)
            {
                coord = arena.getSpawnLoc();
                return new Location(coord[0], coord[1], coord[2]);
            }
        }

        // Get the nearest town
        // TODO: Micht: Maybe we should add some checks to prevent exception here.
        coord = TownManager.getInstance().getClosestTown(activeChar).getSpawnLoc();

        return new Location(coord[0], coord[1], coord[2]);
    }
View Full Code Here

     * @see net.sf.l2j.gameserver.GeoData#moveCheck(int, int, int, int, int, int)
     */
    @Override
    public Location moveCheck(int x, int y, int z, int tx, int ty, int tz)
    {
      Location startpoint = new Location(x,y,z);
      if (DoorTable.getInstance().checkIfDoorsBetween(x,y,z,tx,ty,tz))
        return startpoint;

      Location destiny = new Location(tx,ty,tz);
        return moveCheck(startpoint, destiny,(x - L2World.MAP_MIN_X) >> 4,(y - L2World.MAP_MIN_Y) >> 4,z,(tx - L2World.MAP_MIN_X) >> 4,(ty - L2World.MAP_MIN_Y) >> 4,tz);
    }
View Full Code Here

                next_x += inc_x;
                next_y += inc_y;
                //_log.warning("2: next_x:"+next_x+" next_y"+next_y);
                tempz = nCanMoveNext(x,y,(int)z,next_x,next_y,tz);
                if (tempz == Double.MIN_VALUE)
                  return new Location((x << 4) + L2World.MAP_MIN_X,(y << 4) + L2World.MAP_MIN_Y,(int)z);
          z = tempz;
              }
              else
              {
                d += delta_A;
                next_x += inc_x;
                //_log.warning("3: next_x:"+next_x+" next_y"+next_y);
                tempz = nCanMoveNext(x,y,(int)z,next_x,next_y,tz);
                if (tempz == Double.MIN_VALUE)
                  return new Location((x << 4) + L2World.MAP_MIN_X,(y << 4) + L2World.MAP_MIN_Y,(int)z);
          z = tempz;
              }
            }
        }
        else
        {
          int delta_A = 2*dx;
          int d = delta_A - dy;
            int delta_B = delta_A - 2*dy;
            for (int i = 0; i < dy; i++)
            {
              x = next_x;
              y = next_y;
              if (d > 0)
              {
                d += delta_B;
                next_y += inc_y;
                next_x += inc_x;
                //_log.warning("5: next_x:"+next_x+" next_y"+next_y);
                tempz = nCanMoveNext(x,y,(int)z,next_x,next_y,tz);
                if (tempz == Double.MIN_VALUE)
                  return new Location((x << 4) + L2World.MAP_MIN_X,(y << 4) + L2World.MAP_MIN_Y,(int)z);
          z = tempz;
              }
              else
              {
                d += delta_A;
                next_y += inc_y;
                //_log.warning("6: next_x:"+next_x+" next_y"+next_y);
                tempz = nCanMoveNext(x,y,(int)z,next_x,next_y,tz);
                if (tempz == Double.MIN_VALUE)
                  return new Location((x << 4) + L2World.MAP_MIN_X,(y << 4) + L2World.MAP_MIN_Y,(int)z);
          z = tempz;
              }
            }
        }
        return destiny; // should actually return correct z here instead of tz
View Full Code Here

     * @param tz
     * @return Last Location (x,y,z) where player can walk - just befor wall
     */
    public Location moveCheck(int x, int y, int z, int tx, int ty, int tz)
    {
        return new Location(tx,ty,tz);
    }
View Full Code Here

    @Override
    public void run()
    {
      try
      {
        Location loc = null;
        Castle castle=null;

        if (activeChar.isInJail()) _requestedPointType = 27;
        else if (activeChar.isFestivalParticipant()) _requestedPointType = 4;

        switch (_requestedPointType)
        {
          case 1: // to clanhall
            if (activeChar.getClan().getHasHideout() == 0)
            {
              //cheater
              activeChar.sendMessage("You may not use this respawn point!");
              Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
              return;
            }
            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.ClanHall);

            if (ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan())!= null &&
                ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP) != null)
            {
              activeChar.restoreExp(ClanHallManager.getInstance().getClanHallByOwner(activeChar.getClan()).getFunction(ClanHall.FUNC_RESTORE_EXP).getLvl());
            }
            break;

          case 2: // to castle
            Boolean isInDefense = false;
            castle = CastleManager.getInstance().getCastle(activeChar);
            if (castle != null && castle.getSiege().getIsInProgress())
            {
              //siege in progress
              if (castle.getSiege().checkIsDefender(activeChar.getClan()))
                isInDefense = true;
            }
            if (activeChar.getClan().getHasCastle() == 0 && !isInDefense)
            {
              //cheater
              activeChar.sendMessage("You may not use this respawn point!");
              Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
              return;
            }
            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
            break;

          case 3: // to siege HQ
            L2SiegeClan siegeClan = null;
            castle = CastleManager.getInstance().getCastle(activeChar);

            if (castle != null && castle.getSiege().getIsInProgress())
              siegeClan = castle.getSiege().getAttackerClan(activeChar.getClan());

            if (siegeClan == null || siegeClan.getFlag().size() == 0)
            {
              //cheater
              activeChar.sendMessage("You may not use this respawn point!");
              Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
              return;
            }
            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.SiegeFlag);
            break;

          case 4: // Fixed or Player is a festival participant
            if (!activeChar.isGM() && !activeChar.isFestivalParticipant())
            {
              //cheater
              activeChar.sendMessage("You may not use this respawn point!");
              Util.handleIllegalPlayerAction(activeChar, "Player " + activeChar.getName() + " used respawn cheat.", IllegalPlayerAction.PUNISH_KICK);
              return;
            }
            loc = new Location(activeChar.getX(), activeChar.getY(), activeChar.getZ()); // spawn them where they died
            break;

          case 27: // to jail
            if (!activeChar.isInJail()) return;
            loc = new Location(-114356, -249645, -2984);
            break;

          default:
            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
          break;
View Full Code Here

   * Get the clan hall's spawn
   * @return
   */
  public Location getSpawn()
  {
    return new Location(_spawnLoc[0], _spawnLoc[1], _spawnLoc[2]);
  }
View Full Code Here

            activeChar.sendMessage("MapRegion: x:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getX()) + " y:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getY()));

            activeChar.sendMessage("Closest Town: " + MapRegionTable.getInstance().getClosestTownName(activeChar));

            Location loc;

            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
            activeChar.sendMessage("TeleToLocation (Castle): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());

            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.ClanHall);
            activeChar.sendMessage("TeleToLocation (ClanHall): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());

            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.SiegeFlag);
            activeChar.sendMessage("TeleToLocation (SiegeFlag): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());

            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
            activeChar.sendMessage("TeleToLocation (Town): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
        } else if (actualCommand.equalsIgnoreCase("admin_zone_reload"))
        {
          //TODO: ZONETODO ZoneManager.getInstance().reload();
          GmListTable.broadcastMessageToGMs("Zones can not be reloaded in this version.");
        }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.