# HG changeset patch
# User tercio
# Date 1408830988 10800
# Node ID a6fb0ff113b12b0a7abd9e846c77f6900eb0447a
# Parent 018fc9f0c471c73e2528ce8730cea445528bd00b
- Added inventory items.
- Added alpha animation.
diff -r 018fc9f0c471 -r a6fb0ff113b1 HotCorners.lua
--- a/HotCorners.lua Sat Aug 09 17:28:04 2014 -0300
+++ b/HotCorners.lua Sat Aug 23 18:56:28 2014 -0300
@@ -1,3 +1,6 @@
+
+-- fazer ele fechar apenas com o HotCornersBackgroundFrame.
+-- assim vai dar + estabilidade sabendo exatamente quando ele esta aberto ou fechado.
LibHotCorners = LibStub ("AceAddon-3.0"):NewAddon ("HotCorners", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0")
_G.HotCorners = LibHotCorners
@@ -29,6 +32,9 @@
end
+LibHotCorners.ItemButtons = {}
+LibHotCorners.ItemOnInventory = {}
+
local refresh_topleft = function()
LibHotCorners ["topleft"].is_enabled = LibHotCorners.db.profile.topleft_enabled
end
@@ -289,7 +295,7 @@
function HotCornersBackgroundOnEnter (self)
if (LibHotCornersTopLeft and LibHotCornersTopLeft:IsShown()) then
if (LibHotCornersTopLeft:GetWidth() > 2) then
- HotCornersOnLeave (LibHotCornersTopLeft)
+ HotCornersOnLeave (LibHotCornersTopLeft, true)
end
end
self:EnableMouse (false)
@@ -306,7 +312,7 @@
--> show tooltip
local show_tooltip = function (self)
- if (self.table.tooltip) then
+ if (self.table and self.table.tooltip) then
if (type (self.table.tooltip) == "function") then
GameTooltip:SetOwner (self, "ANCHOR_RIGHT")
self.table.tooltip (GameTooltip)
@@ -316,8 +322,12 @@
GameTooltip:AddLine (self.table.tooltip)
GameTooltip:Show()
end
- elseif (self.table.onenter) then
+ elseif (self.table and self.table.onenter) then
self.table.onenter (self)
+ elseif (self.isItem) then
+ GameTooltip:SetOwner (self, "ANCHOR_BOTTOMRIGHT")
+ GameTooltip:SetHyperlink (self.itemtable[4])
+ GameTooltip:Show()
end
end
@@ -326,6 +336,100 @@
return t1[1] > t2[1]
end
+ LibHotCorners.BackPackItemList = {
+
+ --> alchemy
+ [76086] = true, -- Flask of Falling Leaves
+ [76084] = true, -- Flask of Spring Blossoms
+ [76085] = true, -- Flask of the Warm Sun
+ [76087] = true, -- Flask of the Earth
+ [76088] = true, -- Flask of Winter's Bite
+
+ [76081] = true, -- Elixir of Mirrors
+ [76079] = true, -- Elixir of Peace
+ [76080] = true, -- Elixir of Perfection
+ [76078] = true, -- Elixir of the Rapids
+ [76077] = true, -- Elixir of Weaponry
+ [70676] = true, -- Mad Hozen Elixir
+ [76075] = true, -- Mantid Elixir
+ [76083] = true, -- Monk's Elixir
+
+ [76094] = true, -- Alchemist's Rejuvenation
+ [96096] = true, -- Darkwater Potion
+ [75218] = true, -- Electrified Oil
+ [76097] = true, -- Master Healing Potion
+ [76098] = true, -- Master Mana Potion
+ [76092] = true, -- Potion of Focus
+ [76093] = true, -- Potion of the Jade Serpent
+ [76095] = true, -- Potion of Mogu Power
+ [76090] = true, -- Potion of the Mountains
+ [76091] = true, -- Greater Potion of Luck
+ [76089] = true, -- Virmen's Bite
+
+ --> cooking
+
+ --Way of the Grill: Strength
+ [74642] = true, -- Charbroiled Tiger Steak
+ [74645] = true, -- Eternal Blossom Fish
+ [74646] = true, -- Black Pepper Ribs and Shrimp
+
+ --Way of the Oven: Stamina
+ [74654] = true, -- Wildfowl Roast
+ [74655] = true, -- Twin Fish Platter
+ [74656] = true, -- Chun Tian Spring Rolls
+
+ --Way of the Pot: Intellect
+
+ [74644] = true, -- Swirling Mist Soup
+ [74649] = true, -- Braised Turtle
+ [74650] = true, -- Mogu Fish Stew
+
+ --Way of the Steamer: Spirit
+
+ [74651] = true, -- Shrimp Dumplings
+ [74652] = true, -- Fire Spirit Salmon
+ [74653] = true, -- Steamed Crab Surprise
+
+ --Way of the Wok: Agility
+
+ [74643] = true, -- Sauteed Carrots
+ [74647] = true, -- Valley Stir Fry
+ [74648] = true, -- Sea Mist Rice Noodles
+
+ --Way of the Brew: Headaches and Grandeur
+
+ [74626] = true, -- Ginseng Tea
+ [74637] = true, -- Jade Witch Brew
+ [74638] = true, -- Mad Brewer's Breakfast
+
+ --General Cooking
+
+ [74641] = true, -- Fish Cake
+ [74636] = true, -- Golden Carp Consomme
+ [86070] = true, -- Wildfowl Ginseng Soup
+ [86069] = true, -- Rice Pudding
+ [86074] = true, -- Spicy Vegetable Chips
+ [86073] = true, -- Spicy Salmon
+
+ --5.4 Recipes
+
+ [145308] = true, -- Mango Ice
+ [145309] = true, -- Farmer's Delight
+ [145311] = true, -- Fluffy Silkfeather Omelet
+ [145310] = true, -- Stuffed Lushrooms
+ [145307] = true, -- Spiced Blossom Soup
+ [145305] = true, -- Seasoned Pomfruit Slices
+
+ --Cart Kits
+ [101630] = true, -- Noodle Cart Kit
+ [101661] = true, -- Deluxe Noodle Cart Kit
+ [101662] = true, -- Pandaren Treasure Noodle Cart Kit
+
+ [101618] = true, -- Pandaren Treasure Noodle Soup
+ [101617] = true, -- Deluxe Noodle Soup
+ [101616] = true, -- Noodle Soup
+ }
+
function HotCornersOnEnter (self)
if (not LibHotCorners.db.profile.is_enabled) then
@@ -336,9 +440,14 @@
return
end
+ if (self:GetWidth() < 1.1 and self:GetHeight() < 1.1) then
+ --print ("abrindo...")
+ end
+
set_size (self)
HotCornersBackgroundFrame:EnableMouse (true)
+ self.item_frame:Show()
local i = 1
@@ -363,10 +472,13 @@
if (not disabled [button_table.name] and not button_table.optionstable.hide) then
if (self.position == "topleft" or self.position == "topright") then
+
local y = i * 35 * -1
- button_table.widget:SetPoint ("topleft", self, "topleft", 4, y)
+ --button_table.widget:SetPoint ("topleft", self, "topleft", 4, y)
button_table.widget.y = y
- else
+ HotCornersStartAnimOnShow (button_table.widget, "y")
+
+ else --bottom left / bottom right
local x = i * 35
button_table.widget:SetPoint ("topleft", self, "topleft", x, -4)
button_table.widget.x = x
@@ -386,18 +498,105 @@
OptionsButton:SetPoint ("top", self, "top", 0, y)
OptionsButton:Show()
+ --item frame
+ LibHotCorners:RefereshItems (self)
+
end
+ function LibHotCorners:RefereshItems (self)
+
+ if (not self) then
+ return LibHotCorners:ScheduleTimer ("RefereshItems", 1, LibHotCornersTopLeft)
+ end
+
+ if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
+ for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do
+ itemTable [1] = 0
+ end
+
+ for bagID = 0, 4 do
+ local numItems = GetContainerNumSlots (bagID)
+ for slot = 1, numItems do
+ local itemId = GetContainerItemID (bagID, slot)
+ if (LibHotCorners.BackPackItemList [itemId]) then
+ local texture, itemCount, locked, quality, readable, lootable, itemLink = GetContainerItemInfo (bagID, slot)
+ if (not LibHotCorners.ItemOnInventory [itemId]) then
+ LibHotCorners.ItemOnInventory [itemId] = {itemCount, texture, quality, itemLink, itemId}
+ else
+ LibHotCorners.ItemOnInventory [itemId] [1] = LibHotCorners.ItemOnInventory [itemId] [1] + itemCount
+ end
+ end
+ end
+ end
+
+ local index = 1
+ for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do
+ local itemCount, texture, quality, itemLink = unpack (itemTable)
+
+ local item_button = LibHotCorners:GetItemButton (index, self)
+ if (item_button) then
+ item_button:SetNormalTexture (texture)
+ item_button:SetHighlightTexture (texture)
+ item_button:SetPushedTexture (texture)
+
+ item_button.item_count:SetText (itemCount or 0)
+ item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCorners:RefereshItems()")
+
+ item_button.itemtable = itemTable
+
+ if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
+ HotCornersStartAnimOnShow (item_button, "item_topleft")
+ end
+ end
+ index = index + 1
+ end
+
+ end
+
+ --/run local itemid=GetContainerItemID (0, 1);print (itemid)
+ --UseContainerItem(bagID, slot[, onSelf])
+ end
+
+ function LibHotCorners:GetItemButton (index, parent)
+ local button = LibHotCorners.ItemButtons [index]
+ if (not button) then
+ button = CreateFrame ("button", "HotCornersItemButton" .. index, parent.item_frame, "HotCornersUseItemButtonTemplate")
+ button.isItem = true
+
+ if (parent.position == "topleft") then
+ local x = (index-1) * 33
+ button:SetPoint ("topleft", parent.item_frame, "topleft", x, -2)
+ button.x = x
+ elseif (parent.position == "topright") then
+ local x = (index-1) * 33
+ button:SetPoint ("topright", parent.item_frame, "topright", -x, -2)
+ end
+
+ LibHotCorners.ItemButtons [index] = button
+ end
+ return button
+ end
+
--> corner frame on leave
- function HotCornersOnLeave (self)
+ function HotCornersOnLeave (self, from_background)
+ if (not from_background) then
+ return
+ end
+
self:SetSize (1, 1)
for index, button_table in ipairs (LibHotCorners [self.position]) do
if (button_table.widget) then
button_table.widget:Hide()
end
end
+ for _, button in pairs (LibHotCorners.ItemButtons) do
+ button:Hide()
+ end
+
local OptionsButton = LibHotCorners [self.position].optionsbutton
OptionsButton:Hide()
+
+ self.item_frame:Hide()
end
--> quick corner on click
@@ -436,51 +635,87 @@
--> button onenter
function HotCornersButtonOnEnter (self)
- set_size (self:GetParent())
- for index, button_table in ipairs (LibHotCorners [self:GetParent().position]) do
- if (not LibHotCorners.db.profile.disabled [button_table.name]) then
- button_table.widget:Show()
- end
- end
+ --set_size (self:GetParent())
+ --for index, button_table in ipairs (LibHotCorners [self:GetParent().position]) do
+ -- if (not LibHotCorners.db.profile.disabled [button_table.name] and button_table.widget) then
+ -- button_table.widget:Show()
+ -- end
+ --end
show_tooltip (self)
- local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
- OptionsButton:Show()
+ --local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
+ --OptionsButton:Show()
end
--> button onleave
function HotCornersButtonOnLeave (self)
GameTooltip:Hide()
- if (self.table.onleave) then
+ if (self.table and self.table.onleave) then
self.table.onleave (self)
end
- self:GetParent():GetScript("OnLeave")(self:GetParent())
- local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
- OptionsButton:Hide()
+ --self:GetParent():GetScript("OnLeave")(self:GetParent())
+ --local OptionsButton = LibHotCorners [self:GetParent().position].optionsbutton
+ --OptionsButton:Hide()
end
--> button onmousedown
function HotCornersButtonOnMouseDown (self, button)
- if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
- self:SetPoint ("topleft", self:GetParent(), "topleft", 5, self.y - 1)
+ if (self.isItem) then
+ if (self:GetParent():GetParent().position == "topleft") then
+ self:SetPoint ("topleft", self:GetParent(), "topleft", self.x+1, -3)
+ end
else
- self:SetPoint ("topleft", self:GetParent(), "topleft", self.x+1, -6)
+ if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
+ self:SetPoint ("topleft", self:GetParent(), "topleft", 5, self.y - 1)
+ else
+ self:SetPoint ("topleft", self:GetParent(), "topleft", self.x+1, -6)
+ end
end
end
--> button onmouseup
function HotCornersButtonOnMouseUp (self, button)
- if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
- self:SetPoint ("topleft", self:GetParent(), "topleft", 4, self.y)
+ if (self.isItem) then
+ if (self:GetParent():GetParent().position == "topleft") then
+ self:SetPoint ("topleft", self:GetParent(), "topleft", self.x, -2)
+ end
else
- self:SetPoint ("topleft", self:GetParent(), "topleft", self.x, -4)
+ if (self:GetParent().position == "topleft" or self:GetParent().position == "topright") then
+ self:SetPoint ("topleft", self:GetParent(), "topleft", 4, self.y)
+ else
+ self:SetPoint ("topleft", self:GetParent(), "topleft", self.x, -4)
+ end
+ if (self.table.click) then
+ local clicks = LibHotCorners.db.profile.clicks
+ clicks [self.table.name] = clicks [self.table.name] or 0
+ clicks [self.table.name] = clicks [self.table.name] + 1
+ self.table.click (self, button)
+ end
end
- if (self.table.click) then
- local clicks = LibHotCorners.db.profile.clicks
- clicks [self.table.name] = clicks [self.table.name] or 0
- clicks [self.table.name] = clicks [self.table.name] + 1
- self.table.click (self, button)
+ end
+
+ --> start show animation
+ function HotCornersStartAnimOnShow (button, axis)
+ if (axis == "y") then
+ --button:SetPoint ("topleft", button:GetParent(), "topleft", -32, button.y)
+ button:SetPoint ("topleft", button:GetParent(), "topleft", 4, button.y)
+ button.AnimOnShow:Play()
+
+ elseif (axis == "item_topleft") then
+ button:Show()
+ button.AnimOnShow:Play()
+
end
end
+
+ --> on start / finish show animation
+ function HotCornersAnimOnShowStarted (button)
+
+ end
+ function HotCornersAnimOnShowFinished (button)
+ --button:SetPoint ("topleft", button:GetParent(), "topleft", 4, button.y)
+ button:Show()
+ --button:SetPoint ("topleft", button:GetParent(), "topleft", -4, button.y)
+ end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> create top left corner
diff -r 018fc9f0c471 -r a6fb0ff113b1 HotCorners.xml
--- a/HotCorners.xml Sat Aug 09 17:28:04 2014 -0300
+++ b/HotCorners.xml Sat Aug 23 18:56:28 2014 -0300
@@ -30,12 +30,31 @@
- HotCornersOnEnter (self);
+
HotCornersOnLeave (self);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -57,8 +76,96 @@
+
+
+
+
+
+
+
+
+
+
+
+ HotCornersAnimOnShowStarted (self:GetParent())
+
+
+ HotCornersAnimOnShowFinished (self:GetParent())
+
+
+
+
+
self:SetFrameLevel (self:GetParent():GetFrameLevel()+2);
@@ -114,6 +221,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ self.go:Play()
+ self:Hide()
+
+
+
+
+
\ No newline at end of file