Diminishing returns function menu

User Tag List

Results 1 to 5 of 5
  1. #1
    G0tha's Avatar Member
    Reputation
    9
    Join Date
    Jul 2013
    Posts
    76
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Diminishing returns function

    Does anyone know if it exists somewhere? It fades 15 seconds after SPELL_AURA_REMOVED



    PHP Code:
    local major "DRData-1.0"
    local minor 1007
    assert
    (LibStubstring.format("%s requires LibStub."major))

    local Data LibStub:NewLibrary(majorminor)
    if( 
    not Data then return end

    local L 
    = {
        [
    "Banish"] = "Banish",
        [
    "Controlled stuns"] = "Controlled stuns",
        [
    "Cyclone"] = "Cyclone",
        [
    "Disarms"] = "Disarms",
        [
    "Disorients"] = "Disorients",
        [
    "Entrapment"] = "Entrapment",
        [
    "Fears"] = "Fears",
        [
    "Horrors"] = "Horrors",
        [
    "Mind Control"] = "Mind Control",
        [
    "Random roots"] = "Random roots",
        [
    "Random stuns"] = "Random stuns",
        [
    "Controlled roots"] = "Controlled roots",
        [
    "Scatter Shot"] = "Scatter Shot",
        [
    "Dragon's Breath"] = "Dragon's Breath",
        [
    "Silences"] = "Silences",
        [
    "Taunts"] = "Taunts",
    }

    if 
    GetLocale() == "frFR" then
        L
    ["Banish"] = "Bannissement"
        
    L["Controlled stuns"] = "Etourdissements contrôlés"
        
    L["Cyclone"] = "Cyclone"
        
    L["Disarms"] = "Désarmements"
        
    L["Disorients"] = "Désorientations"
        
    L["Entrapment"] = "Piège"
        
    L["Fears"] = "Peurs"
        
    L["Horrors"] = "Horreurs"
        
    L["Mind Control"] = "Contrôle mental"
        
    L["Random roots"] = "Immobilisations aléatoires"
        
    L["Random stuns"] = "Etourdissemensts aléatoires"
        
    L["Controlled roots"] = "Immobilisations contrôlées"
        
    L["Scatter Shot"] = "Flèche de dispersion"
        
    L["Dragon's Breath"] = "Souffle du dragon"
        
    L["Silences"] = "Silences"
        
    L["Taunts"] = "Provocations"
    end

    -- How long before DR resets
    -- While everyone will tell you it's 15 seconds, it's actually 16 20 seconds with 18 being a decent enough average
    Data
    .RESET_TIME 18

    -- List of spellID -> DR category
    Data
    .spells = {
        --[[ 
    TAUNT ]]--
        [  
    355] = "taunt", -- Taunt (Warrior)
        [
    53477] = "taunt", -- Taunt (Hunter tenacity pet)
        [ 
    6795] = "taunt", -- Growl (Druid)
        [
    56222] = "taunt", -- Dark Command
        
    [62124] = "taunt", -- Hand of Reckoning
        
    [31790] = "taunt", -- Righteous Defense
        
    [20736] = "taunt", -- Distracting Shot
        
    1161] = "taunt", -- Challenging Shout
        
    5209] = "taunt", -- Challenging Roar
        
    [57603] = "taunt", -- Death Grip
        
    [36213] = "taunt", -- Angered Earth -- FIXMENPC ability ?
        [
    17735] = "taunt", -- Suffering (Voidwalker)
        [
    58857] = "taunt", -- Twin Howl (Spirit wolves)

        --[[ 
    DISORIENTS ]]--
        [
    49203] = "disorient", -- Hungering Cold
        
    6770] = "disorient", -- Sap
        
    1776] = "disorient", -- Gouge
        
    [51514] = "disorient", -- Hex
        
    9484] = "disorient", -- Shackle Undead
        
    [  118] = "disorient", -- Polymorph
        
    [28272] = "disorient", -- Polymorph (pig)
        [
    28271] = "disorient", -- Polymorph (turtle)
        [
    61305] = "disorient", -- Polymorph (black cat)
        [
    61025] = "disorient", -- Polymorph (serpent) -- FIXMEgone ?
        [
    61721] = "disorient", -- Polymorph (rabbit)
        [
    61780] = "disorient", -- Polymorph (turkey)
        [ 
    3355] = "disorient", -- Freezing Trap
        
    [19386] = "disorient", -- Wyvern Sting
        
    [20066] = "disorient", -- Repentance
        
    [90337] = "disorient", -- Bad Manner (Monkey) -- FIXMEto check
        
    2637] = "disorient", -- Hibernate
        
    [82676] = "disorient", -- Ring of Frost

        
    --[[ SILENCES ]]--
        [
    50479] = "silence", -- Nether Shock (Nether ray)
        [ 
    1330] = "silence", -- Garrote
        
    [25046] = "silence", -- Arcane Torrent (Energy version)
        [
    28730] = "silence", -- Arcane Torrent (Mana version)
        [
    50613] = "silence", -- Arcane Torrent (Runic power version)
        [
    69179] = "silence", -- Arcane Torrent (Rage version)
        [
    80483] = "silence", -- Arcane Torrent (Focus version)
        [
    15487] = "silence", -- Silence
        
    [34490] = "silence", -- Silencing Shot
        
    [18425] = "silence", -- Improved Kick (rank 1)
        [
    86759] = "silence", -- Improved Kick (rank 2)
        [
    18469] = "silence", -- Improved Counterspell (rank 1)
        [
    55021] = "silence", -- Improved Counterspell (rank 2)
        [
    24259] = "silence", -- Spell Lock (Felhunter)
        [
    47476] = "silence", -- Strangulate
        
    [18498] = "silence", -- Gag Order (Warrior talent)
        [
    74347] = "silence", -- Gag Order (Warrior talent) -- FIXMEduplicate ?
        [
    81261] = "silence", -- Solar Beam
        
    [31935] = "silence", -- Avenger's Shield

        --[[ DISARMS ]]--
        [91644] = "disarm", -- Snatch (Bird of Prey)
        [51722] = "disarm", -- Dismantle
        [  676] = "disarm", -- Disarm
        [64058] = "disarm", -- Psychic Horror (Disarm effect)
        [50541] = "disarm", -- Clench (Scorpid)

        --[[ FEARS ]]--
        [ 2094] = "fear", -- Blind
        [ 5782] = "fear", -- Fear (Warlock)
        [ 6358] = "fear", -- Seduction (Succubus)
        [ 5484] = "fear", -- Howl of Terror
        [ 8122] = "fear", -- Psychic Scream
        [65545] = "fear", -- Psychic Horror
        [ 1513] = "fear", -- Scare Beast
        [10326] = "fear", -- Turn Evil
        [ 5246] = "fear", -- Intimidating Shout (main target)
        [20511] = "fear", -- Intimidating Shout (secondary targets)

        --[[ CONTROL STUNS ]]--
        [89766] = "ctrlstun", -- Axe Toss (Felguard)
        [50519] = "ctrlstun", -- Sonic Blast (Bat)
        [12809] = "ctrlstun", -- Concussion Blow
        [46968] = "ctrlstun", -- Shockwave
        [  853] = "ctrlstun", -- Hammer of Justice
        [ 5211] = "ctrlstun", -- Bash
        [19577] = "ctrlstun", -- Intimidation
        [22570] = "ctrlstun", -- Maim
        [  408] = "ctrlstun", -- Kidney Shot
        [20549] = "ctrlstun", -- War Stomp
        [20252] = "ctrlstun", -- Intercept
        [20253] = "ctrlstun", -- Intercept
        [44572] = "ctrlstun", -- Deep Freeze
        [30283] = "ctrlstun", -- Shadowfury
        [ 2812] = "ctrlstun", -- Holy Wrath
        [22703] = "ctrlstun", -- Inferno Effect
        [54785] = "ctrlstun", -- Demon Leap (Warlock)
        [47481] = "ctrlstun", -- Gnaw (Ghoul)
        [93433] = "ctrlstun", -- Burrow Attack (Worm)
        [56626] = "ctrlstun", -- Sting (Wasp)
        [85388] = "ctrlstun", -- Throwdown
        [ 1833] = "ctrlstun", -- Cheap Shot
        [ 9005] = "ctrlstun", -- Pounce
        [88625] = "ctrlstun", -- Holy Word: Chastise
        [ 7922] = "ctrlstun", -- Charge

        --[[ RANDOM STUNS ]]--
        [64343] = "rndstun", -- Impact
        [39796] = "rndstun", -- Stoneclaw Stun
        [11210] = "rndstun", -- Improved Polymorph (rank 1)
        [12592] = "rndstun", -- Improved Polymorph (rank 2)

        --[[ CYCLONE ]]--
        [33786] = "cyclone", -- Cyclone

        --[[ ROOTS ]]--
        [33395] = "ctrlroot", -- Freeze (Water Elemental)
        [50245] = "ctrlroot", -- Pin (Crab)
        [  122] = "ctrlroot", -- Frost Nova
        [  339] = "ctrlroot", -- Entangling Roots
        [19975] = "ctrlroot", -- Nature'
    s Grasp (Uses different spellIDs than Entangling Roots for the same spell)
        [
    64695] = "ctrlroot", -- Earthgrab (StormEarth and Fire talent)
        [ 
    4167] = "ctrlroot", -- Web (Spider)
        [
    54706] = "ctrlroot",    -- Venom Web Spray (Silithid)
        [
    19306] = "ctrlroot", -- Counterattack
        
    [90327] = "ctrlroot", -- Lock Jaw (Dog)
        [
    11190] = "ctrlroot", -- Improved Cone of Cold (rank 1)
        [
    12489] = "ctrlroot", -- Improved Cone of Cold (rank 2)

        --[[ 
    RANDOM ROOTS ]]--
        [
    23694] = "rndroot", -- Improved Hamstring -- FIXMEto check
        
    [44745] = "rndroot", -- Shattered Barrier (rank 1)
        [
    54787] = "rndroot", -- Shattered Barrier (rank 2)

        --[[ 
    HORROR ]]--
        [ 
    6789] = "horror", -- Death Coil
        
    [64044] = "horror", -- Psychic Horror
        
    [87099] = "horror", -- Sin and Punishment (rank 1)
        [
    87100] = "horror", -- Sin and Punishment (rank 2)

        --[[ 
    MISC ]]--
        [
    19503] = "scatters",   -- Scatter Shot
        
    [31661] = "dragons",    -- Dragon's Breath
        [  605] = "mc",         -- Mind Control
        [  710] = "banish",     -- Banish
        [19185] = "entrapment", -- Entrapment
    }

    -- DR Category names
    Data.categoryNames = {
        ["banish"] = L["Banish"],
        ["ctrlstun"] = L["Controlled stuns"],
        ["cyclone"] = L["Cyclone"],
        ["disarm"] = L["Disarms"],
        ["disorient"] = L["Disorients"],
        ["entrapment"] = L["Entrapment"],
        ["fear"] = L["Fears"],
        ["horror"] = L["Horrors"],
        ["mc"] = L["Mind Control"],
        ["rndroot"] = L["Random roots"],
        ["rndstun"] = L["Random stuns"],
        ["ctrlroot"] = L["Controlled roots"],
        ["scatters"] = L["Scatter Shot"],
        ["dragons"] = L["Dragon'
    s Breath"],
        ["
    silence"] = L["Silences"],
        ["
    taunt"] = L["Taunts"],
    }

    -- Categories that have DR in PvE as well as PvP
    Data.pveDR = {
        ["
    ctrlstun"] = true,
        ["
    rndstun"] = true,
        ["
    taunt"] = true,
        ["
    cyclone"] = true,
    }

    -- Public APIs
    -- Category name in something usable
    function Data:GetCategoryName(cat)
        return cat and Data.categoryNames[cat] or nil
    end

    -- Spell list
    function Data:GetSpells()
        return Data.spells
    end

    -- Seconds before DR resets
    function Data:GetResetTime()
        return Data.RESET_TIME
    end

    -- Get the category of the spellID
    function Data:GetSpellCategory(spellID)
        return spellID and Data.spells[spellID] or nil
    end

    -- Does this category DR in PvE?
    function Data:IsPVE(cat)
        return cat and Data.pveDR[cat] or nil
    end

    -- List of categories
    function Data:GetCategories()
        return Data.categoryNames
    end

    -- Next DR, if it's 1.0, next is 0.50, if it's 0.[50] = "
    ctrlroot",next is 0.[25] = "ctrlroot",and such
    function Data:NextDR(diminished)
        if( diminished == 1 ) then
            return 0.50
        elseif( diminished == 0.50 ) then
            return 0.25
        end

        return 0
    end

    --[[ EXAMPLES ]]--
    -- This is how you would track DR easily, you're welcome to do whatever you want with the below functions

    --[[
    local trackedPlayers = {}
    local function debuffGained(spellID, destName, destGUID, isEnemy, isPlayer)
        -- Not a player, and this category isn't diminished in PVE, as well as make sure we want to track NPCs
        local drCat = DRData:GetSpellCategory(spellID)
        if( not isPlayer and not DRData:IsPVE(drCat) ) then
            return
        end

        if( not trackedPlayers[destGUID] ) then
            trackedPlayers[destGUID] = {}
        end

        -- See if we should reset it back to undiminished
        local tracked = trackedPlayers[destGUID][drCat]
        if( tracked and tracked.reset <= GetTime() ) then
            tracked.diminished = 1.0
        end
    end

    local function debuffFaded(spellID, destName, destGUID, isEnemy, isPlayer)
        local drCat = DRData:GetSpellCategory(spellID)
        if( not isPlayer and not DRData:IsPVE(drCat) ) then
            return
        end

        if( not trackedPlayers[destGUID] ) then
            trackedPlayers[destGUID] = {}
        end

        if( not trackedPlayers[destGUID][drCat] ) then
            trackedPlayers[destGUID][drCat] = { reset = 0, diminished = 1.0 }
        end

        local time = GetTime()
        local tracked = trackedPlayers[destGUID][drCat]

        tracked.reset = time + DRData:GetResetTime()
        tracked.diminished = DRData:NextDR(tracked.diminished)

        -- Diminishing returns changed, now you can do an update
    end

    local function resetDR(destGUID)
        -- Reset the tracked DRs for this person
        if( trackedPlayers[destGUID] ) then
            for cat in pairs(trackedPlayers[destGUID]) do
                trackedPlayers[destGUID][cat].reset = 0
                trackedPlayers[destGUID][cat].diminished = 1.0
            end
        end
    end

    local COMBATLOG_OBJECT_TYPE_PLAYER = COMBATLOG_OBJECT_TYPE_PLAYER
    local COMBATLOG_OBJECT_REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE
    local COMBATLOG_OBJECT_CONTROL_PLAYER = COMBATLOG_OBJECT_CONTROL_PLAYER

    local eventRegistered = {["
    SPELL_AURA_APPLIED"] = true, ["SPELL_AURA_REFRESH"] = true, ["SPELL_AURA_REMOVED"] = true, ["PARTY_KILL"] = true, ["UNIT_DIED"] = true}
    local function COMBAT_LOG_EVENT_UNFILTERED(self, event, timestamp, eventType, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, spellID, spellName, spellSchool, auraType)
        if( not eventRegistered[eventType] ) then
            return
        end

        -- Enemy gained a debuff
        if( eventType == "
    SPELL_AURA_APPLIED" ) then
            if( auraType == "
    DEBUFF" and DRData:GetSpellCategory(spellID) ) then
                local isPlayer = ( bit.band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) == COMBATLOG_OBJECT_TYPE_PLAYER or bit.band(destFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) == COMBATLOG_OBJECT_CONTROL_PLAYER )
                debuffGained(spellID, destName, destGUID, (bit.band(destFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE), isPlayer)
            end

        -- Enemy had a debuff refreshed before it faded, so fade + gain it quickly
        elseif( eventType == "
    SPELL_AURA_REFRESH" ) then
            if( auraType == "
    DEBUFF" and DRData:GetSpellCategory(spellID) ) then
                local isPlayer = ( bit.band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) == COMBATLOG_OBJECT_TYPE_PLAYER or bit.band(destFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) == COMBATLOG_OBJECT_CONTROL_PLAYER )
                local isHostile = (bit.band(destFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE)
                debuffFaded(spellID, destName, destGUID, isHostile, isPlayer)
                debuffGained(spellID, destName, destGUID, isHostile, isPlayer)
            end

        -- Buff or debuff faded from an enemy
        elseif( eventType == "
    SPELL_AURA_REMOVED" ) then
            if( auraType == "
    DEBUFF" and DRData:GetSpellCategory(spellID) ) then
                local isPlayer = ( bit.band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) == COMBATLOG_OBJECT_TYPE_PLAYER or bit.band(destFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) == COMBATLOG_OBJECT_CONTROL_PLAYER )
                debuffFaded(spellID, destName, destGUID, (bit.band(destFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE), isPlayer)
            end

        -- Don't use UNIT_DIED inside arenas due to accuracy issues, outside of arenas we don't care too much
        elseif( ( eventType == "
    UNIT_DIED" and select(2, IsInInstance()) ~= "arena" ) or eventType == "PARTY_KILL" ) then
            resetDR(destGUID)
        end
    end]] 
    This is from gladius

    PHP Code:
    for i=1,do
        
    local customTarget "arena"..i
        
        
        
        
    function MCFrame_OnEvent(self,event,...)
            if 
    event == "COMBAT_LOG_EVENT_UNFILTERED" then
                    local subEvent          
    select(2, ...)
                    
    local spell             select(13, ...)

                    
                    -- 
    Aura removed events
                    
    if subEvent == "SPELL_AURA_REMOVED" then
                            
    if UnitName(customTarget) == destination then
                                    
    -- Debuff Removed
                                    
    for i=1,#Data.spells do
                                        
    if spell == GetSpellInfo(Data.spells[i]) then  
                                            DR 
    1  -- i no it's nothing worthless
                                        end
                                    end
                            end
                    end
    end 
    Im trying to do something with it, if anyone can help me out feel free to post. I have no idea what i did above and how it works and if it even works
    Last edited by G0tha; 08-03-2013 at 10:59 AM.

    Diminishing returns function
  2. #2
    G0tha's Avatar Member
    Reputation
    9
    Join Date
    Jul 2013
    Posts
    76
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any toughts how to GetTime() from combat log events?

  3. #3
    crystal_tech's Avatar Elite User
    Reputation
    468
    Join Date
    Feb 2008
    Posts
    1,033
    Thanks G/R
    1/6
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by G0tha View Post
    any toughts how to GetTime() from combat log events?
    using API_COMBAT_LOG_EVENT the first param is the time stamp.

    so under 'if event == "COMBAT_LOG_EVENT_UNFILTERED" then'
    add 'local timestamp = select(1, ...)' thats the gettime when it was casted.

    Please if someone helped you donate rep to them.

  4. #4
    G0tha's Avatar Member
    Reputation
    9
    Join Date
    Jul 2013
    Posts
    76
    Thanks G/R
    4/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i meant timestamp is diffrent format than Gettime(), so do i use http://www.wowwiki.com/API_time to do it or http://www.wowwiki.com/API_date?
    i am not sure what's timestamp return value. they say it's kinda diffrent, but almost the same from time()
    Last edited by G0tha; 08-14-2013 at 04:17 PM.

  5. #5
    Numba1stunna1's Avatar Active Member
    Reputation
    70
    Join Date
    Dec 2013
    Posts
    182
    Thanks G/R
    1/34
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have been looking at both of these data files and I have been trying to figure a way to add it to my rogue pvp profile. I want to track just controlled stuns (such as kidney shot and cheapshot). I want to add something like " if controlled stun DR == nil then return true". Any help?

    edit: If anyone knows how to script the DR tracker to apply it to abilities and make the abilities return true of CC if the CC is higher than a specific duration. For instance, something like "if "StunDuration >= 3 then return true" (it will only cast the stun ability if the rotation knows that the stun will be 3 seconds or higher based on diminishing returns). Kinda complicated, and I am new to coding.
    Last edited by Numba1stunna1; 10-05-2014 at 03:46 PM.

Similar Threads

  1. Diminishing returns when doing many events
    By woned in forum Guild Wars 2
    Replies: 4
    Last Post: 09-05-2012, 07:05 AM
  2. Replies: 20
    Last Post: 06-08-2012, 12:11 PM
  3. [GUIDE] Diminishing returns on armor
    By Bitadas in forum Diablo 3 Guides
    Replies: 2
    Last Post: 05-28-2012, 04:59 PM
  4. diminishing returns issue
    By reaku in forum WoW EMU Questions & Requests
    Replies: 13
    Last Post: 02-18-2010, 04:48 AM
  5. About Diminishing Returns
    By ßetray in forum World of Warcraft Guides
    Replies: 7
    Last Post: 10-26-2009, 12:16 PM
All times are GMT -5. The time now is 06:09 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search