Merge 39ee5b27fd
into 00ba2eebc8
This commit is contained in:
commit
9ac3eb2156
|
@ -22,6 +22,8 @@ export function applySessionDataPatches(data: SessionSaveData) {
|
||||||
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
||||||
m.className = "ResetNegativeStatStageModifier";
|
m.className = "ResetNegativeStatStageModifier";
|
||||||
} else if (m.className === "TempBattleStatBoosterModifier") {
|
} else if (m.className === "TempBattleStatBoosterModifier") {
|
||||||
|
// Dire Hit no longer a part of the TempBattleStatBoosterModifierTypeGenerator
|
||||||
|
if (m.typeId !== "DIRE_HIT") {
|
||||||
m.className = "TempStatStageBoosterModifier";
|
m.className = "TempStatStageBoosterModifier";
|
||||||
m.typeId = "TEMP_STAT_STAGE_BOOSTER";
|
m.typeId = "TEMP_STAT_STAGE_BOOSTER";
|
||||||
|
|
||||||
|
@ -31,6 +33,14 @@ export function applySessionDataPatches(data: SessionSaveData) {
|
||||||
|
|
||||||
// From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
|
// From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
|
||||||
m.args = [ newStat, 5, m.args[1] ];
|
m.args = [ newStat, 5, m.args[1] ];
|
||||||
|
} else {
|
||||||
|
m.className = "TempCritBoosterModifier";
|
||||||
|
m.typePregenArgs = [];
|
||||||
|
|
||||||
|
// From [ stat, battlesLeft ] to [ maxBattles, battleCount ]
|
||||||
|
m.args = [ 5, m.args[1] ];
|
||||||
|
}
|
||||||
|
|
||||||
} else if (m.className === "DoubleBattleChanceBoosterModifier" && m.args.length === 1) {
|
} else if (m.className === "DoubleBattleChanceBoosterModifier" && m.args.length === 1) {
|
||||||
let maxBattles: number;
|
let maxBattles: number;
|
||||||
switch (m.typeId) {
|
switch (m.typeId) {
|
||||||
|
@ -73,7 +83,7 @@ export function applySystemDataPatches(data: SystemSaveData) {
|
||||||
case "1.0.3":
|
case "1.0.3":
|
||||||
case "1.0.4":
|
case "1.0.4":
|
||||||
// --- LEGACY PATCHES ---
|
// --- LEGACY PATCHES ---
|
||||||
if (data.starterData) {
|
if (data.starterData && data.dexData) {
|
||||||
// Migrate ability starter data if empty for caught species
|
// Migrate ability starter data if empty for caught species
|
||||||
Object.keys(data.starterData).forEach(sd => {
|
Object.keys(data.starterData).forEach(sd => {
|
||||||
if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) {
|
if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) {
|
||||||
|
@ -104,6 +114,7 @@ export function applySystemDataPatches(data: SystemSaveData) {
|
||||||
// --- PATCHES ---
|
// --- PATCHES ---
|
||||||
|
|
||||||
// Fix Starter Data
|
// Fix Starter Data
|
||||||
|
if (data.starterData && data.dexData) {
|
||||||
for (const starterId of defaultStarterSpecies) {
|
for (const starterId of defaultStarterSpecies) {
|
||||||
if (data.starterData[starterId]?.abilityAttr) {
|
if (data.starterData[starterId]?.abilityAttr) {
|
||||||
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
||||||
|
@ -113,6 +124,7 @@ export function applySystemDataPatches(data: SystemSaveData) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data.gameVersion = LATEST_VERSION;
|
data.gameVersion = LATEST_VERSION;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import { Button } from "#app/enums/buttons";
|
||||||
|
|
||||||
export default class AdminUiHandler extends FormModalUiHandler {
|
export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
|
|
||||||
|
private unlinkAction: Function;
|
||||||
|
|
||||||
constructor(scene: BattleScene, mode: Mode | null = null) {
|
constructor(scene: BattleScene, mode: Mode | null = null) {
|
||||||
super(scene, mode);
|
super(scene, mode);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +26,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
getWidth(config?: ModalConfig): number {
|
getWidth(config?: ModalConfig): number {
|
||||||
return 160;
|
return 220;
|
||||||
}
|
}
|
||||||
|
|
||||||
getMargin(config?: ModalConfig): [number, number, number, number] {
|
getMargin(config?: ModalConfig): [number, number, number, number] {
|
||||||
|
@ -32,7 +34,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
getButtonLabels(config?: ModalConfig): string[] {
|
getButtonLabels(config?: ModalConfig): string[] {
|
||||||
return ["Link account", "Cancel"];
|
return ["Link account", "Unlink account", "Cancel"];
|
||||||
}
|
}
|
||||||
|
|
||||||
processInput(button: Button): boolean {
|
processInput(button: Button): boolean {
|
||||||
|
@ -48,6 +50,20 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
if (super.show(args)) {
|
if (super.show(args)) {
|
||||||
const config = args[0] as ModalConfig;
|
const config = args[0] as ModalConfig;
|
||||||
const originalSubmitAction = this.submitAction;
|
const originalSubmitAction = this.submitAction;
|
||||||
|
let originAction: number = 0; // this is used to keep track of which button has been pressed
|
||||||
|
/* This code is here because currently the form-modal-ui-handler is hardcoded to only have a single action button and a cancel button
|
||||||
|
* This code below adds interactivity and a specific action to the unlink account button. This also sets up the originalAction variable
|
||||||
|
* from above, which lets us figure out if we're linking or unlinking, which makes this.submitAction do post different API calls
|
||||||
|
*/
|
||||||
|
for (let i = 0; i < this.buttonBgs.length - 1; i++) {
|
||||||
|
this.buttonBgs[i].off("pointerdown");
|
||||||
|
this.buttonBgs[i].on("pointerdown", () => {
|
||||||
|
originAction = i;
|
||||||
|
if (this.submitAction) {
|
||||||
|
this.submitAction();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.submitAction = (_) => {
|
this.submitAction = (_) => {
|
||||||
this.submitAction = originalSubmitAction;
|
this.submitAction = originalSubmitAction;
|
||||||
this.scene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
this.scene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||||
|
@ -61,6 +77,7 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
if (!this.inputs[1].text) {
|
if (!this.inputs[1].text) {
|
||||||
return onFail("Discord Id is required");
|
return onFail("Discord Id is required");
|
||||||
}
|
}
|
||||||
|
if (originAction === 0) {
|
||||||
Utils.apiPost("admin/account/discord-link", `username=${encodeURIComponent(this.inputs[0].text)}&discordId=${encodeURIComponent(this.inputs[1].text)}`, "application/x-www-form-urlencoded", true)
|
Utils.apiPost("admin/account/discord-link", `username=${encodeURIComponent(this.inputs[0].text)}&discordId=${encodeURIComponent(this.inputs[1].text)}`, "application/x-www-form-urlencoded", true)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
@ -75,6 +92,22 @@ export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
this.scene.ui.revertMode();
|
this.scene.ui.revertMode();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
} else if (originAction === 1) {
|
||||||
|
Utils.apiPost("admin/account/discord-unlink", `username=${encodeURIComponent(this.inputs[0].text)}&discordId=${encodeURIComponent(this.inputs[1].text)}`, "application/x-www-form-urlencoded", true)
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
console.error(response);
|
||||||
|
}
|
||||||
|
this.inputs[0].setText("");
|
||||||
|
this.inputs[1].setText("");
|
||||||
|
this.scene.ui.revertMode();
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
this.scene.ui.revertMode();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -393,6 +393,9 @@ export default class MenuUiHandler extends MessageUiHandler {
|
||||||
() => {
|
() => {
|
||||||
ui.revertMode();
|
ui.revertMode();
|
||||||
},
|
},
|
||||||
|
() => {
|
||||||
|
ui.revertMode();
|
||||||
|
},
|
||||||
() => {
|
() => {
|
||||||
ui.revertMode();
|
ui.revertMode();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue