Skip to content

Commit

Permalink
Commit more latest changes (Git is being derpy).
Browse files Browse the repository at this point in the history
  • Loading branch information
gardenappl committed Jan 10, 2017
1 parent 63642e8 commit b711b4e
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 50 deletions.
5 changes: 5 additions & 0 deletions NPC/ExpertNPCInfo.cs → ExpertNPCInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ namespace BossExpertise
{
public class ExpertNPCInfo : NPCInfo
{
public override bool Autoload(ref string name)
{
return false;
}

internal bool FakeExpertMode;
}
}
16 changes: 16 additions & 0 deletions ExpertPlayer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

using System;
using Terraria;
using Terraria.ModLoader;

namespace BossExpertise
{
public class ExpertPlayer : ModPlayer
{
public override void ResetEffects()
{
if(Config.DemonHeartHack && player.extraAccessory && !(Main.expertMode || Main.gameMenu))
player.extraAccessorySlots++;
}
}
}
50 changes: 0 additions & 50 deletions NPC/ExpertGlobalNPC.cs

This file was deleted.

65 changes: 65 additions & 0 deletions OldConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

using System;
using System.IO;
using Terraria;

namespace BossExpertise
{
public static class OldConfig
{
static string ConfigFolderPath = Path.Combine(Main.SavePath, "Mod Configs", "BossExpertise");
static string ConfigPath = Path.Combine(ConfigFolderPath, "config.txt");
static string ConfigVersionPath = Path.Combine(ConfigFolderPath, "configVersion.txt");

public static void Load()
{
if(!Directory.Exists(ConfigFolderPath))
return;

if(File.Exists(ConfigPath))
{
BossExpertise.Log("Found config file with old format! Reading outdated config...");
var file = new StreamReader(ConfigPath);
try
{
file.ReadLine();
bool.TryParse(file.ReadLine().Split(':')[1], out Config.DropBags);

file.ReadLine();
bool.TryParse(file.ReadLine().Split(':')[1], out Config.ChangeBossAI);

file.ReadLine();
bool.TryParse(file.ReadLine().Split(':')[1], out Config.AddCheatSheetButton);

file.ReadLine();
bool.TryParse(file.ReadLine().Split(':')[1], out Config.AddExpertCommand);
}
catch(Exception e)
{
BossExpertise.Log("Unable to read old config file!");
BossExpertise.Log(e.ToString());
}
finally
{
file.Dispose();
}
}

BossExpertise.Log("Deleting outdated config...");
try
{
File.Delete(ConfigPath);
File.Delete(ConfigVersionPath);
if(Directory.GetFiles(ConfigFolderPath).Length == 0 && Directory.GetDirectories(ConfigFolderPath).Length == 0)
Directory.Delete(ConfigFolderPath);
else
BossExpertise.Log("Outdated config folder still cotains some files/directories. They will not get deleted.");
}
catch(Exception e)
{
BossExpertise.Log("Unable to delete old config!");
BossExpertise.Log(e.ToString());
}
}
}
}

0 comments on commit b711b4e

Please sign in to comment.