/trunk
--[[ |
Desc: |
Info: $Id: turnin.lua 25 2009-05-04 10:55:20Z draake $ |
Info: $Id: turnin.lua 28 2009-05-07 04:22:11Z draake $ |
]] |
local _G = _G |
self.tracker.gossip[title] = true |
return true |
end |
if self:GetPVar("stickyturnin") and self.tracker.gossip[title] ~= nil then |
if self.tracker.gossip[title] ~= nil then |
return self.tracker.gossip[title] |
end |
local found, _, questType, questTag, _, _, enabled = self:GetQuestBaseInfo(title) |
local found, _, questType, questTag, _, enabled = self:GetQuestBaseInfo(title) |
if ( not found ) then |
return self:TypeIDActive("normal") |
end |
function EasyDaily:CanCompleteRepeatQuest(title) |
local _, _, questType = self:GetQuestBaseInfo(title) |
--~ local objective = self:GetQuestObjective(title) |
if ( questType == "repeat" ) and objective then |
local objective = self:GetQuestObjective(title) |
if ( questType == "repeat" ) and objective and #objective > 0 then |
local minimum |
for i, v in ipairs(objective) do |
local count = self:CountContainerItem(v.index) |
local floor = math.floor( count / v.need ) |
self:Debug(v.name, count, v.need, floor) |
minimum = math.min( floor, amount or math.huge ) |
for _, objString in ipairs(objective) do |
local _, index, need = self:StrSplit(":", objString) |
local count = self:CountContainerItem(index) |
local floor = math.floor( count / need ) |
self:Debug(GetItemInfo(index), count, need, floor) |
minimum = math.min( floor, minimum or math.huge ) |
end |
return ( minimum > 0 ) and minimum |
end |
return true -- ONLY UNTIL OBJECTIVES ARE PROPERLY STORED |
--~ return true -- ONLY UNTIL OBJECTIVES ARE PROPERLY STORED |
end |
-------------------------------------------------------------------------------------------------- |
-- Quest/Gossip Frame Events/Functions |
-------------------------------------------------------------------------------------------------- |
local autoText = sformat(NORMAL_QUEST_DISPLAY, L["Auto"]) |
-- Triggers on: Active, Available/Repeatable |
-- Type: Parent |
function EasyDaily:QUEST_GREETING() |
self:Debug("QUEST_GREETING") |
self:QuestGreeting() |
end |
function EasyDaily:QuestGreeting(refresh) |
if ( not QuestFrameGreetingPanel:IsShown() ) or ( not self:IsEnabled() ) then |
return |
self.tracker.gossip.parent = true |
local r = {} |
local active_title, active_index, active_priority |
local available_title, available_index, available_priority |
for n = 1, MAX_NUM_QUESTS, 1 do |
local b = _G["QuestTitleButton" .. n] |
if b:IsShown() then |
local i = b:GetID() |
local title, isTrivial, isActive |
if b.isActive == 0 then |
title, isTrivial = GetAvailableTitle(i), IsAvailableQuestTrivial(i) |
if ( not refresh ) and ( not r.title ) then |
self:Debug("Checking Available Quest:", title) |
if self:CanAdvanceAvailableQuest(title) then |
local button = _G["QuestTitleButton" .. n] |
if button:IsShown() then |
local i = button:GetID() |
if button.isActive == 0 then |
local title, isTrivial = GetAvailableTitle(i), IsAvailableQuestTrivial(i) |
if self:CanAdvanceAvailableQuest(title) then |
local priority = self:GetHandleValue("quest", title, "priority") or 0 |
if ( not available_priority ) or ( priority > available_priority ) then |
self:Debug("Eligible Available Quest:", title) |
r.title = title |
r.available = i |
available_title, available_index, available_priority = title, i, priority |
end |
end |
elseif b.isActive == 1 then |
title, isTrivial, isActive = GetActiveTitle(i), IsActiveQuestTrivial(i), true |
if ( not refresh ) and ( not r.title ) then |
self:Debug("Checking Active Quest:", title) |
if self:CanAdvanceActiveQuest(title) then |
button.title = title |
button.active = nil |
elseif button.isActive == 1 then |
local title, isTrivial = GetActiveTitle(i), IsActiveQuestTrivial(i) |
if self:CanAdvanceActiveQuest(title) then |
local priority = self:GetHandleValue("quest", title, "priority") or 0 |
if ( not active_priority ) or ( priority > active_priority ) then |
self:Debug("Eligible Active Quest:", title) |
r.title = title |
r.active = i |
active_title, active_index, active_priority = title, i, priority |
end |
end |
button.title = title |
button.active = true |
end |
b.title = title |
b.trivial = isTrivial |
-- Extra Gossip text |
if self:GetPVar("gossipstate") and self:GetQuestState(title) then |
b:SetFormattedText("%s (%s)", b:GetText(), autoText) |
end |
-- Icon Settings |
if b.icon and self:GetPVar("gossipicons") then |
self:SetGossipIcon(b.icon, title, isActive) |
end |
else |
button.title = nil |
button.active = nil |
end |
end |
if r.active then |
self:Debug("Selecting Active Quest:", r.title) |
SelectActiveQuest(r.active) |
elseif r.available then |
self:Debug("Selecting Available Quest:", r.title) |
SelectAvailableQuest(r.available) |
self:UpdateGossipOrQuestFrame() |
if active_title then |
self:Debug("Selecting Active Quest:", active_title) |
SelectActiveQuest(active_index) |
elseif available_title then |
self:Debug("Selecting Available Quest:", available_title) |
SelectAvailableQuest(available_index) |
end |
end |
-- Type: Parent |
function EasyDaily:GOSSIP_SHOW() |
self:Debug("GOSSIP_SHOW") |
self:GossipShow() |
end |
function EasyDaily:GossipShow(refresh) |
if ( not GossipFrame:IsShown() ) or ( not self:IsEnabled() ) then |
return |
local v, j, g = self:Pack(GetGossipAvailableQuests()), self:Pack(GetGossipActiveQuests()), self:Pack(GetGossipOptions()) |
local r = {} |
local active_title, active_index, active_priority |
local available_title, available_index, available_priority |
for n = 1, NUMGOSSIPBUTTONS, 1 do |
local b = _G["GossipTitleButton" .. n] |
if b:IsShown() then |
local i = b:GetID() |
local button = _G["GossipTitleButton" .. n] |
if button:IsShown() and button.type ~= "Gossip" then |
local i = button:GetID() |
local index = ( i - 1 ) * 3 + 1 |
local title, isTrivial, isActive |
if b.type == "Available" then |
title, isTrivial = v[index], v[index + 2] |
if ( not refresh ) and ( not r.title ) then |
self:Debug("Checking Available Quest:", title) |
if self:CanAdvanceAvailableQuest(title) then |
if button.type == "Available" then |
local title, isTrivial = v[index], v[index + 2] |
if self:CanAdvanceAvailableQuest(title) then |
local priority = self:GetHandleValue("quest", title, "priority") or 0 |
if ( not available_priority ) or ( priority > available_priority ) then |
self:Debug("Eligible Available Quest:", title) |
r.title = title |
r.available = i |
available_title, available_index, available_priority = title, i, priority |
end |
end |
elseif b.type == "Active" then |
title, isTrivial, isActive = j[index], j[index + 2], true |
if ( not refresh ) and ( not r.title ) then |
self:Debug("Checking Active Quest:", title) |
if self:CanAdvanceActiveQuest(title) then |
button.title = title |
button.active = nil |
elseif button.type == "Active" then |
local title, isTrivial = j[index], j[index + 2] |
if self:CanAdvanceActiveQuest(title) then |
local priority = self:GetHandleValue("quest", title, "priority") or 0 |
if ( not active_priority ) or ( priority > active_priority ) then |
self:Debug("Eligible Active Quest:", title) |
r.title = title |
r.active = i |
active_title, active_index, active_priority = title, i, priority |
end |
end |
button.title = title |
button.active = true |
end |
if b.type ~= "Gossip" then |
b.title = title |
b.trivial = isTrivial |
-- Extra Gossip text |
if self:GetPVar("gossipstate") and self:GetQuestState(title) then |
b:SetFormattedText("%s (%s)", b:GetText(), autoText) |
end |
-- Icon Settings |
if b.icon and self:GetPVar("gossipicons") then |
self:SetGossipIcon(b.icon, title, isActive) |
end |
end |
else |
button.title = nil |
button.active = nil |
end |
end |
if r.active then |
self:Debug("Selecting Active Quest:", r.title) |
SelectGossipActiveQuest(r.active) |
elseif r.available then |
self:Debug("Selecting Available Quest:", r.title) |
SelectGossipAvailableQuest(r.available) |
self:UpdateGossipOrQuestFrame() |
if active_title then |
self:Debug("Selecting Active Quest:", active_title) |
SelectGossipActiveQuest(active_index) |
elseif available_title then |
self:Debug("Selecting Available Quest:", available_title) |
SelectGossipAvailableQuest(available_index) |
end |
end |
end |
else |
if GetNumQuestChoices() > 0 then |
local i = self:GetHandlerValue("quest", GetTitleText(), "reward") |
local i = self:GetHandleValue("quest", GetTitleText(), "reward") |
if i and i > 0 and self:GetPVar("multiple") then |
GetQuestReward(i) |
end |
elseif self:GetPVar("single") then |
else |
GetQuestReward(0) |
end |
end |
end |
end |
function EasyDaily:SetGossipIcon(icon, title, isActive) |
local autoText = sformat(NORMAL_QUEST_DISPLAY, L["Auto"]) |
function EasyDaily:UpdateGossipOrQuestFrame() |
local _, _, questType, questTag, _, _, questEnabled = self:GetQuestBaseInfo(title) |
if ( not self:IsEnabled() ) then return end |
local iconColor |
if ( isActive or questType == "repeat" ) and ( not self:CanCompleteQuest(title) ) then |
iconColor = "Grey" |
elseif ( questType == "daily" ) or ( questType == "repeat" ) then |
iconColor = "Daily" |
local n, x |
if QuestFrameGreetingPanel:IsShown() then |
n, x = MAX_NUM_QUESTS, "QuestTitleButton" |
elseif GossipFrame:IsShown() then |
n, x = NUMGOSSIPBUTTONS, "GossipTitleButton" |
else |
iconColor = "Normal" |
return |
end |
local iconState |
if ( questType == "daily" ) or ( questType == "repeat" ) then |
iconState = questEnabled and "Enable" or "Disable" |
else |
iconState = "" |
for i = 1, n, 1 do |
local button = _G[ x .. i] |
if button.title then |
-- Extra Gossip text |
if self:GetPVar("gossipstate") and self:GetQuestState(button.title) then |
b:SetFormattedText("%s (%s)", button:GetText(), autoText) |
end |
-- Icon Settings |
if button.icon and self:GetPVar("gossipicons") then |
local icon, title, isActive = button.icon, button.title, button.active |
local _, _, questType, questTag, _, enabled = self:GetQuestBaseInfo(title) |
local iconColor |
if ( isActive or questType == "repeat" ) and ( not self:CanCompleteQuest(title) ) then |
iconColor = "Grey" |
elseif ( questType == "daily" ) or ( questType == "repeat" ) then |
iconColor = "Daily" |
else |
iconColor = "Normal" |
end |
local iconState |
if ( questType == "daily" ) or ( questType == "repeat" ) then |
iconState = enabled and "Enable" or "Disable" |
else |
iconState = "" |
end |
local iconType |
if isActive or ( questType == "repeat" ) then |
iconType = "Active" |
else |
iconType = "Available" |
end |
--~ self:Debug(title, isActive, questType, iconColor, iconState, iconType) |
icon:SetTexture("Interface\\Addons\\EasyDaily\\Textures\\Gossip-Icons\\" .. iconColor .. iconState .. iconType) |
end |
end |
end |
local iconType |
if isActive or ( questType == "repeat" ) then |
iconType = "Active" |
else |
iconType = "Available" |
end |
self:Debug(title, isActive, questType, iconColor, iconState, iconType) |
icon:SetTexture() -- Clear current icon |
icon:SetTexture("Interface\\Addons\\EasyDaily\\Textures\\Gossip-Icons\\" .. iconColor .. iconState .. iconType) |
if ( not icon:GetTexture() ) then |
icon:SetTexture("Interface\\QuestFrame\\UI-Quest-BulletPoint") |
end |
end |
function EasyDaily:RefreshGossipOrQuestFrame() |
self:ClearTracker("gossip") |
QuestFrameGreetingPanel:Hide() |
QuestFrameGreetingPanel:Show() |
self:QuestGreeting(true) |
self:UpdateGossipOrQuestFrame() |
elseif GossipFrame:IsShown() then |
self:ClearTracker("gossip") |
GossipFrameUpdate() |
self:GossipShow(true) |
self:UpdateGossipOrQuestFrame() |
end |
end |
function EasyDaily:RefreshQuestRewardHighlight() |
local i = self:GetHandlerValue("quest", GetTitleText(), "reward") |
local i = self:GetHandleValue("quest", GetTitleText(), "reward") |
if i and i > 0 then |
local frame = _G[ "QuestRewardItem" .. i ] |
if frame and frame:IsShown() then |
function EasyDaily:QuestRewardItem_OnClick(frame) |
if arg1 == "RightButton" then |
if ( frame.type == "choice" ) then |
local h = self:GetHandler("quest", GetTitleText()) |
local h = self:GetHandle("quest", GetTitleText()) |
if h then |
local index = frame:GetID() |
if index == h:GetVal("reward") then |
-- L["Alt"] = "" |
-- L["Auto"] = "" |
-- L["Auto-Select rewards for quests with more than one reward."] = "" |
-- L["Auto-Select rewards for quests with one or less reward."] = "" |
-- L["Auto Turn-in"] = "" |
-- L["Auto Turn-in Text"] = "" |
-- L["Available"] = "" |
-- L["Enables Auto Turn-in for %s tagged quests."] = "" |
-- L["Force"] = "" |
-- L["General"] = "" |
-- L["Gossip Window"] = "" |
-- L["Gossip/Quest Window"] = "" |
-- L["[Left-Click] to toggle the quest window"] = "" |
-- L["Minimap Icon"] = "" |
-- L["Multiple Rewards"] = "" |
-- L["None"] = "" |
-- L["Normal"] = "" |
-- L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "" |
-- L["Quest Pop-ups"] = "" |
-- L["Quest Confirmation Pop-ups"] = "" |
-- L["Quest Rewards"] = "" |
-- L["Quests"] = "" |
-- L["Quest Tags"] = "" |
-- L["Selection Modifiers"] = "" |
-- L["Shift"] = "" |
-- L["Show an icon on the Minimap."] = "" |
-- L["Single Reward"] = "" |
-- L["Special"] = "" |
-- L["Sticky Turn-in"] = "" |
-- L["Suspend"] = "" |
-- L["The [new day] begins in %s"] = "" |
-- L["Toggles 'Auto Turn-in' for this quest."] = "" |
-- L["Toggle this quest's state."] = "" |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
-- L["Use this modifier to Auto Turn-in %s quests."] = "" |
-- L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "" |
-- L["Use this modifier to suspend the Auto Turn-in process."] = "" |
-- L["Alt"] = "" |
-- L["Auto"] = "" |
-- L["Auto-Select rewards for quests with more than one reward."] = "" |
-- L["Auto-Select rewards for quests with one or less reward."] = "" |
-- L["Auto Turn-in"] = "" |
-- L["Auto Turn-in Text"] = "" |
-- L["Available"] = "" |
-- L["Enables Auto Turn-in for %s tagged quests."] = "" |
-- L["Force"] = "" |
-- L["General"] = "" |
-- L["Gossip Window"] = "" |
-- L["Gossip/Quest Window"] = "" |
-- L["[Left-Click] to toggle the quest window"] = "" |
L["Minimap Icon"] = "Icône de la minicarte" |
-- L["Multiple Rewards"] = "" |
-- L["None"] = "" |
-- L["Normal"] = "" |
-- L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "" |
-- L["Quest Pop-ups"] = "" |
-- L["Quest Confirmation Pop-ups"] = "" |
-- L["Quest Rewards"] = "" |
-- L["Quests"] = "" |
-- L["Quest Tags"] = "" |
-- L["Selection Modifiers"] = "" |
-- L["Shift"] = "" |
-- L["Show an icon on the Minimap."] = "" |
-- L["Single Reward"] = "" |
-- L["Special"] = "" |
-- L["Sticky Turn-in"] = "" |
-- L["Suspend"] = "" |
-- L["The [new day] begins in %s"] = "" |
-- L["Toggles 'Auto Turn-in' for this quest."] = "" |
-- L["Toggle this quest's state."] = "" |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
-- L["Use this modifier to Auto Turn-in %s quests."] = "" |
-- L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "" |
-- L["Use this modifier to suspend the Auto Turn-in process."] = "" |
-- L["Alt"] = "" |
-- L["Auto"] = "" |
L["Auto-Select rewards for quests with more than one reward."] = "Automatische Auswahl der Belohnung bei mehr als einer Auswahl" |
-- L["Auto-Select rewards for quests with one or less reward."] = "" |
-- L["Auto Turn-in"] = "" |
-- L["Auto Turn-in Text"] = "" |
-- L["Available"] = "" |
-- L["Enables Auto Turn-in for %s tagged quests."] = "" |
-- L["Force"] = "" |
-- L["General"] = "" |
-- L["Gossip Window"] = "" |
-- L["Gossip/Quest Window"] = "" |
-- L["[Left-Click] to toggle the quest window"] = "" |
-- L["Minimap Icon"] = "" |
-- L["Multiple Rewards"] = "" |
-- L["None"] = "" |
-- L["Normal"] = "" |
-- L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "" |
-- L["Quest Pop-ups"] = "" |
-- L["Quest Confirmation Pop-ups"] = "" |
-- L["Quest Rewards"] = "" |
-- L["Quests"] = "" |
-- L["Quest Tags"] = "" |
-- L["Selection Modifiers"] = "" |
-- L["Shift"] = "" |
-- L["Show an icon on the Minimap."] = "" |
-- L["Single Reward"] = "" |
-- L["Special"] = "" |
-- L["Sticky Turn-in"] = "" |
-- L["Suspend"] = "" |
-- L["The [new day] begins in %s"] = "" |
-- L["Toggles 'Auto Turn-in' for this quest."] = "" |
-- L["Toggle this quest's state."] = "" |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
-- L["Use this modifier to Auto Turn-in %s quests."] = "" |
-- L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "" |
-- L["Use this modifier to suspend the Auto Turn-in process."] = "" |
-- L["Alt"] = "" |
-- L["Auto"] = "" |
-- L["Auto-Select rewards for quests with more than one reward."] = "" |
-- L["Auto-Select rewards for quests with one or less reward."] = "" |
-- L["Auto Turn-in"] = "" |
-- L["Auto Turn-in Text"] = "" |
-- L["Available"] = "" |
-- L["Enables Auto Turn-in for %s tagged quests."] = "" |
-- L["Force"] = "" |
-- L["General"] = "" |
-- L["Gossip Window"] = "" |
-- L["Gossip/Quest Window"] = "" |
-- L["[Left-Click] to toggle the quest window"] = "" |
-- L["Minimap Icon"] = "" |
-- L["Multiple Rewards"] = "" |
-- L["None"] = "" |
-- L["Normal"] = "" |
-- L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "" |
-- L["Quest Pop-ups"] = "" |
-- L["Quest Confirmation Pop-ups"] = "" |
-- L["Quest Rewards"] = "" |
-- L["Quests"] = "" |
-- L["Quest Tags"] = "" |
-- L["Selection Modifiers"] = "" |
-- L["Shift"] = "" |
-- L["Show an icon on the Minimap."] = "" |
-- L["Single Reward"] = "" |
-- L["Special"] = "" |
-- L["Sticky Turn-in"] = "" |
-- L["Suspend"] = "" |
-- L["The [new day] begins in %s"] = "" |
-- L["Toggles 'Auto Turn-in' for this quest."] = "" |
-- L["Toggle this quest's state."] = "" |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
-- L["Use this modifier to Auto Turn-in %s quests."] = "" |
-- L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "" |
-- L["Use this modifier to suspend the Auto Turn-in process."] = "" |
-- L["Alt"] = "" |
-- L["Auto"] = "" |
-- L["Auto-Select rewards for quests with more than one reward."] = "" |
-- L["Auto-Select rewards for quests with one or less reward."] = "" |
-- L["Auto Turn-in"] = "" |
-- L["Auto Turn-in Text"] = "" |
-- L["Available"] = "" |
-- L["Enables Auto Turn-in for %s tagged quests."] = "" |
-- L["Force"] = "" |
-- L["General"] = "" |
-- L["Gossip Window"] = "" |
-- L["Gossip/Quest Window"] = "" |
-- L["[Left-Click] to toggle the quest window"] = "" |
-- L["Minimap Icon"] = "" |
-- L["Multiple Rewards"] = "" |
-- L["None"] = "" |
-- L["Normal"] = "" |
-- L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "" |
-- L["Quest Pop-ups"] = "" |
-- L["Quest Confirmation Pop-ups"] = "" |
-- L["Quest Rewards"] = "" |
-- L["Quests"] = "" |
-- L["Quest Tags"] = "" |
-- L["Selection Modifiers"] = "" |
-- L["Shift"] = "" |
-- L["Show an icon on the Minimap."] = "" |
-- L["Single Reward"] = "" |
-- L["Special"] = "" |
-- L["Sticky Turn-in"] = "" |
-- L["Suspend"] = "" |
-- L["The [new day] begins in %s"] = "" |
-- L["Toggles 'Auto Turn-in' for this quest."] = "" |
-- L["Toggle this quest's state."] = "" |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
-- L["Use this modifier to Auto Turn-in %s quests."] = "" |
-- L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "" |
-- L["Use this modifier to suspend the Auto Turn-in process."] = "" |
L["Auto Turn-in"] = true |
L["Auto Turn-in Text"] = true |
L["Auto-Select rewards for quests with more than one reward."] = true |
L["Auto-Select rewards for quests with one or less reward."] = true |
L["Available"] = true |
L["Battleground"] = true |
L["Complete"] = true |
L["Enables Auto Turn-in for %s tagged quests."] = true |
L["Force"] = true |
L["General"] = true |
L["Gossip Window"] = true |
L["Gossip/Quest Window"] = true |
L["Minimap Icon"] = true |
L["Multiple Rewards"] = true |
L["None"] = true |
L["Normal"] = true |
L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = true |
L["Quest Pop-ups"] = true |
L["Quest Confirmation Pop-ups"] = true |
L["Quest Rewards"] = true |
L["Quest Tags"] = true |
L["Quests"] = true |
L["Selection Modifiers"] = true |
L["Shift"] = true |
L["Show an icon on the Minimap."] = true |
L["Single Reward"] = true |
L["Special"] = true |
L["Sticky Turn-in"] = true |
L["Suspend"] = true |
L["The [new day] begins in %s"] = true |
L["Toggle this quest's state."] = true |
L["Toggles 'Auto Turn-in' for this quest."] = true |
L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = true |
L["Use this modifier to Auto Turn-in %s quests."] = true |
L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = true |
L["Use this modifier to suspend the Auto Turn-in process."] = true |
-- L["Alt"] = "" |
-- L["Auto"] = "" |
-- L["Auto-Select rewards for quests with more than one reward."] = "" |
-- L["Auto-Select rewards for quests with one or less reward."] = "" |
-- L["Auto Turn-in"] = "" |
-- L["Auto Turn-in Text"] = "" |
-- L["Available"] = "" |
-- L["Enables Auto Turn-in for %s tagged quests."] = "" |
-- L["Force"] = "" |
-- L["General"] = "" |
-- L["Gossip Window"] = "" |
-- L["Gossip/Quest Window"] = "" |
-- L["[Left-Click] to toggle the quest window"] = "" |
-- L["Minimap Icon"] = "" |
-- L["Multiple Rewards"] = "" |
-- L["None"] = "" |
-- L["Normal"] = "" |
-- L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "" |
-- L["Quest Pop-ups"] = "" |
-- L["Quest Confirmation Pop-ups"] = "" |
-- L["Quest Rewards"] = "" |
-- L["Quests"] = "" |
-- L["Quest Tags"] = "" |
-- L["Selection Modifiers"] = "" |
-- L["Shift"] = "" |
-- L["Show an icon on the Minimap."] = "" |
-- L["Single Reward"] = "" |
-- L["Special"] = "" |
-- L["Sticky Turn-in"] = "" |
-- L["Suspend"] = "" |
-- L["The [new day] begins in %s"] = "" |
-- L["Toggles 'Auto Turn-in' for this quest."] = "" |
-- L["Toggle this quest's state."] = "" |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
-- L["Use this modifier to Auto Turn-in %s quests."] = "" |
-- L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "" |
-- L["Use this modifier to suspend the Auto Turn-in process."] = "" |
-- L["Alt"] = "" |
-- L["Auto"] = "" |
-- L["Auto-Select rewards for quests with more than one reward."] = "" |
-- L["Auto-Select rewards for quests with one or less reward."] = "" |
-- L["Auto Turn-in"] = "" |
-- L["Auto Turn-in Text"] = "" |
-- L["Available"] = "" |
-- L["Enables Auto Turn-in for %s tagged quests."] = "" |
-- L["Force"] = "" |
-- L["General"] = "" |
-- L["Gossip Window"] = "" |
-- L["Gossip/Quest Window"] = "" |
-- L["[Left-Click] to toggle the quest window"] = "" |
-- L["Minimap Icon"] = "" |
-- L["Multiple Rewards"] = "" |
-- L["None"] = "" |
-- L["Normal"] = "" |
-- L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "" |
-- L["Quest Pop-ups"] = "" |
-- L["Quest Confirmation Pop-ups"] = "" |
-- L["Quest Rewards"] = "" |
-- L["Quests"] = "" |
-- L["Quest Tags"] = "" |
-- L["Selection Modifiers"] = "" |
-- L["Shift"] = "" |
-- L["Show an icon on the Minimap."] = "" |
-- L["Single Reward"] = "" |
-- L["Special"] = "" |
-- L["Sticky Turn-in"] = "" |
-- L["Suspend"] = "" |
-- L["The [new day] begins in %s"] = "" |
-- L["Toggles 'Auto Turn-in' for this quest."] = "" |
-- L["Toggle this quest's state."] = "" |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
-- L["Use this modifier to Auto Turn-in %s quests."] = "" |
-- L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "" |
-- L["Use this modifier to suspend the Auto Turn-in process."] = "" |
L["Alt"] = "Alt" |
L["Auto"] = "ÐвÑо" |
L["Auto-Select rewards for quests with more than one reward."] = "ÐвÑовÑÐ±Ð¾Ñ Ð½Ð°Ð³Ñад за Ð·Ð°Ð´Ð°Ð½Ð¸Ñ Ñ Ð½ÐµÑколÑкими нагÑадами." |
L["Auto-Select rewards for quests with one or less reward."] = "ÐвÑовÑÐ±Ð¾Ñ Ð½Ð°Ð³ÑÐ°Ð´Ñ Ð·Ð° Ð·Ð°Ð´Ð°Ð½Ð¸Ñ Ñ Ð¾Ð´Ð½Ð¾Ð¹ нагÑадой." |
L["Auto Turn-in"] = "ÐвÑоÑдаÑа" |
L["Auto Turn-in Text"] = "ТекÑÑ Ð°Ð²ÑоÑдаÑи" |
L["Available"] = "ÐоÑÑÑпно" |
L["Enables Auto Turn-in for %s tagged quests."] = "ÐклÑÑиÑÑ Ð°Ð²ÑоÑдаÑÑ Ð·Ð°Ð´Ð°Ð½Ð¸Ð¹, помеÑеннÑÑ , как %s" |
L["Force"] = "ÐÑинÑдиÑелÑно" |
L["General"] = "ÐбÑее" |
L["Gossip Window"] = "Ðкно ÑазговоÑа" |
-- L["Gossip/Quest Window"] = "" |
L["[Left-Click] to toggle the quest window"] = "[ÐевÑй клик] Ð´Ð»Ñ Ð¾ÑкÑÑÑиÑ/закÑÑÑÐ¸Ñ Ð¾ÐºÐ½Ð° заданий" |
L["Minimap Icon"] = "Ðконка Ñ Ð¼Ð¸Ð½Ð¸-каÑÑÑ" |
L["Multiple Rewards"] = "ÐногоÑиÑленнÑе нагÑадÑ" |
L["None"] = "ÐÑÑÑÑÑÑвÑеÑ" |
L["Normal"] = "ÐоÑмалÑнÑй" |
L["Note: The modifier 'None' refers to when no modifier is being held. Setting the modifier to 'Disable' disables the option."] = "ÐамеÑка: ÐодиÑикаÑÐ¾Ñ 'ÐÑÑÑÑÑÑÑвÑеÑ' ÑÑÑлаеÑÑÑ Ð½Ð° оÑÑÑÑÑÑвие назнаÑенного модиÑикаÑоÑа. УÑÑановка модиÑикаÑоÑа на 'ÐÑклÑÑиÑÑ' оÑклÑÑÐ°ÐµÑ ÑÑÑ Ð¾Ð¿ÑиÑ." |
L["Quest Pop-ups"] = "ÐÑплÑвание заданиÑ" |
-- L["Quest Confirmation Pop-ups"] = "" |
L["Quest Rewards"] = "ÐагÑÐ°Ð´Ñ Ð·Ð° заданиÑ" |
L["Quests"] = "ÐаданиÑ" |
L["Quest Tags"] = "ÐеÑки заданиÑ" |
L["Selection Modifiers"] = "ÐодиÑикаÑоÑÑ Ð²ÑбоÑа" |
L["Shift"] = "Shift" |
L["Show an icon on the Minimap."] = "ÐÑобÑажаÑÑ Ð¸ÐºÐ¾Ð½ÐºÑ Ñ Ð¼Ð¸Ð½Ð¸-каÑÑÑ." |
L["Single Reward"] = "ÐдиноÑнÑе нагÑадÑ" |
L["Special"] = "ÐÑобÑе" |
-- L["Sticky Turn-in"] = "" |
L["Suspend"] = "ÐÑиоÑÑановиÑÑ" |
L["The [new day] begins in %s"] = "[ÐовÑй денÑ] наÑнÑÑÑÑ ÑеÑез %s" |
L["Toggles 'Auto Turn-in' for this quest."] = "Ðкл/ÐÑкл 'ÐвÑоÑдаÑÑ' данного заданиÑ." |
L["Toggle this quest's state."] = "ÐеÑеклÑÑение ÑÑаÑÑÑа данного заданиÑ." |
-- L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."] = "" |
L["Use this modifier to Auto Turn-in %s quests."] = "ÐÑполÑзоваÑÑ ÑÑÐ¾Ñ Ð¼Ð¾Ð´Ð¸ÑикаÑÐ¾Ñ Ð´Ð»Ñ Ð°Ð²ÑоÑдаÑи %s заданий." |
L["Use this modifier to forcibly Auto Turn-in any quest. Overrides all settings."] = "ÐÑполÑзоваÑÑ ÑÑÐ¾Ñ Ð¼Ð¾Ð´Ð¸ÑикаÑÐ¾Ñ Ð´Ð»Ñ Ð¿ÑинÑдиÑелÑной авÑоÑдаÑи лÑбого заданиÑ. ÐгноÑиÑÑÐµÑ Ð²Ñе наÑÑÑойки." |
L["Use this modifier to suspend the Auto Turn-in process."] = "ÐÑполÑзоваÑÑ ÑÑÐ¾Ñ Ð¼Ð¾Ð´Ð¸ÑикаÑÐ¾Ñ Ð´Ð»Ñ Ð¿ÑиоÑÑановки пÑоÑеÑÑа авÑоÑдаÑи." |
--[[ |
Desc: |
Info: $Id: tracking.lua 22 2009-05-04 09:34:29Z draake $ |
Info: $Id: tracking.lua 28 2009-05-07 04:22:11Z draake $ |
]] |
local _G = _G |
-------------------------------------------------------------------------------------------------- |
function EasyDaily:UnitName(unit) |
local name, guid, id, kind = UnitName(unit), UnitGUID(unit) or 0, 0, "" |
local name, guid, id, kind, handle = UnitName(unit), UnitGUID(unit) or 0, 0, "", nil |
if ( not self:IsValidName(name) ) then |
return nil, 0, "", nil |
end |
local tid = bit.band(tonumber(string.sub(guid, -16, -14), 16), 0x00F) |
if tid == 1 then |
kind, id = "object", tonumber(string.sub(guid, -12, -7), 16) |
handle = self:GetHandle(kind, id) |
elseif tid == 3 then |
kind, id = "npc", tonumber(string.sub(guid, -12, -7), 16) |
handle = self:GetHandle(kind, id) |
end |
return name, id, kind |
return name, id, kind, handle |
end |
function EasyDaily:GetLocation() |
return zone, math.floor(x * 1000 + 0.5), math.floor(y * 1000 + 0.5), dl |
end |
function EasyDaily:PLAYER_TARGET_CHANGED() |
if ( not UnitExists("target") ) or UnitPlayerControlled("target") then |
return |
end |
local name, id, kind, h = self:UnitName("target") |
if ( not name ) or ( not kind ) or ( not h ) then |
return |
end |
if ( not UnitIsTapped("target") ) and self:UnitIsClose("target") then |
local zone, x, y, dl = self:GetLocation() |
h:SetVal("name", name) |
h:SetVal("coord", zone, x, y, dl) |
end |
end |
-------------------------------------------------------------------------------------------------- |
-- Gossip/Quest Frame Registration |
-------------------------------------------------------------------------------------------------- |
return |
end |
local h, isNew = self:GetHandler("quest", questTitle, true) |
local h, isNew = self:GetHandle("quest", questTitle, true) |
if isNew then |
self:Display(L["Repeatable Quest Discovered"], questTitle) |
h:SetVal("tag", "normal") |
h:SetVal("header", zone) |
--~ for oID = 1, GetNumQuestItems(), 1 do |
--~ local itemName, itemID = self:ParseItemLink( GetQuestItemLink("required", oID) ) |
--~ handler:SetData("obj", oID, "name", itemName) |
--~ handler:SetData("obj", oID, "index", itemID) |
--~ handler:SetData("obj", oID, "type", "item") |
--~ handler:SetData("obj", oID, "need", self:SelectOne(3, GetQuestItemInfo("required", oID))) |
--~ end |
for oID = 1, GetNumQuestItems(), 1 do |
local _, itemID = self:ParseItemLink( GetQuestItemLink("required", oID) ) |
h:SetVal("objective", "item", itemID, self:SelectOne(3, GetQuestItemInfo("required", oID))) |
end |
end |
local questLog, tempLog = {}, {} |
function EasyDaily:RefreshQuestLogInfo() |
function EasyDaily:RefreshQuestLogInfo(refresh) |
if refresh then |
self:CleanTable(questLog) |
end |
local _, numQuests = GetNumQuestLogEntries() |
local collapseHeaders = {} |
tempLog[index] = questLog[index] |
tempLog[index].refresh = true |
else |
-- Quest was not present in last update |
self:RecordQuestStart(index) |
tempLog[index] = {} |
tempLog[index].name = logName |
tempLog[index].complete = isComplete |
tempLog[index].obj = {} |
end |
local numObj = GetNumQuestLeaderBoards(i) |
for k = 1, numObj, 1 do |
local objType, objName, objCurCount, objNeedCount, objText = self:GetLeaderBoardDetails(k, i) |
if questLog[index] and questLog[index].obj[k] then |
if objCurCount and questLog[index].obj[k].cur and objCurCount > questLog[index].obj[k].cur then |
self:Debug(index, logName, objType, objName, questLog[index].obj[k].cur, objCurCount, objNeedCount) |
-- Objective update |
local h = self:GetHandle("quest", index) |
if h then |
self:Debug(index, logName, objType, objName, questLog[index].obj[k].cur, objCurCount, objNeedCount) |
end |
end |
tempLog[index].obj[k] = questLog[index].obj[k] |
else |
if type(v) == "table" and ( not v.refresh ) and v.daily then |
local h, isNew = self:GetHandler("quest", index, true) |
local h, isNew = self:GetHandle("quest", index, true) |
if isNew and self.vars.startup then |
self:Display(L["Daily Quest Discovered"], v.name) |
h:SetVal("tag", v.tag) |
h:SetVal("header", v.header) |
--~ for j, k in pairs(v.obj) do |
--~ handler:SetData("obj", j, "name", k.name or k.text) |
--~ handler:SetData("obj", j, "type", k.type) |
--~ handler:SetData("obj", j, "need", k.need) |
--~ end |
end |
end |
return current, max |
end |
function EasyDaily:RecordQuestStart(name) |
local h = self:GetHandle("quest", name) |
if h and h:GetVal("type") == "daily" then |
h:SetVal("start", self:GetTime()) |
end |
end |
function EasyDaily:RecordQuestComplete(name) |
local h = self:GetHandler("quest", name) |
local h = self:GetHandle("quest", name) |
if h and h:GetVal("type") == "daily" then |
local resetDate, timeLeft = self:GetDailyResetDate() |
h:SetVal("reset", resetDate) |
--[[ |
Desc: |
Info: $Id: utility.lua 17 2009-05-02 03:59:49Z draake $ |
Info: $Id: utility.lua 28 2009-05-07 04:22:11Z draake $ |
]] |
local _G = _G |
return s |
end |
function EasyDaily:Concat(seperator, ...) |
local s = "" |
local n = select("#", ...) |
for i = 1, n, 1 do |
s = s .. tostring( select(i, ...) ) |
if i ~= n then s = s .. seperator end |
end |
return s |
end |
function EasyDaily:StripColors(s) |
local r = string.gsub(s, "|c%x+(.-)|r", "%1") |
return r |
-- Debugging |
-------------------------------------------------------------------------------------------------- |
function EasyDaily:VDebug(...) |
if self.db.profile.verbosedebug then |
self:Debug(...) |
end |
end |
function EasyDaily:Debug(...) |
if self.db.profile.debug then |
if AceLibrary and AceLibrary:HasInstance("AceConsole-2.0") then |
function EasyDaily:ChatPrint(info, r1, g1, b1, r2, g2, b2, ...) |
local msg = "" |
for i = 1, select("#", ...), 1 do |
msg = msg .. tostring( select( i, ...) ) .. " " |
end |
local text = string.format("|cff%02x%02x%02x%s|r|cff%02x%02x%02x: %s|r", |
(r1 or 1) * 255, (g1 or 1) * 255, (b1 or 1) * 255, info or "EasyDaily", |
(r2 or 1) * 255, (g2 or 1) * 255, (b2 or 1) * 255, msg) |
(r2 or 1) * 255, (g2 or 1) * 255, (b2 or 1) * 255, self:Concat(", ", ...)) |
DEFAULT_CHAT_FRAME:AddMessage(text) |
--[[ |
Desc: |
Info: $Id: database.lua 22 2009-05-04 09:34:29Z draake $ |
Info: $Id: database.lua 28 2009-05-07 04:22:11Z draake $ |
]] |
local _G = _G |
-- DB Querying |
-------------------------------------------------------------------------------------------------- |
-- name, index, questType, questTag, header, side, enable = EasyDaily:GetQuestHandlerInfo(name) |
-- name, index, questType, questTag, header, enable = EasyDaily:GetQuestHandleInfo(name) |
function EasyDaily:GetQuestBaseInfo(index) |
if not index then return end |
local h = self:GetHandler("quest", index) |
local h = self:GetHandle("quest", index) |
if h then |
return h:GetVal("name"), h:GetVal("index"), h:GetVal("type"), h:GetVal("tag"), h:GetVal("header"), h:GetVal("side"), h:GetVal("enable") |
return h:GetVal("name"), h:GetVal("index"), h:GetVal("type"), h:GetVal("tag"), h:GetVal("header"), h:GetVal("enable") |
end |
end |
function EasyDaily:GetQuestResetInfo(index) |
if not index then return end |
local h = self:GetHandler("quest", index) |
local h = self:GetHandle("quest", index) |
if h then |
return h:GetVal("reset"), h:GetVal("time"), h:GetVal("done") |
end |
function EasyDaily:GetQuestState(index) |
if not index then return end |
return self:GetHandlerValue("quest", index, "enable") |
return self:GetHandleValue("quest", index, "enable") |
end |
function EasyDaily:GetQuestObjective() |
function EasyDaily:GetQuestObjective(index) |
if not index then return end |
local h = self:GetHandle("quest", index) |
if h then |
return h:GetVal("objective") |
end |
end |
function EasyDaily:ToggleQuestState(index) |
if not index then return end |
local h = self:GetHandler("quest", index) |
local h = self:GetHandle("quest", index) |
if h then |
local newState = not h:GetVal("enable") |
h:SetVal("enable", newState) |
end |
end |
function EasyDaily:GetHandlerValue(kind, index, key) |
local h = self:GetHandler(kind, index) |
function EasyDaily:GetHandleValue(kind, index, key) |
local h = self:GetHandle(kind, index) |
if h then |
return h:GetVal(key) |
end |
end |
do |
local side = ( UnitFactionGroup("player") == "Alliance" and 1 ) or 2 |
function EasyDaily:GetPlayerSideBit() |
return side |
end |
end |
-------------------------------------------------------------------------------------------------- |
-- Data Handler Values/Presets/Mixins |
-- Data Handle Values/Presets/Mixins |
-------------------------------------------------------------------------------------------------- |
local handlerType = { |
quest = { |
values = { |
enable = { db = "global", type = "boolean", locale = nil, default = true }, |
type = { db = "global", type = "string", locale = nil, default = nil }, |
tag = { db = "global", type = "string", locale = nil, default = nil }, |
header = { db = "global", type = "string", locale = true, default = nil }, |
side = { db = "global", type = "number", locale = nil, default = nil }, |
reward = { db = "char", type = "number", locale = nil, default = 0 }, |
time = { db = "char", type = "number", locale = nil, default = 0 }, |
reset = { db = "char", type = "number", locale = nil, default = 0 }, |
done = { db = "char", type = "number", locale = nil, default = 0 }, |
}, |
objects = { |
unit = { db = "global", key = "_unit", mixins = { "SetUnit", "GetUnit", "DelUnit" } }, |
obj = { db = "global", key = "_obj", mixins = { "SetObj", "GetObj" } }, |
}, |
enable = { db = "global", locale = nil, side = nil, default = true, type = "type", value = "boolean", table = nil }, |
type = { db = "global", locale = nil, side = nil, default = nil, type = "type", value = "string", table = nil }, |
tag = { db = "global", locale = nil, side = nil, default = nil, type = "type", value = "string", table = nil }, |
priority = { db = "global", locale = nil, side = nil, default = 0, type = "type", value = "number", table = nil }, |
header = { db = "global", locale = true, side = nil, default = nil, type = "type", value = "string", table = nil }, |
reward = { db = "char", locale = nil, side = nil, default = 0, type = "type", value = "number", table = nil }, |
reset = { db = "char", locale = nil, side = nil, default = 0, type = "type", value = "number", table = nil }, |
start = { db = "char", locale = nil, side = nil, default = 0, type = "type", value = "number", table = nil }, |
time = { db = "char", locale = nil, side = nil, default = 0, type = "type", value = "number", table = nil }, |
done = { db = "char", locale = nil, side = nil, default = 0, type = "type", value = "number", table = nil }, |
unit = { db = "global", locale = nil, side = true, default = nil, type = "concat", table = true }, |
objective = { db = "global", locale = nil, side = nil, default = nil, type = "concat", table = true }, |
}, |
unit = { |
values = { |
type = { db = "global", type = "string", locale = nil, default = nil }, |
side = { db = "global", type = "number", locale = nil, default = nil }, |
}, |
objects = { |
coord = { db = "global", key = "_coord", mixins = { "SetCoord", "GetCoord" } }, |
}, |
npc = { |
faction = { db = "global", locale = true, side = nil, default = nil, type = "type", value = "string", table = nil }, |
reaction = { db = "global", locale = nil, side = true, default = nil, type = "type", value = "string", table = nil }, |
coord = { db = "global", locale = nil, side = nil, default = nil, type = "function", value = "SetCoord", }, |
}, |
object = { |
coord = { db = "global", locale = nil, side = nil, default = nil, type = "function", value = "SetCoord", }, |
}, |
item = { |
values = {}, |
objects = { |
unit = { db = "global", key = "_unit", mixins = { "SetUnit", "GetUnit", "DelUnit" } }, |
}, |
unit = { db = "global", locale = nil, side = true, default = nil, type = "concat", table = true }, |
}, |
event = { |
coord = { db = "global", locale = nil, side = nil, default = nil, type = "function", value = "SetCoord", }, |
}, |
} |
local defaultValues = { |
--~ hkey = { db = "global", type = "number", locale = nil, default = nil, protect = true }, |
hval = { db = "global", type = "string", locale = nil, default = nil, protect = true }, |
name = { db = "global", type = "string", locale = true, default = nil, protect = true }, |
index = { db = "global", type = "number", locale = nil, default = nil, protect = true }, |
--~ hkey = { db = "global", locale = nil, side = nil, default = nil, type = "type", value = "number", table = nil, protect = true }, |
hval = { db = "global", locale = nil, side = nil, default = nil, type = "type", value = "string", table = nil, protect = true }, |
name = { db = "global", locale = nil, side = nil, default = nil, type = "type", value = "string", table = nil, protect = true }, |
index = { db = "global", locale = nil, side = nil, default = nil, type = "type", value = "number", table = nil, protect = true }, |
} |
local defaultMixins = { "Delete", "Refresh", "SetVal", "GetVal" } |
for _, v in pairs(handlerType) do |
for j, k in pairs(defaultValues) do |
v.values[j] = k |
v[j] = k |
end |
end |
local setMixins = { |
SetObj = function(this) |
this:Refresh() |
end, |
GetObj = function(this) |
return |
end, |
SetUnit = function(this, h) |
assert(handler, "SetUnit") |
local t, i = this._unit, nil |
for k = 1, #t, 1 do |
if t[k] == h._hkey then |
i = k; break |
end |
end |
if ( not i ) then |
table.insert(t, h._index) |
this:Refresh() |
end |
end, |
GetUnit = function(this) |
return this._unit |
end, |
DelUnit = function(this, index) |
assert(index, "DelUnit") |
local t, i = this._unit, nil |
for k = 1, #t, 1 do |
if t[k] == index then |
i = k; break |
end |
end |
if i then |
table.remove(t, i) |
this:Refresh() |
end |
end, |
Refresh = function(this) |
end, |
Delete = function(this) |
EasyDaily:DeleteHandler(this) |
EasyDaily:DeleteHandle(this) |
end, |
SetCoord = function(this, zone, x, y, dl) |
assert(zone and x and y, "SetCoord") |
if type(this._coord[zone]) ~= "table" then this._coord[zone] = {}; end |
local t, i = this._coord[zone], nil |
SetCoord = function(db, zone, x, y, dl) |
assert(db and zone and x and y, "SetCoord") |
if type(db[zone]) ~= "table" then db[zone] = {}; end |
local t, i = db[zone], nil |
for k = 1, #t, 1 do |
if ( math.abs(x - t[k].x) <= 5 ) and ( math.abs(y - t[k].y) <= 5 ) and t[k].dl == dl then |
i = k; break |
else |
table.insert(t, { x = x, y = y, dl = dl, n = 1 }) |
end |
this:Refresh() |
end, |
GetCoord = function(this) |
return this._coord |
end, |
SetVal = function(this, key, value) |
assert(type(key) ~= nil and this._data[key] and type(value) ~= nil, "SetVal") |
SetVal = function(this, key, value, ...) |
assert(type(key) ~= "nil" and this._data[key] and type(value) ~= "nil", "SetVal") |
local data = this._data[key] |
if not EasyDaily.db[ data.db ].data[ this._hkey ] then |
EasyDaily.db[ data.db ].data[ this._hkey ] = {} |
end |
local db = EasyDaily.db[ data.db ].data[ this._hkey ] |
if data.type == type(value) then |
if data.locale then |
if not db[key] then |
db[key] = {} |
end |
db = db[key] |
key = GetLocale() |
if data.type == "concat" then |
value = EasyDaily:Concat(":", value, ...) |
elseif data.type == "type" and data.value ~= type(value) then |
return |
end |
if data.locale then |
if not db[key] then db[key] = {} end |
db = db[key] |
key = GetLocale() |
end |
if data.side then |
if not db[key] then db[key] = {} end |
db = db[key] |
key = EasyDaily:GetPlayerSideBit() |
end |
if data.type == "function" then |
if not db[key] then db[key] = {} end |
this[ data.value ](db[key], value, ...) |
elseif data.table then |
if not db[key] then db[key] = {} end |
EasyDaily:SetLinear("utinsert", db, key, value) |
elseif ( not db[key] ) or ( not data.protect ) then |
if value == data.default then |
db[key] = nil |
else |
db[key] = value |
end |
if ( not db[key] ) or ( not data.protect ) then |
if value == data.default then |
db[key] = nil |
else |
db[key] = value |
end |
end |
this:Refresh() |
end |
end, |
GetVal = function(this, key) |
assert(type(key) ~= nil and this._data[key], "GetVal") |
assert(type(key) ~= "nil" and this._data[key], "GetVal") |
local db = EasyDaily.db[ this._data[key].db ].data[ this._hkey ] |
local default = this._data[key].default |
if this._data[key].locale then |
db = db[key] |
key = GetLocale() |
if type(db) == "table" and type(db[key]) ~= "nil" then |
return db[key] |
else |
return this._data[key].default |
return default |
end |
end, |
} |
-------------------------------------------------------------------------------------------------- |
-- Data Handler Creation/Searching |
-- Data Handle Creation/Searching |
-------------------------------------------------------------------------------------------------- |
function EasyDaily:ResetDatabase() |
self.db.global.data = {} |
self.db.char.data = {} |
self.handlers = {} |
self:InitHandles() |
self.vars.startup = nil |
self:RefreshQuestLogInfo(true) |
end |
function EasyDaily:RefreshHandlers() |
for i, v in pairs(EasyDaily.handlers) do |
v:Refresh() |
function EasyDaily:RefreshHandles() |
for i, v in pairs(self.handlers) do |
for j, k in pairs(v) do |
k:Refresh() |
end |
end |
end |
function EasyDaily:DeleteHandler(h) |
function EasyDaily:DeleteHandle(h) |
if type(h) == "table" and h._hval then |
self.db.global.data[h._hkey] = nil |
self.db.char.data[h._hkey] = nil |
end |
end |
function EasyDaily:GetHandler(kind, index, create) |
assert(kind and ( type(index) == "number" or type(index) == "string" ), "GetHandler") |
for i, v in pairs(self.handlers) do |
function EasyDaily:GetHandle(kind, index, create) |
assert(kind and self.handlers[kind] and ( type(index) == "number" or type(index) == "string" ), "GetHandle") |
for i, v in pairs(self.handlers[kind]) do |
if kind == v:GetVal("hval") and ( ( type(index) == "number" and index == v:GetVal("index") ) or ( type(index) == "string" and index == v:GetVal("name") ) ) then |
return v |
end |
end |
if create then |
return self:CreateHandler(kind, index), true |
if create == true then |
return self:CreateHandle(kind, index), true |
end |
end |
function EasyDaily:CreateHandler(kind, index) |
function EasyDaily:CreateHandle(kind, index) |
assert(kind and ( type(index) == "number" or type(index) == "string" ), "CreateHandler") |
assert(kind and self.handlers[kind] and ( type(index) == "number" or type(index) == "string" ), "CreateHandle") |
local getHandler = self:GetHandler(kind, index) |
if getHandler then |
return getHandler |
local getHandle = self:GetHandle(kind, index) |
if getHandle then |
return getHandle |
end |
-- Create data namespace |
self.db.global.data[n] = {} |
-- Create and set handler |
self.handlers[n] = self:BuildHandler(kind, n) |
self.handlers[kind][n] = self:BuildHandle(kind, n) |
--~ self.handlers[n]:SetVal("hkey", n) |
self.handlers[n]:SetVal("hval", kind) |
self.handlers[kind][n]:SetVal("hval", kind) |
if type(index) == "number" then |
self.handlers[n]:SetVal("index", index) |
self.handlers[kind][n]:SetVal("index", index) |
elseif type(index) == "string" then |
self.handlers[n]:SetVal("name", index) |
self.handlers[kind][n]:SetVal("name", index) |
end |
return self.handlers[n] |
return self.handlers[kind][n] |
end |
function EasyDaily:InitHandlers() |
function EasyDaily:InitHandles() |
self.handlers = {} |
for k in pairs(handlerType) do |
self.handlers[k] = {} |
end |
for n, v in pairs(self.db.global.data) do |
if v then |
self.handlers[n] = self:BuildHandler( v.hval, n ) |
tinsert(self.handlers[v.hval], self:BuildHandle(v.hval, n)) |
end |
end |
end |
function EasyDaily:BuildHandler(kind, n) |
function EasyDaily:BuildHandle(kind, n) |
assert(n and handlerType[kind], "BuildHandler") |
assert(n and handlerType[kind], "BuildHandle") |
local handler = {} |
end |
end |
handler._data = handlerType[kind].values |
handler._data = handlerType[kind] |
for i, v in pairs(handlerType[kind].objects) do |
for _, k in pairs(v.mixins) do |
if not handler[k] then |
handler[k] = setMixins[k] |
end |
for i, v in pairs(handlerType[kind]) do |
if v.type == "function" then |
handler[ v.value ] = setMixins[ v.value ] |
end |
if not EasyDaily.db[ v.db ].data[n][i] then |
EasyDaily.db[ v.db ].data[n][i] = {} |
end |
handler[ v.key ] = EasyDaily.db[ v.db ].data[n][i] |
end |
return handler |
clean = { args = 0, func = function(a, _) if type(a) == "table" then for i in pairs(a) do a[i] = nil; end else a = {}; end return a; end }, |
tinit = { args = 0, func = function(a, _) if type(a) ~= "nil" then return a; end return {}; end }, |
tinsert = { args = 1, val = 1, func = function(a, b) if type(a) ~= "table" then a = {}; end tinsert(a, b); return a; end }, |
utinsert = { args = 1, val = 1, func = function(a, b) if type(a) ~= "table" then a = {}; end EasyDaily:InsertUnique(a, b); return a; end }, |
} |
setLinearLoop = function(info, array, index, ...) |
------------------------------------------------------------------------ |
r26 | draake | 2009-05-04 10:56:26 +0000 (Mon, 04 May 2009) | 1 line |
r29 | draake | 2009-05-07 04:23:53 +0000 (Thu, 07 May 2009) | 1 line |
Changed paths: |
A /tags/v2.0-beta.4 (from /trunk:25) |
A /tags/v2.0-beta.5 (from /trunk:28) |
Tagging as v2.0-beta.4 |
Tagging as v2.0-beta.5 |
------------------------------------------------------------------------ |
r28 | draake | 2009-05-07 04:22:11 +0000 (Thu, 07 May 2009) | 5 lines |
Changed paths: |
M /trunk/core.lua |
M /trunk/database.lua |
M /trunk/locales/enUS.lua |
M /trunk/options.lua |
M /trunk/scripts/Strings.lua |
M /trunk/tracking.lua |
M /trunk/turnin.lua |
M /trunk/utility.lua |
Removed some useless options. |
Changed some of the database values to concatenated strings rather than tables. I'll see how that works out. |
Laid groundwork for npc tracking (start/end npc's and objectives). |
Separated quest/gossip frame visual changes from quest acceptance/completion code. |
Laid groundwork for tiered debug modes. |
------------------------------------------------------------------------ |
r27 | draake | 2009-05-05 10:12:13 +0000 (Tue, 05 May 2009) | 2 lines |
Changed paths: |
M /trunk/database.lua |
M /trunk/options.lua |
M /trunk/tracking.lua |
M /trunk/turnin.lua |
First attempt at objective tracking and storage. |
Repeatable quests are now correctly turned in. |
------------------------------------------------------------------------ |
r25 | draake | 2009-05-04 10:55:20 +0000 (Mon, 04 May 2009) | 1 line |
Changed paths: |
M /trunk/turnin.lua |
N: Records daily quest data (id, name, objectives, etc). |
C: Revised the way the addon version is displayed. |
------------------------------------------------------------------------ |
r15 | draake | 2009-03-30 02:18:14 +0000 (Mon, 30 Mar 2009) | 3 lines |
Changed paths: |
M /trunk |
M /trunk/core.lua |
M /trunk/inventory.lua |
M /trunk/turnin.lua |
M /trunk/util.lua |
N: Quest requirements for repeatable quests are now learned. |
N: Added table utility functions. |
C: Experimenting with repo variables. |
------------------------------------------------------------------------ |
## Authors: Draake |
## OptionalDeps: Ace3, LibDBIcon-1.0, LibGratuity-3.0, LibAbacus-3.0, LibTourist-3.0, Babble-Faction-3.0, LibBabble-Zone-3.0 |
## SavedVariables: EasyDaily_DB |
## X-Curse-Packaged-Version: v2.0-beta.4 |
## X-Curse-Packaged-Version: v2.0-beta.5 |
## X-Curse-Project-Name: EasyDaily |
## X-Curse-Project-ID: easydaily |
## X-Curse-Repository-ID: wow/easydaily/mainline |
--[[ |
Desc: |
Info: $Id: core.lua 22 2009-05-04 09:34:29Z draake $ |
Info: $Id: core.lua 28 2009-05-07 04:22:11Z draake $ |
]] |
local _G = _G |
-------------------------------------------------------------------------------------------------- |
-- Increasing this forces a database purge |
local RESETDB = 0 |
local RESETDB = 1 |
local defaults = { |
global = { |
profile = { |
enabled = true, |
debug = false, |
vdebug = false, |
skipflag = false, |
skipmoney = false, |
single = true, |
multiple = true, |
gossipstate = false, |
gossipicons = true, |
stickyturnin = true, |
tag_normal = true, |
tag_group = true, |
tag_elite = true, |
mod_normal = "disable", |
mod_daily = "shift", |
mod_daily = "none", |
mod_repeat = "shift", |
mod_override = "alt", |
mod_suspend = "disable", |
self.version = {} |
-- Version |
self.version.revision = tonumber("25") |
self.version.revision = tonumber("28") |
if self.version.revision then |
local vtext = "v2.0-beta.4" |
local vtext = "v2.0-beta.5" |
if string.find(vtext, "^r%d+$") then |
self.version.text = string.format("r%s-alpha", self.version.revision) |
else |
end |
]] |
if self.db.global.purge and ( self.db.global.purge < RESETDB ) then |
if EasyDaily.db.global.purge and ( self.db.global.purge < RESETDB ) then |
self:ResetDatabase() |
self:Print("Database reset to default.") |
end |
self.db.profile.purge = RESETDB |
self:InitHandlers() |
self:InitHandles() |
self.tracker = { |
spell = {}, |
f:SetHeight(64) |
f:SetWidth(256) |
f.texture = f:CreateTexture(nil, "BACKGROUND") |
f.texture:SetHeight(64) |
f.texture:SetWidth(256) |
f.texture:SetAllPoints(f) |
f.texture:SetTexture("Interface\\Addons\\EasyDaily\\Textures\\Quest-Frame\\RewardHighlight") |
f.texture:SetBlendMode("ADD") |
local t = f:CreateTexture(nil, "BACKGROUND") |
t:SetHeight(64) |
t:SetWidth(256) |
t:SetAllPoints(f) |
t:SetTexture("Interface\\Addons\\EasyDaily\\Textures\\Quest-Frame\\RewardHighlight") |
t:SetBlendMode("ADD") |
end |
self:RegisterEvent("QUEST_PROGRESS") |
self:RegisterEvent("QUEST_COMPLETE") |
self:RegisterEvent("PLAYER_TARGET_CHANGED") |
self:RegisterBucketEvent({ |
"QUEST_FINISHED", |
"GOSSIP_CLOSED" |
self.db.profile.enabled = false |
-- Shutdown functions |
self.vars.questbutton:Hide() |
EasyDailyQuestFrameCheckButton:Hide() |
self:RefreshGossipOrQuestFrame() |
end |
--[[ |
Desc: |
Info: $Id: options.lua 22 2009-05-04 09:34:29Z draake $ |
Info: $Id: options.lua 28 2009-05-07 04:22:11Z draake $ |
]] |
local _G = _G |
-- Content |
-------------------------------------------------------------------------------------------------- |
do |
local side = UnitFactionGroup("player") |
local sideBit = ( side == "Alliance" and 1 ) or 2 |
function EasyDaily:GetPlayerSideBit() |
return sideBit |
end |
end |
-- available, complete, repeatable, normal |
function EasyDaily:SetQuestOptionsTable(available, complete, repeatable) |
for i, h in pairs(self.handlers) do |
for i, h in pairs(self.handlers.quest) do |
if h:GetVal("hval") == "quest" then |
local name, questType, questTag, header, enable = h:GetVal("name"), h:GetVal("type"), h:GetVal("tag"), h:GetVal("header"), h:GetVal("enable") |
local t |
local GetOptMods = function(...) |
local optMods = { ["ctrl"] = L["Ctrl"], ["alt"] = L["Alt"], ["shift"] = L["Shift"], ["none"] = L["None"], ["disable"] = L["Disable"] } |
for i = 1, select("#", ...), 1 do |
local v = EasyDaily:GetPVar( EasyDaily:SelectOne(i, ...) ) |
local v = EasyDaily:GetPVar( "mod_" .. EasyDaily:SelectOne(i, ...) ) |
if v and v ~= "disable" then |
optMods[v] = nil |
end |
args = { |
enabled = { |
order = 1, |
width = "half", |
type = "toggle", |
name = L["Enabled"], |
desc = L["Enable/Disable the addon."], |
get = function() return self:IsEnabled() end, |
set = function(info, value) self[value and "Enable" or "Disable"](self) end, |
width = "half", |
}, |
debug = { |
order = 2, |
set = function(info, value) self.db.profile.minimapIcon.hide = not value; LDBIcon[value and "Show" or "Hide"](self, "EasyDaily") end, |
disabled = function() return not LDBIcon end, |
}, |
resetall = { |
order = 3, |
type = "execute", |
hidden = function() return ( not self.db.profile.debug ) end, |
name = "Reset All", |
desc = "Resets everything to default.", |
func = function() self.db:ResetDB("Default"); self:ResetDatabase(); self.db.profile.debug = true; end, |
}, |
general = { |
order = 10, |
type = "group", |
name = L["General"], |
disabled = isDisabled, |
args = { |
debugmode = { |
order = 0, |
type = "group", |
guiInline = true, |
name = "Debug Mode", |
disabled = isDisabled, |
hidden = function() return ( not self.db.profile.debug ) end, |
args = { |
vdebug = { |
order = 1, |
type = "toggle", |
name = "Verbose Debug", |
desc = "Enable/Disable verbose debug mode.", |
get = getFunc, |
set = setFunc, |
}, |
resetall = { |
order = 2, |
type = "execute", |
name = "Reset All", |
confirm = true, |
confirmText = "Are you want to reset the current profile and the entire quest database? This cannot be undone.", |
desc = "Resets the current profile and the entire quest database.", |
func = function() self.db:ResetDB("Default"); self:ResetDatabase(); self.db.profile.debug = true; end, |
}, |
}, |
}, |
gossipdisplay = { |
order = 1, |
type = "group", |
guiInline = true, |
name = L["Gossip Window"], |
name = L["Gossip/Quest Window"], |
args = { |
stickyturnin = { |
--[[stickyturnin = { |
order = 1, |
type = "toggle", |
name = L["Sticky Turn-in"], |
desc = L["Turn-in sequences will run to completion once they've been started regardless of its modifier's status."], |
name = "Sticky Turn-in", |
desc = "Turn-in sequences will run to completion once they've been started regardless of its modifier's status.", |
get = getFunc, |
set = setFunc, |
}, |
},]] |
gossipicons = { |
order = 2, |
type = "toggle", |
guiInline = true, |
name = L["Quest Rewards"], |
args = { |
single = { |
multiple = { |
order = 1, |
type = "toggle", |
name = L["Single Reward"], |
desc = L["Auto-Select rewards for quests with one or less reward."], |
get = getFunc, |
set = setFunc, |
}, |
multiple = { |
order = 2, |
type = "toggle", |
name = L["Multiple Rewards"], |
desc = L["Auto-Select rewards for quests with more than one reward."], |
get = getFunc, |
order = 3, |
type = "group", |
guiInline = true, |
name = L["Quest Pop-ups"], |
name = L["Quest Confirmation Pop-ups"], |
args = { |
skipflag = { |
order = 1, |