Trade: Add dedicated trading prompts.

Dialogue: Add support to show dedicated trading prompts for dedicated traders.
(WIP) Get buy/sell offers for dedicated traders.
This commit is contained in:
zorman2000
2017-01-29 20:30:43 -05:00
parent d7a8de5b86
commit 54c005ec34
2 changed files with 48 additions and 0 deletions

View File

@ -48,6 +48,29 @@ npc.trade.CASUAL_TRADE_SELL_DIALOGUE = {
}
}
-- Dedicated trade dialogue prompt
npc.trade.DEDICATED_TRADER_PROMPT = {
text = "Hello there, would you like to trade?",
is_dedicated_trade_prompt = true,
responses = {
[1] = {
text = "Buy",
action_type = "function",
response_id = 1,
action = function(self, player)
end
},
[2] = {
text = "Sell",
action_type = "function",
response_id = 2,
action = function(self, player)
end
}
}
}
function npc.trade.show_trade_offer_formspec(self, player, offer_type)
-- Strings for formspec, to include international support later
@ -171,6 +194,15 @@ function npc.trade.get_casual_trade_offer(self, offer_type)
return result
end
-- The following function create buy and sell offers for dedicated traders,
-- based on the trader list and the source of items. Initially, it will only
-- be NPC inventories. In the future, it should support both NPC and chest
-- inventories,
function npc.trade.get_trade_offers_for_dedicated_trader(self)
end
-- Creates a trade offer based on the offer type, given item and count. If
-- the offer is a "buy" offer, it is required to provide the price item and
-- the minimum price item count.