comparison Main.lua @ 12:be3d67c28a27

Refactoring, and record quest ending unit.
author James D. Callahan III <jcallahan@curse.com>
date Tue, 01 May 2012 12:16:17 -0500
parents 0ec5c8f4b72b
children 39972835bdc9
comparison
equal deleted inserted replaced
11:0ec5c8f4b72b 12:be3d67c28a27
471 end 471 end
472 action_data.type = AF.NPC -- This will be set as appropriate below 472 action_data.type = AF.NPC -- This will be set as appropriate below
473 end 473 end
474 474
475 475
476 function WDP:QUEST_COMPLETE() 476 do
477 end 477 local function UpdateQuestJuncture(point)
478 478 local unit_name = _G.UnitName("questnpc")
479 479
480 function WDP:QUEST_DETAIL() 480 if not unit_name then
481 local unit_name = _G.UnitName("questnpc") 481 return
482 482 end
483 if not unit_name then 483 local unit_type, unit_id = WDP:ParseGUID(_G.UnitGUID("questnpc"))
484 return 484
485 end 485 if unit_type == private.UNIT_TYPES.OBJECT then
486 local unit_type, unit_id = self:ParseGUID(_G.UnitGUID("questnpc")) 486 UpdateObjectLocation(unit_id)
487 487 end
488 if unit_type == private.UNIT_TYPES.OBJECT then 488 local quest = UnitEntry("quests", _G.GetQuestID())
489 UpdateObjectLocation(unit_id) 489 quest[point] = quest[point] or {}
490 end 490 quest[point][("%s:%d"):format(private.UNIT_TYPE_NAMES[unit_type + 1], unit_id)] = true
491 local quest = UnitEntry("quests", _G.GetQuestID()) 491 end
492 quest.begin = quest.begin or {} 492
493 quest.begin[("%s:%d"):format(private.UNIT_TYPE_NAMES[unit_type + 1], unit_id)] = true 493
494 end 494 function WDP:QUEST_COMPLETE()
495 UpdateQuestJuncture("end")
496 end
497
498
499 function WDP:QUEST_DETAIL()
500 UpdateQuestJuncture("begin")
501 end
502 end -- do-block
495 503
496 504
497 function WDP:QUEST_LOG_UPDATE() 505 function WDP:QUEST_LOG_UPDATE()
498 self:UnregisterEvent("QUEST_LOG_UPDATE") 506 self:UnregisterEvent("QUEST_LOG_UPDATE")
499 end 507 end