Exemplo n.º 1
0
 public ItemHoverFixSnippet(Item item, bool check = false)
     : base("")
 {
     this._item = item;
     this.Color = ItemRarity.GetColor(item.rare);
     this.check = check;
 }
Exemplo n.º 2
0
 public override void ModifyTooltips(List <TooltipLine> tooltips)
 {
     for (int k = 0; k < items.Count; k++)
     {
         var a = new TooltipLine(mod, "test", items[k].Name);
         a.overrideColor = ItemRarity.GetColor(items[k].rare);
         tooltips.Add(a);
     }
 }
Exemplo n.º 3
0
        public void DrawCardInfo(Item item, SpriteBatch spriteBatch, Rectangle rect, string text)
        {
            if (item == null || item.type < ItemID.None)
            {
                return;
            }

            List <List <TextSnippet> > list = Utils.WordwrapStringSmart(text, Color.White, Main.fontMouseText, (int)(rect.Width * 1.22f), fontScale);

            foreach (var elem in list[0])
            {
                elem.Color = ItemRarity.GetColor(item.rare);
            }

            int offsetY = FontOffsetY;

            scrollMax = (list.Count - 1) * offsetY;
            Color backgroundColor = new Color(25, 25, 45, 160) * 0.75f;

            Rectangle nameRectangle    = new Rectangle(rect.X - 2, rect.Y - 2, rect.Width + 4, offsetY + 4);
            Rectangle tooltipRectangle = new Rectangle(nameRectangle.X, nameRectangle.Y + offsetY + 6, nameRectangle.Width + 1, rect.Height + 4 - offsetY - 6);

            // Card Name
            {
                spriteBatch.Draw(Main.magicPixel, nameRectangle, backgroundColor);
                ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, list[0].ToArray(), new Vector2(nameRectangle.X + 4, nameRectangle.Y + 6), 0f, Vector2.Zero, Vector2.One * (fontScale / 10f), out _, -1f, 2f);
            }

            Rectangle    oldScissorRectangle = spriteBatch.GraphicsDevice.ScissorRectangle;
            SamplerState anisotropicClamp    = SamplerState.AnisotropicClamp;

            spriteBatch.End();
            spriteBatch.GraphicsDevice.ScissorRectangle = Rectangle.Intersect(GetClippingRectangle(tooltipRectangle, spriteBatch), spriteBatch.GraphicsDevice.ScissorRectangle);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, anisotropicClamp, DepthStencilState.None, rasterizerState, null, Main.UIScaleMatrix);

            // Info
            {
                spriteBatch.Draw(Main.magicPixel, tooltipRectangle, backgroundColor);
                for (int i = 0; i < list.Count - 1; i++)
                {
                    Vector2 drawPosition = new Vector2(tooltipRectangle.X + 4, (float)(tooltipRectangle.Y + offsetY * i - scrollValue) + 4);
                    ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, list[i + 1].ToArray(), drawPosition, 0f, Vector2.Zero, Vector2.One * (fontScale / 10f), out _, -1f, 2f);
                }
            }

            spriteBatch.End();
            spriteBatch.GraphicsDevice.ScissorRectangle = oldScissorRectangle;
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, anisotropicClamp, DepthStencilState.None, spriteBatch.GraphicsDevice.RasterizerState, null, Main.UIScaleMatrix);
        }
Exemplo n.º 4
0
        public void Display(Item type, string text, Color textColor)
        {
            visible = true;

            titleText.SetText(text);
            titleText.TextColor = textColor;

            fakeInv[10] = type;
            itemText.SetText(type.IsAir ? "Not set" : fakeInv[10].Name);
            itemText.TextColor = type.IsAir ? Color.Red : ItemRarity.GetColor(fakeInv[10].rare);
            panel.Width.Pixels = itemText.MinWidth.Pixels + Main.inventoryBackTexture.Width * 0.5f * Main.UIScale + 20;

            Left.Pixels = Main.mouseX + 10;
            Top.Pixels  = Main.mouseY + 10;

            Recalculate();
        }
Exemplo n.º 5
0
        public void Display(Item type, string text, Color textColor)
        {
            visible = true;

            titleText.SetText(text);
            titleText.TextColor = textColor;

            fakeInv[10] = type;
            itemText.SetText(type.IsAir ? Language.GetTextValue(NotSetTextKey) : fakeInv[10].Name);
            itemText.TextColor = type.IsAir ? Color.Red : ItemRarity.GetColor(fakeInv[10].rare);
            panel.Width.Pixels = itemText.MinWidth.Pixels + Main.inventoryBackTexture.Width * 0.5f * Main.UIScale + 20;

            Vector2 pos = Vector2.Transform(Main.MouseScreen, Main.GameViewMatrix.TransformationMatrix);

            Left.Pixels = (pos.X + 10) / Main.UIScale;
            Top.Pixels  = (pos.Y + 10) / Main.UIScale;

            Recalculate();
        }
Exemplo n.º 6
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            if (storedArmor[0] is null || storedArmor[1] is null || storedArmor[2] is null)
            {
                return;
            }

            TooltipLine armorLineHead = new TooltipLine(mod, "HelmetSlot",
                                                        (storedArmor[0].IsAir) ? "No helmet" : storedArmor[0].Name)
            {
                overrideColor = (storedArmor[0].IsAir) ? new Color(150, 150, 150) : ItemRarity.GetColor(storedArmor[0].rare)
            };

            tooltips.Add(armorLineHead);

            TooltipLine armorLineChest = new TooltipLine(mod, "ChestSlot",
                                                         (storedArmor[1].IsAir) ? "No chestplate" : storedArmor[1].Name)
            {
                overrideColor = (storedArmor[1].IsAir) ? new Color(150, 150, 150) : ItemRarity.GetColor(storedArmor[1].rare)
            };

            tooltips.Add(armorLineChest);

            TooltipLine armorLineLegs = new TooltipLine(mod, "LegsSlot",
                                                        (storedArmor[2].IsAir) ? "No leggings" : storedArmor[2].Name)
            {
                overrideColor = (storedArmor[2].IsAir) ? new Color(150, 150, 150) : ItemRarity.GetColor(storedArmor[2].rare)
            };

            tooltips.Add(armorLineLegs);

            TooltipLine line = new TooltipLine(mod, "Starlight",
                                               "Right click to equip stored armor\n" +
                                               "Right click with armor to add it to the bag\n" +
                                               "Shift-Right click to empty the bag");

            tooltips.Add(line);
        }
Exemplo n.º 7
0
        public static string GetDisplayName(this ItemRarity rarity, bool inColor)
        {
            string output;

            switch (rarity)
            {
            case ItemRarity.UltraRare:
                output = "Ultra Rare";
                break;

            default:
                output = rarity.ToString();
                break;
            }

            if (!inColor)
            {
                return(output);
            }
            else
            {
                return(output.InColor(rarity.GetColor() * 5f));
            }
        }
Exemplo n.º 8
0
 public ItemSnippet(Item item)
 {
     _item = item;
     Color = ItemRarity.GetColor(item.rare);
 }
Exemplo n.º 9
0
 public ItemSnippet(Item item)
     : base("")
 {
     this._item = item;
     this.Color = ItemRarity.GetColor(item.rare);
 }
Exemplo n.º 10
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            Texture2D tex = GetTexture("StarlightRiver/Assets/GUI/LootSlotOn");

            Utils.DrawBorderStringBig(spriteBatch, Quotes[QuoteID], GetDimensions().Center() + new Vector2(0, -80) - 2.2f * Main.fontItemStack.MeasureString(Quotes[QuoteID]) / 2, Color.White, 0.75f);

            string str  = "You get:";
            string str2 = "Pick two:";

            Utils.DrawBorderString(spriteBatch, str, GetDimensions().Center() + new Vector2(0, -40) - Main.fontItemStack.MeasureString(str) / 2, Color.White, 0.8f);
            Utils.DrawBorderString(spriteBatch, str2, GetDimensions().Center() + new Vector2(0, +50) - Main.fontItemStack.MeasureString(str2) / 2, Color.White, 0.8f);

            spriteBatch.Draw(tex, GetDimensions().Center(), tex.Frame(), Color.White * 0.75f, 0, tex.Size() / 2, 1, 0, 0);

            if (!BigItem.IsAir)
            {
                Texture2D tex2  = BigItem.type > ItemID.Count ? GetTexture(BigItem.modItem.Texture) : GetTexture("Terraria/Item_" + BigItem.type);
                float     scale = tex2.Frame().Size().Length() < 52 ? 1 : 52f / tex2.Frame().Size().Length();

                spriteBatch.Draw(tex2, GetDimensions().Center(), tex2.Frame(), Color.White, 0, tex2.Frame().Size() / 2, scale, 0, 0);

                if (BigItem.stack > 1)
                {
                    spriteBatch.DrawString(Main.fontItemStack, BigItem.stack.ToString(), GetDimensions().Position() + Vector2.One * 28, Color.White);
                }
            }

            Rectangle rect = new Rectangle(Main.screenWidth / 2 - 28, Main.screenHeight / 2 - 28, 56, 56);

            if (rect.Contains(Main.MouseScreen.ToPoint()))
            {
                float   offY = 40 - BigItem.ToolTip.Lines * 14;
                Vector2 pos  = new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) + new Vector2(60, offY);

                for (int k = 0; k <= BigItem.ToolTip.Lines; k++)
                {
                    if (k == 0)
                    {
                        Utils.DrawBorderString(spriteBatch, BigItem.Name, pos + new Vector2(0, k * 14), ItemRarity.GetColor(BigItem.rare), 0.75f);
                    }
                    else
                    {
                        Utils.DrawBorderString(spriteBatch, BigItem.ToolTip.GetLine(k - 1), pos + new Vector2(0, k * 14), Color.White, 0.75f);
                    }
                }
            }

            base.Draw(spriteBatch);
            Recalculate();
        }
Exemplo n.º 11
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (IsMouseHovering)
            {
                Main.LocalPlayer.mouseInterface = true;
            }

            if (Parent is LootUI)
            {
                LootUI    parent  = Parent as LootUI;
                Texture2D tex     = parent.Selections.Any(n => n == Item) ? GetTexture("StarlightRiver/Assets/GUI/LootSlotOn") : GetTexture("StarlightRiver/Assets/GUI/LootSlot");
                float     opacity = IsMouseHovering ? 1 : 0.6f;

                spriteBatch.Draw(tex, GetDimensions().Position(), tex.Frame(), Color.White * opacity, 0, Vector2.Zero, 1, 0, 0);
                if (!Item.IsAir)
                {
                    Texture2D tex2  = Item.type > ItemID.Count ? GetTexture(Item.modItem.Texture) : GetTexture("Terraria/Item_" + Item.type);
                    float     scale = tex2.Frame().Size().Length() < 52 ? 1 : 52f / tex2.Frame().Size().Length();

                    spriteBatch.Draw(tex2, GetDimensions().Center(), tex2.Frame(), Color.White, 0, tex2.Frame().Size() / 2, 1, 0, 0);
                    if (Item.stack > 1)
                    {
                        Utils.DrawBorderString(spriteBatch, Item.stack.ToString(), GetDimensions().Position() + Vector2.One * 36, Color.White, 0.75f);
                    }
                }
                if (IsMouseHovering)
                {
                    float   offY = 40 - Item.ToolTip.Lines * 14;
                    Vector2 pos  = new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) + new Vector2(60, offY);
                    for (int k = 0; k <= Item.ToolTip.Lines; k++)
                    {
                        if (k == 0)
                        {
                            Utils.DrawBorderString(spriteBatch, Item.Name, pos + new Vector2(0, k * 14), ItemRarity.GetColor(Item.rare), 0.75f);
                        }
                        else
                        {
                            Utils.DrawBorderString(spriteBatch, Item.ToolTip.GetLine(k - 1), pos + new Vector2(0, k * 14), Color.White, 0.75f);
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            Texture2D      tex = Main.inventoryBackTexture;
            AbilityHandler mp  = Main.LocalPlayer.GetModPlayer <AbilityHandler>();

            Equipped = (TargetSlot == 0) ? mp.slot1 : mp.slot2;

            //Draws the slot
            spriteBatch.Draw(tex, GetDimensions().ToRectangle(), new Rectangle(0, 0, (int)tex.Size().X, (int)tex.Size().Y), Color.White * 0.75f);
            if (Equipped != null)
            {
                //Draws the item itself
                Texture2D tex2 = ModContent.GetTexture(Equipped.modItem.Texture);
                spriteBatch.Draw(tex2, GetDimensions().Center(), tex2.Frame(), Color.White, 0f, tex2.Frame().Center(), 0.8f, SpriteEffects.None, 0);
                if (IsMouseHovering && Main.mouseItem.IsAir)
                {
                    //Grabs the items tooltip
                    string ToolTip = "";
                    for (int k = 0; k < Equipped.ToolTip.Lines; k++)
                    {
                        ToolTip += Equipped.ToolTip.GetLine(k);
                        ToolTip += "\n";
                    }

                    //Draws the name and tooltip at the mouse
                    Utils.DrawBorderStringBig(spriteBatch, Equipped.Name, Main.MouseScreen + new Vector2(22, 22), ItemRarity.GetColor(Equipped.rare).MultiplyRGB(Main.mouseTextColorReal), 0.39f);
                    Utils.DrawBorderStringBig(spriteBatch, ToolTip, Main.MouseScreen + new Vector2(22, 48), Main.mouseTextColorReal, 0.39f);
                }
            }
        }
Exemplo n.º 13
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            Texture2D tex = Main.inventoryBackTexture;

            //Draws the slot
            spriteBatch.Draw(tex, GetDimensions().ToRectangle(), new Rectangle(0, 0, (int)tex.Size().X, (int)tex.Size().Y), Color.White * 0.75f);

            if (item != null)
            {
                //Draws the item itself
                Texture2D tex2 = (item.modItem != null) ? ModContent.GetTexture(item.modItem.Texture) : ModContent.GetTexture("Terraria/Item_" + item.type);
                spriteBatch.Draw(tex2, GetDimensions().Center(), tex2.Frame(), Color.White, 0f, tex2.Frame().Center(), 0.8f, 0, 0);

                if (IsMouseHovering && Main.mouseItem.IsAir)
                {
                    //Grabs the items tooltip
                    string ToolTip = "";
                    for (int k = 0; k < item.ToolTip.Lines; k++)
                    {
                        ToolTip += item.ToolTip.GetLine(k);
                        ToolTip += "\n";
                    }

                    //Draws the name and tooltip at the mouse
                    Utils.DrawBorderStringBig(spriteBatch, item.Name, Main.MouseScreen + new Vector2(22, 22), ItemRarity.GetColor(item.rare).MultiplyRGB(Main.mouseTextColorReal), 0.39f);
                    Utils.DrawBorderStringBig(spriteBatch, ToolTip, Main.MouseScreen + new Vector2(22, 48), Main.mouseTextColorReal, 0.39f);
                }
            }
        }