/// <returns>Task that must be awaited.</returns>
ValueTask SetColorAsync(ColorType colorType);
- // /// <summary>
- // /// Sets the hat of the current <see cref="IInnerPlayerControl" />.
- // /// Visible to all players.
- // /// </summary>
- // /// <param name="hatId">An hat for the player.</param>
- // /// <returns>Task that must be awaited.</returns>
- // ValueTask SetHatAsync(string hatId);
- //
- // /// <summary>
- // /// Sets the pet of the current <see cref="IInnerPlayerControl" />.
- // /// Visible to all players.
- // /// </summary>
- // /// <param name="petId">A pet for the player.</param>
- // /// <returns>Task that must be awaited.</returns>
- // ValueTask SetPetAsync(string petId);
- //
- // /// <summary>
- // /// Sets the skin of the current <see cref="IInnerPlayerControl" />.
- // /// Visible to all players.
- // /// </summary>
- // /// <param name="skinId">A skin for the player.</param>
- // /// <returns>Task that must be awaited.</returns>
- // ValueTask SetSkinAsync(string skinId);
+ /// <summary>
+ /// Sets the hat of the current <see cref="IInnerPlayerControl" />.
+ /// Visible to all players.
+ /// </summary>
+ /// <param name="hatId">An hat for the player.</param>
+ /// <returns>Task that must be awaited.</returns>
+ ValueTask SetHatAsync(string hatId);
+
+ /// <summary>
+ /// Sets the pet of the current <see cref="IInnerPlayerControl" />.
+ /// Visible to all players.
+ /// </summary>
+ /// <param name="petId">A pet for the player.</param>
+ /// <returns>Task that must be awaited.</returns>
+ ValueTask SetPetAsync(string petId);
+
+ /// <summary>
+ /// Sets the skin of the current <see cref="IInnerPlayerControl" />.
+ /// Visible to all players.
+ /// </summary>
+ /// <param name="skinId">A skin for the player.</param>
+ /// <returns>Task that must be awaited.</returns>
+ ValueTask SetSkinAsync(string skinId);
/// <summary>
/// Send a chat message as the current <see cref="IInnerPlayerControl" />.
{
// Modify player properties.
await playerControl.SetColorAsync((ColorType)_random.Next(1, 9));
- await playerControl.SetHatAsync((HatType)_random.Next(1, 9));
- await playerControl.SetSkinAsync((SkinType)_random.Next(1, 9));
- await playerControl.SetPetAsync((PetType)_random.Next(1, 9));
+ // TODO Rewrite using cosmetics source generator
+ // await playerControl.SetHatAsync((HatType)_random.Next(1, 9));
+ // await playerControl.SetSkinAsync((SkinType)_random.Next(1, 9));
+ // await playerControl.SetPetAsync((PetType)_random.Next(1, 9));
await Task.Delay(TimeSpan.FromMilliseconds(5000));
}
if (e.Message == "look")
{
await e.PlayerControl.SetColorAsync(ColorType.Pink);
- await e.PlayerControl.SetHatAsync(HatType.Cheese);
- await e.PlayerControl.SetSkinAsync(SkinType.Police);
- await e.PlayerControl.SetPetAsync(PetType.Ufo);
+ await e.PlayerControl.SetHatAsync("hat_pk05_Cheese");
+ await e.PlayerControl.SetSkinAsync("skin_Police");
+ await e.PlayerControl.SetPetAsync("pet_alien1");
}
if (e.Message == "snap")
await Game.FinishRpcAsync(writer);
}
+ public async ValueTask SetHatAsync(string hatId)
+ {
+ PlayerInfo.CurrentOutfit.HatId = hatId;
+
+ using var writer = Game.StartRpc(NetId, RpcCalls.SetHat);
+ Rpc39SetHat.Serialize(writer, hatId);
+ await Game.FinishRpcAsync(writer);
+ }
+
+ public async ValueTask SetPetAsync(string petId)
+ {
+ PlayerInfo.CurrentOutfit.PetId = petId;
+
+ using var writer = Game.StartRpc(NetId, RpcCalls.SetPet);
+ Rpc41SetPet.Serialize(writer, petId);
+ await Game.FinishRpcAsync(writer);
+ }
+
+ public async ValueTask SetSkinAsync(string skinId)
+ {
+ PlayerInfo.CurrentOutfit.SkinId = skinId;
+
+ using var writer = Game.StartRpc(NetId, RpcCalls.SetSkin);
+ Rpc40SetSkin.Serialize(writer, skinId);
+ await Game.FinishRpcAsync(writer);
+ }
+
public async ValueTask SendChatAsync(string text)
{
using var writer = Game.StartRpc(NetId, RpcCalls.SendChat);