Thread Tools Display Modes
05-14-11, 05:43 AM   #1
ultraw
A Murloc Raider
Join Date: May 2010
Posts: 8
[Request] Any chance this can be updated?

Hi everyone.

I've got an addon that I'd really like to see updated. Unfortunately I don't know how to do so myself, so I'm checking here to see if anyone can take a look at it. I hope it's a small fix, if not I don't expect anyone to put alot of time into it.

Link to the addon:
http://wow.curse.com/downloads/wow-a...ls/crtkng.aspx

Regards,
ultraw.
  Reply With Quote
05-14-11, 07:08 AM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Hope this works

CritKing.lua
Code:
CRITKINGPREFIX = "CK"
CRITKINGVERSION = "0.2"

CritKing = {} -- critking class :)
CritKing.__index = CritKing

CritKingDisplay = "on" -- saved variable, per character
CritKingResetOnNormalHit = "on" -- reset crit statistic when hit normal

CritKing.VariablesLoaded = false

CritKing.PlayerName = ""  -- the player's character name

CritKing.MaxDamage = 0        -- The maximum damage
CritKing.MaxCritNum = 0       -- The maximum crit number
CritKing.Damage = 0           -- The actual damage
CritKing.CritNum = 0          -- The actual critical number
CritKing.KillNum = 0          -- The actual killing blow number
CritKing.MaxKillNum = 0       -- The maximum killing blow number
CritKing.CritMessages =
{
    "Head shot!"        -- 1
  , "Oh, Yeah!"         -- 2
  , "Unstoppable!"      -- 3
  , "Killing Spree!"    -- 4
  , "Dominating!"       -- 5
  , "Ultra Kill!"       -- 6
  , "Wicked Sick!"      -- 7
  , "God Like!"         -- 8
  , "God Like!"         -- 9
  , "Holy ****!"        -- 10
  , "Holy ****!"        -- 11
  , "Holy ****!"        -- 12
  , "Holy ****!"        -- 13
  , "Holy ****!"        -- 14
  , "Monster Kill!"     -- 15
  , "Monster Kill!"     -- 16
  , "Monster Kill!"     -- 17
  , "Monster Kill!"     -- 18
  , "Monster Kill!"     -- 19
  , "Ludicrous Kill!"   -- 20
  , "Ludicrous Kill!"   -- 21
  , "Ownage!"           -- 22
}

CritKing.Critsounds = 
{
    "Interface\\Addons\\CritKing\\sounds\\head_shot.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ohyeah.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\unstoppable.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\killer.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\dominating.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ultrakill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\wickedsick.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\godlike.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\godlike.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\holy****.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\holy****.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\holy****.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\holy****.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\monsterkill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\monsterkill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\monsterkill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\monsterkill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\monsterkill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ludicrouskill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ludicrouskill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ownage.ogg"
}

CritKing.KillingMessages =
{
    "First Blood!"          -- 1
  , "Double Kill!"          -- 2
  , "Tripple Kill!"         -- 3
  , "Multi Kill!"           -- 4
  , "Ultra Kill!"           -- 5
  , "Mega Kill!"            -- 6
  , "Monster Kill!"         -- 7
  , "Ludicrous Kill!"       -- 8
  , "Wicked Sick!"          -- 9
  , "Holy ****!"            -- 10
  , "God Like!"             -- 11
  , "Ownage!"               -- 12
  , "Ownage!"               -- 13
  , "Ownage!"               -- 14
  , "Ownage!"               -- 14
  , "Ownage!"               -- 15
  , "I am INVICIBLE!"       -- 16
  , "I am INVICIBLE!"       -- 17
  , "I am INVICIBLE!"       -- 18
  , "I am INVICIBLE!"       -- 19
  , "YES! I'm a GOD!"       -- 20
}

CritKing.Killingsounds =
{
    "Interface\\Addons\\CritKing\\sounds\\firstblood.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\doublekill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\tripplekill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\multikill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ultrakill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\megakill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\monsterkill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ludicrouskill.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\wickedsick.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\holy****.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\godlike.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ownage.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ownage.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ownage.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\ownage.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\invicible.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\invicible.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\invicible.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\invicible.ogg"
  , "Interface\\Addons\\CritKing\\sounds\\god.ogg"
}

CritKing.MaxCrit = 23
CritKing.MaxKill = 21

-- Simple message function, to the default chat frame
function CritKing.SendMsg( msg )
    DEFAULT_CHAT_FRAME:AddMessage( CRITKINGPREFIX .. ": " .. msg, 1.0, 0.0, 0.0 )
end

-- Command handler
function CritKing.OnCommand( args )

    if ( ( args ~= nil      )
     and ( string.len( args ) > 0 ) )
    then
        if ( string.lower( args ) == "help" )
        then
            CritKing.SendMsg( "/ck display on  - enable error frame messages" )
            CritKing.SendMsg( "/ck display off - disable error frame messages" )
            CritKing.SendMsg( "/ck normal on - reset critical statistic when hit normal and end of fight" )
            CritKing.SendMsg( "/ck normal off - reset critical statistic just when end of fight" )
            CritKing.SendMsg( "/ck help - display this text" )
            CritKing.SendMsg( "/ck - display max damage, critical number, killing blow statistic" )
            return
        end

        if ( string.lower( args ) == "display on" )
        then
            CritKingDisplay = "on"
            CritKing.SendMsg( "set display on" )
            return
        end

        if ( string.lower( args ) == "display off" )
        then
            CritKingDisplay = "off"
            CritKing.SendMsg( "set display off" )
            return
        end

        if ( string.lower( args ) == "normal on" )
        then
            CritKingResetOnNormalHit = "on"
            CritKing.SendMsg( "reset critical statistic when hit normal" )
            return
        end

        if ( string.lower( args ) == "normal off" )
        then
            CritKingResetOnNormalHit = "off"
            CritKing.SendMsg( "no reset critical statistic when hit normal" )
            return
        end
    end     
    -- no parameters given, show the infos
    CritKing.SendMsg( " - Max damage: " .. CritKing.MaxDamage )
    CritKing.SendMsg( " - Max crit num: " .. CritKing.MaxCritNum )
    CritKing.SendMsg( " - Max kill num: " .. CritKing.MaxKillNum )

end

-- Fired when the player hit critical
function CritKing.OnCrit()
    local msg = CritKing.CritMessages[ CritKing.CritNum ]
    local sound = CritKing.Critsounds[ CritKing.CritNum ]
    
    if ( CritKingDisplay == "on" )
    then
        UIErrorsFrame:AddMessage( msg .. " (x" .. CritKing.CritNum .. ") Damage: " .. CritKing.Damage )
    end

    PlaySoundFile( sound )
end

-- Fired when the player kill an enemy
function CritKing.OnKill()
    local msg = CritKing.KillingMessages[ CritKing.KillNum ]
    local sound = CritKing.Killingsounds[ CritKing.KillNum ]
    
    if ( CritKingDisplay == "on" )
    then
        UIErrorsFrame:AddMessage( msg .. " (x" .. CritKing.KillNum .. ")" )
    end
    
    PlaySoundFile( sound )
end

-- Reset critical statistric
function CritKing.ResetCrit()
	CritKing.CritNum = 0
--	CritKing.MaxDamage = 0
--	CritKing.MaxCrit = 0
end

-- Reset killing blow statistic
function CritKing.ResetKill()
	CritKing.KillNum = 0
--	CritKing.MaxKillNum = 0
end

-- Reset all statistic
function CritKing.ResetStat()
    CritKing.ResetCrit()
    CritKing.ResetKill()
end

-- Event handler
function CritKing.OnEvent(self, event, ...)
    if ( event == "VARIABLES_LOADED" ) -- loading saved variables, and player name
    then
        CritKing.VariablesLoaded = true
        CritKing.PlayerName = UnitName( "player" )
		CritKing.SendMsg( "variables loaded! " .. CRITKINGVERSION )
        return
    end

    if ( CritKing.VariablesLoaded == false ) -- no event handling, while saved variables not loaded ...
    then
    	return
    end

	
    if ( event == "COMBAT_LOG_EVENT_UNFILTERED" ) -- new event from combatlog
    then
		local timestamp, eType, _, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags  = ...;
        if ( sourceName == nil )
        then
            sourceName = ""
        end

		if ( sourceName ~= CritKing.PlayerName ) -- if the sender not equal with the player, just return
        then
            return
        end
        
		local fromNum = 10;
		if ( eType == "SPELL_DAMAGE" )
		then
			fromNum = 13;
		end
		
		local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = select(fromNum, ...)

		--[[local v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20 = select( 1, ... )
		CritKing.SendMsg( "v1: " .. tostring( v1 )
					     .. " v2: " .. tostring( v2 )
					     .. " v3: " .. tostring( v3 )
					     .. " v4: " .. tostring( v4 )
					     .. " v5: " .. tostring( v5 )
					     .. " v6: " .. tostring( v6 )
					     .. " v7: " .. tostring( v7 )
					     .. " v8: " .. tostring( v8 )
					     .. " v9: " .. tostring( v9 )
					     .. " v10: " .. tostring( v10 )
					     .. " v11: " .. tostring( v11 )
					     .. " v12: " .. tostring( v12 )
					     .. " v13: " .. tostring( v13 )
					     .. " v14: " .. tostring( v14 )
					     .. " v15: " .. tostring( v15 )
					     .. " v16: " .. tostring( v16 )
					     .. " v17: " .. tostring( v17 )
					     .. " v18: " .. tostring( v18 )
					     .. " v19: " .. tostring( v19 )
					     .. " v20: " .. tostring( v20 ) );
						 ]]--
		
    
        if ( critical == nil )
        then
            critical = false
        end
       
		if ( eType == "PARTY_KILL" )
        then
            CritKing.KillNum = CritKing.KillNum + 1
		    if ( CritKing.MaxKillNum < CritKing.KillNum )
            then
                CritKing.MaxKillNum = CritKing.KillNum
            end

            if ( CritKing.KillNum < CritKing.MaxKill )
            then
                CritKing.OnKill()
            end
    
            return
        end
    
        if( critical )
        then
            CritKing.CritNum = CritKing.CritNum + 1
            CritKing.Damage = amount

            if ( amount > CritKing.MaxDamage )
            then
                CritKing.MaxDamage = amount
            end
            
            if ( CritKing.CritNum > CritKing.MaxCritNum )
            then
                CritKing.MaxCritNum = CritKing.CritNum
            end
            
            if ( CritKing.CritNum < CritKing.MaxCrit )
            then
                CritKing.OnCrit()
            end
        else
            if ( CritKingResetOnNormalHit == "on" )
            then
                CritKing.ResetCrit()
            end
        end

        return
    end
    
    if ( ( event == "PLAYER_REGEN_ENABLED" )   -- player enter, or leave from combat
      or ( event == "PLAYER_REGEN_DISABLED" ) )
    then
	    CritKing.ResetStat()
    	return
    end
end

local f = CreateFrame("Frame")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:RegisterEvent("PLAYER_REGEN_DISABLED")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH")
f:RegisterEvent("VARIABLES_LOADED")
f:SetScript("OnEvent", CritKing.OnEvent)

SlashCmdList[ "CRK_CMD" ] = CritKing.OnCommand
SLASH_CRK_CMD1 = "/ck"

--CritKing.SendMsg( " loaded! Version: " .. CRITKINGVERSION )
CritKing.toc
Code:
## Interface: 40100
## Title: Crit King
## Author: TwILeK
## Version: 0.2
## Notes: Crit and Killing blow counter
## eMail: [email protected]
## SavedVariablesPerCharacter: CritKingDisplay, CritKingResetOnNormalHit

CritKing.lua
Attached Files
File Type: zip CritKing-v0.2.zip (540.8 KB, 659 views)
  Reply With Quote
05-14-11, 10:17 AM   #3
ultraw
A Murloc Raider
Join Date: May 2010
Posts: 8
Thanks a bunch Ketho. I've tested it and it's working, though only to some extent.

When I crit the first sound is played, and only the first sound. As I crit more times it's suppose to play the next sounds, but it doesn't.

Edit:

I might have misunderstood the addon. Does it play the next sound only when the critical strikes are in sequence? Or just within the same session of "in combat"? If it's the former, then it works fine. If the latter (which is the sort of addon I was hoping it to be), then it doesn't.

Last edited by ultraw : 05-14-11 at 10:50 AM.
  Reply With Quote
05-14-11, 02:48 PM   #4
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
i believe the crits are supposed to be in sequence the kills are each time you kill something.
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
05-14-11, 03:14 PM   #5
ultraw
A Murloc Raider
Join Date: May 2010
Posts: 8
Ah, ok. Then it's working atleast thanks tinyu.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » [Request] Any chance this can be updated?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off