Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
New Loot Merchant (disabled by default). Sells items needed to summon vanilla bosses (he will only sell what's needed for the next vanilla boss you haven't beaten and all vanilla bosses you haven't).
  • Loading branch information
dragon3025 authored Apr 12, 2019
1 parent 20bd5a6 commit 869901f
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
230 changes: 230 additions & 0 deletions NPCs/LootMerchant.cs
Original file line number Diff line number Diff line change
@@ -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<ReducedGrindingPlayer>();
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++;
}
}
}
}
}
Binary file added NPCs/LootMerchant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added NPCs/LootMerchant_Head.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions ReducedGrinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI)

bool AllNPCsSellTheirDeathLoot;
bool DryadSellsPlanteraBulbAfterPlanteraDefeated;
bool LootMerchant;
bool MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated;
bool MechanicSellsGeyserAfterWallofFleshDefeated;
bool WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1346,6 +1348,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI)

AllNPCsSellTheirDeathLoot,
DryadSellsPlanteraBulbAfterPlanteraDefeated,
LootMerchant,
MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated,
MechanicSellsGeyserAfterWallofFleshDefeated,
WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion ReducedGrindingPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -916,6 +917,7 @@ public ClientConf(

bool CC_AllNPCsSellTheirDeathLoot,
bool CC_DryadSellsPlanteraBulbAfterPlanteraDefeated,
bool CC_LootMerchant,
bool CC_MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated,
bool CC_MechanicSellsGeyserAfterWallofFleshDefeated,
bool CC_WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -2720,6 +2725,7 @@ public override void OnEnterWorld(Player player)

Config.AllNPCsSellTheirDeathLoot,
Config.DryadSellsPlanteraBulbAfterPlanteraDefeated,
Config.LootMerchant,
Config.MechanicSellsDartTrapAndSpikesAfterSkeletronDefeated,
Config.MechanicSellsGeyserAfterWallofFleshDefeated,
Config.WitchDoctorSellsLihzahrdTrapsAfterGolemDefeated,
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 869901f

Please sign in to comment.