koishi-plugin-rusty-lake-lizard 0.0.3 → 0.0.5

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.
Files changed (2) hide show
  1. package/lib/index.js +35 -39
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -111,50 +111,43 @@ var rooms = [
111
111
  id: "bedroom",
112
112
  name: "卧室",
113
113
  description: "这是一个黑暗的、方形的、铺着白色瓷砖的房间。",
114
- image: images.bedroom,
115
- locked: false
114
+ image: images.bedroom
116
115
  },
117
116
  {
118
117
  id: "corridor",
119
118
  name: "走廊",
120
119
  description: "这是一条长长的、昏暗的走廊,尽头分成两条岔路。",
121
- image: images.corridor,
122
- locked: true
120
+ image: images.corridor
123
121
  },
124
122
  {
125
123
  id: "kitchen",
126
124
  name: "厨房",
127
125
  description: "这里摆着一张桌子和一个厨台。",
128
- image: images.kitchen,
129
- locked: true
126
+ image: images.kitchen
130
127
  },
131
128
  {
132
129
  id: "laboratory",
133
130
  name: "化学实验室",
134
131
  description: "这里出奇的空旷——里面只有一个小型实验台立在房间中央,上面摆着少量化学设备。",
135
- image: images.laboratory,
136
- locked: true
132
+ image: images.laboratory
137
133
  },
138
134
  {
139
135
  id: "electrical",
140
136
  name: "电气室",
141
137
  description: "空气中弥漫着一股霉味,天花板上布满了管道和电线,房间中央有一个大型保险丝盒,旁边是一个近乎空荡的货架,上面积满了灰尘。",
142
- image: images.electrical,
143
- locked: true
138
+ image: images.electrical
144
139
  },
145
140
  {
146
141
  id: "office",
147
142
  name: "办公室",
148
143
  description: "简朴干净的白色墙纸与遍布整座设施的冰冷单调的白色瓷砖形成了鲜明的对比。房间中央有一张桌子,上面放着一台电脑,发出轻微的电流声。",
149
- image: images.office,
150
- locked: true
144
+ image: images.office
151
145
  },
152
146
  {
153
147
  id: "hide",
154
148
  name: "隐藏房间",
155
149
  description: "从布满灰尘的通风口爬出来,到了一个黑暗房间的冰冷地板上。嵌入进墙体里的巨型机器矗立在你眼前,一个小屏幕发出红光,显示着闪烁的消息。",
156
- image: images.hide,
157
- locked: true
150
+ image: images.hide
158
151
  }
159
152
  ];
160
153
  var itemsDetails = {
@@ -282,16 +275,14 @@ function apply(ctx) {
282
275
  visitedRooms: "json",
283
276
  doneTasks: "json"
284
277
  }, {
285
- primary: "id",
286
- autoInc: true
278
+ primary: "id"
287
279
  });
288
280
  ctx.model.extend("rusty_lake_players", {
289
281
  id: "string",
290
282
  gameId: "string",
291
283
  userId: "string"
292
284
  }, {
293
- primary: "id",
294
- autoInc: true
285
+ primary: "id"
295
286
  });
296
287
  const command = ctx.command("锈湖", "锈湖桌游").alias("rl");
297
288
  async function getPlayerState(session) {
@@ -346,6 +337,12 @@ function apply(ctx) {
346
337
  logger.info(`用户 ${session.userId} 已加入房间 ${gameName}`);
347
338
  await session.send(`成功创建房间:${gameName}。
348
339
  已自动为您加入`);
340
+ const state = await getPlayerState(session);
341
+ const currentRoom = state.currentRoom;
342
+ const current = rooms.find((r) => r.id === currentRoom);
343
+ await session.send(`当前所在场景:${current.name}
344
+ 使用“锈湖 查看”指令查看当前场景。例如:“锈湖 查看 监控”`);
345
+ await session.send(import_koishi.h.image(current.image));
349
346
  });
350
347
  command.subcommand(".删除", "清除游戏房间").action(async ({ session }) => {
351
348
  const games = await ctx.database.get("rusty_lake_games", {});
@@ -405,6 +402,12 @@ ${gameList}`);
405
402
  userId: session.userId
406
403
  });
407
404
  await session.send(`你成功加入了房间:${games[index].gameName}!`);
405
+ const state = await getPlayerState(session);
406
+ const currentRoom = state.currentRoom;
407
+ const current = rooms.find((r) => r.id === currentRoom);
408
+ await session.send(`当前所在场景:${current.name}
409
+ 使用“锈湖 查看”指令查看当前场景。例如:“锈湖 查看 监控”`);
410
+ await session.send(import_koishi.h.image(current.image));
408
411
  });
409
412
  command.subcommand(".移动 <room>", "移动到另一个场景").action(async ({ session }) => {
410
413
  const state = await getPlayerState(session);
@@ -635,14 +638,13 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
635
638
  return "你观察了一会,并没有什么特别的发现。";
636
639
  }
637
640
  } else if (/门/.test(point)) {
638
- const corridor = rooms.find((room) => room.id === "corridor");
639
- if (corridor.locked === true) {
641
+ if (!state.doneTasks.includes("走廊锁")) {
640
642
  await session.send("这扇装有坚固的金属门把手的白门被锁上了,需要钥匙才能开。");
641
643
  if (state.inventory.includes("钥匙")) {
642
644
  await session.send("你拥有钥匙。要试着开门吗?(是/否)");
643
645
  const choice = await session.prompt(5e3);
644
646
  if (choice === "是") {
645
- corridor.locked = false;
647
+ await addTaskToDoneTasks(session, "走廊锁");
646
648
  await ctx.database.upsert("rusty_lake_games", [
647
649
  {
648
650
  id: state.id,
@@ -679,8 +681,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
679
681
  response += "摄像头静止地悬挂在天花板上,以一种令人不安的姿态注视着你。";
680
682
  response += "\n\n你试着拨弄它,但它坚固的金属框架可以使它免受任何损害。";
681
683
  } else if (/通风/.test(point)) {
682
- const hide = rooms.find((room) => room.id === "hide");
683
- if (hide.locked === true) {
684
+ if (!state.doneTasks.includes("隐藏房间锁")) {
684
685
  await session.send("通风口被一块挡板覆盖,挡板被螺丝固定在墙上。");
685
686
  if (state.inventory.includes("螺丝刀")) {
686
687
  await session.send("你拥有螺丝刀。要试着拆开挡板吗?(是/否)");
@@ -701,7 +702,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
701
702
  response += "\n\n你设法打开通风口,从布满灰尘的通风口爬出来,到了一个黑暗房间的冰冷地板上,脑袋差点撞到上方的桌子。";
702
703
  response += "\n\n你艰难地从桌子下面爬出来,然后就看到了嵌入进墙体里的巨型机器矗立在你眼前,一个小屏幕发出红光,显示着闪烁的消息。“";
703
704
  response += import_koishi.h.image(images.hide);
704
- hide.locked = false;
705
+ await addTaskToDoneTasks(session, "隐藏房间锁");
705
706
  await ctx.database.upsert("rusty_lake_games", [
706
707
  {
707
708
  id: state.id,
@@ -733,14 +734,13 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
733
734
  }
734
735
  } else if (currentRoom.id === "corridor") {
735
736
  if (/厨房/.test(point)) {
736
- const kitchen = rooms.find((room) => room.id === "hide");
737
- if (kitchen.locked === true) {
737
+ if (!state.doneTasks.includes("厨房锁")) {
738
738
  response += "厨房的门没锁,你开门走了进去。";
739
739
  response += "\n\n你走进厨房,面前是一张小桌子和一把椅子。";
740
740
  response += "\n\n远端的墙上有一个厨台,上面放着一个咖啡机。";
741
741
  response += "\n\n你听到角落的垃圾桶周围萦绕着嗡嗡作响的苍蝇声。";
742
742
  response += import_koishi.h.image(images.kitchen);
743
- kitchen.locked = false;
743
+ await addTaskToDoneTasks(session, "厨房锁");
744
744
  await ctx.database.upsert("rusty_lake_games", [
745
745
  {
746
746
  id: state.id,
@@ -756,15 +756,14 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
756
756
  response += "你观察了一会,并没有什么特别的发现。";
757
757
  }
758
758
  } else if (/实验室/.test(point)) {
759
- const laboratory = rooms.find((room) => room.id === "hide");
760
- if (laboratory.locked === true) {
759
+ if (!state.doneTasks.includes("实验室锁")) {
761
760
  response += "你来到化学实验室门口。";
762
761
  response += "\n\n当你靠近门边时,嗅到了从另外一侧传来的浓烈化学气味,直冲鼻腔。";
763
762
  response += "\n\n门没锁,你开门走了进去。";
764
763
  response += "\n\n化学实验室出奇地空旷——里面只有一个小型实验台立在房间中央,上面摆着少量化学设备。";
765
764
  response += "\n\n然而一股令人不安的寒意掠过你的脊背,你总感觉有什么东西在注视着你。";
766
765
  response += import_koishi.h.image(images.laboratory);
767
- laboratory.locked = false;
766
+ await addTaskToDoneTasks(session, "实验室锁");
768
767
  await ctx.database.upsert("rusty_lake_games", [
769
768
  {
770
769
  id: state.id,
@@ -780,8 +779,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
780
779
  response += "你观察了一会,并没有什么特别的发现。";
781
780
  }
782
781
  } else if (/电/.test(point)) {
783
- const electrical = rooms.find((room) => room.id === "hide");
784
- if (electrical.locked === true) {
782
+ if (!state.doneTasks.includes("电锁")) {
785
783
  await session.send("通往电气室的门是锁着的。门把手是简单的旋转式,看起来不是很牢固,中间有一个钥匙孔。");
786
784
  await session.send("你准备想办法把门弄开。(输入准备使用的道具或方式)");
787
785
  const choice = await session.prompt(15e3);
@@ -790,7 +788,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
790
788
  response += "\n\n门嘎吱作响地打开了,映入眼帘的是一个狭小的房间,空气中弥漫着一股霉味。";
791
789
  response += "\n\n你看到天花板上布满了管道和电线,房间中央有一个大型保险丝盒,旁边是一个近乎空荡的货架,上面积满了灰尘。";
792
790
  response += import_koishi.h.image(images.electrical);
793
- electrical.locked = false;
791
+ await addTaskToDoneTasks(session, "电锁");
794
792
  await ctx.database.upsert("rusty_lake_games", [
795
793
  {
796
794
  id: state.id,
@@ -807,7 +805,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
807
805
  response += "\n\n门嘎吱作响地打开了,映入眼帘的是一个狭小的房间,空气中弥漫着一股霉味。";
808
806
  response += "\n\n你看到天花板上布满了管道和电线,房间中央有一个大型保险丝盒,旁边是一个近乎空荡的货架,上面积满了灰尘。";
809
807
  response += import_koishi.h.image(images.electrical);
810
- electrical.locked = false;
808
+ await addTaskToDoneTasks(session, "电锁");
811
809
  await ctx.database.upsert("rusty_lake_games", [
812
810
  {
813
811
  id: state.id,
@@ -824,7 +822,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
824
822
  response += "\n\n门嘎吱作响地打开了,映入眼帘的是一个狭小的房间,空气中弥漫着一股霉味。";
825
823
  response += "\n\n你看到天花板上布满了管道和电线,房间中央有一个大型保险丝盒,旁边是一个近乎空荡的货架,上面积满了灰尘。";
826
824
  response += import_koishi.h.image(images.electrical);
827
- electrical.locked = false;
825
+ await addTaskToDoneTasks(session, "电锁");
828
826
  await ctx.database.upsert("rusty_lake_games", [
829
827
  {
830
828
  id: state.id,
@@ -843,8 +841,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
843
841
  response += "你观察了一会,并没有什么特别的发现。";
844
842
  }
845
843
  } else if (/办公室/.test(point)) {
846
- const office = rooms.find((room) => room.id === "hide");
847
- if (office.locked === true) {
844
+ if (!state.doneTasks.includes("办公室锁")) {
848
845
  await session.send("办公室的门被一个牢固的电子锁锁住,旁边有一个指纹读取器。");
849
846
  if (state.doneTasks.includes("房间电")) {
850
847
  await session.send("你试了试自己的指纹,读取器闪烁红灯,门并未打开。");
@@ -857,7 +854,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
857
854
  response += "\n\n简朴干净的白色墙纸与遍布整座设施的冰冷单调的白色瓷砖形成了鲜明的对比。";
858
855
  response += "\n\n房间中央有一张桌子,上面放着一台电脑,发出轻微的电流声。";
859
856
  response += import_koishi.h.image(images.office);
860
- office.locked = false;
857
+ await addTaskToDoneTasks(session, "办公室锁");
861
858
  await ctx.database.upsert("rusty_lake_games", [
862
859
  {
863
860
  id: state.id,
@@ -1110,7 +1107,6 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
1110
1107
  await session.send("插槽C和H已经插入了保险丝。你决定调整保险丝的位置,并把之前找到的那个也放进去。");
1111
1108
  await session.send("输入你想插入保险丝的三个插槽。(三个大写英文字母)");
1112
1109
  const choice = await session.prompt(15e3);
1113
- const hide = rooms.find((room) => room.id === "hide");
1114
1110
  if (/A/.test(choice) && /B/.test(choice) && /G/.test(choice) && !state.doneTasks.includes("房间电")) {
1115
1111
  response += "你将保险丝插入插槽A、B、G。";
1116
1112
  response += "\n\n放好了最后一个保险丝,你听到电流噼啪作响,伴着火花从保险丝盒中飞溅而出。";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-rusty-lake-lizard",
3
3
  "description": "交互式解谜游戏,来玩玩吧~",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/lizard0126/rusty-lake-lizard.git"