Add the battle pass (port of AVA2 ENABLE_BATTLE_PASS)

Monthly seasons from share/locale/<locale>/port_battlepass.tsv, up to ten
missions (kills, boss, stone, play time, fishing, refine, level, NPC spend,
NPC sell) with per-mission and final rewards. Progress is counted in memory
and flushed additively on save; claims are idempotent via INSERT IGNORE.
Client protocol: /mt_bp 1 info|claim N|close -> MTBP1 lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-16 09:11:36 +09:00
co-authored by Claude Opus 5.5
parent 1bdaae8807
commit 7f4e8b3f76
15 changed files with 964 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
# PORT battle pass seasons (docs/FEATURE-BATTLEPASS.md). Installed as share/locale/newcibn/port_battlepass.tsv;
# every core rereads it within 5 s of an atomic replace. Any error disables the battle pass (see syserr PORT_BP).
#
# season ID START END unix seconds, START inclusive, END exclusive; seasons must not overlap
# mission SLOT TYPE SUB TARGET [VNUM COUNT]x0..3
# SLOT 1..10. Progress and claims are stored per season and slot: do not reuse a slot for another mission
# within a running season.
# TYPE 1 kill monster (SUB mob vnum or 0 = any normal monster) 2 kill boss (SUB vnum or 0)
# 3 kill metin stone (SUB vnum or 0) 4 seconds online 5 catch fish (SUB item vnum or 0)
# 6 successful refine (SUB result vnum or 0) 7 levels gained 8 gold paid to NPC shops
# 9 items sold to NPC shops (SUB item vnum, required)
# Kills count for the player the quest kill goes to, within 20 levels of the monster.
# final VNUM COUNT x1..6 once every mission of the season is done
MTBATTLEPASS 1
# 2026-10 (Europe/Berlin)
season 202610 1790805600 1793487600
mission 1 1 0 20000 70043 1 71153 5
mission 2 2 0 30 25041 2 71032 1
mission 3 3 0 300 50513 3
mission 4 4 0 172800 71094 2
mission 5 5 0 100 27987 5
mission 6 6 0 50 25040 2
mission 7 7 0 5 71153 5
mission 8 8 0 50000000 71084 20
final 27992 2 27993 1 27994 1 70024 1
# 2026-11 (Europe/Berlin)
season 202611 1793487600 1796079600
mission 1 1 0 20000 70043 1 71153 5
mission 2 2 0 30 25041 2 71032 1
mission 3 3 0 300 50513 3
mission 4 4 0 172800 71094 2
mission 5 5 0 100 27987 5
mission 6 6 0 50 25040 2
mission 7 7 0 5 71153 5
mission 8 8 0 50000000 71084 20
final 27992 2 27993 1 27994 1 70024 1
# 2026-12 (Europe/Berlin)
season 202612 1796079600 1798758000
mission 1 1 0 20000 70043 1 71153 5
mission 2 2 0 30 25041 2 71032 1
mission 3 3 0 300 50513 3
mission 4 4 0 172800 71094 2
mission 5 5 0 100 27987 5
mission 6 6 0 50 25040 2
mission 7 7 0 5 71153 5
mission 8 8 0 50000000 71084 20
final 27992 2 27993 1 27994 1 70024 1
1 # PORT battle pass seasons (docs/FEATURE-BATTLEPASS.md). Installed as share/locale/newcibn/port_battlepass.tsv;
2 # every core rereads it within 5 s of an atomic replace. Any error disables the battle pass (see syserr PORT_BP).
3 #
4 # season ID START END unix seconds, START inclusive, END exclusive; seasons must not overlap
5 # mission SLOT TYPE SUB TARGET [VNUM COUNT]x0..3
6 # SLOT 1..10. Progress and claims are stored per season and slot: do not reuse a slot for another mission
7 # within a running season.
8 # TYPE 1 kill monster (SUB mob vnum or 0 = any normal monster) 2 kill boss (SUB vnum or 0)
9 # 3 kill metin stone (SUB vnum or 0) 4 seconds online 5 catch fish (SUB item vnum or 0)
10 # 6 successful refine (SUB result vnum or 0) 7 levels gained 8 gold paid to NPC shops
11 # 9 items sold to NPC shops (SUB item vnum, required)
12 # Kills count for the player the quest kill goes to, within 20 levels of the monster.
13 # final VNUM COUNT x1..6 once every mission of the season is done
14 MTBATTLEPASS 1
15 # 2026-10 (Europe/Berlin)
16 season 202610 1790805600 1793487600
17 mission 1 1 0 20000 70043 1 71153 5
18 mission 2 2 0 30 25041 2 71032 1
19 mission 3 3 0 300 50513 3
20 mission 4 4 0 172800 71094 2
21 mission 5 5 0 100 27987 5
22 mission 6 6 0 50 25040 2
23 mission 7 7 0 5 71153 5
24 mission 8 8 0 50000000 71084 20
25 final 27992 2 27993 1 27994 1 70024 1
26 # 2026-11 (Europe/Berlin)
27 season 202611 1793487600 1796079600
28 mission 1 1 0 20000 70043 1 71153 5
29 mission 2 2 0 30 25041 2 71032 1
30 mission 3 3 0 300 50513 3
31 mission 4 4 0 172800 71094 2
32 mission 5 5 0 100 27987 5
33 mission 6 6 0 50 25040 2
34 mission 7 7 0 5 71153 5
35 mission 8 8 0 50000000 71084 20
36 final 27992 2 27993 1 27994 1 70024 1
37 # 2026-12 (Europe/Berlin)
38 season 202612 1796079600 1798758000
39 mission 1 1 0 20000 70043 1 71153 5
40 mission 2 2 0 30 25041 2 71032 1
41 mission 3 3 0 300 50513 3
42 mission 4 4 0 172800 71094 2
43 mission 5 5 0 100 27987 5
44 mission 6 6 0 50 25040 2
45 mission 7 7 0 5 71153 5
46 mission 8 8 0 50000000 71084 20
47 final 27992 2 27993 1 27994 1 70024 1
+20
View File
@@ -0,0 +1,20 @@
-- PORT: battle pass tables (docs/FEATURE-BATTLEPASS.md). Idempotent; run once on the player database.
-- Progress: one row per player, season and mission slot; the game adds deltas and MySQL caps them at target.
CREATE TABLE IF NOT EXISTS player.mt_battlepass_progress (
pid INT UNSIGNED NOT NULL,
season INT UNSIGNED NOT NULL,
slot TINYINT UNSIGNED NOT NULL,
value BIGINT UNSIGNED NOT NULL DEFAULT 0,
target BIGINT UNSIGNED NOT NULL DEFAULT 0,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (pid, season, slot)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Claims: the primary key is the idempotency guard; only the request whose INSERT IGNORE adds the row pays out.
-- slot 0 is the final reward.
CREATE TABLE IF NOT EXISTS player.mt_battlepass_claim (
pid INT UNSIGNED NOT NULL,
season INT UNSIGNED NOT NULL,
slot TINYINT UNSIGNED NOT NULL,
claimed_at INT UNSIGNED NOT NULL,
PRIMARY KEY (pid, season, slot)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;