2016-03-07 05:58:40 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
2016-03-23 08:36:04 +08:00
|
|
|
|
using StardewValley;
|
2016-03-07 05:58:40 +08:00
|
|
|
|
|
|
|
|
|
namespace StardewModdingAPI
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2016-03-27 13:09:09 +08:00
|
|
|
|
/// Static class containing readonly values.
|
2016-03-07 05:58:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
public static class Constants
|
|
|
|
|
{
|
2016-03-31 06:37:53 +08:00
|
|
|
|
public static readonly Version Version = new Version(0, 39, 5, "Alpha");
|
2016-03-27 13:09:09 +08:00
|
|
|
|
|
2016-03-07 05:58:40 +08:00
|
|
|
|
/// <summary>
|
2016-03-27 13:09:09 +08:00
|
|
|
|
/// Not quite "constant", but it makes more sense for it to be here, at least for now
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static int ModsLoaded = 0;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Stardew Valley's roaming app data location.
|
|
|
|
|
/// %AppData%//StardewValley
|
2016-03-07 05:58:40 +08:00
|
|
|
|
/// </summary>
|
2016-03-07 06:04:22 +08:00
|
|
|
|
public static string DataPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley");
|
2016-03-07 05:58:40 +08:00
|
|
|
|
|
2016-03-23 08:36:04 +08:00
|
|
|
|
public static string SavesPath => Path.Combine(DataPath, "Saves");
|
|
|
|
|
|
|
|
|
|
private static string saveFolderName => PlayerNull ? string.Empty : Game1.player.name.RemoveNumerics() + "_" + Game1.uniqueIDForThisGame;
|
|
|
|
|
public static string SaveFolderName => CurrentSavePathExists ? saveFolderName : "";
|
|
|
|
|
|
|
|
|
|
private static string currentSavePath => PlayerNull ? string.Empty : Path.Combine(SavesPath, saveFolderName);
|
|
|
|
|
public static string CurrentSavePath => CurrentSavePathExists ? currentSavePath : "";
|
|
|
|
|
|
|
|
|
|
public static bool CurrentSavePathExists => Directory.Exists(currentSavePath);
|
|
|
|
|
|
|
|
|
|
public static bool PlayerNull => !Game1.hasLoadedGame || Game1.player == null || string.IsNullOrEmpty(Game1.player.name);
|
|
|
|
|
|
2016-03-07 05:58:40 +08:00
|
|
|
|
/// <summary>
|
2016-03-27 13:09:09 +08:00
|
|
|
|
/// Execution path to execute the code.
|
2016-03-07 05:58:40 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
public static string ExecutionPath => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2016-03-27 13:09:09 +08:00
|
|
|
|
/// Title for the API console
|
2016-03-07 05:58:40 +08:00
|
|
|
|
/// </summary>
|
2016-03-24 01:43:11 +08:00
|
|
|
|
public static string ConsoleTitle => $"Stardew Modding API Console - Version {Version.VersionString} - Mods Loaded: {ModsLoaded}";
|
2016-03-07 05:58:40 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2016-03-27 13:09:09 +08:00
|
|
|
|
/// Path for log files to be output to.
|
|
|
|
|
/// %LocalAppData%//StardewValley//ErrorLogs
|
2016-03-07 05:58:40 +08:00
|
|
|
|
/// </summary>
|
2016-03-27 09:50:47 +08:00
|
|
|
|
public static string LogDir => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "ErrorLogs");
|
2016-03-07 05:58:40 +08:00
|
|
|
|
|
2016-03-27 13:09:09 +08:00
|
|
|
|
public static string LogPath => Path.Combine(LogDir, "MODDED_ProgramLog.Log_LATEST.txt");
|
2016-03-27 09:50:47 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2016-03-27 13:09:09 +08:00
|
|
|
|
/// Whether or not to enable the Render Target drawing code offered by ClxS
|
|
|
|
|
/// Do not mark as 'const' or else 'if' checks will complain that the expression is always true in ReSharper
|
2016-03-27 09:50:47 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
public static bool EnableDrawingIntoRenderTarget => true;
|
2016-03-27 15:52:43 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Completely overrides the base game's draw call to the one is SGame
|
|
|
|
|
/// </summary>
|
2016-03-27 18:40:09 +08:00
|
|
|
|
public static bool EnableCompletelyOverridingBaseCalls => true;
|
2016-03-07 05:58:40 +08:00
|
|
|
|
}
|
2016-03-27 13:09:09 +08:00
|
|
|
|
}
|