Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.Location


        activeChar.sendMessage("You can't restart in Event!");
        return;
      }
      try
      {
        Location loc = null;
        Castle castle = null;
        Fort fort = null;
       
        if (activeChar.isInJail())
        {
          _requestedPointType = 27;
        }
        else if (activeChar.isFestivalParticipant())
        {
          _requestedPointType = 4;
        }
       
        if (activeChar.isPhoenixBlessed())
          activeChar.stopPhoenixBlessing(null);
       
        switch (_requestedPointType)
        {
          case 1: // to clanhall
           
            if (activeChar.getClan() != null)
            {
             
              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;       
            }
           
            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
            break;
          case 2: // to castle
            Boolean isInDefense = false;
            castle = CastleManager.getInstance().getCastle(activeChar);
            fort = FortManager.getInstance().getFort(activeChar);
            MapRegionTable.TeleportWhereType teleportWhere = MapRegionTable.TeleportWhereType.Town;
           
            if (castle != null && castle.getSiege().getIsInProgress())
            {
              // siege in progress
              if (castle.getSiege().checkIsDefender(activeChar.getClan()))
              {
                isInDefense = true;
              }
            }
           
            if (fort != null && fort.getSiege().getIsInProgress())
            {
              // siege in progress
              if (fort.getSiege().checkIsDefender(activeChar.getClan()))
              {
                isInDefense = true;
              }
            }
           
            if (activeChar.getClan().getHasCastle() == 0 && activeChar.getClan().getHasFort() == 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;
            }
           
            if (CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null)
              teleportWhere = MapRegionTable.TeleportWhereType.Castle;
            else if (FortManager.getInstance().getFortByOwner(activeChar.getClan()) != null)
              teleportWhere = MapRegionTable.TeleportWhereType.Fortress;
           
            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, teleportWhere);
            break;
         
          case 3: // to siege HQ
            L2SiegeClan siegeClan = null;
            castle = CastleManager.getInstance().getCastle(activeChar);
            fort = FortManager.getInstance().getFort(activeChar);
           
            if (castle != null && castle.getSiege().getIsInProgress())
            {
              siegeClan = castle.getSiege().getAttackerClan(activeChar.getClan());
            }
            else if (fort != null && fort.getSiege().getIsInProgress())
            {
              siegeClan = fort.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:
            if (activeChar.getKarma() > 0 && Config.ALT_KARMA_TELEPORT_TO_FLORAN)
            {
              loc = new Location(17836, 170178, -3507);// Floran Village
              break;
            }
            loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
            break;       
        }
View Full Code Here


    replyMSG.append("Current event:<br1>");
    replyMSG.append("Name:&nbsp;<font color=\"00FF00\">" + TvT.get_eventName() + "</font><br1>");
    replyMSG.append("Description:&nbsp;<font color=\"00FF00\">" + TvT.get_eventDesc() + "</font><br1>");
    replyMSG.append("Joining location name:&nbsp;<font color=\"00FF00\">" + TvT.get_joiningLocationName() + "</font><br1>");
   
    Location npc_loc = TvT.get_npcLocation();
   
    replyMSG.append("Joining NPC ID:&nbsp;<font color=\"00FF00\">" + TvT.get_npcId()+ " on pos " + npc_loc._x + "," + npc_loc._y + "," + npc_loc._z + "</font><br1>");
    replyMSG.append("Reward ID:&nbsp;<font color=\"00FF00\">" + TvT.get_rewardId() + "</font><br1>");
    replyMSG.append("Reward Amount:&nbsp;<font color=\"00FF00\">" + TvT.get_rewardAmount() + "</font><br><br>");
    replyMSG.append("Min lvl:&nbsp;<font color=\"00FF00\">" + TvT.get_minlvl() + "</font><br>");
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;
      Fort fort = 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());
        }

        // If teleport to fort
        if(teleportWhere == TeleportWhereType.Fortress)
        {
          fort = FortManager.getInstance().getFortByOwner(player.getClan());
        }

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

        if(fort == null)
        {
          fort = FortManager.getInstance().getFort(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());
            }
            flags = null;
          }
        }

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

          if(teleportWhere == TeleportWhereType.SiegeFlag && fort.getSiege().getIsInProgress())
          {
            // check if player's clan is attacker
            List<L2NpcInstance> flags = fort.getSiege().getFlag(player.getClan());

            if(flags != null && !flags.isEmpty())
            {
              // spawn to flag
              L2NpcInstance flag = flags.get(0);
              return new Location(flag.getX(), flag.getY(), flag.getZ());
            }

            flags = null;
          }
        }

      }

      castle = null;
      fort = null;

      // 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]);
      }
     
      L2ChaoticZone chaotic = ChaoticManager.getInstance().getChaotic(player);
      if(chaotic != null)
      {
        coord = chaotic.getSpawnLoc();
        return new Location(coord[0], coord[1], coord[2]);
      }
      L2EventZone event = EventZoneManager.getInstance().getEventZone(player);
      if(event != null)
      {
        coord = event.getSpawnLoc();
        return new Location(coord[0], coord[1], coord[2]);
      }
      L2KamalokaZone kama = KamalokaZoneManager.getInstance().getKamaZone(player);
      if(kama != null)
      {
        coord = kama.getSpawnLoc();
        return new Location(coord[0], coord[1], coord[2]);
      }
      L2DmZone dm = DmManager.getInstance().getChaotic(player);
      if(dm != null)
      {
        coord = dm.getSpawnLoc();
        return new Location(coord[0], coord[1], coord[2]);
      }
    }

    // Get the nearest town
    L2TownZone local_zone = null;
    if(activeChar!=null && (local_zone = TownManager.getInstance().getClosestTown(activeChar))!=null)
    {
      coord = local_zone.getSpawnLoc();
      return new Location(coord[0], coord[1], coord[2]);
    }
   
    local_zone = TownManager.getInstance().getTown(9); //giran
    coord = local_zone.getSpawnLoc();
    return new Location(coord[0], coord[1], coord[2]);
   
   
  }
View Full Code Here

   *
   * @return the _npc location
   */
  public static Location get_npcLocation()
  {
    Location npc_loc = new Location(_npcX,_npcY,_npcZ,_npcHeading);
   
    return npc_loc;
   
  }
View Full Code Here

    private int _hp;

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

    }

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

    locations.clear();
    for (L2PcInstance member : party.getPartyMembers())
    {
      if (member == null)
        continue;
      locations.put(member.getObjectId(), new Location(member));
    }
  }
View Full Code Here

    writeC(0xa7);
    writeD(locations.size());

    for (Map.Entry<Integer, Location> entry : locations.entrySet())
    {
      Location loc = entry.getValue();
      writeD(entry.getKey());
      writeD(loc.getX());
      writeD(loc.getY());
      writeD(loc.getZ());
    }
  }
View Full Code Here

      return _broadcastAnnouncement;
    }

    public boolean addSpawnLocation(int x, int y, int z, int heading)
    {
      return _locList.add(new Location(x, y, z, heading));
    }
View Full Code Here

   * @param tz
   * @return Last Location (x,y,z) where player can walk - just before 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

TOP

Related Classes of com.l2jfrozen.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.