comparison PVPScan.lua @ 3:1c0f88ab78b7

Fixed class detection.
author tercio
date Sun, 01 Jun 2014 22:52:51 -0300
parents f2456f1454af
children 16590718738a
comparison
equal deleted inserted replaced
2:f2456f1454af 3:1c0f88ab78b7
1 1
2 PVPScan = LibStub ("AceAddon-3.0"):NewAddon ("PVPScan", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0") 2 PVPScan = LibStub ("AceAddon-3.0"):NewAddon ("PVPScan", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0")
3 3
4 local PVPScan = PVPScan
4 local LDB = LibStub ("LibDataBroker-1.1", true) 5 local LDB = LibStub ("LibDataBroker-1.1", true)
5 local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true) 6 local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true)
6 local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") 7 local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
7 8
8 local _bit_band = bit.band 9 local _bit_band = bit.band
284 if (PVPScan.NeedClass [who_name]) then 285 if (PVPScan.NeedClass [who_name]) then
285 local class = PVPScan:GuessClass (...) 286 local class = PVPScan:GuessClass (...)
286 if (class) then 287 if (class) then
287 PVPScan:UpdateBar (PVPScan.SpotBars [PVPScan.CurrentShownPlayers [who_name]], who_name, class, true) 288 PVPScan:UpdateBar (PVPScan.SpotBars [PVPScan.CurrentShownPlayers [who_name]], who_name, class, true)
288 PVPScan.NeedClass [who_name] = nil 289 PVPScan.NeedClass [who_name] = nil
289 end
290 return
291 end
292
293 if (PVPScan.NeedClass [target_name]) then
294 local class = PVPScan:GuessClass (...)
295 if (class) then
296 PVPScan:UpdateBar (PVPScan.SpotBars [PVPScan.CurrentShownPlayers [target_name]], target_name, class, true)
297 PVPScan.NeedClass [target_name] = nil
298 end 290 end
299 return 291 return
300 end 292 end
301 293
302 if (not PVPScan.CurrentShownPlayers [target_name] and _bit_band (target_flags, OBJECT_TYPE_PLAYER) ~= 0) then --> is player 294 if (not PVPScan.CurrentShownPlayers [target_name] and _bit_band (target_flags, OBJECT_TYPE_PLAYER) ~= 0) then --> is player
639 631
640 function PVPScan:GuessClass (...) 632 function PVPScan:GuessClass (...)
641 local arg1, arg2, arg3, arg4 = select (1, ...) 633 local arg1, arg2, arg3, arg4 = select (1, ...)
642 634
643 if (type (arg1) == "number") then 635 if (type (arg1) == "number") then
644 if (PVPScan.ClassSpellList [arg1]) then 636 return PVPScan.ClassSpellList [arg1]
645 return PVPScan.ClassSpellList [arg1]
646 end
647 end 637 end
648 638
649 return nil 639 return nil
650 end 640 end
651 641