Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
IronSinew committed Apr 19, 2023
0 parents commit f4f8a75
Show file tree
Hide file tree
Showing 22 changed files with 772 additions and 0 deletions.
Empty file added CHANGES.txt
Empty file.
6 changes: 6 additions & 0 deletions CritWow.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Interface: 30401
## Title: CritWow
## Author: IronSinew
## Version: 1.0.0

main.lua
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

Binary file added icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
local playerGUID = UnitGUID("player")
local lastCritTime = time()

local defaults = {
playsSound = true,
debounce = 1,
}

local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", function(self, event, addOnName)
if event == "ADDON_LOADED" and addOnName == "CritWow" then
icrit = icrit or CopyTable(defaults)
self.options = icrit
self:InitializeOptions()
end
self:COMBAT_LOG_EVENT_UNFILTERED(CombatLogGetCurrentEventInfo())
end)

function f:InitializeOptions()
self.panel = CreateFrame("Frame")
self.panel.name = "Crit WOW"

local title = self.panel:CreateFontString("ARTWORK", nil, "GameFontNormalLarge")
title:SetPoint("TOP")
title:SetText("Crit Wow")

local cb = CreateFrame("CheckButton", nil, self.panel, "InterfaceOptionsCheckButtonTemplate")
cb:SetPoint("TOPLEFT", 20, -20)
cb.Text:SetText("Play sounds")
cb:HookScript("OnClick", function(_, btn, down)
self.options.playsSound = cb:GetChecked()
end)
cb:SetChecked(self.options.playsSound)

local debounceSlider = CreateFrame("Slider", "debounceWowSlider", self.panel, "OptionsSliderTemplate")
debounceSlider:SetPoint("TOPLEFT", 20, -70)
debounceSlider:SetMinMaxValues(0,30)
debounceSlider:SetValueStep(2)
debounceSlider:SetObeyStepOnDrag(true)
debounceSlider:SetValue(10)
getglobal(debounceSlider:GetName() .. "Low"):SetText("Unl");
getglobal(debounceSlider:GetName() .. "High"):SetText("Every 3");

local debounceTitle = "Unlimited"
if self.options.debounce > 0 then
debounceTitle = "Once per " .. self.options.debounce .. "s"
end
debounceSlider.Text:SetText("Wows: " .. debounceTitle)
debounceSlider.tooltipText = "Speed of Wows"
debounceSlider:HookScript("OnValueChanged", function(_)
self.options.debounce = _:GetValue()/10

debounceTitle = "Unlimited"
if self.options.debounce > 0 then
debounceTitle = "Once per " .. self.options.debounce .. "s"
end
_.Text:SetText("Wows: " .. debounceTitle)
end)

InterfaceOptions_AddCategory(self.panel)
end

function f:COMBAT_LOG_EVENT_UNFILTERED(...)
local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
local spellId, spellName, spellSchool
local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand

if subevent == "SWING_DAMAGE" then
amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
elseif subevent == "SPELL_DAMAGE" then
spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
elseif subevent == "SPELL_HEAL" then
spellId, spellName, spellSchool, amount, overhealing, absorbed, critical = select(12, ...)
end

if critical and sourceGUID == playerGUID then
local currentTime = time()
if (lastCritTime + self.options.debounce <= currentTime and self.options.playsSound) then
PlaySoundFile("Interface\\AddOns\\WowICrit\\sounds\\"..tostring(math.random(1,17))..".mp3","master")
lastCritTime = currentTime
end
end
end

SLASH_CRITWOW1 = "/critwow"

SlashCmdList.CRITWOW = function(msg, editBox)
InterfaceOptionsFrame_OpenToCategory(f.panel)
InterfaceOptionsFrame_OpenToCategory(f.panel)
end
Binary file added sounds/1.mp3
Binary file not shown.
Binary file added sounds/10.mp3
Binary file not shown.
Binary file added sounds/11.mp3
Binary file not shown.
Binary file added sounds/12.mp3
Binary file not shown.
Binary file added sounds/13.mp3
Binary file not shown.
Binary file added sounds/14.mp3
Binary file not shown.
Binary file added sounds/15.mp3
Binary file not shown.
Binary file added sounds/16.mp3
Binary file not shown.
Binary file added sounds/17.mp3
Binary file not shown.
Binary file added sounds/2.mp3
Binary file not shown.
Binary file added sounds/3.mp3
Binary file not shown.
Binary file added sounds/4.mp3
Binary file not shown.
Binary file added sounds/5.mp3
Binary file not shown.
Binary file added sounds/6.mp3
Binary file not shown.
Binary file added sounds/7.mp3
Binary file not shown.
Binary file added sounds/8.mp3
Binary file not shown.
Binary file added sounds/9.mp3
Binary file not shown.

0 comments on commit f4f8a75

Please sign in to comment.