unite-lib 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +26 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.global.js +23 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/moves/ho-oh_s11.png +0 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -40,9 +40,12 @@ __export(src_exports, {
|
|
|
40
40
|
getSpawnInfo: () => getSpawnInfo,
|
|
41
41
|
getSpawnInfoForSpawn: () => getSpawnInfoForSpawn,
|
|
42
42
|
getSpawnsByMap: () => getSpawnsByMap,
|
|
43
|
+
getSpawnsByMapVisibleAt: () => getSpawnsByMapVisibleAt,
|
|
44
|
+
isSpawnVisibleAtGameClock: () => isSpawnVisibleAtGameClock,
|
|
43
45
|
maps: () => maps_default,
|
|
44
46
|
moves: () => moves_default,
|
|
45
47
|
neutrals: () => neutrals_default,
|
|
48
|
+
parseGameClockToSeconds: () => parseGameClockToSeconds,
|
|
46
49
|
pokemons: () => pokemons_default,
|
|
47
50
|
spawns: () => spawns_default
|
|
48
51
|
});
|
|
@@ -4924,6 +4927,26 @@ function getMapImageUrl(map, resolution, options) {
|
|
|
4924
4927
|
function getSpawnsByMap(mapId) {
|
|
4925
4928
|
return spawns_default.filter((s) => s.mapId === mapId);
|
|
4926
4929
|
}
|
|
4930
|
+
function parseGameClockToSeconds(clock) {
|
|
4931
|
+
const parts = String(clock).trim().split(":");
|
|
4932
|
+
const m = parseInt(parts[0], 10) || 0;
|
|
4933
|
+
const s = parseInt(parts[1], 10) || 0;
|
|
4934
|
+
return m * 60 + s;
|
|
4935
|
+
}
|
|
4936
|
+
function isSpawnVisibleAtGameClock(spawn, gameClockSeconds) {
|
|
4937
|
+
const spawnSec = parseGameClockToSeconds(spawn.spawnTime);
|
|
4938
|
+
if (gameClockSeconds > spawnSec) return false;
|
|
4939
|
+
if (spawn.despawnTime != null && spawn.despawnTime !== "") {
|
|
4940
|
+
const despawnSec = parseGameClockToSeconds(spawn.despawnTime);
|
|
4941
|
+
if (gameClockSeconds <= despawnSec) return false;
|
|
4942
|
+
}
|
|
4943
|
+
return true;
|
|
4944
|
+
}
|
|
4945
|
+
function getSpawnsByMapVisibleAt(mapId, gameClockSeconds) {
|
|
4946
|
+
return getSpawnsByMap(mapId).filter(
|
|
4947
|
+
(s) => isSpawnVisibleAtGameClock(s, gameClockSeconds)
|
|
4948
|
+
);
|
|
4949
|
+
}
|
|
4927
4950
|
function getNeutralById(id) {
|
|
4928
4951
|
return neutrals_default.find((n) => n.id === id);
|
|
4929
4952
|
}
|
|
@@ -5635,9 +5658,12 @@ function getSpawnInfoForSpawn(spawn, locale = "en") {
|
|
|
5635
5658
|
getSpawnInfo,
|
|
5636
5659
|
getSpawnInfoForSpawn,
|
|
5637
5660
|
getSpawnsByMap,
|
|
5661
|
+
getSpawnsByMapVisibleAt,
|
|
5662
|
+
isSpawnVisibleAtGameClock,
|
|
5638
5663
|
maps,
|
|
5639
5664
|
moves,
|
|
5640
5665
|
neutrals,
|
|
5666
|
+
parseGameClockToSeconds,
|
|
5641
5667
|
pokemons,
|
|
5642
5668
|
spawns
|
|
5643
5669
|
});
|