Skip to content

Commit

Permalink
1045
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsFabTest committed Aug 18, 2023
1 parent 0fd7048 commit 7d7c7eb
Show file tree
Hide file tree
Showing 19 changed files with 425 additions and 33 deletions.
6 changes: 3 additions & 3 deletions Nebula/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class CustomOptionHolder
"option.display.percentage.andSoForth", "option.display.percentage.10", "option.display.percentage.20", "option.display.percentage.30", "option.display.percentage.40",
"option.display.percentage.50", "option.display.percentage.60", "option.display.percentage.70", "option.display.percentage.80", "option.display.percentage.90" };
public static string[] presets = new string[] { "option.display.preset.1", "option.display.preset.2", "option.display.preset.3", "option.display.preset.4", "option.display.preset.5" };
public static string[] gamemodesNormal = new string[] { "gamemode.standard", "gamemode.freePlay", "gamemode.battle" };
public static string[] gamemodesNormal = new string[] { "gamemode.standard", "gamemode.freePlay", "gamemode.battle", "gamemode.viruscrisis" };
public static string[] gamemodesHnS = new string[] { "gamemode.standard", "gamemode.freePlay" };

private static byte ToByte(float f)
Expand Down Expand Up @@ -502,7 +502,7 @@ public static void Load()
}
};

mapOptions = CustomOption.Create(Color.white, "option.mapOptions", false, null, true, false, "", CustomOptionTab.Settings).SetGameMode(CustomGameMode.All);
mapOptions = CustomOption.Create(Color.white, "option.mapOptions", false, null, true, false, "", CustomOptionTab.Settings).SetGameMode(CustomGameMode.ActuallyAll);
CustomOption.RegisterTopOption(mapOptions);
dynamicMap = CustomOption.Create(Color.white, "option.playRandomMaps", false, mapOptions).SetGameMode(CustomGameMode.All);
exceptSkeld = CustomOption.Create(Color.white, "option.exceptSkeld", false, dynamicMap).SetGameMode(CustomGameMode.All);
Expand Down Expand Up @@ -581,7 +581,7 @@ MetaScreenContent getSuitableContent()
};
};

limiterOptions = CustomOption.Create(Color.white, "option.limitOptions", false, null, true, false, "", CustomOptionTab.Settings).SetGameMode(CustomGameMode.AllStandard);
limiterOptions = CustomOption.Create(Color.white, "option.limitOptions", false, null, true, false, "", CustomOptionTab.Settings).SetGameMode(CustomGameMode.ActuallyAll);
CustomOption.RegisterTopOption(limiterOptions);
timeLimitOption = CustomOption.Create(Color.white, "option.timeLimitOption", 20f, 1f, 80f, 1f, limiterOptions).SetGameMode(CustomGameMode.All);
timeLimitSecondOption = CustomOption.Create(Color.white, "option.timeLimitSecondOption", 0f, 0f, 55f, 5f, limiterOptions).SetGameMode(CustomGameMode.All);
Expand Down
4 changes: 3 additions & 1 deletion Nebula/Game/GameModeProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public GameModeProperty(Module.CustomGameMode RelatedMode, int MinPlayers, bool
static public GameModeProperty StandardHnSMode;
static public GameModeProperty FreePlayHnSMode;
static public GameModeProperty BattleMode;
static public GameModeProperty VirusCrisisMode;

static public void Load()
{
Expand All @@ -65,7 +66,8 @@ static public void Load()
Module.CustomOptionTab.Settings | Module.CustomOptionTab.CrewmateRoles | Module.CustomOptionTab.ImpostorRoles | Module.CustomOptionTab.AdvancedSettings);
FreePlayHnSMode = new GameModeProperty(Module.CustomGameMode.FreePlayHnS, new IntRange(0, 1), false, false, false, null, Roles.Roles.HnSCrewmate, Roles.Roles.HnSReaper,
Module.CustomOptionTab.Settings | Module.CustomOptionTab.AdvancedSettings);
BattleMode = new GameModeProperty(Module.CustomGameMode.Battle,2,false,false,false,null,Roles.Roles.Crewmate,Roles.Roles.Impostor,Module.CustomOptionTab.Settings);
BattleMode = new GameModeProperty(Module.CustomGameMode.Battle,2,false,false,false,null,Roles.Roles.YellowTeam,Roles.Roles.GreenTeam,Module.CustomOptionTab.Settings);
VirusCrisisMode = new GameModeProperty(Module.CustomGameMode.VirusCrisis,4,false,false,false,null,Roles.Roles.Crewmate,Roles.Roles.Impostor,Module.CustomOptionTab.Settings | Module.CustomOptionTab.CrewmateRoles | Module.CustomOptionTab.ImpostorRoles);
}

static public GameModeProperty GetProperty(Module.CustomGameMode gameMode)
Expand Down
6 changes: 3 additions & 3 deletions Nebula/Module/CustomOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public enum CustomGameMode
AllHnS = 12,
AllStandard = 3,
Battle = 16,
ActuallyAll = 31,
ActuallyAll = 63,
VirusCrisis = 32,
}

[Flags]
Expand All @@ -43,7 +43,7 @@ public static class CustomGameModes
{
static public List<CustomGameMode> AllGameModes = new List<CustomGameMode>()
{
CustomGameMode.Standard,CustomGameMode.FreePlay,CustomGameMode.Battle,CustomGameMode.Standard,
CustomGameMode.Standard,CustomGameMode.FreePlay,CustomGameMode.Battle,CustomGameMode.VirusCrisis,
CustomGameMode.Standard,CustomGameMode.Standard,CustomGameMode.Standard,CustomGameMode.Standard,
CustomGameMode.StandardHnS,CustomGameMode.FreePlayHnS
};
Expand Down
8 changes: 4 additions & 4 deletions Nebula/Nebula.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public class NebulaPlugin : BasePlugin
public const string AmongUsVersion = "2023.3.28";
public const string PluginGuid = "cn.zsfabtest.amongus.nebular";
public const string PluginName = "TheNebula-R-LTS";
public const string PluginVersion = "1.0.4.4";
public const string PluginVersion = "1.0.4.5";
public const bool IsSnapshot = true;

public static string PluginVisualVersion = (IsSnapshot ? "23.08.17-" : "") + PluginVersion;
public static string PluginVisualVersion = (IsSnapshot ? "23.08.18-" : "") + PluginVersion;
public static string PluginStage = IsSnapshot ? "Snapshot" : "";

public const string PluginVersionForFetch = "1.0.4.4";
public byte[] PluginVersionData = new byte[] { 1, 0, 4, 4 };
public const string PluginVersionForFetch = "1.0.4.5";
public byte[] PluginVersionData = new byte[] { 1, 0, 4, 5 };

public static NebulaPlugin Instance;

Expand Down
2 changes: 1 addition & 1 deletion Nebula/Patches/CredentialsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void Prefix(PingTracker __instance)
static void Postfix(PingTracker __instance)
{
__instance.text.alignment = TMPro.TextAlignmentOptions.TopRight;
__instance.text.text = $"<size=130%><color=#9579ce>Nebula-R-LTS</color></size> v" + NebulaPlugin.PluginVisualVersion + "\n" + "<color=#eddb5aff>Produced by 凛\nBased on Nebula produced by Dolly1016\n<color=#ED1C24FF>这辈子都不可能写轮选的</color>\n</color><color=#30CF42FF>" + __instance.text.text + "</color>";
__instance.text.text = $"<size=130%><color=#9579ce>Nebula-R-LTS</color></size> v" + NebulaPlugin.PluginVisualVersion + "\n" + "<color=#eddb5aff>Produced by 凛(YiChanlian)\nBased on Nebula produced by Dolly1016\n<color=#ED1C24FF>这辈子都不可能写轮选的</color>\n</color><color=#30CF42FF>" + __instance.text.text + "</color>";
if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started)
{
__instance.gameObject.GetComponent<AspectPosition>().DistanceFromEdge = new Vector3(1.2f, 0.8f, 0f);
Expand Down
24 changes: 17 additions & 7 deletions Nebula/Patches/EndGamePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public class EndCondition
public static EndCondition TrilemmaWin = new EndCondition(25, new Color(209f / 255f, 63f / 255f, 138f / 255f), "trilemma", 0, Module.CustomGameMode.Standard);
public static EndCondition SantaWin = new EndCondition(26, Roles.NeutralRoles.SantaClaus.RoleColor, "santa", 4, Module.CustomGameMode.Standard);

public static EndCondition NobodyWin = new EndCondition(48, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody", 0, Module.CustomGameMode.All).SetNoBodyWin(true);
public static EndCondition NobodySkeldWin = new EndCondition(49, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.skeld", 32, Module.CustomGameMode.All).SetNoBodyWin(true);
public static EndCondition NobodyMiraWin = new EndCondition(50, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.mira", 32, Module.CustomGameMode.All).SetNoBodyWin(true);
public static EndCondition NobodyPolusWin = new EndCondition(51, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.polus", 32, Module.CustomGameMode.All).SetNoBodyWin(true);
public static EndCondition NobodyAirshipWin = new EndCondition(52, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.airship", 32, Module.CustomGameMode.All).SetNoBodyWin(true);
public static EndCondition NobodyWin = new EndCondition(48, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody", 0, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition NobodySkeldWin = new EndCondition(49, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.skeld", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition NobodyMiraWin = new EndCondition(50, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.mira", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition NobodyPolusWin = new EndCondition(51, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.polus", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition NobodyAirshipWin = new EndCondition(52, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.airship", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);

public static EndCondition NoGame = new EndCondition(64, new Color(72f / 255f, 78f / 255f, 84f / 255f), "noGame", 0, Module.CustomGameMode.All).SetNoBodyWin(true);
public static EndCondition NoGame = new EndCondition(64, new Color(72f / 255f, 78f / 255f, 84f / 255f), "noGame", 0, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);

public static EndCondition PavlovWin = new EndCondition(128, Roles.NeutralRoles.Pavlov.RoleColor, "pavlov", 1, Module.CustomGameMode.Standard);
public static EndCondition MoriartyWin = new EndCondition(129, Roles.NeutralRoles.Moriarty.RoleColor, "moriarty", 1, Module.CustomGameMode.Standard);
Expand All @@ -49,6 +49,8 @@ public class EndCondition
public static EndCondition PuppeteerWin = new EndCondition(138,Roles.NeutralRoles.Puppeteer.RoleColor,"puppeteer",1,Module.CustomGameMode.Standard);
public static EndCondition YellowTeamWin = new EndCondition(139,Roles.BattleRoles.YellowTeam.RoleColor,"yellowTeam",1,Module.CustomGameMode.Battle);
public static EndCondition GreenTeamWin = new EndCondition(140,Roles.BattleRoles.GreenTeam.RoleColor,"greenTeam",1,Module.CustomGameMode.Battle);
public static EndCondition InfectedWin = new EndCondition(141,Palette.ImpostorRed,"infected",1,Module.CustomGameMode.VirusCrisis);
public static EndCondition SurvivalWin = new EndCondition(142,Palette.CrewmateBlue,"survival",1,Module.CustomGameMode.VirusCrisis);

public static HashSet<EndCondition> AllEnds = new HashSet<EndCondition>() {
CrewmateWinByVote ,CrewmateWinByTask,CrewmateWinDisconnect,
Expand All @@ -57,7 +59,7 @@ public class EndCondition
JesterWin,JackalWin,ArsonistWin,EmpiricWin,PaparazzoWin,VultureWin,SpectreWin,SantaWin,
LoversWin,TrilemmaWin,AvengerWin,
NoGame,NobodyWin,NobodySkeldWin,NobodyMiraWin,NobodyPolusWin,NobodyAirshipWin,
PavlovWin,MoriartyWin,MoriartyWinByKillHolmes,CascrubinterWin,GuesserWin,YandereWin,WerewolfWin,ChallengerWin,OracleWin,GhostWin,PuppeteerWin,YellowTeamWin,GreenTeamWin
PavlovWin,MoriartyWin,MoriartyWinByKillHolmes,CascrubinterWin,GuesserWin,YandereWin,WerewolfWin,ChallengerWin,OracleWin,GhostWin,PuppeteerWin,YellowTeamWin,GreenTeamWin,InfectedWin,SurvivalWin,
};

public static EndCondition GetEndCondition(GameOverReason gameOverReason)
Expand Down Expand Up @@ -749,6 +751,9 @@ public class PlayerStatistics
public int AliveYellowTeam;
public int AliveGreenTeam;

public int AliveInfected;
public int AliveSurvivals;

public bool IsValid;

//
Expand Down Expand Up @@ -821,6 +826,9 @@ public PlayerStatistics(ShipStatus __instance)
AliveYellowTeam = 0;
AliveGreenTeam = 0;

AliveInfected = 0;
AliveSurvivals = 0;

Roles.Side side;


Expand Down Expand Up @@ -1093,6 +1101,8 @@ public PlayerStatistics(ShipStatus __instance)
AliveOracle = GetAlivePlayers(Roles.Side.Oracle);
AliveYellowTeam = GetAlivePlayers(Roles.Side.YellowTeam);
AliveGreenTeam = GetAlivePlayers(Roles.Side.GreenTeam);
AliveInfected = GetAlivePlayers(Roles.Side.Infected);
AliveSurvivals = GetAlivePlayers(Roles.Side.Survival);

if (!Roles.Roles.Lover.loversAsIndependentSideOption.getBool())
{
Expand Down
19 changes: 19 additions & 0 deletions Nebula/Patches/RoleAssignmentPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,25 @@ private static void assignRoles(AssignMap assignMap)
else assignMap.AssignRole(allPlayers[tmp],Roles.Roles.GreenTeam.id);
}

return;
}else if(CustomOptionHolder.GetCustomGameMode() == Module.CustomGameMode.VirusCrisis){
var allPlayers = new List<byte>();
foreach (var player in PlayerControl.AllPlayerControls.GetFastEnumerator())
{
allPlayers.Add(player.PlayerId);
}

var impidx = NebulaPlugin.rnd.Next(0,allPlayers.Count);
assignMap.AssignRole(allPlayers[impidx],Roles.Roles.Infected.id);
allPlayers.RemoveAt(impidx);
for(int i = 0;i < Roles.Roles.Gunner.neutrallySpawnCount.getFloat();i++){
var idx = NebulaPlugin.rnd.Next(0,allPlayers.Count);
assignMap.AssignRole(allPlayers[idx],Roles.Roles.Gunner.id);
allPlayers.RemoveAt(idx);
}
foreach(var pi in allPlayers){
assignMap.AssignRole(pi,Roles.Roles.Survival.id);
}
return;
}

Expand Down
15 changes: 15 additions & 0 deletions Nebula/RPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public enum CustomRPC
FixedRevive,
SetBombTarget,
SetSmoke,
SetInfectLives,
}

//RPCを受け取ったときのイベント
Expand Down Expand Up @@ -428,6 +429,9 @@ static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] Messa
case (byte)CustomRPC.SetSmoke:
RPCEvents.SetSmoke(reader.ReadByte());
break;
case (byte)CustomRPC.SetInfectLives:
RPCEvents.SetInfectLives(reader.ReadByte());
break;
}
}
}
Expand Down Expand Up @@ -1772,6 +1776,10 @@ public static void SetSmoke(byte playerId){
*/
RPCEventInvoker.ObjectInstantiate(new Objects.ObjectTypes.Bomb(),Helpers.playerById(playerId).transform.position);
}

public static void SetInfectLives(byte lives){
Roles.Roles.Infected.TotalLives = lives;
}
}

public class RPCEventInvoker
Expand Down Expand Up @@ -2817,4 +2825,11 @@ public static void SetSmoke(PlayerControl player){
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCEvents.SetSmoke(player.PlayerId);
}

public static void SetInfectLives(byte lives){
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId,(byte)CustomRPC.SetInfectLives,Hazel.SendOption.Reliable,-1);
writer.Write(lives);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCEvents.SetInfectLives(lives);
}
}
35 changes: 32 additions & 3 deletions Nebula/Resources/Languages/SChinese.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,7 @@
"option.searchableDistance" : "船员搜索最大半径"

"gamemode.battle" : "小游戏:战争模式"
"gamemode.viruscrisis" : "小游戏:感染对抗"

"option.battleOption" : "战争模式设置"
"option.battleOption.killCooldownOption" : "狙击冷却时间"
Expand Down Expand Up @@ -2144,6 +2145,30 @@
"role.greenTeam.hint" : "取得战争的胜利"
"role.greenTeam.info" : "取得战争的胜利"

"role.infected.name" : "感染者"
"role.infected.short" : "感"
"role.infected.hint" : "将所有人杀干净"
"role.infected.description" : "将他们杀干净!"
"role.infected.info" : "你拥有极快的冷却。\n如果有时间设置,时间结束后将胜利。"
"role.infected.initkillcooldown" : "初始击杀冷却"
"role.infected.killcooldown" : "击杀冷却"
"role.infected.totalLives" : "初始生命值"

"role.survival.name" : "幸存者"
"role.survival.short" : "幸"
"role.survival.description" : "想办法活下来"
"role.survival.hint" : "做任务 活下来"
"role.survival.info" : "你可以跳管道保命。\n做完任务后将成为枪手。\n你可以挨两刀。"
"role.survival.taskCount" : "任务数量"

"role.gunner.name" : "枪手"
"role.gunner.short" : "枪"
"role.gunner.description" : "击杀<color=#ff1919ff>感染者</color>!"
"role.gunner.hint" : "击杀<color=#ff1919ff>感染者</color>"
"role.gunner.info" : "你可以攻击伪装者。\n更重要的是,你只有一次机会(一条命)。"
"role.gunner.killcooldown" : "击杀冷却时间"
"role.gunner.neutrallySpawnCount" : "自然生成的枪手个数"

"option.display.random" : "随机"

"side.paparazzo.name" : "摄影师"
Expand All @@ -2159,7 +2184,9 @@
"side.oracle.name" : "天启"
"side.ghost.name" : "怨灵"
"side.yellowTeam.name" : "黄队"
"side.greenTeam.short" : "绿队"
"side.greenTeam.name" : "绿队"
"side.infected.name" : "感染者"
"side.survival.name" : "幸存者"

"text.exile.role" : "%PLAYER% 的职业是 %ROLE%"
"text.exile.connection" : " "
Expand All @@ -2182,8 +2209,10 @@
"game.endText.challenger" : "挑战者胜利"
"game.endText.oracle" : "天启胜利"
"game.endText.ghost" : "怨灵胜利"
"game.endText.yellowTeam" : "黄队胜利"
"game.endText.greenTeam" : "绿队胜利"
"game.endText.yellowTeam" : "黄队取得了战争的胜利!"
"game.endText.greenTeam" : "绿队取得了战争的胜利!"
"game.endText.infected" : "所有人都失踪了!"
"game.endText.survival" : "我们活下来了!"

"status.hemorrhage" : "失血"
"status.killed" : "爆炸"
Expand Down
6 changes: 5 additions & 1 deletion Nebula/Roles/BattleRoles/GreenTeam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ public override void CleanUp()
}

public override void EditOthersDisplayNameColor(byte playerId,ref Color displayColor){
if(Helpers.playerById(playerId).GetModData().role.side == Side.GreenTeam) displayColor = RoleColor;
displayColor = RoleColor;
}

public override void OnMurdered(byte murderId){
Game.GameData.data.myData.CanSeeEveryoneInfo = true;
}

public GreenTeam()
Expand Down
6 changes: 5 additions & 1 deletion Nebula/Roles/BattleRoles/YellowTeam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ public override void CleanUp()
}

public override void EditOthersDisplayNameColor(byte playerId,ref Color displayColor){
if(Helpers.playerById(playerId).GetModData().role.side == Side.YellowTeam) displayColor = RoleColor;
displayColor = RoleColor;
}

public override void OnMurdered(byte murderId){
Game.GameData.data.myData.CanSeeEveryoneInfo = true;
}

public YellowTeam()
Expand Down
Loading

0 comments on commit 7d7c7eb

Please sign in to comment.