Skip to content
Snippets Groups Projects
Commit 160758ce authored by dg's avatar dg
Browse files

Enabled selling again, gems still sell at a high price, other stuff less (as before)

Most stores have much better stuff to buy
Reduced drops


git-svn-id: http://svn.net-core.org/repos/t-engine4@2704 51575b47-30f0-44d4-a5cc-537603b46e54
parent a11c68f2
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ function _M:loadStores(f)
end
function _M:init(t, no_default)
t.store.buy_percent = t.store.buy_percent or 40
t.store.buy_percent = t.store.buy_percent or function(self, o) if o.type == "gem" then return 40 else return 15 end end
t.store.sell_percent = t.store.sell_percent or 100
t.store.purse = t.store.purse or 20
Store.init(self, t, no_default)
......@@ -41,7 +41,7 @@ function _M:init(t, no_default)
if not self.store.actor_filter then
self.store.actor_filter = function(o)
return (o.type == "gem" or o.unique) and not o.quest and not o.lore and o.cost and o.cost > 0
return not o.quest and not o.lore and o.cost and o.cost > 0
end
end
end
......@@ -53,7 +53,7 @@ end
-- @param nb number of items (if stacked) to buy
-- @return true if allowed to buy
function _M:tryBuy(who, o, item, nb)
local price = o:getPrice() * self.store.sell_percent / 100
local price = o:getPrice() * util.getval(self.store.sell_percent, self, o) / 100
if who.money >= price * nb then
return nb, price * nb
else
......@@ -68,7 +68,7 @@ end
-- @param nb number of items (if stacked) to sell
-- @return true if allowed to sell
function _M:trySell(who, o, item, nb)
local price = o:getPrice() * self.store.buy_percent / 100
local price = o:getPrice() * util.getval(self.store.buy_percent, self, o) / 100
if price <= 0 or nb <= 0 then return end
price = math.min(price * nb, self.store.purse * nb)
return nb, price
......@@ -83,7 +83,7 @@ end
-- @return true if allowed to buy
function _M:onBuy(who, o, item, nb, before)
if before then return end
local price = o:getPrice() * self.store.sell_percent / 100
local price = o:getPrice() * util.getval(self.store.sell_percent, self, o) / 100
if who.money >= price * nb then
who:incMoney(- price * nb)
end
......@@ -99,7 +99,7 @@ end
function _M:onSell(who, o, item, nb, before)
if before then o:identify(true) return end
local price = o:getPrice() * self.store.buy_percent / 100
local price = o:getPrice() * util.getval(self.store.buy_percent, self, o) / 100
if price <= 0 or nb <= 0 then return end
price = math.min(price * nb, self.store.purse * nb)
who:incMoney(price)
......@@ -148,11 +148,11 @@ end
-- @return a string (possibly multiline) describing the object
function _M:descObject(who, what, o)
if what == "buy" then
local desc = tstring({"font", "bold"}, {"color", "GOLD"}, ("Buy for: %0.2f gold (You have %0.2f gold)"):format(o:getPrice() * self.store.sell_percent / 100, who.money), {"font", "normal"}, {"color", "LAST"}, true, true)
local desc = tstring({"font", "bold"}, {"color", "GOLD"}, ("Buy for: %0.2f gold (You have %0.2f gold)"):format(o:getPrice() * util.getval(self.store.sell_percent, self, o) / 100, who.money), {"font", "normal"}, {"color", "LAST"}, true, true)
desc:merge(o:getDesc())
return desc
else
local desc = tstring({"font", "bold"}, {"color", "GOLD"}, ("Sell for: %0.2f gold (You have %0.2f gold)"):format(o:getPrice() * self.store.buy_percent / 100, who.money), {"font", "normal"}, {"color", "LAST"}, true, true)
local desc = tstring({"font", "bold"}, {"color", "GOLD"}, ("Sell for: %0.2f gold (You have %0.2f gold)"):format(o:getPrice() * util.getval(self.store.buy_percent, self, o) / 100, who.money), {"font", "normal"}, {"color", "LAST"}, true, true)
desc:merge(o:getDesc())
return desc
end
......@@ -165,9 +165,9 @@ end
-- @return a string describing the price
function _M:descObjectPrice(who, what, o)
if what == "buy" then
return o:getPrice() * self.store.sell_percent / 100, who.money
return o:getPrice() * util.getval(self.store.sell_percent, self, o) / 100, who.money
else
return o:getPrice() * self.store.buy_percent / 100, who.money
return o:getPrice() * util.getval(self.store.buy_percent, self, o) / 100, who.money
end
end
......
......@@ -179,9 +179,9 @@ newEntity{
sell_percent = 140,
min_fill = 10,
max_fill = 20,
filters = {
{ego_chance=80, id=true, ignore={type="money"}},
},
filters = function()
return {id=true, ignore={type="money"}, add_levels=10, ego_chance={ego_chance=100, properties=rng.percent(game.player.level * 2) and {"greater_ego"}}}
end,
},
}
......@@ -193,7 +193,6 @@ newEntity{
purse = 5,
restock_after = 1000,
empty_before_restock = true,
sell_percent = 100,
min_fill = 40,
max_fill = 40,
filters = {
......@@ -218,7 +217,6 @@ newEntity{
purse = 5,
restock_after = 1000,
empty_before_restock = true,
sell_percent = 100,
min_fill = 40,
max_fill = 40,
filters = {
......
......@@ -17,19 +17,20 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
quickEntity('^', {show_tooltip=true, name='mountains', display='^', color=colors.LIGHT_BLUE, image="terrain/mountain.png", block_move=true, block_sight=true})
defineTile('^', "HARDMOUNTAIN_WALL")
defineTile('#', "HARDWALL")
quickEntity('<', {show_tooltip=true, name='portal back', display='<', color=colors.WHITE, change_level=1, change_zone=game.player.last_wilderness, image="terrain/stone_road1.png", add_displays = {mod.class.Grid.new{image="terrain/worldmap.png"}},}, nil, {type="portal", subtype="back"})
quickEntity('t', {show_tooltip=true, name='tree', display='#', color=colors.LIGHT_GREEN, block_move=true, block_sight=true, image="terrain/grass.png", add_displays = {mod.class.Grid.new{image="terrain/tree_alpha2.png"}}})
quickEntity('*', {show_tooltip=true, name='magical rock', display='#', color=colors.GREY, back_color={r=44,g=95,b=43}, block_move=true, block_sight=true, image="terrain/grass.png", add_displays = {mod.class.Grid.new{image="terrain/rock_grass.png"}}})
quickEntity('~', {show_tooltip=true, name='fountain', display='~', color=colors.BLUE, block_move=true, image="terrain/river.png", shader = "water", textures = { function() return _3DNoise, true end }})
quickEntity('.', {show_tooltip=true, name='grass', display='.', color=colors.LIGHT_GREEN, image="terrain/grass.png"})
quickEntity('-', {show_tooltip=true, name='cultivated fields', display=';', color=colors.GREEN, back_color=colors.DARK_GREEN, image="terrain/cultivation.png", equilibrium_level=-10})
quickEntity('_', {show_tooltip=true, name='cobblestone road', display='.', color=colors.WHITE, image="terrain/stone_road1.png"})
defineTile(".", "GRASS")
defineTile("t", {"TREE","TREE2","TREE3","TREE4","TREE5","TREE6","TREE7","TREE8","TREE9","TREE10","TREE11","TREE12","TREE13","TREE14","TREE15","TREE16","TREE17","TREE18","TREE19","TREE20"})
defineTile('*', "ROCK")
defineTile('~', "FOUNTAIN")
defineTile('-', "FIELDS")
defineTile('_', "COBBLESTONE")
quickEntity('2', {show_tooltip=true, name="Jewelry", display='2', color=colors.BLUE, resolvers.store("ANGOLWEN_JEWELRY"), resolvers.chatfeature("jewelry-store"), image="terrain/wood_store_gem.png"})
quickEntity('4', {show_tooltip=true, name="Alchemist", display='4', color=colors.LIGHT_BLUE, resolvers.store("POTION"), image="terrain/wood_store_potion.png"})
quickEntity('5', {show_tooltip=true, name="Library", display='5', color=colors.WHITE, resolvers.store("ANGOLWEN_SCROLL"), image="terrain/wood_store_book.png"})
quickEntity('6', {show_tooltip=true, name="Staves & Wands", display='6', color=colors.RED, resolvers.store("ANGOLWEN_STAFF_WAND"), resolvers.chatfeature("magic-store"), image="terrain/wood_store_closed.png"})
defineTile('2', "HARDWALL", nil, nil, "JEWELRY")
defineTile('4', "HARDWALL", nil, nil, "ALCHEMIST")
defineTile('5', "HARDWALL", nil, nil, "LIBRARY")
defineTile('6', "HARDWALL", nil, nil, "STAVES")
defineTile('@', "GRASS", nil, "SUPREME_ARCHMAGE_LINANIIL")
......@@ -40,15 +41,15 @@ return [[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^2^^4^5^^6^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^.._.._._.._..^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^.._________..^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^...t.._..t...^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^.............^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^.._____________..^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^.._..t._._.t.._..^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^.#2#..#4#5#..#6#.^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^.._...._._...._..^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^.._____________..^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^....t.._..t....^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^...._....^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^.._..^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^._.^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^._.^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^t_t^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^.t_t.^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^._.^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^._.^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^._.^^^^^^^^^^^^^^^^^^^^^^^^
......
......@@ -30,10 +30,9 @@ defineTile("_", "OLD_FLOOR")
defineTile(".", "GRASS")
defineTile("t", {"TREE","TREE2","TREE3","TREE4","TREE5","TREE6","TREE7","TREE8","TREE9","TREE10","TREE11","TREE12","TREE13","TREE14","TREE15","TREE16","TREE17","TREE18","TREE19","TREE20"})
quickEntity('2', {show_tooltip=true, name="Armour Smith", display='2', color=colors.UMBER, resolvers.store("ARMOR"), image="terrain/wood_store_armor.png"})
quickEntity('3', {show_tooltip=true, name="Weapon Smith", display='3', color=colors.UMBER, resolvers.store("WEAPON"), image="terrain/wood_store_weapon.png"})
quickEntity('4', {show_tooltip=true, name="Alchemist", display='4', color=colors.LIGHT_BLUE, resolvers.store("POTION"), image="terrain/wood_store_potion.png"})
quickEntity('5', {show_tooltip=true, name="Scribe", display='5', color=colors.WHITE, resolvers.store("SCROLL"), image="terrain/wood_store_book.png"})
defineTile("2", "HARDWALL", nil, nil, "ARMOR_STORE")
defineTile("3", "HARDWALL", nil, nil, "WEAPON_STORE")
defineTile("5", "HARDWALL", nil, nil, "RUNEMASTER")
-- addSpot section
......@@ -60,12 +59,12 @@ return [[
~~...............##___________##......ttt..~~~~~~~
~~....ttt........#__#########__#...........~~~~~~~
~....ttt.........#_###########_#...........~~~~~~~
~...ttt.....######__#########__######.......~~~~~~
~...ttt.....######__#5#######__######.......~~~~~~
~...t....####_______________________####......~~~~
~......###_______#_____..._____#_______###.....~~~
~.....##________###___.....___###________##....~~~
~....##_________###__..ttt..__###_________##...~~~
~....___________##5__..ttt..__###___________...~~~
~....___________###__..ttt..__###___________...~~~
~....##_________###__..ttt..__###_________##...~~~
~~....##________###___.....___###________##.....~~
~~.....###_______#_____..._____#_______###......~~
......
......@@ -17,4 +17,28 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
load("/data/general/grids/basic.lua")
load("/data/general/grids/forest.lua")
load("/data/general/grids/water.lua")
load("/data/general/grids/mountain.lua")
newEntity{ base = "GRASS", define_as = "FIELDS",
name="cultivated fields",
display=';', image="terrain/cultivation.png"
}
newEntity{ base = "FLOOR", define_as = "COBBLESTONE",
name="cobblestone road",
display='.', image="terrain/stone_road1.png"
}
newEntity{ base = "FLOOR", define_as = "ROCK",
name="magical rock",
image="terrain/grass.png", add_displays = {class.new{image="terrain/maze_rock.png"}},
does_block_move = true
}
newEntity{ base = "DEEP_WATER", define_as = "FOUNTAIN",
name="fountain",
does_block_move = true
}
......@@ -19,26 +19,26 @@
load("/data/general/traps/store.lua")
newEntity{ base = "BASE_STORE", define_as = "ARMOR_STORE",
name="Armoury",
display='2', color=colors.UMBER,
resolvers.store("ZIGUR_ARMOR"),
newEntity{ base = "BASE_STORE", define_as = "JEWELRY",
name="Jewelry",
display='2', color=colors.BLUE,
resolvers.store("ANGOLWEN_JEWELRY"),
}
newEntity{ base = "BASE_STORE", define_as = "WEAPON_STORE",
name="Weapon Store",
display='3', color=colors.UMBER,
resolvers.store("ZIGUR_WEAPON"),
newEntity{ base = "BASE_STORE", define_as = "ALCHEMIST",
name="Alchemist",
display='4', color=colors.GREEN,
resolvers.store("POTION"),
}
newEntity{ base = "BASE_STORE", define_as = "LIBRARY",
name="Library",
display='5', color=colors.RED,
resolvers.store("ZIGUR_LIBRARY"),
resolvers.store("ANGOLWEN_SCROLL"),
}
newEntity{ base = "BASE_STORE", define_as = "TRAINER",
name="Trainer",
display='1', color=colors.UMBER,
resolvers.chatfeature("zigur-trainer", "zigur"),
newEntity{ base = "BASE_STORE", define_as = "STAVES",
name="Staves and Wands",
display='6', color=colors.UMBER,
resolvers.store("ANGOLWEN_STAFF_WAND"),
}
......@@ -71,9 +71,17 @@
</properties>
</tile>
</tileset>
<tileset firstgid="217" name="dg_dungeon32" tilewidth="32" tileheight="32">
<image source="gfx/dg_dungeon32.gif" width="288" height="320"/>
<tile id="0">
<properties>
<property name="display" value="#"/>
</properties>
</tile>
</tileset>
<layer name="Terrain" width="50" height="50">
<data encoding="base64" compression="gzip">
H4sIAAAAAAAAA+2YzQ2DMAyFObNEx2CGLpR5emWA/k5XVU0kyzLBJMR2Ih+eoECT9/EIJgnTNAWXy7geYP8Vt29w7GPAY05z1IXYp47NBjzvceypB46flo37v6DrtD1zeTBHD/5zz1mP/jFL4tD24hz/cX2JW20vnodzWNMoHNbGOa7F3NpsLQ/nsMURop/c75E5rI3zXvOg+j3CkZt/SDJQfXI5MAOey0qw4Hkb7PMoR/J/JVhaM6wEB2fdAN93yJBEneeohONZ2Rb8T/K/ECzcNks5RsjD4vgo5cAsuTYl3lc1HGGjL436UcvBabNFPaee67PX8KQ4bhlpcRz9TmzNITX/GJVjHYTj7Dxq+EfgsDbOJfNoXT8kOKzKOWzJ4rpPaRbwu13bU0kOieMOOHrMZYQ8IIvme79HfQGWdg7AECcAAA==
<data encoding="base64" compression="zlib">
eJztmMsNwyAMhnPOEh0jM3Qh5uk1A/S5SbdpD1iyLAeBCbZBHH6lgQb85Y95hWVZwtSUU60CWcfMxX8RyBMP5oDfGym7kHL6f2sG4Pj+9YjXFZW94vXN1H1QmTXDkR+0LFXnkaPn/MAsND+O8sbrmJVi4r4p6xhLebbIAT5Yx1TDAn5YxzI5Joc34Ty3jgXeKx4zc8dQb35MDl8cIcaTuh+Zw1ue9+oH128JR2qdqMnA9ZnLQRnoXkODJXWmUcoB8V8ZltYMO8Mh2eNhBhBXnyMJx7OyLfwMxL8xLLltSjlG8MNjfkg5KEuqTY3xqoYjHPRlMX/UcuS02WI+577rs89atDhuCVlxlK4TW3No7T9G5dgH4Tjbjxr+ETi85bmmH63nDw0Or5ocvuTx3EfqBV63W8ck8QE47oijR19G8AOzWI77PeoHvmDfOg==
</data>
</layer>
</map>
......@@ -115,7 +115,7 @@
</tileset>
<layer name="Terrain" width="50" height="50">
<data encoding="base64" compression="zlib">
eJzt2tttwzAMBVD7N0tkDM/gLbJAu0PX9DRFgBggBJK6fIhWgnwQBdJY0hFFyXa7L8uyf0ONg8TVY4ka7m9soYYzUMtWMD60j4ijYryIg9YE5/BaKvJU4ajM27FgjtZSPdeWXFgcV837JzvO8f2suuN3nbdOTsfdEM/v315B27kJ4Vkf1Q40Zs8Hja0Jr8M7J6McW6dfj0EzZa4rzjLKQIPbnxAHarGsK6QdzSGdE1x4a32kgToQQ/tcMsrRMyBzbMkHF15L6+iN3VIH1kBNlhpHxy79nrZluY4zIZbIHiRZuTaR6yx7W89hWT/ceLRa8zgkS8/hWc9/61gHl+dPzUfEcmV9WGt91v0Kdcx8fngcmqn6PPeehagNNRzN9yP9IoaN/OzdL0byMdIhPZP11pqnDrIMGY42J6hDagvp03rvLrXXfp7lQPq2PoNo8zHCgayD7GfzbAdnqHBk1wdajxkO2geXD+3c1847y55iMUjtofsv4pByYTHQ91qPFWtTctHPvQ40PO9K0Hc+GfmIjJ+zoHsFarHeg3vGPrPDY0D3LM/ziud+KmLojct63ZWOPdBWz5JtqPo7NVcro+a+yhId/2z/IzA6/gFPh4TY
eJzt2tttwzAMBVD7N0tkDM/gLbJAu0PX9DRFgBggBJK6fIhWgnwQBdJY0hFFyXa7L8uyf0ONg8TVY4ka7m9soYYzUMtWMD60j4ijYryIg9YE5/BaKvJU4ajM27FgjtZSPdeWXFgcV837JzvO8f2suuN3nbdOTsfdEM/v315B27kJ4Vkf1Q40Zs8Hja0Jr8M7J6McW6dfj0EzZa4rzjLKQIPbnxAHarGsK6QdzSGdE1x4a32kgToQQ/tcMsrRMyBz/Lfi+eDCa2kdvbFb6sAaqMlS4+jYpd/TtizXcSbEEtmDJCvXJnKdZW/rOSzrhxuPVmseh2TpObzreaSDy/On5iNiubI+rLU+636FOmY+PzwOzYSe0VnnufcsRG2o4Wi+H+kXMWzkZ+9+MZKPkQ7pmay31jx1kGXIcLQ5QR1SW0if1nt3qb328ywH0rf1GUSbjxEOZB1kP5tnOzhDhSO7PtB6zHDQPrh8aOe+dt5Z9hSLQWoP3X8Rh5QLi4G+13qsWJuSi37udaDheVeCvvPJyEdk/JwF3StQi/Ue3DP2mR0eA7pneZ5XPPdTEUNvXNbrrnTsgbZ6lmxD1d+puVoZNfdVluj4Z/sfgdHxD/vJhNg=
</data>
</layer>
</map>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment