Skip to content

Commit

Permalink
v1.5.4
Browse files Browse the repository at this point in the history
* Updated for TML 0.10
* Offloaded utility/helper code to Hamstar's Helpers mod (now a dependency)
* Numerous fixes and tweaks
  • Loading branch information
hamstar committed Jun 8, 2017
1 parent 079a9e9 commit 5d51640
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 508 deletions.
20 changes: 12 additions & 8 deletions Items/ExtraLifeItem.cs
Expand Up @@ -6,8 +6,13 @@

namespace Lives.Items {
public class ExtraLifeItem : ModItem {
public override void SetStaticDefaults() {
this.DisplayName.SetDefault( "1-Up" );
this.Tooltip.SetDefault( "Extra life (except for hardcore folk)" );
}


public override void SetDefaults() {
this.item.name = "1-Up";
this.item.maxStack = 99;
this.item.consumable = true;
this.item.width = 18;
Expand All @@ -16,7 +21,6 @@ public class ExtraLifeItem : ModItem {
this.item.useTime = 30;
this.item.useAnimation = 30;
this.item.UseSound = SoundID.Item4;
this.item.toolTip = "Extra life (except for hardcore folk)";
this.item.value = 10000;
this.item.rare = 4;
}
Expand Down Expand Up @@ -44,8 +48,8 @@ public class ExtraLifeItem : ModItem {

public override void AddRecipes() {
var mymod = (LivesMod)this.mod;
var recipe1 = new ExtraLifeRecipe( mymod, this, "Life Crystal", 1 );
var recipe2 = new ExtraLifeRecipe( mymod, this, "Life Fruit", 4 );
var recipe1 = new ExtraLifeRecipe( mymod, this, ItemID.LifeCrystal, 1 );
var recipe2 = new ExtraLifeRecipe( mymod, this, ItemID.LifeFruit, 4 );

recipe1.AddRecipe();
recipe2.AddRecipe();
Expand All @@ -55,16 +59,16 @@ public class ExtraLifeItem : ModItem {


class ExtraLifeRecipe : ModRecipe {
public ExtraLifeRecipe( LivesMod mymod, ExtraLifeItem myitem, string base_ingredient, int base_quantity ) : base( mymod ) {
public ExtraLifeRecipe( LivesMod mymod, ExtraLifeItem myitem, int item_id, int base_quantity ) : base( mymod ) {
int coins = mymod.Config.Data.ExtraLifeGoldCoins;

this.AddIngredient( base_ingredient, base_quantity );
this.AddIngredient( item_id, base_quantity );

if( mymod.Config.Data.ExtraLifeVoodoo ) {
this.AddIngredient( "Guide Voodoo Doll", 1 );
this.AddIngredient( ItemID.GuideVoodooDoll, 1 );
}
if( coins > 0 ) {
this.AddIngredient( "Gold Coin", coins );
this.AddIngredient( ItemID.GoldCoin, coins );
}
this.SetResult( myitem );
}
Expand Down
11 changes: 6 additions & 5 deletions Lives.csproj
Expand Up @@ -31,8 +31,8 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Libraries.JSON.NET.Newtonsoft.Json">
<HintPath>..\..\..\Reference\Libraries.JSON.NET.Newtonsoft.Json.dll</HintPath>
<Reference Include="HamstarHelpers">
<HintPath>..\HamstarHelpers\bin\Release\HamstarHelpers.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -48,16 +48,17 @@
<Reference Include="Terraria">
<HintPath>..\..\..\..\..\Program Files\Steam\steamapps\common\Terraria\Terraria.exe</HintPath>
</Reference>
<Reference Include="Terraria.Libraries.ReLogic.ReLogic, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Reference\Terraria.Libraries.ReLogic.ReLogic.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Items\ExtraLifeItem.cs" />
<Compile Include="LivesMod.cs" />
<Compile Include="LivesNetProtocol.cs" />
<Compile Include="LivesPlayer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\DebugHelper.cs" />
<Compile Include="Utils\JsonConfig.cs" />
<Compile Include="Utils\PlayerHead.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="build.txt" />
Expand Down
15 changes: 7 additions & 8 deletions LivesMod.cs
@@ -1,11 +1,12 @@
using Microsoft.Xna.Framework;
using HamstarHelpers.PlayerHelpers;
using HamstarHelpers.Utilities.Config;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.ModLoader;
using Utils;
using Utils.JsonConfig;


namespace Lives {
Expand All @@ -24,7 +25,7 @@ public class ConfigurationData {


public class LivesMod : Mod {
public static readonly Version ConfigVersion = new Version( 1, 5, 3 );
public static readonly Version ConfigVersion = new Version( 1, 5, 4 );
public JsonConfig<ConfigurationData> Config { get; private set; }


Expand Down Expand Up @@ -82,10 +83,8 @@ public class LivesMod : Mod {
int lives = modplayer.Lives;
Vector2 pos = new Vector2(Main.screenWidth - 38, Main.screenHeight - 26);

PlayerHead.DrawPlayerHead(sb, Main.player[Main.myPlayer], Main.screenWidth - 48, Main.screenHeight - 24, 1f, 1f);
sb.DrawString(Main.fontMouseText, " x" + lives, pos, Color.White);

DebugHelper.PrintToBatch( sb );
PlayerHeadHelpers.DrawPlayerHead(sb, Main.player[Main.myPlayer], Main.screenWidth - 48, Main.screenHeight - 24, 1f, 1f);
sb.DrawString( Main.fontMouseText, " x" + lives, pos, Color.White );
}
}
}
12 changes: 6 additions & 6 deletions LivesNetProtocol.cs
Expand Up @@ -5,8 +5,8 @@

namespace Lives {
public enum LivesNetProtocolTypes : byte {
SendSettingsRequest,
SendSettings,
RequestModSettings,
ModSettings,
SignalDifficultyChange
}

Expand All @@ -16,10 +16,10 @@ public static class LivesNetProtocol {
LivesNetProtocolTypes protocol = (LivesNetProtocolTypes)reader.ReadByte();

switch( protocol ) {
case LivesNetProtocolTypes.SendSettingsRequest:
case LivesNetProtocolTypes.RequestModSettings:
LivesNetProtocol.ReceiveSettingsRequestWithServer( mymod, reader );
break;
case LivesNetProtocolTypes.SendSettings:
case LivesNetProtocolTypes.ModSettings:
LivesNetProtocol.ReceiveSettingsWithClient( mymod, reader );
break;
case LivesNetProtocolTypes.SignalDifficultyChange:
Expand All @@ -42,7 +42,7 @@ public static class LivesNetProtocol {

ModPacket packet = mymod.GetPacket();

packet.Write( (byte)LivesNetProtocolTypes.SendSettingsRequest );
packet.Write( (byte)LivesNetProtocolTypes.RequestModSettings );
packet.Write( (int)player.whoAmI );
packet.Send();
}
Expand All @@ -67,7 +67,7 @@ public static class LivesNetProtocol {

ModPacket packet = mymod.GetPacket();

packet.Write( (byte)LivesNetProtocolTypes.SendSettings );
packet.Write( (byte)LivesNetProtocolTypes.ModSettings );
packet.Write( (string)mymod.Config.SerializeMe() );

packet.Send( (int)player.whoAmI );
Expand Down
27 changes: 0 additions & 27 deletions Utils/DebugHelper.cs

This file was deleted.

87 changes: 0 additions & 87 deletions Utils/JsonConfig.cs

This file was deleted.

0 comments on commit 5d51640

Please sign in to comment.