Last active
November 29, 2023 15:49
-
-
Save CannoHarito/9eeb199a899014a2539b10952d5a9a8c to your computer and use it in GitHub Desktop.
BLUE PROTOCOL(ブルプロ)のレグナス時間を求めるTypeScript。 単なる推測です。ゲームと一致するか保証しません。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface RegnusClock { | |
isNight: boolean | |
remainSecond: number | |
} | |
// レグナスの1日は50分 | |
const dayDuration = 50 * 60; | |
// UTC00:00:00はレグナスの朝の12.5分前? | |
// const regnusStart = -12.5 * 60; | |
// 実際は22秒ずれてる? //750?740?728? | |
const regnusStart = -728; | |
const fixSecond = (regnusStart + 24 * 60 * 60) % (dayDuration / 2); | |
export function getRegnusClock(date: Date = new Date()): RegnusClock { | |
// UTC秒 | |
const instant = date.getUTCHours() * 60 * 60 + date.getUTCMinutes() * 60 + date.getUTCSeconds(); | |
// -00:02:30~+23:57:29の範囲に補正したUTC秒 // 補正秒調整 | |
const fixedInstant = (instant + fixSecond) % (24 * 60 * 60) - fixSecond; | |
//朝の始まりを0とするレグナス時間(0~50*60)。正の数で。 | |
const regnusTime = (regnusStart + fixedInstant + dayDuration) % dayDuration; | |
const isNight = regnusTime >= dayDuration / 2; | |
const remainSecond = (dayDuration / 2) - regnusTime % (dayDuration / 2); | |
return { isNight, remainSecond }; | |
} | |
// Learn more at https://deno.land/manual/examples/module_metadata#concepts | |
if (import.meta?.main) { | |
console.log("now->", getRegnusClock()); | |
console.log("08:57:00->", getRegnusClock(new Date("2023-11-29T08:57:00"))); | |
console.log("08:57:30->", getRegnusClock(new Date("2023-11-29T08:57:30"))); | |
console.log("09:00:00->", getRegnusClock(new Date("2023-11-29T09:00:00"))); | |
console.log("09:12:30->", getRegnusClock(new Date("2023-11-29T09:12:30"))); | |
console.log("09:37:30->", getRegnusClock(new Date("2023-11-29T09:37:30"))); | |
} |
今現在のゲーム内時間と比べると想像より22秒ずれてたので合わせてみました
今後もクロノリープの影響でずれるかもしれません
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fixedInstant
の補正秒数2.5*60は以下です(regnusStart + 24 * 60 * 60) % (dayDuration / 2)