allowed discount card effect to apply to most items that Calamity adds
This commit is contained in:
1 parent
46bc91f9bc
commit
7e39efc84c
5 files changed
+32
-1
No files matched your search
@@ -1384,7 +1384,7 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetShopItem(ref Chest shop, ref int nextSlot, int itemID, bool condition = true, int? price = null)
|
||||
public static void SetShopItem(ref Chest shop, ref int nextSlot, int itemID, bool condition = true, int? price = null, bool ignoreDiscount = false)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
@@ -1392,6 +1392,8 @@ namespace CalamityMod.NPCs
|
||||
if (price != null)
|
||||
{
|
||||
shop.item[nextSlot].shopCustomPrice = price;
|
||||
if (Main.LocalPlayer.discount && !ignoreDiscount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
}
|
||||
|
||||
nextSlot++;
|
||||
|
||||
@@ -128,6 +128,8 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemID.WarmthPotion);
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<ColdheartIcicle>());
|
||||
nextSlot++;
|
||||
@@ -167,6 +169,8 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<Popo>());
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
if (Main.LocalPlayer.HasItem(ModContent.ItemType<IceBarrage>()))
|
||||
{
|
||||
|
||||
@@ -275,6 +275,8 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
|
||||
public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original alcohol value
|
||||
{
|
||||
// All prices are manually set. This means the Discount Card does not work.
|
||||
// Cirrus doesn't accept your card.
|
||||
shop.item[nextSlot].SetDefaults(ItemID.HeartreachPotion);
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0);
|
||||
nextSlot++;
|
||||
|
||||
@@ -365,29 +365,41 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemID.GillsPotion);
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemID.WaterWalkingPotion);
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemID.FlipperPotion);
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
if (CalamityWorld.downedEoCAcidRain)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<CausticTear>());
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(gold: 3);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
}
|
||||
if (NPC.downedFishron)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm);
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
}
|
||||
if (CalamityWorld.downedBoomerDuke)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<BloodwormItem>());
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0);
|
||||
if (Main.LocalPlayer.discount)
|
||||
shop.item[nextSlot].shopCustomPrice = (int)(shop.item[nextSlot].shopCustomPrice * 0.8);
|
||||
nextSlot++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +245,8 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
|
||||
public override void SetupShop(Chest shop, ref int nextSlot)
|
||||
{
|
||||
// All prices are manually set. This means the Discount Card does not work.
|
||||
// The Bandit doesn't believe in discounts.
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<Cinquedea>());
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 9, 0, 0);
|
||||
nextSlot++;
|
||||
@@ -258,6 +260,7 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 40, 0, 0);
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemID.TigerClimbingGear);
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemID.InvisibilityPotion);
|
||||
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0);
|
||||
@@ -271,6 +274,7 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
if (CalamityWorld.downedSlimeGod)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<GelDart>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.hardMode)
|
||||
@@ -294,22 +298,28 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
if (NPC.downedMechBossAny)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<BouncingBetty>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<LatcherMine>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
}
|
||||
if (CalamityWorld.downedCalamitas)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<DeepWounder>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
}
|
||||
if (NPC.downedPlantBoss)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<MonkeyDarts>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<GloveOfPrecision>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<GloveOfRecklessness>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
}
|
||||
if (NPC.downedGolemBoss)
|
||||
@@ -344,6 +354,7 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
}
|
||||
//:BearWatchingYou:
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<BearEye>());
|
||||
shop.item[nextSlot].shopCustomPrice = shop.item[nextSlot].value;
|
||||
nextSlot++;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user