cutDay가 변경된 월을 반환하도록 수정
설치 도구를 구현.
This commit is contained in:
+9
-3
@@ -1549,13 +1549,19 @@ function cutDay($date, int $turnterm) {
|
|||||||
$baseGap = 60*24 / $turnterm;
|
$baseGap = 60*24 / $turnterm;
|
||||||
|
|
||||||
$diffMin = intdiv($date->getTimeStamp() - $baseDate->getTimeStamp(), 60);
|
$diffMin = intdiv($date->getTimeStamp() - $baseDate->getTimeStamp(), 60);
|
||||||
if($diffMin % $baseGap != 0){
|
|
||||||
|
$timeAdjust = $diffMin % $baseGap;
|
||||||
|
$newMonth = intdiv($timeAdjust, $turnterm) + 1;
|
||||||
|
|
||||||
|
$yearPulled = false;
|
||||||
|
if($newMonth > 3){//3월 이후일때는
|
||||||
|
$yearPulled = true;
|
||||||
$diffMin += $baseGap;
|
$diffMin += $baseGap;
|
||||||
}
|
}
|
||||||
$diffMin -= $diffMin % $baseGap;
|
$diffMin -= $timeAdjust;
|
||||||
|
|
||||||
$baseDate->add(new \DateInterval("PT{$diffMin}M"));
|
$baseDate->add(new \DateInterval("PT{$diffMin}M"));
|
||||||
return $baseDate->format('Y-m-d H:i:s');
|
return [$baseDate->format('Y-m-d H:i:s'), $yearPulled, $newMonth];
|
||||||
}
|
}
|
||||||
|
|
||||||
function increaseRefresh($type="", $cnt=1) {
|
function increaseRefresh($type="", $cnt=1) {
|
||||||
|
|||||||
+48
-8
@@ -69,21 +69,61 @@ if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/schema.sql'))){
|
|||||||
while (@$mysqli_obj->next_result()) {;}
|
while (@$mysqli_obj->next_result()) {;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CityConst::build();
|
||||||
|
|
||||||
$db->insert('plock', [
|
$db->insert('plock', [
|
||||||
'plock'=>0
|
'plock'=>0
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/*
|
|
||||||
$db->insert('game', [
|
|
||||||
|
|
||||||
]);
|
$turntime = date('Y-m-d H:i:s');
|
||||||
*/
|
$time = substr($turntime, 11, 2);
|
||||||
//TODO:script
|
if($sync == 0) {
|
||||||
|
// 현재 시간을 1월로 맞춤
|
||||||
|
$starttime = cutTurn($turntime, $turnterm);
|
||||||
|
$month = 1;
|
||||||
|
$year = $startyear;
|
||||||
|
} else {
|
||||||
|
// 현재 시간과 동기화
|
||||||
|
list($starttime, $yearPulled, $month) = cutDay($turntime, $turnterm);
|
||||||
|
if($yearPulled){
|
||||||
|
$year = $startyear-1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$year = $startyear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$killturn = 4800 / $turnterm;
|
||||||
|
if($npcmode == 1) { $killturn = floor($killturn / 3); }
|
||||||
|
|
||||||
$env = [
|
$env = [
|
||||||
|
'year'=> $year,
|
||||||
|
'month'=> $month,
|
||||||
|
'msg'=>'공지사항',//TODO:공지사항
|
||||||
|
'maxgeneral'=>500,
|
||||||
|
'normgeneral'=>300,
|
||||||
|
'maxnation'=>55,
|
||||||
|
'conlimit'=>300,
|
||||||
|
'gold_rate'=>100,
|
||||||
|
'rice_rate'=>100,
|
||||||
|
'turntime'=>$turntime,
|
||||||
|
'starttime'=>$starttime,
|
||||||
|
'turnterm'=>$turnterm,
|
||||||
|
'killturn'=>$killturn,
|
||||||
|
'genius'=>5,
|
||||||
|
'startyear'=>$startyear,
|
||||||
|
'scenario'=>$scenario,
|
||||||
|
'show_img_level'=>$show_img_level,
|
||||||
|
'npcmode'=>$npcmode,
|
||||||
|
'extend'=>$extend,
|
||||||
|
'fiction'=>$fiction
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$db->insert('game', $env);
|
||||||
|
|
||||||
|
$scenario->build($env);
|
||||||
|
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result'=>true
|
||||||
'reason'=>'NYI'
|
|
||||||
]);
|
]);
|
||||||
Reference in New Issue
Block a user