예제 #1
0
 public override void Render(RenderingContext rc)
 {
     if (!Settings.GetBool("Tooltip") || !Settings.GetBool("Tooltip.ShowItemMods"))
         return;
     Element uiHover = this.poe.Internal.IngameState.UIHover;
     Entity poeEntity = uiHover.AsObject<InventoryItemIcon>().Item;
     if (poeEntity.address == 0 || !poeEntity.IsValid)
         return;
     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();
     Rect headerRect = childAtIndex1.GetChildAtIndex(0).GetClientRect();
     if (this.poeEntity == null || this.poeEntity.ID != poeEntity.ID) {
         this.mods = new List<MaxRolls_Current>();
         //List<Poe_ItemMod> impMods = poeEntity.GetComponent<Mods>().ImplicitMods;
         List<ItemMod> expMods = poeEntity.GetComponent<Mods>().ItemMods;
         int ilvl = poeEntity.GetComponent<Mods>().ItemLevel;
         foreach (ItemMod item in expMods)
         {
             this.mods.Add(new MaxRolls_Current(item.Name, item.Level, ilvl));
         }
         this.poeEntity = poeEntity;
     }
     int tooltipBotY=clientRect.Y + clientRect.H;
     int i = tooltipBotY;
     // Implicit mods
     //foreach (Poe_ItemMod item in impMods)
     //{
     //    rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.Name, Color.Yellow, 9, DrawTextFormat.Left);
     //    rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 10, i), item.Level.ToString(), Color.White, 6, DrawTextFormat.Left);
     //    i += 20;
     //}
     foreach (MaxRolls_Current item in this.mods)
     {
         rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.name, item.color, 8, DrawTextFormat.Left);
         i += 20;
         rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max, Color.White, 8, DrawTextFormat.Left);
         rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr, Color.White, 8, DrawTextFormat.Left);
         i += 20;
         if (item.curr2 != null && item.max2 != null)
         {
             rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max2, Color.White, 8, DrawTextFormat.Left);
             rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr2, Color.White, 8, DrawTextFormat.Left);
             i += 20;
         }
     }
     if (i > tooltipBotY)
     {
         Rect helpRect = new Rect(clientRect.X + 1, tooltipBotY, clientRect.W, i - tooltipBotY);
         rc.AddBox(helpRect, Color.FromArgb(220, Color.Black));
     }
 }
예제 #2
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("XphDisplay") || (this.poe.Player != null && this.poe.Player.GetComponent <Player>().Level >= 100))
            {
                return;
            }
            if (!this.hasStarted)
            {
                this.startXp      = this.poe.Player.GetComponent <Player>().XP;
                this.startTime    = DateTime.Now;
                this.lastCalcTime = DateTime.Now;
                this.hasStarted   = true;
                return;
            }
            DateTime dtNow = DateTime.Now;
            TimeSpan delta = dtNow - this.lastCalcTime;

            if (delta.TotalSeconds > 1.0)
            {
                this.poe.Area.CurrentArea.AddTimeSpent(delta);
                calculateRemainingExp(dtNow);
                this.lastCalcTime = dtNow;
            }

            int fontSize = Settings.GetInt("XphDisplay.FontSize");
            int bgAlpha  = Settings.GetInt("XphDisplay.BgAlpha");

            Rect clientRect    = this.poe.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
            Vec2 mapWithOffset = new Vec2(clientRect.X - 10, clientRect.Y + 5);
            int  yCursor       = 0;
            Vec2 rateTextSize  = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y), this.curDisplayString, Color.White, fontSize, DrawTextFormat.Right);

            yCursor += rateTextSize.Y;
            Vec2 remainingTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + yCursor), this.curTimeLeftString, Color.White, fontSize, DrawTextFormat.Right);

            yCursor += remainingTextSize.Y;
            int    thirdLine     = mapWithOffset.Y + yCursor;
            Vec2   areaLevelNote = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, thirdLine), this.poe.Area.CurrentArea.DisplayName, Color.White, fontSize, DrawTextFormat.Right);
            string strTimer      = this.poe.Area.CurrentArea.TimeString;
            Vec2   timerSize     = rc.MeasureString(strTimer, fontSize, DrawTextFormat.Left);

            yCursor += areaLevelNote.Y;


            int  textWidth = Math.Max(Math.Max(rateTextSize.X, remainingTextSize.X), areaLevelNote.X + timerSize.X + 20) + 10;
            int  width     = Math.Max(textWidth, Math.Max(clientRect.W, this.overlay.PreloadAlert.Bounds.W));
            Rect rect      = new Rect(mapWithOffset.X - width + 5, mapWithOffset.Y - 5, width, yCursor + 10);

            this.Bounds = rect;

            rc.AddTextWithHeight(new Vec2(rect.X + 5, mapWithOffset.Y), dtNow.ToShortTimeString(), Color.White, fontSize, DrawTextFormat.Left);
            rc.AddTextWithHeight(new Vec2(rect.X + 5, thirdLine), strTimer, Color.White, fontSize, DrawTextFormat.Left);

            rc.AddBox(rect, Color.FromArgb(bgAlpha, 1, 1, 1));
        }
예제 #3
0
        public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
        {
            Vec2 pos = mountPoints[UiMountPoint.LeftOfMinimap];

            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("Player = {0:X8}\r\n", model.Player.Address);
            sb.AppendFormat("TheGame = {0:X8}\r\n", model.Internal.Address);
            sb.AppendFormat("IngameState = {0:X8}\r\n", model.Internal.IngameState.Address);
            sb.AppendFormat("IngameData = {0:X8}\r\n", model.Internal.IngameState.Data.Address);
            sb.AppendFormat("InventoryFrame = {0:X8}\r\n", model.Internal.IngameState.IngameUi.InventoryPanel.Address);

            var w1 = model.Internal.IngameState.IngameUi.InventoryPanel.MainWeaponSlot.GetItemAt();

            //var flasks = model.Internal.IngameState.IngameUi.InventoryPanel.FlasksFrame;
            //for (int i = 0; i < 5; i++)
            //{
            //	var f1 = flasks.GetItemAt(i);
            //	if (f1 != null)
            //		sb.AppendFormat("F{1} = {0}\r\n",String.Join("; ", f1.EnumComponents().Select(kv => String.Format("{0}: {1:X8}", kv.Key, kv.Value))), i + 1);
            //}

            var szText = rc.AddTextWithHeight(pos, sb.ToString(), Color.White, 11, DrawTextFormat.Right);
            Rect box = new Rect(pos.X - szText.X - 5, pos.Y - 5, szText.X + 10, szText.Y + 10);
            rc.AddBox(box, Color.FromArgb(160, 0, 0, 0));

            mountPoints[UiMountPoint.LeftOfMinimap]  = new Vec2(pos.X, pos.Y + szText.Y + 10 + 5);
        }
예제 #4
0
        private static Vec2 drawItem(RenderingContext rc, AlertDrawStyle drawStyle, int x, int y, Vec2 vPadding, string text,
                                     int fontSize)
        {
            // collapse padding when there's a frame
            vPadding.X -= drawStyle.FrameWidth;
            vPadding.Y -= drawStyle.FrameWidth;
            // item will appear to have equal size

            Vec2 textPos   = new Vec2(x - vPadding.X, y + vPadding.Y);
            Vec2 vTextSize = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right);

            int iconSize = drawStyle.IconIndex >= 0 ? vTextSize.Y : 0;

            int fullHeight = vTextSize.Y + 2 * vPadding.Y + 2 * drawStyle.FrameWidth;
            int fullWidth  = vTextSize.X + 2 * vPadding.X + iconSize + 2 * drawStyle.FrameWidth;

            rc.AddBox(new Rect(x - fullWidth, y, fullWidth, fullHeight), Color.FromArgb(180, 0, 0, 0));

            if (iconSize > 0)
            {
                const float iconsInSprite = 4;

                Rect   iconPos = new Rect(textPos.X - iconSize - vTextSize.X, textPos.Y, iconSize, iconSize);
                RectUV uv      = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1);
                rc.AddSprite("item_icons.png", iconPos, uv);
            }
            if (drawStyle.FrameWidth > 0)
            {
                Rect frame = new Rect(x - fullWidth, y, fullWidth, fullHeight);
                rc.AddFrame(frame, drawStyle.color, drawStyle.FrameWidth);
            }
            return(new Vec2(fullWidth, fullHeight));
        }
예제 #5
0
파일: FpsMeter.cs 프로젝트: codelyfe/PoeHud
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!hasStarted)
            {
                watch = new Stopwatch();
                watch.Start();
                hasStarted = true;
                return;
            }


            Vec2  mapWithOffset = mountPoints[UiMountPoint.LeftOfMinimap];
            float ms            = watch.ElapsedMilliseconds;

            watch.Restart();

            var textSize = rc.AddTextWithHeight(mapWithOffset, ms + " ms/frame", Color.White, Settings.DpsFontSize, DrawTextFormat.Right);


            int  width = textSize.X;
            Rect rect  = new Rect(mapWithOffset.X - 5 - width, mapWithOffset.Y - 5, width + 10, textSize.Y + 10);

            rc.AddBox(rect, Color.FromArgb(160, Color.Black));

            mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(mapWithOffset.X, mapWithOffset.Y + 5 + rect.H);
        }
예제 #6
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            Vec2 pos = mountPoints[UiMountPoint.LeftOfMinimap];

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Player = {0:X8}\r\n", model.Player.Address);
            sb.AppendFormat("TheGame = {0:X8}\r\n", model.Internal.Address);
            sb.AppendFormat("IngameState = {0:X8}\r\n", model.Internal.IngameState.Address);
            sb.AppendFormat("IngameData = {0:X8}\r\n", model.Internal.IngameState.Data.Address);
            sb.AppendFormat("InventoryFrame = {0:X8}\r\n", model.Internal.IngameState.IngameUi.InventoryPanel.Address);

            var w1 = model.Internal.IngameState.IngameUi.InventoryPanel.MainWeaponSlot.GetItemAt();

            //var flasks = model.Internal.IngameState.IngameUi.InventoryPanel.FlasksFrame;
            //for (int i = 0; i < 5; i++)
            //{
            //	var f1 = flasks.GetItemAt(i);
            //	if (f1 != null)
            //		sb.AppendFormat("F{1} = {0}\r\n",String.Join("; ", f1.EnumComponents().Select(kv => String.Format("{0}: {1:X8}", kv.Key, kv.Value))), i + 1);
            //}

            var  szText = rc.AddTextWithHeight(pos, sb.ToString(), Color.White, 11, DrawTextFormat.Right);
            Rect box    = new Rect(pos.X - szText.X - 5, pos.Y - 5, szText.X + 10, szText.Y + 10);

            rc.AddBox(box, Color.FromArgb(160, 0, 0, 0));

            mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(pos.X, pos.Y + szText.Y + 10 + 5);
        }
예제 #7
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("Tooltip") || !Settings.GetBool("Tooltip.ShowItemLevel"))
            {
                return;
            }
            Poe_UIElement uIHover = this.poe.Internal.IngameState.UIHover;
            Poe_Entity    item    = uIHover.AsObject <Poe_UI_InventoryItemIcon>().Item;

            if (item.address != 0 && item.IsValid)
            {
                Poe_UI_Tooltip tooltip = uIHover.AsObject <Poe_UI_InventoryItemIcon>().Tooltip;
                if (tooltip == null)
                {
                    return;
                }
                Poe_UIElement childAtIndex = tooltip.GetChildAtIndex(0);
                if (childAtIndex == null)
                {
                    return;
                }
                Poe_UIElement childAtIndex2 = childAtIndex.GetChildAtIndex(1);
                if (childAtIndex2 == null)
                {
                    return;
                }
                Rect clientRect = childAtIndex2.GetClientRect();
                rc.AddTextWithHeight(new Vec2(clientRect.X + 2, clientRect.Y + 2), item.GetComponent <Mods>().ItemLevel.ToString(), Color.White, 16, DrawTextFormat.Left);
            }
        }
예제 #8
0
파일: Menu.cs 프로젝트: benjy3gg/PoeHud
 public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
 {
     int alpha = this.menuVisible ? 255 : 100;
     rc.AddBox(this.bounds, Color.FromArgb(alpha, Color.Gray));
     rc.AddTextWithHeight(new Vec2(Settings.PositionWidth + Settings.AnchorWidth / 2, Settings.PositionHeight + Settings.AnchorHeight / 2), "Menu", Color.Gray, 10, DrawTextFormat.Center | DrawTextFormat.VerticalCenter);
     foreach (BooleanButton current in this.buttons)
         current.Render(rc);
 }
예제 #9
0
        private void RenderItemLevel(RenderingContext rc, Rect clientRect)
        {
            string text = _lastHovered.GetComponent <Mods>().ItemLevel.ToString();

#if DEBUG
            text += " @ " + _lastHovered.Address.ToString("X8");
#endif
            rc.AddTextWithHeight(new Vec2(clientRect.X + 2, clientRect.Y + 2), text, Color.White, 14, DrawTextFormat.Left);
        }
예제 #10
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("ItemAlert") || !Settings.GetBool("ItemAlert.ShowText"))
            {
                return;
            }
            Rect clientRect     = this.poe.Internal.game.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
            Vec2 rightTopAnchor = new Vec2(clientRect.X + clientRect.W, clientRect.Y + clientRect.H + 5);

            int y        = rightTopAnchor.Y;
            int fontSize = Settings.GetInt("ItemAlert.ShowText.FontSize");

            foreach (KeyValuePair <ExileBot.Entity, AlertDrawStyle> kv in this.currentAlerts)
            {
                if (!kv.Key.IsValid)
                {
                    continue;
                }

                string text = GetItemName(kv);
                if (null == text)
                {
                    continue;
                }

                AlertDrawStyle drawStyle   = kv.Value;
                int            frameWidth  = drawStyle.FrameWidth;
                Vec2           vPadding    = new Vec2(frameWidth + 5, frameWidth);
                int            frameMargin = frameWidth + 2;

                Vec2 textPos = new Vec2(rightTopAnchor.X - vPadding.X, y + vPadding.Y);

                var  vTextFrame = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right);
                int  iconSize   = vTextFrame.Y;
                bool hasIcon    = drawStyle.IconIndex >= 0;

                int maxHeight = vTextFrame.Y + 2 * vPadding.Y + frameMargin;
                int maxWidth  = vTextFrame.X + 2 * vPadding.X + (hasIcon ? iconSize : 0);
                rc.AddBox(new Rect(rightTopAnchor.X - maxWidth, y, maxWidth, maxHeight), Color.FromArgb(180, 0, 0, 0));

                if (hasIcon)
                {
                    const float iconsInSprite = 4;

                    Rect   iconPos = new Rect(textPos.X - iconSize - vTextFrame.X, textPos.Y, iconSize, iconSize);
                    RectUV uv      = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1);
                    rc.AddSprite("item_icons.png", iconPos, uv);
                }
                if (frameWidth > 0)
                {
                    Rect frame = new Rect(rightTopAnchor.X - vTextFrame.X - 2 * vPadding.X, y, vTextFrame.X + 2 * vPadding.X, vTextFrame.Y + 2 * vPadding.Y);
                    rc.AddFrame(frame, kv.Value.color, frameWidth);
                }
                y += vTextFrame.Y + 2 * vPadding.Y + frameMargin;
            }
        }
예제 #11
0
        public override void Render(RenderingContext rc)
        {
            int alpha = this.menuVisible ? 255 : 100;

            rc.AddBox(this.bounds, Color.FromArgb(alpha, Color.Gray));
            rc.AddTextWithHeight(new Vec2(Settings.GetInt("Menu.PositionWidth") + 25, Settings.GetInt("Menu.PositionHeight") + 12), "Menu", Color.Gray, 10, DrawTextFormat.VerticalCenter | DrawTextFormat.Center); foreach (BooleanButton current in this.buttons)
            {
                current.Render(rc);
            }
        }
예제 #12
0
        private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
        {
            if (!root.IsVisibleLocal || depth > 3)
            {
                return;
            }
            //Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));
            Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));

            if (rC.W < 20)
            {
                return;
            }
            string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth - 1));
            int    ix    = depth > 0 ? path[depth - 1] : 0;
            var    c     = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);

            string msg = string.Format("[{2}] {1:X8} : {0}", rC, root.Address, sPath);

            var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);

            rc.AddTextWithHeight(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);

            rc.AddFrame(rC, c);
            yPos += v.Y;

            if (yPos > 1100)
            {
                yPos = 80;
                x   += 300;
            }
            var pp = new Vec2(rC.X, rC.Y);

            for (int i = 0; i < root.Children.Count; i++)
            {
                var elt = root.Children[i];
                path[depth] = i;
                if (depth < 8)
                {
                    drawElt(rc, elt, pp, ref x, ref yPos, path, depth + 1);
                }
            }
        }
예제 #13
0
        private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
        {
            if (/* !root.IsVisibleLocal || */ depth > MAX_DEPTH)
            {
                return;
            }
            var   scale    = root.Scale;
            Vec2f position = new Vec2f(parent.X + root.X * scale, parent.Y + root.Y * scale);
            Vec2  size     = new Vec2((int)(root.Width * scale), (int)(root.Height * scale));

//			if (rC.W < 20) return;

            string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth - 1));
            int    ix    = depth > 0 ? path[depth - 1] : 0;
            var    c     = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);

            string msg = string.Format("[{2}] {1:X8} : {0} {3}", position, root.Address, sPath, size);

            var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);

            rc.AddTextWithHeight(new Vec2f(position.X, position.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);
            // rc.AddTextWithHeightAndOutline(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, Color.Black, 8, DrawTextFormat.Left);

            rc.AddFrame(new Rect(position, size), c);
            yPos += v.Y;

            if (yPos > 1100)
            {
                yPos = 80;
                x   += 300;
            }
            position.Y += root.ScrollY * root.Scale;

            List <Element> children = root.Children;

            for (int i = 0; i < children.Count && i < MAX_CHILDREN; i++)
            {
                var elt = children[i];
                path[depth] = i;
                drawElt(rc, elt, position, ref x, ref yPos, path, depth + 1);
            }
        }
예제 #14
0
파일: Menu.cs 프로젝트: codelyfe/PoeHud
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            int alpha = this.menuVisible ? 255 : 100;

            rc.AddBox(this.bounds, Color.FromArgb(alpha, Color.Gray));
            rc.AddTextWithHeight(new Vec2(Settings.PositionWidth + Settings.AnchorWidth / 2, Settings.PositionHeight + Settings.AnchorHeight / 2), "Menu", Color.Gray, 10, DrawTextFormat.Center | DrawTextFormat.VerticalCenter);
            foreach (BooleanButton current in this.buttons)
            {
                current.Render(rc);
            }
        }
예제 #15
0
        public override void Render(RenderingContext rc)
        {
            int alpha = this.menuVisible ? 255 : 50;

            rc.AddBox(this.bounds, Color.FromArgb(alpha, Color.Gray));
            rc.AddTextWithHeight(new Vec2(128, 16), "Menu", Color.White, 16, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
            foreach (BooleanButton current in this.buttons)
            {
                current.Render(rc);
            }
        }
예제 #16
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!hasStarted)
            {
                lastCalcTime = DateTime.Now;
                hasStarted   = true;
                return;
            }

            DateTime dtNow = DateTime.Now;
            TimeSpan delta = dtNow - lastCalcTime;

            if (delta.TotalSeconds > dps_period)
            {
                ixDamageMemory++;
                if (ixDamageMemory >= damageMemory.Length)
                {
                    ixDamageMemory = 0;
                }
                damageMemory[ixDamageMemory] = CalculateDps(delta);
                lastCalcTime = dtNow;
            }

            Vec2 mapWithOffset = mountPoints[UiMountPoint.LeftOfMinimap];
            int  dps           = ((int)damageMemory.Average());

            if (maxDps < dps)
            {
                maxDps = dps;
            }

            var textSize = rc.AddTextWithHeight(mapWithOffset, dps + " DPS", Color.White, Settings.DpsFontSize, DrawTextFormat.Right);
            var tx2      = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + textSize.Y), maxDps + " peak DPS", Color.White, Settings.PeakFontSize, DrawTextFormat.Right);

            int  width = Math.Max(tx2.X, textSize.X);
            Rect rect  = new Rect(mapWithOffset.X - 5 - width, mapWithOffset.Y - 5, width + 10, textSize.Y + tx2.Y + 10);

            rc.AddBox(rect, Color.FromArgb(160, Color.Black));

            mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(mapWithOffset.X, mapWithOffset.Y + 5 + rect.H);
        }
예제 #17
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!Settings.ShowText)
            {
                return;
            }
            Rect rect          = model.Window.ClientRect();
            int  xScreenCenter = rect.W / 2 + rect.X;
            int  yPos          = rect.H / 5 + rect.Y;

            var  playerPos      = model.Player.GetComponent <Positioned>().GridPos;
            int  fontSize       = Settings.TextFontSize;
            bool first          = true;
            Rect rectBackground = new Rect();

            foreach (var alert in alertTexts)
            {
                if (!alert.Key.IsAlive)
                {
                    continue;
                }

                Vec2   delta = alert.Key.GetComponent <Positioned>().GridPos - playerPos;
                double phi;
                var    distance = delta.GetPolarCoordinates(out phi);
                RectUV uv       = GetDirectionsUv(phi, distance);

                Vec2 textSize = rc.AddTextWithHeight(new Vec2(xScreenCenter, yPos), alert.Value, Color.Red, fontSize, DrawTextFormat.Center);

                rectBackground    = new Rect(xScreenCenter - textSize.X / 2 - 6, yPos, textSize.X + 12, textSize.Y);
                rectBackground.X -= textSize.Y + 3;
                rectBackground.W += textSize.Y;

                Rect rectDirection = new Rect(rectBackground.X + 3, rectBackground.Y, rectBackground.H, rectBackground.H);

                if (first)                 // vertical padding above
                {
                    rectBackground.Y -= 5;
                    rectBackground.H += 5;
                    first             = false;
                }
                rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));
                rc.AddSprite("directions.png", rectDirection, uv, Color.Red);
                yPos += textSize.Y;
            }
            if (!first)              // vertical padding below
            {
                rectBackground.Y = rectBackground.Y + rectBackground.H;
                rectBackground.H = 5;
                rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));
            }
        }
예제 #18
0
		private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
		{
			if (!root.IsVisibleLocal || depth > 3)
			{
				return;
			}
            //Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));
            Rect rC = new Rect(parent.X + (int)(root.X * 0.75), parent.Y + (int)(root.Y * 0.75), (int)(root.Width * 0.75), (int)(root.Height * 0.75));

			if (rC.W < 20)
				return;
			string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth-1));
			int ix = depth > 0 ? path[depth - 1] : 0;
			var c = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);

			string msg = string.Format("[{2}] {1:X8} : {0}", rC, root.Address, sPath);

			var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);
			rc.AddTextWithHeight(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);

			rc.AddFrame(rC, c);
			yPos += v.Y;

			if (yPos > 1100)
			{
				yPos = 80;
				x += 300;
			}
			var pp = new Vec2(rC.X, rC.Y);
			for (int i = 0; i < root.Children.Count; i++)
			{
				var elt = root.Children[i];
				path[depth] = i;
				if (depth < 8)
					drawElt(rc, elt, pp, ref x, ref yPos, path, depth + 1);
			}
		}
예제 #19
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("ItemAlert") || !Settings.GetBool("ItemAlert.ShowText"))
            {
                return;
            }
            Rect clientRect = this.poe.Internal.game.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
            Vec2 rightTopAnchor = new Vec2(clientRect.X + clientRect.W, clientRect.Y + clientRect.H + 5);

            int y = rightTopAnchor.Y;
            int fontSize = Settings.GetInt("ItemAlert.ShowText.FontSize");

            foreach (KeyValuePair<ExileBot.Entity, AlertDrawStyle> kv in this.currentAlerts)
            {
                if (!kv.Key.IsValid) continue;

                string text = GetItemName(kv);
                if( null == text ) continue;

                AlertDrawStyle drawStyle = kv.Value;
                int frameWidth = drawStyle.FrameWidth;
                Vec2 vPadding = new Vec2(frameWidth + 5, frameWidth);
                int frameMargin = frameWidth + 2;

                Vec2 textPos = new Vec2(rightTopAnchor.X - vPadding.X, y + vPadding.Y);

                var vTextFrame = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right);
                int iconSize = vTextFrame.Y;
                bool hasIcon = drawStyle.IconIndex >= 0;

                int maxHeight = vTextFrame.Y + 2*vPadding.Y + frameMargin;
                int maxWidth = vTextFrame.X + 2 * vPadding.X + (hasIcon ? iconSize : 0);
                rc.AddBox(new Rect(rightTopAnchor.X - maxWidth, y, maxWidth, maxHeight), Color.FromArgb(180, 0, 0, 0));

                if (hasIcon)
                {
                    const float iconsInSprite = 4;

                    Rect iconPos = new Rect(textPos.X - iconSize - vTextFrame.X, textPos.Y, iconSize, iconSize);
                    RectUV uv = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1);
                    rc.AddSprite("item_icons.png", iconPos, uv);
                }
                if( frameWidth > 0) {
                    Rect frame = new Rect(rightTopAnchor.X - vTextFrame.X - 2*vPadding.X, y, vTextFrame.X + 2*vPadding.X, vTextFrame.Y + 2*vPadding.Y);
                    rc.AddFrame(frame, kv.Value.color, frameWidth);
                }
                y += vTextFrame.Y + 2 * vPadding.Y + frameMargin;
            }
        }
예제 #20
0
파일: DpsMeter.cs 프로젝트: benjy3gg/PoeHud
        public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
        {
            if (!hasStarted)
            {
                lastCalcTime = DateTime.Now;
                hasStarted = true;
                return;
            }

            DateTime dtNow = DateTime.Now;
            TimeSpan delta = dtNow - lastCalcTime;

            if (delta.TotalSeconds > dps_period)
            {
                ixDamageMemory++;
                if (ixDamageMemory >= damageMemory.Length)
                    ixDamageMemory = 0;
                damageMemory[ixDamageMemory] = CalculateDps(delta);
                lastCalcTime = dtNow;
            }

            Vec2 mapWithOffset = mountPoints[UiMountPoint.LeftOfMinimap];
            int dps = ((int)damageMemory.Average());
            if (maxDps < dps)
                maxDps = dps;

            var textSize = rc.AddTextWithHeight(mapWithOffset,  dps + " DPS", Color.White, Settings.DpsFontSize, DrawTextFormat.Right);
            var tx2 = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + textSize.Y), maxDps + " peak DPS", Color.White, Settings.PeakFontSize, DrawTextFormat.Right);

            int width = Math.Max(tx2.X, textSize.X);
            Rect rect = new Rect(mapWithOffset.X - 5 - width, mapWithOffset.Y - 5, width + 10, textSize.Y + tx2.Y + 10);

            rc.AddBox(rect, Color.FromArgb(160, Color.Black));

            mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(mapWithOffset.X, mapWithOffset.Y + 5 + rect.H);
        }
예제 #21
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("ItemAlert") || !Settings.GetBool("ItemAlert.ShowText"))
            {
                return;
            }
            Rect clientRect = this.poe.Internal.game.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
            Vec2 vec        = new Vec2(clientRect.X + clientRect.W, clientRect.Y + clientRect.H);

            int y        = vec.Y;
            int fontSize = Settings.GetInt("ItemAlert.ShowText.FontSize");

            foreach (KeyValuePair <Entity, AlertDrawStyle> kv in this.currentAlerts)
            {
                if (kv.Key.IsValid)
                {
                    Poe_UI_EntityLabel labelFromEntity = this.poe.GetLabelFromEntity(kv.Key);
                    string             text;
                    if (labelFromEntity == null)
                    {
                        Poe_Entity itemEntity = kv.Key.GetComponent <WorldItem>().ItemEntity;
                        if (!itemEntity.IsValid)
                        {
                            continue;
                        }
                        text = kv.Value.Text;
                    }
                    else
                    {
                        text = labelFromEntity.Text;
                    }

                    int  frameWidth  = kv.Value.FrameWidth;
                    Vec2 vPadding    = new Vec2(frameWidth * 5, frameWidth);
                    int  frameMargin = frameWidth * 2;

                    Vec2 textPos = new Vec2(vec.X - vPadding.X, y + vPadding.Y);

                    var vTextFrame = rc.AddTextWithHeight(textPos, text, kv.Value.color, fontSize, DrawTextFormat.Right);
                    if (frameWidth > 0)
                    {
                        rc.AddFrame(new Rect(vec.X - vTextFrame.X - 2 * vPadding.X, y, vTextFrame.X + 2 * vPadding.X, vTextFrame.Y + 2 * vPadding.Y), kv.Value.color, frameWidth);
                    }
                    y += vTextFrame.Y + 2 * vPadding.Y + frameMargin;
                }
            }
        }
예제 #22
0
        public override void Render(RenderingContext rc)
        {
            if (!this.isVisible)
            {
                return;
            }
            Color gray = Color.Gray;

            rc.AddTextWithHeight(new Vec2(base.Bounds.X + base.Bounds.W / 2, base.Bounds.Y + base.Bounds.H / 3), this.text + ": " + this.value, Color.White, 11, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
            rc.AddBox(base.Bounds, Color.Black);
            rc.AddBox(new Rect(base.Bounds.X + 1, base.Bounds.Y + 1, base.Bounds.W - 2, base.Bounds.H - 2), gray);
            rc.AddBox(new Rect(base.Bounds.X + 5, base.Bounds.Y + 3 * base.Bounds.H / 4, base.Bounds.W - 10, 5), Color.Black);
            float num  = (float)(this.value - this.min) / (float)(this.max - this.min);
            int   num2 = (int)((float)(base.Bounds.W - 10) * num);

            rc.AddBox(new Rect(base.Bounds.X + 5 + num2 - 2, base.Bounds.Y + 3 * base.Bounds.H / 4 - 4, 4, 8), Color.White);
        }
예제 #23
0
        private static Vec2 drawItem(RenderingContext rc, AlertDrawStyle drawStyle, Vec2 delta, int x, int y, Vec2 vPadding, string text,
                                     int fontSize)
        {
            // collapse padding when there's a frame
            vPadding.X -= drawStyle.FrameWidth;
            vPadding.Y -= drawStyle.FrameWidth;
            // item will appear to have equal size

            double phi;
            var    distance = delta.GetPolarCoordinates(out phi);


            //text = text + " @ " + (int)distance + " : " + (int)(phi / Math.PI * 180)  + " : " + xSprite;

            int  compassOffset = fontSize + 8;
            Vec2 textPos       = new Vec2(x - vPadding.X - compassOffset, y + vPadding.Y);
            Vec2 vTextSize     = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right);

            int iconSize = drawStyle.IconIndex >= 0 ? vTextSize.Y : 0;

            int fullHeight = vTextSize.Y + 2 * vPadding.Y + 2 * drawStyle.FrameWidth;
            int fullWidth  = vTextSize.X + 2 * vPadding.X + iconSize + 2 * drawStyle.FrameWidth + compassOffset;

            rc.AddBox(new Rect(x - fullWidth, y, fullWidth - compassOffset, fullHeight), Color.FromArgb(180, 0, 0, 0));

            var rectUV = GetDirectionsUv(phi, distance);

            rc.AddSprite("directions.png", new Rect(x - vPadding.X - compassOffset + 6, y + vPadding.Y, vTextSize.Y, vTextSize.Y), rectUV);

            if (iconSize > 0)
            {
                const float iconsInSprite = 6;

                Rect   iconPos = new Rect(textPos.X - iconSize - vTextSize.X, textPos.Y, iconSize, iconSize);
                RectUV uv      = new RectUV(drawStyle.IconIndex / iconsInSprite, 0, (drawStyle.IconIndex + 1) / iconsInSprite, 1);
                rc.AddSprite("item_icons.png", iconPos, uv);
            }
            if (drawStyle.FrameWidth > 0)
            {
                Rect frame = new Rect(x - fullWidth, y, fullWidth - compassOffset, fullHeight);
                rc.AddFrame(frame, drawStyle.color, drawStyle.FrameWidth);
            }
            return(new Vec2(fullWidth, fullHeight));
        }
예제 #24
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("PreloadAlert"))
            {
                return;
            }
            int num = this.poe.Memory.ReadInt(this.poe.Memory.BaseAddress + Offsets.FileRoot, new int[]
            {
                12
            });

            if (num != this.lastCount)
            {
                this.lastCount = num;
                this.Parse();
            }
            if (this.disp.Count > 0)
            {
                Rect clientRect = this.poe.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
                Rect rect       = this.overlay.XphRenderer.Bounds;
                Vec2 vec        = new Vec2(clientRect.X - 10, rect.Y + rect.H + 10);
                int  num2       = vec.Y;
                int  num3       = clientRect.W;
                int  @int       = Settings.GetInt("PreloadAlert.FontSize");
                int  int2       = Settings.GetInt("PreloadAlert.BgAlpha");
                foreach (string current in this.disp)
                {
                    Vec2 vec2 = rc.AddTextWithHeight(new Vec2(vec.X, num2), current, Color.White, @int, DrawTextFormat.Right);
                    if (vec2.X + 10 > num3)
                    {
                        num3 = vec2.X + 10;
                    }
                    num2 += vec2.Y;
                }
                if (num3 > 0 && int2 > 0)
                {
                    this.bounds = new Rect(vec.X - num3 + 5, vec.Y - 5, num3, num2 - vec.Y + 10);
                    rc.AddBox(this.bounds, Color.FromArgb(int2, 1, 1, 1));
                }
            }
        }
예제 #25
0
 public override void Render(RenderingContext rc)
 {
     if (!this.isVisible)
     {
         return;
     }
     Color color = this.isEnabled ? Color.Gray : Color.Crimson;
     rc.AddTextWithHeight(new Vec2(base.Bounds.X + base.Bounds.W / 2, base.Bounds.Y + base.Bounds.H / 2), this.text, Color.White, 12, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
     rc.AddBox(base.Bounds, Color.Black);
     rc.AddBox(new Rect(base.Bounds.X + 1, base.Bounds.Y + 1, base.Bounds.W - 2, base.Bounds.H - 2), color);
     if (this.children.Count > 0)
     {
         int num = (int)((float)(base.Bounds.W - 2) * 0.05f);
         int num2 = (base.Bounds.H - 2) / 2;
         rc.AddTexture("menu_submenu.png", new Rect(base.Bounds.X + base.Bounds.W - 1 - num, base.Bounds.Y + 1 + num2 - num2 / 2, num, num2));
     }
     foreach (MenuItem current in this.children)
     {
         current.Render(rc);
     }
 }
예제 #26
0
 public override void Render(RenderingContext rc)
 {
     if (!Settings.GetBool("PreloadAlert"))
     {
         return;
     }
     int num = this.poe.Memory.ReadInt(this.poe.Memory.BaseAddress + poe.Memory.offsets.FileRoot, new int[]
     {
         12
     });
     if (num != this.lastCount)
     {
         this.lastCount = num;
         this.Parse();
     }
     if (this.disp.Count > 0)
     {
         Rect clientRect = this.poe.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
         Rect rect = this.overlay.XphRenderer.Bounds;
         Vec2 vec = new Vec2(clientRect.X - 10, rect.Y + rect.H + 10);
         int num2 = vec.Y;
         int num3 = clientRect.W;
         int @int = Settings.GetInt("PreloadAlert.FontSize");
         int int2 = Settings.GetInt("PreloadAlert.BgAlpha");
         foreach (string current in this.disp)
         {
             Vec2 vec2 = rc.AddTextWithHeight(new Vec2(vec.X, num2), current, Color.White, @int, DrawTextFormat.Right);
             if (vec2.X + 10 > num3)
             {
                 num3 = vec2.X + 10;
             }
             num2 += vec2.Y;
         }
         if (num3 > 0 && int2 > 0)
         {
             this.bounds = new Rect(vec.X - num3 + 5, vec.Y - 5, num3, num2 - vec.Y + 10);
             rc.AddBox(this.bounds, Color.FromArgb(int2, 1, 1, 1));
         }
     }
 }
예제 #27
0
        public override void Render(RenderingContext rc)
        {
            if (!this.isVisible)
            {
                return;
            }
            Color color = this.isEnabled ? Color.Gray : Color.Crimson;

            rc.AddTextWithHeight(new Vec2(base.Bounds.X + base.Bounds.W / 2, base.Bounds.Y + base.Bounds.H / 2), this.text, Color.White, 12, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
            rc.AddBox(base.Bounds, Color.Black);
            rc.AddBox(new Rect(base.Bounds.X + 1, base.Bounds.Y + 1, base.Bounds.W - 2, base.Bounds.H - 2), color);
            if (this.children.Count > 0)
            {
                int num  = (int)((float)(base.Bounds.W - 2) * 0.05f);
                int num2 = (base.Bounds.H - 2) / 2;
                rc.AddTexture("menu_submenu.png", new Rect(base.Bounds.X + base.Bounds.W - 1 - num, base.Bounds.Y + 1 + num2 - num2 / 2, num, num2));
            }
            foreach (MenuItem current in this.children)
            {
                current.Render(rc);
            }
        }
예제 #28
0
        public override void Render(RenderingContext rc)
        {
            if (!this.isVisible)
            {
                return;
            }

            rc.AddBox(base.Bounds, Color.Black);
            rc.AddBox(new Rect(base.Bounds.X + 1, base.Bounds.Y + 1, base.Bounds.W - 2, base.Bounds.H - 2), Color.Gray);

            for (int c = 0; c < 3; c++ )
            {
                Rect barBounds = new Rect(base.Bounds.X, base.Bounds.Y + (base.Bounds.H / 3 * c), base.Bounds.W - 15, base.Bounds.H / 3);
                rc.AddTextWithHeight(new Vec2(barBounds.X + barBounds.W / 2, barBounds.Y + barBounds.H / 3), bars[c].Name + ": " + this.value.PrimaryColorValue(bars[c]), Color.White, 11, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
                rc.AddBox(new Rect(barBounds.X + 5, barBounds.Y + (3 * barBounds.H / 4), barBounds.W - 10, 4), bars[c]);
                rc.AddBox(new Rect(barBounds.X + 5 + ((barBounds.W - 10) * this.value.PrimaryColorValue(bars[c]) / 255) - 2, barBounds.Y + (3 * barBounds.H / 4) - 2, 4, 8), Color.White);
            }

            Rect preview = new Rect(base.Bounds.X + base.Bounds.W - 12, base.Bounds.Y + 2, 10, base.Bounds.H - 4);
            rc.AddBox(preview, Color.Black);
            rc.AddBox(new Rect(preview.X + 1, preview.Y + 1, preview.W - 2, preview.H - 2), this.value);
        }
예제 #29
0
        public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
        {
            if (!Settings.Enabled)
            {
                return;
            }
            int num = this.model.Memory.ReadInt(this.model.Memory.BaseAddress + model.Memory.offsets.FileRoot, new int[]
            {
                12
            });
            if (num != this.lastCount)
            {
                this.lastCount = num;
                this.Parse();
            }
            if (this.disp.Count > 0)
            {

                Vec2 vec = mountPoints[UiMountPoint.LeftOfMinimap];
                int num2 = vec.Y;
                int maxWidth = 0;
                foreach (string current in this.disp)
                {
                    Vec2 vec2 = rc.AddTextWithHeight(new Vec2(vec.X, num2), current, Color.White, Settings.FontSize, DrawTextFormat.Right);
                    if (vec2.X + 10 > maxWidth)
                    {
                        maxWidth = vec2.X + 10;
                    }
                    num2 += vec2.Y;
                }
                if (maxWidth > 0 && Settings.BgAlpha > 0)
                {
                    Rect bounds = new Rect(vec.X - maxWidth + 5, vec.Y - 5, maxWidth, num2 - vec.Y + 10);
                    rc.AddBox(bounds, Color.FromArgb(Settings.BgAlpha, 1, 1, 1));
                    mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(vec.X, vec.Y + 5 + bounds.H);
                }

            }
        }
예제 #30
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!Settings.Enabled)
            {
                return;
            }
            int num = this.model.Memory.ReadInt(this.model.Memory.BaseAddress + model.Memory.offsets.FileRoot, new int[]
            {
                12
            });

            if (num != this.lastCount)
            {
                this.lastCount = num;
                this.Parse();
            }
            if (this.disp.Count > 0)
            {
                Vec2 vec      = mountPoints[UiMountPoint.LeftOfMinimap];
                int  num2     = vec.Y;
                int  maxWidth = 0;
                foreach (string current in this.disp)
                {
                    Vec2 vec2 = rc.AddTextWithHeight(new Vec2(vec.X, num2), current, Color.White, Settings.FontSize, DrawTextFormat.Right);
                    if (vec2.X + 10 > maxWidth)
                    {
                        maxWidth = vec2.X + 10;
                    }
                    num2 += vec2.Y;
                }
                if (maxWidth > 0 && Settings.BgAlpha > 0)
                {
                    Rect bounds = new Rect(vec.X - maxWidth + 5, vec.Y - 5, maxWidth, num2 - vec.Y + 10);
                    rc.AddBox(bounds, Color.FromArgb(Settings.BgAlpha, 1, 1, 1));
                    mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(vec.X, vec.Y + 5 + bounds.H);
                }
            }
        }
예제 #31
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("DangerAlert.ShowText"))
            {
                return;
            }
            Rect             rect    = this.poe.Window.ClientRect();
            int              num     = rect.W / 2 + rect.X;
            int              num2    = (int)((float)rect.H * 0.2f) + rect.Y;
            int              num3    = 0;
            int              num4    = 0;
            HashSet <string> hashSet = new HashSet <string>();

            foreach (KeyValuePair <Entity, string> current in this.currentAlerts)
            {
                if (current.Key.IsAlive && !hashSet.Contains(current.Value))
                {
                    hashSet.Add(current.Value);
                }
            }
            int @int = Settings.GetInt("DangerAlert.ShowText.FontSize");

            foreach (string current2 in hashSet)
            {
                Vec2 vec = rc.AddTextWithHeight(new Vec2(num, num2), current2, Color.Red, @int, DrawTextFormat.Center);
                if (vec.X > num3)
                {
                    num3 = vec.X;
                }
                num2 += vec.Y;
                num4 += vec.Y;
            }
            if (num3 > 0)
            {
                Rect rect2 = new Rect(num - num3 / 2 - 5, (int)((float)rect.H * 0.2f) + rect.Y - 5, num3 + 10, num4 + 10);
                rc.AddBox(rect2, Color.FromArgb(Settings.GetInt("DangerAlert.ShowText.BgAlpha"), 1, 1, 1));
            }
        }
예제 #32
0
        public override void Render(RenderingContext rc)
        {
            if (!this.isVisible)
            {
                return;
            }

            rc.AddBox(base.Bounds, Color.Black);
            rc.AddBox(new Rect(base.Bounds.X + 1, base.Bounds.Y + 1, base.Bounds.W - 2, base.Bounds.H - 2), Color.Gray);

            for (int c = 0; c < 3; c++)
            {
                Rect barBounds = new Rect(base.Bounds.X, base.Bounds.Y + (base.Bounds.H / 3 * c), base.Bounds.W - 15, base.Bounds.H / 3);
                rc.AddTextWithHeight(new Vec2(barBounds.X + barBounds.W / 2, barBounds.Y + barBounds.H / 3), bars[c].Name + ": " + this.value.PrimaryColorValue(bars[c]), Color.White, 11, DrawTextFormat.VerticalCenter | DrawTextFormat.Center);
                rc.AddBox(new Rect(barBounds.X + 5, barBounds.Y + (3 * barBounds.H / 4), barBounds.W - 10, 4), bars[c]);
                rc.AddBox(new Rect(barBounds.X + 5 + ((barBounds.W - 10) * this.value.PrimaryColorValue(bars[c]) / 255) - 2, barBounds.Y + (3 * barBounds.H / 4) - 2, 4, 8), Color.White);
            }

            Rect preview = new Rect(base.Bounds.X + base.Bounds.W - 12, base.Bounds.Y + 2, 10, base.Bounds.H - 4);

            rc.AddBox(preview, Color.Black);
            rc.AddBox(new Rect(preview.X + 1, preview.Y + 1, preview.W - 2, preview.H - 2), this.value);
        }
예제 #33
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!Settings.GetBool("Tooltip") || !Settings.GetBool("Tooltip.ShowItemLevel"))
            {
                return;
            }
            Element uIHover = this.model.Internal.IngameState.UIHover;
            Entity  item    = uIHover.AsObject <InventoryItemIcon>().Item;

            if (item.address == 0 || !item.IsValid)
            {
                return;
            }

            Tooltip tooltip = uIHover.AsObject <InventoryItemIcon>().Tooltip;

            if (tooltip == null)
            {
                return;
            }
            Element childAtIndex = tooltip.GetChildAtIndex(0);

            if (childAtIndex == null)
            {
                return;
            }
            Element childAtIndex2 = childAtIndex.GetChildAtIndex(1);

            if (childAtIndex2 == null)
            {
                return;
            }
            Rect   clientRect = childAtIndex2.GetClientRect();
            string text       = item.GetComponent <Mods>().ItemLevel + " @ " + item.address.ToString("X8");

            rc.AddTextWithHeight(new Vec2(clientRect.X + 2, clientRect.Y + 2), text, Color.White, 14, DrawTextFormat.Left);
        }
예제 #34
0
 public override void Render(RenderingContext rc)
 {
     if (!Settings.GetBool("DangerAlert.ShowText"))
     {
         return;
     }
     Rect rect = this.poe.Window.ClientRect();
     int num = rect.W / 2 + rect.X;
     int num2 = (int)((float)rect.H * 0.2f) + rect.Y;
     int num3 = 0;
     int num4 = 0;
     HashSet<string> hashSet = new HashSet<string>();
     foreach (KeyValuePair<Entity, string> current in this.currentAlerts)
     {
         if (current.Key.IsAlive && !hashSet.Contains(current.Value))
         {
             hashSet.Add(current.Value);
         }
     }
     int @int = Settings.GetInt("DangerAlert.ShowText.FontSize");
     foreach (string current2 in hashSet)
     {
         Vec2 vec = rc.AddTextWithHeight(new Vec2(num, num2), current2, Color.Red, @int, DrawTextFormat.Center);
         if (vec.X > num3)
         {
             num3 = vec.X;
         }
         num2 += vec.Y;
         num4 += vec.Y;
     }
     if (num3 > 0)
     {
         Rect rect2 = new Rect(num - num3 / 2 - 5, (int)((float)rect.H * 0.2f) + rect.Y - 5, num3 + 10, num4 + 10);
         rc.AddBox(rect2, Color.FromArgb(Settings.GetInt("DangerAlert.ShowText.BgAlpha"), 1, 1, 1));
     }
 }
예제 #35
0
        public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
        {
            if (!Settings.ShowText || !alertsText.Any())
            {
                return;
            }

            Rect rect = model.Window.ClientRect();
            int xScreenCenter = rect.W / 2 + rect.X;
            int yPos = rect.H * Settings.YPosition / 100 + rect.Y;

            var playerPos = model.Player.GetComponent<Positioned>().GridPos;
            int fontSize = Settings.TextFontSize;
            bool first = true;
            Rect rectBackground = new Rect();
            foreach (var alert in alertsText)
            {
                int cntAlive = alert.Value.Count(c => c.IsAlive);
                if (cntAlive == 0)
                    continue;

                Vec2 textSize = rc.MeasureString(alert.Key, fontSize, DrawTextFormat.Center);

                int iconSize = 3 + textSize.Y;

                int xPos = xScreenCenter - textSize.X / 2 - 6;
                rc.AddTextWithHeight(new Vec2(xPos + 6, yPos), alert.Key, Color.Red, fontSize, DrawTextFormat.Left);

                int cntArrows = 1;
                rectBackground = new Rect(xPos - cntAlive * iconSize, yPos, textSize.X + 12 + cntAlive * iconSize, textSize.Y);
                if (first) // vertical padding above
                {
                    if( !Settings.StackUp)
                        rectBackground.Y -= 5;
                    rectBackground.H += 5;
                    first = false;
                }
                rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));

                foreach (EntityWrapper mob in alert.Value)
                {
                    if (!mob.IsAlive)
                        continue;
                    Vec2 delta = mob.GetComponent<Positioned>().GridPos - playerPos;
                    double phi;
                    double distance = delta.GetPolarCoordinates(out phi);
                    RectUV uv = GetDirectionsUv(phi, distance);

                    Rect rectDirection = new Rect(xPos - cntArrows * iconSize, yPos, rectBackground.H, rectBackground.H);
                    cntArrows++;
                    rc.AddSprite("directions.png", rectDirection, uv, Color.Red);
                }

                yPos += Settings.StackUp ? -textSize.Y : textSize.Y;
            }

            if (!first)  // vertical padding below
            {
                rectBackground.Y = rectBackground.Y + (Settings.StackUp ? - rectBackground.H - 5: rectBackground.H);
                rectBackground.H = 5;
                rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));
            }
        }
예제 #36
0
 private void DrawEntityHealthPercents(Color hppercentsTextColor, String hppercentsText, Rect bg, RenderingContext rc)
 {
     // Draw percents
     rc.AddTextWithHeight(new Vec2(bg.X + bg.W + 4, bg.Y), hppercentsText, hppercentsTextColor, 9, DrawTextFormat.Left);
 }
예제 #37
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (this.model.Player != null && this.model.Player.GetComponent <Player>().Level >= 100)
            {
                return;
            }
            if (!this.hasStarted)
            {
                this.startXp      = this.model.Player.GetComponent <Player>().XP;
                this.startTime    = DateTime.Now;
                this.lastCalcTime = DateTime.Now;
                this.hasStarted   = true;
                return;
            }
            DateTime dtNow = DateTime.Now;
            TimeSpan delta = dtNow - this.lastCalcTime;

            if (delta.TotalSeconds > 1)
            {
                calculateRemainingExp(dtNow);
                this.lastCalcTime = dtNow;
            }

            int fontSize = Settings.FontSize;
            int bgAlpha  = Settings.BgAlpha;

            Vec2 mapWithOffset = mountPoints[UiMountPoint.LeftOfMinimap];

            int  yCursor      = 0;
            Vec2 rateTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y), this.curDisplayString, Color.White, fontSize, DrawTextFormat.Right);

            yCursor += rateTextSize.Y;
            Vec2 remainingTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + yCursor), this.curTimeLeftString, Color.White, fontSize, DrawTextFormat.Right);

            yCursor += remainingTextSize.Y;

            int thirdLine = mapWithOffset.Y + yCursor;

            int    textWidth = Math.Max(rateTextSize.X, remainingTextSize.X) + 10;
            string strTimer  = null;

            if (Settings.ShowZoneAndTimeSpent)
            {
                Vec2 areaLevelNote = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, thirdLine), this.model.Area.CurrentArea.DisplayName, Color.White, fontSize, DrawTextFormat.Right);

                strTimer = AreaInstance.GetTimeString(dtNow - this.model.Area.CurrentArea.TimeEntered);
                Vec2 timerSize = rc.MeasureString(strTimer, fontSize, DrawTextFormat.Left);
                yCursor  += areaLevelNote.Y;
                textWidth = Math.Max(textWidth, areaLevelNote.X + timerSize.X + 20 + 10);
            }

            Rect clientRect = model.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();

            int  width = Math.Max(textWidth, Math.Max(clientRect.W, 0 /*this.overlay.PreloadAlert.Bounds.W*/));
            Rect rect  = new Rect(mapWithOffset.X - width + 5, mapWithOffset.Y - 5, width, yCursor + 10);

            if (Settings.ShowClock)
            {
                rc.AddTextWithHeight(new Vec2(rect.X + 5, mapWithOffset.Y), dtNow.ToShortTimeString(), Color.White, fontSize, DrawTextFormat.Left);
            }

            if (Settings.ShowZoneAndTimeSpent)
            {
                rc.AddTextWithHeight(new Vec2(rect.X + 5, thirdLine), strTimer, Color.White, fontSize, DrawTextFormat.Left);
            }

            rc.AddBox(rect, Color.FromArgb(bgAlpha, 1, 1, 1));

            mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(mapWithOffset.X, mapWithOffset.Y + 5 + rect.H);
        }
예제 #38
0
        private static int drawStatLine(RenderingContext rc, RollValue roll, Rect clientRect, int yPos, bool isImp = false)
        {
            const int leftRuler = 50;
            Color textColor = isImp ? HudSkin.MagicColor : Color.White;

            bool isUniqAffix = roll.AffixType == ModsDat.ModType.Hidden;
            string prefix = isImp ? "[Impl]" : roll.AffixType == ModsDat.ModType.Prefix
                ? "[P]"
                : roll.AffixType == ModsDat.ModType.Suffix ? "[S]" : "[?]";
            if (!isUniqAffix || isImp)
            {
                if( !isImp && roll.CouldHaveTiers())
                    prefix += " T" + roll.Tier + " ";

                rc.AddTextWithHeight(new Vec2(clientRect.X + 5, yPos), prefix, textColor, 8, DrawTextFormat.Left);
                var textSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), roll.AffixText, roll.TextColor, 8,
                    DrawTextFormat.Left);
                yPos += textSize.Y;
            }

            for (int iStat = 0; iStat < 4; iStat++)
            {
                IntRange range = roll.TheMod.StatRange[iStat];
                if(range.Min == 0 && range.Max == 0)
                    continue;

                var theStat = roll.TheMod.StatNames[iStat];
                int val = roll.StatValue[iStat];
                float percents = range.GetPercentage(val);
                bool noSpread = !range.HasSpread();

                double hue = 120 * percents;
                if (noSpread) hue = 300;
                if (percents > 1) hue = 180;

                Color col = ColorUtils.ColorFromHsv(hue, 1, 1);

                string line2 = string.Format(noSpread ? "{0}" : "{0} [{1}]", theStat, range);

                rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), line2, Color.White, 8, DrawTextFormat.Left);

                if( null == theStat) // crazy maps
                    continue;

                string sValue = theStat.ValueToString(val);
                var txSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler - 5, yPos), sValue,
                    col, 8,
                    DrawTextFormat.Right);

                yPos += txSize.Y;
            }
            return yPos;
        }
예제 #39
0
 private void DrawEntityHealthPercents(Color hppercentsTextColor, String hppercentsText, Rect bg, RenderingContext rc)
 {
     // Draw percents
     rc.AddTextWithHeight(new Vec2(bg.X + bg.W + 4, bg.Y), hppercentsText, hppercentsTextColor, 9, DrawTextFormat.Left);
 }
예제 #40
0
        public override void Render(RenderingContext rc, Dictionary<UiMountPoint, Vec2> mountPoints)
        {
            if (this.model.Player != null && this.model.Player.GetComponent<Player>().Level >= 100)
            {
                return;
            }
            if (!this.hasStarted)
            {
                this.startXp = this.model.Player.GetComponent<Player>().XP;
                this.startTime = DateTime.Now;
                this.lastCalcTime = DateTime.Now;
                this.hasStarted = true;
                return;
            }
            DateTime dtNow = DateTime.Now;
            TimeSpan delta = dtNow - this.lastCalcTime;

            if (delta.TotalSeconds > 1)
            {
                calculateRemainingExp(dtNow);
                this.lastCalcTime = dtNow;
            }

            int fontSize = Settings.FontSize;
            int bgAlpha = Settings.BgAlpha;

            Vec2 mapWithOffset = mountPoints[UiMountPoint.LeftOfMinimap];

            int yCursor = 0;
            Vec2 rateTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y), this.curDisplayString, Color.White, fontSize, DrawTextFormat.Right);
            yCursor += rateTextSize.Y;
            Vec2 remainingTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + yCursor), this.curTimeLeftString, Color.White, fontSize, DrawTextFormat.Right);
            yCursor += remainingTextSize.Y;

            int thirdLine = mapWithOffset.Y + yCursor;

            int textWidth = Math.Max(rateTextSize.X, remainingTextSize.X) + 10;
            string strTimer = null;

            if (Settings.ShowZoneAndTimeSpent)
            {
                Vec2 areaLevelNote = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, thirdLine), this.model.Area.CurrentArea.DisplayName, Color.White, fontSize, DrawTextFormat.Right);

                strTimer = AreaInstance.GetTimeString(dtNow - this.model.Area.CurrentArea.TimeEntered);
                Vec2 timerSize = rc.MeasureString(strTimer, fontSize, DrawTextFormat.Left);
                yCursor += areaLevelNote.Y;
                textWidth = Math.Max(textWidth, areaLevelNote.X + timerSize.X + 20 + 10);
            }

            Rect clientRect = model.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();

            int width = Math.Max(textWidth, Math.Max(clientRect.W, 0/*this.overlay.PreloadAlert.Bounds.W*/));
            Rect rect = new Rect(mapWithOffset.X - width + 5, mapWithOffset.Y - 5, width, yCursor + 10);

            if( Settings.ShowClock)
                rc.AddTextWithHeight(new Vec2(rect.X + 5, mapWithOffset.Y), dtNow.ToShortTimeString(), Color.White, fontSize, DrawTextFormat.Left);

            if( Settings.ShowZoneAndTimeSpent)
                rc.AddTextWithHeight(new Vec2(rect.X + 5, thirdLine), strTimer, Color.White, fontSize, DrawTextFormat.Left);

            rc.AddBox(rect, Color.FromArgb(bgAlpha, 1, 1, 1));

            mountPoints[UiMountPoint.LeftOfMinimap] = new Vec2(mapWithOffset.X, mapWithOffset.Y + 5 + rect.H);
        }
예제 #41
0
 private void RenderItemLevel(RenderingContext rc, Rect clientRect)
 {
     string text = _lastHovered.GetComponent<Mods>().ItemLevel.ToString();
     #if DEBUG
     text += " @ " + _lastHovered.Address.ToString("X8");
     #endif
     rc.AddTextWithHeight(new Vec2(clientRect.X + Settings.OffsetInnerX, clientRect.Y + Settings.OffsetInnerY), text, Color.White, Settings.ItemLevelFontSize, DrawTextFormat.Left);
 }
예제 #42
0
        private static Vec2 drawItem(RenderingContext rc, AlertDrawStyle drawStyle, Vec2 delta, int x, int y, Vec2 vPadding, string text,
			int fontSize)
        {
            // collapse padding when there's a frame
            vPadding.X -= drawStyle.FrameWidth;
            vPadding.Y -= drawStyle.FrameWidth;
            // item will appear to have equal size

            double phi;
            var distance = delta.GetPolarCoordinates(out phi);

            //text = text + " @ " + (int)distance + " : " + (int)(phi / Math.PI * 180)  + " : " + xSprite;

            int compassOffset = fontSize + 8;
            Vec2 textPos = new Vec2(x - vPadding.X - compassOffset, y + vPadding.Y);
            Vec2 vTextSize = rc.AddTextWithHeight(textPos, text, drawStyle.color, fontSize, DrawTextFormat.Right);

            int iconSize =  drawStyle.IconIndex >= 0 ? vTextSize.Y : 0;

            int fullHeight = vTextSize.Y + 2 * vPadding.Y + 2 * drawStyle.FrameWidth;
            int fullWidth = vTextSize.X + 2 * vPadding.X + iconSize + 2 * drawStyle.FrameWidth + compassOffset;
            rc.AddBox(new Rect(x - fullWidth, y, fullWidth - compassOffset, fullHeight), Color.FromArgb(180, 0, 0, 0));

            var rectUV = GetDirectionsUv(phi, distance);
            rc.AddSprite("directions.png", new Rect(x - vPadding.X - compassOffset + 6, y + vPadding.Y, vTextSize.Y, vTextSize.Y), rectUV);

            if (iconSize > 0)
            {
                const float iconsInSprite = 6;

                Rect iconPos = new Rect(textPos.X - iconSize - vTextSize.X, textPos.Y, iconSize, iconSize);
                RectUV uv = new RectUV(drawStyle.IconIndex/iconsInSprite, 0, (drawStyle.IconIndex + 1)/iconsInSprite, 1);
                rc.AddSprite("item_icons.png", iconPos, uv);
            }
            if (drawStyle.FrameWidth > 0)
            {
                Rect frame = new Rect(x - fullWidth, y, fullWidth - compassOffset , fullHeight);
                rc.AddFrame(frame, drawStyle.color, drawStyle.FrameWidth);
            }
            return new Vec2(fullWidth, fullHeight);
        }
예제 #43
0
        private static void drawElt(RenderingContext rc, Element root, Vec2 parent, ref int x, ref int yPos, int[] path, int depth = 0)
        {
            if ( /* !root.IsVisibleLocal || */ depth > MAX_DEPTH)
            {
                return;
            }
            var scale = root.Scale;
            Vec2f position = new Vec2f(parent.X + root.X * scale, parent.Y + root.Y * scale);
            Vec2 size = new Vec2((int)(root.Width * scale), (int)(root.Height * scale));

            //			if (rC.W < 20) return;

            string sPath = path[0].ToString("X3") + "-" + String.Join("-", path.Skip(1).Take(depth-1));
            int ix = depth > 0 ? path[depth - 1] : 0;
            var c = Color.FromArgb(255, 255 - 25 * (ix % 10), 255 - 25 * ((ix % 100) / 10), 255);

            string msg = string.Format("[{2}] {1:X8} : {0} {3}", position, root.Address, sPath, size);

            var v = rc.AddTextWithHeight(new Vec2(x, yPos), msg, c, 9, DrawTextFormat.Left);
            rc.AddTextWithHeight(new Vec2f(position.X, position.Y + depth * 10 - 10), sPath, c, 8, DrawTextFormat.Left);
            // rc.AddTextWithHeightAndOutline(new Vec2(rC.X, rC.Y + depth * 10 - 10), sPath, c, Color.Black, 8, DrawTextFormat.Left);

            rc.AddFrame(new Rect(position, size), c);
            yPos += v.Y;

            if (yPos > 1100)
            {
                yPos = 80;
                x += 300;
            }
            position.Y += root.ScrollY * root.Scale;

            List<Element> children = root.Children;
            for (int i = 0; i < children.Count && i < MAX_CHILDREN; i++)
            {
                var elt = children[i];
                path[depth] = i;
                drawElt(rc, elt, position, ref x, ref yPos, path, depth + 1);
            }
        }
예제 #44
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("Tooltip") || !Settings.GetBool("Tooltip.ShowItemMods"))
            {
                return;
            }
            Element uiHover   = this.poe.Internal.IngameState.UIHover;
            Entity  poeEntity = uiHover.AsObject <InventoryItemIcon>().Item;

            if (poeEntity.address == 0 || !poeEntity.IsValid)
            {
                return;
            }
            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();
            Rect headerRect = childAtIndex1.GetChildAtIndex(0).GetClientRect();

            if (this.poeEntity == null || this.poeEntity.ID != poeEntity.ID)
            {
                this.mods = new List <MaxRolls_Current>();
                //List<Poe_ItemMod> impMods = poeEntity.GetComponent<Mods>().ImplicitMods;
                List <ItemMod> expMods = poeEntity.GetComponent <Mods>().ItemMods;
                int            ilvl    = poeEntity.GetComponent <Mods>().ItemLevel;
                foreach (ItemMod item in expMods)
                {
                    this.mods.Add(new MaxRolls_Current(item.Name, item.Level, ilvl));
                }
                this.poeEntity = poeEntity;
            }
            int tooltipBotY = clientRect.Y + clientRect.H;
            int i           = tooltipBotY;

            // Implicit mods
            //foreach (Poe_ItemMod item in impMods)
            //{
            //    rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.Name, Color.Yellow, 9, DrawTextFormat.Left);
            //    rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 10, i), item.Level.ToString(), Color.White, 6, DrawTextFormat.Left);
            //    i += 20;
            //}
            foreach (MaxRolls_Current item in this.mods)
            {
                rc.AddTextWithHeight(new Vec2(clientRect.X, i), item.name, item.color, 8, DrawTextFormat.Left);
                i += 20;
                rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max, Color.White, 8, DrawTextFormat.Left);
                rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr, Color.White, 8, DrawTextFormat.Left);
                i += 20;
                if (item.curr2 != null && item.max2 != null)
                {
                    rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 100, i), item.max2, Color.White, 8, DrawTextFormat.Left);
                    rc.AddTextWithHeight(new Vec2(clientRect.X + 30, i), item.curr2, Color.White, 8, DrawTextFormat.Left);
                    i += 20;
                }
            }
            if (i > tooltipBotY)
            {
                Rect helpRect = new Rect(clientRect.X + 1, tooltipBotY, clientRect.W, i - tooltipBotY);
                rc.AddBox(helpRect, Color.FromArgb(220, Color.Black));
            }
        }
예제 #45
0
        private static int drawStatLine(RenderingContext rc, RollValue item, Rect clientRect, int yPos)
        {
            const int leftRuler = 50;

            bool   isUniqAffix = item.AffixType == ModsDat.ModType.Hidden;
            string prefix      = item.AffixType == ModsDat.ModType.Prefix
            ? "[P]"
            : item.AffixType == ModsDat.ModType.Suffix ? "[S]" : "[?]";

            if (!isUniqAffix)
            {
                if (item.CouldHaveTiers())
                {
                    prefix += " T" + item.Tier + " ";
                }
                rc.AddTextWithHeight(new Vec2(clientRect.X + 5, yPos), prefix, item.TextColor, 8, DrawTextFormat.Left);
                var textSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), item.AffixText, item.TextColor, 8,
                                                    DrawTextFormat.Left);
                yPos += textSize.Y;
            }

            for (int iStat = 0; iStat < 4; iStat++)
            {
                IntRange range = item.TheMod.StatRange[iStat];
                if (range.Min == 0 && range.Max == 0)
                {
                    continue;
                }

                var theStat = item.TheMod.StatNames[iStat];
                if (theStat != null)
                {
                    int   val      = item.StatValue[iStat];
                    float percents = range.GetPercentage(val);
                    bool  noSpread = !range.HasSpread();

                    double hue = 120 * percents;
                    if (noSpread)
                    {
                        hue = 300;
                    }
                    if (percents > 1)
                    {
                        hue = 180;
                    }

                    Color col = ColorUtils.ColorFromHsv(hue, 1, 1);

                    string line2 = string.Format(noSpread ? "{0}" : "{0} [{1}]", theStat, range);

                    rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), line2, Color.White, 8, DrawTextFormat.Left);

                    string sValue = theStat.ValueToString(val);
                    var    txSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler - 5, yPos), sValue,
                                                         col, 8,
                                                         DrawTextFormat.Right);
                    yPos += txSize.Y;
                }
            }
            return(yPos);
        }
예제 #46
0
 private void DrawEntityHealthbarText(Color textColor, String healthString, Rect bg, RenderingContext rc)
 {
     // Draw monster health ex. "163 / 12k"
     rc.AddTextWithHeight(new Vec2(bg.X + bg.W / 2, bg.Y), healthString, textColor, 9, DrawTextFormat.Center);
 }
예제 #47
0
 private void DrawEntityHealthbarText(Color textColor, String healthString, Rect bg, RenderingContext rc)
 {
     // Draw monster health ex. "163 / 12k"
     rc.AddTextWithHeight(new Vec2(bg.X + bg.W / 2, bg.Y), healthString, textColor, 9, DrawTextFormat.Center);
 }
예제 #48
0
        private void RenderWeaponStats(RenderingContext rc, Rect clientRect)
        {
            const int innerPadding = 3;
            float     aSpd         = ((float)1000) / _weaponAttack.AttackDelay;
            int       cntDamages   = Enum.GetValues(typeof(DamageType)).Length;

            float[] doubleDpsPerStat  = new float[cntDamages];
            float   physDmgMultiplier = 1;

            doubleDpsPerStat[(int)DamageType.Physical] = _weaponAttack.MaxDamage + _weaponAttack.MinDamage;
            foreach (RollValue roll in _explicitMods)
            {
                for (int iStat = 0; iStat < 4; iStat++)
                {
                    IntRange range = roll.TheMod.StatRange[iStat];
                    if (range.Min == 0 && range.Max == 0)
                    {
                        continue;
                    }

                    StatsDat.StatRecord theStat = roll.TheMod.StatNames[iStat];
                    int val = roll.StatValue[iStat];
                    switch (theStat.Key)
                    {
                    case "physical_damage_+%":
                    case "local_physical_damage_+%":
                        physDmgMultiplier += val / 100f;
                        break;

                    case "local_attack_speed_+%":
                        aSpd *= (100f + val) / 100;
                        break;

                    case "local_minimum_added_physical_damage":
                    case "local_maximum_added_physical_damage":
                        doubleDpsPerStat[(int)DamageType.Physical] += val;
                        break;

                    case "local_minimum_added_fire_damage":
                    case "local_maximum_added_fire_damage":
                    case "unique_local_minimum_added_fire_damage_when_in_main_hand":
                    case "unique_local_maximum_added_fire_damage_when_in_main_hand":
                        doubleDpsPerStat[(int)DamageType.Fire] += val;
                        break;

                    case "local_minimum_added_cold_damage":
                    case "local_maximum_added_cold_damage":
                    case "unique_local_minimum_added_cold_damage_when_in_off_hand":
                    case "unique_local_maximum_added_cold_damage_when_in_off_hand":
                        doubleDpsPerStat[(int)DamageType.Cold] += val;
                        break;

                    case "local_minimum_added_lightning_damage":
                    case "local_maximum_added_lightning_damage":
                        doubleDpsPerStat[(int)DamageType.Lightning] += val;
                        break;

                    case "unique_local_minimum_added_chaos_damage_when_in_off_hand":
                    case "unique_local_maximum_added_chaos_damage_when_in_off_hand":
                    case "local_minimum_added_chaos_damage":
                    case "local_maximum_added_chaos_damage":
                        doubleDpsPerStat[(int)DamageType.Chaos] += val;
                        break;

                    default:
                        break;
                    }
                }
            }

            doubleDpsPerStat[(int)DamageType.Physical] *= physDmgMultiplier;
            if (_quality > 0)
            {
                doubleDpsPerStat[(int)DamageType.Physical] += (_weaponAttack.MaxDamage + _weaponAttack.MinDamage) * _quality / 100f;
            }
            float pDps = doubleDpsPerStat[(int)DamageType.Physical] / 2 * aSpd;

            float eDps      = 0;
            int   firstEmg  = 0;
            Color eDpsColor = Color.White;

            for (int i = 1; i < cntDamages; i++)
            {
                eDps += doubleDpsPerStat[i] / 2 * aSpd;
                if (doubleDpsPerStat[i] > 0)
                {
                    if (firstEmg == 0)
                    {
                        firstEmg  = i;
                        eDpsColor = eleCols[i];
                    }
                    else
                    {
                        eDpsColor = Color.DarkViolet;
                    }
                }
            }

            Vec2 sz = new Vec2();

            if (pDps > 0)
            {
                sz = rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - Settings.OffsetInnerX, clientRect.Y + Settings.OffsetInnerY), pDps.ToString("#.#"), Color.White, Settings.DpsFontSize, DrawTextFormat.Right);
            }
            Vec2 sz2 = new Vec2();

            if (eDps > 0)
            {
                sz2 = rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - Settings.OffsetInnerX, clientRect.Y + Settings.OffsetInnerY + sz.Y), eDps.ToString("#.#"), eDpsColor, Settings.DpsFontSize, DrawTextFormat.Right);
            }
            rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - Settings.OffsetInnerX, clientRect.Y + Settings.OffsetInnerY + sz.Y + sz2.Y), "DPS", Color.White, 8, DrawTextFormat.Right);
        }
예제 #49
0
        private void RenderWeaponStats(RenderingContext rc, Rect clientRect)
        {
            const int innerPadding = 3;
            float aSpd = ((float)1000) / _weaponAttack.AttackDelay;
            int cntDamages = Enum.GetValues(typeof(DamageType)).Length;
            float[] doubleDpsPerStat = new float[cntDamages];
            float physDmgMultiplier = 1;
            doubleDpsPerStat[(int)DamageType.Physical] = _weaponAttack.MaxDamage + _weaponAttack.MinDamage;
            foreach (RollValue roll in _explicitMods)
            {
                for (int iStat = 0; iStat < 4; iStat++)
                {
                    IntRange range = roll.TheMod.StatRange[iStat];
                    if (range.Min == 0 && range.Max == 0)
                        continue;

                    StatsDat.StatRecord theStat = roll.TheMod.StatNames[iStat];
                    int val = roll.StatValue[iStat];
                    switch (theStat.Key)
                    {
                        case "physical_damage_+%":
                        case "local_physical_damage_+%":
                            physDmgMultiplier += val / 100f;
                            break;
                        case "local_attack_speed_+%":
                            aSpd *= (100f + val) / 100;
                            break;
                        case "local_minimum_added_physical_damage":
                        case "local_maximum_added_physical_damage":
                            doubleDpsPerStat[(int)DamageType.Physical] += val;
                            break;
                        case "local_minimum_added_fire_damage":
                        case "local_maximum_added_fire_damage":
                        case "unique_local_minimum_added_fire_damage_when_in_main_hand":
                        case "unique_local_maximum_added_fire_damage_when_in_main_hand":
                            doubleDpsPerStat[(int)DamageType.Fire] += val;
                            break;
                        case "local_minimum_added_cold_damage":
                        case "local_maximum_added_cold_damage":
                        case "unique_local_minimum_added_cold_damage_when_in_off_hand":
                        case "unique_local_maximum_added_cold_damage_when_in_off_hand":
                            doubleDpsPerStat[(int)DamageType.Cold] += val;
                            break;
                        case "local_minimum_added_lightning_damage":
                        case "local_maximum_added_lightning_damage":
                            doubleDpsPerStat[(int)DamageType.Lightning] += val;
                            break;
                        case "unique_local_minimum_added_chaos_damage_when_in_off_hand":
                        case "unique_local_maximum_added_chaos_damage_when_in_off_hand":
                        case "local_minimum_added_chaos_damage":
                        case "local_maximum_added_chaos_damage":
                            doubleDpsPerStat[(int)DamageType.Chaos] += val;
                            break;

                        default:
                            break;
                    }
                }
            }

            doubleDpsPerStat[(int)DamageType.Physical] *= physDmgMultiplier;
            if (_quality > 0)
                doubleDpsPerStat[(int)DamageType.Physical] += (_weaponAttack.MaxDamage + _weaponAttack.MinDamage) * _quality / 100f;
            float pDps = doubleDpsPerStat[(int)DamageType.Physical] / 2 * aSpd;

            float eDps = 0;
            int firstEmg = 0;
            Color eDpsColor = Color.White;

            for(int i = 1; i < cntDamages; i++) {
                eDps += doubleDpsPerStat[i] / 2 * aSpd;
                if (doubleDpsPerStat[i] > 0)
                {
                    if (firstEmg == 0)
                    {
                        firstEmg = i;
                        eDpsColor = eleCols[i];
                    } else
                    {
                        eDpsColor = Color.DarkViolet;
                    }
                }
            }

            Vec2 sz = new Vec2();
            if (pDps > 0)
                sz = rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - Settings.OffsetInnerX, clientRect.Y + Settings.OffsetInnerY), pDps.ToString("#.#"), Color.White, Settings.DpsFontSize, DrawTextFormat.Right);
            Vec2 sz2 = new Vec2();
            if( eDps > 0 )
                sz2 = rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - Settings.OffsetInnerX, clientRect.Y + Settings.OffsetInnerY + sz.Y), eDps.ToString("#.#"), eDpsColor, Settings.DpsFontSize, DrawTextFormat.Right);
            rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - Settings.OffsetInnerX, clientRect.Y + Settings.OffsetInnerY + sz.Y + sz2.Y), "DPS", Color.White, 8, DrawTextFormat.Right);
        }
예제 #50
0
        public override void Render(RenderingContext rc, Dictionary <UiMountPoint, Vec2> mountPoints)
        {
            if (!Settings.ShowText || !alertsText.Any())
            {
                return;
            }

            Rect rect          = model.Window.ClientRect();
            int  xScreenCenter = rect.W / 2 + rect.X;
            int  yPos          = rect.H * Settings.YPosition / 100 + rect.Y;

            var  playerPos      = model.Player.GetComponent <Positioned>().GridPos;
            int  fontSize       = Settings.TextFontSize;
            bool first          = true;
            Rect rectBackground = new Rect();

            foreach (var alert in alertsText)
            {
                int cntAlive = alert.Value.Count(c => c.IsAlive);
                if (cntAlive == 0)
                {
                    continue;
                }

                Vec2 textSize = rc.MeasureString(alert.Key, fontSize, DrawTextFormat.Center);

                int iconSize = 3 + textSize.Y;

                int xPos = xScreenCenter - textSize.X / 2 - 6;
                rc.AddTextWithHeight(new Vec2(xPos + 6, yPos), alert.Key, Color.Red, fontSize, DrawTextFormat.Left);


                int cntArrows = 1;
                rectBackground = new Rect(xPos - cntAlive * iconSize, yPos, textSize.X + 12 + cntAlive * iconSize, textSize.Y);
                if (first)                 // vertical padding above
                {
                    if (!Settings.StackUp)
                    {
                        rectBackground.Y -= 5;
                    }
                    rectBackground.H += 5;
                    first             = false;
                }
                rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));

                foreach (EntityWrapper mob in alert.Value)
                {
                    if (!mob.IsAlive)
                    {
                        continue;
                    }
                    Vec2   delta = mob.GetComponent <Positioned>().GridPos - playerPos;
                    double phi;
                    double distance = delta.GetPolarCoordinates(out phi);
                    RectUV uv       = GetDirectionsUv(phi, distance);

                    Rect rectDirection = new Rect(xPos - cntArrows * iconSize, yPos, rectBackground.H, rectBackground.H);
                    cntArrows++;
                    rc.AddSprite("directions.png", rectDirection, uv, Color.Red);
                }



                yPos += Settings.StackUp ? -textSize.Y : textSize.Y;
            }

            if (!first)              // vertical padding below
            {
                rectBackground.Y = rectBackground.Y + (Settings.StackUp ? -rectBackground.H - 5: rectBackground.H);
                rectBackground.H = 5;
                rc.AddBox(rectBackground, Color.FromArgb(Settings.TextBgAlpha, 1, 1, 1));
            }
        }
예제 #51
0
        public override void Render(RenderingContext rc)
        {
            if (!Settings.GetBool("XphDisplay") || (this.poe.Player != null && this.poe.Player.GetComponent<Player>().Level >= 100))
            {
                return;
            }
            if (!this.hasStarted)
            {
                this.startXp = this.poe.Player.GetComponent<Player>().XP;
                this.startTime = DateTime.Now;
                this.lastCalcTime = DateTime.Now;
                this.hasStarted = true;
                return;
            }
            DateTime dtNow = DateTime.Now;
            TimeSpan delta = dtNow - this.lastCalcTime;

            if (delta.TotalSeconds > 1.0)
            {
                this.poe.Area.CurrentArea.AddTimeSpent(delta);
                calculateRemainingExp(dtNow);
                this.lastCalcTime = dtNow;
            }

            int fontSize = Settings.GetInt("XphDisplay.FontSize");
            int bgAlpha = Settings.GetInt("XphDisplay.BgAlpha");

            Rect clientRect = this.poe.Internal.IngameState.IngameUi.Minimap.SmallMinimap.GetClientRect();
            Vec2 mapWithOffset = new Vec2(clientRect.X - 10, clientRect.Y + 5);
            int yCursor = 0;
            Vec2 rateTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y), this.curDisplayString, Color.White, fontSize, DrawTextFormat.Right);
            yCursor += rateTextSize.Y;
            Vec2 remainingTextSize = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, mapWithOffset.Y + yCursor), this.curTimeLeftString, Color.White, fontSize, DrawTextFormat.Right);
            yCursor += remainingTextSize.Y;
            int thirdLine = mapWithOffset.Y + yCursor;
            Vec2 areaLevelNote = rc.AddTextWithHeight(new Vec2(mapWithOffset.X, thirdLine), this.poe.Area.CurrentArea.DisplayName, Color.White, fontSize, DrawTextFormat.Right);
            string strTimer = this.poe.Area.CurrentArea.TimeString;
            Vec2 timerSize = rc.MeasureString(strTimer, fontSize, DrawTextFormat.Left);
            yCursor += areaLevelNote.Y;

            int textWidth = Math.Max( Math.Max(rateTextSize.X, remainingTextSize.X), areaLevelNote.X + timerSize.X + 20 ) + 10;
            int width = Math.Max(textWidth, Math.Max(clientRect.W, this.overlay.PreloadAlert.Bounds.W));
            Rect rect = new Rect(mapWithOffset.X - width + 5, mapWithOffset.Y - 5, width, yCursor + 10);
            this.Bounds = rect;

            rc.AddTextWithHeight(new Vec2(rect.X + 5, mapWithOffset.Y), dtNow.ToShortTimeString(), Color.White, fontSize, DrawTextFormat.Left);
            rc.AddTextWithHeight(new Vec2(rect.X + 5, thirdLine), strTimer, Color.White, fontSize, DrawTextFormat.Left);

            rc.AddBox(rect, Color.FromArgb(bgAlpha, 1, 1, 1));
        }