public override void Load() { for (int k = 1; k <= 4; k++) { AddBossHeadTexture(captiveElementHead + k); AddBossHeadTexture(captiveElement2Head + k); } RandomBuffHotKey = RegisterHotKey("Random Buff", "P"); FaceCustomCurrencyID = CustomCurrencyManager.RegisterCurrency(new ExampleCustomCurrency(ItemType <Items.Face>(), 999L)); if (!Main.dedServ) { AddEquipTexture(null, EquipType.Legs, "ExampleRobe_Legs", "ExampleMod/Items/Armor/ExampleRobe_Legs"); //Main.music[MusicID.Dungeon].ModMusic = GetSound("Sounds/Music/ExampleMusic").CreateInstance(); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic"), ItemType("ExampleMusicBox"), TileType("ExampleMusicBox")); Main.instance.LoadTiles(TileID.Loom); Main.tileTexture[TileID.Loom] = GetTexture("Tiles/AnimatedLoom"); // What if....Replace a vanilla item texture and equip texture. //Main.itemTexture[ItemID.CopperHelmet] = GetTexture("Resprite/CopperHelmet_Item"); //Item copperHelmet = new Item(); //copperHelmet.SetDefaults(ItemID.CopperHelmet); //Main.armorHeadLoaded[copperHelmet.headSlot] = true; //Main.armorHeadTexture[copperHelmet.headSlot] = GetTexture("Resprite/CopperHelmet_Head"); Filters.Scene["ExampleMod:PuritySpirit"] = new Filter(new PuritySpiritScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.9f, 0.4f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["ExampleMod:PuritySpirit"] = new PuritySpiritSky(); Filters.Scene["ExampleMod:MonolithVoid"] = new Filter(new ScreenShaderData("FilterMoonLord"), EffectPriority.Medium); SkyManager.Instance["ExampleMod:MonolithVoid"] = new VoidSky(); exampleFont = GetFont("Fonts/ExampleFont"); exampleUI = new ExampleUI(); exampleUI.Activate(); exampleUserInterface = new UserInterface(); exampleUserInterface.SetState(exampleUI); } }
public override void Load() { for (int k = 1; k <= 4; k++) { AddBossHeadTexture(captiveElementHead + k); AddBossHeadTexture(captiveElement2Head + k); } RandomBuffHotKey = RegisterHotKey("Random Buff", "P"); FaceCustomCurrencyID = CustomCurrencyManager.RegisterCurrency(new ExampleCustomCurrency(ItemType <Items.Face>(), 999L)); if (!Main.dedServ) { AddEquipTexture(null, EquipType.Legs, "ExampleRobe_Legs", "ExampleMod/Items/Armor/ExampleRobe_Legs"); AddEquipTexture(new Items.Armor.BlockyHead(), null, EquipType.Head, "BlockyHead", "ExampleMod/Items/Armor/ExampleCostume_Head"); AddEquipTexture(new Items.Armor.BlockyBody(), null, EquipType.Body, "BlockyBody", "ExampleMod/Items/Armor/ExampleCostume_Body", "ExampleMod/Items/Armor/ExampleCostume_Arms"); AddEquipTexture(new Items.Armor.BlockyLegs(), null, EquipType.Legs, "BlockyLeg", "ExampleMod/Items/Armor/ExampleCostume_Legs"); //Main.music[MusicID.Dungeon].ModMusic = GetSound("Sounds/Music/ExampleMusic").CreateInstance(); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic"), ItemType("ExampleMusicBox"), TileType("ExampleMusicBox")); Main.instance.LoadTiles(TileID.Loom); Main.tileTexture[TileID.Loom] = GetTexture("Tiles/AnimatedLoom"); // What if....Replace a vanilla item texture and equip texture. //Main.itemTexture[ItemID.CopperHelmet] = GetTexture("Resprite/CopperHelmet_Item"); //Item copperHelmet = new Item(); //copperHelmet.SetDefaults(ItemID.CopperHelmet); //Main.armorHeadLoaded[copperHelmet.headSlot] = true; //Main.armorHeadTexture[copperHelmet.headSlot] = GetTexture("Resprite/CopperHelmet_Head"); Filters.Scene["ExampleMod:PuritySpirit"] = new Filter(new PuritySpiritScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.9f, 0.4f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["ExampleMod:PuritySpirit"] = new PuritySpiritSky(); Filters.Scene["ExampleMod:MonolithVoid"] = new Filter(new ScreenShaderData("FilterMoonLord"), EffectPriority.Medium); SkyManager.Instance["ExampleMod:MonolithVoid"] = new VoidSky(); // exampleFont = GetFont("Fonts/ExampleFont"); exampleEffect = GetEffect("Effects/ExampleEffect"); Ref <Effect> exampleEffectRef = new Ref <Effect>(); exampleEffectRef.Value = exampleEffect; GameShaders.Armor.BindShader <ArmorShaderData>(ItemType <Items.ExampleDye>(), new ArmorShaderData(exampleEffectRef, "ExampleDyePass")); exampleUI = new ExampleUI(); exampleUI.Activate(); exampleUserInterface = new UserInterface(); exampleUserInterface.SetState(exampleUI); } ModTranslation text = CreateTranslation("LivesLeft"); text.SetDefault("{0} has {1} lives left!"); AddTranslation(text); text = CreateTranslation("LifeLeft"); text.SetDefault("{0} has 1 life left!"); AddTranslation(text); text = CreateTranslation("NPCTalk"); text.SetDefault("<{0}> {1}"); AddTranslation(text); text = CreateTranslation("VolcanoWarning"); text.SetDefault("Did you hear something....A Volcano! Find Cover!"); AddTranslation(text); }
public override void Load() { instance = this; // Adds boss head textures for the Abomination boss for (int k = 1; k <= 4; k++) { AddBossHeadTexture(captiveElementHead + k); AddBossHeadTexture(captiveElement2Head + k); } // Registers a new hotkey RandomBuffHotKey = RegisterHotKey("Random Buff", "P"); // Registers a new custom currency FaceCustomCurrencyID = CustomCurrencyManager.RegisterCurrency(new ExampleCustomCurrency(ItemType <Items.Face>(), 999L)); // All code below runs only if we're not loading on a server if (!Main.dedServ) { // Add certain equip textures AddEquipTexture(null, EquipType.Legs, "ExampleRobe_Legs", "ExampleMod/Items/Armor/ExampleRobe_Legs"); AddEquipTexture(new Items.Armor.BlockyHead(), null, EquipType.Head, "BlockyHead", "ExampleMod/Items/Armor/ExampleCostume_Head"); AddEquipTexture(new Items.Armor.BlockyBody(), null, EquipType.Body, "BlockyBody", "ExampleMod/Items/Armor/ExampleCostume_Body", "ExampleMod/Items/Armor/ExampleCostume_Arms"); AddEquipTexture(new Items.Armor.BlockyLegs(), null, EquipType.Legs, "BlockyLeg", "ExampleMod/Items/Armor/ExampleCostume_Legs"); // Change the vanilla dungeon track // Main.music[MusicID.Dungeon] = GetMusic("Sounds/Music/DriveMusic"); // Register a new music box AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic"), ItemType("ExampleMusicBox"), TileType("ExampleMusicBox")); // Change the vailla loom texture Main.instance.LoadTiles(TileID.Loom); // First load the tile texture Main.tileTexture[TileID.Loom] = GetTexture("Tiles/AnimatedLoom"); // Now we change it //What if....Replace a vanilla item texture and equip texture. //Main.itemTexture[ItemID.CopperHelmet] = GetTexture("Resprite/CopperHelmet_Item"); //Item copperHelmet = new Item(); //copperHelmet.SetDefaults(ItemID.CopperHelmet); //Main.armorHeadLoaded[copperHelmet.headSlot] = true; //Main.armorHeadTexture[copperHelmet.headSlot] = GetTexture("Resprite/CopperHelmet_Head"); // Create new skies and screen filters Filters.Scene["ExampleMod:PuritySpirit"] = new Filter(new PuritySpiritScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.9f, 0.4f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["ExampleMod:PuritySpirit"] = new PuritySpiritSky(); Filters.Scene["ExampleMod:MonolithVoid"] = new Filter(new ScreenShaderData("FilterMoonLord"), EffectPriority.Medium); SkyManager.Instance["ExampleMod:MonolithVoid"] = new VoidSky(); // exampleFont = GetFont("Fonts/ExampleFont"); exampleEffect = GetEffect("Effects/ExampleEffect"); Ref <Effect> exampleEffectRef = new Ref <Effect>(); exampleEffectRef.Value = exampleEffect; GameShaders.Armor.BindShader <ArmorShaderData>(ItemType <Items.ExampleDye>(), new ArmorShaderData(exampleEffectRef, "ExampleDyePass")); // Custom UI exampleUI = new ExampleUI(); exampleUI.Activate(); exampleUserInterface = new UserInterface(); exampleUserInterface.SetState(exampleUI); } // Register custom mod translations, lives left is for Spirit of Purity ModTranslation text = CreateTranslation("LivesLeft"); text.SetDefault("{0} has {1} lives left!"); AddTranslation(text); text = CreateTranslation("LifeLeft"); text.SetDefault("{0} has 1 life left!"); AddTranslation(text); text = CreateTranslation("NPCTalk"); text.SetDefault("<{0}> {1}"); AddTranslation(text); // Volcano warning is for the random vulcano tremor text = CreateTranslation("VolcanoWarning"); text.SetDefault("Did you hear something....A Volcano! Find Cover!"); AddTranslation(text); }
public override void Load() { // Will show up in client.log under the ExampleMod name Logger.InfoFormat("{0} example logging", Name); // In older tModLoader versions we used: ErrorLogger.Log("blabla"); // Replace that with above // Registers a new hotkey RandomBuffHotKey = RegisterHotKey("Random Buff", "P"); // See https://docs.microsoft.com/en-us/previous-versions/windows/xna/bb197781(v%3dxnagamestudio.41) for special keys // Registers a new custom currency FaceCustomCurrencyId = CustomCurrencyManager.RegisterCurrency(new ExampleCustomCurrency(ModContent.ItemType <Items.Face>(), 999L)); Mundane.AddHacks(); // All code below runs only if we're not loading on a server if (!Main.dedServ) { // Add certain equip textures AddEquipTexture(null, EquipType.Legs, "ExampleRobe_Legs", "ExampleMod/Items/Armor/ExampleRobe_Legs"); AddEquipTexture(new Items.Armor.BlockyHead(), null, EquipType.Head, "BlockyHead", "ExampleMod/Items/Armor/ExampleCostume_Head"); AddEquipTexture(new Items.Armor.BlockyBody(), null, EquipType.Body, "BlockyBody", "ExampleMod/Items/Armor/ExampleCostume_Body", "ExampleMod/Items/Armor/ExampleCostume_Arms"); AddEquipTexture(new Items.Armor.BlockyLegs(), null, EquipType.Legs, "BlockyLeg", "ExampleMod/Items/Armor/ExampleCostume_Legs"); // Register a new music box AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/MarbleGallery"), ItemType("ExampleMusicBox"), TileType("ExampleMusicBox")); // Change the vanilla loom texture Main.instance.LoadTiles(TileID.Loom); // First load the tile texture Main.tileTexture[TileID.Loom] = GetTexture("Tiles/AnimatedLoom"); // Now we change it //What if....Replace a vanilla item texture and equip texture. //Main.itemTexture[ItemID.CopperHelmet] = GetTexture("Resprite/CopperHelmet_Item"); //Item copperHelmet = new Item(); //copperHelmet.SetDefaults(ItemID.CopperHelmet); //Main.armorHeadLoaded[copperHelmet.headSlot] = true; //Main.armorHeadTexture[copperHelmet.headSlot] = GetTexture("Resprite/CopperHelmet_Head"); // Create new skies and screen filters Filters.Scene["ExampleMod:PuritySpirit"] = new Filter(new PuritySpiritScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.9f, 0.4f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["ExampleMod:PuritySpirit"] = new PuritySpiritSky(); Filters.Scene["ExampleMod:MonolithVoid"] = new Filter(new ScreenShaderData("FilterMoonLord"), EffectPriority.Medium); SkyManager.Instance["ExampleMod:MonolithVoid"] = new VoidSky(); GameShaders.Armor.BindShader(ModContent.ItemType <Items.ExampleDye>(), new ArmorShaderData(new Ref <Effect>(GetEffect("Effects/ExampleEffect")), "ExampleDyePass")); GameShaders.Hair.BindShader(ModContent.ItemType <Items.ExampleHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Green)); GameShaders.Misc["ExampleMod:DeathAnimation"] = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/ExampleEffectDeath")), "DeathAnimation").UseImage("Images/Misc/Perlin"); if (FontExists("Fonts/ExampleFont")) { exampleFont = GetFont("Fonts/ExampleFont"); } // Custom UI ExampleUI = new ExampleUI(); ExampleUI.Activate(); _exampleUserInterface = new UserInterface(); _exampleUserInterface.SetState(ExampleUI); // Custom Resource Bar ExampleResourceBar = new ExampleResourceBar(); _exampleResourceBarUserInterface = new UserInterface(); _exampleResourceBarUserInterface.SetState(ExampleResourceBar); // UserInterface can only show 1 UIState at a time. If you want different "pages" for a UI, switch between UIStates on the same UserInterface instance. // We want both the Coin counter and the Example Person UI to be independent and coexist simultaneously, so we have them each in their own UserInterface. ExamplePersonUserInterface = new UserInterface(); // We will call .SetState later in ExamplePerson.OnChatButtonClicked } // Register custom mod translations, lives left is for Spirit of Purity // See the .lang files in the Localization folder for an easier to manage approach to translations. These few examples are here just to illustrate the concept. ModTranslation text = CreateTranslation("LivesLeft"); text.SetDefault("{0} has {1} lives left!"); AddTranslation(text); text = CreateTranslation("LifeLeft"); text.SetDefault("{0} has 1 life left!"); AddTranslation(text); text = CreateTranslation("NPCTalk"); text.SetDefault("<{0}> {1}"); AddTranslation(text); text = CreateTranslation("Common.LocalizedLabelDynamic"); text.SetDefault($"[i:{ModContent.ItemType<Items.Weapons.SpectreGun>()}] This dynamic label is added in ExampleMod.Load"); AddTranslation(text); // Volcano warning is for the random volcano tremor text = CreateTranslation("VolcanoWarning"); text.SetDefault("Did you hear something....A Volcano! Find Cover!"); AddTranslation(text); }
public override void Load() { instance = this; // Will show up in client.log under the ExampleMod name Logger.InfoFormat("{0} example logging", this.Name); // ErrorLogger.Log("blabla"); REPLACE THIS WITH ABOVE // Adds boss head textures for the Abomination boss for (int k = 1; k <= 4; k++) { AddBossHeadTexture(captiveElementHead + k); AddBossHeadTexture(captiveElement2Head + k); } // Registers a new hotkey RandomBuffHotKey = RegisterHotKey("Random Buff", "P"); // See https://docs.microsoft.com/en-us/previous-versions/windows/xna/bb197781(v%3dxnagamestudio.41) for special keys // Registers a new custom currency FaceCustomCurrencyID = CustomCurrencyManager.RegisterCurrency(new ExampleCustomCurrency(ItemType <Items.Face>(), 999L)); // All code below runs only if we're not loading on a server if (!Main.dedServ) { // Add certain equip textures AddEquipTexture(null, EquipType.Legs, "ExampleRobe_Legs", "ExampleMod/Items/Armor/ExampleRobe_Legs"); AddEquipTexture(new Items.Armor.BlockyHead(), null, EquipType.Head, "BlockyHead", "ExampleMod/Items/Armor/ExampleCostume_Head"); AddEquipTexture(new Items.Armor.BlockyBody(), null, EquipType.Body, "BlockyBody", "ExampleMod/Items/Armor/ExampleCostume_Body", "ExampleMod/Items/Armor/ExampleCostume_Arms"); AddEquipTexture(new Items.Armor.BlockyLegs(), null, EquipType.Legs, "BlockyLeg", "ExampleMod/Items/Armor/ExampleCostume_Legs"); // Change the vanilla dungeon track // Main.music[MusicID.Dungeon] = GetMusic("Sounds/Music/DriveMusic"); // Register a new music box AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic"), ItemType("ExampleMusicBox"), TileType("ExampleMusicBox")); // Change the vanilla loom texture Main.instance.LoadTiles(TileID.Loom); // First load the tile texture Main.tileTexture[TileID.Loom] = GetTexture("Tiles/AnimatedLoom"); // Now we change it //What if....Replace a vanilla item texture and equip texture. //Main.itemTexture[ItemID.CopperHelmet] = GetTexture("Resprite/CopperHelmet_Item"); //Item copperHelmet = new Item(); //copperHelmet.SetDefaults(ItemID.CopperHelmet); //Main.armorHeadLoaded[copperHelmet.headSlot] = true; //Main.armorHeadTexture[copperHelmet.headSlot] = GetTexture("Resprite/CopperHelmet_Head"); // Create new skies and screen filters Filters.Scene["ExampleMod:PuritySpirit"] = new Filter(new PuritySpiritScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.9f, 0.4f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["ExampleMod:PuritySpirit"] = new PuritySpiritSky(); Filters.Scene["ExampleMod:MonolithVoid"] = new Filter(new ScreenShaderData("FilterMoonLord"), EffectPriority.Medium); SkyManager.Instance["ExampleMod:MonolithVoid"] = new VoidSky(); // exampleFont = GetFont("Fonts/ExampleFont"); GameShaders.Armor.BindShader(ItemType <Items.ExampleDye>(), new ArmorShaderData(new Ref <Effect>(GetEffect("Effects/ExampleEffect")), "ExampleDyePass")); GameShaders.Misc["ExampleMod:DeathAnimation"] = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/ExampleEffectDeath")), "DeathAnimation").UseImage("Images/Misc/Perlin"); // Custom UI exampleUI = new ExampleUI(); exampleUI.Activate(); exampleUserInterface = new UserInterface(); exampleUserInterface.SetState(exampleUI); // UserInterface can only show 1 UIState at a time. If you want different "pages" for a UI, switch between UIStates on the same UserInterface instance. // We want both the Coin counter and the Example Person UI to be independent and coexist simultaneously, so we have them each in their own UserInterface. examplePersonUserInterface = new UserInterface(); // We will call .SetState later in ExamplePerson.OnChatButtonClicked } // Register custom mod translations, lives left is for Spirit of Purity ModTranslation text = CreateTranslation("LivesLeft"); text.SetDefault("{0} has {1} lives left!"); AddTranslation(text); text = CreateTranslation("LifeLeft"); text.SetDefault("{0} has 1 life left!"); AddTranslation(text); text = CreateTranslation("NPCTalk"); text.SetDefault("<{0}> {1}"); AddTranslation(text); // Volcano warning is for the random volcano tremor text = CreateTranslation("VolcanoWarning"); text.SetDefault("Did you hear something....A Volcano! Find Cover!"); AddTranslation(text); }
public override void Load() { for (int k = 1; k <= 4; k++) { AddBossHeadTexture(captiveElementHead + k); AddBossHeadTexture(captiveElement2Head + k); } RandomBuffHotKey = RegisterHotKey("Random Buff", "P"); FaceCustomCurrencyID = CustomCurrencyManager.RegisterCurrency(new ExampleCustomCurrency(ItemType<Items.Face>(), 999L)); if (!Main.dedServ) { AddEquipTexture(null, EquipType.Legs, "ExampleRobe_Legs", "ExampleMod/Items/Armor/ExampleRobe_Legs"); //Main.music[MusicID.Dungeon].ModMusic = GetSound("Sounds/Music/ExampleMusic").CreateInstance(); AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic"), ItemType("ExampleMusicBox"), TileType("ExampleMusicBox")); Main.instance.LoadTiles(TileID.Loom); Main.tileTexture[TileID.Loom] = GetTexture("Tiles/AnimatedLoom"); // What if....Replace a vanilla item texture and equip texture. //Main.itemTexture[ItemID.CopperHelmet] = GetTexture("Resprite/CopperHelmet_Item"); //Item copperHelmet = new Item(); //copperHelmet.SetDefaults(ItemID.CopperHelmet); //Main.armorHeadLoaded[copperHelmet.headSlot] = true; //Main.armorHeadTexture[copperHelmet.headSlot] = GetTexture("Resprite/CopperHelmet_Head"); Filters.Scene["ExampleMod:PuritySpirit"] = new Filter(new PuritySpiritScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.9f, 0.4f).UseOpacity(0.7f), EffectPriority.VeryHigh); SkyManager.Instance["ExampleMod:PuritySpirit"] = new PuritySpiritSky(); Filters.Scene["ExampleMod:MonolithVoid"] = new Filter(new ScreenShaderData("FilterMoonLord"), EffectPriority.Medium); SkyManager.Instance["ExampleMod:MonolithVoid"] = new VoidSky(); exampleFont = GetFont("Fonts/ExampleFont"); exampleUI = new ExampleUI(); exampleUI.Activate(); exampleUserInterface = new UserInterface(); exampleUserInterface.SetState(exampleUI); } }