Added other regions support
This commit is contained in:
commit
75df742452
7 files changed
+302
No files matched your search
@@ -0,0 +1,47 @@
|
|||||||
|
name: Build Plugin
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- master
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '6.0.x'
|
||||||
|
|
||||||
|
- name: Restore Dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: Build Project (Development)
|
||||||
|
run: dotnet build --configuration Development --no-restore
|
||||||
|
|
||||||
|
- name: Upload Build Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: AUModdedRegions
|
||||||
|
path: bin/Development/net6.0/AUModdedRegions.dll
|
||||||
|
|
||||||
|
- name: Upload Release Asset
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: bin/Development/net6.0/AUModdedRegions.dll
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
Libs/
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
using BepInEx;
|
||||||
|
using BepInEx.Unity.IL2CPP;
|
||||||
|
using HarmonyLib;
|
||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Nodes;
|
||||||
|
|
||||||
|
namespace AUModdedRegions
|
||||||
|
{
|
||||||
|
[BepInPlugin("com.aumoddedregions", "AUModdedRegions", "1.0.0")]
|
||||||
|
public class AUModdedRegionsPlugin : BasePlugin
|
||||||
|
{
|
||||||
|
private static readonly string[] OfficialDomains = new string[]
|
||||||
|
{
|
||||||
|
"innersloth.com",
|
||||||
|
"among.us",
|
||||||
|
"matchmaker.among.us",
|
||||||
|
"matchmaker-as.among.us",
|
||||||
|
"matchmaker-eu.among.us"
|
||||||
|
};
|
||||||
|
|
||||||
|
// La liste des 8 régions moddées à garantir dans le fichier
|
||||||
|
private static readonly List<(string Name, string Host)> DefaultModdedRegions = new()
|
||||||
|
{
|
||||||
|
("Niko233 (EU)", "https://au-eu.niko233.top"),
|
||||||
|
("Niko233 (AS)", "https://au-as.niko233.top"),
|
||||||
|
("Niko233 (NA)", "https://au-us.niko233.top"),
|
||||||
|
("Niko233 (CN)", "https://au-cn.niko233.top"),
|
||||||
|
("Modded NA", "https://aumods.org"),
|
||||||
|
("Modded EU", "https://au-eu.duikbo.at"),
|
||||||
|
("Modded AS", "https://au-as.duikbo.at"),
|
||||||
|
("Skeld.net", "https://play.skeld.net")
|
||||||
|
};
|
||||||
|
|
||||||
|
public override void Load()
|
||||||
|
{
|
||||||
|
ProcessAndMergeRegions();
|
||||||
|
|
||||||
|
// Bloque le CleanAndMerge natif d'Among Us pour pas qu'il remette Innersloth
|
||||||
|
Harmony.CreateAndPatchAll(typeof(PatchCleanAndMerge));
|
||||||
|
Log.LogInfo("AUModdedRegions chargé avec succès !");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessAndMergeRegions()
|
||||||
|
{
|
||||||
|
string regionFilePath = Path.Combine(Application.persistentDataPath, "regionInfo.json");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
JsonNode rootNode;
|
||||||
|
|
||||||
|
// 1. Lire le fichier s'il existe, sinon créer une structure JSON vide
|
||||||
|
if (File.Exists(regionFilePath) && new FileInfo(regionFilePath).Length > 0)
|
||||||
|
{
|
||||||
|
string content = File.ReadAllText(regionFilePath);
|
||||||
|
rootNode = JsonNode.Parse(content) ?? CreateEmptyRegionStructure();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rootNode = CreateEmptyRegionStructure();
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonArray regionsArray = rootNode["Regions"]?.AsArray() ?? new JsonArray();
|
||||||
|
|
||||||
|
// 2. Filtrer et supprimer uniquement les régions Innersloth
|
||||||
|
for (int i = regionsArray.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
string regionJson = regionsArray[i]?.ToJsonString() ?? "";
|
||||||
|
if (IsOfficialInnersloth(regionJson))
|
||||||
|
{
|
||||||
|
regionsArray.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Ajouter les 8 régions moddées si elles ne sont pas déjà présentes
|
||||||
|
foreach (var (name, host) in DefaultModdedRegions)
|
||||||
|
{
|
||||||
|
if (!HasRegion(regionsArray, host))
|
||||||
|
{
|
||||||
|
regionsArray.Add(BuildRegionNode(name, host));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Mettre à jour et sauvegarder le fichier
|
||||||
|
rootNode["Regions"] = regionsArray;
|
||||||
|
|
||||||
|
var options = new JsonSerializerOptions { WriteIndented = true };
|
||||||
|
File.WriteAllText(regionFilePath, rootNode.ToJsonString(options));
|
||||||
|
|
||||||
|
Log.LogInfo("[AUModdedRegions] Fichier regionInfo.json mis à jour ! (Innersloth viré, tes régions custom + régions moddées conservées/ajoutées).");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.LogError($"[AUModdedRegions] Erreur lors du traitement du fichier regionInfo.json : {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsOfficialInnersloth(string json)
|
||||||
|
{
|
||||||
|
foreach (var domain in OfficialDomains)
|
||||||
|
{
|
||||||
|
if (json.Contains(domain, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool HasRegion(JsonArray regionsArray, string host)
|
||||||
|
{
|
||||||
|
foreach (var node in regionsArray)
|
||||||
|
{
|
||||||
|
if (node != null && node.ToJsonString().Contains(host, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonNode CreateEmptyRegionStructure()
|
||||||
|
{
|
||||||
|
return new JsonObject
|
||||||
|
{
|
||||||
|
["CurrentRegionIdx"] = 0,
|
||||||
|
["Regions"] = new JsonArray()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonNode BuildRegionNode(string name, string host)
|
||||||
|
{
|
||||||
|
return new JsonObject
|
||||||
|
{
|
||||||
|
["$type"] = "StaticHttpRegionInfo, Assembly-CSharp",
|
||||||
|
["Name"] = name,
|
||||||
|
["PingServer"] = host,
|
||||||
|
["Servers"] = new JsonArray
|
||||||
|
{
|
||||||
|
new JsonObject
|
||||||
|
{
|
||||||
|
["Name"] = "Http-1",
|
||||||
|
["Ip"] = host,
|
||||||
|
["Port"] = 443,
|
||||||
|
["UseDtls"] = false,
|
||||||
|
["Players"] = 0,
|
||||||
|
["ConnectionFailures"] = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
["TargetServer"] = null,
|
||||||
|
["TranslateName"] = 1003
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch("ServerManager+JsonServerData", "CleanAndMerge")]
|
||||||
|
public static class PatchCleanAndMerge
|
||||||
|
{
|
||||||
|
[HarmonyPrefix]
|
||||||
|
public static bool Prefix() => false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<AssemblyName>AUModdedRegions</AssemblyName>
|
||||||
|
<RootNamespace>AUModdedRegions</RootNamespace>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
|
<Description>Auto-manages and injects custom modded regions into Among Us while filtering out official servers.</Description>
|
||||||
|
<Authors>Nb1X</Authors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" ExcludeAssets="runtime;native" />
|
||||||
|
|
||||||
|
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2026.6.5" PrivateAssets="all" />
|
||||||
|
|
||||||
|
<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" PrivateAssets="all" ExcludeAssets="runtime" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||||
|
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(AmongUs)/BepInEx/plugins/" UseSymboliclinksIfPossible="true" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
> This mod is not affiliated with Among Us or Innersloth LLC, and the content contained therein is not endorsed or otherwise sponsored by Innersloth LLC. Portions of the materials contained herein are property of Innersloth LLC. © Innersloth LLC.
|
||||||
|
|
||||||
|
> In the releases, there are BepInEx builds with AUModdedRegions included. BepInEx's [source code is available here](https://github.com/BepInEx/BepInEx) and it is not under MIT License like this project. It is under LGPL-v2.1
|
||||||
|
|
||||||
|
# AUModdedRegions
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<!-- Ton Logo -->
|
||||||
|
<img src="static/logo.png" alt="Logo" width="300" />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<a href="#"><img src="https://img.shields.io/badge/status-active-brightgreen" alt="Status" /></a>
|
||||||
|
<a href="#"><img src="https://img.shields.io/badge/version-v1.0.0-blue" alt="Version" /></a>
|
||||||
|
<a href="#"><img src="https://img.shields.io/badge/--512BD4?logo=.net&logoColor=ffffff)](https://dotnet.microsoft.com/" alt="Dotnet" /></a>
|
||||||
|
<a href="#"><img src="https://badgen.net/badge/icon/github?icon=github&label" alt="GitHub" /></a>
|
||||||
|
<a href="#"><img src="https://badgen.net/badge/icon/windows?icon=windows&label" alt="Windows" /></a>
|
||||||
|
<a href="#"><img src="https://img.shields.io/badge/badges-awesome-green.svg" alt="Badges Are Awesome" /></a>
|
||||||
|
<a href="#"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="Licence" /></a>
|
||||||
|
<a href="#"><img src="https://img.shields.io/badge/Google%20Gemini-8E75B2?style=flat&logo=googlegemini&logoColor=white" alt="Gemini" /></a>
|
||||||
|
<a href="#"><img src="https://img.shields.io/github/stars/BetterUsProject/AUModdedRegions?style=flat" alt="GitHub Stars" /></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
AUModdedRegions is a BepInEx plugin that removes Innersloth regions from Among Us and adds other regions that supports [modded handshake](https://github.com/NuclearPowered/Reactor.Impostor).
|
||||||
|
|
||||||
|
It adds the following regions (If there is another region other than the modded regions listed below in your regionInfo.json file, they will stay on the regions list but the modded regions listed will all be added):
|
||||||
|
|
||||||
|
- Niko233 (NA)
|
||||||
|
- Niko233 (EU)
|
||||||
|
- Niko233 (AS)
|
||||||
|
- Niko233 (CN)
|
||||||
|
- Modded EU
|
||||||
|
- Modded NA
|
||||||
|
- Modded AS
|
||||||
|
|
||||||
|
and removes these regions:
|
||||||
|
- North America
|
||||||
|
- Europe
|
||||||
|
- Asia
|
||||||
|
|
||||||
|
The modded regions are not managed by me. If you have a problem, contact the regions' owner.
|
||||||
|
|
||||||
|
Niko233 regions website: https://au.niko233.top
|
||||||
|
|
||||||
|
Modded EU, Modded AS and Modded NA regions doesn't have a website yet.
|
||||||
|
|
||||||
|
For more information, see [Informations](INFO.md).
|
||||||
|
|
||||||
|
For mod developers that want to integrate this plugin to their mods, you can. See [license here](LICENSE).
|
||||||
|
|
||||||
|
All of the listed regions use a custom, open-source server called [Impostor](https://github.com/Impostor/Impostor). You can host it yourself on a VPS, a [Raspberry Pi](https://raspberrypi.com) or an old laptop.
|
||||||
|
|
||||||
|
(Niko233 servers are using a custom build of Impostor available [here](https://github.com/NikoCat233/Impostor))
|
||||||
|
|
||||||
|
To use BETA builds of this plugin, go to the [Actions](https://github.com/BetterUsProject/AUModdedRegions/actions) of this repository (sometimes, normal versions are also on Actions).
|
||||||
@@ -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>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 211 KiB |
Reference in new issue
Block a user