public override void MoveItemFromStorage(BasePlayerCharacterEntity playerCharacterEntity, StorageId storageId, short storageItemIndex, short amount, short nonEquipIndex) { if (!CanAccessStorage(playerCharacterEntity, playerCharacterEntity.CurrentStorageId)) { SendServerGameMessage(playerCharacterEntity.ConnectionId, GameMessage.Type.CannotAccessStorage); return; } if (!storageItems.ContainsKey(storageId)) { storageItems[storageId] = new List <CharacterItem>(); } List <CharacterItem> storageItemList = storageItems[storageId]; if (storageItemIndex < 0 || storageItemIndex >= storageItemList.Count) { // Don't do anything, if storage item index is invalid return; } // Prepare storage data Storage storage = GetStorage(storageId); bool isLimitSlot = storage.slotLimit > 0; short slotLimit = storage.slotLimit; // Prepare item data CharacterItem movingItem = storageItemList[storageItemIndex].Clone(); movingItem.amount = amount; if (nonEquipIndex < 0 || nonEquipIndex >= playerCharacterEntity.NonEquipItems.Count || !playerCharacterEntity.NonEquipItems[nonEquipIndex].NotEmptySlot() || playerCharacterEntity.NonEquipItems[nonEquipIndex].dataId == movingItem.dataId) { // Add to inventory or merge bool isOverwhelming = playerCharacterEntity.IncreasingItemsWillOverwhelming(movingItem.dataId, movingItem.amount); if (!isOverwhelming && playerCharacterEntity.IncreaseItems(movingItem)) { // Decrease from storage CharacterDataExtension.DecreaseItemsByIndex(storageItemList, storageItemIndex, amount); } } else { // Swapping CharacterItem storageItem = storageItemList[storageItemIndex]; CharacterItem nonEquipItem = playerCharacterEntity.NonEquipItems[nonEquipIndex]; storageItemList[storageItemIndex] = nonEquipItem; playerCharacterEntity.NonEquipItems[nonEquipIndex] = storageItem; } CharacterDataExtension.FillEmptySlots(storageItemList, isLimitSlot, slotLimit); UpdateStorageItemsToCharacters(usingStorageCharacters[storageId], storageItemList); }