Пример #1
0
 public void Update()
 {
     if (PlayerControl.AllPlayerControls.Count > 1)
     {
         HudManagerPatch.MorphButton.Visible = true;
         if (!isAlive())
         {
             HudManagerPatch.MorphButton.Clickable = false;
         }
         else
         {
             if (playerControl.POECPOEKKNO)
             {
                 if (lastPlayerContact != null && !HudManagerPatch.MorphButton.IsEffectActive)
                 {
                     MorphInfo target = new MorphInfo(lastPlayerContact);
                     HudManagerPatch.MorphButton.SetTarget(target);
                     lastPlayerContact = null;
                 }
                 if (Input.GetKeyDown(KeyCode.F))
                 {
                     HudManagerPatch.MorphButton.PerformMorph();
                 }
             }
         }
     }
 }
Пример #2
0
 public void Update()
 {
     if (PlayerControl.AllPlayerControls.Count > 1)
     {
         if (PlayerId == PlayerControl.LocalPlayer.PlayerId)
         {
             HudManagerPatch.MorphButton.Visible = true;
             if (!isAlive())
             {
                 HudManagerPatch.MorphButton.Clickable = false;
             }
             else
             {
                 if (playerControl.MPEOHLJNPOB)
                 {
                     if (lastPlayerContact != null && !HudManagerPatch.MorphButton.IsEffectActive)
                     {
                         MorphInfo target = new MorphInfo(lastPlayerContact);
                         HudManagerPatch.MorphButton.SetTarget(target, OrignalInfo);
                         lastPlayerContact = null;
                     }
                     if (Input.GetKeyDownInt(KeyCode.F))
                     {
                         HudManagerPatch.MorphButton.PerformMorph();
                     }
                 }
             }
         }
     }
 }
Пример #3
0
        public Metamorph(PlayerControl pc)
        {
            this.playerControl = pc;
            this.PlayerId      = pc.PlayerId;

            this.OrignalInfo = new MorphInfo(pc);
        }
Пример #4
0
 public void SetTarget(MorphInfo target, MorphInfo original)
 {
     if (!IsEffectActive && !IsCoolingDown)
     {
         this.morphTarget   = target;
         this.morphOriginal = original;
     }
 }
Пример #5
0
 public void SetTarget(MorphInfo target)
 {
     if (!IsEffectActive && !IsCoolingDown)
     {
         this.morphTarget = target;
         killButtonManager.renderer.sprite = sprites[morphTarget.Value.ColorId];
     }
 }
Пример #6
0
        public Metamorph(PlayerControl pc)
        {
            this.playerControl = pc;
            this.PlayerId      = pc.PlayerId;

            // Save original apperance

            /*PlayerInfo playerInfo = playerControl.PKMHEDAKKHE;
            *  this.originalName = playerControl.name;
            *  this.originalColorId = playerInfo.ACBLKMFEPKC;
            *  this.originalSkinId = playerInfo.FHNDEEGICJP;
            *  this.originalHatId = playerInfo.KCILOGLJODF;
            *  this.originalPetId = playerInfo.HIJJGKGBKOJ; // ??*/
            this.OrignalInfo = new MorphInfo(pc);
        }
Пример #7
0
        public void RpcMorphTo(MorphInfo target)
        {
            Metamorphosis.Logger.LogDebug($"Rpc Morp to");
            MessageWriter writer = AmongUsClient.Instance.StartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetMorph, Hazel.SendOption.Reliable);

            writer.Write(PlayerControl.LocalPlayer.PlayerId);
            writer.Write(target.Name);
            writer.Write(target.ColorId);
            writer.Write(target.SkinId);
            writer.Write(target.HatId);
            writer.Write(target.PetId);
            writer.EndMessage();

            MorphTo(target, false);
        }
Пример #8
0
 public static void Prefix(PlayerInfo EKCPHFOGJPA)
 {
     if (PlayerControlPatch.Metamorphs != null)
     {
         foreach (Metamorph metamorph in PlayerControlPatch.Metamorphs)
         {
             if (metamorph.PlayerId == EKCPHFOGJPA.FMAAJCIEMEH)
             {
                 MorphInfo original = metamorph.OrignalInfo;
                 EKCPHFOGJPA.LNFMCJAPLBH = original.Name;
                 EKCPHFOGJPA.ACBLKMFEPKC = original.ColorId;
                 EKCPHFOGJPA.FHNDEEGICJP = original.SkinId;
                 EKCPHFOGJPA.KCILOGLJODF = original.HatId;
                 EKCPHFOGJPA.HIJJGKGBKOJ = original.PetId;
             }
         }
     }
 }
Пример #9
0
        private void MorphTo(MorphInfo target)
        {
            PlayerControl.LocalPlayer.RpcSetName(target.Name);
            //SetOriginalName();
            PlayerControl.LocalPlayer.RpcSetColor(target.ColorId);
            PlayerControl.LocalPlayer.RpcSetSkin(target.SkinId);
            PlayerControl.LocalPlayer.RpcSetHat(target.HatId);
            PlayerControl.LocalPlayer.RpcSetPet(target.PetId);

            // Send messages ???
            //SendMorphMessage(name, colorId, skinId, hatId, petId);

            Metamorphosis.Logger.LogDebug(
                $@"Morph from {PlayerControl.LocalPlayer.PlayerId} 
                into {target.PlayerId}: 
                name: {target.Name}, 
                color: {target.ColorId}, 
                skin: {target.SkinId}, 
                hat: {target.HatId}, 
                pet: {target.PetId}");
        }
Пример #10
0
        public static void Postfix(byte ACCJCEHMKLN, MessageReader HFPCBBHJIPJ)
        {
            switch (ACCJCEHMKLN)
            {
            case (byte)CustomRPC.SetMetamorphs:
            {
                InitMetamorphs();

                byte[] infections = HFPCBBHJIPJ.ReadBytesAndSize();
                Metamorphosis.Logger.LogMessage(String.Format($"HandleRpc SetMetamorphs Length: {infections.Length}"));
                foreach (byte infectedId in infections)
                {
                    PlayerControl infectedControl = GetPlayerControlById(infectedId);
                    if (infectedControl != null)
                    {
                        Metamorph metamorph = new Metamorph(infectedControl);
                        Metamorphs.Add(metamorph);
                        Metamorphosis.Logger.LogDebug(String.Format($"HandleRpc SetMetamorphs Add Metamorph: {metamorph.PlayerId}"));
                        if (metamorph.PlayerId == PlayerControl.LocalPlayer.PlayerId)
                        {
                            Metamorphosis.Logger.LogDebug(String.Format($"HandleRpc SetMetamorphs is local player {metamorph.PlayerId}"));
                            Metamorph.LocalMetamorph = metamorph;
                            if (HudManagerPatch.MorphButton != null)
                            {
                                HudManagerPatch.MorphButton.StartCooldown(CustomGameOptions.MorphCooldown + 9.0f);
                                HudManagerPatch.MorphButton.EffectDuration   = CustomGameOptions.MorphDuration;
                                HudManagerPatch.MorphButton.CooldownDuration = CustomGameOptions.MorphCooldown;
                            }
                        }
                    }
                }

                break;
            }

            case (byte)CustomRPC.SetMorph:
            {
                Metamorphosis.Logger.LogDebug("HandleRpc SetMorph");

                byte   playerId = HFPCBBHJIPJ.ReadByte();
                string name     = HFPCBBHJIPJ.ReadString();
                byte   colorId  = HFPCBBHJIPJ.ReadByte();
                uint   skinId   = HFPCBBHJIPJ.ReadUInt32();
                uint   hatId    = HFPCBBHJIPJ.ReadUInt32();
                uint   petId    = HFPCBBHJIPJ.ReadUInt32();

                MorphInfo target = new MorphInfo(playerId, name, colorId, skinId, hatId, petId);

                Metamorph metamorph;
                if (IsMetamorph(playerId, out metamorph))
                {
                    bool updateName = !IsMetamorph(PlayerControl.LocalPlayer.PlayerId);
                    metamorph.MorphTo(target, updateName);
                }
                else
                {
                    Metamorphosis.Logger.LogError("HandleRpc SetMorph: Player is not a Metamorph");
                }
                break;
            }

            case (byte)RPC.StartMeeting:
            {
                Metamorphosis.Logger.LogDebug("HandleRpc StartMeeting");
                if (PlayerControlPatch.Metamorphs != null)
                {
                    foreach (Metamorph metamorph in PlayerControlPatch.Metamorphs)
                    {
                        metamorph.MorphBack();
                    }
                }
                break;
            }

            case (byte)CustomRPC.SyncCustomSettings:
            {
                CustomGameOptions.MorphDuration = System.BitConverter.ToSingle(HFPCBBHJIPJ.ReadBytes(4), 0);
                CustomGameOptions.MorphCooldown = System.BitConverter.ToSingle(HFPCBBHJIPJ.ReadBytes(4), 0);
                break;
            }
            }
        }
Пример #11
0
        public void MorphTo(MorphInfo target, bool updateName = true)
        {
            Metamorphosis.Logger.LogDebug(
                $@"Morph from {PlayerControl.LocalPlayer.PlayerId} 
                into {target.PlayerId}: 
                name: {target.Name}, 
                color: {target.ColorId}, 
                skin: {target.SkinId}, 
                hat: {target.HatId}, 
                pet: {target.PetId}");

            if (updateName)
            {
                playerControl.nameText.text = target.Name;
            }
            playerControl.KJAENOGGEOK.material.SetColor("_BackColor", Palette.ShadowColors[target.ColorId]);
            playerControl.KJAENOGGEOK.material.SetColor("_BodyColor", Palette.PlayerColors[target.ColorId]);
            playerControl.HatRenderer.SetHat(target.HatId, target.ColorId);
            playerControl.nameText.transform.localPosition = new Vector3(0f, (target.HatId == 0U) ? 0.7f : 1.05f, -0.5f);

            PlayerPhysics playerPhysics = playerControl.MyPhysics;

            if (playerControl.MyPhysics.Skin.skin.ProdId != DestroyableSingleton <HatManager> .MGCNALHEEBA.AllSkins[(int)target.SkinId].ProdId)
            {
                SkinData      nextSkin   = DestroyableSingleton <HatManager> .MGCNALHEEBA.AllSkins[(int)target.SkinId];
                AnimationClip clip       = null;
                var           spriteAnim = playerPhysics.Skin.animator;
                var           anim       = spriteAnim.m_animator;
                var           skinLayer  = playerPhysics.Skin;

                AnimationClip currentPhysicsAnim = playerPhysics.NIKGMJIKBMP.GetCurrentAnimation();
                if (currentPhysicsAnim == playerPhysics.RunAnim)
                {
                    clip = nextSkin.RunAnim;
                }
                else if (currentPhysicsAnim == playerPhysics.SpawnAnim)
                {
                    clip = nextSkin.SpawnAnim;
                }
                else if (currentPhysicsAnim == playerPhysics.EnterVentAnim)
                {
                    clip = nextSkin.EnterVentAnim;
                }
                else if (currentPhysicsAnim == playerPhysics.ExitVentAnim)
                {
                    clip = nextSkin.ExitVentAnim;
                }
                else if (currentPhysicsAnim == playerPhysics.IdleAnim)
                {
                    clip = nextSkin.IdleAnim;
                }
                else
                {
                    clip = nextSkin.IdleAnim;
                }

                float progress = playerPhysics.NIKGMJIKBMP.m_animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
                skinLayer.skin = nextSkin;

                spriteAnim.Play(clip, 1f);
                anim.Play("a", 0, progress % 1);
                anim.Update(0f);
            }

            if (playerControl.CurrentPet == null || playerControl.CurrentPet.ProductId != HatManager.MGCNALHEEBA.AllPets[(int)target.PetId].ProductId)
            {
                if (playerControl.CurrentPet)
                {
                    Object.Destroy(playerControl.CurrentPet.gameObject);
                }

                playerControl.CurrentPet = Object.Instantiate <PetBehaviour>(HatManager.MGCNALHEEBA.AllPets[(int)target.PetId]);
                playerControl.CurrentPet.transform.position = playerControl.transform.position;
                playerControl.CurrentPet.Source             = playerControl;
                playerControl.CurrentPet.BDBDGFDELMB        = playerControl.BDBDGFDELMB;
                PlayerControl.SetPlayerMaterialColors(target.ColorId, playerControl.CurrentPet.rend);
            }
            else if (playerControl.CurrentPet)
            {
                PlayerControl.SetPlayerMaterialColors(target.ColorId, playerControl.CurrentPet.rend);
            }
        }