{"action":"created","issue":{"url":"https://api.github.com/repos/Sidoine/Ovale/issues/73","repository_url":"https://api.github.com/repos/Sidoine/Ovale","labels_url":"https://api.github.com/repos/Sidoine/Ovale/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/Sidoine/Ovale/issues/73/comments","events_url":"https://api.github.com/repos/Sidoine/Ovale/issues/73/events","html_url":"https://github.com/Sidoine/Ovale/issues/73","id":174426958,"number":73,"title":"Cooldown Conditions not working","user":{"login":"LunaEclipse73","id":176530,"avatar_url":"https://avatars.githubusercontent.com/u/176530?v=3","gravatar_id":"","url":"https://api.github.com/users/LunaEclipse73","html_url":"https://github.com/LunaEclipse73","followers_url":"https://api.github.com/users/LunaEclipse73/followers","following_url":"https://api.github.com/users/LunaEclipse73/following{/other_user}","gists_url":"https://api.github.com/users/LunaEclipse73/gists{/gist_id}","starred_url":"https://api.github.com/users/LunaEclipse73/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LunaEclipse73/subscriptions","organizations_url":"https://api.github.com/users/LunaEclipse73/orgs","repos_url":"https://api.github.com/users/LunaEclipse73/repos","events_url":"https://api.github.com/users/LunaEclipse73/events{/privacy}","received_events_url":"https://api.github.com/users/LunaEclipse73/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-01T03:13:39Z","updated_at":"2016-09-01T03:43:13Z","closed_at":"2016-09-01T03:43:13Z","body":"I was having trouble with my custom scripts, recommending wrong spells and such, I eventually narrowed it down to SpellCooldown() not returning correctly, this could possible apply to others such as SpellChargeCooldown as well.\r\n\r\nSimple way to confirm this bug,  I am using an unholy DK for this, but you can quite easily modify it for any class with a cooldown spell:\r\n\r\n```\r\nAddIcon specialization=unholy\r\n{\r\n\tif SpellCooldown(death_and_decay) Spell(death_and_decay text=true)\r\n\tif not SpellCooldown(death_and_decay) Spell(death_and_decay text=false)\r\n}\r\n```\r\n\r\nThis basically adds an extra icon which is a visual display of whether the condition is returning true or false.  If the spell is on cooldown it should show the icon with the text true in the center of the icon, if it is not on cooldown it should show the icon with the text false in the center.\r\n\r\nUse Death and Decay or whichever spell you use for the test, and the box should change the text, however it never does, it always shows \"False\" meaning the functions are returning that spells are never on cooldown.  I tested this with several DK cooldown spells, so it definitely seems to be a problem with the condition itself."},"comment":{"url":"https://api.github.com/repos/Sidoine/Ovale/issues/comments/243967998","html_url":"https://github.com/Sidoine/Ovale/issues/73#issuecomment-243967998","issue_url":"https://api.github.com/repos/Sidoine/Ovale/issues/73","id":243967998,"user":{"login":"LunaEclipse73","id":176530,"avatar_url":"https://avatars.githubusercontent.com/u/176530?v=3","gravatar_id":"","url":"https://api.github.com/users/LunaEclipse73","html_url":"https://github.com/LunaEclipse73","followers_url":"https://api.github.com/users/LunaEclipse73/followers","following_url":"https://api.github.com/users/LunaEclipse73/following{/other_user}","gists_url":"https://api.github.com/users/LunaEclipse73/gists{/gist_id}","starred_url":"https://api.github.com/users/LunaEclipse73/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LunaEclipse73/subscriptions","organizations_url":"https://api.github.com/users/LunaEclipse73/orgs","repos_url":"https://api.github.com/users/LunaEclipse73/repos","events_url":"https://api.github.com/users/LunaEclipse73/events{/privacy}","received_events_url":"https://api.github.com/users/LunaEclipse73/received_events","type":"User","site_admin":false},"created_at":"2016-09-01T03:43:13Z","updated_at":"2016-09-01T03:43:13Z","body":"I was able to get it to return the correct values by changing the condition as follows, though I don't know enough about the Ovale:Future module to know if this will interfere with future best spell suggestion.\r\n\r\n```\r\ndo\r\n\t--- Get the number of seconds before any of the listed spells are ready for use.\r\n\t-- @name SpellCooldown\r\n\t-- @paramsig number or boolean\r\n\t-- @param id The spell ID.\r\n\t-- @param ... Optional. Additional spell IDs.\r\n\t-- @param operator Optional. Comparison operator: less, atMost, equal, atLeast, more.\r\n\t-- @param number Optional. The number to compare against.\r\n\t-- @return The number of seconds.\r\n\t-- @return A boolean value for the result of the comparison.\r\n\tlocal function SpellCooldown(positionalParams, namedParams, state, atTime)\r\n\t\tlocal comparator, limit;\r\n\t\tlocal usable = (namedParams.usable == 1);\r\n\t\tlocal target = ParseCondition(positionalParams, namedParams, state, \"target\");\r\n\t\tlocal returnValue = 0;\r\n\r\n\t\tfor counter, spellID in ipairs(positionalParams) do\r\n\t\t\tif OvaleCondition.COMPARATOR[spellID] then\r\n\t\t\t\tcomparator, limit = spellID, positionalParams[counter + 1];\r\n\t\t\t\tbreak;\r\n\t\t\telseif not usable or state:IsUsableSpell(spellID, atTime, OvaleGUID:UnitGUID(target)) then\r\n\t\t\t\tlocal spellStart, spellDuration = state:GetSpellCooldown(spellID);\r\n\t\t\t\tlocal newReturnValue = (spellStart + spellDuration) - GetTime();\r\n\t\t\t\t\t\r\n\t\t\t\tif newReturnValue < returnValue or returnValue == 0 then\r\n\t\t\t\t\treturnValue = newReturnValue;\r\n\t\t\t\tend\r\n\t\t\tend\t\t\r\n\t\tend\r\n\r\n\t\tif returnValue < 0 then\r\n\t\t\treturnValue = 0;\r\n\t\tend\r\n\r\n\t\treturn Compare(returnValue, comparator, limit);\r\n\tend\r\n\r\n\tOvaleCondition:RegisterCondition(\"spellcooldown\", false, SpellCooldown)\r\nend\r\n```\r\n\r\n"}}
{"actor":{"display_login":"LunaEclipse73"}}