Skip to content

Commit 3726afb

Browse files
committed
Small improvement to locals in FindPotentialAllies
1 parent 613fd0c commit 3726afb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

PvpAlerts/PvpAlerts_KOS_System.lua

+11-8
Original file line numberDiff line numberDiff line change
@@ -845,16 +845,19 @@ end
845845

846846
function PVP:FindPotentialAllies()
847847
local currentTime = GetFrameTimeMilliseconds()
848+
local showPlayerNotes = self.SV.showPlayerNotes
849+
local showFriends = self.SV.showFriends
850+
local showGuildMates = self.SV.showGuildMates
848851

849852
for k, v in pairs(self.idToName) do
850853
local playerDbRecord = self.SV.playersDB[v]
851854
if playerDbRecord then
852855
local isCool = self:FindAccInCOOL(v, playerDbRecord.unitAccName)
853856
local isPlayerGrouped = IsPlayerInGroup(v)
854-
local playerNote = self.SV.showPlayerNotes and self.SV.playerNotes[playerDbRecord.unitAccName] or nil
855-
local hasPlayerNote = (playerNote ~= nil) and (playerNote ~= "")
856-
local isFriend = self.SV.showFriends and IsFriend(v) or false
857-
local isGuildmate = self.SV.showGuildMates and IsGuildMate(v) or false
857+
local playerNote = showPlayerNotes and self.SV.playerNotes[playerDbRecord.unitAccName] or nil
858+
local hasPlayerNote = showPlayerNotes and (playerNote ~= nil) and (playerNote ~= "")
859+
local isFriend = showFriends and IsFriend(v) or false
860+
local isGuildmate = showGuildMates and IsGuildMate(v) or false
858861
if hasPlayerNote or ((not isPlayerGrouped) and (isCool or isFriend or isGuildmate)) then
859862
self.potentialAllies[v] = {
860863
currentTime = currentTime,
@@ -877,17 +880,17 @@ function PVP:FindPotentialAllies()
877880
if playerDbRecord then
878881
local isPlayerGrouped = IsPlayerInGroup(k)
879882
local isCool = self:FindAccInCOOL(k, playerDbRecord.unitAccName)
880-
local playerNote = self.SV.showPlayerNotes and self.SV.playerNotes[playerDbRecord.unitAccName] or nil
881-
local hasPlayerNote = (playerNote ~= nil) and (playerNote ~= "")
883+
local playerNote = showPlayerNotes and self.SV.playerNotes[playerDbRecord.unitAccName] or nil
884+
local hasPlayerNote = showPlayerNotes and (playerNote ~= nil) and (playerNote ~= "")
882885
local isFriend = showFriends and IsFriend(v) or false
883-
local isGuildmate = self.SV.showGuildMates and IsGuildMate(v) or false
886+
local isGuildmate = showGuildMates and IsGuildMate(v) or false
884887
if hasPlayerNote or ((not isPlayerGrouped) and (isCool or isFriend or isGuildmate)) then
885888
self.potentialAllies[k] = {
886889
currentTime = currentTime,
887890
unitAccName = playerDbRecord.unitAccName,
888891
unitAlliance = playerDbRecord.unitAlliance,
889892
isPlayerGrouped = isPlayerGrouped,
890-
isFriend = self.SV.showFriends and isFriend,
893+
isFriend = isFriend,
891894
isGuildmate = isGuildmate,
892895
isCool = isCool,
893896
playerNote = hasPlayerNote and playerNote or nil,

0 commit comments

Comments
 (0)