-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.lua
161 lines (148 loc) · 4.02 KB
/
data.lua
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
local parsers = require "parsers"
local map = require "map"
local Data = {
map = {
id = nil,
explored = {},
},
game = {
rng_state = 0,
},
hero = {
stats = {
xp = 0,
level = 0,
hp = 0,
hpMax = 0,
mp = 0,
mpMax = 0,
strength = 0,
agility = 0,
attack = 0,
defense = 0,
},
gold = 0,
equipment = {
weapon = nil,
armor = nil,
shield = nil,
},
quest_progress = {
left_throne_room = false,
green_dragon_trap = false,
golem_trap = false,
princess_rescued = false,
princess_returned = false,
rainbow_bridge = false,
charlock_stairs = false,
},
quest_items = {
dragon_scale = false,
fighter_ring = false,
death_necklace = false,
gwaelin_love = false,
erdrick_token = false,
silver_harp = false,
fairy_flute = false,
stones_of_sunlight = false,
staff_of_rain = false,
rainbow_drop = false,
ball_of_light = false,
},
equipped = {
dragon_scale = false,
fighter_ring = false,
death_necklace = false,
cursed_belt = false,
},
items = {
magic_key = 0,
herb = 0,
torch = 0,
wings = 0,
fairy_water = 0,
cursed_belt = 0,
},
spells = {
HEAL = false,
HURT = false,
SLEEP = false,
RADIANT = false,
STOPSPELL = false,
OUTSIDE = false,
RETURN = false,
REPEL = false,
HEALMORE = false,
HURTMORE = false,
},
},
}
local function updateMapData(TrackedValues)
return {
id = parsers.parseMap(TrackedValues.map.memValue) or nil,
explored = map.updateMapExplored(TrackedValues),
}
end
local function updateGameData(TrackedValues)
return {
-- TODO: implement this
rng_state = 0,
}
end
local function updateHeroStats(TrackedValues)
return parsers.parseStats(TrackedValues)
end
local function updateHeroEquipment(TrackedValues)
return parsers.parseEquipment(TrackedValues.equipment.memValue)
end
local function updateHeroQuestProgress(TrackedValues)
return parsers.parseQuestProgress(
TrackedValues.quest.memvValue,
TrackedValues.quest2.memValue,
TrackedValues.quest3.memValue
)
end
local function updateHeroQuestItems(TrackedValues)
return parsers.parseQuestItems(
TrackedValues.items.memValue
)
end
local function updateHeroEquipped(TrackedValues)
return parsers.parseEquipped(
TrackedValues.quest.memValue
)
end
local function updateHeroItems(TrackedValues)
return parsers.parseItems(
TrackedValues.items.memValue,
TrackedValues.keys.memValue,
TrackedValues.herbs.memValue
)
end
local function updateHeroSpells(TrackedValues)
return parsers.parseSpells(
TrackedValues.spells.memValue,
TrackedValues.quest.memValue
)
end
local function updateHeroData(TrackedValues)
return {
stats = updateHeroStats(TrackedValues),
gold = TrackedValues.gold.memValue or 0,
equipment = updateHeroEquipment(TrackedValues),
quest_progress = updateHeroQuestProgress(TrackedValues),
quest_items = updateHeroQuestItems(TrackedValues),
equipped = updateHeroEquipped(TrackedValues),
items = updateHeroItems(TrackedValues),
spells = updateHeroSpells(TrackedValues),
}
end
local function updateData(TrackedValues, dataTable)
dataTable.map = updateMapData(TrackedValues)
dataTable.game = updateGameData(TrackedValues)
dataTable.hero = updateHeroData(TrackedValues)
end
return {
Data = Data,
updateData = updateData,
}