Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local missingParameter = {}
- STAT_CRIT_DMG=47
- STAT_CRIT_DMG_MAG=46
- EsoStrings[SI_DERIVEDSTATS47] ="|cc5c29eWeapon Critical Damage|r"
- EsoStrings[SI_DERIVEDSTATS46] ="|cc5c29eSpell Critical Damage|r"
- EsoStrings[SI_DERIVEDSTATS34] ="|cc5c29eSpell Penetration|r" -- STAT_SPELL_PENETRATION = 34
- EsoStrings[SI_DERIVEDSTATS33] ="|cc5c29ePhysical Penetration|r" -- STAT_PHYSICAL_PENETRATION = 33
- CritD=CritD or {}
- local StrWep= "The percentage of increased damage from critically attacking an enemy (vs non-crit attacks) with physical abilities."
- local StrMag= "The percentage of increased damage from critically attacking an enemy (vs non-crit attacks) with magic abilities."
- ZO_CreateStringId("SI_STAT_TOOLTIP_CRIT_DMG", StrWep)
- ZO_CreateStringId("SI_STAT_TOOLTIP_CRIT_DMG_MAG", StrMag)
- ZO_STAT_TOOLTIP_DESCRIPTIONS[STAT_CRIT_DMG]=SI_STAT_TOOLTIP_CRIT_DMG
- ZO_STAT_TOOLTIP_DESCRIPTIONS[STAT_CRIT_DMG_MAG]=SI_STAT_TOOLTIP_CRIT_DMG_MAG
- CritD.Forces={
- ["Major Force"]={ ["name"]="Major Force", ["value"]=15 },
- ["Minor Force"]={["name"]="Minor Force", ["value"]=10 }
- }
- function CritD:TheForceBeWithYou()
- local flag=0
- local X=0
- for i=1, GetNumBuffs("player") do
- X=select(1,GetUnitBuffInfo("player",i))
- if self.Forces[X] ~=nil then -- x is the code of one of the listed stones
- flag = flag+self.Forces[X].value
- end
- end
- return flag
- end
- function CritD:Ggdivines()
- local T= {
- EQUIP_SLOT_HEAD,
- EQUIP_SLOT_CHEST,
- EQUIP_SLOT_SHOULDERS,
- EQUIP_SLOT_WAIST,
- EQUIP_SLOT_WRIST,
- EQUIP_SLOT_LEGS,
- EQUIP_SLOT_FEET
- }
- if GetActiveWeaponPairInfo()==1 then -- main weapons active
- T[#T+1]=EQUIP_SLOT_OFF_HAND -- append off hand, which can be shield
- elseif GetActiveWeaponPairInfo()==2 then -- backup weapons active
- T[#T+1]=EQUIP_SLOT_BACKUP_OFF -- append off hand, which can be shield
- end
- local flag=0
- local x, y=0
- for _,i in pairs(T) do
- x,y = GetItemTrait(BAG_WORN,i)
- if x==ITEM_TRAIT_TYPE_ARMOR_DIVINES then
- flag=flag + 2.5 + GetItemQuality(BAG_WORN,i)
- end
- end
- return flag/100
- end
- local STONE_VALUE_SHADOW=0.09
- function CritD:TheShadowBeWithYou()
- local result=0
- local x=0
- for i=1, GetNumBuffs("player") do
- x=select(11,GetUnitBuffInfo("player",i))
- if x==13984 then -- code for shadow stone
- result = math.floor(100*STONE_VALUE_SHADOW * (1+CritD:Ggdivines()))
- end
- end
- return result
- end
- CritD.TemplarT={}; CritD.NightbladeT={}
- for i=1, 6 do
- local Id= GetSkillAbilityId(1,1,i)
- CritD.TemplarT[Id]=1 -- The table has keys equal to the templar aedric spear abilities. Second entry not nil
- CritD.NightbladeT[Id]=1 -- The table has keys equal to the nb ass abilities. Second entry not nil
- end
- function CritD:TheClassBeWithYou()
- local class=GetUnitClassId("player") -- returns number in bijection with the 5 (6!) classes
- local flag=0
- local test=0
- -- Assuming player has appropiate skills on bar if a nb or templar. will edit as i learn more
- if class==3 then -- If nb
- for i=3, 9 do
- if self.NightbladeT[GetSlotBoundId(i)] ~= nil then -- Checks to see if one has an ass ability slotted
- test= 1
- end
- end
- local a=GetSkillAbilityUpgradeInfo(1,1,10) -- Is hem passive leveled?
- flag=5*a*test
- elseif class==6 then -- if Templar
- for i=3, 9 do
- if self.TemplarT[GetSlotBoundId(i)] ~= nil then -- Checks to see if one has an aedric spear ability
- test= 1
- end
- end
- local a=GetSkillAbilityUpgradeInfo(1,1,7) -- Is passive leveled?
- flag=5*a*test
- else
- flag =0
- end
- return flag
- end
- function CritD:CritDamage(type) -- type =1 stam, 0 mag
- local total,base =0, 50 -- Default crit damage is 50
- local GStone=self:TheShadowBeWithYou()
- local GClass=self:TheClassBeWithYou()
- local GBuff=self:TheForceBeWithYou()
- -- P=0.01*math.max(GetNumPointsSpentOnChampionSkill(5, 2),GetNumPointsSpentOnChampionSkill(7, 3))
- local Ps = GetNumPointsSpentOnChampionSkill(5, 2) -- Points in precise strikes
- local Pm = GetNumPointsSpentOnChampionSkill(7, 3) -- Points into elfborn
- local P = 0.01*(type*Ps+(1-type)*Pm) -- So if type =1 stam build, 0 mag
- local GCP = 0.25*P*(2-P) -- +(1-P)*(0.5-P)*P*2/250
- GCP = math.floor(100*GCP)
- total = base +GClass+GCP +GBuff+ GStone
- return total
- end
- CritD.GetGet =GetPlayerStat
- GetPlayerStat = function(stat, ...)
- local flag=0
- if stat==STAT_CRIT_DMG then flag =CritD:CritDamage(1)
- elseif stat==STAT_CRIT_DMG_MAG then flag =CritD:CritDamage(0)
- else flag=CritD.GetGet(stat, ...)
- end
- return flag
- -- GetPlayerStat=GetGet -- Not sure if this will work right .. ?
- end
- local AddStatRowOrg = ZO_Stats.AddStatRow
- ZO_Stats.AddStatRow = function(...) -- originally has two arguments.
- missingParameter = (select(1,...)) -- select(1,...) seems to just return ... ?
- local ret = AddStatRowOrg(...)
- ZO_Stats.AddStatRow = AddStatRowOrg
- return ret
- end
- local CreateAttributesSectionOrg = ZO_Stats.CreateAttributesSection
- ZO_Stats.CreateAttributesSection = function(...)
- local ret = CreateAttributesSectionOrg(...)
- ZO_Stats.SetNextControlPadding(missingParameter,20) -- There's a missing parameter because functions defined as self:SetNextControlPadding, etc
- ZO_Stats.AddStatRow(missingParameter,STAT_SPELL_PENETRATION,STAT_PHYSICAL_PENETRATION)
- ZO_Stats.SetNextControlPadding(missingParameter,0)
- ZO_Stats.AddStatRow(missingParameter,STAT_CRIT_DMG_MAG, STAT_CRIT_DMG)
- return ret
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement