Пример #1
0
export async function insertPlug(account: DestinyAccount, item: DimItem, socket: DimSocket, plugItemHash: number) {
  const actionToken = await getAwaToken(account, AwaType.InsertPlugs, item);

  return insertSocketPlug(httpAdapterWithRetry, {
    actionToken,
    itemInstanceId: item.id,
    plug: {
      socketIndex: socket.socketIndex,
      socketArrayType: DestinySocketArrayType.Default,
      plugItemHash
    },
    characterId: item.owner,
    membershipType: account.platformType
  });
}
Пример #2
0
export async function insertPlug(
  account: DestinyAccount,
  item: D2Item,
  socket: DimSocket,
  plugItemHash: number
) {
  const actionToken = await getAwaToken(account, AwaType.InsertPlugs, item);

  // TODO: if the plug costs resources to insert, add a confirmation

  return insertSocketPlug(httpAdapter, {
    actionToken,
    itemInstanceId: item.id,
    plug: {
      socketIndex: socket.socketIndex,
      socketArrayType: DestinySocketArrayType.Default,
      plugItemHash
    },
    characterId: item.owner,
    membershipType: account.platformType
  });

  // TODO: need to update the item after modifying, and signal that it has changed (Redux?)
}