Exemple #1
0
        public static void BeginImpostor(IntroCutscene introCutscene)
        {
            introCutscene.ImpostorText.gameObject.SetActive(false);
            introCutscene.Title.Text =
                DestroyableSingleton <TranslationController> .Instance.GetString(StringNames.Impostor,
                                                                                 (Il2CppReferenceArray <Object>) Array.Empty <object>());

            introCutscene.Title.Color = Palette.ImpostorRed;

            GameData.PlayerInfo data = PlayerControl.LocalPlayer.Data;
            if (data != null)
            {
                int            num            = -1;
                int            num2           = 1 / 2;
                float          num3           = 1f - (float)num2 * 0.075f;
                float          num4           = 1f - (float)num2 * 0.035f;
                float          num5           = -8;
                PoolablePlayer poolablePlayer =
                    UnityEngine.Object.Instantiate <PoolablePlayer>(introCutscene.PlayerPrefab, introCutscene.transform);
                poolablePlayer.transform.localPosition = new Vector3((float)(num * num2) * num4,
                                                                     introCutscene.BaseY + (float)num2 * 0.15f, num5 + (float)num2 * 0.01f) * 1.5f;
                Vector3 vector = new Vector3(num3, num3, num3) * 1.5f;
                poolablePlayer.transform.localScale = vector;
                poolablePlayer.SetFlipX(false);
                PlayerControl.SetPlayerMaterialColors((int)data.ColorId, poolablePlayer.Body);
                //DestroyableSingleton<HatManager>.Instance.SetSkin(poolablePlayer.SkinSlot, data.SkinId);
                poolablePlayer.HatSlot.SetHat(data.HatId, (int)data.ColorId);
                PlayerControl.SetPetImage(data.PetId, (int)data.ColorId, poolablePlayer.PetSlot);
                TextRenderer nameText = poolablePlayer.NameText;
                nameText.Text = data.PlayerName;
                nameText.transform.localScale = vector.Inv();
            }
        }
Exemple #2
0
        public static void Prefix(IntroCutscene __instance)
        {
            // Arsonist generate player icons
            if (PlayerControl.LocalPlayer != null && PlayerControl.LocalPlayer == Arsonist.arsonist && HudManager.Instance != null)
            {
                int     playerCounter = 0;
                Vector3 bottomLeft    = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                bottomLeft += new Vector3(-0.25f, -0.25f, 0);
                foreach (PlayerControl player in PlayerControl.AllPlayerControls)
                {
                    if (player != PlayerControl.LocalPlayer)
                    {
                        GameData.PlayerInfo data           = player.Data;
                        PoolablePlayer      poolablePlayer = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
                        poolablePlayer.transform.localPosition = bottomLeft + Vector3.right * playerCounter * 0.35f;
                        poolablePlayer.transform.localScale    = Vector3.one * 0.3f;
                        PlayerControl.SetPlayerMaterialColors(data.ColorId, poolablePlayer.Body);
                        DestroyableSingleton <HatManager> .Instance.SetSkin(poolablePlayer.SkinSlot, data.SkinId);

                        poolablePlayer.HatSlot.SetHat(data.HatId, data.ColorId);
                        PlayerControl.SetPetImage(data.PetId, data.ColorId, poolablePlayer.PetSlot);
                        poolablePlayer.NameText.text = data.PlayerName;
                        poolablePlayer.SetFlipX(true);
                        poolablePlayer.setSemiTransparent(true);
                        Arsonist.dousedIcons[player.PlayerId] = poolablePlayer;
                        playerCounter++;
                    }
                }
            }
        }
Exemple #3
0
        protected override void IntroPrefix(IntroCutscene __instance, ref Il2CppSystem.Collections.Generic.List <PlayerControl> yourTeam)
        {
            var glitchTeam = new Il2CppSystem.Collections.Generic.List <PlayerControl>();

            glitchTeam.Add(PlayerControl.LocalPlayer);
            yourTeam = glitchTeam;
        }
Exemple #4
0
            private static IEnumerator setupRole(IntroCutscene __instance)
            {
                List <RoleInfo> infos    = RoleInfo.getRoleInfoForPlayer(PlayerControl.LocalPlayer, new RoleType[] { RoleType.Lovers });
                RoleInfo        roleInfo = infos.FirstOrDefault();

                if (roleInfo == RoleInfo.fortuneTeller && FortuneTeller.numTasks > 0)
                {
                    roleInfo = RoleInfo.crewmate;
                }

                Logger.info("----------Role Assign-----------", "Settings");
                foreach (var pc in PlayerControl.AllPlayerControls)
                {
                    Logger.info(String.Format("{0,-3}{1,-2}:{2,-16}:{3}", pc.AmOwner ? "[*]" : "", pc.PlayerId, pc.Data.PlayerName, RoleInfo.GetRolesString(pc, false, joinSeparator: " + ")), "Settings");
                }
                Logger.info("-----------Platforms------------", "Settings");
                foreach (var pc in PlayerControl.AllPlayerControls)
                {
                    Logger.info(String.Format("{0,-3}{1,-2}:{2,-16}:{3}", pc.AmOwner ? "[*]" : "", pc.PlayerId, pc.Data.PlayerName, pc.getPlatform().Replace("Standalone", "")), "Settings");
                }
                Logger.info("---------Game Settings----------", "Settings");
                TheOtherRolesPlugin.optionsPage = 0;
                var tmp = PlayerControl.GameOptions.ToHudString(GameData.Instance ? GameData.Instance.PlayerCount : 10).Split("\r\n");

                foreach (var t in tmp[1..(tmp.Length - 2)])
Exemple #5
0
 static void Postfix(IntroCutscene __instance)
 {
     if (TryGetSpecialRole(PlayerControl.LocalPlayer.PlayerId, out Role _))
     {
         __instance.ImpostorText.gameObject.SetActive(true);
     }
 }
Exemple #6
0
 public static bool Prefix(IntroCutscene __instance, ref Il2CppSystem.Collections.IEnumerator __result)
 {
     if (!CustomOptionHolder.activateRoles.getBool())
     {
         return(true);                                             // Don't override the intro of the vanilla roles
     }
     __result = setupRole(__instance).WrapToIl2Cpp();
     return(false);
 }
Exemple #7
0
 public static void Prefix(IntroCutscene __instance)
 {
     HudManager.Instance.StartCoroutine(Effects.Lerp(16.2f, new Action <float>((p) =>
     {
         if (p == 1f)
         {
             meetingFlag = false;
         }
     })));
 }
Exemple #8
0
 public static void Postfix(IntroCutscene __instance)
 {
     if (customRoles.ContainsKey(PlayerControl.LocalPlayer.PlayerId))
     {
         var role = customRoles[PlayerControl.LocalPlayer.PlayerId];
         __instance.BackgroundBar.material.SetColor("_Color", role[0].Colour);
         __instance.Title.Text        = role[0].Name;
         __instance.Title.Color       = role[0].Colour;
         __instance.ImpostorText.Text = role[0].ImpostorText;
     }
 }
Exemple #9
0
        static void Postfix(IntroCutscene __instance)
        {
            var glitch = Role.AllRoles.FirstOrDefault(x => x.RoleType == RoleEnum.Glitch);

            if (glitch != null)
            {
                ((Glitch)glitch).LastMimic = DateTime.UtcNow;
                ((Glitch)glitch).LastHack  = DateTime.UtcNow;
                ((Glitch)glitch).LastKill  = DateTime.UtcNow.AddSeconds(CustomGameOptions.InitialGlitchKillCooldown + (CustomGameOptions.GlitchKillCooldown * -1));
            }
        }
            public static void Postfix(IntroCutscene __instance)
            {
                byte sheriffID = SheriffRole.sheriffID;

                if (sheriffID == PlayerControl.LocalPlayer.Data.PlayerId)
                {
                    __instance.Title.text                         = SheriffRole.name;
                    __instance.Title.color                        = SheriffRole.roleColor;
                    __instance.ImpostorText.text                  = "Kill the Imposter, but be smart about who you kill";
                    __instance.BackgroundBar.material.color       = SheriffRole.roleColor;
                    Utils.GetPlayerById(sheriffID).nameText.color = SheriffRole.roleColor;
                }
            }
Exemple #11
0
        public IntroCutsceneStartProtocol(IntroCutscene cutscene, IntroMovieSet set) : base(cutscene, set)
        {
            this.ExteriorShipView  = set.ExteriorShipView;
            this.InteriorShipView  = set.InteriorShipView;
            this.ExteriorDeckWidth = set.ExteriorDeckWidth;
            this.ExteriorDeckX     = set.ExteriorDeckX;
            this.ExteriorDeckY     = set.ExteriorDeckY;

            this.ExteriorCrewNPCs = set.ExteriorCrewNPCs.ToArray();

            this.DungeonX = Main.dungeonX;
            this.DungeonY = Main.dungeonY;
        }
Exemple #12
0
            public static bool Prefix(ref IntroCutscene __instance)
            {
                BaseRole?myRole = PlayerControl.LocalPlayer.GetRole();

                if (myRole == null || myRole.PatchFilterFlags.HasFlag(PatchFilter.IntroCutScene))
                {
                    return(true);
                }

                PlayerControl.LocalPlayer.SetKillTimer(10f);
                HudManager.Instance.KillButton.gameObject.SetActive(myRole.CanKill(null));

                List <PlayerControl> myTeam = PlayerControl.AllPlayerControls.ToArray()
                                              .Where(p => PlayerControl.LocalPlayer.CanSeeSpecial(p))
                                              .OrderBy(p => !p.AmOwner)
                                              .ToList();

                __instance.Title.text  = myRole.Name;
                __instance.Title.color = myRole.Color;
                __instance.BackgroundBar.material.SetColor(Color, myRole.Color);
                __instance.ImpostorText.text = myRole.Description;

                for (var i = 0; i < myTeam.Count; i++)
                {
                    GameData.PlayerInfo data = myTeam[i].Data;
                    int            oddness   = (i + 1) / 2;
                    PoolablePlayer player    = Object.Instantiate(__instance.PlayerPrefab, __instance.transform);
                    player.transform.localPosition = new Vector3(
                        0.8f * oddness * (i % 2 == 0 ? -1 : 1) * (1 - oddness * 0.08f),
                        __instance.BaseY + oddness * 0.15f,
                        (i == 0 ? -8 : -1) + oddness * 0.01f
                        ) * 1.5f;
                    player.SetFlipX(i % 2 == 0);
                    PlayerControl.SetPlayerMaterialColors(data.ColorId, player.Body);
                    DestroyableSingleton <HatManager> .Instance.SetSkin(player.SkinSlot, data.SkinId); // SetSkin

                    player.HatSlot.SetHat(data.HatId, data.ColorId);
                    PlayerControl.SetPetImage(data.PetId, data.ColorId, player.PetSlot);
                    float   scale    = 1f - oddness * 0.075f;
                    Vector3 scaleVec = new Vector3(scale, scale, scale) * 1.5f;
                    player.transform.localScale          = scaleVec;
                    player.NameText.transform.localScale = global::Extensions.Inv(scaleVec);
                    player.NameText.text = myRole.FormatName(data);
                    if (i > 0 && myRole.Visibility != Visibility.Everyone)
                    {
                        player.NameText.gameObject.SetActive(true);
                    }
                }

                return(false);
            }
Exemple #13
0
 public static void Postfix(IntroCutscene __instance)
 {
     if (CustomRoles.ContainsKey(PlayerControl.LocalPlayer.PlayerId))
     {
         var role = CustomRoles[PlayerControl.LocalPlayer.PlayerId];
         if (role)
         {
             __instance.ImpostorText.Text = JesterRole.ImpostorText;
             __instance.Title.Text        = JesterRole.Name;
             __instance.Title.Color       = JesterRole.Color;
             __instance.BackgroundBar.material.SetColor(Color, JesterRole.Color);
         }
     }
 }
Exemple #14
0
        public static void setupIntroTeam(IntroCutscene __instance, ref Il2CppSystem.Collections.Generic.List <PlayerControl> yourTeam)
        {
            List <RoleInfo> infos    = RoleInfo.getRoleInfoForPlayer(PlayerControl.LocalPlayer);
            RoleInfo        roleInfo = infos.Where(info => info.roleType != RoleType.Lovers).FirstOrDefault();

            if (roleInfo == null)
            {
                return;
            }
            if (PlayerControl.LocalPlayer.isNeutral() || PlayerControl.LocalPlayer.isGM())
            {
                __instance.BackgroundBar.material.color = roleInfo.color;
                __instance.TeamTitle.text    = roleInfo.name;
                __instance.TeamTitle.color   = roleInfo.color;
                __instance.ImpostorText.text = "";
            }
        }
 public static void Prefix(IntroCutscene __instance)
 {
     if (PlayerControl.LocalPlayer != null && HudManager.Instance != null)
     {
         Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
         foreach (PlayerControl p in PlayerControl.AllPlayerControls)
         {
             GameData.PlayerInfo data   = p.Data;
             PoolablePlayer      player = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
             player.UpdateFromPlayerOutfit(p.Data.DefaultOutfit, p.Data.IsDead);
             player.SetFlipX(true);
             player.PetSlot.gameObject.SetActive(false);
             player.NameText.text = p.Data.DefaultOutfit.PlayerName;
             player.gameObject.SetActive(false);
             playerIcons[p.PlayerId] = player;
         }
     }
 }
Exemple #16
0
        public static void setupIntroTeamIcons(IntroCutscene __instance, ref Il2CppSystem.Collections.Generic.List <PlayerControl> yourTeam)
        {
            // Intro solo teams
            if (PlayerControl.LocalPlayer.isNeutral() || PlayerControl.LocalPlayer == GM.gm)
            {
                var soloTeam = new Il2CppSystem.Collections.Generic.List <PlayerControl>();
                soloTeam.Add(PlayerControl.LocalPlayer);
                yourTeam = soloTeam;
            }

            // Don't show the GM
            if (!PlayerControl.LocalPlayer.isGM())
            {
                var newTeam = new Il2CppSystem.Collections.Generic.List <PlayerControl>();
                foreach (PlayerControl p in yourTeam)
                {
                    if (p != GM.gm)
                    {
                        newTeam.Add(p);
                    }
                }
                yourTeam = newTeam;
            }

            // Add the Spy to the Impostor team (for the Impostors)
            if (Spy.spy != null && PlayerControl.LocalPlayer.Data.Role.IsImpostor)
            {
                List <PlayerControl> players = PlayerControl.AllPlayerControls.ToArray().ToList().OrderBy(x => Guid.NewGuid()).ToList();
                var fakeImpostorTeam         = new Il2CppSystem.Collections.Generic.List <PlayerControl>(); // The local player always has to be the first one in the list (to be displayed in the center)
                fakeImpostorTeam.Add(PlayerControl.LocalPlayer);
                foreach (PlayerControl p in players)
                {
                    if (PlayerControl.LocalPlayer != p && (p == Spy.spy || p.Data.Role.IsImpostor))
                    {
                        fakeImpostorTeam.Add(p);
                    }
                }
                yourTeam = fakeImpostorTeam;
            }
        }
Exemple #17
0
        public static void Prefix(IntroCutscene __instance)
        {
            // Generate and initialize player icons
            if (PlayerControl.LocalPlayer != null && HudManager.Instance != null)
            {
                Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
                foreach (PlayerControl p in PlayerControl.AllPlayerControls)
                {
                    GameData.PlayerInfo data   = p.Data;
                    PoolablePlayer      player = UnityEngine.Object.Instantiate <PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
                    player.UpdateFromPlayerOutfit(p.Data.DefaultOutfit, p.Data.IsDead);
                    player.SetFlipX(true);
                    player.PetSlot.gameObject.SetActive(false);
                    player.NameText.text = p.Data.DefaultOutfit.PlayerName;
                    MapOptions.playerIcons[p.PlayerId] = player;

                    if (PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
                    {
                        player.transform.localPosition = bottomLeft + new Vector3(-0.25f, 0f, 0);
                        player.transform.localScale    = Vector3.one * 0.4f;
                        player.gameObject.SetActive(false);
                    }
                    else if (PlayerControl.LocalPlayer == GM.gm)
                    {
                        player.transform.localPosition = Vector3.zero;
                        player.transform.localScale    = Vector3.one * 0.3f;
                        player.setSemiTransparent(false);
                        player.gameObject.SetActive(false);
                    }
                    else
                    {
                        player.gameObject.SetActive(false);
                    }
                }
            }

            // Force Bounty Hunter to load a new Bounty when the Intro is over
            if (BountyHunter.bounty != null && PlayerControl.LocalPlayer == BountyHunter.bountyHunter)
            {
                BountyHunter.bountyUpdateTimer = 0f;
                if (HudManager.Instance != null)
                {
                    Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z) + new Vector3(-0.25f, 1f, 0);
                    BountyHunter.cooldownText           = UnityEngine.Object.Instantiate <TMPro.TextMeshPro>(HudManager.Instance.KillButton.cooldownTimerText, HudManager.Instance.transform);
                    BountyHunter.cooldownText.alignment = TMPro.TextAlignmentOptions.Center;
                    BountyHunter.cooldownText.transform.localPosition = bottomLeft + new Vector3(0f, -1f, -1f);
                    BountyHunter.cooldownText.gameObject.SetActive(true);
                }
            }

            Arsonist.updateIcons();
            Morphling.resetMorph();
            Camouflager.resetCamouflage();

            if (PlayerControl.LocalPlayer == GM.gm && !GM.hasTasks)
            {
                PlayerControl.LocalPlayer.clearAllTasks();
            }

            if (PlayerControl.LocalPlayer.isGM())
            {
                HudManager.Instance.ShadowQuad.gameObject.SetActive(false);
                HudManager.Instance.ReportButton.gameObject.SetActiveRecursively(false);
                HudManager.Instance.ReportButton.SetActive(false);
                HudManager.Instance.ReportButton.graphic.enabled         = false;
                HudManager.Instance.ReportButton.enabled                 = false;
                HudManager.Instance.ReportButton.graphic.sprite          = null;
                HudManager.Instance.ReportButton.buttonLabelText.enabled = false;
                HudManager.Instance.ReportButton.buttonLabelText.SetText("");

                HudManager.Instance.roomTracker.gameObject.SetActiveRecursively(false);
                HudManager.Instance.roomTracker.text.enabled = false;
                HudManager.Instance.roomTracker.text.SetText("");
                HudManager.Instance.roomTracker.enabled = false;
            }

            // ベントを追加する
            AdditionalVents.AddAdditionalVents();

            // スペシメンにバイタルを移動する
            SpecimenVital.moveVital();

            //タスクバグ修正
            if (PlayerControl.GameOptions.MapId == 4 && CustomOptionHolder.airshipEnableWallCheck.getBool())
            {
                var objects = UnityEngine.GameObject.FindObjectsOfType <Console>().ToList();
                objects.Find(x => x.name == "task_garbage1").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage2").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage3").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage4").checkWalls      = true;
                objects.Find(x => x.name == "task_garbage5").checkWalls      = true;
                objects.Find(x => x.name == "task_shower").checkWalls        = true;
                objects.Find(x => x.name == "task_developphotos").checkWalls = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.Armory).checkWalls   = true;
                objects.Find(x => x.name == "DivertRecieve" && x.Room == SystemTypes.MainHall).checkWalls = true;
            }

            // 最初から一人の場合はLast Impostorになる
            if (AmongUsClient.Instance.AmHost)
            {
                LastImpostor.promoteToLastImpostor();
            }

            // タスクパネルの表示優先度を上げる
            var taskPanel = DestroyableSingleton <HudManager> ._instance.TaskStuff;
            var pos       = taskPanel.transform.position;

            taskPanel.transform.position = new Vector3(pos.x, pos.y, -20);

            // ダミー人形をスポーンさせておく
            if (PlayerControl.LocalPlayer.isRole(RoleType.Puppeteer) && SubmergedCompatibility.isSubmerged())
            {
                var           playerId = (byte)GameData.Instance.GetAvailableId();
                MessageWriter writer   = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SpawnDummy, Hazel.SendOption.Reliable, -1);
                writer.Write(playerId);
                writer.Write(PlayerControl.LocalPlayer.transform.position.x);
                writer.Write(PlayerControl.LocalPlayer.transform.position.y);
                writer.Write(PlayerControl.LocalPlayer.transform.position.z);
                AmongUsClient.Instance.FinishRpcImmediately(writer);
                RPCProcedure.spawnDummy(playerId, PlayerControl.LocalPlayer.transform.position);
            }
        }
Exemple #18
0
 private static void Postfix(IntroCutscene __instance)
 {
     Assassin.AssassinState = new Assassin();
 }
 public IntroCutsceneUpdateProtocol(IntroCutscene cutscene, IntroMovieSet set) : base(cutscene, set)
 {
     this.InteriorCrewNPC = set.InteriorCrewNPC;
     this.ShipPropNPC     = set.ShipPropNPC;
 }