Cleanup: moved relationships into own file.

Moved trading and pricing code to another folder, separate files.
NPC: Added further inventory functionality.
Trading: Added price data structure, which allows for setting prices for items. Also includes some default definitions.
This commit is contained in:
zorman2000
2016-12-11 20:52:57 -05:00
parent 2720be8d48
commit 83c9b2c681
6 changed files with 667 additions and 529 deletions

22
trade/trade.lua Normal file
View File

@ -0,0 +1,22 @@
-- NPC trading abilities by Zorman2000
npc.trade = {}
npc.trade.CASUAL = "casual"
npc.trade.TRADER = "trader"
npc.trade.NONE = "none"
function npc.trade.get_random_trade_status()
local chance = math.random(1,10)
if chance < 3 then
-- Non-trader
return npc.trade.NONE
elseif 3 <= chance and chance <= 7 then
-- Casual trader
return npc.trade.CASUAL
elseif chance > 7 then
-- Trader by profession
return npc.trade.TRADER
end
end