koishi-plugin-warframe 1.5.2 → 1.5.3
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/lib/index.d.ts +4 -0
- package/lib/index.js +26 -20
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -165,6 +165,7 @@ declare interface ClosedStatisticsEntry {
|
|
|
165
165
|
donch_top: number;
|
|
166
166
|
donch_bot: number;
|
|
167
167
|
id: string;
|
|
168
|
+
mod_rank: number;
|
|
168
169
|
}
|
|
169
170
|
declare interface LiveStatisticsEntry {
|
|
170
171
|
datetime: string;
|
|
@@ -177,6 +178,7 @@ declare interface LiveStatisticsEntry {
|
|
|
177
178
|
order_type: "buy" | "sell";
|
|
178
179
|
moving_avg: number;
|
|
179
180
|
id: string;
|
|
181
|
+
mod_rank: number;
|
|
180
182
|
}
|
|
181
183
|
export interface StatisticsCollection {
|
|
182
184
|
statistics_closed: {
|
|
@@ -402,6 +404,7 @@ declare interface ClosedStatisticsEntryDTO {
|
|
|
402
404
|
donch_top: number;
|
|
403
405
|
donch_bot: number;
|
|
404
406
|
id: string;
|
|
407
|
+
mod_rank: number;
|
|
405
408
|
}
|
|
406
409
|
declare interface LiveStatisticsEntryDTO {
|
|
407
410
|
datetime: string;
|
|
@@ -414,6 +417,7 @@ declare interface LiveStatisticsEntryDTO {
|
|
|
414
417
|
order_type: "buy" | "sell";
|
|
415
418
|
moving_avg: number;
|
|
416
419
|
id: string;
|
|
420
|
+
mod_rank: number;
|
|
417
421
|
}
|
|
418
422
|
export interface StatisticsCollectionDTO {
|
|
419
423
|
statistics_closed: {
|
package/lib/index.js
CHANGED
|
@@ -17843,30 +17843,36 @@ var primedModHistory = createAsyncCache(async () => {
|
|
|
17843
17843
|
});
|
|
17844
17844
|
const result = [];
|
|
17845
17845
|
const { globalItemDict, globalItemNameToSlugDict } = await globalItemData.get();
|
|
17846
|
-
|
|
17847
|
-
|
|
17846
|
+
const minInterval = 500;
|
|
17847
|
+
let lastRequestTime = 0;
|
|
17848
|
+
for (const mod of primeModHistory) {
|
|
17848
17849
|
const name2 = normalizeName(mod.Name);
|
|
17849
17850
|
const slug = globalItemNameToSlugDict[name2];
|
|
17850
|
-
if (slug) {
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
|
|
17861
|
-
|
|
17862
|
-
|
|
17863
|
-
|
|
17864
|
-
|
|
17865
|
-
|
|
17866
|
-
|
|
17851
|
+
if (!slug) {
|
|
17852
|
+
result.push({ name: mod.Name, last: mod.Last });
|
|
17853
|
+
continue;
|
|
17854
|
+
}
|
|
17855
|
+
const item = globalItemDict[slug];
|
|
17856
|
+
const elapsed = Date.now() - lastRequestTime;
|
|
17857
|
+
if (elapsed < minInterval) {
|
|
17858
|
+
await sleep(minInterval - elapsed);
|
|
17859
|
+
}
|
|
17860
|
+
const data = await getWFMItemStatistics(slug);
|
|
17861
|
+
lastRequestTime = Date.now();
|
|
17862
|
+
if (data) {
|
|
17863
|
+
const zeroRankList = data.statistics_closed["90days"].filter(
|
|
17864
|
+
(e) => e.mod_rank === 0
|
|
17865
|
+
);
|
|
17866
|
+
const lastThree = zeroRankList.slice(-3);
|
|
17867
|
+
const avg = lastThree.length > 0 ? Math.round(lastThree.reduce((acc, e) => acc + e.median, 0) / lastThree.length * 10) / 10 : void 0;
|
|
17868
|
+
result.push({
|
|
17869
|
+
name: item.i18n["zh-hans"]?.name,
|
|
17870
|
+
last: mod.Last,
|
|
17871
|
+
plats: avg
|
|
17872
|
+
});
|
|
17867
17873
|
} else {
|
|
17868
17874
|
result.push({
|
|
17869
|
-
name:
|
|
17875
|
+
name: item.i18n["zh-hans"]?.name,
|
|
17870
17876
|
last: mod.Last
|
|
17871
17877
|
});
|
|
17872
17878
|
}
|