forked from Rhyono/CraftStore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCraftStore_Events.lua
465 lines (409 loc) · 18.8 KB
/
CraftStore_Events.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
local CS = CraftStoreFixedAndImprovedLongClassName
local LAM = LibAddonMenu2
local EM, WM, SM, ZOSF = EVENT_MANAGER, WINDOW_MANAGER, SCENE_MANAGER, zo_strformat
function CS.OnQuestConditionCounterChanged(eventCode,journalIndex)
CS.UpdateQuest(journalIndex)
end
function CS.OnRecipeLearned(eventCode,list,id)
CS.RecipeLearned(list,id)
CS.BlueprintLearned(list,id)
end
function CS.OnStyleLearned(eventCode, styleIndex, chapterIndex, isDefaultRacialStyle)
CS.UpdateStyleKnowledge(true)
end
function CS.OnSmithingTraitResearchStarted(eventCode, craft, line, trait)
local _,remaining = GetSmithingResearchLineTraitTimes(craft,line,trait)
if remaining then CS.Data.crafting.researched[CS.CurrentPlayer][craft][line][trait] = remaining + GetTimeStamp() end
CS.Account.crafting.stored[craft][line][trait] = {}
CS.UpdateResearchWindows()
CS.UpdatePanelIcon(craft,line,trait)
CS.GetTimer()
end
function CS.OnSmithingTraitResearchChange(eventCode, craft, line, trait)
CS.UpdateResearch()
CS.UpdateResearchWindows()
end
function CS.OnStableInteractEnd(eventCode)
CS.GetTimer()
end
function CS.OnCraftingStationInteract(eventCode,craftSkill)
-- Provisioning level is needed for both the enchanting and provisioning level due to furniture
if CS.Account.options.usecook or CS.Account.options.userune then
if craftSkill == CRAFTING_TYPE_PROVISIONING or craftSkill == CRAFTING_TYPE_ENCHANTING then
CS.Cook.craftLevel = GetNonCombatBonus(NON_COMBAT_BONUS_PROVISIONING_LEVEL)
CS.Cook.qualityLevel = GetNonCombatBonus(NON_COMBAT_BONUS_PROVISIONING_RARITY_LEVEL)
end
end
if CS.Account.options.usecook and craftSkill == CRAFTING_TYPE_PROVISIONING then
CS.CookShowCategory(CS.Character.recipe)
CS.CookShow()
--Update space
CS.InventorySpace(CraftStoreFixed_CookSpaceButtonName)
if not CS.Cook.hooksInitialized and not IsInGamepadPreferredMode() then
ZO_PreHookHandler(ZO_ProvisionerTopLevelTabsButton2,'OnMouseDown', CS.CookFoodTabShow)
ZO_PreHookHandler(ZO_ProvisionerTopLevelTabsButton3,'OnMouseDown', CS.CookDrinkTabShow)
ZO_PreHookHandler(ZO_ProvisionerTopLevelTabsButton4,'OnMouseDown', CS.CookFurnitureTabShow)
CS.Cook.hooksInitialized = true
end
end
if CS.Account.options.userune and craftSkill == CRAFTING_TYPE_ENCHANTING then
CS.Extern = false
-- use CS interface?
local useCSRune = true
if (not CS.Account.options.userunecreation and CS.Character.runemode == 'craft') or
(not CS.Account.options.useruneextraction and CS.Character.runemode == 'refine') or
(not CS.Account.options.userunerecipe and CS.Character.runemode == 'furniture')
then
useCSRune = false
end
CS.RuneInitialize(useCSRune)
CS.RuneHideVanillaUI(useCSRune)
CS.RuneShowMode()
local soundPlayer = CRAFTING_RESULTS.enchantSoundPlayer
soundPlayer.PlaySound = function() return end
--Update space
CS.InventorySpace(CraftStoreFixed_RuneSpaceButtonName)
end
-- if CS.Account.options.useflask then
-- if craftSkill == CRAFTING_TYPE_ALCHEMY then
-- CS_Flask:SetHidden(false)
-- end
-- end
if CS.Account.options.usequest then
CS.GetQuest()
if CS.Quest[craftSkill] then
local title = CS.Quest[craftSkill].name..'\n'
local out = ''
for _, step in pairs(CS.Quest[craftSkill].work) do out = out..step..'\n' end
if CS.Quest[craftSkill] then
CraftStoreFixed_QuestText:SetText(title..out)
CraftStoreFixed_Quest:SetHidden(false)
end
end
end
--Handle updating research
if craftSkill == CRAFTING_TYPE_BLACKSMITHING or craftSkill == CRAFTING_TYPE_CLOTHIER or craftSkill == CRAFTING_TYPE_WOODWORKING or craftSkill == CRAFTING_TYPE_JEWELRYCRAFTING then
CS.UpdateResearch()
CS.UpdateResearchWindows()
end
end
function CS.OnCraftCompleted(eventCode,craftSkill)
local inspirationGained = GetLastCraftingResultTotalInspiration()
if inspirationGained > 0 then CS.Inspiration = '|t30:30:/esoui/art/currency/currency_inspiration.dds|t |c9095FF'..inspirationGained..'|r' end
if CS.Account.options.usecook and craftSkill == CRAFTING_TYPE_PROVISIONING then
CraftStoreFixed_CookAmount:SetText('')
zo_callLater(function() CS.CookShowCategory(CS.Character.recipe,false) end,500)
--Update space
CS.InventorySpace(CraftStoreFixed_CookSpaceButtonName)
end
if CS.Account.options.userune and craftSkill == CRAFTING_TYPE_ENCHANTING then
CraftStoreFixed_RuneAmount:SetText('')
if CS.Rune.refine.glyphs[1] then
local remove = true
while remove do
if CS.Rune.refine.glyphs[1] and CS.Rune.refine.glyphs[1].crafted and not CS.Rune.refine.crafted then
table.remove(CS.Rune.refine.glyphs,1)
else
remove = false
end
end
if CS.Rune.refine.glyphs[1] then
if GetNumBagFreeSlots(BAG_BACKPACK) >= 3 or (tonumber(GetSetting(SETTING_TYPE_LOOT,LOOT_SETTING_AUTO_ADD_TO_CRAFT_BAG)) == 1 and IsESOPlusSubscriber()) then
ExtractEnchantingItem(CS.Rune.refine.glyphs[1].location[1][1], CS.Rune.refine.glyphs[1].location[1][2])
PlaySound('Enchanting_Extract_Start_Anim')
--Only remove the table if all of the stack is gone
if #CS.Rune.refine.glyphs[1].location == 1 then
table.remove(CS.Rune.refine.glyphs,1)
else
--Remove only the used glyph
table.remove(CS.Rune.refine.glyphs[1].location,1)
end
else CS.Chat:Print(CS.Loc.nobagspace) end
end
end
--Update space
CS.InventorySpace(CraftStoreFixed_RuneSpaceButtonName)
zo_callLater(function() CS.RuneShowMode(true) end,500)
end
CS.UpdateBag()
end
function CS.OnEndCraftingStationInteract(eventCode, craftSkill)
CraftStoreFixed_Quest:SetHidden(true)
--CraftStoreFixed_Flask:SetHidden(true)
CS.UIClosed = true
if CS.Account.options.usecook and craftSkill == CRAFTING_TYPE_PROVISIONING then
CraftStoreFixed_Cook:SetHidden(true)
for x = 2, ZO_ProvisionerTopLevel:GetNumChildren() do ZO_ProvisionerTopLevel:GetChild(x):SetAlpha(1) end
CS.Cook.job = {amount=0}
for x = 1,CraftStoreFixed_CookFoodSectionScrollChild:GetNumChildren() do CS.HideControl('CraftStoreFixed_CookFoodSectionScrollChildButton'..x) end
end
if CS.Account.options.userune and craftSkill == CRAFTING_TYPE_ENCHANTING then
CraftStoreFixed_Rune:SetHidden(true)
CS.Extern = true
for k in next,CS.Rune.refine.glyphs do CS.Rune.refine.glyphs[k] = nil end
for x = 2, ZO_EnchantingTopLevel:GetNumChildren() do ZO_EnchantingTopLevel:GetChild(x):SetHidden(false) end
CS.Rune.job = {amount=0}
for x = 1,CraftStoreFixed_RuneGlyphSectionScrollChild:GetNumChildren() do CS.HideControl('CraftStoreFixed_RuneGlyphSectionScrollChildButton'..x) end
end
end
function CS.OnGameCameraUIModeChanged(eventCode)
if CS.UIClosed then CS.UIClosed = false end
end
function CS.OnActionLayerPushed(eventCode, layerIndex, activeLayerIndex)
if CS.UIClosed then ZO_KeybindStripControl:SetHidden(false) CS.UIClosed=false end
end
function CS.NewMovementInUIMode(eventCode)
if CS.Account.options.closeonmove and not CraftStoreFixed_Panel:IsHidden() then CS.ControlCloseAll() end
end
function CS.OnReticleHiddenUpdate(eventCode,hidden)
if not hidden and not CraftStoreFixed_Rune:IsHidden() then CS.RuneView(2) end
end
function CS.OnPlayerActivated(eventCode,initial)
if CS.Debug then zo_callLater(function() CHAT_ROUTER:AddSystemMessage("CS.Account.crafting.jewelryIdSwapMigrationAlreadyDoneDone: "..tostring(CS.Account.crafting.jewelryIdSwapMigrationAlreadyDoneDone)) end, 50) end
if CS.Account.crafting.jewelryIdSwapMigrationAlreadyDoneDone == nil or CS.Account.crafting.jewelryIdSwapMigrationAlreadyDoneDone == false then
zo_callLater(
function()
CHAT_ROUTER:AddSystemMessage("[CraftStore] The internal indices of the game for jewelry (rings and necklaces) got swapped by ZOS. CraftStore need to migrate its SavedVariables once. Starting...")
end, 50)
CS.MigrateJewelryIdSwap()
CS.Account.crafting.jewelryIdSwapMigrationAlreadyDoneDone = true
zo_callLater(
function()
CHAT_ROUTER:AddSystemMessage("[CraftStore] Migration of CraftStore's SavedVariables finished.")
end, 50)
end
CS.UpdateAccountVars()
CS.UpdatePlayer()
CS.UpdateStyleKnowledge(true)
CS.UpdateRecipeKnowledge()
CS.UpdateAllStudies()
CS.UpdateInventory()
CS.CharacterInitialize()
CS.GetTimer()
CS.InitPreviews()
CS.UpdateResearch()
CS.UpdateResearchWindows()
CS.UpdateBag()
CS.HideStyles(true)
CS.HideCrownStyles(true)
CS.HidePerfectedStyles(true)
CS.HideUnknownStyles(true)
CS.HideKnownBlueprints(true)
CS.HideUnknownBlueprints(true)
CS.HideKnownRecipes(true)
CS.HideUnknownRecipes(true)
CS.Init = true
EM:UnregisterForEvent('CSEE',EVENT_PLAYER_ACTIVATED)
end
function CS.OnPlayerDeactivated(eventCode)
CS.UpdatePlayer(true)
EM:UnregisterForEvent('CSEE',EVENT_PLAYER_DEACTIVATED)
end
function CS.OnChampionPerksSceneStateChange(oldState,newState)
if newState == SCENE_SHOWING then
CS.ControlCloseAll()
CraftStoreFixed_ButtonFrame:SetHidden(true)
elseif newState == SCENE_HIDDEN then
if CS.Account.options.showbutton then CraftStoreFixed_ButtonFrame:SetHidden(false) end
end
end
function CS.HouseBankQuantity(bag,slot,link)
if link == nil then link = false end
local items = SHARED_INVENTORY:GenerateFullSlotData(nil,bag)
--slot is used during initialize/add actions; link is used to sum during a remove
if slot then
link = CS.StripLink(GetItemLink(bag,slot))
end
local quantity = 0
for index,data in pairs(items) do
if link == CS.StripLink(GetItemLink(data.bagId,data.slotIndex)) then
local _,stack = GetItemInfo(data.bagId,data.slotIndex)
quantity = quantity + stack
end
end
return quantity
end
function CS.OnInventorySlotAdded(bag,slot,data,replace)
if not replace then replace = false end
if bag ~= BAG_BACKPACK and bag~=BAG_BANK and bag~=BAG_SUBSCRIBER_BANK and bag~=BAG_VIRTUAL and not IsHouseBankBag(bag) then return end
local link = CS.StripLink(GetItemLink(bag,slot))
local a1, a2, a3 = GetItemLinkStacks(link)
if not CS.Account.storage[link] then CS.Account.storage[link] = {} end
--inline ternary did not work, handle line by line
CS.Account.storage[link][CS.Lang.en.craftbag] = a3
if a3 == 0 then CS.Account.storage[link][CS.Lang.en.craftbag] = nil end
CS.Account.storage[link][CS.Lang.en.bank] = a2
if a2 == 0 then CS.Account.storage[link][CS.Lang.en.bank] = nil end
CS.Account.storage[link][CS.CurrentPlayer] = a1
if a1 == 0 then CS.Account.storage[link][CS.CurrentPlayer] = nil end
if IsHouseBankBag(bag) then
if not CS.Account.storage[link][CS.Lang.en.housebank..(bag-7)] then
CS.Account.storage[link][CS.Lang.en.housebank] = 0
end
CS.Account.storage[link][CS.Lang.en.housebank..(bag-7)] = CS.HouseBankQuantity(bag,slot)
end
CS.UpdateMatsInfo(link)
data.uid = Id64ToString(GetItemUniqueId(bag,slot))
data.lnk = link
if CS.IsValidEquip(GetItemLinkEquipType(link)) then
if CS.IsLocked(bag,slot) then
CS.UpdateStored('removed',data,replace)
else
CS.UpdateStored('added',data)
end
end
end
function CS.OnInventorySlotRemoved(bag,slot,data)
if bag ~= BAG_BACKPACK and bag~=BAG_BANK and bag~=BAG_SUBSCRIBER_BANK and bag~=BAG_VIRTUAL and not IsHouseBankBag(bag) then return end
local link = CS.StripLink(data.lnk)
local a1, a2, a3 = GetItemLinkStacks(link)
--inline ternary did not work, handle line by line
CS.Account.storage[link][CS.Lang.en.craftbag] = a3
if a3 == 0 then CS.Account.storage[link][CS.Lang.en.craftbag] = nil end
CS.Account.storage[link][CS.Lang.en.bank] = a2
if a2 == 0 then CS.Account.storage[link][CS.Lang.en.bank] = nil end
CS.Account.storage[link][CS.CurrentPlayer] = a1
if a1 == 0 then CS.Account.storage[link][CS.CurrentPlayer] = nil end
if IsHouseBankBag(bag) then
CS.Account.storage[link][CS.Lang.en.housebank..(bag-7)] = CS.HouseBankQuantity(bag,false,link)
end
CS.UpdateMatsInfo(link)
if CS.IsValidEquip(GetItemLinkEquipType(link)) then CS.UpdateStored('removed',data) end
end
function CS.OnStackSplitShow()
if CS.Account.options.stacksplit then
ZO_StackSplitSpinnerDisplay:TakeFocus()
ZO_StackSplitSpinnerDisplay:SelectAll()
end
end
function CS.OnInventorySingleSlotUpdate(eventCode, bagId, slotId, isNewItem, itemSoundCategory, inventoryUpdateReason, stackCountChange)
--Locked or unlocked, so replace it
local replace = inventoryUpdateReason == 4 and true or false
CS.OnInventorySlotAdded(bagId, slotId, {bagId=bagId},replace)
end
function CS.OnMoneyUpdate(eventCode, newMoney, oldMoney, reason)
if reason == 42 or reason == 43 then
CS.Character.income[2] = CS.Character.income[2] + newMoney - oldMoney
end
end
-- hooks for the default rune interface
function CS.RuneCreationTabShow()
CS.Character.runemode = 'craft'
if CS.Account.options.userune and CS.Account.options.userunecreation then
CS.RuneShowMode()
end
end
function CS.RuneExtractionTabShow()
CS.Character.runemode = 'refine'
if CS.Account.options.userune and CS.Account.options.useruneextraction then
CS.RuneShowMode()
end
end
function CS.RuneRecipeTabShow()
CS.Character.runemode = 'furniture'
if CS.Account.options.userune then
CS.RuneShowMode()
end
end
function CS.CookFoodTabShow()
if CS.Account.options.usecook then
CS.CookShowCategory(1)
CS.CookShow()
end
end
function CS.CookDrinkTabShow()
if CS.Account.options.usecook then
CS.CookShowCategory(8)
CS.CookShow()
end
end
function CS.CookFurnitureTabShow()
if CS.Account.options.usecook then
CS.CookShowCategory(19)
CS.CookShow()
end
end
function CS.OnAddOnLoaded(eventCode,addOnName)
if addOnName ~= CS.Name then return end
CS.Style = CS.STYLE()
CS.Style.RemoveUnpublishedStyles()
CS.Style.CompileStyles()
CS.Style.CompilePartialStyles({[114]=true,[119]=true})
CS.Crafting.CompileTraits()
--cs_flask = CS.CS.Flask()
CS.Account = ZO_SavedVars:NewAccountWide('CraftStore_Account',3,GetWorldName(),CS.AccountInit)
CS.Character = ZO_SavedVars:NewCharacterIdSettings('CraftStore_Character',2,GetWorldName(),CS.CharInit)
-- remove unpublished furnishing recipies
CS.Furnisher.recipelist = CS.FilterPublishedItems(CS.Furnisher.recipelist)
--build schema for data
LBE:DefinePrefix("CSCK28",CS.Name,CS.LBE.Cook,64,LBE:ConvertTable(LBE:ConcatTables(CS.Cook.recipelist,CS.Cook.recipeduplicatelist)))
LBE:DefinePrefix("CSFK32",CS.Name,CS.LBE.Furnisher,64,LBE:ConvertTable(CS.Furnisher.recipelist))
LBE:DefinePrefix("CSSK29",CS.Name,CS.LBE.Styles.."Old",64,LBE:ConvertTable(CS.Styles.oldlist))
LBE:DefinePrefix("CSSK32",CS.Name,CS.LBE.Styles,64,LBE:ConvertTable(CS.Styles.list))
LBE:DefinePrefix("CSCS29",CS.Name,CS.LBE.Crafting,64,CS.Crafting.list)
LBE:DefinePrefix("CSCR29",CS.Name,CS.LBE.Researched,64,CS.Crafting.list) -- intentionally same schema as CSCS, but unique prefix needed
-- only applicable for characters with saved vars already
for nr, char in pairs(CS.GetCharacters()) do
local temp = {}
--cooking knowledge
CS.Data.cook.knowledge[char] = LBE:ParseTrusted(CS.Account.cook.knowledge[char],CS.Name,CS.LBE.Cook)
--furnishing knowledge
CS.Data.furnisher.knowledge[char] = LBE:ParseTrusted(CS.Account.furnisher.knowledge[char],CS.Name,CS.LBE.Furnisher)
--style knowledge
CS.Data.style.knowledge[char] = LBE:ParseTrusted(CS.Account.style.knowledge[char],CS.Name,CS.LBE.Styles)
--trait tracking
CS.Data.crafting.studies[char] = LBE:ParseTrusted(CS.Account.crafting.studies[char],CS.Name,CS.LBE.Crafting)
--researched tracking
CS.Data.crafting.researched[char] = LBE:MergeTables(CS.Account.crafting.researching[char],LBE:ParseTrusted(CS.Account.crafting.researched[char],CS.Name,CS.LBE.Researched))
end
-- temporary saved var cleanup
CS.Account.crafting.research = nil
if CS.Character.income[1] ~= GetDate()then
CS.Character.income[1] = GetDate()
CS.Character.income[2] = GetCurrentMoney()
end
ZO_CreateStringId('SI_BINDING_NAME_SHOW_CRAFTSTOREFIXED_WINDOW',CS.Loc.TT[15])
SM:RegisterTopLevel(CraftStoreFixed_Panel,false)
EM:RegisterForEvent('CSEE',EVENT_QUEST_CONDITION_COUNTER_CHANGED,CS.OnQuestConditionCounterChanged)
EM:RegisterForEvent("CSEE",EVENT_RECIPE_LEARNED,CS.OnRecipeLearned)
EM:RegisterForEvent('CSEE',EVENT_STYLE_LEARNED,CS.OnStyleLearned)
EM:RegisterForEvent('CSEE',EVENT_TRADING_HOUSE_RESPONSE_RECEIVED,CS.UpdateGuildStore)
EM:RegisterForEvent('CSEE',EVENT_SMITHING_TRAIT_RESEARCH_STARTED,CS.OnSmithingTraitResearchStarted)
EM:RegisterForEvent('CSEE',EVENT_STABLE_INTERACT_END,CS.OnStableInteractEnd)
EM:RegisterForEvent('CSEE',EVENT_SMITHING_TRAIT_RESEARCH_COMPLETED,CS.OnSmithingTraitResearchChange)
EM:RegisterForEvent('CSEE',EVENT_SMITHING_TRAIT_RESEARCH_CANCELED,CS.OnSmithingTraitResearchChange)
EM:RegisterForEvent('CSEE',EVENT_CRAFTING_STATION_INTERACT,CS.OnCraftingStationInteract)
EM:RegisterForEvent('CSEE',EVENT_INVENTORY_FULL_UPDATE,CS.UpdateBag)
EM:RegisterForEvent('CSEE',EVENT_CRAFT_COMPLETED,CS.OnCraftCompleted)
EM:RegisterForEvent('CSEE',EVENT_END_CRAFTING_STATION_INTERACT,CS.OnEndCraftingStationInteract)
EM:RegisterForEvent('CSEE',EVENT_GAME_CAMERA_UI_MODE_CHANGED,CS.OnGameCameraUIModeChanged)
EM:RegisterForEvent('CSEE',EVENT_ACTION_LAYER_PUSHED,CS.OnActionLayerPushed)
EM:RegisterForEvent('CSEE',EVENT_NEW_MOVEMENT_IN_UI_MODE,CS.NewMovementInUIMode)
EM:RegisterForEvent('CSEE',EVENT_RETICLE_HIDDEN_UPDATE,CS.OnReticleHiddenUpdate)
EM:RegisterForEvent('CSEE',EVENT_PLAYER_ACTIVATED,CS.OnPlayerActivated)
EM:RegisterForEvent('CSEE',EVENT_PLAYER_DEACTIVATED,CS.OnPlayerDeactivated)
EM:RegisterForEvent('CSEE',EVENT_INVENTORY_SINGLE_SLOT_UPDATE, CS.OnInventorySingleSlotUpdate)
EM:RegisterForEvent('CSEE',EVENT_MONEY_UPDATE, CS.OnMoneyUpdate)
--Esc close
--SCENE_MANAGER:RegisterTopLevel(CraftStoreFixed_Blueprint_Window, false)
--SCENE_MANAGER:RegisterTopLevel(CraftStoreFixed_Recipe_Window, false)
--SCENE_MANAGER:RegisterTopLevel(CraftStoreFixed_Style_Window, false)
--SCENE_MANAGER:RegisterTopLevel(CraftStoreFixed_Rune, false)
CHAMPION_PERKS_SCENE:RegisterCallback('StateChange',CS.OnChampionPerksSceneStateChange)
SHARED_INVENTORY:RegisterCallback('SlotAdded',CS.OnInventorySlotAdded)
SHARED_INVENTORY:RegisterCallback('SlotRemoved',CS.OnInventorySlotRemoved)
ZO_PreHookHandler(ZO_StackSplit,'OnShow', CS.OnStackSplitShow)
ZO_PreHookHandler(ZO_EnchantingTopLevelModeMenuBarButton1,'OnMouseDown', CS.RuneCreationTabShow)
ZO_PreHookHandler(ZO_EnchantingTopLevelModeMenuBarButton2,'OnMouseDown', CS.RuneExtractionTabShow)
ZO_PreHookHandler(ZO_EnchantingTopLevelModeMenuBarButton3,'OnMouseDown', CS.RuneRecipeTabShow)
CS.LAM = LAM:RegisterAddonPanel(CS.Name, CS.PanelData)
LAM:RegisterOptionControls(CS.Name, CS.OptionsTable)
CS.ScrollText()
CS.TooltipHandler()
if type(CS.Character.previewtype) == "string" or not CS.Character.previewType then CS.Character.previewtype=1 end
CS.Style.UpdatePreview(CS.Character.previewtype)
CS.PanelInitialize()
--CS.LMMAdd()
EM:UnregisterForEvent('CSEE',EVENT_ADD_ON_LOADED)
end
EM:RegisterForEvent('CSEE',EVENT_ADD_ON_LOADED,CS.OnAddOnLoaded)