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