diff --git a/game/engines/default/engine/Store.lua b/game/engines/default/engine/Store.lua index 5b54bb4af69b6e735c005750bdcd30af94cca536..e2caaa818a3291b8e3180efaaf0ed45e6ccdbc18 100644 --- a/game/engines/default/engine/Store.lua +++ b/game/engines/default/engine/Store.lua @@ -27,6 +27,8 @@ local GetQuantity = require "engine.dialogs.GetQuantity" module(..., package.seeall, class.inherit(Entity, Inventory)) function _M:init(t, no_default) + self.allow_sell = true + self.allow_buy = true t = t or {} t.body = {INVEN=10000} @@ -94,7 +96,7 @@ function _M:interact(who) return self:descObject(who, what, o) end, function(what, o) return self:descObjectPrice(who, what, o) - end) + end, self.allow_sell, self.allow_buy) game:registerDialog(d) end diff --git a/game/engines/default/engine/dialogs/ShowStore.lua b/game/engines/default/engine/dialogs/ShowStore.lua index 2130647cc7ca1bbafcdb8cd74740a5d2576610fd..b38239d5be1e02ba78a73c7497caa8a7e1503178 100644 --- a/game/engines/default/engine/dialogs/ShowStore.lua +++ b/game/engines/default/engine/dialogs/ShowStore.lua @@ -26,7 +26,8 @@ local Separator = require "engine.ui.Separator" module(..., package.seeall, class.inherit(Dialog)) -function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, action, desc, descprice) +function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, action, desc, descprice, allow_sell, allow_buy) + self.allow_sell, self.allow_buy = allow_sell, allow_buy self.action = action self.desc = desc self.descprice = descprice @@ -97,11 +98,13 @@ end function _M:use(item) if item and item.object then if self.focus_ui and self.focus_ui.ui == self.c_store then - self.action("buy", item.object, item.item) --- self:updateStore() + if util.getval(self.allow_buy, item.object, item.item) then + self.action("buy", item.object, item.item) + end else - self.action("sell", item.object, item.item) --- self:updateStore() + if util.getval(self.allow_sell, item.object, item.item) then + self.action("sell", item.object, item.item) + end end end end diff --git a/game/modules/tome/class/Store.lua b/game/modules/tome/class/Store.lua index 095ede3a183df4d11e6b3f295959869dec1259c3..299b977b631dc9036b42cf486848599f22bb94d2 100644 --- a/game/modules/tome/class/Store.lua +++ b/game/modules/tome/class/Store.lua @@ -30,6 +30,7 @@ function _M:loadStores(f) end function _M:init(t, no_default) + t.allow_sell = function() Dialog:simplePopup("Can not sell", "Do you really think I will buy your filthy wreckages found in the wilds? Ah!") end t.buy_percent = t.buy_percent or 10 t.sell_percent = t.sell_percent or 100 Store.init(self, t, no_default) diff --git a/game/modules/tome/data/general/objects/money.lua b/game/modules/tome/data/general/objects/money.lua index ed48c2be6615cae946dd102a4264b9b15e3a5bff..39aca789bc070410cc6504d06eb751159e7adafb 100644 --- a/game/modules/tome/data/general/objects/money.lua +++ b/game/modules/tome/data/general/objects/money.lua @@ -39,7 +39,7 @@ newEntity{ base = "BASE_MONEY", define_as = "MONEY_SMALL", name = "gold pieces", image = "object/money_small.png", add_name = " (#MONEY#)", level_range = {1, 50}, - money_value = resolvers.rngavg(1, 5), + money_value = resolvers.rngavg(5, 10), } newEntity{ base = "BASE_MONEY", define_as = "MONEY_BIG", @@ -48,5 +48,5 @@ newEntity{ base = "BASE_MONEY", define_as = "MONEY_BIG", level_range = {30, 50}, color=colors.GOLD, rarity = 15, - money_value = resolvers.rngavg(10, 30), + money_value = resolvers.rngavg(20, 30), }