forked from Romain-P/Ewt-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared_units.lua
94 lines (84 loc) · 2.19 KB
/
shared_units.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
-- Created by romain-p
-- see updates on http://github.com/romain-p
if not shared_units then
shared_units = true
enemy = "enemy"
ally = "ally"
target = "target"
party1 = "party1"
party1pet = "party1pet"
party2 = "party2"
party2pet = "party2pet"
party3 = "party3"
party3pet = "party3pet"
player = "player"
pet = "pet"
arena1 = "arena1"
arena2 = "arena2"
arena3 = "arena3"
arenapet1 = "arenapet1"
arenapet2 = "arenapet2"
arenapet3 = "arenapet3"
player_name = UnitName(player)
player_unit = GetObjectWithGUID(UnitGUID(player))
player_class = select(2, UnitClass(player))
Party = {
"party1",
"party2",
"party3",
"party1pet",
"party2pet",
"party3pet"
}
PartyAndMe = {
"player",
"party1",
"party2",
"party3",
"party1pet",
"party2pet",
"party3pet"
}
ArenaEnemies = {
"arenapet1",
"arenapet2",
"arenapet3",
"arena1",
"arena2",
"arena1pet",
"arena2pet",
"arena3pet",
"target",
"mouseover",
"focus",
}
WorldEnemies = {
"target",
"targettarget",
"focustarget",
"focus",
"mouseover"
}
ArenaMode = {
V3 = 1,
V2 = 2,
V1 = 3
}
-- Return true if the player is playing in Arena
-- Define the mode if needed (ArenaMode.V1/V2/V3)
function IsArena(mode)
local inArena = select(1, IsActiveBattlefieldArena()) == 1
return inArena and (not mode
or (mode == ArenaMode.V1 and UnitExists(arena1)) == 1
or (mode == ArenaMode.V2 and UnitExists(arena1) and UnitExists(arena2))
or (mode == ArenaMode.V3 and UnitExists(arena1) and UnitExists(arena2) and UnitExists(arena3)) == 1)
end
-- Return an enemy array depending on the current area of the player
function GetEnemies()
if IsArena() then
return ArenaEnemies
else
return WorldEnemies
end
end
end