Skip to content

Commit

Permalink
Refactor MobResist.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
leenux authored Aug 2, 2023
1 parent 28e62c3 commit f04af9f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions MobResist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ function Update()
MobResistDisplay:Show();
--NameText:SetText(GetTargetName());

local L,H=UnitDamage("target");
local S=UnitAttackSpeed("target");

--ArmorText:SetText(GetArmor());
ArmorText:SetText(GetArmor()..string.format(" [%.0f - %.0f]",L,H)..string.format(" [%.2f]",S));
ArmorText:SetText(GetArmorAndDmg());
ArmorText:SetTextColor(0.5, 0.5, 0.5);
HolyText:SetText(GetHoly());
HolyText:SetTextColor(1, 1, 0);
Expand Down Expand Up @@ -136,12 +132,15 @@ function GetTargetName()
return UnitName(MR_Target);
end

function GetArmor()
function GetArmorAndDmg()
if TargetCheck("target") ~= true then
return "";
end

return UnitResistance(MR_Target, 0);

local L,H=UnitDamage("target");
local S=UnitAttackSpeed("target");

return UnitResistance(MR_Target, 0)..string.format(" [%.0f - %.0f]",L,H)..string.format(" [%.2f]",S);
end

function GetHoly()
Expand Down Expand Up @@ -197,7 +196,7 @@ function Report(channel)
return;
end

local message = "("..GetTargetName().."): "..GetArmor().."arm, "..GetHoly().."hol, "..GetFire().."fir, "..GetNature().."nat, "..GetFrost().."fro, "..GetShadow().."sha, "..GetArcane().."arc.";
local message = "("..GetTargetName().."): "..GetArmor().."arm and dmg, "..GetHoly().."hol, "..GetFire().."fir, "..GetNature().."nat, "..GetFrost().."fro, "..GetShadow().."sha, "..GetArcane().."arc.";

if channel == "s" or channel == "S" or channel == "say" then
SendChatMessage(message, "SAY", GetDefaultLanguage("player"));
Expand All @@ -212,4 +211,4 @@ function Report(channel)
elseif channel == "g" or channel == "G" or channel == "guild" then
SendChatMessage(message, "GUILD", GetDefaultLanguage("player"));
end
end
end

0 comments on commit f04af9f

Please sign in to comment.