Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jofairden committed Jul 12, 2017
1 parent c617c17 commit 82e4df7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 57 deletions.
19 changes: 10 additions & 9 deletions PiggyBank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,26 @@

namespace Tremor
{
public class PiggyBank:GlobalItem
public class PiggyBank : GlobalItem
{
public override void ModifyTooltips(Item item,List<TooltipLine> tooltips)//Add support for defender coins in bank3?
public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)//Add support for defender coins in bank3?
{
bool flag;
int[] coins;
if(item.type==ItemID.PiggyBank||item.type==ItemID.MoneyTrough)

if (item.type == ItemID.PiggyBank || item.type == ItemID.MoneyTrough)
{
coins=Utils.CoinsSplit(Utils.CoinsCount(out flag,Main.LocalPlayer.bank.item,new int[0]));
coins = Utils.CoinsSplit(Utils.CoinsCount(out flag, Main.LocalPlayer.bank.item, new int[0]));
}
else if(item.type==ItemID.Safe)
else if (item.type == ItemID.Safe)
{
coins=Utils.CoinsSplit(Utils.CoinsCount(out flag,Main.LocalPlayer.bank2.item,new int[0]));
coins = Utils.CoinsSplit(Utils.CoinsCount(out flag, Main.LocalPlayer.bank2.item, new int[0]));
}
else{return;}
else { return; }

for(int i=0;i<3;i++)
for (int i = 0; i < 3; i++)
{
if(coins[i]>0){tooltips.Add(new TooltipLine(mod,"","[i/s1:"+(ItemID.PlatinumCoin-i)+"] x"+coins[i]));}
if (coins[i] > 0) { tooltips.Add(new TooltipLine(mod, "", "[i/s1:" + (ItemID.PlatinumCoin - i) + "] x" + coins[i])); }
}
}
}
Expand Down
92 changes: 46 additions & 46 deletions TremorGlowMask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,88 +5,88 @@

namespace Tremor
{
public class TremorGlowMask:ModPlayer
public class TremorGlowMask : ModPlayer
{
private static Dictionary<int,Texture2D> itemGlowMask=new Dictionary<int,Texture2D>();
private static readonly Dictionary<int, Texture2D> ItemGlowMask = new Dictionary<int, Texture2D>();

public static void AddGlowMask(int itemType,string texturePath)
public static void AddGlowMask(int itemType, string texturePath)
{
itemGlowMask.Add(itemType,ModLoader.GetTexture(texturePath));
ItemGlowMask.Add(itemType, ModLoader.GetTexture(texturePath));
}

public override void ModifyDrawLayers(List<PlayerLayer> layers)
{
Texture2D textureLegs;
if(!player.armor[12].IsAir)
if (!player.armor[12].IsAir)
{
if(player.armor[12].type>=ItemID.Count&&itemGlowMask.TryGetValue(player.armor[12].type,out textureLegs))//Vanity Legs
if (player.armor[12].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[12].type, out textureLegs))//Vanity Legs
{
InsertAfterVanillaLayer(layers,"Legs",new PlayerLayer(mod.Name,"GlowMaskLegs",delegate(PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Legs,textureLegs,info);
}));
InsertAfterVanillaLayer(layers, "Legs", new PlayerLayer(mod.Name, "GlowMaskLegs", delegate (PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Legs, textureLegs, info);
}));
}
}
else if(player.armor[2].type>=ItemID.Count&&itemGlowMask.TryGetValue(player.armor[2].type,out textureLegs))//Legs
else if (player.armor[2].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[2].type, out textureLegs))//Legs
{
InsertAfterVanillaLayer(layers,"Legs",new PlayerLayer(mod.Name,"GlowMaskLegs",delegate(PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Legs,textureLegs,info);
}));
InsertAfterVanillaLayer(layers, "Legs", new PlayerLayer(mod.Name, "GlowMaskLegs", delegate (PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Legs, textureLegs, info);
}));
}
Texture2D textureBody;
if(!player.armor[11].IsAir)
if (!player.armor[11].IsAir)
{
if(player.armor[11].type>=ItemID.Count&&itemGlowMask.TryGetValue(player.armor[11].type,out textureBody))//Vanity Body
if (player.armor[11].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[11].type, out textureBody))//Vanity Body
{
InsertAfterVanillaLayer(layers,"Body",new PlayerLayer(mod.Name,"GlowMaskBody",delegate(PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Body,textureBody,info);
}));
InsertAfterVanillaLayer(layers, "Body", new PlayerLayer(mod.Name, "GlowMaskBody", delegate (PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Body, textureBody, info);
}));
}
}
else if(player.armor[1].type>=ItemID.Count&&itemGlowMask.TryGetValue(player.armor[1].type,out textureBody))//Body
else if (player.armor[1].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[1].type, out textureBody))//Body
{
InsertAfterVanillaLayer(layers,"Body",new PlayerLayer(mod.Name,"GlowMaskBody",delegate(PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Body,textureBody,info);
}));
InsertAfterVanillaLayer(layers, "Body", new PlayerLayer(mod.Name, "GlowMaskBody", delegate (PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Body, textureBody, info);
}));
}
Texture2D textureHead;
if(!player.armor[10].IsAir)
if (!player.armor[10].IsAir)
{
if(player.armor[10].type>=ItemID.Count&&itemGlowMask.TryGetValue(player.armor[10].type,out textureHead))//Vanity Head
if (player.armor[10].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[10].type, out textureHead))//Vanity Head
{
InsertAfterVanillaLayer(layers,"Head",new PlayerLayer(mod.Name,"GlowMaskHead",delegate(PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Head,textureHead,info);
}));
InsertAfterVanillaLayer(layers, "Head", new PlayerLayer(mod.Name, "GlowMaskHead", delegate (PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Head, textureHead, info);
}));
}
}
else if(player.armor[0].type>=ItemID.Count&&itemGlowMask.TryGetValue(player.armor[0].type,out textureHead))//Head
else if (player.armor[0].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[0].type, out textureHead))//Head
{
InsertAfterVanillaLayer(layers,"Head",new PlayerLayer(mod.Name,"GlowMaskHead",delegate(PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Head,textureHead,info);
}));
InsertAfterVanillaLayer(layers, "Head", new PlayerLayer(mod.Name, "GlowMaskHead", delegate (PlayerDrawInfo info)
{
TremorUtils.DrawArmorGlowMask(EquipType.Head, textureHead, info);
}));
}
Texture2D textureItem;
if(player.HeldItem.type>=ItemID.Count&&itemGlowMask.TryGetValue(player.HeldItem.type,out textureItem))//Held Item
if (player.HeldItem.type >= ItemID.Count && ItemGlowMask.TryGetValue(player.HeldItem.type, out textureItem))//Held Item
{
InsertAfterVanillaLayer(layers,"HeldItem",new PlayerLayer(mod.Name,"GlowMaskHeldItem",delegate(PlayerDrawInfo info)
{
TremorUtils.DrawItemGlowMask(textureItem,info);
}));
InsertAfterVanillaLayer(layers, "HeldItem", new PlayerLayer(mod.Name, "GlowMaskHeldItem", delegate (PlayerDrawInfo info)
{
TremorUtils.DrawItemGlowMask(textureItem, info);
}));
}
}

public static void InsertAfterVanillaLayer(List<PlayerLayer> layers,string vanillaLayerName,PlayerLayer newPlayerLayer)
public static void InsertAfterVanillaLayer(List<PlayerLayer> layers, string vanillaLayerName, PlayerLayer newPlayerLayer)
{
for(int i=0;i<layers.Count;i++)
for (int i = 0; i < layers.Count; i++)
{
if(layers[i].Name==vanillaLayerName&&layers[i].mod=="Terraria")
if (layers[i].Name == vanillaLayerName && layers[i].mod == "Terraria")
{
layers.Insert(i+1,newPlayerLayer);
layers.Insert(i + 1, newPlayerLayer);
return;
}
}
Expand Down
2 changes: 0 additions & 2 deletions TremorPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

namespace Tremor
{


public class TremorPlayer : ModPlayer
{
public bool heartAmulet;
Expand Down

0 comments on commit 82e4df7

Please sign in to comment.