Five character slots (AVA2 ENABLE_PLAYER_PER_ACCOUNT5)
PLAYER_PER_ACCOUNT 5: player_index.pid5 in the login/empire/monarch queries, char_change_empire sized by PLAYER_PER_ACCOUNT, slot check relaxed; client gate mt20261029. tools/player-slots5 adds pid5. tools/player-deleted-sync: PLAYER_DELETE copies with SELECT *, so player_deleted must match player column for column; the conqueror schema now adds its columns to player_deleted too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
31ebae050b
commit
96f8486306
@@ -1,11 +1,11 @@
|
||||
-- AVA2 conqueror (Yohara) level: per-player columns read/written by db ClientManagerLogin/Player.
|
||||
-- Idempotent: run against the player schema (player / player_sb).
|
||||
DROP PROCEDURE IF EXISTS mt_conqueror_add_columns;
|
||||
-- Idempotent: run against the player schema (player / player_sb). Adds the columns to player and player_deleted.
|
||||
DROP PROCEDURE IF EXISTS mt_conqueror_add_columns_to;
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE mt_conqueror_add_columns()
|
||||
CREATE PROCEDURE mt_conqueror_add_columns_to(tbl VARCHAR(64))
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'player' AND COLUMN_NAME = 'conquerorlevel') THEN
|
||||
ALTER TABLE player
|
||||
IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = tbl AND COLUMN_NAME = 'conquerorlevel') THEN
|
||||
SET @mt_sql = CONCAT('ALTER TABLE ', tbl, '
|
||||
ADD COLUMN conquerorlevel tinyint(3) unsigned NOT NULL DEFAULT 0,
|
||||
ADD COLUMN conqueror_level_step tinyint(3) unsigned NOT NULL DEFAULT 0,
|
||||
ADD COLUMN sungma_str smallint(6) NOT NULL DEFAULT 0,
|
||||
@@ -13,9 +13,14 @@ BEGIN
|
||||
ADD COLUMN sungma_move smallint(6) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN sungma_inmune smallint(6) NOT NULL DEFAULT 0,
|
||||
ADD COLUMN conqueror_exp int(10) unsigned NOT NULL DEFAULT 0,
|
||||
ADD COLUMN conqueror_point smallint(6) NOT NULL DEFAULT 0;
|
||||
ADD COLUMN conqueror_point smallint(6) NOT NULL DEFAULT 0');
|
||||
PREPARE mt_stmt FROM @mt_sql;
|
||||
EXECUTE mt_stmt;
|
||||
DEALLOCATE PREPARE mt_stmt;
|
||||
END IF;
|
||||
END //
|
||||
DELIMITER ;
|
||||
CALL mt_conqueror_add_columns();
|
||||
DROP PROCEDURE mt_conqueror_add_columns;
|
||||
-- player_deleted too: db PLAYER_DELETE copies rows with INSERT INTO player_deleted SELECT * FROM player.
|
||||
CALL mt_conqueror_add_columns_to('player');
|
||||
CALL mt_conqueror_add_columns_to('player_deleted');
|
||||
DROP PROCEDURE mt_conqueror_add_columns_to;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# db PLAYER_DELETE copies the row with INSERT INTO player_deleted SELECT * FROM player, so the two tables
|
||||
# need the same columns in the same order. Appends the player columns player_deleted lacks (columns added
|
||||
# to player by later schema changes, e.g. HEAD inventory_0..5/shopFlag, conqueror), then checks the order.
|
||||
# sh sync.sh <player db> e.g. sh sync.sh player_sb
|
||||
set -e
|
||||
DB=${1:?player db}
|
||||
Q="mysql -uroot -N $DB -e"
|
||||
ALTER=$($Q "SELECT GROUP_CONCAT(CONCAT('ADD COLUMN \`', column_name, '\` ', column_type,
|
||||
IF(is_nullable='NO', ' NOT NULL', ' NULL'),
|
||||
IF(column_default IS NULL, '', CONCAT(' DEFAULT ', QUOTE(column_default))))
|
||||
ORDER BY ordinal_position SEPARATOR ', ')
|
||||
FROM information_schema.COLUMNS p WHERE table_schema=DATABASE() AND table_name='player'
|
||||
AND column_name NOT IN (SELECT column_name FROM information_schema.COLUMNS WHERE table_schema=DATABASE() AND table_name='player_deleted')")
|
||||
if [ "$ALTER" != NULL ]; then
|
||||
echo "ALTER TABLE player_deleted $ALTER"
|
||||
$Q "ALTER TABLE player_deleted $ALTER"
|
||||
fi
|
||||
BAD=$($Q "SELECT COUNT(*) FROM information_schema.COLUMNS p LEFT JOIN information_schema.COLUMNS d
|
||||
ON d.table_schema=p.table_schema AND d.table_name='player_deleted' AND d.ordinal_position=p.ordinal_position
|
||||
WHERE p.table_schema=DATABASE() AND p.table_name='player' AND (d.column_name IS NULL OR d.column_name<>p.column_name)")
|
||||
[ "$BAD" = 0 ] || { echo "player_deleted column order differs from player in $BAD places" >&2; exit 1; }
|
||||
echo "player_deleted matches player"
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Five character slots: player_index.pid5. Idempotent.
|
||||
# sh install.sh <player db> e.g. sh install.sh player_sb
|
||||
# Install before starting a db/game built with ENABLE_PLAYER_PER_ACCOUNT5 (its login queries select pid5).
|
||||
set -e
|
||||
DB=${1:?player db}
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
HAS=$(mysql -uroot -N "$DB" -e "SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='$DB' AND TABLE_NAME='player_index' AND COLUMN_NAME='pid5'")
|
||||
[ "$HAS" = 0 ] && mysql -uroot "$DB" < "$HERE/schema.sql"
|
||||
mysql -uroot "$DB" -e "SHOW COLUMNS FROM player_index LIKE 'pid%'"
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Five character slots (ENABLE_PLAYER_PER_ACCOUNT5): player_index gets a fifth pid column.
|
||||
ALTER TABLE player_index ADD pid5 int(11) NOT NULL DEFAULT 0 AFTER pid4, ADD KEY pid5_key (pid5);
|
||||
Reference in New Issue
Block a user