Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # npc_prototypes.py module
- BASIC_SUPPLIES = {
- 'prototype_parent': 'merchant',
- 'key': 'basic supplies merchant',
- 'stock': ['CRUDELY_MADE_TORCH', 'FOUL_SMELLING_BAIT']
- }
- # merchant_handler.py module
- from world.items import item_prototypes
- from evennia.prototypes.prototypes import search_prototype
- class MerchantHandler:
- def __init__(self, owner):
- self.owner = owner
- def return_stock(self):
- """
- =========[Stock]===============
- a poorly-crafted torch
- an unappetizing food ration
- a dirty flask of oil
- a crude iron lantern
- a make-shift fishing rod
- a piece of foul-smelling bait
- ===============================
- """
- 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:
- item = search_prototype(i)
- item = item[0]
- name = item['key']
- price = item['price']
- body.append(f"{name} {price}\n")
- msg = f"{header}\n{''.join(body)}{footer}"
- return msg
- # item_prototypes.py module
- from evennia.utils.utils import random
- """
- CONSUMABLE CATEGORY
- """
- # Food Category
- FOOD = {
- 'prototype_key': 'food',
- 'prototype_desc': 'Food items.',
- 'prototype_tags': 'food',
- 'typeclass': 'typeclasses.objects.Object',
- 'tags': ('food', 'consumable')
- }
- RASPBERRY_CAKE = {
- 'prototype_parent': 'food',
- 'key': 'raspberry cake',
- 'price': 10,
- 'hunger': 10
- }
- BEEF_STEAK = {
- 'prototype_parent': 'food',
- 'key': 'beef steak',
- 'price': 50,
- 'hunger': 25
- }
- MILLET_PORRIDGE = {
- 'prototype_parent': 'food',
- 'key': 'millet porridge',
- 'price': 4,
- 'hunger': 15
- }
- BARLEY_PORRIDGE = {
- 'prototype_parent': 'food',
- 'key': 'barley porridge',
- 'price': 4,
- 'hunger': 15
- }
- STEWED_BEETROOT = {
- 'prototype_parent': 'food',
- 'key': 'stewed beetroot',
- 'price': 4,
- 'hunger': 15
- }
- BOILED_MUTTON_AND_PEAS = {
- 'prototype_parent': 'food',
- 'key': 'boiled mutton and peas',
- 'price': 11,
- 'hunger': 25
- }
- # Drink Category
- DRINK = {
- 'prototype_key': 'drink',
- 'prototype_desc': 'Drink items.',
- 'prototype_tags': 'drink',
- 'typeclass': 'typeclasses.objects.Object',
- 'tags': ('drink', 'consumable')
- }
- BLACK_TEA = {
- 'prototype_parent': 'drink',
- 'key': 'black tea',
- 'price': 3,
- 'thirst': 5
- }
- WATER = {
- 'prototype_parent': 'drink',
- 'key': 'water',
- 'price': 1,
- 'thirst': 5
- }
- """
- LIGHTING CATEGORY
- """
- LIGHTING = {
- 'prototype_key': 'lighting',
- 'key': 'lighting',
- 'typeclass': 'typeclasses.objects.Lighting'
- }
- TORCH = {
- 'prototype_parent': 'lighting',
- 'key': 'torch',
- 'typeclass': 'typeclasses.objects.Torch'
- }
- 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
- }
- INVENTORY_CONTAINER = {
- 'prototype_key': 'inventory_container',
- 'key': 'inventory_container',
- 'typeclass': 'typeclasses.objects.InventoryContainer'
- }
- INVENTORY_BAG = {
- 'prototype_parent': 'inventory_container',
- 'key': lambda: generate_random_bag_key()
- }
- def generate_random_bag_key():
- color = ('red', 'blue', 'green', 'yellow', 'black')
- adjective = ('tattered', 'worn', 'pristine', 'well-crafted', 'frayed')
- # a tattered red bag
- # a pristine yellow bag
- bag_key = f"a {random.choice(adjective)} {random.choice(color)} bag"
- return bag_key
- # Bags
- # Satchels
- # Sacks
- # Backpacks
- BAIT = {
- 'prototype_key': 'bait',
- 'prototype_desc': 'Fishing bait',
- 'prototype_tags': 'bait',
- 'typeclass': 'typeclasses.objects.Object',
- 'tags': ('bait', 'fishing')
- }
- FOUL_SMELLING_BAIT = {
- 'prototype_parent': 'bait',
- 'prototype_key': 'foul-smelling bait',
- 'key': 'foul-smelling bait',
- 'lure': 1,
- 'price': 2,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement