koishi-plugin-maple-warriors 0.1.0 → 0.1.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/lib/index.js CHANGED
@@ -100,7 +100,7 @@ var INITIAL_ITEMS = [
100
100
  function calculateRates(character) {
101
101
  const resistance = (character.toughness / (character.toughness + 90)).toFixed(4);
102
102
  const critRate = (character.crit / (character.crit + 90)).toFixed(4);
103
- const chargeTime = (1 + 720 / (character.agility + 80)).toFixed(2);
103
+ const chargeTime = (1 + 1800 / (7 * character.agility + 200)).toFixed(2);
104
104
  const dodgeRate = (0.2 * character.agility / (character.agility + 90)).toFixed(4);
105
105
  return { resistance, critRate, chargeTime, dodgeRate };
106
106
  }
@@ -635,38 +635,7 @@ ${itemsText || "空空如也"}`;
635
635
  ctx.command("猫武士/我的角色", "查看我的角色信息").example("我的角色").action(async ({ session }) => {
636
636
  const userId = session.userId;
637
637
  let character = await getOrCreateCharacter(userId);
638
- const attrs = calculateCharacterAttributes(character);
639
- const items = parseItemsString(character.items);
640
- const itemsText = Object.entries(items).map(([name2, count]) => `${name2}*${count}`).join("\n");
641
- const buffs = parseBuffs(character.buffs);
642
- const now = /* @__PURE__ */ new Date();
643
- const activeBuffs = buffs.filter((buff) => new Date(buff.endTime) > now);
644
- let buffsText = "无";
645
- if (activeBuffs.length > 0) {
646
- buffsText = activeBuffs.map((buff) => {
647
- const endTime = new Date(buff.endTime);
648
- const remainingSeconds = Math.max(0, (endTime.getTime() - now.getTime()) / 1e3);
649
- return `${buff.name}(${formatTimeRemaining(Math.floor(remainingSeconds))})`;
650
- }).join(" ");
651
- }
652
- const constitutionDisplay = attrs.buffs.constitution > 0 ? `${attrs.total.constitution}(+${attrs.buffs.constitution})` : attrs.total.constitution.toString();
653
- const attackDisplay = attrs.buffs.attack > 0 ? `${attrs.total.attack}(+${attrs.buffs.attack})` : attrs.total.attack.toString();
654
- const toughnessDisplay = attrs.buffs.toughness > 0 ? `${attrs.total.toughness}(+${attrs.buffs.toughness})` : attrs.total.toughness.toString();
655
- const critDisplay = attrs.buffs.crit > 0 ? `${attrs.total.crit}(+${attrs.buffs.crit})` : attrs.total.crit.toString();
656
- const agilityDisplay = attrs.buffs.agility > 0 ? `${attrs.total.agility}(+${attrs.buffs.agility})` : attrs.total.agility.toString();
657
- const currentHp = Math.min(character.currentHp, attrs.maxHp);
658
- return `名字: ${character.name}
659
- 等级: ${character.level}
660
- 体质: ${constitutionDisplay} (HP: ${currentHp}/${attrs.maxHp})
661
- 攻击: ${attackDisplay}
662
- 防御: ${toughnessDisplay} (韧性: ${(parseFloat(attrs.rates.resistance) * 100).toFixed(2)}%)
663
- 暴击: ${critDisplay} (暴击率: ${(parseFloat(attrs.rates.critRate) * 100).toFixed(2)}%)
664
- 敏捷: ${agilityDisplay} (蓄力: ${attrs.rates.chargeTime}s 闪避率: ${(parseFloat(attrs.rates.dodgeRate) * 100).toFixed(2)}%)
665
- 状态: ${character.status}${character.statusEndTime ? " 剩余" + formatRemainingTime(character.statusEndTime) : ""}
666
- buff: ${buffsText}
667
- ──────────
668
- 物品栏:
669
- ${itemsText || "空空如也"}`;
638
+ return await formatCharacterInfo(character);
670
639
  });
671
640
  ctx.command("猫武士/训练 <...args>", "训练提升属性").example("训练 体质 体质 攻击").example("训练 体质").example("训练 随机").action(async ({ session }, ...args) => {
672
641
  const userId = session.userId;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-maple-warriors",
3
3
  "description": "-",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/lib/index.d.ts DELETED
@@ -1,52 +0,0 @@
1
- import { Context, Schema } from 'koishi';
2
- export declare const name = "maple-warriors";
3
- export declare const using: readonly ["database"];
4
- declare module 'koishi' {
5
- interface Tables {
6
- maple_warriors: MapleWarrior;
7
- maple_warriors_items: MapleItem;
8
- }
9
- }
10
- export interface MapleWarrior {
11
- id: number;
12
- userId: string;
13
- name: string;
14
- level: number;
15
- gold: number;
16
- constitution: number;
17
- attack: number;
18
- toughness: number;
19
- crit: number;
20
- agility: number;
21
- currentHp: number;
22
- status: string;
23
- previousStatus: string;
24
- statusEndTime: Date | null;
25
- buffs: string;
26
- items: string;
27
- lastTrainDate: string;
28
- lastHuntDate: string;
29
- updatedAt: Date;
30
- }
31
- export interface MapleItem {
32
- id: number;
33
- name: string;
34
- type: string;
35
- sellPrice: number;
36
- shopPrice: number;
37
- buff: string;
38
- hpBonus: number;
39
- constitutionBonus: number;
40
- attackBonus: number;
41
- toughnessBonus: number;
42
- critBonus: number;
43
- agilityBonus: number;
44
- description: string;
45
- createdAt: Date;
46
- }
47
- export interface Config {
48
- preyData: string[];
49
- battleMessageInterval: number;
50
- }
51
- export declare const Config: Schema<Config>;
52
- export declare function apply(ctx: Context, config: Config): void;