Skip to content
Snippets Groups Projects
Commit 580da612 authored by dg's avatar dg
Browse files

The money achievements will pop no matter the mean of acquiring money

git-svn-id: http://svn.net-core.org/repos/t-engine4@1180 51575b47-30f0-44d4-a5cc-537603b46e54
parent a55459a2
No related branches found
No related tags found
No related merge requests found
......@@ -357,6 +357,18 @@ function _M:magicMap(radius, x, y)
end
end
function _M:incMoney(v)
self.money = self.money + v
if self.money < 0 then self.money = 0 end
self.changed = true
if self.player then
world:gainAchievement("TREASURE_HUNTER", self)
world:gainAchievement("TREASURE_HOARDER", self)
world:gainAchievement("DRAGON_GREED", self)
end
end
function _M:getRankStatAdjust()
if self.rank == 1 then return -1
elseif self.rank == 2 then return -0.5
......
......@@ -73,7 +73,7 @@ end
function _M:onBuy(who, o, item, nb)
local price = o:getPrice() * self.sell_percent / 100
if who.money >= price * nb then
who.money = who.money - price * nb
who:incMoney(- price * nb)
end
end
......@@ -86,7 +86,7 @@ end
function _M:onSell(who, o, item, nb)
local price = o:getPrice() * self.buy_percent / 100
if price <= 0 or nb <= 0 then return end
who.money = who.money + price * nb
who:incMoney(price * nb)
o:identify(true)
end
......
......@@ -24,7 +24,7 @@ local imbue_ring = function(npc, player)
if price > player.money then require("engine.Dialog"):simplePopup("Not enough money", "This costs "..price.." gold, you need more gold.") return end
require("engine.Dialog"):yesnoPopup("Imbue cost", "This will cost you "..price.." gold, do you accept?", function(ret) if ret then
player.money = player.money - price
player:incMoney(-price)
player:removeObject(player:getInven("INVEN"), gem_item)
ring.wielder = ring.wielder or {}
table.mergeAdd(ring.wielder, gem.imbue_powers, true)
......@@ -45,7 +45,7 @@ local artifact_imbue_ring = function(npc, player)
if price > player.money then require("engine.Dialog"):simplePopup("Not enough money", "Limmir needs more gold for the magical plating.") return end
require("engine.Dialog"):yesnoPopup("Imbue cost", "You need to use "..price.." gold for the plating, do you accept?", function(ret) if ret then
player.money = player.money - price
player:incMoney(-price)
local gem3 = game.zone:makeEntity(game.level, "object", {type="gem"}, nil, true)
print("Imbue third gem", gem3.name)
......
......@@ -23,7 +23,7 @@ local function recharge(npc, player)
if cost > player.money then require("engine.Dialog"):simplePopup("Not enough money", "This costs "..cost.." gold.") return true end
require("engine.Dialog"):yesnoPopup("Recharge?", "This will cost you "..cost.." gold.", function(ok) if ok then
o.power = o.max_power
player.money = player.money - cost
player:incMoney(-cost)
player.changed = true
end end)
return true
......
......@@ -34,7 +34,7 @@ newChat{ id="training",
answers = {
{"Please train me in generic weapons and armour usage.", action=function(npc, player)
game.logPlayer(player, "The smith spends some time with you, teaching you the basics of armour and weapon usage.")
player.money = player.money - 50
player:incMoney(-50)
player:learnTalentType("technique/combat-training", true)
player.changed = true
end, cond=function(npc, player)
......@@ -44,7 +44,7 @@ newChat{ id="training",
end},
{"Please train me in the basic usage of bows and slings.", action=function(npc, player)
game.logPlayer(player, "The smith spends some time with you, teaching you the basics of bows and slings.")
player.money = player.money - 8
player:incMoney(-8)
player:learnTalent(player.T_SHOOT, true)
player.changed = true
end, cond=function(npc, player)
......
......@@ -26,15 +26,10 @@ newEntity{
identified = true,
desc = [[All that glitters is not gold, all that is gold does not glitter.]],
on_prepickup = function(self, who, id)
who.money = who.money + self.money_value / 10
who:incMoney(self.money_value / 10)
game.logPlayer(who, "You pickup %0.2f gold pieces.", self.money_value / 10)
-- Remove from the map
game.level.map:removeObject(who.x, who.y, id)
if who.player then
world:gainAchievement("TREASURE_HUNTER", who)
world:gainAchievement("TREASURE_HOARDER", who)
world:gainAchievement("DRAGON_GREED", who)
end
return true
end,
auto_pickup = true,
......
......@@ -47,7 +47,7 @@ leave_zone = function(self, who)
end
if merchant_alive then
game.logPlayer(who, "#LIGHT_BLUE#The merchant thanks you for saving his life. He gives you 8 gold and asks you to meet him again in Minas Tirith.")
who.money = who.money + 8
player:incMoney(8)
who.changed = true
who:setQuestStatus(self.id, engine.Quest.COMPLETED, "saved")
world:gainAchievement("LOST_MERCHANT_RESCUE", game.player)
......
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