Skip to content

Commit

Permalink
Some more bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteOne committed May 20, 2024
1 parent 16dcb81 commit 6cc3637
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 30 deletions.
37 changes: 20 additions & 17 deletions System/API/Enemies.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

local _, br = ...
if br.api == nil then br.api = {} end
local function setVariable(self,unit,range,checkNoCombat,facing,type,table,count)
local function setVariable(self, unit, range, checkNoCombat, facing, type, table, count)
if unit == nil then unit = "player" end
if range == nil then range = 5 end
if checkNoCombat == nil then checkNoCombat = false end
Expand All @@ -32,19 +32,22 @@ local function setVariable(self,unit,range,checkNoCombat,facing,type,table,count
if table == nil then table = {} end
if count == nil then count = #table end
-- Build enemies.yards variable
local insertTable = "yards"..range..type -- Ex: enemies.yards8 (returns all enemies around player in 8yrds), Adds Table Type (r for Rect, c for Cone, blank for Normal)
local insertTable = "yards" ..
range ..
type -- Ex: enemies.yards8 (returns all enemies around player in 8yrds), Adds Table Type (r for Rect, c for Cone, blank for Normal)
if unit ~= "player" then
-- letter tag on end based on type of unit passed, if target or enemy unit then "t" otherwise first letter of what is passed in: f - "focus", p - "pet", m - "mouseover", etc
if br.units[unit] ~= nil then
insertTable = insertTable.."t" -- Ex: enemies.yards8t (returns all enemies around target in 8yrds)
insertTable = insertTable .. "t" -- Ex: enemies.yards8t (returns all enemies around target in 8yrds)
else
insertTable = insertTable..unit:sub(1,1) -- Ex: enemies.yards8f (returns all enemies around "focus" in 8yrds)
insertTable = insertTable ..
unit:sub(1, 1) -- Ex: enemies.yards8f (returns all enemies around "focus" in 8yrds)
end
end
if checkNoCombat then insertTable = insertTable.."nc" end -- Ex: enemies.yards8tnc (returns all units around target in 8yrds)
if facing then insertTable = insertTable.."f" end-- Ex: enemies.yards8tncf (returns all units the target is facing in 8yrds)
if checkNoCombat then insertTable = insertTable .. "nc" end -- Ex: enemies.yards8tnc (returns all units around target in 8yrds)
if facing then insertTable = insertTable .. "f" end -- Ex: enemies.yards8tncf (returns all units the target is facing in 8yrds)
if self.enemies[insertTable] == nil then self.enemies[insertTable] = {} else br._G.wipe(self.enemies[insertTable]) end
if count > 0 then br.insertTableIntoTable(self.enemies[insertTable],table) end
if count > 0 then br.insertTableIntoTable(self.enemies[insertTable], table) end
end

br.api.enemies = function(self)
Expand All @@ -59,13 +62,13 @@ br.api.enemies = function(self)
-- @bool checkNoCombat Check for enemies even if not in combat
-- @bool facing Check if enemies are facing unit
-- @treturn table
enemies.get = function(range,unit,checkNoCombat,facing)
enemies.get = function(range, unit, checkNoCombat, facing)
if unit == nil then unit = "player" end
if checkNoCombat == nil then checkNoCombat = false end
if facing == nil then facing = false end
local enemyTable = br.getEnemies(unit,range,checkNoCombat,facing)
local enemyTable = br.getEnemies(unit, range, checkNoCombat, facing)
-- Build enemies.yards variable
setVariable(self,unit,range,checkNoCombat,facing,"",enemyTable)
setVariable(self, unit, range, checkNoCombat, facing, "", enemyTable)
-- Backwards compatability for old way
return enemyTable, #enemyTable
end
Expand All @@ -77,10 +80,10 @@ br.api.enemies = function(self)
-- @bool checkNoCombat Check for enemies even if not in combat
-- @bool showLines Show lines for the cone *non-functional atm*
-- @treturn table
enemies.cone.get = function(angle,range,checkNoCombat,showLines)
local count, table = br.getEnemiesInCone(angle,range,checkNoCombat,showLines)
enemies.cone.get = function(angle, range, checkNoCombat, showLines)
local count, table = br.getEnemiesInCone(angle, range, checkNoCombat, showLines)
-- Build enemies.yards variable
setVariable(self,"player",range,checkNoCombat,false,"c",table,count)
setVariable(self, "player", range, checkNoCombat, false, "c", table, count)
-- Backwards compatability for old way
return table, count
end
Expand All @@ -93,11 +96,11 @@ br.api.enemies = function(self)
-- @bool checkNoCombat Check for enemies even if not in combat
-- @bool facing Check if enemies are facing unit *no longer used*
-- @treturn table
enemies.rect.get = function(width,range,showLines,checkNoCombat,facing)
local count, table = br.getEnemiesInRect(width,range,showLines,checkNoCombat)
enemies.rect.get = function(width, range, showLines, checkNoCombat, facing)
local count, table = br.getEnemiesInRect(width, range, showLines, checkNoCombat)
-- Build enemies.yards variable
setVariable(self,"player",range,checkNoCombat,false,"r",table,count)
setVariable(self, "player", range, checkNoCombat, false, "r", table, count)
-- Backwards compatability for old way
return table, count
end
end
end
6 changes: 4 additions & 2 deletions System/API/UI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ br.api.ui = function(self)
if range == nil then range = 8 end
if minCount == nil then minCount = 3 end
if useTarget == nil then useTarget = "player" end
return ((ui.mode.rotation == 1 and #self.enemies.get(range, useTarget) >= minCount) or (ui.mode.rotation == 2 and #self.enemies.get(range, useTarget) > 0))
local _, enemyCount = self.enemies.get(range, useTarget)
return ((ui.mode.rotation == 1 and enemyCount >= minCount) or (ui.mode.rotation == 2 and enemyCount > 0))
end
end

Expand Down Expand Up @@ -230,7 +231,8 @@ br.api.ui = function(self)
if range == nil then range = 8 end
if minCount == nil then minCount = 3 end
if useTarget == nil then useTarget = "player" end
return ((ui.mode.rotation == 1 and #self.enemies.get(range, useTarget) < minCount) or (ui.mode.rotation == 3 and #self.enemies.get(range, useTarget) > 0))
local _, enemyCount = self.enemies.get(range, useTarget)
return ((ui.mode.rotation == 1 and enemyCount < minCount) or (ui.mode.rotation == 3 and enemyCount > 0))
end
end

Expand Down
22 changes: 11 additions & 11 deletions System/Functions/Range.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ function br.getDistance(Unit1, Unit2, option)
Unit2 = Unit1
Unit1 = "player"
end
if br.units ~= nil then
if (Unit1 == "player" and br.units[br._G.ObjectPointer(Unit2)] ~= nil) then
return br.units[br._G.ObjectPointer(Unit2)].range
end
if (br.units[br._G.ObjectPointer(Unit1)] ~= nil and Unit2 == "player") then
return br.units[br._G.ObjectPointer(Unit1)].range
end
local thisUnit = Unit1 == "player" and br.units[br._G.ObjectPointer(Unit2)] or
br.units[br._G.ObjectPointer(Unit1)]
if thisUnit ~= nil then return thisUnit.range end
end
-- if br.units ~= nil then
-- if (Unit1 == "player" and br.units[br._G.ObjectPointer(Unit2)] ~= nil) then
-- return br.units[br._G.ObjectPointer(Unit2)].range
-- end
-- if (br.units[br._G.ObjectPointer(Unit1)] ~= nil and Unit2 == "player") then
-- return br.units[br._G.ObjectPointer(Unit1)].range
-- end
-- local thisUnit = Unit1 == "player" and br.units[br._G.ObjectPointer(Unit2)] or
-- br.units[br._G.ObjectPointer(Unit1)]
-- if thisUnit ~= nil then return thisUnit.range end
-- end
return br.getDistanceCalc(Unit1, Unit2, option)
end

Expand Down
2 changes: 2 additions & 0 deletions System/Loader/cCharacter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ function br.cCharacter:new(class)
self.module.BasicHealing()
end
if not self.unit.inCombat() then
-- Module Auto Mythic+ Keystone
self.module.autoKeystone()
-- Module PhialUp
self.module.PhialUp()
-- Module - Imbue Up
Expand Down

0 comments on commit 6cc3637

Please sign in to comment.