Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
764240e
[Minor] adds a stopwatch to monitor patching time
remyCases Aug 21, 2024
00bec1c
[Major] updates utmt dlls
remyCases Aug 21, 2024
ab770d6
[Minor] updates version to a dev one
remyCases Aug 30, 2024
68c48f3
[Minor] adds utmt version in the first log
remyCases Aug 30, 2024
c0a7456
Merge branch 'main' into Dev
altairwei Nov 6, 2024
fd771a6
[Major] Allows a new room to be created from a Json file (by Pong)
altairwei Nov 6, 2024
c22d249
[Minor] Fixed InstanceID allocation problem in AddRoomJson
altairwei Nov 10, 2024
b720989
[Minor] Did some workaround for RtR
altairwei Jan 24, 2025
5be0446
Merge pull request #92 from altairwei/Dev
remyCases Jan 24, 2025
a48ecb1
[Minor] Added checksum for Steam 0.9.1.16-vm to whitelist
Nylux Jan 27, 2025
e88b00d
Merge pull request #93 from Nylux/Dev
remyCases Jan 27, 2025
01dbb50
Fixed issue with underscores in mod source name
Nylux Jan 28, 2025
df09959
Updated ConsumpParam table (now ItemStats) for RtR
Nylux Jan 29, 2025
f3f2217
Added Steam 0.9.1.17-vm to checksum whitelist
Nylux Jan 29, 2025
9acd53d
[Minor] Updated Contract table (now ContractsStats) for RtR
Nylux Jan 29, 2025
0799450
[Minor] Updated CreditsBackers table (now Backers) for RtR
Nylux Jan 30, 2025
ea05e27
[Minor] Updated EnemyBalance table (now MobsStats) for RtR
Nylux Jan 30, 2025
4581ffd
[Minor] Updated Potion table (now PotionsStats) for RtR
Nylux Jan 30, 2025
ad6b0b6
[Minor] Updated SkillsStat table (now SkillsStats) for RtR
Nylux Jan 31, 2025
44716de
[Minor] Updated Armor table for RtR
Nylux Jan 31, 2025
93fe26c
[Minor] Added SurfaceSpawn table
Nylux Jan 31, 2025
e68e89c
[Minor] Added Steam 0.9.1.18-vm checksum to whitelist
Nylux Jan 31, 2025
2cb7a53
[Minor] Added RecipesCook table
Nylux Jan 31, 2025
a2a97e0
[Minor] Added Drops table
Nylux Feb 2, 2025
443351b
Added RecipesCraft table
Nylux Feb 4, 2025
d84f23d
[Minor] Added DungeonsSpawn table
Nylux Feb 4, 2025
32d3af7
[Minor] Cleaned up TableUtils, Updated Weapons table for RtR
Nylux Feb 4, 2025
5934f94
[Doc] Minor edits
Nylux Feb 4, 2025
4cb5242
[Doc] Removed useless instruction in release workflow
Nylux Feb 4, 2025
499d191
Version bump to 0.13.1.0
Nylux Feb 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Controls/SourceBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
RenderOptions.BitmapScalingMode="NearestNeighbor"
RenderOptions.ClearTypeHint="Enabled"/>
</Border>
<Label Name="ModName" HorizontalAlignment="Left"
Margin="16,16,0,0" VerticalAlignment="Top"
Content="{Binding Name}" Foreground="White"
FontSize="15" Style="{StaticResource xFont}"/>
<TextBlock Name="ModName" HorizontalAlignment="Left"
Margin="16,16,0,0" VerticalAlignment="Top"
Text="{Binding Name}" Foreground="White"
FontSize="15" Style="{StaticResource sFont}"/>
<Button x:Name="CompileButton" Width="120" Height="39"
VerticalAlignment="Bottom" HorizontalAlignment="Right"
Margin="0,0,168,12" Padding="0" BorderBrush="Transparent"
Expand Down
15 changes: 11 additions & 4 deletions DataLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,16 @@ private static string ComputeChecksum(FileStream stream)
private static bool CompareChecksum(FileStream stream)
{
string hash = ComputeChecksum(stream);
const string hashGog = "6E37E076EDFDC25468195EC1FFA937A5";
const string hashSteam = "392EE0E8C6A09A16DED58C5737ECF1B5";
return hash == hashGog || hash == hashSteam;
// Log.Information(hash); // uncomment to log the checksum of new versions and add to the array
string[] checksums =
{
"6E37E076EDFDC25468195EC1FFA937A5", // GOG 0.8.2.10
"392EE0E8C6A09A16DED58C5737ECF1B5", // Steam 0.8.2.10
"5F91989CA7E2A2B1234B2CD2A6AF9821", // Steam 0.9.1.16-vm
"2BD331F728428746FA337D6C7B67040A", // Steam 0.9.1.17-vm
"6F9F1E29275EEF60E3A725ECA1033DF8" // Steam 0.9.1.18-vm
};
return checksums.Contains(hash);
}
private static bool LoadUmt(string filename)
{
Expand All @@ -133,7 +140,7 @@ private static bool LoadUmt(string filename)
{
if(!CompareChecksum(stream))
{
Log.Warning("Checksum inconsistency, {{{0}}} is not vanilla.", filename);
Log.Warning("Checksum inconsistency, {{{0}}} may not be vanilla or is a new version.", filename);
}
data = UndertaleIO.Read(
stream, warning =>
Expand Down
5 changes: 4 additions & 1 deletion Main.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Runtime.InteropServices;
using ModShardLauncher.Mods;
using System.Diagnostics;
using UndertaleModLib.Models;

namespace ModShardLauncher
{
Expand All @@ -36,6 +37,7 @@ public partial class Main : Window
public const int SW_SHOW = 5;
public static IntPtr handle;
public string mslVersion;
public string utmtlibVersion;
//
private const double DefaultWidth = 960; // Исходная ширина
private const double DefaultHeight = 800; // Исходная высота
Expand Down Expand Up @@ -75,13 +77,14 @@ public Main()
ProcessModule mainProcess = Msl.ThrowIfNull(Process.GetCurrentProcess().MainModule);
string mainProcessName = Msl.ThrowIfNull(mainProcess.FileName);
mslVersion = "v" + FileVersionInfo.GetVersionInfo(mainProcessName).FileVersion;
utmtlibVersion = "v" + FileVersionInfo.GetVersionInfo(typeof(UndertaleCode).Assembly.Location).FileVersion;
}
catch (FileNotFoundException ex)
{
Log.Error(ex, "Cannot find the dll of ModShardLauncher");
throw;
}
Log.Information("Launching msl {{{0}}}", mslVersion);
Log.Information("Launching msl {{{0}}} using UTMT {{{1}}}", mslVersion, utmtlibVersion);

try
{
Expand Down
12 changes: 9 additions & 3 deletions ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void ShowMessage(string msg)
public static void Initalize()
{
Weapons = Msl.ThrowIfNull(GetTable("gml_GlobalScript_table_weapons"));
WeaponDescriptions = Msl.ThrowIfNull(GetTable("gml_GlobalScript_table_weapons_text"));
WeaponDescriptions = Msl.ThrowIfNull(GetTable("gml_GlobalScript_table_equipment"));
}
internal static void AddCredit(string modNameShort, string[] authors)
{
Expand Down Expand Up @@ -175,6 +175,8 @@ public static void PatchMods()
Disclaimers = new();
List<ModFile> mods = ModInfos.Instance.Mods;
Menus = new();

Stopwatch watch = Stopwatch.StartNew();
foreach (ModFile mod in mods)
{
if (!mod.isEnabled) continue;
Expand Down Expand Up @@ -202,6 +204,10 @@ public static void PatchMods()
Msl.AddDisclaimerRoom(Credits.Select(x => x.Item1).ToArray(), Credits.SelectMany(x => x.Item2).Distinct().ToArray());
Msl.ChainDisclaimerRooms(Disclaimers);
Msl.CreateMenu(Menus);

watch.Stop();
long elapsedMs = watch.ElapsedMilliseconds;
Log.Information("Patching lasts {{{0}}} ms", elapsedMs);
}
public static void LoadWeapon(Type type)
{
Expand All @@ -226,8 +232,8 @@ public static void PatchFile()
}
internal static void PatchInnerFile()
{
if (Data.Code.All(x => x.Name.Content != "print"))
Msl.AddInnerFunction("print");
if (Data.Code.All(x => x.Name.Content != "msl_print"))
Msl.AddInnerFunction("msl_print");
if (Data.Code.All(x => x.Name.Content != "give"))
Msl.AddInnerFunction("give");
if (Data.Code.All(x => x.Name.Content != "SendMsg"))
Expand Down
26 changes: 19 additions & 7 deletions ModShardLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@
<ApplicationIcon>ico.ico</ApplicationIcon>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
<FileVersion>0.12.1.0</FileVersion>
<FileVersion>0.13.1.0</FileVersion>
</PropertyGroup>

<ItemGroup> <!-- Include the specific files to exclude the ones in the test folder -->
<Compile Include="*.cs" Exclude="bin\**;obj\**;ModShardLauncherTest\**.*cs" />
<Compile Include="ModUtils\TableUtils\ConsumParam.cs" />
<Compile Include="ModUtils\TableUtils\Contract.cs" />
<Compile Include="ModUtils\TableUtils\CreditsBackers.cs" />
<Compile Include="ModUtils\TableUtils\EnemyBalance.cs" />
<Compile Include="ModUtils\TableUtils\Potion.cs" />
<Compile Include="ModUtils\TableUtils\SkillsStat.cs" />
<Compile Include="ModUtils\TableUtils\Backers.cs" />
<Compile Include="ModUtils\TableUtils\ContractsStats.cs" />
<Compile Include="ModUtils\TableUtils\Drops.cs" />
<Compile Include="ModUtils\TableUtils\DungeonsSpawn.cs" />
<Compile Include="ModUtils\TableUtils\ItemStats.cs" />
<Compile Include="ModUtils\TableUtils\MobsStats.cs" />
<Compile Include="ModUtils\TableUtils\PotionsStats.cs" />
<Compile Include="ModUtils\TableUtils\RecipesCook.cs" />
<Compile Include="ModUtils\TableUtils\RecipesCraft.cs" />
<Compile Include="ModUtils\TableUtils\SkillsStats.cs" />
<Compile Include="ModUtils\TableUtils\SurfaceSpawn.cs" />
<Compile Include="ModUtils\TableUtils\TableArmor.cs" />
<Compile Include="ModUtils\TableUtils\TableUtils.cs" />
<Compile Include="ModUtils\TableUtils\LocalizationUtils.cs" />
Expand Down Expand Up @@ -211,4 +216,11 @@
<Copy SourceFiles="ModReference\netstandard.dll;ModReference\System.Collections.dll;ModReference\System.Runtime.dll;ModReference\System.Linq.dll;ModReference\System.ObjectModel.dll" DestinationFolder="$(OutDir)" />
</Target>

<Target Name="CopyDevFiles" AfterTargets="Publish">
<Copy SourceFiles="Resources\ExportRoom.csx" DestinationFolder="$(PublishDir)" />
<Copy SourceFiles="Reference\UndertaleModLib.dll" DestinationFolder="$(PublishDir)" />
<Copy SourceFiles="Reference\UndertaleModTool.dll" DestinationFolder="$(PublishDir)" />
<Copy SourceFiles="$(OutputPath)ModShardLauncher.dll" DestinationFolder="$(PublishDir)" />
</Target>

</Project>
165 changes: 0 additions & 165 deletions ModUtils/CodeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,20 +444,6 @@ public static string Collect(this FileEnumerable<(Match, string)> fe)
if (otherEnumerator.MoveNext())
otherString = otherEnumerator.Current;

//TODO Delete (Necromancy)
if (otherString == "var XP = math_round((")
{
otherString = "var XP = math_round(";
}
else if (otherString == "return 1")
{
otherString = "return false";
}

//TODO Delete (UI+ 2.0.0)
if (otherString == " is_activate = _notEmpty")
otherString = "is_activate = _notEmpty";

foreach (string element in ienumerable)
{
if (m != Match.After && otherString != null && element.Contains(otherString))
Expand All @@ -471,16 +457,6 @@ public static string Collect(this FileEnumerable<(Match, string)> fe)
m = Match.After;
}

//TODO Delete (CraftableArrows)
if(otherString == " select = 1")
{
otherString = " select = true";
}
else if(otherString == " global.inv_select = 1")
{
otherString = " global.inv_select = true";
}

}
else
{
Expand Down Expand Up @@ -633,12 +609,6 @@ public static string Collect(this FileEnumerable<(Match, string)> fe)
if (otherUntilEnumerator.MoveNext())
otherUntilString = otherUntilEnumerator.Current;

//TODO Delete (ArtifactKnowledge)
if(otherUntilString == " _create_exit = 1")
{
otherUntilString = " _create_exit = true";
}

foreach ((Match m, string element) in ienumerable.MatchFrom(otherfrom))
{
if (m == Match.Before || m == Match.Matching)
Expand Down Expand Up @@ -973,141 +943,6 @@ public static IEnumerable<string> Apply(this IEnumerable<string> ienumerable, Fu
/// </summary>
public static FileEnumerable<string> Apply(this FileEnumerable<string> fe, Func<IEnumerable<string>, IEnumerable<string>> iterator)
{
//TODO Delete SpeedShard
#region SpeedShard
if (fe.header.fileName == "gml_GlobalScript_scr_loot_chestRemoteBastion")
{
var newEnumerable = new List<string>
{
"var _temp_local_var_2;",
"function scr_loot_chestRemoteBastion() //gml_Script_scr_loot_chestRemoteBastion",
"{",
" var lvl = 1;",
" var min_lvl = scr_globaltile_dungeon_get(\"mob_lvl_min\");",
" var max_lvl = scr_globaltile_dungeon_get(\"mob_lvl_max\");",
" var tier = floor(((max_lvl + min_lvl) / 2));",
" lootScriptShowData(tier);",
" var predicat = scr_loot_allweapon();",
" with (o_player)",
" lvl = (scr_atr(\"LVL\") + random_range(0, 4));",
" var _temp_local_var_2 = tier;",
" with (scr_inventory_add_item(o_inv_moneybag))",
" ds_map_replace(data, \"Stack\", (300 + irandom_range(300, 600)));",
" if scr_chance_value(50)",
" scr_inventory_add_weapon(scr_find_weapon_params(15, 25, scr_loot_weapon()));",
" else if scr_chance_value(50)",
" scr_inventory_add_weapon(scr_find_weapon_params(15, 25, scr_loot_armor()));",
" if scr_chance_value(75)",
" scr_inventory_add_item(choose(3050, 3086));",
" if scr_chance_value(100)",
" {",
" var gems = choose(3016, 3014, 3017, 3013);",
" var precious = choose(2951, 2952, 2953);",
" var goods = choose(2963, 2964, 2966, 2961);",
" scr_inventory_add_item(choose(gems, precious, goods));",
" }",
" if scr_chance_value(50)",
" scr_inventory_add_item(choose(3243, 4570, 340, 579, 2609), id, -4, 1, -4, 1, 1);",
" else",
" {",
" with (scr_inventory_add_weapon(choose(\"Jarl Blade\", \"Royal Sword\", \"Relict Blade\", \"Guard Broadsword\", \"Decorated Saber\", \"Ancient Scimitar\", \"Gilded Axe\", \"Feudal Axe\", \"Decorated Flanged Mace\", \"Decorated Warhammer\", \"Ornate Greatsword\", \"Espadon\", \"Faceless Spear\", \"Decorated Voulge\", \"Ornate Longaxe\", \"Exquisite Grandmace\", \"Relict Polehammer\", \"Decorated Longbow\", \"Relic Bow\", \"Guard Crossbow\", \"Orient Staff\", \"Relict Staff\", \"Hermit Staff\", \"Guardian Shield\", \"Sun Shield\", \"Uroboros Shield\", \"Engraved Boots\", \"Decorated Barbute\", \"Joust Bascinet\", \"Joust Topfhelm\", \"Pigfaced Bascinet\", \"Decorated Sallet\", \"Mastercrafted Sallet\", \"Hermit Circlet\", \"Royal Ranger Gambeson\", \"Ceremonial Cuirass\", \"Vagabond Knight Armor\", \"Joust Armor\", \"Hermit Ring\"), (6 << 0)))",
" scr_inv_atr_set(\"Duration\", irandom_range(35, 60));",
" }",
" scr_random_speech(\"containerRich\");",
"}"
};

return new FileEnumerable<string>(fe.header, iterator(newEnumerable));
}
else if (fe.header.fileName == "gml_GlobalScript_scr_loot_chestRemoteCrypt")
{
var newEnumerable = new List<string>
{
"var _temp_local_var_2;",
"function scr_loot_chestRemoteCrypt() //gml_Script_scr_loot_chestRemoteCrypt",
"{",
" var lvl = 1;",
" var min_lvl = scr_globaltile_dungeon_get(\"mob_lvl_min\");",
" var max_lvl = scr_globaltile_dungeon_get(\"mob_lvl_max\");",
" var tier = floor(((max_lvl + min_lvl) / 2));",
" lootScriptShowData(tier);",
" var predicat = scr_loot_allweapon();",
" with (o_player)",
" lvl = (scr_atr(\"LVL\") + random_range(0, 4));",
" var _temp_local_var_2 = tier;",
" with (scr_inventory_add_item(o_inv_moneybag))",
" ds_map_replace(data, \"Stack\", (300 + irandom_range(300, 600)));",
" if scr_chance_value(50)",
" scr_inventory_add_weapon(scr_find_weapon_params(15, 25, scr_loot_weapon()));",
" else if scr_chance_value(50)",
" scr_inventory_add_weapon(scr_find_weapon_params(15, 25, scr_loot_armor()));",
" if scr_chance_value(75)",
" scr_inventory_add_item(choose(3050, 3086));",
" if scr_chance_value(100)",
" {",
" var gems = choose(3016, 3014, 3017, 3013);",
" var precious = choose(2951, 2952, 2953);",
" var goods = choose(2963, 2964, 2966, 2961);",
" scr_inventory_add_item(choose(gems, precious, goods));",
" }",
" if scr_chance_value(50)",
" scr_inventory_add_item(choose(6365, 818, 1579, 104, 822, 2609), id, -4, 1, -4, 1, 1);",
" else",
" {",
" with (scr_inventory_add_weapon(choose(\"Jarl Blade\", \"Royal Sword\", \"Relict Blade\", \"Guard Broadsword\", \"Decorated Saber\", \"Ancient Scimitar\", \"Gilded Axe\", \"Feudal Axe\", \"Decorated Flanged Mace\", \"Decorated Warhammer\", \"Ornate Greatsword\", \"Espadon\", \"Faceless Spear\", \"Decorated Voulge\", \"Ornate Longaxe\", \"Exquisite Grandmace\", \"Relict Polehammer\", \"Decorated Longbow\", \"Relic Bow\", \"Guard Crossbow\", \"Orient Staff\", \"Relict Staff\", \"Hermit Staff\", \"Guardian Shield\", \"Sun Shield\", \"Uroboros Shield\", \"Engraved Boots\", \"Decorated Barbute\", \"Joust Bascinet\", \"Joust Topfhelm\", \"Pigfaced Bascinet\", \"Decorated Sallet\", \"Mastercrafted Sallet\", \"Hermit Circlet\", \"Royal Ranger Gambeson\", \"Ceremonial Cuirass\", \"Vagabond Knight Armor\", \"Joust Armor\", \"Druid Robe\", \"Hermit Ring\"), (6 << 0)))",
" scr_inv_atr_set(\"Duration\", irandom_range(35, 60));",
" }",
" scr_random_speech(\"containerRich\");",
"}"
};

return new FileEnumerable<string>(fe.header, iterator(newEnumerable));
}
else if (fe.header.fileName == "gml_GlobalScript_scr_loot_chestRemoteCatacombs")
{
var newEnumerable = new List<string>
{
"var _temp_local_var_2;",
"function scr_loot_chestRemoteCatacombs() //gml_Script_scr_loot_chestRemoteCatacombs",
"{",
" var lvl = 1;",
" var min_lvl = scr_globaltile_dungeon_get(\"mob_lvl_min\");",
" var max_lvl = scr_globaltile_dungeon_get(\"mob_lvl_max\");",
" var tier = floor(((max_lvl + min_lvl) / 2));",
" lootScriptShowData(tier);",
" var predicat = scr_loot_allweapon();",
" with (o_player)",
" lvl = (scr_atr(\"LVL\") + random_range(0, 4));",
" var _temp_local_var_2 = tier;",
" with (scr_inventory_add_item(o_inv_moneybag))",
" ds_map_replace(data, \"Stack\", (300 + irandom_range(300, 600)));",
" if scr_chance_value(25)",
" scr_inventory_add_weapon(scr_find_weapon_params(15, 25, scr_loot_weapon()));",
" else if scr_chance_value(25)",
" scr_inventory_add_weapon(scr_find_weapon_params(15, 25, scr_loot_armor()));",
" if scr_chance_value(50)",
" scr_inventory_add_item(choose(3050, 3086));",
" if scr_chance_value(100)",
" {",
" var gems = choose(3016, 3014, 3017, 3013);",
" var precious = choose(2951, 2952, 2953);",
" var goods = choose(2963, 2964, 2966, 2961);",
" scr_inventory_add_item(choose(gems, precious, goods));",
" }",
" if scr_chance_value(50)",
" scr_inventory_add_item(choose(818, 104, 6365, 579, 2609), id, -4, 1, -4, 1, 1);",
" else",
" {",
" with (scr_inventory_add_weapon(choose(\"Jarl Blade\", \"Royal Sword\", \"Relict Blade\", \"Guard Broadsword\", \"Decorated Saber\", \"Ancient Scimitar\", \"Gilded Axe\", \"Feudal Axe\", \"Decorated Flanged Mace\", \"Decorated Warhammer\", \"Ornate Greatsword\", \"Espadon\", \"Faceless Spear\", \"Decorated Voulge\", \"Ornate Longaxe\", \"Exquisite Grandmace\", \"Relict Polehammer\", \"Decorated Longbow\", \"Relic Bow\", \"Guard Crossbow\", \"Orient Staff\", \"Relict Staff\", \"Guardian Shield\", \"Sun Shield\", \"Uroboros Shield\", \"Engraved Boots\", \"Decorated Barbute\", \"Joust Bascinet\", \"Joust Topfhelm\", \"Pigfaced Bascinet\", \"Decorated Sallet\", \"Mastercrafted Sallet\", \"Royal Ranger Gambeson\", \"Ceremonial Cuirass\", \"Vagabond Knight Armor\", \"Druid Robe\", \"Hermit Ring\"), (6 << 0)))",
" scr_inv_atr_set(\"Duration\", irandom_range(35, 60));",
" }",
" scr_random_speech(\"containerRich\");",
"}"
};

return new FileEnumerable<string>(fe.header, iterator(newEnumerable));
}
#endregion
return new(fe.header, fe.ienumerable.Apply(iterator));
}
/// <summary>
Expand Down
Loading
Loading