Skip to content

Commit

Permalink
feat: bread mode uicons support
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Sep 13, 2024
1 parent 3c53db3 commit 4c5dfcc
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
"source-map": "^0.7.4",
"suncalc": "^1.9.0",
"supercluster": "^8.0.1",
"uicons.js": "1.4.1",
"uicons.js": "2.0.0",
"zustand": "4.4.6"
},
"devDependencies": {
Expand Down
16 changes: 13 additions & 3 deletions src/features/search/OptionImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,23 @@ function FortImage({ url }) {
)
}

/** @param {Partial<import('@rm/types').Pokemon>} props */
function PokemonImage({ pokemon_id, form, gender, costume, shiny }) {
/** @param {Partial<import('@rm/types').Pokemon> & { bread?: number }} props */
function PokemonImage({ pokemon_id, form, gender, costume, shiny, bread }) {
const { Icons } = useMemory.getState()
const { t } = useTranslateById()
return (
<NameTT title={[form ? `form_${form}` : '', `poke_${pokemon_id}`]}>
<Img
src={Icons.getPokemon(pokemon_id, form, 0, gender, costume, 0, shiny)}
src={Icons.getPokemon(
pokemon_id,
form,
0,
gender,
costume,
0,
shiny,
bread,
)}
alt={t(`${pokemon_id}-${form}`)}
maxHeight={45}
maxWidth={45}
Expand Down Expand Up @@ -191,6 +200,7 @@ function OptionImage(props) {
form={props.battle_pokemon_form}
gender={props.battle_pokemon_gender}
costume={props.battle_pokemon_costume}
bread={1}
/>
)
return <Misc />
Expand Down
5 changes: 5 additions & 0 deletions src/features/station/StationPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ function StationMedia({
battle_pokemon_gender,
battle_pokemon_costume,
battle_pokemon_alignment,
false,
1,
),
)
const stationImage = useMemory((s) => s.Icons.getStation(true))
Expand Down Expand Up @@ -338,6 +340,9 @@ function StationMons({ id }) {
0,
mon.gender,
mon.costume,
0,
false,
mon.bread_mode,
)}
alt={caption}
maxHeight="100%"
Expand Down
2 changes: 2 additions & 0 deletions src/features/station/useStationMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export function useStationMarker({
battle_pokemon_gender,
battle_pokemon_costume,
battle_pokemon_alignment,
false,
1,
),
Icons.getSize(
'dynamax',
Expand Down
21 changes: 15 additions & 6 deletions src/services/Assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export class UAssets {
* @param {string | number} [costume]
* @param {string | number} [alignment]
* @param {boolean} [shiny]
* @param {string | number} [bread]
* @returns {string}
*/
getPokemon(
Expand All @@ -333,15 +334,17 @@ export class UAssets {
costume = 0,
alignment = 0,
shiny = false,
bread = 0,
) {
try {
return this[this.selected.pokemon]?.class?.pokemon(
pokemonId,
form,
evolution,
gender,
form,
costume,
gender,
alignment,
bread,
shiny,
)
} catch (e) {
Expand Down Expand Up @@ -384,11 +387,10 @@ export class UAssets {
try {
return this[this.selected.pokestop]?.class?.pokestop(
lureId,
power,
display,
invasionActive,
display || !!invasionActive,
questActive,
ar,
power,
)
} catch (e) {
console.error(`[${this.assetType.toUpperCase()}]`, e)
Expand Down Expand Up @@ -435,6 +437,7 @@ export class UAssets {
* @param {boolean} [inBattle]
* @param {boolean} [ex]
* @param {boolean} [ar]
* @param {string | number | boolean} [power]
* @returns
*/
getGyms(
Expand All @@ -443,6 +446,7 @@ export class UAssets {
inBattle = false,
ex = false,
ar = false,
power = false,
) {
try {
return this[this.selected.gym]?.class?.gym(
Expand All @@ -451,6 +455,7 @@ export class UAssets {
inBattle,
ex,
ar,
power,
)
} catch (e) {
console.error(`[${this.assetType.toUpperCase()}]`, e)
Expand Down Expand Up @@ -496,7 +501,11 @@ export class UAssets {
*/
getWeather(weatherId, timeOfDay = 'day') {
try {
return this[this.selected.weather]?.class?.weather(weatherId, timeOfDay)
return this[this.selected.weather]?.class?.weather(
weatherId,
0,
timeOfDay,
)
} catch (e) {
console.error(`[${this.assetType.toUpperCase()}]`, e)
return `${this.fallback}/weather/0.${this.fallbackExt}`
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9560,10 +9560,10 @@ uglify-js@^3.1.4:
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c"
integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==

uicons.js@1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/uicons.js/-/uicons.js-1.4.1.tgz#210153422062a0f919579548c7209772c218cf35"
integrity sha512-ntjiPZj4JZGDHrEZ44OWXjtTWlgHwRIRDQn1Y0lcSuCcXeDYB23C5s0wexrlreg6XvRiozA3S4DfoSUYEnkd3A==
uicons.js@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/uicons.js/-/uicons.js-2.0.0.tgz#54d97d24bc998f4547d5a2270af8fb7cda3a762c"
integrity sha512-OCguuXPU4NpRDwfLbqXAZfDYjkKdERbcALmVqubmHTG4exqOX1iN9Ur9DvlcfXTrwBTm6bCffHBqcMHeIpTgeg==

uid-safe@~2.1.5:
version "2.1.5"
Expand Down

0 comments on commit 4c5dfcc

Please sign in to comment.