koishi-plugin-rocom 1.0.19 → 1.0.24
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/atlas-service.js +1 -1
- package/lib/client.d.ts +10 -0
- package/lib/client.js +44 -8
- package/lib/commands/egg.js +1 -1
- package/lib/commands/merchant.d.ts +105 -0
- package/lib/commands/merchant.js +474 -54
- package/lib/commands/query.d.ts +18 -0
- package/lib/commands/query.js +446 -37
- package/lib/commands/share-code.js +47 -2
- package/lib/commands/tools.js +1 -1
- package/lib/commands/wiki.js +1 -1
- package/lib/egg-service.js +1 -1
- package/lib/element-colors.d.ts +3 -0
- package/lib/element-colors.js +34 -0
- package/lib/icon-metrics.d.ts +32 -0
- package/lib/icon-metrics.js +255 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +11857 -188
- package/lib/merchant-catalog.d.ts +47 -0
- package/lib/merchant-catalog.js +193 -0
- package/lib/merchant-price-log.d.ts +63 -0
- package/lib/merchant-price-log.js +187 -0
- package/lib/merchant-service.d.ts +17 -3
- package/lib/merchant-service.js +79 -11
- package/lib/pet-data-service.d.ts +13 -0
- package/lib/pet-data-service.js +111 -2
- package/lib/player-service.js +2 -2
- package/lib/ranking-service.js +1 -1
- package/lib/render-templates/home/style.css +15 -14
- package/lib/render-templates/home-pets/index.html +80 -0
- package/lib/render-templates/home-pets/style.css +338 -0
- package/lib/render-templates/pet-detail-classic/index.html +151 -0
- package/lib/render-templates/pet-detail-classic/style.css +503 -0
- package/lib/render-templates/pet-detail-classic/texture2D/a_title.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/bg.jpg +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/footer.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/icon.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/img_head.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/jinhua_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/level_icon.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/line.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/mask_bar.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/pet_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/pet_rocom.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/pet_rocom_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/poro_bar.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/right_jinhua.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/skill_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/skill_mask.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star_1.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star_8.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/star_9.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/table.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/tags.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/title.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/top_bg.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/xuancai_overlay.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/yise_overlay.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D/ys_bar.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/10.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/11.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/12.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/13.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/14.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/15.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/16.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/17.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/18.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/19.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/2.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/20.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/23.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/3.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/4.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/5.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/6.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/8.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247/9.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/205/211.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/206/260.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/234/260.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/271/273.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//345/271/275.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/201/266.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/227/240.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/231/256/351/200/232.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/234/272/346/242/260.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/255/246.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/257/222.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//346/260/264.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//347/201/253.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//347/224/265.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//347/277/274.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//350/215/211.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//350/220/214.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//350/231/253.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//345/261/236/346/200/247//351/276/231.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/1.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/10.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/11.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/12.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/13.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/14.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/15.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/16.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/17.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/18.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/19.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/2.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/21.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/23.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/24.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/3.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/4.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/5.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/6.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/7.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/8.png +0 -0
- package/lib/render-templates/pet-detail-classic/texture2D//350/241/200/350/204/211/9.png +0 -0
- package/lib/render-templates/share-code-classic/assets/eit-logo.png +0 -0
- package/lib/render-templates/share-code-classic/assets/img_xingxingdi.png +0 -0
- package/lib/render-templates/share-code-classic/assets/roco_icon.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/255/227/344/275/223/Rocofontblack-Regular .ttf +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/205/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/206/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/234/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/271/273.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//345/271/275.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/201/266.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/227/240.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/231/256/351/200/232.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/234/272/346/242/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/255/246.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/257/222.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//346/260/264.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//347/201/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//347/224/265.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//347/277/274.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//350/215/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//350/220/214.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//350/231/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//345/256/240/347/211/251/345/261/236/346/200/247//351/276/231.png +0 -0
- package/lib/render-templates/share-code-classic/assets//347/201/253/346/274/206/345/215/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//347/253/213/347/273/230/350/203/214/346/231/257/346/241/206.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/205/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/206/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/234/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/245/207/345/274/202.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/271/273.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//345/271/275.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/201/266.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/231/256/351/200/232.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/234/272/346/242/260.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/255/246.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/257/222.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/260/264.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//346/261/241/346/237/223.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//347/201/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//347/224/265.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//347/277/274.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//350/215/211.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//350/220/214.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//350/231/253.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//351/246/226/351/242/206.png +0 -0
- package/lib/render-templates/share-code-classic/assets//350/241/200/350/204/211//351/276/231.png +0 -0
- package/lib/render-templates/share-code-classic/index.html +119 -0
- package/lib/render-templates/share-code-classic/style.css +646 -0
- package/lib/render-templates/yuanxing-shangren/merchant.html +479 -461
- package/lib/render-templates/yuanxing-shangren/today.html +407 -461
- package/lib/render.d.ts +3 -0
- package/lib/render.js +19 -3
- package/lib/send-image.js +10 -0
- package/lib/share-code-service.d.ts +36 -0
- package/lib/share-code-service.js +73 -0
- package/lib/ttf/rocom_origin.ttf +0 -0
- package/lib/types.d.ts +9 -1
- package/lib/user.d.ts +6 -0
- package/lib/wiki-catalog.js +1 -1
- package/lib/wiki-service.js +1 -1
- package/package.json +2 -1
- package/readme.md +3 -23
- package/lib/ttf/rocom_skill_origin.ttf +0 -0
package/lib/atlas-service.js
CHANGED
|
@@ -149,7 +149,7 @@ class AtlasService {
|
|
|
149
149
|
}
|
|
150
150
|
return text;
|
|
151
151
|
}
|
|
152
|
-
//
|
|
152
|
+
// 解析简单结构的 pets.yaml:`正式名:` + 缩进 `- 别名` 列表。
|
|
153
153
|
loadPetAliases() {
|
|
154
154
|
const filePath = this.aliasPath();
|
|
155
155
|
if (!node_fs_1.default.existsSync(filePath))
|
package/lib/client.d.ts
CHANGED
|
@@ -88,6 +88,10 @@ export declare class RocomClient {
|
|
|
88
88
|
getMerchantInfo(ctx: Context, refresh?: boolean, options?: IngameTaskPollOptions & {
|
|
89
89
|
auth?: IngameAuthContext;
|
|
90
90
|
}): Promise<any>;
|
|
91
|
+
getLegacyMerchantInfo(ctx: Context, refresh?: boolean, options?: {
|
|
92
|
+
signal?: AbortSignal;
|
|
93
|
+
auth?: IngameAuthContext;
|
|
94
|
+
}): Promise<any>;
|
|
91
95
|
queryPetSize(ctx: Context, diameter: number, weight: number, pool?: string, pageNo?: number, pageSize?: number, userIdentifier?: string): Promise<any>;
|
|
92
96
|
searchEggBySize(ctx: Context, heightMeters: number, weightKg: number, pageNo?: number, pageSize?: number, userIdentifier?: string): Promise<any>;
|
|
93
97
|
getPetCollectionRanking(ctx: Context, rankType: 'shining' | 'glass', limit?: number, uid?: string, options?: {
|
|
@@ -133,6 +137,12 @@ export declare class RocomClient {
|
|
|
133
137
|
ingameMerchantInfo(ctx: Context, shopId?: string | number | null, options?: IngameTaskPollOptions & {
|
|
134
138
|
auth?: IngameAuthContext;
|
|
135
139
|
}): Promise<any>;
|
|
140
|
+
ingameHomeEggs(ctx: Context, uid: string, options?: IngameTaskPollOptions & {
|
|
141
|
+
auth?: IngameAuthContext;
|
|
142
|
+
}): Promise<any>;
|
|
143
|
+
ingameHomePetData(ctx: Context, uid: string, options?: IngameTaskPollOptions & {
|
|
144
|
+
auth?: IngameAuthContext;
|
|
145
|
+
}): Promise<any>;
|
|
136
146
|
ingamePetData(ctx: Context, uid: string, extras?: {
|
|
137
147
|
petGid?: string | number;
|
|
138
148
|
npcId?: string | number;
|
package/lib/client.js
CHANGED
|
@@ -11,7 +11,7 @@ const INGAME_FAILED_STATUSES = ['failed', 'error', 'timeout', 'cancelled', 'canc
|
|
|
11
11
|
const INGAME_COMPLETED_STATUSES = ['done', 'success', 'succeeded', 'completed', 'finished'];
|
|
12
12
|
const isObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
13
13
|
exports.isObject = isObject;
|
|
14
|
-
// 每剥离一层 envelope 时继承 goods_mapping
|
|
14
|
+
// 每剥离一层 envelope 时继承 goods_mapping,避免只改商品渲染后拿不到名称/图标。
|
|
15
15
|
function inheritGoodsMapping(parent, child) {
|
|
16
16
|
const mapping = child._goods_mapping ?? child.goods_mapping
|
|
17
17
|
?? parent._goods_mapping ?? parent.goods_mapping;
|
|
@@ -624,7 +624,7 @@ class RocomClient {
|
|
|
624
624
|
stillQueued: (taskId) => `玩家搜索任务仍在排队,请稍后重试(task_id: ${taskId})`,
|
|
625
625
|
});
|
|
626
626
|
}
|
|
627
|
-
//
|
|
627
|
+
// 玩家名片:需要补充收集数/名片图时按需查询。
|
|
628
628
|
async ingamePlayerCard(ctx, uid, options = {}) {
|
|
629
629
|
const sanitizedUid = this.sanitizeUid(uid);
|
|
630
630
|
if (!sanitizedUid && !options.auth?.fwToken) {
|
|
@@ -667,6 +667,10 @@ class RocomClient {
|
|
|
667
667
|
}
|
|
668
668
|
if (options.signal?.aborted)
|
|
669
669
|
return null;
|
|
670
|
+
return this.getLegacyMerchantInfo(ctx, refresh, options);
|
|
671
|
+
}
|
|
672
|
+
// 旧版 merchant/info 直取(商品目录 / 实时接口不可用时的回退)。
|
|
673
|
+
async getLegacyMerchantInfo(ctx, refresh = false, options = {}) {
|
|
670
674
|
const legacy = await this.get(ctx, '/api/v1/games/rocom/merchant/info', this.wegameHeaders(options.auth?.fwToken, options.auth?.userIdentifier), {
|
|
671
675
|
refresh: refresh ? 'true' : 'false',
|
|
672
676
|
random_goods: 'all',
|
|
@@ -688,7 +692,7 @@ class RocomClient {
|
|
|
688
692
|
}, userIdentifier);
|
|
689
693
|
return this.get(ctx, '/api/v1/games/rocom/wiki/pet-size/query', this.wegameHeaders('', userIdentifier, 'bot', 'koishi'), params);
|
|
690
694
|
}
|
|
691
|
-
//
|
|
695
|
+
// 后端查蛋:按展示身高/体重查询,参数名是 height/weight。
|
|
692
696
|
async searchEggBySize(ctx, heightMeters, weightKg, pageNo = 1, pageSize = 30, userIdentifier = '') {
|
|
693
697
|
const params = this.scopedParams({
|
|
694
698
|
height: heightMeters,
|
|
@@ -698,7 +702,7 @@ class RocomClient {
|
|
|
698
702
|
}, userIdentifier);
|
|
699
703
|
return this.get(ctx, '/api/v1/games/rocom/egg/search', this.wegameHeaders('', userIdentifier, 'bot', 'koishi'), params);
|
|
700
704
|
}
|
|
701
|
-
//
|
|
705
|
+
// 异色/炫彩收集排行榜。
|
|
702
706
|
async getPetCollectionRanking(ctx, rankType, limit = 10, uid = '', options = {}) {
|
|
703
707
|
if (!['shining', 'glass'].includes(rankType)) {
|
|
704
708
|
this.setLastError('无效榜单类型');
|
|
@@ -713,7 +717,7 @@ class RocomClient {
|
|
|
713
717
|
params.uid = this.sanitizeUid(uid);
|
|
714
718
|
return this.get(ctx, `/api/v1/games/rocom/ingame/player/card/pet-stats/rankings/${rankType}`, this.wegameHeaders('', options.userIdentifier || '', 'bot', 'koishi'), this.scopedParams(params, options.userIdentifier || ''));
|
|
715
719
|
}
|
|
716
|
-
//
|
|
720
|
+
// 阵容分享码解析与历史查询。
|
|
717
721
|
async parseShareCode(ctx, shareCode, userIdentifier = '') {
|
|
718
722
|
const code = String(shareCode || '').trim();
|
|
719
723
|
if (!code) {
|
|
@@ -808,7 +812,7 @@ class RocomClient {
|
|
|
808
812
|
stillQueued: (taskId) => `家园查询任务仍在排队,请稍后重试(task_id: ${taskId})`,
|
|
809
813
|
});
|
|
810
814
|
}
|
|
811
|
-
//
|
|
815
|
+
// 远行商人实时接口:优先 ingame live,返回 goods/shop/meta 或任务轮询结果。
|
|
812
816
|
// 未指定商店时不传 shop_id;调用方负责在新接口不可用时回退旧 merchant/info。
|
|
813
817
|
async ingameMerchantInfo(ctx, shopId, options = {}) {
|
|
814
818
|
const waitMs = Number(options.waitMs) || 5000;
|
|
@@ -820,7 +824,39 @@ class RocomClient {
|
|
|
820
824
|
stillQueued: (taskId) => `远行商人任务仍在排队,请稍后重试(task_id: ${taskId})`,
|
|
821
825
|
});
|
|
822
826
|
}
|
|
823
|
-
//
|
|
827
|
+
// 家园蛋状态轻量接口:只返回蛋相关数据,供蛋状态订阅轮询与即时查询。
|
|
828
|
+
async ingameHomeEggs(ctx, uid, options = {}) {
|
|
829
|
+
const sanitizedUid = this.sanitizeUid(uid);
|
|
830
|
+
if (!sanitizedUid && !options.auth?.fwToken) {
|
|
831
|
+
this.setLastError('UID 不能为空');
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
const waitMs = Number(options.waitMs) || 5000;
|
|
835
|
+
const payload = { wait_ms: waitMs };
|
|
836
|
+
if (sanitizedUid)
|
|
837
|
+
payload.uid = sanitizedUid;
|
|
838
|
+
return this.queuedQuery(ctx, '/api/v1/games/rocom/ingame/home/eggs', payload, options, {
|
|
839
|
+
queuedNoTaskId: '家园蛋状态任务已入队,但未返回 task_id',
|
|
840
|
+
stillQueued: (taskId) => `家园蛋状态任务仍在排队,请稍后重试(task_id: ${taskId})`,
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
// 家园精灵列表:走 home/pet-data 路径,返回侧重体重和声音的精灵一览。
|
|
844
|
+
async ingameHomePetData(ctx, uid, options = {}) {
|
|
845
|
+
const sanitizedUid = this.sanitizeUid(uid);
|
|
846
|
+
if (!sanitizedUid && !options.auth?.fwToken) {
|
|
847
|
+
this.setLastError('UID 不能为空');
|
|
848
|
+
return null;
|
|
849
|
+
}
|
|
850
|
+
const waitMs = Number(options.waitMs) || 20000;
|
|
851
|
+
const payload = { wait_ms: waitMs };
|
|
852
|
+
if (sanitizedUid)
|
|
853
|
+
payload.uid = sanitizedUid;
|
|
854
|
+
return this.queuedQuery(ctx, '/api/v1/games/rocom/ingame/home/pet-data', payload, options, {
|
|
855
|
+
queuedNoTaskId: '家园精灵查询任务已入队,但未返回 task_id',
|
|
856
|
+
stillQueued: (taskId) => `家园精灵查询任务仍在排队,请稍后重试(task_id: ${taskId})`,
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
// 家园详情:批量或单只查询家园摆放精灵的完整 ingame 数据。
|
|
824
860
|
// UID 参数名为 target_uin;单只查询需同时提供 pet_gid 和 npc_id。
|
|
825
861
|
async ingamePetData(ctx, uid, extras = {}, options = {}) {
|
|
826
862
|
const sanitizedUid = this.sanitizeUid(uid);
|
|
@@ -873,7 +909,7 @@ class RocomClient {
|
|
|
873
909
|
params.name = options.name;
|
|
874
910
|
return this.get(ctx, '/api/v1/games/rocom/pet/detail', this.wegameHeaders(), params);
|
|
875
911
|
}
|
|
876
|
-
// ===== 新版 RoCom Wiki API
|
|
912
|
+
// ===== 新版 RoCom Wiki API=====
|
|
877
913
|
wikiPagedParams(q = '', pageNo = 1, pageSize = 10, filters = {}) {
|
|
878
914
|
const params = {
|
|
879
915
|
page_no: Math.max(Number(pageNo) || 1, 1),
|
package/lib/commands/egg.js
CHANGED
|
@@ -137,7 +137,7 @@ function register(deps) {
|
|
|
137
137
|
const name = nameParts.join(' ');
|
|
138
138
|
if (!name)
|
|
139
139
|
return '请输入精灵名称。用法:洛克.查蛋 <精灵名>';
|
|
140
|
-
//
|
|
140
|
+
// 后端查蛋优先:pet-groups → group-pets,接口不可用才回退 Wiki。
|
|
141
141
|
const userId = session?.userId || '';
|
|
142
142
|
const eggCandidatesRes = await client.getEggPetGroups(ctx, name, 20, userId);
|
|
143
143
|
if (eggCandidatesRes !== null) {
|
|
@@ -1,2 +1,107 @@
|
|
|
1
1
|
import { PluginDeps } from '../types';
|
|
2
|
+
import { type ImageMetrics } from '../icon-metrics';
|
|
3
|
+
type MerchantCategoryKey = 'normal' | 'round' | 'weekend';
|
|
4
|
+
type MerchantProductForRender = {
|
|
5
|
+
name: string;
|
|
6
|
+
image: string;
|
|
7
|
+
time_label: string;
|
|
8
|
+
category: MerchantCategoryKey;
|
|
9
|
+
round_id: number | null;
|
|
10
|
+
is_active: boolean;
|
|
11
|
+
start_time: number | null;
|
|
12
|
+
end_time: number | null;
|
|
13
|
+
price: number | null;
|
|
14
|
+
limit: number | null;
|
|
15
|
+
item_category: string;
|
|
16
|
+
allDay: boolean;
|
|
17
|
+
goods_id: string;
|
|
18
|
+
};
|
|
19
|
+
type MerchantCardItem = {
|
|
20
|
+
goods_name: string;
|
|
21
|
+
iconUrl: string;
|
|
22
|
+
price: string | number;
|
|
23
|
+
num: string;
|
|
24
|
+
category: MerchantCategoryKey;
|
|
25
|
+
roundId: number;
|
|
26
|
+
isHot: boolean;
|
|
27
|
+
isEnded: boolean;
|
|
28
|
+
remainingStr: string;
|
|
29
|
+
top: number;
|
|
30
|
+
};
|
|
31
|
+
export declare function buildMerchantRenderParams(pageHeight: number): {
|
|
32
|
+
pageHeight: number;
|
|
33
|
+
renderWidth: number;
|
|
34
|
+
renderHeight: number;
|
|
35
|
+
renderBaseWidth: number;
|
|
36
|
+
renderBaseHeight: number;
|
|
37
|
+
renderScale: number;
|
|
38
|
+
renderZoom: number;
|
|
39
|
+
renderDeviceScaleFactor: number;
|
|
40
|
+
renderStroke11: number;
|
|
41
|
+
renderStroke10: number;
|
|
42
|
+
renderStrokeName: number;
|
|
43
|
+
renderOffset3: number;
|
|
44
|
+
};
|
|
45
|
+
export declare function buildMerchantCardItems(products: MerchantProductForRender[], options: {
|
|
46
|
+
includeEnded: boolean;
|
|
47
|
+
iconMetrics?: Map<string, ImageMetrics>;
|
|
48
|
+
}): {
|
|
49
|
+
pageHeight: number;
|
|
50
|
+
renderWidth: number;
|
|
51
|
+
renderHeight: number;
|
|
52
|
+
renderBaseWidth: number;
|
|
53
|
+
renderBaseHeight: number;
|
|
54
|
+
renderScale: number;
|
|
55
|
+
renderZoom: number;
|
|
56
|
+
renderDeviceScaleFactor: number;
|
|
57
|
+
renderStroke11: number;
|
|
58
|
+
renderStroke10: number;
|
|
59
|
+
renderStrokeName: number;
|
|
60
|
+
renderOffset3: number;
|
|
61
|
+
goods: {
|
|
62
|
+
num: string;
|
|
63
|
+
top: number;
|
|
64
|
+
iconScale: number;
|
|
65
|
+
iconOffsetX: number;
|
|
66
|
+
iconOffsetY: number;
|
|
67
|
+
goods_name: string;
|
|
68
|
+
iconUrl: string;
|
|
69
|
+
price: string | number;
|
|
70
|
+
category: MerchantCategoryKey;
|
|
71
|
+
roundId: number;
|
|
72
|
+
isHot: boolean;
|
|
73
|
+
isEnded: boolean;
|
|
74
|
+
remainingStr: string;
|
|
75
|
+
}[];
|
|
76
|
+
bottomFrameTop: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* 今日卡片按轮次分行:热销(roundId 0,全天/跨天在架)置顶,第 1~4 轮升序。
|
|
80
|
+
* 每件商品落在哪一轮由商品数据的 roundId 事先算好。
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildTodayRows(goods: MerchantCardItem[], currentRoundId: number | null, iconMetrics?: Map<string, ImageMetrics>): {
|
|
83
|
+
roundId: number;
|
|
84
|
+
label: string;
|
|
85
|
+
timeLabel: string;
|
|
86
|
+
isCurrent: boolean;
|
|
87
|
+
top: number;
|
|
88
|
+
cellWidth: number;
|
|
89
|
+
iconSize: number;
|
|
90
|
+
items: {
|
|
91
|
+
iconScale: number;
|
|
92
|
+
iconOffsetX: number;
|
|
93
|
+
iconOffsetY: number;
|
|
94
|
+
goods_name: string;
|
|
95
|
+
iconUrl: string;
|
|
96
|
+
price: string | number;
|
|
97
|
+
num: string;
|
|
98
|
+
category: MerchantCategoryKey;
|
|
99
|
+
roundId: number;
|
|
100
|
+
isHot: boolean;
|
|
101
|
+
isEnded: boolean;
|
|
102
|
+
remainingStr: string;
|
|
103
|
+
top: number;
|
|
104
|
+
}[];
|
|
105
|
+
}[];
|
|
2
106
|
export declare function register(deps: PluginDeps): void;
|
|
107
|
+
export {};
|