Skip to content

Commit

Permalink
0.11.5 refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed Oct 6, 2019
1 parent 3735d9f commit 1f735a9
Show file tree
Hide file tree
Showing 288 changed files with 691 additions and 646 deletions.
16 changes: 8 additions & 8 deletions AssPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ private void SpawnSoulTemp()
if (tempSoulMinion && player.whoAmI == Main.myPlayer)
{
bool checkIfAlive = false;
int spawnedType = Main.hardMode ? mod.ProjectileType<CompanionDungeonSoulPostWOFMinion>() : mod.ProjectileType<CompanionDungeonSoulPreWOFMinion>();
int spawnedType = Main.hardMode ? ModContent.ProjectileType<CompanionDungeonSoulPostWOFMinion>() : ModContent.ProjectileType<CompanionDungeonSoulPreWOFMinion>();
int spawnedDamage = Main.hardMode ? (int)(EverhallowedLantern.BaseDmg * 1.1f * 2f) : ((EverhallowedLantern.BaseDmg / 2 - 1) * 2);
for (int i = 0; i < 1000; i++)
{
Expand Down Expand Up @@ -303,7 +303,7 @@ private void SpawnSoulsWhenHarvesterIsAlive()
{
if (Array.IndexOf(AssWorld.harvesterTypes, Main.npc[j].type) < 0 && EligibleToReceiveSoulBuff(Main.npc[j]))
{
Main.npc[j].AddBuff(mod.BuffType<SoulBuff>(), 60, true);
Main.npc[j].AddBuff(ModContent.BuffType<SoulBuff>(), 60, true);
}
}
}
Expand All @@ -319,8 +319,8 @@ public void ConvertInertSoulsInventory()
{
//this gets called once on server side for all players, and then each player calls it on itself client side
int tempStackCount;
int itemTypeOld = mod.ItemType<CaughtDungeonSoul>();
int itemTypeNew = mod.ItemType<CaughtDungeonSoulFreed>(); //version that is used in crafting
int itemTypeOld = ModContent.ItemType<CaughtDungeonSoul>();
int itemTypeNew = ModContent.ItemType<CaughtDungeonSoulFreed>(); //version that is used in crafting

Item[][] inventoryArray = { player.inventory, player.bank.item, player.bank2.item, player.bank3.item }; //go though player inv
for (int y = 0; y < inventoryArray.Length; y++)
Expand Down Expand Up @@ -484,7 +484,7 @@ public override void Initialize()
CircleUIList = new List<CircleUIHandler>
{
new CircleUIHandler(
triggerItem: AssUtils.Instance.ItemType<EverhallowedLantern>(),
triggerItem: ModContent.ItemType<EverhallowedLantern>(),
condition: () => true,
uiConf: EverhallowedLantern.GetUIConf,
onUIStart: delegate
Expand All @@ -503,7 +503,7 @@ public override void Initialize()
triggerLeft: false
),
new CircleUIHandler(
triggerItem: AssUtils.Instance.ItemType<SlimeHandlerKnapsack>(),
triggerItem: ModContent.ItemType<SlimeHandlerKnapsack>(),
condition: () => true,
uiConf: SlimeHandlerKnapsack.GetUIConf,
onUIStart: () => selectedSlimePackMinionType,
Expand All @@ -515,7 +515,7 @@ public override void Initialize()
triggerLeft: false
),
new CircleUIHandler(
triggerItem: AssUtils.Instance.ItemType<DroneController>(),
triggerItem: ModContent.ItemType<DroneController>(),
condition: () => true,
uiConf: DroneController.GetUIConf,
onUIStart: delegate
Expand Down Expand Up @@ -758,7 +758,7 @@ public override void ModifyDrawLayers(List<PlayerLayer> layers)
if (shieldDroneReduction > 0) layers.Insert(0, ShieldDroneBack);

int wingLayer = layers.FindIndex(PlayerLayer => PlayerLayer.Name.Equals("Wings"));
if (player.inventory[player.selectedItem].type == mod.ItemType<SlimeHandlerKnapsack>())
if (player.inventory[player.selectedItem].type == ModContent.ItemType<SlimeHandlerKnapsack>())
{
if (wingLayer != -1)
{
Expand Down
14 changes: 7 additions & 7 deletions AssWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public class AssWorld : ModWorld

private void InitHarvesterSouls()
{
harvesterTypes[0] = mod.NPCType<Harvester1>();
harvesterTypes[1] = mod.NPCType<Harvester2>();
harvesterTypes[2] = mod.NPCType<Harvester>();
harvesterTypes[3] = harvesterTalonLeft = mod.NPCType<HarvesterTalonLeft>();
harvesterTypes[4] = harvesterTalonRight = mod.NPCType<HarvesterTalonRight>();
harvesterTypes[0] = ModContent.NPCType<Harvester1>();
harvesterTypes[1] = ModContent.NPCType<Harvester2>();
harvesterTypes[2] = ModContent.NPCType<Harvester>();
harvesterTypes[3] = harvesterTalonLeft = ModContent.NPCType<HarvesterTalonLeft>();
harvesterTypes[4] = harvesterTalonRight = ModContent.NPCType<HarvesterTalonRight>();
downedHarvester = false;
droppedHarvesterSpawnItemThisSession = false;
}
Expand Down Expand Up @@ -150,13 +150,13 @@ private void LimitSoulCount()
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (Main.time % 30 == 15 && NPC.CountNPCS(mod.NPCType<DungeonSoul>()) > 10) //limit soul count in the world to 15
if (Main.time % 30 == 15 && NPC.CountNPCS(ModContent.NPCType<DungeonSoul>()) > 10) //limit soul count in the world to 15
{
short oldest = 200;
int timeleftmin = int.MaxValue;
for (short j = 0; j < 200; j++)
{
if (Main.npc[j].active && Main.npc[j].type == mod.NPCType<DungeonSoul>())
if (Main.npc[j].active && Main.npc[j].type == ModContent.NPCType<DungeonSoul>())
{
if (Main.npc[j].timeLeft < timeleftmin)
{
Expand Down
66 changes: 33 additions & 33 deletions AssortedCrazyThings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ private void AddToSoulBuffBlacklist()
//assuming this is called after InitSoulBuffBlacklist
List<int> tempList = new List<int>(soulBuffBlacklist)
{
NPCType<DungeonSoul>(),
NPCType<DungeonSoulFreed>()
ModContent.NPCType<DungeonSoul>(),
ModContent.NPCType<DungeonSoulFreed>()
};

soulBuffBlacklist = tempList.ToArray();
Expand Down Expand Up @@ -288,49 +288,49 @@ public override void PostSetupContent()

PetEaterofWorldsBase.wormTypes = new int[]
{
ProjectileType<PetEaterofWorldsHead>(),
ProjectileType<PetEaterofWorldsBody1>(),
ProjectileType<PetEaterofWorldsBody2>(),
ProjectileType<PetEaterofWorldsTail>()
ModContent.ProjectileType<PetEaterofWorldsHead>(),
ModContent.ProjectileType<PetEaterofWorldsBody1>(),
ModContent.ProjectileType<PetEaterofWorldsBody2>(),
ModContent.ProjectileType<PetEaterofWorldsTail>()
};

PetDestroyerBase.wormTypes = new int[]
{
ProjectileType<PetDestroyerHead>(),
ProjectileType<PetDestroyerBody1>(),
ProjectileType<PetDestroyerBody2>(),
ProjectileType<PetDestroyerTail>()
ModContent.ProjectileType<PetDestroyerHead>(),
ModContent.ProjectileType<PetDestroyerBody1>(),
ModContent.ProjectileType<PetDestroyerBody2>(),
ModContent.ProjectileType<PetDestroyerTail>()
};

//https://forums.terraria.org/index.php?threads/boss-checklist-in-game-progression-checklist.50668/
Mod bossChecklist = ModLoader.GetMod("BossChecklist");
if (bossChecklist != null)
{
//5.1f means just after skeletron
bossChecklist.Call("AddMiniBossWithInfo", Harvester.name, 5.1f, (Func<bool>)(() => AssWorld.downedHarvester), "Use a [i:" + ItemType<IdolOfDecay>() + "] in the dungeon after Skeletron has been defeated");
bossChecklist.Call("AddMiniBossWithInfo", Harvester.name, 5.1f, (Func<bool>)(() => AssWorld.downedHarvester), "Use a [i:" + ModContent.ItemType<IdolOfDecay>() + "] in the dungeon after Skeletron has been defeated");
}

Mod summonersAssociation = ModLoader.GetMod("SummonersAssociation");
if (summonersAssociation != null && summonersAssociation.Version > new Version(0, 4, 1))
{
summonersAssociation.Call("AddMinionInfo", ItemType<EverglowLantern>(), BuffType<CompanionDungeonSoulMinionBuff>(), new List<int>
summonersAssociation.Call("AddMinionInfo", ModContent.ItemType<EverglowLantern>(), ModContent.BuffType<CompanionDungeonSoulMinionBuff>(), new List<int>
{
ProjectileType<CompanionDungeonSoulPreWOFMinion>(),
ModContent.ProjectileType<CompanionDungeonSoulPreWOFMinion>(),
});
summonersAssociation.Call("AddMinionInfo", ItemType<EverhallowedLantern>(), BuffType<CompanionDungeonSoulMinionBuff>(), new List<int>
summonersAssociation.Call("AddMinionInfo", ModContent.ItemType<EverhallowedLantern>(), ModContent.BuffType<CompanionDungeonSoulMinionBuff>(), new List<int>
{
ProjectileType<CompanionDungeonSoulPostWOFMinion>(),
ProjectileType<CompanionDungeonSoulFrightMinion>(),
ProjectileType<CompanionDungeonSoulMightMinion>(),
ProjectileType<CompanionDungeonSoulSightMinion>()
ModContent.ProjectileType<CompanionDungeonSoulPostWOFMinion>(),
ModContent.ProjectileType<CompanionDungeonSoulFrightMinion>(),
ModContent.ProjectileType<CompanionDungeonSoulMightMinion>(),
ModContent.ProjectileType<CompanionDungeonSoulSightMinion>()
});
summonersAssociation.Call("AddMinionInfo", ItemType<SlimeHandlerKnapsack>(), BuffType<SlimePackMinionBuff>(), ProjectileType<SlimePackMinion>());
summonersAssociation.Call("AddMinionInfo", ModContent.ItemType<SlimeHandlerKnapsack>(), ModContent.BuffType<SlimePackMinionBuff>(), ModContent.ProjectileType<SlimePackMinion>());
List<int> drones = new List<int>();
foreach (var drone in DroneController.DataList)
{
drones.Add(drone.ProjType);
}
summonersAssociation.Call("AddMinionInfo", ItemType<DroneController>(), BuffType<DroneControllerBuff>(), drones);
summonersAssociation.Call("AddMinionInfo", ModContent.ItemType<DroneController>(), ModContent.BuffType<DroneControllerBuff>(), drones);
}

Mod bossAssist = ModLoader.GetMod("BossAssist");
Expand All @@ -344,14 +344,14 @@ public override void AddRecipeGroups()
{
RecipeGroup.RegisterGroup("ACT:RegularCuteSlimes", new RecipeGroup(() => Language.GetTextValue("LegacyMisc.37") + " Regular Bottled Slime", new int[]
{
ItemType<CuteSlimeBlueNew>(),
ItemType<CuteSlimeBlackNew>(),
ItemType<CuteSlimeGreenNew>(),
ItemType<CuteSlimePinkNew>(),
ItemType<CuteSlimePurpleNew>(),
ItemType<CuteSlimeRainbowNew>(),
ItemType<CuteSlimeRedNew>(),
ItemType<CuteSlimeYellowNew>()
ModContent.ItemType<CuteSlimeBlueNew>(),
ModContent.ItemType<CuteSlimeBlackNew>(),
ModContent.ItemType<CuteSlimeGreenNew>(),
ModContent.ItemType<CuteSlimePinkNew>(),
ModContent.ItemType<CuteSlimePurpleNew>(),
ModContent.ItemType<CuteSlimeRainbowNew>(),
ModContent.ItemType<CuteSlimeRedNew>(),
ModContent.ItemType<CuteSlimeYellowNew>()
}));

RecipeGroup.RegisterGroup("ACT:GoldPlatinum", new RecipeGroup(() => Language.GetTextValue("LegacyMisc.37") + " " + Lang.GetItemNameValue(ItemID.GoldBar), new int[]
Expand Down Expand Up @@ -424,7 +424,7 @@ private void CircleUIStart(int triggerType, bool triggerLeft = true, bool fromDr
//extra things that happen
if (!found)
{
if (triggerType == ItemType<VanitySelector>())
if (triggerType == ModContent.ItemType<VanitySelector>())
{
AssUtils.UIText("No alt costumes found for" + (triggerLeft ? "" : " light") + " pet", CombatText.DamagedFriendly);
return;
Expand Down Expand Up @@ -471,7 +471,7 @@ private void CircleUIEnd(bool triggerLeft = true)
}
}
//extra things that happen
if (CircleUI.triggerItemType == ItemType<VanitySelector>())
if (CircleUI.triggerItemType == ModContent.ItemType<VanitySelector>())
{
PoofVisual(CircleUI.UIConf.AdditionalInfo);
AssUtils.UIText("Selected: " + CircleUI.UIConf.Tooltips[CircleUI.returned], CombatText.HealLife);
Expand All @@ -491,10 +491,10 @@ private void UpdateCircleUI()
AssPlayer mPlayer = player.GetModPlayer<AssPlayer>();

int triggerType = player.HeldItem.type;
bool openWithDresser = player.showItemIcon2 == ItemType<VanityDresserItem>();
bool openWithDresser = player.showItemIcon2 == ModContent.ItemType<VanityDresserItem>();
if (openWithDresser)
{
triggerType = ItemType<VanitySelector>();
triggerType = ModContent.ItemType<VanitySelector>();
}
bool? left = null;
if (mPlayer.LeftClickPressed && (CircleUIHandler.TriggerListLeft.Contains(triggerType) || openWithDresser))
Expand All @@ -506,7 +506,7 @@ private void UpdateCircleUI()
left = false;
}

if (left != null && AllowedToOpenUI(ItemType<VanityDresserItem>())) CircleUIStart(triggerType, (bool)left, openWithDresser);
if (left != null && AllowedToOpenUI(ModContent.ItemType<VanityDresserItem>())) CircleUIStart(triggerType, (bool)left, openWithDresser);

if (CircleUI.visible)
{
Expand Down
16 changes: 8 additions & 8 deletions Base/SlimePets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ public static void Load()

slimePetRegularNPCs = new List<int>
{
AssUtils.Instance.NPCType<CuteSlimeBlack>(),
AssUtils.Instance.NPCType<CuteSlimeBlue>(),
AssUtils.Instance.NPCType<CuteSlimeGreen>(),
AssUtils.Instance.NPCType<CuteSlimePink>(),
AssUtils.Instance.NPCType<CuteSlimePurple>(),
AssUtils.Instance.NPCType<CuteSlimeRainbow>(),
AssUtils.Instance.NPCType<CuteSlimeRed>(),
AssUtils.Instance.NPCType<CuteSlimeYellow>()
ModContent.NPCType<CuteSlimeBlack>(),
ModContent.NPCType<CuteSlimeBlue>(),
ModContent.NPCType<CuteSlimeGreen>(),
ModContent.NPCType<CuteSlimePink>(),
ModContent.NPCType<CuteSlimePurple>(),
ModContent.NPCType<CuteSlimeRainbow>(),
ModContent.NPCType<CuteSlimeRed>(),
ModContent.NPCType<CuteSlimeYellow>()
};

//start list
Expand Down
6 changes: 3 additions & 3 deletions Buffs/AbeeminationBuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public override void SetDefaults()
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<PetPlayer>(mod).Abeemination = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType<AbeeminationProj>()] <= 0;
player.GetModPlayer<PetPlayer>().Abeemination = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType<AbeeminationProj>()] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + player.height / 3, 0f, 0f, mod.ProjectileType<AbeeminationProj>(), 0, 0f, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(player.position.X + (player.width / 2), player.position.Y + player.height / 3, 0f, 0f, ModContent.ProjectileType<AbeeminationProj>(), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Buffs/AlienHornet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void SetDefaults()
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<PetPlayer>(mod).AlienHornet = true;
player.GetModPlayer<PetPlayer>().AlienHornet = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("AlienHornet")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Expand Down
2 changes: 1 addition & 1 deletion Buffs/AnimatedTomeBuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void SetDefaults()
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<PetPlayer>(mod).AnimatedTome = true;
player.GetModPlayer<PetPlayer>().AnimatedTome = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("AnimatedTomeProj")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Expand Down
2 changes: 1 addition & 1 deletion Buffs/BabyCrimera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void SetDefaults()
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<PetPlayer>(mod).BabyCrimera = true;
player.GetModPlayer<PetPlayer>().BabyCrimera = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("BabyCrimera")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Expand Down
2 changes: 1 addition & 1 deletion Buffs/BabyIchorSticker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void SetDefaults()
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<PetPlayer>(mod).BabyIchorSticker = true;
player.GetModPlayer<PetPlayer>().BabyIchorSticker = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("BabyIchorSticker")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Expand Down
2 changes: 1 addition & 1 deletion Buffs/BabyOcram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void SetDefaults()
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<PetPlayer>(mod).BabyOcram = true;
player.GetModPlayer<PetPlayer>().BabyOcram = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("BabyOcram")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Expand Down
2 changes: 1 addition & 1 deletion Buffs/BrainofConfusion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void SetDefaults()
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<PetPlayer>(mod).BrainofConfusion = true;
player.GetModPlayer<PetPlayer>().BrainofConfusion = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("BrainofConfusion")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Expand Down
Loading

0 comments on commit 1f735a9

Please sign in to comment.