コード例 #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();
            }
        }