private void ManaFruitUI(On.Terraria.Main.orig_DrawInterface_Resources_Mana orig) { Player player = Main.player[Main.myPlayer]; int fruits = player.GetModPlayer <RTerrariaPlayer>().manaFruits; int UIDisplay_ManaPerStar; if (fruits < 10) { UIDisplay_ManaPerStar = 20 + fruits; } else { UIDisplay_ManaPerStar = player.statManaMax2 / 10; } if (player.ghost || player.statManaMax2 <= 0) { return; } Vector2 vector = Main.fontMouseText.MeasureString(Language.GetTextValue("LegacyInterface.2")); int num = 50; if (vector.X >= 45f) { num = (int)vector.X + 5; } spriteBatch.DrawString(Main.fontMouseText, Language.GetTextValue("LegacyInterface.2"), new Vector2(800 - num + UI_ScreenAnchorX, 6f), new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), 0f, default, 1f, SpriteEffects.None, 0f);
private void DrawRottenMana(On.Terraria.Main.orig_DrawInterface_Resources_Mana orig) { orig(); Player player = Main.LocalPlayer; if (player.armor[0].type != ItemType <PoltergeistHead>()) { return; } var helm = player.armor[0].modItem as PoltergeistHead; for (int i = 1; i < player.statManaMax2 / 20 + 1; i++) //iterate each mana star { int manaDrawn = i * 20; //the amount of mana drawn by this star and all before it float starHeight = MathHelper.Clamp(((Main.player[Main.myPlayer].statMana - (i - 1) * 20) / 20f) / 4f + 0.75f, 0.75f, 1); //height of the current star based on current mana if (player.statMana <= i * 20 && player.statMana >= (i - 1) * 20) //pulsing star for the "current" star { starHeight += Main.cursorScale - 1; } var rottenManaAmount = player.statManaMax2 - helm.manaRestrictFade; //amount of mana to draw as rotten if (rottenManaAmount < manaDrawn) { if (manaDrawn - rottenManaAmount < 20) { var tex1 = GetTexture(AssetDirectory.GravediggerItem + "RottenMana"); var pos1 = new Vector2(Main.screenWidth - 25, (30 + Main.manaTexture.Height / 2f) + (Main.manaTexture.Height - Main.manaTexture.Height * starHeight) / 2f + (28 * (i - 1))); int off = (int)(rottenManaAmount % 20 / 20f * tex1.Height); var source = new Rectangle(0, off, tex1.Width, tex1.Height - off); pos1.Y += off; Main.spriteBatch.Draw(tex1, pos1, source, Color.White, 0f, tex1.Size() / 2, starHeight, 0, 0); continue; } var tex = GetTexture(AssetDirectory.GravediggerItem + "RottenMana"); var pos = new Vector2(Main.screenWidth - 25, (30 + Main.manaTexture.Height / 2f) + (Main.manaTexture.Height - Main.manaTexture.Height * starHeight) / 2f + (28 * (i - 1))); Main.spriteBatch.Draw(tex, pos, null, Color.White, 0f, tex.Size() / 2, starHeight, 0, 0); } } }
private void DrawRottenMana(On.Terraria.Main.orig_DrawInterface_Resources_Mana orig) { orig(); Player player = Main.LocalPlayer; if (player.HeldItem.type != ModContent.ItemType <Sorcerwrench>()) { return; } var item = player.HeldItem.modItem as Sorcerwrench; if (item.proj == null || !item.proj.active) { return; } var projectile = item.proj.modProjectile as SorcerwrenchProjectile; if (projectile == null) { return; } if (projectile.released) { return; } int manaMissing = (player.statManaMax2 - player.statMana) / 20; for (int i = 1; i < player.statManaMax2 / 20 + 1; i++) //iterate each mana star { int manaDrawn = i * 20; //the amount of mana drawn by this star and all before it float starHeight = MathHelper.Clamp(((Main.player[Main.myPlayer].statMana - (i - 1) * 20) / 20f) / 4f + 0.75f, 0.75f, 1); //height of the current star based on current mana if (player.statMana <= i * 20 && player.statMana >= (i - 1) * 20) //pulsing star for the "current" star { starHeight += Main.cursorScale - 1; } var rottenManaAmount = player.statManaMax2 - projectile.manaUsed; //amount of mana to draw as rotten if (rottenManaAmount < manaDrawn + manaMissing && i < (player.statManaMax2 / 20 + 1) - manaMissing) { if (manaDrawn - rottenManaAmount < 20) { var tex1 = GetTexture(AssetDirectory.GravediggerItem + "RottenMana"); var pos1 = new Vector2(Main.screenWidth - 25, (30 + Main.manaTexture.Height / 2f) + (Main.manaTexture.Height - Main.manaTexture.Height * starHeight) / 2f + (28 * (i - 1))); int off = (int)(rottenManaAmount % 20 / 20f * tex1.Height); var source = new Rectangle(0, off, tex1.Width, tex1.Height - off); pos1.Y += off; Main.spriteBatch.Draw(tex1, pos1, source, Color.White, 0f, tex1.Size() / 2, starHeight, 0, 0); continue; } var tex = GetTexture(AssetDirectory.GravediggerItem + "RottenMana"); var pos = new Vector2(Main.screenWidth - 25, (30 + Main.manaTexture.Height / 2f) + (Main.manaTexture.Height - Main.manaTexture.Height * starHeight) / 2f + (28 * (i - 1))); Main.spriteBatch.Draw(tex, pos, null, Color.White, 0f, tex.Size() / 2, starHeight, 0, 0); } } }
private void NewDrawMana(On.Terraria.Main.orig_DrawInterface_Resources_Mana orig) { if (Terraria.Main.player[Terraria.Main.myPlayer].statManaMax2 / 10 >= 20) { UIDisplay_ManaPerStar = Terraria.Main.player[Terraria.Main.myPlayer].statManaMax2 / 10; } else { UIDisplay_ManaPerStar = 20; } if (Terraria.Main.LocalPlayer.ghost || Terraria.Main.player[Terraria.Main.myPlayer].statManaMax2 <= 0) { return; } int num18 = Terraria.Main.player[Terraria.Main.myPlayer].statManaMax / 20; int num17 = Terraria.Main.player[Terraria.Main.myPlayer].GetModPlayer <TemperatePlayer>().ArcaneCrystals; if (num17 < 0) { num17 = 0; } if (num17 > 0) { num18 = Terraria.Main.player[Terraria.Main.myPlayer].statManaMax / (20 + num17 / 2); } _ = Terraria.Main.player[Terraria.Main.myPlayer].statManaMax2 / 20; Microsoft.Xna.Framework.Vector2 vector = Terraria.Main.fontMouseText.MeasureString(Terraria.Lang.inter[2].Value); int num8 = 50; if (vector.X >= 45f) { num8 = (int)vector.X + 5; } DynamicSpriteFontExtensionMethods.DrawString(Terraria.Main.spriteBatch, Terraria.Main.fontMouseText, Terraria.Lang.inter[2].Value, new Microsoft.Xna.Framework.Vector2(800 - num8 + UI_ScreenAnchorX, 6f), new Microsoft.Xna.Framework.Color(Terraria.Main.mouseTextColor, Terraria.Main.mouseTextColor, Terraria.Main.mouseTextColor, Terraria.Main.mouseTextColor), 0f, default(Microsoft.Xna.Framework.Vector2), 1f, SpriteEffects.None, 0f); if (UIDisplay_ManaPerStar <= 20) { for (int i = 1; i < Terraria.Main.player[Terraria.Main.myPlayer].statManaMax2 / UIDisplay_ManaPerStar + 1; i++) { int num7 = 255; bool flag = false; float num6 = 1f; if (Terraria.Main.player[Terraria.Main.myPlayer].statMana >= i * UIDisplay_ManaPerStar) { num7 = 255; if (Terraria.Main.player[Terraria.Main.myPlayer].statMana == i * UIDisplay_ManaPerStar) { flag = true; } } else { float num4 = (float)(Terraria.Main.player[Terraria.Main.myPlayer].statMana - (i - 1) * UIDisplay_ManaPerStar) / (float)UIDisplay_ManaPerStar; num7 = (int)(30f + 225f * num4); if (num7 < 30) { num7 = 30; } num6 = num4 / 4f + 0.75f; if ((double)num6 < 0.75) { num6 = 0.75f; } if (num4 > 0f) { flag = true; } } if (flag) { num6 += Terraria.Main.cursorScale - 1f; } int a = (int)((double)(float)num7 * 0.9); if (!Terraria.Main.player[Terraria.Main.myPlayer].ghost) { if (num17 > 0) { num17--; Terraria.Main.spriteBatch.Draw(GetTexture("Items/Consumables/Special/ArcaneOverlay"), new Microsoft.Xna.Framework.Vector2(775 + UI_ScreenAnchorX, (float)(30 + Terraria.Main.manaTexture.Height / 2) + ((float)Terraria.Main.manaTexture.Height - (float)Terraria.Main.manaTexture.Height * num6) / 2f + (float)(28 * (i - 1))), new Microsoft.Xna.Framework.Rectangle(0, 0, Terraria.Main.manaTexture.Width, Terraria.Main.manaTexture.Height), new Microsoft.Xna.Framework.Color(num7, num7, num7, a), 0f, new Vector2(Terraria.Main.manaTexture.Width / 2, Terraria.Main.manaTexture.Height / 2), num6, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f); } else { Terraria.Main.spriteBatch.Draw(Terraria.Main.manaTexture, new Microsoft.Xna.Framework.Vector2(775 + UI_ScreenAnchorX, (float)(30 + Terraria.Main.manaTexture.Height / 2) + ((float)Terraria.Main.manaTexture.Height - (float)Terraria.Main.manaTexture.Height * num6) / 2f + (float)(28 * (i - 1))), new Microsoft.Xna.Framework.Rectangle(0, 0, Terraria.Main.manaTexture.Width, Terraria.Main.manaTexture.Height), new Microsoft.Xna.Framework.Color(num7, num7, num7, a), 0f, new Vector2(Terraria.Main.manaTexture.Width / 2, Terraria.Main.manaTexture.Height / 2), num6, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f); } } } } else if (UIDisplay_ManaPerStar > 20) { for (int i = 1; i < Terraria.Main.player[Terraria.Main.myPlayer].statManaMax2 / UIDisplay_ManaPerStar + 1; i++) { int num7 = 255; bool flag = false; float num6 = 1f; if (Terraria.Main.player[Terraria.Main.myPlayer].statMana >= i * UIDisplay_ManaPerStar) { num7 = 255; if (Terraria.Main.player[Terraria.Main.myPlayer].statMana == i * UIDisplay_ManaPerStar) { flag = true; } } else { float num4 = (float)(Terraria.Main.player[Terraria.Main.myPlayer].statMana - (i - 1) * UIDisplay_ManaPerStar) / (float)UIDisplay_ManaPerStar; num7 = (int)(30f + 225f * num4); if (num7 < 30) { num7 = 30; } num6 = num4 / 4f + 0.75f; if ((double)num6 < 0.75) { num6 = 0.75f; } if (num4 > 0f) { flag = true; } } if (flag) { num6 += Terraria.Main.cursorScale - 1f; } int a = (int)((double)(float)num7 * 0.9); if (!Terraria.Main.player[Terraria.Main.myPlayer].ghost) { if (num17 > 0) { num17--; Terraria.Main.spriteBatch.Draw(GetTexture("Items/Consumables/Special/ArcaneOverlay"), new Microsoft.Xna.Framework.Vector2(775 + UI_ScreenAnchorX, (float)(30 + Terraria.Main.manaTexture.Height / 2) + ((float)Terraria.Main.manaTexture.Height - (float)Terraria.Main.manaTexture.Height * num6) / 2f + (float)(28 * (i - 1))), new Microsoft.Xna.Framework.Rectangle(0, 0, Terraria.Main.manaTexture.Width, Terraria.Main.manaTexture.Height), new Microsoft.Xna.Framework.Color(num7, num7, num7, a), 0f, new Vector2(Terraria.Main.manaTexture.Width / 2, Terraria.Main.manaTexture.Height / 2), num6, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f); } else { Terraria.Main.spriteBatch.Draw(Terraria.Main.manaTexture, new Microsoft.Xna.Framework.Vector2(775 + UI_ScreenAnchorX, (float)(30 + Terraria.Main.manaTexture.Height / 2) + ((float)Terraria.Main.manaTexture.Height - (float)Terraria.Main.manaTexture.Height * num6) / 2f + (float)(28 * (i - 1))), new Microsoft.Xna.Framework.Rectangle(0, 0, Terraria.Main.manaTexture.Width, Terraria.Main.manaTexture.Height), new Microsoft.Xna.Framework.Color(num7, num7, num7, a), 0f, new Vector2(Terraria.Main.manaTexture.Width / 2, Terraria.Main.manaTexture.Height / 2), num6, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f); } } } } }