Port AVA2 native tracker and item-currency ticket shop

This commit is contained in:
shen
2026-10-18 10:41:51 -07:00
parent 83809631ed
commit 5decc93798
33 changed files with 1850 additions and 17 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ GM 测试:`/level 120`,`/item 25168`(或 25169、25170),再 `/warp`
- `lc_quest("KEY")` 和任务提示编号换成中文(203 的任务直接写字符串);`NO_CH2` 改成 203 的格式。
- `GetMissionInfo(level, seconds)` 换成 `cmdchat("RefreshDungeonTimer ...")`。客户端的 `mt_dungeon_timer`(`src/platform/ScriptLib/DungeonTimerScript.inc`)收到后,在小地图的位置显示 AVA2 的副本计时器:Boss 头像、第几层(船防是第几波)和倒计时。船防地图里还会显示 `gethydrahp` 发来的船桅血条。计时器图片在 `../ava2-maps` 打的 ava2maps 包里。
- 去掉 203 没有的战令任务(`do_battlepass_mission`)、地下城追踪(`d.track_update`)和 `DUNGEON_COOLDOWN_EVENT` 分支,普通冷却保留。
- 去掉 203 没有的战令任务(`do_battlepass_mission`)和 `DUNGEON_COOLDOWN_EVENT` 分支,普通冷却保留。2026-10-18 接入原生追踪后保留 `d.track_update`,三份任务已在 sbtest 单独重编译。
- 203 没有 `time_str`,改成秒数。
- 九头蛇地图从 AVA2 的 972800,153600 搬到了 3276800,0,入口 10049,1652 改成 33089,116。
- 修 AVA2 的两个 bug:冰雪任务 `nemere_full_timer` / `nemere_dead_timer` 里的 `index` 没有定义;赤龙 `6230.attack` 的 `set_meley_hp` 同样。
+4 -5
View File
@@ -5,7 +5,7 @@ The quests are AVA2's quest/Mazmorras/{snow,shipdefense,meleylair}.lua with asse
match, so a changed source fails loudly):
- lc_quest("KEY") and the mission notice numbers become zh text (the 203 quests carry their strings inline);
- GetMissionInfo(level, seconds) becomes d.command("RefreshDungeonTimer ...") (the client ignores it for now);
- the battle pass / dungeon tracker calls and the DUNGEON_COOLDOWN_EVENT branch go (203 has neither; the normal
- the battle pass calls and the DUNGEON_COOLDOWN_EVENT branch go (the normal
cooldown stays: snow 60 min, ship and Meley 3 h);
- time_str, which 203 lacks, becomes seconds;
- the hydra map entry moves with the map (AVA2 972800,153600 -> 203 3276800,0: entry 10049,1652 -> 33089,116);
@@ -53,7 +53,7 @@ FIXES=[
('MeleyDungeon','npc.set_meley_hp(index,6230,','npc.set_meley_hp(d.get_map_index(),6230,',8),
('MeleyDungeon','say("Bileti olmayan \xfcyeler: ")','say("以下玩家没有钥匙:")',1),
]
NEW_FUNCTIONS=['d.mission_notice','d.global_warp_all_to_base','d.new_kill_all','d.command','d.dungeon_remove_all',
NEW_FUNCTIONS=['d.track_update','d.mission_notice','d.global_warp_all_to_base','d.new_kill_all','d.command','d.dungeon_remove_all',
'd.kill_area','d.spawn_mob_new','npc.get_protect_time','npc.set_protect_time','npc.set_statu_affect',
'npc.set_statu_clear_aff','npc.show_statu','npc.set_meley_hp','npc.show_end_statu','npc.set_protect_flag2',
'npc.dead_by_vnum','npc.set_hp','npc.get_hp',
@@ -106,11 +106,10 @@ def convert(name,src):
t=re.sub(r'(d\.mission_notice\([^,()]+(?:\(\))?,)"(\d+ ?)"\)',notice,t)
t=re.sub(r'(d\.notice\()"(\d+)"\)',notice,t)
t=mission_info(t,name)
# AVA2 systems 203 does not have: battle pass missions, the dungeon tracker, DUNGEON_COOLDOWN_EVENT.
# AVA2 systems 203 does not have: battle pass missions and DUNGEON_COOLDOWN_EVENT (tracker callback is now native).
t=re.sub(r'[ \t]*do_battlepass_mission\([^\n]*\n','',t)
t=re.sub(r'[ \t]*d\.track_update\([^\n]*\n','',t)
t=re.sub(r'[ \t]*if game\.check_event\([^\n]*\n[^\n]*\n[ \t]*else[ \t]*\n([^\n]*\n)[ \t]*end[ \t]*\n',r'\1',t)
for bad in ('lc_quest','GetMissionInfo(','do_battlepass_mission','track_update','check_event','time_str'):
for bad in ('lc_quest','GetMissionInfo(','do_battlepass_mission','check_event','time_str'):
if bad in t.replace('--GetMissionInfo(','').replace('-- GetMissionInfo(',''):
raise SystemExit('%s: %s left'%(name,bad))
if not re.search(r'^quest %s begin'%re.escape(name),t,re.M):raise SystemExit(name+': quest name changed')
+17
View File
@@ -206,6 +206,14 @@ def pack_ui_subimages(assets,files):
updated=re.sub(rb'(?im)^version\s+\S+',b'version 1.0',updated)
sub.write_bytes(updated)
def copy_ui_literal_assets(text,assets,files):
"""Copy literal layout dependencies too, including placeholder icons used before runtime substitution."""
for name in re.findall(r"[\"']((?:icon/|d:/ymir work/ui/)[^\"']+\.(?:tga|dds|sub))[\"']",text,re.I):
name=name.lower().replace('\\','/')
if name not in files:raise ValueError('missing UI layout asset '+name)
target=assets/name;target.parent.mkdir(parents=True,exist_ok=True)
if not target.exists():shutil.copy2(files[name],target)
def server_proto(ava,filename):
path=ava/'2. Backup SF+SRC and SQL/home/srv1/db'/filename
if path.is_file():return path.read_bytes()
@@ -286,6 +294,15 @@ def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
if q.startswith('d:/ymir work/ui/game/gameoption/') or q in ('icon/item/70002.tga','d:/ymir work/ui/game/farm/premium_pickup.tga'):
target=assets/q;target.parent.mkdir(parents=True,exist_ok=True)
if not target.exists():shutil.copy2(files[q],target);copied+=1
# Original AVA2 native tracker: both selected ymirdesign layouts and all shared avatars.
track=assets/'uiscript/track';track.mkdir(parents=True,exist_ok=True)
for name in ('window_old.py','item_old.py'):
(track/name).write_bytes((pack_maker/'uiscript/uiscript/track'/name).read_bytes())
copy_ui_literal_assets((pack_maker/'uiscript/uiscript/track'/name).read_text(),assets,files)
for q in files:
if q.startswith('d:/ymir work/ui/game/track/'):
target=assets/q;target.parent.mkdir(parents=True,exist_ok=True)
if not target.exists():shutil.copy2(files[q],target);copied+=1
pack_ui_subimages(assets,files)
(output/'items-server.tsv').write_bytes(b'\n'.join(server)+b'\n')
(output/'items-client.tsv').write_bytes(b'\n'.join(client)+b'\n')
@@ -24,6 +24,14 @@ class UIAssetTests(unittest.TestCase):
self.assertIn(b'image "ava2_native/properties_01.dds"',v1.read_bytes())
self.assertIn(b'version 1.0',v2.read_bytes())
self.assertEqual((assets/'d:/ymir work/ui/ava2_native/switchbot/switchbot.tga').read_bytes(),b'switchbot atlas')
def test_tracker_placeholder_icon_is_a_required_dependency(self):
with tempfile.TemporaryDirectory() as tmp:
root=Path(tmp);icon=root/'source.tga';icon.write_bytes(b'original AVA2 image')
target=root/'assets';text='{"image":"icon/item/70068.tga"}'
with self.assertRaisesRegex(ValueError,'missing UI layout asset'):
m.copy_ui_literal_assets(text,target,{})
m.copy_ui_literal_assets(text,target,{'icon/item/70068.tga':icon})
self.assertEqual((target/'icon/item/70068.tga').read_bytes(),icon.read_bytes())
def test_missing_atlas_rejects_pack(self):
with tempfile.TemporaryDirectory() as tmp:
root=Path(tmp);(root/'a.sub').write_bytes(b'version 1.0\nimage "missing.dds"\n')
+3 -2
View File
@@ -25,11 +25,12 @@ MAPS={'plechito_desert_map_01':(57,'法老沙漠'),
'metin2_map_dawnmist_dungeon_01':(210,'晨雾地下城'),
'metin2_map_n_flame_dragon':(212,'赤龙巢穴'),
'metin2_map_n_snow_dungeon_01':(352,'冰雪地下城'),
'defensawe_hydra':(355,'九头蛇船防')}
'defensawe_hydra':(355,'九头蛇船防'),
'metin2_12zi_stage':(357,'十二生肖神殿')}
# The zh client already ships these maps (files and atlasinfo row).
CLIENT_HAS={'metin2_map_n_snow_dungeon_01'}
# AVA2 leaves these Town.txt files empty (players would land at the map's corner): the 10107 warp landing.
TOWN={'metin2_map_eastplain_01':b'133\t415\r\n'}
TOWN={'metin2_map_eastplain_01':b'133\t415\r\n', 'metin2_12zi_stage':b'768\t257\r\n'}
# defensawe_hydra (972800,153600 2x2) is 203's metin2_map_empirewar03; this corner is free on 203 and in
# the zh atlas. The shipdefense quest (L4) must shift its coordinates by the same delta.
RELOCATE={'defensawe_hydra':(3276800,0)}
+87
View File
@@ -133,3 +133,90 @@
20836 戟兵
20850 神秘祭坛
60003 西奥瓦丹
# AVA2 world boss / zodiac arena
9035 密本僧人
9800 生肖铠甲兵
9801 生肖铠甲兵战士
9802 生肖铠甲兵将军
9803 生肖死翼
9804 生肖死翼战士
9805 生肖死翼将军
9806 生肖魔洛克
9807 生肖魔洛克战士
9808 生肖魔洛克将军
9809 生肖斯巴达战士
9810 生肖斯巴达战士战士
9811 生肖斯巴达战士将军
9812 生肖掠食者
9813 生肖掠食者战士
9814 生肖掠食者将军
9815 生肖骸骨斗士
9816 生肖骸骨斗士战士
9817 生肖骸骨斗士将军
9818 生肖坎塔尔
9819 生肖坎塔尔战士
9820 生肖坎塔尔将军
9821 生肖乌鲁克
9822 生肖乌鲁克战士
9823 生肖乌鲁克将军
9824 生肖猛虎
9825 生肖猛虎战士
9826 生肖猛虎将军
9827 生肖尖啸者
9828 生肖尖啸者战士
9829 生肖尖啸者将军
9830 生肖瓦古尔夫
9831 生肖瓦古尔夫战士
9832 生肖瓦古尔夫将军
9833 生肖天使
9834 生肖天使战士
9835 生肖天使将军
9836 酉将军
9837 酉副官
9838 丑将军
9839 丑副官
9840 戌将军
9841 戌副官
9842 辰将军
9843 辰副官
9844 午将军
9845 午副官
9846 申将军
9847 申副官
9848 子将军
9849 子副官
9850 亥将军
9851 亥副官
9852 卯将军
9853 卯副官
9854 未将军
9855 未副官
9856 巳将军
9857 巳副官
9858 寅将军
9859 寅副官
9860 亥宫传送门
9861 戌宫传送门
9862 酉宫传送门
9863 申宫传送门
9864 未宫传送门
9865 午宫传送门
9866 巳宫传送门
9867 辰宫传送门
9868 卯宫传送门
9869 寅宫传送门
9870 丑宫传送门
9871 子宫传送门
9875 子鼠陨石
9876 丑牛陨石
9877 寅虎陨石
9878 辰龙陨石
9879 巳蛇陨石
9880 午马陨石
9881 未羊陨石
9882 申猴陨石
9883 酉鸡陨石
9884 戌狗陨石
9885 亥猪陨石
9886 卯兔陨石
Can't render this file because it contains an unexpected character in line 1 and column 104.
+5
View File
@@ -0,0 +1,5 @@
# AVA2 追踪数据快照
`newregen.txt` 是 AVA2 原配置中原生追踪窗口使用的五个世界首领记录;保留原始坐标、频道与日历规则。`shop12.tsv` 从 AVA2 原始 MyISAM 数据读取,四列依次为奖励 vnum、数量、兑换道具 vnum、数量。90010/90011/90012 是原建筑材料。
本轮只发布 sbtest。服务端实现、测试边界与资源生成入口见 `docs/AVA2-TRACK.md`。勿直接覆盖正式服已有 shop 12 或整个 proto;导入世界首领数据时只增加缺失的 85 条生肖记录和地图 357,不覆盖此前副本调整。
+6
View File
@@ -0,0 +1,6 @@
// AVA2 native uitrack IDs 0-4. Retain source calendar, positions and channel.
0 357 metin2_12zi_stage 775 279 0 0 0 23 0 0 1 0 2 0 0 9844
1 357 metin2_12zi_stage 284 756 0 0 0 23 0 0 1 0 2 0 0 9836
2 357 metin2_12zi_stage 767 743 0 0 0 23 0 0 1 0 2 0 0 9838
3 357 metin2_12zi_stage 1258 761 0 0 0 23 0 0 1 0 2 0 0 9840
4 357 metin2_12zi_stage 255 1268 0 0 0 23 0 0 1 0 2 0 0 9842
+8
View File
@@ -0,0 +1,8 @@
25163 1 90011 10
25164 1 90011 15
25165 1 90012 15
25166 1 90012 15
25167 1 90010 20
25168 1 90010 20
25169 1 90010 30
25170 1 90010 30
1 25163 1 90011 10
2 25164 1 90011 15
3 25165 1 90012 15
4 25166 1 90012 15
5 25167 1 90010 20
6 25168 1 90010 20
7 25169 1 90010 30
8 25170 1 90010 30