Metin2

Show characters, rankings, and online players

Configure Metin2 queries for player and public website data

These queries let linked players see their characters and let Forgeport show the online count, level ranking, guild names, and item catalog. Character listing and item search are required; online count and rankings are optional.

List an account's characters

Characters are linked through player_index.pid1pid4. Empire belongs to the account's player_index row on the reference base; class/job belongs to the player row. Join guild membership with LEFT JOIN so a character without a guild still appears.

The query must filter by @account and alias the fields expected by the connector. Adjust columns where your base moved empire, added Lycan, or uses postfixed tables.

Detect online players

There is no reliable online flag. The generated queries combine:

  • the latest log.loginlog2 row, where logout_time IS NULL means the character entered the game and has not logged out;
  • a ten-minute last_play window that expires a session left open by a crashed core.

A base that never writes loginlog2 falls back to the last_play window. Add this index once the session table grows:

ALTER TABLE log.loginlog2
ADD INDEX idx_portal_pid_id (pid, id);

Do not use player.last_play alone: it updates periodically, so fresh logins appear offline and recent logouts remain online.

Show level rankings

Metin2 rankings use the level metric. The generated query orders by level and then experience. Exclude game masters with the authority source used by your base; on a standard schema that can be common.gmlist.

Search item names

player.item_proto.locale_name supplies the picker. On standard schemas it is binary, so convert it both in SELECT and WHERE:

WHERE CONVERT(ip.locale_name USING utf8) LIKE @term

Without conversion, search is byte- and case-sensitive and returned names can arrive as raw bytes.

After this works

The linked account's character picker shows current names, levels, jobs, empires, guilds, and online state. The published website and public website API can show the online count and level ranking.

Verify

  1. Link an account with characters in different slots.
  2. Compare their empire, class, guild, and online state with the game client.
  3. Log in and out while watching the online count.
  4. Compare the first ranking rows with MySQL.
  5. Search one mixed-case and one localized item name in Admin.

On this page