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>
|
||||
|
||||
+10
-2
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
@@ -25,8 +26,7 @@ $permission = checkSecretPermission($me);
|
||||
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();
|
||||
}
|
||||
@@ -65,13 +65,21 @@ if($btn == "국가방침 수정") {
|
||||
'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;
|
||||
|
||||
Reference in New Issue
Block a user