Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- 20-11-30 04:23:04-05 This is the stocked item in the list that we are searching for: CRUDELY_MADE_TORCH
- 20-11-30 04:23:04-05 [::] Traceback (most recent call last):
- 20-11-30 04:23:04-05 [::] File "d:\muddev\evennia\evennia\commands\cmdhandler.py", line 644, in _run_command
- 20-11-30 04:23:04-05 [::] ret = cmd.func()
- 20-11-30 04:23:04-05 [::] File ".\commands\command.py", line 943, in func
- 20-11-30 04:23:04-05 [::] self.caller.msg(i.merch.return_stock())
- 20-11-30 04:23:04-05 [::] File "D:\muddev\hecate\world\npcs\merchant_handler.py", line 32, in return_stock
- 20-11-30 04:23:04-05 [::] item = search_prototype(i, require_single=True)
- 20-11-30 04:23:04-05 [::] File "d:\muddev\evennia\evennia\prototypes\prototypes.py", line 426, in search_prototype
- 20-11-30 04:23:04-05 [::] raise KeyError(f"Found {nmodules + ndbprots} matching prototypes.")
- 20-11-30 04:23:04-05 [::] KeyError: 'Found 0 matching prototypes.'
- 20-11-30 04:23:04-05 [EE] User input was: 'stock'.
- """
- # in MerchantHandler class
- def return_stock(self):
- owner = self.owner
- if owner.attributes.has('stock'):
- stocked_items = owner.attributes.get('stock')
- header = "=========[Stock]==============="
- body = []
- footer = "==============================="
- item = None
- name = None
- price = None
- for i in stocked_items:
- print(f"This is the stocked item in the list that we are searching for: {i}")
- item = search_prototype(i, require_single=True)
- print(f"This is the found prototype item in the search_prototype for merchant stock: {item}")
- name = item['key']
- price = item['price']
- body.append(f"{name} {price}\n")
- msg = f"{header}\n{''.join(body)}{footer}"
- return msg
- # in item_prototypes.py module
- CRUDELY_MADE_TORCH = {
- 'prototype_parent': 'lighting',
- 'prototype_key': 'CRUDELY_MADE_TORCH',
- 'key': 'crudely-made torch',
- 'typeclass': 'typeclasses.objects.Torch',
- 'price': 10,
- 'fuel': 90,
- 'burn_rate': 30
- }
- # in settings.py module
- # Modules that contain prototypes for use with the spawner mechanism.
- PROTOTYPE_MODULES = [
- "world.npcs.npc_prototypes",
- "world.items.item_prototypes",
- "world.mobs.mob_prototypes"]
- # ingame spawn/list command result
- .
- +---------------------------+----------------------+-----------------------+-----------------------+
- | Key | Spawn/Edit | Tags | Desc |
- +~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~+
- | basic_supplies | Y/N | module | |
- | merchant | Y/N | module | |
- | bait | Y/N | bait, module | Fishing bait |
- | barley_porridge | Y/N | module | |
- | beef_steak | Y/N | module | |
- | black_tea | Y/N | module | |
- | boiled_mutton_and_peas | Y/N | module | |
- | crudely_made_torch | Y/N | module | |
- | drink | Y/N | drink, module | Drink items. |
- | food | Y/N | food, module | Food items. |
- | foul_smelling_bait | Y/N | module | |
- | inventory_bag | Y/N | module | |
- | inventory_container | Y/N | module | |
- | lighting | Y/N | module | |
- | millet_porridge | Y/N | module | |
- | raspberry_cake | Y/N | module | |
- | stewed_beetroot | Y/N | module | |
- | torch | Y/N | module | |
- | water | Y/N | module | |
- | rat | Y/N | module | |
- +---------------------------+----------------------+-----------------------+-----------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement