diff --git a/hwe/_admin5.php b/hwe/_admin5.php index 84c861fa..5ed1292e 100644 --- a/hwe/_admin5.php +++ b/hwe/_admin5.php @@ -86,7 +86,7 @@ $sel2[$type2] = "selected"; diff --git a/hwe/sammo/Scenario/Nation.php b/hwe/sammo/Scenario/Nation.php index f556568a..2f93b9d4 100644 --- a/hwe/sammo/Scenario/Nation.php +++ b/hwe/sammo/Scenario/Nation.php @@ -3,6 +3,7 @@ namespace sammo\Scenario; use \sammo\DB; use \sammo\GameConst; use \sammo\Util; +use \sammo\KVStorage; use function \sammo\getNationChiefLevel; class Nation{ @@ -82,6 +83,7 @@ class Nation{ } $db = DB::db(); + $nationStor = KVStorage::getStorage($db, 'nation_env'); $otherNations = $db->queryFirstColumn('SELECT nation FROM nation'); $db->insert('nation', [ @@ -98,7 +100,6 @@ class Nation{ 'war'=>0, 'strategic_cmd_limit'=>24, 'surlimit'=>72, - 'scoutmsg'=>$this->infoText, 'tech'=>$this->tech, 'level'=>$this->nationLevel, 'type'=>$type, @@ -109,7 +110,9 @@ class Nation{ 'nation'=>$this->id ], 'city IN %li', $cities); } - + + $scoutKey = "nation_scout_msg_{$this->id}"; + $nationStor->{$scoutKey} = $this->infoText; $diplomacy = []; diff --git a/hwe/select_npc.php b/hwe/select_npc.php index 3f6c3968..81743802 100644 --- a/hwe/select_npc.php +++ b/hwe/select_npc.php @@ -18,7 +18,18 @@ if(!$npcmode) { $gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2'); -$nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg FROM nation ORDER BY rand()'); +$nationList = $db->query('SELECT nation,`name`,color,scout FROM nation'); +shuffle($nationList); +$nationList = Util::convertArrayToDict($nationList, 'nation'); +$nationStor = KVStorage::getStorage($db, 'nation_env'); +//NOTE: join 안할것임 +$scoutMsgs = $nationStor->getValues(array_map(function($nationID){ + return "nation_scout_msg_{$nationID}"; +}, array_keys($nationList))); +foreach($scoutMsgs as $nationIDPack=>$scoutMsg){ + $nationID = Util::toInt(Util::array_last(explode('_', $nationIDPack))); + $nationList[$nationID]['scoutmsg'] = $scoutMsg; +} ?> diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 443ebe9a..abb55a45 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -117,7 +117,6 @@ CREATE TABLE `nation` ( `name` VARCHAR(64) NOT NULL COLLATE 'utf8mb4_bin', `color` CHAR(10) NOT NULL, `onlinegen` TEXT NULL DEFAULT '', - `msg` TEXT NULL DEFAULT '', `capital` INT(1) NULL DEFAULT '0', `capset` INT(6) NULL DEFAULT '0', `gennum` INT(3) NULL DEFAULT '1', @@ -132,13 +131,11 @@ CREATE TABLE `nation` ( `war` INT(1) NULL DEFAULT '0', `strategic_cmd_limit` INT(4) NULL DEFAULT '36', `surlimit` INT(4) NULL DEFAULT '72', - `scoutmsg` TEXT NULL DEFAULT '', `tech` float NULL DEFAULT '0', `power` INT(8) NULL DEFAULT '0', `spy` TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`spy`)), `level` INT(1) NULL DEFAULT '0', `type` VARCHAR(20) NOT NULL DEFAULT 'che_중립', - `rule` TEXT NULL DEFAULT '', `aux` LONGTEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`aux`)), PRIMARY KEY (`nation`) ) diff --git a/hwe/templates/invitationList.php b/hwe/templates/invitationList.php index 097a09f8..54c52ca9 100644 --- a/hwe/templates/invitationList.php +++ b/hwe/templates/invitationList.php @@ -11,7 +11,7 @@
+ >