public override void OnCatch(Player player)
 {
     if (Main.netMode == 2 || player.whoAmi != Main.myPlayer)
     {
         return;
     }
     if (ModWorld.AcAchieve != null)
     {
         ModWorld.AcAchieve("SHK_WORLDP_FLY_CORRUPT", null);
         if (chaos)
         {
             ModWorld.AcAchieve("SHK_WORLDP_FLY_CORRUPT2", null);
         }
     }
 }
 public override void OnCatch(Player player)
 {
     if (Main.netMode == 2 || player.whoAmi != Main.myPlayer)
     {
         return;
     }
     if (ModWorld.AcAchieve != null)
     {
         ModWorld.AcAchieve("SHK_WORLDP_FLY_FLAME", null);
         if (color1.G == 255)
         {
             ModWorld.AcAchieve("SHK_WORLDP_FLY_FLAME2", null);
         }
     }
 }
Beispiel #3
0
 public override void OnCatch(Player player)
 {
     if (Main.netMode == 2 || player.whoAmi != Main.myPlayer)
     {
         return;
     }
     if (ModWorld.AcAchieve != null)
     {
         ModWorld.AcAchieve("SHK_WORLDP_FLY_MOON", null);
         if (hasRing)
         {
             ModWorld.AcAchieve("SHK_WORLDP_FLY_MOON2", null);
         }
     }
 }
Beispiel #4
0
 public override void OnCatch(Player player)
 {
     if (Main.netMode == 2 || player.whoAmi != Main.myPlayer)
     {
         return;
     }
     if (ModWorld.AcAchieve != null)
     {
         ModWorld.AcAchieve("SHK_WORLDP_FLY_HOLY", null);
         if (hueSpeed != 0)
         {
             ModWorld.AcAchieve("SHK_WORLDP_FLY_HOLY2", null);
         }
     }
 }
    public void ButtonClicked(int num)
    {
        int x = (int)Config.tileInterface.sourceLocation.X, y = (int)Config.tileInterface.sourceLocation.Y;

        if (Main.netMode == 0)
        {
            ModWorld.SetNoteLevel(new Vector2(x, y), num);
        }
        else
        {
            NetMessage.SendModData(ModWorld.modId, ModWorld.MSG_SETLEVEL, -1, -1, x, y, (byte)num);
        }
        Codable.RunTileMethod(false, new Vector2(x, y), Main.tile[x, y].type, "ExternalNoteBlockPlay");

        Create(x, y, num);
    }
Beispiel #6
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;
        }
    }
Beispiel #7
0
 //Initialize all variables to their default values
 public override void Initialize()
 {
     if (SGAmod.cachedata == false)
     {
         Instance                      = this;
         dungeonlevel                  = 0;
         Main.invasionSize             = 0;
         customInvasionUp              = false;
         downedCustomInvasion          = false;
         downedSPinky                  = false;
         downedTPD                     = false;
         downedSpiderQueen             = false;
         downedHarbinger               = false;
         downedWraiths                 = 0;
         downedMurk                    = 0;
         craftwarning                  = 0;
         downedMurklegacy              = false;
         downedCaliburnGuardians       = 0;
         downedCaliburnGuardiansPoints = 0;
         downedCirno                   = false;
         downedSharkvern               = false;
         overalldamagedone             = 0;
         downedCratrosity              = false;
         downedCratrosityPML           = false;
         downedHellion                 = 0;
         tf2cratedrops                 = false;
         tf2quest                      = 0;
         bossprgressor                 = 0;
         modtimer                      = 0;
         for (int f = 0; f < CaliburnAlterCoordsX.Length; f++)
         {
             CaliburnAlterCoordsX[f] = 0;
             CaliburnAlterCoordsY[f] = 0;
         }
         WorldIsTin = WorldGen.oreTier1 != TileID.Copper;
         int x = 0;
         for (x = 0; x < questvars.Length; x++)
         {
             questvars[x] = 0;
         }
     }
     SGAmod.cachedata = false;
 }
Beispiel #8
0
    public void Draw(SpriteBatch sb, int xx, ref int yy, int ww)
    {
        if (!Visible())
        {
            return;
        }

        if (Main.mouseLeft && Main.mouseLeftRelease && ModWorld.GuiAchievements.MouseIn(sb.GraphicsDevice.ScissorRectangle, new Rectangle(xx, yy, ww, 42)))
        {
            toggled = !toggled;
            if (toggled)
            {
                GuiAchievements.setScroll = yy + GuiAchievements.scroll - 120;
            }
        }

        Color white    = new Color(255, 255, 255, 191);
        Color limish   = new Color(136, 255, 0, 191);
        bool  achieved = Achieved();

        sb.Draw(ModWorld.Notifier.frame1, new Rectangle(xx + 1, yy, ww - 2, 42), achieved ? limish : white);
        sb.Draw(ModWorld.Notifier.frame2, new Rectangle(xx, yy, 1, 42), achieved ? limish : white);
        sb.Draw(ModWorld.Notifier.frame2, new Rectangle(xx + ww - 1, yy, 1, 42), achieved ? limish : white);

        ModWorld.DrawStringShadowed(sb, Main.fontMouseText, title, new Vector2(xx + 8, yy + 10), Color.White, Color.Black);
        string value = "" + Value(true) + "/" + Value(false);

        ModWorld.DrawStringShadowed(sb, Main.fontMouseText, value, new Vector2(xx + ww - 12 - Main.fontMouseText.MeasureString(value).X, yy + 10), Color.White, Color.Black);

        yy += 42;

        if (toggled)
        {
            for (int i = 0; i < categories.Count; i++)
            {
                categories[i].Draw(sb, xx + 24, ref yy, ww - 48);
            }
            for (int i = 0; i < achievements.Count; i++)
            {
                achievements[i].Draw(sb, xx + 24, ref yy, ww - 48);
            }
        }
    }
    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);
        }
    }
	public override void Draw(SpriteBatch sb, Projectile p, ModWorld.Firework f) {
		trail.Insert(0,new Vector2(pos.X,pos.Y));
		for (int i = 0; i < Math.Min(trail.Count,5); i++) {
			Vector2 v = trail[i];
			float alpha = (5-i)/5f;
			sb.Draw(ptFuzzy,v-Main.screenPosition,GetRectFuzzy(),new Color(color.R,color.G,color.B,(byte)(color.A*alpha*.5f)),0f,GetCenterFuzzy(),GetScaleFuzzy(12f),SpriteEffects.None,0f);
			sb.Draw(ptFuzzy,v-Main.screenPosition,GetRectFuzzy(),new Color(color.R,color.G,color.B,(byte)(color.A*alpha)),0f,GetCenterFuzzy(),GetScaleFuzzy(4f),SpriteEffects.None,0f);
		}
		if (trail.Count > 5) trail.RemoveAt(5);
		
		pos += vel;
		vel.Y += .05f;
		
		if (timeLeft > 0) {
			timeLeft--;
		} else {
			color.A = (byte)Math.Max(color.A-26,0);
			if (color.A == 0) dead = true;
		}
	}
Beispiel #11
0
    public void PreDrawFilter(SpriteBatch sb, Texture2D tex, Texture2D tex2, int frameCount, int frame, Vector2 v, bool value)
    {
        Color c = value || ModWorld.MouseRegion(v, new Vector2(tex.Width, tex.Height)) ? Color.White : Color.Gray;

        sb.Draw(tex, v, ModWorld.GetTexRectangle(tex), c, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
        if (tex2 != null)
        {
            float scale = 1f;
            int   ww = tex.Width - 4, hh = tex.Height - 4;
            if (tex2.Width * scale > ww)
            {
                scale = 1f * ww / tex2.Width;
            }
            if (tex2.Height / frameCount * scale > hh)
            {
                scale = 1f * hh / (tex2.Height / frameCount);
            }
            sb.Draw(tex2, v + new Vector2(2, 2) + new Vector2((ww - tex2.Width * scale) / 2f, (hh - tex2.Height / frameCount * scale) / 2f), new Rectangle?(new Rectangle(0, tex2.Height / frameCount * frame, tex2.Width, tex2.Height / frameCount)), c, 0f, default(Vector2), scale, SpriteEffects.None, 0f);
        }
    }
Beispiel #12
0
        private static void LoadLegacyModData(BinaryReader reader)
        {
            int count = reader.ReadUInt16();

            for (int k = 0; k < count; k++)
            {
                string   modName  = reader.ReadString();
                string   name     = reader.ReadString();
                byte[]   data     = reader.ReadBytes(reader.ReadUInt16());
                Mod      mod      = ModLoader.GetMod(modName);
                ModWorld modWorld = mod == null ? null : mod.GetModWorld(name);
                if (modWorld != null)
                {
                    using (MemoryStream stream = new MemoryStream(data))
                    {
                        using (BinaryReader customReader = new BinaryReader(stream))
                        {
                            try
                            {
                                modWorld.LoadLegacy(customReader);
                            }
                            catch (Exception e)
                            {
                                throw new CustomModDataException(mod,
                                                                 "Error in reading custom world data for " + mod.Name, e);
                            }
                        }
                    }
                }
                else
                {
                    var tag = new TagCompound
                    {
                        ["mod"]        = modName,
                        ["name"]       = name,
                        ["legacyData"] = data
                    };
                    ((MysteryWorld)ModLoader.GetMod("ModLoader").GetModWorld("MysteryWorld")).data.Add(tag);
                }
            }
        }
 public void BeginMainMenu()
 {
     moduleConsole             = base.gameObject.AddComponent <ModConsoleOpt>();
     modulePlayer              = base.gameObject.AddComponent <ModPlayer>();
     moduleWorld               = base.gameObject.AddComponent <ModWorld>();
     moduleConsole.CallerEntry = new SkMenuItem("Console Menu\t►", (Action) delegate
     {
         menuController.RequestSubMenu(moduleConsole.FlushMenu());
     }, "");
     modulePlayer.CallerEntry = new SkMenuItem("Player Menu\t►", (Action) delegate
     {
         menuController.RequestSubMenu(modulePlayer.FlushMenu());
     }, "");
     moduleWorld.CallerEntry = new SkMenuItem("World Menu\t►", (Action) delegate
     {
         menuController.RequestSubMenu(moduleWorld.FlushMenu());
     }, "");
     MenuOptions.Add(modulePlayer);
     MenuOptions.Add(moduleWorld);
     MenuOptions.Add(moduleConsole);
 }
Beispiel #14
0
        internal static void ReadCustomData(BinaryReader reader)
        {
            int count = reader.ReadUInt16();

            for (int k = 0; k < count; k++)
            {
                string   modName  = reader.ReadString();
                string   name     = reader.ReadString();
                byte[]   data     = reader.ReadBytes(reader.ReadUInt16());
                Mod      mod      = ModLoader.GetMod(modName);
                ModWorld modWorld = mod == null ? null : mod.GetModWorld(name);
                if (modWorld != null)
                {
                    using (MemoryStream stream = new MemoryStream(data))
                    {
                        using (BinaryReader customReader = new BinaryReader(stream))
                        {
                            try
                            {
                                modWorld.LoadCustomData(customReader);
                            }
                            catch (Exception e)
                            {
                                throw new CustomModDataException(mod,
                                                                 "Error in reading custom world data for " + mod.Name, e);
                            }
                        }
                    }
                    if (modName == "ModLoader" && name == "MysteryWorld")
                    {
                        ((MysteryWorld)modWorld).RestoreData();
                    }
                }
                else
                {
                    ModWorld mystery = ModLoader.GetMod("ModLoader").GetModWorld("MysteryWorld");
                    ((MysteryWorld)mystery).AddData(modName, name, data);
                }
            }
        }
Beispiel #15
0
 internal static bool WriteCustomData(ModWorld modWorld, BinaryWriter writer)
 {
     byte[] data;
     using (MemoryStream stream = new MemoryStream())
     {
         using (BinaryWriter customWriter = new BinaryWriter(stream))
         {
             modWorld.SaveCustomData(customWriter);
             customWriter.Flush();
             data = stream.ToArray();
         }
     }
     if (data.Length > 0)
     {
         writer.Write(modWorld.mod.Name);
         writer.Write(modWorld.Name);
         writer.Write((ushort)data.Length);
         writer.Write(data);
         return(true);
     }
     return(false);
 }
Beispiel #16
0
    public bool PostDrawFilter(SpriteBatch sb, Texture2D tex, Vector2 v, bool value, string text)
    {
        bool ret = false;

        if (ModWorld.MouseRegion(v, new Vector2(tex.Width, tex.Height)))
        {
            Main.player[Main.myPlayer].mouseInterface = true;
            MouseText(text);
            if (Main.mouseLeft && Main.mouseLeftRelease)
            {
                ret = true;
            }
        }

        if (blockChange)
        {
            return(false);
        }
        if (ret)
        {
            blockChange = true;
        }
        return(ret);
    }
Beispiel #17
0
 public static void SetModWorldConditions(string modname, string worldname, string ConditionName, object Set_value, bool nopub = false, bool sta = false)
 {
     if (ModLoader.GetMod(modname) != null)
     {
         Mod mod = ModLoader.GetMod(modname);
         try
         {
             ModWorld world = mod.GetModWorld(worldname);
             if (world != null)
             {
                 BindingFlags binding = (sta? BindingFlags.Static : BindingFlags.Instance) | (nopub? BindingFlags.NonPublic : BindingFlags.Public);
                 FieldInfo    field   = world.GetType().GetField(ConditionName, binding);
                 if (field.FieldType == Set_value.GetType())
                 {
                     field.SetValue(world, Set_value);
                 }
             }
         }
         catch
         {
             throw new Exception("Error in setting world data.");
         }
     }
 }
Beispiel #18
0
        //Initialize all variables to their default values
        public override void Initialize()
        {
            modtimer = 0;
            Instance = this;

            Tiles.Monolith.CelestialMonolithTE.ResetTEs();

            if (Dimensions.SGAPocketDim.WhereAmI == null)
            {
                downedSpaceBoss = false;
            }

            if (SGAmod.cachedata == false)
            {
                portalcanmovein     = false;
                oretypesprehardmode = new int[4] {
                    TileID.Copper, TileID.Iron, TileID.Silver, TileID.Gold
                };
                oretypeshardmode = new int[3] {
                    TileID.Cobalt, TileID.Mythril, TileID.Adamantite
                };
                NightmareHardcore = 0;
                dungeonlevel      = 0;
                //highestDimDungeonFloor = 0;
                Main.invasionSize              = 0;
                customInvasionUp               = false;
                downedCustomInvasion           = false;
                downedSPinky                   = false;
                downedTPD                      = false;
                downedSpiderQueen              = false;
                downedHarbinger                = false;
                downedWraiths                  = 0;
                downedMurk                     = 0;
                craftwarning                   = 0;
                tidalCharmUnlocked             = false;
                GennedVirulent                 = false;
                downedMurklegacy               = false;
                downedCaliburnGuardians        = 0;
                downedCaliburnGuardiansPoints  = 0;
                downedCaliburnGuardianHardmode = false;
                downedCirno                    = false;
                downedSharkvern                = false;
                darknessVision                 = false;
                overalldamagedone              = 0;
                downedCratrosity               = false;
                downedCratrosityPML            = false;
                downedHellion                  = 0;
                sharkvernMessage               = false;
                downedPrismBanshee             = 0;
                tf2cratedrops                  = false;
                tf2quest      = 0;
                bossprgressor = 0;
                SnapCooldown  = 0;
                WorldIsNovus  = true;
                for (int f = 0; f < CaliburnAlterCoordsX.Length; f++)
                {
                    CaliburnAlterCoordsX[f] = 0;
                    CaliburnAlterCoordsY[f] = 0;
                }
                WorldIsTin = WorldGen.oreTier1 != TileID.Copper;
                int x = 0;
                for (x = 0; x < questvars.Length; x++)
                {
                    questvars[x] = 0;
                }

                if (!Main.dedServ)
                {
                    Item c0decrown = new Item();
                    c0decrown.SetDefaults(mod.ItemType("CelestialCrown"));

                    Main.armorHeadLoaded[c0decrown.headSlot]  = true;
                    Main.armorHeadTexture[c0decrown.headSlot] = SGAmod.RadSuitHeadTex;
                }
            }

            WorldNoise = new NoiseGenerator(Main.worldName.GetHashCode());

            WorldNoise.Amplitude   = 1;
            WorldNoise.Octaves     = 4;
            WorldNoise.Persistence = 0.750;
            WorldNoise.Frequency  *= 1.25;

            SGAmod.cachedata = false;
        }
    public static void Draw(SpriteBatch sb)
    {
        if (!visible)
        {
            return;
        }
        if (Config.tileInterface != null || Config.npcInterface != null || Main.npcShop != 0 || Main.signBubble || (Main.npcChatText != null && Main.npcChatText != ""))
        {
            Toggle();
            return;
        }

        sb.End();

        int guiX = 80, guiY = 120, guiW = Main.screenWidth - guiX * 2, guiH = Main.screenHeight - guiY * 2 - 40;

        sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, _rasterizerState);
        sb.GraphicsDevice.ScissorRectangle = new Rectangle(guiX, guiY, guiW + 1, guiH);

        int yStart = guiY - scroll, yy = yStart;

        for (int i = 0; i < categories.Count; i++)
        {
            categories[i].Draw(sb, guiX, ref yy, guiW - 32);
        }
        for (int i = 0; i < achievements.Count; i++)
        {
            achievements[i].Draw(sb, guiX, ref yy, guiW - 32);
        }

        sb.End();
        sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);

        int hMax = yy - yStart, scrollMax = hMax - guiH;

        if (scrollMax < 0)
        {
            scrollMax = 0;
        }
        if (scroll < 0)
        {
            scroll = 0;
        }
        if (scroll > scrollMax)
        {
            scroll = scrollMax;
        }

        float     sliderY = scrollMax == 0 ? 0f : 1f * scroll / scrollMax, sliderH = scrollMax == 0 ? 1f : 1f * guiH / hMax;
        Rectangle rectBlack = new Rectangle(guiX + guiW - 24, guiY, 24, guiH); sb.Draw(whiteTex, rectBlack, new Color(1f, 1f, 1f, .75f));
        Rectangle rectWhite = new Rectangle(guiX + guiW - 22, (int)(guiY + 2 + (guiH - 4 - (guiH - 4) * sliderH) * sliderY), 20, (int)((guiH - 4) * sliderH)); sb.Draw(whiteTex, rectWhite, new Color(0f, 0f, 0f, .75f));

        if (scrollDragY == -1)
        {
            if (Main.mouseLeft && Main.mouseLeftRelease)
            {
                if (MouseIn(rectBlack))
                {
                    if (MouseIn(rectWhite))
                    {
                        scrollDragY = Main.mouseY - rectWhite.Y;
                    }
                    else
                    {
                        scrollDragY = rectWhite.Height / 2;
                        scroll      = (int)(1f * (Main.mouseY - scrollDragY - (guiY + 2)) / (guiH - 4) * hMax);
                    }
                }
            }
        }
        else
        {
            scroll = (int)(1f * (Main.mouseY - scrollDragY - (guiY + 2)) / (guiH - 4) * hMax);
            if (!Main.mouseLeft)
            {
                scrollDragY = -1;
            }
        }

        if (setScroll >= 0)
        {
            scroll    = setScroll;
            setScroll = -1;
        }

        stateOld = state;
        state    = Microsoft.Xna.Framework.Input.Mouse.GetState();
        if (stateOld.HasValue && state.HasValue)
        {
            int mouseScrollDiff = (state.Value.ScrollWheelValue - stateOld.Value.ScrollWheelValue) / 120;
            scroll -= mouseScrollDiff * 56;
            Main.player[Main.myPlayer].selectedItem += mouseScrollDiff;
            while (Main.player[Main.myPlayer].selectedItem < 0)
            {
                Main.player[Main.myPlayer].selectedItem += 10;
            }
            while (Main.player[Main.myPlayer].selectedItem > 9)
            {
                Main.player[Main.myPlayer].selectedItem -= 10;
            }
        }

        if (scroll < 0)
        {
            scroll = 0;
        }
        if (scroll > scrollMax)
        {
            scroll = scrollMax;
        }

        int acAchieved = 0, acTotal = 0, acHidden = 0, acLocked = 0, acPoints = 0, acPointsTotal = 0;

        UpdateCounters(ref acAchieved, ref acTotal, ref acHidden, ref acLocked, ref acPoints, ref acPointsTotal);

        ModWorld.DrawStringShadowed(sb, Main.fontMouseText, "Achieved: " + acAchieved + "/" + acTotal + (acHidden + acLocked != 0 ? " (" + (acHidden > 0 ? "+" + acHidden + " hidden" : "") + (acLocked > 0 ? (acHidden > 0 ? ", " : "") + "+" + acLocked + " locked" : "") + ")" : ""), new Vector2(guiX, guiY + guiH + 10), Color.White, Color.Black);
        ModWorld.DrawStringShadowed(sb, Main.fontMouseText, "Total points: " + acPoints + "/" + acPointsTotal, new Vector2(guiX + guiW - Main.fontMouseText.MeasureString("Total points: " + acPoints + "/" + acPointsTotal).X, guiY + guiH + 10), Color.White, Color.Black);
    }
    public static void PostUpdate()
    {
        if (style == "circular_bottomleft")
        {
            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);
            }
        }
    }
Beispiel #21
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);
        }
    }
 public override void Load(TagCompound tag)
 {
     DimDingeonsWorld.Instance = this;
 }
Beispiel #23
0
    public void Draw(SpriteBatch sb, int xx, ref int yy, int ww)
    {
        Color white  = new Color(255, 255, 255, 191);
        Color limish = new Color(136, 255, 0, 191);
        Color orange = new Color(255, 127, 0, 191);

        float progress = GetProgress();

        if (achieved)
        {
            progress = 1f;
        }
        Color c = achieved ? limish : white;

        if (progress <= 0f || progress >= 1f)
        {
            sb.Draw(ModWorld.Notifier.frame1, new Rectangle(xx + 1, yy, ww - 2, 56), c);
            sb.Draw(ModWorld.Notifier.frame2, new Rectangle(xx, yy, 1, 56), c);
            sb.Draw(ModWorld.Notifier.frame2, new Rectangle(xx + ww - 1, yy, 1, 56), c);
        }
        else
        {
            int progressW = (int)((ww - 2) * progress);
            sb.Draw(ModWorld.Notifier.frame1, new Rectangle(xx + 1, yy, progressW, 56), orange);
            sb.Draw(ModWorld.Notifier.frame1, new Rectangle(xx + 1 + progressW, yy, ww - 2 - progressW, 56), white);
            sb.Draw(ModWorld.Notifier.frame2, new Rectangle(xx, yy, 1, 56), orange);
            sb.Draw(ModWorld.Notifier.frame2, new Rectangle(xx + ww - 1, yy, 1, 56), white);
        }

        xx += 4;
        if (tex != null)
        {
            float scale = 1f;
            if (tex.Width > 48)
            {
                scale = 48f / tex.Width;
            }
            if (tex.Height * scale > 48f)
            {
                scale = 48f / tex.Height;
            }
            sb.Draw(tex, new Rectangle((int)(xx + (48 - tex.Width * scale) / 2f), (int)(yy + 4 + (48 - tex.Height * scale) / 2f), (int)(tex.Width * scale), (int)(tex.Height * scale)), Color.White);
            xx += 52;
        }
        ModWorld.DrawStringShadowed(sb, Main.fontMouseText, title, new Vector2(xx, yy + 8), Color.White, Color.Black);
        ModWorld.DrawStringShadowed(sb, Main.fontMouseText, description, new Vector2(xx, yy + 28), Color.White, Color.Black, default(Vector2), .75f);
        string progressText = GetProgressText();

        if (!achieved && progressText != null)
        {
            ModWorld.DrawStringShadowed(sb, Main.fontMouseText, progressText, new Vector2((int)(xx + Main.fontMouseText.MeasureString(description).X *.75f + 20), yy + 18), Color.White, Color.Black, default(Vector2), .75f);
        }
        xx -= 4; if (tex != null)
        {
            xx -= 52;
        }
        ModWorld.DrawStringShadowed(sb, Main.fontMouseText, "" + value, new Vector2(xx + ww - 12 - Main.fontMouseText.MeasureString("" + value).X, yy + 16), Color.White, Color.Black);

        yy += 56;

        for (int i = 0; i < sub.Count; i++)
        {
            sub[i].Draw(sb, xx + 24, ref yy, ww - 48);
        }
    }
Beispiel #24
0
 public static void Create(int x, int y)
 {
     Create(x, y, ModWorld.GetNoteLevel(new Vector2(x, y)));
 }
Beispiel #25
0
		internal static bool WriteCustomData(ModWorld modWorld, BinaryWriter writer)
		{
			byte[] data;
			using (MemoryStream stream = new MemoryStream())
			{
				using (BinaryWriter customWriter = new BinaryWriter(stream))
				{
					modWorld.SaveCustomData(customWriter);
					customWriter.Flush();
					data = stream.ToArray();
				}
			}
			if (data.Length > 0)
			{
				writer.Write(modWorld.mod.Name);
				writer.Write(modWorld.Name);
				writer.Write((ushort)data.Length);
				writer.Write(data);
				return true;
			}
			return false;
		}
Beispiel #26
0
        public override void AI()
        {
            // calculate target
            npc.TargetClosest(true);
            Player target = Main.player[npc.target];

            // fly away if everyone's dead
            if (!target.active || target.dead)
            {
                npc.TargetClosest(true);
                target = Main.player[npc.target];
                if (!target.active || target.dead)
                {
                    npc.velocity = new Vector2(0f, -10f);
                    if (npc.timeLeft > 10)
                    {
                        npc.timeLeft = 10;
                    }
                    return;
                }
            }

            // rotate towards target
            Vector2 properDirection = new Vector2((float)(target.Center.X - npc.Center.X), (float)(target.Center.Y - npc.Center.Y));

            npc.rotation = (float)(Math.Atan2(properDirection.Y, properDirection.X));

            // fire bullets where it's facing
            if (Main.netMode != 1)
            {
                npc.ai[0]--;
                if (npc.ai[0] <= 0f)
                {
                    float fireSpeed = 3f;
                    bool  revengeOn = false;

                    if (Main.expertMode)
                    {
                        fireSpeed = (Main.rand.NextBool(2))?3f:2f;
                    }
                    // check if we're in revengeance mode (calamity)
                    Mod calamityMod = ModLoader.GetMod("CalamityMod");
                    if (calamityMod != null)
                    {
                        ModWorld calamityWorld = calamityMod.GetModWorld("CalamityWorld");
                        revengeOn = (bool)calamityWorld.GetType().GetField("revenge").GetValue(calamityWorld);
                        if (revengeOn == true)
                        {
                            fireSpeed = 2f;
                        }
                    }

                    String projectileType   = "BossLunar";
                    int    projectileDamage = 55;
                    if (npc.ai[1] == 2f)
                    {
                        projectileType   = "BossTears";
                        projectileDamage = 40;
                    }
                    else if (npc.ai[1] == 3f)
                    {
                        projectileType   = "BossLuminite";
                        projectileDamage = 35;
                    }
                    else if (npc.ai[1] == 4f)
                    {
                        projectileType   = "BossCosmilite";
                        projectileDamage = 95;
                    }

                    if (Main.expertMode && Main.rand.NextBool(12))
                    {
                        projectileType   = "BossRainbow";
                        projectileDamage = 1;
                    }

                    float lifePercentage = (float)npc.life / (float)npc.lifeMax;
                    if (lifePercentage <= 0.25f && revengeOn)   // 25% health
                    {
                        npc.ai[1] = 4f;
                    }
                    else if (lifePercentage <= 0.45f)     // 35% health
                    {
                        npc.ai[1] = 1f;
                    }
                    else if (lifePercentage <= 0.55f)     // 55% health
                    {
                        npc.ai[1] = 2f;
                    }
                    else
                    {
                        npc.ai[1] = 3f;
                    }

                    npc.ai[0] = fireSpeed;
                    Main.PlaySound(SoundID.Item40, (int)npc.Center.X, (int)npc.Center.Y);
                    Vector2 projectileVelocity = properDirection.RotatedByRandom(MathHelper.ToRadians(10));
                    int     a = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, projectileVelocity.X, projectileVelocity.Y, mod.ProjectileType(projectileType), projectileDamage, 3f);
                    if (revengeOn || (Main.expertMode && Main.rand.NextBool(2)))
                    {
                        Main.projectile[a].extraUpdates = 1;
                    }
                }
            }

            // chase target while twitching
            if (target.Distance(npc.Center) > 250f)
            {
                Vector2 newVelocity = (target.Center - npc.Center).RotatedByRandom(MathHelper.ToRadians(180));
                newVelocity *= 10f / (float)Math.Sqrt(newVelocity.X * newVelocity.X + newVelocity.Y * newVelocity.Y);
                npc.velocity = newVelocity;
            }
            else
            {
                npc.velocity = new Vector2(0f, 10f).RotatedByRandom(MathHelper.ToRadians(360));
            }
        }