From 4765de29c4f50b86165455a16eb50fbe1431046c Mon Sep 17 00:00:00 2001 From: Alex Shubert Date: Sun, 14 Oct 2012 17:44:52 +0400 Subject: [PATCH] quest level ui added --- AutoTurnIn.lua | 32 +++++++++++++++++++++----------- QuestLevel.lua | 38 +++++++++++++++++++++----------------- loc/localization_DE.lua | 2 ++ loc/localization_EN.lua | 2 ++ loc/localization_FR.lua | 2 ++ loc/localization_RU.lua | 4 +++- ui/main_options.lua | 30 ++++++++++++++++++++++++------ 7 files changed, 75 insertions(+), 35 deletions(-) diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua index af5c3c8..6a7ff7a 100644 --- a/AutoTurnIn.lua +++ b/AutoTurnIn.lua @@ -14,7 +14,9 @@ AutoTurnIn = LibStub("AceAddon-3.0"):NewAddon("AutoTurnIn", "AceEvent-3.0", "Ace AutoTurnIn.defaults = {enabled = true, all = false, trivial = false, lootreward = 1, tournament = 2, darkmoonteleport=true, togglekey=4, darkmoonautostart=true, showrewardtext=true, version=TOCVersion, autoequip = false, debug=false, + questlevel=true, watchlevel=true, armor = {}, weapon = {}, stat = {}, secondary = {}} + AutoTurnIn.ldb, AutoTurnIn.allowed = nil, nil AutoTurnIn.caption = addonName ..' [%s]' AutoTurnIn.funcList = {[1] = function() return false end, [2]=IsAltKeyDown, [3]=IsControlKeyDown, [4]=IsShiftKeyDown} @@ -62,24 +64,28 @@ function AutoTurnIn:OnEnable() if not AutoTurnInCharacterDB then _G.AutoTurnInCharacterDB = CopyTable(self.defaults) end - if (tonumber(AutoTurnInCharacterDB.lootreward) == nil) then - AutoTurnInCharacterDB.lootreward = 1 + local DB = AutoTurnInCharacterDB + + if (tonumber(DB.lootreward) == nil) then + DB.lootreward = 1 end - if (tonumber(AutoTurnInCharacterDB.togglekey) == nil) then - AutoTurnInCharacterDB.togglekey = 1 + if (tonumber(DB.togglekey) == nil) then + DB.togglekey = 1 end - AutoTurnInCharacterDB.armor = AutoTurnInCharacterDB.armor and AutoTurnInCharacterDB.armor or {} - AutoTurnInCharacterDB.weapon = AutoTurnInCharacterDB.weapon and AutoTurnInCharacterDB.weapon or {} - AutoTurnInCharacterDB.stat = AutoTurnInCharacterDB.stat and AutoTurnInCharacterDB.stat or {} - AutoTurnInCharacterDB.secondary = AutoTurnInCharacterDB.secondary and AutoTurnInCharacterDB.secondary or {} - AutoTurnInCharacterDB.trivial = AutoTurnInCharacterDB.trivial ~= nil and AutoTurnInCharacterDB.trivial or false + DB.armor = DB.armor and DB.armor or {} + DB.weapon = DB.weapon and DB.weapon or {} + DB.stat = DB.stat and DB.stat or {} + DB.secondary = DB.secondary and DB.secondary or {} + DB.trivial = DB.trivial ~= nil and DB.trivial or false + DB.questlevel = DB.questlevel ~= nil and DB.questlevel or true + DB.watchlevel = DB.watchlevel ~= nil and DB.watchlevel or true local LDB = LibStub:GetLibrary("LibDataBroker-1.1", true) if LDB then self.ldb = LDB:NewDataObject("AutoTurnIn", self.ldbstruct) end - self:SetEnabled(AutoTurnInCharacterDB.enabled) + self:SetEnabled(DB.enabled) self:RegisterGossipEvents() end @@ -544,4 +550,8 @@ function AutoTurnIn:QUEST_COMPLETE() self:TurnInQuest(1) -- index greater than '0' enables autoequip check. end end -end \ No newline at end of file +end + +-- gossip and quest interaction goes through a sequence of windows: gossip [shows a list of available quests] - quest[describes specified quest] +-- sometimes some parts of this chain is skipped. For example, priest in Honor Hold show quest window directly. This is a trick to handle 'toggle key' +hooksecurefunc(QuestFrame, "Hide", function() AutoTurnIn.allowed = nil end) \ No newline at end of file diff --git a/QuestLevel.lua b/QuestLevel.lua index 483342d..9a8395e 100644 --- a/QuestLevel.lua +++ b/QuestLevel.lua @@ -5,7 +5,24 @@ local L = ptable.L local C = ptable.CONST AutoTurnIn.QuestLevelFormat = " [%d] %s" +AutoTurnIn.WatchFrameLevelFormat = "[%d%s%s] %s" +AutoTurnIn.QuestTypesIndex = { + [0] = "", --default + [1] = "g", --Group + [41] = "+", --PvP + [62] = "r", --Raid + [81] = "d", --Dungeon + [83] = "L", --Legendary + [85] = "h", --Heroic + [98] = "s", --Scenario QUEST_TYPE_SCENARIO + [102] = "a", -- Account +} + function AutoTurnIn:ShowQuestLevelInLog() + if not AutoTurnInCharacterDB.questlevel then + return + end + -- see function QuestLog_Update() in function QuestLogFrame.lua for details local scrollOffset = HybridScrollFrame_GetOffset(QuestLogScrollFrame); local numEntries, numQuests = GetNumQuestLogEntries(); @@ -22,28 +39,15 @@ function AutoTurnIn:ShowQuestLevelInLog() end end end - --- gossip and quest interaction goes through a sequence of windows: gossip [shows a list of available quests] - quest[describes specified quest] --- sometimes some parts of this chain is skipped. For example, priest in Honor Hold show quest window directly. This is a trick to handle 'toggle key' -hooksecurefunc(QuestFrame, "Hide", function() AutoTurnIn.allowed = nil end) - -- Quest level in a log. hooksecurefunc("QuestLog_Update", AutoTurnIn.ShowQuestLevelInLog) hooksecurefunc(QuestLogScrollFrame, "update", AutoTurnIn.ShowQuestLevelInLog) -AutoTurnIn.WatchFrameLevelFormat = "[%d%s%s] %s" -AutoTurnIn.QuestTypesIndex = { - [0] = "", --default - [1] = "g", --Group - [41] = "+", --PvP - [62] = "r", --Raid - [81] = "d", --Dungeon - [83] = "L", --Legendary - [85] = "h", --Heroic - [98] = "s", --Scenario QUEST_TYPE_SCENARIO - [102] = "a", -- Account -} function AutoTurnIn:ShowQuestLevelInWatchFrame() + if not AutoTurnInCharacterDB.watchlevel then + return + end + for i = 1, #WATCHFRAME_LINKBUTTONS do button = WATCHFRAME_LINKBUTTONS[i] diff --git a/loc/localization_DE.lua b/loc/localization_DE.lua index 6f4eb1c..bbfb307 100644 --- a/loc/localization_DE.lua +++ b/loc/localization_DE.lua @@ -36,6 +36,8 @@ privateTable.L = setmetatable({ ["Scared Pandaren Cub"]="verängstigte Pandarenkinder", ["rewardtext"]="Show quest reward text", + ["questlevel"]="Show quest level", + ["watchlevel"]="Show watched quest level", ["autoequip"]="tragen Belohnung", ["togglekey"]="aktivieren/deaktivieren Taste", diff --git a/loc/localization_EN.lua b/loc/localization_EN.lua index d4aeafe..b855105 100644 --- a/loc/localization_EN.lua +++ b/loc/localization_EN.lua @@ -38,6 +38,8 @@ privateTable.L = setmetatable({ ["DarkmoonAutoLabel"]="Darkmoon: start the game!", ["rewardtext"]="Print quest reward text", + ["questlevel"]="Show quest level", + ["watchlevel"]="Show watched quest level", ["autoequip"]="Equip received reward", ["togglekey"]="Enable/disable key", diff --git a/loc/localization_FR.lua b/loc/localization_FR.lua index 72c4892..cb5fdb8 100644 --- a/loc/localization_FR.lua +++ b/loc/localization_FR.lua @@ -33,6 +33,8 @@ privateTable.L = setmetatable({ ["Scared Pandaren Cub"]="Bébé pandaren apeuré", ["rewardtext"]="Écrire le texte de quête dans le chat", + ["questlevel"]="Show quest level", + ["watchlevel"]="Show watched quest level", ["autoequip"]="Équiper les objets de récompense", ["togglekey"]="touche activer/désactiver", diff --git a/loc/localization_RU.lua b/loc/localization_RU.lua index 36b1344..9164a6e 100644 --- a/loc/localization_RU.lua +++ b/loc/localization_RU.lua @@ -36,8 +36,10 @@ privateTable.L = setmetatable({ ["Scared Pandaren Cub"]="Испуганный юный пандарен", ["rewardtext"]="Показывать финальный текст задания", + ["questlevel"]="Уровни заданий в журнале", + ["watchlevel"]="Уровни отслеживаемых заданий", ["autoequip"]="Надеть полученную награду", - ["togglekey"]="Клавиша разового включения/отключения", + ["togglekey"]="клавиша разового включения/отключения", ['Jewelry']="Ювелирные украшения", ["rewardlootoptions"]="Правила выбора награды", diff --git a/ui/main_options.lua b/ui/main_options.lua index 05bc7c6..2ce5ee2 100644 --- a/ui/main_options.lua +++ b/ui/main_options.lua @@ -152,6 +152,19 @@ end) UIDropDownMenu_SetWidth(ToggleKeyDropDown, 200); UIDropDownMenu_JustifyText(ToggleKeyDropDown, "LEFT") +-- 'Show QuestLevel' CheckBox +local ShowQuestLevel = CreateFrame("CheckButton", O.."QuestLevel", OptionsPanel, "OptionsCheckButtonTemplate") +_G[ShowQuestLevel:GetName().."Text"]:SetText(L["questlevel"]) +ShowQuestLevel:SetScript("OnClick", function(self) + ptable.TempConfig.questlevel = self:GetChecked() == 1 +end) + +-- 'Show Watch Quest Level' CheckBox +local ShowWatchLevel = CreateFrame("CheckButton", O.."WatchLevel", OptionsPanel, "OptionsCheckButtonTemplate") +_G[ShowWatchLevel:GetName().."Text"]:SetText(L["watchlevel"]) +ShowWatchLevel:SetScript("OnClick", function(self) + ptable.TempConfig.watchlevel = self:GetChecked() == 1 +end) -- Control placement title:SetPoint("TOPLEFT", 16, -16) @@ -159,20 +172,21 @@ subText:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8) ResetButton:SetPoint("TOPRIGHT", OptionsPanel, "TOPRIGHT", -10, -10) Enable:SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -16) QuestLabel:SetPoint("BOTTOMLEFT", QuestDropDown, "TOPLEFT", 18, 0) -QuestDropDown:SetPoint("TOPLEFT", Enable, "BOTTOMLEFT", -15, -35) +QuestDropDown:SetPoint("TOPLEFT", Enable, "BOTTOMLEFT", -15, -30) TrivialQuests:SetPoint("TOPLEFT", QuestDropDown, "TOPRIGHT", 30, 0) LootLabel:SetPoint("BOTTOMLEFT", LootDropDown, "TOPLEFT", 18, 0) LootDropDown:SetPoint("TOPLEFT", QuestDropDown, "BOTTOMLEFT", 0, -30) TournamentDropDownLabel:SetPoint("BOTTOMLEFT", TournamentDropDown, "TOPLEFT", 18, 0) TournamentDropDown:SetPoint("TOPLEFT", LootDropDown, "TOPRIGHT", 17, 0) -DarkMoonCannon:SetPoint("TOPLEFT", LootDropDown, "BOTTOMLEFT", 16, -16) +EquipReward:SetPoint("TOPLEFT", LootDropDown, "BOTTOMLEFT", 16, -16) +ShowRewardText:SetPoint("TOPLEFT", EquipReward, "BOTTOMLEFT", 0, -16) +DarkMoonCannon:SetPoint("TOPLEFT", ShowRewardText, "BOTTOMLEFT", 0, -16) DarkMoonAutoStart:SetPoint("TOPLEFT", DarkMoonCannon, "BOTTOMLEFT", 0, -16) -ShowRewardText:SetPoint("TOPLEFT", DarkMoonAutoStart, "BOTTOMLEFT", 0, -16) -EquipReward:SetPoint("TOPLEFT", ShowRewardText, "BOTTOMLEFT", 0, -16) Debug:SetPoint("TOPLEFT", ResetButton, "BOTTOMLEFT", 0, -16) - ToggleKeyLabel:SetPoint("BOTTOMLEFT", ToggleKeyDropDown, "TOPLEFT", 18, 0) -ToggleKeyDropDown:SetPoint("TOPLEFT", EquipReward, "BOTTOMLEFT", -15, -30) +ToggleKeyDropDown:SetPoint("TOPLEFT", DarkMoonAutoStart, "BOTTOMLEFT", -15, -30) +ShowQuestLevel:SetPoint("TOPLEFT", ToggleKeyDropDown, "BOTTOMLEFT", 16, -16) +ShowWatchLevel:SetPoint("TOPLEFT", ShowQuestLevel, "BOTTOMLEFT", 0, -16) OptionsPanel.refresh = function() if ( MakeACopy ) then @@ -195,6 +209,8 @@ OptionsPanel.refresh = function() EquipReward:SetChecked(ptable.TempConfig.autoequip) Debug:SetChecked(ptable.TempConfig.debug) TrivialQuests:SetChecked(ptable.TempConfig.trivial) + ShowQuestLevel:SetChecked(ptable.TempConfig.questlevel) + ShowWatchLevel:SetChecked(ptable.TempConfig.watchlevel) UIDropDownMenu_SetSelectedID(ToggleKeyDropDown, ptable.TempConfig.togglekey) UIDropDownMenu_SetText(ToggleKeyDropDown, ToggleKeyConst[ptable.TempConfig.togglekey]) @@ -208,6 +224,8 @@ end OptionsPanel.okay = function() AutoTurnInCharacterDB = CopyTable(ptable.TempConfig) AutoTurnIn:SetEnabled(AutoTurnInCharacterDB.enabled) + QuestLog_Update() + WatchFrame_Update(WatchFrame) end InterfaceOptions_AddCategory(OptionsPanel) \ No newline at end of file -- 1.7.9.5