Issue with checking for Expert/Master mode

orangepecan

Terrarian
So I'm trying to add drops to a few vanilla bosses and running into issues with the non-expert/master drop. Quite simply this stops my item from dropping period, even on classic mode. Not sure what I'm doing wrong here.

My code:

Code:
if (!Main.GameModeInfo.IsExpertMode && !Main.GameModeInfo.IsMasterMode)
{
    if (npc.type == NPCID.KingSlime || npc.type == NPCID.EyeofCthulhu)
    {
        npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<Items.FleshySubstance>(), 1, 1, 3));
    }
    else if (npc.type == NPCID.Golem)
    {
        npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<Items.PowerCoreFragment>(), 1, 1, 3));
    }
    else if (npc.type == NPCID.MoonLordCore)
    {
        npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<Items.CosmicEssence>(), 1, 1, 3));
    }
}

EDIT: I think I figured it out. Looks like you have to use the ByCondition method in order to make this work.

Code:
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
{
    if (npc.type == NPCID.KingSlime || npc.type == NPCID.EyeofCthulhu)
    {
        npcLoot.Add(ItemDropRule.ByCondition(Condition.InClassicMode.ToDropCondition(ShowItemDropInUI.Always), ModContent.ItemType<Items.FleshySubstance>(), 1, 1, 3));
    }
    else if (npc.type == NPCID.Golem)
    {
        npcLoot.Add(ItemDropRule.ByCondition(Condition.InClassicMode.ToDropCondition(ShowItemDropInUI.Always), ModContent.ItemType<Items.PowerCoreFragment>(), 1, 1, 3));
    }
    else if (npc.type == NPCID.MoonLordCore)
    {
        npcLoot.Add(ItemDropRule.ByCondition(Condition.InClassicMode.ToDropCondition(ShowItemDropInUI.Always), ModContent.ItemType<Items.CosmicEssence>(), 1, 1, 3));
    }
}
 
Last edited:
Back
Top Bottom