neelthee-mansion 3.23.3__tar.gz → 3.23.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/PKG-INFO +1 -1
  2. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/Mansion_of_Amnesia.py +96 -96
  3. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/creatures.py +25 -25
  4. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/items.py +3 -3
  5. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion.egg-info/PKG-INFO +1 -1
  6. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/setup.py +1 -1
  7. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/LICENSE.md +0 -0
  8. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/README.md +0 -0
  9. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/Books.py +0 -0
  10. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/Quests.py +0 -0
  11. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/Rooms.py +0 -0
  12. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/__init__.py +0 -0
  13. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/__main__.py +0 -0
  14. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/all_game_utils.py +0 -0
  15. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion/utils.py +0 -0
  16. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion.egg-info/SOURCES.txt +0 -0
  17. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion.egg-info/dependency_links.txt +0 -0
  18. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion.egg-info/entry_points.txt +0 -0
  19. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion.egg-info/requires.txt +0 -0
  20. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/neelthee_mansion.egg-info/top_level.txt +0 -0
  21. {neelthee_mansion-3.23.3 → neelthee_mansion-3.23.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neelthee_mansion
3
- Version: 3.23.3
3
+ Version: 3.23.5
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
@@ -123,7 +123,7 @@ def parse_command(command_str: str, commands: dict):
123
123
  def showInstructions():
124
124
  global player
125
125
  # Display the game instructions
126
- add_text_to_textbox(
126
+ add_text_to_textbox(info_text_area,
127
127
  """
128
128
  ===========================
129
129
  Commands:
@@ -146,11 +146,11 @@ map - Display the map of places you have been to
146
146
  def showHint():
147
147
  global player
148
148
  if "Hints" in ROOMS[player.CURRENTROOM]:
149
- add_text_to_textbox("You think:")
149
+ add_text_to_textbox(info_text_area, "You think:")
150
150
  hint = choice(ROOMS[player.CURRENTROOM]["Hints"])
151
- add_text_to_textbox(hint)
151
+ add_text_to_textbox(info_text_area, hint)
152
152
  else:
153
- add_text_to_textbox("You can't think of anything")
153
+ add_text_to_textbox(info_text_area, "You can't think of anything")
154
154
 
155
155
 
156
156
  def check_direction(var: str, directions: list):
@@ -163,25 +163,25 @@ def check_direction(var: str, directions: list):
163
163
 
164
164
  def End(text: str, win: bool = True):
165
165
  global player
166
- add_text_to_textbox(text)
166
+ add_text_to_textbox(info_text_area, text)
167
167
  if win:
168
- add_text_to_textbox("Do you want to leave the game? Y/N")
168
+ add_text_to_textbox(info_text_area, "Do you want to leave the game? Y/N")
169
169
  while True:
170
170
  leave = loop_til_valid_input("", ).lower()
171
171
  if leave == "n":
172
- add_text_to_textbox("You decide to continue exploring.")
172
+ add_text_to_textbox(info_text_area, "You decide to continue exploring.")
173
173
  break
174
174
  elif leave == "y":
175
- add_text_to_textbox(
175
+ add_text_to_textbox(info_text_area,
176
176
  "You escaped the house... %*BOLD*%GAME OVER, YOU WIN!",
177
177
  )
178
178
  commands["quit"]()
179
179
  else:
180
- add_text_to_textbox(
180
+ add_text_to_textbox(info_text_area,
181
181
  "Sorry, that wasn't 'y' or 'n'. Please enter 'y' or 'n'.",
182
182
  )
183
183
  else:
184
- add_text_to_textbox("%*BOLD*%GAME OVER, YOU LOSE!")
184
+ add_text_to_textbox(info_text_area, "%*BOLD*%GAME OVER, YOU LOSE!")
185
185
  commands["quit"]()
186
186
 
187
187
 
@@ -197,7 +197,7 @@ def add_note(note, parchment_index=None):
197
197
  del player.inventory[parchment_index]
198
198
  except IndexError:
199
199
  pass
200
- player.inventory_add([item(inv_note)])
200
+ player.inventory_add([item(inv_note)], info_text_area)
201
201
 
202
202
 
203
203
  def Use_grappling_hook():
@@ -205,27 +205,27 @@ def Use_grappling_hook():
205
205
 
206
206
  def swing_into_forest():
207
207
  global player
208
- add_text_to_textbox(
208
+ add_text_to_textbox(info_text_area,
209
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!"
210
210
  )
211
211
  if ask_for_consent("Do you want to swing into the forest"):
212
- add_text_to_textbox("You swing into the forest")
212
+ add_text_to_textbox(info_text_area, "You swing into the forest")
213
213
  Move("Forest Clearing")
214
214
  else:
215
- add_text_to_textbox(
215
+ add_text_to_textbox(info_text_area,
216
216
  "You flick the rope and it unhooks. You continue exploring the house."
217
217
  )
218
218
 
219
219
  def climb_into_house():
220
220
  global player
221
- add_text_to_textbox(
221
+ add_text_to_textbox(info_text_area,
222
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!"
223
223
  )
224
224
  if ask_for_consent("Do you want to climb into the house"):
225
- add_text_to_textbox("You climb into the house")
225
+ add_text_to_textbox(info_text_area, "You climb into the house")
226
226
  Move("Balcony")
227
227
  else:
228
- add_text_to_textbox(
228
+ add_text_to_textbox(info_text_area,
229
229
  "You flick the rope and it unhooks. You continue exploring the forest"
230
230
  )
231
231
 
@@ -242,15 +242,15 @@ def Use_quill():
242
242
 
243
243
  if all(item in player.inventory for item in ["ink-pot", "parchment", "quill"]):
244
244
  parchment_index = player.inventory.index("parchment")
245
- add_text_to_textbox("What do you want to write")
245
+ add_text_to_textbox(info_text_area, "What do you want to write")
246
246
  write = str(input(">")).strip()
247
247
 
248
248
  if write:
249
249
  add_note(write, parchment_index)
250
250
  else:
251
- add_text_to_textbox("You can't write nothing")
251
+ add_text_to_textbox(info_text_area, "You can't write nothing")
252
252
  else:
253
- add_text_to_textbox(
253
+ add_text_to_textbox(info_text_area,
254
254
  "You need an ink pot, parchment, and a quill to write."
255
255
  )
256
256
 
@@ -261,10 +261,10 @@ def Use_note(note_number):
261
261
  note_key = f"note {note_number}"
262
262
  if note_key in player.inventory:
263
263
  note_index = int(note_number) - 1
264
- add_text_to_textbox(f"You read:")
265
- add_text_to_textbox(player.NOTES[note_index])
264
+ add_text_to_textbox(info_text_area, f"You read:")
265
+ add_text_to_textbox(info_text_area, player.NOTES[note_index])
266
266
  else:
267
- add_text_to_textbox("You do not have that note")
267
+ add_text_to_textbox(info_text_area, "You do not have that note")
268
268
 
269
269
 
270
270
  def Use(*Args):
@@ -277,7 +277,7 @@ def Use(*Args):
277
277
  item_obj = player.inventory[player.inventory.index(Item)]
278
278
  if isinstance(item_obj, item):
279
279
  if item_obj.sell(player):
280
- add_text_to_textbox(
280
+ add_text_to_textbox(info_text_area,
281
281
  f"You sell the %*BLUE*%{Item}%*RESET*%"
282
282
  )
283
283
  player.inventory.remove(item_obj.name)
@@ -299,13 +299,13 @@ def PickKey(locked_obj):
299
299
 
300
300
  if keys:
301
301
  while True:
302
- add_text_to_textbox(
302
+ add_text_to_textbox(info_text_area,
303
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:"
304
304
  )
305
305
 
306
306
  # Enumerate keys and display them
307
307
  for idx, key in enumerate(keys, 1): # Starts numbering at 1
308
- add_text_to_textbox(f"{idx}. {key.name} - {key.CurentRevealStr}")
308
+ add_text_to_textbox(info_text_area, f"{idx}. {key.name} - {key.CurentRevealStr}")
309
309
 
310
310
  # Use loop_til_valid_input to get a valid integer within the correct range
311
311
  choice = loop_til_valid_input(
@@ -332,7 +332,7 @@ def Move(move):
332
332
  ROOMS[newRoom]["descovered"] = True
333
333
  return ROOMS[player.CURRENTROOM]["directions"][move]
334
334
  else:
335
- add_text_to_textbox(
335
+ add_text_to_textbox(info_text_area,
336
336
  "You don't have enough money to charter a ship."
337
337
  )
338
338
  return player.CURRENTROOM
@@ -343,7 +343,7 @@ def Move(move):
343
343
  if key.GetKeyCode() == "629.IdnXwnt":
344
344
  End("You unlock the gate to the garden with the key!")
345
345
  return newRoom
346
- add_text_to_textbox("The gate is locked.")
346
+ add_text_to_textbox(info_text_area, "The gate is locked.")
347
347
  return newRoom
348
348
 
349
349
  def move_to_room():
@@ -383,16 +383,16 @@ def Move(move):
383
383
  if isinstance(randomEvent, RandomEvent):
384
384
  randomEvent.check_and_trigger(player)
385
385
  return
386
- add_text_to_textbox(f"There is no exit {move}")
386
+ add_text_to_textbox(info_text_area, f"There is no exit {move}")
387
387
 
388
388
 
389
389
  def start():
390
390
  global player, info_text_area
391
391
  # Wait until info_text_area is initialized
392
392
  while info_text_area is None:
393
- time.sleep(0.1)
393
+ sleep(0.1)
394
394
  # shows the main menu
395
- add_text_to_textbox(
395
+ add_text_to_textbox(info_text_area,
396
396
  f"\nHello %*MAGENTA*%{player.name}%*RESET*% and welcome to my Role Playing Game. \nI hope you have fun!",
397
397
  )
398
398
  showInstructions()
@@ -451,14 +451,14 @@ def showStatus():
451
451
 
452
452
  text += f"\n---------------------------"
453
453
 
454
- add_text_to_textbox(text)
454
+ add_text_to_textbox(info_text_area, text)
455
455
 
456
456
  # Optionally display additional room description
457
457
  if "description" in ROOMS[player.CURRENTROOM] and ask_for_consent(
458
458
  "Do you want to observe the area"
459
459
  ):
460
- add_text_to_textbox("The area:")
461
- add_text_to_textbox(ROOMS[player.CURRENTROOM]["description"])
460
+ add_text_to_textbox(info_text_area, "The area:")
461
+ add_text_to_textbox(info_text_area, ROOMS[player.CURRENTROOM]["description"])
462
462
 
463
463
 
464
464
  def display_directions(text):
@@ -511,27 +511,27 @@ def Examine(*Args):
511
511
  if item_index is not None: # Check explicitly if item_index is valid
512
512
  _ = player.inventory[item_index]
513
513
  if isinstance(_, item):
514
- add_text_to_textbox("You look at your item and you figure out this about it:")
514
+ add_text_to_textbox(info_text_area, "You look at your item and you figure out this about it:")
515
515
  if not revealer.reveal_key_code(_):
516
516
  if _.type == "weapon":
517
- add_text_to_textbox(f"This item is a weapon that adds {_.value} damage.")
517
+ add_text_to_textbox(info_text_area, f"This item is a weapon that adds {_.value} damage.")
518
518
  elif _.type == "readable":
519
519
  if "reading" in player.Skills:
520
- add_text_to_textbox(f"You read {_.name} and it contains:")
520
+ add_text_to_textbox(info_text_area, f"You read {_.name} and it contains:")
521
521
  if isinstance(_, Book):
522
- add_text_to_textbox(_.GetContense())
522
+ add_text_to_textbox(info_text_area, _.GetContense())
523
523
  else:
524
- add_text_to_textbox(_.value)
524
+ add_text_to_textbox(info_text_area, _.value)
525
525
  elif isinstance(_, Recorder):
526
- add_text_to_textbox("This device records sound. The current message is:")
527
- add_text_to_textbox(_.message)
526
+ add_text_to_textbox(info_text_area, "This device records sound. The current message is:")
527
+ add_text_to_textbox(info_text_area, _.message)
528
528
  else:
529
- add_text_to_textbox(_.value)
529
+ add_text_to_textbox(info_text_area, _.value)
530
530
  elif Name in ROOMS[player.CURRENTROOM]["directions"]: # Check exits in the room
531
531
  door = ROOMS[player.CURRENTROOM]["directions"][Name]
532
532
  if isinstance(door, Door):
533
533
  if isinstance(door.lock, Lock):
534
- add_text_to_textbox(
534
+ add_text_to_textbox(info_text_area,
535
535
  (
536
536
  "The door is locked,"
537
537
  if door.lock.is_locked
@@ -541,14 +541,14 @@ def Examine(*Args):
541
541
  )
542
542
  revealer.reveal_key_code(door)
543
543
  else:
544
- add_text_to_textbox(f"The exit {Name} has no lock.")
544
+ add_text_to_textbox(info_text_area, f"The exit {Name} has no lock.")
545
545
  else:
546
- add_text_to_textbox(f"There is nothing special about the exit {Name}.")
546
+ add_text_to_textbox(info_text_area, f"There is nothing special about the exit {Name}.")
547
547
  elif "containers" in ROOMS[player.CURRENTROOM] and Name in ROOMS[player.CURRENTROOM]["containers"]:
548
548
  containerins = ROOMS[player.CURRENTROOM]["containers"][Name]
549
549
  if isinstance(containerins, container):
550
550
  if isinstance(containerins.lock, Lock):
551
- add_text_to_textbox(
551
+ add_text_to_textbox(info_text_area,
552
552
  (
553
553
  "The container is locked,"
554
554
  if containerins.lock.is_locked
@@ -558,18 +558,18 @@ def Examine(*Args):
558
558
  )
559
559
  revealer.reveal_key_code(containerins)
560
560
  else:
561
- add_text_to_textbox(f"The container {Name} has no lock.")
561
+ add_text_to_textbox(info_text_area, f"The container {Name} has no lock.")
562
562
  else:
563
- add_text_to_textbox(f"There is no container named {Name} in this room.")
563
+ add_text_to_textbox(info_text_area, f"There is no container named {Name} in this room.")
564
564
  elif "creatures stats" in ROOMS[player.CURRENTROOM]:
565
565
  for Creature in ROOMS[player.CURRENTROOM]["creatures stats"]:
566
566
  if isinstance(Creature, creature):
567
567
  if isinstance(Creature, NPC):
568
568
  if Creature.name.lower() == Name:
569
- Creature.talk()
569
+ Creature.talk(info_text_area)
570
570
  return
571
571
  else:
572
- add_text_to_textbox(f"There is nothing special about the {Name}.")
572
+ add_text_to_textbox(info_text_area, f"There is nothing special about the {Name}.")
573
573
 
574
574
 
575
575
  def battle(player: PC, good_guys: list, bad_guys: list, last_room):
@@ -634,7 +634,7 @@ def player_turn(player: PC, monster: creature):
634
634
  perform_attack(player, monster)
635
635
  elif player_action == "defend":
636
636
  player.defending = True
637
- add_text_to_textbox("You brace yourself for the next attack.")
637
+ add_text_to_textbox(info_text_area, "You brace yourself for the next attack.")
638
638
  elif player_action == "special":
639
639
  use_special_ability(player, monster)
640
640
 
@@ -647,9 +647,9 @@ def monster_turn(player: PC, monster: creature):
647
647
  player (PC): The player or ally.
648
648
  monster (creature): The monster attacking.
649
649
  """
650
- add_text_to_textbox(f"The %*CYAN*%{monster.name}%*RESET*% attacks!")
650
+ add_text_to_textbox(info_text_area, f"The %*CYAN*%{monster.name}%*RESET*% attacks!")
651
651
  damage = calculate_damage(monster, player)
652
- player.take_damage(damage)
652
+ player.take_damage(damage, info_text_area)
653
653
 
654
654
 
655
655
  def perform_attack(attacker: PC, defender: creature):
@@ -661,7 +661,7 @@ def perform_attack(attacker: PC, defender: creature):
661
661
  defender (creature): The defending monster.
662
662
  """
663
663
  damage = calculate_damage(attacker, defender)
664
- defender.take_damage(damage)
664
+ defender.take_damage(damage, info_text_area)
665
665
 
666
666
 
667
667
  def handle_victory(player: PC, monsters: list):
@@ -672,10 +672,10 @@ def handle_victory(player: PC, monsters: list):
672
672
  player (PC): The player character.
673
673
  monsters (list): The list of defeated monsters.
674
674
  """
675
- add_text_to_textbox("You have defeated all the enemies!")
675
+ add_text_to_textbox(info_text_area, "You have defeated all the enemies!")
676
676
  for monster in monsters:
677
677
  if monster.hp <= 0:
678
- player.inventory_add(monster.dropped_items)
678
+ player.inventory_add(monster.dropped_items, info_text_area)
679
679
 
680
680
 
681
681
  def calculate_damage(attacker, defender) -> int:
@@ -694,11 +694,11 @@ def calculate_damage(attacker, defender) -> int:
694
694
 
695
695
  if random() < attacker.crit_chance:
696
696
  damage *= 2
697
- add_text_to_textbox("Critical hit!")
697
+ add_text_to_textbox(info_text_area, "Critical hit!")
698
698
 
699
699
  if hasattr(defender, "defending") and defender.defending:
700
700
  damage //= 2
701
- add_text_to_textbox("The attack is defended, reducing damage.")
701
+ add_text_to_textbox(info_text_area, "The attack is defended, reducing damage.")
702
702
  defender.defending = False
703
703
 
704
704
  return damage
@@ -730,13 +730,13 @@ def use_special_ability(player: PC, monster: creature):
730
730
  monster (creature): The monster being fought.
731
731
  """
732
732
  if player.special_ability.ready:
733
- player.special_ability.activate(monster)
734
- add_text_to_textbox(
733
+ player.special_ability.activate(monster, random(calculate_damage_range(player.atpw)), info_text_area)
734
+ add_text_to_textbox(info_text_area,
735
735
  f"You use your special ability: {player.special_ability.name}."
736
736
  )
737
737
  player.special_ability.ready = False
738
738
  else:
739
- add_text_to_textbox("Your special ability is not ready yet.")
739
+ add_text_to_textbox(info_text_area, "Your special ability is not ready yet.")
740
740
 
741
741
 
742
742
  def select_target(chooser, targets: list):
@@ -752,11 +752,11 @@ def select_target(chooser, targets: list):
752
752
  """
753
753
  if chooser == player:
754
754
  valid_targets = []
755
- add_text_to_textbox("Who do you want to attack? The options:")
755
+ add_text_to_textbox(info_text_area, "Who do you want to attack? The options:")
756
756
  # Enumerate through the targets to get both the index and the enemy.
757
757
  for index, enemy in enumerate(targets):
758
758
  if enemy.hp > 0:
759
- add_text_to_textbox(f"{index + 1}: {enemy.name} ({enemy.hp} HP)")
759
+ add_text_to_textbox(info_text_area, f"{index + 1}: {enemy.name} ({enemy.hp} HP)")
760
760
  valid_targets.append(index)
761
761
 
762
762
  # Prompt the player to select a target
@@ -766,9 +766,9 @@ def select_target(chooser, targets: list):
766
766
  if choice in valid_targets:
767
767
  return targets[choice]
768
768
  else:
769
- add_text_to_textbox("Invalid choice. Please select a valid target.")
769
+ add_text_to_textbox(info_text_area, "Invalid choice. Please select a valid target.")
770
770
  except ValueError:
771
- add_text_to_textbox("Invalid input. Please enter a number.")
771
+ add_text_to_textbox(info_text_area, "Invalid input. Please enter a number.")
772
772
  else:
773
773
  # AI or other logic for non-player chooser
774
774
  for target in targets:
@@ -801,7 +801,7 @@ def command():
801
801
  else:
802
802
  commands[action]()
803
803
  else:
804
- add_text_to_textbox(
804
+ add_text_to_textbox(info_text_area,
805
805
  f"Unknown command '{action}'. Type 'help' for a list of commands.",
806
806
 
807
807
  )
@@ -810,15 +810,15 @@ def command():
810
810
  if ShouldBreak:
811
811
  return
812
812
  #except KeyError as e:
813
- # add_text_to_textbox(f"KeyError: {e} - This might be due to an undefined command or incorrect arguments.")
813
+ # add_text_to_textbox(info_text_area, f"KeyError: {e} - This might be due to an undefined command or incorrect arguments.")
814
814
  #except ValueError as e:
815
- # add_text_to_textbox(f"ValueError: {e} - This might be due to incorrect arguments provided.")
815
+ # add_text_to_textbox(info_text_area, f"ValueError: {e} - This might be due to incorrect arguments provided.")
816
816
  #except Exception as e:
817
- # add_text_to_textbox(f"Unexpected Error: {e}")
817
+ # add_text_to_textbox(info_text_area, f"Unexpected Error: {e}")
818
818
 
819
819
 
820
820
  def handle_sleep_command(player: PC):
821
- add_text_to_textbox("You decide to rest for a while.")
821
+ add_text_to_textbox(info_text_area, "You decide to rest for a while.")
822
822
 
823
823
  # Simulate some time passing
824
824
  sleep(2) # Example: sleep for 2 seconds
@@ -827,7 +827,7 @@ def handle_sleep_command(player: PC):
827
827
  player.heal(3) # Example: heal 3 health points during sleep
828
828
 
829
829
  # Optional: Print a message or effect that happens during sleep
830
- add_text_to_textbox("You feel refreshed after a good rest.")
830
+ add_text_to_textbox(info_text_area, "You feel refreshed after a good rest.")
831
831
 
832
832
 
833
833
  def get_player_input(split=True):
@@ -850,29 +850,29 @@ def handle_get_command(player: PC, *Args):
850
850
  if "items" in ROOMS[player.CURRENTROOM]:
851
851
  for ItemName in ROOMS[player.CURRENTROOM]["items"].keys():
852
852
  if item_name == ItemName:
853
- player.inventory_add([ROOMS[player.CURRENTROOM]["items"][ItemName]])
853
+ player.inventory_add([ROOMS[player.CURRENTROOM]["items"][ItemName]], info_text_area)
854
854
  del ROOMS[player.CURRENTROOM]["items"][ItemName]
855
- add_text_to_textbox(f"%*BLUE*%{item_name}%*RESET*% got!")
855
+ add_text_to_textbox(info_text_area, f"%*BLUE*%{item_name}%*RESET*% got!")
856
856
  return
857
- add_text_to_textbox(f"Can't get {item_name}!")
857
+ add_text_to_textbox(info_text_area, f"Can't get {item_name}!")
858
858
 
859
859
 
860
860
  def handle_look_command():
861
861
  global player
862
862
  should_return = False
863
863
  if "items" in ROOMS[player.CURRENTROOM]:
864
- add_text_to_textbox(
864
+ add_text_to_textbox(info_text_area,
865
865
  f'The items in the room: %*BLUE*%{", ".join(ROOMS[player.CURRENTROOM]["items"].keys())}%*RESET*%.'
866
866
  )
867
867
  should_return = True
868
868
  if "containers" in ROOMS[player.CURRENTROOM]:
869
- add_text_to_textbox(
869
+ add_text_to_textbox(info_text_area,
870
870
  f"The containers here are: %*RED*%{', '.join(ROOMS[player.CURRENTROOM]['containers'].keys())}%*RESET*%"
871
871
  )
872
872
  should_return = True
873
873
  if should_return:
874
874
  return
875
- add_text_to_textbox("There is nothing of interest.")
875
+ add_text_to_textbox(info_text_area, "There is nothing of interest.")
876
876
 
877
877
 
878
878
  def handle_use_command(*Args):
@@ -888,7 +888,7 @@ def handle_search_command(player, *Args):
888
888
  ):
889
889
  search_container(player, Container)
890
890
  else:
891
- add_text_to_textbox(f"You cannot search the {Container}")
891
+ add_text_to_textbox(info_text_area, f"You cannot search the {Container}")
892
892
 
893
893
 
894
894
  def search_container(player: PC, Container):
@@ -898,7 +898,7 @@ def search_container(player: PC, Container):
898
898
  if isinstance(Container.lock, Lock):
899
899
  key = PickKey(Container.lock)
900
900
  Container.Unlock(key, player)
901
- add_text_to_textbox(
901
+ add_text_to_textbox(info_text_area,
902
902
  f"You search the{' secret' if Container.secret else ''} %*RED*%{ContainerName}%*RESET*% and find a ",
903
903
  newline=False
904
904
  )
@@ -911,7 +911,7 @@ def search_container(player: PC, Container):
911
911
  < last_index(Container.contents)
912
912
  else "\n"
913
913
  )
914
- add_text_to_textbox(
914
+ add_text_to_textbox(info_text_area,
915
915
  f"%*BLUE*%{searchitem.name}%*RESET*%{end_str}",
916
916
  newline=False,
917
917
 
@@ -930,7 +930,7 @@ def put_in_container(player: PC, PutItem=None, container=None):
930
930
  ROOMS[player.CURRENTROOM]["containers"][container].contents
931
931
  ]
932
932
  ROOMS[player.CURRENTROOM]["containers"][container].contents += [PutItem]
933
- add_text_to_textbox(
933
+ add_text_to_textbox(info_text_area,
934
934
  f"You put you're %*BLUE*%{PutItem.name}%*RESET*% into the %*RED*%{container}%*RESET*%",
935
935
  )
936
936
 
@@ -941,7 +941,7 @@ def handle_put_command(player: PC, *Args):
941
941
 
942
942
  # Ensure we have exactly two parts
943
943
  if len(Arguments) < 2:
944
- add_text_to_textbox(
944
+ add_text_to_textbox(info_text_area,
945
945
  "You need to specify an item and where to put it (e.g., 'put book drawer')."
946
946
  )
947
947
  return
@@ -953,7 +953,7 @@ def handle_put_command(player: PC, *Args):
953
953
 
954
954
  # Check if item is in inventory
955
955
  if item_name not in [item.name for item in player.inventory]:
956
- add_text_to_textbox(
956
+ add_text_to_textbox(info_text_area,
957
957
  f"You don't have {item_name} in your inventory."
958
958
  )
959
959
  return
@@ -965,7 +965,7 @@ def handle_put_command(player: PC, *Args):
965
965
  if "containers" in ROOMS[player.CURRENTROOM]:
966
966
  put_in_container(player, PutItem, container_name)
967
967
  else:
968
- add_text_to_textbox(
968
+ add_text_to_textbox(info_text_area,
969
969
  f"You cannot put the {PutItem.name} in the {container_name}"
970
970
  )
971
971
 
@@ -981,7 +981,7 @@ def handle_get_quest_command(questnum):
981
981
 
982
982
  def PrintMap():
983
983
  global player
984
- add_text_to_textbox(ShowMap())
984
+ add_text_to_textbox(info_text_area, ShowMap())
985
985
 
986
986
 
987
987
  # Define handling functions for different types of enemies
@@ -991,7 +991,7 @@ def handle_hungry_bear(player: PC, enemy: creature):
991
991
  if ask_for_consent("Do you want to throw your potion at the bear"):
992
992
  enemy_reacting = False
993
993
  del player.inventory[player.inventory.index("potion")]
994
- add_text_to_textbox(
994
+ add_text_to_textbox(info_text_area,
995
995
  f"You throw the potion at the bear and it explodes into a puff of magic smoke that stuns the bear!"
996
996
  )
997
997
  if enemy_reacting:
@@ -1003,18 +1003,18 @@ def handle_grumpy_pig(player: PC, enemy: creature):
1003
1003
  if "saddle" in player.inventory and "pig-rod" in player.inventory:
1004
1004
  if ask_for_consent("Do you want to use your saddle and pig-rod on the pig"):
1005
1005
  enemy_reacting = False
1006
- add_text_to_textbox(
1006
+ add_text_to_textbox(info_text_area,
1007
1007
  f"You throw a saddle onto the pig and leap on steering it about with a pig fishing rod!"
1008
1008
  )
1009
1009
  del ROOMS[player.CURRENTROOM]["creatures stats"]
1010
1010
  del player.inventory[player.inventory.index("saddle")]
1011
1011
  del player.inventory[player.inventory.index("pig-rod")]
1012
- player.inventory_add(item["pig-steed"])
1012
+ player.inventory_add(item["pig-steed"], info_text_area)
1013
1013
  player.xp += 20
1014
1014
  if "torch" in player.inventory:
1015
1015
  if ask_for_consent("Do you want to use your torch to scare the pig away"):
1016
1016
  enemy_reacting = False
1017
- add_text_to_textbox(
1017
+ add_text_to_textbox(info_text_area,
1018
1018
  f"You wave your torch at the pig and it runs away through a tiny open window."
1019
1019
  )
1020
1020
  del ROOMS[player.CURRENTROOM]["creatures stats"][
@@ -1024,7 +1024,7 @@ def handle_grumpy_pig(player: PC, enemy: creature):
1024
1024
  if "rations" in player.inventory:
1025
1025
  if ask_for_consent("Do you want to throw your ration at the pig"):
1026
1026
  enemy_reacting = False
1027
- add_text_to_textbox(
1027
+ add_text_to_textbox(info_text_area,
1028
1028
  f"You quickly throw rations at the pig. It still doesn't look happy though."
1029
1029
  )
1030
1030
  del player.inventory[player.inventory.index("rations")]
@@ -1039,7 +1039,7 @@ def handle_greedy_goblin(player: PC, enemy: creature):
1039
1039
  if player.money >= 15:
1040
1040
  if ask_for_consent("Do you want to pay the goblin to not attack you"):
1041
1041
  enemy_reacting = False
1042
- add_text_to_textbox(
1042
+ add_text_to_textbox(info_text_area,
1043
1043
  f"You pay the {enemy.name} to not attack you for now, but he says you should run."
1044
1044
  )
1045
1045
  player.money -= 15
@@ -1100,7 +1100,7 @@ def handle_wolf(player: PC, wolf: Guard):
1100
1100
  if "rations" in player.inventory:
1101
1101
  if ask_for_consent("Do you want to give your ration to the wolf"):
1102
1102
  enemy_reacting = False
1103
- add_text_to_textbox(
1103
+ add_text_to_textbox(info_text_area,
1104
1104
  "You quickly give your rations to the wolf. It looks happy, walks up to you, and nuzzles you."
1105
1105
  )
1106
1106
  player.inventory.remove("rations")
@@ -1311,7 +1311,7 @@ def main():
1311
1311
  for guard in guards:
1312
1312
  if isinstance(guard, Guard):
1313
1313
  if guard.hp > 0:
1314
- if guard.check_detection(player.CURRENTROOM):
1314
+ if guard.check_detection(player.CURRENTROOM, info_text_area):
1315
1315
  guard_handled = handle_guard_action(guard)
1316
1316
  if not isinstance(guard_handled, list):
1317
1317
  guard_handled = [guard_handled]
@@ -1350,11 +1350,11 @@ def main():
1350
1350
  if isinstance(enemy, creature):
1351
1351
  if not isinstance(enemy, NPC):
1352
1352
  if enemy.hp > 0:
1353
- enemy.add_text_to_textbox_flavor_text()
1353
+ enemy.add_text_flavor_text(info_text_area)
1354
1354
  if ask_for_consent(
1355
1355
  f"Do you want to examine the {enemy.name}"
1356
1356
  ):
1357
- enemy.add_text_to_textbox_description()
1357
+ enemy.add_text_description(info_text_area)
1358
1358
 
1359
1359
  is_reacting = False
1360
1360
 
@@ -1404,7 +1404,7 @@ def main():
1404
1404
  player, [], [npcstats], player.LASTROOM
1405
1405
  )[1]
1406
1406
 
1407
- player.special_ability.Tick()
1407
+ player.special_ability.Tick(info_text_area)
1408
1408
  quest_manager.update_objective(f"Kill {GameState['Enemies killed']} creatures")
1409
1409
  for Item in GameState["collected items"]:
1410
1410
  if isinstance(Item, item):
@@ -35,7 +35,7 @@ class base_character:
35
35
  Represents a base character in the game, including both players and creatures.
36
36
  """
37
37
 
38
- def take_damage(self, damage_taken: int = 5):
38
+ def take_damage(self, damage_taken: int = 5, text_area=None):
39
39
  """
40
40
  Reduces the character's hit points by the specified amount of damage.
41
41
 
@@ -51,7 +51,7 @@ class base_character:
51
51
  self.hp = self.hp - damage_taken
52
52
  if self.hp < 0:
53
53
  self.hp = 0
54
- type_text(
54
+ add_text_to_textbox(text_area,
55
55
  f"{string_beginning}{self.name}%*RESET*% takes {damage_taken} damage and has {self.hp} HP left!"
56
56
  )
57
57
 
@@ -152,25 +152,25 @@ class creature(base_character):
152
152
  self.frendly = False
153
153
  self.frendly_text = frendly_text
154
154
 
155
- def type_text_flavor_text(self):
155
+ def add_text_flavor_text(self, text_area):
156
156
  """
157
157
  Prints the flavor text associated with encountering the creature.
158
158
  """
159
- type_text(self.flavor_text)
159
+ add_text_to_textbox(text_area, self.flavor_text)
160
160
 
161
- def type_text_description(self):
161
+ def add_text_description(self, text_area):
162
162
  """
163
163
  Prints the description of the creature.
164
164
  """
165
- type_text(self.description)
165
+ add_text_to_textbox(text_area, self.description)
166
166
  curent_holiday = get_holiday()
167
167
  if curent_holiday == "christmas":
168
- type_text(f"The {self.name} also has a santa hat.")
168
+ add_text_to_textbox(text_area, f"The {self.name} also has a santa hat.")
169
169
  elif curent_holiday == "easter":
170
- type_text(f"The {self.name} also has bunny ears.")
170
+ add_text_to_textbox(text_area, f"The {self.name} also has bunny ears.")
171
171
  elif curent_holiday == "halloween":
172
172
  if random < 0.2:
173
- type_text(f"The {self.name} also has a pumkin on it's head.")
173
+ add_text_to_textbox(text_area, f"The {self.name} also has a pumkin on it's head.")
174
174
 
175
175
 
176
176
  class Guard(creature):
@@ -252,7 +252,7 @@ class Guard(creature):
252
252
  self.current_room = room.GetRoom(self.current_room)
253
253
  return
254
254
 
255
- def check_detection(self, player_room):
255
+ def check_detection(self, player_room, text_area):
256
256
  """
257
257
  Checks if the guard has detected the player.
258
258
 
@@ -263,13 +263,13 @@ class Guard(creature):
263
263
  bool: True if the player is detected, False otherwise.
264
264
  """
265
265
  if self.current_room == player_room and not self.frendly:
266
- type_text(
266
+ add_text_to_textbox(text_area,
267
267
  f"You have been caught by {self.name} in the {self.current_room}!"
268
268
  )
269
269
  return True
270
270
  elif self.current_room == player_room and self.frendly:
271
271
  if random() <= 0.015:
272
- type_text(self.frendly_text)
272
+ add_text_to_textbox(text_area, self.frendly_text)
273
273
  return False
274
274
 
275
275
 
@@ -280,18 +280,18 @@ class base_ability:
280
280
  self.cooldown_time = cooldown_time
281
281
  self.current_cooldown = 0
282
282
 
283
- def activate(self, target: creature, damage: int = 5):
283
+ def activate(self, target: creature, damage: int = 5, text_area=None):
284
284
  self.ready = False
285
285
  self.current_cooldown = 0
286
- print(f"Ability {self.name} will be ready after {self.cooldown_time} commands.")
286
+ add_text_to_textbox(f"Ability {self.name} will be ready after {self.cooldown_time} commands.")
287
287
 
288
- def Tick(self):
288
+ def Tick(self, text_area):
289
289
  self.current_cooldown += 1
290
- self.check_cooldown()
290
+ self.check_cooldown(text_area)
291
291
 
292
- def check_cooldown(self):
292
+ def check_cooldown(self, text_area):
293
293
  if self.current_cooldown >= self.cooldown_time and not self.ready:
294
- type_text(f"\nAbility {self.name} is ready to use again. ")
294
+ add_text_to_textbox(text_area, f"\nAbility {self.name} is ready to use again. ")
295
295
  self.ready = True
296
296
 
297
297
 
@@ -375,7 +375,7 @@ class PC(base_character):
375
375
  self.xp += xp_added
376
376
  self.check_xp()
377
377
 
378
- def inventory_add(self, added: list[item]):
378
+ def inventory_add(self, added: list[item], text_area):
379
379
  try:
380
380
  if not isinstance(added, list):
381
381
  added = [added]
@@ -389,10 +389,10 @@ class PC(base_character):
389
389
  self.get_change_weapon(item_to_add.value)
390
390
  else:
391
391
  # Print an error message if the item is not an instance of Item class
392
- type_text(f"Error: {item_to_add} is not an instance of Item class")
392
+ add_text_to_textbox(text_area, f"Error: {item_to_add} is not an instance of Item class")
393
393
  except Exception as e:
394
394
  # Print the full traceback if an exception occurs
395
- type_text(f"Error: {e}")
395
+ add_text_to_textbox(text_area, f"Error: {e}")
396
396
 
397
397
  def heal(self, value):
398
398
  self.hp = clamp(value, 0, self.maxhp)
@@ -508,7 +508,7 @@ class NPC(Guard):
508
508
  self.asked_about = set()
509
509
  self.generic_response = generic_response
510
510
 
511
- def talk(self):
511
+ def talk(self, text_area):
512
512
  while True:
513
513
  player_input = loop_til_valid_input(
514
514
  f"What do you want to say to %*BROWN*%{self.name}%*RESET*%?",
@@ -521,18 +521,18 @@ class NPC(Guard):
521
521
 
522
522
  # Exit the loop if the player says "goodbye"
523
523
  if player_input == "goodbye":
524
- type_text(f"Goodbye then. Don't get lost!")
524
+ add_text_to_textbox(text_area, f"Goodbye then. Don't get lost!")
525
525
  break
526
526
 
527
527
  # Check for keywords and map to corresponding response
528
528
  for topic, variations in self.keyword_variations.items():
529
529
  if any(variation in player_input for variation in variations):
530
530
  self.asked_about.add(topic)
531
- type_text(self._get_response(topic))
531
+ add_text_to_textbox(text_area, self._get_response(topic))
532
532
  break # Stop further keyword checks and wait for the next input
533
533
  else:
534
534
  # If no keywords found, return a generic response
535
- type_text(self._generic_response())
535
+ add_text_to_textbox(text_area, self._generic_response())
536
536
 
537
537
  def _get_response(self, topic):
538
538
  """Return a response from the NPC based on the topic asked."""
@@ -118,10 +118,10 @@ class ShopItem:
118
118
  def can_buy(self, player) -> bool:
119
119
  return player.money >= self.price
120
120
 
121
- def buy(self, player) -> bool:
121
+ def buy(self, player, text_area) -> bool:
122
122
  if self.can_buy(player):
123
123
  player.money -= self.price
124
- player.inventory_add(self.item)
124
+ player.inventory_add(self.item, text_area)
125
125
  return True
126
126
  else:
127
127
  return False
@@ -181,7 +181,7 @@ class container:
181
181
 
182
182
  try:
183
183
  for Item in self.contents:
184
- geter.inventory_add(Item)
184
+ geter.inventory_add(Item, text_area)
185
185
  except:
186
186
  pass
187
187
  finally:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neelthee-mansion
3
- Version: 3.23.3
3
+ Version: 3.23.5
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="neelthee_mansion",
5
- version="3.23.3", # Update version number for each release
5
+ version="3.23.5", # Update version number for each release
6
6
  packages=find_packages(), # Automatically finds all packages and modules
7
7
  install_requires=[
8
8
  "wheel",