2021-12-25 22:35:32 -08:00
|
|
|
|
using QSB.ItemSync.WorldObjects.Items;
|
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.Player;
|
2022-03-24 13:42:23 +00:00
|
|
|
|
using QSB.Utility;
|
2021-12-25 22:35:32 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
namespace QSB.ItemSync.Messages;
|
|
|
|
|
|
2022-07-25 13:09:51 +01:00
|
|
|
|
internal class MoveToCarryMessage : QSBWorldObjectMessage<IQSBItem, uint>
|
2021-12-25 22:35:32 -08:00
|
|
|
|
{
|
2022-07-25 13:09:51 +01:00
|
|
|
|
public MoveToCarryMessage(uint playerHolding) : base(playerHolding) { }
|
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
public override void OnReceiveRemote()
|
2021-12-25 22:35:32 -08:00
|
|
|
|
{
|
2022-03-24 09:49:22 -07:00
|
|
|
|
WorldObject.StoreLocation();
|
|
|
|
|
|
2022-07-25 13:09:51 +01:00
|
|
|
|
var player = QSBPlayerManager.GetPlayer(Data);
|
2022-03-02 19:46:33 -08:00
|
|
|
|
var itemType = WorldObject.GetItemType();
|
2022-01-26 13:12:22 +00:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
player.HeldItem = WorldObject;
|
|
|
|
|
var itemSocket = itemType switch
|
|
|
|
|
{
|
|
|
|
|
ItemType.Scroll => player.ScrollSocket,
|
|
|
|
|
ItemType.SharedStone => player.SharedStoneSocket,
|
|
|
|
|
ItemType.WarpCore => ((QSBWarpCoreItem)WorldObject).IsVesselCoreType()
|
|
|
|
|
? player.VesselCoreSocket
|
|
|
|
|
: player.WarpCoreSocket,
|
|
|
|
|
ItemType.Lantern => player.SimpleLanternSocket,
|
|
|
|
|
ItemType.DreamLantern => player.DreamLanternSocket,
|
|
|
|
|
ItemType.SlideReel => player.SlideReelSocket,
|
|
|
|
|
ItemType.VisionTorch => player.VisionTorchSocket,
|
2022-03-23 15:26:42 -07:00
|
|
|
|
_ => player.ItemSocket
|
2022-03-02 19:46:33 -08:00
|
|
|
|
};
|
2022-03-24 13:42:23 +00:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
WorldObject.PickUpItem(itemSocket);
|
2022-07-25 17:20:02 +01:00
|
|
|
|
WorldObject.ItemState.HasBeenInteractedWith = true;
|
2022-07-25 13:09:51 +01:00
|
|
|
|
WorldObject.ItemState.State = ItemStateType.Held;
|
|
|
|
|
WorldObject.ItemState.HoldingPlayer = player;
|
2022-02-27 04:40:44 -08:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
switch (itemType)
|
|
|
|
|
{
|
|
|
|
|
case ItemType.Scroll:
|
|
|
|
|
player.AnimationSync.VisibleAnimator.SetTrigger("HoldScroll");
|
|
|
|
|
break;
|
|
|
|
|
case ItemType.WarpCore:
|
|
|
|
|
if (((QSBWarpCoreItem)WorldObject).IsVesselCoreType())
|
|
|
|
|
{
|
|
|
|
|
player.AnimationSync.VisibleAnimator.SetTrigger("HoldAdvWarpCore");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
player.AnimationSync.VisibleAnimator.SetTrigger("HoldWarpCore");
|
|
|
|
|
}
|
2022-01-27 17:36:33 +00:00
|
|
|
|
|
2022-03-02 19:46:33 -08:00
|
|
|
|
break;
|
|
|
|
|
case ItemType.SharedStone:
|
|
|
|
|
player.AnimationSync.VisibleAnimator.SetTrigger("HoldSharedStone");
|
|
|
|
|
break;
|
|
|
|
|
case ItemType.ConversationStone:
|
|
|
|
|
player.AnimationSync.VisibleAnimator.SetTrigger("HoldItem");
|
|
|
|
|
break;
|
|
|
|
|
case ItemType.Lantern:
|
|
|
|
|
player.AnimationSync.VisibleAnimator.SetTrigger("HoldLantern");
|
|
|
|
|
break;
|
|
|
|
|
case ItemType.SlideReel:
|
|
|
|
|
case ItemType.DreamLantern:
|
|
|
|
|
case ItemType.VisionTorch:
|
2022-03-24 13:42:23 +00:00
|
|
|
|
DebugLog.ToConsole($"Warning - {itemType} has no implemented holding pose.", OWML.Common.MessageType.Warning);
|
2022-03-02 19:46:33 -08:00
|
|
|
|
break;
|
2021-12-25 22:35:32 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-23 15:26:42 -07:00
|
|
|
|
}
|