Example #1
0
    public static void PostUpdate()
    {
        int xx = 4;

        List <ModWorld.NPCInst> list = ModWorld.GetActualNPCs();

        foreach (ModWorld.NPCInst npci in list)
        {
            if (!ModWorld.IsBoss(npci))
            {
                continue;
            }
            var gd = Config.mainInstance.graphics.GraphicsDevice;

            Player p = Main.player[Main.myPlayer];
            if (Vector2.Distance(p.position + new Vector2(p.width / 2f, p.height / 2f), npci.GetCenterPos()) > 2 * Math.Sqrt(Math.Pow(Main.screenWidth, 2) + Math.Pow(Main.screenHeight, 2)))
            {
                continue;
            }

            gd.SetRenderTarget(rt);

            float hpPercent = 1f * npci.GetLife() / npci.GetLifeMax();
            int   phase     = -1;

            Object[] ret = new Object[] { null, null };
            if (Codable.RunGlobalMethod("ModWorld", "ExternalGetBossPhase", npci.parts, npci.GetName(), npci.GetCenterPos(), npci.GetLife(), npci.GetLifeMax(), ret))
            {
                if (ret[0] != null && ret[1] != null)
                {
                    phase     = (int)ret[0];
                    hpPercent = (float)ret[1];
                }
            }
            int angle = (int)(hpPercent * 270);

            sb.Begin(SpriteSortMode.Immediate, bs1, null, dss1, null);
            gd.Clear(ClearOptions.Target | ClearOptions.Stencil, Color.Transparent, 0, 0);
            VertexPositionColorTexture[] pointList = new VertexPositionColorTexture[Math.Max(angle / 2 + 1, 3)];
            pointList[0] = new VertexPositionColorTexture(new Vector3(48, 48, 0), Color.White, default(Vector2));
            for (int i = 1; i <= 2; i++)
            {
                pointList[pointList.Length - i] = new VertexPositionColorTexture(new Vector3(48 + LdirX(48, 270), 48 + LdirY(48, 270), 0), Color.White, default(Vector2));
            }
            for (int i = 0; i < angle / 2; i++)
            {
                pointList[i + 1] = new VertexPositionColorTexture(new Vector3(48 + LdirX(48, 270 - i * 2), 48 + LdirY(48, 270 - i * 2), 0), Color.White, default(Vector2));
            }
            new ModWorld.PolygonShape(Config.mainInstance.graphics.GraphicsDevice, pointList).Draw();;
            sb.End();

            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, dss2, null);
            sb.Draw(phase == -1 ? ModWorld.texTop : ModWorld.texPhase[phase], default(Vector2), Color.White);
            sb.End();
            gd.SetRenderTarget(null);

            string s = "" + npci.GetLife() + "/" + npci.GetLifeMax();
            xx += (int)(Math.Max(Main.fontMouseText.MeasureString(s).X, Main.fontMouseText.MeasureString(npci.GetName()).X) + 68);
        }
    }
Example #2
0
    public void DrawOnScreen(SpriteBatch sb, double layer)
    {
        int xx = 200, yy = Main.screenHeight - 32, ww = Main.screenWidth - 2 * xx, hh = 32;

        List <ModWorld.NPCInst> list = ModWorld.GetActualNPCs();

        foreach (ModWorld.NPCInst npci in list)
        {
            if (!ModWorld.IsBoss(npci))
            {
                continue;
            }

            Player p = Main.player[Main.myPlayer];
            if (Vector2.Distance(p.position + new Vector2(p.width / 2f, p.height / 2f), npci.GetCenterPos()) > 2 * Math.Sqrt(Math.Pow(Main.screenWidth, 2) + Math.Pow(Main.screenHeight, 2)))
            {
                continue;
            }

            sb.Draw(ModWorld.texBack, new Rectangle(xx, yy + 4, ww, hh - 8), Color.White);
            sb.Draw(ModWorld.texWhite, new Rectangle(xx + 2, yy + 6, ww - 4, hh - 12), Color.Black);

            int      phase   = 0;
            float    percent = 1f * npci.GetLife() / npci.GetLifeMax();
            Object[] ret     = new Object[] { null, null };
            if (Codable.RunGlobalMethod("ModWorld", "ExternalGetBossPhase", npci.parts, npci.GetName(), npci.GetCenterPos(), npci.GetLife(), npci.GetLifeMax(), ret))
            {
                if (ret[0] != null && ret[1] != null)
                {
                    phase   = (int)ret[0];
                    percent = (float)ret[1];
                }
            }
            if (phase > 0)
            {
                sb.Draw(ModWorld.texPhase[phase - 1], new Rectangle(xx + 2, yy + 6, (int)(1f * (ww - 4)), hh - 12), Color.White);
            }
            sb.Draw(ModWorld.texPhase[phase], new Rectangle(xx + 2, yy + 6, (int)((percent) * (ww - 4)), hh - 12), Color.White);

            DrawStringShadowed(sb, Main.fontMouseText, npci.GetName(), new Vector2(xx + 4, yy + 4), Color.White, Color.Black);
            string s = "" + npci.GetLife() + "/" + npci.GetLifeMax();
            DrawStringShadowed(sb, Main.fontMouseText, s, new Vector2(xx + ww - 4 - Main.fontMouseText.MeasureString(s).X, yy + 4), Color.White, Color.Black);

            yy -= hh;
        }
    }
Example #3
0
    public void DrawOnScreen(SpriteBatch sb, double layer)
    {
        int xx = 4, yy = Main.screenHeight - 100;

        List <ModWorld.NPCInst> list = ModWorld.GetActualNPCs();

        foreach (ModWorld.NPCInst npci in list)
        {
            if (!ModWorld.IsBoss(npci))
            {
                continue;
            }

            Player p = Main.player[Main.myPlayer];
            if (Vector2.Distance(p.position + new Vector2(p.width / 2f, p.height / 2f), npci.GetCenterPos()) > 2 * Math.Sqrt(Math.Pow(Main.screenWidth, 2) + Math.Pow(Main.screenHeight, 2)))
            {
                continue;
            }

            sb.Draw(ModWorld.texBack, new Vector2(xx, yy), Color.White);

            int      phase = -1;
            Object[] ret   = new Object[] { null, null };
            if (Codable.RunGlobalMethod("ModWorld", "ExternalGetBossPhase", npci.parts, npci.GetName(), npci.GetCenterPos(), npci.GetLife(), npci.GetLifeMax(), ret))
            {
                if (ret[0] != null && ret[1] != null)
                {
                    phase = (int)ret[0];
                }
            }
            if (phase > 0)
            {
                sb.Draw(ModWorld.texPhase[phase - 1], new Vector2(xx, yy), Color.White);
            }

            sb.Draw((Texture2D)rt, new Vector2(xx, yy), Color.White);
            string s = "" + npci.GetLife() + "/" + npci.GetLifeMax();
            DrawStringShadowed(sb, Main.fontMouseText, s, new Vector2(xx + 52, yy + 52), Color.White, Color.Black);
            DrawStringShadowed(sb, Main.fontMouseText, npci.GetName(), new Vector2(xx + 52, yy + 72), Color.White, Color.Black);

            xx += (int)(Math.Max(Main.fontMouseText.MeasureString(s).X, Main.fontMouseText.MeasureString(npci.GetName()).X) + 68);
        }
    }
Example #4
0
    public void DrawOnScreen(SpriteBatch sb, double layer)
    {
        Player player = Main.player[Main.myPlayer];

        if (resetChat)
        {
            Main.chatMode = false;
        }
        resetChat = false;

        if (!Settings.GetBool("toggle") && Main.playerInventory && !Main.craftingHide && (!Codable.RunGlobalMethod("ModWorld", "PreDrawAvailableRecipes", sb) || (bool)Codable.customMethodReturn))
        {
            if (Main.reforge || player.chest != -1 || Main.npcShop != 0 || player.talkNPC != -1 || Main.craftGuide || Main.ForceGuideMenu)
            {
                return;
            }
            if (Config.tileInterface == null && Config.npcInterface == null)
            {
                if (shouldInit)
                {
                    GuiCraft.Init();
                    shouldInit = false;
                }
                GuiCraft.Create();
            }
        }

        if (Config.tileInterface != null && Config.tileInterface.code is GuiCraft)
        {
            Config.tileInterface.SetLocation(new Vector2(player.position.X / 16f, player.position.Y / 16f));
            ((GuiCraft)Config.tileInterface.code).PreDrawInterface(sb);
        }

        if (Main.playerInventory && Settings.GetBool("toggle") && (Config.tileInterface == null || Config.tileInterface.code is GuiCraft))
        {
            Color c = Config.tileInterface != null && Config.tileInterface.code is ModWorld.GuiCraft ? Color.White : Color.Gray;
            sb.Draw(ModWorld.texShow, new Vector2(414, 210), GetTexRectangle(texShow), c, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
        }
    }
Example #5
0
    public override void PostDraw(SpriteBatch sb)
    {
        Vector2 v;

        if (!Main.mouseLeft)
        {
            blockChange = false;
        }
        if (clockDragAngle >= 0)
        {
            Main.player[Main.myPlayer].mouseInterface = true;
        }
        bool oldBlockChange = blockChange;

        stateOld = state;
        state    = Microsoft.Xna.Framework.Input.Mouse.GetState();

        v = new Vector2(xo, yo) + new Vector2(texClock.Width / 2, texClock.Height / 2);
        if (ModWorld.MouseRegionCircle(v, texClock.Width / 2))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            if (stateOld.HasValue && state.HasValue)
            {
                int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;

                Main.time -= 3600 * mouseScrollDiff;
                while (Main.time < 0 || Main.time > (Main.dayTime ? 54000 : 86400 - 54000))
                {
                    if (Main.time < 0)
                    {
                        Main.time += Main.dayTime ? 86400 - 54000 : 54000;
                        if (Main.dayTime)
                        {
                            Main.moonPhase--;
                        }
                        if (Main.moonPhase < 0)
                        {
                            Main.moonPhase += moonPhases.Length;
                        }
                        Main.dayTime = !Main.dayTime;
                    }
                    else
                    {
                        Main.time -= Main.dayTime ? 54000 : 86400 - 54000;
                        if (!Main.dayTime)
                        {
                            Main.moonPhase++;
                            Main.bloodMoon = false;
                        }
                        if (Main.moonPhase >= moonPhases.Length)
                        {
                            Main.moonPhase -= moonPhases.Length;
                        }
                        Main.dayTime = !Main.dayTime;
                    }
                }
                if (mouseScrollDiff != 0)
                {
                    NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_SET_TIME, -1, -1, (int)Main.time, Main.dayTime, (byte)Main.moonPhase, Main.bloodMoon, Main.hardMode, Main.dayRate);
                    CheatNotification.Add(new CheatNotification("time|time", "Time: " + GetTimeText(false), 30));
                }
            }
            if (Main.mouseLeft && Main.mouseLeftRelease && PressStuff())
            {
                clockDragAngle = Util.Direction(v, new Vector2(Main.mouseX, Main.mouseY));
            }
        }

        bool b = false;

        v = new Vector2(xo + texClock.Width, yo);
        if (PostDrawFilter(sb, texNPCBlank2, v + new Vector2(texNPCBlank2.Width * 0, texNPCBlank2.Height * 0), Main.bloodMoon, "Blood Moon: " + (Main.bloodMoon ? "On" : "Off")))
        {
            Main.bloodMoon = !Main.bloodMoon;
            CheatNotification.Add(new CheatNotification("time|bloodmoon", "Blood Moon " + (Main.bloodMoon ? "on" : "off")));
            b = true;
        }
        if (PostDrawFilter(sb, texNPCBlank2, v + new Vector2(texNPCBlank2.Width * 1, texNPCBlank2.Height * 0), Main.hardMode, "Hardmode: " + (Main.hardMode ? "On" : "Off")))
        {
            Main.hardMode = !Main.hardMode;
            CheatNotification.Add(new CheatNotification("time|hardmode", "Hardmode " + (Main.hardMode ? "on" : "off")));
            b = true;
        }
        if (PostDrawFilter(sb, texNPCBlank2, v + new Vector2(texNPCBlank2.Width * 3, texNPCBlank2.Height * 0), ModWorld.enabledNoclip[Main.myPlayer], "Noclip: " + (ModWorld.enabledNoclip[Main.myPlayer] ? "On" : "Off")))
        {
            ModWorld.enabledNoclip[Main.myPlayer] = !ModWorld.enabledNoclip[Main.myPlayer];
            CheatNotification.Add(new CheatNotification("misc|noclip", "Noclip " + (ModWorld.enabledNoclip[Main.myPlayer] ? "on" : "off")));
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_SWITCH_NOCLIP, -1, -1, (byte)Main.myPlayer);
        }
        if (PostDrawFilter(sb, texNPCBlank2, v + new Vector2(texNPCBlank2.Width * 4, texNPCBlank2.Height * 0), ModWorld.enabledGodmode[Main.myPlayer], "Godmode: " + (ModWorld.enabledGodmode[Main.myPlayer] ? "On" : "Off")))
        {
            ModWorld.enabledGodmode[Main.myPlayer] = !ModWorld.enabledGodmode[Main.myPlayer];
            CheatNotification.Add(new CheatNotification("misc|godmode", "Godmode " + (ModWorld.enabledGodmode[Main.myPlayer] ? "on" : "off")));
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_SWITCH_GODMODE, -1, -1, (byte)Main.myPlayer);
        }
        if (PostDrawFilter(sb, texNPCBlank2, v + new Vector2(texNPCBlank2.Width * 5, texNPCBlank2.Height * 0), ModWorld.enabledAllLight, "Lighting Up: " + (ModWorld.enabledAllLight ? "On" : "Off")))
        {
            ModWorld.enabledAllLight = !ModWorld.enabledAllLight;
            CheatNotification.Add(new CheatNotification("misc|alllight", "Lighting Up " + (ModWorld.enabledAllLight ? "on" : "off")));
        }
        for (int i = 0; i < moonPhases.Length; i++)
        {
            if (PostDrawFilter(sb, texNPCBlank2, v + new Vector2(texNPCBlank2.Width * i, texNPCBlank2.Height * 1.5f), Main.moonPhase == i, moonPhases[i] + " Moon"))
            {
                Main.moonPhase = i;
                CheatNotification.Add(new CheatNotification("time|moon", moonPhases[i] + " Moon"));
                b = true;
            }
        }

        if (b)
        {
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_SET_TIME, -1, -1, (int)Main.time, Main.dayTime, (byte)Main.moonPhase, Main.bloodMoon, Main.hardMode, Main.dayRate);
        }

        if (ModWorld.MouseRegion(v + new Vector2(0, texNPCBlank2.Height * 1.5f), new Vector2(texNPCBlank2.Width * moonPhases.Length, texNPCBlank2.Height)))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            if (stateOld.HasValue && state.HasValue)
            {
                int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;
                Main.moonPhase -= mouseScrollDiff;
                while (Main.moonPhase < 0)
                {
                    Main.moonPhase += moonPhases.Length;
                }
                while (Main.moonPhase >= moonPhases.Length)
                {
                    Main.moonPhase -= moonPhases.Length;
                }
                if (mouseScrollDiff != 0)
                {
                    NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_SET_TIME, -1, -1, (int)Main.time, Main.dayTime, (byte)Main.moonPhase, Main.bloodMoon, Main.hardMode, Main.dayRate);
                    CheatNotification.Add(new CheatNotification("time|moon", moonPhases[Main.moonPhase] + " Moon", 30));
                }
            }
        }

        Player p = Main.player[Main.myPlayer];
        int    oldI, max;

        v   += new Vector2(0, texNPCBlank2.Height * 3);
        b    = false;
        oldI = Main.dayRate;
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 0, texALeft.Height * 0), false, "-25 day rate"))
        {
            Main.dayRate -= 25;
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 1, texALeft.Height * 0), false, "-5 day rate"))
        {
            Main.dayRate -= 5;
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 2, texALeft.Height * 0), false, "-1 day rate"))
        {
            Main.dayRate--;
            b = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 5, texALeft.Height * 0), false, "+1 day rate"))
        {
            Main.dayRate++;
            b = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 6, texALeft.Height * 0), false, "+5 day rate"))
        {
            Main.dayRate += 5;
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 7, texALeft.Height * 0), false, "+25 day rate"))
        {
            Main.dayRate += 25;
            b             = true;
        }
        if (b)
        {
            CheatNotification.Add(new CheatNotification("time|rate", "Day rate: " + Main.dayRate, 30));
        }
        if (ModWorld.MouseRegion(v, new Vector2(texALeft.Width * 8, texALeft.Height)))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            if (stateOld.HasValue && state.HasValue)
            {
                int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;
                Main.dayRate -= mouseScrollDiff;
                if (mouseScrollDiff != 0)
                {
                    CheatNotification.Add(new CheatNotification("time|rate", "Day rate: " + Main.dayRate, 30));
                }
            }
        }
        if (oldI != Main.dayRate)
        {
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_SET_TIME, -1, -1, (int)Main.time, Main.dayTime, (byte)Main.moonPhase, Main.bloodMoon, Main.hardMode, Main.dayRate);
        }

        v   += new Vector2(0, texALeft.Height * 2);
        b    = false;
        oldI = p.statLife;
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 0, texALeft.Height * 0), false, "1 HP"))
        {
            p.statLife = 1;
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 1, texALeft.Height * 0), false, "-20 HP"))
        {
            p.statLife = Math.Max(p.statLife - 20, 1);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 2, texALeft.Height * 0), false, "-1 HP"))
        {
            p.statLife = Math.Max(p.statLife - 1, 1);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 5, texALeft.Height * 0), false, "+1 HP"))
        {
            p.statLife = Math.Min(p.statLife + 1, p.statLifeMax2);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 6, texALeft.Height * 0), false, "+20 HP"))
        {
            p.statLife = Math.Min(p.statLife + 20, p.statLifeMax2);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 7, texALeft.Height * 0), false, "" + p.statLifeMax2 + " HP"))
        {
            p.statLife = p.statLifeMax2;
            b          = true;
        }
        if (b)
        {
            CheatNotification.Add(new CheatNotification("hp|current", "HP: " + p.statLife, 30));
        }
        if (ModWorld.MouseRegion(v, new Vector2(texALeft.Width * 8, texALeft.Height)))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            if (stateOld.HasValue && state.HasValue)
            {
                int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;
                p.statLife = Math.Min(Math.Max(p.statLife - mouseScrollDiff * 20, 1), p.statLifeMax2);
                if (mouseScrollDiff != 0)
                {
                    CheatNotification.Add(new CheatNotification("hp|current", "HP: " + p.statLife, 30));
                }
            }
        }
        if (oldI != p.statLife)
        {
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_STATS, -1, -1, (byte)p.whoAmi, p.statLife, p.statLifeMax, p.statMana, p.statManaMax);
        }

        v   += new Vector2(0, texALeft.Height);
        b    = false;
        oldI = p.statLifeMax;
        max  = Codable.RunGlobalMethod("ModWorld", "ExternalGetMaxHealth") ? (int)Codable.customMethodReturn : 400;
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 0, texALeft.Height * 0), false, "20 max HP"))
        {
            p.statLifeMax = 20;
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 1, texALeft.Height * 0), false, "-20 max HP"))
        {
            p.statLifeMax = Math.Max(p.statLifeMax - 20, 20);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 2, texALeft.Height * 0), false, "-1 max HP"))
        {
            p.statLifeMax = Math.Max(p.statLifeMax - 1, 20);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 5, texALeft.Height * 0), false, "+1 max HP"))
        {
            p.statLifeMax = Math.Min(p.statLifeMax + 1, max);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 6, texALeft.Height * 0), false, "+20 max HP"))
        {
            p.statLifeMax = Math.Min(p.statLifeMax + 20, max);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 7, texALeft.Height * 0), false, "" + max + " max HP"))
        {
            p.statLifeMax = max;
            b             = true;
        }
        if (b)
        {
            CheatNotification.Add(new CheatNotification("hp|max", "HP Max: " + p.statLifeMax, 30));
        }
        if (ModWorld.MouseRegion(v, new Vector2(texALeft.Width * 8, texALeft.Height)))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            if (stateOld.HasValue && state.HasValue)
            {
                int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;
                p.statLifeMax = Math.Min(Math.Max(p.statLifeMax - mouseScrollDiff * 20, 20), max);
                if (mouseScrollDiff != 0)
                {
                    CheatNotification.Add(new CheatNotification("hp|max", "HP Max: " + p.statLifeMax, 30));
                }
            }
        }
        if (oldI != p.statLifeMax)
        {
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_STATS, -1, -1, (byte)p.whoAmi, p.statLife, p.statLifeMax, p.statMana, p.statManaMax);
        }

        v   += new Vector2(0, texALeft.Height * 1.5f);
        b    = false;
        oldI = p.statMana;
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 0, texALeft.Height * 0), false, "0 MP"))
        {
            p.statMana = 0;
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 1, texALeft.Height * 0), false, "-20 MP"))
        {
            p.statMana = Math.Max(p.statMana - 20, 0);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 2, texALeft.Height * 0), false, "-1 MP"))
        {
            p.statMana = Math.Max(p.statMana - 1, 0);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 5, texALeft.Height * 0), false, "+1 MP"))
        {
            p.statMana = Math.Min(p.statMana + 1, p.statManaMax2);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 6, texALeft.Height * 0), false, "+20 MP"))
        {
            p.statMana = Math.Min(p.statMana + 20, p.statManaMax2);
            b          = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 7, texALeft.Height * 0), false, "" + p.statManaMax2 + " MP"))
        {
            p.statMana = p.statManaMax2;
            b          = true;
        }
        if (b)
        {
            CheatNotification.Add(new CheatNotification("mp|current", "MP: " + p.statMana, 30));
        }
        if (ModWorld.MouseRegion(v, new Vector2(texALeft.Width * 8, texALeft.Height)))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            if (stateOld.HasValue && state.HasValue)
            {
                int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;
                p.statMana = Math.Min(Math.Max(p.statMana - mouseScrollDiff * 20, 0), p.statManaMax2);
                if (mouseScrollDiff != 0)
                {
                    CheatNotification.Add(new CheatNotification("mp|current", "MP: " + p.statMana, 30));
                }
            }
        }
        if (oldI != p.statMana)
        {
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_STATS, -1, -1, (byte)p.whoAmi, p.statLife, p.statLifeMax, p.statMana, p.statManaMax);
        }

        v   += new Vector2(0, texALeft.Height);
        b    = false;
        oldI = p.statManaMax;
        max  = Codable.RunGlobalMethod("ModWorld", "ExternalGetMaxMana") ? (int)Codable.customMethodReturn : 200;
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 0, texALeft.Height * 0), false, "0 max MP"))
        {
            p.statManaMax = 20;
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 1, texALeft.Height * 0), false, "-20 max MP"))
        {
            p.statManaMax = Math.Max(p.statManaMax - 20, 0);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 2, texALeft.Height * 0), false, "-1 max MP"))
        {
            p.statManaMax = Math.Max(p.statManaMax - 1, 0);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 5, texALeft.Height * 0), false, "+1 max MP"))
        {
            p.statManaMax = Math.Min(p.statManaMax + 1, max);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 6, texALeft.Height * 0), false, "+20 max MP"))
        {
            p.statManaMax = Math.Min(p.statManaMax + 20, max);
            b             = true;
        }
        if (PostDrawFilter(sb, texALeft, v + new Vector2(texALeft.Width * 7, texALeft.Height * 0), false, "" + max + " max MP"))
        {
            p.statManaMax = max;
            b             = true;
        }
        if (b)
        {
            CheatNotification.Add(new CheatNotification("mp|max", "MP Max: " + p.statManaMax, 30));
        }
        if (ModWorld.MouseRegion(v, new Vector2(texALeft.Width * 8, texALeft.Height)))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            if (stateOld.HasValue && state.HasValue)
            {
                int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;
                p.statManaMax = Math.Min(Math.Max(p.statManaMax - mouseScrollDiff * 20, 0), max);
                if (mouseScrollDiff != 0)
                {
                    CheatNotification.Add(new CheatNotification("mp|max", "MP Max: " + p.statManaMax, 30));
                }
            }
        }
        if (oldI != p.statManaMax)
        {
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_STATS, -1, -1, (byte)p.whoAmi, p.statLife, p.statLifeMax, p.statMana, p.statManaMax);
        }
    }