Skip to content

Commit

Permalink
System - Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteOne committed May 26, 2024
1 parent a1f2e0b commit 67f859f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 32 deletions.
35 changes: 13 additions & 22 deletions Rotations/Hunter/Support/PetCuteOne.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local units
local var
local currentTarget
local fetching = false
local lootCount
local paused = false
local pausekey = false
local petAppearTimer = br._G.GetTime()
Expand Down Expand Up @@ -85,16 +86,6 @@ br.rotations.support["PetCuteOne"] = {
return petMode
end

local function getLootableCount()
local count = 0
for k, v in pairs(br.lootable) do
if br.lootable[k] ~= nil and unit.distance(br.lootable[k]) > 8 then
count = count + 1
end
end
return count
end

--Set Pause Key
if br.player.ui.toggle("Pause Mode") or br.player.ui.value("Pause Mode") == 6 then
pausekey = br._G.IsLeftAltKeyDown()
Expand Down Expand Up @@ -157,6 +148,9 @@ br.rotations.support["PetCuteOne"] = {
enemies.get(40, "pet")
enemies.yards40r = enemies.rect.get(10, 40, false)

-- Loot Count
lootCount = br.lootManager:lootCount()

-- Pet Target Modes
if br.petTarget == nil then br.petTarget = "target" end
if br.petTarget ~= "target" and (not unit.exists(br.petTarget) or unit.deadOrGhost(br.petTarget) or (unit.exists("pettarget") and not unit.isUnit("pettarget", br.petTarget))) then
Expand Down Expand Up @@ -251,7 +245,7 @@ br.rotations.support["PetCuteOne"] = {
ui.debug("[Pet] Pet is now Defending")
br._G.PetDefensiveAssistMode()
elseif petMode ~= "Passive" and ((not unit.inCombat() and #enemies.yards20pnc == 0 and not unit.valid(br.petTarget)) or var.haltPetProfile)
and (not spell.fetch.known() or getLootableCount() == 0)
and (not spell.fetch.known() or lootCount == 0)
then
ui.debug("[Pet] Pet is now Passive")
br._G.PetPassiveMode()
Expand Down Expand Up @@ -692,18 +686,15 @@ br.rotations.support["PetCuteOne"] = {
if ui.checked("Fetch") and not unit.inCombat() and not unit.inCombat("pet") and cast.able.fetch("pet") and not cast.current.fetch("pet")
and petExists and not br.deadPet and cast.timeSinceLast.fetch() > unit.gcd(true) * 2 and not buff.playDead.exists("pet")
then
local lootCount = getLootableCount() or 0
if fetching and ( --[[fetchCount ~= lootCount or]] lootCount == 0) then fetching = false end
if fetching and (lootCount == 0) then fetching = false end
if not fetching then
for k, _ in pairs(br.lootable) do
if br.lootable[k] ~= nil then
local thisDistance = unit.distance(k)
if thisDistance > 8 and thisDistance < 40 then
if cast.fetch("pet") then
fetching = true
ui.debug("[Pet] Cast Fetch")
break
end
for _, v in pairs(br.lootable) do
local thisDistance = unit.distance(v.unit)
if thisDistance > 8 and thisDistance < 40 then
if cast.fetch("pet") then
fetching = true
ui.debug("[Pet] Cast Fetch")
break
end
end
end
Expand Down
15 changes: 8 additions & 7 deletions System/API/Equiped.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
local _, br = ...
if br.api == nil then br.api = {} end

br.api.equiped = function(self,item,id)
br.api.equiped = function(self, item, id)
if self[item] == nil then self[item] = {} end
local equiped = self

Expand All @@ -19,7 +19,7 @@ br.api.equiped = function(self,item,id)
if slotID == nil then
return br.hasEquiped(id)
else
return br.hasEquiped(id,slotID)
return br.hasEquiped(id, slotID)
end
end

Expand All @@ -31,11 +31,11 @@ br.api.equiped = function(self,item,id)
-- @return boolean value indicating whether the item with specific ID is equipped in the specified slot (if provided)
-- @usage equipes.item(12345) -- will return true if item with ID 12345 is equipped anywhere
-- @usage equipes.item(12345, 1) -- will return true if item with ID 12345 is equipped in slot 1
equiped.item = function(itemID,slotID)
equiped.item = function(itemID, slotID)
if slotID == nil then
return br.hasEquiped(itemID)
else
return br.hasEquiped(itemID,slotID)
return br.hasEquiped(itemID, slotID)
end
end

Expand All @@ -53,8 +53,9 @@ br.api.equiped = function(self,item,id)
-- @function equiped.tier
-- @param tierLevel string|number The tier level to check for. (e.g. "T20" or 20)
-- @treturn number
equiped.tier = function(tierLevel,numEquiped)
if type(tierLevel) == "number" then tierLevel = "T"..tierLevel end
equiped.tier = function(tierLevel, numEquiped)
if type(tierLevel) == "number" then tierLevel = "T" .. tierLevel end
if numEquiped == nil then return br.TierScan(tierLevel) end
return br.TierScan(tierLevel) >= numEquiped
end

Expand All @@ -69,4 +70,4 @@ br.api.equiped = function(self,item,id)
return IsEquippedItemType(itemType)
end
end
end
end
8 changes: 5 additions & 3 deletions System/Functions/Cast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ function br.createCastFunction(thisUnit, castType, minUnits, effectRng, spellID,
-- Talent Check
local function hasTalent(spellID)
for k, v in pairs(br.player.spells.talents) do
if spellID == v then return br.player.talent[k] end
if spellID == v then return br.player.talent[k] or br.isKnown(spellID) end
end
return true
end
Expand All @@ -741,8 +741,10 @@ function br.createCastFunction(thisUnit, castType, minUnits, effectRng, spellID,
return queensCourtEncounter == nil or (queensCourtEncounter ~= nil and br.lastCastTable.tracker[1] ~= spellID)
end
-- Base Spell Availablility Check
if br.lastCastTable.castTime[spellID] == nil then br.lastCastTable.castTime[spellID] = br._G.GetTime() -
(br.getGlobalCD(true) + (select(3, br._G.GetNetStats()) / 100)) end
if br.lastCastTable.castTime[spellID] == nil then
br.lastCastTable.castTime[spellID] = br._G.GetTime() -
(br.getGlobalCD(true) + (select(3, br._G.GetNetStats()) / 100))
end
if ((baseSpellID == spellID or overrideSpellID == spellID) and (br.empowerID == nil or br.empowerID == 0)
and (br._G.GetTime() - br.lastCastTable.castTime[spellID] > br.getGlobalCD(true) + (select(3, br._G.GetNetStats()) / 100)) --br.getGlobalCD(true)) -- Double Casting Check
and ((thisUnit ~= nil and not br._G.UnitIsUnit(thisUnit, "player") and not br._G.UnitIsFriend(thisUnit, "player")
Expand Down
1 change: 1 addition & 0 deletions System/Lists/Items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ br.lists.items = {
--- Dragonflight Items Below ---
algetharPuzzleBox = 193701,
ashesOfTheEmbersoul = 207167,
beaconToTheBeyond = 203963,
elementalPotionOfUltimatePower = 191383,
integratedPrimalFire = 200868,
irideusFragment = 193743,
Expand Down

0 comments on commit 67f859f

Please sign in to comment.