Files
metin2-server/docs/FEATURE-LEVEL-120.md
T
shenleiandClaude Opus 5.5 e097b927de Skill power: bounds-check skill group/level (party crash), level 120 test results
A player row with skill_group 50 made CParty::ComputeRolePoint index past
m_aiSkillPowerByLevelFromType and crash the core once the character was in a party.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 12:17:59 +09:00

58 lines
9.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Level cap 120 + AVA2 105–120 content
The user decided on 2026-10-16:
- raise the level cap from 105 to 120;
- for 105–119, use a geometric exp curve that stays under the DWORD limit;
- keep the level-delta exp/drop table (`aiPercentByDeltaLev*`) unchanged;
- port AVA2's new maps and dungeons, with drops for their monsters.
## Why the cap alone is not enough
- **Exp curve.** On the newcibn locale `exp_table` = `exp_table_common`. Its 105–119 entries only moved from 2.33e9 to 2.49e9, so every level cost about the same as 104. AVA2 climbs to 2.05e10, but its table is DWORD, so from 107 on it wraps: 4.37e9 becomes about 7.5e7. That is not copied.
- **No monsters.** On 203 the highest normal monster that spawns is level 103 (6006); bosses and stones top out at 105. `PERCENT_LVDELTA` applies to exp, drop chance and gold alike. A player 12 levels above the monster gets 20%, and 15 or more levels above gets 1%. So without new monsters, 105–120 cannot be levelled.
- **AVA2 has the content.** 445 monster/stone vnums are AVA2-only, and 348 of them are level 100 or higher. AVA2 also re-levels 47 shared monsters, for example 2493 from 97 to 105 and 3091 from 105 to 115.
## Phases
| | What | Where |
|---|---|---|
| L1 | `MAX_LEVEL: 120`; exp table 105–119 = 2.33e9 → 4.2e9 geometric (constants.cpp); `player.exp` / `player_deleted.exp` → `INT UNSIGNED`. Points are already DWORD on the server, and the client reads exp unsigned. | server, `tools/server/level-120` (client repo) |
| L2 | Monsters: AVA2-only rows from AVA2 `db/mob_proto.txt` (not `share/conf`, which is an older copy), zh names, client mob models/motions (Monster, Monster2, NPC2 packs), `npclist`. | server proto + client pack |
| L3 | Maps, 100+ first: `plechito_desert_map_01` (101–115), `metin2_map_elemental_04_rework` (103–112), Yohara `eastplain_01–03` + `empirecastle` (85–125), `metin2_map_dawnmist_dungeon_01` (120). Server map dir + index + MAP_ALLOW on a core; client map pack, atlas, minimap, zh map names; reach them through the travel ring / NPC like AVA2's `anillotp` / `tp_npc1`. | both |
| L4 | Dungeons: `flame` (107–120, our 351 retuned), `snow` (`n_snow_dungeon_01` 352, 100–120), `meleylair` (212, 113–123, level ≥ 110), `shipdefense` (`defensawe_hydra` 355, 100–120). They need quest functions we lack: `d.global_warp_all_to_base`, `d.mission_notice`, `d.track_update`, `d.spawn_mob_new`, `d.new_kill_all`, `game.check_event`, `npc.set_meley_hp`, `npc.set_protect_flag2`, `npc.set_protect_time`, `npc.get_protect_time`, `npc.set_statu_affect`, `npc.set_statu_clear_aff`, `npc.show_statu`, `npc.dead_by_vnum`. AVA2's `when X.chat.lc_quest("…")` and `lc_quest` strings must become zh literals for our qc. | both |
| L5 | Drops: AVA2 gives only 8 of the new monsters drops (203 already has those groups), so the rest are designed in the client repo's `tools/server/ava2-maps/drops_maps.tsv` (tiers normal / elite / boss / stone / gold, plus per-map and per-vnum-range rows) and written by `make_drops_maps.py`. Every drop item must exist in item_proto first, otherwise the core won't boot. | server |
| L6 | Test on the sbtest cluster, then deploy with the rest of feature/ava2-unlock (needs approval). | 203 |
Later, below 105 or separate systems: summer maps `a1/c1_summer`, `metin2_12zi_stage` (zodiac, C++), `kingdoomswar`, `battlefied`. The plechi dungeons (slime/duratus/gold/nightmare/troll/elephant) have maps but no quest in AVA2's quest_list, so they are skipped.
## Open
- Whether to take AVA2's new levels for the 47 shared monsters.
- Which 203 core carries the new maps. The cores are i386 and each uses about 400 MB.
## Status
- L1 done on sbtest (2026-10-16). Exp table 106–120 in constants.cpp. The exp sum in `CHARACTER::PointChange(POINT_EXP)` is now 64-bit, as are the death exp-loss product (char_battle.cpp) and the quest reward check (questpc.cpp). Before that fix, 3.67e9 + 2e9 at level 119 wrapped to 1375032704. Tested with `/set exp` on [SA]Admin:
- 105 → 106 at 2.33e9;
- 3375032704 (> 2^31) saved to `player_sb.player` and survived `restart.sh`;
- +2e9 at 119 → 120;
- no more gain at 120.
The live schema change and live `MAX_LEVEL: 120` are not applied.
- L2/L3 on sbtest (2026-10-17): the 10 maps of `tools/server/ava2-maps/README.md` (client repo) are installed in channel5's own locale/data farm (`sbtest_locale.sh`) and reachable with `/warp x y` (global metres; `/goto #index` does not reach them). Hydra is moved from AVA2's 972800,153600 to 3276800,0, so AVA2 quest coordinates shift by (+2304000, −153600); its entry is `/warp 33089 116`. Mob models render.
- Client fix found on the way: after `/warp`, a timer chat (`/bio status`, `/server_bonuses`) sent between the new socket coming online and the core's GC_PHASE reached the core's handshake phase and got the connection closed ("Handshake phase does not handle packet 3"). The client now leaves the "Game" phase on GC_WARP and drops chat outside it.
- L5 on sbtest (2026-10-17): 99 drop groups appended (107 generated, the 8 existing kept). A kill test on plechito (`/m` + `/weaken all` + auto hunt) dropped the tier items, the lv115 armor, and the flame/hydra boss materials.
- L4 on sbtest (2026-10-17): AVA2's snow / ship defence / Meley quests ported as `snow_dungeon`, `ShipDefense`, `MeleyDungeon` by the client repo's `tools/server/ava2-dungeons` (`make_quests.py` + `install.sh`, see its README). Server side: `port_ava2_dungeon.cpp` (the `d.*` / `npc.*` functions AVA2's quests call), `QUEST_ATTACK_EVENT` (`<vnum>.attack`, Meley's HP phases), the Meley and hydra HP helpers. `d.track_update`, `game.check_event` and the battle pass calls were dropped from the quests instead of ported. The game build is installed only as sbtest's `game.switchbot` (previous one kept as `game.switchbot.pre-l4`). Entry test on the Mac client (key + `/warp` to the NPC + quest dialog → solo → yes): all three dungeons warp in (352, 355, 212), the key is used, the dungeon timers and mob spawns start, and syserr shows no quest errors. Meley full run (2026-10-17, solo GM at level 120 with a temporary sbtest-only damage/HP buff quest, since removed): all 9 floors, the floor-10 chest, and the exit warp back to map 62 (5986,6573) in 837 s; the 3 h cooldown flag is written. Fixes found on the way: `char_battle.cpp` never lets a hit take a dragon statue (6230) below 1 HP, so only the quest's `npc.dead_by_vnum` kills it (AVA2 has the same stuck-lair bug on floor 8); the client's autohunt now skips a target that is hit but takes no damage for 4 s (it stays skipped for 60 s). The client's `mt_dungeon_timer` shows the AVA2 dungeon timer (boss portrait, floor/wave, countdown) in place of the minimap, plus the hydra mast HP bar.
- Snow / ship / party runs (2026-10-17), with the fixes they needed:
- QUEST_INFO desync: `SendQuestInfoPakcet` sent the header before the optional fields were added, so `qi.size` was short and the client read the rest as a new packet ("Unknown packet header: 212"). The fields are now built first. The client also takes the full size from the flags.
- Hydra 6812 (KING, MAGIC) never took damage. The deck stops a player about 620 from its centre, and `battle_melee_attack` allowed only 300 (AVA2 600, still short of 620), so the server dropped every hit as VICTIM_FAR. For a non-PC victim of rank BOSS or higher the limit is now 800. The client gives a boss the 500 centre test of a huge race, like AVA2's `IsBoss()`.
- Client autohunt: large targets (defending reach as body size, walk straight at a body in reach when the planner finds no path), escalating skip for a target it keeps stalling on, a new anchor after a teleport (snow floor changes move the player more than 2000), and the immune skip only counts an explicit 0-damage packet.
- The snow driver used GM `/purge all` on floors 1/3/4 when a floor was still open after 300 s. This is a test accelerator for floors with 100+ mobs, not autohunt.
- Party skill power crash: `CTableBySkill::GetSkillPowerByLevelFromType` indexed its table with `job * 2 + skill_group - 1` and only rejected skill_group 0. [SA]Admin has skill_group 50 (one live row has it too), so the party update event (`CParty::ComputeRolePoint`) crashed the core as soon as that character was in a party. Out-of-range skill groups and levels now return 0.
- Results (sbtest, 2026-10-17, Mac client, autohunt):
- Ship defence (test character): waves 1→3, the hydra dies, chest 9018 spawns, exit to CapeDragonHead in 450 s, the key is used.
- Meley (test character): floors 1→10, the chest, exit to map 62 in 1362 s.
- Snow ([SA]Admin): floors 1→10, Nemere dies, exit to map 61 in 3303 s. Floors 1/3/4 needed GM `/purge all` (see above). The quest's `item.remove()` takes the whole stack of seal keys 30331/30333 (same in AVA2), so the driver handed them out one at a time.
- Party entry ([SA]Admin leads, Test joins): snow, ship and Meley all take both members in, and each member's key is used.
- Deploy package: `/root/deploy-features/20261017-lv120` on 203 (`sh deploy.sh check|go|rollback`).
- Follow-ups: client models/motions missing for the hydra chest (race 9018), `defensewave_hydra_boss` drop and minihydra `special_attack1`; autohunt is slow on floors with 200+ mobs; the new maps are reachable only by `/warp` (no travel NPC yet); the sash quest is not deployed; `new_quest_lv52` already raises `is_destination_village` Lua errors on live (questlib.lua's `dofile(GFquestlib.lua)` is commented out).