-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapi.lua
More file actions
45 lines (37 loc) · 1.15 KB
/
api.lua
File metadata and controls
45 lines (37 loc) · 1.15 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
-- Public interfaces for use by other addons all in one place
local _self = PlayerbotsBroker
local _store = PlayerbotsBroker.store
local _broker = PlayerbotsBroker.broker
local function validateName(name)
if name == nil or type(name) ~= "string" or name == "" then
return nil
end
return true
end
function _self.RegisterByName(name)
if not validateName(name) then return end
if _store:RegisterBot(name) then
_broker:DoHandshakeAfterRegistration(name)
end
end
function _self.UnregisterByName(name)
if not validateName(name) then return end
_store:UnregisterBot(name)
end
function _self.GetBot(name)
if not validateName(name) then return end
return _store:GetBot(name)
end
function _self.GetBotStatus(name)
if not validateName(name) then return end
return _store:GetBotStatus(name)
end
--- Provide the actual bot table.
--- local bot = GetBot(name)
--- StartQuery(qtype, bot)
function _self.StartQuery(queryType, bot)
_broker:StartQuery(queryType, bot)
end
function _self.GenerateCommand(bot, cmdType, cmdSubtype, arg1, arg2, arg3)
_broker:GenerateCommand(bot, cmdType, cmdSubtype, arg1, arg2, arg3)
end