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

get charballs t oo

git-svn-id: http://svn.net-core.org/repos/t-engine4@4932 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8ca940fb
No related branches found
No related tags found
No related merge requests found
......@@ -627,6 +627,20 @@ function _M:registerNewCharacter(module)
return uuid
end
function _M:getCharball(id_profile, uuid)
if not self.auth then return end
local dialog = Dialog:simpleWaiter("Retrieving data from the server", "Retrieving...")
core.display.forceRedraw()
local data = nil
core.profile.pushOrder(table.serialize{o="GetCharball", module=game.__mod_info.short_name, uuid=uuid, id_profile=id_profile})
self:waitEvent("GetCharball", function(e) data = e.data end, 30000)
dialog:done()
if not data then return end
return data
end
function _M:registerSaveCharball(module, uuid, data)
if not self.auth or not self.hash_valid then return end
core.profile.pushOrder(table.serialize{o="SaveCharball",
......
......@@ -352,6 +352,19 @@ function _M:orderSaveCharball(o)
cprofile.pushEvent("e='SaveCharball' ok=true")
end
function _M:orderGetCharball(o)
self:command("CHAR", "GETCHARBALL", o.id_profile, o.uuid, o.module)
if self:read("200") then
local _, _, size = self.last_line:find("^([0-9]+)")
size = tonumber(size)
if not size or size < 1 then return end
local body = self:receive(size)
cprofile.pushEvent(string.format("e='GetCharball' id_profile=%q uuid=%q data=%q", o.id_profile, o.uuid, body))
else
cprofile.pushEvent(string.format("e='GetCharball' id_profile=%q uuid=%q unknown=true", o.id_profile, o.uuid))
end
end
function _M:orderCurrentCharacter(o)
self:command("CHAR", "CUR", table.serialize(o))
self.cur_char = o
......
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