/// <summary> /// </summary> /// <param name="fromPlacement"> /// </param> /// <param name="receivingPage"> /// </param> /// <param name="toPlacement"> /// </param> /// <exception cref="NotImplementedException"> /// </exception> public void Unequip(int fromPlacement, IInventoryPage receivingPage, int toPlacement) { IItem toUnEquip = this[fromPlacement]; receivingPage.Add(toPlacement, toUnEquip); this.Remove(fromPlacement); }
/// <summary> /// </summary> /// <param name="sendingPage"> /// </param> /// <param name="fromPlacement"> /// </param> /// <param name="toPlacement"> /// </param> /// <exception cref="NotImplementedException"> /// </exception> public void HotSwap(IInventoryPage sendingPage, int fromPlacement, int toPlacement) { IItem toEquip = sendingPage[fromPlacement]; IItem hotSwapItem = this[toPlacement]; sendingPage.Remove(fromPlacement); this.Remove(toPlacement); sendingPage.Add(fromPlacement, hotSwapItem); this.Add(toPlacement, toEquip); }
/// <summary> /// </summary> /// <param name="sourceContainerType"> /// </param> /// <param name="sourcePlacement"> /// </param> /// <param name="target"> /// </param> /// <param name="targetPlacement"> /// </param> /// <returns> /// </returns> /// <exception cref="NotImplementedException"> /// </exception> public bool ContainerAddItem(int sourceContainerType, int sourcePlacement, Identity target, int targetPlacement) { // Procedure: // 1. Check if source location has item // 2. Check if target container exists // 3. Switch source with target // Source container exists if (this.Character.BaseInventory.Pages.ContainsKey(sourceContainerType)) { IInventoryPage sourcePage = this.Character.BaseInventory.Pages[sourceContainerType]; // Source is not null if (sourcePage[sourcePlacement] != null) { if (this.Character.Identity == target) { IInventoryPage targetPage = this.Character.BaseInventory.PageFromSlot(targetPlacement); if (targetPage != null) { IItem itemSource = sourcePage.Remove(sourcePlacement); IItem itemTarget = targetPage.Remove(targetPlacement); if (itemTarget != null) { sourcePage.Add(sourcePlacement, itemTarget); } if (itemSource != null) { targetPage.Add(targetPlacement, itemSource); } } } else { // Put it into the other players/npcs trade window? } } } return(true); }