SBTE is an open-sourced web time engine for the time system in Hypixel SkyBlock.
This script was originally created for the Hypixel SkyBlock Wiki.
The code is written in the latest EMCAScript standard. A build stage calls on Babel and Webpack: the prior produces the ES5 compliant code used on MediaWiki, and the latter combines all scripts into a single file starting from entry.js. The generated file goes to the dist folder.
For standard web integration, see the examples folder (along with sources in the src folder, except entry.js). Note: To open it on your own machine, due to browser's CORS policy, you might have to use VSCode Live Server or other workarounds.
For MediaWiki integration, see the TimingEvents implementation (along with sources in the src folder). It uses mw.hook to ensure correct running sequence.
There are six classes that facilitate web integration of the Hypixel SkyBlock Standard Time (SBST, "SkyBlock time"). The design is modular; meaning it starts from a module handling durations, then dates, then routines.
Traditionally, SkyDate supported Main Server time. Prototype-based inheritance in JavaScript made adjusting to Alpha Server time very easy.
| Class | Description | Source file | Dependent classes |
|---|---|---|---|
| SkyDuration | Represents a duration and handles conversions between SBST and UTC. | SkyDuration.js | |
| SkyDate | Represents a date and handles conversions between SBST, UTC and LOCAL. Uses Main Server time. | SkyDate.js | SkyDuration |
| SkyRoutine | Stores and handles transactions of a routine. Uses Main Server time. | SkyRoutine.js | SkyDuration, SkyDate |
| SkyDateAlpha | The same as SkyDate, but uses the Alpha Server time. | AlphaExt.js | SkyDuration, SkyDate |
| SkyRoutineAlpha | The same as SkyRoutine, but uses the Alpha Server time. | AlphaExt.js | SkyDuration, SkyDate, SkyRoutine |
A locale determines the length of time measuring units. Both SkyDuration and SkyDate support specification of locale at the end of the input string. Current supported locales are:
- UTC (Coordinated Universal Time). Specification:
-U - SBST (SkyBlock Standard Time). Specification:
-SFor example,7y 6d -Smeans 7 Years and 6 Days in SBST.D6 M9 2000 00:00 -Umeans September 6, 2000 in UTC.
SkyDuration is a custom class which represents a duration. Fields in the duration can be defined with components in any order and are case insensitive. For example, 2y 3mo 1d 3h 2m 50s -U is the same as 50S 2M 3H 1D 3Mo 2Y -U.
A SkyDuration can be defined through UTC units or SBST units: A trailing locale specification can be added (if not specified, SBST units will be used).
| Unit | Written Form (# = number) | Default Value if not specified |
|---|---|---|
| Year | #y | 0 |
| Month | #mo | 0 |
| Day | #d | 0 |
| Hour | #h | 0 |
| Minute | #m | 0 |
| Second | #s | 0 |
SkyDate is a custom class which represents a date. Fields in the date can be defined with components in any order and are case insensitive. For example, Y2019 M6 D12 17:00 -U is the same as 17:00 D12 Jun Y2019 -U.
A SkyDate can be defined through a UTC date or a SBST date: A trailing locale specification can be added (if not specified, locale is SBST).
All fields in the date can be optionally defined. The values will be determined by the table below:
| Unit | Written Form (# = number) | Value Range | Default Value when below Highest Defined Unit | Default Value when above Lowest Defined Unit or when nothing is defined |
|---|---|---|---|---|
| (Highest) Year | Y# | Any Number | (This value is the highest) | Current Year |
| Month | M# or Month_String (See conversion table below) | 1-12 | 1 | Current Month |
| Day | D# | 1-31 | 1 | Current Day |
| Hour | ##: | 0-23 | 0 | Current Hour |
| Minute | :## | 0-59 | 0 | Current Minute |
| (Lowest) Second | ::## | 0-59 | 0 | Current Second |
Therefore, for an exact, non-changing date representation, the year must be specified. In a SkyRoutine, an exact, non-changing date representation is always recommended.
Month_String Conversion Table:
| Converts to | Values accepted | ||
|---|---|---|---|
| The value of 1 | M1 | Jan | ESP |
| The value of 2 | M2 | Feb | SP |
| The value of 3 | M3 | Mar | LSP |
| The value of 4 | M4 | Apr | ESU |
| The value of 5 | M5 | May | SU |
| The value of 6 | M6 | Jun | LSU |
| The value of 7 | M7 | Jul | EAU |
| The value of 8 | M8 | Aug | AU |
| The value of 9 | M9 | Sep | LAU |
| The value of 10 | M10 | Oct | EWI |
| The value of 11 | M11 | Nov | WI |
| The value of 12 | M12 | Dec | LWI |
SkyRoutine is a custom class that handles transactions of a routine. It is responsible for parsing the routine input, and load and handle events.
A SkyRoutine is written in the following syntax: A[...] C[...] L[...] U[...], where:
| Key | Meaning | Mandatory | Accepts Values |
|---|---|---|---|
| A | Anchor | Yes | A SkyDate representation of a date (See SkyDate Syntax) |
| C | Cycle | No | A slash-separated list of SkyDuration or Number, in the form of [ Run Time / Break Time / Run Time / Break Time ... ] The time is best represented in SkyDuration (See SkyDuration Syntax) Alternatively, if specified in Number, it will be treated as number of seconds passed in the locale chosen for the Anchor (See locale) If not specified, or if the program found zero interval between events, the event will be limited to one execution. |
| L | Limit | No | The maximum number of executions allowed. |
| U | Until | No | A date in SkyDate representation. No event will start past this date. |
SkyRoutine can trace the number of would-have executions before the browser run the code, and inserts itself into the correct state. The anchor date can be set anytime in the past. If the anchor date is in the future, SkyRoutine will wait until the anchor date to execute the first time.
| Version | Changes | Target |
|---|---|---|
| 3.1 | Babel and webpack integration for transpiling to ES5 compliant bundle | Latest (module) |
| 3.0 | Breaking change: Routine cycle separator changed from | to / Switched to using ECMAScript module |
ES5 (module), ES5 (bundled for mediawiki) |
| 2.1 | Undocumented. | ES5, ES5 (bundled for mediawiki) |
| 2.0 | Undocumented. | ES5, ES5 (bundled for mediawiki) |
| 1.0 | Undocumented. | ES5, ES6, ES5 (bundled for mediawiki) |
| beta 2 | Undocumented. | ES5, ES6 |
| beta 1 | Undocumented. | ES6 |