comparison Main.lua @ 180:466187ddb947

Removed some unneeded Debug prints.
author James D. Callahan III <jcallahan@curse.com>
date Tue, 06 Nov 2012 09:50:06 -0600
parents f5e3662ed5f9
children 5d166590440e
comparison
equal deleted inserted replaced
179:f5e3662ed5f9 180:466187ddb947
276 end -- do-block 276 end -- do-block
277 277
278 278
279 -- Called on a timer 279 -- Called on a timer
280 local function ClearKilledNPC() 280 local function ClearKilledNPC()
281 Debug("Clearing last_killed_npc_id")
282 killed_npc_id = nil 281 killed_npc_id = nil
283 end 282 end
284 283
285 284
286 local function IsRaidFinderInstance(instance_type, instance_difficulty) 285 local function IsRaidFinderInstance(instance_type, instance_difficulty)
368 end 367 end
369 368
370 if y % 2 ~= 0 then 369 if y % 2 ~= 0 then
371 y = y + 1 370 y = y + 1
372 end 371 end
373 Debug(("x: %d y: %d map_id: %d"):format(x, y, _G.GetCurrentMapAreaID()))
374 return _G.GetRealZoneText(), current_area_id, x, y, map_level, InstanceDifficultyToken() 372 return _G.GetRealZoneText(), current_area_id, x, y, map_level, InstanceDifficultyToken()
375 end 373 end
376 374
377 375
378 local function ItemLinkToID(item_link) 376 local function ItemLinkToID(item_link)
517 if current_line:GetText() == _G.ITEM_OPENABLE then 515 if current_line:GetText() == _G.ITEM_OPENABLE then
518 table.wipe(current_action) 516 table.wipe(current_action)
519 current_action.target_type = AF.ITEM 517 current_action.target_type = AF.ITEM
520 current_action.identifier = item_id 518 current_action.identifier = item_id
521 current_action.loot_label = "contains" 519 current_action.loot_label = "contains"
522
523 Debug(("HandleItemUse: current_action.identifier: '%s'"):format(item_id))
524 break 520 break
525 end 521 end
526 end 522 end
527 end 523 end
528 524
1037 category = AF.NPC 1033 category = AF.NPC
1038 end 1034 end
1039 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category] 1035 local update_func = CHAT_MSG_LOOT_UPDATE_FUNCS[category]
1040 1036
1041 if not category or not update_func then 1037 if not category or not update_func then
1042 Debug("No update func found")
1043 return 1038 return
1044 end 1039 end
1045 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE) 1040 local item_link, quantity = deformat(message, _G.LOOT_ITEM_PUSHED_SELF_MULTIPLE)
1046 1041
1047 if not item_link then 1042 if not item_link then
1048 quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF) 1043 quantity, item_link = 1, deformat(message, _G.LOOT_ITEM_PUSHED_SELF)
1049 end 1044 end
1050 local item_id = ItemLinkToID(item_link) 1045 local item_id = ItemLinkToID(item_link)
1051 1046
1052 if not item_id then 1047 if not item_id then
1053 Debug(("%s: No item_id found."):format(event_name))
1054 return 1048 return
1055 end 1049 end
1056 update_func(item_id, quantity) 1050 update_func(item_id, quantity)
1057 end 1051 end
1058 end 1052 end
1178 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name) 1172 UNIT_DIED = function(sub_event, source_guid, source_name, source_flags, dest_guid, dest_name, dest_flags, spell_id, spell_name)
1179 if dest_guid ~= _G.UnitGUID("target") then 1173 if dest_guid ~= _G.UnitGUID("target") then
1180 return 1174 return
1181 end 1175 end
1182 local unit_type, unit_idnum = ParseGUID(dest_guid) 1176 local unit_type, unit_idnum = ParseGUID(dest_guid)
1183
1184 Debug(sub_event)
1185 1177
1186 if not unit_idnum or not UnitTypeIsNPC(unit_type) then 1178 if not unit_idnum or not UnitTypeIsNPC(unit_type) then
1187 ClearKilledNPC() 1179 ClearKilledNPC()
1188 private.harvesting = nil 1180 private.harvesting = nil
1189 return 1181 return
1315 if not modded_faction or faction_name == modded_faction then 1307 if not modded_faction or faction_name == modded_faction then
1316 modifier = modifier + MODIFIERS[buff_label].modifier 1308 modifier = modifier + MODIFIERS[buff_label].modifier
1317 end 1309 end
1318 end 1310 end
1319 end 1311 end
1320 Debug(("Setting reputation for %s."):format(faction_name))
1321 npc.reputations = npc.reputations or {} 1312 npc.reputations = npc.reputations or {}
1322 npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier) 1313 npc.reputations[("%s:%s"):format(faction_name, faction_standings[faction_name])] = math.floor(amount / modifier)
1323 end 1314 end
1324 end -- do-block 1315 end -- do-block
1325 1316
1388 end 1379 end
1389 1380
1390 if not locked_item_id or (current_action.identifier and current_action.identifier ~= locked_item_id) then 1381 if not locked_item_id or (current_action.identifier and current_action.identifier ~= locked_item_id) then
1391 return false 1382 return false
1392 end 1383 end
1393 Debug(("LOOT_VERIFY_FUNCS[AF.ITEM]: current_action.identifier: '%s'"):format(locked_item_id))
1394 current_action.identifier = locked_item_id 1384 current_action.identifier = locked_item_id
1395 return true 1385 return true
1396 end, 1386 end,
1397 [AF.NPC] = function() 1387 [AF.NPC] = function()
1398 if not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then 1388 if not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then
1510 if current_loot then 1500 if current_loot then
1511 return 1501 return
1512 end 1502 end
1513 1503
1514 if not current_action.target_type then 1504 if not current_action.target_type then
1515 Debug("No target type.") 1505 return
1516 return
1517 else
1518 Debug(("current_action.target_type: %s"):format(private.ACTION_TYPE_NAMES[current_action.target_type]))
1519 end 1506 end
1520 1507
1521 local verify_func = LOOT_OPENED_VERIFY_FUNCS[current_action.target_type] 1508 local verify_func = LOOT_OPENED_VERIFY_FUNCS[current_action.target_type]
1522 local update_func = LOOT_OPENED_UPDATE_FUNCS[current_action.target_type] 1509 local update_func = LOOT_OPENED_UPDATE_FUNCS[current_action.target_type]
1523 1510
2024 current_action.target_type = AF.NPC 2011 current_action.target_type = AF.NPC
2025 end 2012 end
2026 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then 2013 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then
2027 current_action.target_type = AF.ITEM 2014 current_action.target_type = AF.ITEM
2028 2015
2029 Debug(("%s: Item name: '%s'"):format(event_name, tostring(item_name)))
2030
2031 if item_name and item_name == target_name then 2016 if item_name and item_name == target_name then
2032 current_action.identifier = ItemLinkToID(item_link) 2017 current_action.identifier = ItemLinkToID(item_link)
2033 elseif target_name and target_name ~= "" then 2018 elseif target_name and target_name ~= "" then
2034 current_action.identifier = ItemLinkToID(select(2, _G.GetItemInfo(target_name))) 2019 current_action.identifier = ItemLinkToID(select(2, _G.GetItemInfo(target_name)))
2035 end 2020 end
2036 Debug(("%s: current_action.identifier: '%s'"):format(event_name, tostring(current_action.identifier)))
2037 elseif not item_name and not unit_name then 2021 elseif not item_name and not unit_name then
2038 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then 2022 if bit.band(spell_flags, AF.OBJECT) == AF.OBJECT then
2039 if target_name == "" then 2023 if target_name == "" then
2040 Debug("Didn't set current_action.target_type")
2041 return 2024 return
2042 end 2025 end
2043 current_action.object_name = target_name 2026 current_action.object_name = target_name
2044 current_action.target_type = AF.OBJECT 2027 current_action.target_type = AF.OBJECT
2045
2046 Debug(("Set current_action.target_type to %s"):format(private.ACTION_TYPE_NAMES[current_action.target_type]))
2047 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then 2028 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then
2048 current_action.target_type = AF.ZONE 2029 current_action.target_type = AF.ZONE
2049 end 2030 end
2050 end 2031 end
2051 private.tracked_line = spell_line 2032 private.tracked_line = spell_line