private static Items.Iitem KeepOpening(string itemName, Items.Iitem item, int itemPosition = 1, int itemIndex = 1) { Items.Icontainer container = item as Items.Icontainer; if (item.ItemType.ContainsKey(Items.ItemsType.CONTAINER) && container.Contents.Count > 0) { foreach (string innerID in container.GetContents()) { Items.Iitem innerItem = Items.Items.GetByID(innerID); if (innerItem != null && KeepOpening(itemName, innerItem, itemPosition, itemIndex).Name.Contains(itemName)) { if (itemIndex == itemPosition) { return(innerItem); } else { itemIndex++; } } } } return(item); }
public List <string> GetInventoryList() { UpdateInventoryFromDatabase(); List <string> result = new List <string>(); Dictionary <string, int> itemGroups = new Dictionary <string, int>(); foreach (Items.Iitem item in GetInventoryAsItemList()) { if (item != null) { Items.Icontainer containerItem = item as Items.Icontainer; if (containerItem != null) { if (!itemGroups.ContainsKey(item.Name + "$" + (containerItem.Opened ? "[Opened]" : "[Closed]"))) { itemGroups.Add(item.Name + "$" + (containerItem.Opened ? "[Opened]" : "[Closed]"), 1); } else { itemGroups[item.Name + "$" + (containerItem.Opened ? "[Opened]" : "[Closed]")] += 1; } } else { if (!itemGroups.ContainsKey(item.Name + "$" + item.CurrentCondition)) { itemGroups.Add(item.Name + "$" + item.CurrentCondition, 1); } else { itemGroups[item.Name + "$" + item.CurrentCondition] += 1; } } } } foreach (KeyValuePair <string, int> pair in itemGroups) { string[] temp = pair.Key.Split('$'); if (!string.Equals(temp[1], "NONE", StringComparison.InvariantCultureIgnoreCase)) { if (temp[1].Contains("[Opened]") || temp[1].Contains("[Closed]")) { result.Add(temp[0] + " " + temp[1] + (pair.Value > 1 ? (" [x" + pair.Value + "]") : "")); } else { result.Add(temp[0] + " (" + temp[1].Replace("_", " ").ToLower() + " condition)" + (pair.Value > 1 ? ("[x" + pair.Value + "]") : "")); } } } return(result); }
private static void Inventory(User.User player, List <string> commands) { List <Items.Iitem> inventoryList = player.Player.Inventory.GetInventoryAsItemList(); StringBuilder sb = new StringBuilder(); Dictionary <string, int> grouping = new Dictionary <string, int>(); //let's group repeat items for easier display this may be a candidate for a helper method foreach (Items.Iitem item in inventoryList) { Items.Icontainer container = item as Items.Icontainer; if (!grouping.ContainsKey(item.Name)) { if (!item.ItemType.ContainsKey(Items.ItemsType.CONTAINER)) { grouping.Add(item.Name, 1); } else { grouping.Add(item.Name + " [" + (container.Opened ? "Opened" : "Closed") + "]", 1); container = null; } } else { if (!item.ItemType.ContainsKey(Items.ItemsType.CONTAINER)) { grouping[item.Name] += 1; } else { grouping[item.Name + " [" + (container.Opened ? "Opened" : "Closed") + "]"] += 1; container = null; } } } if (grouping.Count > 0) { sb.AppendLine("You are carrying:"); foreach (KeyValuePair <string, int> pair in grouping) { sb.AppendLine(pair.Key.CamelCaseString() + (pair.Value > 1 ? "[" + pair.Value + "]" : "")); } sb.AppendLine("\n\r"); } else { sb.AppendLine("\n\r[ EMPTY ]\n\r"); } player.MessageHandler(sb.ToString()); }
//TODO: had a bug where I removed item form a container, shut down the game and then both container and player still had the same item (the player even had it duped) //needless to say this is bad and fail. public static void Get(User.User player, List <string> commands) { int itemPosition = 1; int containerPosition = 1; string itemName = ""; string containerName = ""; List <string> commandAltered = ParseItemPositions(commands, "from", out itemPosition, out itemName); ParseContainerPosition(commandAltered, commands[3], out containerPosition, out containerName); string location = player.Player.Location; Items.Iitem retrievedItem = null; Items.Iitem containerItem = null; //using a recursive method we will dig down into each sub container and look for the appropriate item/container TraverseItems(player, containerName.ToString().Trim(), itemName.ToString().Trim(), containerPosition, itemPosition, out retrievedItem, out containerItem); string msg = null; string msgOthers = null; if (retrievedItem != null) { Items.Icontainer container = containerItem as Items.Icontainer; if (containerItem != null) { retrievedItem = container.RetrieveItem(retrievedItem.Id.ToString()); msg = "You take " + retrievedItem.Name.ToLower() + " out of " + containerItem.Name.ToLower() + "."; msgOthers = string.Format("{0} takes {1} out of {2}", player.Player.FirstName, retrievedItem.Name.ToLower(), containerItem.Name.ToLower()); } else { msg = "You get " + retrievedItem.Name.ToLower(); msgOthers = string.Format("{0} grabs {1}.", player.Player.FirstName, retrievedItem.Name.ToLower()); } retrievedItem.Location = null; retrievedItem.Owner = player.UserID; retrievedItem.Save(); player.Player.Inventory.AddItemToInventory(retrievedItem); } else { msg = "You can't seem to find " + itemName.ToString().Trim().ToLower() + " to grab it."; } Room.GetRoom(player.Player.Location).InformPlayersInRoom(msgOthers, new List <string>(new string[] { player.UserID })); player.MessageHandler(msg); }
private bool LightSourcePresent() { //foreach player/npc/item in room check to see if it is lightsource and on bool lightSource = false; //check th eplayers and see if anyones equipment is a lightsource foreach (string id in players) { User.User temp = MySockets.Server.GetAUser(id); Dictionary <Items.Wearable, Items.Iitem> equipped = temp.Player.Equipment.GetEquipment(); foreach (Items.Iitem item in equipped.Values) { Items.Iiluminate light = item as Items.Iiluminate; if (light != null && light.isLit) { lightSource = true; break; } } if (lightSource) { break; } } //check the NPCS and do the same as we did with the players if (!lightSource) { foreach (string id in npcs) { Character.Iactor actor = Character.NPCUtils.GetAnNPCByID(id); Dictionary <Items.Wearable, Items.Iitem> equipped = actor.Equipment.GetEquipment(); foreach (Items.Iitem item in equipped.Values) { Items.Iiluminate light = item as Items.Iiluminate; if (light != null && light.isLit) { lightSource = true; break; } } if (lightSource) { break; } } } //finally check for items in the room (just ones laying in the room, if a container is open check in container) if (!lightSource) { foreach (string id in items) { Items.Iitem item = Items.Items.GetByID(id); Items.Icontainer container = item as Items.Icontainer; Items.Iiluminate light = item as Items.Iiluminate; //even if container check this first. Container may have light enchanment. if (light != null && light.isLit) { lightSource = true; break; } if (container != null && (container.Contents != null && container.Contents.Count > 0) && container.Opened) //let's look in the container only if it's open { foreach (string innerId in container.Contents) { Items.Iitem innerItem = Items.Items.GetByID(id); light = innerItem as Items.Iiluminate; if (light != null && light.isLit) { lightSource = true; break; } } } if (lightSource) { break; } } } return(lightSource); }
private static void LookIn(User.User player, List <string> commands) { commands.RemoveAt(2); //remove "in" string itemNameToGet = Items.Items.ParseItemName(commands); bool itemFound = false; Room room = Room.GetRoom(player.Player.Location); string location; if (string.Equals(commands[commands.Count - 1], "inventory", StringComparison.InvariantCultureIgnoreCase)) { location = null; commands.RemoveAt(commands.Count - 1); //get rid of "inventory" se we can parse an index specifier if there is one } else { location = player.Player.Location; } int itemPosition = 1; string[] position = commands[commands.Count - 1].Split('.'); //we are separating based on using the decimal operator after the name of the npc/item if (position.Count() > 1) { int.TryParse(position[position.Count() - 1], out itemPosition); itemNameToGet = itemNameToGet.Remove(itemNameToGet.Length - 2, 2); } int index = 1; if (!string.IsNullOrEmpty(location)) //player didn't specify it was in his inventory check room first { foreach (string itemID in room.GetObjectsInRoom(Room.RoomObjects.Items)) { Items.Iitem inventoryItem = Items.Items.GetByID(itemID); inventoryItem = KeepOpening(itemNameToGet, inventoryItem, itemPosition, index); if (inventoryItem.Name.Contains(itemNameToGet)) { Items.Icontainer container = inventoryItem as Items.Icontainer; player.MessageHandler(container.LookIn()); itemFound = true; break; } } } if (!itemFound) //so we didn't find one in the room that matches { var playerInventory = player.Player.Inventory.GetInventoryAsItemList(); foreach (Items.Iitem inventoryItem in playerInventory) { if (inventoryItem.Name.Contains(itemNameToGet)) { //if player didn't specify an index number loop through all items until we find the first one we want otherwise we will // keep going through each item that matches until we hit the index number if (index == itemPosition) { Items.Icontainer container = inventoryItem as Items.Icontainer; player.MessageHandler(container.LookIn()); itemFound = true; break; } else { index++; } } } } }
private static string DisplayItemsInRoom(Room room) { StringBuilder sb = new StringBuilder(); List <string> itemsInRoom = room.GetObjectsInRoom(Room.RoomObjects.Items); Dictionary <string, int> itemGroups = new Dictionary <string, int>(); if (!room.IsDark) { foreach (string id in itemsInRoom) { Items.Iitem item = Items.Items.GetByID(id); if (item != null) { // Items.Icontainer containerItem = item as Items.Icontainer; // Items.Iedible edible = item as Items.Iedible; if (item.ItemType.ContainsKey(Items.ItemsType.CONTAINER)) { Items.Icontainer containerItem = item as Items.Icontainer; if (!itemGroups.ContainsKey(item.Name + "$" + (containerItem.IsOpenable == true ? (containerItem.Opened ? "[Opened]" : "[Closed]") : "[container]"))) { itemGroups.Add(item.Name + "$" + (containerItem.IsOpenable == true ? (containerItem.Opened ? "[Opened]" : "[Closed]") : "[container]"), 1); } else { itemGroups[item.Name + "$" + (containerItem.IsOpenable == true ? (containerItem.Opened ? "[Opened]" : "[Closed]") : "[container]")] += 1; } } else if (item.ItemType.ContainsKey(Items.ItemsType.DRINKABLE) || item.ItemType.ContainsKey(Items.ItemsType.EDIBLE)) { if (!itemGroups.ContainsKey(item.Name)) { itemGroups.Add(item.Name, 1); } else { itemGroups[item.Name] += 1; } } else { if (!itemGroups.ContainsKey(item.Name + "$" + item.CurrentCondition)) { itemGroups.Add(item.Name + "$" + item.CurrentCondition, 1); } else { itemGroups[item.Name + "$" + item.CurrentCondition] += 1; } } } } foreach (KeyValuePair <string, int> pair in itemGroups) { string[] temp = pair.Key.Split('$'); sb.Append(temp[0] + " is laying here"); if (temp.Count() > 1 && !string.Equals(temp[1], "NONE", StringComparison.InvariantCultureIgnoreCase)) { if (temp[1].Contains("[Opened]") || temp[1].Contains("[Closed]") || temp[1].Contains("[container]")) { sb.AppendLine(". " + (temp[1] == "[container]" ? "" : temp[1]) + (pair.Value > 1 ? (" [x" + pair.Value + "]") : "")); } else { sb.AppendLine(" in " + temp[1].Replace("_", " ").ToLower() + " condition." + (pair.Value > 1 ? ("[x" + pair.Value + "]") : "")); } } else { sb.AppendLine("."); } } } else { int count = 0; foreach (string id in itemsInRoom) { Items.Iitem item = Items.Items.GetByID(id); if (item != null) { count++; } } if (count == 1) { sb.AppendLine("Something is laying here."); } else if (count > 1) { sb.AppendLine("Somethings are laying here."); } } return(sb.ToString()); }
private static void CloseContainer(User.User player, List <string> commands) { string location; if (string.Equals(commands[commands.Count - 1], "inventory", StringComparison.InvariantCultureIgnoreCase)) { location = null; commands.RemoveAt(commands.Count - 1); //get rid of "inventory" se we can parse an index specifier if there is one } else { location = player.Player.Location; } string itemNameToGet = Items.Items.ParseItemName(commands); bool itemFound = false; Room room = Room.GetRoom(player.Player.Location); int itemPosition = 1; string[] position = commands[commands.Count - 1].Split('.'); //we are separating based on using the decimal operator after the name of the npc/item if (position.Count() > 1) { int.TryParse(position[position.Count() - 1], out itemPosition); } int index = 1; //Here is the real problem, how do I differentiate between a container in the room and one in the players inventory? //if a backpack is laying on the ground th eplayer should be able to put stuff in it or take from it, same as if it were //in his inventory. I should probably check room containers first then player inventory otherwise the player can //specify "inventory" to just do it in their inventory container. if (!string.IsNullOrEmpty(location)) //player didn't specify it was in his inventory check room first { foreach (string itemID in room.GetObjectsInRoom(Room.RoomObjects.Items)) { Items.Iitem inventoryItem = Items.Items.GetByID(itemID); if (string.Equals(inventoryItem.Name, itemNameToGet, StringComparison.InvariantCultureIgnoreCase)) { if (index == itemPosition) { Items.Icontainer container = inventoryItem as Items.Icontainer; player.MessageHandler(container.Close()); room.InformPlayersInRoom(player.Player.FirstName + " closes " + inventoryItem.Name.ToLower(), new List <string>(new string[] { player.UserID })); itemFound = true; break; } } } } if (!itemFound) //so we didn't find one in the room that matches { var playerInventory = player.Player.Inventory.GetInventoryAsItemList(); foreach (Items.Iitem inventoryItem in playerInventory) { if (string.Equals(inventoryItem.Name, itemNameToGet, StringComparison.InvariantCultureIgnoreCase)) { //if player didn't specify an index number loop through all items until we find the want we want otherwise we will // keep going through each item that matches until we hit the index number if (index == itemPosition) { Items.Icontainer container = inventoryItem as Items.Icontainer; player.MessageHandler(container.Close()); itemFound = true; break; } else { index++; } } } } }
private static void OpenContainer(User.User player, List <string> commands) { //this is a quick work around for knowing which container to open without implementing the dot operator //I need to come back and make it work like with NPCS once I've tested everything works correctly string location; if (string.Equals(commands[commands.Count - 1], "inventory", StringComparison.InvariantCultureIgnoreCase)) { location = null; commands.RemoveAt(commands.Count - 1); //get rid of "inventory" se we can parse an index specifier if there is one } else { location = player.Player.Location; } string itemNameToGet = Items.Items.ParseItemName(commands); bool itemFound = false; int itemPosition = 1; string[] position = commands[commands.Count - 1].Split('.'); //we are separating based on using the decimal operator after the name of the npc/item if (position.Count() > 1) { int.TryParse(position[position.Count() - 1], out itemPosition); } int index = 1; Room room = Room.GetRoom(location); if (!string.IsNullOrEmpty(location)) //player didn't specify it was in his inventory check room first { foreach (string itemID in room.GetObjectsInRoom(Room.RoomObjects.Items)) { Items.Iitem inventoryItem = Items.Items.GetByID(itemID); inventoryItem = KeepOpening(itemNameToGet, inventoryItem, itemPosition); if (string.Equals(inventoryItem.Name, itemNameToGet, StringComparison.InvariantCultureIgnoreCase)) { if (index == itemPosition) { Items.Icontainer container = inventoryItem as Items.Icontainer; player.MessageHandler(container.Open()); itemFound = true; break; } else { index++; } } } } if (!itemFound) //so we didn't find one in the room that matches { var playerInventory = player.Player.Inventory.GetInventoryAsItemList(); foreach (Items.Iitem inventoryItem in playerInventory) { if (string.Equals(inventoryItem.Name, itemNameToGet, StringComparison.InvariantCultureIgnoreCase)) { //if player didn't specify an index number loop through all items until we find the want we want otherwise we will // keep going through each item that matches until we hit the index number if (index == itemPosition) { Items.Icontainer container = inventoryItem as Items.Icontainer; player.MessageHandler(container.Open()); room.InformPlayersInRoom(player.Player.FirstName + " opens " + inventoryItem.Name.ToLower(), new List <string>(new string[] { player.UserID })); itemFound = true; break; } else { index++; } } } } if (!itemFound) { player.MessageHandler("Open what?"); } }
private static Items.Iiluminate FindLightInEquipment(List <string> commands, User.User player, Rooms.Room room) { Items.Iitem lightItem = null; if (commands.Count > 0) { string itemName = GetItemName(commands, "").ToString(); //let's see if player has a lightsource equipped foreach (Items.Iitem item in player.Player.Equipment.GetEquipment().Values) { if (item.WornOn == Items.Wearable.WIELD_LEFT || item.WornOn == Items.Wearable.WIELD_RIGHT) { Items.Iiluminate temp = item as Items.Iiluminate; if (temp != null && temp.isLightable) { lightItem = item; break; } } } } else //let's be smart and figure out what lightSource he wants activated, first come first serve otherwise { foreach (Items.Iitem item in player.Player.Equipment.GetEquipment().Values) { Items.Iiluminate lightsource = item as Items.Iiluminate; if (lightsource != null && lightsource.isLightable) { lightItem = item; break; } } if (lightItem == null) //not in players equipment let's check the room { foreach (string itemId in room.GetObjectsInRoom(Room.RoomObjects.Items)) { lightItem = Items.Items.GetByID(itemId); Items.Iiluminate lightsource = lightItem as Items.Iiluminate; if (lightsource != null && lightsource.isLightable) { break; } //if it's a container and it's open see if it has a lightsource inside if (lightItem.ItemType.ContainsKey(Items.ItemsType.CONTAINER)) { Items.Icontainer containerItem = lightItem as Items.Icontainer; if (containerItem.Opened) { foreach (string id in containerItem.GetContents()) { lightItem = Items.Items.GetByID(itemId); lightsource = lightItem as Items.Iiluminate; if (lightsource != null && lightsource.isLightable) { break; } } } } } } } return(lightItem as Items.Iiluminate); }
private static void TraverseItems(User.User player, string containerName, string itemName, int containerPosition, int itemPosition, out Items.Iitem retrievedItem, out Items.Iitem retrievedContainer) { int containerIndex = 1; int itemIndex = 1; retrievedItem = null; retrievedContainer = null; Room room = Room.GetRoom(player.Player.Location); if (!string.IsNullOrEmpty(containerName.CamelCaseString())) { foreach (string itemID in room.GetObjectsInRoom(Room.RoomObjects.Items)) { Items.Iitem inventoryItem = Items.Items.GetByID(itemID); inventoryItem = KeepOpening(containerName.CamelCaseString(), inventoryItem, containerPosition, containerIndex); if (inventoryItem.Name.Contains(containerName.CamelCaseString())) { retrievedContainer = inventoryItem; break; } } } //if we retrieved a specific indexed container search within it for the item if (retrievedContainer != null) { Items.Icontainer container = null; container = retrievedContainer as Items.Icontainer; foreach (string itemID in container.GetContents()) { Items.Iitem inventoryItem = Items.Items.GetByID(itemID); inventoryItem = KeepOpening(itemName.CamelCaseString(), inventoryItem, itemPosition, itemIndex); if (inventoryItem.Name.Contains(itemName.CamelCaseString())) { retrievedItem = inventoryItem; break; } } } else if (string.IsNullOrEmpty(containerName)) //we are grabbing a container or an item without a specific index { foreach (string itemID in room.GetObjectsInRoom(Room.RoomObjects.Items)) { Items.Iitem inventoryItem = Items.Items.GetByID(itemID); inventoryItem = KeepOpening(itemName.CamelCaseString(), inventoryItem, itemPosition, itemIndex); if (inventoryItem.Name.Contains(itemName.CamelCaseString())) { retrievedItem = inventoryItem; break; } } } else { foreach (string itemID in room.GetObjectsInRoom(Room.RoomObjects.Items)) { Items.Iitem inventoryItem = Items.Items.GetByID(itemID); if (inventoryItem.Name.Contains(itemName.CamelCaseString())) { retrievedItem = inventoryItem; break; } } } }
//container commands public static void Put(User.User player, List <string> commands) { //this command is used only for putting an Item in the root inventory of a player into a bag. //If an item needs to go from a bag to the root inventory level player should use the GET command instead. int itemPosition = 1; int containerPosition = 1; string itemName = ""; string containerName = ""; //this allows players to use either IN or INTO int commandIndex = 0; foreach (string word in commands) { if (string.Equals(word, "in", StringComparison.InvariantCultureIgnoreCase)) { commands[commandIndex] = "into"; break; } commandIndex++; } string location; if (string.Equals(commands[commands.Count - 1], "inventory", StringComparison.InvariantCultureIgnoreCase)) { location = null; commands.RemoveAt(commands.Count - 1); //get rid of "inventory" se we can parse an index specifier if there is one } else { location = player.Player.Location; } List <string> commandAltered = ParseItemPositions(commands, "into", out itemPosition, out itemName); ParseContainerPosition(commandAltered, "", out containerPosition, out containerName); Items.Iitem retrievedItem = null; Items.Iitem containerItem = null; //using a recursive method we will dig down into each sub container looking for the appropriate container if (!string.IsNullOrEmpty(location)) { TraverseItems(player, containerName.ToString().Trim(), itemName.ToString().Trim(), containerPosition, itemPosition, out retrievedItem, out containerItem); //player is an idiot and probably wanted to put it in his inventory but didn't specify it so let's check there as well if (containerItem == null) { foreach (Items.Iitem tempContainer in player.Player.Inventory.GetInventoryAsItemList()) { //Items.Iitem tempContainer = Items.Items.GetByID(id); containerItem = KeepOpening(containerName.CamelCaseString(), tempContainer, containerPosition); if (string.Equals(containerItem.Name, containerName.CamelCaseString(), StringComparison.InvariantCultureIgnoreCase)) { break; } } } } else //player specified it is in his inventory { foreach (string id in player.Player.Inventory.GetInventoryList()) { Items.Iitem tempContainer = Items.Items.GetByID(id); containerItem = KeepOpening(containerName.CamelCaseString(), tempContainer, containerPosition); if (string.Equals(containerItem.Name, containerName.CamelCaseString(), StringComparison.InvariantCultureIgnoreCase)) { break; } } } bool stored = false; retrievedItem = player.Player.Inventory.GetInventoryAsItemList().Where(i => i.Name == itemName).SingleOrDefault(); if (containerItem != null && retrievedItem != null) { retrievedItem.Location = containerItem.Location; retrievedItem.Owner = containerItem.Id.ToString(); retrievedItem.Save(); Items.Icontainer container = containerItem as Items.Icontainer; stored = container.StoreItem(retrievedItem.Id.ToString()); } string msg = null; if (!stored) { msg = "Could not put " + itemName.ToString().Trim().ToLower() + " inside the " + containerName.ToString().Trim().ToLower() + "."; } else { msg = "You place " + itemName.ToString().Trim().ToLower() + " inside the " + containerName.ToString().Trim().ToLower() + "."; } player.MessageHandler(msg); }
public static void Equip(User.User player, List <string> commands) { StringBuilder itemName = new StringBuilder(); int itemPosition = 1; string msgOthers = null; string msgPlayer = null; //we need to make a list of items to wear from the players inventory and sort them based on stats if (commands.Count > 2 && string.Equals(commands[2].ToLower(), "all", StringComparison.InvariantCultureIgnoreCase)) { foreach (Items.Iitem item in player.Player.Inventory.GetAllItemsToWear()) { if (player.Player.Equipment.EquipItem(item, player.Player.Inventory)) { msgPlayer += string.Format("You equip {0}.\n", item.Name); msgOthers = string.Format("{0} equips {1}.\n", player.Player.FirstName, item.Name); } } } else { string[] position = commands[commands.Count - 1].Split('.'); //we are separating based on using the decimal operator after the name of the npc/item if (position.Count() > 1) { int.TryParse(position[position.Count() - 1], out itemPosition); itemName = itemName.Remove(itemName.Length - 2, 2); } string full = commands[0]; commands.RemoveRange(0, 2); foreach (string word in commands) { itemName.Append(word + " "); } List <Items.Iitem> items = Items.Items.GetByName(itemName.ToString().Trim(), player.UserID); msgPlayer = null; //players need to specify an indexer or we will just give them the first one we found that matched Items.Iitem item = items[itemPosition - 1]; Items.Iweapon weapon = item as Items.Iweapon; if (item != null && item.IsWearable) { player.Player.Equipment.EquipItem(item, player.Player.Inventory); if (item.ItemType.ContainsKey(Items.ItemsType.CONTAINER)) { Items.Icontainer container = item as Items.Icontainer; container.Wear(); } if (item.ItemType.ContainsKey(Items.ItemsType.CLOTHING)) { Items.Iclothing clothing = item as Items.Iclothing; clothing.Wear(); } msgOthers = string.Format("{0} equips {1}.", player.Player.FirstName, item.Name); msgPlayer = string.Format("You equip {0}.", item.Name); } else if (weapon.IsWieldable) { msgPlayer = "This item can only be wielded not worn."; } else if (!item.IsWearable || !weapon.IsWieldable) { msgPlayer = "That doesn't seem like something you can wear."; } else { msgPlayer = "You don't seem to have that in your inventory to be able to wear."; } } player.MessageHandler(msgPlayer); Room.GetRoom(player.Player.Location).InformPlayersInRoom(msgOthers, new List <string>(new string[] { player.UserID })); }