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:
22
trade/trade.lua
Normal file
22
trade/trade.lua
Normal 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
|
Reference in New Issue
Block a user