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

Online charsheets now store some more flags that will later allow the website...

Online charsheets now store some more flags that will later allow the website to be used to search for characters


git-svn-id: http://svn.net-core.org/repos/t-engine4@2207 51575b47-30f0-44d4-a5cc-537603b46e54
parent db966fa4
No related branches found
No related tags found
No related merge requests found
......@@ -188,6 +188,8 @@ function _M:instanciate(mod, name, new_game, no_reboot)
if mod.short_name == "boot" then profile.hash_valid = true end
mod.version_name = ("%s-%d.%d.%d"):format(mod.short_name, mod.version[1], mod.version[2], mod.version[3])
profile.generic.modules_loaded = profile.generic.modules_loaded or {}
profile.generic.modules_loaded[mod.short_name] = (profile.generic.modules_loaded[mod.short_name] or 0) + 1
......@@ -252,7 +254,7 @@ function _M:instanciate(mod, name, new_game, no_reboot)
-- Disable the profile if ungood
if mod.short_name ~= "boot" then
local ok, err = profile:checkModuleHash(("%s-%d.%d.%d"):format(mod.short_name, mod.version[1], mod.version[2], mod.version[3]), fmd5)
local ok, err = profile:checkModuleHash(mod.version_name, fmd5)
if not ok then
game.log("#LIGHT_RED#Profile disabled due to %s.", err)
end
......
......@@ -346,10 +346,10 @@ function _M:registerNewCharacter(module)
return data.uuid
end
function _M:registerSaveChardump(module, uuid, title, data)
function _M:registerSaveChardump(module, uuid, title, tags, data)
if not self.auth or not self.hash_valid then return end
local dialog = Dialog:simplePopup("Uploading character data", "Character sheet is being uploaded to http://te4.org/") dialog.__showup = nil core.display.forceRedraw()
local data = self:rpc{action="SaveChardump", login=self.login, hash=self.auth.hash, module=module, uuid=uuid, title=title, data=data}
local data = self:rpc{action="SaveChardump", login=self.login, hash=self.auth.hash, module=module, uuid=uuid, title=title, tags=tags, data=data}
game:unregisterDialog(dialog)
if not data or not data.ok then return end
print("[ONLINE PROFILE] saved character ", uuid)
......
......@@ -43,11 +43,11 @@ function _M:saveUUID()
return self[table]
end,
}})
local title = self:dumpToJSON(data)
local title, tags = self:dumpToJSON(data)
data = json.encode(data)
if not data or not title then return end
profile:registerSaveChardump(game.__mod_info.short_name, self.__te4_uuid, title, core.zlib.compress(data))
profile:registerSaveChardump(game.__mod_info.short_name, self.__te4_uuid, title, tags, core.zlib.compress(data))
end
--- Override this method to define dump sections
......
......@@ -275,5 +275,17 @@ function _M:dumpToJSON(js)
end
end
return title
local tags = {
game = game.__mod_info.version_name,
level = self.level,
name = self.name,
difficulty = self.descriptor.difficulty,
campaign = self.descriptor.world,
race = self.descriptor.subrace,
class = self.descriptor.subclass,
dead = self.dead and "dead" or nil,
winner = self.winner and "winner" or nil,
}
return title, tags
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