npc
index
/home/achifaifa/git/kirino/source/npc.py

 
Modules
       
common
copy
item
os
parser
random

 
Classes
       
npc
vendor

 
class npc
    NPC generator and manager
 
#Characteristic strings
name=""           #Name
secondname=""     #Second name
personality=""    #Personality
appearance=""     #Appearance
job=""            #Job
likes1=""         #Things this NPC likes (1)
likes2=""         #Things this NPC likes (2)
dislikes1=""      #Things this NPC dislikes (1)
dislikes2=""      #Things this NPC dislikes (2)
 
#Primary attributes
STR=1             #Strenght
DEX=1             #Dexterity
CON=1             #Constitution
INT=1             #Intelligence
PER=1             #Perception
WIL=1             #Willpower
CHA=1             #Charisma
 
#Status variables
 
rel=0             #Relation with player 
                  # <-10    - bad
                  # -10,10  - neutral
                  # >10     - good
 
  Methods defined here:
__init__(self, gender, stat, total)
Constructor. Generates an NPC, as in the standalone NPC generator:
https://github.com/Achifaifa/GM-Tools/tree/master/npcgenerator
 
Needs:
 
Gender
  0 female
  1 male
  Anything else defaults at a random genre
 
Maximum stat level
  A number smaller than 1 defaults to 5
 
Total attribute points
  A number smaller than 1 defaults to 16

 
class vendor
    Vendor class. Creates and manages vendors (shops) in a dungeon floor.
 
  Methods defined here:
__init__(self)
Vendor constructor. 
 
Generates a random NPC (The shopkeeper) and generates items to be sold.
buyit(self, player)
Display the list of items available for buying from the vendor
buypot(self, player)
Sells potions to the player. Three random potions are generated by the vendor.
commerce(self, player)
pricecalc(self, player)
Calculates the trading multiplier based on the player charisma and the player-NPC relationship
 
Base multiplier: 2
 
Additional multipliers: 
 
Charisma: +- 0.1 for each point
Relationship with vendor: +-0.5 for every 10 points
sell(self, player)
Display the list of items in the inventory to sell

 
Functions
       
load()
Load the data from the files into a dictionary. 
The arrays with the data is stored in a dictionary.
The dictionary is global in the module and is used by default in the NPC class.
sanitize()
Rewrite the NPC data files to follow formatting standards.

 
Data
        npcdata = {}
vendordata = {}