changeset 7:d8a463c5ef5a

- Updates to support WoD.
author Tercio
date Mon, 27 Apr 2015 12:34:29 -0300
parents 50b60140e5d8
children 3d3823b0f3f2
files HotCorners.lua HotCorners.xml
diffstat 2 files changed, 200 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/HotCorners.lua	Tue Feb 24 14:56:04 2015 -0300
+++ b/HotCorners.lua	Mon Apr 27 12:34:29 2015 -0300
@@ -20,6 +20,8 @@
 LibHotCorners.RegistredQuickFunctions = {}
 LibHotCorners.QuickFunctions = {topleft = false}
 
+LibHotCorners.LastItemButtonClick = GetTime()
+
 function LibHotCorners:OnEnable()
 	
 end
@@ -335,6 +337,8 @@
 		LibHotCorners.BackPackItemList = {
 
 			--> alchemy
+			
+				--MOP
 				[76086] = true, -- Flask of Falling Leaves
 				[76084] = true, -- Flask of Spring Blossoms
 				[76085] = true, -- Flask of the Warm Sun
@@ -361,10 +365,67 @@
 				[76090] = true, -- Potion of the Mountains
 				[76091] = true, -- Greater Potion of Luck
 				[76089] = true, -- Virmen's Bite
-			
+				
+				--WOD
+				[118704] = true, --Pure Rage Potion
+				[109156] = true, --Greater Draenic Strength Flask
+				[109160] = true, --Greater Draenic Stamina Flask
+				[109155] = true, --Greater Draenic Intellect Flask
+				[109153] = true, --Greater Draenic Agility Flask
+				[118711] = true, --Draenic Water Walking Elixir
+				[116271] = true, --Draenic Water Breathing Elixir
+				[116266] = true, --Draenic Swiftness Potion
+				[109219] = true, --Draenic Strength Potion
+				[109148] = true, --Draenic Strength Flask
+				[109152] = true, --Draenic Stamina Flask
+				[109226] = true, --Draenic Rejuvenation Potion
+				[109222] = true, --Draenic Mana Potion
+				[116276] = true, --Draenic Living Action Potion
+				[116268] = true, --Draenic Invisibility Potion
+				[109218] = true, --Draenic Intellect Potion
+				[109147] = true, --Draenic Intellect Flask
+				[109221] = true, --Draenic Channeled Mana Potion
+				[109220] = true, --Draenic Armor Potion
+				[109217] = true, --Draenic Agility Potion
+				[109145] = true, --Draenic Agility Flask
+				[112090] = true, --Transmorphic Tincture
+
 			--> cooking
-						
-				 --Way of the Grill: Strength
+				--WOD
+				[111449] = true, --Blackrock Barbecue
+				[111433] = true, --Blackrock Ham
+				[111436] = true, --Braised Riverbeast
+				[122348] = true, --Buttered Sturgeon
+				[111453] = true, --Calamari Crepes
+				[111438] = true, --Clefthoof Sausages
+				[126935] = true, --Fancy Darkmoon Feast
+				[111444] = true, --Fat Sleeper Cakes
+				[111457] = true, --Feast of Blood
+				[111458] = true, --Feast of the Waters
+				[111445] = true, --Fiery Calamari
+				[111450] = true, --Frosty Stew
+				[111454] = true, --Gorgrond Chowder
+				[111441] = true, --Grilled Gulper
+				[111456] = true, --Grilled Saberfish
+				[111431] = true, --Hearty Elekk Steak
+				[122346] = true, --Jumbo Sea Dog
+				[126934] = true, --Lemon Herb Filet
+				[111434] = true, --Pan-Seared Talbuk
+				[122345] = true, --Pickled Eel
+				[111437] = true, --Rylak Crepes
+				[111455] = true, --Saberfish Broth
+				[122344] = true, --Salty Squid Roll
+				[111446] = true, --Skulker Chowder
+				[111452] = true, --Sleeper Surprise
+				[122343] = true, --Sleeper Sushi
+				[111439] = true, --Steamed Scorpion
+				[111442] = true, --Sturgeon Stew
+				[126936] = true, --Sugar-Crusted Fish Feast
+				[111447] = true, --Talador Surf and Turf
+				[122347] = true, --Whiptail Fillet
+				--[] = true, --
+				--MOP
+				--Way of the Grill: Strength
 				[74642] = true, -- Charbroiled Tiger Steak
 				[74645] = true, -- Eternal Blossom Fish
 				[74646] = true, -- Black Pepper Ribs and Shrimp
@@ -536,6 +597,16 @@
 
 	function LibHotCorners:RefereshItems (self)
 		
+		if (HotCornersItemUsed and LibHotCorners.LastItemButtonClick < GetTime() and not self) then
+			for _, button in pairs (LibHotCorners.ItemButtons) do
+				if (not button.itemtable[6]) then --> isn't a profession cooldown
+					button.cooldown:SetCooldown (GetTime(), 1.5)
+				end
+			end
+			HotCornersItemUsed = nil
+			LibHotCorners.LastItemButtonClick = GetTime()+1.5
+		end
+		
 		if (not self) then
 			return LibHotCorners:ScheduleTimer ("RefereshItems", 1, LibHotCornersTopLeft)
 		end
@@ -571,7 +642,7 @@
 					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:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
 					
 					item_button.itemtable = itemTable
 					
@@ -579,14 +650,127 @@
 						HotCornersStartAnimOnShow (item_button, "item_topleft")
 					end
 				end
-				index = index + 1	
+				index = index + 1
 			end
+			
+			LibHotCorners:RefereshProfessions (self, index)
 
 		end
-		
 		--/run local itemid=GetContainerItemID (0, 1);print (itemid)
 		--UseContainerItem(bagID, slot[, onSelf])
-	end		
+	end
+	
+	local get_profession = function (icon)
+		if (icon:find ("Trade_Engineering")) then
+			return "en"
+		elseif (icon:find ("Trade_LeatherWorking")) then
+			return "lw"
+		elseif (icon:find ("Trade_Tailoring")) then
+			return "tl"
+		elseif (icon:find ("Trade_Engraving")) then
+			return "ec"
+		elseif (icon:find ("Trade_BlackSmithing")) then
+			return "bs"
+		elseif (icon:find ("Trade_Alchemy")) then
+			return "al"
+		elseif (icon:find ("INV_Misc_Gem_01")) then
+			return "jc"
+		elseif (icon:find ("INV_Inscription_Tradeskill01")) then
+			return "in"
+		end
+	end
+	local secrets_index = {
+		["tl"] = 176058, --tailoring
+		["ec"] = 177043, --enchanting
+		["lw"] = 176089, --letherwork
+		["en"] = 177054, --engeener
+		["bs"] = 176090, --blacksmith
+		["al"] = 175880, --alchemy
+		["jc"] = 176087, --jewelcraft
+		["in"] = 177045, --inscription
+	}
+	local secrets_icons = {
+		["tl"] = "inv_misc_book_03", --tailoring
+		["ec"] = "inv_misc_book_08", --enchant
+		["al"] = "inv_misc_book_08", -- alchemy
+		["bs"] = "inv_misc_book_11", --bs
+		["en"] = "inv_misc_book_08", --engeener
+		["in"] = "inv_misc_book_08", --inscritp
+		["jc"] = "inv_misc_book_10", --jc
+		["lw"] = "inv_misc_book_09", --lw
+	}
+	
+	function LibHotCorners:RefereshProfessions (self, index)
+		
+		index = index + 1
+		
+		local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions()
+
+		if (prof1) then
+			local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier, specializationIndex, specializationOffset = GetProfessionInfo (prof1)
+			local prof = get_profession (icon)
+			local secrets_spellID = secrets_index [prof]
+			if (secrets_spellID) then
+				local name, _, texture = GetSpellInfo (secrets_spellID)
+				texture = "Interface\\Icons\\" .. secrets_icons [prof]
+				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:SetAttribute ("macrotext", "/cast " .. name .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
+					
+					item_button.itemtable = {false, false, false, GetSpellLink (secrets_spellID), false, true}
+					
+					local start, duration = GetSpellCooldown (secrets_spellID)
+					if (start and start > 0) then
+						item_button.cooldown:SetCooldown (start, duration)
+					else
+						item_button.item_count:SetText (1)
+					end
+					
+					if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
+						HotCornersStartAnimOnShow (item_button, "item_topleft")
+					end
+				end
+				index = index + 1
+			end
+		end
+		
+		if (prof2) then
+			local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier, specializationIndex, specializationOffset = GetProfessionInfo (prof2)
+			local prof = get_profession (icon)
+			local secrets_spellID = secrets_index [prof]
+			if (secrets_spellID) then
+				local name, _, texture = GetSpellInfo (secrets_spellID)
+				texture = "Interface\\Icons\\" .. secrets_icons [prof]
+				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:SetAttribute ("macrotext", "/cast " .. name .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
+					
+					item_button.itemtable = {false, false, false, GetSpellLink (secrets_spellID), false, true}
+					
+					local start, duration = GetSpellCooldown (secrets_spellID)
+					if (start and start > 0) then
+						item_button.cooldown:SetCooldown (start, duration)
+					else
+						item_button.item_count:SetText (1)
+					end
+					
+					if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
+						HotCornersStartAnimOnShow (item_button, "item_topleft")
+					end
+				end
+				index = index + 1
+			end
+		end
+		
+	end
 		
 	function LibHotCorners:GetItemButton (index, parent)
 		local button = LibHotCorners.ItemButtons [index]
--- a/HotCorners.xml	Tue Feb 24 14:56:04 2015 -0300
+++ b/HotCorners.xml	Mon Apr 27 12:34:29 2015 -0300
@@ -249,6 +249,15 @@
 			</Layer>
 		</Layers>
 		
+		<Frames>
+			<Cooldown parentKey="cooldown" inherits="CooldownFrameTemplate">
+				<Size x="32" y="32"/>
+				<Anchors>
+					<Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER"/>
+				</Anchors>
+			</Cooldown>
+		</Frames>
+		
 		<Animations>
 			<AnimationGroup name="$parentOnShow" parentKey="AnimOnShow" looping="NONE">
 				<!-- hide -->