Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Drawing;
- using System.Collections.Generic;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.DAV {
- public class DAV_ItemEth : BasePlugin, IInGameTopPainter {
- public string MaxText { get; set; } = "Max";
- public IFont EtherealFont { get; set; }
- private ITexture powerBackground { get; set; }
- private List<ISnoItem> weaponPowers { get; set; }
- private Dictionary<uint, ISnoPower> passiveMapping { get; set; }
- public DAV_ItemEth() {
- Enabled = true;
- Order = int.MinValue + 5;
- }
- public void PaintTopInGame(ClipState clipState) {
- if (clipState != ClipState.Inventory || !Hud.Inventory.InventoryMainUiElement.Visible) return;
- var stashVisible = Hud.Inventory.StashMainUiElement.Visible;
- var stashTabAbs = Hud.Inventory.SelectedStashTabIndex + Hud.Inventory.SelectedStashPageIndex * Hud.Inventory.MaxStashTabCountPerPage;
- foreach (var item in Hud.Game.Items.Where(x => VisibleEthereal(x, stashVisible, stashTabAbs))) {
- var rect = Hud.Inventory.GetItemRect(item);
- if (rect != RectangleF.Empty)
- DrawEthPower(item, rect);
- }
- }
- private bool VisibleEthereal(IItem item, bool stashVisible, int stashTabAbs) {
- return item.SnoItem.IsEthereal && item.Perfections != null // && !item.Unidentified
- && (item.Location == ItemLocation.Inventory || item.Location == ItemLocation.LeftHand || item.Location == ItemLocation.RightHand
- || (stashVisible && item.Location == ItemLocation.Stash && item.InventoryY / 10 == stashTabAbs));
- }
- private void DrawEthPower(IItem item, RectangleF rect) {
- var ethPowers = item.Perfections.Where(z => z.Attribute?.Index == 1293u);
- if (ethPowers == null) return;
- var notEquipped = item.Location == ItemLocation.Stash || item.Location == ItemLocation.Inventory;
- var w = rect.Height / 3f;
- var h = w * 2;
- var y = rect.Bottom - h;
- var x = rect.Right;
- if (notEquipped)
- x -= w;
- else if (item.Location == ItemLocation.RightHand)
- x = rect.X - w;
- foreach (var perfect in ethPowers) {
- if (passiveMapping.TryGetValue(perfect.Modifier, out var passivePower)) {
- var w2 = notEquipped ? rect.Width / 2.25f : w;
- var x2 = notEquipped ? rect.Right - w2 : rect.Right;
- var passiveTexture = Hud.Texture.GetTexture(passivePower.NormalIconTextureId);
- passiveTexture?.Draw(x2, rect.Y, w2, w2);
- }
- else {
- var empowerItem = weaponPowers.FirstOrDefault(z => LegendaryPowerSno(z) == perfect.Modifier);
- if (empowerItem != null) {
- powerBackground.Draw(x, y, w, h);
- Hud.Texture.GetItemTexture(empowerItem)?.Draw(x, y, w, h);
- if (perfect.Min != perfect.Max) {
- var curValue = item.Unidentified ? (item.StatList?.FirstOrDefault(a => a.Modifier == perfect.Modifier)?.DoubleValue ?? -1d) : perfect.Cur;
- var adjCur = PowerValue(perfect.Modifier, curValue, perfect.Max);
- EtherealFont.DrawText(adjCur > 0 ? $"{adjCur:0}" : MaxText, rect.X, rect.Y); // to test
- }
- }
- }
- }
- }
- private uint LegendaryPowerSno(ISnoItem snoItem) {
- if (snoItem.LegendaryPower != null)
- return snoItem.LegendaryPower.Sno;
- switch (snoItem.Sno) { // Craft Items
- case 3321082205 : return 247769; // Blood-Magic Edge
- case 962318656 : return 318818; // Reaper's Wraps
- case 59215970 : return 248501; // Sunder
- case 370939127 : return 483537; // Spite
- case 162390824 : return 247585; // Wall of Man
- case 2740453189 : return 248462; // Cinder Switch
- case 2775850772 : return 318733; // Cosmic Strand
- case 2503771951 : return 318852; // Golden Scourge
- case 820499474 : return 318885; // Piro Marella
- }
- return 0;
- }
- private double PowerValue(uint powerSno, double curValue, double maxValue) {
- if (curValue == maxValue) return -1d;
- switch (powerSno) {
- case 402458 : // 引劍
- case 484244 : // 戍衛之傑
- case 475253 : // 萊蓮娜的影魂鉤
- return curValue;
- }
- return curValue * 100d;
- }
- public override void Load(IController hud) {
- base.Load(hud);
- EtherealFont = Hud.Render.CreateFont("Arial", 7f, 255, 255, 255, 51, true, false, 153, 0, 0, 0, true);
- powerBackground = Hud.Texture.GetTexture(2725626326); // 993828447
- var snoList = Hud.Sno;
- passiveMapping = new Dictionary<uint, ISnoPower> {
- // Barbarian
- { 397813, snoList.GetSnoPower(205205) }, { 397814, snoList.GetSnoPower(205175) }, { 397815, snoList.GetSnoPower(217819) }, { 397816, snoList.GetSnoPower(206147) },
- { 397817, snoList.GetSnoPower(205546) }, { 397818, snoList.GetSnoPower(205187) }, { 397819, snoList.GetSnoPower(205217) }, { 397820, snoList.GetSnoPower(205228) },
- { 397822, snoList.GetSnoPower(205491) }, { 397831, snoList.GetSnoPower(205848) }, { 397832, snoList.GetSnoPower(204725) }, { 397833, snoList.GetSnoPower(205398) },
- { 397834, snoList.GetSnoPower(205133) }, { 397835, snoList.GetSnoPower(205707) }, { 397836, snoList.GetSnoPower(205300) }, { 397838, snoList.GetSnoPower(204603) },
- { 397839, snoList.GetSnoPower(361661) }, { 397841, snoList.GetSnoPower(296572) }, { 397842, snoList.GetSnoPower(340877) },
- // Crusader
- { 397843, snoList.GetSnoPower(286177) }, { 397844, snoList.GetSnoPower(302500) }, { 397845, snoList.GetSnoPower(309830) }, { 397846, snoList.GetSnoPower(310626) },
- { 397847, snoList.GetSnoPower(310640) }, { 397848, snoList.GetSnoPower(310678) }, { 397849, snoList.GetSnoPower(310775) }, { 397850, snoList.GetSnoPower(310783) },
- { 397851, snoList.GetSnoPower(311629) }, { 397852, snoList.GetSnoPower(310804) }, { 397853, snoList.GetSnoPower(348741) }, { 397854, snoList.GetSnoPower(348773) },
- { 401366, snoList.GetSnoPower(356052) }, { 401367, snoList.GetSnoPower(356147) }, { 401368, snoList.GetSnoPower(356173) }, { 401369, snoList.GetSnoPower(356176) },
- { 401370, snoList.GetSnoPower(357218) }, { 401371, snoList.GetSnoPower(357269) },
- // DemonHunter
- { 401378, snoList.GetSnoPower(211225) }, { 401379, snoList.GetSnoPower(218385) }, { 401380, snoList.GetSnoPower(155714) }, { 401381, snoList.GetSnoPower(164363) },
- { 401382, snoList.GetSnoPower(155721) }, { 401383, snoList.GetSnoPower(218350) }, { 401384, snoList.GetSnoPower(210801) }, { 401385, snoList.GetSnoPower(155725) },
- { 401386, snoList.GetSnoPower(209734) }, { 401387, snoList.GetSnoPower(218398) }, { 401388, snoList.GetSnoPower(155722) }, { 401389, snoList.GetSnoPower(208610) },
- { 401390, snoList.GetSnoPower(208779) }, { 401391, snoList.GetSnoPower(155715) }, { 401392, snoList.GetSnoPower(155723) }, { 401393, snoList.GetSnoPower(352920) },
- { 401394, snoList.GetSnoPower(324770) }, { 401395, snoList.GetSnoPower(338859) }, { 439528, snoList.GetSnoPower(439525) },
- // Monk
- { 401414, snoList.GetSnoPower(211581) }, { 401415, snoList.GetSnoPower(209029) }, { 401416, snoList.GetSnoPower(209027) }, { 401417, snoList.GetSnoPower(209250) },
- { 401418, snoList.GetSnoPower(156467) }, { 401419, snoList.GetSnoPower(209628) }, { 401420, snoList.GetSnoPower(209812) }, { 401421, snoList.GetSnoPower(209622) },
- { 401422, snoList.GetSnoPower(404245) }, { 401423, snoList.GetSnoPower(209104) }, { 401424, snoList.GetSnoPower(156492) }, { 401425, snoList.GetSnoPower(404168) },
- { 401426, snoList.GetSnoPower(218415) }, { 401427, snoList.GetSnoPower(156484) }, { 401428, snoList.GetSnoPower(315271) }, { 401429, snoList.GetSnoPower(341559) },
- { 401430, snoList.GetSnoPower(368899) }, { 409335, snoList.GetSnoPower(402633) },
- // Necromancer
- { 472668, snoList.GetSnoPower(465917) }, { 472669, snoList.GetSnoPower(465703) }, { 472670, snoList.GetSnoPower(470725) }, { 472671, snoList.GetSnoPower(472965) },
- { 472672, snoList.GetSnoPower(472962) }, { 472673, snoList.GetSnoPower(470805) }, { 472674, snoList.GetSnoPower(464994) }, { 472675, snoList.GetSnoPower(466415) },
- { 472676, snoList.GetSnoPower(470764) }, { 472677, snoList.GetSnoPower(470812) }, { 472678, snoList.GetSnoPower(472220) }, { 472679, snoList.GetSnoPower(472795) },
- { 472693, snoList.GetSnoPower(465952) }, { 472694, snoList.GetSnoPower(473019) }, { 472695, snoList.GetSnoPower(465264) }, { 472697, snoList.GetSnoPower(472905) },
- { 472698, snoList.GetSnoPower(472949) }, { 472699, snoList.GetSnoPower(465821) }, { 472700, snoList.GetSnoPower(465037) }, { 472701, snoList.GetSnoPower(472910) },
- // WitchDoctor
- { 401458, snoList.GetSnoPower(217968) }, { 401459, snoList.GetSnoPower(208571) }, { 401460, snoList.GetSnoPower(208569) }, { 401461, snoList.GetSnoPower(208594) },
- { 401462, snoList.GetSnoPower(208568) }, { 401463, snoList.GetSnoPower(217826) }, { 401464, snoList.GetSnoPower(208563) }, { 401465, snoList.GetSnoPower(208628) },
- { 401466, snoList.GetSnoPower(218501) }, { 401467, snoList.GetSnoPower(218588) }, { 401468, snoList.GetSnoPower(208565) }, { 401469, snoList.GetSnoPower(209041) },
- { 401470, snoList.GetSnoPower(208639) }, { 401471, snoList.GetSnoPower(218191) }, { 401472, snoList.GetSnoPower(208601) }, { 401473, snoList.GetSnoPower(340908) },
- { 401474, snoList.GetSnoPower(340910) }, { 401475, snoList.GetSnoPower(340909) }, { 442744, snoList.GetSnoPower(442741) },
- // Wizard
- { 401476, snoList.GetSnoPower(341344) }, { 401495, snoList.GetSnoPower(208471) }, { 401496, snoList.GetSnoPower(208493) }, { 401497, snoList.GetSnoPower(208472) },
- { 401498, snoList.GetSnoPower(208547) }, { 401499, snoList.GetSnoPower(226301) }, { 401500, snoList.GetSnoPower(208541) }, { 401501, snoList.GetSnoPower(208478) },
- { 401502, snoList.GetSnoPower(208468) }, { 401503, snoList.GetSnoPower(208473) }, { 401504, snoList.GetSnoPower(208823) }, { 401505, snoList.GetSnoPower(208474) },
- { 401506, snoList.GetSnoPower(226348) }, { 401507, snoList.GetSnoPower(298038) }, { 401508, snoList.GetSnoPower(218044) }, { 401509, snoList.GetSnoPower(341540) },
- { 401510, snoList.GetSnoPower(208477) }, { 401511, snoList.GetSnoPower(342326) },
- };
- // from Maxroll
- var snoItems = Hud.Sno.SnoItems;
- weaponPowers = new List<ISnoItem> {
- // Barbarian x 10
- snoItems.P67_Unique_Mighty_1H_006, // 重型武器 : 峽灣分嶺斧
- snoItems.P67_Unique_Mighty_1H_012, // 岸柏之傲
- snoItems.P67_Unique_Mighty_1H_102, // 無憫 P72_Unique_Mighty_1H_102 ?
- snoItems.P4_Unique_Mighty_1H_104, // 守誓者
- snoItems.P61_Unique_Polearm_01, // 峙
- snoItems.P61_Unique_Mighty_2H_001, // 重型武器2H : 審判之鎚
- snoItems.P68_Unique_Mighty_2H_004, // 戍衛之傑
- snoItems.P61_Unique_Mighty_2H_006, // 夷峰烈怒
- snoItems.P610_Unique_Mighty_2H_101, // 部族之刃
- snoItems.P66_Unique_Axe_2H_003, // 斧2H : 劊子手
- // Crusader x 17
- snoItems.P1_flail1H_norm_unique_01, // 連枷 : 喬安娜之證
- snoItems.Unique_Flail_1H_103_x1, // 神駒飛馳
- snoItems.P61_Unique_Flail_1H_105_x1, // 矛隼之爪
- snoItems.P67_Unique_Flail_1H_106, // 黑暗之光
- snoItems.P65_flail2H_norm_unique_01, // 連枷2H : 阿克漢的寬容 P76_flail2H_norm_unique_01 ?
- snoItems.P610_Unique_Flail_2H_101, // 人世無常
- snoItems.P61_Unique_Flail_2H_103_x1, // 妖邪必敗
- snoItems.P61_Unique_Sword_2H_007_x1, // 劍2H: 預言之刃
- snoItems.P61_Unique_Sword_2H_012_x1, // 忠貞回憶
- snoItems.P61_CruShield_norm_unique_01, // 聖教盾 : 佛萊德之怒
- snoItems.P65_Unique_CruShield_102_x1, // 傑伏坎盾
- snoItems.Unique_CruShield_104_x1, // 阿卡拉特的覺醒
- snoItems.Unique_Shield_103_x1, // 喬安娜之衛
- snoItems.P61_Unique_Shield_106_x1, // 聖怒之盾
- snoItems.P2_Unique_Shield_002, // 盾 : 象牙塔
- snoItems.P61_Unique_Shield_007, // 阻絕者
- snoItems.Unique_Shield_102_x1, // 埃伯利加羅
- // DemonHunter x 14
- snoItems.P61_Unique_Dagger_101_x1, // 匕首 : 家妮之鋒
- snoItems.P61_Unique_Dagger_102_x1, // 葛林斯通大君之扇
- snoItems.P4_Unique_HandXBow_001, // 弩槍 : 黎明
- snoItems.P43_Unique_HandXBow_005, // 維拉之贈
- snoItems.P4_Unique_HandXBow_02, // 要塞弩砲
- snoItems.P69_Unique_Bow_102, // 弓 : 奧德賽的尾聲
- snoItems.P61_Unique_Bow_104_x1, // 楊的反曲弓
- snoItems.P61_Unique_XBow_001, // 弩 : 蠍尾獅
- snoItems.P65_Unique_Xbow_102, // 沃賈強襲弩
- snoItems.P65_Unique_Quiver_001, // 箭筒 : 索罪矢
- snoItems.P69_Unique_Quiver_004, // 聖尖矢
- snoItems.P61_Unique_Quiver_007, // 亡者遺產
- snoItems.P69_Unique_Quiver_101, // 瑟里九號箭包
- snoItems.Unique_Quiver_102_x1, // 轟擊者背袋 P72_Unique_Quiver_102 ?
- // Monk x 10
- snoItems.P1_fistWeapon_norm_unique_01, // 拳套 : 猛獅之爪
- snoItems.P67_fistWeapon_norm_unique_02, // 仇憎之風
- snoItems.P71_Unique_Fist_003, // 狂擊
- snoItems.P67_Unique_Fist_006, // 流雲橋
- snoItems.P61_Unique_Fist_009_x1, // 厄圖拉斯之拳
- snoItems.P4_Unique_Fist_102, // 京四郎之刃
- snoItems.P61_Unique_CombatStaff_2H_001, // 武杖 : 均衡
- snoItems.P61_Unique_CombatStaff_2H_003_x1, // 大殿香炬
- snoItems.P41_Unique_CombatStaff_2H_005, // 永恆之悟
- snoItems.Unique_CombatStaff_2H_009_x1, // 翔龍
- // Necromancer x 10
- snoItems.P6_Unique_Scythe1H_02, // 鐮刀 : 塔格奧的腐壞尖牙
- snoItems.P61_Unique_Scythe1H_03, // 輪迴之鐮
- snoItems.P61_Unique_Scythe2H_01, // 鐮刀2H : 馬托利斯的石化尖刺
- snoItems.P65_Unique_Scythe2H_02, // 血潮長刀
- snoItems.P6_Unique_Scythe2H_03, // 萊蓮娜的影魂鉤
- snoItems.P61_Unique_Scythe2H_04, // 奈雅的黑死病
- snoItems.P61_Unique_Phylactery_01, // 魂棺 : 流逝時光
- snoItems.P6_Unique_Phylactery_02, // 骸骨喪鐘
- snoItems.P61_Unique_Phylactery_03, // 萊杰的侮蔑
- snoItems.P65_Unique_Phylactery_04, // 鐵玫瑰 P74_Unique_Phylactery_04 ?
- // WitchDoctor x 11
- snoItems.P610_Unique_Spear_004, // 矛 : 骨牙雕矛
- snoItems.P68_Unique_Dagger_003, // 匕首 : 剃頭師
- snoItems.P61_Unique_Staff_001, // 法杖 : 蝙蝠法杖
- snoItems.P2_mojo_norm_unique_02, // 咒物 : 亨利的追尋
- snoItems.P4_Unique_Mojo_001, // 兇邪蟲巢
- snoItems.P610_Unique_Mojo_001, // 被踐踏的厄蘇亞肖像
- snoItems.P66_Unique_Mojo_002, // 惡怨
- snoItems.P68_Unique_Mojo_003, // 滅亡凝視
- snoItems.Unique_Mojo_102_x1, // 舒可拉妮的勝利 P72_Unique_Mojo_102 ?
- snoItems.P1_CeremonialDagger_norm_unique_01, // 祭祀刀 : 聖穫匕首
- snoItems.P65_CeremonialDagger_norm_unique_02, // 箭鏢匕刃
- // Wizard x 15
- snoItems.P610_Unique_Dagger_010, // 匕首 : 巫師之刺
- snoItems.P610_Unique_Sword_1H_107, // 劍 : 扭曲之劍
- snoItems.P61_Unique_Sword_1H_112_x1,// 絕命
- snoItems.P1_Wand_norm_unique_01, // 魔杖 : 以太行者
- snoItems.P61_Wand_norm_unique_02, // 不穩定的權杖
- snoItems.P610_Unique_Wand_010, // 天命裂片
- snoItems.P61_Unique_Wand_101_x1, // 沃爾魔杖
- snoItems.P68_Unique_Wand_102, // 蛇影爍光
- snoItems.P61_Unique_Staff_009, // 法杖 : 首相
- snoItems.P610_Unique_Staff_102, // 佛爾瑟克的斥責
- snoItems.P610_Unique_Orb_002, // 法器 : 蝕刻徽記
- snoItems.P61_Unique_Orb_003, // 三連寶球
- snoItems.P61_Unique_Orb_004, // 無盡深淵法珠
- snoItems.Unique_Orb_004_x1, // 宇宙縮影
- snoItems.P610_Unique_Orb_005, // 寒冬疾風
- // Generic x 4
- snoItems.Unique_Sword_1H_113_x1, // 劍 : 引劍
- snoItems.P66_Unique_Mace_1H_001, // 釘鎚 : 迴盪狂怒
- snoItems.Unique_Mace_2H_103_x1, // 釘鎚2H : 焚爐
- snoItems.P66_Unique_Axe_2H_011, // 斧2H : 梅希斯密特之劫掠者
- };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment