Download
(41 Kb)
Download
Updated: 06/11/16 06:49 AM
Pictures
File Info
Compatibility:
Update 7 (1.7.0)
Updated:06/11/16 06:49 AM
Created:06/11/16 06:49 AM
Monthly downloads:14
Total downloads:1,128
Favorites:0
MD5:
[Outdated] Provision's IntelSpeller
Version: 0.1a
by: Provision [More]
Combat assistance.

Doesn't work. Switch keybind during the combat.

Lua Code:
  1. local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")
  2.  
  3. local Addon =
  4. {
  5.     name = "ProvisionsIntelSpeller",
  6.     namePublic = "Prov's IntelSpeller",
  7.     nameColor = "|cFF9999Intel|cFF0000Speller|r",
  8.     author = "|c00C000Provision|r",
  9.     version = "0.1", --3 endroits
  10.     CPL = nil,
  11.     defaults =
  12.     {
  13.         enabled     = true,
  14.  
  15.         posx        = 0,
  16.         posy        = 50,
  17.         locked      = true,
  18.  
  19.         refreshRate = 25,
  20.  
  21.         siege       = true,
  22.     },
  23.     debug = {
  24.         enabled     = false,
  25.     }
  26. }
  27.  
  28. local IntelSpeller = {}
  29.  
  30. local KeyIS = {}
  31.  
  32. function IntelSpeller_Keypress(num)
  33.     local a, b
  34.     a = "A5" b = "A4"
  35.     d(KeyIS[a][3] .. " <=> " .. KeyIS[b][3])
  36.     if num == 1 then
  37.         d("INTELSPELLER_A")
  38.         CallSecureProtected("BindKeyToAction", KeyIS[a][1][1], KeyIS[a][1][2], KeyIS[a][1][3], 1, KeyIS[b][2])
  39.         CallSecureProtected("BindKeyToAction", KeyIS[b][1][1], KeyIS[b][1][2], KeyIS[b][1][3], 1, KeyIS[a][2])
  40.     else
  41.         d("INTELSPELLER_B")
  42.         CallSecureProtected("BindKeyToAction", KeyIS[a][1][1], KeyIS[a][1][2], KeyIS[a][1][3], 1, KeyIS[a][2])
  43.         CallSecureProtected("BindKeyToAction", KeyIS[b][1][1], KeyIS[b][1][2], KeyIS[b][1][3], 1, KeyIS[b][2])
  44.     end
  45. end
  46.  
  47. local function GetActionBindingFullInfo(keyName)
  48.     local a, b, c, key, name
  49.     a, b, c = GetActionIndicesFromName(keyName)
  50.  
  51.     key = GetActionBindingInfo(a, b, c, 1)
  52.  
  53.     name = GetString(_G["SI_BINDING_NAME_" .. keyName])
  54.  
  55.     return { { a, b, c }, key, name }
  56. end
  57.  
  58. local IS_myFirstTime = true
  59.  
  60. local function IntelSpeller_OnUpdate()
  61.     if not Addon.vars.enabled then
  62.         return
  63.     end
  64.  
  65.     if (IS_myFirstTime) then
  66.         IS_myFirstTime = false
  67.  
  68.         local c
  69.         for i = 1, 7 do
  70.             c = "A" .. i
  71.             KeyIS[c] = GetActionBindingFullInfo("ACTION_BUTTON_" .. (i + 2))
  72.  
  73.             d(KeyIS[c][3] .. " = " .. KeyIS[c][2])
  74.         end
  75.     end
  76. end
  77.  
  78. local function IntelSpeller_OnMoveStop()
  79.     Addon.vars.posx = math.floor(IntelSpeller.UI:GetLeft())
  80.     Addon.vars.posy = math.floor(IntelSpeller.UI:GetTop())
  81. end
  82.  
  83. local function createLAM2Panel()
  84.     local panelData =
  85.     {
  86.         type = "panel",
  87.         name = Addon.namePublic,
  88.         displayName = Addon.nameColor,
  89.         author = Addon.author,
  90.         version = Addon.version,
  91.         --slashCommand = "/is",
  92.         registerForRefresh = true,
  93.         registerForDefaults = true,
  94.         resetFunc = function()
  95.             Addon.vars = Addon.defaults
  96.  
  97.             IntelSpeller.UI:SetAnchor(CENTER, GuiRoot, CENTER, Addon.vars.posx, Addon.vars.posy)
  98.             IntelSpeller.UI:SetMovable(not Addon.vars.locked)
  99.             IntelSpeller_SetHidden(not Addon.vars.enabled)
  100.  
  101.             EVENT_MANAGER:UnRegisterForUpdate(Addon.name .. "Update")
  102.             EVENT_MANAGER:RegisterForUpdate(Addon.name .. "Update", Addon.vars.refreshRate, function(...) IntelSpeller_OnUpdate() end)
  103.         end,
  104.     }
  105.  
  106.     local optionsData =
  107.     {
  108.         {
  109.             type = "checkbox",
  110.             name = GetString(SI_INTELS_SETTING_ENABLED),
  111.             tooltip = GetString(SI_INTELS_SETTING_ENABLED_TOOLTIP),
  112.             getFunc = function() return Addon.vars.enabled end,
  113.             setFunc = function(value)
  114.                 Addon.vars.enabled = value
  115.                 IntelSpeller_SetHidden(not Addon.vars.enabled)
  116.             end,
  117.             width = "full",
  118.         },
  119.         {
  120.             type = "description",
  121.             text = GetString(SI_INTELS_SETTING_SHOWNOW_TOOLTIP),
  122.             width = "half",
  123.         },
  124.         {
  125.             type = "button",
  126.             name = GetString(SI_INTELS_SETTING_SHOWNOW),
  127.             tooltip = GetString(SI_INTELS_SETTING_SHOWNOW_TOOLTIP),
  128.             func = function()
  129.                 if Addon.vars.enabled then
  130.                     IntelSpeller_SetHidden(false)
  131.                 end
  132.             end,
  133.             width = "half"
  134.         },
  135.         {
  136.             type = "submenu",
  137.             name = GetString(SI_INTELS_SETTING_SIZEOPTIONS),
  138.             controls =
  139.             {
  140.                 [1] = {
  141.                     type = "description",
  142.                     text = GetString(SI_INTELS_SETTING_SIZEOPTIONS_TOOLTIP),
  143.                 },
  144.                 [2] = {
  145.                     type = "slider",
  146.                     name = GetString(SI_INTELS_SETTING_X),
  147.                     tooltip = GetString(SI_INTELS_SETTING_X_TOOLTIP),
  148.                     min = -zo_round(GuiRoot:GetWidth() / 2), max = zo_round(GuiRoot:GetWidth() / 2), step = 1,
  149.                     getFunc = function() return Addon.vars.posx end,
  150.                     setFunc = function(value)
  151.                         Addon.vars.posx = value
  152.                         IntelSpeller.UI:SetAnchor(CENTER, GuiRoot, CENTER, Addon.vars.posx, Addon.vars.posy)
  153.                     end,
  154.                     width = "half",
  155.                 },
  156.                 [3] = {
  157.                     type = "slider",
  158.                     name = GetString(SI_INTELS_SETTING_Y),
  159.                     tooltip = GetString(SI_INTELS_SETTING_Y_TOOLTIP),
  160.                     min = -zo_round(GuiRoot:GetHeight() / 2), max = zo_round(GuiRoot:GetHeight() / 2), step = 1,
  161.                     getFunc = function() return Addon.vars.posy end,
  162.                     setFunc = function(value)
  163.                         Addon.vars.posy = value
  164.                         IntelSpeller.UI:SetAnchor(CENTER, GuiRoot, CENTER, Addon.vars.posx, Addon.vars.posy)
  165.                     end,
  166.                     width = "half",
  167.                 },
  168.                 [4] =
  169.                 {
  170.                     type = "checkbox",
  171.                     name = GetString(SI_INTELS_SETTING_LOCK),
  172.                     tooltip = GetString(SI_INTELS_SETTING_LOCK_TOOLTIP),
  173.                     getFunc = function() return Addon.vars.locked end,
  174.                     setFunc = function(value)
  175.                         Addon.vars.locked = value
  176.                         IntelSpeller.UI:SetMovable(not Addon.vars.locked)
  177.                     end,
  178.                     width = "full",
  179.                 },
  180.             },
  181.         },
  182.         {
  183.             type = "submenu",
  184.             name = GetString(SI_INTELS_SETTING_FOCUSOPTIONS),
  185.             controls =
  186.             {
  187.                 [1] = {
  188.                     type = "description",
  189.                     text = GetString(SI_INTELS_SETTING_FOCUSOPTIONS_TOOLTIP),
  190.                 },
  191.                 [2] = {
  192.                     type = "slider",
  193.                     name = GetString(SI_INTELS_SETTING_REFRESHRATE),
  194.                     tooltip = GetString(SI_INTELS_SETTING_REFRESHRATE_TOOLTIP),
  195.                     warning = GetString(SI_INTELS_SETTING_REFRESHRATE_WARNING),
  196.                     min = 10, max = 100, step = 1,
  197.                     getFunc = function() return Addon.vars.refreshRate end,
  198.                     setFunc = function(value)
  199.                         Addon.vars.refreshRate = value
  200.  
  201.                         EVENT_MANAGER:UnregisterForUpdate(Addon.name .. "Update")
  202.                         EVENT_MANAGER:RegisterForUpdate(Addon.name .. "Update", Addon.vars.refreshRate, function(...) IntelSpeller_OnUpdate() end)
  203.                     end,
  204.                     width = "full",
  205.                 },
  206.                 [3] =
  207.                 {
  208.                     type = "checkbox",
  209.                     name = GetString(SI_INTELS_SETTING_SIEGE),
  210.                     tooltip = GetString(SI_INTELS_SETTING_SIEGE_TOOLTIP),
  211.                     getFunc = function() return Addon.vars.siege end,
  212.                     setFunc = function(value)
  213.                         Addon.vars.siege = value
  214.                     end,
  215.                     width = "full",
  216.                 },
  217.             },
  218.         },
  219.         {
  220.             type = "description",
  221.             text = GetString(SI_INTELS_DESC_INTELSPELLER),
  222.         },
  223.     }
  224.     if GetUnitName("player") == "Elium" or GetUnitName("player") == "Elena d'Alizarine" then -- Just for me ;) (Prevent crash)
  225.         table.insert(optionsData, {
  226.             type = "submenu",
  227.             name = "Espace de développement",
  228.             controls =
  229.             {
  230.                 [1] =
  231.                 {
  232.                     type = "checkbox",
  233.                     name = "Activer",
  234.                     getFunc = function() return Addon.debug.enabled end,
  235.                     setFunc = function(value) Addon.debug.enabled = value end,
  236.                     width = "full",
  237.                 },
  238.             },
  239.         })
  240.     end
  241.  
  242.     Addon.CPL = LAM2:RegisterAddonPanel(Addon.name .. "LAM2Options", panelData)
  243.     LAM2:RegisterOptionControls(Addon.name .. "LAM2Options", optionsData)
  244. end
  245.  
  246. local function IntelSpeller_OnAddOnLoad(eventCode, addOnName)
  247.     if (Addon.name ~= addOnName) then return end
  248.  
  249.     Addon.vars = ZO_SavedVars:NewAccountWide("ProvISSV", 1, nil, Addon.defaults)
  250.  
  251.     SLASH_COMMANDS["/is"] = function(...)
  252.         LAM2:OpenToPanel(Addon.CPL)
  253.     end
  254.  
  255.     IntelSpeller.UI = WINDOW_MANAGER:CreateControl(nil, GuiRoot, CT_TOPLEVELCONTROL)
  256.     IntelSpeller.UI:SetMouseEnabled(true)
  257.     IntelSpeller.UI:SetMovable(not Addon.vars.locked)
  258.     IntelSpeller.UI:SetClampedToScreen(true)
  259.     IntelSpeller.UI:SetDimensions(100, 64)
  260.     IntelSpeller.UI:SetDrawLevel(0)
  261.  
  262.     IntelSpeller.UI:SetHidden(not Addon.vars.enabled)
  263.     IntelSpeller.UI:ClearAnchors()
  264.     IntelSpeller.UI:SetAnchor(CENTER, GuiRoot, CENTER, Addon.vars.posx, Addon.vars.posy)
  265.  
  266.     IntelSpeller.UI:SetHandler("OnMoveStop", function(...) IntelSpeller_OnMoveStop(...) end)
  267.  
  268.     --IntelSpeller.Background = WINDOW_MANAGER:CreateControl(nil, IntelSpeller.UI, CT_BACKDROP)
  269.     --IntelSpeller.Background:SetAnchorFill(IntelSpeller.UI)
  270.     --IntelSpeller.Background:SetEdgeColor(1, 1, 1, 1)
  271.  
  272.     local fragment = ZO_SimpleSceneFragment:New(IntelSpeller.UI)
  273.     SCENE_MANAGER:GetScene('hud'):AddFragment(fragment)
  274.     SCENE_MANAGER:GetScene('hudui'):AddFragment(fragment)
  275.  
  276.     EVENT_MANAGER:UnregisterForEvent(Addon.name, EVENT_ADD_ON_LOADED)
  277.  
  278.     createLAM2Panel()
  279.     EVENT_MANAGER:RegisterForUpdate(Addon.name .. "Update", Addon.vars.refreshRate, function(...) IntelSpeller_OnUpdate() end)
  280.  
  281.     EVENT_MANAGER:RegisterForEvent(Addon.name, EVENT_BEGIN_SIEGE_CONTROL, function(...)
  282.         if Addon.vars.enabled then
  283.             IntelSpeller_SetHidden(not Addon.vars.siege)
  284.         end
  285.     end)
  286. end
  287.  
  288. function IntelSpeller_OnInitialized()
  289.     EVENT_MANAGER:RegisterForEvent(Addon.name, EVENT_ADD_ON_LOADED, function(...) IntelSpeller_OnAddOnLoad(...) end)
  290. end
Optional Files (0)


Post A Reply Comment Options
Unread 06/11/16, 12:04 PM  
Provision
 
Provision's Avatar
AddOn Author - Click to view AddOns

Forum posts: 43
File comments: 101
Uploads: 11
Maybe I will make assistant who advices the keys/actions to do without keys changer.
Report comment to moderator  
Reply With Quote
Unread 06/11/16, 08:20 AM  
Nita

Forum posts: 6
File comments: 21
Uploads: 0
Why post it if it doesn't work ?
Report comment to moderator  
Reply With Quote
Unread 06/11/16, 07:50 AM  
Provision
 
Provision's Avatar
AddOn Author - Click to view AddOns

Forum posts: 43
File comments: 101
Uploads: 11
Originally Posted by QuadroTony
what is this? if you update this you need to change category
It's outdated. Doesn't work with protected function.
Report comment to moderator  
Reply With Quote
Unread 06/11/16, 07:30 AM  
QuadroTony
Banned
 
QuadroTony's Avatar
AddOn Author - Click to view AddOns

Forum posts: 828
File comments: 3866
Uploads: 3
what is this? if you update this you need to change category
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: