Skip to content

Commit

Permalink
System - Additional Fixes and Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteOne committed Jul 27, 2024
1 parent 1d40785 commit 90e7e7c
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 91 deletions.
6 changes: 5 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -23256,7 +23256,6 @@ read_globals = {
'RoundToSignificantDigits',
'RunBinding',
'RunMacro',
'RunMacroText',
'RunNextFrame',
'RunScript',
'RuneButtonMixin',
Expand Down Expand Up @@ -33043,6 +33042,11 @@ read_globals = {
'GetActiveLossOfControlDataCountByUnit'
}
},
C_Macro ={
fields = {
'RunMacroText',
}
},
C_Mail = {
fields = {
'CanCheckInbox',
Expand Down
72 changes: 36 additions & 36 deletions System/API/Unit.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

local _, br = ...
if br.api == nil then br.api = {} end
----------------------
Expand Down Expand Up @@ -28,14 +27,13 @@ br.api.unit = function(self)
return isBeast(thisUnit)
end
-- Can Attack
unit.canAttack = function(thisUnit,playerUnit)
unit.canAttack = function(thisUnit, playerUnit)
local UnitCanAttack = br._G["UnitCanAttack"]
if playerUnit == nil then playerUnit = "player" end
return UnitCanAttack(thisUnit,playerUnit)
return UnitCanAttack(thisUnit, playerUnit)
end
-- Cancelform
unit.cancelForm = function()
local RunMacroText = br._G.RunMacroText
local CancelShapeshiftForm = br._G["CancelShapeshiftForm"]
return CancelShapeshiftForm() or RunMacroText("/CancelForm")
end
Expand Down Expand Up @@ -80,33 +78,35 @@ br.api.unit = function(self)
return isDemon(thisUnit)
end
-- Distance
unit.distance = function(thisUnit,otherUnit)
unit.distance = function(thisUnit, otherUnit)
if not otherUnit then
otherUnit = thisUnit
thisUnit = "player"
end
return br.getDistance(thisUnit,otherUnit)
return br.getDistance(thisUnit, otherUnit)
end
-- Dual Wielding
unit.dualWielding = function()
local IsDualWielding = br._G["IsDualWielding"]
return IsDualWielding()
end
-- Enemy
unit.enemy = function(thisUnit,playerUnit)
unit.enemy = function(thisUnit, playerUnit)
local UnitIsEnemy = br._G["UnitIsEnemy"]
if playerUnit == nil then playerUnit = "player" end
return UnitIsEnemy(thisUnit,playerUnit)
return UnitIsEnemy(thisUnit, playerUnit)
end
-- Exists
unit.exists = function(thisUnit)
local UnitExists = br["GetUnitExists"]
return UnitExists(thisUnit)
end
-- Facing
unit.facing = function(thisUnit,otherUnit,degrees)
if otherUnit == nil then otherUnit = thisUnit; thisUnit = "player" end
return br.getFacing(thisUnit,otherUnit,degrees)
unit.facing = function(thisUnit, otherUnit, degrees)
if otherUnit == nil then
otherUnit = thisUnit; thisUnit = "player"
end
return br.getFacing(thisUnit, otherUnit, degrees)
end
-- Falling
unit.falling = function()
Expand All @@ -133,10 +133,10 @@ br.api.unit = function(self)
return GetNumShapeshiftForms()
end
-- Friend
unit.friend = function(thisUnit,playerUnit)
unit.friend = function(thisUnit, playerUnit)
local UnitIsFriend = br["GetUnitIsFriend"]
if playerUnit == nil then playerUnit = "player" end
return UnitIsFriend(thisUnit,playerUnit)
return UnitIsFriend(thisUnit, playerUnit)
end
-- Global Cooldown (option: Max Global Cooldown)
unit.gcd = function(max)
Expand All @@ -162,7 +162,7 @@ br.api.unit = function(self)
unit.hp = function(thisUnit)
local getHP = br["getHP"]
if thisUnit == nil then thisUnit = "player" end
return br.round2(getHP(thisUnit),2)
return br.round2(getHP(thisUnit), 2)
end
-- Humanoid
unit.humanoid = function(thisUnit)
Expand All @@ -181,20 +181,20 @@ br.api.unit = function(self)
if thisUnit == nil then thisUnit = "player" end
return UnitAffectingCombat(thisUnit) or self.ui.checked("Ignore Combat")
or (self.ui.checked("Tank Aggro = Player Aggro") and self.tankAggro())
or (GetNumGroupMembers()>1 and (UnitAffectingCombat(thisUnit) or UnitAffectingCombat("target")))
or (GetNumGroupMembers() > 1 and (UnitAffectingCombat(thisUnit) or UnitAffectingCombat("target")))
end
-- Instance Type (IE: "party" / "raid")
unit.instance = function(thisInstance)
local select = _G["select"]
local IsInInstance = br._G["IsInInstance"]
local instanceType = select(2,IsInInstance())
local instanceType = select(2, IsInInstance())
return thisInstance == nil and instanceType or instanceType == thisInstance
end
-- Interruptable
unit.interruptable = function(thisUnit,castPercent)
unit.interruptable = function(thisUnit, castPercent)
if thisUnit == nil then thisUnit = "target" end
if castPercent == nil then castPercent = 0 end
return br.canInterrupt(thisUnit,castPercent)
return br.canInterrupt(thisUnit, castPercent)
end
-- Is Boss
unit.isBoss = function(thisUnit)
Expand Down Expand Up @@ -226,10 +226,10 @@ br.api.unit = function(self)
return br.isTankInRange()
end
-- Is Unit
unit.isUnit = function(thisUnit,otherUnit)
unit.isUnit = function(thisUnit, otherUnit)
local UnitIsUnit = br._G["UnitIsUnit"]
if thisUnit == nil or otherUnit == nil then return false end
return UnitIsUnit(thisUnit,otherUnit)
return UnitIsUnit(thisUnit, otherUnit)
end
-- Level
unit.level = function(thisUnit)
Expand Down Expand Up @@ -283,13 +283,13 @@ br.api.unit = function(self)
local select = _G["select"]
local UnitRace = br._G["UnitRace"]
if thisUnit == nil then thisUnit = "player" end
return select(2,UnitRace(thisUnit))
return select(2, UnitRace(thisUnit))
end
-- Reaction
unit.reaction = function(thisUnit,playerUnit)
unit.reaction = function(thisUnit, playerUnit)
local GetUnitReaction = br["GetUnitReaction"]
if playerUnit == nil then playerUnit = "player" end
return GetUnitReaction(thisUnit,playerUnit)
return GetUnitReaction(thisUnit, playerUnit)
end
-- Resting
unit.resting = function()
Expand Down Expand Up @@ -344,17 +344,17 @@ br.api.unit = function(self)
return br.hasThreat(thisUnit)
end
-- Time Till Death
unit.ttd = function(thisUnit,percent)
unit.ttd = function(thisUnit, percent)
if thisUnit == nil then thisUnit = "target" end
return br.getTTD(thisUnit,percent) or 0
return br.getTTD(thisUnit, percent) or 0
end
-- Time Till Death Group
unit.ttdGroup = function(range,percent)
unit.ttdGroup = function(range, percent)
if range == nil then range = 5 end
local enemies = self.enemies.get(range)
local groupTTD = 0
for i = 1, #enemies do
groupTTD = groupTTD + unit.ttd(enemies[i],percent)
groupTTD = groupTTD + unit.ttd(enemies[i], percent)
end
return groupTTD
end
Expand All @@ -371,14 +371,14 @@ br.api.unit = function(self)
unit.weaponImbue = unit.weaponImbue or {}

-- Weapon Imbue Exists
unit.weaponImbue.exists = function(imbueId,offHand)
unit.weaponImbue.exists = function(imbueId, offHand)
local GetWeaponEnchantInfo = br._G["GetWeaponEnchantInfo"]
local hasMain, _, _, mainId, hasOff, _, _, offId = GetWeaponEnchantInfo()
if offHand == nil then offHand = false end
if type(imbueId) == "table" then
for i=1,#imbueId do
if (offHand and hasOff) and offId==imbueId[i] then return true end
if (not offHand and hasMain) and mainId==imbueId[i] then return true end
for i = 1, #imbueId do
if (offHand and hasOff) and offId == imbueId[i] then return true end
if (not offHand and hasMain) and mainId == imbueId[i] then return true end
end
return false
end
Expand All @@ -390,20 +390,20 @@ br.api.unit = function(self)
return false
end
-- Weapon Imbue Remains
unit.weaponImbue.remain = function(imbueId,offHand)
unit.weaponImbue.remain = function(imbueId, offHand)
local GetWeaponEnchantInfo = br._G["GetWeaponEnchantInfo"]
local _, mainExp, _, _, _, offExp = GetWeaponEnchantInfo()
local timeRemain = 0
if offHand and unit.weaponImbue.exists(imbueId,true) then timeRemain = offExp - br._G.GetTime() end
if offHand and unit.weaponImbue.exists(imbueId, true) then timeRemain = offExp - br._G.GetTime() end
if not offHand and unit.weaponImbue.exists(imbueId) then timeRemain = mainExp - br._G.GetTime() end
return timeRemain > 0 and timeRemain or 0
end
-- Weapon Imbue Charges
unit.weaponImbue.charges = function(imbueId,offHand)
unit.weaponImbue.charges = function(imbueId, offHand)
local GetWeaponEnchantInfo = br._G["GetWeaponEnchantInfo"]
local _, _, mainCharges, _, _, _, offCharges = GetWeaponEnchantInfo()
if offHand and unit.weaponImbue.exists(imbueId,true) then return offCharges end
if offHand and unit.weaponImbue.exists(imbueId, true) then return offCharges end
if not offHand and unit.weaponImbue.exists(imbueId) then return mainCharges end
return 0
end
end
end
10 changes: 5 additions & 5 deletions System/Functions/Spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -326,19 +326,19 @@ function br.isSpellInSpellbook(spellID, spellType)
end

function br.getSpellInSpellBook(spellID, spellType)
for i = 1, C_SpellBook.GetNumSpellBookSkillLines() do
local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(i)
for i = 1, br._G.C_SpellBook.GetNumSpellBookSkillLines() do
local skillLineInfo = br._G.C_SpellBook.GetSpellBookSkillLineInfo(i)
local offset, numSlots = skillLineInfo.itemIndexOffset, skillLineInfo.numSpellBookItems
for j = offset + 1, offset + numSlots do
local spellBookItemInfo = C_SpellBook.GetSpellBookItemInfo(j,
local spellBookItemInfo = br._G.C_SpellBook.GetSpellBookItemInfo(j,
(spellType == "pet" and Enum.SpellBookSpellBank.Pet or Enum.SpellBookSpellBank.Player))
local spellType, id = spellBookItemInfo.itemType, spellBookItemInfo.actionID
local spellName
if spellType == Enum.SpellBookItemType.Spell then
spellName = C_Spell.GetSpellName(id)
spellName = br._G.C_Spell.GetSpellName(id)
spellType = "Spell"
elseif spellType == Enum.SpellBookItemType.FutureSpell then
spellName = C_Spell.GetSpellName(id)
spellName = br._G.C_Spell.GetSpellName(id)
spellType = "Future Spell"
elseif spellType == Enum.SpellBookItemType.Flyout then
spellName = GetFlyoutInfo(id)
Expand Down
36 changes: 21 additions & 15 deletions System/engines/HealingEngineFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function br.pulseNovaDebug()
local DiesalGUI = br._G.LibStub("DiesalGUI-1.0")
function br.ui:createBar(parent, option, unit, tooltip, tooltipSpin)
local value, text, statusMin, statusMax = option.name, option.status, option.statusMin, option.statusMax
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
local newHPBar = DiesalGUI:Create("Bar")
parent = parent or {}
--print(newHPBar)
Expand Down Expand Up @@ -116,18 +116,18 @@ function br.pulseNovaDebug()
newHPBar:SetEventListener(
"OnEnter",
function(this, event)
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:SetOwner(br._G.Minimap, "ANCHOR_CURSOR", 50, 50)
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:SetText(tooltip, 214 / 255, 25 / 255, 25 / 255)
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:Show()
end
)
newHPBar:SetEventListener(
"OnLeave",
function(this, event)
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:Hide()
end
)
Expand All @@ -147,7 +147,8 @@ function br.pulseNovaDebug()
if br._G[parent .. value .. "Nova"] == nil then
local scale = 1 --br.data.settings.optionsFrame.scale or 1
local currentValue = _G[parent .. value .. "Nova"]:GetValue()
_G[parent .. value .. "Nova"] = br._G.CreateFrame("StatusBar", br._G[parent .. value .. "Nova"], br._G.UIParent, "BackdropTemplate")
_G[parent .. value .. "Nova"] = br._G.CreateFrame("StatusBar", br._G[parent .. value .. "Nova"],
br._G.UIParent, "BackdropTemplate")
_G[parent .. value .. "Nova"]:SetWidth(width * scale)
_G[parent .. value .. "Nova"]:SetHeight(height * scale)
_G[parent .. value .. "Nova"]:SetPoint("TOPLEFT", x * scale, (y - 2) * scale)
Expand All @@ -162,7 +163,7 @@ function br.pulseNovaDebug()
_G[parent .. value .. "Nova"]:SetScript(
"OnEnter",
function(self)
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:SetOwner(self, "BOTTOMLEFT", 225, 5)
local thisUnit = br.friend[value]
if thisUnit then
Expand All @@ -172,16 +173,19 @@ function br.pulseNovaDebug()
color = "|cff" .. br.classColors[i].hex
end
end
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:SetText(
color .. "Name: " .. thisUnit.name .. "\n|cffFF1100Health: " .. math.floor(thisUnit.hp) .. "\n|cff11A7DFRole: " .. thisUnit.role,
color ..
"Name: " ..
thisUnit.name ..
"\n|cffFF1100Health: " .. math.floor(thisUnit.hp) .. "\n|cff11A7DFRole: " .. thisUnit.role,
nil,
nil,
nil,
nil,
true
)
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:Show()
end
end
Expand All @@ -190,7 +194,7 @@ function br.pulseNovaDebug()
_G[parent .. value .. "Nova"]:SetScript(
"OnLeave",
function(self)
---@diagnostic disable-next-line: undefined-field
---@diagnostic disable-next-line: undefined-field
br._G.GameTooltip:Hide()
end
)
Expand All @@ -206,7 +210,8 @@ function br.pulseNovaDebug()
end
)
-- text
_G[parent .. value .. "NovaText"] = br._G[parent .. value .. "Nova"]:CreateFontString(_G[parent .. value .. "NovaText"], "ARTWORK")
_G[parent .. value .. "NovaText"] = br._G[parent .. value .. "Nova"]:CreateFontString(
_G[parent .. value .. "NovaText"], "ARTWORK")
_G[parent .. value .. "NovaText"]:SetWidth(width * scale)
_G[parent .. value .. "NovaText"]:SetHeight(height * scale)
_G[parent .. value .. "NovaText"]:SetPoint("CENTER", 0, -2)
Expand All @@ -220,6 +225,7 @@ function br.pulseNovaDebug()
br.nNovaDebug[#br.nNovaDebug + 1] = parent .. value .. "Nova"
end
end

local novaUnits = #br.friend
if novaUnits > 5 then
novaUnits = 5
Expand All @@ -246,7 +252,7 @@ function br.pulseNovaDebug()
-- frameCreation("healingDebug",200,150,"|cffFF001Ebr.friend")
-- br.ui:createHealingWindow()
for i = 1, 5 do
local thisOption = {name = i, status = 100, statusMin = 0, statusMax = 100, unit = "thisUnit"}
local thisOption = { name = i, status = 100, statusMin = 0, statusMax = 100, unit = "thisUnit" }
-- br.ui.window.healing:AddMessage(thisOption)
br.createNovaStatusBar("healing", thisOption, 10, -i * 25, 180, 20)
--br.ui:createBar("healing", thisOption, thisOption.unit, tooltip, tooltipSpin)
Expand Down Expand Up @@ -277,7 +283,8 @@ function br.pulseNovaDebug()
_G[thisDebugRow]:SetValue(thisUnit.hp)
_G[thisDebugRow .. "Text"]:SetText(math.floor(thisUnit.hp))
if br.classColors[class] ~= nil then
_G[thisDebugRow]:SetStatusBarTexture(br.classColors[class].R, br.classColors[class].G, br.classColors[class].B)
_G[thisDebugRow]:SetStatusBarTexture(br.classColors[class].R, br.classColors[class].G,
br.classColors[class].B)
else
_G[thisDebugRow]:SetStatusBarTexture(1, 1, 1)
end
Expand Down Expand Up @@ -310,4 +317,3 @@ end
-- elseif br.ui.window['debug']['parent'] and br.data.settings[br.selectedSpec]["debug"].active == true then
-- br.ui:closeWindow("debug")
-- end

2 changes: 1 addition & 1 deletion Unlockers/nn.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: param-type-mismatch, undefined-global
--------------------------------------------------------------------------------------------------------------------------------
-- unlockList
--------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -450,7 +451,6 @@ function br.unlock:NNUnlock()
b.GetKeyState = GetKeyState
b.UnitFacing = b.ObjectFacing
b.ObjectInteract = b.InteractUnit
b.IsHackEnabled = function(...) return false end
b.AuraUtil = {}
b.AuraUtil.FindAuraByName = function(name, unit, filter)
-- return Eval("AuraUtil.FindAuraByName("..table.concat({...}, ", ")..")", "")
Expand Down
Loading

0 comments on commit 90e7e7c

Please sign in to comment.