Skip to content

Commit a6e86a3

Browse files
committed
System - NN Fixes and Cleanup
1 parent c6e5ca3 commit a6e86a3

File tree

2 files changed

+28
-141
lines changed

2 files changed

+28
-141
lines changed

System/Functions/Spell.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ end
362362
-- if br.isKnown(106832) then
363363
function br.isKnown(spellID)
364364
local _, _, spellInBookType = br.getSpellInSpellBook(spellID)
365-
return spellID ~= nil and
366-
(spellInBookType ~= nil or br._G.IsPlayerSpell(tonumber(spellID))
367-
or br._G.IsSpellKnown(spellID) or spellInBookType == "Spell")
365+
return spellID ~= nil and spellInBookType ~= "Future Spell" and
366+
( --[[spellInBookType ~= nil or]] br._G.IsPlayerSpell(tonumber(spellID))
367+
or br._G.IsSpellKnown(spellID)) -- or spellInBookType == "Spell")
368368
end
369369

370370
function br.isActiveEssence(spellID)

Unlockers/nn.lua

Lines changed: 25 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ local globalCacheList =
126126
"GetPartyAssignment",
127127
"GetPlayerInfoByGUID",
128128
"GetPositionFromPosition",
129+
"GetRaidTargetIndex",
129130
"GetReadyCheckStatus",
130131
"GetUnitName",
132+
"GetUnitSpeed",
131133
"InitiateTrade",
132134
"IsItemInRange",
133135
"IsSpellInRange",
@@ -196,6 +198,7 @@ local globalCacheList =
196198
"UnitIsPVPFreeForAll",
197199
"UnitIsPVPSanctuary",
198200
"UnitIsSameServer",
201+
"UnitIsTapDenied",
199202
"UnitIsTrivial",
200203
"UnitIsUnit",
201204
"UnitIsVisible",
@@ -206,6 +209,8 @@ local globalCacheList =
206209
"UnitPlayerControlled",
207210
"UnitPlayerOrPetInParty",
208211
"UnitPlayerOrPetInRaid",
212+
"UnitPower",
213+
"UnitPowerMax",
209214
"UnitPowerType",
210215
"UnitPVPName",
211216
"UnitRace",
@@ -271,24 +276,29 @@ for i = 1, #globalCacheList do
271276
local func = globalCacheList[i]
272277
globalFuncCopies[func] = _G[func]
273278
end
279+
274280
-- print("NN File Called")
275281
function br.unlock:NNUnlock()
276282
if not C_Timer.Nn then return false end
277283
setfenv(1, C_Timer.Nn)
278284
-- print("NN Api Loaded")
285+
279286
--------------------------------
280287
-- API unlocking
281288
--------------------------------
289+
---
282290
for k, v in pairs(funcCopies) do
283291
b[k] = function(...) return Unlock(k, ...) end
284292
end
293+
285294
for _, v in pairs(globalCacheList) do
286295
if C_Timer.Nn[v] == nil then
287296
print("Function: " .. tostring(v) .. ", was not provided.")
288297
else
289298
b[v] = C_Timer.Nn[v]
290299
end
291300
end
301+
292302
for k, v in pairs(globalFuncCopies) do
293303
if not b[k] then
294304
b[k] = function(...) return v(...) end
@@ -343,31 +353,31 @@ function br.unlock:NNUnlock()
343353
return ObjectID(unit)
344354
end
345355

346-
-- b.UnitTarget = function(unit)
347-
-- return UnitTarget(unit)
348-
-- end
349356
b.UnitCreator = function(unit)
350357
return UnitCreator(unit)
351358
end
359+
352360
b.UnitBoundingRadius = function(unit)
353361
return ObjectBoundingRadius(unit)
354362
end
363+
355364
b.UnitCombatReach = function(unit)
356365
return CombatReach(unit)
357366
end
358367

359-
360368
--------------------------------
361369
-- API conversions
362370
--------------------------------
363371
b.GetWoWDirectory = function()
364372
return "\\scripts"
365373
end
374+
366375
local om = {}
367376
b.GetObjectCount = function()
368377
om = Objects()
369378
return #Objects()
370379
end
380+
371381
b.GetObjectWithIndex = function(index)
372382
return om[index]
373383
end
@@ -382,6 +392,7 @@ function br.unlock:NNUnlock()
382392
local castGUID = b.UnitTarget(select(1, ...))
383393
return spellId1, spellId2, castGUID, castGUID
384394
end
395+
385396
b.GetDirectoryFiles = function(...)
386397
local str = ...
387398
if str == nil or str == "*" then return "" end
@@ -412,9 +423,11 @@ function br.unlock:NNUnlock()
412423
SetPlayerFacing(arg)
413424
end
414425
end
426+
415427
b.GetObjectWithGUID = function(...)
416428
return ...
417429
end
430+
418431
b.IsHackEnabled = function(...) return false end
419432

420433
--------------------------------
@@ -430,10 +443,12 @@ function br.unlock:NNUnlock()
430443
return 0, 0
431444
end
432445
end
446+
433447
b.GetPositionBetweenPositions = function(X1, Y1, Z1, X2, Y2, Z2, DistanceFromPosition1)
434448
local AngleXY, AngleXYZ = b.GetAnglesBetweenPositions(X1, Y1, Z1, X2, Y2, Z2)
435449
return b.GetPositionFromPosition(X1, Y1, Z1, DistanceFromPosition1, AngleXY, AngleXYZ)
436450
end
451+
437452
b.GetPositionBetweenObjects = function(unit1, unit2, DistanceFromPosition1)
438453
local X1, Y1, Z1 = b.ObjectPosition(unit1)
439454
local X2, Y2, Z2 = b.ObjectPosition(unit2)
@@ -450,12 +465,8 @@ function br.unlock:NNUnlock()
450465
degrees = degrees and b.rad(degrees) / 2 or math.pi / 2
451466
return ShortestAngle < degrees
452467
end
468+
453469
------------------------- Miscellaneous -------------------
454-
-- b.AuraUtil = {}
455-
-- b.AuraUtil.FindAuraByName = function(name, unit, filter)
456-
-- -- return Eval("AuraUtil.FindAuraByName("..table.concat({...}, ", ")..")", "")
457-
-- return AuraUtil.FindAuraByName(name, ObjectUnit(unit), filter)
458-
-- end
459470
b.ObjectIsGameObject = function(...)
460471
local ObjType = ObjectType(...)
461472
return ObjType == 8 or ObjType == 11
@@ -468,157 +479,33 @@ function br.unlock:NNUnlock()
468479
return
469480
end
470481
end
482+
471483
b.InteractUnit = function(unit)
472484
return ObjectInteract(Object(unit))
473485
end
486+
474487
------------------------------------------
475488
--- API - Unit Function Object Handler ---
476489
------------------------------------------
477-
-- b.CastSpellByName = function(spell, unit)
478-
-- return Unlock("CastSpellByName(\""..spell.."\", \""..ObjectUnit(unit).."\")", "")
479-
-- end
480-
b.GetRaidTargetIndex = function(...)
481-
return GetRaidTargetIndex(ObjectUnit(...))
482-
end
483-
b.GetUnitSpeed = function(...)
484-
return GetUnitSpeed(ObjectUnit(...))
485-
end
486-
b.InSpellInRange = function(spell, unit)
487-
return C_Spell.IsSpellInRange(spell, ObjectUnit(unit))
488-
end
489-
b.UnitAffectingCombat = function(...)
490-
return UnitAffectingCombat(ObjectUnit(...))
491-
end
492-
b.UnitAttackSpeed = function(...)
493-
return UnitAttackSpeed(ObjectUnit(...))
494-
end
495490
b.UnitAura = function(unit, index, filter)
496491
return C_UnitAuras.GetAuraDataByIndex(ObjectUnit(unit), index, filter)
497492
end
493+
498494
b.UnitBuff = function(unit, index, filter)
499495
return C_UnitAuras.GetBuffDataByIndex(ObjectUnit(unit), index, filter)
500496
end
501-
b.UnitCanAttack = function(unit1, unit2)
502-
return UnitCanAttack(ObjectUnit(unit1), ObjectUnit(unit2))
503-
end
504-
b.UnitCastingInfo = function(...)
505-
return UnitCastingInfo(ObjectUnit(...))
506-
end
507-
b.UnitChannelInfo = function(...)
508-
return UnitChannelInfo(ObjectUnit(...))
509-
end
510-
b.UnitClass = function(...)
511-
return UnitClass(ObjectUnit(...))
512-
end
513-
b.UnitClassification = function(...)
514-
return UnitClassification(ObjectUnit(...))
515-
end
516-
b.UnitCreatureFamily = function(...)
517-
return UnitCreatureFamily(ObjectUnit(...))
518-
end
519-
b.UnitCreatureType = function(...)
520-
return UnitCreatureType(ObjectUnit(...))
521-
end
497+
522498
b.UnitDebuff = function(unit, index, filter)
523499
return C_UnitAuras.GetDebuffDataByIndex(ObjectUnit(unit), index, filter)
524500
end
525-
b.UnitExists = function(...)
526-
return UnitExists(ObjectUnit(...))
527-
end
528-
b.UnitGetIncomingHeals = function(unit1, unit2)
529-
return UnitGetIncomingHeals(ObjectUnit(unit1), ObjectUnit(unit2))
530-
end
531-
b.UnitGUID = function(...)
532-
return UnitGUID(ObjectUnit(...))
533-
end
534-
b.UnitHealth = function(...)
535-
return UnitHealth(ObjectUnit(...))
536-
end
537-
b.UnitHealthMax = function(...)
538-
return UnitHealthMax(ObjectUnit(...))
539-
end
540-
b.UnitLevel = function(...)
541-
return UnitLevel(ObjectUnit(...))
542-
end
543-
b.UnitName = function(...)
544-
return UnitName(ObjectUnit(...))
545-
end
546-
b.UnitInParty = function(...)
547-
return UnitInParty(ObjectUnit(...))
548-
end
549-
b.UnitInRaid = function(...)
550-
return UnitInRaid(ObjectUnit(...))
551-
end
552-
b.UnitInRange = function(...)
553-
return UnitInRange(ObjectUnit(...))
554-
end
555-
b.UnitIsCharmed = function(...)
556-
return UnitIsCharmed(ObjectUnit(...))
557-
end
558-
b.UnitIsConnected = function(...)
559-
return UnitIsConnected(ObjectUnit(...))
560-
end
561-
b.UnitIsDeadOrGhost = function(...)
562-
return UnitIsDeadOrGhost(ObjectUnit(...))
563-
end
564-
b.UnitIsEnemy = function(unit1, unit2)
565-
return UnitIsEnemy(ObjectUnit(unit1), ObjectUnit(unit2))
566-
end
567-
b.UnitIsFriend = function(unit1, unit2)
568-
return UnitIsFriend(ObjectUnit(unit1), ObjectUnit(unit2))
569-
end
570-
b.UnitIsPlayer = function(...)
571-
return UnitIsPlayer(ObjectUnit(...))
572-
end
573-
b.UnitIsUnit = function(unit1, unit2)
574-
return UnitIsUnit(ObjectUnit(unit1), ObjectUnit(unit2))
575-
end
576-
b.UnitIsVisible = function(...)
577-
return UnitIsVisible(ObjectUnit(...))
578-
end
579-
b.UnitOnTaxi = function(...)
580-
return UnitOnTaxi(ObjectUnit(...))
581-
end
582-
b.UnitPhaseReason = function(...)
583-
return UnitPhaseReason(ObjectUnit(...))
584-
end
585-
b.UnitPower = function(unit, powerType)
586-
return UnitPower(ObjectUnit(unit), powerType)
587-
end
588-
b.UnitPowerMax = function(unit, powerType)
589-
return UnitPowerMax(ObjectUnit(unit), powerType)
590-
end
591-
b.UnitRace = function(...)
592-
return UnitRace(ObjectUnit(...))
593-
end
594-
b.UnitReaction = function(unit1, unit2)
595-
return UnitReaction(ObjectUnit(unit1), ObjectUnit(unit2))
596-
end
597-
b.UnitStat = function(unit, statIndex)
598-
return UnitStat(ObjectUnit(unit), statIndex)
599-
end
600-
b.UnitIsTapDenied = function(...)
601-
return UnitIsTapDenied(ObjectUnit(...))
602-
end
603-
b.UnitThreatSituation = function(unit1, unit2)
604-
return UnitThreatSituation(ObjectUnit(unit1), ObjectUnit(unit2))
605-
end
606-
b.UnitIsTrivial = function(...)
607-
return UnitIsTrivial(ObjectUnit(...))
608-
end
609501

610502
--------------------------------
611503
-- extra APIs
612504
--------------------------------
613-
-- b.AuraUtil = {}
614-
-- b.AuraUtil.FindAuraByName = _G.AuraUtil["FindAuraByName"]
615-
-- b.ObjectIsGameObject = function(...)
616-
-- local ObjType = ObjectType(...)
617-
-- return ObjType == 8 or ObjType == 11
618-
-- end
619505
b.GetMapId = function()
620506
return select(8, b.GetInstanceInfo())
621507
end
508+
622509
--------------------------------
623510
-- missing APIs
624511
--------------------------------

0 commit comments

Comments
 (0)