/// <summary> /// Unstacks the stacked item from the specified slot. /// </summary> /// <param name="player">The player.</param> /// <param name="stackId">The stack identifier.</param> /// <param name="slot">The slot.</param> public void UnstackItems(Player player, byte stackId, byte slot) { if (!this.IsCorrectNpcOpened(player)) { return; } var mix = this.GetJewelMix(stackId, player); if (mix is null) { return; } var stacked = player.Inventory?.GetItem(slot); if (stacked is null) { player.ViewPlugIns.GetPlugIn <IShowMessagePlugIn>()?.ShowMessage("Stacked Jewel not found.", MessageType.BlueNormal); return; } if (stacked.Definition != mix.SingleJewel) { player.ViewPlugIns.GetPlugIn <IShowMessagePlugIn>()?.ShowMessage("Selected Item is not a stacked Jewel.", MessageType.BlueNormal); return; } byte pieces = (byte)((stacked.Level + 1) * 10); var freeSlots = player.Inventory !.FreeSlots.Take(pieces).ToList(); if (freeSlots.Count < pieces) { player.ViewPlugIns.GetPlugIn <IShowMessagePlugIn>()?.ShowMessage("Inventory got not enough Space.", MessageType.BlueNormal); return; } player.Inventory.RemoveItem(stacked); player.ViewPlugIns.GetPlugIn <IItemRemovedPlugIn>()?.RemoveItem(slot); foreach (var freeSlot in freeSlots) { var jewel = player.PersistenceContext.CreateNew <Item>(); jewel.Definition = mix.SingleJewel; jewel.Durability = 1; jewel.ItemSlot = freeSlot; player.Inventory.AddItem(freeSlot, jewel); player.ViewPlugIns.GetPlugIn <IItemAppearPlugIn>()?.ItemAppear(jewel); } }
void ReleaseDesignerOutlets() { if (NetworkUpdateButton != null) { NetworkUpdateButton.Dispose(); NetworkUpdateButton = null; } if (Authentication != null) { Authentication.Dispose(); Authentication = null; } if (BootFileLabel != null) { BootFileLabel.Dispose(); BootFileLabel = null; } if (ConfigFileLabel != null) { ConfigFileLabel.Dispose(); ConfigFileLabel = null; } if (DefaultGateway != null) { DefaultGateway.Dispose(); DefaultGateway = null; } if (DeployButton != null) { DeployButton.Dispose(); DeployButton = null; } if (DeviceType != null) { DeviceType.Dispose(); DeviceType = null; } if (EnableDHCP != null) { EnableDHCP.Dispose(); EnableDHCP = null; } if (EncryptConfig != null) { EncryptConfig.Dispose(); EncryptConfig = null; } if (Encryption != null) { Encryption.Dispose(); Encryption = null; } if (FirmwareStatus != null) { FirmwareStatus.Dispose(); FirmwareStatus = null; } if (FlashFileLabel != null) { FlashFileLabel.Dispose(); FlashFileLabel = null; } if (FreeSlots != null) { FreeSlots.Dispose(); FreeSlots = null; } if (MacAddress != null) { MacAddress.Dispose(); MacAddress = null; } if (NetworkKey != null) { NetworkKey.Dispose(); NetworkKey = null; } if (NetworkMacAddress != null) { NetworkMacAddress.Dispose(); NetworkMacAddress = null; } if (NetworkValue != null) { NetworkValue.Dispose(); NetworkValue = null; } if (Output != null) { Output.Dispose(); Output = null; } if (Passphrase != null) { Passphrase.Dispose(); Passphrase = null; } if (PrimaryDNS != null) { PrimaryDNS.Dispose(); PrimaryDNS = null; } if (RadioA != null) { RadioA.Dispose(); RadioA = null; } if (RadioB != null) { RadioB.Dispose(); RadioB = null; } if (RadioG != null) { RadioG.Dispose(); RadioG = null; } if (RadioN != null) { RadioN.Dispose(); RadioN = null; } if (ReKeyInternal != null) { ReKeyInternal.Dispose(); ReKeyInternal = null; } if (SaveConfigurationButton != null) { SaveConfigurationButton.Dispose(); SaveConfigurationButton = null; } if (SecondaryDNS != null) { SecondaryDNS.Dispose(); SecondaryDNS = null; } if (SSID != null) { SSID.Dispose(); SSID = null; } if (StaticIPAddress != null) { StaticIPAddress.Dispose(); StaticIPAddress = null; } if (SubnetMask != null) { SubnetMask.Dispose(); SubnetMask = null; } if (UpdateFirmwareButton != null) { UpdateFirmwareButton.Dispose(); UpdateFirmwareButton = null; } }