Загрузить файлы в «/»
This commit is contained in:
@@ -133,7 +133,8 @@ local function ReceiveProf(text)
|
||||
local _, _, name, realm, pname, r, m, ts, rts, rec =
|
||||
string.find(text, "^P%^([^%^]*)%^([^%^]*)%^([^%^]*)%^(%d*)%^(%d*)%^(%d*)%^(%d*)%^(.*)$")
|
||||
if not name or name == "" or pname == "" then return false end
|
||||
if AA.BadProf(pname, tonumber(m)) then return false end
|
||||
local gone = (tonumber(m) or 0) == 0 and (tonumber(r) or 0) == 0 -- tombstone: profession was dropped
|
||||
if not gone and AA.BadProf(pname, tonumber(m)) then return false end
|
||||
local k = name .. "-" .. realm
|
||||
if AA.db.ignored and AA.db.ignored[k] then return false end
|
||||
local c = AA.db.chars[k]
|
||||
@@ -142,12 +143,23 @@ local function ReceiveProf(text)
|
||||
AA.db.chars[k] = c
|
||||
end
|
||||
c.prof = c.prof or {}
|
||||
c.profGone = c.profGone or {}
|
||||
ts, rts = tonumber(ts) or 0, tonumber(rts) or 0
|
||||
if gone then
|
||||
if ts > (c.profGone[pname] or 0) then
|
||||
c.profGone[pname] = ts
|
||||
local p0 = c.prof[pname]
|
||||
if p0 and ts > (p0.ts or 0) then c.prof[pname] = nil end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
if ts <= (c.profGone[pname] or 0) then return false end -- dropped after this data was written
|
||||
local p = c.prof[pname]
|
||||
if not p then
|
||||
p = {}
|
||||
c.prof[pname] = p
|
||||
end
|
||||
ts, rts = tonumber(ts) or 0, tonumber(rts) or 0
|
||||
local ch = false
|
||||
if ts > (p.ts or 0) then
|
||||
p.ts = ts
|
||||
@@ -284,6 +296,11 @@ local function FileWrite()
|
||||
if c.prof then
|
||||
for pname, p in pairs(c.prof) do table.insert(parts, EncodeProf(c, pname, p)) end
|
||||
end
|
||||
for pname, gts in pairs(c.profGone or {}) do
|
||||
if not (c.prof and c.prof[pname]) then
|
||||
table.insert(parts, "P^" .. c.name .. "^" .. c.realm .. "^" .. pname .. "^0^0^" .. gts .. "^0^")
|
||||
end
|
||||
end
|
||||
if c.invBags or c.bankBags then table.insert(parts, EncodeBags(c)) end
|
||||
if c.equip then
|
||||
table.insert(parts, EncodeEquip(c))
|
||||
|
||||
Reference in New Issue
Block a user