Skip to content

Commit

Permalink
Merge pull request #9 from TurtIeSocks/2.0-fixes
Browse files Browse the repository at this point in the history
2.0 Changes - including `_b` flag for pokemon bread forms
  • Loading branch information
TurtIeSocks authored Sep 13, 2024
2 parents 6449eeb + d7e9841 commit d27f76d
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 85 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,36 @@ const indexJson = await fetch('https://www.uicons-repo.com/index.json').then(
uicons.init(indexJson)

// Below are some example usages with variable names for demonstration, see intellisense in your IDE for type information
// Please note that in some cases, such as with Stardust, the `reward_id` is the `amount` of the reward
const device = uicons.device(online)
const gym = uicons.gym(team_id, trainer_count, in_battle, ex, ar, power_level)
const invasion = uicons.invasion(grunt_id, confirmed)
const misc = uicons.misc(filename_without_extension)
const nest = uicons.nest(type_id)
const pokemon = uicons.pokemon(
pokemon_id,
form_id,
evolution_id,
gender_id,
form_id,
costume_id,
gender_id,
alignment_id,
bread_id,
shiny
)
const type = uicons.type(type_id)
const pokestop = uicons.pokestop(
lure_id,
power,
display,
invasion_active,
quest_active,
ar
power,
)
// Please note that in some cases, such as with Stardust, the `reward_id` is the `amount` of the reward
const egg = uicons.raidEgg(raid_level, hatched, ex)
const reward = uicons.reward(reward_type_id, reward_id, amount)
const invasion = uicons.invasion(grunt_id, confirmed)
const gym = uicons.gym(team_id, trainer_count, in_battle, ex, ar)
const egg = uicons.egg(raid_level, hatched, ex)
const team = uicons.team(team_id)
const weather = uicons.weather(weather_id)
const nest = uicons.nest(type_id)
const misc = uicons.misc(filename_without_extension)
const device = uicons.device(online)
const rewardWithOutId = uicons.reward(reward_type_id, amount)
const spawnpoint = uicons.spawnpoint(has_known_tth)
const team = uicons.team(team_id)
const type = uicons.type(type_id)
const weather = uicons.weather(weather_id, severity, 'day')
```

## Development
Expand Down
18 changes: 14 additions & 4 deletions example/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export async function getMonsFromMf(
if (evo) title += `_${evo}`
return {
title,
src: newUicons.pokemon(id, form, evo),
cry: newUaudio.pokemon(id, form, evo),
src: newUicons.pokemon(id, evo, form),
cry: newUaudio.pokemon(id, evo, form),
}
})
}
Expand Down Expand Up @@ -79,11 +79,21 @@ export async function getMonsFromIndex(
const evo = parseArgs(rest, '_e') ?? 0
const gender = parseArgs(rest, '_g') ?? 0
const alignment = parseArgs(rest, '_a') ?? 0
const shiny = !!parseArgs(rest, '_s')
const bread = parseArgs(rest, '_b') ?? 0
const shiny = !!parseArgs(rest, '_s') ?? false
return {
title,
src: `${icon.path}/pokemon/${file}`,
cry: newUaudio.pokemon(id, form, evo, gender, 0, alignment, shiny),
cry: newUaudio.pokemon(
id,
evo,
form,
0,
gender,
alignment,
bread,
shiny
),
}
}) || []
)
Expand Down
17 changes: 8 additions & 9 deletions src/uicons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ describe('pokemon', () => {
expect(icons.pokemon('1')).toBe(`${BASE_ICON_URL}/pokemon/1.webp`)
})
test('charmander form', () => {
expect(icons.pokemon(4, 896)).toBe(`${BASE_ICON_URL}/pokemon/4_f896.webp`)
expect(icons.pokemon(4, 0, 896)).toBe(
`${BASE_ICON_URL}/pokemon/4_f896.webp`
)
})
test('mega blastoise', () => {
expect(
icons.pokemon(
Rpc.HoloPokemonId.BLASTOISE,
Rpc.PokemonDisplayProto.Form.FORM_UNSET,
Rpc.HoloTemporaryEvolutionId.TEMP_EVOLUTION_MEGA
)
).toBe(`${BASE_ICON_URL}/pokemon/9_e1.webp`)
Expand All @@ -107,17 +108,15 @@ describe('pokestops', () => {
expect(icons.pokestop(501)).toBe(`${BASE_ICON_URL}/pokestop/501.webp`)
})
test('invasion', () => {
expect(icons.pokestop(0, 0, 0, true)).toBe(
`${BASE_ICON_URL}/pokestop/0_i.webp`
)
expect(icons.pokestop(0, 0)).toBe(`${BASE_ICON_URL}/pokestop/0_i.webp`)
})
test('quest', () => {
expect(icons.pokestop(0, 0, 0, false, true)).toBe(
expect(icons.pokestop(0, false, 0)).toBe(
`${BASE_ICON_URL}/pokestop/0_q.webp`
)
})
test('ar', () => {
expect(icons.pokestop(504, 0, 0, true, false, true)).toBe(
expect(icons.pokestop(504, 0, false, true)).toBe(
`${BASE_ICON_URL}/pokestop/504_i_ar.webp`
)
})
Expand Down Expand Up @@ -228,11 +227,11 @@ describe('weather', () => {
expect(icons.weather(2)).toBe(`${BASE_ICON_URL}/weather/2.webp`)
})
test('with day', () => {
expect(icons.weather(3, 'day')).toBe(`${BASE_ICON_URL}/weather/3_d.webp`)
expect(icons.weather(3, 0, 'day')).toBe(`${BASE_ICON_URL}/weather/3_d.webp`)
})
test('with night', () => {
expect(
icons.weather(Rpc.GameplayWeatherProto.WeatherCondition.CLEAR, 'night')
icons.weather(Rpc.GameplayWeatherProto.WeatherCondition.CLEAR, 0, 'night')
).toBe(`${BASE_ICON_URL}/weather/1_n.webp`)
})
})
Loading

0 comments on commit d27f76d

Please sign in to comment.