Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added hit, expertise, spell pen, armor pen and attack power to character stats #122

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 116 additions & 12 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1305,8 +1305,8 @@ Private.event_prototypes = {
display = L["Npc ID"],
type = "string",
store = true,
conditionType = "string",
test = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '') == %q",
conditionType = "init",
init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')",
},
{
name = "attackable",
Expand Down Expand Up @@ -1587,8 +1587,8 @@ Private.event_prototypes = {
display = L["Npc ID"],
type = "string",
store = true,
conditionType = "string",
test = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '') == %q",
conditionType = "init",
init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')",
},
{
name = "class",
Expand Down Expand Up @@ -1848,8 +1848,8 @@ Private.event_prototypes = {
display = L["Npc ID"],
type = "string",
store = true,
conditionType = "string",
test = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '') == %q",
conditionType = "init",
init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')",
},
{
name = "class",
Expand Down Expand Up @@ -1976,7 +1976,7 @@ Private.event_prototypes = {
name = "sourceNpcId",
display = L["Source NPC Id"],
type = "string",
test = "tostring(tonumber(string.sub(sourceGUID or '', 8, 12), 16) or '') == %q",
init = "tostring(tonumber(string.sub(sourceGUID or '', 8, 12), 16) or '')",
enable = function(trigger)
return not (trigger.subeventPrefix == "ENVIRONMENTAL")
end,
Expand Down Expand Up @@ -2054,7 +2054,7 @@ Private.event_prototypes = {
name = "destNpcId",
display = L["Destination NPC Id"],
type = "string",
test = "tostring(tonumber(string.sub(destGUID or '', 8, 12), 16) or '') == %q",
init = "tostring(tonumber(string.sub(destGUID or '', 8, 12), 16) or '')",
enable = function(trigger)
return not (trigger.subeventPrefix == "SPELL" and trigger.subeventSuffix == "_CAST_START");
end,
Expand Down Expand Up @@ -5335,10 +5335,10 @@ Private.event_prototypes = {
{
name = "npcId",
display = L["Npc ID"],
type = "string",
type = "init",
store = true,
conditionType = "string",
test = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '') == %q",
conditionType = "init",
init = "tostring(tonumber(string.sub(UnitGUID(unit) or '', 8, 12), 16) or '')",
enable = function(trigger)
return not trigger.use_inverse
end
Expand Down Expand Up @@ -5594,6 +5594,22 @@ Private.event_prototypes = {
store = true,
conditionType = "number"
},
{
name = "attackpower",
display = L["Attack Power"],
type = "number",
init = "select(1, UnitAttackPower('player')) + select(2, UnitAttackPower('player'))",
store = true,
conditionType = "number"
},
{
name = "rangedattackpower",
display = L["Ranged Attack Power"],
type = "number",
init = "select(1, UnitRangedAttackPower('player')) + select(2, UnitRangedAttackPower('player'))",
store = true,
conditionType = "number"
},
{
name = "meleecriticalrating",
display = L["Melee Critical Rating"],
Expand All @@ -5620,7 +5636,7 @@ Private.event_prototypes = {
},
{
name = "meleecriticalpercent",
display = L["Mele Critical (%)"],
display = L["Melee Critical (%)"],
type = "number",
init = "GetCritChance()",
store = true,
Expand Down Expand Up @@ -5665,6 +5681,94 @@ Private.event_prototypes = {
init = "GetCombatRating(CR_HASTE_SPELL)",
store = true,
conditionType = "number"
},
{
name = "meleehitrating",
display = L["Melee Hit Rating"],
type = "number",
init = "GetCombatRating(CR_HIT_MELEE)",
store = true,
conditionType = "number"
},
{
name = "meleehitpercent",
display = L["Melee Hit Percent (%)"],
type = "number",
init = "GetCombatRatingBonus(CR_HIT_MELEE)",
store = true,
conditionType = "number"
},
{
name = "rangedhitrating",
display = L["Ranged Hit Rating"],
type = "number",
init = "GetCombatRating(CR_HIT_RANGED)",
store = true,
conditionType = "number"
},
{
name = "rangedhitpercent",
display = L["Ranged Hit Percent (%)"],
type = "number",
init = "GetCombatRatingBonus(CR_HIT_RANGED)",
store = true,
conditionType = "number"
},
{
name = "spellhitrating",
display = L["Spell Hit Rating"],
type = "number",
init = "GetCombatRating(CR_HIT_SPELL)",
store = true,
conditionType = "number"
},
{
name = "spellhitpercent",
display = L["Spell Hit Percent (%)"],
type = "number",
init = "GetCombatRatingBonus(CR_HIT_SPELL)",
store = true,
conditionType = "number"
},
{
name = "expertiserating",
display = L["Expertise Rating"],
type = "number",
init = "GetCombatRating(CR_EXPERTISE)",
store = true,
conditionType = "number"
},
{
name = "expertisebonus",
display = L["Expertise Bonus"],
type = "number",
init = "GetCombatRatingBonus(CR_EXPERTISE)",
store = true,
conditionType = "number"
},
{
name = "spellpenrating",
display = L["Spell Penetration Rating"],
type = "number",
init = "GetSpellPenetration()",
store = true,
conditionType = "number"
},
{
name = "armorpenrating",
display = L["Armor Penetration Rating"],
type = "number",
init = "GetCombatRating(CR_ARMOR_PENETRATION)",
store = true,
conditionType = "number"
},
{
name = "armorpenpercent",
display = L["Armor Penetration Percent (%)"],
type = "number",
init = "GetCombatRatingBonus(CR_ARMOR_PENETRATION)",
store = true,
conditionType = "number"
},
{
name = "resistancefire",
Expand Down
99 changes: 48 additions & 51 deletions WeakAurasOptions/OptionsFrames/IconPicker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,69 +31,66 @@ local function ConstructIconPicker(frame)
group:AddChild(scroll);

local function iconPickerFill(subname, doSort)
scroll:ReleaseChildren();
scroll:ReleaseChildren();

local usedIcons = {};
local AddButton = function(name, icon)
local button = AceGUI:Create("WeakAurasIconButton");
button:SetName(name);
button:SetTexture(icon);
button:SetClick(function()
group:Pick(icon);
end);
scroll:AddChild(button);

usedIcons[icon] = true;
end

local num = 0;
if subname and subname ~= "" then
subname = subname:lower();

local distances = {};
local names = {};
for name, icons in pairs(spellCache.Get()) do
local nameMatches = name:lower():find(subname, 1, true);

-- Work around special numbers such as inf and nan
if (tonumber(subname)) then
local spellId = tonumber(subname);
if (abs(spellId) < math.huge and tostring(spellId) ~= "nan") then
subname = GetSpellInfo(spellId or 0)

local allIcons = {};
if icons.spells then
for spellId, icon in pairs(icons.spells) do
table.insert(allIcons, { spellId = spellId, icon = icon });
end
end
if icons.achievements then
for _, icon in pairs(icons.achievements) do
table.insert(allIcons, { spellId = nil, icon = icon });
end
end
end

if subname then
subname = subname:lower();
end
for _, data in ipairs(allIcons) do
local icon = data.icon;
local spellId = data.spellId;

local usedIcons = {};
local AddButton = function(name, icon)
local button = AceGUI:Create("WeakAurasIconButton");
button:SetName(name);
button:SetTexture(icon);
button:SetClick(function()
group:Pick(icon);
end);
scroll:AddChild(button);

usedIcons[icon] = true;
end
local iconMatches = icon:lower():find(subname, 1, true);

if (nameMatches or iconMatches) and not usedIcons[icon] then
local displayName = iconMatches and icon or name;
AddButton(displayName, icon);
num = num + 1;

local num = 0;
if(subname and subname ~= "") then
for name, icons in pairs(spellCache.Get()) do
if(name:lower():find(subname, 1, true)) then
if icons.spells then
for spellId, icon in pairs(icons.spells) do
if (not usedIcons[icon]) then
AddButton(name, icon)
num = num + 1;
if(num >= 500) then
break;
end
end
end
elseif icons.achievements then
for _, icon in pairs(icons.achievements) do
if (not usedIcons[icon]) then
AddButton(name, icon)
num = num + 1;
if(num >= 500) then
break;
end
end
end
if num >= 500 then
break;
end
end
end

if(num >= 500) then
break;
end
if num >= 500 then
break;
end
end
end
end



local input = CreateFrame("EDITBOX", "WeakAurasIconFilterInput", group.frame, "InputBoxTemplate");
input:SetScript("OnTextChanged", function(...) iconPickerFill(input:GetText(), false); end);
Expand Down