Skip to content

Commit d27f76d

Browse files
authored
Merge pull request #9 from TurtIeSocks/2.0-fixes
2.0 Changes - including `_b` flag for pokemon bread forms
2 parents 6449eeb + d7e9841 commit d27f76d

File tree

4 files changed

+126
-85
lines changed

4 files changed

+126
-85
lines changed

README.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,36 @@ const indexJson = await fetch('https://www.uicons-repo.com/index.json').then(
4141
uicons.init(indexJson)
4242

4343
// Below are some example usages with variable names for demonstration, see intellisense in your IDE for type information
44+
// Please note that in some cases, such as with Stardust, the `reward_id` is the `amount` of the reward
45+
const device = uicons.device(online)
46+
const gym = uicons.gym(team_id, trainer_count, in_battle, ex, ar, power_level)
47+
const invasion = uicons.invasion(grunt_id, confirmed)
48+
const misc = uicons.misc(filename_without_extension)
49+
const nest = uicons.nest(type_id)
4450
const pokemon = uicons.pokemon(
4551
pokemon_id,
46-
form_id,
4752
evolution_id,
48-
gender_id,
53+
form_id,
4954
costume_id,
55+
gender_id,
5056
alignment_id,
57+
bread_id,
5158
shiny
5259
)
53-
const type = uicons.type(type_id)
5460
const pokestop = uicons.pokestop(
5561
lure_id,
56-
power,
5762
display,
58-
invasion_active,
5963
quest_active,
6064
ar
65+
power,
6166
)
62-
// Please note that in some cases, such as with Stardust, the `reward_id` is the `amount` of the reward
67+
const egg = uicons.raidEgg(raid_level, hatched, ex)
6368
const reward = uicons.reward(reward_type_id, reward_id, amount)
64-
const invasion = uicons.invasion(grunt_id, confirmed)
65-
const gym = uicons.gym(team_id, trainer_count, in_battle, ex, ar)
66-
const egg = uicons.egg(raid_level, hatched, ex)
67-
const team = uicons.team(team_id)
68-
const weather = uicons.weather(weather_id)
69-
const nest = uicons.nest(type_id)
70-
const misc = uicons.misc(filename_without_extension)
71-
const device = uicons.device(online)
69+
const rewardWithOutId = uicons.reward(reward_type_id, amount)
7270
const spawnpoint = uicons.spawnpoint(has_known_tth)
71+
const team = uicons.team(team_id)
72+
const type = uicons.type(type_id)
73+
const weather = uicons.weather(weather_id, severity, 'day')
7374
```
7475

7576
## Development

example/utils.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export async function getMonsFromMf(
4141
if (evo) title += `_${evo}`
4242
return {
4343
title,
44-
src: newUicons.pokemon(id, form, evo),
45-
cry: newUaudio.pokemon(id, form, evo),
44+
src: newUicons.pokemon(id, evo, form),
45+
cry: newUaudio.pokemon(id, evo, form),
4646
}
4747
})
4848
}
@@ -79,11 +79,21 @@ export async function getMonsFromIndex(
7979
const evo = parseArgs(rest, '_e') ?? 0
8080
const gender = parseArgs(rest, '_g') ?? 0
8181
const alignment = parseArgs(rest, '_a') ?? 0
82-
const shiny = !!parseArgs(rest, '_s')
82+
const bread = parseArgs(rest, '_b') ?? 0
83+
const shiny = !!parseArgs(rest, '_s') ?? false
8384
return {
8485
title,
8586
src: `${icon.path}/pokemon/${file}`,
86-
cry: newUaudio.pokemon(id, form, evo, gender, 0, alignment, shiny),
87+
cry: newUaudio.pokemon(
88+
id,
89+
evo,
90+
form,
91+
0,
92+
gender,
93+
alignment,
94+
bread,
95+
shiny
96+
),
8797
}
8898
}) || []
8999
)

src/uicons.test.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,14 @@ describe('pokemon', () => {
8989
expect(icons.pokemon('1')).toBe(`${BASE_ICON_URL}/pokemon/1.webp`)
9090
})
9191
test('charmander form', () => {
92-
expect(icons.pokemon(4, 896)).toBe(`${BASE_ICON_URL}/pokemon/4_f896.webp`)
92+
expect(icons.pokemon(4, 0, 896)).toBe(
93+
`${BASE_ICON_URL}/pokemon/4_f896.webp`
94+
)
9395
})
9496
test('mega blastoise', () => {
9597
expect(
9698
icons.pokemon(
9799
Rpc.HoloPokemonId.BLASTOISE,
98-
Rpc.PokemonDisplayProto.Form.FORM_UNSET,
99100
Rpc.HoloTemporaryEvolutionId.TEMP_EVOLUTION_MEGA
100101
)
101102
).toBe(`${BASE_ICON_URL}/pokemon/9_e1.webp`)
@@ -107,17 +108,15 @@ describe('pokestops', () => {
107108
expect(icons.pokestop(501)).toBe(`${BASE_ICON_URL}/pokestop/501.webp`)
108109
})
109110
test('invasion', () => {
110-
expect(icons.pokestop(0, 0, 0, true)).toBe(
111-
`${BASE_ICON_URL}/pokestop/0_i.webp`
112-
)
111+
expect(icons.pokestop(0, 0)).toBe(`${BASE_ICON_URL}/pokestop/0_i.webp`)
113112
})
114113
test('quest', () => {
115-
expect(icons.pokestop(0, 0, 0, false, true)).toBe(
114+
expect(icons.pokestop(0, false, 0)).toBe(
116115
`${BASE_ICON_URL}/pokestop/0_q.webp`
117116
)
118117
})
119118
test('ar', () => {
120-
expect(icons.pokestop(504, 0, 0, true, false, true)).toBe(
119+
expect(icons.pokestop(504, 0, false, true)).toBe(
121120
`${BASE_ICON_URL}/pokestop/504_i_ar.webp`
122121
)
123122
})
@@ -228,11 +227,11 @@ describe('weather', () => {
228227
expect(icons.weather(2)).toBe(`${BASE_ICON_URL}/weather/2.webp`)
229228
})
230229
test('with day', () => {
231-
expect(icons.weather(3, 'day')).toBe(`${BASE_ICON_URL}/weather/3_d.webp`)
230+
expect(icons.weather(3, 0, 'day')).toBe(`${BASE_ICON_URL}/weather/3_d.webp`)
232231
})
233232
test('with night', () => {
234233
expect(
235-
icons.weather(Rpc.GameplayWeatherProto.WeatherCondition.CLEAR, 'night')
234+
icons.weather(Rpc.GameplayWeatherProto.WeatherCondition.CLEAR, 0, 'night')
236235
).toBe(`${BASE_ICON_URL}/weather/1_n.webp`)
237236
})
238237
})

0 commit comments

Comments
 (0)