feat: 자율턴 한계 표기
This commit is contained in:
@@ -21,9 +21,11 @@ foreach($rawTurn as [$turn_idx, $action, $arg, $brief]){
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[$turnTerm, $year, $month, $lastExecute] = $gameStor->getValuesAsArray(['turnterm', 'year', 'month', 'turntime']);
|
[$turnTerm, $year, $month, $lastExecute] = $gameStor->getValuesAsArray(['turnterm', 'year', 'month', 'turntime']);
|
||||||
|
|
||||||
$turnTime = $db->queryFirstField('SELECT turntime FROM general WHERE no=%i', $generalID);
|
[$turnTime, $rawGeneralAux] = $db->queryFirstList('SELECT turntime, aux FROM general WHERE no=%i', $generalID);
|
||||||
|
$generalAux = Json::decode($rawGeneralAux??'{}');
|
||||||
|
|
||||||
if(cutTurn($turnTime, $turnTerm) > cutTurn($lastExecute, $turnTerm)){
|
if(cutTurn($turnTime, $turnTerm) > cutTurn($lastExecute, $turnTerm)){
|
||||||
//이미 이번달에 실행된 턴이다.
|
//이미 이번달에 실행된 턴이다.
|
||||||
@@ -42,5 +44,6 @@ Json::die([
|
|||||||
'year'=>$year,
|
'year'=>$year,
|
||||||
'month'=>$month,
|
'month'=>$month,
|
||||||
'date'=>TimeUtil::now(true),
|
'date'=>TimeUtil::now(true),
|
||||||
'turn'=>$commandList
|
'turn'=>$commandList,
|
||||||
|
'autorun_limit'=> $generalAux['autorun_limit']??null,
|
||||||
]);
|
]);
|
||||||
+17
-7
@@ -13,6 +13,8 @@ import './msg.ts';
|
|||||||
import './map.ts';
|
import './map.ts';
|
||||||
import { exportWindow } from './util/exportWindow';
|
import { exportWindow } from './util/exportWindow';
|
||||||
import {stringifyUrl} from 'query-string';
|
import {stringifyUrl} from 'query-string';
|
||||||
|
import { joinYearMonth } from './util/joinYearMonth';
|
||||||
|
import { parseYearMonth } from './util/parseYearMonth';
|
||||||
exportWindow($, '$');
|
exportWindow($, '$');
|
||||||
|
|
||||||
type TurnArg = {
|
type TurnArg = {
|
||||||
@@ -33,6 +35,7 @@ type ReservedTurnResponse = {
|
|||||||
month: number,
|
month: number,
|
||||||
date: string,
|
date: string,
|
||||||
turn: TurnItem[],
|
turn: TurnItem[],
|
||||||
|
autorun_limit: number|null,
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function ($) {
|
$(function ($) {
|
||||||
@@ -65,10 +68,12 @@ $(function ($) {
|
|||||||
const turnTime = parseTime(data.turnTime);
|
const turnTime = parseTime(data.turnTime);
|
||||||
let nextTurnTime = new Date(turnTime);
|
let nextTurnTime = new Date(turnTime);
|
||||||
|
|
||||||
let year = data.year;
|
let nowYearMonth = joinYearMonth(data.year, data.month);
|
||||||
let month = data.month;
|
const autorunLimitYearMonth = data.autorun_limit ?? nowYearMonth - 1;
|
||||||
|
const [autorunLimitYear, autorunLimitMonth] = parseYearMonth(autorunLimitYearMonth);
|
||||||
|
|
||||||
for (const [turnIdx, turnInfo] of Object.entries(data.turn)) {
|
for (const [turnIdx, turnInfo] of Object.entries(data.turn)) {
|
||||||
|
const [year, month] = parseYearMonth(nowYearMonth);
|
||||||
const $tr = $(`#command_${turnIdx}`);
|
const $tr = $(`#command_${turnIdx}`);
|
||||||
|
|
||||||
$tr.find('.time_pad').text(formatTime(nextTurnTime, 'HH:mm'));
|
$tr.find('.time_pad').text(formatTime(nextTurnTime, 'HH:mm'));
|
||||||
@@ -76,6 +81,15 @@ $(function ($) {
|
|||||||
const $turn_pad = $tr.find('.turn_pad');
|
const $turn_pad = $tr.find('.turn_pad');
|
||||||
const $turn_text = $turn_pad.find('.turn_text');
|
const $turn_text = $turn_pad.find('.turn_text');
|
||||||
$turn_text.text(turnInfo.brief).css('font-size', '13px');
|
$turn_text.text(turnInfo.brief).css('font-size', '13px');
|
||||||
|
if(nowYearMonth <= autorunLimitYearMonth){
|
||||||
|
const autorunTooltip = `<span class="obj_tooltip" data-toggle="tooltip" data-placement="top"
|
||||||
|
><span style='color:#aaffff;'>${turnInfo.brief}</span
|
||||||
|
><span class="tooltiptext">자율턴 수행기간: ${autorunLimitYear}년 ${autorunLimitMonth}까지</span
|
||||||
|
></span>`;
|
||||||
|
$turn_text.html(autorunTooltip);
|
||||||
|
initTooltip($turn_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const oWidth = unwrap($turn_pad.innerWidth());
|
const oWidth = unwrap($turn_pad.innerWidth());
|
||||||
const iWidth = unwrap($turn_text.outerWidth());
|
const iWidth = unwrap($turn_text.outerWidth());
|
||||||
@@ -85,11 +99,7 @@ $(function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nextTurnTime = addMinutes(nextTurnTime, data.turnTerm);
|
nextTurnTime = addMinutes(nextTurnTime, data.turnTerm);
|
||||||
month += 1;
|
nowYearMonth += 1;
|
||||||
if (month >= 13) {
|
|
||||||
year += 1;
|
|
||||||
month -= 12;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export function joinYearMonth(year: number, month: number): number {
|
||||||
|
return year * 12 + month - 1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export function parseYearMonth(yearMonth: number): [number, number] {
|
||||||
|
return [(yearMonth / 12) | 0, yearMonth % 12 + 1];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user