-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ddc5231
Showing
9 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: wasikuss | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vscode | ||
bin | ||
obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net35</TargetFramework> | ||
<AssemblyName>CastleStory_MultiplayerPlusPlugin</AssemblyName> | ||
<Description>CastleStory: Multiplayer+ Plugin</Description> | ||
<Version>0.1.0</Version> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<LangVersion>latest</LangVersion> | ||
<CastleStoryManagedPath>PUT_HERE_PATH_TO_CASTLE_STORY_FOLDER/Castle Story_Data/Managed</CastleStoryManagedPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" /> | ||
<PackageReference Include="BepInEx.Core" Version="5.*" /> | ||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" /> | ||
<PackageReference Include="UnityEngine.Modules" Version="5.6.5" IncludeAssets="compile" /> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>$(CastleStoryManagedPath)/Assembly-CSharp-firstpass.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="UnityEngine.Networking"> | ||
<HintPath>$(CastleStoryManagedPath)/UnityEngine.Networking.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'"> | ||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 wasikuss | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" /> | ||
</packageSources> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# CastleStory: Multiplayer+ | ||
This mod extends and adds multiplayer related features to the game. | ||
|
||
## Features | ||
### 1. 10-Players | ||
By default mod changes number of players from 4 to 10. Only host is required to have it installed. | ||
In future clients could also benefit from additional changes like proper size of lobby (currently game has it hardcoded to 4). | ||
|
||
Vanilla game has some additional logic for multiplayer which mod keep unaltered: | ||
- if there is more players than teams (again hardcoded to 4), they will be sharing the same bricktrons - all players in the same team are allies | ||
- if there is more players than spawnpoints (map related setting), they will be sharing the same bricktrons and crystal | ||
- if there is more players than colors (flags, map related setting), they can have the same color features but still be an enemy | ||
|
||
Ass one thing is unrelated to map (teams), mod introduces custom command to lobby chat: `/teams`, which will assign separete team to each player. | ||
It causes that players above team D (4th) will disappear from list, but will be still in lobby. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
|
||
using BepInEx; | ||
using HarmonyLib; | ||
using BepInEx.Logging; | ||
|
||
|
||
namespace CastleStory_MultiplayerPlusPlugin | ||
{ | ||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] | ||
|
||
public class Plugin : BaseUnityPlugin | ||
{ | ||
private static Plugin _instance; | ||
public static Plugin Instance | ||
{ | ||
get | ||
{ | ||
if (_instance == null) | ||
{ | ||
throw new InvalidOperationException(); | ||
} | ||
return _instance; | ||
} | ||
} | ||
|
||
public ManualLogSource Log { get { return Logger; } } | ||
|
||
private void Awake() | ||
{ | ||
_instance = this; | ||
|
||
new Harmony("com.wasikuss.castlestory.multiplayerplus").PatchAll(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using HarmonyLib; | ||
using Brix.Network; | ||
|
||
namespace CastleStory_MultiplayerPlusPlugin | ||
{ | ||
[HarmonyPatch(typeof(LobbyPlayer), nameof(LobbyPlayer.CmdSendChatMessage))] | ||
public class LobbyPlayerPatch | ||
{ | ||
static bool Prefix(LobbyPlayer __instance, string message) | ||
{ | ||
if (__instance.hasAuthority && message.Equals("/teams")) | ||
{ | ||
int team = 0; | ||
UNetManager.instance.LobbyPlayerList.ForEach(delegate(LobbyPlayer lp) | ||
{ | ||
lp.CallCmdSetTeam(team++); | ||
}); | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection.Emit; | ||
|
||
using HarmonyLib; | ||
using Brix.Network; | ||
|
||
namespace CastleStory_MultiplayerPlusPlugin | ||
{ | ||
[HarmonyPatch(typeof(UNetManager), nameof(UNetManager.Initialize))] | ||
public class UNetManagerPatch | ||
{ | ||
static void Postfix(UNetManager __instance) | ||
{ | ||
__instance.maxConnections = 10; | ||
__instance.maxPlayers = 10; | ||
} | ||
|
||
[HarmonyTranspiler] | ||
[HarmonyPatch(nameof(UNetManager.StartHostMultiplayer))] | ||
static IEnumerable<CodeInstruction> StartHostMultiplayerTranspiler(IEnumerable<CodeInstruction> instructions) | ||
{ | ||
var codes = new List<CodeInstruction>(instructions); | ||
for (var i = 0; i < codes.Count; i++) | ||
{ | ||
if (codes[i].opcode == OpCodes.Ldc_I4_2) | ||
{ | ||
if (codes[i + 1].opcode == OpCodes.Ldc_I4_4) | ||
{ | ||
if (codes[i + 2].opcode == OpCodes.Call) | ||
{ | ||
CastleStory_MultiplayerPlusPlugin.Plugin.Instance.Log.LogError("operand = " + codes[i + 2].operand.GetType()); | ||
codes[i + 1] = new CodeInstruction(OpCodes.Ldc_I4, 10); | ||
} | ||
} | ||
} | ||
} | ||
return codes.AsEnumerable(); | ||
} | ||
} | ||
} |