-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathap_data_storage.lua
More file actions
74 lines (73 loc) · 2.54 KB
/
Copy pathap_data_storage.lua
File metadata and controls
74 lines (73 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
-- AP data storage releated
function AP:getTypeFromDataStorageKey(k)
-- print("AP:getTypeFromDataStorageKey")
local type = "invalid"
local splitResult = split(k, "_")
if #splitResult >= 4 then
if splitResult[1] == "tobir" and tonumber(splitResult[2]) == self.CONNECTION_INFO.team and
tonumber(splitResult[3]) == self.CONNECTION_INFO.slot then
type = splitResult[4]
end
end
return type
end
-- notes
function AP:setPersistentNoteInfo(note_type, player_type, isHardMode)
print("AP:setPersistentNoteInfo", note_type, player_type, isHardMode)
local goal = tonumber(self.SLOT_DATA.goal)
if goal ~= 16 and goal ~= 17 then
return
end
local noteMarkRequireHardMode = self.SLOT_DATA.noteMarkRequireHardMode
-- print("AP:setPersistentNoteInfo", 2, noteMarkRequireHardMode)
if noteMarkRequireHardMode == 1 and not isHardMode then
return
end
local char = -1
for k, v in pairs(self.NOTE_CHARS) do
-- print("AP:setPersistentNoteInfo", 3, player_type, dump_table(v))
if tbl_contains(v, player_type) then
char = k
break
end
end
if char == -1 then
return
end
local key = self:getNoteInfoKey(note_type, char)
self.AP_CLIENT:Set(key, 0, true, {{"replace", 1}})
end
function AP:setupPersistentNoteInfo()
--print("AP:setupPersistentNoteInfo")
local keys = {}
for k, v in pairs(self.NOTE_TYPES) do
for k2, v2 in pairs(self.NOTE_CHARS) do
table.insert(keys, self:getNoteInfoKey(v, k2))
end
end
self.AP_CLIENT:Get(keys)
self.AP_CLIENT:SetNotify(keys)
end
function AP:getNoteInfoKey(note_type, char)
-- print("AP:getNoteInfoKey", note_type, char)
local team = tonumber(self.CONNECTION_INFO.team)
local slot = tonumber(self.CONNECTION_INFO.slot)
return "tobir_" .. team .. "_" .. slot .. "_note_" .. note_type .. "_" .. char
end
-- floors
function AP:getPersistentInfoFurthestFloor()
-- print("AP:getPersistentInfoFurthestFloor")
local team = tonumber(self.CONNECTION_INFO.team)
local slot = tonumber(self.CONNECTION_INFO.slot)
local key = "tobir_" .. team .. "_" .. slot .. "_floor"
self.AP_CLIENT:Get({key})
end
function AP:setPersistentInfoFurthestFloor(op)
if not op then
op = "max"
end
local team = tonumber(self.CONNECTION_INFO.team)
local slot = tonumber(self.CONNECTION_INFO.slot)
local key = "tobir_" .. team .. "_" .. slot .. "_floor"
self.AP_CLIENT:Set(key, 1, true, {{op, self.FURTHEST_FLOOR}})
end