Package lineage2.gameserver.model.mail

Examples of lineage2.gameserver.model.mail.Mail


   * @param killer Creature
   */
  @Override
  protected void onEvtDead(Creature killer)
  {
    final NpcInstance actor = getActor();
    actor.broadcastPacket(new PlaySound(PlaySound.Type.MUSIC, "BS02_D", 1, 0, actor.getLoc()));
    Functions.npcSay(actor, "A fatal error has occurred");
    Functions.npcSay(actor, "System is being shut down...");
    Functions.npcSay(actor, "......");
    try
    {
      final NpcInstance cubic1 = NpcHolder.getInstance().getTemplate(TELEPORTATION_CUBIC_ID).getNewInstance();
      cubic1.setReflection(actor.getReflection());
      cubic1.setCurrentHpMp(cubic1.getMaxHp(), cubic1.getMaxMp(), true);
      cubic1.spawnMe(CUBIC_1_POSITION);
      final NpcInstance cubic2 = NpcHolder.getInstance().getTemplate(TELEPORTATION_CUBIC_ID).getNewInstance();
      cubic2.setReflection(actor.getReflection());
      cubic2.setCurrentHpMp(cubic1.getMaxHp(), cubic1.getMaxMp(), true);
      cubic2.spawnMe(CUBIC_2_POSITION);
      ThreadPoolManager.getInstance().schedule(new DeSpawnScheduleTimerTask(cubic1, cubic2), CUBIC_DESPAWN_TIME);
    }
    catch (Exception e)
    {
      e.printStackTrace();
View Full Code Here


   */
  @Override
  protected void onEvtSpawn()
  {
    super.onEvtSpawn();
    final NpcInstance actor = getActor();
    if (Rnd.chance(50))
    {
      actor.setNpcState(1);
    }
    ThreadPoolManager.getInstance().scheduleAtFixedRate(new Switch(), 5 * 60 * 1000L, 5 * 60 * 1000L);
  }
 
View Full Code Here

     * Method runImpl.
     */
    @Override
    public void runImpl()
    {
      final NpcInstance actor = getActor();
      if (actor.getNpcState() == 1)
      {
        actor.setNpcState(2);
      }
      else
      {
        actor.setNpcState(1);
      }
    }
View Full Code Here

      int myBirthdayReceiveYear = activeChar.getVarInt(Player.MY_BIRTHDAY_RECEIVE_YEAR, 0);
      if ((create.get(Calendar.MONTH) == now.get(Calendar.MONTH)) && (create.get(Calendar.DAY_OF_MONTH) == day))
      {
        if (((myBirthdayReceiveYear == 0) && (create.get(Calendar.YEAR) != now.get(Calendar.YEAR))) || ((myBirthdayReceiveYear > 0) && (myBirthdayReceiveYear != now.get(Calendar.YEAR))))
        {
          Mail mail = new Mail();
          mail.setSenderId(1);
          mail.setSenderName(StringHolder.getInstance().getNotNull(activeChar, "birthday.npc"));
          mail.setReceiverId(activeChar.getObjectId());
          mail.setReceiverName(activeChar.getName());
          mail.setTopic(StringHolder.getInstance().getNotNull(activeChar, "birthday.title"));
          mail.setBody(StringHolder.getInstance().getNotNull(activeChar, "birthday.text"));
          ItemInstance item = ItemFunctions.createItem(21169);
          item.setLocation(ItemInstance.ItemLocation.MAIL);
          item.setCount(1L);
          item.save();
          mail.addAttachment(item);
          mail.setUnread(true);
          mail.setType(Mail.SenderType.BIRTHDAY);
          mail.setExpireTime((720 * 3600) + (int) (System.currentTimeMillis() / 1000L));
          mail.save();
          activeChar.setVar(Player.MY_BIRTHDAY_RECEIVE_YEAR, String.valueOf(now.get(Calendar.YEAR)), -1);
        }
      }
    }
    if (activeChar.getClan() != null)
View Full Code Here

    Player activeChar = getClient().getActiveChar();
    if (activeChar == null)
    {
      return;
    }
    Mail mail = MailDAO.getInstance().getReceivedMailByMailId(activeChar.getObjectId(), postId);
    if (mail != null)
    {
      if (mail.isUnread())
      {
        mail.setUnread(false);
        mail.setJdbcState(JdbcEntityState.UPDATED);
        mail.update();
        activeChar.sendPacket(new ExChangePostState(true, Mail.READED, mail));
      }
      activeChar.sendPacket(new ExReplyReceivedPost(mail));
      return;
    }
View Full Code Here

    }
    if (items.keySet().size() > 8)
    {
      return;
    }
    Mail mail = new Mail();
    mail.setSenderId(1);
    mail.setSenderName("Admin");
    mail.setReceiverId(receiver.getObjectId());
    mail.setReceiverName(receiver.getName());
    mail.setTopic(title);
    mail.setBody(body);
    for (Map.Entry<Integer, Long> itm : items.entrySet())
    {
      ItemInstance item = ItemFunctions.createItem(itm.getKey());
      item.setLocation(ItemInstance.ItemLocation.MAIL);
      item.setCount(itm.getValue());
      item.save();
      mail.addAttachment(item);
    }
    mail.setType(Mail.SenderType.NEWS_INFORMER);
    mail.setUnread(true);
    mail.setExpireTime((720 * 3600) + (int) (System.currentTimeMillis() / 1000L));
    mail.save();
    receiver.sendPacket(ExNoticePostArrived.STATIC_TRUE);
    receiver.sendPacket(Msg.THE_MAIL_HAS_ARRIVED);
  }
View Full Code Here

   * @param messageId int
   * @return Mail
   */
  private Mail load0(int messageId)
  {
    Mail mail = null;
    Connection con = null;
    PreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(RESTORE_MAIL);
      statement.setInt(1, messageId);
      rset = statement.executeQuery();
      if (rset.next())
      {
        mail = new Mail();
        mail.setMessageId(messageId);
        mail.setSenderId(rset.getInt(1));
        mail.setSenderName(rset.getString(2));
        mail.setReceiverId(rset.getInt(3));
        mail.setReceiverName(rset.getString(4));
        mail.setExpireTime(rset.getInt(5));
        mail.setTopic(rset.getString(6));
        mail.setBody(rset.getString(7));
        mail.setPrice(rset.getLong(8));
        mail.setType(Mail.SenderType.VALUES[rset.getInt(9)]);
        mail.setUnread(rset.getBoolean(10));
        mail.setReturnable(rset.getBoolean(11));
        mail.setSystemMsg1(rset.getInt(12));
        mail.setSystemMsg2(rset.getInt(13));
        DbUtils.close(statement, rset);
        statement = con.prepareStatement(RESTORE_MAIL_ATTACHMENTS);
        statement.setInt(1, messageId);
        rset = statement.executeQuery();
        ItemInstance item;
        int objectId;
        while (rset.next())
        {
          objectId = rset.getInt(1);
          item = ItemsDAO.getInstance().load(objectId);
          if (item != null)
          {
            mail.addAttachment(item);
          }
        }
      }
    }
    catch (SQLException e)
View Full Code Here

   * @return Mail
   */
  @Override
  public Mail load(Integer id)
  {
    Mail mail;
    Element ce = cache.get(id);
    if (ce != null)
    {
      mail = (Mail) ce.getObjectValue();
      return mail;
    }
    mail = load0(id);
    if (mail==null)
    {
      _log.warn("Mail load error id:" + id);
    }
    else
    {
      mail.setJdbcState(JdbcEntityState.STORED);
      cache.put(new Element(mail.getMessageId(), mail));
    }
    return mail;
  }
View Full Code Here

    if (messageIds.isEmpty())
    {
      return Collections.emptyList();
    }
    List<Mail> list = new ArrayList<>(messageIds.size());
    Mail mail;
    for (Integer messageId : messageIds)
    {
      mail = load(messageId);
      if (mail != null)
      {
View Full Code Here

      inventory.reduceAdena(price);
      container.removeItem(itemInfo.getItem());
      inventory.addItem(itemInfo.getItem());
      player.sendPacket(new ExResponseCommissionBuyItem(1, itemInfo.getItem().getItemId(), itemInfo.getItem().getCount()));
      long fee = (long) Math.max(1000, price * SALE_FEE);
      Mail mail = new Mail();
      mail.setSenderId(receiverId);
      mail.setSenderName(itemInfo.getSellerName());
      mail.setReceiverId(receiverId);
      mail.setReceiverName(itemInfo.getSellerName());
      mail.setTopic("CommissionBuyTitle");
      mail.setBody(itemInfo.getItem().getName());
      mail.setSystemMsg1(3490);
      mail.setSystemMsg2(3491);
      ItemInstance item = ItemFunctions.createItem(ItemTemplate.ITEM_ID_ADENA);
      item.setLocation(ItemInstance.ItemLocation.MAIL);
      item.setCount(price - fee);
      if (item.getCount() > 0)
      {
        item.save();
        mail.addAttachment(item);
      }
      mail.setType(Mail.SenderType.SYSTEM);
      mail.setUnread(true);
      mail.setReturnable(false);
      mail.setExpireTime((360 * 3600) + (int) (System.currentTimeMillis() / 1000L));
      mail.save();
      Player receiver = World.getPlayer(receiverId);
      if (receiver != null)
      {
        receiver.sendPacket(ExNoticePostArrived.STATIC_TRUE);
        receiver.sendPacket(Msg.THE_MAIL_HAS_ARRIVED);
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.mail.Mail

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.