diff --git a/hwe/func.php b/hwe/func.php index cbabbc3e..68ac8331 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -2158,7 +2158,7 @@ function getRandTurn($term, ?\DateTimeInterface $baseDateTime = null) $randSecond = Util::randRangeInt(0, 60 * $term - 1); $randFraction = Util::randRangeInt(0, 999999) / 1000000; //6자리 소수 - return $baseDateTime->add(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s'); + return $baseDateTime->add(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s.u'); } function getRandTurn2($term, ?\DateTimeInterface $baseDateTime = null) @@ -2173,5 +2173,5 @@ function getRandTurn2($term, ?\DateTimeInterface $baseDateTime = null) $randSecond = Util::randRangeInt(0, 60 * $term - 1); $randFraction = Util::randRangeInt(0, 999999) / 1000000; //6자리 소수 - return $baseDateTime->sub(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s'); + return $baseDateTime->sub(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s.u'); } diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 07e07a6f..a6faafe4 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -1150,14 +1150,23 @@ function checkEmperior() LogHistory(); } -function resetInheritanceUser(int $userID, bool $isRebirth=false){ +function resetInheritanceUser(int $userID, bool $isRebirth=false):float{ $rebirthDegraded = [ 'dex'=>0.5, ]; $inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}"); $totalPoint = 0; - foreach($inheritStor->getAll() as $key=>[$value,]){ + $allPoints = $inheritStor->getAll(); + if(count($allPoints) == 0){ + //비었으므로 리셋 안함 + return 0; + } + if(count($allPoints) == 1 && key_exists('previous', $allPoints)){ + //이미 리셋되었으므로 리셋 안함 + return $allPoints['previous']; + } + foreach($allPoints as $key=>[$value,]){ if($isRebirth && key_exists($key, $rebirthDegraded)){ $value *= $rebirthDegraded[$key]; } @@ -1166,6 +1175,7 @@ function resetInheritanceUser(int $userID, bool $isRebirth=false){ $totalPoint = Util::toInt($totalPoint); $inheritStor->resetValues(); $inheritStor->setValue('previous', [$totalPoint, null]); + return $totalPoint; } function updateMaxDomesticCritical(General $general, $score){ diff --git a/hwe/join_post.php b/hwe/join_post.php index fbd6b58a..e9fb0d22 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -1,39 +1,50 @@