feat: star days rotation (#2573)
Closes #2567 Reviewed-on: #2573 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									f94f2005d3
								
							
						
					
					
						commit
						9286627668
					
				@ -71,8 +71,8 @@
 | 
				
			|||||||
    "affinityBoost": false,
 | 
					    "affinityBoost": false,
 | 
				
			||||||
    "resourceBoost": false,
 | 
					    "resourceBoost": false,
 | 
				
			||||||
    "tennoLiveRelay": false,
 | 
					    "tennoLiveRelay": false,
 | 
				
			||||||
    "starDays": true,
 | 
					 | 
				
			||||||
    "galleonOfGhouls": 0,
 | 
					    "galleonOfGhouls": 0,
 | 
				
			||||||
 | 
					    "starDaysOverride": null,
 | 
				
			||||||
    "eidolonOverride": "",
 | 
					    "eidolonOverride": "",
 | 
				
			||||||
    "vallisOverride": "",
 | 
					    "vallisOverride": "",
 | 
				
			||||||
    "duviriOverride": "",
 | 
					    "duviriOverride": "",
 | 
				
			||||||
 | 
				
			|||||||
@ -82,8 +82,8 @@ export interface IConfig {
 | 
				
			|||||||
        affinityBoost?: boolean;
 | 
					        affinityBoost?: boolean;
 | 
				
			||||||
        resourceBoost?: boolean;
 | 
					        resourceBoost?: boolean;
 | 
				
			||||||
        tennoLiveRelay?: boolean;
 | 
					        tennoLiveRelay?: boolean;
 | 
				
			||||||
        starDays?: boolean;
 | 
					 | 
				
			||||||
        galleonOfGhouls?: number;
 | 
					        galleonOfGhouls?: number;
 | 
				
			||||||
 | 
					        starDaysOverride?: boolean;
 | 
				
			||||||
        eidolonOverride?: string;
 | 
					        eidolonOverride?: string;
 | 
				
			||||||
        vallisOverride?: string;
 | 
					        vallisOverride?: string;
 | 
				
			||||||
        duviriOverride?: string;
 | 
					        duviriOverride?: string;
 | 
				
			||||||
 | 
				
			|||||||
@ -1349,6 +1349,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
 | 
				
			|||||||
    const week = Math.trunc(day / 7);
 | 
					    const week = Math.trunc(day / 7);
 | 
				
			||||||
    const weekStart = EPOCH + week * 604800000;
 | 
					    const weekStart = EPOCH + week * 604800000;
 | 
				
			||||||
    const weekEnd = weekStart + 604800000;
 | 
					    const weekEnd = weekStart + 604800000;
 | 
				
			||||||
 | 
					    const date = new Date(timeMs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const worldState: IWorldState = {
 | 
					    const worldState: IWorldState = {
 | 
				
			||||||
        BuildLabel: typeof buildLabel == "string" ? buildLabel.split(" ").join("+") : buildConfig.buildLabel,
 | 
					        BuildLabel: typeof buildLabel == "string" ? buildLabel.split(" ").join("+") : buildConfig.buildLabel,
 | 
				
			||||||
@ -1401,11 +1402,24 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
 | 
				
			|||||||
            Node: "TennoConBHUB6"
 | 
					            Node: "TennoConBHUB6"
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (config.worldState?.starDays) {
 | 
					    const isFebruary = date.getUTCMonth() == 1;
 | 
				
			||||||
 | 
					    if (config.worldState?.starDaysOverride ?? isFebruary) {
 | 
				
			||||||
        worldState.Goals.push({
 | 
					        worldState.Goals.push({
 | 
				
			||||||
            _id: { $oid: "67a4dcce2a198564d62e1647" },
 | 
					            _id: { $oid: "67a4dcce2a198564d62e1647" },
 | 
				
			||||||
            Activation: { $date: { $numberLong: "1738868400000" } },
 | 
					            Activation: {
 | 
				
			||||||
            Expiry: { $date: { $numberLong: "2000000000000" } },
 | 
					                $date: {
 | 
				
			||||||
 | 
					                    $numberLong: config.worldState?.starDaysOverride
 | 
				
			||||||
 | 
					                        ? "1738868400000"
 | 
				
			||||||
 | 
					                        : Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1).toString()
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            Expiry: {
 | 
				
			||||||
 | 
					                $date: {
 | 
				
			||||||
 | 
					                    $numberLong: config.worldState?.starDaysOverride
 | 
				
			||||||
 | 
					                        ? "2000000000000"
 | 
				
			||||||
 | 
					                        : Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 1).toString()
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
            Count: 0,
 | 
					            Count: 0,
 | 
				
			||||||
            Goal: 0,
 | 
					            Goal: 0,
 | 
				
			||||||
            Success: 0,
 | 
					            Success: 0,
 | 
				
			||||||
 | 
				
			|||||||
@ -929,10 +929,6 @@
 | 
				
			|||||||
                                    <input class="form-check-input" type="checkbox" id="worldState.tennoLiveRelay" />
 | 
					                                    <input class="form-check-input" type="checkbox" id="worldState.tennoLiveRelay" />
 | 
				
			||||||
                                    <label class="form-check-label" for="worldState.tennoLiveRelay" data-loc="worldState_tennoLiveRelay"></label>
 | 
					                                    <label class="form-check-label" for="worldState.tennoLiveRelay" data-loc="worldState_tennoLiveRelay"></label>
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
                                <div class="form-check">
 | 
					 | 
				
			||||||
                                    <input class="form-check-input" type="checkbox" id="worldState.starDays" />
 | 
					 | 
				
			||||||
                                    <label class="form-check-label" for="worldState.starDays" data-loc="worldState_starDays"></label>
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                                <div class="form-check">
 | 
					                                <div class="form-check">
 | 
				
			||||||
                                    <input class="form-check-input" type="checkbox" id="worldState.varziaFullyStocked" />
 | 
					                                    <input class="form-check-input" type="checkbox" id="worldState.varziaFullyStocked" />
 | 
				
			||||||
                                    <label class="form-check-label" for="worldState.varziaFullyStocked" data-loc="worldState_varziaFullyStocked"></label>
 | 
					                                    <label class="form-check-label" for="worldState.varziaFullyStocked" data-loc="worldState_varziaFullyStocked"></label>
 | 
				
			||||||
@ -946,6 +942,14 @@
 | 
				
			|||||||
                                        <option value="3" data-loc="worldState_we3"></option>
 | 
					                                        <option value="3" data-loc="worldState_we3"></option>
 | 
				
			||||||
                                    </select>
 | 
					                                    </select>
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
 | 
					                                <div class="form-group mt-2">
 | 
				
			||||||
 | 
					                                    <label class="form-label" for="worldState.starDaysOverride" data-loc="worldState_starDays"></label>
 | 
				
			||||||
 | 
					                                    <select class="form-control" id="worldState.starDaysOverride" data-default="null">
 | 
				
			||||||
 | 
					                                        <option value="null" data-loc="normal"></option>
 | 
				
			||||||
 | 
					                                        <option value="true" data-loc="enabled"></option>
 | 
				
			||||||
 | 
					                                        <option value="false" data-loc="disabled"></option>
 | 
				
			||||||
 | 
					                                    </select>
 | 
				
			||||||
 | 
					                                </div>
 | 
				
			||||||
                                <div class="form-group mt-2">
 | 
					                                <div class="form-group mt-2">
 | 
				
			||||||
                                    <label class="form-label" for="worldState.eidolonOverride" data-loc="worldState_eidolonOverride"></label>
 | 
					                                    <label class="form-label" for="worldState.eidolonOverride" data-loc="worldState_eidolonOverride"></label>
 | 
				
			||||||
                                    <select class="form-control" id="worldState.eidolonOverride" data-default="">
 | 
					                                    <select class="form-control" id="worldState.eidolonOverride" data-default="">
 | 
				
			||||||
 | 
				
			|||||||
@ -2098,7 +2098,13 @@ for (const id of uiConfigs) {
 | 
				
			|||||||
    if (elm.tagName == "SELECT") {
 | 
					    if (elm.tagName == "SELECT") {
 | 
				
			||||||
        elm.onchange = function () {
 | 
					        elm.onchange = function () {
 | 
				
			||||||
            let value = this.value;
 | 
					            let value = this.value;
 | 
				
			||||||
            if (!isNaN(parseInt(value))) {
 | 
					            if (value == "true") {
 | 
				
			||||||
 | 
					                value = true;
 | 
				
			||||||
 | 
					            } else if (value == "false") {
 | 
				
			||||||
 | 
					                value = false;
 | 
				
			||||||
 | 
					            } else if (value == "null") {
 | 
				
			||||||
 | 
					                value = null;
 | 
				
			||||||
 | 
					            } else if (!isNaN(parseInt(value))) {
 | 
				
			||||||
                value = parseInt(value);
 | 
					                value = parseInt(value);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $.post({
 | 
					            $.post({
 | 
				
			||||||
 | 
				
			|||||||
@ -245,6 +245,7 @@ dict = {
 | 
				
			|||||||
    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
					    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
				
			||||||
    worldState_starDays: `Sternen-Tage`,
 | 
					    worldState_starDays: `Sternen-Tage`,
 | 
				
			||||||
    worldState_galleonOfGhouls: `Galeone der Ghule`,
 | 
					    worldState_galleonOfGhouls: `Galeone der Ghule`,
 | 
				
			||||||
 | 
					    enabled: `[UNTRANSLATED] Enabled`,
 | 
				
			||||||
    disabled: `Deaktiviert`,
 | 
					    disabled: `Deaktiviert`,
 | 
				
			||||||
    worldState_we1: `Wochenende 1`,
 | 
					    worldState_we1: `Wochenende 1`,
 | 
				
			||||||
    worldState_we2: `Wochenende 2`,
 | 
					    worldState_we2: `Wochenende 2`,
 | 
				
			||||||
 | 
				
			|||||||
@ -244,6 +244,7 @@ dict = {
 | 
				
			|||||||
    worldState_tennoLiveRelay: `TennoLive Relay`,
 | 
					    worldState_tennoLiveRelay: `TennoLive Relay`,
 | 
				
			||||||
    worldState_starDays: `Star Days`,
 | 
					    worldState_starDays: `Star Days`,
 | 
				
			||||||
    worldState_galleonOfGhouls: `Galleon of Ghouls`,
 | 
					    worldState_galleonOfGhouls: `Galleon of Ghouls`,
 | 
				
			||||||
 | 
					    enabled: `Enabled`,
 | 
				
			||||||
    disabled: `Disabled`,
 | 
					    disabled: `Disabled`,
 | 
				
			||||||
    worldState_we1: `Weekend 1`,
 | 
					    worldState_we1: `Weekend 1`,
 | 
				
			||||||
    worldState_we2: `Weekend 2`,
 | 
					    worldState_we2: `Weekend 2`,
 | 
				
			||||||
 | 
				
			|||||||
@ -245,6 +245,7 @@ dict = {
 | 
				
			|||||||
    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
					    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
				
			||||||
    worldState_starDays: `Días estelares`,
 | 
					    worldState_starDays: `Días estelares`,
 | 
				
			||||||
    worldState_galleonOfGhouls: `Galeón de Gules`,
 | 
					    worldState_galleonOfGhouls: `Galeón de Gules`,
 | 
				
			||||||
 | 
					    enabled: `[UNTRANSLATED] Enabled`,
 | 
				
			||||||
    disabled: `Desactivado`,
 | 
					    disabled: `Desactivado`,
 | 
				
			||||||
    worldState_we1: `Semana 1`,
 | 
					    worldState_we1: `Semana 1`,
 | 
				
			||||||
    worldState_we2: `Semana 2`,
 | 
					    worldState_we2: `Semana 2`,
 | 
				
			||||||
 | 
				
			|||||||
@ -245,6 +245,7 @@ dict = {
 | 
				
			|||||||
    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
					    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
				
			||||||
    worldState_starDays: `Jours Stellaires`,
 | 
					    worldState_starDays: `Jours Stellaires`,
 | 
				
			||||||
    worldState_galleonOfGhouls: `Galion des Goules`,
 | 
					    worldState_galleonOfGhouls: `Galion des Goules`,
 | 
				
			||||||
 | 
					    enabled: `[UNTRANSLATED] Enabled`,
 | 
				
			||||||
    disabled: `Désactivé`,
 | 
					    disabled: `Désactivé`,
 | 
				
			||||||
    worldState_we1: `Weekend 1`,
 | 
					    worldState_we1: `Weekend 1`,
 | 
				
			||||||
    worldState_we2: `Weekend 2`,
 | 
					    worldState_we2: `Weekend 2`,
 | 
				
			||||||
 | 
				
			|||||||
@ -245,6 +245,7 @@ dict = {
 | 
				
			|||||||
    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
					    worldState_tennoLiveRelay: `[UNTRANSLATED] TennoLive Relay`,
 | 
				
			||||||
    worldState_starDays: `[UNTRANSLATED] Star Days`,
 | 
					    worldState_starDays: `[UNTRANSLATED] Star Days`,
 | 
				
			||||||
    worldState_galleonOfGhouls: `[UNTRANSLATED] Galleon of Ghouls`,
 | 
					    worldState_galleonOfGhouls: `[UNTRANSLATED] Galleon of Ghouls`,
 | 
				
			||||||
 | 
					    enabled: `[UNTRANSLATED] Enabled`,
 | 
				
			||||||
    disabled: `[UNTRANSLATED] Disabled`,
 | 
					    disabled: `[UNTRANSLATED] Disabled`,
 | 
				
			||||||
    worldState_we1: `[UNTRANSLATED] Weekend 1`,
 | 
					    worldState_we1: `[UNTRANSLATED] Weekend 1`,
 | 
				
			||||||
    worldState_we2: `[UNTRANSLATED] Weekend 2`,
 | 
					    worldState_we2: `[UNTRANSLATED] Weekend 2`,
 | 
				
			||||||
 | 
				
			|||||||
@ -245,6 +245,7 @@ dict = {
 | 
				
			|||||||
    worldState_tennoLiveRelay: `TennoLive 中继站`,
 | 
					    worldState_tennoLiveRelay: `TennoLive 中继站`,
 | 
				
			||||||
    worldState_starDays: `活动:星日`,
 | 
					    worldState_starDays: `活动:星日`,
 | 
				
			||||||
    worldState_galleonOfGhouls: `战术警报:尸鬼的帆船战舰`,
 | 
					    worldState_galleonOfGhouls: `战术警报:尸鬼的帆船战舰`,
 | 
				
			||||||
 | 
					    enabled: `[UNTRANSLATED] Enabled`,
 | 
				
			||||||
    disabled: `关闭/取消配置`,
 | 
					    disabled: `关闭/取消配置`,
 | 
				
			||||||
    worldState_we1: `活动阶段:第一周`,
 | 
					    worldState_we1: `活动阶段:第一周`,
 | 
				
			||||||
    worldState_we2: `活动阶段:第二周`,
 | 
					    worldState_we2: `活动阶段:第二周`,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user