/// <summary> /// Places a wall item in the room and makes it visible for all clients, and returns a boolean that holds true if the operation has succeeded. /// </summary> /// <param name="handItemInstance">The stripItem instance of the wall item that is being placed down.</param> /// <param name="Position">The new position of the wall item as a string.</param> public bool placeWallItem(stripItem handItemInstance, string Position) { if (this.containsWallItem(handItemInstance.ID)) { return(false); } wallItem pItem = new wallItem(); pItem.ID = handItemInstance.ID; pItem.roomID = this.roomID; pItem.ownerID = handItemInstance.ownerID; pItem.Definition = handItemInstance.Definition; pItem.customData = handItemInstance.customData; pItem.wallPosition = Position; if (handItemInstance.Definition.Behaviour.isPostIt) // New post.it, set blank message data { pItem.postItMessage = String.Empty; } this.broadcoastWallItemPlacement(pItem); this.wallItems.Add(pItem); pItem.Update(); // Save position return(true); }
/// <summary> /// Tries to remove a wallitem from the room, broadcoasts the removal and updates the item, and optionally sends the item to the hand of a given user and returns a stripItem copy of the item with the out parameter. /// </summary> /// <param name="itemID">The database ID of the item to remove.</param> /// <param name="toUserID">The database ID of the user that should receive this item in his/her hand. Supply -1 to delete the item from the database.</param> /// <param name="handItemInstance">If toUserID > 0, then the stripItem copy of the removed item will be returned via the out parameter.</param> public stripItem pickupWallItem(int itemID, int toUserID) { wallItem pItem = this.getWallItem(itemID); if (pItem == null || (pItem.Definition.Behaviour.isPostIt && toUserID > 0)) { return(null); // Can't pickup item to hand } broadcoastWallItemRemoval(itemID); this.unloadWallItem(itemID); if (toUserID > 0) // Item picked up to hand of user { pItem.roomID = 0; pItem.ownerID = toUserID; pItem.wallPosition = null; pItem.Update(); } else { Engine.Game.Items.deleteItemInstance(itemID); } if (toUserID > 0) { return((stripItem)pItem); } else { return(null); } }
/// <summary> /// Places a wall item in the room and makes it visible for all clients, and returns a boolean that holds true if the operation has succeeded. /// </summary> /// <param name="handItemInstance">The stripItem instance of the wall item that is being placed down.</param> /// <param name="Position">The new position of the wall item as a string.</param> public bool placeWallItem(stripItem handItemInstance, string Position) { if (this.containsWallItem(handItemInstance.ID)) return false; wallItem pItem = new wallItem(); pItem.ID = handItemInstance.ID; pItem.roomID = this.roomID; pItem.ownerID = handItemInstance.ownerID; pItem.Definition = handItemInstance.Definition; pItem.customData = handItemInstance.customData; pItem.wallPosition = Position; if (handItemInstance.Definition.Behaviour.isPostIt) // New post.it, set blank message data { pItem.postItMessage = String.Empty; } this.broadcoastWallItemPlacement(pItem); this.wallItems.Add(pItem); pItem.Update(); // Save position return true; }