Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.95 KB | None | 0 0
  1. local GetActionCountOrig = GetActionCount;
  2. function GetActionCount(button)
  3.     --Check each spell name that requires shards/reagents.
  4.     --Search bags for the right reagent count.
  5.     local s, rank, reagent;
  6.     local actionType, id, subType = GetActionInfo(button);
  7.     if (id ~= nil) then
  8.         s = GetSpellInfo(id);
  9.         rank = GetSpellSubtext(id);
  10.     end
  11.     if (s ~= nil and (s == "Soul Fire" or s == "Summon Voidwalker" or s == "Summon Succubus"
  12.             or s == "Summon Felhunter"  or s == "Ritual of Summoning" or s == "Enslave Demon"
  13.             or s == "Shadowburn"
  14.             or string.match(s, "Create Soulstone") or string.match(s, "Create Healthstone")
  15.             or string.match(s, "Create Spellstone") or string.match(s, "Create Firestone"))) then
  16.         reagent = "Soul Shard";
  17.     elseif (s ~= nil and string.match(s, "Teleport")) then
  18.         reagent = "Rune of Teleportation";
  19.     elseif (s ~= nil and string.match(s, "Portal")) then
  20.         reagent = "Rune of Portals";
  21.     elseif (s ~= nil and s == "Vanish") then
  22.         reagent = "Flash Powder";
  23.     elseif (s ~= nil and s ==  "Blind") then
  24.         reagent = "Blinding Powder";
  25.     elseif (s ~= nil and s == "Reincarnation") then
  26.         reagent = "Ankh";
  27.     elseif (s ~= nil and string.match(s, "Greater Blessing of")) then
  28.         reagent = "Symbol of Kings";
  29.     elseif (s ~= nil and s == "Rebirth") then
  30.         reagent = "Maple Seed";
  31.     elseif (s ~= nil and s == "Inferno") then
  32.         reagent = "Infernal Stone";
  33.     elseif (s ~= nil and s == "Arcane Brilliance") then
  34.         reagent = "Arcane Powder";
  35.     elseif (s ~= nil and s == "Divine Intervention") then
  36.         reagent = "Symbol of Divinity";
  37.     elseif (s ~= nil and s == "Ritual of Doom") then
  38.         reagent = "Demonic Figurine";
  39.     end
  40.     --These spells have diff reagents for diff ranks.
  41.     if (s ~= nil and s == "Prayer of Fortitude") then
  42.         if (rank == "Rank 1") then
  43.             reagent = "Sacred Candle";
  44.         else
  45.             reagent = "Holy Candle";
  46.         end
  47.     elseif (s ~= nil and string.match(s, "Prayer of")) then
  48.         --All other prayers use sacred candle.
  49.         reagent = "Sacred Candle";
  50.     end
  51.     if (s ~= nil and s == "Rebirth") then
  52.         if (rank == "Rank 1") then
  53.             reagent = "Maple Seed";
  54.         elseif (rank == "Rank 2") then
  55.             reagent = "Stranglethorn Seed";
  56.         elseif (rank == "Rank 3") then
  57.             reagent = "Ashwood Seed";
  58.         elseif (rank == "Rank 4") then
  59.             reagent = "Hornbeam Seed";
  60.         else
  61.             reagent = "Ironwood Seed";
  62.         end
  63.     end
  64.     if (s ~= nil and s == "Gift of the Wild") then
  65.         if (rank == "Rank 1") then
  66.             reagent = "Wild Berries";
  67.         else
  68.             reagent = "Wild Thornroot";
  69.         end
  70.     end
  71.     if (reagent ~= nil) then
  72.         local count = 0;
  73.         for bag = 0, NUM_BAG_SLOTS do
  74.             for slot = 1, GetContainerNumSlots(bag) do
  75.                 local _, itemCount, _, _, _, _, itemLink = GetContainerItemInfo(bag, slot)
  76.                 if (itemLink and string.find(itemLink, "%[" .. reagent .. "%]")) then --Brackets to match exact name.
  77.                     count = count + (itemCount or 1);
  78.                 end
  79.             end
  80.         end
  81.         return count;
  82.     end
  83.     --If no reagent type found return the original Blizzard function.
  84.     return GetActionCountOrig(button);
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement