neelthee-mansion 3.22.10__tar.gz → 3.23.1__tar.gz
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.
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/PKG-INFO +2 -21
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/Mansion_of_Amnesia.py +147 -148
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/items.py +14 -14
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/utils.py +13 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/PKG-INFO +3 -22
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/setup.py +1 -1
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/LICENSE.md +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/README.md +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/Books.py +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/Quests.py +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/Rooms.py +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/__init__.py +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/__main__.py +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/all_game_utils.py +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion/creatures.py +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/SOURCES.txt +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/dependency_links.txt +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/entry_points.txt +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/requires.txt +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/top_level.txt +0 -0
- {neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: neelthee_mansion
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.23.1
|
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
|
@@ -18,25 +18,6 @@ Classifier: Operating System :: OS Independent
|
|
18
18
|
Requires-Python: >=3.6
|
19
19
|
Description-Content-Type: text/markdown
|
20
20
|
License-File: LICENSE.md
|
21
|
-
Requires-Dist: wheel
|
22
|
-
Requires-Dist: psutil
|
23
|
-
Requires-Dist: playsound
|
24
|
-
Requires-Dist: requests
|
25
|
-
Requires-Dist: keyboard
|
26
|
-
Requires-Dist: pandas
|
27
|
-
Requires-Dist: validators
|
28
|
-
Requires-Dist: dicttoxml
|
29
|
-
Requires-Dist: pytz
|
30
|
-
Dynamic: author
|
31
|
-
Dynamic: author-email
|
32
|
-
Dynamic: classifier
|
33
|
-
Dynamic: description
|
34
|
-
Dynamic: description-content-type
|
35
|
-
Dynamic: home-page
|
36
|
-
Dynamic: license
|
37
|
-
Dynamic: requires-dist
|
38
|
-
Dynamic: requires-python
|
39
|
-
Dynamic: summary
|
40
21
|
|
41
22
|
# Neel-thee's Mansion of Amnesia
|
42
23
|
|
@@ -4,6 +4,7 @@ from .items import *
|
|
4
4
|
from .Quests import *
|
5
5
|
from .all_game_utils import *
|
6
6
|
import tkinter as tk
|
7
|
+
from tkinter import scrolledtext
|
7
8
|
|
8
9
|
|
9
10
|
GameState = {
|
@@ -16,10 +17,11 @@ GameState = {
|
|
16
17
|
Neel-thee's Mansion of Amnesia
|
17
18
|
"""
|
18
19
|
|
19
|
-
global player, evil_mage, commands, NOTE_NUM, credits, color_coding, quest_manager, revealer, CHARACTERSLIST, BACKGROUNDS
|
20
|
+
global player, evil_mage, commands, NOTE_NUM, credits, color_coding, quest_manager, revealer, CHARACTERSLIST, BACKGROUNDS, info_text_area
|
20
21
|
|
21
22
|
player_info_root = None
|
22
23
|
player_info_label = None
|
24
|
+
info_text_area = None
|
23
25
|
|
24
26
|
BACKGROUNDS = {
|
25
27
|
"Adventurer": ["survival", "climbing"],
|
@@ -121,7 +123,7 @@ def parse_command(command_str: str, commands: dict):
|
|
121
123
|
def showInstructions():
|
122
124
|
global player
|
123
125
|
# Display the game instructions
|
124
|
-
|
126
|
+
add_text_to_textbox(
|
125
127
|
"""
|
126
128
|
===========================
|
127
129
|
Commands:
|
@@ -138,18 +140,17 @@ help - Show these instructions
|
|
138
140
|
hint - Get a random hint for your current location
|
139
141
|
map - Display the map of places you have been to
|
140
142
|
""",
|
141
|
-
colorTrue=color_coding,
|
142
143
|
)
|
143
144
|
|
144
145
|
|
145
146
|
def showHint():
|
146
147
|
global player
|
147
148
|
if "Hints" in ROOMS[player.CURRENTROOM]:
|
148
|
-
|
149
|
+
add_text_to_textbox("You think:")
|
149
150
|
hint = choice(ROOMS[player.CURRENTROOM]["Hints"])
|
150
|
-
|
151
|
+
add_text_to_textbox(hint)
|
151
152
|
else:
|
152
|
-
|
153
|
+
add_text_to_textbox("You can't think of anything")
|
153
154
|
|
154
155
|
|
155
156
|
def check_direction(var: str, directions: list):
|
@@ -162,27 +163,25 @@ def check_direction(var: str, directions: list):
|
|
162
163
|
|
163
164
|
def End(text: str, win: bool = True):
|
164
165
|
global player
|
165
|
-
|
166
|
+
add_text_to_textbox(text)
|
166
167
|
if win:
|
167
|
-
|
168
|
+
add_text_to_textbox("Do you want to leave the game? Y/N")
|
168
169
|
while True:
|
169
|
-
leave =
|
170
|
+
leave = loop_til_valid_input("", ).lower()
|
170
171
|
if leave == "n":
|
171
|
-
|
172
|
+
add_text_to_textbox("You decide to continue exploring.")
|
172
173
|
break
|
173
174
|
elif leave == "y":
|
174
|
-
|
175
|
+
add_text_to_textbox(
|
175
176
|
"You escaped the house... %*BOLD*%GAME OVER, YOU WIN!",
|
176
|
-
colorTrue=color_coding,
|
177
177
|
)
|
178
178
|
commands["quit"]()
|
179
179
|
else:
|
180
|
-
|
180
|
+
add_text_to_textbox(
|
181
181
|
"Sorry, that wasn't 'y' or 'n'. Please enter 'y' or 'n'.",
|
182
|
-
colorTrue=color_coding,
|
183
182
|
)
|
184
183
|
else:
|
185
|
-
|
184
|
+
add_text_to_textbox("%*BOLD*%GAME OVER, YOU LOSE!")
|
186
185
|
commands["quit"]()
|
187
186
|
|
188
187
|
|
@@ -206,32 +205,28 @@ def Use_grappling_hook():
|
|
206
205
|
|
207
206
|
def swing_into_forest():
|
208
207
|
global player
|
209
|
-
|
210
|
-
"You throw your grappling-hook, it catches a branch of a nearby tree and hooks back onto itself. \nYou can swing into the forest!"
|
211
|
-
colorTrue=color_coding,
|
208
|
+
add_text_to_textbox(
|
209
|
+
"You throw your grappling-hook, it catches a branch of a nearby tree and hooks back onto itself. \nYou can swing into the forest!"
|
212
210
|
)
|
213
211
|
if ask_for_consent("Do you want to swing into the forest"):
|
214
|
-
|
212
|
+
add_text_to_textbox("You swing into the forest")
|
215
213
|
Move("Forest Clearing")
|
216
214
|
else:
|
217
|
-
|
218
|
-
"You flick the rope and it unhooks. You continue exploring the house."
|
219
|
-
colorTrue=color_coding,
|
215
|
+
add_text_to_textbox(
|
216
|
+
"You flick the rope and it unhooks. You continue exploring the house."
|
220
217
|
)
|
221
218
|
|
222
219
|
def climb_into_house():
|
223
220
|
global player
|
224
|
-
|
225
|
-
"You throw your grappling-hook, it catches the railing of the nearby house and hooks back onto itself. \nYou can climb into the house!"
|
226
|
-
colorTrue=color_coding,
|
221
|
+
add_text_to_textbox(
|
222
|
+
"You throw your grappling-hook, it catches the railing of the nearby house and hooks back onto itself. \nYou can climb into the house!"
|
227
223
|
)
|
228
224
|
if ask_for_consent("Do you want to climb into the house"):
|
229
|
-
|
225
|
+
add_text_to_textbox("You climb into the house")
|
230
226
|
Move("Balcony")
|
231
227
|
else:
|
232
|
-
|
233
|
-
"You flick the rope and it unhooks. You continue exploring the forest"
|
234
|
-
colorTrue=color_coding,
|
228
|
+
add_text_to_textbox(
|
229
|
+
"You flick the rope and it unhooks. You continue exploring the forest"
|
235
230
|
)
|
236
231
|
|
237
232
|
if player.CURRENTROOM == "Balcony" and "grappling-hook" in player.inventory:
|
@@ -247,17 +242,16 @@ def Use_quill():
|
|
247
242
|
|
248
243
|
if all(item in player.inventory for item in ["ink-pot", "parchment", "quill"]):
|
249
244
|
parchment_index = player.inventory.index("parchment")
|
250
|
-
|
245
|
+
add_text_to_textbox("What do you want to write")
|
251
246
|
write = str(input(">")).strip()
|
252
247
|
|
253
248
|
if write:
|
254
249
|
add_note(write, parchment_index)
|
255
250
|
else:
|
256
|
-
|
251
|
+
add_text_to_textbox("You can't write nothing")
|
257
252
|
else:
|
258
|
-
|
259
|
-
"You need an ink pot, parchment, and a quill to write."
|
260
|
-
colorTrue=color_coding,
|
253
|
+
add_text_to_textbox(
|
254
|
+
"You need an ink pot, parchment, and a quill to write."
|
261
255
|
)
|
262
256
|
|
263
257
|
|
@@ -267,10 +261,10 @@ def Use_note(note_number):
|
|
267
261
|
note_key = f"note {note_number}"
|
268
262
|
if note_key in player.inventory:
|
269
263
|
note_index = int(note_number) - 1
|
270
|
-
|
271
|
-
|
264
|
+
add_text_to_textbox(f"You read:")
|
265
|
+
add_text_to_textbox(player.NOTES[note_index])
|
272
266
|
else:
|
273
|
-
|
267
|
+
add_text_to_textbox("You do not have that note")
|
274
268
|
|
275
269
|
|
276
270
|
def Use(*Args):
|
@@ -283,8 +277,8 @@ def Use(*Args):
|
|
283
277
|
item_obj = player.inventory[player.inventory.index(Item)]
|
284
278
|
if isinstance(item_obj, item):
|
285
279
|
if item_obj.sell(player):
|
286
|
-
|
287
|
-
f"You sell the %*BLUE*%{Item}%*RESET*%"
|
280
|
+
add_text_to_textbox(
|
281
|
+
f"You sell the %*BLUE*%{Item}%*RESET*%"
|
288
282
|
)
|
289
283
|
player.inventory.remove(item_obj.name)
|
290
284
|
elif Item == "quill":
|
@@ -305,13 +299,13 @@ def PickKey(locked_obj):
|
|
305
299
|
|
306
300
|
if keys:
|
307
301
|
while True:
|
308
|
-
|
302
|
+
add_text_to_textbox(
|
309
303
|
f"Please pick which key you want to use in the lock. This is what you know about the lock: {locked_obj}. These are your keys:"
|
310
304
|
)
|
311
305
|
|
312
306
|
# Enumerate keys and display them
|
313
307
|
for idx, key in enumerate(keys, 1): # Starts numbering at 1
|
314
|
-
|
308
|
+
add_text_to_textbox(f"{idx}. {key.name} - {key.CurentRevealStr}")
|
315
309
|
|
316
310
|
# Use loop_til_valid_input to get a valid integer within the correct range
|
317
311
|
choice = loop_til_valid_input(
|
@@ -338,8 +332,8 @@ def Move(move):
|
|
338
332
|
ROOMS[newRoom]["descovered"] = True
|
339
333
|
return ROOMS[player.CURRENTROOM]["directions"][move]
|
340
334
|
else:
|
341
|
-
|
342
|
-
"You don't have enough money to charter a ship."
|
335
|
+
add_text_to_textbox(
|
336
|
+
"You don't have enough money to charter a ship."
|
343
337
|
)
|
344
338
|
return player.CURRENTROOM
|
345
339
|
|
@@ -349,7 +343,7 @@ def Move(move):
|
|
349
343
|
if key.GetKeyCode() == "629.IdnXwnt":
|
350
344
|
End("You unlock the gate to the garden with the key!")
|
351
345
|
return newRoom
|
352
|
-
|
346
|
+
add_text_to_textbox("The gate is locked.")
|
353
347
|
return newRoom
|
354
348
|
|
355
349
|
def move_to_room():
|
@@ -389,15 +383,17 @@ def Move(move):
|
|
389
383
|
if isinstance(randomEvent, RandomEvent):
|
390
384
|
randomEvent.check_and_trigger(player)
|
391
385
|
return
|
392
|
-
|
386
|
+
add_text_to_textbox(f"There is no exit {move}")
|
393
387
|
|
394
388
|
|
395
389
|
def start():
|
396
|
-
global player
|
390
|
+
global player, info_text_area
|
391
|
+
# Wait until info_text_area is initialized
|
392
|
+
while info_text_area is None:
|
393
|
+
time.sleep(0.1)
|
397
394
|
# shows the main menu
|
398
|
-
|
395
|
+
add_text_to_textbox(
|
399
396
|
f"\nHello %*MAGENTA*%{player.name}%*RESET*% and welcome to my Role Playing Game. \nI hope you have fun!",
|
400
|
-
colorTrue=color_coding,
|
401
397
|
)
|
402
398
|
showInstructions()
|
403
399
|
|
@@ -455,14 +451,14 @@ def showStatus():
|
|
455
451
|
|
456
452
|
text += f"\n---------------------------"
|
457
453
|
|
458
|
-
|
454
|
+
add_text_to_textbox(text)
|
459
455
|
|
460
456
|
# Optionally display additional room description
|
461
457
|
if "description" in ROOMS[player.CURRENTROOM] and ask_for_consent(
|
462
458
|
"Do you want to observe the area"
|
463
459
|
):
|
464
|
-
|
465
|
-
|
460
|
+
add_text_to_textbox("The area:")
|
461
|
+
add_text_to_textbox(ROOMS[player.CURRENTROOM]["description"])
|
466
462
|
|
467
463
|
|
468
464
|
def display_directions(text):
|
@@ -515,27 +511,27 @@ def Examine(*Args):
|
|
515
511
|
if item_index is not None: # Check explicitly if item_index is valid
|
516
512
|
_ = player.inventory[item_index]
|
517
513
|
if isinstance(_, item):
|
518
|
-
|
514
|
+
add_text_to_textbox("You look at your item and you figure out this about it:")
|
519
515
|
if not revealer.reveal_key_code(_):
|
520
516
|
if _.type == "weapon":
|
521
|
-
|
517
|
+
add_text_to_textbox(f"This item is a weapon that adds {_.value} damage.")
|
522
518
|
elif _.type == "readable":
|
523
519
|
if "reading" in player.Skills:
|
524
|
-
|
520
|
+
add_text_to_textbox(f"You read {_.name} and it contains:")
|
525
521
|
if isinstance(_, Book):
|
526
|
-
|
522
|
+
add_text_to_textbox(_.GetContense())
|
527
523
|
else:
|
528
|
-
|
524
|
+
add_text_to_textbox(_.value)
|
529
525
|
elif isinstance(_, Recorder):
|
530
|
-
|
531
|
-
|
526
|
+
add_text_to_textbox("This device records sound. The current message is:")
|
527
|
+
add_text_to_textbox(_.message)
|
532
528
|
else:
|
533
|
-
|
529
|
+
add_text_to_textbox(_.value)
|
534
530
|
elif Name in ROOMS[player.CURRENTROOM]["directions"]: # Check exits in the room
|
535
531
|
door = ROOMS[player.CURRENTROOM]["directions"][Name]
|
536
532
|
if isinstance(door, Door):
|
537
533
|
if isinstance(door.lock, Lock):
|
538
|
-
|
534
|
+
add_text_to_textbox(
|
539
535
|
(
|
540
536
|
"The door is locked,"
|
541
537
|
if door.lock.is_locked
|
@@ -545,14 +541,14 @@ def Examine(*Args):
|
|
545
541
|
)
|
546
542
|
revealer.reveal_key_code(door)
|
547
543
|
else:
|
548
|
-
|
544
|
+
add_text_to_textbox(f"The exit {Name} has no lock.")
|
549
545
|
else:
|
550
|
-
|
546
|
+
add_text_to_textbox(f"There is nothing special about the exit {Name}.")
|
551
547
|
elif "containers" in ROOMS[player.CURRENTROOM] and Name in ROOMS[player.CURRENTROOM]["containers"]:
|
552
548
|
containerins = ROOMS[player.CURRENTROOM]["containers"][Name]
|
553
549
|
if isinstance(containerins, container):
|
554
550
|
if isinstance(containerins.lock, Lock):
|
555
|
-
|
551
|
+
add_text_to_textbox(
|
556
552
|
(
|
557
553
|
"The container is locked,"
|
558
554
|
if containerins.lock.is_locked
|
@@ -562,9 +558,9 @@ def Examine(*Args):
|
|
562
558
|
)
|
563
559
|
revealer.reveal_key_code(containerins)
|
564
560
|
else:
|
565
|
-
|
561
|
+
add_text_to_textbox(f"The container {Name} has no lock.")
|
566
562
|
else:
|
567
|
-
|
563
|
+
add_text_to_textbox(f"There is no container named {Name} in this room.")
|
568
564
|
elif "creatures stats" in ROOMS[player.CURRENTROOM]:
|
569
565
|
for Creature in ROOMS[player.CURRENTROOM]["creatures stats"]:
|
570
566
|
if isinstance(Creature, creature):
|
@@ -573,7 +569,7 @@ def Examine(*Args):
|
|
573
569
|
Creature.talk()
|
574
570
|
return
|
575
571
|
else:
|
576
|
-
|
572
|
+
add_text_to_textbox(f"There is nothing special about the {Name}.")
|
577
573
|
|
578
574
|
|
579
575
|
def battle(player: PC, good_guys: list, bad_guys: list, last_room):
|
@@ -638,7 +634,7 @@ def player_turn(player: PC, monster: creature):
|
|
638
634
|
perform_attack(player, monster)
|
639
635
|
elif player_action == "defend":
|
640
636
|
player.defending = True
|
641
|
-
|
637
|
+
add_text_to_textbox("You brace yourself for the next attack.")
|
642
638
|
elif player_action == "special":
|
643
639
|
use_special_ability(player, monster)
|
644
640
|
|
@@ -651,7 +647,7 @@ def monster_turn(player: PC, monster: creature):
|
|
651
647
|
player (PC): The player or ally.
|
652
648
|
monster (creature): The monster attacking.
|
653
649
|
"""
|
654
|
-
|
650
|
+
add_text_to_textbox(f"The %*CYAN*%{monster.name}%*RESET*% attacks!")
|
655
651
|
damage = calculate_damage(monster, player)
|
656
652
|
player.take_damage(damage)
|
657
653
|
|
@@ -676,7 +672,7 @@ def handle_victory(player: PC, monsters: list):
|
|
676
672
|
player (PC): The player character.
|
677
673
|
monsters (list): The list of defeated monsters.
|
678
674
|
"""
|
679
|
-
|
675
|
+
add_text_to_textbox("You have defeated all the enemies!")
|
680
676
|
for monster in monsters:
|
681
677
|
if monster.hp <= 0:
|
682
678
|
player.inventory_add(monster.dropped_items)
|
@@ -698,11 +694,11 @@ def calculate_damage(attacker, defender) -> int:
|
|
698
694
|
|
699
695
|
if random() < attacker.crit_chance:
|
700
696
|
damage *= 2
|
701
|
-
|
697
|
+
add_text_to_textbox("Critical hit!")
|
702
698
|
|
703
699
|
if hasattr(defender, "defending") and defender.defending:
|
704
700
|
damage //= 2
|
705
|
-
|
701
|
+
add_text_to_textbox("The attack is defended, reducing damage.")
|
706
702
|
defender.defending = False
|
707
703
|
|
708
704
|
return damage
|
@@ -735,13 +731,12 @@ def use_special_ability(player: PC, monster: creature):
|
|
735
731
|
"""
|
736
732
|
if player.special_ability.ready:
|
737
733
|
player.special_ability.activate(monster)
|
738
|
-
|
739
|
-
f"You use your special ability: {player.special_ability.name}."
|
740
|
-
colorTrue=color_coding,
|
734
|
+
add_text_to_textbox(
|
735
|
+
f"You use your special ability: {player.special_ability.name}."
|
741
736
|
)
|
742
737
|
player.special_ability.ready = False
|
743
738
|
else:
|
744
|
-
|
739
|
+
add_text_to_textbox("Your special ability is not ready yet.")
|
745
740
|
|
746
741
|
|
747
742
|
def select_target(chooser, targets: list):
|
@@ -757,11 +752,11 @@ def select_target(chooser, targets: list):
|
|
757
752
|
"""
|
758
753
|
if chooser == player:
|
759
754
|
valid_targets = []
|
760
|
-
|
755
|
+
add_text_to_textbox("Who do you want to attack? The options:")
|
761
756
|
# Enumerate through the targets to get both the index and the enemy.
|
762
757
|
for index, enemy in enumerate(targets):
|
763
758
|
if enemy.hp > 0:
|
764
|
-
|
759
|
+
add_text_to_textbox(f"{index + 1}: {enemy.name} ({enemy.hp} HP)")
|
765
760
|
valid_targets.append(index)
|
766
761
|
|
767
762
|
# Prompt the player to select a target
|
@@ -771,9 +766,9 @@ def select_target(chooser, targets: list):
|
|
771
766
|
if choice in valid_targets:
|
772
767
|
return targets[choice]
|
773
768
|
else:
|
774
|
-
|
769
|
+
add_text_to_textbox("Invalid choice. Please select a valid target.")
|
775
770
|
except ValueError:
|
776
|
-
|
771
|
+
add_text_to_textbox("Invalid input. Please enter a number.")
|
777
772
|
else:
|
778
773
|
# AI or other logic for non-player chooser
|
779
774
|
for target in targets:
|
@@ -806,24 +801,24 @@ def command():
|
|
806
801
|
else:
|
807
802
|
commands[action]()
|
808
803
|
else:
|
809
|
-
|
804
|
+
add_text_to_textbox(
|
810
805
|
f"Unknown command '{action}'. Type 'help' for a list of commands.",
|
811
|
-
|
806
|
+
|
812
807
|
)
|
813
808
|
if action in commands:
|
814
809
|
ShouldBreak = True
|
815
810
|
if ShouldBreak:
|
816
811
|
return
|
817
812
|
#except KeyError as e:
|
818
|
-
#
|
813
|
+
# add_text_to_textbox(f"KeyError: {e} - This might be due to an undefined command or incorrect arguments.")
|
819
814
|
#except ValueError as e:
|
820
|
-
#
|
815
|
+
# add_text_to_textbox(f"ValueError: {e} - This might be due to incorrect arguments provided.")
|
821
816
|
#except Exception as e:
|
822
|
-
#
|
817
|
+
# add_text_to_textbox(f"Unexpected Error: {e}")
|
823
818
|
|
824
819
|
|
825
820
|
def handle_sleep_command(player: PC):
|
826
|
-
|
821
|
+
add_text_to_textbox("You decide to rest for a while.")
|
827
822
|
|
828
823
|
# Simulate some time passing
|
829
824
|
sleep(2) # Example: sleep for 2 seconds
|
@@ -832,7 +827,7 @@ def handle_sleep_command(player: PC):
|
|
832
827
|
player.heal(3) # Example: heal 3 health points during sleep
|
833
828
|
|
834
829
|
# Optional: Print a message or effect that happens during sleep
|
835
|
-
|
830
|
+
add_text_to_textbox("You feel refreshed after a good rest.")
|
836
831
|
|
837
832
|
|
838
833
|
def get_player_input(split=True):
|
@@ -857,29 +852,27 @@ def handle_get_command(player: PC, *Args):
|
|
857
852
|
if item_name == ItemName:
|
858
853
|
player.inventory_add([ROOMS[player.CURRENTROOM]["items"][ItemName]])
|
859
854
|
del ROOMS[player.CURRENTROOM]["items"][ItemName]
|
860
|
-
|
855
|
+
add_text_to_textbox(f"%*BLUE*%{item_name}%*RESET*% got!")
|
861
856
|
return
|
862
|
-
|
857
|
+
add_text_to_textbox(f"Can't get {item_name}!")
|
863
858
|
|
864
859
|
|
865
860
|
def handle_look_command():
|
866
861
|
global player
|
867
862
|
should_return = False
|
868
863
|
if "items" in ROOMS[player.CURRENTROOM]:
|
869
|
-
|
870
|
-
f'The items in the room: %*BLUE*%{", ".join(ROOMS[player.CURRENTROOM]["items"].keys())}%*RESET*%.'
|
871
|
-
colorTrue=color_coding,
|
864
|
+
add_text_to_textbox(
|
865
|
+
f'The items in the room: %*BLUE*%{", ".join(ROOMS[player.CURRENTROOM]["items"].keys())}%*RESET*%.'
|
872
866
|
)
|
873
867
|
should_return = True
|
874
868
|
if "containers" in ROOMS[player.CURRENTROOM]:
|
875
|
-
|
876
|
-
f"The containers here are: %*RED*%{', '.join(ROOMS[player.CURRENTROOM]['containers'].keys())}%*RESET*%"
|
877
|
-
colorTrue=color_coding,
|
869
|
+
add_text_to_textbox(
|
870
|
+
f"The containers here are: %*RED*%{', '.join(ROOMS[player.CURRENTROOM]['containers'].keys())}%*RESET*%"
|
878
871
|
)
|
879
872
|
should_return = True
|
880
873
|
if should_return:
|
881
874
|
return
|
882
|
-
|
875
|
+
add_text_to_textbox("There is nothing of interest.")
|
883
876
|
|
884
877
|
|
885
878
|
def handle_use_command(*Args):
|
@@ -895,7 +888,7 @@ def handle_search_command(player, *Args):
|
|
895
888
|
):
|
896
889
|
search_container(player, Container)
|
897
890
|
else:
|
898
|
-
|
891
|
+
add_text_to_textbox(f"You cannot search the {Container}")
|
899
892
|
|
900
893
|
|
901
894
|
def search_container(player: PC, Container):
|
@@ -905,10 +898,9 @@ def search_container(player: PC, Container):
|
|
905
898
|
if isinstance(Container.lock, Lock):
|
906
899
|
key = PickKey(Container.lock)
|
907
900
|
Container.Unlock(key, player)
|
908
|
-
|
901
|
+
add_text_to_textbox(
|
909
902
|
f"You search the{' secret' if Container.secret else ''} %*RED*%{ContainerName}%*RESET*% and find a ",
|
910
|
-
newline=False
|
911
|
-
colorTrue=color_coding,
|
903
|
+
newline=False
|
912
904
|
)
|
913
905
|
for searchitem in Container.contents:
|
914
906
|
if searchitem:
|
@@ -919,23 +911,38 @@ def search_container(player: PC, Container):
|
|
919
911
|
< last_index(Container.contents)
|
920
912
|
else "\n"
|
921
913
|
)
|
922
|
-
|
914
|
+
add_text_to_textbox(
|
923
915
|
f"%*BLUE*%{searchitem.name}%*RESET*%{end_str}",
|
924
916
|
newline=False,
|
925
|
-
|
917
|
+
|
926
918
|
)
|
927
919
|
Container.take_contents(player)
|
928
920
|
|
929
921
|
|
922
|
+
def put_in_container(player: PC, PutItem=None, container=None):
|
923
|
+
player.inventory.remove(PutItem.name)
|
924
|
+
if not ROOMS[player.CURRENTROOM]["containers"][container].contents:
|
925
|
+
ROOMS[player.CURRENTROOM]["containers"][container].contents = []
|
926
|
+
if not isinstance(
|
927
|
+
ROOMS[player.CURRENTROOM]["containers"][container].contents, list
|
928
|
+
):
|
929
|
+
ROOMS[player.CURRENTROOM]["containers"][container].contents = [
|
930
|
+
ROOMS[player.CURRENTROOM]["containers"][container].contents
|
931
|
+
]
|
932
|
+
ROOMS[player.CURRENTROOM]["containers"][container].contents += [PutItem]
|
933
|
+
add_text_to_textbox(
|
934
|
+
f"You put you're %*BLUE*%{PutItem.name}%*RESET*% into the %*RED*%{container}%*RESET*%",
|
935
|
+
)
|
936
|
+
|
937
|
+
|
930
938
|
def handle_put_command(player: PC, *Args):
|
931
939
|
arguments = " ".join(Args)
|
932
940
|
Arguments = arguments.split(" in ")
|
933
941
|
|
934
942
|
# Ensure we have exactly two parts
|
935
943
|
if len(Arguments) < 2:
|
936
|
-
|
937
|
-
"You need to specify an item and where to put it (e.g., 'put book
|
938
|
-
colorTrue=color_coding,
|
944
|
+
add_text_to_textbox(
|
945
|
+
"You need to specify an item and where to put it (e.g., 'put book drawer')."
|
939
946
|
)
|
940
947
|
return
|
941
948
|
|
@@ -946,8 +953,8 @@ def handle_put_command(player: PC, *Args):
|
|
946
953
|
|
947
954
|
# Check if item is in inventory
|
948
955
|
if item_name not in [item.name for item in player.inventory]:
|
949
|
-
|
950
|
-
f"You don't have {item_name} in your inventory."
|
956
|
+
add_text_to_textbox(
|
957
|
+
f"You don't have {item_name} in your inventory."
|
951
958
|
)
|
952
959
|
return
|
953
960
|
|
@@ -958,29 +965,11 @@ def handle_put_command(player: PC, *Args):
|
|
958
965
|
if "containers" in ROOMS[player.CURRENTROOM]:
|
959
966
|
put_in_container(player, PutItem, container_name)
|
960
967
|
else:
|
961
|
-
|
962
|
-
f"You cannot put the {PutItem.name} in the {container_name}"
|
963
|
-
colorTrue=color_coding,
|
968
|
+
add_text_to_textbox(
|
969
|
+
f"You cannot put the {PutItem.name} in the {container_name}"
|
964
970
|
)
|
965
971
|
|
966
972
|
|
967
|
-
def put_in_container(player: PC, PutItem=None, container=None):
|
968
|
-
player.inventory.remove(PutItem.name)
|
969
|
-
if not ROOMS[player.CURRENTROOM]["containers"][container].contents:
|
970
|
-
ROOMS[player.CURRENTROOM]["containers"][container].contents = []
|
971
|
-
if not isinstance(
|
972
|
-
ROOMS[player.CURRENTROOM]["containers"][container].contents, list
|
973
|
-
):
|
974
|
-
ROOMS[player.CURRENTROOM]["containers"][container].contents = [
|
975
|
-
ROOMS[player.CURRENTROOM]["containers"][container].contents
|
976
|
-
]
|
977
|
-
ROOMS[player.CURRENTROOM]["containers"][container].contents += [PutItem]
|
978
|
-
type_text(
|
979
|
-
f"You put you're %*BLUE*%{PutItem.name}%*RESET*% into the %*RED*%{container}%*RESET*%",
|
980
|
-
colorTrue=color_coding,
|
981
|
-
)
|
982
|
-
|
983
|
-
|
984
973
|
def handle_get_quest_command(questnum):
|
985
974
|
global player
|
986
975
|
if "quests" in ROOMS[player.CURRENTROOM]:
|
@@ -992,7 +981,7 @@ def handle_get_quest_command(questnum):
|
|
992
981
|
|
993
982
|
def PrintMap():
|
994
983
|
global player
|
995
|
-
|
984
|
+
add_text_to_textbox(ShowMap())
|
996
985
|
|
997
986
|
|
998
987
|
# Define handling functions for different types of enemies
|
@@ -1002,9 +991,8 @@ def handle_hungry_bear(player: PC, enemy: creature):
|
|
1002
991
|
if ask_for_consent("Do you want to throw your potion at the bear"):
|
1003
992
|
enemy_reacting = False
|
1004
993
|
del player.inventory[player.inventory.index("potion")]
|
1005
|
-
|
1006
|
-
f"You throw the potion at the bear and it explodes into a puff of magic smoke that stuns the bear!"
|
1007
|
-
colorTrue=color_coding,
|
994
|
+
add_text_to_textbox(
|
995
|
+
f"You throw the potion at the bear and it explodes into a puff of magic smoke that stuns the bear!"
|
1008
996
|
)
|
1009
997
|
if enemy_reacting:
|
1010
998
|
return [enemy, enemy_reacting]
|
@@ -1015,9 +1003,8 @@ def handle_grumpy_pig(player: PC, enemy: creature):
|
|
1015
1003
|
if "saddle" in player.inventory and "pig-rod" in player.inventory:
|
1016
1004
|
if ask_for_consent("Do you want to use your saddle and pig-rod on the pig"):
|
1017
1005
|
enemy_reacting = False
|
1018
|
-
|
1019
|
-
f"You throw a saddle onto the pig and leap on steering it about with a pig fishing rod!"
|
1020
|
-
colorTrue=color_coding,
|
1006
|
+
add_text_to_textbox(
|
1007
|
+
f"You throw a saddle onto the pig and leap on steering it about with a pig fishing rod!"
|
1021
1008
|
)
|
1022
1009
|
del ROOMS[player.CURRENTROOM]["creatures stats"]
|
1023
1010
|
del player.inventory[player.inventory.index("saddle")]
|
@@ -1027,9 +1014,8 @@ def handle_grumpy_pig(player: PC, enemy: creature):
|
|
1027
1014
|
if "torch" in player.inventory:
|
1028
1015
|
if ask_for_consent("Do you want to use your torch to scare the pig away"):
|
1029
1016
|
enemy_reacting = False
|
1030
|
-
|
1031
|
-
f"You wave your torch at the pig and it runs away through a tiny open window."
|
1032
|
-
colorTrue=color_coding,
|
1017
|
+
add_text_to_textbox(
|
1018
|
+
f"You wave your torch at the pig and it runs away through a tiny open window."
|
1033
1019
|
)
|
1034
1020
|
del ROOMS[player.CURRENTROOM]["creatures stats"][
|
1035
1021
|
ROOMS[player.CURRENTROOM]["creatures stats"].index(enemy)
|
@@ -1038,9 +1024,8 @@ def handle_grumpy_pig(player: PC, enemy: creature):
|
|
1038
1024
|
if "rations" in player.inventory:
|
1039
1025
|
if ask_for_consent("Do you want to throw your ration at the pig"):
|
1040
1026
|
enemy_reacting = False
|
1041
|
-
|
1042
|
-
f"You quickly throw rations at the pig. It still doesn't look happy though."
|
1043
|
-
colorTrue=color_coding,
|
1027
|
+
add_text_to_textbox(
|
1028
|
+
f"You quickly throw rations at the pig. It still doesn't look happy though."
|
1044
1029
|
)
|
1045
1030
|
del player.inventory[player.inventory.index("rations")]
|
1046
1031
|
player.xp += 15
|
@@ -1054,9 +1039,8 @@ def handle_greedy_goblin(player: PC, enemy: creature):
|
|
1054
1039
|
if player.money >= 15:
|
1055
1040
|
if ask_for_consent("Do you want to pay the goblin to not attack you"):
|
1056
1041
|
enemy_reacting = False
|
1057
|
-
|
1058
|
-
f"You pay the {enemy.name} to not attack you for now, but he says you should run."
|
1059
|
-
colorTrue=color_coding,
|
1042
|
+
add_text_to_textbox(
|
1043
|
+
f"You pay the {enemy.name} to not attack you for now, but he says you should run."
|
1060
1044
|
)
|
1061
1045
|
player.money -= 15
|
1062
1046
|
enemy.dropped_items[1].value += 15
|
@@ -1116,9 +1100,8 @@ def handle_wolf(player: PC, wolf: Guard):
|
|
1116
1100
|
if "rations" in player.inventory:
|
1117
1101
|
if ask_for_consent("Do you want to give your ration to the wolf"):
|
1118
1102
|
enemy_reacting = False
|
1119
|
-
|
1120
|
-
"You quickly give your rations to the wolf. It looks happy, walks up to you, and nuzzles you."
|
1121
|
-
colorTrue=color_coding,
|
1103
|
+
add_text_to_textbox(
|
1104
|
+
"You quickly give your rations to the wolf. It looks happy, walks up to you, and nuzzles you."
|
1122
1105
|
)
|
1123
1106
|
player.inventory.remove("rations")
|
1124
1107
|
wolf.patrol_type = "follow"
|
@@ -1143,9 +1126,22 @@ def handle_guard_action(guard):
|
|
1143
1126
|
return [False, [guard, True]] # Function was not found
|
1144
1127
|
|
1145
1128
|
|
1129
|
+
def create_info_textbox():
|
1130
|
+
global info_text_area
|
1131
|
+
root = tk.Tk()
|
1132
|
+
root.title("Text Box with Scrollbar")
|
1133
|
+
|
1134
|
+
info_text_area = scrolledtext.ScrolledText(root, wrap=tk.WORD, width=120, height=40)
|
1135
|
+
info_text_area.pack(padx=10, pady=10)
|
1136
|
+
|
1137
|
+
# Set the text box to read-only
|
1138
|
+
info_text_area.config(state=tk.DISABLED)
|
1139
|
+
|
1140
|
+
root.mainloop()
|
1141
|
+
|
1142
|
+
|
1146
1143
|
def initializer():
|
1147
1144
|
global color_coding, player, CHARACTERSLIST
|
1148
|
-
df = pd.DataFrame(CHARACTERSLIST)
|
1149
1145
|
|
1150
1146
|
# A tkinter window that asks these questions, instead of the console.Include a button that says "Exit Game". When the button is clicked, the game exits. Include a button that says "premade character". When the button is clicked, a new window opens that lets you choose one of the premade characters from teh CHARACTERSLIST var. Include a button that says "custom character". When the button is clicked, a new window opens that asks them for a name, age, hight, and waight(LBs).
|
1151
1147
|
def create_main_menu():
|
@@ -1278,6 +1274,9 @@ def initializer():
|
|
1278
1274
|
|
1279
1275
|
create_main_menu()
|
1280
1276
|
|
1277
|
+
info_text_thread = threading.Thread(target=create_info_textbox, daemon=True, name="Info Text Box Thread")
|
1278
|
+
info_text_thread.start()
|
1279
|
+
|
1281
1280
|
|
1282
1281
|
def main():
|
1283
1282
|
global player, color_coding
|
@@ -1351,11 +1350,11 @@ def main():
|
|
1351
1350
|
if isinstance(enemy, creature):
|
1352
1351
|
if not isinstance(enemy, NPC):
|
1353
1352
|
if enemy.hp > 0:
|
1354
|
-
enemy.
|
1353
|
+
enemy.add_text_to_textbox_flavor_text()
|
1355
1354
|
if ask_for_consent(
|
1356
1355
|
f"Do you want to examine the {enemy.name}"
|
1357
1356
|
):
|
1358
|
-
enemy.
|
1357
|
+
enemy.add_text_to_textbox_description()
|
1359
1358
|
|
1360
1359
|
is_reacting = False
|
1361
1360
|
|
@@ -24,7 +24,7 @@ class Lock:
|
|
24
24
|
self.key_code = key_code if key_code else get_random_string(10)
|
25
25
|
self.is_locked = True
|
26
26
|
|
27
|
-
def unlock(self, key, player):
|
27
|
+
def unlock(self, key, player, text_area=None):
|
28
28
|
if not self.is_locked:
|
29
29
|
do_lock = loop_til_valid_input(
|
30
30
|
"The lock is not locked, do you want to lock it again? Y/N",
|
@@ -32,21 +32,21 @@ class Lock:
|
|
32
32
|
Y_N,
|
33
33
|
).value
|
34
34
|
if do_lock:
|
35
|
-
|
35
|
+
add_text_to_textbox(text_area, "You relock the lock")
|
36
36
|
return False
|
37
37
|
|
38
38
|
elif key.GetKeyCode() == self.key_code:
|
39
|
-
|
39
|
+
add_text_to_textbox(text_area, "The lock clicks open!")
|
40
40
|
self.is_locked = False
|
41
41
|
if key.KeyDels:
|
42
42
|
player.inventory.remove(key)
|
43
|
-
|
43
|
+
add_text_to_textbox(
|
44
44
|
f"The {key.name} was used and has been removed from your inventory."
|
45
45
|
)
|
46
46
|
return True
|
47
47
|
|
48
48
|
else:
|
49
|
-
|
49
|
+
add_text_to_textbox(text_area, "The lock holds fast!")
|
50
50
|
return False
|
51
51
|
|
52
52
|
def __str__(self) -> str:
|
@@ -68,11 +68,11 @@ class KeyRevealer:
|
|
68
68
|
def __init__(self, max_reveals=2):
|
69
69
|
self.max_reveals = max_reveals
|
70
70
|
|
71
|
-
def reveal_key_code(self, obj: Key, mask_char="="):
|
71
|
+
def reveal_key_code(self, obj: Key, mask_char="=", text_area=None):
|
72
72
|
if hasattr(obj, "reveal_count"):
|
73
73
|
if obj.reveal_count >= self.max_reveals:
|
74
|
-
|
75
|
-
|
74
|
+
add_text_to_textbox(text_area, f"You can only reveal a Key Code {self.max_reveals} times.")
|
75
|
+
add_text_to_textbox(text_area,
|
76
76
|
f"Here is what you already know about this lock: {obj.CurentRevealStr}"
|
77
77
|
)
|
78
78
|
return
|
@@ -103,7 +103,7 @@ class KeyRevealer:
|
|
103
103
|
|
104
104
|
obj.reveal_count += 1
|
105
105
|
obj.CurentRevealStr = "".join(result)
|
106
|
-
|
106
|
+
add_text_to_textbox(text_area, "".join(result))
|
107
107
|
return True
|
108
108
|
|
109
109
|
|
@@ -174,9 +174,9 @@ class container:
|
|
174
174
|
"=" * len(self.lock.key_code) if isinstance(self.lock, Lock) else ""
|
175
175
|
)
|
176
176
|
|
177
|
-
def take_contents(self, geter=None):
|
177
|
+
def take_contents(self, geter=None, text_area=None):
|
178
178
|
if isinstance(self.lock, Lock) and self.lock.is_locked:
|
179
|
-
|
179
|
+
add_text_to_textbox(text_area, "The container is locked and won't budge.")
|
180
180
|
return None
|
181
181
|
|
182
182
|
try:
|
@@ -203,9 +203,9 @@ class Recorder(item):
|
|
203
203
|
def __str__(self):
|
204
204
|
return self.record if self.record else "This recorder has no record on it."
|
205
205
|
|
206
|
-
def Record(self):
|
207
|
-
|
208
|
-
message =
|
206
|
+
def Record(self, text_area=None):
|
207
|
+
add_text_to_textbox(text_area, "What record do you want to put on the recorder? \n>", newline=False)
|
208
|
+
message = loop_til_valid_input()
|
209
209
|
self.message = message
|
210
210
|
|
211
211
|
def use(self):
|
@@ -14,6 +14,8 @@ try:
|
|
14
14
|
|
15
15
|
# Importing the whole module
|
16
16
|
import pickle as pk
|
17
|
+
import tkinter as tk
|
18
|
+
from tkinter import scrolledtext
|
17
19
|
import inspect
|
18
20
|
import threading
|
19
21
|
import json
|
@@ -45,6 +47,17 @@ These utilities aim to simplify development processes, promote code reuse, and i
|
|
45
47
|
"""
|
46
48
|
|
47
49
|
|
50
|
+
# a function that adds text to a text box and scrolls to the bottom and updates it
|
51
|
+
def add_text_to_textbox(text_area: scrolledtext.ScrolledText, text, newline=True):
|
52
|
+
# Enable the text box to insert text
|
53
|
+
text_area.config(state=tk.NORMAL)
|
54
|
+
text_area.insert(tk.END, text + f'{"\n"if newline else ""}')
|
55
|
+
text_area.see(tk.END)
|
56
|
+
text_area.update_idletasks()
|
57
|
+
# Set the text box back to read-only
|
58
|
+
text_area.config(state=tk.DISABLED)
|
59
|
+
|
60
|
+
|
48
61
|
def perform_action_on_matches(input_list, target, action):
|
49
62
|
"""
|
50
63
|
Perform an action on all items in the list that are the same as the target.
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
2
|
-
Name:
|
3
|
-
Version: 3.
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: neelthee-mansion
|
3
|
+
Version: 3.23.1
|
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
|
@@ -18,25 +18,6 @@ Classifier: Operating System :: OS Independent
|
|
18
18
|
Requires-Python: >=3.6
|
19
19
|
Description-Content-Type: text/markdown
|
20
20
|
License-File: LICENSE.md
|
21
|
-
Requires-Dist: wheel
|
22
|
-
Requires-Dist: psutil
|
23
|
-
Requires-Dist: playsound
|
24
|
-
Requires-Dist: requests
|
25
|
-
Requires-Dist: keyboard
|
26
|
-
Requires-Dist: pandas
|
27
|
-
Requires-Dist: validators
|
28
|
-
Requires-Dist: dicttoxml
|
29
|
-
Requires-Dist: pytz
|
30
|
-
Dynamic: author
|
31
|
-
Dynamic: author-email
|
32
|
-
Dynamic: classifier
|
33
|
-
Dynamic: description
|
34
|
-
Dynamic: description-content-type
|
35
|
-
Dynamic: home-page
|
36
|
-
Dynamic: license
|
37
|
-
Dynamic: requires-dist
|
38
|
-
Dynamic: requires-python
|
39
|
-
Dynamic: summary
|
40
21
|
|
41
22
|
# Neel-thee's Mansion of Amnesia
|
42
23
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="neelthee_mansion",
|
5
|
-
version="3.
|
5
|
+
version="3.23.1", # Update version number for each release
|
6
6
|
packages=find_packages(), # Automatically finds all packages and modules
|
7
7
|
install_requires=[
|
8
8
|
"wheel",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/dependency_links.txt
RENAMED
File without changes
|
{neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/entry_points.txt
RENAMED
File without changes
|
File without changes
|
{neelthee_mansion-3.22.10 → neelthee_mansion-3.23.1}/neelthee_mansion.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|