发布于 2019-11-07 17:29:28
寄出:“单位”,“目标”,"castGUID",spellID
成功:“目标”,"castGUID",spellID
每个拼写节目都有一个独特的castGUID。它是在您开始使用UNIT_SPELLCAST_SENT进行强制转换时创建的,它出现在cast/通道的末尾或立即出现在UNIT_SPELLCAST_SUCCEEDED中。
因此,每当单元== "https://wow.gamepedia.com/UnitId“时,只需记录castGUID,然后寻找以相同值完成的咒语。所以你才知道那不是别人的咒语。
同时,您可以查找每个拼写对应的spellID。在下面的示例中,我使用了您的帖子中的两个(196670和589)。
local myFrame = CreateFrame("Frame");
local myCurrentCast;
myFrame:RegisterEvent("UNIT_SPELLCAST_SENT");
myFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
myFrame:SetScript("OnEvent",
function(self, event, arg1, arg2, arg3, arg4)
if (event == "UNIT_SPELLCAST_SENT" and arg1 == "player") then
print("I am casting something");
myCurrentCast = arg3;
elseif (event == "UNIT_SPELLCAST_SUCCEEDED" and arg2 == myCurrentCast) then
if (arg3 == 196670) then
print("I just finished casting Chaos Bolt!");
elseif (arg3 == 589) then
print("Look at my instant Shadow Word: Pain. Isn't it cool?");
end
end
end
);
此示例创建一个框架,注册这两个事件,然后创建一个事件处理程序,在您转换这两个示例咒语时打印出花哨的文本。关于事件处理程序的教程,我建议使用事件。
https://stackoverflow.com/questions/58754983
复制