Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Player


  {
    if(param.length < 1)
    {
      throw new IllegalArgumentException();
    }
    L2Player player = (L2Player) getSelf();
    if(player == null || player.isDead())
    {
      return;
    }
    int instancedZoneId = Integer.parseInt(param[0]);
    // SoD
    if(instancedZoneId == 400 && ServerVariables.getLong("SoD_opened", 0) * 1000L + SOD_OPEN_TIME < System.currentTimeMillis())
    {
      TiatEnter();
      return;
    }
    FastMap<Integer, InstancedZone> izs = InstancedZoneManager.getInstance().getById(instancedZoneId);
    if(izs == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return;
    }
    InstancedZone iz = izs.get(0);
    assert iz != null;
    if(player.getLevel() < iz.getMinLevel() || player.getLevel() > iz.getMaxLevel() || player.isInFlyingTransform())
    {
      player.sendPacket(new SystemMessage(SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(player));
      return;
    }
    if(player.isCursedWeaponEquipped())
    {
      player.sendPacket(new SystemMessage(SystemMessage.C1S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(player));
      return;
    }
    Reflection r = ReflectionTable.SOD_REFLECTION_ID == 0 ? null : ReflectionTable.getInstance().get(ReflectionTable.SOD_REFLECTION_ID);
    if(ReflectionTable.SOD_REFLECTION_ID > 0 && r != null)
    {
      player.setVar("backCoords", r.getReturnLoc().toXYZString());
      player.teleToLocation(r.getTeleportLoc(), r.getId());
      return;
    }
    else
    {
      r = new Reflection(iz.getName());
      r.setInstancedZoneId(instancedZoneId);
      ReflectionTable.SOD_REFLECTION_ID = r.getId();
    }
    long timelimit = 0;
    if(instancedZoneId == 400)
    {
      timelimit = ServerVariables.getLong("SoD_opened", 0) * 1000L + SOD_OPEN_TIME - System.currentTimeMillis();
    }
    for(InstancedZone i : izs.values())
    {
      if(r.getTeleportLoc() == null)
      {
        r.setTeleportLoc(i.getTeleportCoords());
      }
      r.FillSpawns(i.getSpawnsInfo());
      r.FillDoors(i.getDoors());
    }
    r.setCoreLoc(r.getReturnLoc());
    r.setReturnLoc(player.getLoc());
    player.setVar("backCoords", r.getReturnLoc().toXYZString());
    player.teleToLocation(r.getTeleportLoc(), r.getId());
    if(timelimit > 0)
    {
      r.startCollapseTimer(timelimit);
    }
  }
View Full Code Here


    activeChar.setMaried(false);
    activeChar.setPartnerId(0);
    Couple couple = CoupleManager.getInstance().getCouple(activeChar.getCoupleId());
    couple.divorce();
    couple = null;
    L2Player partner = L2ObjectsStorage.getPlayer(_partnerId);
    if(partner != null)
    {
      partner.setPartnerId(0);
      if(partner.isMaried())
      {
        partner.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PartnerDivorce", partner));
      }
      else
      {
        partner.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PartnerDisengage", partner));
      }
      partner.setMaried(false);
      // give adena
      if(activeChar.getAdena() >= AdenaAmount)
      {
        activeChar.reduceAdena(AdenaAmount, true);
        partner.addAdena(AdenaAmount);
      }
    }
    else
    {
      Letter letter = new Letter();
View Full Code Here

    }
  }

  public void TiatEnter()
  {
    L2Player player = (L2Player) getSelf();
    if(player == null)
    {
      return;
    }
    int instancedZoneId = 401;
    if(player.getParty() == null || !player.getParty().isInCommandChannel())
    {
      player.sendPacket(Msg.YOU_CANNOT_ENTER_BECAUSE_YOU_ARE_NOT_IN_A_CURRENT_COMMAND_CHANNEL);
      return;
    }
    L2CommandChannel cc = player.getParty().getCommandChannel();
    if(cc.getChannelLeader() != player)
    {
      player.sendMessage("You must be leader of the command channel.");
      return;
    }
    InstancedZoneManager izm = InstancedZoneManager.getInstance();
    FastMap<Integer, InstancedZone> izs = InstancedZoneManager.getInstance().getById(instancedZoneId);
    if(izs == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return;
    }
    InstancedZone iz = izs.get(0);
    assert iz != null;
    String name = iz.getName();
    int timelimit = iz.getTimelimit();
    int minMembers = iz.getMinParty();
    int maxMembers = iz.getMaxParty();
    if(cc.getMemberCount() < minMembers)
    {
      player.sendMessage("The command channel must contains at least " + minMembers + " members.");
      return;
    }
    if(cc.getMemberCount() > maxMembers)
    {
      player.sendMessage("The command channel must contains not more than " + maxMembers + " members.");
      return;
    }
    for(L2Player member : cc.getMembers())
    {
      if(member.getLevel() < iz.getMinLevel() || member.getLevel() > iz.getMaxLevel())
      {
        cc.broadcastToChannelMembers(new SystemMessage(SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(member));
        return;
      }
      if(member.isCursedWeaponEquipped() || member.isInFlyingTransform() || member.isDead())
      {
        player.sendPacket(new SystemMessage(SystemMessage.C1S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(member));
        return;
      }
      if(!player.isInRange(member, 500))
      {
        member.sendPacket(Msg.ITS_TOO_FAR_FROM_THE_NPC_TO_WORK);
        player.sendPacket(Msg.ITS_TOO_FAR_FROM_THE_NPC_TO_WORK);
        return;
      }
      if(izm.getTimeToNextEnterInstance(name, member) > 0)
      {
        cc.broadcastToChannelMembers(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
        return;
      }
    }
    Reflection r = new Reflection(name);
    r.setInstancedZoneId(instancedZoneId);
    for(InstancedZone i : izs.values())
    {
      if(r.getTeleportLoc() == null)
      {
        r.setTeleportLoc(i.getTeleportCoords());
      }
      r.FillSpawns(i.getSpawnsInfo());
      r.FillDoors(i.getDoors());
    }
    r.setCoreLoc(r.getReturnLoc());
    r.setReturnLoc(player.getLoc());
    for(L2Player member : cc.getMembers())
    {
      member.setVar(name, String.valueOf(System.currentTimeMillis()));
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.teleToLocation(iz.getTeleportCoords(), r.getId());
View Full Code Here

          activeChar.sendPacket(new SystemMessage(SystemMessage.S1_S2S_EFFECT_CAN_BE_FELT).addSkillName(skillId, skillLevel));
        }
      }
      return false;
    }
    L2Player ptarget = (L2Player) activeChar.getTarget();
    // check if player target himself
    if(ptarget.getObjectId() == activeChar.getObjectId())
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.EngagingYourself", activeChar));
      return false;
    }
    if(ptarget.isMaried())
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PlayerAlreadyMarried", activeChar));
      return false;
    }
    if(ptarget.getPartnerId() != 0)
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PlayerAlreadyEngaged", activeChar));
      return false;
    }
    if(ptarget.isEngageRequest())
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PlayerAlreadyAsked", activeChar));
      return false;
    }
    if(ptarget.getPartnerId() != 0)
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PlayerAlreadyEngaged", activeChar));
      return false;
    }
    if(ptarget.getSex() == activeChar.getSex() && !Config.WEDDING_SAMESEX)
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.SameSex", activeChar));
      return false;
    }
    // check if target has player on friendlist
    boolean FoundOnFriendList = false;
    int objectId;
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=?");
      statement.setInt(1, ptarget.getObjectId());
      rset = statement.executeQuery();
      while(rset.next())
      {
        objectId = rset.getInt("friend_id");
        if(objectId == activeChar.getObjectId())
        {
          FoundOnFriendList = true;
          break;
        }
      }
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    finally
    {
      DatabaseUtils.closeDatabaseCSR(con, statement, rset);
    }
    if(!FoundOnFriendList)
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.NotInFriendlist", activeChar));
      return false;
    }
    ptarget.setEngageRequest(true, activeChar.getObjectId());
    // ptarget.sendMessage("Player "+activeChar.getName()+" wants to engage with you.");
    ptarget.sendPacket(new ConfirmDlg(SystemMessage.S1, 60000, 4).addString("Player " + activeChar.getName() + " asking you to engage. Do you want to start new relationship?"));
    return true;
  }
View Full Code Here

    }
  }

  public void LeaveKamaloka(String[] param)
  {
    L2Player player = (L2Player) getSelf();
    L2NpcInstance npc = getNpc();
    if(player == null || npc == null)
    {
      return;
    }
    if(player.getParty() == null || !player.getParty().isLeader(player))
    {
      show("You are not a party leader.", player, npc);
      return;
    }
    player.getReflection().collapse();
  }
View Full Code Here

    player.getReflection().collapse();
  }

  public String DialogAppend_32484(Integer val)
  {
    L2Player player = (L2Player) getSelf();
    String ret = "";
    if(player == null || player.getLevel() < 20)
    {
      return ret;
    }
    if(Config.ALT_KAMALOKA_NIGHTMARE_REENTER || Config.ALT_KAMALOKA_ABYSS_REENTER || Config.ALT_KAMALOKA_LAB_REENTER)
    {
      ret += "<br>Ticket price: " + Util.formatAdena(player.getLevel() * 5000) + " adena.";
      if(Config.ALT_KAMALOKA_NIGHTMARE_REENTER)
      {
        ret += "<br>[scripts_Kamaloka:buyTicket 13011|Buy ticket to Hall of Nightmates]";
      }
      if(Config.ALT_KAMALOKA_ABYSS_REENTER)
View Full Code Here

    return ret;
  }

  public void buyTicket(String[] id)
  {
    L2Player player = (L2Player) getSelf();
    if(player == null || player.getLevel() < 20)
    {
      return;
    }
    int price = player.getLevel() * 5000;
    if(Functions.getItemCount(player, 57) < price)
    {
      player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
      return;
    }
    Functions.removeItem(player, 57, price);
    Functions.addItem(player, Integer.parseInt(id[0]), 1);
  }
View Full Code Here

    if(activeChar.getPartnerId() == 0)
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PartnerNotInDB", activeChar));
      return false;
    }
    L2Player partner = L2ObjectsStorage.getPlayer(activeChar.getPartnerId());
    if(partner == null)
    {
      activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.PartnerOffline", activeChar));
      return false;
    }
    if(partner.isInOlympiadMode() || partner.isFestivalParticipant() || activeChar.isMovementDisabled() || activeChar.isPMuted() || activeChar.isInOlympiadMode() || activeChar.getDuel() != null || activeChar.isFestivalParticipant() || partner.isInZone(no_summon))
    {
      activeChar.sendMessage(new CustomMessage("common.TryLater", activeChar));
      return false;
    }
    if(activeChar.isInParty() && activeChar.getParty().isInDimensionalRift() || partner.isInParty() && partner.getParty().isInDimensionalRift())
    {
      activeChar.sendMessage(new CustomMessage("common.TryLater", activeChar));
      return false;
    }
    if(activeChar.getTeleMode() != 0 || activeChar.getReflection().getId() != 0)
    {
      activeChar.sendMessage(new CustomMessage("common.TryLater", activeChar));
      return false;
    }
    // "Нельзя вызывать персонажей в/из зоны свободного PvP"
    // "в зоны осад"
    // "на Олимпийский стадион"
    // "в зоны определенных рейд-боссов и эпик-боссов"
    if(partner.isInZoneBattle() || partner.isInZone(Siege) || partner.isInZone(no_restart) || partner.isInZone(OlympiadStadia) || activeChar.isInZoneBattle() || activeChar.isInZone(Siege) || activeChar.isInZone(no_restart) || activeChar.isInZone(OlympiadStadia) || partner.getReflection().getId() != 0 || partner.isInZone(no_summon))
    {
      activeChar.sendPacket(Msg.YOUR_TARGET_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING);
      return false;
    }
    activeChar.abortAttack(true, true);
    activeChar.abortCast(true);
    activeChar.sendActionFailed();
    activeChar.stopMove();
    int teleportTimer = Config.WEDDING_TELEPORT_INTERVAL * 1000;
    if(activeChar.getInventory().getAdena() < Config.WEDDING_TELEPORT_PRICE)
    {
      activeChar.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
      return false;
    }
    activeChar.reduceAdena(Config.WEDDING_TELEPORT_PRICE, true);
    activeChar.sendMessage(new CustomMessage("scripts.commands.voiced.Wedding.Teleport", activeChar).addNumber(teleportTimer / 60000));
    // SoE Animation section
    activeChar.broadcastPacket(new MagicSkillUse(activeChar, activeChar, 1050, 1, teleportTimer, 0));
    activeChar.sendPacket(new SetupGauge(0, teleportTimer));
    // End SoE Animation section
    // continue execution later
    activeChar._skillTask = ThreadPoolManager.getInstance().scheduleAi(new EscapeFinalizer(activeChar, partner.getLoc()), teleportTimer, true);
    return true;
  }
View Full Code Here

    Functions.addItem(player, Integer.parseInt(id[0]), 1);
  }

  public void toDC()
  {
    L2Player player = (L2Player) getSelf();
    L2NpcInstance npc = getNpc();
    if(player == null || npc == null)
    {
      return;
    }
    if(!L2NpcInstance.canBypassCheck(player, npc))
    {
      return;
    }
    player.setVar("DCBackCoords", player.getLoc().toXYZString());
    player.teleToLocation(-114582, -152635, -6742);
  }
View Full Code Here

    player.teleToLocation(-114582, -152635, -6742);
  }

  public void fromDC()
  {
    L2Player player = (L2Player) getSelf();
    L2NpcInstance npc = getNpc();
    if(player == null || npc == null)
    {
      return;
    }
    if(!L2NpcInstance.canBypassCheck(player, npc))
    {
      return;
    }
    String var = player.getVar("DCBackCoords");
    if(var == null || var.equals(""))
    {
      return;
    }
    player.teleToLocation(new Location(var), 0);
    player.unsetVar("DCBackCoords");
  }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.L2Player

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.