Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

GetTradeContainer

Returns the ID of a trade container within the specified secure trade window.

TradeNum — index of the active trade window (1-based, as returned by TradeCount).

Num — which container to retrieve: 1 for your own container, 2 for the opponent’s container.

Returns 0 if Num is not 1 or 2, the trade window does not exist, or the character is disconnected.

The returned container ID can be passed to GetContent or find methods to inspect the items inside.

Возвращает ID контейнера в указанном окне безопасного обмена.

TradeNum — индекс активного окна обмена (начиная с 1, как возвращает TradeCount).

Num — какой контейнер получить: 1 — ваш собственный, 2 — контейнер оппонента.

Возвращает 0, если Num не равен 1 или 2, окно обмена не существует или персонаж не подключён.

Полученный ID контейнера можно передать в GetContent или методы поиска для просмотра предметов внутри.

Pascal

function GetTradeContainer(TradeNum: Byte; Num: Byte): Cardinal;

Python

def GetTradeContainer(TradeNum: int, Num: int) -> int: ...

Pascal Example

var
  MyContainer, TheirContainer: Cardinal;
begin
  if TradeCount > 0 then
  begin
    MyContainer := GetTradeContainer(1, 1);
    TheirContainer := GetTradeContainer(1, 2);
    AddToSystemJournal('My trade container: $' + IntToHex(MyContainer, 8));
    AddToSystemJournal('Opponent container: $' + IntToHex(TheirContainer, 8));
  end;
end.

Python Example

if TradeCount() > 0:
    my_container = GetTradeContainer(1, 1)
    their_container = GetTradeContainer(1, 2)
    AddToSystemJournal(f'My trade container: ${my_container:08X}')
    AddToSystemJournal(f'Opponent container: ${their_container:08X}')

See Also

TradeCount, GetTradeOpponent, GetTradeOpponentName, ConfirmTrade, CancelTrade