1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
-------------------
-- General Stats --
-------------------
STAT_TYPES =
{
[ ATTRIBUTE_HEALTH ] = STAT_HEALTH_MAX ,
[ ATTRIBUTE_MAGICKA ] = STAT_MAGICKA_MAX ,
[ ATTRIBUTE_STAMINA ] = STAT_STAMINA_MAX ,
}
ZO_STAT_TOOLTIP_DESCRIPTIONS =
{
[ STAT_HEALTH_MAX ] = SI_STAT_TOOLTIP_HEALTH_MAX ,
[ STAT_HEALTH_REGEN_IDLE ] = SI_STAT_TOOLTIP_HEALTH_REGENERATION_IDLE ,
[ STAT_HEALTH_REGEN_COMBAT ] = SI_STAT_TOOLTIP_HEALTH_REGENERATION_COMBAT ,
[ STAT_MAGICKA_MAX ] = SI_STAT_TOOLTIP_MAGICKA_MAX ,
[ STAT_MAGICKA_REGEN_IDLE ] = SI_STAT_TOOLTIP_MAGICKA_REGENERATION_IDLE ,
[ STAT_MAGICKA_REGEN_COMBAT ] = SI_STAT_TOOLTIP_MAGICKA_REGENERATION_COMBAT ,
[ STAT_STAMINA_MAX ] = SI_STAT_TOOLTIP_STAMINA_MAX ,
[ STAT_STAMINA_REGEN_IDLE ] = SI_STAT_TOOLTIP_STAMINA_REGENERATION_IDLE ,
[ STAT_STAMINA_REGEN_COMBAT ] = SI_STAT_TOOLTIP_STAMINA_REGENERATION_COMBAT ,
[ STAT_SPELL_POWER ] = SI_STAT_TOOLTIP_SPELL_POWER ,
[ STAT_SPELL_PENETRATION ] = SI_STAT_TOOLTIP_SPELL_PENETRATION ,
[ STAT_SPELL_CRITICAL ] = SI_STAT_TOOLTIP_SPELL_CRITICAL ,
[ STAT_ATTACK_POWER ] = SI_STAT_TOOLTIP_ATTACK_POWER ,
[ STAT_PHYSICAL_PENETRATION ] = SI_STAT_TOOLTIP_PHYSICAL_PENETRATION ,
[ STAT_CRITICAL_STRIKE ] = SI_STAT_TOOLTIP_CRITICAL_STRIKE ,
[ STAT_PHYSICAL_RESIST ] = SI_STAT_TOOLTIP_PHYSICAL_RESIST ,
[ STAT_SPELL_RESIST ] = SI_STAT_TOOLTIP_SPELL_RESIST ,
[ STAT_CRITICAL_RESISTANCE ] = SI_STAT_TOOLTIP_CRITICAL_RESISTANCE ,
[ STAT_POWER ] = SI_STAT_TOOLTIP_POWER ,
[ STAT_MITIGATION ] = SI_STAT_TOOLTIP_MITIGATION ,
[ STAT_SPELL_MITIGATION ] = SI_STAT_TOOLTIP_SPELL_MITIGATION ,
[ STAT_ARMOR_RATING ] = SI_STAT_TOOLTIP_ARMOR_RATING ,
[ STAT_WEAPON_AND_SPELL_DAMAGE ] = SI_STAT_TOOLTIP_WEAPON_POWER ,
}
ZO_STATS_REFRESH_TIME_SECONDS = 2
end
------------------
-- Stats Common --
------------------
return statsCommon
end
end
end
end
-- To be overridden.
end
end
end
end
end
end
if currentTitleIndex then
else
end
end
dropdown : AddItem ( ZO_ComboBox : CreateItemEntry ( GetString ( SI_STATS_NO_TITLE ) , function ( ) SelectTitle ( nil ) end ) , ZO_COMBOBOX_SUPRESS_UPDATE )
dropdown : AddItem ( ZO_ComboBox : CreateItemEntry ( zo_strformat ( GetTitle ( i ) , GetRawUnitName ( "player" ) ) , function ( ) SelectTitle ( i ) end ) , ZO_COMBOBOX_SUPRESS_UPDATE )
end
end
end
end
do
--to break ties for the player's lowest scoring piece of equipment and show the most important piece
local COMBAT_EQUIP_SLOT_IMPORTANCE =
{
[ EQUIP_SLOT_MAIN_HAND ] = 12 ,
[ EQUIP_SLOT_BACKUP_MAIN ] = 12 ,
[ EQUIP_SLOT_OFF_HAND ] = 11 ,
[ EQUIP_SLOT_BACKUP_OFF ] = 11 ,
[ EQUIP_SLOT_CHEST ] = 10 ,
[ EQUIP_SLOT_LEGS ] = 9 ,
[ EQUIP_SLOT_HEAD ] = 8 ,
[ EQUIP_SLOT_SHOULDERS ] = 7 ,
[ EQUIP_SLOT_FEET ] = 6 ,
[ EQUIP_SLOT_HAND ] = 5 ,
[ EQUIP_SLOT_WAIST ] = 4 ,
[ EQUIP_SLOT_NECK ] = 3 ,
[ EQUIP_SLOT_RING1 ] = 2 ,
[ EQUIP_SLOT_RING2 ] = 1 ,
}
local EQUIPMENT_BONUS_FILLED_TEXTURE = "EsoUI/Art/CharacterWindow/equipmentBonusIcon_full.dds"
local EQUIPMENT_BONUS_EMPTY_TEXTURE = "EsoUI/Art/CharacterWindow/equipmentBonusIcon_empty.dds"
local EQUIPMENT_BONUS_GOLD_TEXTURE = "EsoUI/Art/CharacterWindow/equipmentBonusIcon_full_gold.dds"
--calculate total combat equipment bonus rating
local totalEquipmentBonusRating = 0
local lowestEquipmentBonusRating
local lowestEquipSlot
--check if our active weapon is two-handed (for special consideration in weighting weapon equipment bonus value and showing lowest piece in tooltips)
local mainHandSlot = heldWeaponPair == ACTIVE_WEAPON_PAIR_BACKUP and EQUIP_SLOT_BACKUP_MAIN or EQUIP_SLOT_MAIN_HAND
local isUsingTwoHanded = equipType == EQUIP_TYPE_TWO_HAND
for equipSlot = EQUIP_SLOT_ITERATION_BEGIN , EQUIP_SLOT_ITERATION_END do
-- filter out an "non-combat" slots as well as the inactive weapon pair
local considerSlotForOverallRating = true
--don't consider off hand weapon slots if player is wielding a two-handed weapon
if equipSlot == EQUIP_SLOT_OFF_HAND or equipSlot == EQUIP_SLOT_BACKUP_OFF then
if isUsingTwoHanded then
considerSlotForOverallRating = false
end
end
if considerSlotForOverallRating then
if not lowestEquipmentBonusRating or equipmentBonusRating < lowestEquipmentBonusRating then
lowestEquipmentBonusRating = equipmentBonusRating
lowestEquipSlot = equipSlot
elseif equipmentBonusRating == lowestEquipmentBonusRating and COMBAT_EQUIP_SLOT_IMPORTANCE [ equipSlot ] > COMBAT_EQUIP_SLOT_IMPORTANCE [ lowestEquipSlot ] then
lowestEquipSlot = equipSlot
end
--weight two-handed weapons twice so that they count double in the total
--this is to compensate for their empty off hand weapon slot, so they aren't penalized for 2H weapons in the total
if equipSlot == EQUIP_SLOT_MAIN_HAND or equipSlot == EQUIP_SLOT_BACKUP_MAIN then
if isUsingTwoHanded then
equipmentBonusRating = equipmentBonusRating * 2
end
end
totalEquipmentBonusRating = totalEquipmentBonusRating + equipmentBonusRating
end
-- else don't add the bonus rating to the total because we aren't considering it
end
end
--set equipment bonus
local averageEquipmentBonusRating = totalEquipmentBonusRating / NUM_COMBAT_RELATED_EQUIP_SLOTS
local averageRelativeEquipmentBonusRating = GetUnitEquipmentBonusRatingRelativeToLevel ( "player" , averageEquipmentBonusRating )
local equipmentBonus = EQUIPMENT_BONUS_ITERATION_BEGIN
for thresholdNumber = EQUIPMENT_BONUS_ITERATION_END , EQUIPMENT_BONUS_ITERATION_BEGIN , - 1 do
local thresholdValue = GetEquipmentBonusThreshold ( playerLevel , playerChampionPoints , thresholdNumber )
if averageRelativeEquipmentBonusRating >= thresholdValue then
equipmentBonus = thresholdNumber
break
end
end
--setup icons
local lastIcon
--we setup 2 fewer icons than the number of EQUIPMENT_BONUS levels: the lowest equipment bonus level is all empty icons, and the highest adds a bonus icon separately
for iconNumber = EQUIPMENT_BONUS_ITERATION_BEGIN , EQUIPMENT_BONUS_ITERATION_END - 2 do
local equipmentBonusIconTexture
equipmentBonusIconTexture = self . equipmentBonus . value == EQUIPMENT_BONUS_EXTRAORDINARY and EQUIPMENT_BONUS_GOLD_TEXTURE or EQUIPMENT_BONUS_FILLED_TEXTURE
else
equipmentBonusIconTexture = EQUIPMENT_BONUS_EMPTY_TEXTURE
end
if lastIcon then
else
end
lastIcon = equipmentBonusIconControl
end
--add bonus icon if at the highest level
end
end
end
end
-----------------------
-- Attribute Spinner --
-----------------------
function ZO_AttributeSpinner_Shared : New ( attributeControl , attributeType , attributeManager , valueChangedCallback )
attributeSpinner . attributeControl = attributeControl
attributeSpinner . points = 0
attributeSpinner . addedPoints = 0
attributeSpinner . attributeManager = attributeManager
return attributeSpinner
end
self . pointsSpinner : RegisterCallback ( "OnValueChanged" , function ( points ) self : OnValueChanged ( points ) end )
end
end
end
end
end
end
self . pointsSpinner : SetMinMax ( self . points , self . points + self . addedPoints + self . attributeManager : GetAvailablePoints ( ) )
end
end
end
end
end
end
if ( force ) then
diff = 0
elseif diff > availablePoints then
diff = availablePoints
end
if ( diff ~= 0 ) then
end
self . attributeManager : UpdatePendingStatBonuses ( STAT_TYPES [ self . attributeType ] , self . perPoint * self . addedPoints )
end
end |