동결, 지연인 경우에 한해 커맨드 창의 월 표시가 다르게 되던 문제 수정.
addTurn, subTurn, cutTurn 등에서 밀리초 표기 개선
This commit is contained in:
@@ -94,7 +94,7 @@ switch ($btn) {
|
||||
}
|
||||
$turn = ($admin['year'] - $admin['startyear']) * 12 + $admin['month'] - 1;
|
||||
$starttime = $servTurnTime->sub(TimeUtil::secondsToDateInterval($turn * $unit))->format('Y-m-d H:i:s');
|
||||
$starttime = cutTurn($starttime, $turnterm);
|
||||
$starttime = cutTurn($starttime, $turnterm, false);
|
||||
$gameStor->turnterm = $turnterm;
|
||||
$gameStor->starttime = $starttime;
|
||||
pushWorldHistory(["<R>★</>턴시간이 <C>$btn</>으로 변경됩니다."]);
|
||||
|
||||
+2
-4
@@ -75,10 +75,8 @@ function myCommandList() {
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$date = TimeUtil::now();
|
||||
|
||||
// 명령 목록
|
||||
$admin = $gameStor->getValues(['year','month','turnterm']);
|
||||
$admin = $gameStor->getValues(['year','month','turnterm','turntime']);
|
||||
|
||||
$me = $db->queryFirstRow("SELECT `no`,turntime,term,turn0,turn1,turn2,turn3,turn4,turn5,turn6,turn7,turn8,turn9,turn10,turn11,turn12,turn13,turn14,turn15,turn16,turn17,turn18,turn19,turn20,turn21,turn22,turn23 FROM general WHERE `owner`=%s", $userID);
|
||||
if(!$me){
|
||||
@@ -97,7 +95,7 @@ function myCommandList() {
|
||||
$month = $admin['month'];
|
||||
// 실행된 턴시간이면 +1
|
||||
$cutTurn = cutTurn($me['turntime'], $admin['turnterm']);
|
||||
if($date <= $cutTurn) { $month++; }
|
||||
if($admin['turntime'] <= $cutTurn) { $month++; }
|
||||
|
||||
$totaldate = $me['turntime'];
|
||||
|
||||
|
||||
+22
-5
@@ -1186,21 +1186,27 @@ function banner() {
|
||||
GameConst::$banner);
|
||||
}
|
||||
|
||||
function addTurn($date, int $turnterm, int $turn=1) {
|
||||
function addTurn($date, int $turnterm, int $turn=1, bool $withFraction=true) {
|
||||
$date = new \DateTime($date);
|
||||
$target = $turnterm*$turn;
|
||||
$date->add(new \DateInterval("PT{$target}M"));
|
||||
if($withFraction){
|
||||
return $date->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
function subTurn($date, int $turnterm, int $turn=1) {
|
||||
function subTurn($date, int $turnterm, int $turn=1, bool $withFraction=true) {
|
||||
$date = new \DateTime($date);
|
||||
$target = $turnterm*$turn;
|
||||
$date->sub(new \DateInterval("PT{$target}M"));
|
||||
if($withFraction){
|
||||
return $date->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
function cutTurn($date, int $turnterm) {
|
||||
function cutTurn($date, int $turnterm, bool $withFraction=true) {
|
||||
$date = new \DateTime($date);
|
||||
|
||||
$baseDate = new \DateTime($date->format('Y-m-d'));
|
||||
@@ -1211,10 +1217,14 @@ function cutTurn($date, int $turnterm) {
|
||||
$diffMin -= $diffMin % $turnterm;
|
||||
|
||||
$baseDate->add(new \DateInterval("PT{$diffMin}M"));
|
||||
if($withFraction){
|
||||
return $baseDate->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
return $baseDate->format('Y-m-d H:i:s');
|
||||
|
||||
}
|
||||
|
||||
function cutDay($date, int $turnterm) {
|
||||
function cutDay($date, int $turnterm, bool $withFraction=true) {
|
||||
$date = new \DateTime($date);
|
||||
|
||||
$baseDate = new \DateTime($date->format('Y-m-d'));
|
||||
@@ -1236,7 +1246,14 @@ function cutDay($date, int $turnterm) {
|
||||
$diffMin -= $timeAdjust;
|
||||
|
||||
$baseDate->add(new \DateInterval("PT{$diffMin}M"));
|
||||
return [$baseDate->format('Y-m-d H:i:s'), $yearPulled, $newMonth];
|
||||
if($withFraction){
|
||||
$dateTimeString = $baseDate->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
else{
|
||||
$dateTimeString = $baseDate->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
return [$dateTimeString, $yearPulled, $newMonth];
|
||||
}
|
||||
|
||||
function increaseRefresh($type="", $cnt=1) {
|
||||
|
||||
Reference in New Issue
Block a user