Elite NetworkElite SaaS · Docsv0.1
GitHubPainel

Inventory API

Listar catálogo, ler inventário de um jogador, adicionar e remover items via painel.

Todos os endpoints delegam para functions/inventory.lua — adapte lá se o seu servidor não usa mtg_inventory.
GET/elite-saas/inventory/items🔒 auth

Catálogo de items disponíveis no servidor (lista todos os items registrados em mtg_inventory).

json
{
  "items": [
    {
      "item": "bandagem",
      "name": "Bandagem",
      "weight": 100,
      "image": "https://cdn.exemplo.com/items/bandagem.png"
    },
    { "item": "ak47", "name": "AK-47", "weight": 4500, "image": "..." }
  ]
}

GET/elite-saas/inventory/search?q=<query>🔒 auth

Mesma busca de player_search — pra encontrar de quem é o inventário.


GET/elite-saas/inventory/<userId>🔒 auth

Inventário completo de um jogador, slot a slot.

json
{
  "userId": 4823,
  "weight": 12300,
  "capacity": 50000,
  "items": [
    {
      "slot": 1,
      "item": "bandagem",
      "name": "Bandagem",
      "amount": 5,
      "weight": 500,
      "image": "https://cdn.exemplo.com/items/bandagem.png"
    },
    {
      "slot": 7,
      "item": "ak47",
      "name": "AK-47",
      "amount": 1,
      "weight": 4500,
      "image": "..."
    }
  ]
}

POST/elite-saas/inventory/<userId>/remove🔒 auth

Remove um item (ou parte da quantidade) de um slot. Idempotente — mais que o disponível remove só o que dá.

Body

item
stringrequired
Identificador interno do item (não o label).
amount
integeroptional
Quantidade a remover. Default 1.
slot
integeroptional
Slot específico. Sem slot, o adapter decide (geralmente o primeiro slot que tenha o item).
bash
curl -X POST http://IP:30120/elite-saas/inventory/4823/remove \
  -H "Authorization: Bearer SEU_TOKEN" \
  -H "x-tenant-id: elite-city" \
  -H "Content-Type: application/json" \
  -d '{"item":"bandagem","amount":2,"slot":1}'
json
{ "ok": true, "removed": 2, "item": "bandagem", "slot": 1 }

POST/elite-saas/inventory/<userId>/add🔒 auth

Adiciona item ao inventário. Respeita peso/capacidade do mtg_inventory.

Body

item
stringrequired
Identificador interno.
amount
integeroptional
Default 1.
slot
integeroptional
Sugere o slot; sem o param o adapter aloca.
json
{ "ok": true, "added": 1, "item": "ak47", "slot": 8 }

Tabelas envolvidas

  • mtg_inventories — coluna inventory JSON.
  • Catálogo via export exports['mtg_inventory']:getItemList().

Permissão no painel

Endpoints POST exigem inventory.view + users.ban (ou Owner). Customize na sua role via Configurações → Staff.

Elite Network — Command Center