Skip to content
Snippets Groups Projects
Commit 3b48c5b5 authored by dg's avatar dg
Browse files

ix

git-svn-id: http://svn.net-core.org/repos/t-engine4@860 51575b47-30f0-44d4-a5cc-537603b46e54
parent 261c5aa6
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,7 @@ function _M:loadGenericProfile()
local field = file:gsub(".profile$", "")
self.generic[field] = self.generic[field] or {}
self:loadData(f, self.generic[field])
if not self.generic[field].__uuid then self.generic[field].__uuid = util.uuid() end
end
end
......@@ -124,6 +125,7 @@ function _M:loadModuleProfile(short_name)
local field = file:gsub(".profile$", "")
self.modules[short_name][field] = self.modules[short_name][field] or {}
self:loadData(f, self.modules[short_name][field])
if not self.modules[short_name][field].__uuid then self.modules[short_name][field].__uuid = util.uuid() end
end
end
......
......@@ -25,11 +25,11 @@ module(..., package.seeall, class.make)
_M.quest_class = "engine.Quest"
--- Grants a quest to an actor from the given quest definition
function _M:grantQuest(quest)
function _M:grantQuest(quest, args)
if type(quest) == "string" then
local f, err = loadfile("/data/quests/"..quest..".lua")
if not f and err then error(err) end
local ret = {}
local ret = args or {}
setfenv(f, setmetatable(ret, {__index=_G}))
f()
ret.id = ret.id or quest
......
......@@ -533,3 +533,11 @@ function util.show_backtrace()
level = level + 1
end
end
function util.uuid()
local x = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}
local y = {'8', '9', 'a', 'b'}
local tpl = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
local uuid = tpl:gsub("[xy]", function(c) if c=='y' then return rng.table(y) else return rng.table(x) end end)
return uuid
end
-- ToME - Tales of Middle-Earth
-- 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
-- Random escort
id = "escort-duty-"..game.zone.short_name.."-"..game.level.level
kind = {}
name = ""
desc = function(self, who)
local desc = {}
desc[#desc+1] = "Escort"
return table.concat(desc, "\n")
end
on_grant = function(self, who)
self.on_grant = nil
local types = {
{ name="warrior",
types = {
["technique/combat-training"] = 0.7,
["technique/combat-techniques-active"] = 0.7,
["technique/combat-techniques-passive"] = 0.7,
},
talents =
{
[who.T_RUSH] = 1,
},
stats =
{
[who.STAT_STR] = 2,
[who.STAT_DEX] = 1,
[who.STAT_CON] = 2,
}
},
}
end
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