forked from Nevcairiel/GatherMate2_Data
/
GatherMateData.lua
249 lines (235 loc) · 5.53 KB
/
GatherMateData.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
-- nearby check yes/no? slowdown may be an isue if someone leaves the mod enabled and always replace node
local GatherMateData = LibStub("AceAddon-3.0"):NewAddon("GatherMate2_Data")
local GatherMate = LibStub("AceAddon-3.0"):GetAddon("GatherMate2")
GatherMateData.generatedVersion = "@project-revision@"
local bcZones = {
[94] = true,
[95] = true,
[97] = true,
[100] = true,
[102] = true,
[103] = true,
[104] = true,
[105] = true,
[106] = true,
[107] = true,
[108] = true,
[109] = true,
[110] = true,
[111] = true,
[122] = true,
}
local wrathZones = {
[114] = true,
[115] = true,
[116] = true,
[117] = true,
[118] = true,
[119] = true,
[120] = true,
[121] = true,
[123] = true,
[125] = true,
[126] = true,
[127] = true,
[170] = true,
}
local cataZones = {
[174] = true,
[175] = true,
[176] = true,
[177] = true,
[178] = true,
[194] = true,
[198] = true,
[201] = true,
[204] = true,
[205] = true,
[207] = true,
[208] = true,
[209] = true,
[217] = true,
[218] = true,
[241] = true,
[244] = true,
[245] = true,
[276] = true,
}
local mistsZones = {
[371] = true,
[376] = true,
[378] = true,
[379] = true,
[388] = true,
[390] = true,
[418] = true,
[422] = true,
[433] = true,
[504] = true,
[507] = true,
[516] = true,
[554] = true,
}
local wodZones = {
[525] = true,
[534] = true,
[535] = true,
[539] = true,
[542] = true,
[543] = true,
[550] = true,
[572] = true,
[577] = true,
[582] = true,
[588] = true,
[589] = true,
[590] = true,
[622] = true,
[624] = true,
}
local legionZones = {
[627] = true,
[628] = true,
[630] = true,
[634] = true,
[641] = true,
[646] = true,
[650] = true,
[680] = true,
[790] = true,
[830] = true,
[882] = true,
[885] = true,
}
local bfaZones = {
[862] = true,
[863] = true,
[864] = true,
[895] = true,
[896] = true,
[942] = true,
[1161] = true,
[1165] = true,
[1355] = true,
[1462] = true,
}
local slZones = {
[1525] = true,
[1533] = true,
[1536] = true,
[1543] = true,
[1565] = true,
[1670] = true,
}
local dfZones = {
[2022] = true,
[2023] = true,
[2024] = true,
[2025] = true,
[2112] = true,
}
function GatherMateData:PerformMerge(dbs,style, zoneFilter)
local filter = nil
if zoneFilter and type(zoneFilter) == "string" then
if zoneFilter == "TBC" then
filter = bcZones
elseif zoneFilter == "WRATH" then
filter = wrathZones
elseif zoneFilter == "CATACLYSM" then
filter = cataZones
elseif zoneFilter == "MISTS" then
filter = mistsZones
elseif zoneFilter == "WOD" then
filter = wodZones
elseif zoneFilter == "LEGION" then
filter = legionZones
elseif zoneFilter == "BFA" then
filter = bfaZones
elseif zoneFilter == "SL" then
filter = slZones
elseif zoneFilter == "DF" then
filter = dfZones
end
end
if dbs["Mines"] then self:MergeMines(style ~= "Merge",filter) end
if dbs["Herbs"] then self:MergeHerbs(style ~= "Merge",filter) end
if dbs["Gases"] then self:MergeGases(style ~= "Merge",filter) end
if dbs["Fish"] then self:MergeFish(style ~= "Merge",filter) end
if dbs["Treasure"] then self:MergeTreasure(style ~= "Merge",filter) end
if dbs["Archaeology"] then self:MergeArchaelogy(style ~= "Merge",filter) end
self:CleanupImportData()
GatherMate:SendMessage("GatherMateData2Import")
--GatherMate:CleanupDB()
end
-- Insert mining data
function GatherMateData:MergeMines(clear,zoneFilter)
if clear then GatherMate:ClearDB("Mining") end
for zoneID, node_table in pairs(GatherMateData2MineDB) do
if not zoneFilter or zoneFilter[zoneID] then
for coord, nodeID in pairs(node_table) do
GatherMate:InjectNode2(zoneID,coord,"Mining", nodeID)
end
end
end
end
-- herbs
function GatherMateData:MergeHerbs(clear,zoneFilter)
if clear then GatherMate:ClearDB("Herb Gathering") end
for zoneID, node_table in pairs(GatherMateData2HerbDB) do
if not zoneFilter or zoneFilter[zoneID] then
for coord, nodeID in pairs(node_table) do
GatherMate:InjectNode2(zoneID,coord,"Herb Gathering", nodeID)
end
end
end
end
-- gases
function GatherMateData:MergeGases(clear,zoneFilter)
if clear then GatherMate:ClearDB("Extract Gas") end
for zoneID, node_table in pairs(GatherMateData2GasDB) do
if not zoneFilter or zoneFilter[zoneID] then
for coord, nodeID in pairs(node_table) do
GatherMate:InjectNode2(zoneID,coord,"Extract Gas", nodeID)
end
end
end
end
-- fish
function GatherMateData:MergeFish(clear,zoneFilter)
if clear then GatherMate:ClearDB("Fishing") end
for zoneID, node_table in pairs(GatherMateData2FishDB) do
if not zoneFilter or zoneFilter[zoneID] then
for coord, nodeID in pairs(node_table) do
GatherMate:InjectNode2(zoneID,coord,"Fishing", nodeID)
end
end
end
end
function GatherMateData:MergeTreasure(clear,zoneFilter)
if clear then GatherMate:ClearDB("Treasure") end
for zoneID, node_table in pairs(GatherMateData2TreasureDB) do
if not zoneFilter or zoneFilter[zoneID] then
for coord, nodeID in pairs(node_table) do
GatherMate:InjectNode2(zoneID,coord,"Treasure", nodeID)
end
end
end
end
function GatherMateData:MergeArchaelogy(clear,zoneFilter)
if clear then GatherMate:ClearDB("Archaeology") end
for zoneID, node_table in pairs(GatherMateData2ArchaeologyDB) do
if not zoneFilter or zoneFilter[zoneID] then
for coord, nodeID in pairs(node_table) do
GatherMate:InjectNode2(zoneID,coord,"Archaeology", nodeID)
end
end
end
end
function GatherMateData:CleanupImportData()
GatherMateData2HerbDB = nil
GatherMateData2MineDB = nil
GatherMateData2GasDB = nil
GatherMateData2FishDB = nil
GatherMateData2TreasureDB = nil
GatherMateData2ArchaeologyDB = nil
end