AVA2 unlock P1/P2: stone and Boss bonus apply types

APPLY_ATTBONUS_STONE 139 / APPLY_ATTBONUS_BOSS 140 (AVA2 numbering, 92-138
reserved) in the game and the db proto reader; docs/FEATURE-AVA2-UNLOCK.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-16 11:05:16 +09:00
co-authored by Claude Opus 5.5
parent 89261fdf8a
commit 5ad07886ea
6 changed files with 124 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
# 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 |
## 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_<n>`, 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).
+5
View File
@@ -437,6 +437,11 @@ enum EApplyTypes
APPLY_ANTI_PENETRATE_PCT, //91 관통타격 저항
// PORT AVA2 bonus numbering (AVA2 common/length.h): 92-138 are AVA2 applies not ported yet,
// kept free so later ports and the client item_proto keep AVA2's numbers.
APPLY_ATTBONUS_STONE = 139,
APPLY_ATTBONUS_BOSS = 140,
MAX_APPLY_NUM, //
};
+8
View File
@@ -393,6 +393,14 @@ int get_Item_ApplyType_Value(string inputString)
"APPLY_EXTRACT_HP_PCT", "APPLY_RESIST_WARRIOR", "APPLY_RESIST_ASSASSIN", "APPLY_RESIST_SURA", "APPLY_RESIST_SHAMAN",
"APPLY_ENERGY", "APPLY_DEF_GRADE", "APPLY_COSTUME_ATTR_BONUS", "APPLY_MAGIC_ATTBONUS_PER", "APPLY_MELEE_MAGIC_ATTBONUS_PER",
"APPLY_RESIST_ICE", "APPLY_RESIST_EARTH", "APPLY_RESIST_DARK", "APPLY_ANTI_CRITICAL_PCT", "APPLY_ANTI_PENETRATE_PCT",
// PORT AVA2 numbering: 92-138 not ported yet (common/length.h)
"APPLY_RESERVED_92", "APPLY_RESERVED_93", "APPLY_RESERVED_94", "APPLY_RESERVED_95", "APPLY_RESERVED_96", "APPLY_RESERVED_97", "APPLY_RESERVED_98", "APPLY_RESERVED_99",
"APPLY_RESERVED_100", "APPLY_RESERVED_101", "APPLY_RESERVED_102", "APPLY_RESERVED_103", "APPLY_RESERVED_104", "APPLY_RESERVED_105", "APPLY_RESERVED_106", "APPLY_RESERVED_107",
"APPLY_RESERVED_108", "APPLY_RESERVED_109", "APPLY_RESERVED_110", "APPLY_RESERVED_111", "APPLY_RESERVED_112", "APPLY_RESERVED_113", "APPLY_RESERVED_114", "APPLY_RESERVED_115",
"APPLY_RESERVED_116", "APPLY_RESERVED_117", "APPLY_RESERVED_118", "APPLY_RESERVED_119", "APPLY_RESERVED_120", "APPLY_RESERVED_121", "APPLY_RESERVED_122", "APPLY_RESERVED_123",
"APPLY_RESERVED_124", "APPLY_RESERVED_125", "APPLY_RESERVED_126", "APPLY_RESERVED_127", "APPLY_RESERVED_128", "APPLY_RESERVED_129", "APPLY_RESERVED_130", "APPLY_RESERVED_131",
"APPLY_RESERVED_132", "APPLY_RESERVED_133", "APPLY_RESERVED_134", "APPLY_RESERVED_135", "APPLY_RESERVED_136", "APPLY_RESERVED_137", "APPLY_RESERVED_138",
"APPLY_ATTBONUS_STONE", "APPLY_ATTBONUS_BOSS",
};
int retInt = -1;
+2
View File
@@ -3827,6 +3827,8 @@ void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal)
case APPLY_DEF_GRADE: // 83 방어력. DEF_GRADE_BONUS는 클라에서 두배로 보여지는 의도된 버그(...)가 있다.
case APPLY_COSTUME_ATTR_BONUS: // 84 코스튬 아이템에 붙은 속성치 보너스
case APPLY_MAGIC_ATTBONUS_PER: // 85 마법 공격력 +x%
case APPLY_ATTBONUS_STONE:
case APPLY_ATTBONUS_BOSS:
case APPLY_MELEE_MAGIC_ATTBONUS_PER: // 86 마법 + 밀리 공격력 +x%
PointChange(aApplyInfo[bApplyType].bPointType, iVal);
break;
+52
View File
@@ -914,6 +914,56 @@ const TApplyInfo aApplyInfo[MAX_APPLY_NUM] =
{ POINT_RESIST_DARK, }, // APPLY_RESIST_DARK, 89
{ POINT_RESIST_CRITICAL, }, // APPLY_ANTI_CRITICAL_PCT, 90
{ POINT_RESIST_PENETRATE, }, // APPLY_ANTI_PENETRATE_PCT, 91
// PORT AVA2 applies 92-138, not ported yet
{ POINT_NONE }, // 92
{ POINT_NONE }, // 93
{ POINT_NONE }, // 94
{ POINT_NONE }, // 95
{ POINT_NONE }, // 96
{ POINT_NONE }, // 97
{ POINT_NONE }, // 98
{ POINT_NONE }, // 99
{ POINT_NONE }, // 100
{ POINT_NONE }, // 101
{ POINT_NONE }, // 102
{ POINT_NONE }, // 103
{ POINT_NONE }, // 104
{ POINT_NONE }, // 105
{ POINT_NONE }, // 106
{ POINT_NONE }, // 107
{ POINT_NONE }, // 108
{ POINT_NONE }, // 109
{ POINT_NONE }, // 110
{ POINT_NONE }, // 111
{ POINT_NONE }, // 112
{ POINT_NONE }, // 113
{ POINT_NONE }, // 114
{ POINT_NONE }, // 115
{ POINT_NONE }, // 116
{ POINT_NONE }, // 117
{ POINT_NONE }, // 118
{ POINT_NONE }, // 119
{ POINT_NONE }, // 120
{ POINT_NONE }, // 121
{ POINT_NONE }, // 122
{ POINT_NONE }, // 123
{ POINT_NONE }, // 124
{ POINT_NONE }, // 125
{ POINT_NONE }, // 126
{ POINT_NONE }, // 127
{ POINT_NONE }, // 128
{ POINT_NONE }, // 129
{ POINT_NONE }, // 130
{ POINT_NONE }, // 131
{ POINT_NONE }, // 132
{ POINT_NONE }, // 133
{ POINT_NONE }, // 134
{ POINT_NONE }, // 135
{ POINT_NONE }, // 136
{ POINT_NONE }, // 137
{ POINT_NONE }, // 138
{ POINT_ATTBONUS_STONE }, // APPLY_ATTBONUS_STONE 139
{ POINT_ATTBONUS_BOSS }, // APPLY_ATTBONUS_BOSS 140
};
const int aiItemMagicAttributePercentHigh[ITEM_ATTRIBUTE_MAX_LEVEL] =
@@ -1281,6 +1331,8 @@ TValueName c_aApplyTypeNames[] =
{ "MAGIC_ATTBONUS_PER", APPLY_MAGIC_ATTBONUS_PER },
{ "MELEE_MAGIC_ATTBONUS_PER", APPLY_MELEE_MAGIC_ATTBONUS_PER },
{ "ATTBONUS_STONE", APPLY_ATTBONUS_STONE },
{ "ATTBONUS_BOSS", APPLY_ATTBONUS_BOSS },
{ NULL, 0 }
};
// from import_item_proto.c
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""AVA2 bonus numbering: the stone/boss applies the AVA2 stones and guardian weapons carry (docs/FEATURE-AVA2-UNLOCK.md)."""
from pathlib import Path
import re
ROOT=Path(__file__).resolve().parents[2]
SRC=ROOT/'src/server'
def source(name):return (SRC/name).read_bytes().decode('latin1')
length=source('common/length.h')
enum=length[length.index('enum EApplyTypes'):] if 'enum EApplyTypes' in length else length[length.index('APPLY_NONE'):]
enum=enum[:enum.index('MAX_APPLY_NUM')]
assert 'APPLY_ATTBONUS_STONE = 139,' in enum and 'APPLY_ATTBONUS_BOSS = 140,' in enum and enum.rstrip().endswith('= 140,')
# the db reads apply names by position, so the array index is the apply number
reader=source('db/src/ProtoReader.cpp')
names=re.findall(r'"([^"]+)"',re.search(r'arApplyType\[\]\s*=\s*\{(.*?)\};',reader,re.S).group(1))
assert len(names)==141 and names[91]=='APPLY_ANTI_PENETRATE_PCT' and names[139:]==['APPLY_ATTBONUS_STONE','APPLY_ATTBONUS_BOSS'],names[88:]
# aApplyInfo is indexed by apply number: 141 rows, the two new ones mapped to the biolog points
constants=source('game/src/constants.cpp')
table=constants[constants.index('aApplyInfo[MAX_APPLY_NUM]'):]
table=table[table.index('{')+1:table.index('};')]
rows=re.findall(r'\{\s*(POINT_[A-Z_]+)',table)
assert len(rows)==141 and rows[139:]==['POINT_ATTBONUS_STONE','POINT_ATTBONUS_BOSS'] and set(rows[92:139])=={'POINT_NONE'},len(rows)
assert '"ATTBONUS_STONE",\tAPPLY_ATTBONUS_STONE' in constants and '"ATTBONUS_BOSS",\tAPPLY_ATTBONUS_BOSS' in constants
char=source('game/src/char.cpp')
apply=char[char.index('void CHARACTER::ApplyPoint('):char.index('void CHARACTER::MotionPacketEncode(')]
assert 'case APPLY_ATTBONUS_STONE:' in apply and 'case APPLY_ATTBONUS_BOSS:' in apply
points=source('game/src/char.h')
assert 'POINT_ATTBONUS_STONE = 240,' in points and 'POINT_ATTBONUS_BOSS = 241,' in points
battle=source('game/src/battle.cpp')
assert 'GetPoint(POINT_ATTBONUS_STONE)' in battle and 'GetPoint(POINT_ATTBONUS_BOSS)' in battle
print('PASS: stone/boss applies 139/140 in the db reader, aApplyInfo, apply names and ApplyPoint')