1
0
Bifurcation 0
Ce dépôt a été archivé le 2024-10-10. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
ButtonForge-classic/CursorUtil.lua1

77 lignes
1,8 Kio
Text

--[[
Author: Alternator (Massiner of Nathrezim)
Copyright: 2012
]]
--local AddonName, AddonTable = ...;
local CursorUtil = BFCursorUtil;
local UILib = BFUILib;
local Util = BFUtil;
local PetActionIndex;
function CursorUtil.GetCursorInfo()
local Command, Data, Subvalue, Subsubvalue = GetCursorInfo();
if (Command) then
if (Command == "petaction") then
Data = PetActionIndex;
local Type, Id = GetSpellBookItemInfo(Data, BOOKTYPE_PET);
if (Type == "PETACTION") then
Command = "petcommand";
else
Command = "petability";
end
end
return Command, Data, Subvalue, Subsubvalue;
end
return UILib.GetDragInfo();
end
local CompatibleActions = {
["spell"] = true
, ["item"] = true
, ["macro"] = true
, ["flyout"] = true
, ["petaction"] = true
, ["companion"] = true
, ["battlepet"] = true
, ["equipmentset"] = true};
function CursorUtil.CursorHasAction()
return CompatibleActions[GetCursorInfo()] or CustomCommand ~= nil;
end
local StoredCursor = {};
function CursorUtil.StoreCursor(...)
StoredCursor = {...};
end
function CursorUtil.GetStoredCursor()
return unpack(StoredCursor);
end
local function CapturePickupSpellBookItem(Index, BookType)
PetActionIndex = Index;
end
local function CapturePickupPetAction(Slot)
PetActionIndex = Util.FindPetActionIndexByTexture(Util.GetTrackedPetSlotAction(Slot, true));
print(Slot, PetActionIndex);
end
local function CaptureCastPetAction(Slot)
PetActionIndex = Util.FindPetActionIndexByTexture(Util.GetTrackedPetSlotAction(Slot, false));
end
local function CapturePickupPetSpell(Id)
PetActionIndex = Util.FindPetActionIndexById(Id);
end
hooksecurefunc("PickupSpellBookItem", CapturePickupSpellBookItem);
hooksecurefunc("PickupPetAction", CapturePickupPetAction);
hooksecurefunc("PickupPetSpell", CapturePickupPetSpell);
hooksecurefunc("CastPetAction", CaptureCastPetAction);