comparison Main.lua @ 52:2bfdce67c71e

Removed the special case kludge for Fishing location field name.
author James D. Callahan III <jcallahan@curse.com>
date Thu, 28 Jun 2012 14:36:36 -0500
parents 9f23fb15adc5
children 052c4075df13
comparison
equal deleted inserted replaced
51:9f23fb15adc5 52:2bfdce67c71e
252 zone_data[("%s:%s:%s"):format(map_level, x, y)] = true 252 zone_data[("%s:%s:%s"):format(map_level, x, y)] = true
253 end 253 end
254 end -- do-block 254 end -- do-block
255 255
256 256
257 local function UpdateDBEntryLocation(entry_type, identifier, location_label) 257 local function UpdateDBEntryLocation(entry_type, identifier)
258 if not identifier then 258 if not identifier then
259 return 259 return
260 end 260 end
261 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData() 261 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData()
262 local entry = DBEntry(entry_type, identifier) 262 local entry = DBEntry(entry_type, identifier)
263 local location_field = location_label or "locations"
264 entry[difficulty_token] = entry[difficulty_token] or {} 263 entry[difficulty_token] = entry[difficulty_token] or {}
265 entry[difficulty_token][location_field] = entry[difficulty_token][location_field] or {} 264 entry[difficulty_token].locations = entry[difficulty_token].locations or {}
266 265
267 local zone_token = ("%s:%d"):format(zone_name, area_id) 266 local zone_token = ("%s:%d"):format(zone_name, area_id)
268 local zone_data = entry[difficulty_token][location_field][zone_token] 267 local zone_data = entry[difficulty_token].locations[zone_token]
269 268
270 if not zone_data then 269 if not zone_data then
271 zone_data = {} 270 zone_data = {}
272 entry[difficulty_token][location_field][zone_token] = zone_data 271 entry[difficulty_token].locations[zone_token] = zone_data
273 end 272 end
274 local location_token = ("%s:%s:%s"):format(map_level, x, y) 273 local location_token = ("%s:%s:%s"):format(map_level, x, y)
275 zone_data[location_token] = zone_data[location_token] or true 274 zone_data[location_token] = zone_data[location_token] or true
276 return zone_data 275 return zone_data
277 end 276 end
1236 1235
1237 action_data.type = AF.OBJECT 1236 action_data.type = AF.OBJECT
1238 action_data.identifier = identifier 1237 action_data.identifier = identifier
1239 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then 1238 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then
1240 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name. 1239 local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name.
1241 action_data.zone_data = UpdateDBEntryLocation("zones", identifier, (spell_label == "FISHING") and "fishing_locations" or nil) 1240 action_data.zone_data = UpdateDBEntryLocation("zones", identifier)
1242 action_data.type = AF.ZONE 1241 action_data.type = AF.ZONE
1243 action_data.identifier = identifier 1242 action_data.identifier = identifier
1244 action_data.spell_label = spell_label 1243 action_data.spell_label = spell_label
1245 end 1244 end
1246 end 1245 end