예제 #1
0
 private static void skinsActivated()
 {
     // Only change pet settings, when mod is active
     if (ModActive.GetValue())
     {
         AlternativeRpcSender.RpcSetSkin(SaveManager.LastSkin);
     }
 }
예제 #2
0
 private static void skinsDeactivated()
 {
     // Only change skin settings, when mod is active
     if (ModActive.GetValue())
     {
         SaveManager.LastSkin = PlayerControl.LocalPlayer.Data.SkinId;
         AlternativeRpcSender.RpcSetSkin(0);
     }
 }
예제 #3
0
 private static void petsDeactivated()
 {
     // Only change pet settings, when mod is active
     if (ModActive.GetValue())
     {
         SaveManager.LastPet = PlayerControl.LocalPlayer.Data.PetId;
         AlternativeRpcSender.RpcSetPet(0);
     }
 }
예제 #4
0
        private static void modDeactivated()
        {
            PlayerControl player = PlayerControl.LocalPlayer;

            // Get new name and color from host
            player.CmdCheckName(SaveManager.PlayerName);
            player.CmdCheckColor(SaveManager.BodyColor);

            // Send hat, pet and skin to other players
            AlternativeRpcSender.RpcSetHat(SaveManager.LastHat);
            AlternativeRpcSender.RpcSetPet(SaveManager.LastPet);
            AlternativeRpcSender.RpcSetSkin(SaveManager.LastSkin);
        }
예제 #5
0
        static void Postfix([HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
        {
            switch (callId)
            {
            case (byte)CustomRpc.HostSetHat:
            {
                uint playerId = reader.ReadPackedUInt32();
                if (playerId == PlayerControl.LocalPlayer.PlayerId)
                {
                    AlternativeRpcSender.RpcSetHat(reader.ReadPackedUInt32());
                }
                break;
            }

            case (byte)CustomRpc.HostSetPet:
            {
                uint playerId = reader.ReadPackedUInt32();
                if (playerId == PlayerControl.LocalPlayer.PlayerId)
                {
                    AlternativeRpcSender.RpcSetPet(reader.ReadPackedUInt32());
                }
                break;
            }

            case (byte)CustomRpc.HostSetSkin:
            {
                uint playerId = reader.ReadPackedUInt32();
                if (playerId == PlayerControl.LocalPlayer.PlayerId)
                {
                    AlternativeRpcSender.RpcSetSkin(reader.ReadPackedUInt32());
                }
                break;
            }

            case (byte)CustomRpc.SetModActive:
                MarkModeMain.ModActive.SetValue(reader.ReadBoolean());
                break;

            case (byte)CustomRpc.SetPetsAllowed:
                MarkModeMain.PetsAllowed.SetValue(reader.ReadBoolean());
                break;

            case (byte)CustomRpc.SetSkinsAllowed:
                MarkModeMain.SkinsAllowed.SetValue(reader.ReadBoolean());
                break;
            }
        }
예제 #6
0
        public static void sendHatAssignments()
        {
            // Send hat assignments for each player
            foreach (PlayerControl player in PlayerControl.AllPlayerControls)
            {
                uint hatId = hatAssignments[player.PlayerId];

                // Set for host
                if (player.PlayerId == PlayerControl.LocalPlayer.PlayerId)
                {
                    AlternativeRpcSender.RpcSetHat(hatId);
                }

                // Send to other players
                CustomRpcSender.RpcHostSetHat(player.PlayerId, hatId);
            }
        }
예제 #7
0
        private static void modActivated()
        {
            PlayerControl player = PlayerControl.LocalPlayer;

            // Get new name and color from host
            player.CmdCheckName(SaveManager.PlayerName);
            player.CmdCheckColor(SaveManager.BodyColor);

            // Remember settings
            SaveManager.LastHat  = player.Data.HatId;
            SaveManager.LastPet  = player.Data.PetId;
            SaveManager.LastSkin = player.Data.SkinId;

            // Reset hat on begin
            AlternativeRpcSender.RpcSetHat(0);

            // Handle pet setting
            if (PetsAllowed.GetValue())
            {
                petsActivated();
            }
            else
            {
                petsDeactivated();
            }

            // Handle skin setting
            if (SkinsAllowed.GetValue())
            {
                skinsActivated();
            }
            else
            {
                skinsDeactivated();
            }
        }