From f8aa3b0832cd1d1baac30ec8c1ccd70cc1bbfc8a Mon Sep 17 00:00:00 2001 From: jeffi Date: Tue, 27 Feb 2024 10:27:49 -0600 Subject: [PATCH] Added KeyCodes and Other Items --- .vscode/settings.json | 6 + Tinkr.lua | 269 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 267 insertions(+), 8 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d2acd65 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "Lua.diagnostics.globals": [ + "AuraUtil", + "C_UnitAuras" + ] +} \ No newline at end of file diff --git a/Tinkr.lua b/Tinkr.lua index 44d1644..f1f8405 100644 --- a/Tinkr.lua +++ b/Tinkr.lua @@ -311,8 +311,12 @@ local SpectatedTeamBPetUnitIds = { --#region TinkrTypes ----@class WowGameObject +--- Example: "!00038" +---@alias TinkrObjectManagerId string + +---@class WowGameObject : userdata ---@field unit fun(): UnitIds +---@field guid fun(): string ---@alias TinkrObjectReference WowGameObject | UnitId ---@alias spellId integer @@ -1435,7 +1439,7 @@ local TinkrUtilModulesEvaluator = { ---@param input string ---@param args any[] ---@param path string - ---@return function + ---@return ... LoadString = function(self, input, args, path) end, ---@param self Tinkr.Util.Modules.Evaluator @@ -1646,6 +1650,10 @@ local TinkrUtilModules = { ---@field List fun(self: Tinkr.Util.File, dir: string): string[] ---@field Read fun(self: Tinkr.Util.File, file: string): string +---@class Tinkr.Util.Serialize +---@field Load fun(self: Tinkr.Util.Serialize, string: string): any +---@field Serialize fun(self: Tinkr.Util.Serialize, value: any): string + ---@class Tinkr.Util ---@field File Tinkr.Util.File local TinkrUtil = { @@ -1669,6 +1677,7 @@ local TinkrUtil = { GUIBuilder = {}, LibStub = LibStub, JSON = Tinkr.Util.Modules.JSON, + Serialize = {}, } --#endregion Tinkr.Util @@ -2015,7 +2024,7 @@ local TinkrObjects = { ---@return number | false ObjectHeight = function(objectRef) end, - ---Returns the ID of a WowGameObject. + ---Returns the NPC ID of a WowGameObject. ---@param objectRef TinkrObjectReference ---@return number | false ObjectID = function(objectRef) end, @@ -2194,6 +2203,122 @@ UnitItemLevels = TinkrObjects.UnitItemLevels UnitShapeShiftID = TinkrObjects.UnitShapeShiftID GetUnitAttachmentPosition = TinkrObjects.GetUnitAttachmentPosition +---@enum Tinkr.KeyCodes +local KeyCodes = { + ANSI_A = 0x00, + ANSI_S = 0x01, + ANSI_D = 0x02, + ANSI_F = 0x03, + ANSI_H = 0x04, + ANSI_G = 0x05, + ANSI_Z = 0x06, + ANSI_X = 0x07, + ANSI_C = 0x08, + ANSI_V = 0x09, + ANSI_B = 0x0B, + ANSI_Q = 0x0C, + ANSI_W = 0x0D, + ANSI_E = 0x0E, + ANSI_R = 0x0F, + ANSI_Y = 0x10, + ANSI_T = 0x11, + ANSI_1 = 0x12, + ANSI_2 = 0x13, + ANSI_3 = 0x14, + ANSI_4 = 0x15, + ANSI_6 = 0x16, + ANSI_5 = 0x17, + ANSI_Equal = 0x18, + ANSI_9 = 0x19, + ANSI_7 = 0x1A, + ANSI_Minus = 0x1B, + ANSI_8 = 0x1C, + ANSI_0 = 0x1D, + ANSI_RightBracket = 0x1E, + ANSI_O = 0x1F, + ANSI_U = 0x20, + ANSI_LeftBracket = 0x21, + ANSI_I = 0x22, + ANSI_P = 0x23, + ANSI_L = 0x25, + ANSI_J = 0x26, + ANSI_Quote = 0x27, + ANSI_K = 0x28, + ANSI_Semicolon = 0x29, + ANSI_Backslash = 0x2A, + ANSI_Comma = 0x2B, + ANSI_Slash = 0x2C, + ANSI_N = 0x2D, + ANSI_M = 0x2E, + ANSI_Period = 0x2F, + ANSI_Grave = 0x32, + ANSI_KeypadDecimal = 0x41, + ANSI_KeypadMultiply = 0x43, + ANSI_KeypadPlus = 0x45, + ANSI_KeypadClear = 0x47, + ANSI_KeypadDivide = 0x4B, + ANSI_KeypadEnter = 0x4C, + ANSI_KeypadMinus = 0x4E, + ANSI_KeypadEquals = 0x51, + ANSI_Keypad0 = 0x52, + ANSI_Keypad1 = 0x53, + ANSI_Keypad2 = 0x54, + ANSI_Keypad3 = 0x55, + ANSI_Keypad4 = 0x56, + ANSI_Keypad5 = 0x57, + ANSI_Keypad6 = 0x58, + ANSI_Keypad7 = 0x59, + ANSI_Keypad8 = 0x5B, + ANSI_Keypad9 = 0x5C, + Return = 0x24, + Tab = 0x30, + Space = 0x31, + Delete = 0x33, + Escape = 0x35, + Command = 0x37, + Shift = 0x38, + CapsLock = 0x39, + Option = 0x3A, + Control = 0x3B, + RightShift = 0x3C, + RightOption = 0x3D, + RightControl = 0x3E, + Function = 0x3F, + F17 = 0x40, + VolumeUp = 0x48, + VolumeDown = 0x49, + Mute = 0x4A, + F18 = 0x4F, + F19 = 0x50, + F20 = 0x5A, + F5 = 0x60, + F6 = 0x61, + F7 = 0x62, + F3 = 0x63, + F8 = 0x64, + F9 = 0x65, + F11 = 0x67, + F13 = 0x69, + F16 = 0x6A, + F14 = 0x6B, + F10 = 0x6D, + F12 = 0x6F, + F15 = 0x71, + Help = 0x72, + Home = 0x73, + PageUp = 0x74, + ForwardDelete = 0x75, + F4 = 0x76, + End = 0x77, + F2 = 0x78, + PageDown = 0x79, + F1 = 0x7A, + LeftArrow = 0x7B, + RightArrow = 0x7C, + DownArrow = 0x7D, + UpArrow = 0x7E, +} + --#endregion Tinkr.Objects --#region Tinkr.Utility @@ -2246,7 +2371,7 @@ local TinkrUtility = { GetGameTick = function() end, ---Get the state of a key - ---@param key KeyCode + ---@param key Tinkr.KeyCodes ---@return boolean GetKeyState = function(key) end, @@ -2384,17 +2509,145 @@ loadstringsecure = TinkrUtility.loadstringsecure --#endregion Tinkr.Utility +---@class Tinkr.Routine +---@field active_routine boolean +---@field enabled boolean +---@field timer boolean +---@field update_rate number +---@field Disable fun() +---@field Enable fun() +---@field Inject fun(metatable: metatable, libName?: string, Class?: Tinkr.Routine.Classes ) +---@field InjectLib fun(...:any) +---@field InjectLibrary fun(...:any) +---@field LoadLib fun(...: any) +---@field LoadLibrary fun(...: any) +---@field RegisterLib fun(...: any) +---@field RegisterLibrary fun(...: any) +---@field RegisterRoutine fun(callback: fun(...:any), class: Tinkr.Routine.Classes, spec: number) +---@field RegisterSpellBook fun(spellbook: table, class: Tinkr.Routine.Classes) +---@field LoadForSpec fun() +---@field LoadRoutine fun(id: number) +---@field RegisterLocalRoutines fun() +---@field RegisterLocalSpellbooks fun() +---@field RegisterLocal fun() +---@field Toggle fun(state: boolean) +local TinkrRoutine = { + ---@enum Tinkr.Routine.Classes + Classes = { + Warrior = 1, + Paladin = 2, + Hunter = 3, + Rogue = 4, + Priest = 5, + DeathKnight = 6, + Shaman = 7, + Mage = 8, + Warlock = 9, + Monk = 10, + Druid = 11, + DemonHunter = 12, + Evoker = 13, + Shared = 999 + }, + Exports = {}, + RoutineCache = {}, + Specs = { + Warrior = { + Arms = 71, + Fury = 72, + Protection = 73 + }, + Paladin = { + Holy = 65, + Protection = 66, + Retribution = 70 + }, + Hunter = { + BeastMastery = 253, + Marksmanship = 254, + Survival = 255 + }, + Rogue = { + Assassination = 259, + Outlaw = 260, + Subtlety = 261 + }, + Priest = { + Discipline = 256, + Holy = 257, + Shadow = 258 + }, + DeathKnight = { + Blood = 250, + Frost = 251, + Unholy = 252 + }, + Shaman = { + Elemental = 262, + Enhancement = 263, + Restoration = 264 + }, + Mage = { + Arcane = 62, + Fire = 63, + Frost = 64 + }, + Warlock = { + Affliction = 265, + Demonology = 266, + Destruction = 267 + }, + Monk = { + Brewmaster = 268, + Mistweaver = 270, + Windwalker = 269 + }, + Druid = { + Balance = 102, + Feral = 103, + Guardian = 104, + Restoration = 105 + }, + DemonHunter = { + Havoc = 577, + Vengeance = 581 + }, + Evoker = { + Devastation = 1467, + Preservation = 1468, + }, + }, + export_cache = {}, + injected_libs = {}, + routine_data = {}, + routine_hooks = {}, + routines = {}, + spellbooks = {}, +} + ---@class Tinkr : Tinkr.Utility +---@field classic boolean +---@field dragonflight boolean +---@field era boolean +---@field retail boolean +---@field shadowlands boolean +---@field init_at 0 +---@field build string +---@field color string +---@field name "Tinkr" +---@field name_locale string +---@field release "release" +---@field Routine Tinkr.Routine ---@field Util Tinkr.Util local Tinkr = { - name = "Tinkr", - classic = false, - retail = false, - era = false, Common = {}, ---@param path string ---@return string, string resolvePath = function(path) end, + Automator = {}, + Commands = {}, + globals = {}, + modules = {}, } AuraUtil_ForEachAura = AuraUtil.ForEachAura