-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuildlist.lua
More file actions
73 lines (58 loc) · 2.35 KB
/
Guildlist.lua
File metadata and controls
73 lines (58 loc) · 2.35 KB
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
do
-- table of players
local players = {}
local function GuildRosterUpdate(self)
local time = GetTime()
-- Loop through every member, online and offline
for i = 1, GetNumGuildMembers(true), 1 do
local name, _, rank, _, _, _, _, note, online = GetGuildRosterInfo(i)
name = name:lower()
-- Save the player's rank and officer note to the ranks table
players[name] = {rank, note, online}
-- Player is on waitlist
if EPGPWaitlist.waitlist:IsWaitlisted(name) then
if online then
EPGPWaitlist.waitlist:UpdatePlayerStatus(name, time, true)
else
EPGPWaitlist.waitlist:UpdatePlayerStatus(name, time)
end
-- Player is on an alt and on waitlist
elseif EPGPWaitlist.config:IsAltRank(rank) and EPGPWaitlist.waitlist:IsWaitlisted(note:lower()) and online then
EPGPWaitlist.waitlist:UpdatePlayerStatus(note:lower(), time, true, true, name)
end
end
end
local function IsAlt(self, name)
return EPGPWaitlist.config:IsAltRank(players[name][1])
end
local function IsGuildMember(self, name)
if players[name] ~= nil then
return true
end
return false
end
local function GetAltsMain(self, altName)
-- Checks if alt is in the guild
assert(players[altName], EPGPWaitlist:Capitalize(altName) .. " is not in the guild.")
-- Checks if the player is an alt
assert(self:IsAlt(altName), EPGPWaitlist:Capitalize(altName) .. " is not an alt.")
-- Get the main player's name
local note = players[altName][2]:lower()
-- Checks if the main player is in the guild
assert(players[note], EPGPWaitlist:Capitalize(note) .. " is not in the guild.")
return note
end
local function GetOnlineStatus(self, name)
return players[name][3]
end
function EPGPWaitlist:Guildlist()
local obj = {
GuildRosterUpdate = GuildRosterUpdate,
IsAlt = IsAlt,
IsGuildMember = IsGuildMember,
GetAltsMain = GetAltsMain,
GetOnlineStatus = GetOnlineStatus
}
return obj
end
end