/trunk
--[[ |
Desc: |
Info: $Id: turnin.lua 28 2009-05-07 04:22:11Z draake $ |
Info: $Id: turnin.lua 32 2009-05-07 11:18:13Z draake $ |
]] |
local _G = _G |
-- Quest Advancement/Completion Eligibility |
-------------------------------------------------------------------------------------------------- |
do |
local ModOptToFunc = { |
["ctrl"] = IsControlKeyDown, |
["alt"] = IsAltKeyDown, |
["shift"] = IsShiftKeyDown, |
["none"] = function() return ( not IsModifierKeyDown() ); end, |
} |
function EasyDaily:ModKeyIsDown(x) |
return x and ModOptToFunc[x] and ModOptToFunc[x]() |
function EasyDaily:ModKeyIsDown(key) |
if key == "ctrl" then |
return IsControlKeyDown() |
elseif key == "alt" then |
return IsAltKeyDown() |
elseif key == "shift" then |
return IsShiftKeyDown() |
elseif key == "none" then |
return ( not IsModifierKeyDown() ) |
end |
function EasyDaily:TypeIDActive(typeText) |
return typeText and self:ModKeyIsDown( self:GetPVar("mod_" .. typeText) ) |
end |
function EasyDaily:TagIDActive(tagText) |
return tagText and self:GetPVar("tag_" .. tagText) |
end |
end |
function EasyDaily:QuestTypeKeyIsDown(typeText) |
return typeText and self:ModKeyIsDown( self:GetPVar("mod_" .. typeText) ) |
end |
function EasyDaily:QuestTagIsActive(tagText) |
return tagText and self:GetPVar("tag_" .. tagText) |
end |
function EasyDaily:QuestEligibleForAdvancement(title) |
if self:TypeIDActive("suspend") then |
if self:QuestTypeKeyIsDown("suspend") then |
self.tracker.gossip[title] = false |
return |
end |
if self:TypeIDActive("override") then |
if self:QuestTypeKeyIsDown("override") then |
self.tracker.gossip[title] = true |
return true |
end |
if self.tracker.gossip[title] ~= nil then |
if self:GetPVar("stickyturnin") and self.tracker.gossip[title] ~= nil then |
return self.tracker.gossip[title] |
end |
local found, _, questType, questTag, _, enabled = self:GetQuestBaseInfo(title) |
if ( not found ) then |
return self:TypeIDActive("normal") |
return self:QuestTypeKeyIsDown("normal") |
end |
if ( not self:TypeIDActive(questType) ) or ( not self:TagIDActive(questTag) ) then |
if ( not self:QuestTypeKeyIsDown(questType) ) or ( not self:QuestTagIsActive(questTag) ) then |
self.tracker.gossip[title] = false |
return |
end |
self:Debug(GetItemInfo(index), count, need, floor) |
minimum = math.min( floor, minimum or math.huge ) |
end |
return ( minimum > 0 ) and minimum |
if minimum and ( minimum > 0 ) then |
return minimum |
end |
end |
--~ return true -- ONLY UNTIL OBJECTIVES ARE PROPERLY STORED |
end |
-------------------------------------------------------------------------------------------------- |
-- Triggers on: Active, Available/Repeatable |
-- Type: Parent |
function EasyDaily:QUEST_GREETING() |
self:Debug("QUEST_GREETING") |
if ( not QuestFrameGreetingPanel:IsShown() ) or ( not self:IsEnabled() ) then |
-- Triggers on: Active, Available/Repeatable |
-- Type: Parent |
function EasyDaily:GOSSIP_SHOW() |
self:Debug("GOSSIP_SHOW") |
if ( not GossipFrame:IsShown() ) or ( not self:IsEnabled() ) then |
-- Triggers on: Available |
-- Type: Child |
function EasyDaily:QUEST_DETAIL(...) |
self:Debug("QUEST_DETAIL") |
EasyDailyQuestFrameCheckButton:Show() |
local title = GetTitleText() |
if self:QuestEligibleForAdvancement(title) then |
if ( not self:GetPVar("skipflag") ) and QuestFlagsPVP() then |
AcceptQuest() |
end |
end |
end |
-- Triggers on: Active/Repeatable |
-- Type: Child |
function EasyDaily:QUEST_PROGRESS() |
self:Debug("QUEST_PROGRESS") |
EasyDailyQuestFrameCheckButton:Show() |
local title = GetTitleText() |
local isRepeat = ( not self:GetQuestLogInfoByName(title) ) |
if isRepeat then |
if self:QuestEligibleForAdvancement(title) then |
if IsQuestCompletable() then |
CompleteQuest() |
elseif isRepeat and self.tracker.gossip.parent then |
DeclineQuest() |
--~ elseif isRepeat and self.tracker.gossip.parent then |
--~ DeclineQuest() |
end |
end |
end |
-- Triggers on: Active/Repeatable |
local iconState |
if ( questType == "daily" ) or ( questType == "repeat" ) then |
iconState = enabled and "Enable" or "Disable" |
if ( not enabled ) or ( not self:QuestTagIsActive(questTag) ) then |
iconState = "Disable" |
else |
iconState = "Enable" |
end |
else |
iconState = "" |
end |
iconType = "Available" |
end |
--~ self:Debug(title, isActive, questType, iconColor, iconState, iconType) |
--~ self:Debug(title, isActive, questType, questTag, self:QuestTagIsActive(questTag), iconColor, iconState, iconType) |
icon:SetTexture("Interface\\Addons\\EasyDaily\\Textures\\Gossip-Icons\\" .. iconColor .. iconState .. iconType) |
------------------------------------------------------------------------ |
r29 | draake | 2009-05-07 04:23:53 +0000 (Thu, 07 May 2009) | 1 line |
r35 | draake | 2009-05-07 23:13:00 +0000 (Thu, 07 May 2009) | 1 line |
Changed paths: |
A /tags/v2.0-beta.5 (from /trunk:28) |
A /tags/v2.0-beta.7 (from /trunk:34) |
Tagging as v2.0-beta.5 |
Tagging as v2.0-beta.7 |
------------------------------------------------------------------------ |
r34 | draake | 2009-05-07 23:12:17 +0000 (Thu, 07 May 2009) | 1 line |
Changed paths: |
M /trunk/core.lua |
Quick fix for reseting corrupted databases. |
------------------------------------------------------------------------ |
r32 | draake | 2009-05-07 11:18:13 +0000 (Thu, 07 May 2009) | 3 lines |
Changed paths: |
M /trunk/core.lua |
M /trunk/options.lua |
M /trunk/turnin.lua |
Added hard reset slash command (/edreset). |
Forcing data purge to fix possible display errors. |
Cleaned up some code. |
------------------------------------------------------------------------ |
r31 | draake | 2009-05-07 07:26:07 +0000 (Thu, 07 May 2009) | 2 lines |
Changed paths: |
M /trunk/core.lua |
M /trunk/turnin.lua |
Reset quest DB just to be safe. |
Gossip icons should now show their proper stat if a quests tag is enabled/disabled. |
------------------------------------------------------------------------ |
r28 | draake | 2009-05-07 04:22:11 +0000 (Thu, 07 May 2009) | 5 lines |
Changed paths: |
M /trunk/core.lua |
## 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.5 |
## X-Curse-Packaged-Version: v2.0-beta.7 |
## X-Curse-Project-Name: EasyDaily |
## X-Curse-Project-ID: easydaily |
## X-Curse-Repository-ID: wow/easydaily/mainline |
--[[ |
Desc: |
Info: $Id: core.lua 28 2009-05-07 04:22:11Z draake $ |
Info: $Id: core.lua 34 2009-05-07 23:12:17Z draake $ |
]] |
local _G = _G |
-------------------------------------------------------------------------------------------------- |
-- Increasing this forces a database purge |
local RESETDB = 1 |
local RESETDB = 2 |
local defaults = { |
global = { |
skipflag = false, |
skipmoney = false, |
stickyturnin = true, |
multiple = true, |
gossipstate = false, |
}, |
} |
LFG_TYPE_NORMAL_DUNGEON = DUNGEON_DIFFICULTY1 .. " " .. LFG_TYPE_DUNGEON |
-------------------------------------------------------------------------------------------------- |
-- Enable/Disable |
-------------------------------------------------------------------------------------------------- |
return self:GetLoopTable(self.db.char, ...) |
end |
LFG_TYPE_NORMAL_DUNGEON = DUNGEON_DIFFICULTY1 .. " " .. LFG_TYPE_DUNGEON |
function EasyDaily:OnInitialize() |
self.db = LibStub("AceDB-3.0"):New("EasyDaily_DB", defaults, "Default") |
self.tracker = { |
spell = {}, |
npc = {}, |
gossip = {}, |
} |
self.vars = { |
complete = {} |
} |
self.version = {} |
-- Version |
self.version.revision = tonumber("28") |
self.version.revision = tonumber("34") |
if self.version.revision then |
local vtext = "v2.0-beta.5" |
if string.find(vtext, "^r%d+$") then |
local version = "v2.0-beta.7" |
if string.find(version, "^r%d+$") then |
self.version.major, self.version.minor, self.version.type = 0, 0, "alpha" |
self.version.text = string.format("r%s-alpha", self.version.revision) |
else |
self.version.major, self.version.minor, self.version.vtype, self.version.vsub = self:StrSplit("v%.%-", vtext) |
self.version.text = string.format("v%s.%s.%s-%s", self.version.major or 0, self.version.minor or 0, self.version.revision, self.version.vtype or "???") |
self.version.major, self.version.minor, self.version.type, self.version.sub = self:StrSplit("v%.%-", version) |
self.version.text = string.format("v%s.%s.%s-%s", self.version.major or 0, self.version.minor or 0, self.version.revision, self.version.type or "???") |
end |
else |
self.version.major, self.version.minor, self.version.type = 0, 0, "svn" |
self.version.text = "SVN" |
end |
--[[ |
if self.version.major then |
if self.db.profile.mversion and ( self.db.profile.mversion < self.version.major ) then |
self.db:ResetDB("Default") |
end |
self.db.profile.mversion = self.version.major |
self:CreateResetSlash() |
if self.db.profile.purge then |
self.db.global.purge = 0 |
self.db.profile.purge = nil |
end |
]] |
if EasyDaily.db.global.purge and ( self.db.global.purge < RESETDB ) then |
-- Database pursing and handle initialization |
if self.db.global.purge and ( self.db.global.purge < RESETDB ) then |
self:ResetDatabase() |
self:Print("Database reset to default.") |
else |
self:InitHandles() |
end |
self.db.profile.purge = RESETDB |
self.db.global.purge = RESETDB |
self:InitHandles() |
self.LibTourist = LibStub("LibTourist-3.0") |
self.LibAbacus = LibStub("LibAbacus-3.0") |
self.tracker = { |
spell = {}, |
npc = {}, |
gossip = {}, |
} |
self:CreateFrames() |
self.vars = { |
complete = {} |
} |
self:SetupOptions() |
self.LibTourist = LibStub("LibTourist-3.0") |
self.LibAbacus = LibStub("LibAbacus-3.0") |
self:SetEnabledState(self.db.profile.enabled) |
do -- Create QuestFrame CheckButton |
local b = CreateFrame("CheckButton", "EasyDailyQuestFrameCheckButton", QuestFrame, "UICheckButtonTemplate") |
b:SetPoint("TOPLEFT", "QuestFrame", "TOPLEFT", 80, -50) |
b:SetHitRectInsets(0, -70, 0, 0) |
b:SetHeight(24) |
b:SetWidth(24) |
b.text = _G[ b:GetName() .. "Text" ] |
b.text:ClearAllPoints() |
b.text:SetPoint("LEFT", b:GetName(), "RIGHT", 0, 0) |
b.text:SetText(L["Auto Turn-in"]) |
b:SetScript("OnShow", function(this) |
EasyDaily:QuestCheckButtonOnShow(this) |
end) |
b:SetScript("OnClick", function(this) |
EasyDaily:QuestCheckButtonOnClick(this) |
end) |
b:SetScript("OnEnter", function(this) |
GameTooltip:SetOwner(this, "ANCHOR_LEFT") |
GameTooltip:SetText(L["Toggles 'Auto Turn-in' for this quest."], nil, nil, nil, nil, 1) |
end) |
b:SetScript("OnLeave", GameTooltip_Hide) |
end |
end |
function EasyDaily:CreateFrames() |
-- Gossip/Quest Frame additional click registration |
for i = 1, NUMGOSSIPBUTTONS, 1 do |
b:RegisterForClicks("LeftButtonUp", "RightButtonUp") |
end |
do |
local f = CreateFrame("Frame", "EasyDailyQuestRewardItemHighlight", QuestRewardScrollChildFrame) |
f:SetHeight(64) |
f:SetWidth(256) |
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 |
-- Create QuestFrame CheckButton |
local b = CreateFrame("CheckButton", "EasyDailyQuestFrameCheckButton", QuestFrame, "UICheckButtonTemplate") |
b:SetPoint("TOPLEFT", "QuestFrame", "TOPLEFT", 80, -50) |
b:SetHitRectInsets(0, -70, 0, 0) |
b:SetHeight(24) |
b:SetWidth(24) |
self:SetupOptions() |
b.text = _G[ b:GetName() .. "Text" ] |
b.text:ClearAllPoints() |
b.text:SetPoint("LEFT", b:GetName(), "RIGHT", 0, 0) |
b.text:SetText(L["Auto Turn-in"]) |
self:SetEnabledState(self.db.profile.enabled) |
b:SetScript("OnShow", function(this) |
EasyDaily:QuestCheckButtonOnShow(this) |
end) |
b:SetScript("OnClick", function(this) |
EasyDaily:QuestCheckButtonOnClick(this) |
end) |
b:SetScript("OnEnter", function(this) |
GameTooltip:SetOwner(this, "ANCHOR_LEFT") |
GameTooltip:SetText(L["Toggles 'Auto Turn-in' for this quest."], nil, nil, nil, nil, 1) |
end) |
b:SetScript("OnLeave", GameTooltip_Hide) |
-- Create ItemReward Texture |
local f = CreateFrame("Frame", "EasyDailyQuestRewardItemHighlight", QuestRewardScrollChildFrame) |
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") |
end |
function EasyDaily:OnEnable() |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 656 2008-05-31 11:47:08Z nargiddley $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 808 2009-05-07 14:45:15Z ammo $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Does not close the pullout on click |
do |
local widgetType = "Dropdown-Item-Menu" |
local widgetVersion = 1 |
local widgetVersion = 2 |
local function OnEnter(this) |
local self = this.obj |
end |
-- exported |
function SetMenu(self, menu) |
local function SetMenu(self, menu) |
assert(menu.type == "Dropdown-Pullout") |
self.submenu = menu |
end |
-- exported |
function CloseMenu(self) |
local function CloseMenu(self) |
self.submenu:Close() |
end |
--[[ |
Desc: |
Info: $Id: options.lua 28 2009-05-07 04:22:11Z draake $ |
Info: $Id: options.lua 32 2009-05-07 11:18:13Z draake $ |
]] |
local _G = _G |
guiInline = true, |
name = L["Gossip/Quest Window"], |
args = { |
--[[stickyturnin = { |
stickyturnin = { |
order = 1, |
hidden = true, |
type = "toggle", |
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", |
end |
function EasyDaily:CreateResetSlash() |
-- Hard Resest slash command |
StaticPopupDialogs["EASYDAILY_RESETALL"] = { |
text = "Are you want to reset EasyDaily's current profile and the entire quest database? This cannot be undone and will reload your UI.", |
button1 = YES, |
button2 = NO, |
OnAccept = function() |
EasyDaily.db:ResetDB("Default") |
EasyDaily:ResetDatabase() |
ReloadUI() |
end, |
showAlert = 1, |
timeout = 0, |
exclusive = 1, |
hideOnEscape = 1, |
whileDead = 1, |
} |
SlashCmdList["EDRESET"] = function() StaticPopup_Show("EASYDAILY_RESETALL") end |
SLASH_EDRESET1 = "/edreset" |
end |