Skip to content
Snippets Groups Projects
Commit 142dd3d7 authored by dg's avatar dg
Browse files

Each achievement now have three versions, one for each difficulty level

git-svn-id: http://svn.net-core.org/repos/t-engine4@1034 51575b47-30f0-44d4-a5cc-537603b46e54
parent b42a3cd6
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,11 @@ require "engine.Dialog"
module(..., package.seeall, class.inherit(engine.Dialog))
function _M:init(title)
engine.Dialog.init(self, title or "Achievements", game.w * 0.8, game.h * 0.8, nil, nil, nil, core.display.newFont("/data/font/VeraMono.ttf", 12))
local total = #world.achiev_defs
local nb = 0
for id, data in pairs(world.achieved) do nb = nb + 1 end
engine.Dialog.init(self, (title or "Achievements").." ("..nb.."/"..total..")", game.w * 0.8, game.h * 0.8, nil, nil, nil, core.display.newFont("/data/font/VeraMono.ttf", 12))
self:generateList()
......
......@@ -19,10 +19,10 @@
require "engine.class"
require "engine.World"
require "engine.interface.WorldAchievements"
require "mod.class.interface.WorldAchievements"
local Savefile = require "engine.Savefile"
module(..., package.seeall, class.inherit(engine.World, engine.interface.WorldAchievements))
module(..., package.seeall, class.inherit(engine.World, mod.class.interface.WorldAchievements))
function _M:init()
engine.World.init(self)
......@@ -54,5 +54,8 @@ function _M:gainAchievement(id, src, ...)
-- Do not unlock things in easy mode
if not a or (game.difficulty == game.DIFFICULTY_EASY and not a.tutorial) then return end
engine.interface.WorldAchievements.gainAchievement(self, id, src, ...)
if game.difficulty == game.DIFFICULTY_NIGHTMARE then id = "NIGHTMARE_"..id end
if game.difficulty == game.DIFFICULTY_INSANE then id = "INSANE_"..id end
mod.class.interface.WorldAchievements.gainAchievement(self, id, src, ...)
end
-- TE4 - T-Engine 4
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local WA = require "engine.interface.WorldAchievements"
local table = table
--- Handles archievements in a world
module(..., package.seeall, class.inherit({}, WA))
--- Make a new achivement with a name and desc
function _M:newAchievement(t)
t.id = t.id or t.name
t.id = t.id:upper():gsub("[ ]", "_")
WA.newAchievement(self, t)
local t2 = table.clone(t)
t2.id = "NIGHTMARE_"..t2.id
t2.name = t2.name.." (Nightmare difficulty)"
WA.newAchievement(self, t2)
local t2 = table.clone(t)
t2.id = "INSANE_"..t2.id
t2.name = t2.name.." (Insane difficulty)"
WA.newAchievement(self, t2)
end
......@@ -35,7 +35,7 @@ local ActorInventory = require "engine.interface.ActorInventory"
local ActorLevel = require "engine.interface.ActorLevel"
local Birther = require "engine.Birther"
local Store = require "mod.class.Store"
local WorldAchievements = require "engine.interface.WorldAchievements"
local WorldAchievements = require "mod.class.interface.WorldAchievements"
local Quest = require "engine.Quest"
config.settings.tome = config.settings.tome or {}
......
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