magpie-digital-pet 1.1.1 → 1.2.1
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/README.md +8 -8
- package/lib/pet.adapter.mjs +43 -28
- package/lib/pet.care-rules.mjs +736 -44
- package/lib/pet.care-store.mjs +365 -14
- package/lib/pet.server.mjs +106 -5
- package/package.json +1 -1
- package/page/app.css +289 -0
- package/page/app.html +7 -4
- package/page/app.js +517 -46
- package/page/props/brick-stand.png +0 -0
- package/page/props/charge-dock.png +0 -0
- package/page/props/digi-monument.png +0 -0
- package/page/props/gravity-chamber.png +0 -0
- package/page/props/training-bag.png +0 -0
package/README.md
CHANGED
|
@@ -154,9 +154,9 @@ inMagpieOnly = 有 agent && 没有 main
|
|
|
154
154
|
|
|
155
155
|
| 档位 | 时长 | 数据碎片 | 亲密 | 消耗精力 |
|
|
156
156
|
|---|---|---|---|---|
|
|
157
|
-
| 短巡逻 patrol | 5 分钟 | **
|
|
158
|
-
| 数据原野 field | 15 分钟 | **
|
|
159
|
-
| 深夜远征 night | 30 分钟 | **
|
|
157
|
+
| 短巡逻 patrol | 5 分钟 | **5** | **+3** | 10(需要精力 ≥ 15) |
|
|
158
|
+
| 数据原野 field | 15 分钟 | **11** | **+4** | 10(同上) |
|
|
159
|
+
| 深夜远征 night | 30 分钟 | **19** | **+5** | 10(同上) |
|
|
160
160
|
|
|
161
161
|
一次只能进行一场探险;结算时随机附一句见闻,并计入「探险 1 次」的每日目标。
|
|
162
162
|
|
|
@@ -164,15 +164,15 @@ inMagpieOnly = 有 agent && 没有 main
|
|
|
164
164
|
|
|
165
165
|
| 目标 | 条件 | 奖励 |
|
|
166
166
|
|---|---|---|
|
|
167
|
-
| 照顾 | 当天照顾 2 次 | **
|
|
168
|
-
| 探险 | 当天完成 1 次探险 | **
|
|
169
|
-
| 投喂 | 当天自动吃掉 10 个请求 | **
|
|
167
|
+
| 照顾 | 当天照顾 2 次 | **5 碎片** |
|
|
168
|
+
| 探险 | 当天完成 1 次探险 | **7 碎片** |
|
|
169
|
+
| 投喂 | 当天自动吃掉 10 个请求 | **5 碎片** |
|
|
170
170
|
|
|
171
171
|
### 数据碎片
|
|
172
172
|
|
|
173
|
-
- **每天最多赚
|
|
173
|
+
- **每天最多赚 260 片**(探险 + 每日目标合计),北京时间 0 点按本地日期重置;花掉的碎片不占额度。
|
|
174
174
|
- 到顶后再结算探险,实发 0,提示里会写「今日碎片已达上限」。
|
|
175
|
-
- 页面「收藏与装饰」里显示 `数据碎片:N(今日 X /
|
|
175
|
+
- 页面「收藏与装饰」里显示 `数据碎片:N(今日 X / 260)`。
|
|
176
176
|
|
|
177
177
|
### 装饰背景(十五套)
|
|
178
178
|
|
package/lib/pet.adapter.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import { fileURLToPath } from "node:url";
|
|
|
24
24
|
import { Database } from "bun:sqlite";
|
|
25
25
|
import { plugin as createOpenCodePetPlugin, DIGIMON_DATA } from "@jcendal/opencode-digital-pet";
|
|
26
26
|
import { DIFFICULTY_KNOWN } from "./pet.care-store.mjs";
|
|
27
|
-
import { decayCareState, evaluatePetStatuses } from "./pet.care-rules.mjs";
|
|
27
|
+
import { createDefaultCareState, decayCareState, evaluatePetStatuses } from "./pet.care-rules.mjs";
|
|
28
28
|
|
|
29
29
|
export { DIGIMON_DATA };
|
|
30
30
|
|
|
@@ -185,33 +185,48 @@ export function createPetAdapter({ databasePath, dbPath, notifyGate } = {}) {
|
|
|
185
185
|
const row = roDb
|
|
186
186
|
.query("SELECT * FROM magpie_pet_care_state WHERE partner_id = ?")
|
|
187
187
|
.get(partner.partner_id);
|
|
188
|
-
|
|
189
|
-
const decayed =
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
188
|
+
const nowMs = Date.now();
|
|
189
|
+
const decayed = row
|
|
190
|
+
? decayCareState(
|
|
191
|
+
{
|
|
192
|
+
partnerId: row.partner_id,
|
|
193
|
+
satiety: row.satiety,
|
|
194
|
+
mood: row.mood,
|
|
195
|
+
energy: row.energy,
|
|
196
|
+
hygiene: row.hygiene,
|
|
197
|
+
bond: row.bond,
|
|
198
|
+
cooldowns: {
|
|
199
|
+
snack: row.cooldown_snack ?? 0,
|
|
200
|
+
play: row.cooldown_play ?? 0,
|
|
201
|
+
clean: row.cooldown_clean ?? 0,
|
|
202
|
+
rest: row.cooldown_rest ?? 0,
|
|
203
|
+
petEgg: row.cooldown_pet_egg ?? 0,
|
|
204
|
+
pet: row.cooldown_pet ?? 0,
|
|
205
|
+
},
|
|
206
|
+
burstUses: {
|
|
207
|
+
snack: row.snack_burst_used ?? 0,
|
|
208
|
+
play: row.play_burst_used ?? 0,
|
|
209
|
+
},
|
|
210
|
+
lastDecayAt: row.last_decay_at,
|
|
211
|
+
updatedAt: row.updated_at,
|
|
212
|
+
},
|
|
213
|
+
nowMs,
|
|
214
|
+
)
|
|
215
|
+
: createDefaultCareState(partner.partner_id, nowMs);
|
|
216
|
+
let activeBuffs = [];
|
|
217
|
+
try {
|
|
218
|
+
activeBuffs = roDb
|
|
219
|
+
.query(
|
|
220
|
+
`SELECT buff_id AS id, label, xp_multiplier AS xpMultiplier,
|
|
221
|
+
expedition_bonus AS expeditionBonus, tip, granted_at AS grantedAt, expires_at AS expiresAt
|
|
222
|
+
FROM magpie_pet_buffs
|
|
223
|
+
WHERE partner_id = ? AND expires_at > ?`,
|
|
224
|
+
)
|
|
225
|
+
.all(partner.partner_id, nowMs);
|
|
226
|
+
} catch {
|
|
227
|
+
activeBuffs = [];
|
|
228
|
+
}
|
|
229
|
+
return evaluatePetStatuses(decayed, activeBuffs, nowMs).xpMultiplier;
|
|
215
230
|
} catch {
|
|
216
231
|
return 1;
|
|
217
232
|
}
|