|
5 | 5 | using AmongUs.GameOptions;
|
6 | 6 | using Hazel;
|
7 | 7 | using PowerTools;
|
| 8 | +using Sentry.Protocol; |
8 | 9 | using TheOtherRoles.Buttons;
|
9 | 10 | using TheOtherRoles.Objects;
|
10 | 11 | using TheOtherRoles.Utilities;
|
@@ -359,70 +360,80 @@ private static void WrapUpPostfix(GameData.PlayerInfo exiled)
|
359 | 360 | if (BountyHunter.bountyHunter != null && BountyHunter.bountyHunter == CachedPlayer.LocalPlayer.PlayerControl)
|
360 | 361 | BountyHunter.bountyUpdateTimer = 0f;
|
361 | 362 |
|
362 |
| - // Eraser erase |
363 |
| - if (Eraser.eraser != null && AmongUsClient.Instance.AmHost && Eraser.futureErased != null) |
| 363 | + if (AmongUsClient.Instance.AmHost) |
364 | 364 | {
|
365 |
| - var rasePlayerList = new List<PlayerControl>(Eraser.futureErased); |
366 |
| - foreach (var target in rasePlayerList) |
| 365 | + LastImpostor.promoteToLastImpostor(); |
| 366 | + |
| 367 | + // Eraser erase |
| 368 | + if (Eraser.eraser != null && Eraser.futureErased != null) |
367 | 369 | {
|
368 |
| - var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl.NetId, CustomRPC.ErasePlayerRoles); |
369 |
| - writer.Write(target.PlayerId); |
370 |
| - writer.EndRPC(); |
371 |
| - RPCProcedure.erasePlayerRoles(target.PlayerId); |
372 |
| - Eraser.alreadyErased.Add(target.PlayerId); |
| 370 | + var rasePlayerList = new List<PlayerControl>(Eraser.futureErased); |
| 371 | + foreach (var target in rasePlayerList) |
| 372 | + { |
| 373 | + var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl.NetId, CustomRPC.ErasePlayerRoles); |
| 374 | + writer.Write(target.PlayerId); |
| 375 | + writer.EndRPC(); |
| 376 | + RPCProcedure.erasePlayerRoles(target.PlayerId); |
| 377 | + Eraser.alreadyErased.Add(target.PlayerId); |
| 378 | + } |
373 | 379 | }
|
374 |
| - } |
375 |
| - Eraser.futureErased = new List<PlayerControl>(); |
376 |
| - |
377 |
| - // Shifter shift |
378 |
| - if (Shifter.shifter != null && AmongUsClient.Instance.AmHost && Shifter.futureShift != null) |
379 |
| - { |
380 |
| - var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.ShifterShift); |
381 |
| - writer.Write(Shifter.futureShift.PlayerId); |
382 |
| - writer.EndRPC(); |
383 |
| - RPCProcedure.shifterShift(Shifter.futureShift.PlayerId); |
384 |
| - } |
385 | 380 |
|
386 |
| - Shifter.futureShift = null; |
| 381 | + // Shifter shift |
| 382 | + if (Shifter.shifter != null && Shifter.futureShift != null) |
| 383 | + { |
| 384 | + var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.ShifterShift); |
| 385 | + writer.Write(Shifter.futureShift.PlayerId); |
| 386 | + writer.EndRPC(); |
| 387 | + RPCProcedure.shifterShift(Shifter.futureShift.PlayerId); |
| 388 | + } |
387 | 389 |
|
388 |
| - // Witch execute casted spells |
389 |
| - if (Witch.witch != null && Witch.futureSpelled != null && AmongUsClient.Instance.AmHost) |
390 |
| - { |
391 |
| - var partner = exiled?.Object?.getPartner(); |
| 390 | + // Witch execute casted spells |
| 391 | + if (Witch.witch != null && Witch.futureSpelled != null) |
| 392 | + { |
| 393 | + var partner = exiled?.Object?.getPartner(); |
392 | 394 |
|
393 |
| - var exiledIsWitch = exiled?.PlayerId == Witch.witch.PlayerId; |
394 |
| - var witchDiesWithExiledLover = partner?.PlayerId == Witch.witch.PlayerId || exiled?.PlayerId == Witch.witch.PlayerId; |
| 395 | + var exiledIsWitch = exiled?.PlayerId == Witch.witch.PlayerId; |
| 396 | + var witchDiesWithExiledLover = partner?.PlayerId == Witch.witch.PlayerId || exiled?.PlayerId == Witch.witch.PlayerId; |
395 | 397 |
|
396 |
| - if (((witchDiesWithExiledLover || exiledIsWitch) && Witch.witchVoteSavesTargets) || Witch.witchWasGuessed) |
397 |
| - Witch.futureSpelled = new List<PlayerControl>(); |
| 398 | + if (((witchDiesWithExiledLover || exiledIsWitch) && Witch.witchVoteSavesTargets) || Witch.witchWasGuessed) |
| 399 | + Witch.futureSpelled = new List<PlayerControl>(); |
398 | 400 |
|
399 |
| - foreach (var target in Witch.futureSpelled.Where(x => x.IsAlive())) |
400 |
| - { |
401 |
| - if (Lawyer.lawyer != null && target == Lawyer.target) |
| 401 | + foreach (var target in Witch.futureSpelled.Where(x => x.IsAlive())) |
402 | 402 | {
|
403 |
| - var writer2 = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.LawyerPromotesToPursuer); |
404 |
| - writer2.EndRPC(); |
405 |
| - Lawyer.PromotesToPursuer(); |
406 |
| - } |
| 403 | + if (Lawyer.lawyer != null && target == Lawyer.target) |
| 404 | + { |
| 405 | + var writer2 = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.LawyerPromotesToPursuer); |
| 406 | + writer2.EndRPC(); |
| 407 | + Lawyer.PromotesToPursuer(); |
| 408 | + } |
407 | 409 |
|
408 |
| - if (Executioner.executioner.IsAlive() && target == Executioner.target) |
409 |
| - { |
410 |
| - var writer2 = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.ExecutionerPromotesRole); |
411 |
| - writer2.EndRPC(); |
412 |
| - Executioner.PromotesRole(); |
413 |
| - } |
| 410 | + if (Executioner.executioner.IsAlive() && target == Executioner.target) |
| 411 | + { |
| 412 | + var writer2 = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.ExecutionerPromotesRole); |
| 413 | + writer2.EndRPC(); |
| 414 | + Executioner.PromotesRole(); |
| 415 | + } |
414 | 416 |
|
415 |
| - var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.UncheckedExilePlayer); |
416 |
| - writer.Write(target.PlayerId); |
417 |
| - writer.EndRPC(); |
418 |
| - RPCProcedure.uncheckedExilePlayer(target.PlayerId); |
| 417 | + var writer = StartRPC(CachedPlayer.LocalPlayer.PlayerControl, CustomRPC.UncheckedExilePlayer); |
| 418 | + writer.Write(target.PlayerId); |
| 419 | + writer.EndRPC(); |
| 420 | + RPCProcedure.uncheckedExilePlayer(target.PlayerId); |
419 | 421 |
|
420 |
| - GameHistory.RpcOverrideDeathReasonAndKiller(target, CustomDeathReason.WitchExile, Witch.witch); |
| 422 | + GameHistory.RpcOverrideDeathReasonAndKiller(target, CustomDeathReason.WitchExile, Witch.witch); |
| 423 | + } |
421 | 424 | }
|
422 | 425 | }
|
423 | 426 |
|
| 427 | + Eraser.futureErased = new List<PlayerControl>(); |
| 428 | + Shifter.futureShift = null; |
424 | 429 | Witch.futureSpelled = new List<PlayerControl>();
|
425 | 430 |
|
| 431 | + if (Specter.Player != null && Specter.Player?.Data?.IsDead == true && Specter.revive) |
| 432 | + { |
| 433 | + Specter.Player.Revive(); |
| 434 | + Specter.revive = false; |
| 435 | + } |
| 436 | + |
426 | 437 | // Medium spawn souls
|
427 | 438 | if (Medium.medium != null && CachedPlayer.LocalPlayer.PlayerControl == Medium.medium)
|
428 | 439 | {
|
@@ -451,11 +462,6 @@ private static void WrapUpPostfix(GameData.PlayerInfo exiled)
|
451 | 462 | }
|
452 | 463 | }
|
453 | 464 |
|
454 |
| - // AntiTeleport set position |
455 |
| - AntiTeleport.setPosition(); |
456 |
| - |
457 |
| - if (CustomOptionHolder.randomGameStartPosition.GetBool()) MapData.RandomSpawnPlayers(); |
458 |
| - |
459 | 465 | if (InfoSleuth.infoSleuth != null && InfoSleuth.target != null && InfoSleuth.infoSleuth == PlayerControl.LocalPlayer)
|
460 | 466 | {
|
461 | 467 | var isNotCrew = (isNeutral(InfoSleuth.target) || InfoSleuth.target.isImpostor()) ^ Vortox.Reversal;
|
@@ -507,10 +513,11 @@ static string getTeam(PlayerControl player)
|
507 | 513 |
|
508 | 514 | if (!Yoyo.markStaysOverMeeting) Silhouette.clearSilhouettes();
|
509 | 515 |
|
510 |
| - if (AmongUsClient.Instance.AmHost) |
511 |
| - { |
512 |
| - LastImpostor.promoteToLastImpostor(); |
513 |
| - } |
| 516 | + // AntiTeleport set position |
| 517 | + AntiTeleport.setPosition(); |
| 518 | + |
| 519 | + if (CustomOptionHolder.randomGameStartPosition.GetBool()) MapData.RandomSpawnPlayers(); |
| 520 | + |
514 | 521 | }
|
515 | 522 |
|
516 | 523 | [HarmonyPatch(typeof(ExileController), nameof(ExileController.WrapUp))]
|
|
0 commit comments