Files
GameLauncher/Engines/Tkool/TkoolGameItem.cs
T
armonica ae86b53147 スタイル: コーディング規約に準拠したコードフォーマットの適用(this.の明示、空白スタイルの統一)
- 自インスタンスメンバーアクセスへの this. 付与(28ファイル)
- .editorconfig に準拠したインデント・波括弧・空白スタイルの適用
- UTF-8 (BOMあり)、CRLF改行コード、行末空白除去の整合性検証
2026-10-20 10:14:26 +09:00

990 lines
49 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using GameLauncher.Models;
using GameLauncher.Engines.Unity;
namespace GameLauncher.Engines.Tkool
{
/// <summary>
/// 各プラグイン改造の個別有効/無効オプション(互換用)
/// </summary>
public class ModPluginOptions : System.ComponentModel.INotifyPropertyChanged
{
private bool _speedUp = true;
private bool _antigravityGameTweaks = true;
private bool _dropItem99 = true;
private bool _turnStartFullRecover = true;
private bool _turnStartFullRecoverHp = true;
private bool _turnStartFullRecoverMp = true;
private bool _turnStartFullRecoverTp = true;
private bool _maxGainGold = true;
private bool _maxGainExp = true;
private bool _instantMessage = true;
public bool SpeedUp
{
get => this._speedUp;
set { if (this._speedUp != value) { this._speedUp = value; this.OnPropertyChanged(); } }
}
public bool AntigravityGameTweaks
{
get => this._antigravityGameTweaks;
set { if (this._antigravityGameTweaks != value) { this._antigravityGameTweaks = value; this.OnPropertyChanged(); } }
}
public bool DropItem99
{
get => this._dropItem99;
set { if (this._dropItem99 != value) { this._dropItem99 = value; this.OnPropertyChanged(); } }
}
public bool TurnStartFullRecover
{
get => this._turnStartFullRecover;
set { if (this._turnStartFullRecover != value) { this._turnStartFullRecover = value; this.OnPropertyChanged(); } }
}
public bool TurnStartFullRecoverHp
{
get => this._turnStartFullRecoverHp;
set { if (this._turnStartFullRecoverHp != value) { this._turnStartFullRecoverHp = value; this.OnPropertyChanged(); } }
}
public bool TurnStartFullRecoverMp
{
get => this._turnStartFullRecoverMp;
set { if (this._turnStartFullRecoverMp != value) { this._turnStartFullRecoverMp = value; this.OnPropertyChanged(); } }
}
public bool TurnStartFullRecoverTp
{
get => this._turnStartFullRecoverTp;
set { if (this._turnStartFullRecoverTp != value) { this._turnStartFullRecoverTp = value; this.OnPropertyChanged(); } }
}
public bool MaxGainGold
{
get => this._maxGainGold;
set { if (this._maxGainGold != value) { this._maxGainGold = value; this.OnPropertyChanged(); } }
}
public bool MaxGainExp
{
get => this._maxGainExp;
set { if (this._maxGainExp != value) { this._maxGainExp = value; this.OnPropertyChanged(); } }
}
public bool InstantMessage
{
get => this._instantMessage;
set { if (this._instantMessage != value) { this._instantMessage = value; this.OnPropertyChanged(); } }
}
public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string? name = null)
{
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs(name));
}
}
/// <summary>
/// ツクールおよびティラノスクリプトゲームのデータモデル
/// </summary>
public class TkoolGameItem : GameItemBase
{
private string _pluginsJsPath = string.Empty;
private string _pluginsDirPath = string.Empty;
private TkoolEngineType _engineType = TkoolEngineType.Unknown;
private bool _isModded;
private bool _applyMod = true;
private bool _hasCustomApplyMod;
private bool _isInitializingApplyMod;
private ModPluginOptions _modOptions = new();
// app.asar 関連プロパティ
private bool _isAsar;
private bool _isAsarExtracted;
private string? _asarPath;
private string? _asarExtractedDirPath;
private string? _relativePluginsJsInAsar;
// ================= 単体exe梱包(FOSSIL / boxed)関連プロパティ =================
// js/plugins.js がディスク上に無く、exeへ埋め込まれている形態を識別します。
// 注: boxed の埋め込みコンテナ展開(旧 _extracted 展開)は廃止しました。
// 単体exeは「起動のみ対応」として扱い、展開・注入は行いません。
private bool _isFossilSingleExe;
private bool _isBoxedExe;
// ================= Enigma Virtual Box (EVB) 梱包関連プロパティ =================
// EVB でパックされた exe を evbunpack で解凍した状態を識別します。
// 他エンジンのゲームへは一切影響しません(このゲームフォルダ内でのみ扱う)。
private bool _isEvbPacked;
private bool _isEvbExtracted;
private string? _evbExtractedDirPath;
private string? _evbBackupPath;
private string _evbUnderlyingEngine = string.Empty;
/// <summary>Enigma Virtual Box でパックされた exe を持つゲームかどうか</summary>
public override bool IsEvbPacked
{
get => this._isEvbPacked;
set
{
if (this._isEvbPacked != value)
{
this._isEvbPacked = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.IsEvb));
this.OnPropertyChanged(nameof(this.EvbBadgeVisibility));
this.OnPropertyChanged(nameof(this.EvbBadgeText));
this.OnPropertyChanged(nameof(this.EvbNeedsUnpackVisibility));
this.OnPropertyChanged(nameof(this.EvbNeedsUnpackBadgeText));
this.OnPropertyChanged(nameof(this.EvbExtractedVisibility));
this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText));
this.OnPropertyChanged(nameof(this.EvbDetailStatusText));
this.OnPropertyChanged(nameof(this.IsEvbToolMissing));
}
}
}
/// <summary>EVB 解凍済み(_evb_extracted に出力済み)かどうか</summary>
public override bool IsEvbExtracted
{
get => this._isEvbExtracted;
set
{
if (this._isEvbExtracted != value)
{
this._isEvbExtracted = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.EvbBadgeVisibility));
this.OnPropertyChanged(nameof(this.EvbBadgeText));
this.OnPropertyChanged(nameof(this.EvbNeedsUnpackVisibility));
this.OnPropertyChanged(nameof(this.EvbNeedsUnpackBadgeText));
this.OnPropertyChanged(nameof(this.EvbExtractedVisibility));
this.OnPropertyChanged(nameof(this.EvbExtractedBadgeText));
this.OnPropertyChanged(nameof(this.EvbDetailStatusText));
}
}
}
/// <summary>EVB 解凍先ディレクトリ(ゲームフォルダ内 _evb_extracted)</summary>
public string? EvbExtractedDirPath
{
get => this._evbExtractedDirPath;
set { if (this._evbExtractedDirPath != value) { this._evbExtractedDirPath = value; this.OnPropertyChanged(); } }
}
/// <summary>EVB 解凍時に作成した元 exe のバックアップパス(*.glbak)</summary>
public string? EvbBackupPath
{
get => this._evbBackupPath;
set { if (this._evbBackupPath != value) { this._evbBackupPath = value; this.OnPropertyChanged(); } }
}
/// <summary>EVB 解凍後に再判定された本来のエンジン名</summary>
public string EvbUnderlyingEngine
{
get => this._evbUnderlyingEngine;
set { if (this._evbUnderlyingEngine != value) { this._evbUnderlyingEngine = value; this.OnPropertyChanged(); this.OnPropertyChanged(nameof(this.EvbDetailStatusText)); } }
}
/// <summary>EVB として扱うか(UI バッジ判定用)</summary>
public override bool IsEvb => this.IsEvbPacked;
/// <summary>EVB バッジの可視性(実際にEVBで圧縮され解凍・管理対象のもののみ Visible)</summary>
public override Visibility EvbBadgeVisibility => this.IsEvbPacked ? Visibility.Visible : Visibility.Collapsed;
/// <summary>
/// EVB バッジのテキスト。実際に Enigma Virtual Box でパックされているゲームのみ "EVB" を返し、
/// それ以外は空文字を返してバッジを非表示にする。
/// </summary>
public override string EvbBadgeText => this.IsEvbPacked ? "EVB" : string.Empty;
/// <summary>
/// EVB「要解凍」バッジのテキスト。未解凍のときだけ "要解凍" を返し、それ以外は空文字を返す。
/// バッジはテキスト駆動(StringNotEmptyToVisibilityConverter)で表示制御されるため、
/// 無関係なゲームで空のバッジが描画されることはない。
/// </summary>
public override string EvbNeedsUnpackBadgeText => (this.IsEvbPacked && !this.IsEvbExtracted) ? "要解凍" : string.Empty;
/// <summary>EVB 未解凍のときだけ「要解凍」を強調表示するための可視性(一目で分かる導線)</summary>
public override Visibility EvbNeedsUnpackVisibility => (this.IsEvbPacked && !this.IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed;
/// <summary>EVB 解凍済みのときだけ「解凍済み」ラベルを表示するための可視性(一目で分かる導線)</summary>
public override Visibility EvbExtractedVisibility => (this.IsEvbPacked && this.IsEvbExtracted) ? Visibility.Visible : Visibility.Collapsed;
/// <summary>
/// EVB「解凍済み」ラベルのテキスト。EVB パック済みかつ解凍済みのときだけ "解凍済み" を返し、
/// それ以外は空文字を返して非表示にする。
/// </summary>
public override string EvbExtractedBadgeText => (this.IsEvbPacked && this.IsEvbExtracted) ? "解凍済み" : string.Empty;
/// <summary>
/// Evb 解凍ツール(evbunpack.exe)が未配置かどうか。
/// 選択時のガイドで「README.md を参照してください」と案内するために使用します。
/// </summary>
public bool IsEvbToolMissing => this.IsEvbPacked && !Engines.Evb.EvbUnpackerToolProvider.IsAvailable();
/// <summary>EVB 詳細状態テキスト</summary>
public override string EvbDetailStatusText
{
get
{
if (!this.IsEvbPacked)
{
return string.Empty;
}
var engine = string.IsNullOrWhiteSpace(this.EvbUnderlyingEngine) ? "未判定" : this.EvbUnderlyingEngine;
if (this.IsEvbToolMissing)
{
return "evbunpack.exe が未配置です。Engines/Evb/Tools/evbunpack/README.md を参照してください。";
}
return this.IsEvbExtracted
? $"Enigma Virtual Box パック済み(解凍済み / 本来: {engine})"
: $"Enigma Virtual Box パック済み(未解凍 / 本来: {engine})";
}
}
/// <summary>
/// EVB 解凍後の起動に使う実行ファイルを解決します。
/// 解凍済み(_evb_extracted に完了マーカーがある)なら、その配下の exe を起動対象とし、
/// 未解凍なら元の exe を返します。他ゲームには影響しません。
/// </summary>
public string ResolveLaunchExecutable()
{
if (!this.IsEvbPacked || !this.IsEvbExtracted)
{
return this.ExecutablePath;
}
// 解凍先フォルダを決定する(保存済みパスが無ければゲームフォルダ配下から解決)。
var outputDir = !string.IsNullOrEmpty(this.EvbExtractedDirPath)
? this.EvbExtractedDirPath!
: GameLauncher.Engines.Evb.EvbUnpackService.GetExtractedDir(this.RootDirectory);
// ExecutablePath が空の場合でも、解凍完了マーカーを確認したうえで
// 解凍後の exe を起動対象として復元する(再スキャン直後の起動失敗対策)。
var exe = GameLauncher.Engines.Evb.EvbUnpackService.FindLaunchExecutable(outputDir);
if (!string.IsNullOrEmpty(exe))
{
return exe!;
}
return this.ExecutablePath;
}
/// <summary>FOSSIL形態(FOSSILindex.html + 単体Game.exe、data/System.json はディスク上)かどうか</summary>
public bool IsFossilSingleExe
{
get => this._isFossilSingleExe;
set { if (this._isFossilSingleExe != value) { this._isFossilSingleExe = value; this.OnPropertyChanged(); } }
}
/// <summary>boxed形態(ゲーム本体をexeへ内包、例: Game_boxed.exe)かどうか</summary>
public bool IsBoxedExe
{
get => this._isBoxedExe;
set { if (this._isBoxedExe != value) { this._isBoxedExe = value; this.OnPropertyChanged(); } }
}
/// <summary>いずれかの単体exe梱包形態(FOSSIL / boxed)かどうか</summary>
public bool IsStandaloneExePackage => this.IsFossilSingleExe || this.IsBoxedExe;
public override GameEngineKind EngineKind => this.EngineType switch
{
TkoolEngineType.Tyrano => GameEngineKind.Tyrano,
TkoolEngineType.Wolf => GameEngineKind.Wolf,
TkoolEngineType.SrpgStudio => GameEngineKind.SrpgStudio,
TkoolEngineType.Nwjs => GameEngineKind.Nwjs,
TkoolEngineType.Other => GameEngineKind.Other,
_ => GameEngineKind.Tkool
};
public string PluginsJsPath
{
get => this._pluginsJsPath;
set { if (this._pluginsJsPath != value) { this._pluginsJsPath = value; this.OnPropertyChanged(); } }
}
public string PluginsDirPath
{
get => this._pluginsDirPath;
set { if (this._pluginsDirPath != value) { this._pluginsDirPath = value; this.OnPropertyChanged(); } }
}
public override bool IsMV => this.EngineType == TkoolEngineType.MV;
public override bool IsMZ => this.EngineType == TkoolEngineType.MZ;
public override bool IsTyrano => this.EngineType == TkoolEngineType.Tyrano;
public override bool IsVX => this.EngineType == TkoolEngineType.VX;
public override bool IsVXAce => this.EngineType == TkoolEngineType.VXAce;
public override bool IsWolf => this.EngineType == TkoolEngineType.Wolf;
public override bool IsSrpgStudio => this.EngineType == TkoolEngineType.SrpgStudio;
public override bool IsRgss => this.EngineType is TkoolEngineType.VX or TkoolEngineType.VXAce;
public override bool IsNwjs => this.EngineType == TkoolEngineType.Nwjs;
public override bool IsOther => this.EngineType == TkoolEngineType.Other;
/// <summary>
/// エンジン種別ラベルの表示文字列。該当エンジンが無い場合は空文字を返し、ラベル自体を非表示にします。
/// </summary>
public override string EngineLabelText => this.EngineType switch
{
TkoolEngineType.MV => "MV",
TkoolEngineType.MZ => "MZ",
TkoolEngineType.VX => "VX",
TkoolEngineType.VXAce => "VX Ace",
TkoolEngineType.Tyrano => "ティラノ",
TkoolEngineType.Wolf => "ウディタ",
TkoolEngineType.SrpgStudio => "SRPG",
_ => string.Empty
};
/// <summary>エンジン種別ラベルの背景色</summary>
public override Brush EngineLabelBackground => this.EngineType switch
{
TkoolEngineType.MV => new SolidColorBrush(Color.FromRgb(0x8B, 0x1E, 0x3F)),
TkoolEngineType.MZ => new SolidColorBrush(Color.FromRgb(0x1E, 0x5F, 0x8B)),
TkoolEngineType.VX => new SolidColorBrush(Color.FromRgb(0xC0, 0x39, 0x2B)),
TkoolEngineType.VXAce => new SolidColorBrush(Color.FromRgb(0xD3, 0x54, 0x00)),
TkoolEngineType.Tyrano => new SolidColorBrush(Color.FromRgb(0xD3, 0x54, 0x00)),
TkoolEngineType.Wolf => new SolidColorBrush(Color.FromRgb(0x8B, 0x57, 0x1E)),
TkoolEngineType.SrpgStudio => new SolidColorBrush(Color.FromRgb(0x1E, 0x7A, 0x5F)),
_ => Brushes.Transparent
};
/// <summary>NW.jsバッジのテキスト</summary>
public override string NwjsBadgeText =>
this.EngineType == TkoolEngineType.Nwjs ? "NW.js" : string.Empty;
/// <summary>NW.jsバッジの可視性</summary>
public override Visibility NwjsBadgeVisibility =>
this.EngineType == TkoolEngineType.Nwjs ? Visibility.Visible : Visibility.Collapsed;
/// <summary>その他バッジの可視性</summary>
public override Visibility OtherBadgeVisibility =>
this.EngineType == TkoolEngineType.Other ? Visibility.Visible : Visibility.Collapsed;
/// <summary>
/// 「プリンセスシナジー」(ツクールMZ製・専用改造対象ゲーム)かどうか。
/// タイトルまたはフォルダ名に "プリンセスシナジー" を含み、エンジンがMZの場合のみ true。
/// これにより当該機能が他ゲームに表示・適用されるのを防ぎます。
/// </summary>
public override bool IsPrincessSynergy =>
!string.IsNullOrEmpty(this.Title) && this.Title.Contains("プリンセスシナジー");
// SRPG Studio アーカイブ関連プロパティ
private bool _hasSrpgArchive;
private bool _isSrpgExtracted;
private string? _srpgArchivePath;
public override bool HasSrpgArchive
{
get => this._hasSrpgArchive;
set
{
if (this._hasSrpgArchive != value)
{
this._hasSrpgArchive = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.SrpgBadgeVisibility));
this.OnPropertyChanged(nameof(this.SrpgBadgeText));
this.OnPropertyChanged(nameof(this.SrpgBadgeBackground));
this.OnPropertyChanged(nameof(this.SrpgDetailStatusText));
}
}
}
public override bool IsSrpgExtracted
{
get => this._isSrpgExtracted;
set
{
if (this._isSrpgExtracted != value)
{
this._isSrpgExtracted = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.SrpgBadgeText));
this.OnPropertyChanged(nameof(this.SrpgBadgeBackground));
this.OnPropertyChanged(nameof(this.SrpgDetailStatusText));
}
}
}
public string? SrpgArchivePath
{
get => this._srpgArchivePath;
set { if (this._srpgArchivePath != value) { this._srpgArchivePath = value; this.OnPropertyChanged(); } }
}
public override Visibility SrpgBadgeVisibility => (this.IsSrpgStudio && this.HasSrpgArchive) ? Visibility.Visible : Visibility.Collapsed;
public override string SrpgBadgeText => !(this.IsSrpgStudio && this.HasSrpgArchive) ? string.Empty : (this.IsSrpgExtracted ? "SRPG (抽出済)" : "SRPG (暗号化)");
public override Brush SrpgBadgeBackground => !(this.IsSrpgStudio && this.HasSrpgArchive)
? Brushes.Transparent
: (this.IsSrpgExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B))
: new SolidColorBrush(Color.FromRgb(0x09, 0x84, 0xE3)));
public override string SrpgDetailStatusText => !(this.IsSrpgStudio && this.HasSrpgArchive)
? string.Empty
: (this.IsSrpgExtracted ? "📦 SRPGアーカイブ(スクリプト/リソース抽出済み・改造可能)" : "🔒 SRPG暗号化アーカイブ(ボタンで抽出・改造・再構築可能)");
// RGSS (VX / VX Ace) アーカイブ関連プロパティ
private bool _hasRgssArchive;
private bool _isRgssExtracted;
private string? _rgssArchivePath;
public override bool HasRgssArchive
{
get => this._hasRgssArchive;
set
{
if (this._hasRgssArchive != value)
{
this._hasRgssArchive = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.RgssBadgeVisibility));
this.OnPropertyChanged(nameof(this.RgssBadgeText));
this.OnPropertyChanged(nameof(this.RgssBadgeBackground));
this.OnPropertyChanged(nameof(this.RgssDetailStatusText));
}
}
}
public override bool IsRgssExtracted
{
get => this._isRgssExtracted;
set
{
if (this._isRgssExtracted != value)
{
this._isRgssExtracted = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.RgssBadgeText));
this.OnPropertyChanged(nameof(this.RgssBadgeBackground));
this.OnPropertyChanged(nameof(this.RgssDetailStatusText));
}
}
}
public string? RgssArchivePath
{
get => this._rgssArchivePath;
set { if (this._rgssArchivePath != value) { this._rgssArchivePath = value; this.OnPropertyChanged(); } }
}
public override Visibility RgssBadgeVisibility => (this.IsRgss && this.HasRgssArchive) ? Visibility.Visible : Visibility.Collapsed;
public override string RgssBadgeText => !(this.IsRgss && this.HasRgssArchive) ? string.Empty : (this.IsRgssExtracted ? "RGSS (抽出済)" : "RGSS (暗号化)");
public override Brush RgssBadgeBackground => !(this.IsRgss && this.HasRgssArchive)
? Brushes.Transparent
: (this.IsRgssExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B))
: new SolidColorBrush(Color.FromRgb(0xD3, 0x54, 0x00)));
public override string RgssDetailStatusText => !(this.IsRgss && this.HasRgssArchive)
? string.Empty
: (this.IsRgssExtracted ? "📦 RGSSアーカイブ(スクリプト抽出済み・改造可能)" : "🔒 RGSS暗号化アーカイブ(起動時またはボタンでスクリプト抽出可能)");
public TkoolEngineType EngineType
{
get => this._engineType;
set
{
if (this._engineType != value)
{
this._engineType = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.EngineKind));
this.OnPropertyChanged(nameof(this.EngineDisplayName));
this.OnPropertyChanged(nameof(this.EngineLabelText));
this.OnPropertyChanged(nameof(this.EngineLabelBackground));
this.OnPropertyChanged(nameof(this.IsMV));
this.OnPropertyChanged(nameof(this.IsMZ));
this.OnPropertyChanged(nameof(this.IsTyrano));
this.OnPropertyChanged(nameof(this.IsVX));
this.OnPropertyChanged(nameof(this.IsVXAce));
this.OnPropertyChanged(nameof(this.IsWolf));
this.OnPropertyChanged(nameof(this.IsSrpgStudio));
this.OnPropertyChanged(nameof(this.IsRgss));
this.OnPropertyChanged(nameof(this.IsNwjs));
this.OnPropertyChanged(nameof(this.IsOther));
this.OnPropertyChanged(nameof(this.NwjsBadgeText));
this.OnPropertyChanged(nameof(this.NwjsBadgeVisibility));
this.OnPropertyChanged(nameof(this.OtherBadgeVisibility));
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility));
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText));
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground));
this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText));
this.OnPropertyChanged(nameof(this.SrpgBadgeVisibility));
this.OnPropertyChanged(nameof(this.SrpgBadgeText));
this.OnPropertyChanged(nameof(this.SrpgBadgeBackground));
this.OnPropertyChanged(nameof(this.SrpgDetailStatusText));
this.OnPropertyChanged(nameof(this.RgssBadgeVisibility));
this.OnPropertyChanged(nameof(this.RgssBadgeText));
this.OnPropertyChanged(nameof(this.RgssBadgeBackground));
this.OnPropertyChanged(nameof(this.RgssDetailStatusText));
}
}
}
// ================= WOLF RPGエディター関連プロパティ =================
private bool _wolfProxyDll = false;
private double _wolfSpeedMultiplier = 3.0;
private bool _hasWolfArchive = false;
private bool _isWolfExtracted = false;
/// <summary>プロキシDLL(version.dll 倍速/メモリフック)を適用するか</summary>
public override bool WolfProxyDll
{
get => this._wolfProxyDll;
set { if (this._wolfProxyDll != value) { this._wolfProxyDll = value; this.OnPropertyChanged(); } }
}
/// <summary>プロキシDLLのスピード倍率</summary>
public double WolfSpeedMultiplier
{
get => this._wolfSpeedMultiplier;
set { if (this._wolfSpeedMultiplier != value) { this._wolfSpeedMultiplier = value; this.OnPropertyChanged(); } }
}
/// <summary>Data.wolf アーカイブが存在するか</summary>
public override bool HasWolfArchive
{
get => this._hasWolfArchive;
set
{
if (this._hasWolfArchive != value)
{
this._hasWolfArchive = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility));
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText));
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground));
this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText));
}
}
}
/// <summary>Data.wolf が解凍済み(Dataフォルダが存在)か</summary>
public override bool IsWolfExtracted
{
get => this._isWolfExtracted;
set
{
if (this._isWolfExtracted != value)
{
this._isWolfExtracted = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeVisibility));
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeText));
this.OnPropertyChanged(nameof(this.WolfArchiveBadgeBackground));
this.OnPropertyChanged(nameof(this.WolfArchiveDetailStatusText));
}
}
}
public override Visibility WolfArchiveBadgeVisibility => (this.IsWolf && this.HasWolfArchive) ? Visibility.Visible : Visibility.Collapsed;
public override string WolfArchiveBadgeText => !(this.IsWolf && this.HasWolfArchive) ? string.Empty : (this.IsWolfExtracted ? "Data解凍済" : "Data.wolf保護");
public override Brush WolfArchiveBadgeBackground => !(this.IsWolf && this.HasWolfArchive)
? Brushes.Transparent
: (this.IsWolfExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0xB8, 0x94))
: new SolidColorBrush(Color.FromRgb(0x63, 0x6E, 0x72)));
public override string WolfArchiveDetailStatusText => !(this.IsWolf && this.HasWolfArchive)
? string.Empty
: (this.IsWolfExtracted
? "Data フォルダに解凍・抽出済みです。ウディタは Data フォルダのマップ・イベント・データベース等を優先して読み込みます。直接ファイルを改造できます。"
: "Data.wolf アーカイブで暗号化・保護されています。下の「Data.wolf を解凍」を実行すると、全データを展開して直接編集・改造可能になります。");
// ================= SRPG Studio関連プロパティ =================
private bool _srpgProxyDll = false;
private double _srpgSpeedMultiplier = 3.0;
/// <summary>SRPG Studio プロキシDLL(version.dll 倍速機能)を適用するか</summary>
public override bool SrpgProxyDll
{
get => this._srpgProxyDll;
set { if (this._srpgProxyDll != value) { this._srpgProxyDll = value; this.OnPropertyChanged(); } }
}
/// <summary>SRPG Studio プロキシDLLのスピード倍率</summary>
public double SrpgSpeedMultiplier
{
get => this._srpgSpeedMultiplier;
set { if (this._srpgSpeedMultiplier != value) { this._srpgSpeedMultiplier = value; this.OnPropertyChanged(); } }
}
/// <summary>SRPG Studio プラグイン改造オプション(PluginOptionsのエイリアス)</summary>
public ObservableCollection<ModPluginOptionItem> SrpgModOptions => this.PluginOptions;
public override bool IsModded
{
get => this._isModded;
set { if (this._isModded != value) { this._isModded = value; this.OnPropertyChanged(); } }
}
public bool HasCustomApplyMod
{
get => this._hasCustomApplyMod;
set { if (this._hasCustomApplyMod != value) { this._hasCustomApplyMod = value; this.OnPropertyChanged(); } }
}
public override bool ApplyMod
{
get => this._applyMod;
set
{
if (this._applyMod != value)
{
this._applyMod = value;
if (!this._isInitializingApplyMod)
{
this.HasCustomApplyMod = true;
}
this.OnPropertyChanged();
}
}
}
public void SetDefaultApplyMod(bool defaultVal)
{
if (!this._hasCustomApplyMod)
{
this._isInitializingApplyMod = true;
this._applyMod = defaultVal;
this._isInitializingApplyMod = false;
this.OnPropertyChanged(nameof(this.ApplyMod));
}
}
public override bool IsAsar
{
get => this._isAsar;
set
{
if (this._isAsar != value)
{
this._isAsar = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.AsarBadgeVisibility));
this.OnPropertyChanged(nameof(this.AsarBadgeText));
this.OnPropertyChanged(nameof(this.AsarBadgeBackground));
this.OnPropertyChanged(nameof(this.AsarDetailStatusText));
}
}
}
public override bool IsAsarExtracted
{
get => this._isAsarExtracted;
set
{
if (this._isAsarExtracted != value)
{
this._isAsarExtracted = value;
this.OnPropertyChanged();
this.OnPropertyChanged(nameof(this.AsarBadgeText));
this.OnPropertyChanged(nameof(this.AsarBadgeBackground));
this.OnPropertyChanged(nameof(this.AsarDetailStatusText));
}
}
}
public string? AsarPath
{
get => this._asarPath;
set { if (this._asarPath != value) { this._asarPath = value; this.OnPropertyChanged(); } }
}
public string? AsarExtractedDirPath
{
get => this._asarExtractedDirPath;
set { if (this._asarExtractedDirPath != value) { this._asarExtractedDirPath = value; this.OnPropertyChanged(); } }
}
public string? RelativePluginsJsInAsar
{
get => this._relativePluginsJsInAsar;
set { if (this._relativePluginsJsInAsar != value) { this._relativePluginsJsInAsar = value; this.OnPropertyChanged(); } }
}
public override Visibility AsarBadgeVisibility => this.IsAsar ? Visibility.Visible : Visibility.Collapsed;
public override string AsarBadgeText => !this.IsAsar ? string.Empty : (this.IsAsarExtracted ? "ASAR (解凍済)" : "ASAR (圧縮)");
public override Brush AsarBadgeBackground => !this.IsAsar
? Brushes.Transparent
: (this.IsAsarExtracted
? new SolidColorBrush(Color.FromRgb(0x00, 0x89, 0x7B))
: new SolidColorBrush(Color.FromRgb(0x5E, 0x35, 0xB1)));
public override string AsarDetailStatusText => !this.IsAsar
? string.Empty
: (this.IsAsarExtracted ? "📦 app.asar 形式(解凍済み・改造可能)" : "📦 app.asar 形式(圧縮中・起動時またはボタンで解凍可能)");
private Dictionary<string, bool> _pluginSettings = new(StringComparer.OrdinalIgnoreCase);
private ObservableCollection<ModPluginOptionItem> _pluginOptions = [];
private ObservableCollection<ModPluginOptionItem> _commonPluginOptions = [];
private ObservableCollection<ModPluginOptionItem> _specificPluginOptions = [];
public Dictionary<string, bool> PluginSettings
{
get => this._pluginSettings;
set { if (this._pluginSettings != value) { this._pluginSettings = value; this.OnPropertyChanged(); } }
}
public override ObservableCollection<ModPluginOptionItem> PluginOptions
{
get => this._pluginOptions;
set { if (this._pluginOptions != value) { this._pluginOptions = value; this.OnPropertyChanged(); } }
}
/// <summary>共通プラグイン設定コレクション</summary>
public override ObservableCollection<ModPluginOptionItem> CommonPluginOptions
{
get => this._commonPluginOptions;
set { if (this._commonPluginOptions != value) { this._commonPluginOptions = value; this.OnPropertyChanged(); } }
}
/// <summary>固有ゲーム専用プラグイン設定コレクション</summary>
public override ObservableCollection<ModPluginOptionItem> SpecificPluginOptions
{
get => this._specificPluginOptions;
set { if (this._specificPluginOptions != value) { this._specificPluginOptions = value; this.OnPropertyChanged(); } }
}
/// <summary>固有ゲーム専用プラグインが存在するかどうか</summary>
public override bool HasSpecificPlugins => this._specificPluginOptions.Count > 0;
/// <summary>
/// プリンセスシナジー専用: HP常時MAX(プラグイン "AlwaysMaxHp")の有効状態。
/// PluginSettings に直接マッピングされ、既存の改造適用パイプラインで反映されます。
/// </summary>
public override bool PrincessAlwaysMaxHp
{
get => this.IsPluginEnabled("AlwaysMaxHp", fallbackVal: false);
set => this.SetPrincessPluginSetting("AlwaysMaxHp", value);
}
/// <summary>
/// プリンセスシナジー専用: MP常時MAX(プラグイン "AlwaysMaxMp")の有効状態。
/// </summary>
public override bool PrincessAlwaysMaxMp
{
get => this.IsPluginEnabled("AlwaysMaxMp", fallbackVal: false);
set => this.SetPrincessPluginSetting("AlwaysMaxMp", value);
}
/// <summary>
/// プラグイン設定を更新し、関連プロパティの変更通知を発行します。
/// </summary>
private void SetPrincessPluginSetting(string pluginId, bool value)
{
if (this._pluginSettings.TryGetValue(pluginId, out var cur) && cur == value)
{
return;
}
this._pluginSettings[pluginId] = value;
this.OnPropertyChanged(pluginId == "AlwaysMaxHp" ? nameof(this.PrincessAlwaysMaxHp) : nameof(this.PrincessAlwaysMaxMp));
// プラグイン一覧側のアイテムとも同期
var optItem = this._pluginOptions.FirstOrDefault(o => string.Equals(o.Id, pluginId, StringComparison.OrdinalIgnoreCase));
if (optItem != null && optItem.IsEnabled != value)
{
optItem.IsEnabled = value;
}
// 連動して独自の改造設定であることを示す
this.HasCustomApplyMod = true;
}
public bool IsPluginEnabled(string pluginId, Dictionary<string, bool>? defaultSettings = null, bool fallbackVal = true)
{
if (this._pluginSettings.TryGetValue(pluginId, out var val))
{
return val;
}
if (pluginId is "BattleTurnRecoverHp" or "BattleTurnRecoverMp" or "BattleTurnRecoverTp")
{
if (this._pluginSettings.TryGetValue("BattleTurnRecover", out var legacyVal))
{
return legacyVal;
}
}
// ショップ初期個数最大および個別ゲーム専用プラグインは未操作ゲームでは常に既定でOFF
if (pluginId is "ShopMaxBuy" or "AlwaysMaxHp" or "AlwaysMaxMp")
{
return false;
}
if (defaultSettings != null && defaultSettings.TryGetValue(pluginId, out var defVal))
{
return defVal;
}
if (pluginId is "BattleTurnRecoverHp" or "BattleTurnRecoverMp" or "BattleTurnRecoverTp")
{
if (defaultSettings != null && defaultSettings.TryGetValue("BattleTurnRecover", out var legacyDefVal))
{
return legacyDefVal;
}
}
return fallbackVal;
}
public static readonly ModPluginDefinition[] DefaultTyranoPlugins =
[
new() { Id = "TyranoUnlockAllCg", Name = "🔓 全CG・全回想の全開放", Description = "システム変数(sf)のCG・回想フラグを全開放し、最初からCG・シーン鑑賞を可能にします。" },
new() { Id = "TyranoFastMessage", Name = "⚡ メッセージ超高速化・演出ウェイト短縮", Description = "文字送り速度を最大化し、[wait]演出の停止時間を短縮して快適にスキップ可能にします。" },
new() { Id = "TyranoDevTools", Name = "🛠 開発者ツール (F12) の有効化", Description = "F12キーでブラウザ・アプリの開発者ツールコンソールを開けるようにします。" },
new() { Id = "TyranoCheatMenu", Name = "🎛 画面上変数(f)チートエディタ表示", Description = "画面右上にボタンを配置し、ゲーム内変数・フラグの閲覧と直接書き換えができるメニューを表示します。" }
];
/// <summary>ツクールVX / VX Ace用スクリプト改造定義一覧</summary>
public static readonly ModPluginDefinition[] DefaultRgssPlugins =
[
new() { Id = "RgssDashSpeedUp", Name = "⚡ 移動速度高速化&常時オートダッシュ", Description = "キャラクターの移動速度を高速化し、Shiftキーを押さなくても常時ダッシュ状態にします。" },
new() { Id = "RgssItemGainMax", Name = "🎁 アイテム入手時 99個固定化", Description = "宝箱・イベント・戦闘等で通常アイテムを入手した際、入手個数を99個にします。" },
new() { Id = "RgssItemNoConsume", Name = "♾️ アイテム消費なし", Description = "アイテムを使用しても所持個数を減少しないようにします。" },
new() { Id = "RgssGoldGainMax", Name = "💰 獲得ゴールド最大化 (999,999G)", Description = "戦闘勝利時の獲得ゴールドを999,999Gにします。" },
new() { Id = "RgssExpGainMax", Name = "📈 獲得経験値最大化 (999,999Exp)", Description = "戦闘勝利時の獲得経験値を999,999Expにします。" },
new() { Id = "RgssBattleTurnRecoverHp", Name = "💖 ターン開始時 全回復 (HP)", Description = "戦闘中の毎ターン開始時にパーティ全員のHPを全回復します。" },
new() { Id = "RgssBattleTurnRecoverMp", Name = "🔷 ターン開始時 全回復 (MP)", Description = "戦闘中の毎ターン開始時にパーティ全員のMPを全回復します。" },
new() { Id = "RgssBattleTurnRecoverTp", Name = "⚡ ターン開始時 全回復 (TP)", Description = "戦闘中の毎ターン開始時にパーティ全員のTPを最大(100)にします。(VX Ace)" },
new() { Id = "RgssMessageInstant", Name = "⏩ メッセージ瞬間表示・高速スキップ", Description = "会話ウィンドウの文字送りウェイトをカットし、瞬間表示します。" },
new() { Id = "RgssCommandMemory", Name = "🧠 コマンド位置記憶 (ツクールMV風)", Description = "メニュー画面や戦闘中のアクターコマンドのカーソル選択位置を記憶して次回遷移時に復元します。" },
new() { Id = "RgssWindowResizeFull", Name = "🖥 ウィンドウをディスプレイに合わせて整数倍拡大 (スクリプト注入)", Description = "ゲーム起動時に論理解像度をディスプレイに収まる最大の整数倍(1x/2x/3x...)へ拡大し、ウィンドウを追従させます。VX AceはGraphics.resize_screen、VX(RGSS2)はWin32APIフォールバックで拡大します。解除で完全復元されます。" },
new() { Id = "RgssWindowResizeExternal", Name = "🪟 外部ツールでウィンドウ拡大 (Win32 API / Sizer等)", Description = "ゲーム側は無改造のまま、ランチャーがゲームウィンドウを検出してディスプレイに収まる最大の整数倍へ拡大します。外部ツールパス設定があればそちらを優先起動します。(既定OFF)" }
];
/// <summary>SRPG Studio用スクリプト改造定義一覧</summary>
public static readonly ModPluginDefinition[] DefaultSrpgPlugins =
[
new() { Id = "SrpgExpBoost", Name = "📈 獲得経験値最大化 (即LvUP / 100Exp固定)", Description = "戦闘やアイテム使用時の獲得経験値を最大(100Exp)にして毎回即座にレベルアップします。" },
new() { Id = "SrpgMaxGold", Name = "💰 所持金最大化 (999,999G)", Description = "自軍ターン開始時および戦闘勝利時に所持金を常に最大(999,999G)に設定します。" },
new() { Id = "SrpgInfDurability", Name = "♾️ 武器・アイテム耐久度無限", Description = "武器やアイテムを使用しても耐久度が減少しないようにします。" },
new() { Id = "SrpgTurnRecoverHp", Name = "💖 自軍ターン開始時 全味方HP全回復", Description = "プレイヤーのターン開始時に生存している全味方ユニットのHPを満タンまで回復します。" },
new() { Id = "SrpgMoveBoost", Name = "👟 味方移動力大幅強化 (+5)", Description = "自軍味方ユニットの基本移動力を+5加算し、広大なマップでも自在に行動できるようにします。" },
new() { Id = "SrpgItemAllDrop", Name = "🎁 敵撃破時アイテム100%ドロップ", Description = "敵ユニットが所持しているドロップ可能アイテムのドロップ率を100%にします。" }
];
public void SyncPluginOptions(IEnumerable<ModPluginDefinition> availablePlugins, Dictionary<string, bool>? defaultSettings = null)
{
this._pluginOptions.Clear();
this._commonPluginOptions.Clear();
this._specificPluginOptions.Clear();
if (this.EngineType is TkoolEngineType.Wolf or TkoolEngineType.Nwjs)
{
this.OnPropertyChanged(nameof(this.HasSpecificPlugins));
return;
}
IEnumerable<ModPluginDefinition> targetDefs;
if (this.EngineType == TkoolEngineType.Tyrano)
{
targetDefs = DefaultTyranoPlugins;
}
else if (this.IsRgss)
{
targetDefs = DefaultRgssPlugins;
}
else if (this.IsSrpgStudio)
{
targetDefs = DefaultSrpgPlugins;
}
else
{
// MV / MZ: 固有ゲームプラグイン(AlwaysMaxHp/AlwaysMaxMp等)は、対象ゲーム以外では一覧に表示しない
targetDefs = availablePlugins.Where(p =>
{
// 削除対象の旧プラグインは除外
if (string.Equals(p.Id, "GameLauncher_Mod", StringComparison.OrdinalIgnoreCase) ||
string.Equals(p.Id, "GameLauncher_StandaloneMod", StringComparison.OrdinalIgnoreCase))
{
return false;
}
if (p.IsGameSpecific)
{
if (string.Equals(p.TargetGameKey, "PrincessSynergy", StringComparison.OrdinalIgnoreCase) && !this.IsPrincessSynergy)
{
return false;
}
}
return true;
});
}
foreach (var def in targetDefs)
{
bool isEnabled = this.IsPluginEnabled(def.Id, defaultSettings, fallbackVal: def.DefaultEnabled);
var item = new ModPluginOptionItem
{
Definition = def,
IsEnabled = isEnabled
};
item.PropertyChanged += (s, e) =>
{
if (e.PropertyName == nameof(ModPluginOptionItem.IsEnabled))
{
this._pluginSettings[def.Id] = item.IsEnabled;
if (def.Id == "AlwaysMaxHp")
{
this.OnPropertyChanged(nameof(this.PrincessAlwaysMaxHp));
}
else if (def.Id == "AlwaysMaxMp")
{
this.OnPropertyChanged(nameof(this.PrincessAlwaysMaxMp));
}
}
};
this._pluginOptions.Add(item);
if (def.IsGameSpecific)
{
this._specificPluginOptions.Add(item);
}
else
{
this._commonPluginOptions.Add(item);
}
}
this.OnPropertyChanged(nameof(this.HasSpecificPlugins));
}
public ModPluginOptions ModOptions
{
get => this._modOptions;
set { if (this._modOptions != value) { this._modOptions = value; this.OnPropertyChanged(); } }
}
public string EngineDisplayName => this.EngineType switch
{
TkoolEngineType.MV => "RPGツクールMV",
TkoolEngineType.MZ => "RPGツクールMZ",
TkoolEngineType.Tyrano => "ティラノスクリプト",
TkoolEngineType.VX => "RPGツクールVX",
TkoolEngineType.VXAce => "RPGツクールVX Ace",
TkoolEngineType.Wolf => "WOLF RPGエディター",
TkoolEngineType.SrpgStudio => "SRPG Studio",
TkoolEngineType.Nwjs => "NW.js",
_ => "ツクール/ティラノ"
};
}
}