forked from devsam/core
json_valid 설정. officer 설정 방식 변경
This commit is contained in:
@@ -51,7 +51,7 @@ var myLevel = <?=$meLevel?>;
|
||||
|
||||
<?php
|
||||
|
||||
$query = "select nation,name,level,color,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set from nation where nation='{$nationID}'";
|
||||
$query = "select nation,name,level,color,chief_set from nation where nation='{$nationID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result); //국가정보
|
||||
|
||||
@@ -179,7 +179,7 @@ for($i=12; $i >= $lv; $i-=2) {
|
||||
<td width=498>
|
||||
<?php
|
||||
|
||||
if($meLevel >= 5 && $nation["l{$meLevel}set"] == 0) {
|
||||
if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $meLevel)) {
|
||||
echo "
|
||||
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
|
||||
|
||||
@@ -216,7 +216,7 @@ echo "
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
if($meLevel >= 5 && $nation['l11set'] == 0) {
|
||||
if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], 11)) {
|
||||
echo "
|
||||
<select id='genlist_11' size=1 maxlength=15 style=color:white;background-color:black;>
|
||||
<option value=0 data-officer_level='0' data-name=''>____공석____</option>";
|
||||
@@ -269,7 +269,7 @@ for($i=10; $i >= $lv; $i--) {
|
||||
";
|
||||
|
||||
|
||||
if($meLevel >= 5 && $nation["l{$i}set"] == 0) {
|
||||
if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $i)) {
|
||||
echo "
|
||||
<select id='genlist_{$i}' size=1 style=color:white;background-color:black;>
|
||||
<option value=0 data-officer_level='0' data-name=''>____공석____</option>";
|
||||
@@ -345,7 +345,7 @@ if($meLevel >= 5) {
|
||||
<select id='citylist_4' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and officer4set=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and (officer_set&(1<<4))=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
@@ -397,7 +397,7 @@ if($meLevel >= 5) {
|
||||
<select id='citylist_3' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and officer3set=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and (officer_set&(1<<3))=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
@@ -449,7 +449,7 @@ if($meLevel >= 5) {
|
||||
<select id='citylist_2' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and officer2set=0 order by region, level desc,binary(name)"; // 도시 이름 목록
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and (officer_set&(1<<2))=0 order by region, level desc,binary(name)"; // 도시 이름 목록
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
@@ -527,7 +527,7 @@ $dummyOfficer = [
|
||||
$textColor = newColor($nation['color']);
|
||||
$nationColor = $nation['color'];
|
||||
|
||||
foreach($db->query('SELECT city,name,level,region,officer4set,officer3set,officer2set from city where nation=%i order by region,level desc,binary(name)', $nationID) as $city) {
|
||||
foreach($db->query('SELECT city,name,level,region,officer_set from city where nation=%i order by region,level desc,binary(name)', $nationID) as $city) {
|
||||
$cityID = $city['city'];
|
||||
$cityOfficerList = $officerList[$cityID]??[];
|
||||
?>
|
||||
|
||||
@@ -30,6 +30,14 @@ function getCharacterList(bool $onlyAvailable=true){
|
||||
return $infoText;
|
||||
}
|
||||
|
||||
function isOfficerSet(int $officerSet, int $reqOfficerLevel):bool{
|
||||
return ($officerSet & (1 << $reqOfficerLevel)) !== 0;
|
||||
}
|
||||
|
||||
function doOfficerSet(int $officerSet, int $reqOfficerLevel):int{
|
||||
return ($officerSet | (1 << $reqOfficerLevel));
|
||||
}
|
||||
|
||||
function getNationChiefLevel(int $level) {
|
||||
return [
|
||||
7=>5,
|
||||
|
||||
+3
-14
@@ -181,20 +181,11 @@ function updateQuaterly()
|
||||
|
||||
//천도 제한 해제, 관직 변경 제한 해제
|
||||
$db->update('nation', [
|
||||
'l12set' => 0,
|
||||
'l11set' => 0,
|
||||
'l10set' => 0,
|
||||
'l9set' => 0,
|
||||
'l8set' => 0,
|
||||
'l7set' => 0,
|
||||
'l6set' => 0,
|
||||
'l5set' => 0,
|
||||
'chief_set'=>0,
|
||||
], true);
|
||||
//관직 변경 제한 해제
|
||||
$db->update('city', [
|
||||
'officer4set' => 0,
|
||||
'officer3set' => 0,
|
||||
'officer2set' => 0,
|
||||
'officer_set' => 0,
|
||||
], true);
|
||||
}
|
||||
|
||||
@@ -259,9 +250,7 @@ function preUpdateMonthly()
|
||||
], 'officer_city IN %li', array_keys($lostCities));
|
||||
$db->update('city', [
|
||||
'nation' => 0,
|
||||
'officer4set' => 0,
|
||||
'officer3set' => 0,
|
||||
'officer2set' => 0,
|
||||
'officer_set' => 0,
|
||||
'conflict' => '{}',
|
||||
'term' => 0,
|
||||
'front' => 0
|
||||
|
||||
+16
-10
@@ -80,7 +80,7 @@ function do수뇌임명(General $general, int $targetOfficerLevel):?string{
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
[$levelSet, $nationLevel] = $db->queryFirstList('SELECT %b,level FROM nation WHERE nation = %i', "l{$targetOfficerLevel}set", $nationID);
|
||||
[$chiefSet, $nationLevel] = $db->queryFirstList('SELECT chief_set,level FROM nation WHERE nation = %i',$nationID);
|
||||
|
||||
// 임명가능 레벨
|
||||
$lv = getNationChiefLevel($nationLevel);
|
||||
@@ -89,7 +89,7 @@ function do수뇌임명(General $general, int $targetOfficerLevel):?string{
|
||||
return '임명불가능한 관직입니다.';
|
||||
}
|
||||
|
||||
if($levelSet){
|
||||
if(isOfficerSet($chiefSet, $lv)){
|
||||
return '지금은 임명할 수 없습니다.';
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ function do수뇌임명(General $general, int $targetOfficerLevel):?string{
|
||||
$general->setVar('officer_level', $targetOfficerLevel);
|
||||
$general->setVar('officer_city', 0);
|
||||
$db->update('nation', [
|
||||
"l{$targetOfficerLevel}set"=>1,
|
||||
'chief_set'=> $db->sqleval('chief_set | %i', doOfficerSet(0, $targetOfficerLevel)),
|
||||
], 'nation=%i', $nationID);
|
||||
$general->applyDB($db);
|
||||
|
||||
@@ -128,14 +128,21 @@ function do수뇌임명(General $general, int $targetOfficerLevel):?string{
|
||||
function do도시임명(General $general, int $cityID, int $targetOfficerLevel):?string{
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
$genlvset = 'officer'.$targetOfficerLevel.'set';
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
if(CityConst::byID($cityID) === null){
|
||||
return '올바르지 않은 도시입니다';
|
||||
}
|
||||
|
||||
$officerSet = $db->queryFirstField('SELECT officer_set FROM city WHERE nation=%i AND city=%i', $nationID, $cityID);
|
||||
if($officerSet === null){
|
||||
return '아국 도시가 아닙니다';
|
||||
}
|
||||
|
||||
if(isOfficerSet($officerSet, $targetOfficerLevel)){
|
||||
return '이미 다른 장수가 임명되어있습니다';
|
||||
}
|
||||
|
||||
//기존 장수 일반으로
|
||||
$db->update('general', [
|
||||
'officer_level'=>1,
|
||||
@@ -156,7 +163,7 @@ function do도시임명(General $general, int $cityID, int $targetOfficerLevel):
|
||||
|
||||
//신임 장수
|
||||
$db->update('city', [
|
||||
$genlvset=>1
|
||||
'officer_set'=>$db->sqleval('officer_set | %i', doOfficerSet(0, $targetOfficerLevel)),
|
||||
], 'city=%i AND nation=%i', $cityID, $nationID);
|
||||
$general->setVar('officer_level', $targetOfficerLevel);
|
||||
$general->setVar('officer_city', $cityID);
|
||||
@@ -167,7 +174,6 @@ function do도시임명(General $general, int $cityID, int $targetOfficerLevel):
|
||||
|
||||
function do추방(General $general, int $myOfficerLevel):?string{
|
||||
$generalID = $general->getID();
|
||||
$officerLevel = $general->getVar('officer_level');
|
||||
$generalName = $general->getVar('name');
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
@@ -183,13 +189,13 @@ function do추방(General $general, int $myOfficerLevel):?string{
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$env = $gameStor->getValues(['startyear','year','month','scenario']);
|
||||
|
||||
$nation = $db->queryFirstRow('SELECT name,%b,color FROM nation WHERE nation=%i',"l{$myOfficerLevel}set", $nationID);
|
||||
$nation = $db->queryFirstRow('SELECT name,chief_set,color FROM nation WHERE nation=%i', $nationID);
|
||||
$nationName = $nation['name'];
|
||||
|
||||
$logger = $general->getLogger();
|
||||
|
||||
//이미 지정했다면 무시
|
||||
if($nation["l{$myOfficerLevel}set"] == 1 || $officerLevel == 0 && $officerLevel == 12) {
|
||||
if(isOfficerSet($nation['chief_set'], $myOfficerLevel) || ($myOfficerLevel == 0 && $myOfficerLevel == 12)) {
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
die();
|
||||
}
|
||||
@@ -295,7 +301,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
|
||||
} else {
|
||||
//이번분기는 추방불가(초반 제외)
|
||||
$db->update('nation', [
|
||||
"l{$myOfficerLevel}set"=>1,
|
||||
'chief_set'=>$db->sqleval('chief_set | %i', doOfficerSet(0, $myOfficerLevel)),
|
||||
'gennum'=>$db->sqleval('gennum - %i', $general->getVar('npc')!=5?1:0),
|
||||
'gold'=>$db->sqleval('gold + %i', $gold),
|
||||
'rice'=>$db->sqleval('rice + %i', $rice),
|
||||
|
||||
+1
-3
@@ -699,9 +699,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
'comm'=>$db->sqleval('comm*0.7'),
|
||||
'secu'=>$db->sqleval('secu*0.7'),
|
||||
'nation'=>$conquerNation,
|
||||
'officer4set'=>0,
|
||||
'officer3set'=>0,
|
||||
'officer2set'=>0
|
||||
'officer_set'=>0,
|
||||
];
|
||||
if($city['level'] > 3) {
|
||||
$query['def'] = 1000;
|
||||
|
||||
@@ -166,11 +166,6 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$general->setVar('rice', GameConst::$defaultRice);
|
||||
}
|
||||
|
||||
$officerLevel = $general->getVar('officer_level');
|
||||
if(5 <= $officerLevel && $officerLevel <= 11){
|
||||
$setOriginalNationValues["l{$officerLevel}set"] = 0;
|
||||
}
|
||||
|
||||
// 재야가 아니면 명성N*10% 공헌N*10%감소
|
||||
$general->setVar('experience', $general->getVar('experience') * (1 - 0.1 * $general->getVar('betray')));
|
||||
$general->addExperience(0, false);
|
||||
|
||||
+20
-16
@@ -97,7 +97,7 @@ class GeneralAI
|
||||
}
|
||||
|
||||
$this->nation = $db->queryFirstRow(
|
||||
'SELECT nation,name,color,capital,capset,gennum,gold,rice,bill,rate,rate_tmp,scout,war,strategic_cmd_limit,surlimit,tech,power,level,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set,type,aux FROM nation WHERE nation = %i',
|
||||
'SELECT nation,name,color,capital,capset,gennum,gold,rice,bill,rate,rate_tmp,scout,war,strategic_cmd_limit,surlimit,tech,power,level,chief_set,type,aux FROM nation WHERE nation = %i',
|
||||
$general->getNationID()
|
||||
) ?? [
|
||||
'nation' => 0,
|
||||
@@ -3318,10 +3318,11 @@ class GeneralAI
|
||||
//빈자리는 아무나 채움
|
||||
$db = DB::db();
|
||||
|
||||
$setChiefLevel = [];
|
||||
$setChiefLevel = 0;
|
||||
$minChiefLevel = getNationChiefLevel($this->nation['level']);
|
||||
$chiefSet = $this->nation['chief_set'];
|
||||
foreach(Util::range($minChiefLevel, 12) as $chiefLevel){
|
||||
if($this->nation["l{$chiefLevel}set"]){
|
||||
if(isOfficerSet($chiefSet, $chiefLevel)){
|
||||
continue;
|
||||
}
|
||||
if(key_exists($chiefLevel, $this->chiefGenerals)){
|
||||
@@ -3383,13 +3384,15 @@ class GeneralAI
|
||||
$randGeneral->setVar('officer_level', $chiefLevel);
|
||||
$randGeneral->setVar('officer_city', 0);
|
||||
$randGeneral->applyDB($db);
|
||||
$this->nation["l{$chiefLevel}set"] = 1;
|
||||
$setChiefLevel["l{$chiefLevel}set"] = 1;
|
||||
$this->nation['chief_set'] |= doOfficerSet(0, $chiefLevel);
|
||||
$setChiefLevel |= doOfficerSet(0, $chiefLevel);
|
||||
$this->chiefGenerals[$chiefLevel] = $randGeneral;
|
||||
}
|
||||
|
||||
if($setChiefLevel){
|
||||
$db->update('nation', $setChiefLevel, 'nation=%i', $this->nation['nation']);
|
||||
$db->update('nation', [
|
||||
'chief_set' => $db->sqleval('chief_set | %i', $setChiefLevel)
|
||||
], 'nation=%i', $this->nation['nation']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3431,12 +3434,12 @@ class GeneralAI
|
||||
|
||||
|
||||
$minBelong = min($this->general->getVar('belong') - 1, 3);
|
||||
$updatedNationVar = [];
|
||||
$updatedChiefSet = 0;
|
||||
|
||||
/** @var General[] */
|
||||
$nextChiefs = [];
|
||||
|
||||
if($userChiefCnt == 0 && $this->userGenerals && !$nation['l11set']){
|
||||
if($userChiefCnt == 0 && $this->userGenerals && !isOfficerSet($nation['chief_set'], 11)){
|
||||
$userGenerals = $this->userGenerals;
|
||||
uasort($userGenerals, function(General $lhs, General $rhs){
|
||||
return -($lhs->getVar('leadership')<=>$rhs->getVar('leadership'));
|
||||
@@ -3455,8 +3458,8 @@ class GeneralAI
|
||||
$general->setVar('officer_level', 11);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('permission', 'ambassador');
|
||||
$nation['l11set'] = true;
|
||||
$updatedNationVar['l11set'] = 1;
|
||||
$nation['chief_set'] |= doOfficerSet(0, 11);
|
||||
$updatedChiefSet |= doOfficerSet(0, 11);
|
||||
$userChiefCnt += 1;
|
||||
break;
|
||||
}
|
||||
@@ -3476,8 +3479,7 @@ class GeneralAI
|
||||
|
||||
|
||||
foreach(Util::range(11, $minChiefLevel-1, -1) as $chiefLevel) {
|
||||
$nationKey = "l{$chiefLevel}set";
|
||||
if($nation[$nationKey]){
|
||||
if(isOfficerSet($nation['chief_set'], $chiefLevel)){
|
||||
continue;
|
||||
}
|
||||
if($this->general->getVar('officer_level') === $chiefLevel){
|
||||
@@ -3544,8 +3546,8 @@ class GeneralAI
|
||||
$nextChiefs[$chiefLevel] = $newChief;
|
||||
$newChief->setVar('officer_level', $chiefLevel);
|
||||
$newChief->setVar('officer_city', 0);
|
||||
$nation[$nationKey] = true;
|
||||
$updatedNationVar[$nationKey] = 1;
|
||||
$nation['chief_set'] |= doOfficerSet(0, $chiefLevel);
|
||||
$updatedChiefSet |= doOfficerSet(0, $chiefLevel);
|
||||
}
|
||||
|
||||
foreach($nextChiefs as $chiefLevel=>$chief){
|
||||
@@ -3558,8 +3560,10 @@ class GeneralAI
|
||||
$chief->applyDB($db);
|
||||
$this->chiefGenerals[$chiefLevel] = $chief;
|
||||
}
|
||||
if($updatedNationVar){
|
||||
$db->update('nation', $updatedNationVar, 'nation=%i', $nationID);
|
||||
if($updatedChiefSet){
|
||||
$db->update('nation', [
|
||||
'chief_set'=>$db->sqleval('chief_set | %i', $updatedChiefSet)
|
||||
], 'nation=%i', $nationID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
-33
@@ -76,8 +76,8 @@ CREATE TABLE `general` (
|
||||
`tournament` INT(1) NULL DEFAULT '0',
|
||||
`vote` INT(1) NULL DEFAULT '0',
|
||||
`newvote` INT(1) NULL DEFAULT '0',
|
||||
`last_turn` TEXT NOT NULL DEFAULT '{}',
|
||||
`aux` TEXT NOT NULL DEFAULT '{}' COMMENT 'JSON',
|
||||
`last_turn` TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`last_turn`)),
|
||||
`aux` LONGTEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`aux`)),
|
||||
`penalty` TEXT NULL DEFAULT '',
|
||||
PRIMARY KEY (`no`),
|
||||
INDEX `nation` (`nation`, `npc`),
|
||||
@@ -127,14 +127,7 @@ CREATE TABLE `nation` (
|
||||
`rate` INT(3) NULL DEFAULT '0',
|
||||
`rate_tmp` INT(3) NULL DEFAULT '0',
|
||||
`secretlimit` INT(2) NULL DEFAULT '3',
|
||||
`l12set` INT(1) NULL DEFAULT '0',
|
||||
`l11set` INT(1) NULL DEFAULT '0',
|
||||
`l10set` INT(1) NULL DEFAULT '0',
|
||||
`l9set` INT(1) NULL DEFAULT '0',
|
||||
`l8set` INT(1) NULL DEFAULT '0',
|
||||
`l7set` INT(1) NULL DEFAULT '0',
|
||||
`l6set` INT(1) NULL DEFAULT '0',
|
||||
`l5set` INT(1) NULL DEFAULT '0',
|
||||
`chief_set` INT(11) NOT NULL DEFAULT '0',
|
||||
`scout` INT(1) NULL DEFAULT '0',
|
||||
`war` INT(1) NULL DEFAULT '0',
|
||||
`strategic_cmd_limit` INT(4) NULL DEFAULT '36',
|
||||
@@ -142,11 +135,11 @@ CREATE TABLE `nation` (
|
||||
`scoutmsg` TEXT NULL DEFAULT '',
|
||||
`tech` float NULL DEFAULT '0',
|
||||
`power` INT(8) NULL DEFAULT '0',
|
||||
`spy` TEXT NOT NULL DEFAULT '{}',
|
||||
`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` TEXT NOT NULL DEFAULT '{}',
|
||||
`aux` LONGTEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`aux`)),
|
||||
PRIMARY KEY (`nation`)
|
||||
)
|
||||
ENGINE=Aria DEFAULT CHARSET=utf8mb4;
|
||||
@@ -157,7 +150,7 @@ CREATE TABLE `nation_turn` (
|
||||
`officer_level` INT(4) NOT NULL,
|
||||
`turn_idx` INT(4) NOT NULL,
|
||||
`action` VARCHAR(16) NOT NULL,
|
||||
`arg` TEXT NULL DEFAULT NULL,
|
||||
`arg` TEXT NULL DEFAULT NULL CHECK (json_valid(`arg`)),
|
||||
`brief` TEXT NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `nation` (`nation_id`, `officer_level`, `turn_idx`),
|
||||
@@ -222,13 +215,11 @@ CREATE TABLE `city` (
|
||||
`def_max` INT(5) NOT NULL,
|
||||
`wall` INT(5) NOT NULL,
|
||||
`wall_max` INT(5) NOT NULL,
|
||||
`officer4set` INT(1) NOT NULL DEFAULT '0',
|
||||
`officer3set` INT(1) NOT NULL DEFAULT '0',
|
||||
`officer2set` INT(1) NOT NULL DEFAULT '0',
|
||||
`officer_set` INT(11) NOT NULL DEFAULT '0',
|
||||
`state` INT(2) NOT NULL DEFAULT '0',
|
||||
`region` INT(2) NOT NULL,
|
||||
`term` INT(1) NOT NULL DEFAULT '0',
|
||||
`conflict` TEXT NOT NULL DEFAULT '{}',
|
||||
`conflict` TEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`conflict`)),
|
||||
PRIMARY KEY (`city`),
|
||||
INDEX `nation` (`nation`)
|
||||
) ENGINE=Aria DEFAULT CHARSET=utf8mb4;
|
||||
@@ -269,7 +260,7 @@ CREATE TABLE `message` (
|
||||
`dest` INT(11) NOT NULL,
|
||||
`time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`valid_until` DATETIME NOT NULL DEFAULT '9999-12-31 23:59:59',
|
||||
`message` TEXT NOT NULL COMMENT 'json',
|
||||
`message` TEXT NOT NULL CHECK (json_valid(`message`)),
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `by_mailbox` (`mailbox`, `type`, `id`)
|
||||
)
|
||||
@@ -289,7 +280,7 @@ CREATE TABLE IF NOT EXISTS `ng_hall` (
|
||||
`type` INT(11) NOT NULL,
|
||||
`value` DOUBLE NOT NULL,
|
||||
`owner` INT(11) NULL DEFAULT NULL,
|
||||
`aux` TEXT NOT NULL DEFAULT '{}',
|
||||
`aux` LONGTEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`aux`)),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `server_general` (`server_id`, `type`, `general_no`),
|
||||
UNIQUE INDEX `owner` (`owner`, `server_id`, `type`),
|
||||
@@ -312,7 +303,8 @@ CREATE TABLE IF NOT EXISTS `ng_games` (
|
||||
`season` INT(11) NOT NULL,
|
||||
`scenario` INT(11) NOT NULL,
|
||||
`scenario_name` TEXT NOT NULL,
|
||||
`env` TEXT NOT NULL COMMENT 'json',
|
||||
`env` TEXT NOT NULL CHECK (json_valid(`aux`)),
|
||||
CHECK (JSON_VALID(`env`)),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `server_id` (`server_id`),
|
||||
INDEX `date` (`date`)
|
||||
@@ -323,7 +315,7 @@ CREATE TABLE IF NOT EXISTS `ng_old_nations` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL DEFAULT '0',
|
||||
`nation` INT(11) NOT NULL DEFAULT '0',
|
||||
`data` LONGTEXT NOT NULL DEFAULT '0' COMMENT 'json',
|
||||
`data` LONGTEXT NOT NULL DEFAULT '{}' CHECK (json_valid(`data`)),
|
||||
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `server_id` (`server_id`, `nation`)
|
||||
@@ -387,8 +379,8 @@ CREATE TABLE IF NOT EXISTS `emperior` (
|
||||
`tiger` VARCHAR(128) NULL DEFAULT '',
|
||||
`eagle` VARCHAR(128) NULL DEFAULT '',
|
||||
`gen` TEXT NULL DEFAULT '',
|
||||
`history` MEDIUMTEXT NULL DEFAULT '',
|
||||
`aux` MEDIUMTEXT NULL DEFAULT '' COMMENT 'json',
|
||||
`history` MEDIUMTEXT NULL DEFAULT '{}' CHECK (json_valid(`aux`)),
|
||||
`aux` MEDIUMTEXT NULL DEFAULT '{}' CHECK (json_valid(`aux`)),
|
||||
PRIMARY KEY (`no`)
|
||||
) ENGINE=Aria ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
@@ -419,7 +411,7 @@ CREATE TABLE `ng_diplomacy` (
|
||||
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`src_signer` INT(11) NOT NULL,
|
||||
`dest_signer` INT(11) NULL DEFAULT NULL,
|
||||
`aux` TEXT NULL DEFAULT NULL,
|
||||
`aux` TEXT NULL DEFAULT NULL CHECK (json_valid(`aux`)),
|
||||
PRIMARY KEY (`no`),
|
||||
INDEX `by_nation_src` (`src_nation_id`, `dest_nation_id`, `state`, `date`),
|
||||
INDEX `by_nation_dest` (`dest_nation_id`, `src_nation_id`, `state`, `date`)
|
||||
@@ -486,7 +478,7 @@ CREATE TABLE `statistic` (
|
||||
`power_hist` TEXT NULL DEFAULT '',
|
||||
`crewtype` TEXT NULL DEFAULT '',
|
||||
`etc` TEXT NULL DEFAULT '',
|
||||
`aux` TEXT NULL DEFAULT '' COMMENT 'json',
|
||||
`aux` TEXT NULL DEFAULT NULL CHECK (json_valid(`aux`)),
|
||||
PRIMARY KEY (`no`)
|
||||
)
|
||||
ENGINE=Aria ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
@@ -499,9 +491,9 @@ CREATE TABLE IF NOT EXISTS `history` (
|
||||
`server_id` CHAR(20) NOT NULL DEFAULT '',
|
||||
`year` INT(4) NULL DEFAULT '0',
|
||||
`month` INT(2) NULL DEFAULT '0',
|
||||
`map` MEDIUMTEXT NULL DEFAULT '',
|
||||
`log` TEXT NULL DEFAULT '',
|
||||
`genlog` MEDIUMTEXT NULL DEFAULT '',
|
||||
`map` MEDIUMTEXT NULL DEFAULT NULL CHECK (json_valid(`map`)),
|
||||
`log` TEXT NULL DEFAULT NULL CHECK (json_valid(`log`)),
|
||||
`genlog` MEDIUMTEXT NULL DEFAULT NULL CHECK (json_valid(`genlog`)),
|
||||
`nation` TEXT NULL DEFAULT '',
|
||||
`power` TEXT NULL DEFAULT '',
|
||||
`gen` TEXT NULL DEFAULT '',
|
||||
@@ -517,8 +509,8 @@ ENGINE=Aria DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED;
|
||||
|
||||
CREATE TABLE `event` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`condition` MEDIUMTEXT NOT NULL COMMENT 'json',
|
||||
`action` MEDIUMTEXT NOT NULL COMMENT 'json',
|
||||
`condition` MEDIUMTEXT NOT NULL CHECK (json_valid(`condition`)),
|
||||
`action` MEDIUMTEXT NOT NULL CHECK (json_valid(`action`)),
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
@@ -560,7 +552,7 @@ ENGINE=Aria
|
||||
# 예약 오픈 테이블
|
||||
CREATE TABLE IF NOT EXISTS `reserved_open` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`options` TEXT NULL DEFAULT NULL,
|
||||
`options` TEXT NULL DEFAULT NULL CHECK (json_valid(`options`)),
|
||||
`date` DATETIME NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `date` (`date`)
|
||||
@@ -575,7 +567,7 @@ CREATE TABLE `select_npc_token` (
|
||||
`owner` INT(11) NOT NULL,
|
||||
`valid_until` DATETIME NOT NULL,
|
||||
`pick_more_from` DATETIME NOT NULL,
|
||||
`pick_result` TEXT NOT NULL COMMENT 'json',
|
||||
`pick_result` TEXT NOT NULL CHECK (json_valid(`pick_result`)),
|
||||
`nonce` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `owner` (`owner`),
|
||||
@@ -591,7 +583,7 @@ CREATE TABLE IF NOT EXISTS `storage` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`namespace` VARCHAR(40) NOT NULL,
|
||||
`key` VARCHAR(40) NOT NULL,
|
||||
`value` TEXT NOT NULL,
|
||||
`value` LONGTEXT NOT NULL CHECK (json_valid(`value`)),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `key` (`namespace`, `key`)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user