mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-24 16:46:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
376d91d8e6 | ||
|
|
f1bd70cd31 | ||
|
|
77c3107ecb | ||
|
|
225e123116 | ||
|
|
ba9f47d7d5 |
No files matched your search
@@ -93,6 +93,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Express => CustomRoles.Crewmate,
|
||||
CustomRoles.NiceEraser => CustomRoles.Crewmate,
|
||||
CustomRoles.TaskManager => CustomRoles.Crewmate,
|
||||
CustomRoles.Druid => Options.UsePets.GetBool() ? CustomRoles.Crewmate : CustomRoles.Engineer,
|
||||
CustomRoles.Insight => CustomRoles.Crewmate,
|
||||
CustomRoles.Tunneler => CustomRoles.Crewmate,
|
||||
CustomRoles.Detour => CustomRoles.Crewmate,
|
||||
@@ -223,6 +224,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Express => CustomRoles.CrewmateTOHE,
|
||||
CustomRoles.NiceEraser => CustomRoles.CrewmateTOHE,
|
||||
CustomRoles.TaskManager => CustomRoles.CrewmateTOHE,
|
||||
CustomRoles.Druid => CustomRoles.EngineerTOHE,
|
||||
CustomRoles.Insight => CustomRoles.CrewmateTOHE,
|
||||
CustomRoles.Tunneler => CustomRoles.CrewmateTOHE,
|
||||
CustomRoles.Detour => CustomRoles.CrewmateTOHE,
|
||||
|
||||
@@ -92,12 +92,13 @@ static class ExtendedPlayerControl
|
||||
|
||||
public static List<CustomRoles> GetCustomSubRoles(this PlayerControl player)
|
||||
{
|
||||
if (GameStates.IsLobby) return [CustomRoles.NotAssigned];
|
||||
if (player == null)
|
||||
{
|
||||
Logger.Warn("CustomSubRoleを取得しようとしましたが、対象がnullでした。", "getCustomSubRole");
|
||||
return [CustomRoles.NotAssigned];
|
||||
}
|
||||
return Main.PlayerStates[player.PlayerId].SubRoles;
|
||||
return Main.PlayerStates.TryGetValue(player.PlayerId, out var state) ? state.SubRoles : [CustomRoles.NotAssigned];
|
||||
}
|
||||
public static CountTypes GetCountTypes(this PlayerControl player)
|
||||
{
|
||||
@@ -694,6 +695,8 @@ static class ExtendedPlayerControl
|
||||
if (!pc.IsAlive() || pc.Data.Role.Role == RoleTypes.GuardianAngel) return false;
|
||||
if (CopyCat.playerIdList.Contains(pc.PlayerId)) return true;
|
||||
|
||||
if (pc.Is(CustomRoles.Nimble)) return true;
|
||||
|
||||
return pc.GetCustomRole() switch
|
||||
{
|
||||
CustomRoles.Minimalism or
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1520,6 +1520,8 @@ public static class Options
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Demolitionist]);
|
||||
RoleLoadingText = "Crewmate roles\nTask Manager";
|
||||
SetupRoleOptions(5575, TabGroup.CrewmateRoles, CustomRoles.TaskManager);
|
||||
RoleLoadingText = "Crewmate roles\nDruid";
|
||||
Druid.SetupCustomOption();
|
||||
RoleLoadingText = "Crewmate roles\nInsight";
|
||||
SetupRoleOptions(5594, TabGroup.CrewmateRoles, CustomRoles.Insight);
|
||||
RoleLoadingText = "Crewmate roles\nTunneler";
|
||||
|
||||
+5
-1
@@ -19,6 +19,7 @@ using TOHE.Roles.Crewmate;
|
||||
using TOHE.Roles.Impostor;
|
||||
using TOHE.Roles.Neutral;
|
||||
using UnityEngine;
|
||||
using static Epic.OnlineServices.Helper;
|
||||
using static TOHE.Translator;
|
||||
|
||||
namespace TOHE;
|
||||
@@ -751,6 +752,9 @@ public static class Utils
|
||||
case CustomRoles.Doppelganger:
|
||||
ProgressText.Append(Doppelganger.GetStealLimit(playerId));
|
||||
break;
|
||||
case CustomRoles.Druid:
|
||||
ProgressText.Append(Druid.UseLimit.TryGetValue(playerId, out var uses) ? $"<color=#777777>-</color> <#ffffff>{uses}</color>" : string.Empty);
|
||||
break;
|
||||
case CustomRoles.SerialKiller:
|
||||
if (SerialKiller.SuicideTimer.ContainsKey(playerId))
|
||||
{
|
||||
@@ -2636,7 +2640,7 @@ public static class Utils
|
||||
|
||||
if ((MapNames)Main.NormalOptions.MapId == MapNames.Airship && AmongUsClient.Instance.AmHost && PlayerControl.LocalPlayer.Is(CustomRoles.GM))
|
||||
{
|
||||
_ = new LateTask(() => { PlayerControl.LocalPlayer.TP(new(15.5f, 0.0f)); }, 11f, "GM Auto-TP Failsafe"); // TP to Main Hall
|
||||
_ = new LateTask(() => { PlayerControl.LocalPlayer.NetTransform.SnapTo(new(15.5f, 0.0f), (ushort)(PlayerControl.LocalPlayer.NetTransform.lastSequenceId + 8)); }, 11f, "GM Auto-TP Failsafe"); // TP to Main Hall
|
||||
}
|
||||
}
|
||||
public static void AfterPlayerDeathTasks(PlayerControl target, bool onMeeting = false)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using HarmonyLib;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TOHE;
|
||||
|
||||
@@ -5,7 +5,6 @@ using InnerNet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using TOHE.Roles.Neutral;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -6,7 +6,6 @@ using TMPro;
|
||||
using TOHE.Roles.Crewmate;
|
||||
using TOHE.Roles.Impostor;
|
||||
using TOHE.Roles.Neutral;
|
||||
using Unity.Services.Analytics;
|
||||
using UnityEngine;
|
||||
using static TOHE.Translator;
|
||||
|
||||
|
||||
@@ -683,7 +683,7 @@ class CheckMurderPatch
|
||||
target.Suicide(PlayerState.DeathReason.Kill, killer);
|
||||
killer.SetKillCooldown();
|
||||
RPC.PlaySoundRPC(killer.PlayerId, Sounds.KillSound);
|
||||
NameNotifyManager.Notify(target, ColorString(GetRoleColor(CustomRoles.Scavenger), GetString("KilledByScavenger")));
|
||||
target.Notify(ColorString(GetRoleColor(CustomRoles.Scavenger), GetString("KilledByScavenger")));
|
||||
return false;
|
||||
}
|
||||
if (target.Is(CustomRoles.Pestilence))
|
||||
|
||||
@@ -489,7 +489,7 @@ internal class SelectRolesPatch
|
||||
|
||||
if (nimbleSpawn) Main.NimblePlayer = nimbleList[rd.Next(0, nimbleList.Count)];
|
||||
if (physicistSpawn) while (Main.PhysicistPlayer == byte.MaxValue || Main.PhysicistPlayer == Main.NimblePlayer)
|
||||
Main.PhysicistPlayer = physicistList[rd.Next(0, physicistList.Count)];
|
||||
Main.PhysicistPlayer = physicistList[rd.Next(0, physicistList.Count)];
|
||||
|
||||
List<(PlayerControl, RoleTypes)> newList = [];
|
||||
foreach ((PlayerControl PLAYER, RoleTypes ROLETYPE) in RpcSetRoleReplacer.StoragedData.ToArray())
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace TOHE.Roles.AddOns.Crewmate
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncStressedTimer, SendOption.Reliable, -1);
|
||||
writer.Write(id);
|
||||
writer.Write(time);
|
||||
writer.Write(lastUpdate);
|
||||
writer.Write(lastUpdate.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace TOHE.Roles.AddOns.Impostor
|
||||
if (!DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncDamoclesTimer, SendOption.Reliable, -1);
|
||||
writer.Write(Timer);
|
||||
writer.Write(lastUpdate);
|
||||
writer.Write(lastUpdate.ToString());
|
||||
writer.Write(PreviouslyEnteredVents.Count);
|
||||
if (PreviouslyEnteredVents.Count > 0) foreach (var vent in PreviouslyEnteredVents.ToArray()) writer.Write(vent);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
|
||||
@@ -207,7 +207,6 @@ namespace TOHE.Roles.Crewmate
|
||||
{
|
||||
InvisTime = [];
|
||||
long invis = long.Parse(reader.ReadString());
|
||||
_ = long.Parse(reader.ReadString());
|
||||
if (invis > 0) InvisTime.Add(PlayerControl.LocalPlayer.PlayerId, invis);
|
||||
}
|
||||
public static void OnCoEnterVent(PlayerPhysics __instance, int ventId)
|
||||
@@ -227,7 +226,7 @@ namespace TOHE.Roles.Crewmate
|
||||
|
||||
InvisTime.Add(pc.PlayerId, Utils.GetTimeStamp());
|
||||
SendRPC(pc);
|
||||
NameNotifyManager.Notify(pc, GetString("ChameleonInvisState"), InvisDuration.GetFloat());
|
||||
pc.Notify(GetString("ChameleonInvisState"), InvisDuration.GetFloat());
|
||||
}, 0.5f, "Alchemist Invis");
|
||||
}
|
||||
public static void OnFixedUpdate(PlayerControl player)
|
||||
@@ -249,7 +248,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (remainTime < 0)
|
||||
{
|
||||
pc?.MyPhysics?.RpcBootFromVent(ventedId.TryGetValue(pc.PlayerId, out var id) ? id : Main.LastEnteredVent[pc.PlayerId].Id);
|
||||
NameNotifyManager.Notify(pc, GetString("ChameleonInvisStateOut"));
|
||||
pc.Notify(GetString("ChameleonInvisStateOut"));
|
||||
pc.RpcResetAbilityCooldown();
|
||||
SendRPC(pc);
|
||||
continue;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!IsEnable || !DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncAnalyzerTarget, SendOption.Reliable, -1);
|
||||
writer.Write(CurrentTarget.ID);
|
||||
writer.Write(CurrentTarget.TIME);
|
||||
writer.Write(CurrentTarget.TIME.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static TOHE.Options;
|
||||
using static TOHE.Translator;
|
||||
using static TOHE.Utils;
|
||||
|
||||
namespace TOHE.Roles.Crewmate
|
||||
{
|
||||
@@ -21,14 +24,14 @@ namespace TOHE.Roles.Crewmate
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
Options.SetupRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Benefactor);
|
||||
SetupRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Benefactor);
|
||||
TaskMarkPerRoundOpt = IntegerOptionItem.Create(Id + 10, "TaskMarkPerRound", new(1, 14, 1), 3, TabGroup.CrewmateRoles, false)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Benefactor])
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Benefactor])
|
||||
.SetValueFormat(OptionFormat.Votes);
|
||||
ShieldDuration = IntegerOptionItem.Create(Id + 11, "AidDur", new(1, 30, 1), 10, TabGroup.CrewmateRoles, false)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Benefactor])
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Benefactor])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
Options.OverrideTasksData.Create(Id + 12, TabGroup.CrewmateRoles, CustomRoles.Benefactor);
|
||||
OverrideTasksData.Create(Id + 12, TabGroup.CrewmateRoles, CustomRoles.Benefactor);
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
@@ -48,7 +51,7 @@ namespace TOHE.Roles.Crewmate
|
||||
}
|
||||
private static void SendRPC(byte benefactorID, int taskIndex = -1, bool IsShield = false, bool clearAll = false, bool shieldExpire = false, byte shieldedId = byte.MaxValue)
|
||||
{
|
||||
if (!IsEnable || !Utils.DoRPC) return;
|
||||
if (!IsEnable || !DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncBenefactorMarkedTask, SendOption.Reliable, -1);
|
||||
writer.Write(benefactorID);
|
||||
writer.Write(taskIndex);
|
||||
@@ -85,7 +88,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (clearAll && taskIndex.ContainsKey(benefactorID)) taskIndex[benefactorID].Clear();
|
||||
if (IsShield)
|
||||
{
|
||||
shieldedPlayers.TryAdd(shieldedId, Utils.GetTimeStamp());
|
||||
shieldedPlayers.TryAdd(shieldedId, GetTimeStamp());
|
||||
}
|
||||
if (shieldExpire)
|
||||
{
|
||||
@@ -99,7 +102,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!TaskMarkPerRound.ContainsKey(playerId)) TaskMarkPerRound[playerId] = 0;
|
||||
int markedTasks = TaskMarkPerRound[playerId];
|
||||
int x = Math.Max(maxTasksMarkedPerRound - markedTasks, 0);
|
||||
return Utils.ColorString(Utils.GetRoleColor(CustomRoles.Benefactor).ShadeColor(0.25f), $"({x})");
|
||||
return ColorString(GetRoleColor(CustomRoles.Benefactor).ShadeColor(0.25f), $"({x})");
|
||||
}
|
||||
public static void AfterMeetingTasks()
|
||||
{
|
||||
@@ -116,10 +119,10 @@ namespace TOHE.Roles.Crewmate
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
|
||||
foreach (var x in shieldedPlayers.Where(x => x.Value + ShieldDuration.GetInt() < Utils.GetTimeStamp()))
|
||||
foreach (var x in shieldedPlayers.Where(x => x.Value + ShieldDuration.GetInt() < GetTimeStamp()))
|
||||
{
|
||||
shieldedPlayers.Remove(x.Key);
|
||||
SendRPC(pc.PlayerId, shieldExpire: true, shieldedId: Utils.GetPlayerById(x.Key).PlayerId);
|
||||
SendRPC(pc.PlayerId, shieldExpire: true, shieldedId: GetPlayerById(x.Key).PlayerId);
|
||||
}
|
||||
}
|
||||
public static void OnTaskComplete(PlayerControl player, PlayerTask task)
|
||||
@@ -140,7 +143,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!taskIndex.ContainsKey(playerId)) taskIndex[playerId] = [];
|
||||
taskIndex[playerId].Add(task.Index);
|
||||
SendRPC(benefactorID: playerId, taskIndex: task.Index);
|
||||
player.Notify(Translator.GetString("BenefactorTaskMarked"));
|
||||
player.Notify(GetString("BenefactorTaskMarked"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -148,13 +151,13 @@ namespace TOHE.Roles.Crewmate
|
||||
{
|
||||
if (taskIndex[benefactorId].Contains(task.Index))
|
||||
{
|
||||
var taskinatorPC = Utils.GetPlayerById(benefactorId);
|
||||
if (taskinatorPC == null) continue;
|
||||
var benefactorPC = GetPlayerById(benefactorId);
|
||||
if (benefactorPC == null) continue;
|
||||
|
||||
player.Notify(Translator.GetString("BenefactorTargetGotShieldNotify"));
|
||||
player.Notify(GetString("BenefactorTargetGotShieldNotify"));
|
||||
taskIndex[benefactorId].Remove(task.Index);
|
||||
SendRPC(benefactorID: benefactorId, taskIndex: task.Index, IsShield: true, shieldedId: player.PlayerId);
|
||||
Logger.Info($"{player.GetAllRoleName()} got a shield because the task was marked by {taskinatorPC.GetNameWithRole()}", "Benefactor");
|
||||
Logger.Info($"{player.GetAllRoleName()} got a shield because the task was marked by {benefactorPC.GetNameWithRole()}", "Benefactor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public static class Chameleon
|
||||
{
|
||||
lastTime.Add(pc.PlayerId, now);
|
||||
pc?.MyPhysics?.RpcBootFromVent(ventedId.TryGetValue(pc.PlayerId, out var id) ? id : Main.LastEnteredVent[pc.PlayerId].Id);
|
||||
NameNotifyManager.Notify(pc, GetString("ChameleonInvisStateOut"));
|
||||
pc.Notify(GetString("ChameleonInvisStateOut"));
|
||||
pc.RpcResetAbilityCooldown();
|
||||
SendRPC(pc);
|
||||
continue;
|
||||
@@ -160,7 +160,7 @@ public static class Chameleon
|
||||
|
||||
InvisTime.Add(pc.PlayerId, Utils.GetTimeStamp());
|
||||
SendRPC(pc);
|
||||
NameNotifyManager.Notify(pc, GetString("ChameleonInvisState"), ChameleonDuration.GetFloat());
|
||||
pc.Notify(GetString("ChameleonInvisState"), ChameleonDuration.GetFloat());
|
||||
|
||||
UseLimit[pc.PlayerId] -= 1;
|
||||
SendRPCPlus(pc.PlayerId);
|
||||
@@ -173,7 +173,7 @@ public static class Chameleon
|
||||
else
|
||||
{
|
||||
//__instance.myPlayer.MyPhysics.RpcBootFromVent(ventId);
|
||||
NameNotifyManager.Notify(pc, GetString("ChameleonInvisInCooldown"));
|
||||
pc.Notify(GetString("ChameleonInvisInCooldown"));
|
||||
}
|
||||
}, 0.5f, "Chameleon Vent");
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public static class Chameleon
|
||||
SendRPC(pc);
|
||||
|
||||
pc?.MyPhysics?.RpcBootFromVent(vent.Id);
|
||||
NameNotifyManager.Notify(pc, GetString("ChameleonInvisStateOut"));
|
||||
pc.Notify(GetString("ChameleonInvisStateOut"));
|
||||
}
|
||||
public static string GetHudText(PlayerControl pc)
|
||||
{
|
||||
|
||||
+10
-14
@@ -1,4 +1,5 @@
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
using Hazel;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -79,19 +80,10 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!pc.Is(CustomRoles.Drainer)) return;
|
||||
if (DrainLimit <= 0) return;
|
||||
|
||||
if (vent?.NearbyVents == null)
|
||||
{
|
||||
Logger.Warn("No Nearby Vents....?", "Drainer");
|
||||
return;
|
||||
}
|
||||
|
||||
DrainLimit--;
|
||||
|
||||
foreach (var ventToDrain in vent?.NearbyVents?.ToArray())
|
||||
{
|
||||
if (ventToDrain == null) continue;
|
||||
KillPlayersInVent(pc, ventToDrain.Id);
|
||||
}
|
||||
var vents = vent.NearbyVents.Where(vent => vent != null).AddItem(vent).ToArray();
|
||||
foreach (var ventToDrain in vents) KillPlayersInVent(pc, ventToDrain);
|
||||
}
|
||||
|
||||
public static void OnAnyoneEnterVent(PlayerControl pc, Vent vent)
|
||||
@@ -110,9 +102,12 @@ namespace TOHE.Roles.Crewmate
|
||||
|
||||
public static string GetProgressText() => $"<color=#777777>-</color> <color=#ffffff>{DrainLimit}</color>";
|
||||
|
||||
private static void KillPlayersInVent(PlayerControl pc, int ventId)
|
||||
private static void KillPlayersInVent(PlayerControl pc, Vent vent)
|
||||
{
|
||||
if (!IsEnable) return;
|
||||
|
||||
int ventId = vent.Id;
|
||||
|
||||
if (!playersInVents.ContainsValue(ventId)) return;
|
||||
|
||||
foreach (var venterId in playersInVents.Where(x => x.Value == ventId).ToArray())
|
||||
@@ -122,10 +117,11 @@ namespace TOHE.Roles.Crewmate
|
||||
|
||||
if (pc != null && pc.RpcCheckAndMurder(venter, true))
|
||||
{
|
||||
venter?.MyPhysics?.RpcBootFromVent(ventId);
|
||||
venter.MyPhysics.RpcBootFromVent(ventId);
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
venter?.Suicide(PlayerState.DeathReason.Demolished);
|
||||
venter.Suicide(PlayerState.DeathReason.Demolished, pc);
|
||||
Logger.Info($"Killed venter {venter.GetNameWithRole()} (was inside {vent.name}, ID {ventId})", "Drainer");
|
||||
}, 0.55f, "Drainer-KillPlayerInVent");
|
||||
}
|
||||
}
|
||||
|
||||
+22
-16
@@ -33,10 +33,10 @@ namespace TOHE.Roles.Crewmate
|
||||
TriggerPlaceDelay = IntegerOptionItem.Create(Id + 11, "DruidTriggerPlaceDelayOpt", new(1, 20, 1), 7, TabGroup.CrewmateRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Druid])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
UseLimitOpt = IntegerOptionItem.Create(Id + 12, "AbilityUseLimit", new(0, 20, 1), 1, TabGroup.CrewmateRoles, false)
|
||||
UseLimitOpt = IntegerOptionItem.Create(Id + 12, "AbilityUseLimit", new(0, 20, 1), 3, TabGroup.CrewmateRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Druid])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
DruidAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(Id + 13, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 0.5f, TabGroup.CrewmateRoles, false)
|
||||
DruidAbilityUseGainWithEachTaskCompleted = FloatOptionItem.Create(Id + 13, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.1f), 1f, TabGroup.CrewmateRoles, false)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Druid])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!IsEnable || !DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
|
||||
writer.Write(playerId);
|
||||
writer.Write(timestamp);
|
||||
writer.Write(timestamp.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void ReceiveRPCAddTriggerDelay(MessageReader reader)
|
||||
@@ -92,7 +92,7 @@ namespace TOHE.Roles.Crewmate
|
||||
public static void SendRPCAddTrigger(byte playerId, Vector2 position, string roomName)
|
||||
{
|
||||
if (!IsEnable || !DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTrigger, SendOption.Reliable, -1);
|
||||
writer.Write(playerId);
|
||||
writer.Write(position.x);
|
||||
writer.Write(position.y);
|
||||
@@ -115,7 +115,7 @@ namespace TOHE.Roles.Crewmate
|
||||
public static void SendRPCRemoveTrigger(byte playerId, Vector2 position)
|
||||
{
|
||||
if (!IsEnable || !DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidRemoveTrigger, SendOption.Reliable, -1);
|
||||
writer.Write(playerId);
|
||||
writer.Write(position.x);
|
||||
writer.Write(position.y);
|
||||
@@ -134,8 +134,8 @@ namespace TOHE.Roles.Crewmate
|
||||
public static void SendRPCSyncLastUpdate()
|
||||
{
|
||||
if (!IsEnable || !DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidAddTriggerDelay, SendOption.Reliable, -1);
|
||||
writer.Write(lastUpdate);
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.DruidSyncLastUpdate, SendOption.Reliable, -1);
|
||||
writer.Write(lastUpdate.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void ReceiveRPCSyncLastUpdate(MessageReader reader)
|
||||
@@ -176,8 +176,6 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!Triggers.Any() && !TriggerDelays.Any()) return;
|
||||
|
||||
long now = GetTimeStamp();
|
||||
lastUpdate = now;
|
||||
SendRPCSyncLastUpdate();
|
||||
|
||||
if (TriggerDelays.Any())
|
||||
{
|
||||
@@ -198,18 +196,19 @@ namespace TOHE.Roles.Crewmate
|
||||
}
|
||||
|
||||
var timeLeft = TriggerPlaceDelay.GetInt() - (now - x.Value);
|
||||
if (lastUpdate < now) pc.Notify(string.Format(GetString("DruidTimeLeft"), timeLeft));
|
||||
if (lastUpdate < now) pc.Notify(string.Format(GetString("DruidTimeLeft"), timeLeft, 2f));
|
||||
}
|
||||
}
|
||||
|
||||
if (Triggers.Any())
|
||||
{
|
||||
foreach (var pc in Main.AllAlivePlayerControls.Where(pc => !playerIdList.Contains(pc.PlayerId)).ToArray()) // Check for all alive players except Druids - Worst case scenario it's 14 loops
|
||||
{
|
||||
foreach (var triggers in Triggers.ToArray()) // Check for all Druids' traps - Most likely just 1 loop
|
||||
{
|
||||
foreach (var trigger in triggers.Value.ToArray()) // Check for all traps of the current Druid - Most likely 0-2 loops
|
||||
foreach (var trigger in triggers.Value.ToArray()) // Check for all traps of the current Druid - Most likely 0-3 loops
|
||||
{
|
||||
if (Vector2.Distance(trigger.Key, pc.Pos()) <= 2f)
|
||||
if (Vector2.Distance(trigger.Key, pc.Pos()) <= 1.5f)
|
||||
{
|
||||
GetPlayerById(triggers.Key).Notify(string.Format(GetString("DruidTriggerTriggered"), GetFormattedRoomName(trigger.Value), GetFormattedVectorText(trigger.Key)));
|
||||
Triggers[triggers.Key].Remove(trigger.Key);
|
||||
@@ -219,6 +218,9 @@ namespace TOHE.Roles.Crewmate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastUpdate = now;
|
||||
SendRPCSyncLastUpdate();
|
||||
}
|
||||
|
||||
private static (Vector2 LOCATION, string ROOM_NAME) GetTriggerInfo(PlayerControl pc)
|
||||
@@ -237,11 +239,13 @@ namespace TOHE.Roles.Crewmate
|
||||
if (!IsEnable) return string.Empty;
|
||||
if (GetPlayerById(playerId) == null) return string.Empty;
|
||||
|
||||
if (!Triggers.TryGetValue(playerId, out var triggers)) return string.Empty;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("\n<size=1.7>");
|
||||
|
||||
sb.AppendLine($"<color=#00ffa5>{Triggers[playerId].Count}</color> triggers active");
|
||||
sb.Append(string.Join(", ", Triggers[playerId].Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
sb.AppendLine($"<color=#00ffa5>{triggers.Count}</color> trigger{(triggers.Count == 1 ? string.Empty : 's')} active");
|
||||
sb.Append(string.Join(", ", triggers.Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
|
||||
sb.Append("</size>");
|
||||
return sb.ToString();
|
||||
@@ -257,12 +261,14 @@ namespace TOHE.Roles.Crewmate
|
||||
|
||||
sb.AppendLine(GetCD_HUDText());
|
||||
|
||||
if (!Triggers.TryGetValue(id, out var triggers)) return sb.ToString();
|
||||
|
||||
string GetCD_HUDText() => !UsePets.GetBool() || !Main.PetCD.TryGetValue(id, out var CD)
|
||||
? string.Empty
|
||||
: string.Format(GetString("CDPT"), CD.TOTALCD - (GetTimeStamp() - CD.START_TIMESTAMP) + 1);
|
||||
|
||||
sb.AppendLine($"<color=#00ffa5>{Triggers[id].Count}</color> triggers active");
|
||||
sb.Append(string.Join('\n', Triggers[id].Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
sb.AppendLine($"<color=#00ffa5>{triggers.Count}</color> trigger{(triggers.Count == 1 ? string.Empty : 's')} active");
|
||||
sb.Append(string.Join('\n', triggers.Select(trigger => $"Trigger {GetFormattedRoomName(trigger.Value)} {GetFormattedVectorText(trigger.Key)}")));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public static class Marshall
|
||||
|
||||
if (!IsExposed[marshallId]) IsExposed[marshallId] = true;
|
||||
|
||||
NameNotifyManager.Notify(marshall, Translator.GetString("MarshallDoneTasks"));
|
||||
marshall.Notify(Translator.GetString("MarshallDoneTasks"));
|
||||
IsComplete[marshallId] = true;
|
||||
}
|
||||
public static string GetWarningMark(PlayerControl seer, PlayerControl target)
|
||||
|
||||
@@ -97,7 +97,7 @@ internal static class NiceEraser
|
||||
var player = Utils.GetPlayerById(pc);
|
||||
if (player == null) continue;
|
||||
player.RpcSetCustomRole(player.GetCustomRole().GetErasedRole());
|
||||
NameNotifyManager.Notify(player, GetString("LostRoleByNiceEraser"));
|
||||
player.Notify(GetString("LostRoleByNiceEraser"));
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} 被擦除了", "NiceEraser");
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public static class Snitch
|
||||
}
|
||||
}
|
||||
|
||||
NameNotifyManager.Notify(snitch, Translator.GetString("SnitchDoneTasks"));
|
||||
snitch.Notify(Translator.GetString("SnitchDoneTasks"));
|
||||
|
||||
IsComplete[snitchId] = true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace TOHE.Roles.Impostor
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetAdmireLimit, SendOption.Reliable, -1);
|
||||
writer.Write(isRampaging);
|
||||
writer.Write(chargePercent);
|
||||
writer.Write(lastUpdate);
|
||||
writer.Write(lastUpdate.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void ReceiveRPC(MessageReader reader)
|
||||
|
||||
@@ -98,13 +98,13 @@ namespace TOHE.Roles.Impostor
|
||||
{
|
||||
DuelPair.Remove(pair.Key);
|
||||
SendRPC(pair.Key, pair.Value, true);
|
||||
duellist.TPtoRndVent();
|
||||
_ = new LateTask(duellist.TPtoRndVent, 0.5f, log: false);
|
||||
}
|
||||
else if (TAlive && !DAlive)
|
||||
{
|
||||
DuelPair.Remove(pair.Key);
|
||||
SendRPC(pair.Key, pair.Value, true);
|
||||
target.TPtoRndVent();
|
||||
_ = new LateTask(target.TPtoRndVent, 0.5f, log: false);
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ internal static class Eraser
|
||||
if (player == null)
|
||||
continue;
|
||||
player.RpcSetCustomRole(CustomRolesHelper.GetErasedRole(player.GetCustomRole()));
|
||||
NameNotifyManager.Notify(player, GetString("LostRoleByEraser"));
|
||||
player.Notify(GetString("LostRoleByEraser"));
|
||||
Logger.Info($"{player.GetNameWithRole().RemoveHtmlTags()} 被擦除了", "Eraser");
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace TOHE.Roles.Impostor
|
||||
|
||||
targetId = target.PlayerId;
|
||||
SendRPC(targetId);
|
||||
NotifyRoles(SpecifySeer: hitman, SpecifyTarget: hitman);
|
||||
NotifyRoles(SpecifySeer: hitman, SpecifyTarget: target);
|
||||
|
||||
//_ = new LateTask(() => { hitman.CmdCheckRevertShapeshift(false); }, 1.5f, "Hitman RpcRevertShapeshift");
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace TOHE.Roles.Impostor
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncMafiosoPistolCD, SendOption.Reliable, -1);
|
||||
writer.Write(Pistol1CD);
|
||||
writer.Write(Pistol2CD);
|
||||
writer.Write(lastUpdate);
|
||||
writer.Write(lastUpdate.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void ReceiveRPCSyncPistolCD(MessageReader reader)
|
||||
|
||||
@@ -122,7 +122,7 @@ public static class Swooper
|
||||
{
|
||||
lastTime.Add(pc.PlayerId, now);
|
||||
pc?.MyPhysics?.RpcBootFromVent(ventedId.TryGetValue(pc.PlayerId, out var id) ? id : Main.LastEnteredVent[pc.PlayerId].Id);
|
||||
NameNotifyManager.Notify(pc, GetString("SwooperInvisStateOut"));
|
||||
pc.Notify(GetString("SwooperInvisStateOut"));
|
||||
SendRPC(pc);
|
||||
continue;
|
||||
}
|
||||
@@ -155,14 +155,14 @@ public static class Swooper
|
||||
InvisTime.Add(pc.PlayerId, Utils.GetTimeStamp());
|
||||
SwoopLimit[pc.PlayerId] -= 1;
|
||||
SendRPC(pc);
|
||||
NameNotifyManager.Notify(pc, GetString("SwooperInvisState"), SwooperDuration.GetFloat());
|
||||
pc.Notify(GetString("SwooperInvisState"), SwooperDuration.GetFloat());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!SwooperVentNormallyOnCooldown.GetBool())
|
||||
{
|
||||
__instance.myPlayer.MyPhysics.RpcBootFromVent(ventId);
|
||||
NameNotifyManager.Notify(pc, GetString("SwooperInvisInCooldown"));
|
||||
pc.Notify(GetString("SwooperInvisInCooldown"));
|
||||
}
|
||||
}
|
||||
}, 0.5f, "Swooper Vent");
|
||||
@@ -176,7 +176,7 @@ public static class Swooper
|
||||
SendRPC(pc);
|
||||
|
||||
pc?.MyPhysics?.RpcBootFromVent(vent.Id);
|
||||
NameNotifyManager.Notify(pc, GetString("SwooperInvisStateOut"));
|
||||
pc.Notify(GetString("SwooperInvisStateOut"));
|
||||
}
|
||||
public static string GetHudText(PlayerControl pc)
|
||||
{
|
||||
|
||||
@@ -107,23 +107,23 @@ public static class Glitch
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchMimic, SendOption.Reliable, -1);
|
||||
writer.Write(mimicCDTimer);
|
||||
writer.Write(mimicDurTimer);
|
||||
writer.Write(lastMimic);
|
||||
writer.Write(lastMimic.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void SendRPCSyncLongs(long lastKill, long lastHack, long lastMimic)
|
||||
{
|
||||
if (!IsEnable || !Utils.DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchLongs, SendOption.Reliable, -1);
|
||||
writer.Write(lastKill);
|
||||
writer.Write(lastHack);
|
||||
writer.Write(lastMimic);
|
||||
writer.Write(lastKill.ToString());
|
||||
writer.Write(lastHack.ToString());
|
||||
writer.Write(lastMimic.ToString());
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void SendRPCSyncKill(long lastKill, int KCDtimer)
|
||||
{
|
||||
if (!IsEnable || !Utils.DoRPC) return;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncGlitchKill, SendOption.Reliable, -1);
|
||||
writer.Write(lastKill);
|
||||
writer.Write(lastKill.ToString());
|
||||
writer.Write(KCDtimer);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public static class Werewolf
|
||||
if (remainTime < 0)
|
||||
{
|
||||
lastTime.Add(pc.PlayerId, now);
|
||||
NameNotifyManager.Notify(pc, GetString("WWRampageOut"));
|
||||
pc.Notify(GetString("WWRampageOut"));
|
||||
SendRPC(pc);
|
||||
continue;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public static class Werewolf
|
||||
{
|
||||
RampageTime.Add(pc.PlayerId, Utils.GetTimeStamp());
|
||||
SendRPC(pc);
|
||||
NameNotifyManager.Notify(pc, GetString("WWRampaging"), RampageDur.GetFloat());
|
||||
pc.Notify(GetString("WWRampaging"), RampageDur.GetFloat());
|
||||
}
|
||||
else return;
|
||||
}, 0.5f, "Werewolf Vent");
|
||||
|
||||
@@ -117,7 +117,7 @@ public static class Wraith
|
||||
{
|
||||
lastTime.Add(pc.PlayerId, now);
|
||||
pc?.MyPhysics?.RpcBootFromVent(ventedId.TryGetValue(pc.PlayerId, out var id) ? id : Main.LastEnteredVent[pc.PlayerId].Id);
|
||||
NameNotifyManager.Notify(pc, GetString("WraithInvisStateOut"));
|
||||
pc.Notify(GetString("WraithInvisStateOut"));
|
||||
SendRPC(pc);
|
||||
continue;
|
||||
}
|
||||
@@ -149,14 +149,14 @@ public static class Wraith
|
||||
|
||||
InvisTime.Add(pc.PlayerId, Utils.GetTimeStamp());
|
||||
SendRPC(pc);
|
||||
NameNotifyManager.Notify(pc, GetString("WraithInvisState"), WraithDuration.GetFloat());
|
||||
pc.Notify(GetString("WraithInvisState"), WraithDuration.GetFloat());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!WraithVentNormallyOnCooldown.GetBool())
|
||||
{
|
||||
__instance.myPlayer.MyPhysics.RpcBootFromVent(ventId);
|
||||
NameNotifyManager.Notify(pc, GetString("WraithInvisInCooldown"));
|
||||
pc.Notify(GetString("WraithInvisInCooldown"));
|
||||
}
|
||||
}
|
||||
}, 0.5f, "Wraith Vent");
|
||||
@@ -170,7 +170,7 @@ public static class Wraith
|
||||
SendRPC(pc);
|
||||
|
||||
pc?.MyPhysics?.RpcBootFromVent(vent.Id);
|
||||
NameNotifyManager.Notify(pc, GetString("WraithInvisStateOut"));
|
||||
pc.Notify(GetString("WraithInvisStateOut"));
|
||||
}
|
||||
public static string GetHudText(PlayerControl pc)
|
||||
{
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<Description>TOHE+</Description>
|
||||
<Authors>Gurge44</Authors>
|
||||
<langVersion>preview</langVersion>
|
||||
<AmongUs>E:\Program Files\AmongUs</AmongUs>
|
||||
<AmongUs>D:\Epic Games\AmongUs</AmongUs>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>True</Optimize>
|
||||
<AssemblyName>$(MSBuildProjectName)+</AssemblyName>
|
||||
|
||||
@@ -33,8 +33,8 @@ public class Main : BasePlugin
|
||||
public static ConfigEntry<string> DebugKeyInput { get; private set; }
|
||||
public static readonly string MainMenuText = " ";
|
||||
public const string PluginGuid = "com.gurge44.toheplus";
|
||||
public const string PluginVersion = "1.5.0";
|
||||
public const string PluginDisplayVersion = "1.5.0";
|
||||
public const string PluginVersion = "2.0.1";
|
||||
public const string PluginDisplayVersion = "2.0.1";
|
||||
public static readonly string SupportedAUVersion = "2023.10.24";
|
||||
public const int PluginCreate = 3;
|
||||
public const bool Canary = false;
|
||||
|
||||
Reference in new issue
Block a user