Compare commits

..
7 Commits
4 changed files with 22 additions and 6 deletions
+3 -3
View File
@@ -408,14 +408,14 @@ function checkSecretPermission(array $me, $checkSecretLimit = true)
}
$secretMin = 0;
$secretMax = checkSecretMaxPermission($me, $penalty);
$secretMax = checkSecretMaxPermission($penalty);
if ($me['officer_level'] == 12) {
$secretMin = 4;
} else if ($me['permission'] == 'ambassador') {
} else if ($permission == 'ambassador') {
$secretMin = 4;
} else if ($me['permission'] == 'auditor') {
} else if ($permission == 'auditor') {
$secretMin = 3;
} else if ($me['officer_level'] >= 5) {
$secretMin = 2;
+8 -1
View File
@@ -37,7 +37,14 @@ if(!$member){
$userNick = $member['name'];
$memberPenalty = Json::decode($member['penalty'] ?? '{}');
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penalty = [];
foreach($penaltyInfo as $penaltyKey => $penaltyValue){
if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){
$penalty[$penaltyKey] = $penaltyValue['value'];
}
}
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
if(!$pickResult){
+8 -1
View File
@@ -153,7 +153,14 @@ class Join extends \sammo\BaseAPI
}
$memberPenalty = Json::decode($member['penalty'] ?? "{}");
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penalty = [];
foreach($penaltyInfo as $penaltyKey => $penaltyValue){
if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){
$penalty[$penaltyKey] = $penaltyValue['value'];
}
}
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
+3 -1
View File
@@ -67,12 +67,14 @@ class RaiseInvader extends \sammo\Event\Action
foreach ($db->queryAllLists('SELECT capital, nation from nation WHERE capital in %li', $cities) as $row) {
[$oldCapital, $nation] = $row;
$capitalCandidates = $db->queryFirstColumn('SELECT from city WHERE nation = %i AND city != %i', $nation, $oldCapital);
$capitalCandidates = $db->queryFirstColumn('SELECT city from city WHERE nation = %i AND city != %i NOT IN %li', $nation, $oldCapital, $cities);
if (!$capitalCandidates) {
$disabledInvaderCity->add($oldCapital);
continue;
}
$newCapital = $rng->choice($capitalCandidates);
$db->update('nation', ['capital' => $newCapital], 'nation=%i', $nation);
$db->update('general', ['city' => $newCapital], 'nation=%i and city=%i', $nation, $oldCapital);
}