mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 23:13:42 +02:00
Merge cfb0857b44
into cffbafe4bd
This commit is contained in:
commit
457cf7656b
@ -1,8 +1,11 @@
|
||||
import { pokerogueApi } from "#api/pokerogue-api";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { bypassLogin } from "#app/global-vars/bypass-login";
|
||||
import { Button } from "#enums/buttons";
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { GameData } from "#system/game-data";
|
||||
import type { SearchAccountResponse } from "#types/api/pokerogue-admin-api";
|
||||
import type { InputFieldConfig } from "#ui/form-modal-ui-handler";
|
||||
import { FormModalUiHandler } from "#ui/form-modal-ui-handler";
|
||||
import type { ModalConfig } from "#ui/modal-ui-handler";
|
||||
@ -17,6 +20,8 @@ export class AdminUiHandler extends FormModalUiHandler {
|
||||
private adminResult: AdminSearchInfo;
|
||||
private config: ModalConfig;
|
||||
|
||||
private tempGameData: GameData;
|
||||
|
||||
private readonly buttonGap = 10;
|
||||
private readonly ERR_REQUIRED_FIELD = (field: string) => {
|
||||
if (field === "username") {
|
||||
@ -48,13 +53,13 @@ export class AdminUiHandler extends FormModalUiHandler {
|
||||
override getButtonLabels(): string[] {
|
||||
switch (this.adminMode) {
|
||||
case AdminMode.LINK:
|
||||
return ["Link Account", "Cancel"];
|
||||
return ["Link Account", "Cancel", " ", " "];
|
||||
case AdminMode.SEARCH:
|
||||
return ["Find account", "Cancel"];
|
||||
return ["Find account", "Cancel", " ", " "];
|
||||
case AdminMode.ADMIN:
|
||||
return ["Back to search", "Cancel"];
|
||||
return ["Back to search", "Cancel", "Stats", "Pokedex"];
|
||||
default:
|
||||
return ["Activate ADMIN", "Cancel"];
|
||||
return ["Activate ADMIN", "Cancel", " ", " "];
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,8 +278,8 @@ export class AdminUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
break;
|
||||
case AdminMode.SEARCH:
|
||||
if (!this.inputs[0].text) {
|
||||
// username missing from search panel
|
||||
if (!this.inputs[0].text && !bypassLogin) {
|
||||
// username missing from search panel, skip check for local testing
|
||||
return {
|
||||
error: true,
|
||||
errorMessage: this.ERR_REQUIRED_FIELD("username"),
|
||||
@ -314,6 +319,18 @@ export class AdminUiHandler extends FormModalUiHandler {
|
||||
}
|
||||
|
||||
private async adminSearch(adminSearchResult: AdminSearchInfo) {
|
||||
// Mocking response, solely for local testing
|
||||
if (bypassLogin) {
|
||||
const fakeResponse: SearchAccountResponse = {
|
||||
username: adminSearchResult.username,
|
||||
discordId: "",
|
||||
googleId: "",
|
||||
lastLoggedIn: "",
|
||||
registered: "",
|
||||
};
|
||||
this.tempGameData = globalScene.gameData;
|
||||
return { adminSearchResult: fakeResponse, error: false };
|
||||
}
|
||||
try {
|
||||
const [adminInfo, errorType] = await pokerogueApi.admin.searchAccount({
|
||||
username: adminSearchResult.username,
|
||||
@ -397,6 +414,12 @@ export class AdminUiHandler extends FormModalUiHandler {
|
||||
globalScene.ui.revertMode();
|
||||
globalScene.ui.revertMode();
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setOverlayMode(UiMode.GAME_STATS, this.tempGameData);
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setOverlayMode(UiMode.POKEDEX, this.tempGameData);
|
||||
},
|
||||
],
|
||||
},
|
||||
mode,
|
||||
|
@ -239,6 +239,9 @@ export class GameStatsUiHandler extends UiHandler {
|
||||
/** Logged in username */
|
||||
private headerText: Phaser.GameObjects.Text;
|
||||
|
||||
/** The game data to display */
|
||||
private gameData: GameData;
|
||||
|
||||
/** Whether the UI is single column mode */
|
||||
private get singleCol(): boolean {
|
||||
const resolvedLang = i18next.resolvedLanguage ?? "en";
|
||||
@ -396,7 +399,12 @@ export class GameStatsUiHandler extends UiHandler {
|
||||
}
|
||||
|
||||
show(args: any[]): boolean {
|
||||
super.show(args);
|
||||
super.show([]);
|
||||
|
||||
this.gameData = globalScene.gameData;
|
||||
if (args.length > 0) {
|
||||
this.gameData = args[0];
|
||||
}
|
||||
|
||||
// show updated username on every render
|
||||
this.headerText.setText(this.getUsername());
|
||||
@ -436,7 +444,7 @@ export class GameStatsUiHandler extends UiHandler {
|
||||
const statKeys = Object.keys(displayStats).slice(this.cursor * columns, this.cursor * columns + perPage);
|
||||
statKeys.forEach((key, s) => {
|
||||
const stat = displayStats[key] as DisplayStat;
|
||||
const value = stat.sourceFunc?.(globalScene.gameData) ?? "-";
|
||||
const value = stat.sourceFunc?.(this.gameData) ?? "-";
|
||||
const valAsInt = Number.parseInt(value);
|
||||
this.statLabels[s].setText(
|
||||
!stat.hidden || Number.isNaN(value) || valAsInt ? i18next.t(`gameStatsUiHandler:${stat.label_key}`) : "???",
|
||||
@ -512,6 +520,7 @@ export class GameStatsUiHandler extends UiHandler {
|
||||
clear() {
|
||||
super.clear();
|
||||
this.gameStatsContainer.setVisible(false).setActive(false);
|
||||
// TODO: do we need to clear this.gameData here?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ export class MenuUiHandler extends MessageUiHandler {
|
||||
keepOpen: true,
|
||||
},
|
||||
];
|
||||
if (!bypassLogin && loggedInUser?.hasAdminRole) {
|
||||
if (bypassLogin || loggedInUser?.hasAdminRole) {
|
||||
communityOptions.push({
|
||||
label: "Admin",
|
||||
handler: () => {
|
||||
|
@ -31,6 +31,7 @@ import { UiMode } from "#enums/ui-mode";
|
||||
import { UiTheme } from "#enums/ui-theme";
|
||||
import type { Variant } from "#sprites/variant";
|
||||
import { getVariantIcon, getVariantTint } from "#sprites/variant";
|
||||
import type { GameData } from "#system/game-data";
|
||||
import { SettingKeyboard } from "#system/settings-keyboard";
|
||||
import type { DexEntry } from "#types/dex-data";
|
||||
import type { DexAttrProps, StarterAttributes } from "#types/save-data";
|
||||
@ -236,6 +237,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
private showFormTrayLabel: Phaser.GameObjects.Text;
|
||||
private canShowFormTray: boolean;
|
||||
private filteredIndices: SpeciesId[];
|
||||
private gameData: GameData;
|
||||
|
||||
constructor() {
|
||||
super(UiMode.POKEDEX);
|
||||
@ -641,10 +643,15 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
|
||||
this.pokerusSpecies = getPokerusStarters();
|
||||
|
||||
this.gameData = globalScene.gameData;
|
||||
|
||||
// When calling with "refresh", we do not reset the cursor and filters
|
||||
if (args.length > 0 && args[0] === "refresh") {
|
||||
if (args.length > 0) {
|
||||
if (args[0] === "refresh") {
|
||||
return false;
|
||||
}
|
||||
this.gameData = args[0];
|
||||
}
|
||||
|
||||
super.show(args);
|
||||
|
||||
@ -685,8 +692,8 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
*/
|
||||
initStarterPrefs(species: PokemonSpecies): StarterAttributes {
|
||||
const starterAttributes = this.starterPreferences[species.speciesId];
|
||||
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
||||
const starterData = globalScene.gameData.starterData[species.speciesId];
|
||||
const dexEntry = this.gameData.dexData[species.speciesId];
|
||||
const starterData = this.gameData.starterData[species.speciesId];
|
||||
|
||||
// no preferences or Pokemon wasn't caught, return empty attribute
|
||||
if (!starterAttributes || !dexEntry.caughtAttr) {
|
||||
@ -753,15 +760,14 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
const selectedForm = starterAttributes.form;
|
||||
if (
|
||||
selectedForm !== undefined
|
||||
&& (!species.forms[selectedForm]?.isStarterSelectable
|
||||
|| !(caughtAttr & globalScene.gameData.getFormAttr(selectedForm)))
|
||||
&& (!species.forms[selectedForm]?.isStarterSelectable || !(caughtAttr & this.gameData.getFormAttr(selectedForm)))
|
||||
) {
|
||||
// requested form wasn't unlocked/isn't a starter form, purging setting
|
||||
starterAttributes.form = undefined;
|
||||
}
|
||||
|
||||
if (starterAttributes.nature !== undefined) {
|
||||
const unlockedNatures = globalScene.gameData.getNaturesForAttr(dexEntry.natureAttr);
|
||||
const unlockedNatures = this.gameData.getNaturesForAttr(dexEntry.natureAttr);
|
||||
if (unlockedNatures.indexOf(starterAttributes.nature as unknown as Nature) < 0) {
|
||||
// requested nature wasn't unlocked, purging setting
|
||||
starterAttributes.nature = undefined;
|
||||
@ -812,7 +818,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
return true;
|
||||
}
|
||||
if (!seenFilter) {
|
||||
const starterDexEntry = globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
|
||||
const starterDexEntry = this.gameData.dexData[this.getStarterSpeciesId(species.speciesId)];
|
||||
return !!starterDexEntry?.caughtAttr;
|
||||
}
|
||||
return false;
|
||||
@ -851,7 +857,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
*/
|
||||
isPassiveAvailable(speciesId: number): boolean {
|
||||
// Get this species ID's starter data
|
||||
const starterData = globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)];
|
||||
const starterData = this.gameData.starterData[this.getStarterSpeciesId(speciesId)];
|
||||
|
||||
return (
|
||||
starterData.candyCount >= getPassiveCandyCount(speciesStarterCosts[this.getStarterSpeciesId(speciesId)])
|
||||
@ -866,7 +872,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
*/
|
||||
isValueReductionAvailable(speciesId: number): boolean {
|
||||
// Get this species ID's starter data
|
||||
const starterData = globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)];
|
||||
const starterData = this.gameData.starterData[this.getStarterSpeciesId(speciesId)];
|
||||
|
||||
return (
|
||||
starterData.candyCount
|
||||
@ -883,7 +889,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
*/
|
||||
isSameSpeciesEggAvailable(speciesId: number): boolean {
|
||||
// Get this species ID's starter data
|
||||
const starterData = globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)];
|
||||
const starterData = this.gameData.starterData[this.getStarterSpeciesId(speciesId)];
|
||||
|
||||
return (
|
||||
starterData.candyCount >= getSameSpeciesEggCandyCounts(speciesStarterCosts[this.getStarterSpeciesId(speciesId)])
|
||||
@ -1372,21 +1378,21 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
const starterId = this.getStarterSpeciesId(species.speciesId);
|
||||
|
||||
const currentDexAttr = this.getCurrentDexProps(species.speciesId);
|
||||
const props = this.getSanitizedProps(globalScene.gameData.getSpeciesDexAttrProps(species, currentDexAttr));
|
||||
const props = this.getSanitizedProps(this.gameData.getSpeciesDexAttrProps(species, currentDexAttr));
|
||||
|
||||
const data: ContainerData = {
|
||||
species,
|
||||
cost: globalScene.gameData.getSpeciesStarterValue(starterId),
|
||||
cost: this.gameData.getSpeciesStarterValue(starterId),
|
||||
props,
|
||||
};
|
||||
|
||||
// First, ensure you have the caught attributes for the species else default to bigint 0
|
||||
// TODO: This might be removed depending on how accessible we want the pokedex function to be
|
||||
const caughtAttr =
|
||||
(globalScene.gameData.dexData[species.speciesId]?.caughtAttr || BigInt(0))
|
||||
& (globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)]?.caughtAttr || BigInt(0))
|
||||
(this.gameData.dexData[species.speciesId]?.caughtAttr || BigInt(0))
|
||||
& (this.gameData.dexData[this.getStarterSpeciesId(species.speciesId)]?.caughtAttr || BigInt(0))
|
||||
& species.getFullUnlocksData();
|
||||
const starterData = globalScene.gameData.starterData[starterId];
|
||||
const starterData = this.gameData.starterData[starterId];
|
||||
const isStarterProgressable = speciesEggMoves.hasOwnProperty(starterId);
|
||||
|
||||
// Name filter
|
||||
@ -1635,7 +1641,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
});
|
||||
|
||||
// Seen Filter
|
||||
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
||||
const dexEntry = this.gameData.dexData[species.speciesId];
|
||||
const isItSeen = this.isSeen(species, dexEntry, true) || !!dexEntry.caughtAttr;
|
||||
const fitsSeen = this.filterBar.getVals(DropDownColumn.MISC).some(misc => {
|
||||
if (misc.val === "SEEN_SPECIES" && misc.state === DropDownState.ON) {
|
||||
@ -1725,33 +1731,31 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
case SortCriteria.COST:
|
||||
return (a.cost - b.cost) * -sort.dir;
|
||||
case SortCriteria.CANDY: {
|
||||
const candyCountA =
|
||||
globalScene.gameData.starterData[this.getStarterSpeciesId(a.species.speciesId)].candyCount;
|
||||
const candyCountB =
|
||||
globalScene.gameData.starterData[this.getStarterSpeciesId(b.species.speciesId)].candyCount;
|
||||
const candyCountA = this.gameData.starterData[this.getStarterSpeciesId(a.species.speciesId)].candyCount;
|
||||
const candyCountB = this.gameData.starterData[this.getStarterSpeciesId(b.species.speciesId)].candyCount;
|
||||
return (candyCountA - candyCountB) * -sort.dir;
|
||||
}
|
||||
case SortCriteria.IV: {
|
||||
const avgIVsA =
|
||||
globalScene.gameData.dexData[a.species.speciesId].ivs.reduce((a, b) => a + b, 0)
|
||||
/ globalScene.gameData.dexData[a.species.speciesId].ivs.length;
|
||||
this.gameData.dexData[a.species.speciesId].ivs.reduce((a, b) => a + b, 0)
|
||||
/ this.gameData.dexData[a.species.speciesId].ivs.length;
|
||||
const avgIVsB =
|
||||
globalScene.gameData.dexData[b.species.speciesId].ivs.reduce((a, b) => a + b, 0)
|
||||
/ globalScene.gameData.dexData[b.species.speciesId].ivs.length;
|
||||
this.gameData.dexData[b.species.speciesId].ivs.reduce((a, b) => a + b, 0)
|
||||
/ this.gameData.dexData[b.species.speciesId].ivs.length;
|
||||
return (avgIVsA - avgIVsB) * -sort.dir;
|
||||
}
|
||||
case SortCriteria.NAME:
|
||||
return a.species.name.localeCompare(b.species.name) * -sort.dir;
|
||||
case SortCriteria.CAUGHT:
|
||||
return (
|
||||
(globalScene.gameData.dexData[a.species.speciesId].caughtCount
|
||||
- globalScene.gameData.dexData[b.species.speciesId].caughtCount)
|
||||
(this.gameData.dexData[a.species.speciesId].caughtCount
|
||||
- this.gameData.dexData[b.species.speciesId].caughtCount)
|
||||
* -sort.dir
|
||||
);
|
||||
case SortCriteria.HATCHED:
|
||||
return (
|
||||
(globalScene.gameData.dexData[this.getStarterSpeciesId(a.species.speciesId)].hatchedCount
|
||||
- globalScene.gameData.dexData[this.getStarterSpeciesId(b.species.speciesId)].hatchedCount)
|
||||
(this.gameData.dexData[this.getStarterSpeciesId(a.species.speciesId)].hatchedCount
|
||||
- this.gameData.dexData[this.getStarterSpeciesId(b.species.speciesId)].hatchedCount)
|
||||
* -sort.dir
|
||||
);
|
||||
default:
|
||||
@ -1795,10 +1799,10 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
container.checkIconId(props.female, props.formIndex, props.shiny, props.variant);
|
||||
|
||||
const speciesId = data.species.speciesId;
|
||||
const dexEntry = globalScene.gameData.dexData[speciesId];
|
||||
const dexEntry = this.gameData.dexData[speciesId];
|
||||
const caughtAttr =
|
||||
dexEntry.caughtAttr
|
||||
& globalScene.gameData.dexData[this.getStarterSpeciesId(speciesId)].caughtAttr
|
||||
& this.gameData.dexData[this.getStarterSpeciesId(speciesId)].caughtAttr
|
||||
& data.species.getFullUnlocksData();
|
||||
|
||||
if (caughtAttr & data.species.getFullUnlocksData() || globalScene.dexForDevs) {
|
||||
@ -1857,13 +1861,13 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
}
|
||||
|
||||
container.starterPassiveBgs.setVisible(
|
||||
!!globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].passiveAttr,
|
||||
!!this.gameData.starterData[this.getStarterSpeciesId(speciesId)].passiveAttr,
|
||||
);
|
||||
container.hiddenAbilityIcon.setVisible(
|
||||
!!caughtAttr && !!(globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].abilityAttr & 4),
|
||||
!!caughtAttr && !!(this.gameData.starterData[this.getStarterSpeciesId(speciesId)].abilityAttr & 4),
|
||||
);
|
||||
container.classicWinIcon.setVisible(
|
||||
globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].classicWinCount > 0,
|
||||
this.gameData.starterData[this.getStarterSpeciesId(speciesId)].classicWinCount > 0,
|
||||
);
|
||||
container.favoriteIcon.setVisible(this.starterPreferences[speciesId]?.favorite ?? false);
|
||||
|
||||
@ -1989,15 +1993,15 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
this.formTrayContainer.setX((goLeft ? boxPos.x - 18 * (this.trayColumns - spaceRight) : boxPos.x) - 3);
|
||||
this.formTrayContainer.setY(goUp ? boxPos.y - this.trayBg.height : boxPos.y + 17);
|
||||
|
||||
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
||||
const dexEntry = this.gameData.dexData[species.speciesId];
|
||||
const dexAttr = this.getCurrentDexProps(species.speciesId);
|
||||
const props = this.getSanitizedProps(globalScene.gameData.getSpeciesDexAttrProps(this.lastSpecies, dexAttr));
|
||||
const props = this.getSanitizedProps(this.gameData.getSpeciesDexAttrProps(this.lastSpecies, dexAttr));
|
||||
|
||||
this.trayContainers = [];
|
||||
const isFormSeen = this.isSeen(species, dexEntry);
|
||||
this.trayForms.map((f, index) => {
|
||||
const isFormCaught = dexEntry
|
||||
? (dexEntry.caughtAttr & species.getFullUnlocksData() & globalScene.gameData.getFormAttr(f.formIndex ?? 0)) > 0n
|
||||
? (dexEntry.caughtAttr & species.getFullUnlocksData() & this.gameData.getFormAttr(f.formIndex ?? 0)) > 0n
|
||||
: false;
|
||||
const formContainer = new PokedexMonContainer(species, {
|
||||
formIndex: f.formIndex,
|
||||
@ -2066,7 +2070,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
}
|
||||
|
||||
getFriendship(speciesId: number) {
|
||||
let currentFriendship = globalScene.gameData.starterData[this.getStarterSpeciesId(speciesId)].friendship;
|
||||
let currentFriendship = this.gameData.starterData[this.getStarterSpeciesId(speciesId)].friendship;
|
||||
if (!currentFriendship || currentFriendship === undefined) {
|
||||
currentFriendship = 0;
|
||||
}
|
||||
@ -2094,7 +2098,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
if (container) {
|
||||
const lastSpeciesIcon = container.icon;
|
||||
const dexAttr = this.getCurrentDexProps(container.species.speciesId);
|
||||
const props = this.getSanitizedProps(globalScene.gameData.getSpeciesDexAttrProps(container.species, dexAttr));
|
||||
const props = this.getSanitizedProps(this.gameData.getSpeciesDexAttrProps(container.species, dexAttr));
|
||||
this.checkIconId(lastSpeciesIcon, container.species, props.female, props.formIndex, props.shiny, props.variant);
|
||||
this.iconAnimHandler.addOrUpdate(lastSpeciesIcon, PokemonIconAnimMode.NONE);
|
||||
// Resume the animation for the previously selected species
|
||||
@ -2103,7 +2107,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
}
|
||||
|
||||
setSpecies(species: PokemonSpecies | null) {
|
||||
this.speciesStarterDexEntry = species ? globalScene.gameData.dexData[species.speciesId] : null;
|
||||
this.speciesStarterDexEntry = species ? this.gameData.dexData[species.speciesId] : null;
|
||||
|
||||
if (!species && globalScene.ui.getTooltip().visible) {
|
||||
globalScene.ui.hideTooltip();
|
||||
@ -2182,15 +2186,15 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
}
|
||||
|
||||
if (species) {
|
||||
const dexEntry = globalScene.gameData.dexData[species.speciesId];
|
||||
const dexEntry = this.gameData.dexData[species.speciesId];
|
||||
const caughtAttr =
|
||||
dexEntry.caughtAttr
|
||||
& globalScene.gameData.dexData[this.getStarterSpeciesId(species.speciesId)].caughtAttr
|
||||
& this.gameData.dexData[this.getStarterSpeciesId(species.speciesId)].caughtAttr
|
||||
& species.getFullUnlocksData();
|
||||
|
||||
if (caughtAttr) {
|
||||
const props = this.getSanitizedProps(
|
||||
globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)),
|
||||
this.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)),
|
||||
);
|
||||
|
||||
if (shiny === undefined) {
|
||||
@ -2207,7 +2211,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
}
|
||||
}
|
||||
|
||||
const isFormCaught = dexEntry ? (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n : false;
|
||||
const isFormCaught = dexEntry ? (caughtAttr & this.gameData.getFormAttr(formIndex ?? 0)) > 0n : false;
|
||||
const isFormSeen = this.isSeen(species, dexEntry);
|
||||
|
||||
const assetLoadCancelled = new BooleanHolder(false);
|
||||
@ -2291,7 +2295,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
updateStarterValueLabel(starter: PokedexMonContainer): void {
|
||||
const speciesId = starter.species.speciesId;
|
||||
const baseStarterValue = speciesStarterCosts[speciesId];
|
||||
const starterValue = globalScene.gameData.getSpeciesStarterValue(this.getStarterSpeciesId(speciesId));
|
||||
const starterValue = this.gameData.getSpeciesStarterValue(this.getStarterSpeciesId(speciesId));
|
||||
starter.cost = starterValue;
|
||||
let valueStr = starterValue.toString();
|
||||
if (valueStr.startsWith("0.")) {
|
||||
@ -2356,8 +2360,8 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
let props = 0n;
|
||||
const species = allSpecies.find(sp => sp.speciesId === speciesId);
|
||||
const caughtAttr =
|
||||
globalScene.gameData.dexData[speciesId].caughtAttr
|
||||
& globalScene.gameData.dexData[this.getStarterSpeciesId(speciesId)].caughtAttr
|
||||
this.gameData.dexData[speciesId].caughtAttr
|
||||
& this.gameData.dexData[this.getStarterSpeciesId(speciesId)].caughtAttr
|
||||
& (species?.getFullUnlocksData() ?? 0n);
|
||||
|
||||
/* this checks the gender of the pokemon; this works by checking a) that the starter preferences for the species exist, and if so, is it female. If so, it'll add DexAttr.FEMALE to our temp props
|
||||
@ -2401,7 +2405,7 @@ export class PokedexUiHandler extends MessageUiHandler {
|
||||
props += BigInt(Math.pow(2, this.starterPreferences[speciesId]?.form)) * DexAttr.DEFAULT_FORM;
|
||||
} else {
|
||||
// Get the first unlocked form
|
||||
props += globalScene.gameData.getFormAttr(globalScene.gameData.getFormIndex(caughtAttr));
|
||||
props += this.gameData.getFormAttr(this.gameData.getFormIndex(caughtAttr));
|
||||
}
|
||||
|
||||
return props;
|
||||
|
Loading…
Reference in New Issue
Block a user