comparison ObjectiveTracker/ObjectiveTracker.lua @ 32:a3afe6c3771e

- organize and display reward icons as a background hint - centralize reward data function
author Nenue
date Fri, 15 Apr 2016 07:01:40 -0400
parents 7583684becf4
children 64f2a9bbea79
comparison
equal deleted inserted replaced
31:48b3e3959a0a 32:a3afe6c3771e
407 T.animateReasons = T.animateReasons - reason 407 T.animateReasons = T.animateReasons - reason
408 end 408 end
409 end 409 end
410 end 410 end
411 411
412 local iprint = B.print('Info')
413 T.SetRewards = function(t, questID)
414
415 SelectQuestLogEntry(GetQuestLogIndexByID(questID))
416 local numQuestChoices = GetNumQuestLogChoices();
417 local skillName, skillIcon, skillPoints = GetQuestLogRewardSkillPoints();
418 local xp = GetQuestLogRewardXP();
419 local playerTitle = GetQuestLogRewardTitle();
420 ProcessQuestLogRewardFactions();
421 local rewards = {}
422 local texture, name, isTradeskillSpell, isSpellLearned, hideSpellLearnText, isBoostSpell, garrFollowerID = GetQuestLogRewardSpell(questID)
423 if name then
424 tinsert(rewards,{
425 type = 'spell',
426 name = name,
427 texture = texture,
428 })
429 end
430
431 t.numCurrencies = GetNumQuestLogRewardCurrencies(questID)
432 for i = 1, t.numCurrencies do
433 local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID)
434 tinsert(rewards,{
435 type = 'currency',
436 index = i,
437 name = name,
438 texture = texture,
439 count = count
440 });
441 end
442 -- items
443 t.numItems = GetNumQuestLogRewards(questID)
444 for i = 1, t.numItems do
445 local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID)
446 tinsert(rewards, {
447 type = 'item',
448 index = i ,
449 name = name,
450 texture = texture,
451 count = count,
452 quality = quality,
453 isUsable = isUsable
454 });
455 end
456 -- money
457
458 local money = GetQuestLogRewardMoney(questID)
459 if ( money > 0 ) then
460 tinsert(rewards, {
461 type = 'money',
462 name = GetMoneyString(money),
463 texture = "Interface\\Icons\\inv_misc_coin_01",
464 count = 0,
465 });
466 end
467
468 if #rewards >= 1 then
469 t.rewardInfo = rewards
470 end
471 end
472
412 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end 473 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end
413 474
414 function T:OnEvent (event, ...) 475 function T:OnEvent (event, ...)
415 local isHandled 476 local isHandled
416 print('OnEvent(|cFF00FF00'.. event ..'|r):', ...) 477 print('OnEvent(|cFF00FF00'.. event ..'|r):', ...)