comparison HotCorners.lua @ 7:d8a463c5ef5a

- Updates to support WoD.
author Tercio
date Mon, 27 Apr 2015 12:34:29 -0300
parents be6f5d3e0a95
children 371e14cd2feb
comparison
equal deleted inserted replaced
6:50b60140e5d8 7:d8a463c5ef5a
17 }, 17 },
18 } 18 }
19 19
20 LibHotCorners.RegistredQuickFunctions = {} 20 LibHotCorners.RegistredQuickFunctions = {}
21 LibHotCorners.QuickFunctions = {topleft = false} 21 LibHotCorners.QuickFunctions = {topleft = false}
22
23 LibHotCorners.LastItemButtonClick = GetTime()
22 24
23 function LibHotCorners:OnEnable() 25 function LibHotCorners:OnEnable()
24 26
25 end 27 end
26 28
333 end 335 end
334 336
335 LibHotCorners.BackPackItemList = { 337 LibHotCorners.BackPackItemList = {
336 338
337 --> alchemy 339 --> alchemy
340
341 --MOP
338 [76086] = true, -- Flask of Falling Leaves 342 [76086] = true, -- Flask of Falling Leaves
339 [76084] = true, -- Flask of Spring Blossoms 343 [76084] = true, -- Flask of Spring Blossoms
340 [76085] = true, -- Flask of the Warm Sun 344 [76085] = true, -- Flask of the Warm Sun
341 [76087] = true, -- Flask of the Earth 345 [76087] = true, -- Flask of the Earth
342 [76088] = true, -- Flask of Winter's Bite 346 [76088] = true, -- Flask of Winter's Bite
359 [76093] = true, -- Potion of the Jade Serpent 363 [76093] = true, -- Potion of the Jade Serpent
360 [76095] = true, -- Potion of Mogu Power 364 [76095] = true, -- Potion of Mogu Power
361 [76090] = true, -- Potion of the Mountains 365 [76090] = true, -- Potion of the Mountains
362 [76091] = true, -- Greater Potion of Luck 366 [76091] = true, -- Greater Potion of Luck
363 [76089] = true, -- Virmen's Bite 367 [76089] = true, -- Virmen's Bite
364 368
369 --WOD
370 [118704] = true, --Pure Rage Potion
371 [109156] = true, --Greater Draenic Strength Flask
372 [109160] = true, --Greater Draenic Stamina Flask
373 [109155] = true, --Greater Draenic Intellect Flask
374 [109153] = true, --Greater Draenic Agility Flask
375 [118711] = true, --Draenic Water Walking Elixir
376 [116271] = true, --Draenic Water Breathing Elixir
377 [116266] = true, --Draenic Swiftness Potion
378 [109219] = true, --Draenic Strength Potion
379 [109148] = true, --Draenic Strength Flask
380 [109152] = true, --Draenic Stamina Flask
381 [109226] = true, --Draenic Rejuvenation Potion
382 [109222] = true, --Draenic Mana Potion
383 [116276] = true, --Draenic Living Action Potion
384 [116268] = true, --Draenic Invisibility Potion
385 [109218] = true, --Draenic Intellect Potion
386 [109147] = true, --Draenic Intellect Flask
387 [109221] = true, --Draenic Channeled Mana Potion
388 [109220] = true, --Draenic Armor Potion
389 [109217] = true, --Draenic Agility Potion
390 [109145] = true, --Draenic Agility Flask
391 [112090] = true, --Transmorphic Tincture
392
365 --> cooking 393 --> cooking
366 394 --WOD
367 --Way of the Grill: Strength 395 [111449] = true, --Blackrock Barbecue
396 [111433] = true, --Blackrock Ham
397 [111436] = true, --Braised Riverbeast
398 [122348] = true, --Buttered Sturgeon
399 [111453] = true, --Calamari Crepes
400 [111438] = true, --Clefthoof Sausages
401 [126935] = true, --Fancy Darkmoon Feast
402 [111444] = true, --Fat Sleeper Cakes
403 [111457] = true, --Feast of Blood
404 [111458] = true, --Feast of the Waters
405 [111445] = true, --Fiery Calamari
406 [111450] = true, --Frosty Stew
407 [111454] = true, --Gorgrond Chowder
408 [111441] = true, --Grilled Gulper
409 [111456] = true, --Grilled Saberfish
410 [111431] = true, --Hearty Elekk Steak
411 [122346] = true, --Jumbo Sea Dog
412 [126934] = true, --Lemon Herb Filet
413 [111434] = true, --Pan-Seared Talbuk
414 [122345] = true, --Pickled Eel
415 [111437] = true, --Rylak Crepes
416 [111455] = true, --Saberfish Broth
417 [122344] = true, --Salty Squid Roll
418 [111446] = true, --Skulker Chowder
419 [111452] = true, --Sleeper Surprise
420 [122343] = true, --Sleeper Sushi
421 [111439] = true, --Steamed Scorpion
422 [111442] = true, --Sturgeon Stew
423 [126936] = true, --Sugar-Crusted Fish Feast
424 [111447] = true, --Talador Surf and Turf
425 [122347] = true, --Whiptail Fillet
426 --[] = true, --
427 --MOP
428 --Way of the Grill: Strength
368 [74642] = true, -- Charbroiled Tiger Steak 429 [74642] = true, -- Charbroiled Tiger Steak
369 [74645] = true, -- Eternal Blossom Fish 430 [74645] = true, -- Eternal Blossom Fish
370 [74646] = true, -- Black Pepper Ribs and Shrimp 431 [74646] = true, -- Black Pepper Ribs and Shrimp
371 432
372 --Way of the Oven: Stamina 433 --Way of the Oven: Stamina
534 595
535 end 596 end
536 597
537 function LibHotCorners:RefereshItems (self) 598 function LibHotCorners:RefereshItems (self)
538 599
600 if (HotCornersItemUsed and LibHotCorners.LastItemButtonClick < GetTime() and not self) then
601 for _, button in pairs (LibHotCorners.ItemButtons) do
602 if (not button.itemtable[6]) then --> isn't a profession cooldown
603 button.cooldown:SetCooldown (GetTime(), 1.5)
604 end
605 end
606 HotCornersItemUsed = nil
607 LibHotCorners.LastItemButtonClick = GetTime()+1.5
608 end
609
539 if (not self) then 610 if (not self) then
540 return LibHotCorners:ScheduleTimer ("RefereshItems", 1, LibHotCornersTopLeft) 611 return LibHotCorners:ScheduleTimer ("RefereshItems", 1, LibHotCornersTopLeft)
541 end 612 end
542 613
543 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then 614 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
569 item_button:SetNormalTexture (texture) 640 item_button:SetNormalTexture (texture)
570 item_button:SetHighlightTexture (texture) 641 item_button:SetHighlightTexture (texture)
571 item_button:SetPushedTexture (texture) 642 item_button:SetPushedTexture (texture)
572 643
573 item_button.item_count:SetText (itemCount or 0) 644 item_button.item_count:SetText (itemCount or 0)
574 item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCorners:RefereshItems()") 645 item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
575 646
576 item_button.itemtable = itemTable 647 item_button.itemtable = itemTable
577 648
578 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then 649 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
579 HotCornersStartAnimOnShow (item_button, "item_topleft") 650 HotCornersStartAnimOnShow (item_button, "item_topleft")
580 end 651 end
581 end 652 end
582 index = index + 1 653 index = index + 1
583 end 654 end
584 655
585 end 656 LibHotCorners:RefereshProfessions (self, index)
586 657
658 end
587 --/run local itemid=GetContainerItemID (0, 1);print (itemid) 659 --/run local itemid=GetContainerItemID (0, 1);print (itemid)
588 --UseContainerItem(bagID, slot[, onSelf]) 660 --UseContainerItem(bagID, slot[, onSelf])
589 end 661 end
662
663 local get_profession = function (icon)
664 if (icon:find ("Trade_Engineering")) then
665 return "en"
666 elseif (icon:find ("Trade_LeatherWorking")) then
667 return "lw"
668 elseif (icon:find ("Trade_Tailoring")) then
669 return "tl"
670 elseif (icon:find ("Trade_Engraving")) then
671 return "ec"
672 elseif (icon:find ("Trade_BlackSmithing")) then
673 return "bs"
674 elseif (icon:find ("Trade_Alchemy")) then
675 return "al"
676 elseif (icon:find ("INV_Misc_Gem_01")) then
677 return "jc"
678 elseif (icon:find ("INV_Inscription_Tradeskill01")) then
679 return "in"
680 end
681 end
682 local secrets_index = {
683 ["tl"] = 176058, --tailoring
684 ["ec"] = 177043, --enchanting
685 ["lw"] = 176089, --letherwork
686 ["en"] = 177054, --engeener
687 ["bs"] = 176090, --blacksmith
688 ["al"] = 175880, --alchemy
689 ["jc"] = 176087, --jewelcraft
690 ["in"] = 177045, --inscription
691 }
692 local secrets_icons = {
693 ["tl"] = "inv_misc_book_03", --tailoring
694 ["ec"] = "inv_misc_book_08", --enchant
695 ["al"] = "inv_misc_book_08", -- alchemy
696 ["bs"] = "inv_misc_book_11", --bs
697 ["en"] = "inv_misc_book_08", --engeener
698 ["in"] = "inv_misc_book_08", --inscritp
699 ["jc"] = "inv_misc_book_10", --jc
700 ["lw"] = "inv_misc_book_09", --lw
701 }
702
703 function LibHotCorners:RefereshProfessions (self, index)
704
705 index = index + 1
706
707 local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions()
708
709 if (prof1) then
710 local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier, specializationIndex, specializationOffset = GetProfessionInfo (prof1)
711 local prof = get_profession (icon)
712 local secrets_spellID = secrets_index [prof]
713 if (secrets_spellID) then
714 local name, _, texture = GetSpellInfo (secrets_spellID)
715 texture = "Interface\\Icons\\" .. secrets_icons [prof]
716 local item_button = LibHotCorners:GetItemButton (index, self)
717 if (item_button) then
718 item_button:SetNormalTexture (texture)
719 item_button:SetHighlightTexture (texture)
720 item_button:SetPushedTexture (texture)
721
722 item_button:SetAttribute ("macrotext", "/cast " .. name .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
723
724 item_button.itemtable = {false, false, false, GetSpellLink (secrets_spellID), false, true}
725
726 local start, duration = GetSpellCooldown (secrets_spellID)
727 if (start and start > 0) then
728 item_button.cooldown:SetCooldown (start, duration)
729 else
730 item_button.item_count:SetText (1)
731 end
732
733 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
734 HotCornersStartAnimOnShow (item_button, "item_topleft")
735 end
736 end
737 index = index + 1
738 end
739 end
740
741 if (prof2) then
742 local name, icon, skillLevel, maxSkillLevel, numAbilities, spelloffset, skillLine, skillModifier, specializationIndex, specializationOffset = GetProfessionInfo (prof2)
743 local prof = get_profession (icon)
744 local secrets_spellID = secrets_index [prof]
745 if (secrets_spellID) then
746 local name, _, texture = GetSpellInfo (secrets_spellID)
747 texture = "Interface\\Icons\\" .. secrets_icons [prof]
748 local item_button = LibHotCorners:GetItemButton (index, self)
749 if (item_button) then
750 item_button:SetNormalTexture (texture)
751 item_button:SetHighlightTexture (texture)
752 item_button:SetPushedTexture (texture)
753
754 item_button:SetAttribute ("macrotext", "/cast " .. name .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
755
756 item_button.itemtable = {false, false, false, GetSpellLink (secrets_spellID), false, true}
757
758 local start, duration = GetSpellCooldown (secrets_spellID)
759 if (start and start > 0) then
760 item_button.cooldown:SetCooldown (start, duration)
761 else
762 item_button.item_count:SetText (1)
763 end
764
765 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
766 HotCornersStartAnimOnShow (item_button, "item_topleft")
767 end
768 end
769 index = index + 1
770 end
771 end
772
773 end
590 774
591 function LibHotCorners:GetItemButton (index, parent) 775 function LibHotCorners:GetItemButton (index, parent)
592 local button = LibHotCorners.ItemButtons [index] 776 local button = LibHotCorners.ItemButtons [index]
593 if (not button) then 777 if (not button) then
594 button = CreateFrame ("button", "HotCornersItemButton" .. index, parent.item_frame, "HotCornersUseItemButtonTemplate") 778 button = CreateFrame ("button", "HotCornersItemButton" .. index, parent.item_frame, "HotCornersUseItemButtonTemplate")