Advertisement
Guest User

Untitled

a guest
Mar 11th, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.33 KB | None | 0 0
  1. local missingParameter = {}
  2.  
  3. STAT_CRIT_DMG=47
  4. STAT_CRIT_DMG_MAG=46
  5. EsoStrings[SI_DERIVEDSTATS47] ="|cc5c29eWeapon Critical Damage|r"
  6. EsoStrings[SI_DERIVEDSTATS46] ="|cc5c29eSpell Critical Damage|r"
  7. EsoStrings[SI_DERIVEDSTATS34] ="|cc5c29eSpell Penetration|r" -- STAT_SPELL_PENETRATION = 34
  8. EsoStrings[SI_DERIVEDSTATS33] ="|cc5c29ePhysical Penetration|r" -- STAT_PHYSICAL_PENETRATION = 33
  9.  
  10.  
  11.  
  12. CritD=CritD or {}
  13. local StrWep= "The percentage of increased damage from critically attacking an enemy (vs non-crit attacks) with physical abilities."
  14. local StrMag= "The percentage of increased damage from critically attacking an enemy (vs non-crit attacks) with magic abilities."
  15.  
  16. ZO_CreateStringId("SI_STAT_TOOLTIP_CRIT_DMG", StrWep)
  17. ZO_CreateStringId("SI_STAT_TOOLTIP_CRIT_DMG_MAG", StrMag)
  18. ZO_STAT_TOOLTIP_DESCRIPTIONS[STAT_CRIT_DMG]=SI_STAT_TOOLTIP_CRIT_DMG
  19. ZO_STAT_TOOLTIP_DESCRIPTIONS[STAT_CRIT_DMG_MAG]=SI_STAT_TOOLTIP_CRIT_DMG_MAG
  20.  
  21.  
  22.  
  23. CritD.Forces={
  24. ["Major Force"]={ ["name"]="Major Force", ["value"]=15 },
  25. ["Minor Force"]={["name"]="Minor Force", ["value"]=10 }
  26. }
  27. function CritD:TheForceBeWithYou()
  28. local flag=0
  29. local X=0
  30. for i=1, GetNumBuffs("player") do
  31. X=select(1,GetUnitBuffInfo("player",i))
  32. if self.Forces[X] ~=nil then -- x is the code of one of the listed stones
  33. flag = flag+self.Forces[X].value
  34. end
  35. end
  36. return flag
  37. end
  38.  
  39. function CritD:Ggdivines()
  40. local T= {
  41. EQUIP_SLOT_HEAD,
  42. EQUIP_SLOT_CHEST,
  43. EQUIP_SLOT_SHOULDERS,
  44. EQUIP_SLOT_WAIST,
  45. EQUIP_SLOT_WRIST,
  46. EQUIP_SLOT_LEGS,
  47. EQUIP_SLOT_FEET
  48. }
  49. if GetActiveWeaponPairInfo()==1 then -- main weapons active
  50. T[#T+1]=EQUIP_SLOT_OFF_HAND -- append off hand, which can be shield
  51. elseif GetActiveWeaponPairInfo()==2 then -- backup weapons active
  52. T[#T+1]=EQUIP_SLOT_BACKUP_OFF -- append off hand, which can be shield
  53. end
  54. local flag=0
  55. local x, y=0
  56. for _,i in pairs(T) do
  57. x,y = GetItemTrait(BAG_WORN,i)
  58. if x==ITEM_TRAIT_TYPE_ARMOR_DIVINES then
  59. flag=flag + 2.5 + GetItemQuality(BAG_WORN,i)
  60. end
  61. end
  62. return flag/100
  63. end
  64.  
  65. local STONE_VALUE_SHADOW=0.09
  66. function CritD:TheShadowBeWithYou()
  67. local result=0
  68. local x=0
  69. for i=1, GetNumBuffs("player") do
  70. x=select(11,GetUnitBuffInfo("player",i))
  71. if x==13984 then -- code for shadow stone
  72. result = math.floor(100*STONE_VALUE_SHADOW * (1+CritD:Ggdivines()))
  73. end
  74. end
  75. return result
  76. end
  77.  
  78. CritD.TemplarT={}; CritD.NightbladeT={}
  79. for i=1, 6 do
  80. local Id= GetSkillAbilityId(1,1,i)
  81. CritD.TemplarT[Id]=1 -- The table has keys equal to the templar aedric spear abilities. Second entry not nil
  82. CritD.NightbladeT[Id]=1 -- The table has keys equal to the nb ass abilities. Second entry not nil
  83. end
  84.  
  85. function CritD:TheClassBeWithYou()
  86. local class=GetUnitClassId("player") -- returns number in bijection with the 5 (6!) classes
  87. local flag=0
  88. local test=0
  89.  
  90. -- Assuming player has appropiate skills on bar if a nb or templar. will edit as i learn more
  91.  
  92. if class==3 then -- If nb
  93. for i=3, 9 do
  94. if self.NightbladeT[GetSlotBoundId(i)] ~= nil then -- Checks to see if one has an ass ability slotted
  95. test= 1
  96. end
  97. end
  98. local a=GetSkillAbilityUpgradeInfo(1,1,10) -- Is hem passive leveled?
  99. flag=5*a*test
  100. elseif class==6 then -- if Templar
  101. for i=3, 9 do
  102. if self.TemplarT[GetSlotBoundId(i)] ~= nil then -- Checks to see if one has an aedric spear ability
  103. test= 1
  104. end
  105. end
  106. local a=GetSkillAbilityUpgradeInfo(1,1,7) -- Is passive leveled?
  107. flag=5*a*test
  108. else
  109. flag =0
  110. end
  111.  
  112. return flag
  113. end
  114.  
  115. function CritD:CritDamage(type) -- type =1 stam, 0 mag
  116. local total,base =0, 50 -- Default crit damage is 50
  117. local GStone=self:TheShadowBeWithYou()
  118. local GClass=self:TheClassBeWithYou()
  119. local GBuff=self:TheForceBeWithYou()
  120.  
  121. -- P=0.01*math.max(GetNumPointsSpentOnChampionSkill(5, 2),GetNumPointsSpentOnChampionSkill(7, 3))
  122.  
  123. local Ps = GetNumPointsSpentOnChampionSkill(5, 2) -- Points in precise strikes
  124. local Pm = GetNumPointsSpentOnChampionSkill(7, 3) -- Points into elfborn
  125.  
  126. local P = 0.01*(type*Ps+(1-type)*Pm) -- So if type =1 stam build, 0 mag
  127. local GCP = 0.25*P*(2-P) -- +(1-P)*(0.5-P)*P*2/250
  128. GCP = math.floor(100*GCP)
  129. total = base +GClass+GCP +GBuff+ GStone
  130. return total
  131. end
  132.  
  133.  
  134. CritD.GetGet =GetPlayerStat
  135.  
  136. GetPlayerStat = function(stat, ...)
  137. local flag=0
  138. if stat==STAT_CRIT_DMG then flag =CritD:CritDamage(1)
  139. elseif stat==STAT_CRIT_DMG_MAG then flag =CritD:CritDamage(0)
  140. else flag=CritD.GetGet(stat, ...)
  141. end
  142. return flag
  143. -- GetPlayerStat=GetGet -- Not sure if this will work right .. ?
  144. end
  145.  
  146. local AddStatRowOrg = ZO_Stats.AddStatRow
  147.  
  148. ZO_Stats.AddStatRow = function(...) -- originally has two arguments.
  149. missingParameter = (select(1,...)) -- select(1,...) seems to just return ... ?
  150. local ret = AddStatRowOrg(...)
  151. ZO_Stats.AddStatRow = AddStatRowOrg
  152. return ret
  153. end
  154.  
  155.  
  156. local CreateAttributesSectionOrg = ZO_Stats.CreateAttributesSection
  157.  
  158. ZO_Stats.CreateAttributesSection = function(...)
  159. local ret = CreateAttributesSectionOrg(...)
  160.  
  161. ZO_Stats.SetNextControlPadding(missingParameter,20) -- There's a missing parameter because functions defined as self:SetNextControlPadding, etc
  162. ZO_Stats.AddStatRow(missingParameter,STAT_SPELL_PENETRATION,STAT_PHYSICAL_PENETRATION)
  163.  
  164. ZO_Stats.SetNextControlPadding(missingParameter,0)
  165.  
  166. ZO_Stats.AddStatRow(missingParameter,STAT_CRIT_DMG_MAG, STAT_CRIT_DMG)
  167.  
  168. return ret
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement