Exemple #1
0
        public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
        {
            PartType partType = GHelper.GetPartType(partKey);

            item.height = ModContent.GetTexture(partType.invTexture).Height;
            item.width  = ModContent.GetTexture(partType.invTexture).Width;
            item.SetNameOverride(GHelper.GetPartName(partKey));
            return(false);
        }
Exemple #2
0
        public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
        {
            PartType pType = GHelper.GetPartType(partKey);

            item.height = ModContent.GetTexture(pType.invTexture).Height;
            item.width  = ModContent.GetTexture(pType.invTexture).Width;
            item.SetNameOverride(GHelper.GetPartName(partKey));
            return(false);
        }
Exemple #3
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            foreach (TooltipLine line in tooltips)
            {
                if (line.Name == "ItemName" && line.mod == "Terraria")
                {
                    line.text = GHelper.GetPartName(partKey);
                }
            }
            string effectsText = "";
            Dictionary <string, int> effects = GHelper.GetPartType(partKey).effects;

            foreach (KeyValuePair <string, int> pair in effects)
            {
                EffectType effectType = GHelper.GetEffectType(pair.Key);
                if (effectsText != "")
                {
                    effectsText += "\n";
                }
                effectsText += $"{effectType.name}";
                if (effectType.showLevel)
                {
                    effectsText += $" Level {pair.Value}";
                }
                if (Main.keyState.PressingShift())
                {
                    effectsText += $": {effectType.desc}";
                }
            }
            tooltips.Add(new TooltipLine(mod, "TerrariaConstruct:EffectsLine", effectsText));

            if (!Main.keyState.PressingShift() && effects.Count > 0)
            {
                tooltips.Add(new TooltipLine(mod, "TerrariaConstruct:ShiftMessageLine", "Press Shift to see descriptions!"));
            }

            if (GHelper.GetPartType(partKey) == PartData.UnknownPart)
            {
                TooltipLine line = new TooltipLine(mod, "TerrariaConstruct:BrokenPartLine", "This part is broken! Did you disable a mod since you last played?");
                tooltips.Add(line);
            }
        }