Package l2p.gameserver.model

Examples of l2p.gameserver.model.TradeItem


    {
      activeChar.sendPacket(Msg.THIS_ITEM_CANNOT_BE_TRADED_OR_SOLD);
      return;
    }
    long InvItemCount = InvItem.getCount();
    TradeItem tradeItem = getItem(_objectId, transaction.getExchangeList(activeChar));
    long realCount = Math.min(_amount, InvItemCount);
    long leaveCount = InvItemCount - realCount;
    if(tradeItem == null)
    {
      // добавляем новую вещь в список
      tradeItem = new TradeItem(InvItem);
      tradeItem.setCount(realCount);
      transaction.getExchangeList(activeChar).add(tradeItem);
    }
    else
    {
      // меняем количество уже имеющегося
      if(!InvItem.canBeTraded(activeChar))
      {
        return;
      }
      long TradeItemCount = tradeItem.getCount();
      if(InvItemCount == TradeItemCount) // мы уже предлогаем всё что имеем
      {
        return;
      }
      try
      {
        if(SafeMath.safeAddLong(_amount, TradeItemCount) >= InvItemCount)
        {
          realCount = InvItemCount - TradeItemCount;
        }
      }
      catch(ArithmeticException e)
      {
        activeChar.sendPacket(Msg.SYSTEM_ERROR, Msg.ActionFail);
        return;
      }
      tradeItem.setCount(realCount + TradeItemCount);
      leaveCount = InvItemCount - realCount - TradeItemCount;
    }
    activeChar.sendPacket(new TradeOwnAdd(InvItem, tradeItem.getCount()), new TradeUpdate(InvItem, leaveCount));
    requestor.sendPacket(new TradeOtherAdd(InvItem, tradeItem.getCount()));
  }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.TradeItem

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.