private void SyncEquipSprite(string slotName, GameObject Item)
    {
        NamedSlot enumA = (NamedSlot)Enum.Parse(typeof(NamedSlot), slotName);

        equipment.SetReference((int)enumA, Item);
    }
Exemple #2
0
 /// <summary>
 /// Gets the specified named slot from the specified storage. Null if this item storage does not have
 /// a slot with the given name.
 /// </summary>
 /// <param name="itemStorage"></param>
 /// <param name="named"></param>
 /// <returns></returns>
 public static ItemSlot GetNamed(ItemStorage itemStorage, NamedSlot named)
 {
     return(Get(itemStorage, SlotIdentifier.Named(named)));
 }
 public void CmdSetActiveHand(NamedSlot hand)
 {
     activeHand = hand;
 }
 private string ItemNameInSlot(NamedSlot slot)
 {
     return(ItemStorage.GetNamedItemSlot(slot).ItemObject.ExpensiveName());
 }
Exemple #5
0
 /// <summary>
 /// Gets the clothing item corresponding to this slot, null if no clothing item exists for this slot.
 /// </summary>
 /// <param name="namedSlot"></param>
 /// <returns></returns>
 public ClothingItem GetClothingItem(NamedSlot namedSlot)
 {
     clothingItems.TryGetValue(namedSlot, out var clothingItem);
     return(clothingItem);
 }
Exemple #6
0
    public override void Deserialize(NetworkReader reader)
    {
        base.Deserialize(reader);
        var componentID = reader.ReadUInt16();

        if (componentID == UNKNOWN_COMPONENT_TYPE_ID)
        {
            //client didn't know which to trigger, leave ComponentType null
            ComponentType = null;
        }
        else
        {
            //client requested a specific component.
            ComponentType = componentIDToComponentType[componentID];
        }

        InteractionType = interactionIDToInteractionType[reader.ReadByte()];
        if (componentID != UNKNOWN_COMPONENT_TYPE_ID)
        {
            // client specified exact component
            ProcessorObject = reader.ReadUInt32();
        }
        else
        {
            // client requested server to check the interaction
            ProcessorObject = NetId.Invalid;
        }
        Intent = (Intent)reader.ReadByte();

        if (InteractionType == typeof(PositionalHandApply))
        {
            TargetObject   = reader.ReadUInt32();
            TargetVector   = reader.ReadVector2();
            TargetBodyPart = (BodyPartType)reader.ReadUInt32();
        }
        else if (InteractionType == typeof(HandApply))
        {
            TargetObject   = reader.ReadUInt32();
            TargetBodyPart = (BodyPartType)reader.ReadUInt32();
            IsAltUsed      = reader.ReadBoolean();
        }
        else if (InteractionType == typeof(AimApply))
        {
            TargetVector     = reader.ReadVector2();
            MouseButtonState = reader.ReadBoolean() ? MouseButtonState.PRESS : MouseButtonState.HOLD;
        }
        else if (InteractionType == typeof(MouseDrop))
        {
            TargetObject = reader.ReadUInt32();
            UsedObject   = reader.ReadUInt32();
        }
        else if (InteractionType == typeof(InventoryApply))
        {
            UsedObject = reader.ReadUInt32();
            Storage    = reader.ReadUInt32();
            SlotIndex  = reader.ReadInt32();
            NamedSlot  = (NamedSlot)reader.ReadInt32();
            IsAltUsed  = reader.ReadBoolean();
        }
        else if (InteractionType == typeof(TileApply))
        {
            TargetVector = reader.ReadVector2();
        }
        else if (InteractionType == typeof(TileMouseDrop))
        {
            UsedObject   = reader.ReadUInt32();
            TargetVector = reader.ReadVector2();
        }
        else if (InteractionType == typeof(ConnectionApply))
        {
            TargetObject     = reader.ReadUInt32();
            TargetVector     = reader.ReadVector2();
            connectionPointA = (Connection)reader.ReadByte();
            connectionPointB = (Connection)reader.ReadByte();
        }
        else if (InteractionType == typeof(ContextMenuApply))
        {
            TargetObject    = reader.ReadUInt32();
            RequestedOption = reader.ReadString();
        }
    }
 public bool IsSlotObscured(NamedSlot namedSlot)
 {
     return(obscuredSlots.HasFlag(ItemSlot.GetFlaggedSlot(namedSlot)));
 }
    public void CmdDropItemWithoutValidations(NamedSlot equipSlot)
    {
        var slot = itemStorage.GetNamedItemSlot(equipSlot);

        Inventory.ServerDrop(slot);
    }
    /// <summary>
    /// Get the item in the player's slot
    /// </summary>
    /// <returns>the gameobject item in the player's slot, null if nothing </returns>
    public GameObject GetActiveItemInSlot(NamedSlot slot)
    {
        var pu = itemStorage.GetNamedItemSlot(slot).Item;

        return(pu?.gameObject);
    }
 public ItemSlot GetNamedItemSlot(NamedSlot named)
 {
     return(ItemSlot.GetNamed(this, named));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="namedSlot"></param>
 /// <returns>true iff this item storage has the slot with the specified identifier</returns>
 public bool HasSlot(NamedSlot namedSlot)
 {
     return(HasSlot(SlotIdentifier.Named(namedSlot)));
 }
Exemple #12
0
 public static NamedSlotFlagged GetFlaggedSlot(NamedSlot slot)
 {
     return((NamedSlotFlagged)(1 << (int)slot));
 }
Exemple #13
0
 private NamedSlotFlagged ConvertNamedSlotToObscuredSlot(NamedSlot slot)
 {
     return((NamedSlotFlagged)Math.Pow(2, (int)slot));
 }
Exemple #14
0
 public bool IsSlotObscured(NamedSlot namedSlot)
 {
     return(obscuredSlots.HasFlag(ConvertNamedSlotToObscuredSlot(namedSlot)));
 }