mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-24 13:00:50 +00:00
api: use dynamic shortcut for string.gfind
This commit is contained in:
@@ -883,3 +883,6 @@ function pfUI.api.GetColorGradient(perc)
|
|||||||
gradientcolors[perc].b,
|
gradientcolors[perc].b,
|
||||||
gradientcolors[perc].h
|
gradientcolors[perc].h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- [ shortcuts ]
|
||||||
|
pfUI.api.gfind = string.gfind
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ setfenv(1, pfUI:GetEnvironment())
|
|||||||
-- the "MiniMapTrackingFrame" is called "MiniMapTracking"
|
-- the "MiniMapTrackingFrame" is called "MiniMapTracking"
|
||||||
pfUI.api.MiniMapTrackingFrame = _G.MiniMapTracking
|
pfUI.api.MiniMapTrackingFrame = _G.MiniMapTracking
|
||||||
|
|
||||||
|
-- gfind got replaced by gmatch
|
||||||
|
pfUI.api.gfind = string.gmatch
|
||||||
|
|
||||||
-- blacklist pfUI functions
|
-- blacklist pfUI functions
|
||||||
pfUI.api.hooksecurefunc = nil
|
pfUI.api.hooksecurefunc = nil
|
||||||
pfUI.api.select = nil
|
pfUI.api.select = nil
|
||||||
|
|||||||
+10
-10
@@ -192,61 +192,61 @@ libcast:SetScript("OnEvent", function()
|
|||||||
-- Fill database with environmental casts
|
-- Fill database with environmental casts
|
||||||
elseif arg1 then
|
elseif arg1 then
|
||||||
-- (.+) begins to cast (.+).
|
-- (.+) begins to cast (.+).
|
||||||
for mob, spell in string.gfind(arg1, libcast.SPELL_CAST) do
|
for mob, spell in gfind(arg1, libcast.SPELL_CAST) do
|
||||||
libcast:AddAction(mob, spell)
|
libcast:AddAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (.+) begins to perform (.+).
|
-- (.+) begins to perform (.+).
|
||||||
for mob, spell in string.gfind(arg1, libcast.SPELL_PERFORM) do
|
for mob, spell in gfind(arg1, libcast.SPELL_PERFORM) do
|
||||||
libcast:AddAction(mob, spell)
|
libcast:AddAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (.+) gains (.+).
|
-- (.+) gains (.+).
|
||||||
for mob, spell in string.gfind(arg1, libcast.SPELL_GAINS) do
|
for mob, spell in gfind(arg1, libcast.SPELL_GAINS) do
|
||||||
libcast:RemoveAction(mob, spell)
|
libcast:RemoveAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (.+) is afflicted by (.+).
|
-- (.+) is afflicted by (.+).
|
||||||
for mob, spell in string.gfind(arg1, libcast.SPELL_AFFLICTED) do
|
for mob, spell in gfind(arg1, libcast.SPELL_AFFLICTED) do
|
||||||
libcast:RemoveAction(mob, spell)
|
libcast:RemoveAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Your (.+) hits (.+) for (%d+).
|
-- Your (.+) hits (.+) for (%d+).
|
||||||
for spell, mob in string.gfind(arg1, libcast.SPELL_HIT) do
|
for spell, mob in gfind(arg1, libcast.SPELL_HIT) do
|
||||||
libcast:RemoveAction(mob, spell)
|
libcast:RemoveAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Your (.+) crits (.+) for (%d+).
|
-- Your (.+) crits (.+) for (%d+).
|
||||||
for spell, mob in string.gfind(arg1, libcast.SPELL_CRIT) do
|
for spell, mob in gfind(arg1, libcast.SPELL_CRIT) do
|
||||||
libcast:RemoveAction(mob, spell)
|
libcast:RemoveAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (.+)'s (.+) %a hits (.+) for (%d+).
|
-- (.+)'s (.+) %a hits (.+) for (%d+).
|
||||||
for _, spell, mob in string.gfind(arg1, libcast.OTHER_SPELL_HIT) do
|
for _, spell, mob in gfind(arg1, libcast.OTHER_SPELL_HIT) do
|
||||||
libcast:RemoveAction(mob, spell)
|
libcast:RemoveAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (.+)'s (.+) %a crits (.+) for (%d+).
|
-- (.+)'s (.+) %a crits (.+) for (%d+).
|
||||||
for _, spell, mob in string.gfind(arg1, libcast.OTHER_SPELL_CRIT) do
|
for _, spell, mob in gfind(arg1, libcast.OTHER_SPELL_CRIT) do
|
||||||
libcast:RemoveAction(mob, spell)
|
libcast:RemoveAction(mob, spell)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- You interrupt (.+)'s (.+).";
|
-- You interrupt (.+)'s (.+).";
|
||||||
for mob, spell in string.gfind(arg1, libcast.SPELL_INTERRUPT) do
|
for mob, spell in gfind(arg1, libcast.SPELL_INTERRUPT) do
|
||||||
libcast:RemoveAction(mob, "INTERRUPT")
|
libcast:RemoveAction(mob, "INTERRUPT")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- (.+) interrupts (.+)'s (.+).
|
-- (.+) interrupts (.+)'s (.+).
|
||||||
for _, mob, spell in string.gfind(arg1, libcast.OTHER_SPELL_INTERRUPT) do
|
for _, mob, spell in gfind(arg1, libcast.OTHER_SPELL_INTERRUPT) do
|
||||||
libcast:RemoveAction(mob, "INTERRUPT")
|
libcast:RemoveAction(mob, "INTERRUPT")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
+3
-3
@@ -179,7 +179,7 @@ libdebuff.pending = {}
|
|||||||
libdebuff:SetScript("OnEvent", function()
|
libdebuff:SetScript("OnEvent", function()
|
||||||
-- Add Combat Log
|
-- Add Combat Log
|
||||||
if event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE" or event == "CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE" then
|
if event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE" or event == "CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE" then
|
||||||
for unit, effect in string.gfind(arg1, libdebuff.combatlog) do
|
for unit, effect in gfind(arg1, libdebuff.combatlog) do
|
||||||
local unitlevel = UnitName("target") == unit and UnitLevel("target") or 0
|
local unitlevel = UnitName("target") == unit and UnitLevel("target") or 0
|
||||||
|
|
||||||
if not libdebuff.objects[unit] or not libdebuff.objects[unit][unitlevel] or not libdebuff.objects[unit][unitlevel][effect] then
|
if not libdebuff.objects[unit] or not libdebuff.objects[unit][unitlevel] or not libdebuff.objects[unit][unitlevel][effect] then
|
||||||
@@ -203,7 +203,7 @@ libdebuff:SetScript("OnEvent", function()
|
|||||||
elseif event == "CHAT_MSG_SPELL_FAILED_LOCALPLAYER" or event == "CHAT_MSG_SPELL_SELF_DAMAGE" then
|
elseif event == "CHAT_MSG_SPELL_FAILED_LOCALPLAYER" or event == "CHAT_MSG_SPELL_SELF_DAMAGE" then
|
||||||
-- Persist pending Spell
|
-- Persist pending Spell
|
||||||
for _, msg in pairs(libdebuff.pp) do
|
for _, msg in pairs(libdebuff.pp) do
|
||||||
for effect, _ in string.gfind(arg1, msg) do
|
for effect, _ in gfind(arg1, msg) do
|
||||||
libdebuff:PersistPending(effect)
|
libdebuff:PersistPending(effect)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -211,7 +211,7 @@ libdebuff:SetScript("OnEvent", function()
|
|||||||
|
|
||||||
-- Remove pending spell
|
-- Remove pending spell
|
||||||
for _, msg in pairs(libdebuff.rp) do
|
for _, msg in pairs(libdebuff.rp) do
|
||||||
for effect, _ in string.gfind(arg1, msg) do
|
for effect, _ in gfind(arg1, msg) do
|
||||||
libdebuff:RemovePending(effect)
|
libdebuff:RemovePending(effect)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ pfUI:RegisterModule("autoshift", function ()
|
|||||||
pfUI.autoshift.scanString = string.gsub(SPELL_FAILED_ONLY_SHAPESHIFT, "%%s", "(.+)")
|
pfUI.autoshift.scanString = string.gsub(SPELL_FAILED_ONLY_SHAPESHIFT, "%%s", "(.+)")
|
||||||
|
|
||||||
function pfUI.autoshift:SwitchStance()
|
function pfUI.autoshift:SwitchStance()
|
||||||
for stance in string.gfind(pfUI.autoshift.lastError, pfUI.autoshift.scanString) do
|
for stance in gfind(pfUI.autoshift.lastError, pfUI.autoshift.scanString) do
|
||||||
for _, stance in pairs({ strsplit(",", stance)}) do
|
for _, stance in pairs({ strsplit(",", stance)}) do
|
||||||
pfUI.autoshift.CastSpellByName(string.gsub(stance,"^%s*(.-)%s*$", "%1"))
|
pfUI.autoshift.CastSpellByName(string.gsub(stance,"^%s*(.-)%s*$", "%1"))
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -858,7 +858,7 @@ pfUI:RegisterModule("chat", function ()
|
|||||||
-- display class colors if already indexed
|
-- display class colors if already indexed
|
||||||
if C.chat.text.classcolor == "1" then
|
if C.chat.text.classcolor == "1" then
|
||||||
|
|
||||||
for name in string.gfind(text, "|Hplayer:(.-)|h") do
|
for name in gfind(text, "|Hplayer:(.-)|h") do
|
||||||
local color = unknowncolorhex
|
local color = unknowncolorhex
|
||||||
local match = false
|
local match = false
|
||||||
-- search player in database
|
-- search player in database
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pfUI:RegisterModule("pixelperfect", function ()
|
|||||||
-- apply pixel dependent scaling
|
-- apply pixel dependent scaling
|
||||||
local resolution = GetCVar("gxResolution")
|
local resolution = GetCVar("gxResolution")
|
||||||
|
|
||||||
for screenwidth, screenheight in string.gfind(resolution, "(.+)x(.+)") do
|
for screenwidth, screenheight in gfind(resolution, "(.+)x(.+)") do
|
||||||
local screenheight = tonumber(screenheight) / 8
|
local screenheight = tonumber(screenheight) / 8
|
||||||
local scale = 768 / ( screenheight * conf )
|
local scale = 768 / ( screenheight * conf )
|
||||||
|
|
||||||
|
|||||||
@@ -278,25 +278,25 @@ pfUI:RegisterModule("prediction", function ()
|
|||||||
pfUI.prediction.sender:SetScript("OnEvent", function()
|
pfUI.prediction.sender:SetScript("OnEvent", function()
|
||||||
if event == "CHAT_MSG_SPELL_SELF_BUFF" then
|
if event == "CHAT_MSG_SPELL_SELF_BUFF" then
|
||||||
-- "Your %s heals %s for %d.";
|
-- "Your %s heals %s for %d.";
|
||||||
for spell, _, heal in string.gfind(arg1, healedselfother) do
|
for spell, _, heal in gfind(arg1, healedselfother) do
|
||||||
if spell == spell_queue[1] then cache[spell_queue[2]] = tonumber(heal) end
|
if spell == spell_queue[1] then cache[spell_queue[2]] = tonumber(heal) end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- "Your %s heals you for %d."
|
-- "Your %s heals you for %d."
|
||||||
for spell, heal in string.gfind(arg1, healedselfself) do
|
for spell, heal in gfind(arg1, healedselfself) do
|
||||||
if spell == spell_queue[1] then cache[spell_queue[2]] = tonumber(heal) end
|
if spell == spell_queue[1] then cache[spell_queue[2]] = tonumber(heal) end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- "Your %s critically heals %s for %d."
|
-- "Your %s critically heals %s for %d."
|
||||||
for spell, heal in string.gfind(arg1, healedcritselfother) do
|
for spell, heal in gfind(arg1, healedcritselfother) do
|
||||||
if spell == spell_queue[1] and not cache[spell_queue[2]] then cache[spell_queue[2]] = tonumber(heal)*2/3 end
|
if spell == spell_queue[1] and not cache[spell_queue[2]] then cache[spell_queue[2]] = tonumber(heal)*2/3 end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- "Your %s critically heals you for %d."
|
-- "Your %s critically heals you for %d."
|
||||||
for spell, _, heal in string.gfind(arg1, healedcritselfself) do
|
for spell, _, heal in gfind(arg1, healedcritselfself) do
|
||||||
if spell == spell_queue[1] and not cache[spell_queue[2]] then cache[spell_queue[2]] = tonumber(heal)*2/3 end
|
if spell == spell_queue[1] and not cache[spell_queue[2]] then cache[spell_queue[2]] = tonumber(heal)*2/3 end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user