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