Adding main files
Adam Davenport [06-26-18 - 04:18]
diff --git a/NUI.lua b/NUI.lua
new file mode 100644
index 0000000..d7865a0
--- /dev/null
+++ b/NUI.lua
@@ -0,0 +1,119 @@
+-- Addon name string
+
+NUI = {}
+NUI.name = "NinjaInterface"
+
+function NUI:Initialize()
+ self.SavedVariables = ZO_SavedVars:NewAccountWide("NinjaInterface", 1, nil, {})
+ self:CheckVariables()
+ self:RegisterEvents()
+ self:SetupSlashCommands()
+ self:SetupUpdates()
+ self:RestorePosition()
+
+end
+
+function NUI:CheckVariables()
+ -- Check default location
+ if self.SavedVariables.x == nil or self.SavedVariables.bHidePing == nil then
+ local sv = self.SavedVariables
+ sv.x = 0
+ sv.y = 0
+ sv.bMovable = true
+ sv.bHidePing = false
+ sv.bHideMount = false
+ sv.bHideBag = false
+ sv.bHideGold = false
+ end
+end
+
+function NUI:RegisterEvents()
+ NUI:HideInMenus()
+ EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_COMBAT_STATE, self.OnPlayerCombatState)
+ EVENT_MANAGER:RegisterForEvent(self.name, EVENT_CHATTER_BEGIN, self.OnPlayerChatterBegin)
+ EVENT_MANAGER:RegisterForEvent(self.name, EVENT_CHATTER_END, self.OnPlayerChatterEnd)
+end
+
+function NUI:SetupSlashCommands()
+ SLASH_COMMANDS["/nui"] = NUI.SlashCommands
+ SLASH_COMMANDS["/rl"] = ReloadUI
+end
+
+function SlashCommands(Args)
+ NUI.DisplayHelp()
+end
+
+function NUI:SetupUpdates()
+ -- Timed updates
+ EVENT_MANAGER:RegisterForUpdate("NinjaUpdate1", 1000, NUI.Update1)
+ EVENT_MANAGER:RegisterForUpdate("NinjaUpdate1", 10000, NUI.Update2)
+ EVENT_MANAGER:RegisterForUpdate("NinjaUpdate3", 60000, NUI.Update3)
+
+ -- Inital call to all updates
+ NUI:Update1()
+ NUI:Update2()
+ NUI:Update3()
+end
+
+
+function NUI:DisplayHelp()
+ d("Ninja Panel")
+ d("|cffffff Type /nplock to lock or unlock the pane.|")
+ d("|cffffff Type /npx to center the panel on the x axis|.")
+ d("|cffffff Type /npy to center the panel on the y axis|.")
+end
+
+
+------------------------
+-- Updates
+------------------------
+
+-- Update every second
+function NUI:Update1()
+end
+
+-- Update every 10 seconds
+function NUI:Update2()
+end
+
+-- Update every minute
+function NUI:Update3()
+end
+
+----------------
+-- EVENTS
+----------------
+
+-- Hide when the player is talking to an npc
+function NUI.OnPlayerChatterBegin(eventCode, optionCount)
+end
+
+-- Show when the player stops talking to an npc
+function NUI.OnPlayerChatterEnd(eventCode)
+end
+
+-- Called when the addon is loaded
+local function OnLoad(event, AddonName)
+ if AddonName == NUI.name then
+ NUI:Initialize()
+ end
+end
+
+-- Hide the display when in a menu
+function NUI:HideInMenus()
+ local hud = SCENE_MANAGER:GetScene("hud")
+ hud:RegisterCallback("StateChange", function(oldState, newState)
+ if newState == SCENE_HIDDEN and SCENE_MANAGER:GetNextScene():GetName() ~= "hudui" then
+ ----------------------------
+ --Place Main ui container to hide
+ ----------------------------
+ end
+ if newState == SCENE_SHOWING then
+ ----------------------------
+ --Place Main ui container to hide
+ ----------------------------
+ end
+ end)
+end
+
+EVENT_MANAGER:RegisterForEvent(NUI.name, EVENT_ADD_ON_LOADED, OnLoad)
\ No newline at end of file
diff --git a/NUI.txt b/NUI.txt
new file mode 100644
index 0000000..09759ca
--- /dev/null
+++ b/NUI.txt
@@ -0,0 +1 @@
+NUI.lua
\ No newline at end of file