diff 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
line wrap: on
line diff
--- a/ObjectiveTracker/ObjectiveTracker.lua	Thu Apr 14 19:39:05 2016 -0400
+++ b/ObjectiveTracker/ObjectiveTracker.lua	Fri Apr 15 07:01:40 2016 -0400
@@ -409,6 +409,67 @@
   end
 end
 
+local iprint = B.print('Info')
+T.SetRewards = function(t, questID)
+
+  SelectQuestLogEntry(GetQuestLogIndexByID(questID))
+  local numQuestChoices = GetNumQuestLogChoices();
+  local skillName, skillIcon, skillPoints = GetQuestLogRewardSkillPoints();
+  local xp = GetQuestLogRewardXP();
+  local playerTitle = GetQuestLogRewardTitle();
+  ProcessQuestLogRewardFactions();
+  local rewards = {}
+  local texture, name, isTradeskillSpell, isSpellLearned, hideSpellLearnText, isBoostSpell, garrFollowerID = GetQuestLogRewardSpell(questID)
+  if name  then
+    tinsert(rewards,{
+      type = 'spell',
+      name = name,
+      texture = texture,
+    })
+  end
+
+  t.numCurrencies = GetNumQuestLogRewardCurrencies(questID)
+  for i = 1, t.numCurrencies do
+    local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID)
+    tinsert(rewards,{
+      type = 'currency',
+      index = i,
+      name = name,
+      texture = texture,
+      count = count
+    });
+  end
+  -- items
+  t.numItems = GetNumQuestLogRewards(questID)
+  for i = 1, t.numItems do
+    local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID)
+    tinsert(rewards, {
+      type = 'item',
+      index = i ,
+      name = name,
+      texture = texture,
+      count = count,
+      quality = quality,
+      isUsable = isUsable
+    });
+  end
+  -- money
+
+  local money = GetQuestLogRewardMoney(questID)
+  if ( money > 0 ) then
+    tinsert(rewards, {
+      type = 'money',
+      name = GetMoneyString(money),
+      texture = "Interface\\Icons\\inv_misc_coin_01",
+      count = 0,
+    });
+  end
+
+  if #rewards >= 1 then
+    t.rewardInfo = rewards
+  end
+end
+
 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end
 
 function T:OnEvent (event, ...)