koishi-plugin-rusty-lake-lizard 0.0.4 → 0.0.6

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 +89 -83
  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 = {
@@ -344,6 +337,12 @@ function apply(ctx) {
344
337
  logger.info(`用户 ${session.userId} 已加入房间 ${gameName}`);
345
338
  await session.send(`成功创建房间:${gameName}。
346
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));
347
346
  });
348
347
  command.subcommand(".删除", "清除游戏房间").action(async ({ session }) => {
349
348
  const games = await ctx.database.get("rusty_lake_games", {});
@@ -403,6 +402,12 @@ ${gameList}`);
403
402
  userId: session.userId
404
403
  });
405
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));
406
411
  });
407
412
  command.subcommand(".移动 <room>", "移动到另一个场景").action(async ({ session }) => {
408
413
  const state = await getPlayerState(session);
@@ -633,23 +638,23 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
633
638
  return "你观察了一会,并没有什么特别的发现。";
634
639
  }
635
640
  } else if (/门/.test(point)) {
636
- const corridor = rooms.find((room) => room.id === "corridor");
637
- if (corridor.locked === true) {
641
+ if (!state.doneTasks.includes("走廊锁")) {
638
642
  await session.send("这扇装有坚固的金属门把手的白门被锁上了,需要钥匙才能开。");
639
643
  if (state.inventory.includes("钥匙")) {
640
644
  await session.send("你拥有钥匙。要试着开门吗?(是/否)");
641
645
  const choice = await session.prompt(5e3);
642
646
  if (choice === "是") {
643
- corridor.locked = false;
647
+ await addTaskToDoneTasks(session, "走廊锁");
648
+ const newState = await getPlayerState(session);
644
649
  await ctx.database.upsert("rusty_lake_games", [
645
650
  {
646
- id: state.id,
647
- gameId: state.gameId,
648
- gameName: state.gameName,
651
+ id: newState.id,
652
+ gameId: newState.gameId,
653
+ gameName: newState.gameName,
649
654
  currentRoom: "corridor",
650
- inventory: state.inventory,
651
- visitedRooms: [...state.visitedRooms, "corridor"],
652
- doneTasks: state.doneTasks
655
+ inventory: newState.inventory,
656
+ visitedRooms: [...newState.visitedRooms, "corridor"],
657
+ doneTasks: newState.doneTasks
653
658
  }
654
659
  ]);
655
660
  response += "你小心翼翼地打开门,迈步走了出去。";
@@ -677,8 +682,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
677
682
  response += "摄像头静止地悬挂在天花板上,以一种令人不安的姿态注视着你。";
678
683
  response += "\n\n你试着拨弄它,但它坚固的金属框架可以使它免受任何损害。";
679
684
  } else if (/通风/.test(point)) {
680
- const hide = rooms.find((room) => room.id === "hide");
681
- if (hide.locked === true) {
685
+ if (!state.doneTasks.includes("隐藏房间锁")) {
682
686
  await session.send("通风口被一块挡板覆盖,挡板被螺丝固定在墙上。");
683
687
  if (state.inventory.includes("螺丝刀")) {
684
688
  await session.send("你拥有螺丝刀。要试着拆开挡板吗?(是/否)");
@@ -699,16 +703,17 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
699
703
  response += "\n\n你设法打开通风口,从布满灰尘的通风口爬出来,到了一个黑暗房间的冰冷地板上,脑袋差点撞到上方的桌子。";
700
704
  response += "\n\n你艰难地从桌子下面爬出来,然后就看到了嵌入进墙体里的巨型机器矗立在你眼前,一个小屏幕发出红光,显示着闪烁的消息。“";
701
705
  response += import_koishi.h.image(images.hide);
702
- hide.locked = false;
706
+ await addTaskToDoneTasks(session, "隐藏房间锁");
707
+ const newState = await getPlayerState(session);
703
708
  await ctx.database.upsert("rusty_lake_games", [
704
709
  {
705
- id: state.id,
706
- gameId: state.gameId,
707
- gameName: state.gameName,
710
+ id: newState.id,
711
+ gameId: newState.gameId,
712
+ gameName: newState.gameName,
708
713
  currentRoom: "hide",
709
- inventory: state.inventory,
710
- visitedRooms: [...state.visitedRooms, "hide"],
711
- doneTasks: state.doneTasks
714
+ inventory: newState.inventory,
715
+ visitedRooms: [...newState.visitedRooms, "hide"],
716
+ doneTasks: newState.doneTasks
712
717
  }
713
718
  ]);
714
719
  } else {
@@ -731,55 +736,54 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
731
736
  }
732
737
  } else if (currentRoom.id === "corridor") {
733
738
  if (/厨房/.test(point)) {
734
- const kitchen = rooms.find((room) => room.id === "hide");
735
- if (kitchen.locked === true) {
739
+ if (!state.doneTasks.includes("厨房锁")) {
736
740
  response += "厨房的门没锁,你开门走了进去。";
737
741
  response += "\n\n你走进厨房,面前是一张小桌子和一把椅子。";
738
742
  response += "\n\n远端的墙上有一个厨台,上面放着一个咖啡机。";
739
743
  response += "\n\n你听到角落的垃圾桶周围萦绕着嗡嗡作响的苍蝇声。";
740
744
  response += import_koishi.h.image(images.kitchen);
741
- kitchen.locked = false;
745
+ await addTaskToDoneTasks(session, "厨房锁");
746
+ const newState = await getPlayerState(session);
742
747
  await ctx.database.upsert("rusty_lake_games", [
743
748
  {
744
- id: state.id,
745
- gameId: state.gameId,
746
- gameName: state.gameName,
749
+ id: newState.id,
750
+ gameId: newState.gameId,
751
+ gameName: newState.gameName,
747
752
  currentRoom: "kitchen",
748
- inventory: state.inventory,
749
- visitedRooms: [...state.visitedRooms, "kitchen"],
750
- doneTasks: state.doneTasks
753
+ inventory: newState.inventory,
754
+ visitedRooms: [...newState.visitedRooms, "kitchen"],
755
+ doneTasks: newState.doneTasks
751
756
  }
752
757
  ]);
753
758
  } else {
754
759
  response += "你观察了一会,并没有什么特别的发现。";
755
760
  }
756
761
  } else if (/实验室/.test(point)) {
757
- const laboratory = rooms.find((room) => room.id === "hide");
758
- if (laboratory.locked === true) {
762
+ if (!state.doneTasks.includes("实验室锁")) {
759
763
  response += "你来到化学实验室门口。";
760
764
  response += "\n\n当你靠近门边时,嗅到了从另外一侧传来的浓烈化学气味,直冲鼻腔。";
761
765
  response += "\n\n门没锁,你开门走了进去。";
762
766
  response += "\n\n化学实验室出奇地空旷——里面只有一个小型实验台立在房间中央,上面摆着少量化学设备。";
763
767
  response += "\n\n然而一股令人不安的寒意掠过你的脊背,你总感觉有什么东西在注视着你。";
764
768
  response += import_koishi.h.image(images.laboratory);
765
- laboratory.locked = false;
769
+ await addTaskToDoneTasks(session, "实验室锁");
770
+ const newState = await getPlayerState(session);
766
771
  await ctx.database.upsert("rusty_lake_games", [
767
772
  {
768
- id: state.id,
769
- gameId: state.gameId,
770
- gameName: state.gameName,
773
+ id: newState.id,
774
+ gameId: newState.gameId,
775
+ gameName: newState.gameName,
771
776
  currentRoom: "laboratory",
772
- inventory: state.inventory,
773
- visitedRooms: [...state.visitedRooms, "laboratory"],
774
- doneTasks: state.doneTasks
777
+ inventory: newState.inventory,
778
+ visitedRooms: [...newState.visitedRooms, "laboratory"],
779
+ doneTasks: newState.doneTasks
775
780
  }
776
781
  ]);
777
782
  } else {
778
783
  response += "你观察了一会,并没有什么特别的发现。";
779
784
  }
780
785
  } else if (/电/.test(point)) {
781
- const electrical = rooms.find((room) => room.id === "hide");
782
- if (electrical.locked === true) {
786
+ if (!state.doneTasks.includes("电锁")) {
783
787
  await session.send("通往电气室的门是锁着的。门把手是简单的旋转式,看起来不是很牢固,中间有一个钥匙孔。");
784
788
  await session.send("你准备想办法把门弄开。(输入准备使用的道具或方式)");
785
789
  const choice = await session.prompt(15e3);
@@ -788,16 +792,17 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
788
792
  response += "\n\n门嘎吱作响地打开了,映入眼帘的是一个狭小的房间,空气中弥漫着一股霉味。";
789
793
  response += "\n\n你看到天花板上布满了管道和电线,房间中央有一个大型保险丝盒,旁边是一个近乎空荡的货架,上面积满了灰尘。";
790
794
  response += import_koishi.h.image(images.electrical);
791
- electrical.locked = false;
795
+ await addTaskToDoneTasks(session, "电锁");
796
+ const newState = await getPlayerState(session);
792
797
  await ctx.database.upsert("rusty_lake_games", [
793
798
  {
794
- id: state.id,
795
- gameId: state.gameId,
796
- gameName: state.gameName,
799
+ id: newState.id,
800
+ gameId: newState.gameId,
801
+ gameName: newState.gameName,
797
802
  currentRoom: "electrical",
798
- inventory: state.inventory,
799
- visitedRooms: [...state.visitedRooms, "electrical"],
800
- doneTasks: state.doneTasks
803
+ inventory: newState.inventory,
804
+ visitedRooms: [...newState.visitedRooms, "electrical"],
805
+ doneTasks: newState.doneTasks
801
806
  }
802
807
  ]);
803
808
  } else if (choice === "身份证" && state.inventory.includes("身份证")) {
@@ -805,16 +810,17 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
805
810
  response += "\n\n门嘎吱作响地打开了,映入眼帘的是一个狭小的房间,空气中弥漫着一股霉味。";
806
811
  response += "\n\n你看到天花板上布满了管道和电线,房间中央有一个大型保险丝盒,旁边是一个近乎空荡的货架,上面积满了灰尘。";
807
812
  response += import_koishi.h.image(images.electrical);
808
- electrical.locked = false;
813
+ await addTaskToDoneTasks(session, "电锁");
814
+ const newState = await getPlayerState(session);
809
815
  await ctx.database.upsert("rusty_lake_games", [
810
816
  {
811
- id: state.id,
812
- gameId: state.gameId,
813
- gameName: state.gameName,
817
+ id: newState.id,
818
+ gameId: newState.gameId,
819
+ gameName: newState.gameName,
814
820
  currentRoom: "electrical",
815
- inventory: state.inventory,
816
- visitedRooms: [...state.visitedRooms, "electrical"],
817
- doneTasks: state.doneTasks
821
+ inventory: newState.inventory,
822
+ visitedRooms: [...newState.visitedRooms, "electrical"],
823
+ doneTasks: newState.doneTasks
818
824
  }
819
825
  ]);
820
826
  } else if (/力/.test(choice)) {
@@ -822,16 +828,17 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
822
828
  response += "\n\n门嘎吱作响地打开了,映入眼帘的是一个狭小的房间,空气中弥漫着一股霉味。";
823
829
  response += "\n\n你看到天花板上布满了管道和电线,房间中央有一个大型保险丝盒,旁边是一个近乎空荡的货架,上面积满了灰尘。";
824
830
  response += import_koishi.h.image(images.electrical);
825
- electrical.locked = false;
831
+ await addTaskToDoneTasks(session, "电锁");
832
+ const newState = await getPlayerState(session);
826
833
  await ctx.database.upsert("rusty_lake_games", [
827
834
  {
828
- id: state.id,
829
- gameId: state.gameId,
830
- gameName: state.gameName,
835
+ id: newState.id,
836
+ gameId: newState.gameId,
837
+ gameName: newState.gameName,
831
838
  currentRoom: "electrical",
832
- inventory: state.inventory,
833
- visitedRooms: [...state.visitedRooms, "electrical"],
834
- doneTasks: state.doneTasks
839
+ inventory: newState.inventory,
840
+ visitedRooms: [...newState.visitedRooms, "electrical"],
841
+ doneTasks: newState.doneTasks
835
842
  }
836
843
  ]);
837
844
  } else {
@@ -841,8 +848,7 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
841
848
  response += "你观察了一会,并没有什么特别的发现。";
842
849
  }
843
850
  } else if (/办公室/.test(point)) {
844
- const office = rooms.find((room) => room.id === "hide");
845
- if (office.locked === true) {
851
+ if (!state.doneTasks.includes("办公室锁")) {
846
852
  await session.send("办公室的门被一个牢固的电子锁锁住,旁边有一个指纹读取器。");
847
853
  if (state.doneTasks.includes("房间电")) {
848
854
  await session.send("你试了试自己的指纹,读取器闪烁红灯,门并未打开。");
@@ -855,16 +861,17 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
855
861
  response += "\n\n简朴干净的白色墙纸与遍布整座设施的冰冷单调的白色瓷砖形成了鲜明的对比。";
856
862
  response += "\n\n房间中央有一张桌子,上面放着一台电脑,发出轻微的电流声。";
857
863
  response += import_koishi.h.image(images.office);
858
- office.locked = false;
864
+ await addTaskToDoneTasks(session, "办公室锁");
865
+ const newState = await getPlayerState(session);
859
866
  await ctx.database.upsert("rusty_lake_games", [
860
867
  {
861
- id: state.id,
862
- gameId: state.gameId,
863
- gameName: state.gameName,
868
+ id: newState.id,
869
+ gameId: newState.gameId,
870
+ gameName: newState.gameName,
864
871
  currentRoom: "office",
865
- inventory: state.inventory,
866
- visitedRooms: [...state.visitedRooms, "office"],
867
- doneTasks: state.doneTasks
872
+ inventory: newState.inventory,
873
+ visitedRooms: [...newState.visitedRooms, "office"],
874
+ doneTasks: newState.doneTasks
868
875
  }
869
876
  ]);
870
877
  } else {
@@ -1108,7 +1115,6 @@ ${targetRoom.description}${targetRoom.image ? "\n" + import_koishi.h.image(targe
1108
1115
  await session.send("插槽C和H已经插入了保险丝。你决定调整保险丝的位置,并把之前找到的那个也放进去。");
1109
1116
  await session.send("输入你想插入保险丝的三个插槽。(三个大写英文字母)");
1110
1117
  const choice = await session.prompt(15e3);
1111
- const hide = rooms.find((room) => room.id === "hide");
1112
1118
  if (/A/.test(choice) && /B/.test(choice) && /G/.test(choice) && !state.doneTasks.includes("房间电")) {
1113
1119
  response += "你将保险丝插入插槽A、B、G。";
1114
1120
  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.4",
4
+ "version": "0.0.6",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/lizard0126/rusty-lake-lizard.git"