feat: add AVA2 64-bit gold protocol and client formatting

This commit is contained in:
shen
2026-10-19 23:23:31 -07:00
parent f386815353
commit 86a769f7dd
12 changed files with 169 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
# AVA2 64-bit Gold Migration
## 概述
为了与 AVA2 客户端的万亿金币体系(最高 `2,000,000,000,000,000`)对齐,本迁移将数据库 `player`、`safebox`、`guild` 中的 `gold` 字段扩展为 `BIGINT(20) UNSIGNED`。
## 协议
- 封包:`HEADER_GC_EXTENDED_POINTS`(218),Subheader `EXTENDED_POINT_SUB_GOLD_SET`(1)。
- 长度:固定 10 字节(Header 1B + Subheader 1B + `int64_t gold` 8B)。
## 运维执行
在执行前确保停服并做逻辑备份:
```bash
mysqldump -u root -p --single-transaction player > /root/backup-gold/player_before_64bit.sql
mysql -u root -p player < migrate_gold_64bit.sql
```
回滚:
```bash
mysql -u root -p player < rollback_gold_64bit.sql
```
@@ -0,0 +1,20 @@
-- AVA2 64-bit Gold Migration Script
-- Date: 2026-10-20
-- Expands gold columns from INT(11) to BIGINT(20) UNSIGNED to support up to 2,000,000,000,000,000 gold.
-- 1. Character table (player.player)
ALTER TABLE `player`
MODIFY COLUMN `gold` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0;
-- 2. Safebox table (player.safebox)
ALTER TABLE `safebox`
MODIFY COLUMN `gold` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0;
-- 3. Guild funds (player.guild)
ALTER TABLE `guild`
MODIFY COLUMN `gold` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0;
-- 4. Log tables (if log database exists)
ALTER TABLE `log`.`goldlog`
MODIFY COLUMN `current_gold` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
MODIFY COLUMN `change_gold` BIGINT(20) NOT NULL DEFAULT 0;
@@ -0,0 +1,15 @@
-- AVA2 64-bit Gold Rollback Script
-- Date: 2026-10-20
-- WARNING: Clamps values above 2,000,000,000 to prevent integer truncation errors before modifying columns back to INT(11).
UPDATE `player` SET `gold` = 2000000000 WHERE `gold` > 2000000000;
ALTER TABLE `player`
MODIFY COLUMN `gold` INT(11) NOT NULL DEFAULT 0;
UPDATE `safebox` SET `gold` = 2000000000 WHERE `gold` > 2000000000;
ALTER TABLE `safebox`
MODIFY COLUMN `gold` INT(11) NOT NULL DEFAULT 0;
UPDATE `guild` SET `gold` = 2000000000 WHERE `gold` > 2000000000;
ALTER TABLE `guild`
MODIFY COLUMN `gold` INT(11) NOT NULL DEFAULT 0;