public override void OnEnable() { this._explicitMods = new List<RollValue>(); this._implicitMods = new List<RollValue>(); _weaponAttack = null; this._lastHovered = null; }
public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints) { Element uiHover = this.model.Internal.IngameState.ElementUnderCursor; Tooltip tooltip = uiHover.AsObject<InventoryItemIcon>().Tooltip; if (tooltip == null) return; Element childAtIndex1 = tooltip.GetChildAtIndex(0); if (childAtIndex1 == null) return; Element childAtIndex2 = childAtIndex1.GetChildAtIndex(1); if (childAtIndex2 == null) return; Rect clientRect = childAtIndex2.GetClientRect(); Entity poeEntity = uiHover.AsObject<InventoryItemIcon>().Item; if (poeEntity.Address == 0 || !poeEntity.IsValid) return; if (this._lastHovered == null || this._lastHovered.ID != poeEntity.ID) { this._lastHovered = poeEntity; this._explicitMods = new List<RollValue>(); this._implicitMods = new List<RollValue>(); int ilvl = poeEntity.GetComponent<Mods>().ItemLevel; foreach (ItemMod item in poeEntity.GetComponent<Mods>().ItemMods) this._explicitMods.Add(new RollValue(item, model.Files, ilvl)); foreach (ItemMod item in poeEntity.GetComponent<Mods>().ImplicitMods) this._implicitMods.Add(new RollValue(item, model.Files, ilvl, true)); _quality = poeEntity.GetComponent<Quality>().ItemQuality; Weapon weap = poeEntity.GetComponent<Weapon>(); if (weap.Address != 0) { var attack = weap.Attack; _weaponAttack = new WeaponAttack() { AttackDelay = attack.AttackTime, CritChancePer10K = attack.CritChance, MinDamage = attack.DamageMin, MaxDamage = attack.DamageMax }; } else _weaponAttack = null; } RenderRolls(rc, clientRect); if( _weaponAttack != null && Settings.ShowDps) RenderWeaponStats(rc, clientRect); if (Settings.ShowItemLevel) RenderItemLevel(rc, clientRect); }