diff --git a/hwe/func.php b/hwe/func.php index 0284e298..2fb792cc 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1130,6 +1130,7 @@ function CheckOverhead() $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); [$turnterm, $refreshLimit] = $gameStor->getValuesAsArray(['turnterm', 'refreshLimit']); + $turnterm = abs($turnterm); $nextRefreshLimit = Util::round(pow($turnterm, 0.6) * 3) * GameConst::$refreshLimitCoef; @@ -1177,7 +1178,7 @@ function timeover(): bool list($turnterm, $turntime) = $gameStor->getValuesAsArray(['turnterm', 'turntime']); $diff = (new \DateTime())->getTimestamp() - (new \DateTime($turntime))->getTimestamp(); - $t = min($turnterm, 5); + $t = min(abs($turnterm), 5); $term = $diff; if ($term >= $t || $term < 0) { @@ -1199,6 +1200,12 @@ function checkDelay() // 1턴이상 갱신 없었으면 서버 지연 $term = $gameStor->turnterm; + + if($term < 0){ + //가변 턴에는 수행 안함! + return; + } + if ($term >= 20) { $threshold = 1; } else if ($term >= 10) { @@ -1278,10 +1285,14 @@ function turnDate($curtime) $admin = $gameStor->getValues(['startyear', 'starttime', 'turnterm', 'year', 'month']); $turn = $admin['starttime']; - $curturn = cutTurn($curtime, $admin['turnterm']); $term = $admin['turnterm']; - - $num = intdiv((strtotime($curturn) - strtotime($turn)), $term * 60); + if($term == -60){ + $num = VarTurn60::calcTurnDiff(new \DateTimeImmutable($turn), new \DateTimeImmutable($curtime)); + } + else{ + $curturn = cutTurn($curtime, $admin['turnterm']); + $num = intdiv((strtotime($curturn) - strtotime($turn)), $term * 60); + } $date = $admin['startyear'] * 12; $date += $num; @@ -2232,6 +2243,10 @@ function getRandTurn(RandUtil $rng, $term, ?\DateTimeInterface $baseDateTime = n throw new MustNotBeReachedException(); } + if($term == -60){ + [, $term] = VarTurn60::fromDatetime($baseDateTime)->cutTurn(); + } + $randSecond = $rng->nextRangeInt(0, 60 * $term - 1); $randFraction = $rng->nextRangeInt(0, 999999) / 1000000; //6자리 소수 @@ -2247,6 +2262,11 @@ function getRandTurn2(RandUtil $rng, $term, ?\DateTimeInterface $baseDateTime = } else { throw new MustNotBeReachedException(); } + + if($term == -60){ + [, $term] = VarTurn60::fromDatetime($baseDateTime)->cutTurn(); + } + $randSecond = $rng->nextRangeInt(0, 60 * $term - 1); $randFraction = $rng->nextRangeInt(0, 999999) / 1000000; //6자리 소수 diff --git a/hwe/func_legacy.php b/hwe/func_legacy.php index deaf55c3..efc88920 100644 --- a/hwe/func_legacy.php +++ b/hwe/func_legacy.php @@ -181,7 +181,12 @@ function info($type = 0) $admin = $gameStor->getValues(['year', 'month', 'turnterm', 'maxgeneral']); - $termtype = "{$admin['turnterm']}분 턴"; + $turnTermText = $admin['turnterm'].'분'; + if($admin['turnterm'] < 0){ + $turnTermText = "가변 {$admin['turnterm']}분"; + } + + $termtype = "{$turnTermText}분 턴"; $gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc < 2'); $npccount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc >= 2'); diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index c8046516..f2f76afd 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -10,6 +10,7 @@ use sammo\Enums\InheritanceKey; * @return int 토너먼트 초 단위 */ function calcTournamentTerm(int $turnTerm): int{ + $turnTerm = abs($turnTerm); return Util::valueFit($turnTerm, 5, 120); } @@ -138,6 +139,7 @@ function processTournament() function getTournamentTermText(int $turnTerm) { + $turnTerm = abs($turnTerm); $term = calcTournamentTerm($turnTerm); if ($term % 60 === 0) { @@ -342,7 +344,7 @@ function startBetting($type) { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); - [$year, $month, $startyear, $turnterm] = $gameStor->getValuesAsArray(['year', 'month', 'startyear', 'turnterm']); + [$year, $month, $startyear] = $gameStor->getValuesAsArray(['year', 'month', 'startyear']); pushGlobalHistoryLog([ "◆{$year}년 {$month}월:【대회】우승자를 예상하는 내기가 진행중입니다! 호사가의 참여를 기다립니다!" ], $year, $month); diff --git a/hwe/install.php b/hwe/install.php index cb733f15..5ba9ac7b 100644 --- a/hwe/install.php +++ b/hwe/install.php @@ -54,6 +54,7 @@ if ($session->userGrade < 5 && !$allowReset) {
+ diff --git a/hwe/j_get_select_npc_token.php b/hwe/j_get_select_npc_token.php index 0227114d..57799b86 100644 --- a/hwe/j_get_select_npc_token.php +++ b/hwe/j_get_select_npc_token.php @@ -36,6 +36,7 @@ list( $turnterm, $npcmode ) = $gameStor->getValuesAsArray(['maxgeneral', 'turnterm', 'npcmode']); +$turnterm = abs($turnterm); if($npcmode!=1){ Json::die([ diff --git a/hwe/j_select_picked_general.php b/hwe/j_select_picked_general.php index d5f99e96..6c35ceb9 100644 --- a/hwe/j_select_picked_general.php +++ b/hwe/j_select_picked_general.php @@ -121,7 +121,7 @@ $builder->setOwner($userID); $builder->setOwnerName($userNick); $builder->setKillturn(5); $builder->setNPCType(0); -$builder->setAuxVar('next_change', TimeUtil::nowAddMinutes(12 * $env['turnterm'])); +$builder->setAuxVar('next_change', TimeUtil::nowAddMinutes(12 * abs($env['turnterm']))); $builder->fillRemainSpecAsZero($env); $builder->build($env); $generalID = $builder->getGeneralID(); diff --git a/hwe/j_set_my_setting.php b/hwe/j_set_my_setting.php index 81f66f0f..f50be1f8 100644 --- a/hwe/j_set_my_setting.php +++ b/hwe/j_set_my_setting.php @@ -60,7 +60,7 @@ $me->setAuxVar('use_auto_nation_turn', $use_auto_nation_turn); $me->setVar('tnmt', $tnmt); if ($me->getNPCType() == 1 && $detachNPC) { - $turnterm = $gameStor->turnterm; + $turnterm = abs($gameStor->turnterm); if ($turnterm < 10) { $targetKillTurn = 30 / $turnterm; diff --git a/hwe/j_update_picked_general.php b/hwe/j_update_picked_general.php index e5aac0d0..0726809e 100644 --- a/hwe/j_update_picked_general.php +++ b/hwe/j_update_picked_general.php @@ -39,6 +39,7 @@ list( $npcmode, $turnterm ) = $gameStor->getValuesAsArray(['year', 'month', 'maxgeneral', 'npcmode', 'turnterm']); +$turnterm = abs($turnterm); if($npcmode!=2){ Json::die([ diff --git a/hwe/sammo/API/General/Join.php b/hwe/sammo/API/General/Join.php index bc20229c..3f599975 100644 --- a/hwe/sammo/API/General/Join.php +++ b/hwe/sammo/API/General/Join.php @@ -28,6 +28,7 @@ use sammo\UniqueConst; use sammo\UserLogger; use sammo\Util; use sammo\Validator; +use sammo\VarTurn60; use sammo\WebUtil; use function sammo\addTurn; @@ -355,20 +356,28 @@ class Join extends \sammo\BaseAPI } if ($inheritTurntimeZone !== null) { - $inheritTurntime = $inheritTurntimeZone * $admin['turnterm']; - $inheritTurntime += $rng->nextRangeInt(0, Util::clamp($admin['turnterm'] - 1, 0)); + $turnterm = abs($admin['turnterm']); + $inheritTurntime = $inheritTurntimeZone * $turnterm; + $inheritTurntime += $rng->nextRangeInt(0, Util::clamp($turnterm - 1, 0)); $userLogger->push(sprintf("턴 시간 %02d:%02d 로 지정", intdiv($inheritTurntime, 60), $inheritTurntime % 60), "inheritPoint"); $inheritTurntime += $rng->nextRangeInt(0, 999999) / 1000000; - $turntime = new \DateTimeImmutable(cutTurn($admin['turntime'], $admin['turnterm'])); + $turntime = new \DateTimeImmutable(cutTurn($admin['turntime'], $turnterm)); $turntime = $turntime->add(TimeUtil::secondsToDateInterval($inheritTurntime)); $turntime = TimeUtil::format($turntime, true); } else { - $turntime = getRandTurn($rng, $admin['turnterm'], new \DateTimeImmutable($admin['turntime'])); + $turntime = getRandTurn($rng, abs($admin['turnterm']), new \DateTimeImmutable($admin['turntime'])); } + if ($admin['turnterm'] == -60){ + $baseObj = VarTurn60::fromDatetime(new \DateTimeImmutable($admin['turntime'])); + $userTurnObj = VarTurn60::fromDatetime(new \DateTimeImmutable($turntime)); + if($baseObj->turnIdx != $userTurnObj->turnIdx){ + $turntime = $userTurnObj->addTurn(-1)->toDateStr(); + } + } $now = TimeUtil::now(true); if ($now >= $turntime) { diff --git a/hwe/sammo/API/InheritAction/ResetTurnTime.php b/hwe/sammo/API/InheritAction/ResetTurnTime.php index 3f8e7a20..6a106680 100644 --- a/hwe/sammo/API/InheritAction/ResetTurnTime.php +++ b/hwe/sammo/API/InheritAction/ResetTurnTime.php @@ -62,7 +62,7 @@ class ResetTurnTime extends \sammo\BaseAPI } $gameStor = KVStorage::getStorage($db, 'game_env'); - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); $currTurnTime = new DateTimeImmutable($general->getTurnTime()); diff --git a/hwe/sammo/AbsFromUserPool.php b/hwe/sammo/AbsFromUserPool.php index 4fca0fac..62de5d63 100644 --- a/hwe/sammo/AbsFromUserPool.php +++ b/hwe/sammo/AbsFromUserPool.php @@ -46,7 +46,7 @@ abstract class AbsFromUserPool extends AbsGeneralPool{ $gameStor = KVStorage::getStorage($db, 'game_env'); $result = []; - $validUntil = TimeUtil::nowAddMinutes(2 * $gameStor->turnterm); + $validUntil = TimeUtil::nowAddMinutes(2 * abs($gameStor->turnterm)); while(count($result) < $pickCnt){ $cand = $rng->choiceUsingWeightPair($pool); $poolID = $cand['id']; diff --git a/hwe/sammo/Auction.php b/hwe/sammo/Auction.php index ce274efa..72dcf3a4 100644 --- a/hwe/sammo/Auction.php +++ b/hwe/sammo/Auction.php @@ -164,7 +164,7 @@ abstract class Auction if ($date === null) { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); $date = $this->info->closeDate->add(TimeUtil::secondsToDateInterval( max(static::MIN_EXTENSION_MINUTES_PER_BID, $turnTerm * static::COEFF_EXTENSION_MINUTES_PER_BID) * 60 )); @@ -324,7 +324,7 @@ abstract class Auction } $gameStor = KVStorage::getStorage($db, 'game_env'); - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); if ($this->info->detail->availableLatestBidCloseDate !== null) { $extendedCloseDate = $now->add(TimeUtil::secondsToDateInterval( @@ -437,7 +437,7 @@ abstract class Auction $general->increaseVar($resType->value, -$morePoint); $gameStor = KVStorage::getStorage($db, 'game_env'); - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); $extendedCloseDate = $now->add(TimeUtil::secondsToDateInterval( max(static::MIN_EXTENSION_MINUTES_PER_BID, $turnTerm * static::COEFF_EXTENSION_MINUTES_PER_BID) * 60 )); @@ -471,7 +471,7 @@ abstract class Auction if ($highestBid->aux->tryExtendCloseDate) { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); //연장 요청이 있었다. $extendedCloseDate = $this->info->closeDate->add(TimeUtil::secondsToDateInterval( diff --git a/hwe/sammo/AuctionBasicResource.php b/hwe/sammo/AuctionBasicResource.php index 4302a1b8..56150e07 100644 --- a/hwe/sammo/AuctionBasicResource.php +++ b/hwe/sammo/AuctionBasicResource.php @@ -58,7 +58,7 @@ abstract class AuctionBasicResource extends Auction $now = new \DateTimeImmutable(); $gameStor = KVStorage::getStorage($db, 'game_env'); - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); $closeDate = $now->add(TimeUtil::secondsToDateInterval($closeTurnCnt * $turnTerm * 60)); $openResult = static::openAuction(new AuctionInfo( @@ -246,7 +246,13 @@ abstract class AuctionBasicResource extends Auction $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); $turnTerm = $gameStor->getValue('turnterm'); - $date = (new DateTimeImmutable())->add(TimeUtil::secondsToDateInterval($turnTerm * 60)); + if($turnTerm == -60){ + $date = VarTurn60::fromDatetime(new \DateTimeImmutable())->addTurn(1)->toDateStr(); + } + else{ + $date = (new DateTimeImmutable())->add(TimeUtil::secondsToDateInterval($turnTerm * 60)); + } + $this->shrinkCloseDate($date); } diff --git a/hwe/sammo/AuctionUniqueItem.php b/hwe/sammo/AuctionUniqueItem.php index 069bd346..78320f51 100644 --- a/hwe/sammo/AuctionUniqueItem.php +++ b/hwe/sammo/AuctionUniqueItem.php @@ -75,6 +75,7 @@ class AuctionUniqueItem extends Auction $now = new DateTimeImmutable(); [$turnTerm, $year, $month] = $gameStor->getValuesAsArray(['turnterm', 'year', 'month']); + $turnTerm = abs($turnTerm); $closeDate = $now->add(TimeUtil::secondsToDateInterval( max(static::MIN_AUCTION_CLOSE_MINUTES, $turnTerm * static::COEFF_AUCTION_CLOSE_MINUTES) * 60 @@ -266,7 +267,7 @@ class AuctionUniqueItem extends Auction } if ($availableEquipUniqueCnt <= 0) { - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); //제한에 걸렸다면 자동 연장 $extendedCloseDate = $this->info->closeDate->add(TimeUtil::secondsToDateInterval( max(static::MIN_EXTENSION_MINUTES_BY_EXTENSION_QUERY, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_UNIQUE_CNT) * 60 @@ -314,7 +315,7 @@ class AuctionUniqueItem extends Auction if (!$availableItemTypes) { if ($isExtendCloseDateRequired) { - $turnTerm = $gameStor->getValue('turnterm'); + $turnTerm = abs($gameStor->getValue('turnterm')); //동일 부위 제한에 걸렸다면 자동 연장 $extendedCloseDate = $this->info->closeDate->add(TimeUtil::secondsToDateInterval( max(static::MIN_EXTENSION_MINUTES_LIMIT_BY_BID, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_BY_BID) * 60 diff --git a/hwe/sammo/Command/Nation/che_불가침제의.php b/hwe/sammo/Command/Nation/che_불가침제의.php index d33f76f5..de763ef1 100644 --- a/hwe/sammo/Command/Nation/che_불가침제의.php +++ b/hwe/sammo/Command/Nation/che_불가침제의.php @@ -200,7 +200,7 @@ class che_불가침제의 extends Command\NationCommand $now = new \DateTime($date); $validUntil = new \DateTime($date); - $validMinutes = max(30, $env['turnterm'] * 3); + $validMinutes = max(30, abs($env['turnterm']) * 3); $validUntil->add(new \DateInterval("PT{$validMinutes}M")); $josaWa = JosaUtil::pick($nationName, '와'); diff --git a/hwe/sammo/Command/Nation/che_불가침파기제의.php b/hwe/sammo/Command/Nation/che_불가침파기제의.php index 1cf27c35..ede9634c 100644 --- a/hwe/sammo/Command/Nation/che_불가침파기제의.php +++ b/hwe/sammo/Command/Nation/che_불가침파기제의.php @@ -149,7 +149,7 @@ class che_불가침파기제의 extends Command\NationCommand{ $now = new \DateTime($date); $validUntil = new \DateTime($date); - $validMinutes = max(30, $env['turnterm']*3); + $validMinutes = max(30, abs($env['turnterm'])*3); $validUntil->add(new \DateInterval("PT{$validMinutes}M")); $msg = new DiplomaticMessage( diff --git a/hwe/sammo/Command/Nation/che_종전제의.php b/hwe/sammo/Command/Nation/che_종전제의.php index 236cb4c3..80555764 100644 --- a/hwe/sammo/Command/Nation/che_종전제의.php +++ b/hwe/sammo/Command/Nation/che_종전제의.php @@ -147,7 +147,7 @@ class che_종전제의 extends Command\NationCommand{ $now = new \DateTime($date); $validUntil = new \DateTime($date); - $validMinutes = max(30, $env['turnterm']*3); + $validMinutes = max(30, abs($env['turnterm'])*3); $validUntil->add(new \DateInterval("PT{$validMinutes}M")); $msg = new DiplomaticMessage( diff --git a/hwe/sammo/Event/Action/RaiseInvader.php b/hwe/sammo/Event/Action/RaiseInvader.php index dacef71f..8b5eb0ba 100644 --- a/hwe/sammo/Event/Action/RaiseInvader.php +++ b/hwe/sammo/Event/Action/RaiseInvader.php @@ -120,7 +120,7 @@ class RaiseInvader extends \sammo\Event\Action $gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor->setValue('isunited', 1); - $turnterm = $gameStor->turnterm; + $turnterm = abs($gameStor->turnterm); $generalCnt = $db->queryFirstField('SELECT count(*) FROM general'); if ($npcEachCount < 0) { diff --git a/hwe/sammo/Event/Action/UpdateNationLevel.php b/hwe/sammo/Event/Action/UpdateNationLevel.php index 88751956..44a39416 100644 --- a/hwe/sammo/Event/Action/UpdateNationLevel.php +++ b/hwe/sammo/Event/Action/UpdateNationLevel.php @@ -134,7 +134,7 @@ class UpdateNationLevel extends \sammo\Event\Action if ($levelDiff) { //유니크 아이템 하나 돌리자 $targetKillTurn = $env['killturn']; - $targetKillTurn -= 24 * 60 / $env['turnterm']; + $targetKillTurn -= 24 * 60 / abs($env['turnterm']); $nationGenIDList = $db->queryFirstColumn( 'SELECT no FROM general WHERE nation = %i AND killturn >= %i AND npc < 2', $nation['nation'], diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 68066a78..fa83585b 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -283,6 +283,7 @@ class General extends GeneralBase implements iAction } $recwar = new \DateTimeImmutable($this->getVar('recent_war')); $turnNow = new \DateTimeImmutable($this->getVar('turntime')); + $secDiff = TimeUtil::DateIntervalToSeconds($recwar->diff($turnNow)); if ($secDiff <= 0) { @@ -290,6 +291,12 @@ class General extends GeneralBase implements iAction return 0; } + if($turnTerm == -60){ + $turnDiff = VarTurn60::calcTurnDiff($recwar, $turnNow); + $this->calcCache[$cacheKey] = $turnDiff; + return $turnDiff; + } + $result = intdiv(Util::toInt($secDiff), 60 * $turnTerm); $this->calcCache[$cacheKey] = $result; return $result; diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 5b89f246..9c3324f7 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -1980,7 +1980,7 @@ class GeneralAI $db = DB::db(); $nationStor = KVStorage::getStorage($db, $general->getNationID(), 'nation_env'); - $turnTerm = $this->env['turnterm']; + $turnTerm = abs($this->env['turnterm']); //천도를 한턴 넣었다면 계속 넣는다. if ($lastTurn->getCommand() === '천도' && $lastTurn->getArg()['destCityID'] != $this->nation['capital']) { @@ -3715,7 +3715,7 @@ class GeneralAI $this->updateInstance(); //특별 메세지 있는 경우 출력 - $term = $this->env['turnterm']; + $term = abs($this->env['turnterm']); if ($general->getVar('npcmsg') && $this->rng->nextBool(GameConst::$npcMessageFreqByDay * $term / (60 * 24))) { $src = new MessageTarget( $general->getID(), @@ -3985,7 +3985,7 @@ class GeneralAI $userChiefCnt = 0; - $minUserKillturn = $this->env['killturn'] - Util::toInt(240 / $this->env['turnterm']); + $minUserKillturn = $this->env['killturn'] - Util::toInt(240 / abs($this->env['turnterm'])); $minNPCKillturn = 36; foreach (Util::range($minChiefLevel, 12) as $chiefLevel) { diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index 3842718f..92aaaac9 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -245,7 +245,16 @@ class ResetHelper{ true ); - if($sync == 0) { + if($turnterm == -60){ + [$starttime, $yearPulled, $month] = VarTurn60::fromDatetime(new \DateTimeImmutable($turntime))->cutDay(); + if($yearPulled){ + $year = $startyear-1; + } + else{ + $year = $startyear; + } + } + else if($sync == 0) { // 현재 시간을 1월로 맞춤 $starttime = cutTurn($turntime, $turnterm); $month = 1; @@ -261,7 +270,7 @@ class ResetHelper{ } } - $killturn = 4800 / $turnterm; + $killturn = 4800 / abs($turnterm); if($npcmode == 1) { $killturn = intdiv($killturn, 3); } $develcost = ($year - $startyear + 10) * 2; diff --git a/hwe/sammo/TurnExecutionHelper.php b/hwe/sammo/TurnExecutionHelper.php index 5a4a98a8..41861b2e 100644 --- a/hwe/sammo/TurnExecutionHelper.php +++ b/hwe/sammo/TurnExecutionHelper.php @@ -219,11 +219,20 @@ class TurnExecutionHelper $nextTurnTimeBase = $general->getAuxVar('nextTurnTimeBase'); if($nextTurnTimeBase !== null){ - $turntime = cutTurn($turntime, $gameStor->turnterm); - $turntimeObj = new \DateTimeImmutable($turntime); - $turntimeObj = $turntimeObj->add(TimeUtil::secondsToDateInterval($nextTurnTimeBase)); - $turntime = TimeUtil::format($turntimeObj, true); - $general->setAuxVar('nextTurnTimeBase', null); + if($gameStor->turnterm == -60){ + [$turntime, $nextTurnterm] = VarTurn60::fromDatetime(new \DateTimeImmutable($turntime))->cutTurn(); + $turntimeObj = new \DateTimeImmutable($turntime); + $turntimeObj = $turntimeObj->add(TimeUtil::secondsToDateInterval($nextTurnTimeBase * $nextTurnterm / 60)); + $turntime = TimeUtil::format($turntimeObj, true); + $general->setAuxVar('nextTurnTimeBase', null); + } + else { + $turntime = cutTurn($turntime, $gameStor->turnterm); + $turntimeObj = new \DateTimeImmutable($turntime); + $turntimeObj = $turntimeObj->add(TimeUtil::secondsToDateInterval($nextTurnTimeBase)); + $turntime = TimeUtil::format($turntimeObj, true); + $general->setAuxVar('nextTurnTimeBase', null); + } } $general->setVar('turntime', $turntime); diff --git a/hwe/ts/ChiefCenter/TopItem.vue b/hwe/ts/ChiefCenter/TopItem.vue index c2c16ca4..4c252e1d 100644 --- a/hwe/ts/ChiefCenter/TopItem.vue +++ b/hwe/ts/ChiefCenter/TopItem.vue @@ -68,7 +68,7 @@ import { formatTime } from "@/util/formatTime"; import { mb_strwidth } from "@/util/mb_strwidth"; import { parseTime } from "@/util/parseTime"; import type { StoredActionsHelper } from "@/util/StoredActionsHelper"; -import addMinutes from "date-fns/esm/addMinutes/index"; +import { addMinutes } from "date-fns/addMinutes"; import { range } from "lodash-es"; import { inject, onMounted, ref, type PropType } from "vue"; import VueTypes from "vue-types"; @@ -76,6 +76,7 @@ import DragSelect from "@/components/DragSelect.vue"; import { BButton } from "bootstrap-vue-next"; import { QueryActionHelper } from "@/util/QueryActionHelper"; import type { ChiefResponse } from "@/defs/API/NationCommand"; +import { VarTurn60 } from "@/varTurn60"; const props = defineProps({ style: VueTypes.object.isRequired, @@ -198,10 +199,21 @@ if (!props.officer || !props.officer.turnTime) { } } else { const baseTurnTime = parseTime(props.officer.turnTime); - for (const idx of range(props.officer.turn.length)) { - turnTimes.value.push( - formatTime(addMinutes(baseTurnTime, idx * props.turnTerm), props.turnTerm >= 5 ? "HH:mm" : "mm:ss") - ); + if(props.turnTerm == -60){ + const baseTurnTimeObj = VarTurn60.fromDatetime(baseTurnTime); + for (const idx of range(props.officer.turn.length)) { + turnTimes.value.push( + formatTime(baseTurnTimeObj.addTurn(idx).toDate(), "HH:mm") + ); + } } + else{ + for (const idx of range(props.officer.turn.length)) { + turnTimes.value.push( + formatTime(addMinutes(baseTurnTime, idx * props.turnTerm), props.turnTerm >= 5 ? "HH:mm" : "mm:ss") + ); + } + } + } diff --git a/hwe/ts/PageInheritPoint.vue b/hwe/ts/PageInheritPoint.vue index 57756e98..00f2ce41 100644 --- a/hwe/ts/PageInheritPoint.vue +++ b/hwe/ts/PageInheritPoint.vue @@ -310,14 +310,13 @@ declare const staticValues: { import { reactive, ref, watch } from "vue"; import "@scss/game_bg.scss"; import TopBackBar from "@/components/TopBackBar.vue"; -import _ from "lodash-es"; +import { sum } from "lodash-es"; import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue"; import { SammoAPI } from "./SammoAPI"; import { InheritResetStat, type inheritBuffType, type InheritPointLogItem } from "./defs/API/InheritAction"; import * as JosaUtil from "@/util/JosaUtil"; import { BButton } from "bootstrap-vue-next"; import { unwrap } from "./util/unwrap"; -import { add as dateAdd } from 'date-fns'; const inheritanceViewText: Record = { sum: { @@ -428,7 +427,7 @@ const title = "유산 관리"; const items = ref( (() => { - const totalPoint = Math.floor(_.sum(Object.values(staticValues.items))); + const totalPoint = Math.floor(sum(Object.values(staticValues.items))); const previousPoint = Math.floor(staticValues.items["previous"]); const newPoint = Math.floor(totalPoint - previousPoint); const result: Record = { diff --git a/hwe/ts/PageJoin.vue b/hwe/ts/PageJoin.vue index be116be3..5e935108 100644 --- a/hwe/ts/PageJoin.vue +++ b/hwe/ts/PageJoin.vue @@ -485,7 +485,7 @@ watch(inheritCity, (newValue: undefined | number) => { const inheritTurnTimeZone = ref(); const turnTimeZoneList: string[] = (()=>{ const result: string[] = []; - const zoneSec = turnterm; // * 60 / 60 + const zoneSec = Math.abs(turnterm); // * 60 / 60 let zoneCur = 0; for(const idx of range(60)){ const zoneNext = zoneCur + zoneSec; diff --git a/hwe/ts/PartialReservedCommand.vue b/hwe/ts/PartialReservedCommand.vue index 9ae40697..c8269a2b 100644 --- a/hwe/ts/PartialReservedCommand.vue +++ b/hwe/ts/PartialReservedCommand.vue @@ -276,7 +276,7 @@ declare const staticValues: {