From c90bf08b68de59d6006ee379088a72d6ec17377d Mon Sep 17 00:00:00 2001 From: Alex Shubert Date: Sun, 8 Apr 2012 09:27:14 +0400 Subject: [PATCH] Reward looter release --- AutoTurnIn.lua | 40 ++++++++++++++++++---------------------- RewardOptions.lua | 39 +++++++++++++++++++++++++++------------ localization_DE.lua | 3 ++- localization_EN.lua | 3 ++- localization_RU.lua | 5 +++-- options.lua | 5 +++-- 6 files changed, 55 insertions(+), 40 deletions(-) diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua index cfc0635..6df1b44 100644 --- a/AutoTurnIn.lua +++ b/AutoTurnIn.lua @@ -52,7 +52,6 @@ function AutoTurnIn:OnEnable() if (tonumber(AutoTurnInCharacterDB.togglekey) == nil) then AutoTurnInCharacterDB.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 {} @@ -110,8 +109,6 @@ function AutoTurnIn:GetItemAmount(isCurrency, item) local amount = isCurrency and select(2, GetCurrencyInfo(item)) or GetItemCount(item, nil, true) return amount and amount or 0 end - - function AutoTurnIn:AllowedToHandle(forcecheck) if ( self.allowed == nil or forcecheck ) then -- Double 'not' converts possible 'nil' to boolean representation @@ -127,7 +124,6 @@ function AutoTurnIn:QUEST_GREETING() if (not self:AllowedToHandle(true)) then return end - for index=1, GetNumActiveQuests() do local quest, completed = GetActiveTitle(index) if (AutoTurnInCharacterDB.all or L.quests[quest]) and (completed) then @@ -162,10 +158,12 @@ function AutoTurnIn:VarArgForActiveQuests(...) if quest and quest.amount then if self:GetItemAmount(quest.currency, quest.item) >= quest.amount then SelectGossipActiveQuest(math.floor(i/4)+1) + self.DarkmoonAllowToProceed = false return end else SelectGossipActiveQuest(math.floor(i/4)+1) + self.DarkmoonAllowToProceed = false return end end @@ -200,16 +198,18 @@ function AutoTurnIn:GOSSIP_SHOW() SelectGossipOption(1) StaticPopup1Button1:Click() end - + -- darkmoon fairy gossip sometime turns in quest too fast so I can't relay only on quest number count. It often lie. + self.DarkmoonAllowToProceed = true + local questCount = GetNumGossipActiveQuests() > 0 self:VarArgForActiveQuests(GetGossipActiveQuests()) self:VarArgForAvailableQuests(GetGossipAvailableQuests()) - - if (AutoTurnInCharacterDB.darkmoonautostart and (GetZoneText() == L["Darkmoon Island"]) and GetNumGossipActiveQuests() > 0) then + + if (self.DarkmoonAllowToProceed and questCount) and AutoTurnInCharacterDB.darkmoonautostart and (GetZoneText() == L["Darkmoon Island"]) then local options = {GetGossipOptions()} for k, v in pairs(options) do if ((v ~= "gossip") and strfind(v, "|cFF0008E8%(")) then - SelectGossipOption(math.floor(k / GetNumGossipOptions()) +1) - end + SelectGossipOption(math.floor(k / GetNumGossipOptions())+1) + end end end end @@ -229,19 +229,14 @@ function AutoTurnIn:QUEST_PROGRESS() end function AutoTurnIn:IsRangedAndRequired(subclass) - return (AutoTurnInCharacterDB.weapon['Ranged'] and + return (AutoTurnInCharacterDB.weapon['Ranged'] and (C.ITEMS['Crossbows'] == subclass or C.ITEMS['Guns'] == subclass or C.ITEMS['Bows'] == subclass)) end -function AutoTurnIn:IsOffhandAndRequired(equipSlot) - return (AutoTurnInCharacterDB.armor[INVTYPE_HOLDABLE] and 'INVTYPE_HOLDABLE' == equipSlot) -end - function AutoTurnIn:IsJewelryAndRequired(equipSlot) return AutoTurnInCharacterDB.armor['Jewelry'] and (C.JEWELRY[equipSlot]) end - --[[ doesn't work. Frame appear faster than items loaded. Need rework. It is called nowhere right now local function TryToLoadRewards() local title = GetTitleText() @@ -295,7 +290,7 @@ function AutoTurnIn:Need() local link = GetQuestItemLink("choice", i) if ( link == nil ) then - self:Print(self.MSG_ITEMLINKISNULL) + self:Print(self.MSG_ITEMLINKISNULL) return true end @@ -312,8 +307,8 @@ function AutoTurnIn:Need() OkByType = (not next(AutoTurnInCharacterDB.weapon)) or (AutoTurnInCharacterDB.weapon[subclass] or self:IsRangedAndRequired(subclass)) else - OkByType = (not next(AutoTurnInCharacterDB.armor)) or (AutoTurnInCharacterDB.armor[subclass] or - self:IsJewelryAndRequired(equipSlot) or self:IsOffhandAndRequired(equipSlot)) + OkByType = ( not next(AutoTurnInCharacterDB.armor) ) or ( AutoTurnInCharacterDB.armor[subclass] or + AutoTurnInCharacterDB.armor[equipSlot] or self:IsJewelryAndRequired(equipSlot) ) end --Same here: if no stat specified or item stat is chosen then item is wanted @@ -337,9 +332,9 @@ function AutoTurnIn:Need() if #self.found > 1 then local vars = "" for _, reward in pairs(self.found) do - vars = vars..' '..GetQuestItemLink("choice", reward) + vars = vars..' '..GetQuestItemLink("choice", reward) end - self:Print('Found more thatn one candidate. '..ERR_QUEST_MUST_CHOOSE..' '..TRACKER_SORT_MANUAL) + self:Print(L["multiplefound"]..ERR_QUEST_MUST_CHOOSE..' '..TRACKER_SORT_MANUAL) elseif(#self.found == 1) then self:TurnInQuest(self.found[1]) end @@ -347,6 +342,7 @@ function AutoTurnIn:Need() return ( #self.found ~= 0 ) end +-- Надо вынести щиты, оффхенды, плащи в другой набор, отдельно от брони. Но не могу вспомнить, почему function AutoTurnIn:QUEST_COMPLETE() -- blasted Lands citadel wonderful NPC. They do not trigger any events except quest_complete. if not self:AllowedToHandle() then @@ -362,11 +358,11 @@ function AutoTurnIn:QUEST_COMPLETE() self:TurnInQuest(AutoTurnInCharacterDB.tournament) return end - + local forceGreed = false if (AutoTurnInCharacterDB.dontloot == 3) then forceGreed = (not self:Need() ) and AutoTurnInCharacterDB.greedifnothingfound - end + end if (AutoTurnInCharacterDB.dontloot == 2 or forceGreed) then self:Greed() end diff --git a/RewardOptions.lua b/RewardOptions.lua index d254dc9..892a46c 100644 --- a/RewardOptions.lua +++ b/RewardOptions.lua @@ -71,15 +71,18 @@ CreateCheckbox("Ranged", WeaponPanel, 10, -136, string.format("%s, %s, %s", weap -- ARMOR local ArmorPanel = CreatePanel("ArmorPanel", C.ARMORLABEL, 590, 70) local ArmorDropDown = CreateFrame("Frame", O.."ToggleKeyDropDown", ArmorPanel, "UIDropDownMenuTemplate") +local ARMORCONST = {NONE_KEY, armor[2], armor[3], armor[4],armor[5]} UIDropDownMenu_Initialize(ArmorDropDown, function (self, level) -local ArmorConst = {NONE_KEY, armor[2], armor[3], armor[4],armor[5]} - for k, v in ipairs(ArmorConst) do + for k, v in ipairs(ARMORCONST) do local info = UIDropDownMenu_CreateInfo() info.text, info.value = v, k info.func = function(self) UIDropDownMenu_SetSelectedID(ArmorDropDown, self:GetID()) - wipe(ptable.TempConfig.armor) - if self:GetID() > 1 then + if ArmorDropDown.value > 1 then + ptable.TempConfig.armor[ARMORCONST[ArmorDropDown.value]] = nil + end + if self:GetID() > 1 then + ArmorDropDown.value = self:GetID() ptable.TempConfig.armor[self:GetText()] = true end end @@ -89,11 +92,11 @@ end) UIDropDownMenu_SetWidth(ArmorDropDown, 200); UIDropDownMenu_JustifyText(ArmorDropDown, "LEFT") ArmorDropDown:SetPoint("TOPLEFT", ArmorPanel, 0, -8) -CreateCheckbox(armor[6], ArmorPanel, 292, -8) +CreateCheckbox(armor[6], ArmorPanel, 402, -8) -- 2nd line CreateCheckbox("Jewelry", ArmorPanel, 10, -40, L['Jewelry'] ) -CreateCheckbox(INVTYPE_HOLDABLE, ArmorPanel, 206, -40) -CreateCheckbox(INVTYPE_CLOAK, ArmorPanel, 206, -40) +CreateCheckbox('INVTYPE_HOLDABLE', ArmorPanel, 206, -40, INVTYPE_HOLDABLE) +CreateCheckbox('INVTYPE_CLOAK', ArmorPanel, 402, -40, INVTYPE_CLOAK) -- ATTRIBUTES local StatPanel = CreatePanel("StatPanel", STAT_CATEGORY_ATTRIBUTES, 590, 40) @@ -129,13 +132,25 @@ RewardPanel.refresh = function() for k,v in pairs(ptable.TempConfig.stat) do _G[StatPanel:GetName()..k]:SetChecked(v) end + for k,v in pairs(ptable.TempConfig.armor) do + local w = _G[ArmorPanel:GetName()..k] + if ( w ) then + w:SetChecked(v) + end + end GreedAfterNeed:SetChecked(ptable.TempConfig.greedifnothingfound ) - - local armor = next(ptable.TempConfig.armor) - local index = armor and AC[armor] or 1 - UIDropDownMenu_SetSelectedID(ArmorDropDown, index) - UIDropDownMenu_SetText(ArmorDropDown, armor and armor or NONE_KEY) + + -- Armor types dropdown + ArmorDropDown.value = nil + for index, armorName in ipairs(ARMORCONST) do + if ptable.TempConfig.armor[armorName] then + ArmorDropDown.value=index + end + end + ArmorDropDown.value = ArmorDropDown.value and ArmorDropDown.value or 1 + UIDropDownMenu_SetSelectedID(ArmorDropDown, ArmorDropDown.value) + UIDropDownMenu_SetText(ArmorDropDown, ARMORCONST[ArmorDropDown.value]) end --RewardPanel.default = function() end --RewardPanel.okay = function()end diff --git a/localization_DE.lua b/localization_DE.lua index 88b62e2..e77c56f 100644 --- a/localization_DE.lua +++ b/localization_DE.lua @@ -35,7 +35,8 @@ privateTable.L = setmetatable({ ['Jewelry']="Juwelier", ["rewardlootoptions"]="Reward loot rules", - ['greedifnothing']='Greed if nothing found'}, + ['greedifnothing']='Greed if nothing found', + ["multiplefound"]="Найдено несколько подходящих наград. "..ERR_QUEST_MUST_CHOOSE..' '..TRACKER_SORT_MANUAL}, {__index = function(table, index) return index end}) diff --git a/localization_EN.lua b/localization_EN.lua index 0dec1f0..1eceb06 100644 --- a/localization_EN.lua +++ b/localization_EN.lua @@ -31,7 +31,8 @@ privateTable.L = setmetatable({ ['Jewelry']="Jewelry", ["rewardlootoptions"]="Reward loot rules", - ['greedifnothing']='Greed if nothing found'}, + ['greedifnothing']='Greed if nothing found', + ["multiplefound"]="Wir fanden einige entsprechende Auszeichnungen. "..ERR_QUEST_MUST_CHOOSE..' '..TRACKER_SORT_MANUAL}, {__index = function(table, index) return index end}) privateTable.L.quests = { diff --git a/localization_RU.lua b/localization_RU.lua index 9d2cb07..cae394a 100644 --- a/localization_RU.lua +++ b/localization_RU.lua @@ -35,7 +35,8 @@ privateTable.L = setmetatable({ ['Jewelry']="Ювелирные украшения", ["rewardlootoptions"]="Правила выбора награды", - ["greedifnothing"]="Взять самую дорогую, если ничего не нашлось"}, + ["greedifnothing"]="Взять самую дорогую, если ничего не нашлось", + ["multiplefound"]="Найдено несколько подходящих наград. "..ERR_QUEST_MUST_CHOOSE..' '..TRACKER_SORT_MANUAL}, {__index = function(table, index) return index end}) @@ -79,7 +80,7 @@ privateTable.L.quests = { ["Покровительство братства, кровь горы"]={item="Кровь Горы", amount=1, currency=false}, ["Покровительство братства, огненное ядро"]={item="Огненное ядро", amount=1, currency=false}, ["Покровительство братства, черное железо"]={item="Руда черного железа", amount=10, currency=false}, -["Покровительство братства, ядро лавы"]={item=" Ядро лавы", amount=1, currency=false}, +["Покровительство братства, ядро лавы"]={item="Ядро лавы", amount=1, currency=false}, --[[Burning Crusade]]-- diff --git a/options.lua b/options.lua index 25b8b37..b4653a1 100644 --- a/options.lua +++ b/options.lua @@ -88,7 +88,7 @@ DarkMoonCannon:SetScript("OnClick", function(self) ptable.TempConfig.darkmoonteleport = self:GetChecked() == 1 end) --- DarkmoonTeleport +-- Darkmoon games local DarkMoonAutoStart = CreateFrame("CheckButton", O.."DarkMoonAutoStart", OptionsPanel, "OptionsCheckButtonTemplate") _G[DarkMoonAutoStart:GetName().."Text"]:SetText(L["DarkmoonAutoLabel"]) DarkMoonAutoStart:SetScript("OnClick", function(self) @@ -152,10 +152,11 @@ OptionsPanel.refresh = function() UIDropDownMenu_SetSelectedID(TournamentDropDown, ptable.TempConfig.tournament) UIDropDownMenu_SetText(TournamentDropDown,TournamentConst[ptable.TempConfig.tournament]) - if (ptable.TempConfig.dontloot == 1) then + if (ptable.TempConfig.dontloot == 1) then UIDropDownMenu_DisableDropDown(TournamentDropDown) end DarkMoonCannon:SetChecked(ptable.TempConfig.darkmoonteleport) + DarkMoonAutoStart:SetChecked(ptable.TempConfig.darkmoonautostart) ShowRewardText:SetChecked(ptable.TempConfig.showrewardtext) UIDropDownMenu_SetSelectedID(ToggleKeyDropDown, ptable.TempConfig.togglekey) -- 1.7.9.5