forked from devsam/core
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1e6ac7b89 | ||
|
|
7b24f66f93 | ||
|
|
b2b2934ce9 | ||
|
|
6ed3e673df | ||
|
|
aa7dcab1fd | ||
|
|
6cebc903c9 | ||
|
|
c0190959e3 |
+3
-3
@@ -408,14 +408,14 @@ function checkSecretPermission(array $me, $checkSecretLimit = true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$secretMin = 0;
|
$secretMin = 0;
|
||||||
$secretMax = checkSecretMaxPermission($me, $penalty);
|
$secretMax = checkSecretMaxPermission($penalty);
|
||||||
|
|
||||||
|
|
||||||
if ($me['officer_level'] == 12) {
|
if ($me['officer_level'] == 12) {
|
||||||
$secretMin = 4;
|
$secretMin = 4;
|
||||||
} else if ($me['permission'] == 'ambassador') {
|
} else if ($permission == 'ambassador') {
|
||||||
$secretMin = 4;
|
$secretMin = 4;
|
||||||
} else if ($me['permission'] == 'auditor') {
|
} else if ($permission == 'auditor') {
|
||||||
$secretMin = 3;
|
$secretMin = 3;
|
||||||
} else if ($me['officer_level'] >= 5) {
|
} else if ($me['officer_level'] >= 5) {
|
||||||
$secretMin = 2;
|
$secretMin = 2;
|
||||||
|
|||||||
@@ -37,7 +37,14 @@ if(!$member){
|
|||||||
|
|
||||||
$userNick = $member['name'];
|
$userNick = $member['name'];
|
||||||
$memberPenalty = Json::decode($member['penalty'] ?? '{}');
|
$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);
|
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
|
||||||
if(!$pickResult){
|
if(!$pickResult){
|
||||||
|
|||||||
@@ -153,7 +153,14 @@ class Join extends \sammo\BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
$memberPenalty = Json::decode($member['penalty'] ?? "{}");
|
$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();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|||||||
@@ -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) {
|
foreach ($db->queryAllLists('SELECT capital, nation from nation WHERE capital in %li', $cities) as $row) {
|
||||||
[$oldCapital, $nation] = $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) {
|
if (!$capitalCandidates) {
|
||||||
$disabledInvaderCity->add($oldCapital);
|
$disabledInvaderCity->add($oldCapital);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newCapital = $rng->choice($capitalCandidates);
|
$newCapital = $rng->choice($capitalCandidates);
|
||||||
|
|
||||||
$db->update('nation', ['capital' => $newCapital], 'nation=%i', $nation);
|
$db->update('nation', ['capital' => $newCapital], 'nation=%i', $nation);
|
||||||
$db->update('general', ['city' => $newCapital], 'nation=%i and city=%i', $nation, $oldCapital);
|
$db->update('general', ['city' => $newCapital], 'nation=%i and city=%i', $nation, $oldCapital);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user