<!-- BEGIN CHANGE: varredura server dir + o que o portal ja expoe (2026-07) -->
# Dados do servidor disponiveis para o portal

Fonte no servidor: `/home/ubuntu/otx2_reseted/` (`OT_SERVER_PATH` na API).
DB compartilhado: `ot_new`.
Parsers compartilhados: `portal/api/server-data-lib.php` (regex + cache mtime em `dev-portal/cache/`).
Lua do OT pode estar em **Latin-1**; a API converte para UTF-8 na leitura (`waServerRead`). Sem `mbstring` no php8.3 arm: usa `iconv` / check UTF-8 via regex.

## 1. Monstros: DB (`z_monsters`) vs XML (`data/monster/`)

| Fonte | Uso |
|---|---|
| `z_monsters` | lista/busca, outfit, exp/hp basicos |
| `data/monster/*.xml` + `monsters.xml` | ficha: loot, attacks, defenses, elements |
| `data/items/items.xml` | nomes de loot |

Sem SimpleXML no arm64 - parse por **regex**.

## 2. O que o portal ja expoe (implementado)

| Origem | API / UI |
|---|---|
| `config.lua` | `serverinfo.php` (rates, skulls, ban frags, houseCleanOld, protectionLevel, pz, whiteSkull...) |
| `data/XML/stages.xml` | Server Info (EXP stages) |
| `reset_system.lua` / `resets_table.json` | Server Info (tabela RR) |
| `dbcleaner.lua` regras + `z_cleanup_log` | Server Info (risco 48h + historico do dia); e-mail via `cleanup-notify.php` |
| `autobless.lua` + `bless_mods.lua` + `bless_functions.lua` | Server Info (bless; **nao** NPC Klaus) |
| `050-function.lua` (`onlinePoints`, `death`) | Server Info |
| `talkactions.xml` (sem access / access 0-1 / range piso 0-1) | Server Info comandos player |
| `raid.lua` + `Random_Raids.lua` | `raids.php` + pagina `/raids` |
| `items.xml` (subset gear: atk/armor/def limiar) + `weapons.xml` wands | `items.php` + `/items` |
| `task_func.lua` (task_sys + daily_task + ranks) | `tasks.php` + `/tasks` |
| `imported-spawn.xml` + `data/npc/*.xml` | `npcs.php` + `/npcs` (so NPCs no mapa) |
| `potions.lua` | `potions.php` + Vocations |
| `spells.xml` + scripts healing | `potions.php?resource=heals` + Vocations |
| `z_spells` + `spells.xml` voc ids | `spells.php` + Vocations |

## 3. Filtros importantes

- **Talked:** nao listar GM (`access >= 2`); incluir sem `access`, `0`, `1`, ranges com piso 0/1.
- **Items:** nao dump completo; so equipamentos relevantes (heuristica attack/armor/defense + slots).
- **NPCs:** somente nomes em `data/world/imported-spawn.xml`.
- **Bless:** so fluxo autobless / `!bless` (+ `BlessConfig` em `bless_functions.lua`).

## 4. Preferencia pratica

- **DB primeiro** quando a tabela custom ja existe (`z_monsters`, `z_spells`, shop, players...).
- **Arquivo do server sob demanda** quando o dado so existe la (loot, stages, raids, formulas).
- Nunca escrever no dir do server a partir do portal; so leitura.

## 5. Docs relacionadas

- Cleanup + cron: `docs/cleanup-notify.md`
- Mapa API: `docs/portal-api-map.md`
- Encoding portal UTF-8: `.cursor/rules/encoding-text.mdc`
- Encoding Lua OT Latin-1: `otx2_reseted/.cursor/rules/lua-latin1-encoding.mdc`

<!-- END CHANGE -->
