refac: 전체 penalty는 expire와 value
- 게임 개시시 expire가 되지 않은 것을 기준 value만 전달 - 즉, 페널티는 깃수 단위 적용
This commit is contained in:
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user