From 1b95e58ad96abd5c972fdd4aa7b490bec4a6ed0b Mon Sep 17 00:00:00 2001 From: Alex Shubert Date: Mon, 2 Apr 2012 16:36:27 +0400 Subject: [PATCH] localization work is done, COMPLETE_QUEST contains logic error: item subtype returned is localized, but constants being saved in configuration is not --- AutoTurnIn.lua | 36 +++++++++++++++++++++++------------- RewardOptions.lua | 4 +++- localization_DE.lua | 4 +++- localization_EN.lua | 12 +++++++----- localization_RU.lua | 5 ++++- rewards.lua | 5 ++++- 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua index 8b8b939..0a1ddb8 100644 --- a/AutoTurnIn.lua +++ b/AutoTurnIn.lua @@ -209,6 +209,16 @@ function AutoTurnIn:QUEST_PROGRESS() end end +local function IsRangedWeapon(subclass) + return (AutoTurnInCharacterDB.items['Ranged'] and (C.ITEMS['Crossbows'] == subclass or + C.ITEMS['Guns'] == subclass or + C.ITEMS['Bows'] == subclass)) +end + +local function IsJewelry(equipSlot) + return AutoTurnInCharacterDB.items['Jewelry'] and (C.JEWELRY[equipSlot]) +end + function AutoTurnIn:QUEST_COMPLETE() -- blasted Lands citadel wonderful NPC. They do not trigger any events except quest_complete. if not AllowedToHandle() then @@ -256,18 +266,15 @@ function AutoTurnIn:QUEST_COMPLETE() local found = {} for i=1, GetNumQuestChoices() do - local class, subclass, _, equipSlot = select(6, GetItemInfo(GetQuestItemLink("choice", i))) - -- relics and trinkets are out of autoloot + local link = GetQuestItemLink("choice", i) + local class, subclass, _, equipSlot = select(6, GetItemInfo(link)) + --[[relics and trinkets are out of autoloot if C.STOPTOKENS[equipSlot] then - self:Print(INVTYPE_RELIC..' or ' .. INVTYPE_TRINKET .. 'found. Choose reward manually pls.') + self:Print(INVTYPE_RELIC..' or ' .. INVTYPE_TRINKET .. ' found. Choose reward manually pls.') return - end - - if AutoTurnInCharacterDB.items[subclass] or (AutoTurnInCharacterDB.items['Ranged'] and - (C.ITEMS['Crossbows'] == subclass or - C.ITEMS['Guns'] == subclass or - C.ITEMS['Bows'] == subclass)) then - local stattable = GetItemStats(swordLink) + end]]-- + if AutoTurnInCharacterDB.items[subclass] or IsRangedWeapon(subclass) or IsJewelry(equipSlot) then + local stattable = GetItemStats(link) for stat, value in pairs(stattable) do if ( C.STATS[stat] ) then tinsert(found, i) @@ -276,13 +283,16 @@ function AutoTurnIn:QUEST_COMPLETE() end end + print("Handle "..#found ) -- HANDLE RESULT if #found > 1 then - for _, reward in pairs(found) do + for _, reward in pairs(found) do + print("found: " .. GetQuestItemLink("choice", found[reward])) --_G["QuestInfoItem" .. index] end elseif(#found == 1) then - GetQuestReward(found[1]) + print("found: " .. GetQuestItemLink("choice", found[1])) + --GetQuestReward(found[1]) end end -- #N E E D @@ -290,7 +300,7 @@ function AutoTurnIn:QUEST_COMPLETE() end else - GetQuestReward(index) + --GetQuestReward(index) end end end diff --git a/RewardOptions.lua b/RewardOptions.lua index fe0eed6..4cf2252 100644 --- a/RewardOptions.lua +++ b/RewardOptions.lua @@ -51,16 +51,18 @@ CreateCheckbox("Fist Weapons", WeaponPanel, 402, -72, C.ITEMS['Fist Weapons']) CreateCheckbox("Daggers", WeaponPanel, 10, -104, C.ITEMS['Daggers'] ) CreateCheckbox("Thrown", WeaponPanel, 206, -104, C.ITEMS['Thrown']) CreateCheckbox("Wands", WeaponPanel, 402, -104, C.ITEMS['Wands']) + -- 5th line CreateCheckbox("Ranged", WeaponPanel, 10, -136, string.format("%s, %s, %s", C.ITEMS['Crossbows'], C.ITEMS['Bows'], C.ITEMS['Guns']) ) - -- ARMOR local ArmorPanel = CreatePanel("ArmorPanel", C.ARMORLABEL, 590, 70) CreateCheckbox("Cloth", ArmorPanel, 10, -8, C.ITEMS['Cloth']) CreateCheckbox("Leather", ArmorPanel, 152, -8, C.ITEMS['Leather'] ) CreateCheckbox("Mail", ArmorPanel, 292, -8, C.ITEMS['Mail']) CreateCheckbox("Plate", ArmorPanel, 436, -8, C.ITEMS['Plate']) + -- 2nd line CreateCheckbox("Shields", ArmorPanel, 10, -40, C.ITEMS['Shields']) +CreateCheckbox("Jewelry", ArmorPanel, 292, -40, ptable.L['Jewelry'] ) -- ATTRIBUTES local StatPanel = CreatePanel("StatPanel", STAT_CATEGORY_ATTRIBUTES, 590, 40) diff --git a/localization_DE.lua b/localization_DE.lua index 1ae5428..d833f85 100644 --- a/localization_DE.lua +++ b/localization_DE.lua @@ -28,7 +28,9 @@ privateTable.L = setmetatable({ ["DarkmoonTeleLabel"]="Dunkelmond-Jahrmarkt: Zurück zur Kanone!", ["Teleportologe Fosselbab"]="Teleportologist Fozlebub", ["rewardtext"]="Show quest reward text", - ["togglekey"]="aktivieren/deaktivieren Taste"}, + ["togglekey"]="aktivieren/deaktivieren Taste", + + ['Jewelry']="Juwelier"}, {__index = function(table, index) return index end}) privateTable.L.quests = { diff --git a/localization_EN.lua b/localization_EN.lua index 890b7eb..0591943 100644 --- a/localization_EN.lua +++ b/localization_EN.lua @@ -9,24 +9,26 @@ privateTable.L = setmetatable({ ["dontlootfalse"]="loot most expensive reward", ["dontloottrue"]="do not complete quests with rewards", - ["questTypeLabel"] = "quests", + ["questTypeLabel"] = "Quests to handle", ["questTypeAll"] = "all", ["questTypeList"] = "daily", - ["lootTypeLabel"]="quests with rewards", + ["lootTypeLabel"]="Quests with rewards", ["lootTypeFalse"]="don't turn in", ["lootTypeGreed"]="loot most expensive reward", ["lootTypeNeed"]="loot by parameters", - ["tournamentLabel"]="tournament", + ["tournamentLabel"]="Tournament", ["tournamentWrit"]="Champion's Writ", -- 46114 ["tournamentPurse"]="Champion's Purse", -- 45724 ["DarkmoonTeleLabel"]="Darkmoon: teleport to the cannon", ["DarkmoonFaireTeleport"]="Teleportologist Fozlebub", - ["rewardtext"]="print quest reward text", - ["togglekey"]="Enable/disable key"}, + ["rewardtext"]="Print quest reward text", + ["togglekey"]="Enable/disable key", + + ['Jewelry']="Jewelry"}, {__index = function(table, index) return index end}) privateTable.L.quests = { diff --git a/localization_RU.lua b/localization_RU.lua index 2e59428..0f03ba4 100644 --- a/localization_RU.lua +++ b/localization_RU.lua @@ -29,7 +29,10 @@ privateTable.L = setmetatable({ ["DarkmoonFaireTeleport"]="Телепортолог Фоцлебульб", ["rewardtext"]="Показывать финальный текст задания", - ["togglekey"]="Клавиша разового включения/отключения"}, + ["togglekey"]="Клавиша разового включения/отключения", + + ['Jewelry']="Ювелирные украшения"}, + {__index = function(table, index) return index end}) privateTable.L.quests = { diff --git a/rewards.lua b/rewards.lua index 714bf98..b720eb1 100644 --- a/rewards.lua +++ b/rewards.lua @@ -8,7 +8,10 @@ local armor = {GetAuctionItemSubClasses(2)} -- INVTYPE_RELIC INVTYPE_TRINKET - . C.WEAPONLABEL, C.ARMORLABEL = GetAuctionItemClasses() C.STOPTOKENS = {['INVTYPE_RELIC']='', ['INVTYPE_TRINKET']=''} +C.JEWELRY = {['INVTYPE_FINGER']='', ['INVTYPE_NECK']=''} --[[ + + SPELL_STAT1_NAME = "Strength"; SPELL_STAT2_NAME = "Agility"; SPELL_STAT3_NAME = "Stamina"; @@ -78,7 +81,7 @@ end /run for k,v in pairs(OPEN_FILTER_LIST) do for n,m in pairs(v) do print(n,m) end end /run print(_G[INVTYPE_CLOAK]) -/run print(select(5, GetItemInfo(" "))) +/run print(select(6, GetItemInfo(" "))) /run function a(...) for i=1, select("#", ...), 2 do invType = _G[select(i, ...)] print(invType, select(i, ...)) end end a(GetAuctionInvTypes(2,2)) 00:08:47 INVTYPE_CLOAK 1 INVTYPE_HOLDABLE nil -- 1.7.9.5