mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
dd1555cfc3
20 files changed
+183
-44
No files matched your search
+17
-1
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -642,6 +642,7 @@ public static class BedWars
|
||||
|
||||
if (!allowed)
|
||||
{
|
||||
RPC.PlaySoundRPC(__instance.PlayerId, Sounds.ImpDiscovered);
|
||||
__instance.Notify(Translator.GetString("Bedwars.YouCannotLeaveRoomInGracePeriod"));
|
||||
__instance.TP(data.Base.SpawnPosition);
|
||||
}
|
||||
@@ -703,6 +704,7 @@ public static class BedWars
|
||||
Logger.Info($"{enemy.GetRealName()} triggered trap for {data.Team} team", "BedWars");
|
||||
upgrades.Remove(Upgrade.Trap);
|
||||
|
||||
enemy.RPCPlayCustomSound("FlashBang");
|
||||
Trapped.Add(enemy.PlayerId);
|
||||
Main.AllPlayerSpeed[enemy.PlayerId] -= TrappedSpeedDecrease;
|
||||
enemy.MarkDirtySettings();
|
||||
@@ -710,6 +712,7 @@ public static class BedWars
|
||||
LateTask.New(() =>
|
||||
{
|
||||
if (GameStates.IsEnded || !GameStates.InGame || GameStates.IsLobby || enemy == null) return;
|
||||
RPC.PlaySoundRPC(enemy.PlayerId, Sounds.TaskComplete);
|
||||
Trapped.Remove(enemy.PlayerId);
|
||||
Main.AllPlayerSpeed[enemy.PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
enemy.MarkDirtySettings();
|
||||
@@ -720,6 +723,7 @@ public static class BedWars
|
||||
PlayerControl player = id.GetPlayer();
|
||||
if (player == null || !player.IsAlive() || otherData.Team != data.Team) continue;
|
||||
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.SabotageSound);
|
||||
player.Notify(string.Format(Translator.GetString("Bedwars.TrapTriggered"), enemy.PlayerId.ColoredPlayerName()));
|
||||
}
|
||||
}
|
||||
@@ -1074,6 +1078,7 @@ public static class BedWars
|
||||
public virtual void EnterShop(PlayerControl pc)
|
||||
{
|
||||
if (pc == null || !pc.IsAlive()) return;
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskUpdateSound);
|
||||
SelectionIndex.TryAdd(pc.PlayerId, 0);
|
||||
}
|
||||
|
||||
@@ -1145,6 +1150,7 @@ public static class BedWars
|
||||
if (itemCategory is ItemCategory.Armor or ItemCategory.Weapon || data.Inventory.Adjust(selectedItem))
|
||||
data.Inventory.Adjust(cost.Resource, -cost.Count);
|
||||
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskComplete);
|
||||
Logger.Info($"{pc.GetRealName()} purchased {selectedItem} for {cost.Count} {cost.Resource}", "BedWars");
|
||||
}
|
||||
}
|
||||
@@ -1163,6 +1169,7 @@ public static class BedWars
|
||||
private void EnterCategory(PlayerControl pc)
|
||||
{
|
||||
if (pc == null || !pc.IsAlive()) return;
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskUpdateSound);
|
||||
CategoryIndex.TryAdd(pc.PlayerId, 0);
|
||||
SelectionIndex.TryAdd(pc.PlayerId, 0);
|
||||
Category[pc.PlayerId] = Categories[CategoryIndex[pc.PlayerId]];
|
||||
@@ -1171,6 +1178,7 @@ public static class BedWars
|
||||
public override void EnterShop(PlayerControl pc)
|
||||
{
|
||||
if (pc == null || !pc.IsAlive()) return;
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskUpdateSound);
|
||||
SelectionIndex.TryAdd(pc.PlayerId, 0);
|
||||
CategoryIndex.TryAdd(pc.PlayerId, 0);
|
||||
}
|
||||
@@ -1245,6 +1253,7 @@ public static class BedWars
|
||||
if (!Upgrades.TryGetValue(data.Team, out HashSet<Upgrade> upgrades)) Upgrades[data.Team] = upgrades = [];
|
||||
if (upgrades.Add(selectedUpgrade)) data.Inventory.Adjust(Item.Diamond, -cost);
|
||||
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskComplete);
|
||||
Logger.Info($"{pc.GetRealName()} purchased {selectedUpgrade} for {cost} {Item.Diamond}", "BedWars");
|
||||
}
|
||||
}
|
||||
@@ -1584,6 +1593,7 @@ public static class BedWars
|
||||
|
||||
if (selected.Value >= req)
|
||||
{
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskUpdateSound);
|
||||
data.Inventory.Adjust(selected.Key, -req);
|
||||
bed.Value.Bed.Layers.Add(selected.Key);
|
||||
bed.Value.Bed.UpdateStatus();
|
||||
@@ -1594,9 +1604,11 @@ public static class BedWars
|
||||
switch (selected.Key)
|
||||
{
|
||||
case Item.GoldenApple:
|
||||
pc.RPCPlayCustomSound("Bet");
|
||||
data.Health = MaxHealth;
|
||||
break;
|
||||
case Item.TNT:
|
||||
pc.RPCPlayCustomSound("Line");
|
||||
_ = new TNT(pos);
|
||||
break;
|
||||
case Item.InvisibilityPotion:
|
||||
@@ -1777,6 +1789,8 @@ public static class BedWars
|
||||
var str = string.Empty;
|
||||
const int progressDisplayParts = 10;
|
||||
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskUpdateSound);
|
||||
|
||||
while (timer > 0f)
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
@@ -1822,6 +1836,7 @@ public static class BedWars
|
||||
pc.Notify(data.Team == team ? Translator.GetString("Bedwars.BedStatus.Broken") : string.Format(Translator.GetString("Bedwars.BedStatus.EnemyBroken"), team.GetName()));
|
||||
}
|
||||
|
||||
CustomSoundsManager.RPCPlayCustomSoundAll("Gunfire");
|
||||
Logger.Info($"Bed of team {team.GetName()} at position {Position} is broken", "BedWars");
|
||||
Despawn();
|
||||
IsBroken = true;
|
||||
@@ -1839,6 +1854,7 @@ public static class BedWars
|
||||
|
||||
public static void OnTNTExplode(Vector2 position)
|
||||
{
|
||||
CustomSoundsManager.RPCPlayCustomSoundAll("Boom");
|
||||
Logger.Info($"TNT exploded at position {position}", "BedWars");
|
||||
|
||||
foreach ((byte id, PlayerData data) in Data)
|
||||
|
||||
@@ -761,7 +761,7 @@ public static class CaptureTheFlag
|
||||
TemporarilyOutPlayers.Remove(__instance.PlayerId);
|
||||
__instance.ReviveFromTemporaryExile();
|
||||
__instance.TP(team.GetFlagBase().Position);
|
||||
RPC.PlaySoundRPC(__instance.PlayerId, Sounds.TaskComplete);
|
||||
RPC.PlaySoundRPC(__instance.PlayerId, Sounds.SpawnSound);
|
||||
Utils.NotifyRoles(SpecifySeer: __instance, SpecifyTarget: __instance, SendOption: SendOption.None);
|
||||
}
|
||||
else if (GameEndCriteria.GetValue() != 2)
|
||||
@@ -794,4 +794,4 @@ public class CTFPlayer : RoleBase
|
||||
CaptureTheFlag.TryPickUpFlag(pc);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-6
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR;
|
||||
@@ -16,7 +14,6 @@ public static class Deathrace
|
||||
public static Dictionary<byte, PlayerData> Data = [];
|
||||
public static long LastPowerUpSpawn;
|
||||
public static List<DeathracePowerUp> SpawnedPowerUps = [];
|
||||
|
||||
public static bool GameGoing;
|
||||
|
||||
// Settings
|
||||
@@ -371,13 +368,16 @@ public static class Deathrace
|
||||
if (!SpawnPowerUps || !Data.TryGetValue(killer.PlayerId, out var data) || data.PowerUps.Count == 0) return;
|
||||
PowerUp powerUp = data.PowerUps[0];
|
||||
if (powerUp != PowerUp.Taser) return;
|
||||
killer.RPCPlayCustomSound("Line");
|
||||
data.PowerUps.RemoveAt(0);
|
||||
Main.AllPlayerSpeed[target.PlayerId] = Main.MinSpeed;
|
||||
target.RPCPlayCustomSound("Bite");
|
||||
target.MarkDirtySettings();
|
||||
LateTask.New(() =>
|
||||
{
|
||||
if (target == null) return;
|
||||
Main.AllPlayerSpeed[target.PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
RPC.PlaySoundRPC(target.PlayerId, Sounds.TaskComplete);
|
||||
target.MarkDirtySettings();
|
||||
}, PowerUpEffectDuration, $"Taser Revert ({Main.AllPlayerNames.GetValueOrDefault(killer.PlayerId, $"ID {killer.PlayerId}")} => {Main.AllPlayerNames.GetValueOrDefault(target.PlayerId, $"ID {target.PlayerId}")})");
|
||||
}
|
||||
@@ -392,6 +392,7 @@ public static class Deathrace
|
||||
{
|
||||
if (!SpawnPowerUps || !Data.TryGetValue(pc.PlayerId, out var data) || data.PowerUps.Count == 0) return;
|
||||
PowerUp powerUp = data.PowerUps[0];
|
||||
pc.RPCPlayCustomSound("Line");
|
||||
data.PowerUps.RemoveAt(0);
|
||||
PlayerControl[] playersInRange = Utils.GetPlayersInRadius(PowerUpEffectRange, pc.Pos()).Without(pc).ToArray();
|
||||
|
||||
@@ -444,6 +445,7 @@ public static class Deathrace
|
||||
{
|
||||
if (!Main.PlayerStates.TryGetValue(player.PlayerId, out var state)) return;
|
||||
state.IsBlackOut = true;
|
||||
player.RPCPlayCustomSound("FlashBang");
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
|
||||
@@ -453,6 +455,7 @@ public static class Deathrace
|
||||
{
|
||||
if (player == null || !Main.PlayerStates.TryGetValue(player.PlayerId, out var state) || !state.IsBlackOut) continue;
|
||||
state.IsBlackOut = false;
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.TaskComplete);
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
}, PowerUpEffectDuration, $"Grenade Revert ({Main.AllPlayerNames.GetValueOrDefault(pc.PlayerId, $"ID {pc.PlayerId}")})");
|
||||
@@ -463,6 +466,7 @@ public static class Deathrace
|
||||
foreach (PlayerControl player in playersInRange)
|
||||
{
|
||||
Main.AllPlayerSpeed[player.PlayerId] *= -1;
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.SabotageSound);
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
|
||||
@@ -472,6 +476,7 @@ public static class Deathrace
|
||||
{
|
||||
if (player == null || Main.AllPlayerSpeed[player.PlayerId] >= 0f) continue;
|
||||
Main.AllPlayerSpeed[player.PlayerId] *= -1;
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.TaskComplete);
|
||||
player.MarkDirtySettings();
|
||||
}
|
||||
}, PowerUpEffectDuration, $"Ice Revert ({Main.AllPlayerNames.GetValueOrDefault(pc.PlayerId, $"ID {pc.PlayerId}")})");
|
||||
@@ -510,6 +515,7 @@ public static class Deathrace
|
||||
|
||||
if (SpawnedPowerUps.FindFirst(x => Vector2.Distance(data.Player.Pos(), x.Position) <= PowerUpPickupRange, out var powerUp))
|
||||
{
|
||||
RPC.PlaySoundRPC(id, Sounds.TaskUpdateSound);
|
||||
data.PowerUps.Add(powerUp.PowerUp);
|
||||
SpawnedPowerUps.Remove(powerUp);
|
||||
powerUp.Despawn();
|
||||
@@ -534,6 +540,7 @@ public static class Deathrace
|
||||
if (endOfTrack)
|
||||
{
|
||||
data.Lap++;
|
||||
RPC.PlaySoundRPC(id, Sounds.TaskComplete);
|
||||
Utils.SendRPC(CustomRPC.DeathraceSync, id, data.Lap);
|
||||
|
||||
if (data.Lap >= LapsToWin)
|
||||
@@ -561,8 +568,9 @@ public static class Deathrace
|
||||
else
|
||||
{
|
||||
data.NextRoom = Clockwise ? Track[index + 1] : Track[index - 1];
|
||||
RPC.PlaySoundRPC(id, Sounds.TaskUpdateSound);
|
||||
}
|
||||
|
||||
|
||||
Logger.Info($"{Main.AllPlayerNames.GetValueOrDefault(id, $"ID {id}")} entered {data.LastRoom}, next is {data.NextRoom}", "Deathrace");
|
||||
}
|
||||
else if (!coordinateCheck && InitialSpawnRoom[Main.CurrentMap] != room.RoomId)
|
||||
@@ -616,4 +624,4 @@ public static class Deathrace
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -795,7 +795,7 @@ public static class KingOfTheZones
|
||||
player.ReviveFromTemporaryExile();
|
||||
player.TP(RandomSpawn.SpawnMap.GetSpawnMap().Positions.ExceptBy(Zones, x => x.Key).RandomElement().Value);
|
||||
LateTask.New(() => player.SetKillCooldown(GetKillCooldown(player)), 1.5f, log: false);
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.TaskComplete);
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.SpawnSound);
|
||||
Utils.NotifyRoles(SpecifyTarget: player, SendOption: SendOption.None);
|
||||
|
||||
int spawnProtectionTime = SpawnProtectionTime.GetInt();
|
||||
@@ -880,4 +880,4 @@ public static class KingOfTheZones
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -968,7 +968,11 @@ public static class NaturalDisasters
|
||||
|
||||
if (room != null && CollapsedRooms.Exists(x => x == room))
|
||||
{
|
||||
if (LastPosition.TryGetValue(pc.PlayerId, out Vector2 lastPos)) pc.TP(lastPos);
|
||||
if (LastPosition.TryGetValue(pc.PlayerId, out Vector2 lastPos))
|
||||
{
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.ImpDiscovered);
|
||||
pc.TP(lastPos);
|
||||
}
|
||||
else pc.Suicide(PlayerState.DeathReason.Collapsed);
|
||||
}
|
||||
else LastPosition[pc.PlayerId] = pc.Pos();
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ internal static class SoloPVP
|
||||
PlayerHP[pc.PlayerId] = PlayerHPMax[pc.PlayerId];
|
||||
LastHurt[pc.PlayerId] = Utils.TimeStamp;
|
||||
pc.ReviveFromTemporaryExile();
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskComplete);
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.SpawnSound);
|
||||
SpawnMap.GetSpawnMap().RandomTeleport(pc);
|
||||
Utils.NotifyRoles(SpecifyTarget: pc, SendOption: SendOption.None);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ internal static class ExtendedPlayerControl
|
||||
public static bool UsesMeetingShapeshift(this PlayerControl player)
|
||||
{
|
||||
CustomRoles role = player.GetCustomRole();
|
||||
if (player.IsModdedClient() && role is CustomRoles.Councillor or CustomRoles.Judge or CustomRoles.Starspawn or CustomRoles.Swapper or CustomRoles.Retributionist) return false;
|
||||
if (player.IsModdedClient() && role is CustomRoles.Councillor or CustomRoles.Inspector or CustomRoles.Judge or CustomRoles.Retributionist or CustomRoles.Starspawn or CustomRoles.Swapper or CustomRoles.Ventriloquist) return false;
|
||||
return role.UsesMeetingShapeshift();
|
||||
}
|
||||
|
||||
@@ -441,6 +441,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
if (!Main.PlayerStates.TryGetValue(player.PlayerId, out var state)) return;
|
||||
|
||||
RPC.PlaySoundRPC(player.PlayerId, Sounds.SpawnSound);
|
||||
GhostRolesManager.RemoveGhostRole(player.PlayerId);
|
||||
state.RealKiller = (DateTime.MinValue, byte.MaxValue);
|
||||
state.IsDead = false;
|
||||
|
||||
+28
-2
@@ -163,6 +163,7 @@ public enum CustomRPC
|
||||
ImitatorClick,
|
||||
RetributionistClick,
|
||||
StarspawnClick,
|
||||
VentriloquistClick,
|
||||
Invisibility,
|
||||
ResetAbilityCooldown,
|
||||
SyncCamouflage,
|
||||
@@ -191,7 +192,12 @@ public enum Sounds
|
||||
KillSound,
|
||||
TaskComplete,
|
||||
TaskUpdateSound,
|
||||
ImpTransform
|
||||
SabotageSound,
|
||||
ImpDiscovered,
|
||||
LobbyTimerPopUp,
|
||||
SpawnSound,
|
||||
ImpTransform,
|
||||
YeehawTransform
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.HandleRpc))]
|
||||
@@ -249,7 +255,7 @@ internal static class RPCHandlerPatch
|
||||
private static bool TrustedRpc(byte id)
|
||||
{
|
||||
if (SubmergedCompatibility.IsSubmerged() && id is >= 120 and <= 124) return true;
|
||||
return (CustomRPC)id is CustomRPC.VersionCheck or CustomRPC.RequestRetryVersionCheck or CustomRPC.AntiBlackout or CustomRPC.SyncNameNotify or CustomRPC.RequestSendMessage or CustomRPC.RequestCommandProcessing or CustomRPC.Judge or CustomRPC.SetSwapperVotes or CustomRPC.MeetingKill or CustomRPC.Guess or CustomRPC.NemesisRevenge or CustomRPC.BAU or CustomRPC.FFAKill or CustomRPC.TMGSync or CustomRPC.InspectorCommand or CustomRPC.ImitatorClick or CustomRPC.RetributionistClick or CustomRPC.StarspawnClick;
|
||||
return (CustomRPC)id is CustomRPC.VersionCheck or CustomRPC.RequestRetryVersionCheck or CustomRPC.AntiBlackout or CustomRPC.SyncNameNotify or CustomRPC.RequestSendMessage or CustomRPC.RequestCommandProcessing or CustomRPC.Judge or CustomRPC.SetSwapperVotes or CustomRPC.MeetingKill or CustomRPC.Guess or CustomRPC.NemesisRevenge or CustomRPC.BAU or CustomRPC.FFAKill or CustomRPC.TMGSync or CustomRPC.InspectorCommand or CustomRPC.ImitatorClick or CustomRPC.RetributionistClick or CustomRPC.StarspawnClick or CustomRPC.VentriloquistClick;
|
||||
}
|
||||
|
||||
private static bool CheckRateLimit(PlayerControl __instance, RpcCalls rpcType)
|
||||
@@ -1363,6 +1369,11 @@ internal static class RPCHandlerPatch
|
||||
ChatCommands.DayBreakCommand(__instance, command, command.Split(' '));
|
||||
break;
|
||||
}
|
||||
case CustomRPC.VentriloquistClick:
|
||||
{
|
||||
Ventriloquist.ReceiveRPC(reader, __instance);
|
||||
break;
|
||||
}
|
||||
case CustomRPC.Invisibility:
|
||||
{
|
||||
int num = reader.ReadPackedInt32();
|
||||
@@ -1635,9 +1646,24 @@ internal static class RPC
|
||||
case Sounds.TaskUpdateSound when HudManager.InstanceExists:
|
||||
SoundManager.Instance.PlaySound(HudManager.Instance.TaskUpdateSound, false);
|
||||
break;
|
||||
case Sounds.SabotageSound:
|
||||
SoundManager.Instance.PlaySound(ShipStatus.Instance.SabotageSound, false);
|
||||
break;
|
||||
case Sounds.ImpDiscovered:
|
||||
SoundManager.Instance.PlaySound(PlayerControl.LocalPlayer.MyPhysics.ImpostorDiscoveredSound, false);
|
||||
break;
|
||||
case Sounds.LobbyTimerPopUp when HudManager.InstanceExists:
|
||||
SoundManager.Instance.PlaySound(HudManager.Instance.LobbyTimerExtensionUI.lobbyTimerPopUpSound, false);
|
||||
break;
|
||||
case Sounds.SpawnSound:
|
||||
SoundManager.Instance.PlaySound(LobbyBehaviour.Instance.SpawnSound, false);
|
||||
break;
|
||||
case Sounds.ImpTransform:
|
||||
SoundManager.Instance.PlaySound(DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherImpostorTransformSfx, false, 0.8f);
|
||||
break;
|
||||
case Sounds.YeehawSound:
|
||||
SoundManager.Instance.PlaySound(DestroyableSingleton<HnSImpostorScreamSfx>.Instance.HnSOtherYeehawSfx, false, 0.8f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1292,11 +1292,9 @@ internal static class ChatCommands
|
||||
PlayerState state = Main.PlayerStates[pc.PlayerId];
|
||||
state.deathReason = PlayerState.DeathReason.Kill;
|
||||
state.RealKiller.ID = player.PlayerId;
|
||||
state.SetDead();
|
||||
|
||||
pc.RpcExileV2();
|
||||
|
||||
pc.RpcGuesserMurderPlayer();
|
||||
Utils.AfterPlayerDeathTasks(pc, true);
|
||||
SoundManager.Instance.PlaySound(pc.KillSfx, false, 0.8f);
|
||||
|
||||
string coloredName = deadPlayer.ColoredPlayerName();
|
||||
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("DeathNoteCommand.Success"), coloredName), sendOption: SendOption.None);
|
||||
@@ -3804,3 +3802,4 @@ internal static class RpcSendChatPatch
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using EHR.Crewmate;
|
||||
using EHR.Impostor;
|
||||
using EHR.Neutral;
|
||||
@@ -189,7 +189,8 @@ public static class HudSpritePatch
|
||||
else if (!shapeshifting) newAbilityButton = CustomButton.Get("Disperse");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
case CustomRoles.Duellist:
|
||||
case CustomRoles.SoulCatcher:
|
||||
case CustomRoles.Twister:
|
||||
{
|
||||
@@ -313,8 +314,9 @@ public static class HudSpritePatch
|
||||
{
|
||||
newKillButton = CustomButton.Get("Shield");
|
||||
break;
|
||||
}
|
||||
case CustomRoles.Gangster when Gangster.CanRecruit(player.PlayerId):
|
||||
}
|
||||
case CustomRoles.Gangster when Gangster.CanRecruit(player.PlayerId):
|
||||
case CustomRoles.Jackal when player.GetAbilityUseLimit() > 0:
|
||||
{
|
||||
newKillButton = CustomButton.Get("Sidekick");
|
||||
break;
|
||||
@@ -507,4 +509,4 @@ public static class HudSpritePatch
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -654,7 +654,8 @@ internal static class BeginCrewmatePatch
|
||||
CustomRoles.Workaholic
|
||||
=> HudManager.Instance.TaskCompleteSound,
|
||||
|
||||
CustomRoles.Helper or
|
||||
CustomRoles.Bestower or
|
||||
CustomRoles.Helper or
|
||||
CustomRoles.TaskManager
|
||||
=> HudManager.Instance.TaskUpdateSound,
|
||||
|
||||
@@ -770,6 +771,7 @@ internal static class BeginCrewmatePatch
|
||||
or CustomRoles.Demon
|
||||
or CustomRoles.Pelican
|
||||
or CustomRoles.Scavenger
|
||||
or CustomRoles.Spider
|
||||
or CustomRoles.Vampire
|
||||
or CustomRoles.Vulture
|
||||
or CustomRoles.Wasp
|
||||
@@ -807,6 +809,7 @@ internal static class BeginCrewmatePatch
|
||||
or CustomRoles.Exclusionary
|
||||
or CustomRoles.Stalker
|
||||
or CustomRoles.SoulCatcher
|
||||
or CustomRoles.SoulCollector
|
||||
or CustomRoles.SoulHunter
|
||||
=> GetIntroSound(RoleTypes.Phantom),
|
||||
|
||||
|
||||
@@ -1156,6 +1156,7 @@ internal static class MeetingHudStartPatch
|
||||
Imitator.StartMeetingPatch.Postfix(__instance);
|
||||
Retributionist.StartMeetingPatch.Postfix(__instance);
|
||||
Starspawn.StartMeetingPatch.Postfix(__instance);
|
||||
Ventriloquist.StartMeetingPatch.Postfix(__instance);
|
||||
ShowHostMeetingPatch.Setup_Postfix(__instance);
|
||||
#if !ANDROID
|
||||
Crowded.MeetingHudStartPatch.Postfix(__instance);
|
||||
@@ -1547,4 +1548,5 @@ internal static class ExileControllerBeginPatch
|
||||
if (Options.CurrentGameMode is CustomGameMode.Standard or CustomGameMode.TheMindGame && init is { outfit: not null })
|
||||
__instance.completeString = CheckForEndVotingPatch.EjectionText[..^8];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
@@ -55,7 +55,6 @@ public class Introvert : IAddon
|
||||
|
||||
if (time == 0)
|
||||
{
|
||||
pc.RPCPlayCustomSound("Teleport");
|
||||
pc.TPToRandomVent();
|
||||
return;
|
||||
}
|
||||
@@ -68,6 +67,7 @@ public class Introvert : IAddon
|
||||
|
||||
if (endTS <= Utils.TimeStamp && !pc.inVent)
|
||||
{
|
||||
pc.RPCPlayCustomSound("Teleport");
|
||||
pc.TPToRandomVent();
|
||||
TeleportAwayDelays.Remove(pc.PlayerId);
|
||||
Utils.SendRPC(CustomRPC.SyncIntrovert, 1, pc.PlayerId);
|
||||
@@ -101,4 +101,4 @@ public class Introvert : IAddon
|
||||
if (!seer.IsAlive() || !TeleportAwayDelays.TryGetValue(seer.PlayerId, out long endTS)) return string.Empty;
|
||||
return string.Format(Translator.GetString("Introvert.Suffix"), endTS - Utils.TimeStamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
|
||||
namespace EHR.Crewmate;
|
||||
|
||||
@@ -57,10 +58,11 @@ public class Bestower : RoleBase
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
float give = GivenUses.GetFloat();
|
||||
RPC.PlaySoundRPC(target.PlayerId, Sounds.TaskUpdateSound);
|
||||
target.RpcIncreaseAbilityUseLimitBy(give);
|
||||
killer.Notify(string.Format(Translator.GetString("Bestower.GaveNotify"), Math.Round(give, 2)));
|
||||
killer.RpcRemoveAbilityUse();
|
||||
killer.SetKillCooldown();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ internal class Speedrunner : RoleBase
|
||||
|
||||
public override void SetupCustomOption()
|
||||
{
|
||||
SetupSingleRoleOptions(652500, TabGroup.CrewmateRoles, CustomRoles.Speedrunner, zeroOne: true);
|
||||
SetupSingleRoleOptions(652500, TabGroup.CrewmateRoles, CustomRoles.Speedrunner);
|
||||
|
||||
SpeedrunnerNotifyKillers = new BooleanOptionItem(652510, "SpeedrunnerNotifyKillers", true, TabGroup.CrewmateRoles)
|
||||
.SetParent(CustomRoleSpawnChances[CustomRoles.Speedrunner]);
|
||||
@@ -103,4 +103,4 @@ internal class Speedrunner : RoleBase
|
||||
keepGameGoing = true;
|
||||
countsAs = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Crewmate;
|
||||
using EHR.Modules;
|
||||
using EHR.Neutral;
|
||||
using static EHR.Options;
|
||||
using static EHR.Translator;
|
||||
@@ -49,6 +50,11 @@ public class Duellist : RoleBase
|
||||
AURoleOptions.ShapeshifterCooldown = SSCD.GetFloat();
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(GetString("SoulCatcherButtonText"));
|
||||
}
|
||||
|
||||
public override bool OnShapeshift(PlayerControl duellist, PlayerControl target, bool shapeshifting)
|
||||
{
|
||||
if (!IsEnable) return false;
|
||||
@@ -69,6 +75,9 @@ public class Duellist : RoleBase
|
||||
|
||||
duellist.TP(pos);
|
||||
DuelPair[duellist.PlayerId] = target.PlayerId;
|
||||
|
||||
duellist.RPCPlayCustomSound("Teleport");
|
||||
target.RPCPlayCustomSound("Teleport");
|
||||
}
|
||||
else
|
||||
duellist.Notify(GetString("TargetCannotBeTeleported"));
|
||||
@@ -107,4 +116,3 @@ public class Duellist : RoleBase
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
namespace EHR.Impostor;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR.Impostor;
|
||||
|
||||
public class Ventriloquist : RoleBase
|
||||
{
|
||||
@@ -40,4 +46,59 @@ public class Ventriloquist : RoleBase
|
||||
var command = $"/target {target.PlayerId}";
|
||||
ChatCommands.TargetCommand(shapeshifter, command, command.Split(' '));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReceiveRPC(MessageReader reader, PlayerControl pc)
|
||||
{
|
||||
int playerId = reader.ReadByte();
|
||||
var command = $"/target {playerId}";
|
||||
ChatCommands.TargetCommand(pc, command, command.Split(' '));
|
||||
}
|
||||
|
||||
private static void VentriloquisttOnClick(byte playerId /*, MeetingHud __instance*/)
|
||||
{
|
||||
Logger.Msg($"Click: ID {playerId}", "Ventriloquist UI");
|
||||
PlayerControl pc = Utils.GetPlayerById(playerId);
|
||||
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
|
||||
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
var command = $"/target {playerId}";
|
||||
ChatCommands.TargetCommand(PlayerControl.LocalPlayer, command, command.Split(' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VentriloquistClick, SendOption.Reliable, AmongUsClient.Instance.HostId);
|
||||
writer.Write(playerId);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateVentriloquistButton(MeetingHud __instance)
|
||||
{
|
||||
foreach (PlayerVoteArea pva in __instance.playerStates.ToArray())
|
||||
{
|
||||
PlayerControl pc = Utils.GetPlayerById(pva.TargetPlayerId);
|
||||
if (pc == null || !pc.IsAlive()) continue;
|
||||
|
||||
GameObject template = pva.Buttons.transform.Find("CancelButton").gameObject;
|
||||
GameObject targetBox = Object.Instantiate(template, pva.transform);
|
||||
targetBox.name = "ShootButton";
|
||||
targetBox.transform.localPosition = new(-0.35f, 0.03f, -1.31f);
|
||||
var renderer = targetBox.GetComponent<SpriteRenderer>();
|
||||
renderer.sprite = Utils.LoadSprite("EHR.Resources.Images.Skills.Hack.png", 160f);
|
||||
var button = targetBox.GetComponent<PassiveButton>();
|
||||
button.OnClick.RemoveAllListeners();
|
||||
button.OnClick.AddListener((Action)(() => VentriloquisttOnClick(pva.TargetPlayerId)));
|
||||
}
|
||||
}
|
||||
|
||||
//[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
|
||||
public static class StartMeetingPatch
|
||||
{
|
||||
public static void Postfix(MeetingHud __instance)
|
||||
{
|
||||
if (PlayerControl.LocalPlayer.Is(CustomRoles.Ventriloquist) && PlayerControl.LocalPlayer.IsAlive())
|
||||
CreateVentriloquistButton(__instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class Pursuer : RoleBase
|
||||
clientList.Add(target.PlayerId);
|
||||
NotActiveList.Add(pc.PlayerId);
|
||||
pc.SetKillCooldown();
|
||||
pc.RPCPlayCustomSound("Bet");
|
||||
pc.RPCPlayCustomSound("Clothe");
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: target);
|
||||
}
|
||||
|
||||
@@ -121,4 +121,5 @@ public class Pursuer : RoleBase
|
||||
{
|
||||
hud.KillButton?.OverrideText(Translator.GetString("PursuerButtonText"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,8 @@ internal class QuizMaster : RoleBase
|
||||
SystemTypes.LifeSupp,
|
||||
SystemTypes.MushroomMixupSabotage,
|
||||
SystemTypes.Laboratory,
|
||||
SystemTypes.HeliSabotage
|
||||
SystemTypes.HeliSabotage,
|
||||
(SystemTypes)SubmergedCompatibility.SubmergedSystemTypes.Ballast
|
||||
];
|
||||
|
||||
public static ((string ColorString, PlayerControl Player) LastReportedPlayer, string LastPlayerPressedButtonName, SystemTypes LastSabotage, string LastReporterName, int NumPlayersVotedLastMeeting, string FirstReportedBodyPlayerName, int NumEmergencyMeetings, int NumPlayersDeadThisRound, int NumPlayersDeadFirstRound, int NumSabotages, int NumMeetings) Data = ((string.Empty, null), string.Empty, default(SystemTypes), string.Empty, 0, string.Empty, 0, 0, 0, 0, 0);
|
||||
@@ -179,6 +180,7 @@ internal class QuizMaster : RoleBase
|
||||
return killer.CheckDoubleTrigger(target, () =>
|
||||
{
|
||||
Target = target.PlayerId;
|
||||
killer.RPCPlayCustomSound("Clothe");
|
||||
killer.SetKillCooldown(MarkCooldown.GetFloat());
|
||||
});
|
||||
}
|
||||
@@ -300,6 +302,7 @@ internal class QuizMaster : RoleBase
|
||||
|
||||
if (CurrentQuestion.CorrectAnswerIndex == index)
|
||||
{
|
||||
RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskComplete);
|
||||
Utils.SendMessage(Translator.GetString("QuizMaster.AnswerCorrect"), Target, Translator.GetString("QuizMaster.Title"));
|
||||
Utils.SendMessage(string.Format(Translator.GetString("QuizMaster.AnswerCorrect.Self"), CurrentQuestion.Answers[CurrentQuestion.CorrectAnswerIndex]), QuizMasterId, Translator.GetString("QuizMaster.Title"));
|
||||
|
||||
@@ -312,8 +315,7 @@ internal class QuizMaster : RoleBase
|
||||
|
||||
if (pc.Is(CustomRoles.Pestilence)) return;
|
||||
Main.PlayerStates[Target].deathReason = PlayerState.DeathReason.WrongAnswer;
|
||||
Main.PlayerStates[Target].SetDead();
|
||||
if (pc != null) pc.RpcExileV2();
|
||||
pc?.RpcGuesserMurderPlayer();
|
||||
Utils.AfterPlayerDeathTasks(pc, true);
|
||||
|
||||
Logger.Info($"Player {name} was killed for answering incorrectly", "QuizMaster");
|
||||
@@ -334,4 +336,4 @@ internal class QuizMaster : RoleBase
|
||||
public readonly int CorrectAnswerIndex = correctAnswerIndex;
|
||||
public readonly string QuestionText = questionText;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,7 @@ public class Spider : RoleBase
|
||||
Vector2 pos = player.Pos();
|
||||
if (Webs.Keys.Any(x => Vector2.Distance(x, pos) <= WebTrapRange.GetFloat() * 2f)) return;
|
||||
Webs[pos] = [];
|
||||
player.RPCPlayCustomSound("Line");
|
||||
LocateArrow.Add(player.PlayerId, pos);
|
||||
player.Notify(Translator.GetString("MarkDone"));
|
||||
}
|
||||
@@ -132,6 +133,8 @@ public class Spider : RoleBase
|
||||
|
||||
if (Webs.FindFirst(x => Vector2.Distance(x.Key, pos) <= WebTrapRange.GetFloat() && x.Value.TryAdd(pc.PlayerId, Utils.TimeStamp + TrappedDuration.GetInt()), out KeyValuePair<Vector2, Dictionary<byte, long>> kvp))
|
||||
{
|
||||
RPC.PlaySoundRPC(SpiderId, Sounds.TaskUpdateSound);
|
||||
pc.RPCPlayCustomSound("FlashBang");
|
||||
pc.MarkDirtySettings();
|
||||
Utils.SendRPC(CustomRPC.SyncRoleData, SpiderId, 1, kvp.Key, pc.PlayerId, kvp.Value.Last().Value);
|
||||
}
|
||||
@@ -154,6 +157,7 @@ public class Spider : RoleBase
|
||||
{
|
||||
trapped.Keys.ToValidPlayers().Do(x =>
|
||||
{
|
||||
RPC.PlaySoundRPC(x.PlayerId, Sounds.TaskComplete);
|
||||
Main.AllPlayerSpeed[x.PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
x.MarkDirtySettings();
|
||||
});
|
||||
@@ -217,4 +221,4 @@ public class Spider : RoleBase
|
||||
if (seer.PlayerId != SpiderId || seer.PlayerId != target.PlayerId || (seer.IsModdedClient() && !hud) || meeting) return string.Empty;
|
||||
return string.Join('\n', Webs.Where(x => x.Value.Count > 0).Select(x => $"{LocateArrow.GetArrow(seer, x.Key)} {x.Value.Count} ({Math.Max(0, x.Value.Values.Min() - Utils.TimeStamp)}s)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user