Thread Tools Display Modes
Prev Previous Post   Next Post Next
11/05/14, 03:41 PM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Anyway if you are still interested in making such addon, here is rough skelleton:

CriTip.txt:
Code:
## APIVersion: 100010
## Title: |cEFEBBECriTip|r v0.2
## Description: Adds critical chance to ability and skill tooltips. 
## Author: |cEFEBBEGarkin|r
## Version: 0.2

CriTip.lua
CriTip.lua
Lua Code:
  1. local abilityToCrit = {
  2. --Dragonknight
  3.    --Ardent Flame
  4.    ["Dragonknight Standard"]  = STAT_SPELL_CRITICAL,
  5.    ["Shifting Standard"]      = STAT_SPELL_CRITICAL,
  6.    ["Standard of Might"]      = STAT_SPELL_CRITICAL,
  7.    ["Fiery Grip"]             = STAT_SPELL_CRITICAL,
  8.    ["Empowering Chains"]      = STAT_SPELL_CRITICAL,
  9.    ["Extended Chains"]        = STAT_SPELL_CRITICAL,
  10.    ["Searing Strike"]         = STAT_CRITICAL_STRIKE, --(dot: spell)
  11.    ["Unstable Flame"]         = STAT_CRITICAL_STRIKE, --(dot: spell)
  12.    ["Burning Embers"]         = STAT_CRITICAL_STRIKE, --(dot: spell)
  13.    ["Fiery Breath"]           = STAT_SPELL_CRITICAL,
  14.    ["Burning Breath"]         = STAT_SPELL_CRITICAL,
  15.    ["Engulfing Flames"]       = STAT_SPELL_CRITICAL,
  16.    ["Lava Whip"]              = STAT_CRITICAL_STRIKE,
  17.    ["Molten Whip"]            = STAT_CRITICAL_STRIKE,
  18.    ["Flame Lash"]             = STAT_CRITICAL_STRIKE,
  19.    ["Inferno"]                = STAT_SPELL_CRITICAL,
  20.    ["Flames of Oblivion"]     = STAT_SPELL_CRITICAL,
  21.    ["Sea of Flames"]          = STAT_SPELL_CRITICAL,
  22.  
  23.    --Draconic Power
  24.    ["Dragon Leap"]            = STAT_CRITICAL_STRIKE,
  25.    ["Take Flight"]            = STAT_CRITICAL_STRIKE,
  26.    ["Ferocious Leap"]         = STAT_CRITICAL_STRIKE,
  27. -- ["Spiked Armor"]           = ???,
  28. -- ["Razor Armor"]            = ???,
  29.    ["Volatile Armor"]         = STAT_SPELL_CRITICAL,
  30.    ["Dark Talons"]            = STAT_SPELL_CRITICAL,
  31.    ["Burning Talons"]         = STAT_SPELL_CRITICAL,
  32.    ["Choking Talons"]         = STAT_SPELL_CRITICAL,
  33. -- ["Dragon Blood"]           = ???,
  34. -- ["Green Dragon Blood"]     = ???,
  35. -- ["Coagulating Blood"]      = ???,
  36. -- ["Reflective Scale"]       = ???,
  37. -- ["Reflective Plate"]       = ???,
  38. -- ["Dragon Fire Scale"]      = ???,
  39.    ["Inhale"]                 = STAT_SPELL_CRITICAL,
  40.    ["Deep Breath"]            = STAT_SPELL_CRITICAL,
  41.    ["Draw Essence"]           = STAT_SPELL_CRITICAL,
  42.  
  43.    --Earthen Heart
  44.    ["Magma Armor"]            = STAT_SPELL_CRITICAL,
  45.    ["Magma Shell"]            = STAT_SPELL_CRITICAL,
  46.    ["Corrosive Armor"]        = STAT_SPELL_CRITICAL,
  47.    ["Stonefist"]              = STAT_SPELL_CRITICAL,
  48.    ["Obsidian Shard"]         = STAT_SPELL_CRITICAL,
  49.    ["Stone Giant"]            = STAT_SPELL_CRITICAL,
  50. -- ["Molten Weapons"]         = ???,
  51. -- ["Igneous Weapons"]        = ???,
  52. -- ["Molten Armaments"]       = ???,
  53. -- ["Obsidian Shield"]        = ???,
  54. -- ["Igneous Shield"]         = ???,
  55.    ["Fragmented Shield"]      = STAT_SPELL_CRITICAL,
  56.    ["Petrify"]                = STAT_SPELL_CRITICAL,
  57.    ["Fossilize"]              = STAT_SPELL_CRITICAL,
  58.    ["Shattering Rocks"]       = STAT_SPELL_CRITICAL,
  59. -- ["Ash Cloud"]              = ???,
  60.    ["Cinder Storm"]           = STAT_SPELL_CRITICAL,
  61. -- ["Eruption"]               = ???,
  62.  
  63. --NightBlade
  64.    --Assassination
  65.    ["Death Stroke"]           = STAT_CRITICAL_STRIKE,
  66.    ["Incapacitating Strike"]  = STAT_CRITICAL_STRIKE,
  67.    ["Soul Harvest"]           = STAT_CRITICAL_STRIKE,
  68.    ["Assassin's Blade"]       = STAT_CRITICAL_STRIKE,
  69.    ["Killer's Blade"]         = STAT_CRITICAL_STRIKE,
  70.    ["Impale"]                 = STAT_CRITICAL_STRIKE,
  71.    ["Teleport Strike"]        = STAT_CRITICAL_STRIKE,
  72.    ["Lotus Fan"]              = STAT_CRITICAL_STRIKE,
  73.    ["Ambush"]                 = STAT_CRITICAL_STRIKE,
  74. -- ["Blur"]                   = ???,
  75. -- ["Mirage"]                 = ???,
  76. -- ["Double Take"]            = ???,
  77. -- ["Mark Target"]            = ???,
  78. -- ["Piercing Mark"]          = ???,
  79. -- ["Reaper's Mark"]          = ???,
  80. -- ["Haste"]                  = ???,
  81. -- ["Focused Attacks"]        = ???,
  82. -- ["Incapacitate"]           = ???,
  83.  
  84.    --Shadow
  85. -- ["Consuming Darkness"]     = ???,
  86. -- ["Bolstering Darkness"]    = ???,
  87.    ["Morph Veil of Blades"]   = STAT_SPELL_CRITICAL,
  88. -- ["Shadow Cloak"]           = ???,
  89. -- ["Shadowy Disguise"]       = ???,
  90. -- ["Dark Cloak"]             = ???,
  91.    ["Veiled Strike"]          = STAT_CRITICAL_STRIKE,
  92.    ["Surprise Attack"]        = STAT_CRITICAL_STRIKE,
  93.    ["Concealed Weapon"]       = STAT_CRITICAL_STRIKE,
  94.    ["Path of Darkness"]       = STAT_SPELL_CRITICAL,
  95.    ["Twisting Path"]          = STAT_SPELL_CRITICAL,
  96.    ["Refreshing Path"]        = STAT_SPELL_CRITICAL,
  97. -- ["Aspect of Terror"]       = ???,
  98. -- ["Mass Hysteria"]          = ???,
  99. -- ["Manifestation of Terror"] = ???,
  100. -- ["Summon Shade"]           = ???,
  101. -- ["Dark Shades"]            = ???,
  102. -- ["Shadow Image"]           = ???,
  103.  
  104.    --Siphoning
  105.    ["Soul Shred"]             = STAT_SPELL_CRITICAL,
  106.    ["Soul Siphon"]            = STAT_SPELL_CRITICAL,
  107.    ["Soul Tether"]            = STAT_SPELL_CRITICAL,
  108.    ["Strife"]                 = STAT_SPELL_CRITICAL,
  109.    ["Funnel Health"]          = STAT_SPELL_CRITICAL,
  110.    ["Swallow Soul"]           = STAT_SPELL_CRITICAL,
  111.    ["Agony"]                  = STAT_SPELL_CRITICAL,
  112.    ["Prolonged Suffering"]    = STAT_SPELL_CRITICAL,
  113.    ["Malefic Wreath"]         = STAT_SPELL_CRITICAL,
  114.    ["Cripple"]                = STAT_SPELL_CRITICAL,
  115.    ["Debilitate"]             = STAT_SPELL_CRITICAL,
  116.    ["Crippling Grasp"]        = STAT_SPELL_CRITICAL,
  117. -- ["Siphonig Strikes"]       = ???,
  118. -- ["Leeching Strikes"]       = ???,
  119. -- ["Siphoning Attacks"]      = ???,
  120.    ["Drain Power"]            = STAT_SPELL_CRITICAL,
  121.    ["Power Extraction"]       = STAT_SPELL_CRITICAL,
  122.    ["Sap Essence"]            = STAT_SPELL_CRITICAL,
  123.  
  124.    --Sorcerer
  125.    --Daedric Summoning
  126.    ["Summon Storm Atronach"]  = STAT_SPELL_CRITICAL,
  127.    ["Daedric Curse"]          = STAT_SPELL_CRITICAL,
  128.  
  129.    --Dark Magic
  130.    ["Crystal Shard"]          = STAT_SPELL_CRITICAL,
  131.    ["Shattering Prison"]      = STAT_SPELL_CRITICAL,
  132.    ["Daedric Mines"]          = STAT_SPELL_CRITICAL,
  133.  
  134.    --Storm Calling
  135.    ["Overload"]               = STAT_SPELL_CRITICAL,
  136.    ["Mages Fury"]             = STAT_SPELL_CRITICAL,
  137.    ["Lightning Form"]         = STAT_SPELL_CRITICAL,
  138.    ["Lightning Splash"]       = STAT_SPELL_CRITICAL,
  139.    ["Morph Sreak"]            = STAT_SPELL_CRITICAL,
  140.  
  141. --Templar
  142.    --Aedric Spear
  143.    ["Radial Sweep"]           = STAT_CRITICAL_STRIKE,
  144.    ["Puncturing Strikes"]     = STAT_CRITICAL_STRIKE,
  145.    ["Piercing Javelin"]       = STAT_SPELL_CRITICAL,
  146.    ["Focused Charge"]         = STAT_CRITICAL_STRIKE,
  147.    ["Spear Shards"]           = STAT_SPELL_CRITICAL,
  148.    ["Sun Shield"]             = STAT_SPELL_CRITICAL,
  149.  
  150.    --Passive Abilities
  151.    ["Burning Light"]          = STAT_SPELL_CRITICAL,
  152.  
  153.    --Dawn's Wrath
  154.    ["Nova"]                   = STAT_SPELL_CRITICAL,
  155.    ["Sun Fire"]               = STAT_SPELL_CRITICAL,
  156.    ["Solar Flare"]            = STAT_SPELL_CRITICAL,
  157.    ["Backlash"]               = STAT_SPELL_CRITICAL,
  158.    ["Unstable Core"]          = STAT_SPELL_CRITICAL,
  159.    ["Searing Light"]          = STAT_SPELL_CRITICAL,
  160.  
  161.    --Restoring Light
  162.    ["Rite of Passage"]        = STAT_SPELL_CRITICAL,
  163.    ["Rushed Ceremony"]        = STAT_SPELL_CRITICAL,
  164.    ["Healing Ritual"]         = STAT_SPELL_CRITICAL,
  165.    ["Cleansing Ritual"]       = STAT_SPELL_CRITICAL,
  166.    ["Rune Focus"]             = STAT_SPELL_CRITICAL,
  167.  
  168. --2 handed, 1Hand and Shield, Duel Wield, Bow: weapon
  169. --Exceptions:
  170. --Dual Wielding
  171. --Sparks: na/Morph Ember Explosion: Weapon
  172. --Bow
  173. --Volley: Weapon/Morph Scorched Earth: Weapon, DoT: Spell
  174. --Snipe: Weapon/Morph Lethal Arrow: Weapon, DoT: Spell
  175.  
  176. --Destruction Staff, Restoration Staff: spell
  177.  
  178. --Fighters Guild:
  179.    ["Dawnbreaker"]            = STAT_CRITICAL_STRIKE,
  180.    ["Silver Bolts"]           = STAT_CRITICAL_STRIKE,
  181.    ["Turn Undead"]            = STAT_SPELL_CRITICAL,
  182.    ["Expert Hunter"]          = STAT_SPELL_CRITICAL,
  183.    ["Trap Beast"]             = STAT_SPELL_CRITICAL,
  184.  
  185. --Mages Guild   spell (only where a damage output is concerned)
  186. --Undaunted spell (only where a damage output is concerned)
  187. --Soul Magic    spell (only where a damage output is concerned)
  188.  
  189. --Lycanthropy
  190.    ["Pounce"]                 = STAT_CRITICAL_STRIKE,
  191.    ["Hircine's Bounty"]       = STAT_SPELL_CRITICAL,
  192.    ["Piercing Howl"]          = STAT_CRITICAL_STRIKE,
  193.    ["Infectious Claw"]        = STAT_CRITICAL_STRIKE,
  194.    ["Claws of Life"]          = STAT_CRITICAL_STRIKE, --HoT: Spell
  195.  
  196. --Vampirism spell
  197. }
  198.  
  199. local translations = {
  200. --German
  201.    ["Drachenritter-Standarte"]         = "Dragonknight Standard",
  202.    ["feuriger Griff"]                  = "Fiery Grip",
  203.    ["versengender Schlag"]             = "Searing Strike",
  204.    ["feuriger Odem"]                   = "Fiery Breath",
  205. --French
  206.    ["Étendard des Chevaliers-dragons"] = "Dragonknight Standard",
  207.    ["Poigne ardente"]                  = "Fiery Grip",
  208.    ["Frappe incendiaire"]              = "Searing Strike",
  209.    ["Souffle ardent"]                  = "Fiery Breath",
  210. }
  211.  
  212. local function AddCriticalChance(self)
  213.    local control = WINDOW_MANAGER:GetMouseOverControl()
  214.    if control then
  215.       local abilityId
  216.       if control.actionId then
  217.          abilityId = control.actionId
  218.       elseif control.index and control.lineIndex and control.skillType then
  219.          abilityId = GetSkillAbilityId(control.skillType, control.lineIndex, control.index)
  220.       end
  221.  
  222.       if abilityId then
  223.          local abilityName = zo_strformat("<<1>>", GetAbilityName(abilityId))
  224.          if #abilityName > 0 then
  225.             abilityName = translations[abilityName] or abilityName
  226.             local stat = abilityToCrit[abilityName]
  227.             if stat == STAT_SPELL_CRITICAL then
  228.                name = ZO_TOOLTIP_DEFAULT_COLOR:Colorize(GetString(SI_STAT_SPELL_CRITICAL))
  229.                value = ("%04.02f%%"):format(GetPlayerStat(STAT_SPELL_CRITICAL, STAT_BONUS_OPTION_APPLY_BONUS, STAT_SOFT_CAP_OPTION_APPLY_SOFT_CAP) / 10)
  230.             elseif stat == STAT_CRITICAL_STRIKE then
  231.                name = ZO_TOOLTIP_DEFAULT_COLOR:Colorize(GetString(SI_STAT_CRITICAL_STRIKE))
  232.                value = ("%04.02f%%"):format(GetPlayerStat(STAT_CRITICAL_STRIKE, STAT_BONUS_OPTION_APPLY_BONUS, STAT_SOFT_CAP_OPTION_APPLY_SOFT_CAP) / 10)
  233.             end
  234.  
  235.             if name and value then
  236.                self:AddVerticalPadding(-6)
  237.                self:AddLine(name, "ZoFontWinH4", 1, 1, 1, LEFT, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_LEFT, true)
  238.                self:AddVerticalPadding(-25)
  239.                self:AddLine(value, "ZoFontWinH4", 1, 1, 1, RIGHT, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_RIGHT, true)
  240.                self:AddVerticalPadding(6)
  241.             end
  242.          end
  243.       end
  244.    end
  245. end
  246.  
  247. local function AbilityAddControl(self, control)
  248.    if control:GetName() == "AbilityTooltipDivider2" then
  249.       AddCriticalChance(self)
  250.    end
  251. end
  252.  
  253. local function SkillAddControl(self, control)
  254.    if control:GetName() == "SkillTooltipDivider2" then
  255.       AddCriticalChance(self)
  256.    end
  257. end
  258.  
  259. local function OnAddOnLoaded(eventCode, addonName)
  260.    if addonName:find("^ZO_") then return end
  261.    EVENT_MANAGER:UnregisterForEvent("CRITIP", eventCode)
  262.  
  263.    ZO_PreHook(AbilityTooltip, "AddControl", AbilityAddControl)
  264.    ZO_PreHook(SkillTooltip, "AddControl", SkillAddControl)
  265. end
  266. EVENT_MANAGER:RegisterForEvent("CRITIP", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
You will need just to add all missing skills and morphs to the data table and if you want to make it work with localized clients, add translations from the AbilityList attached here: http://www.esoui.com/forums/showthread.php?t=2357 (ability names are case sensitive and should be added without control characters ^??? - for example "Drain d'âme" not "Drain d'âme^m".)

I will not have time to finish this addon as I'm tomorrow leaving for four weeks to Mexico...

Last edited by Garkin : 12/03/14 at 02:31 PM. Reason: Updated source
  Reply With Quote
 

ESOUI » AddOns » AddOn Search/Requests » Skill/Ability and Crit type Addon request

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off