PK Ԉ>;. Scrap/Bindings.xml
if MerchantFrame:IsShown() and LoadAddOn('Scrap_Merchant') then
Scrap:SellJunk()
end
local item = GameTooltip:IsVisible() and GameTooltip:GetItem()
if item and LoadAddOn('Scrap_Merchant') then
Scrap:ToggleJunk(item)
end
PK {;A A Scrap/License.url[InternetShortcut]
URL=http://www.gnu.org/licenses/gpl-3.0.txt
PK >K Scrap/Panel.lua--[[
Copyright 2008, 2009, 2010, 2011 João Cardoso
Scrap is distributed under the terms of the GNU General Public License (or the Lesser GPL).
This file is part of Scrap.
Scrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Scrap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Scrap. If not, see .
--]]
local Panel = CreateFrame('Frame', 'ScrapPanel')
Panel.name = 'Scrap'
Panel:SetScript('OnShow', function()
local loaded, reason = LoadAddOn('Scrap_Options')
if not loaded then
local string = Panel:CreateFontString(nil, nil, 'GameFontHighlight')
string:SetText(format('"Scrap_Options" could not be loaded because the addon is %s', strlower(_G['ADDON_'..reason])))
string:SetPoint('RIGHT', -40, 0)
string:SetPoint('LEFT', 40, 0)
string:SetHeight(30)
end
end)
InterfaceOptions_AddCategory(Panel)PK g>r, Scrap/Scrap.lua--[[
Copyright 2008, 2009, 2010, 2011 João Cardoso
Scrap is distributed under the terms of the GNU General Public License (or the Lesser GPL).
This file is part of Scrap.
Scrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Scrap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Scrap. If not, see .
--]]
local Tooltip = CreateFrame('GameTooltip', 'ScrapTooltip', nil, 'GameTooltipTemplate')
local Scrap = CreateFrame('Button', 'Scrap', MerchantBuyBackItem)
local Unfit = LibStub('Unfit-1.0')
local WEAPON, ARMOR, _, CONSUMABLES = GetAuctionItemClasses()
local FISHING_ROD = select(17 , GetAuctionItemSubClasses(1))
local CLASS_NAME = LOCALIZED_CLASS_NAMES_MALE[select(2, UnitClass('player'))]
local CAN_TRADE = BIND_TRADE_TIME_REMAINING:format('.*')
local MATCH_CLASS = ITEM_CLASSES_ALLOWED:format('')
local ACTUAL_SLOTS = {
ROBE = 'CHEST',
CLOAK = 'BACK',
RANGEDRIGHT = 'RANGED',
THROWN = 'RANGED',
WEAPONMAINHAND = 'MAINHAND',
WEAPONOFFHAND = 'OFFHAND',
HOLDABLE = 'OFFHAND',
SHIELD = 'OFFHAND',
}
BINDING_HEADER_SCRAP = 'Scrap'
Scrap_NotJunk = Scrap_NotJunk or {}
Scrap_Junk = Scrap_Junk or {}
Scrap_Hooks = function() end
Scrap_Locals = {}
--[[ Events ]]--
function Scrap:Startup()
self:SetScript('OnEvent', function(self, event) self[event](self) end)
self:RegisterEvent('MERCHANT_SHOW')
self:RegisterEvent('VARIABLES_LOADED') -- BETA TEMPORARY, REMOVE IN 2 WOW PATCHES
end
function Scrap:VARIABLES_LOADED() -- BETA TEMPORARY, REMOVE IN 2 WOW PATCHES
LoadAddOn('Scrap_Updater')
end
function Scrap:MERCHANT_SHOW()
if not LoadAddOn('Scrap_Merchant') then
self:UnregisterEvent('MERCHANT_SHOW')
else
self:MERCHANT_SHOW()
end
end
--[[ Junk List ]]--
function Scrap:IsJunk(id)
if id then
return Scrap_Junk[id] or (not Scrap_NotJunk[id] and self:CheckFilters(id))
end
end
function Scrap:IterateJunk()
local bagNumSlots, bag, slot = GetContainerNumSlots(BACKPACK_CONTAINER), BACKPACK_CONTAINER, 0
local match, id
return function()
match = nil
while not match do
if slot < bagNumSlots then
slot = slot + 1
elseif bag < NUM_BAG_FRAMES then
bag = bag + 1
bagNumSlots = GetContainerNumSlots(bag)
slot = 1
else
bag, slot = nil
break
end
id = GetContainerItemID(bag, slot)
match = self:IsJunk(id)
end
return bag, slot, id
end
end
--[[ Filters ]]--
function Scrap:CheckFilters(id)
local _, link, quality, level, _, class, subClass, _, slot, _, value = GetItemInfo(id)
if value and value > 0 then
if quality == ITEM_QUALITY_POOR then
return true
elseif Scrap_LowConsume and class == CONSUMABLES then
return level ~= 0 and (UnitLevel('player') - level) > 10
elseif class == ARMOR or class == WEAPON then
if isPoor then
return level > 10 or UnitLevel('player') > 20
else
local isEnchanter = self:IsEnchanter()
local numLines, limit = self:IsSoulbound(link)
if numLines then
return not isEnchanter and (Unfit:IsClassUnusable(subClass, slot) or self:IsOtherClass(numLines, limit)) or self:IsLowEquip(id, subClass, slot, level, quality)
end
end
end
end
end
function Scrap:IsEnchanter()
local prof1, prof2 = GetProfessions()
return not prof1 or not prof2 or select(7, GetProfessionInfo(prof1)) == 333 or select(7, GetProfessionInfo(prof2)) == 333
end
function Scrap:IsSoulbound(link)
Tooltip:SetOwner(UIParent, 'ANCHOR_NONE')
Tooltip:SetHyperlink(link)
local numLines = Tooltip:NumLines()
local lastLine = _G['ScrapTooltipTextLeft'..numLines]:GetText()
if not lastLine:match(CAN_TRADE) then
for i = 2,4 do
if _G['ScrapTooltipTextLeft'..i]:GetText() == ITEM_BIND_ON_PICKUP then
return numLines, i
end
end
end
end
function Scrap:IsOtherClass(numLines, limit)
for i = numLines, limit, -1 do
local text = _G['ScrapTooltipTextLeft'..i]:GetText()
if text:match(MATCH_CLASS) then
return not text:match(CLASS_NAME)
end
end
end
function Scrap:IsLowEquip(id, subClass, slot, ...)
if slot ~= '' and subClass ~= FISHING_ROD then
slot = slot:match('INVTYPE_(.+)')
if slot ~= 'TRINKET' and slot ~= 'TABARD' and slot ~= 'BODY' then
return self:HasBetterEquip(id, slot, ...)
end
end
end
function Scrap:HasBetterEquip(id, slot, level, quality)
if Scrap_LowEquip then
local slot1, slot2 = ACTUAL_SLOTS[slot] or slot
local value = level * quality ^.35
local double
if slot1 == 'WEAPON' or slot1 == '2HWEAPON' then
if slot1 == '2HWEAPON' then
double = true
end
slot1, slot2 = 'MAINHAND', 'OFFHAND'
elseif slot1 == 'FINGER' then
slot1, slot2 = 'FINGER1', 'FINGER2'
end
return self:IsBetterEquip(slot1, value) and (not slot2 or self:IsBetterEquip(slot2, value, double))
end
end
function Scrap:IsBetterEquip(slot, value, empty)
local equipedItem = GetInventoryItemID('player', _G['INVSLOT_'..slot])
if equipedItem then
local _,_, equipQuality, equipLevel = GetItemInfo(equipedItem)
return equipLevel * equipQuality^.35 - value > 15
elseif empty then
return true
end
end
--[[ Call Addon ]]--
Scrap:Startup()PK g>5; Scrap/Scrap.toc## Interface: 40100
## Title: Scrap
## Notes: Sells all your junk at the merchant.
## Author: Jaliborc (João Cardoso)
## X-License: GNU General Public License Version 3
## X-Category: Inventory
## Version: 7.5
## SavedVariables: Scrap_AutoSell, Scrap_Tutorials
## SavedVariablesPerCharacter: Scrap_Junk, Scrap_NotJunk, Scrap_LowEquip, Scrap_Unsafe, Scrap_LowConsume, Scrap_List, Scrap_UpdaterVersion
## OptionalDeps: LibStub, Unfit-1.0
Libs\LibStub\LibStub.lua
Libs\Unfit-1.0\Unfit-1.0.lua
Scrap.lua
Panel.luaPK q4>ؚ,@ ,@ Scrap/Art/Disabled Box.tga @ @
333)))(((((('''+++@@@------...000...000...---......)))((('''(((;;;'''((((((((((((<<<;;;,,,,,,++++++///...///000000/////////'''&&&<<<;;;)))&&&(((&&&555 333KKKKKK333;;;:::;;;;;;@@@@@@???@@@DDDCCCDDDCCCBBBCCCBBBBBB;;;;;;;;;;;;:::;;;;;;;;;;;;:::;;;<<<@@@@@@???AAACCCDDDCCCCCCDDDCCCDDDBBB;;;===;;;;;;::::::;;;;;;444MMMMMM555 (((444333
444555))) !!!@@@@@@ 000999uuu}}}uuuoooiiiFFF+++
@@@@@@!!! @@@@@@ !!!{{{YYY222 @@@@@@!!!@@@]]] ]]]yyyYYYXXX___tttjjjcccRRR ^^^???@@@]]]
!!!###+++******)))''' !!!###"""TTTiiiUUUWWWQQQ^^^@@@AAA___ ***:::===;;;:::777++++++,,,******))))))******+++)))(((''''''fffcccXXX cccDDDAAA``` +++FFFPPPUUUPPP<<<<<<777,,,---777555666666666555777444+++(((###:::xxxxxxzzzeeeYYY###cccDDD@@@``` ,,,CCCRRRaaaXXXKKK@@@>>>EEEDDDCCCCCCDDD@@@??????@@@===;;;555222////////////))) SSSxxxvvvxxxhhh^^^)))bbbDDDAAA___ 666NNN[[[aaa```PPPGGGJJJLLLLLLMMMLLLFFFDDD@@@AAAAAA???===<<<<<<<<<999999:::999444222'''AAAuuuVVVVVVooommm...bbbCCCAAA``` >>>PPP___bbbaaaVVVPPPQQQNNNOOOMMMLLLMMMLLLMMMJJJIIIIIIHHHDDDDDDEEEEEECCC:::;;;888555666444+++444sssVVVVVVVVV,,,cccCCCAAA``` 444PPPaaabbb```^^^XXXWWWUUUTTTTTTUUUTTTSSSVVV]]][[[SSSTTTRRRNNNNNNOOOMMMKKKMMMKKKCCC@@@<<<555,,,RRRqqqYYY888cccCCCAAAaaa RRR\\\iiigggaaa___``````^^^\\\^^^\\\^^^aaahhhhhhccc\\\]]]^^^___^^^YYYTTTTTTTTTUUUSSSLLLCCC777AAAuuuuuuyyyzzz|||vvv===bbbCCCBBB``` FFF\\\hhhhhhlllppphhhkkksssppphhheee^^^aaaiiiiiiiiiiiikkkfffbbbfffaaaZZZUUUSSSSSSSSSNNNKKKLLL===NNNtttgggnnn---cccDDDEEEggg XXXggghhhkkkxxxtttjjjttt|||tttpppggghhhpppqqqiiihhhlllmmmhhhcccdddddd___UUUSSSPPPKKKJJJGGGJJJ;;;SSSttt}}}}}} lllIIIFFFfff <<<[[[hhhiii{{{uuuqqquuu||||||zzzttt{{{|||xxxpppooommmmmmmmmkkkfffeee___YYYWWWSSSMMMKKKGGGGGG777LLLyyyyyywww kkkKKK FFFfffSSShhhnnnttt{{{}}}||||||vvvuuuvvvrrrpppooommmggg^^^XXXXXXUUUNNNOOOOOOPPPKKKEEE<<>>[[[111kkk|||ooodddZZZTTTTTTPPPOOOBBB888///555<<<]]]___VVVjjjDDD```AAACCCbbb111lllqqqddd\\\RRROOOQQQNNNCCC777...222666JJJ___eeeJJJlllrrr gggEEECCCccc777|||pppddd\\\WWWPPPQQQOOOBBB999...$$$###999^^^iiiWWWLLLQQQkkkwwwSSS===
fffFFFCCCbbb444}}}{{{sssmmmbbb[[[UUUTTTLLLAAA<<<888000&&&\\\pppcccSSS888......$$$666aaammm}}}WWW...222>>>***fffFFFCCCccc000vvv|||uuurrrggg```VVVTTTNNNIII@@@999333$$$]]]rrr```QQQDDD222&&&111PPP333***''' JJJ666fffFFFEEEccc---yyy|||tttmmmgggaaa[[[TTTMMMMMMEEE:::333$$$^^^pppVVVHHHCCC555,,,###777TTT+++000)))KKK444 gggGGG EEEddd111{{{vvvlllgggaaaZZZTTTMMMMMMGGG===666---'''\\\ooo___QQQEEE444+++"""RRRUUU000)))'''LLL!!! gggGGG EEEccc$$$ttt||||||zzzppp```___YYYXXXUUUTTTLLL<<<555222***HHHjjj```TTTGGG777''' ZZZFFF,,,$$$SSSHHH gggGGGEEEddd%%%lllrrrjjjhhhfff[[[[[[XXXUUUVVVUUUSSSCCC666333&&&:::hhhgggQQQGGG777'''
333\\\AAAVVVSSSiiiGGG???ZZZ___yyyeeeZZZ]]]XXXXXXXXXUUUUUUTTTUUUSSSBBB333$$$,,,___fffLLLEEE777'''
444]]]@@@,,,```333```BBB@@@ZZZ***}}}fff\\\XXXVVVSSSUUUWWWVVVUUUUUUVVVNNN555&&&(((III^^^SSSHHH888$$$
333XXX111YYYQQQ
```@@@???[[[)))vvvxxxbbb\\\[[[ZZZVVVRRRRRRRRRTTTUUUDDD333'''333SSSWWWTTTEEE$$$---FFF'''
TTT ```@@@???\\\ dddzzzxxxxxxwwwyyyxxxzzzwww[[[BBBDDDEEEGGGQQQVVVSSS999%%% 666VVVWWWHHH///***BBB'''999PPP ```AAAAAA```555uuuaaaSSSUUUVVVRRRAAAGGG```|||uuuXXXDDDAAABBBDDDKKKVVVCCC'''!!!FFFVVVJJJ888666$$$444bbbXXX cccBBBBBB```
YYY|||uuucccUUUPPPSSSOOO>>><<