Advertisement
Kovitikus

Untitled

Nov 30th, 2020
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.80 KB | None | 0 0
  1. """
  2. 20-11-30 04:23:04-05 This is the stocked item in the list that we are searching for: CRUDELY_MADE_TORCH
  3. 20-11-30 04:23:04-05 [::] Traceback (most recent call last):
  4. 20-11-30 04:23:04-05 [::]   File "d:\muddev\evennia\evennia\commands\cmdhandler.py", line 644, in _run_command
  5. 20-11-30 04:23:04-05 [::]     ret = cmd.func()
  6. 20-11-30 04:23:04-05 [::]   File ".\commands\command.py", line 943, in func
  7. 20-11-30 04:23:04-05 [::]     self.caller.msg(i.merch.return_stock())
  8. 20-11-30 04:23:04-05 [::]   File "D:\muddev\hecate\world\npcs\merchant_handler.py", line 32, in return_stock
  9. 20-11-30 04:23:04-05 [::]     item = search_prototype(i, require_single=True)
  10. 20-11-30 04:23:04-05 [::]   File "d:\muddev\evennia\evennia\prototypes\prototypes.py", line 426, in search_prototype
  11. 20-11-30 04:23:04-05 [::]     raise KeyError(f"Found {nmodules + ndbprots} matching prototypes.")
  12. 20-11-30 04:23:04-05 [::] KeyError: 'Found 0 matching prototypes.'
  13. 20-11-30 04:23:04-05 [EE] User input was: 'stock'.
  14. """
  15.  
  16.  
  17. # in MerchantHandler class
  18.     def return_stock(self):
  19.         owner = self.owner
  20.         if owner.attributes.has('stock'):
  21.             stocked_items = owner.attributes.get('stock')
  22.  
  23.         header = "=========[Stock]==============="
  24.         body = []
  25.         footer = "==============================="
  26.         item = None
  27.         name = None
  28.         price = None
  29.  
  30.         for i in stocked_items:
  31.             print(f"This is the stocked item in the list that we are searching for: {i}")
  32.             item = search_prototype(i, require_single=True)
  33.             print(f"This is the found prototype item in the search_prototype for merchant stock: {item}")
  34.             name = item['key']
  35.             price = item['price']
  36.             body.append(f"{name}    {price}\n")
  37.  
  38.         msg = f"{header}\n{''.join(body)}{footer}"
  39.         return msg
  40.  
  41.  
  42. # in item_prototypes.py module
  43. CRUDELY_MADE_TORCH = {
  44.     'prototype_parent': 'lighting',
  45.     'prototype_key': 'CRUDELY_MADE_TORCH',
  46.     'key': 'crudely-made torch',
  47.     'typeclass': 'typeclasses.objects.Torch',
  48.     'price': 10,
  49.     'fuel': 90,
  50.     'burn_rate': 30
  51. }
  52.  
  53. # in settings.py module
  54. # Modules that contain prototypes for use with the spawner mechanism.
  55. PROTOTYPE_MODULES = [
  56.     "world.npcs.npc_prototypes",
  57.     "world.items.item_prototypes",
  58.     "world.mobs.mob_prototypes"]
  59.  
  60. # ingame spawn/list command result
  61.                                            .
  62. +---------------------------+----------------------+-----------------------+-----------------------+
  63. | Key                       | Spawn/Edit           | Tags                  | Desc                  |
  64. +~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~+
  65. | basic_supplies            | Y/N                  | module                |                       |
  66. | merchant                  | Y/N                  | module                |                       |
  67. | bait                      | Y/N                  | bait, module          | Fishing bait          |
  68. | barley_porridge           | Y/N                  | module                |                       |
  69. | beef_steak                | Y/N                  | module                |                       |
  70. | black_tea                 | Y/N                  | module                |                       |
  71. | boiled_mutton_and_peas    | Y/N                  | module                |                       |
  72. | crudely_made_torch        | Y/N                  | module                |                       |
  73. | drink                     | Y/N                  | drink, module         | Drink items.          |
  74. | food                      | Y/N                  | food, module          | Food items.           |
  75. | foul_smelling_bait        | Y/N                  | module                |                       |
  76. | inventory_bag             | Y/N                  | module                |                       |
  77. | inventory_container       | Y/N                  | module                |                       |
  78. | lighting                  | Y/N                  | module                |                       |
  79. | millet_porridge           | Y/N                  | module                |                       |
  80. | raspberry_cake            | Y/N                  | module                |                       |
  81. | stewed_beetroot           | Y/N                  | module                |                       |
  82. | torch                     | Y/N                  | module                |                       |
  83. | water                     | Y/N                  | module                |                       |
  84. | rat                       | Y/N                  | module                |                       |
  85. +---------------------------+----------------------+-----------------------+-----------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement