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.js
CHANGED
|
@@ -4874,6 +4874,26 @@ function getMapImageUrl(map, resolution, options) {
|
|
|
4874
4874
|
function getSpawnsByMap(mapId) {
|
|
4875
4875
|
return spawns_default.filter((s) => s.mapId === mapId);
|
|
4876
4876
|
}
|
|
4877
|
+
function parseGameClockToSeconds(clock) {
|
|
4878
|
+
const parts = String(clock).trim().split(":");
|
|
4879
|
+
const m = parseInt(parts[0], 10) || 0;
|
|
4880
|
+
const s = parseInt(parts[1], 10) || 0;
|
|
4881
|
+
return m * 60 + s;
|
|
4882
|
+
}
|
|
4883
|
+
function isSpawnVisibleAtGameClock(spawn, gameClockSeconds) {
|
|
4884
|
+
const spawnSec = parseGameClockToSeconds(spawn.spawnTime);
|
|
4885
|
+
if (gameClockSeconds > spawnSec) return false;
|
|
4886
|
+
if (spawn.despawnTime != null && spawn.despawnTime !== "") {
|
|
4887
|
+
const despawnSec = parseGameClockToSeconds(spawn.despawnTime);
|
|
4888
|
+
if (gameClockSeconds <= despawnSec) return false;
|
|
4889
|
+
}
|
|
4890
|
+
return true;
|
|
4891
|
+
}
|
|
4892
|
+
function getSpawnsByMapVisibleAt(mapId, gameClockSeconds) {
|
|
4893
|
+
return getSpawnsByMap(mapId).filter(
|
|
4894
|
+
(s) => isSpawnVisibleAtGameClock(s, gameClockSeconds)
|
|
4895
|
+
);
|
|
4896
|
+
}
|
|
4877
4897
|
function getNeutralById(id) {
|
|
4878
4898
|
return neutrals_default.find((n) => n.id === id);
|
|
4879
4899
|
}
|
|
@@ -5584,9 +5604,12 @@ export {
|
|
|
5584
5604
|
getSpawnInfo,
|
|
5585
5605
|
getSpawnInfoForSpawn,
|
|
5586
5606
|
getSpawnsByMap,
|
|
5607
|
+
getSpawnsByMapVisibleAt,
|
|
5608
|
+
isSpawnVisibleAtGameClock,
|
|
5587
5609
|
maps_default as maps,
|
|
5588
5610
|
moves_default as moves,
|
|
5589
5611
|
neutrals_default as neutrals,
|
|
5612
|
+
parseGameClockToSeconds,
|
|
5590
5613
|
pokemons_default as pokemons,
|
|
5591
5614
|
spawns_default as spawns
|
|
5592
5615
|
};
|