comparison HotCorners.lua @ 13:fc72b86a3b66 v13-release

- added hearthstones to item list. - if the item count <= 1, hide the amount text.
author Tercio
date Tue, 07 Mar 2017 14:06:24 -0300
parents 6c1cc07c389d
children
comparison
equal deleted inserted replaced
12:6c1cc07c389d 13:fc72b86a3b66
334 return t1[1] > t2[1] 334 return t1[1] > t2[1]
335 end 335 end
336 336
337 LibHotCorners.BackPackItemList = { 337 LibHotCorners.BackPackItemList = {
338 338
339 --> hearthstones
340 [140192] = true, -- Dalaran Hearthstone
341 --[110560] = true, -- Garrison Hearthstone
342 [6948] = true, -- Innkeeper Hearthstone
343
344 --> good items
345
346
339 --> alchemy 347 --> alchemy
340 348
341 --MOP 349 --MOP
342 [76086] = true, -- Flask of Falling Leaves 350 [76086] = true, -- Flask of Falling Leaves
343 [76084] = true, -- Flask of Spring Blossoms 351 [76084] = true, -- Flask of Spring Blossoms
483 [101662] = true, -- Pandaren Treasure Noodle Cart Kit 491 [101662] = true, -- Pandaren Treasure Noodle Cart Kit
484 492
485 [101618] = true, -- Pandaren Treasure Noodle Soup 493 [101618] = true, -- Pandaren Treasure Noodle Soup
486 [101617] = true, -- Deluxe Noodle Soup 494 [101617] = true, -- Deluxe Noodle Soup
487 [101616] = true, -- Noodle Soup 495 [101616] = true, -- Noodle Soup
488 496
489
490 --LEGION 497 --LEGION
491 [188028] = true, --Potion of the Old War 498 [188028] = true, --Potion of the Old War
492 [188027] = true, --Potion of Deadly Grace 499 [188027] = true, --Potion of Deadly Grace
493 [188029] = true, --Unbending Potion 500 [188029] = true, --Unbending Potion
494 [188017] = true, --Ancient Mana Potion 501 [188017] = true, --Ancient Mana Potion
495 [188030] = true, --Leytorrent Potion 502 [188030] = true, --Leytorrent Potion
496 [229206] = true, --Potion of Prolongued Power 503 [229206] = true, --Potion of Prolongued Power
497 504
498
499
500 } 505 }
501 506
502 function HotCornersOnEnter (self) 507 function HotCornersOnEnter (self)
503 508
504 if (not LibHotCorners.db.profile.is_enabled) then 509 if (not LibHotCorners.db.profile.is_enabled) then
524 local clicks = LibHotCorners.db.profile.clicks 529 local clicks = LibHotCorners.db.profile.clicks
525 for index, button_table in ipairs (LibHotCorners [self.position]) do 530 for index, button_table in ipairs (LibHotCorners [self.position]) do
526 tinsert (sort, {clicks [button_table.name] or 0, button_table}) 531 tinsert (sort, {clicks [button_table.name] or 0, button_table})
527 end 532 end
528 table.sort (sort, more_clicked) 533 table.sort (sort, more_clicked)
529 534
530 local last_button 535 local last_button
531 536
532 local disabled = LibHotCorners.db.profile.disabled 537 local disabled = LibHotCorners.db.profile.disabled
533 538
534 for index, button_table in ipairs (sort) do 539 for index, button_table in ipairs (sort) do
622 if (not self) then 627 if (not self) then
623 return LibHotCorners:ScheduleTimer ("RefereshItems", 1, LibHotCornersTopLeft) 628 return LibHotCorners:ScheduleTimer ("RefereshItems", 1, LibHotCornersTopLeft)
624 end 629 end
625 630
626 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then 631 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
632
633 --update the icon
627 for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do 634 for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do
628 itemTable [1] = 0 635 itemTable [1] = 0
629 end 636 end
630 637
631 for bagID = 0, 4 do 638 for bagID = 0, 4 do
647 for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do 654 for itemId, itemTable in pairs (LibHotCorners.ItemOnInventory) do
648 local itemCount, texture, quality, itemLink = unpack (itemTable) 655 local itemCount, texture, quality, itemLink = unpack (itemTable)
649 656
650 local item_button = LibHotCorners:GetItemButton (index, self) 657 local item_button = LibHotCorners:GetItemButton (index, self)
651 if (item_button) then 658 if (item_button) then
659
652 item_button:SetNormalTexture (texture) 660 item_button:SetNormalTexture (texture)
653 item_button:SetHighlightTexture (texture) 661 item_button:SetHighlightTexture (texture)
654 item_button:SetPushedTexture (texture) 662 item_button:SetPushedTexture (texture)
655 663
656 item_button.item_count:SetText (itemCount or 0) 664 itemCount = itemCount or 0
657 item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()") 665 if (itemCount > 1) then
666 item_button.item_count:SetText (itemCount or 0)
667 item_button.bg_item_count:Show()
668 else
669 item_button.item_count:SetText ("")
670 item_button.bg_item_count:Hide()
671 end
672
673 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
674 item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
675 item_button:GetNormalTexture():SetDesaturated (false)
676 --item_button:Enable()
677 else
678 item_button:GetNormalTexture():SetDesaturated (true)
679 --item_button:Disable()
680 end
658 681
659 item_button.itemtable = itemTable 682 item_button.itemtable = itemTable
660 683
661 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then 684 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
662 -- HotCornersStartAnimOnShow (item_button, "item_topleft") 685 -- HotCornersStartAnimOnShow (item_button, "item_topleft")
686 end
687
688 if (not UnitAffectingCombat ("player") and not InCombatLockdown()) then
689 item_button:Show()
663 end 690 end
664 end 691 end
665 index = index + 1 692 index = index + 1
666 end 693 end
667 694
668 LibHotCorners:RefereshProfessions (self, index) 695 LibHotCorners:RefereshProfessions (self, index)
669 696
670 end 697 end
698
671 --/run local itemid=GetContainerItemID (0, 1);print (itemid) 699 --/run local itemid=GetContainerItemID (0, 1);print (itemid)
672 --UseContainerItem(bagID, slot[, onSelf]) 700 --UseContainerItem(bagID, slot[, onSelf])
673 end 701 end
674 702
675 local get_profession = function (icon) 703 local get_profession = function (icon)