From b314ee5da2feb79cb29540fd6be5a7e621bf06d3 Mon Sep 17 00:00:00 2001 From: Ada Young Date: Tue, 16 Oct 2018 22:47:40 +0100 Subject: [PATCH 1/4] This commit removes the use of gmcp.IRE.Display.ButtonActions and relies on using timeframes and cooldowns for rageAvailable-ity! --- script.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/script.lua b/script.lua index 58ac18e..79923df 100644 --- a/script.lua +++ b/script.lua @@ -69,6 +69,7 @@ keneanung.bashing.configuration.priorities = {} keneanung.bashing.targetList = {} keneanung.bashing.systems = {} keneanung.bashing.battlerage = {} +keneanung.bashing.battlerageSkillsCD = {} -- I couldn't get it to work as a local in a tempTimer D: keneanung.bashing.room = {} keneanung.bashing.pausingAfflictions = {} @@ -454,6 +455,10 @@ end keneanung.bashing.battlerage.none = function(rage) end +keneanung.bashing.battlerage.setCooldown = function(rage) + timeframe("keneanung.bashing.battlerageSkillsCD['"..rage.name.."']", 0, rage.cooldown) +end + keneanung.bashing.battlerage.simple = function(rage) if keneanung.bashing.attacking == 0 then return end @@ -469,12 +474,14 @@ keneanung.bashing.battlerage.simple = function(rage) if not rageRazeFunction() then if keneanung.bashing.rageAvailable(4) then sendRageAttack(battlerageSkills[4].command) + keneanung.bashing.battlerage.setCooldown(battlerageSkills[4]) elseif keneanung.bashing.rageAvailable(1) and ((not battlerageSkills[4].skillKnown) or rage >= (battlerageSkills[1].rage + battlerageSkills[4].rage)) then sendRageAttack(battlerageSkills[1].command) + keneanung.bashing.battlerage.setCooldown(battlerageSkills[1]) end end end @@ -494,8 +501,10 @@ keneanung.bashing.battlerage.simplereverse = function(rage) if not rageRazeFunction() then if keneanung.bashing.rageAvailable(1) then sendRageAttack(battlerageSkills[1].command) + keneanung.bashing.battlerage.setCooldown(battlerageSkills[1]) elseif keneanung.bashing.rageAvailable(4) then sendRageAttack(battlerageSkills[4].command) + keneanung.bashing.battlerage.setCooldown(battlerageSkills[4]) end end end @@ -1681,16 +1690,17 @@ keneanung.bashing.handleSkillInfo = function() end keneanung.bashing.rageAvailable = function(ability) + if keneanung.bashing.usedRageAttack then return false end if type(ability) == "number" then ability = battlerageSkills[ability].name end - for _, button in pairs(gmcp.IRE.Display.ButtonActions) do - if button.text:lower() == ability:lower() then - return button.highlight == 1 - end + + if rage >= battlerageSkills[ability].rage then + return not keneanung.bashing.battlerageSkillsCD[ability] + else + return false end - return false end keneanung.bashing.printGains = function(which) From 7498ee98cc6acc87f3b2a6eb52a6149cc8159769 Mon Sep 17 00:00:00 2001 From: Ada Young Date: Tue, 16 Oct 2018 23:18:51 +0100 Subject: [PATCH 2/4] Oops, we don't need that in the else part --- script.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script.lua b/script.lua index 79923df..33e8f27 100644 --- a/script.lua +++ b/script.lua @@ -1698,9 +1698,8 @@ keneanung.bashing.rageAvailable = function(ability) if rage >= battlerageSkills[ability].rage then return not keneanung.bashing.battlerageSkillsCD[ability] - else - return false end + return false end keneanung.bashing.printGains = function(which) From eb85425278e15e2485c967a931a953ab3ecded6c Mon Sep 17 00:00:00 2001 From: Ada Young Date: Wed, 17 Oct 2018 05:13:31 +0100 Subject: [PATCH 3/4] Okay! Moved setCooldown to sendRageAttack. Fixed razing with rage too! --- script.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/script.lua b/script.lua index 33e8f27..bff2809 100644 --- a/script.lua +++ b/script.lua @@ -429,9 +429,10 @@ keneanung.bashing.systems.none = { } -local function sendRageAttack(attack) - debugMessage("sending rage attack", attack) - send(attack:format(keneanung.bashing.targetList[keneanung.bashing.attacking].id), false) +local function sendRageAttack(thisRage) + debugMessage("sending rage attack", thisRage.command) + send(thisRage.command:format(keneanung.bashing.targetList[keneanung.bashing.attacking].id), false) + keneanung.bashing.battlerage.setCooldown(thisRage) keneanung.bashing.usedRageAttack = true tempTimer(1, "keneanung.bashing.usedRageAttack = false") end @@ -439,7 +440,7 @@ end local function rageRazeFunction() if keneanung.bashing.shield then if keneanung.bashing.configuration[class].autorageraze and keneanung.bashing.rageAvailable(3) then - send(battlerageSkills[3].command:format(keneanung.bashing.targetList[keneanung.bashing.attacking].id), false) + sendRageAttack(battlerageSkills[3]) keneanung.bashing.shield = false local system = keneanung.bashing.systems[keneanung.bashing.configuration.system] if system.brokeShield then @@ -473,15 +474,13 @@ keneanung.bashing.battlerage.simple = function(rage) if not rageRazeFunction() then if keneanung.bashing.rageAvailable(4) then - sendRageAttack(battlerageSkills[4].command) - keneanung.bashing.battlerage.setCooldown(battlerageSkills[4]) + sendRageAttack(battlerageSkills[4]) elseif keneanung.bashing.rageAvailable(1) and ((not battlerageSkills[4].skillKnown) or rage >= (battlerageSkills[1].rage + battlerageSkills[4].rage)) then - sendRageAttack(battlerageSkills[1].command) - keneanung.bashing.battlerage.setCooldown(battlerageSkills[1]) + sendRageAttack(battlerageSkills[1]) end end end @@ -500,11 +499,9 @@ keneanung.bashing.battlerage.simplereverse = function(rage) if not rageRazeFunction() then if keneanung.bashing.rageAvailable(1) then - sendRageAttack(battlerageSkills[1].command) - keneanung.bashing.battlerage.setCooldown(battlerageSkills[1]) + sendRageAttack(battlerageSkills[1]) elseif keneanung.bashing.rageAvailable(4) then - sendRageAttack(battlerageSkills[4].command) - keneanung.bashing.battlerage.setCooldown(battlerageSkills[4]) + sendRageAttack(battlerageSkills[4]) end end end From 25949406da18ac6c846a10580e440f1bc0ef7977 Mon Sep 17 00:00:00 2001 From: Ada Young Date: Wed, 17 Oct 2018 09:17:29 +0100 Subject: [PATCH 4/4] IRE.Display gmcp module no longer required --- script.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/script.lua b/script.lua index bff2809..e9bd6f6 100644 --- a/script.lua +++ b/script.lua @@ -69,7 +69,7 @@ keneanung.bashing.configuration.priorities = {} keneanung.bashing.targetList = {} keneanung.bashing.systems = {} keneanung.bashing.battlerage = {} -keneanung.bashing.battlerageSkillsCD = {} -- I couldn't get it to work as a local in a tempTimer D: +keneanung.bashing.battlerageSkillsCD = {} keneanung.bashing.room = {} keneanung.bashing.pausingAfflictions = {} @@ -156,16 +156,12 @@ end local startAttack = function() local system = keneanung.bashing.systems[keneanung.bashing.configuration.system] - system.startAttack() - gmod.enableModule("keneanung.bashing", "IRE.Display") - sendGMCP([[Core.Supports.Add ["IRE.Display 3"] ]]) -- register the GMCP module independently from gmod. + system.startAttack() end local stopAttack = function() local system = keneanung.bashing.systems[keneanung.bashing.configuration.system] - system.stopAttack() - gmod.disableModule("keneanung.bashing", "IRE.Display") - sendGMCP([[Core.Supports.Remove ["IRE.Display"] ]]) -- unregister the GMCP module independently from gmod. + system.stopAttack() end keneanung.bashing.systems.svo = {