neelthee-mansion 3.23.4__py3-none-any.whl → 3.23.6__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.
@@ -123,16 +123,16 @@ 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:
130
- go [%*GREEN*%direction%*RESET*%/%*GREEN*%teleport%*RESET*%/%*GREEN*%number%*RESET*%] - Move to another location
131
- get [%*BLUE*%item%*RESET*%] - Pick up an item from your current location
132
- search [%*RED*%container%*RESET*%] - Search a container in your current location
133
- use [%*BLUE*%item%*RESET*%] - Use an item from your inventory
134
- put [%*BLUE*%item%*RESET*%] [in] [%*RED*%container%*RESET*%] - Put an item from your inventory into a container in your current location
135
- examine [%*GREEN*%direction%*RESET*%/%*RED*%container%*RESET*%/%*BLUE*%item%*RESET*%/%*BROWN*%NPC%*RESET*%] - Find out some info about the object
130
+ go [direction/teleport/number] - Move to another location
131
+ get [item] - Pick up an item from your current location
132
+ search [container] - Search a container in your current location
133
+ use [item] - Use an item from your inventory
134
+ put [item] [in] [container] - Put an item from your inventory into a container in your current location
135
+ examine [direction/container/item/NPC] - Find out some info about the object
136
136
  sleep - Rest for a bit and regain some health
137
137
  look - Look around your current location
138
138
  quit - Quit the game
@@ -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,8 +277,8 @@ 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(
281
- f"You sell the %*BLUE*%{Item}%*RESET*%"
280
+ add_text_to_textbox(info_text_area,
281
+ f"You sell the {Item}"
282
282
  )
283
283
  player.inventory.remove(item_obj.name)
284
284
  elif Item == "quill":
@@ -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,7 +383,7 @@ 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():
@@ -392,8 +392,8 @@ def start():
392
392
  while info_text_area is None:
393
393
  sleep(0.1)
394
394
  # shows the main menu
395
- add_text_to_textbox(
396
- f"\nHello %*MAGENTA*%{player.name}%*RESET*% and welcome to my Role Playing Game. \nI hope you have fun!",
395
+ add_text_to_textbox(info_text_area,
396
+ f"\nHello %*MAGENTA*%{player.name} and welcome to my Role Playing Game. \nI hope you have fun!",
397
397
  )
398
398
  showInstructions()
399
399
 
@@ -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):
@@ -496,10 +496,10 @@ def display_directions(text):
496
496
  for direction in directions:
497
497
  if direction in ROOMS[player.CURRENTROOM]["directions"]:
498
498
  if direction != "teleport":
499
- text += f"\n{direction_descriptions[room_type][direction]} %*GREEN*%{direction}%*RESET*%."
499
+ text += f"\n{direction_descriptions[room_type][direction]} {direction}."
500
500
 
501
501
  if "teleport" in ROOMS[player.CURRENTROOM]["directions"]:
502
- text += "\nThere is a %*GREEN*%teleport%*RESET*%ation circle on the ground."
502
+ text += "\nThere is a teleportation circle on the ground."
503
503
 
504
504
  return text
505
505
 
@@ -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 {monster.name} 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, randint(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"{item_name} 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(
865
- f'The items in the room: %*BLUE*%{", ".join(ROOMS[player.CURRENTROOM]["items"].keys())}%*RESET*%.'
864
+ add_text_to_textbox(info_text_area,
865
+ f'The items in the room: {", ".join(ROOMS[player.CURRENTROOM]["items"].keys())}.'
866
866
  )
867
867
  should_return = True
868
868
  if "containers" in ROOMS[player.CURRENTROOM]:
869
- add_text_to_textbox(
870
- f"The containers here are: %*RED*%{', '.join(ROOMS[player.CURRENTROOM]['containers'].keys())}%*RESET*%"
869
+ add_text_to_textbox(info_text_area,
870
+ f"The containers here are: {', '.join(ROOMS[player.CURRENTROOM]['containers'].keys())}"
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,8 +898,8 @@ 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(
902
- f"You search the{' secret' if Container.secret else ''} %*RED*%{ContainerName}%*RESET*% and find a ",
901
+ add_text_to_textbox(info_text_area,
902
+ f"You search the{' secret' if Container.secret else ''} {ContainerName} and find a ",
903
903
  newline=False
904
904
  )
905
905
  for searchitem in Container.contents:
@@ -911,8 +911,8 @@ def search_container(player: PC, Container):
911
911
  < last_index(Container.contents)
912
912
  else "\n"
913
913
  )
914
- add_text_to_textbox(
915
- f"%*BLUE*%{searchitem.name}%*RESET*%{end_str}",
914
+ add_text_to_textbox(info_text_area,
915
+ f"{searchitem.name}{end_str}",
916
916
  newline=False,
917
917
 
918
918
  )
@@ -930,8 +930,8 @@ 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(
934
- f"You put you're %*BLUE*%{PutItem.name}%*RESET*% into the %*RED*%{container}%*RESET*%",
933
+ add_text_to_textbox(info_text_area,
934
+ f"You put you're {PutItem.name} into the {container}",
935
935
  )
936
936
 
937
937
 
@@ -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):