FightInfo.lua
Code: Select all
local FightInfo = {
name = "FightInfo",
version = "1.0",
author = "blabla",
};
SLASH_FightInfo1 = "/fi";
SlashCmdList["FightInfo"] = function(editBox, msg)
if string.lower(msg) == "attack" then
DEFAULT_CHAT_FRAME:AddMessage(getPlayerAttack())
elseif string.lower(msg) == "damage" then
DEFAULT_CHAT_FRAME:AddMessage(getPlayerDamage())
else
DEFAULT_CHAT_FRAME:AddMessage("Not a viable command")
end
end
function FightInfo.Print()
DEFAULT_CHAT_FRAME:AddMessage("FightInfo Loaded.")
end
frame:RegisterEvent("VARIABLES_LOADED");
frame:RegisterEvent("PLAYER_ENTER_COMBAT");
frame:RegisterEvent("PLAYER_LEAVE_COMBAT");
frame:RegisterEvent("PLAYER_BUFF_CHANGED");
DEFAULT_CHAT_FRAME:AddMessage("Loaded FightInfo v1.0");
Damage = getPlayerDamage()
DefDamage = getPlayerDamage()
Attack = getPlayerAttack()
DefAttack = getPlayerAttack()
function getPlayerDamage()
a, b = GetPlayerAbility("MELEE_MAIN_DAMAGE");
return a + b;
end
function getPlayerAttack()
c, d = GetPlayerAbility("MELEE_ATTACK");
return c + d;
end
function isTargetBoss()
if UnitSex("target") < 2 then
return true;
end
return false;
end
function FightInfo:OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
if(event == "VARIABLES_LOADED") then
self:VARIABLES_LOADED()
end
if(event == "PLAYER_ENTER_COMBAT") then
if isTargetBoss() then
DEFAULT_CHAT_FRAME:AddMessage("Boss Battle initialized...");
printOut = true;
end
end
if(event == "PLAYER_BUFF_CHANGED") then
if getPlayerDamage() > Damage then
Damage = getPlayerDamage()
end
if getPlayerAttack() > Attack then
Attack = getPlayerAttack()
end
end
if(event == "PLAYER_LEAVE_COMBAT") and printOut then
printOut = false;
DEFAULT_CHAT_FRAME:AddMessage("My max attack was "..Attack);
DEFAULT_CHAT_FRAME:AddMessage("My max damage was "..Damage);
end
end
function FightInfo:VARIABLES_LOADED()
self.Print()
end
Code: Select all
<Ui xmlns="http://www.runewaker.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.runewaker.com/UI.xsd">
<Frame name="FightInfo_Frame">
<Scripts>
<OnEvent>
FightInfo:OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
</OnEvent>
</Scripts>
</Frame>
</Ui>
edit: its for printing maximum reached physical damage and physical attack power after boss fight.