feat: 전쟁 금지/허가 여부 횟수 제한 부활
This commit is contained in:
+3
-3
@@ -43,7 +43,7 @@ if ($me['officer_level'] >= 5) {
|
|||||||
$read = "readonly";
|
$read = "readonly";
|
||||||
}
|
}
|
||||||
|
|
||||||
$nationStor->cacheValues(['notice', 'scout_msg']);
|
$nationStor->cacheValues(['notice', 'scout_msg', 'available_war_setting_cnt']);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -251,8 +251,8 @@ if ($budgetricediff > 0) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td align=right class=bg1>기밀 권한 (1 ~ 99년) </td>
|
<td align=right class=bg1>기밀 권한 (1 ~ 99년) </td>
|
||||||
<td align=center><input type=text <?=$read?> name=secretlimit style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['secretlimit']?>>년 <input type=<?=$btn?> name=btn value=기밀권한></td>
|
<td align=center><input type=text <?=$read?> name=secretlimit style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['secretlimit']?>>년 <input type=<?=$btn?> name=btn value=기밀권한></td>
|
||||||
<td align=right class=bg1>임관&전쟁 변경 가능</td>
|
<td align=right class=bg1>전쟁 허용/금지 변경 가능</td>
|
||||||
<td align=center>무제한</td>
|
<td align=center><?=$nationStor->getValue('available_war_setting_cnt')?>회(월 +<?=GameConst::$incAvailableWarSettingCnt?>회, 최대<?=GameConst::$maxAvailableWarSettingCnt?>회)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=4 align=center>
|
<td colspan=4 align=center>
|
||||||
|
|||||||
+35
-27
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
include "lib.php";
|
include "lib.php";
|
||||||
@@ -22,11 +23,10 @@ $me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty
|
|||||||
|
|
||||||
//내가 수뇌부이어야함
|
//내가 수뇌부이어야함
|
||||||
$permission = checkSecretPermission($me);
|
$permission = checkSecretPermission($me);
|
||||||
if($permission < 0){
|
if ($permission < 0) {
|
||||||
header('location:b_myBossInfo.php', true, 303);
|
header('location:b_myBossInfo.php', true, 303);
|
||||||
exit();
|
exit();
|
||||||
}
|
} else if ($me['officer_level'] < 5 && $permission != 4) {
|
||||||
else if ($me['officer_level'] < 5 && $permission != 4) {
|
|
||||||
header('location:b_myBossInfo.php', true, 303);
|
header('location:b_myBossInfo.php', true, 303);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@@ -34,44 +34,52 @@ else if ($me['officer_level'] < 5 && $permission != 4) {
|
|||||||
$nationID = $me['nation'];
|
$nationID = $me['nation'];
|
||||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||||
|
|
||||||
if($btn == "국가방침 수정") {
|
if ($btn == "국가방침 수정") {
|
||||||
$msg = mb_substr($msg, 0, 16384);
|
$msg = mb_substr($msg, 0, 16384);
|
||||||
//$msg = StringUtil::
|
//$msg = StringUtil::
|
||||||
$nationStor->notice = WebUtil::htmlPurify($msg);
|
$nationStor->notice = WebUtil::htmlPurify($msg);
|
||||||
} elseif($btn == "임관 권유문 수정") {
|
} elseif ($btn == "임관 권유문 수정") {
|
||||||
$scoutmsg = mb_substr($scoutmsg, 0, 1000);
|
$scoutmsg = mb_substr($scoutmsg, 0, 1000);
|
||||||
$nationStor->scout_msg = WebUtil::htmlPurify($scoutmsg);
|
$nationStor->scout_msg = WebUtil::htmlPurify($scoutmsg);
|
||||||
} elseif($btn == "세율") {
|
} elseif ($btn == "세율") {
|
||||||
$rate = Util::valueFit($rate, 5, 30);
|
$rate = Util::valueFit($rate, 5, 30);
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'rate'=>$rate,
|
'rate' => $rate,
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
} elseif($btn == "지급률") {
|
} elseif ($btn == "지급률") {
|
||||||
$bill = Util::valueFit($bill, 20, 200);
|
$bill = Util::valueFit($bill, 20, 200);
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'bill'=>$bill
|
'bill' => $bill
|
||||||
], 'nation=%i',$nationID);
|
], 'nation=%i', $nationID);
|
||||||
} elseif($btn == "기밀권한") {
|
} elseif ($btn == "기밀권한") {
|
||||||
$secretlimit = Util::valueFit($secretlimit, 1, 99);
|
$secretlimit = Util::valueFit($secretlimit, 1, 99);
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'secretlimit'=>$secretlimit
|
'secretlimit' => $secretlimit
|
||||||
], 'nation=%i',$nationID);
|
], 'nation=%i', $nationID);
|
||||||
} elseif($btn == "임관 금지") {
|
} elseif ($btn == "임관 금지") {
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'scout'=>1
|
'scout' => 1
|
||||||
], 'nation=%i',$nationID);
|
], 'nation=%i', $nationID);
|
||||||
} elseif($btn == "임관 허가") {
|
} elseif ($btn == "임관 허가") {
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'scout'=>0
|
'scout' => 0
|
||||||
], 'nation=%i',$nationID);
|
], 'nation=%i', $nationID);
|
||||||
} elseif($btn == "전쟁 금지") {
|
} elseif ($btn == "전쟁 금지") {
|
||||||
$db->update('nation', [
|
$avilableCnt = $nationStor->getValue('available_war_setting_cnt') ?? 0;
|
||||||
'war'=>1
|
if ($avilableCnt > 0) {
|
||||||
], 'nation=%i',$nationID);
|
$db->update('nation', [
|
||||||
} elseif($btn == "전쟁 허가") {
|
'war' => 1
|
||||||
$db->update('nation', [
|
], 'nation=%i', $nationID);
|
||||||
'war'=>0
|
$nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1);
|
||||||
], 'nation=%i',$nationID);
|
}
|
||||||
|
} elseif ($btn == "전쟁 허가") {
|
||||||
|
$avilableCnt = $nationStor->getValue('available_war_setting_cnt') ?? 0;
|
||||||
|
if ($avilableCnt > 0) {
|
||||||
|
$db->update('nation', [
|
||||||
|
'war' => 0
|
||||||
|
], 'nation=%i', $nationID);
|
||||||
|
$nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('location:b_dipcenter.php');
|
header('location:b_dipcenter.php');
|
||||||
|
|||||||
@@ -481,6 +481,21 @@ function postUpdateMonthly()
|
|||||||
'term' => 6,
|
'term' => 6,
|
||||||
], 'state = 1 AND term = 0');
|
], 'state = 1 AND term = 0');
|
||||||
|
|
||||||
|
$availableWarSettingCnt = KVStorage::getValuesFromInterNamespace($db, 'nation_env', 'available_war_setting_cnt');
|
||||||
|
foreach ($nations as $nation) {
|
||||||
|
$nationID = $nation['nation'];
|
||||||
|
if(!key_exists($nationID, $availableWarSettingCnt)){
|
||||||
|
$availableWarSettingCnt[$nationID] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($availableWarSettingCnt as $nationID=>$cnt){
|
||||||
|
if($cnt >= GameConst::$maxAvailableWarSettingCnt){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$cnt = Util::valueFit($cnt + GameConst::$incAvailableWarSettingCnt, 0, GameConst::$maxAvailableWarSettingCnt);
|
||||||
|
(KVStorage::getStorage($db, $nationID, 'nation_env'))->setValue('available_war_setting_cnt', $cnt);
|
||||||
|
}
|
||||||
|
|
||||||
//초반이후 방랑군 자동 해체
|
//초반이후 방랑군 자동 해체
|
||||||
if ($admin['year'] >= $admin['startyear'] + 2) {
|
if ($admin['year'] >= $admin['startyear'] + 2) {
|
||||||
checkWander();
|
checkWander();
|
||||||
|
|||||||
@@ -202,6 +202,9 @@ class GameConstBase
|
|||||||
[20, 4]
|
[20, 4]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static $maxAvailableWarSettingCnt = 10;
|
||||||
|
public static $incAvailableWarSettingCnt = 2;
|
||||||
|
|
||||||
public static $inheritBornSpecialPoint = 6000;
|
public static $inheritBornSpecialPoint = 6000;
|
||||||
public static $inheritBornTurntimePoint = 3000;
|
public static $inheritBornTurntimePoint = 3000;
|
||||||
public static $inheritBornCityPoint = 1000;
|
public static $inheritBornCityPoint = 1000;
|
||||||
|
|||||||
+20
-20
@@ -42,7 +42,7 @@ class KVStorage{
|
|||||||
public function __get($key) {
|
public function __get($key) {
|
||||||
return $this->getValue($key);
|
return $this->getValue($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __set($key, $value) {
|
public function __set($key, $value) {
|
||||||
$this->setValue($key, $value);
|
$this->setValue($key, $value);
|
||||||
}
|
}
|
||||||
@@ -93,13 +93,13 @@ class KVStorage{
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
$keys = array_map('mb_strtolower', $keys);
|
$keys = array_map('mb_strtolower', $keys);
|
||||||
|
|
||||||
foreach($keys as $key){
|
foreach($keys as $key){
|
||||||
if(key_exists($key, $this->cacheData)){
|
if(key_exists($key, $this->cacheData)){
|
||||||
unset($this->cacheData[$key]);
|
unset($this->cacheData[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ class KVStorage{
|
|||||||
$this->cacheData[$key] = null;
|
$this->cacheData[$key] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ class KVStorage{
|
|||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
$notExists = [];
|
$notExists = [];
|
||||||
|
|
||||||
//TODO: DB Select에서 as를 쓸 수 있으면 좋을 듯.
|
//TODO: DB Select에서 as를 쓸 수 있으면 좋을 듯.
|
||||||
foreach($keys as $key){
|
foreach($keys as $key){
|
||||||
if(!key_exists($key, $this->cacheData)){
|
if(!key_exists($key, $this->cacheData)){
|
||||||
@@ -208,9 +208,9 @@ class KVStorage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|int $key
|
* @param string|int $key
|
||||||
* @param bool $onlyCache
|
* @param bool $onlyCache
|
||||||
* @return mixed|null
|
* @return mixed|null
|
||||||
*/
|
*/
|
||||||
public function getValue($key, bool $onlyCache=false){
|
public function getValue($key, bool $onlyCache=false){
|
||||||
if(is_string($key)){
|
if(is_string($key)){
|
||||||
@@ -228,11 +228,11 @@ class KVStorage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string|int $key
|
* @param string|int $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return KVStorage
|
* @return KVStorage
|
||||||
* @throws MeekroDBException
|
* @throws MeekroDBException
|
||||||
*/
|
*/
|
||||||
public function setValue($key, $value):self{
|
public function setValue($key, $value):self{
|
||||||
if(is_string($key)){
|
if(is_string($key)){
|
||||||
@@ -249,11 +249,11 @@ class KVStorage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string|int $key
|
* @param string|int $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return KVStorage
|
* @return KVStorage
|
||||||
* @throws MeekroDBException
|
* @throws MeekroDBException
|
||||||
*/
|
*/
|
||||||
public function deleteValue($key):self{
|
public function deleteValue($key):self{
|
||||||
if(is_string($key)){
|
if(is_string($key)){
|
||||||
@@ -284,9 +284,9 @@ class KVStorage{
|
|||||||
}
|
}
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach($this->db->queryAllLists(
|
foreach($this->db->queryAllLists(
|
||||||
'SELECT `key`, `value` FROM %b WHERE `namespace`=%s AND `key` IN %ls',
|
'SELECT `key`, `value` FROM %b WHERE `namespace`=%s AND `key` IN %ls',
|
||||||
$this->tableName,
|
$this->tableName,
|
||||||
$this->storNamespace,
|
$this->storNamespace,
|
||||||
$keys
|
$keys
|
||||||
) as list($key, $value))
|
) as list($key, $value))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user