# AVA2 items: unlocking the locked systems The 478 AVA2 drop items come from metin2-client `tools/server/ava2-items` (see FEATURE-AVA2-DROPS.md). Items of systems 40250 lacks were imported as ITEM_NONE. This branch turns them back into usable items one system at a time. Each phase keeps the AVA2 row (type, subtype, values, applies) once the server and client understand it. | Phase | Items | State | |---|---|---| | P1 boxes and keys | 77918–77920 boxes, 77921–77923 keys (`ITEM_TREASURE_BOX` / `ITEM_TREASURE_KEY`, value0 3–5) | done | | P2 stones | 28444 破碑之石+4 (`APPLY_ATTBONUS_STONE`), 28445 Boss stone (`APPLY_ATTBONUS_BOSS`) | done | | P3 dragon armor | 21210–21219 暗龙 (warrior), 21230– 风龙 (assassin), 21250– 魔龙 (sura), 21270– 神龙 (shaman), +0..+9 | done (client) | | P4 sash | 85004 领主 / 85008 大师 / 85014 王朝 / 85018 皇家 披风 (`COSTUME_SASH`, grade 4) | done, not deployed | | P5 mounts | 71502 / 71505 / 71508 / 71511 坐骑时装 (`COSTUME_MOUNT`), 71234 / 71254 坐骑外观 (`COSTUME_MOUNT_SKIN`) + mobs 32012 / 32028 | done, not deployed | ## P1: boxes and keys 40250 already has both types. A key opens a box when their value0 match (char_item.cpp, `ITEM_TREASURE_KEY`); the box then hands out its special_item_group group (live since the drops deploy). 203's own boxes use value0 0–2, so AVA2's 3–5 don't clash. ## P2: stone and Boss bonus The points exist from the biolog port (POINT_ATTBONUS_STONE 240, POINT_ATTBONUS_BOSS 241, damage in battle.cpp); the apply types did not. - `APPLY_ATTBONUS_STONE = 139`, `APPLY_ATTBONUS_BOSS = 140` (common/length.h), the same numbers as AVA2 and the client (`ItemData.h`). 92–138 are reserved for AVA2 applies not ported yet: `aApplyInfo` maps them to POINT_NONE and ProtoReader's `arApplyType` names them `APPLY_RESERVED_`, so array index = apply number. - `CHARACTER::ApplyPoint` handles both like the other additive applies. - ProtoReader is in the db, so **the db binary must be redeployed with the game**; an old db rejects the items' `APPLY_ATTBONUS_*` columns. - The two stones share AVA2's stone family 31 (value5), so a weapon holds only one of them. The 7 guardian weapons keep their AVA2 `APPLY_ATTBONUS_BOSS 5`. Test: `tests/features/test_applies.py` (numbering in length.h, constants.cpp, ProtoReader and the client header). ## P3: dragon armor Ordinary `ARMOR_BODY` items; the server needed nothing. All ten refine steps are imported so the refine chain (refine sets 81–89, 203's own costs) works; +9 ends the chain. The look is armor shape 32 (value3). The 40250 race msm stop at shape 30, and they cannot be patched from a pack (a bare file name always comes from the root pack). The client therefore registers the shape after each race msm load: script `mt_shapes` (metin2-client `src/platform/ScriptLib/ArmorShapesScript.inc`). The models `_7_1.gr2` (+ LODs, skin) ship in the ava2items pack. **Open:** AVA2 requires level 115–120. 203 caps at MAX_LEVEL 105, so nobody can wear the armor, nor the guardian weapons (level 120) already live. ## P4: sash AVA2's sash (acce) system, ported from `Srcs/Server` (`#ifdef __SASH_SYSTEM__`) into `game/src/port_sash.cpp`. - Item: `ITEM_COSTUME` / `COSTUME_SASH = 3` (ProtoReader `arSub28`, so **the db binary changes too**). value0 = grade (the four imported sashes are grade 4); socket0 = absorption %, socket1 = vnum of the absorbed weapon/armor. An unrolled grade-4 sash gets 11–25 % on first equip/creation (`SASH_GRADE_4_ABS_*`), combining caps at 19 %. - Slot `WEAR_COSTUME_SASH = 24`; `PART_SASH` follows `PART_HAIR`. The part is not stored in the player table: `SetPlayerProto` clears it and the equipped sash sets it to vnum − 85000, +1000 once absorption reaches 19 % (the client shows the glow above 86000). - **Protocol:** `CHR_EQUIPPART_SASH` is a fifth `awPart` WORD in GC_CHARACTER_ADD / ADD2 / UPDATE, `HEADER_CG_SASH = 211`, `HEADER_GC_SASH = 215`. Old clients break; the server and the client deploy together. - Absorbed bonuses: the sash adds the absorbed item's applies, attributes and (weapons) attack values scaled by absorption, `int(v*abs/100 + .5)` (+1 when positive), in `CItem::ModifyPoints` and battle.cpp. `MTSASH ` chat commands report window errors and results to the client (`mt_sash`). - Combine: two sashes of the same grade, price 100k/200k/300k/500k by grade, success 80/70/50/30 %. Absorb: sash + weapon/armor, the material is destroyed. - Window: quest `sash` on 王铁匠 20016 (203 has no NPC 60003), `pc.open_sash(true)` combine / `(false)` absorb: metin2-client `tools/server/sash` (installs `pc.open_sash` into quest_functions). - Client: `src/platform/ScriptLib/SashScript.inc` (`mt_sash`: windows, costume slot, tooltips), models + `item_scale.txt` + effects in the ava2items pack. Test: `tests/features/test_sash.py` (numbering, packet layout shared with the client header, quest hook). ## P5: mount costume and mount skin AVA2's `ENABLE_MOUNT_COSTUME_SYSTEM` + `ENABLE_MOUNT_SKIN`, ported 1:1 into `game/src/port_mount.cpp`. They ride on the 40250 horse: the worn costume only changes the horse race. - Items: `ITEM_COSTUME` / `COSTUME_MOUNT = 2` and `COSTUME_MOUNT_SKIN = 4` (AVA2 numbers the skin 7; ProtoReader `arSub28` gains `COSTUME_MOUNT_SKIN`, so **the db binary changes again**). value0 = horse race. - 71502 狮子 20113 (怪物强悍 +30 %), 71505 野猪 20110 (破碑 +30 %), 71508 狼 20111 (Boss +30 %), 71511 20112 (双倍经验 30 %). - The applies count while the costume is worn. - Skins 71234 蓝色巴里 → 32012, 71254 白色冬日羊驼 → 32028. - Both subtypes return no attribute set (`GetAttributeSetIndex` −1, the sash too), so they cannot be rerolled. - Slots `WEAR_COSTUME_MOUNT = 25` and `WEAR_COSTUME_MOUNT_SKIN = 26`. - `GetMyHorseVnum`: the worn skin's value0, else the worn mount's value0, else the horse-level race. - Summoning and riding still need horse level ≥ 1, as on AVA2; equipping without a horse says `MTMOUNT need_horse`. - Riding uses horse stamina. - Hooks follow AVA2: - Equipping re-summons. - Taking the mount off sends the horse away; taking the skin off re-summons. - A skin needs a worn mount (`need_mount`). Neither piece changes while riding (`riding`). The mount stays while a skin is worn (`has_skin`). - A worn mount is summoned on login. - `/user_horse_back` also takes the mount off. - Mobs 32012 / 32028 come from the AVA2 mob_proto rows (`mobs-server.tsv`, installed by `install_items.py … `). - Client: - RaceManager `__IsNewMountRace` (32000–32100 → `npc_mount`). - `mt_mount` (`MountScript.inc`) registers the npclist rows, adds the costume window slots and renders the `MTMOUNT` messages. - The models ship in the ava2items pack (`MOUNT_MOBS`). Test: `tests/features/test_mount.py`.