Пример #1
0
 public override void OnEnterWorld(Player player)
 {
     // We can refresh UI using OnEnterWorld. OnEnterWorld happens after Load, so nonStopParty is the correct value.
     ModContent.GetInstance <ExampleMod>().ExampleUI.ExampleButton.HoverText = "SendClientChanges Example: Non-Stop Party " + (nonStopParty ? "On" : "Off");
 }
Пример #2
0
 public override bool Autoload(ref string name)
 {
     return(ModContent.GetInstance <ServerConfig>().WormholeMirror);
 }
        public override void Update(GameTime gameTime)
        {
            Fluftrodon _Fluftrodon = ModContent.GetInstance <Fluftrodon>();

            base.Update(gameTime);
            Fluftrodon.FluftrodonPaintTileMode = FluftrodonPaintTileMode2;
            Fluftrodon.FluftrodonPaintWallMode = FluftrodonPaintWallMode2;
            Fluftrodon.FluftrodonPaintColor    = FluftrodonPaintColor2;
            if (FluftrodonPaintTileMode2 == 0)
            {
                FluftrodonPaintUIBrushText.SetText("Ignore");
            }
            else if (FluftrodonPaintTileMode2 == 1)
            {
                FluftrodonPaintUIBrushText.SetText("Paint");
            }
            else if (FluftrodonPaintTileMode2 == 2)
            {
                FluftrodonPaintUIBrushText.SetText("Erase");
            }
            else
            {
                FluftrodonPaintUIColorText.SetText("Error (please report to MrPlague!)");
            }
            if (FluftrodonPaintWallMode2 == 0)
            {
                FluftrodonPaintUIRollerText.SetText("Ignore");
            }
            else if (FluftrodonPaintWallMode2 == 1)
            {
                FluftrodonPaintUIRollerText.SetText("Paint");
            }
            else if (FluftrodonPaintWallMode2 == 2)
            {
                FluftrodonPaintUIRollerText.SetText("Erase");
            }
            else
            {
                FluftrodonPaintUIColorText.SetText("Error (please report to MrPlague!)");
            }
            if (FluftrodonPaintColor2 == 1)
            {
                FluftrodonPaintUIColorText.SetText("Red");
            }
            else if (FluftrodonPaintColor2 == 2)
            {
                FluftrodonPaintUIColorText.SetText("Orange");
            }
            else if (FluftrodonPaintColor2 == 3)
            {
                FluftrodonPaintUIColorText.SetText("Yellow");
            }
            else if (FluftrodonPaintColor2 == 4)
            {
                FluftrodonPaintUIColorText.SetText("Lime");
            }
            else if (FluftrodonPaintColor2 == 5)
            {
                FluftrodonPaintUIColorText.SetText("Green");
            }
            else if (FluftrodonPaintColor2 == 6)
            {
                FluftrodonPaintUIColorText.SetText("Teal");
            }
            else if (FluftrodonPaintColor2 == 7)
            {
                FluftrodonPaintUIColorText.SetText("Cyan");
            }
            else if (FluftrodonPaintColor2 == 8)
            {
                FluftrodonPaintUIColorText.SetText("Sky");
            }
            else if (FluftrodonPaintColor2 == 9)
            {
                FluftrodonPaintUIColorText.SetText("Blue");
            }
            else if (FluftrodonPaintColor2 == 10)
            {
                FluftrodonPaintUIColorText.SetText("Purple");
            }
            else if (FluftrodonPaintColor2 == 11)
            {
                FluftrodonPaintUIColorText.SetText("Violet");
            }
            else if (FluftrodonPaintColor2 == 12)
            {
                FluftrodonPaintUIColorText.SetText("Pink");
            }
            else if (FluftrodonPaintColor2 == 25)
            {
                FluftrodonPaintUIColorText.SetText("Black");
            }
            else if (FluftrodonPaintColor2 == 27)
            {
                FluftrodonPaintUIColorText.SetText("Gray");
            }
            else if (FluftrodonPaintColor2 == 26)
            {
                FluftrodonPaintUIColorText.SetText("White");
            }
            else if (FluftrodonPaintColor2 == 28)
            {
                FluftrodonPaintUIColorText.SetText("Brown");
            }
            else
            {
                FluftrodonPaintUIColorText.SetText("Error (please report to MrPlague!)");
            }
            if (_Fluftrodon.FluftrodonPaintUIPositionSet)
            {
                FluftrodonPaintUIPanelBackground.Left.Set(Main.mouseX - 100, 0);
                FluftrodonPaintUIPanelBackground.Top.Set(Main.mouseY - 33, 0);
            }
            if (!_Fluftrodon.FluftrodonPaintUI)
            {
                FluftrodonPaintUIPanelBackground.Left.Set(999999, 0);
                FluftrodonPaintUIPanelBackground.Top.Set(999999, 0);
            }
            Recalculate();
        }
Пример #4
0
 public override void SetStaticDefaults()
 {
     DisplayName.SetDefault("Crimtane Defense Knives");
     Tooltip.SetDefault("These knives form a protective Crimtane wall when thrown");
     PlateType = ModContent.GetInstance <Items.Materials.Plates.CrimtanePlate>();
 }
Пример #5
0
        internal void Save(TagCompound tags)
        {
            var myworld = ModContent.GetInstance <ModHelpersWorld>();

            tags["half_days_elapsed_" + myworld.ObsoleteId] = (int)this.HalfDaysElapsed;
        }
Пример #6
0
 public override void OnChanged()
 {
     ModContent.GetInstance <BossFightLives>().ConfigureUi(this);
 }
Пример #7
0
        ////////////////

        private static void _Draw(GameTime gameTime)                    // <- Just in case references are doing something funky...
        {
            ModContent.GetInstance <MenuItemManager>()?.Draw(gameTime);
        }
Пример #8
0
        ////////////////

        public static void AddWidgetVisibilityHook(Func <string, bool> hook)
        {
            var mymod = ModContent.GetInstance <HUDElementsLibMod>();

            mymod.VisibilityHooks.Add(hook);
        }
Пример #9
0
 public override void PostUpdate()
 {
     if (Main.dayTime && VolcanoCountdown == 0)
     {
         if (VolcanoCooldown > 0)
         {
             VolcanoCooldown--;
         }
         if (VolcanoCooldown <= 0 && Main.rand.NextBool(VolcanoChance) && !ModContent.GetInstance <ExampleConfigServer>().DisableVolcanoes)
         {
             string key          = "Mods.ExampleMod.VolcanoWarning";
             Color  messageColor = Color.Orange;
             if (Main.netMode == NetmodeID.Server)                     // Server
             {
                 NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);
             }
             else if (Main.netMode == NetmodeID.SinglePlayer)                     // Single Player
             {
                 Main.NewText(Language.GetTextValue(key), messageColor);
             }
             VolcanoCountdown = DefaultVolcanoCountdown;
             VolcanoCooldown  = DefaultVolcanoCooldown;
         }
     }
     if (VolcanoCountdown > 0)
     {
         VolcanoCountdown--;
         if (VolcanoCountdown == 0)
         {
             VolcanoTremorTime = DefaultVolcanoTremorTime;
             // Since PostUpdate only happens in single and server, we need to inform the clients to shake if this is a server
             if (Main.netMode == NetmodeID.Server)
             {
                 var netMessage = mod.GetPacket();
                 netMessage.Write((byte)ExampleModMessageType.SetTremorTime);
                 netMessage.Write(VolcanoTremorTime);
                 netMessage.Send();
             }
             for (int playerIndex = 0; playerIndex < 255; playerIndex++)
             {
                 if (Main.player[playerIndex].active)
                 {
                     Player  player       = Main.player[playerIndex];
                     int     speed        = 12;
                     float   spawnX       = Main.rand.Next(1000) - 500 + player.Center.X;
                     float   spawnY       = -1000 + player.Center.Y;
                     var     baseSpawn    = new Vector2(spawnX, spawnY);
                     Vector2 baseVelocity = player.Center - baseSpawn;
                     baseVelocity.Normalize();
                     baseVelocity = baseVelocity * speed;
                     var identities = new List <int>();
                     for (int i = 0; i < VolcanoProjectiles; i++)
                     {
                         Vector2 spawn = baseSpawn;
                         spawn.X = spawn.X + i * 30 - VolcanoProjectiles * 15;
                         Vector2 velocity = baseVelocity;
                         velocity   = baseVelocity.RotatedBy(MathHelper.ToRadians(-VolcanoAngleSpread / 2 + VolcanoAngleSpread * i / (float)VolcanoProjectiles));
                         velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f;
                         int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), 10, 10f, Main.myPlayer, 0f, 0f);
                         Main.projectile[projectile].hostile = true;
                         Main.projectile[projectile].Name    = "Volcanic Rubble";
                         identities.Add(Main.projectile[projectile].identity);
                     }
                     if (Main.netMode == NetmodeID.Server)
                     {
                         var netMessage = mod.GetPacket();
                         netMessage.Write((byte)ExampleModMessageType.VolcanicRubbleMultiplayerFix);
                         netMessage.Write(identities.Count);
                         for (int i = 0; i < identities.Count; i++)
                         {
                             netMessage.Write(identities[i]);
                         }
                         netMessage.Send();
                     }
                 }
             }
         }
     }
 }
Пример #10
0
        public override void SetDefaults(Item item)
        {
            Mod Calamity = ModLoader.GetMod("CalamityMod");

            // Axes //
            // Cobalt Axe
            if (item.type == ItemID.CobaltWaraxe && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage    = 72;   // From 33
                item.knockBack = 5.5f; // From 5
            }

            // Palladium Axe
            if (item.type == ItemID.PalladiumWaraxe && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 72; // From 36
            }

            // Mythril Axe
            if (item.type == ItemID.MythrilWaraxe && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage    = 82;   // From 39
                item.knockBack = 6.5f; // From 6
            }

            // Orichalcum Axe
            if (item.type == ItemID.OrichalcumWaraxe && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 82; // From 41
            }

            // Adamantite Axe
            if (item.type == ItemID.AdamantiteWaraxe && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage    = 88;   // From 43
                item.knockBack = 7.5f; // From 7
            }

            // Titanium Axe
            if (item.type == ItemID.TitaniumWaraxe && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 88; // From 44
            }

            // Repeaters //
            // Cobalt Repeater
            if (item.type == ItemID.CobaltRepeater && Calamity == null && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage    = 43;    // From 32
                item.knockBack = 1.75f; // From 1.5
            }

            // Palladium Repeater
            if (item.type == ItemID.PalladiumRepeater && Calamity == null && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 43; // From 34
            }

            // Mythril Repeater
            if (item.type == ItemID.MythrilRepeater && Calamity == null && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 48; // From 36
            }

            // Orichalcum Repeater
            if (item.type == ItemID.OrichalcumRepeater && Calamity == null && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 48; // From 38
            }

            // Adamantite Repeater
            if (item.type == ItemID.AdamantiteRepeater && Calamity == null && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 51; // From 40
            }

            // Titanium Repeater
            if (item.type == ItemID.TitaniumRepeater && Calamity == null && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 51; // From 41
            }

            // Hallowed Repeater
            if (item.type == ItemID.HallowedRepeater && Calamity == null && ModContent.GetInstance <Config>().VanillaBuffs)
            {
                item.damage = 54; // From 43
            }
        }