/// <summary> /// Initializes a new instance of the <see cref="Slot"/> class. /// </summary> /// <param name="address">The address.</param> /// <param name="connection">The connection.</param> /// <param name="id">The id.</param> public Slot(uint address, ConnectionProvider connection, InventoryID id) { this.address = address; this.id = id; this.memory = connection.Memory; this.connection = connection; }
public int GetAmount(InventoryID id) { switch (id) { case InventoryID.Strawberry: return(Strawberries); case InventoryID.StrawberryPair: return(StrawberryPairs); case InventoryID.Cleaner: return(CleaningSupplies); case InventoryID.BookOne: return(BookOne ? 1 : 0); case InventoryID.BookTwo: return(BookTwo ? 1 : 0); case InventoryID.BookThree: return(BookThree ? 1 : 0); default: throw new System.Exception($"unexpected id {id}"); } }
/// <summary> /// Initializes a new instance of the <see cref="Slot"/> class. /// </summary> /// <param name="address">The address.</param> /// <param name="ownerContainer">The owner container.</param> /// <param name="position">The position.</param> public Slot(uint address, IContainer ownerContainer, int position) { this.address = address; this.container = ownerContainer; this.position = position; id = InventoryID.Container; memory = Container.Memory; connection = Container.Connection; }
/// <summary> /// Checks for at least one filter in the GetItem request. /// See GetItem Post https://developers.neto.com.au/documentation/engineers/api-documentation/products/getitem /// </summary> /// <returns>bool</returns> internal override bool isValid() { if (!string.IsNullOrWhiteSpace(ParentSKU)) { return(true); } if (DateAddedFrom != DateTime.MinValue) { return(true); } if (DateAddedTo != DateTime.MinValue) { return(true); } if (DateUpdatedFrom != DateTime.MinValue) { return(true); } if (DateUpdatedTo != DateTime.MinValue) { return(true); } int requiredFilterCount = SKU.NullSafeLength() + AccountingCode.NullSafeLength() + InventoryID.NullSafeLength() + Brand.NullSafeLength() + Model.NullSafeLength() + Name.NullSafeLength() + PrimarySupplier.NullSafeLength() + Approved.NullSafeLength() + ApprovedForPOS.NullSafeLength() + ApprovedForMobileStore.NullSafeLength() + SalesChannels.NullSafeLength() + Visible.NullSafeLength() + IsActive.NullSafeLength() + CategoryID.NullSafeLength(); if (requiredFilterCount != 0) { return(true); } throw new NetoRequestException("At least one filter is required in the GetItem request"); }
public void SetAmount(InventoryID id, int value) { switch (id) { case InventoryID.Strawberry: Strawberries = value; break; case InventoryID.StrawberryPair: StrawberryPairs = value; break; case InventoryID.Cleaner: CleaningSupplies = value; break; default: throw new System.Exception($"unexpected id {id}"); } }
/// <summary> /// Send the ammount of stacked Item to defined Inventory Slot. /// </summary> public void SlotToSlot(IItem item, InventoryID toSlot) { #region " Packet Structure Analyze " //--------------------------------------------------- // SZ ID ST ITM ST QT // 0F 00 78 FF FF 06 00 00 D6 0C 00 FF FF 0A 00 00 01 //--------------------------------------------------- // 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 //--------------------------------------------------- #endregion var Builder = new PacketBuilder(0x78, Connection); Builder.Append(0xFF); Builder.Append(0XFF); Builder.Append(item.Slot.Id.GetHashCode()); Builder.Append(0x00); Builder.Append(0x00); Builder.Append(item.Id); Builder.Append(0x00); Builder.Append(0xFF); Builder.Append(0xFF); Builder.Append(toSlot.GetHashCode()); Builder.Append(0x00); Builder.Append(0x00); Builder.Append(item.Count); Connection.Send(Builder.GetPacket()); }
/// <summary> /// Send the ammount of ground Item to defined Inventory Slot. /// </summary> public void GroundToSlot(IItem item, InventoryID destiny, Location sqm, uint stackPosition) { #region " Packet Structure Analyze " // SZ ID X Y ZZ ITM ?? ST QT //--------------------------------------------------- // 0F 00 78 14 7E ED 7B 07 CD 0C 01 FF FF 06 00 00 04 //--------------------------------------------------- // 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 #endregion var Builder = new PacketBuilder(0x78, Connection); Builder.Append(sqm.X); Builder.Append(sqm.Y); Builder.Append(sqm.Z); Builder.Append(item.Id); Builder.Append(stackPosition); Builder.Append(0xFF); Builder.Append(0xFF); Builder.Append(destiny.GetHashCode()); Builder.Append(0x00); Builder.Append(0x00); Builder.Append(item.Count); Connection.Send(Builder.GetPacket()); }
/// <summary> /// Send the ammount of stacked Item to defined Inventory Slot. /// </summary> public void ContainerToSlot(ISlot fromSlot, InventoryID toSloT) { #region " Packet Structure Analyze " //--------------------------------------------------- // SZ ID BP ST ITM ST ST QT // 0F 00 78 FF FF 40 00 03 CD 0C 03 FF FF 06 00 00 04 //--------------------------------------------------- // 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 //--------------------------------------------------- #endregion var Builder = new PacketBuilder(0x78, Connection); Builder.Append(0xFF); Builder.Append(0xFF); Builder.Append(fromSlot.Container.Position); Builder.Append(0x00); Builder.Append(fromSlot.Position); Builder.Append(fromSlot.Item.Id); Builder.Append(fromSlot.Position); Builder.Append(0xFF); Builder.Append(0xFF); Builder.Append(toSloT.GetHashCode()); Builder.Append(0x00); Builder.Append(0x00); Builder.Append(fromSlot.Item.Count); Connection.Send(Builder.GetPacket()); }