public
Description: WoW Addon - Sometimes you just want to run around nekkid
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/nudist.git
Click here to lend your support to: nudist and make a donation at www.pledgie.com !
nudist / Nudist.lua
100644 72 lines (56 sloc) 1.871 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local slots, freeslots, items = {1, 3, 5, 6, 7, 8, 9, 10, 16, 17, 18}, {}, {}
 
 
local function GetEmpties()
for i=0,4 do freeslots[i] = 0 end
for bag=0,4 do
for slot=1,GetContainerNumSlots(bag) do
if not GetContainerItemInfo(bag, slot) then freeslots[bag] = freeslots[bag] + 1 end
end
end
end
 
 
local function GetNextEmpty()
for i=0,4 do
if freeslots[i] > 0 then
freeslots[i] = freeslots[i] - 1
return i
end
end
end
 
 
---------------------------------
-- Char frame button --
---------------------------------
 
local butt = CreateFrame("Button", nil, CharacterFrame)
butt:SetFrameStrata("DIALOG")
butt:SetPoint("BOTTOMRIGHT", CharacterFrame, "TOPRIGHT", -60, -40)
butt:SetWidth(64) butt:SetHeight(64)
 
-- Textures --
butt:SetNormalTexture("Interface\\Addons\\Nudist\\clothed")
butt:SetPushedTexture("Interface\\Addons\\Nudist\\nude")
 
-- Tooltip bits
--~ butt:SetScript("OnEnter", ShowTooltip)
--~ butt:SetScript("OnLeave", HideTooltip)
 
 
local function handler()
if CursorHasItem() then ClearCursor() end
 
if next(items) then
while next(items) do EquipItemByName(table.remove(items), table.remove(items)) end
butt:SetNormalTexture("Interface\\Addons\\Nudist\\clothed")
butt:SetPushedTexture("Interface\\Addons\\Nudist\\nude")
elseif not InCombatLockdown() then
butt:SetNormalTexture("Interface\\Addons\\Nudist\\nude")
butt:SetPushedTexture("Interface\\Addons\\Nudist\\clothed")
GetEmpties()
for _,i in ipairs(slots) do
local bag = GetNextEmpty()
if not bag then return end
 
local item = GetInventoryItemLink("player", i)
if item then
table.insert(items, i)
table.insert(items, item)
PickupInventoryItem(i)
if bag == 0 then PutItemInBackpack() else PutItemInBag(bag + 19) end
end
end
end
end
 
SLASH_NUDIST1 = "/nudist"
SlashCmdList["NUDIST"] = handler
butt:SetScript("OnClick", handler)