neelthee-mansion 3.23.10__py3-none-any.whl → 3.23.12__py3-none-any.whl

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.
@@ -17,10 +17,12 @@ GameState = {
17
17
  Neel-thee's Mansion of Amnesia
18
18
  """
19
19
 
20
- global player, evil_mage, commands, NOTE_NUM, credits, quest_manager, revealer, CHARACTERSLIST, BACKGROUNDS, info_text_area
20
+ global player, evil_mage, commands, NOTE_NUM, credits, quest_manager, revealer, CHARACTERSLIST, BACKGROUNDS, info_text_area, map_root, map_label, player_info_root, player_info_label
21
21
 
22
22
  player_info_root = None
23
23
  player_info_label = None
24
+ map_root = None
25
+ map_label = None
24
26
  info_text_area = None
25
27
 
26
28
  BACKGROUNDS = {
@@ -387,7 +389,7 @@ def Move(move):
387
389
  def start():
388
390
  global player, info_text_area
389
391
  # Wait until info_text_area is initialized
390
- while info_text_area is None:
392
+ while info_text_area is None or map_label is None:
391
393
  sleep(0.1)
392
394
  # shows the main menu
393
395
  add_text_to_textbox(info_text_area,
@@ -422,10 +424,39 @@ def update_player_info():
422
424
  info_text = get_inventory_text()
423
425
  player_info_root.after(0, lambda: player_info_label.config(text=info_text))
424
426
 
427
+ def get_map():
428
+ text = ""
429
+ if "map" in ROOMS[player.CURRENTROOM]:
430
+ text += f'\n\nKey: {"; ".join(KEY)}\n'
431
+ text += f'\n{ROOMS[player.CURRENTROOM]["map"]}\n'
432
+ else:
433
+ text += f"\nNo map available for this room."
434
+ return text
435
+
436
+ def show_map():
437
+ global map_root, map_label
438
+ map_root = tk.Tk()
439
+ map_root.title("Map")
440
+
441
+ map_text = get_map()
442
+ map_label = tk.Label(map_root, text=map_text, font=("Courier", 12), width=100, height=40)
443
+ map_label.pack()
444
+
445
+ map_root.mainloop()
446
+
447
+ def update_map():
448
+ global map_root, map_label
449
+ if map_root and map_label:
450
+ map_text = get_map()
451
+ map_root.after(0, lambda: map_label.config(text=map_text))
452
+
425
453
  def start_tkinter_thread():
426
454
  player_info_thread = threading.Thread(target=show_player_info)
427
455
  player_info_thread.daemon = True
428
456
  player_info_thread.start()
457
+ map_thread = threading.Thread(target=show_map)
458
+ map_thread.daemon = True
459
+ map_thread.start()
429
460
 
430
461
  def showStatus():
431
462
  global player
@@ -439,10 +470,11 @@ def showStatus():
439
470
  # Display possible directions of travel
440
471
  text = display_directions(text)
441
472
 
442
- # Display the map if available
443
- if "map" in ROOMS[player.CURRENTROOM]:
444
- text += f'\n\nKey: {"; ".join(KEY)}\n'
445
- text += f'\n{ROOMS[player.CURRENTROOM]["map"]}\n'
473
+ ## Display the map if available
474
+ #if "map" in ROOMS[player.CURRENTROOM]:
475
+ # text += f'\n\nKey: {"; ".join(KEY)}\n'
476
+ # text += f'\n{ROOMS[player.CURRENTROOM]["map"]}\n'
477
+ update_map()
446
478
 
447
479
  # Display the description of the current room
448
480
  text += "\n" + str(ROOMS[player.CURRENTROOM]["info"])
@@ -775,8 +807,8 @@ def select_target(chooser, targets: list):
775
807
 
776
808
 
777
809
  def command():
778
- global player
779
- #try:
810
+ global player
811
+ try:
780
812
  ShouldBreak = False
781
813
 
782
814
  while True:
@@ -807,12 +839,12 @@ def command():
807
839
  ShouldBreak = True
808
840
  if ShouldBreak:
809
841
  return
810
- #except KeyError as e:
811
- # add_text_to_textbox(info_text_area, f"KeyError: {e} - This might be due to an undefined command or incorrect arguments.")
812
- #except ValueError as e:
813
- # add_text_to_textbox(info_text_area, f"ValueError: {e} - This might be due to incorrect arguments provided.")
814
- #except Exception as e:
815
- # add_text_to_textbox(info_text_area, f"Unexpected Error: {e}")
842
+ except KeyError as e:
843
+ add_text_to_textbox(info_text_area, f"KeyError: {e} - This might be due to an undefined command or incorrect arguments.")
844
+ except ValueError as e:
845
+ add_text_to_textbox(info_text_area, f"ValueError: {e} - This might be due to incorrect arguments provided.")
846
+ except Exception as e:
847
+ add_text_to_textbox(info_text_area, f"Unexpected Error: {e}")
816
848
 
817
849
 
818
850
  def handle_sleep_command(player: PC):
@@ -1127,7 +1159,7 @@ def handle_guard_action(guard):
1127
1159
  def create_info_textbox():
1128
1160
  global info_text_area
1129
1161
  root = tk.Tk()
1130
- root.title("Text Box with Scrollbar")
1162
+ root.title("Main Window")
1131
1163
 
1132
1164
  info_text_area = scrolledtext.ScrolledText(root, wrap=tk.WORD, width=120, height=40)
1133
1165
  info_text_area.pack(padx=10, pady=10)
@@ -1270,12 +1302,12 @@ def main():
1270
1302
  # this is the initializer
1271
1303
  initializer()
1272
1304
 
1273
- # shows the instructions
1274
- start()
1275
-
1276
1305
  # starts the tkinter thread that shows the player's stats
1277
1306
  start_tkinter_thread()
1278
1307
 
1308
+ # shows the instructions
1309
+ start()
1310
+
1279
1311
  # loop forever while the player wants to play
1280
1312
  while True:
1281
1313
  command()
@@ -1377,19 +1409,6 @@ def main():
1377
1409
  if bad_guys:
1378
1410
  good_guys, bad_guys = battle(player, good_guys, bad_guys, player.LASTROOM)
1379
1411
 
1380
- # Handle NPC interactions
1381
- if "NPCs" in ROOMS[player.CURRENTROOM]:
1382
- for npcname, npcstats in ROOMS[player.CURRENTROOM]["NPCs"].items():
1383
- if (
1384
- ask_for_consent("Do you want to interact with this NPC")
1385
- or npcstats.aggressive
1386
- ):
1387
- npcstats.interact()
1388
- if npcstats.aggressive:
1389
- ROOMS[player.CURRENTROOM]["NPCs"][npcname] = battle(
1390
- player, [], [npcstats], player.LASTROOM
1391
- )[1]
1392
-
1393
1412
  player.special_ability.Tick(info_text_area)
1394
1413
  quest_manager.update_objective(f"Kill {GameState['Enemies killed']} creatures")
1395
1414
  for Item in GameState["collected items"]:
@@ -2,13 +2,11 @@ from .utils import *
2
2
  from re import *
3
3
 
4
4
 
5
- def ask_for_consent(text: str) -> bool:
5
+ def ask_for_consent(text: str, text_area) -> bool:
6
6
  while True:
7
- type_text(f"{text}? Y/N")
8
- anser = str(input(">")).lower().strip()
7
+ add_text_to_textbox(text_area, f"{text}? Y/N")
8
+ anser = loop_til_valid_input("", "That wasn't Y or N", Y_N).Value
9
9
  if anser == "y":
10
10
  return True
11
11
  elif anser == "n":
12
12
  return False
13
- else:
14
- type_text("That wasn't Y or N")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neelthee-mansion
3
- Version: 3.23.10
3
+ Version: 3.23.12
4
4
  Summary: A text-based adventure game set in Neel-thee’s mansion.
5
5
  Home-page: https://github.com/Flameblade375/neelthee_mansion
6
6
  Author: Alexander.E.F
@@ -1,16 +1,16 @@
1
1
  neelthee_mansion/Books.py,sha256=Zs6GOi12vrikne-E37LdrLNRb6CyUogOCDApDGFj6Ls,26168
2
- neelthee_mansion/Mansion_of_Amnesia.py,sha256=Ni3wgLmHh3i3XNTb1n799jzPhE0SI1ReCVAckEFSLsg,53287
2
+ neelthee_mansion/Mansion_of_Amnesia.py,sha256=SE8afkJSBE3y4HSJ7aVHrJGcYNCcuQMbjLDHKtQjvjE,53635
3
3
  neelthee_mansion/Quests.py,sha256=pUlru2RugP57MACQORZaF_X9lsbefTdPYTSO474phgo,2791
4
4
  neelthee_mansion/Rooms.py,sha256=5m1GrFNhXJMBzw2zaXM6FUt497BIoJi9BfRFvdhsy_g,79218
5
5
  neelthee_mansion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  neelthee_mansion/__main__.py,sha256=OIAWZ04le70DyjtR4hlmK9csHej7EHxeUrMoNnM-Vjc,95
7
- neelthee_mansion/all_game_utils.py,sha256=AasunTkFmgAqt9ZIoYmymi4R7leBe4ubW-C1ts0Qclo,351
7
+ neelthee_mansion/all_game_utils.py,sha256=AnDB5LOawpk0tpnda801r2hAVMFJRq5gbHWkcMjLU3k,349
8
8
  neelthee_mansion/creatures.py,sha256=XdRM5DJSnjAKXn4QskXKBf_YGvov26fX3XU1E2ww0zg,19722
9
9
  neelthee_mansion/items.py,sha256=aGEkNUROf4WuLdsmoFYD-0BbJ984SODt73-8-_F1Z9Y,6672
10
10
  neelthee_mansion/utils.py,sha256=1eIb01bsLw7emOy6PCRxyt_JswuyCPhfPS_KRl2IHds,14283
11
- neelthee_mansion-3.23.10.dist-info/LICENSE.md,sha256=CV8XGZaCyyAMdbkYFQUjb8AjBq9vkoyqdZCq1_hetms,1105
12
- neelthee_mansion-3.23.10.dist-info/METADATA,sha256=QPsQEYL7QOhs0KJ9pdY_xNdngzAULcHYMwgny767Blc,1757
13
- neelthee_mansion-3.23.10.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
14
- neelthee_mansion-3.23.10.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
15
- neelthee_mansion-3.23.10.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
16
- neelthee_mansion-3.23.10.dist-info/RECORD,,
11
+ neelthee_mansion-3.23.12.dist-info/LICENSE.md,sha256=CV8XGZaCyyAMdbkYFQUjb8AjBq9vkoyqdZCq1_hetms,1105
12
+ neelthee_mansion-3.23.12.dist-info/METADATA,sha256=Xt79KzQxg_V9a4DXoRr1qAlDeelN9_U6wM2zYlTWPtg,1757
13
+ neelthee_mansion-3.23.12.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
14
+ neelthee_mansion-3.23.12.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
15
+ neelthee_mansion-3.23.12.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
16
+ neelthee_mansion-3.23.12.dist-info/RECORD,,