diff --git a/Config.cs b/Config.cs index 158cef42..768b8b66 100644 --- a/Config.cs +++ b/Config.cs @@ -8,7 +8,7 @@ namespace ReducedGrinding { public static class Config { - static string filename = "Reduced Grinding v4.58.json"; + static string filename = "Reduced Grinding v4.59.json"; public static int DropTriesForAllEnemyDroppedLoot = 1; public static float NormalModeLootMultiplierForLootWithSeperateDifficultyRates = 0.5f; @@ -398,6 +398,7 @@ public static class Config public static bool AllNPCsSellTheirDeathLoot = false; public static bool DryadSellsPlanteraBulbAfterPlanteraDefeated = true; + public static bool LootMerchant = false; public static bool MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated = true; public static bool MechanicSellsGeyserAfterWallofFleshDefeated = true; public static bool WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated = true; @@ -414,7 +415,7 @@ public static class Config public static bool WitchDoctorSellsSeaweed = false; public static bool WitchDoctorSellsStaffofRegrowth = false; public static int TaxCollectorMinTaxRequiredToChatTaxEachMorningAndNight = 50000; - + public static bool GoblinTinkererSellsGoblinRetreatOrder = true; public static bool MerchantSellsGoldReflectionMirrorForCraftingGoldCrittersItem = false; public static bool PirateSellsPirateRetreatOrder = true; @@ -867,6 +868,7 @@ static bool ReadConfig() Configuration.Get("MerchantSellsPyramidItems", ref MerchantSellsPyramidItems); Configuration.Get("MerchantSellsSandstormInABottleWhenInDesert", ref MerchantSellsSandstormInABottleWhenInDesert); Configuration.Get("TaxCollectorMinTaxRequiredToChatTaxEachMorningAndNight", ref TaxCollectorMinTaxRequiredToChatTaxEachMorningAndNight); + Configuration.Get("LootMerchant", ref LootMerchant); Configuration.Get("MerchantSellsSwiftnessPotion", ref MerchantSellsSwiftnessPotion); Configuration.Get("WitchDoctorSellsFlowerBoots", ref WitchDoctorSellsFlowerBoots); Configuration.Get("WitchDoctorSellsHoneyDispenser", ref WitchDoctorSellsHoneyDispenser); @@ -1328,6 +1330,7 @@ static void CreateConfig() Configuration.Put("=================================================================================================VS2", 0); Configuration.Put("AllNPCsSellTheirDeathLoot", AllNPCsSellTheirDeathLoot); Configuration.Put("DryadSellsPlanteraBulbAfterPlanteraDefeated", DryadSellsPlanteraBulbAfterPlanteraDefeated); + Configuration.Put("LootMerchant", LootMerchant); Configuration.Put("MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated", MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated); Configuration.Put("MechanicSellsGeyserAfterWallofFleshDefeated", MechanicSellsGeyserAfterWallofFleshDefeated); Configuration.Put("MerchantSellsAllMiningGear", MerchantSellsAllMiningGear); diff --git a/NPCs/LootMerchant.cs b/NPCs/LootMerchant.cs new file mode 100644 index 00000000..9ff6a306 --- /dev/null +++ b/NPCs/LootMerchant.cs @@ -0,0 +1,230 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace ReducedGrinding.NPCs +{ + [AutoloadHead] + public class LootMerchant : ModNPC + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Loot Merchant"); + } + + public override void SetDefaults() + { + npc.townNPC = true; + npc.friendly = true; + npc.width = 22; //His hitbox, the visual width/height is affected by frame count below. + npc.height = 42; + npc.aiStyle = 7; + npc.damage = 10; + npc.defense = 15; + npc.lifeMax = 250; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0.5f; + Main.npcFrameCount[npc.type] = 25; + animationType = NPCID.Merchant; + } + public override bool CanTownNPCSpawn(int numTownNPCs, int money) + { + ReducedGrindingPlayer mPlayer = Main.LocalPlayer.GetModPlayer(); + if (mPlayer.clientConf.LootMerchant) + return true; + else + return false; + } + + public override string TownNPCName() + { //NPC names + switch (Main.rand.Next(27)) + { + case 0: + return "Dalton"; + case 1: + return "Hall"; + case 2: + return "Zack"; + case 3: + return "Lewin"; + case 4: + return "Kenton"; + case 5: + return "James"; + case 6: + return "Kameron"; + case 7: + return "Reggie"; + case 8: + return "Murphy"; + case 9: + return "Harlan"; + case 10: + return "Manny"; + case 11: + return "Raine"; + case 12: + return "Buddy"; + case 13: + return "Carleton"; + case 14: + return "Gale"; + case 15: + return "Wilson"; + case 16: + return "Darien"; + case 17: + return "Cedric"; + case 18: + return "Walt"; + case 19: + return "Jensen"; + case 20: + return "Thorley"; + case 21: + return "Desmond"; + case 22: + return "Rylan"; + case 23: + return "Doug"; + case 24: + return "Ralf"; + case 25: + return "Oakley"; + default: + return "Dudley"; + } + } + + + + + public override string GetChat() + { + switch (Main.rand.Next(4)) + { + case 0: + return "I like to collect loot from monsters and a little mining, want to buy any?"; + case 1: + return "If you're looking for loot, you've come to the right place."; + case 2: + return "Looking for loot?"; + default: + return "You could kill some mobs for their loot, or you could buy them from me."; + } + } + + public override void SetChatButtons(ref string button, ref string button2) + { + button = "Shop"; + } + + public override void OnChatButtonClicked(bool firstButton, ref bool shop) + { + if (firstButton) + { + shop = true; + } + } + + public override void SetupShop(Chest shop, ref int nextSlot) + { + int gameProgress = 0; + if (NPC.downedSlimeKing) + gameProgress = 1; + if (NPC.downedBoss1) + gameProgress = 2; + if (NPC.downedBoss2) + gameProgress = 3; + if (NPC.downedBoss3) + gameProgress = 4; + if (Main.hardMode) + gameProgress = 5; + if (NPC.downedPlantBoss) + gameProgress = 6; + if (NPC.downedGolemBoss) + gameProgress = 7; + + shop.item[nextSlot].SetDefaults(ItemID.Gel); + nextSlot++; + if (WorldGen.goldBar == ItemID.GoldBar) + shop.item[nextSlot].SetDefaults(ItemID.GoldOre); + else + shop.item[nextSlot].SetDefaults(ItemID.PlatinumOre); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.Ruby); + nextSlot++; + if (gameProgress > 0) + { + shop.item[nextSlot].SetDefaults(ItemID.Lens); + nextSlot++; + } + if (gameProgress > 1) + { + if (WorldGen.crimson) + { + shop.item[nextSlot].SetDefaults(ItemID.ViciousPowder); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.Vertebrae); + nextSlot++; + } + else + { + shop.item[nextSlot].SetDefaults(ItemID.VilePowder); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.RottenChunk); + nextSlot++; + } + } + if (gameProgress > 2) + { + { + shop.item[nextSlot].SetDefaults(ItemID.BottledHoney); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.Stinger); + nextSlot++; + } + } + if (gameProgress > 3) + { + { + //While all other summon material is sold right before the next boss, this is sold after Skeletron, because it has no use until then. + shop.item[nextSlot].SetDefaults(ItemID.ClothierVoodooDoll); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.GuideVoodooDoll); + nextSlot++; + } + } + if (gameProgress > 4) + { + { + shop.item[nextSlot].SetDefaults(WorldGen.ironBar); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.SoulofLight); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.SoulofNight); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.Bone); + nextSlot++; + } + } + if (gameProgress > 5) + { + { + shop.item[nextSlot].SetDefaults(ItemID.LihzahrdPowerCell); + nextSlot++; + } + } + if (gameProgress > 6) + { + { + shop.item[nextSlot].SetDefaults(ItemID.TruffleWorm); + nextSlot++; + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/LootMerchant.png b/NPCs/LootMerchant.png new file mode 100644 index 00000000..60de5499 Binary files /dev/null and b/NPCs/LootMerchant.png differ diff --git a/NPCs/LootMerchant_Head.png b/NPCs/LootMerchant_Head.png new file mode 100644 index 00000000..dd83f1ea Binary files /dev/null and b/NPCs/LootMerchant_Head.png differ diff --git a/ReducedGrinding.cs b/ReducedGrinding.cs index 9845fc25..5e0a9561 100644 --- a/ReducedGrinding.cs +++ b/ReducedGrinding.cs @@ -432,6 +432,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI) bool AllNPCsSellTheirDeathLoot; bool DryadSellsPlanteraBulbAfterPlanteraDefeated; + bool LootMerchant; bool MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated; bool MechanicSellsGeyserAfterWallofFleshDefeated; bool WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated; @@ -904,6 +905,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI) AllNPCsSellTheirDeathLoot = reader.ReadBoolean(); DryadSellsPlanteraBulbAfterPlanteraDefeated = reader.ReadBoolean(); + LootMerchant = reader.ReadBoolean(); MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated = reader.ReadBoolean(); MechanicSellsGeyserAfterWallofFleshDefeated = reader.ReadBoolean(); WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated = reader.ReadBoolean(); @@ -1346,6 +1348,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI) AllNPCsSellTheirDeathLoot, DryadSellsPlanteraBulbAfterPlanteraDefeated, + LootMerchant, MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated, MechanicSellsGeyserAfterWallofFleshDefeated, WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated, @@ -1792,6 +1795,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI) AllNPCsSellTheirDeathLoot = reader.ReadBoolean(); DryadSellsPlanteraBulbAfterPlanteraDefeated = reader.ReadBoolean(); + LootMerchant = reader.ReadBoolean(); MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated = reader.ReadBoolean(); MechanicSellsGeyserAfterWallofFleshDefeated = reader.ReadBoolean(); WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated = reader.ReadBoolean(); @@ -2241,6 +2245,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI) packet.Write((bool)Config.AllNPCsSellTheirDeathLoot); packet.Write((bool)Config.DryadSellsPlanteraBulbAfterPlanteraDefeated); + packet.Write((bool)Config.LootMerchant); packet.Write((bool)Config.MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated); packet.Write((bool)Config.MechanicSellsGeyserAfterWallofFleshDefeated); packet.Write((bool)Config.WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated); diff --git a/ReducedGrindingPlayer.cs b/ReducedGrindingPlayer.cs index 179b049b..b724fefb 100644 --- a/ReducedGrindingPlayer.cs +++ b/ReducedGrindingPlayer.cs @@ -475,6 +475,7 @@ public struct ClientConf public bool AllNPCsSellTheirDeathLoot; public bool DryadSellsPlanteraBulbAfterPlanteraDefeated; + public bool LootMerchant; public bool MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated; public bool MechanicSellsGeyserAfterWallofFleshDefeated; public bool WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated; @@ -491,7 +492,7 @@ public struct ClientConf public bool WitchDoctorSellsSeaweed; public bool WitchDoctorSellsStaffofRegrowth; public int TaxCollectorMinTaxRequiredToChatTaxEachMorningAndNight; - + public bool GoblinTinkererSellsGoblinRetreatOrder; public bool MerchantSellsGoldReflectionMirrorForCraftingGoldCrittersItem; public bool PirateSellsPirateRetreatOrder; @@ -916,6 +917,7 @@ public ClientConf( bool CC_AllNPCsSellTheirDeathLoot, bool CC_DryadSellsPlanteraBulbAfterPlanteraDefeated, + bool CC_LootMerchant, bool CC_MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated, bool CC_MechanicSellsGeyserAfterWallofFleshDefeated, bool CC_WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated, @@ -1357,6 +1359,7 @@ float CC_ExtractinatorGivesTungstenOre AllNPCsSellTheirDeathLoot = CC_AllNPCsSellTheirDeathLoot; DryadSellsPlanteraBulbAfterPlanteraDefeated = CC_DryadSellsPlanteraBulbAfterPlanteraDefeated; + LootMerchant = CC_LootMerchant; MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated = CC_MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated; MechanicSellsGeyserAfterWallofFleshDefeated = CC_MechanicSellsGeyserAfterWallofFleshDefeated; WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated = CC_WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated; @@ -1830,6 +1833,7 @@ public override void SyncPlayer(int toWho, int fromWho, bool newPlayer) packet.Write((bool)Config.AllNPCsSellTheirDeathLoot); packet.Write((bool)Config.DryadSellsPlanteraBulbAfterPlanteraDefeated); + packet.Write((bool)Config.LootMerchant); packet.Write((bool)Config.MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated); packet.Write((bool)Config.MechanicSellsGeyserAfterWallofFleshDefeated); packet.Write((bool)Config.WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated); @@ -2271,6 +2275,7 @@ public override void SyncPlayer(int toWho, int fromWho, bool newPlayer) Config.AllNPCsSellTheirDeathLoot, Config.DryadSellsPlanteraBulbAfterPlanteraDefeated, + Config.LootMerchant, Config.MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated, Config.MechanicSellsGeyserAfterWallofFleshDefeated, Config.WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated, @@ -2720,6 +2725,7 @@ public override void OnEnterWorld(Player player) Config.AllNPCsSellTheirDeathLoot, Config.DryadSellsPlanteraBulbAfterPlanteraDefeated, + Config.LootMerchant, Config.MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated, Config.MechanicSellsGeyserAfterWallofFleshDefeated, Config.WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated, diff --git a/build.txt b/build.txt index af816154..0b61ba08 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Dragon3025 -version = 4.58 +version = 4.59 displayName = Reduced Grinding homepage = http://forums.terraria.org/index.php?threads/reduced-grinding.51082/ hideCode = false