Package lineage2.gameserver.network.serverpackets

Examples of lineage2.gameserver.network.serverpackets.ExBR_PresentBuyProductPacket


  {
    List<L2GameServerPacket> list = new ArrayList<>();
    Player owner = getPlayer();
    if (owner == forPlayer)
    {
      list.add(new CharInfo(this));
    }
    else
    {
      Party party = forPlayer.getParty();
      if ((getReflection() == ReflectionManager.GIRAN_HARBOR) && ((owner == null) || (party == null) || (party != owner.getParty())))
      {
        return list;
      }
      list.add(new CharInfo(this));
      list.add(RelationChanged.update(forPlayer, this, forPlayer));
    }
    if (isInCombat())
    {
      list.add(new AutoAttackStart(getObjectId()));
View Full Code Here


        getInstance().getListenerEngine().onDay();
      }
      for (Player player : GameObjectsStorage.getAllPlayersForIterate())
      {
        player.checkDayNightMessages();
        player.sendPacket(new ClientSetTime());
      }
    }
View Full Code Here

  void changeAura(NpcInstance actor, int npcId)
  {
    if (npcId != actor.getDisplayId())
    {
      actor.setDisplayId(npcId);
      DeleteObject d = new DeleteObject(actor);
      L2GameServerPacket su = new StatusUpdate(actor).addAttribute(StatusUpdateField.CUR_HP, StatusUpdateField.MAX_HP);
      for (Player player : World.getAroundPlayers(actor))
      {
        player.sendPacket(d, new NpcInfo(actor, player));
        if (player.getTarget() == actor)
View Full Code Here

  public void onShutdown()
  {}
 
  public void broadcastPacket(int value, boolean b)
  {
    L2GameServerPacket trigger = new EventTrigger(value, b);
    for (Player player : GameObjectsStorage.getAllPlayersForIterate())
      player.sendPacket(trigger);

  }
View Full Code Here

      return;
    }
    ProductItem product = ProductHolder.getInstance().getProduct(productId);
    if (product == null)
    {
      activeChar.sendPacket(new ExBR_PresentBuyProductPacket(ExBR_PresentBuyProductPacket.RESULT_WRONG_PRODUCT));
      return;
    }
    if ((System.currentTimeMillis() < product.getStartTimeSale()) || (System.currentTimeMillis() > product.getEndTimeSale()))
    {
      activeChar.sendPacket(new ExBR_PresentBuyProductPacket(ExBR_PresentBuyProductPacket.RESULT_SALE_PERIOD_ENDED));
      return;
    }
    int totalPoints = product.getPoints() * count;
    if (totalPoints < 0)
    {
      activeChar.sendPacket(new ExBR_PresentBuyProductPacket(ExBR_PresentBuyProductPacket.RESULT_WRONG_PRODUCT));
      return;
    }
    final long gamePointSize = activeChar.getPremiumPoints();
    if (totalPoints > gamePointSize)
    {
      activeChar.sendPacket(new ExBR_PresentBuyProductPacket(ExBR_PresentBuyProductPacket.RESULT_NOT_ENOUGH_POINTS));
      return;
    }
    int recieverId;
    Player target = World.getPlayer(receiverName);
    if (target != null)
    {
      recieverId = target.getObjectId();
      receiverName = target.getName();
      if (target.isInBlockList(activeChar))
      {
        activeChar.sendPacket(new SystemMessage(SystemMessage.S1_HAS_BLOCKED_YOU_YOU_CANNOT_SEND_MAIL_TO_S1_).addString(receiverName));
        return;
      }
    }
    else
    {
      recieverId = CharacterDAO.getInstance().getObjectIdByName(receiverName);
      if (recieverId > 0)
      {
        if (mysql.simple_get_int("target_Id", "character_blocklist", "obj_Id=" + recieverId + " AND target_Id=" + activeChar.getObjectId()) > 0)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessage.S1_HAS_BLOCKED_YOU_YOU_CANNOT_SEND_MAIL_TO_S1_).addString(receiverName));
          return;
        }
      }
    }
    if (recieverId == 0)
    {
      activeChar.sendPacket(Msg.WHEN_THE_RECIPIENT_DOESN_T_EXIST_OR_THE_CHARACTER_HAS_BEEN_DELETED_SENDING_MAIL_IS_NOT_POSSIBLE);
      return;
    }
    activeChar.reducePremiumPoints(totalPoints);
    List<ItemInstance> attachments = new ArrayList<>();
    for (ProductItemComponent comp : product.getComponents())
    {
      ItemInstance item = ItemFunctions.createItem(comp.getItemId());
      item.setCount(comp.getCount());
      item.setOwnerId(activeChar.getObjectId());
      item.setLocation(ItemInstance.ItemLocation.MAIL);
      if (item.getJdbcState().isSavable())
      {
        item.save();
      }
      else
      {
        item.setJdbcState(JdbcEntityState.UPDATED);
        item.update();
      }
      attachments.add(item);
    }
    Mail mail = new Mail();
    mail.setSenderId(activeChar.getObjectId());
    mail.setSenderName(activeChar.getName());
    mail.setReceiverId(recieverId);
    mail.setReceiverName(receiverName);
    mail.setTopic(topic);
    mail.setBody(message);
    mail.setPrice(0);
    mail.setUnread(true);
    mail.setType(Mail.SenderType.PRESENT);
    mail.setExpireTime((720 * 3600) + (int) (System.currentTimeMillis() / 1000L));
    for (ItemInstance item : attachments)
    {
      mail.addAttachment(item);
    }
    mail.save();
    activeChar.sendPacket(new ExBR_GamePoint(activeChar));
    activeChar.sendPacket(new ExBR_PresentBuyProductPacket(ExBR_PresentBuyProductPacket.RESULT_OK));
    activeChar.sendChanges();
    if (target != null)
    {
      target.sendPacket(ExNoticePostArrived.STATIC_TRUE);
      target.sendPacket(Msg.THE_MAIL_HAS_ARRIVED);
View Full Code Here

  }
 
  public void broadcastSend(Castle castle)
  {
    L2GameServerPacket trigger = new ExCastleState(castle);
    for (Player player : GameObjectsStorage.getAllPlayersForIterate())
      player.sendPacket(trigger);

  }
View Full Code Here

      if (castle != null)
      { 
        if(_side.ordinal()==1 || _side.ordinal()==0)
        {
        ((Player) cha).sendPacket(new ExCastleState(castle));
        broadcastPacket(_side.ordinal(),true);
        broadcastSend(castle);
        Announcements.getInstance().announceToAll(new ExCastleState(castle));
        //broadcastPacket(_side.ordinal(),false);
        }
        else
        {
        ((Player) cha).sendPacket(new ExCastleState(castle));
        broadcastPacket(_side.ordinal(),true);
        broadcastSend(castle);
        Announcements.getInstance().announceToAll(new ExCastleState(castle));
        //broadcastPacket(_side.ordinal(),false);
        }
       
        //return;
      }
View Full Code Here

  @Override
  public void onPlayerEnter(Player player)
  {
    super.onPlayerEnter(player);
    player.sendPacket(new ExSendUIEvent(player, 0, 1, (int) (System.currentTimeMillis() - _savedTime) / 1000, 0, NpcString.NONE));
  }
View Full Code Here

  @Override
  public void onPlayerExit(Player player)
  {
    super.onPlayerExit(player);
    player.sendPacket(new ExSendUIEvent(player, 1, 1, 0, 0));
  }
View Full Code Here

          {
            spawnRoom(7);
            setReenterTime(System.currentTimeMillis());
            for(Player p : getPlayers())
            {
              p.sendPacket(new ExSendUIEvent(p, 1, 1, 0, 0));
              p.sendPacket(new SystemMessage(SystemMessage.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTES).addNumber(5));
            }
            startCollapseTimer(5 * 60 * 1000L);
            timeSpent = (int) (System.currentTimeMillis() - _savedTime) / 1000;
          }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.network.serverpackets.ExBR_PresentBuyProductPacket

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.