Advertisement
Guest User

How to replace Calamity Music

a guest
Dec 23rd, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 11.58 KB | None | 0 0
  1.  
  2. using Terraria;
  3. using Terraria.ModLoader;
  4. using Terraria.ID;
  5.  
  6. namespace CalamituffMusic
  7. {
  8.     class CalamituffMusic : Mod
  9.     {
  10.         public CalamituffMusic()
  11.         {
  12.         }
  13.  
  14.         bool yharon3 = false;
  15.         public override void UpdateMusic(ref int music, ref MusicPriority priority)
  16.         {
  17.             Mod calamityMod = ModLoader.GetMod("CalamityMod");
  18.             bool yharon2 = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetBossDowned", "buffedeclipse") ?? false;
  19.             int scalIndex = NPC.FindFirstNPC(calamityMod.NPCType("SupremeCalamitas"));
  20.             if (scalIndex > -1 && Main.npc[scalIndex].modNPC is ModNPC scal)
  21.             {
  22.                 if (NPC.AnyNPCs(calamityMod.NPCType("SupremeCalamitas")))
  23.                 {
  24.                     if (scal.npc.life <= scal.npc.lifeMax / 100)
  25.                     {
  26.                         music = GetSoundSlot(SoundType.Music, "Sounds/Music/Acceptance");
  27.                         priority = MusicPriority.BossMedium;
  28.                     }
  29.                     if (scal.npc.life <= scal.npc.lifeMax / 3.33333333333 && scal.npc.life >= scal.npc.lifeMax / 100)
  30.                     {
  31.                         music = GetSoundSlot(SoundType.Music, "Sounds/Music/Epiphany");
  32.                         priority = MusicPriority.BossMedium;
  33.                     }
  34.                     if (scal.npc.life <= scal.npc.lifeMax / 2 && scal.npc.life >= scal.npc.lifeMax / 3.33333333333)
  35.                     {
  36.                         music = GetSoundSlot(SoundType.Music, "Sounds/Music/Lament");
  37.                         priority = MusicPriority.BossMedium;
  38.                     }
  39.                     if (scal.npc.life >= scal.npc.lifeMax / 2)
  40.                     {
  41.                         music = GetSoundSlot(SoundType.Music, "Sounds/Music/Grief");
  42.                         priority = MusicPriority.BossMedium;
  43.                     }
  44.                 }
  45.             }
  46.             int yharonIndex = NPC.FindFirstNPC(calamityMod.NPCType("Yharon"));
  47.             if (yharonIndex > -1 && Main.npc[yharonIndex].modNPC is ModNPC yharon)
  48.             {
  49.                 if (NPC.AnyNPCs(calamityMod.NPCType("Yharon")) && yharon2)
  50.                 {
  51.                     if (yharon.npc.life >= yharon.npc.lifeMax / 10)
  52.                     {
  53.                         music = GetSoundSlot(SoundType.Music, "Sounds/Music/Yharon2");
  54.                         priority = MusicPriority.BossMedium;
  55.                     }
  56.                 }
  57.                 if (!yharon3 && yharon.npc.life <= yharon.npc.lifeMax / 10)
  58.                 {
  59.                     yharon3 = true;
  60.                 }
  61.                 if (yharon3)
  62.                 {
  63.                     music = GetSoundSlot(SoundType.Music, "Sounds/Music/Yharon3");
  64.                     priority = MusicPriority.BossHigh;
  65.                 }
  66.             }
  67.             bool incrags = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetInZone", Main.LocalPlayer, "crags") ?? false;
  68.             bool inastral = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetInZone", Main.LocalPlayer, "astral") ?? false;
  69.             bool insulphur = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetInZone", Main.LocalPlayer, "sulphursea") ?? false;
  70.             bool insunken = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetInZone", Main.LocalPlayer, "sunkensea") ?? false;
  71.             bool inabyss = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetInZone", Main.LocalPlayer, "abyss") ?? false;
  72.             bool inlayer3 = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetInZone", Main.LocalPlayer, "layer3") ?? false;
  73.             bool inlayer4 = (bool?)ModLoader.GetMod("CalamityMod")?.Call("GetInZone", Main.LocalPlayer, "layer4") ?? false;
  74.  
  75.             if (incrags)
  76.             {
  77.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/BrimstoneCrags");
  78.                 priority = MusicPriority.Environment;
  79.             }
  80.  
  81.             if (inastral && !Main.player[Main.myPlayer].ZoneDirtLayerHeight)
  82.             {
  83.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/AstralInfection");
  84.                 priority = MusicPriority.Environment;
  85.             }
  86.  
  87.             if (inastral && Main.player[Main.myPlayer].ZoneDirtLayerHeight)
  88.             {
  89.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/AstralUnderground");
  90.                 priority = MusicPriority.Environment;
  91.             }
  92.  
  93.             if (insunken)
  94.             {
  95.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea");
  96.                 priority = MusicPriority.Environment;
  97.             }
  98.  
  99.             if (insulphur)
  100.             {
  101.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/SulphurSea");
  102.                 priority = MusicPriority.Environment;
  103.             }
  104.  
  105.             if (inabyss)
  106.             {
  107.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Abyss1");
  108.                 priority = MusicPriority.Environment;
  109.             }
  110.  
  111.             if (inlayer3)
  112.             {
  113.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Abyss2");
  114.                 priority = MusicPriority.Environment;
  115.             }
  116.  
  117.             if (inlayer4)
  118.             {
  119.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Abyss3");
  120.                 priority = MusicPriority.Environment;
  121.             }
  122.  
  123.             if (NPC.AnyNPCs(NPCID.KingSlime))
  124.             {
  125.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/KingSlime");
  126.                 priority = MusicPriority.BossMedium;
  127.             }
  128.  
  129.             if (NPC.AnyNPCs(NPCID.EyeofCthulhu))
  130.             {
  131.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/EyeOfCthulhu");
  132.                 priority = MusicPriority.BossMedium;
  133.             }
  134.  
  135.             if (NPC.AnyNPCs(NPCID.EaterofWorldsHead))
  136.             {
  137.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/EaterOfWorlds");
  138.                 priority = MusicPriority.BossMedium;
  139.             }
  140.  
  141.             if (NPC.AnyNPCs(NPCID.BrainofCthulhu))
  142.             {
  143.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/BrainOfCthulhu");
  144.                 priority = MusicPriority.BossMedium;
  145.             }
  146.  
  147.             if (NPC.AnyNPCs(NPCID.SkeletronHead))
  148.             {
  149.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Skeletron");
  150.                 priority = MusicPriority.BossMedium;
  151.             }
  152.  
  153.             if (NPC.AnyNPCs(NPCID.WallofFlesh))
  154.             {
  155.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/WallOfFlesh");
  156.                 priority = MusicPriority.BossMedium;
  157.             }
  158.  
  159.             if (NPC.AnyNPCs(NPCID.TheDestroyer))
  160.             {
  161.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Destroyer");
  162.                 priority = MusicPriority.BossMedium;
  163.             }
  164.  
  165.             if (NPC.AnyNPCs(NPCID.Retinazer) || NPC.AnyNPCs(NPCID.Spazmatism))
  166.             {
  167.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Twins");
  168.                 priority = MusicPriority.BossMedium;
  169.             }
  170.  
  171.             if (NPC.AnyNPCs(NPCID.SkeletronPrime))
  172.             {
  173.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/SkeletronPrime");
  174.                 priority = MusicPriority.BossMedium;
  175.             }
  176.  
  177.             if (NPC.AnyNPCs(calamityMod.NPCType("LeviathanStart")))
  178.             {
  179.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Siren");
  180.                 priority = MusicPriority.BossMedium;
  181.             }
  182.  
  183.             if (NPC.AnyNPCs(NPCID.CultistBoss))
  184.             {
  185.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/LunaticCultist");
  186.                 priority = MusicPriority.BossMedium;
  187.             }
  188.  
  189.             if (NPC.AnyNPCs(calamityMod.NPCType("Cnidrion")))
  190.             {
  191.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Cnidrion");
  192.                 priority = MusicPriority.BossLow;
  193.             }
  194.  
  195.             if (NPC.AnyNPCs(calamityMod.NPCType("DesertScourgeHead")))
  196.             {
  197.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge");
  198.                 priority = MusicPriority.BossMedium;
  199.             }
  200.  
  201.             if (NPC.AnyNPCs(calamityMod.NPCType("CrabulonIdle")))
  202.             {
  203.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon");
  204.                 priority = MusicPriority.BossMedium;
  205.             }
  206.  
  207.             if (NPC.AnyNPCs(calamityMod.NPCType("HiveMind")))
  208.             {
  209.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind");
  210.                 priority = MusicPriority.BossMedium;
  211.             }
  212.  
  213.             if (NPC.AnyNPCs(calamityMod.NPCType("HiveMindP2")))
  214.             {
  215.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind");
  216.                 priority = MusicPriority.BossMedium;
  217.             }
  218.  
  219.             if (NPC.AnyNPCs(calamityMod.NPCType("PerforatorHive")))
  220.             {
  221.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Perforator");
  222.                 priority = MusicPriority.BossMedium;
  223.             }
  224.  
  225.             if (NPC.AnyNPCs(calamityMod.NPCType("SlimeGodCore")) || NPC.AnyNPCs(calamityMod.NPCType("SlimeGod")) || NPC.AnyNPCs(calamityMod.NPCType("SlimeGodRun")))
  226.             {
  227.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod");
  228.                 priority = MusicPriority.BossMedium;
  229.             }
  230.  
  231.             if (NPC.AnyNPCs(calamityMod.NPCType("Cryogen")))
  232.             {
  233.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen");
  234.                 priority = MusicPriority.BossMedium;
  235.             }
  236.  
  237.             if (NPC.AnyNPCs(calamityMod.NPCType("BrimstoneElemental")))
  238.             {
  239.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/BrimstoneElemental");
  240.                 priority = MusicPriority.BossMedium;
  241.             }
  242.  
  243.             if (NPC.AnyNPCs(calamityMod.NPCType("AquaticScourgeHead")))
  244.             {
  245.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge");
  246.                 priority = MusicPriority.BossMedium;
  247.             }
  248.  
  249.             if (NPC.AnyNPCs(calamityMod.NPCType("Calamitas")))
  250.             {
  251.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas");
  252.                 priority = MusicPriority.BossMedium;
  253.             }
  254.  
  255.             if (NPC.AnyNPCs(calamityMod.NPCType("CalamitasRun3")))
  256.             {
  257.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas2");
  258.                 priority = MusicPriority.BossMedium;
  259.             }
  260.  
  261.             if (NPC.AnyNPCs(calamityMod.NPCType("Siren")))
  262.             {
  263.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Siren2");
  264.                 priority = MusicPriority.BossMedium;
  265.             }
  266.  
  267.             if (NPC.AnyNPCs(calamityMod.NPCType("Leviathan")))
  268.             {
  269.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Leviathan");
  270.                 priority = MusicPriority.BossMedium;
  271.             }
  272.  
  273.             if (NPC.AnyNPCs(calamityMod.NPCType("AstrumAureus")))
  274.             {
  275.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Aureus");
  276.                 priority = MusicPriority.BossMedium;
  277.             }
  278.  
  279.             if (NPC.AnyNPCs(calamityMod.NPCType("PlaguebringerGoliath")))
  280.             {
  281.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Plaguebringer");
  282.                 priority = MusicPriority.BossMedium;
  283.             }
  284.  
  285.             if (NPC.AnyNPCs(calamityMod.NPCType("RavagerBody")))
  286.             {
  287.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager");
  288.                 priority = MusicPriority.BossMedium;
  289.             }
  290.  
  291.             if (NPC.AnyNPCs(calamityMod.NPCType("AstrumDeusHeadSpectral")))
  292.             {
  293.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus");
  294.                 priority = MusicPriority.BossMedium;
  295.             }
  296.  
  297.             if (NPC.AnyNPCs(calamityMod.NPCType("ProfanedGuardianBoss")))
  298.             {
  299.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/ProfanedGuardians");
  300.                 priority = MusicPriority.BossMedium;
  301.             }
  302.  
  303.             if (NPC.AnyNPCs(calamityMod.NPCType("Providence")))
  304.             {
  305.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Providence");
  306.                 priority = MusicPriority.BossMedium;
  307.             }
  308.  
  309.             if (NPC.AnyNPCs(calamityMod.NPCType("Bumblefuck")))
  310.             {
  311.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Dragonfolly");
  312.                 priority = MusicPriority.BossMedium;
  313.             }
  314.  
  315.             if (NPC.AnyNPCs(calamityMod.NPCType("Polterghast")))
  316.             {
  317.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Polterghast");
  318.                 priority = MusicPriority.BossMedium;
  319.             }
  320.  
  321.             if (NPC.AnyNPCs(calamityMod.NPCType("OldDuke")))
  322.             {
  323.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/OldDuke");
  324.                 priority = MusicPriority.BossMedium;
  325.             }
  326.  
  327.             if (NPC.AnyNPCs(calamityMod.NPCType("StormWeaverHead")))
  328.             {
  329.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/StormWeaver");
  330.                 priority = MusicPriority.BossMedium;
  331.             }
  332.  
  333.             if (NPC.AnyNPCs(calamityMod.NPCType("StormWeaverHeadNaked")))
  334.             {
  335.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/StormWeaver");
  336.                 priority = MusicPriority.BossMedium;
  337.             }
  338.  
  339.             if (NPC.AnyNPCs(calamityMod.NPCType("CeaselessVoid")))
  340.             {
  341.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/CeaselessVoid");
  342.                 priority = MusicPriority.BossMedium;
  343.             }
  344.  
  345.             if (NPC.AnyNPCs(calamityMod.NPCType("Signus")))
  346.             {
  347.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Signus");
  348.                 priority = MusicPriority.BossMedium;
  349.             }
  350.  
  351.             if (NPC.AnyNPCs(calamityMod.NPCType("DevourerofGodsHead")))
  352.             {
  353.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/DevourerOfGods");
  354.                 priority = MusicPriority.BossMedium;
  355.             }
  356.  
  357.             if (NPC.AnyNPCs(calamityMod.NPCType("DevourerofGodsHeadS")))
  358.             {
  359.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/DoG2");
  360.                 priority = MusicPriority.BossMedium;
  361.             }
  362.  
  363.             if (NPC.AnyNPCs(calamityMod.NPCType("Yharon")) && yharon2 == false)
  364.             {
  365.                 music = GetSoundSlot(SoundType.Music, "Sounds/Music/Yharon1");
  366.                 priority = MusicPriority.BossMedium;
  367.             }
  368.         }
  369.     }
  370. }
  371.  
  372.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement