-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImperialization.lua
More file actions
39 lines (31 loc) · 1.19 KB
/
Imperialization.lua
File metadata and controls
39 lines (31 loc) · 1.19 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
local settings = nil
local function OnInventorySlotUpdate(eventCode, bagID, slotID)
local convert = nil
if settings:ShouldConvertOnEquip() then
convert = BAG_WORN
else
convert = BAG_BACKPACK
end
if bagID == convert then
if CanConvertItemStyleToImperial(bagID, slotID) then
local itemStyle = select(7, GetItemInfo(bagID, slotID))
local itemStyleString = GetString("SI_ITEMSTYLE", itemStyle)
if settings:ShouldConvertStyle(itemStyleString) then
if settings:ShouldDisplayResults() then
d(zo_strformat("<<t:1>> converted from the <<2>> style!", GetItemLink(bagID, slotID,
LINK_STYLE_BRACKETS), itemStyleString))
end
ConvertItemStyleToImperial(bagID, slotID)
end
end
end
end
local function ImperializationLoaded(eventCode, addonName)
if addonName ~= "Imperialization" then return end
EVENT_MANAGER:UnregisterForEvent("ImperializationLoaded", EVENT_ADD_ON_LOADED)
settings = ImperializationSettings:New()
EVENT_MANAGER:RegisterForEvent("ImperializationOnInvSlotUpdated",
EVENT_INVENTORY_SINGLE_SLOT_UPDATE, OnInventorySlotUpdate)
d("Imperialization loaded.")
end
EVENT_MANAGER:RegisterForEvent("ImperializationLoaded", EVENT_ADD_ON_LOADED, ImperializationLoaded)