-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtogglesafeportals.lua
More file actions
28 lines (22 loc) · 1.07 KB
/
Copy pathtogglesafeportals.lua
File metadata and controls
28 lines (22 loc) · 1.07 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
ADDON:ImportAPI(API.X2Option)
ADDON:ImportAPI(API.X2Chat)
local UIC_TOGGLE_SAFE_PORTALS = 9105
local ADDON_NAME = "|ic23895;[" .. locale.addon.chat_name .. "]: "
local option = { isUserChat = true }
local safePortalsEnabled = X2Option:GetOptionItemValue(OIT_AUTO_USE_ONLY_MY_PORTAL)
ADDON:RegisterContentTriggerFunc(UIC_TOGGLE_SAFE_PORTALS, function(show, data)
safePortalsEnabled = X2Option:GetOptionItemValue(OIT_AUTO_USE_ONLY_MY_PORTAL)
if safePortalsEnabled == 1 then
X2Option:SetItemFloatValue(OIT_AUTO_USE_ONLY_MY_PORTAL, 0)
X2Chat:DispatchChatMessage(CMF_SYSTEM, ADDON_NAME .. locale.addon.disabled, option)
else
X2Option:SetItemFloatValue(OIT_AUTO_USE_ONLY_MY_PORTAL, 1)
X2Chat:DispatchChatMessage(CMF_SYSTEM, ADDON_NAME .. locale.addon.enabled, option)
end
safePortalsEnabled = X2Option:GetOptionItemValue(OIT_AUTO_USE_ONLY_MY_PORTAL)
ADDON:UpdateEscMenuButton(UIC_TOGGLE_SAFE_PORTALS, safePortalsEnabled, "")
end)
ADDON:AddEscMenuButton(5, UIC_TOGGLE_SAFE_PORTALS, "info", locale.addon.name, {}, {
buttonType = 2,
buttonValue = safePortalsEnabled
})