示例#1
0
        public static void Body(PlayerSetup.Player player, Room.Room room, string commandOptions)
        {
            if (string.IsNullOrEmpty(commandOptions))
            {
                return;
            }

            var foundCorpse = room.items.FirstOrDefault(x => x.name.ToLower().Contains(commandOptions.ToLower()));

            if (foundCorpse == null)
            {
                HubContext.Instance.SendToClient("No corpse found.", player.HubGuid);
                return;
            }

            var corpseName = foundCorpse.name.ToLower();
            var corpse     = string.Empty;

            if (corpseName.Contains("decayed"))
            {
                corpse = corpseName.Replace("the decayed corpse of ", "");
            }
            else if (corpseName.Contains("rotting"))
            {
                corpse = corpseName.Replace("the rotting corpse of ", "");
            }
            else
            {
                corpse = corpseName.Replace("the corpse of ", "");
            }


            var carveMessage = "You carve " + corpse + " retrieving ";
            var bodyPart     = GetBodyPart();

            HubContext.Instance.SendToClient(carveMessage + Helpers.ReturnName(null, null, bodyPart).ToLower() + ".", player.HubGuid);

            if (bodyPart == "nothing")
            {
                return;
            }

            if (foundCorpse.KnownByName)
            {
            }

            var bodybit = new Item.Item()
            {
                name      = corpse + " " + bodyPart,
                location  = Item.Item.ItemLocation.Inventory,
                slot      = Item.Item.EqSlot.Held,
                eqSlot    = Item.Item.EqSlot.Held,
                equipable = true,
            };

            if (foundCorpse.KnownByName)
            {
                bodybit.KnownByName = true;
            }

            PlayerSetup.Player.AddItem(player, bodybit);

            Score.UpdateUiInventory(player);

            if (room.items.FirstOrDefault(x => x.name.ToLower().Contains(commandOptions)) != null)
            {
                room.items.Remove(foundCorpse);
            }
        }
示例#2
0
        public static async Task CraftItem(PlayerSetup.Player player, Room.Room room, Craft craftItem)
        {
            //add skill check here
            var getSkill = player.Skills.FirstOrDefault(x => x.Alias.Equals(craftItem.CraftCommand.ToString()));

            if (getSkill == null)
            {
                HubContext.Instance.SendToClient("You don't know how to do that", player.HubGuid);
                return;
            }


            if (player.MovePoints < craftItem.MoveCost)
            {
                if (craftItem.CraftCommand == CraftType.Chop || craftItem.CraftCommand == CraftType.Brew)
                {
                    HubContext.Instance.SendToClient("You are too tired to make " + Helpers.ReturnName(null, null, craftItem.CreatesItem.name).ToLower() + ".", player.HubGuid);
                    return;
                }



                HubContext.Instance.SendToClient("You are too tired to make " + Helpers.ReturnName(null, null, craftItem.Name).ToLower() + ".", player.HubGuid);
                return;
            }

            player.MovePoints -= craftItem.MoveCost;



            var successChance = ShowSkills.CraftSuccess(getSkill.Points);

            if (getSkill.Points >= successChance)
            {
                //success
                if (player.ActiveSkill != null)
                {
                    HubContext.Instance.SendToClient("wait till you have finished " + player.ActiveSkill.Name,
                                                     player.HubGuid);
                    return;
                }

                player.ActiveSkill = getSkill;

                var oldRoom = room;
                HubContext.Instance.SendToClient(craftItem.StartMessage, player.HubGuid);

                await Task.Delay(1500);

                foreach (var emote in craftItem.CraftingEmotes)
                {
                    HubContext.Instance.SendToClient(emote, player.HubGuid);


                    await Task.Delay(2000);
                }

                HubContext.Instance.SendToClient(craftItem.SuccessMessage, player.HubGuid);


                if (craftItem.Materials != null)
                {
                    foreach (var materials in craftItem.Materials)
                    {
                        for (var i = 0; i < materials.Count; i++)
                        {
                            var item = player.Inventory.FirstOrDefault(x => x.name.ToLower()
                                                                       .Contains(materials.Name.ToLower()));

                            player.Inventory.Remove(item);
                        }
                    }
                }

                if (craftItem.CraftAppearsInRoom)
                {
                    room.items.Add(craftItem.CreatesItem);
                }

                if (!craftItem.CraftAppearsInRoom)
                {
                    PlayerSetup.Player.AddItem(player, craftItem.CreatesItem);
                }


                Score.UpdateUiInventory(player);

                Cache.updateRoom(room, oldRoom);

                player.ActiveSkill = null;
            }
            else
            {
                var failMessage = craftItem.FailureMessages[Helpers.Rand(1, craftItem.FailureMessages.Count)];

                HubContext.Instance.SendToClient(failMessage.Message,
                                                 player.HubGuid);

                if (failMessage.BreakMaterial)
                {
                    var item = player.Inventory.FirstOrDefault(x => x.name.ToLower().Contains(craftItem
                                                                                              .Materials[Helpers.Rand(1, craftItem.Materials.Count)].Name.ToLower()));

                    player.Inventory.Remove(item);
                }

                var xp = new Experience();



                if (getSkill != null)
                {
                    if (player.ChosenCraft == craftItem.CraftCommand.ToString())
                    {
                        getSkill.Points += Helpers.Rand(1, 10);


                        HubContext.Instance.SendToClient("<p class='roomExit'>You learn from your mistakes and gain 100 experience points.</p>",
                                                         player.HubGuid);

                        player.Experience += 100;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(player.ChosenCraft) && getSkill.Points <= 99)
                        {
                            HubContext.Instance.SendToClient("<p class='roomExit'>You learn from your mistakes and gain 100 experience points.</p>",
                                                             player.HubGuid);

                            player.Experience += 100;


                            getSkill.Points += Helpers.Rand(1, 10);

                            if (getSkill.Points > 99)
                            {
                                var rankWarning = ShowSkills.checkRank(getSkill.Points, player);
                                HubContext.Instance.SendToClient(rankWarning,
                                                                 player.HubGuid);

                                getSkill.Points = 99;
                            }
                        }
                        else if (getSkill.Points <= 99)
                        {
                            HubContext.Instance.SendToClient("<p class='roomExit'>You learn from your mistakes and gain 100 experience points.</p>",
                                                             player.HubGuid);

                            player.Experience += 100;


                            getSkill.Points += Helpers.Rand(1, 10);

                            if (getSkill.Points > 99)
                            {
                                getSkill.Points = 99;
                            }
                        }
                    }
                }

                Score.ReturnScoreUI(player);


                xp.GainLevel(player);
            }
        }
示例#3
0
        public static void Say(string message, Player player, Room room)
        {
            string playerId = player.HubGuid;

            HubContext.Instance.SendToClient($"<span class='sayColor'>You say, \"{message}\"</span>", playerId, null, false, false);

            Score.UpdateUIChannels(player, $"<span class='sayColor'>You say, \"{message}\"</span>", "roomChannelF");

            foreach (var character in room.players)
            {
                if (player != character)
                {
                    var roomMessage = $"<span class='sayColor'>{ Helpers.ReturnName(player, character, string.Empty)} says \"{message}\"</span>";

                    Score.UpdateUIChannels(character, $"<span class='sayColor'>{ Helpers.ReturnName(player, character, string.Empty)} says \"{message}\"</span>", "roomChannelF");

                    HubContext.Instance.SendToClient(roomMessage, character.HubGuid);
                }
            }


            //check npc response
            foreach (var mob in room.mobs)
            {
                var       response              = string.Empty;
                var       responseEmote         = string.Empty;
                var       responseGiveItemEmote = string.Empty;
                Item.Item responseGiveItem      = null;
                Skill     responseGiveSkill     = null;
                var       hasQuest              = false;
                var       questId = 0;
                var       GivePrerequisiteItem = false;

                if (mob.Dialogue != null)
                {
                    foreach (var dialogue in mob.Dialogue)
                    {
                        foreach (var keyword in dialogue.Keyword)
                        {
                            if (message.Contains(keyword))
                            {
                                response      = dialogue.Response;
                                responseEmote = dialogue.DoEmote;
                            }
                        }
                    }
                }



                if (response == string.Empty)
                {
                    if (mob.DialogueTree != null)
                    {
                        foreach (var tree in mob.DialogueTree)
                        {
                            if (message.Equals(tree.MatchPhrase))
                            {
                                responseGiveItem      = tree.GiveItem;
                                responseGiveItemEmote = tree.GiveItemEmote;
                                response          = tree.Message;
                                responseGiveSkill = tree.GiveSkill;
                                if (tree.GiveQuest != null)
                                {
                                    hasQuest = (bool)tree.GiveQuest;
                                }
                                if (tree.GivePrerequisiteItem != null)
                                {
                                    GivePrerequisiteItem = (bool)tree.GivePrerequisiteItem;
                                }
                                if (tree.QuestId != null)
                                {
                                    questId = (int)tree.QuestId;
                                }
                            }
                        }
                    }
                }

                if (response != String.Empty)
                {
                    Thread.Sleep(120); // hack, sometimes the responses calls before the questions??

                    HubContext.Instance.SendToClient("<span class='sayColor'>" + mob.Name + " says to you \"" + response.Replace("$playerName", player.Name) + "\"<span>", playerId);

                    Score.UpdateUIChannels(player, "<span class='sayColor'>" + mob.Name + " says to you \"" + response.Replace("$playerName", player.Name) + "\"<span>", "roomChannelF");



                    if (!string.IsNullOrEmpty(responseEmote))
                    {
                        HubContext.Instance.SendToClient(player.Name + " " + responseEmote, playerId);
                    }

                    if (!string.IsNullOrEmpty(responseGiveItemEmote))
                    {
                        HubContext.Instance.SendToClient(responseGiveItemEmote, playerId);
                    }

                    if (responseGiveItem != null)
                    {
                        Player.AddItem(player, responseGiveItem);
                        Score.UpdateUiInventory(player);
                    }

                    if (responseGiveSkill != null)
                    {
                        player.Skills.Add(responseGiveSkill);
                        HubContext.Instance.SendToClient("You have learned " + responseGiveSkill.Name, playerId);
                    }



                    //check branch to show responses from
                    var speak = mob.DialogueTree.FirstOrDefault(x => x.Message.Equals(response));


                    foreach (var respond in speak.PossibleResponse)
                    {
                        var textChoice =
                            "<a class='multipleChoice' href='javascript:void(0)' onclick='$.connection.mIMHub.server.recieveFromClient(\"say " +
                            respond.Response + "\",\"" + player.HubGuid + "\")'>[say, " + respond.Response +
                            "]</a>";
                        HubContext.Instance.AddNewMessageToPage(player.HubGuid, textChoice);
                    }


                    if (hasQuest)
                    {
                        //find quest
                        var quest = mob.Quest.FirstOrDefault(x => x.Id.Equals(questId));

                        var playerHasQuest = player.QuestLog.FirstOrDefault(x => quest != null && x.Name.Equals(quest.Name));

                        if (playerHasQuest == null)
                        {
                            //to player log
                            player.QuestLog.Add(quest);
                            Score.UpdateUiQlog(player);

                            HubContext.Instance.SendToClient("<span class='questColor'>Quest Added:<br />" + quest.Name + " </span> ", playerId);

                            if (GivePrerequisiteItem)
                            {
                                HubContext.Instance.SendToClient(quest.PrerequisiteItemEmote, playerId);

                                foreach (var qitem in quest.PrerequisiteItem)
                                {
                                    HubContext.Instance.SendToClient(mob.Name + " gives you " + Helpers.ReturnName(null, null, qitem.name), playerId);

                                    Player.AddItem(player, qitem);
                                }

                                Score.UpdateUiInventory(player);

                                foreach (var character in room.players)
                                {
                                    if (player != character)
                                    {
                                        var roomMessage = $"{ Helpers.ReturnName(mob, character, string.Empty)}  {quest.PrerequisiteItemEmote}";

                                        HubContext.Instance.SendToClient(roomMessage, character.HubGuid);
                                    }
                                }
                            }
                        }
                    }
                }


                else
                {
                    //generic responses?
                }

                if (mob.EventOnComunicate.Count > 0)
                {
                    var triggerEvent = mob.EventOnComunicate.FirstOrDefault(x => x.Value.Equals("yes"));

                    Event.ParseCommand(triggerEvent.Key, player, mob, room, "yes", "player");
                }
            }
        }
示例#4
0
        public static void RepairItem(PlayerSetup.Player player, Room.Room room, string commandOptions)
        {
            var hasSkill = player.Skills.FirstOrDefault(x => x.Name.Equals("Repair"));

            if (hasSkill == null)
            {
                HubContext.Instance.SendToClient("You don't know how to do that.", player.HubGuid);
                return;
            }


            if (string.IsNullOrEmpty(commandOptions))
            {
                return;
            }

            var item         = FindNth.Findnth(commandOptions);
            var foundItem    = FindItem.Item(player.Inventory, item.Key, item.Value, Item.Item.ItemLocation.Inventory);
            var repairHammer =
                player.Inventory.FirstOrDefault(x => x.name.ToLower().Contains(player.Equipment.Held.ToLower()));

            if (foundItem == null)
            {
                HubContext.Instance.SendToClient("You don't have " + Helpers.ReturnName(null, null, item.Value), player.HubGuid);
                return;
            }

            if (foundItem.Condition >= 75)
            {
                HubContext.Instance.SendToClient("You can't improve " + Helpers.ReturnName(null, null, foundItem.name) + " any further.", player.HubGuid);
                return;
            }

            if (repairHammer != null && repairHammer.type == Item.Item.ItemType.Repair)
            {
                var chance = Helpers.Rand(1, 100);

                if (hasSkill.Proficiency >= chance)
                {
                    foundItem.Condition += Helpers.Rand(10, 25);

                    HubContext.Instance.SendToClient(Helpers.ReturnName(null, null, item.Value) + " looks to be in a better condition.", player.HubGuid);

                    if (foundItem.Condition > 0)
                    {
                        var iname = Helpers.FirstLetterToUpper(foundItem.name.ToLower().Replace("broken", String.Empty)
                                                               .Trim());
                        foundItem.name = iname;
                    }

                    if (foundItem.Condition >= 75)
                    {
                        var removeBrokenFromName = foundItem.name.ToLower().Replace("broken ", String.Empty).Trim();
                        foundItem.name      = Helpers.FirstLetterToUpper(removeBrokenFromName);
                        foundItem.Condition = 75;
                        HubContext.Instance.SendToClient(Helpers.ReturnName(null, null, item.Value) + " has been fully repaired.", player.HubGuid);

                        Score.UpdateUiInventory(player);
                        return;
                    }

                    repairHammer.Uses -= 1;
                }
                else
                {
                    HubContext.Instance.SendToClient("You fail to improve the condition of " + Helpers.ReturnName(null, null, item.Value), player.HubGuid);
                    PlayerSetup.Player.LearnFromMistake(player, hasSkill, 100);
                }



                if (repairHammer.Uses <= 0)
                {
                    HubContext.Instance.SendToClient("The repair hammer falls to pieces in your hand.", player.HubGuid);
                    player.Inventory.Remove(repairHammer);
                    player.Equipment.Held = "Nothing";
                }

                Score.UpdateUiInventory(player);
                Score.ReturnScoreUI(player);
            }
            else
            {
                HubContext.Instance.SendToClient("You need to equip a repair hammer", player.HubGuid);
                return;
            }
        }
示例#5
0
        /// <summary>
        /// Drops item from player inventory
        /// </summary>
        /// <param name="room">room object</param>
        /// <param name="player">player object</param>
        /// <param name="userInput">text entered by user</param>
        /// <param name="commandKey">command entered</param>
        public static void GiveItem(Room room, Player player, string userInput, string commandKey, string type)
        {
            var currentRoom   = room;
            var currentPlayer = player;

            string[] all        = userInput.Split();
            var      itemToGive = all[0];
            var      thing      = all.Last();
            var      item       = itemToGive;

            var foundItem  = player.Inventory.FirstOrDefault(x => item != null && x.name.StartsWith(item, StringComparison.CurrentCultureIgnoreCase));
            var foundThing = room.players.FirstOrDefault(x => thing != null && x.Name.StartsWith(thing, StringComparison.CurrentCultureIgnoreCase)) ??
                             room.mobs.FirstOrDefault(x => thing != null && x.Name.StartsWith(thing, StringComparison.CurrentCultureIgnoreCase));

            if (all[0].Equals("all", StringComparison.InvariantCultureIgnoreCase))
            {
                var playerInv      = player.Inventory;
                var playerInvCount = player.Inventory.Count;

                for (int i = playerInvCount - 1; i >= 0; i--)
                {
                    if (foundThing != null)
                    {
                        foundThing.Inventory.Add(playerInv[i]);


                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players,
                                                                     "You give a " + playerInv[i].name + " to " + foundThing.Name,
                                                                     player.Name + " gives a " + playerInv[i].name + " to " + foundThing.Name);

                        player.Inventory.Remove(playerInv[i]);
                    }
                }
            }
            else
            {
                if (foundThing == null)
                {
                    HubContext.SendToClient("You don't see " + thing + " here.", player.HubGuid);
                    return;
                }

                if (foundItem == null)
                {
                    HubContext.SendToClient("You are not carrying a " + item, player.HubGuid);
                    return;
                }

                player.Inventory.Remove(foundItem);
                foundThing.Inventory.Add(foundItem);


                BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players,
                                                             "You give a " + foundItem.name + " to " + foundThing.Name,
                                                             player.Name + " gives a " + foundItem.name + " to " + foundThing.Name);

                //check quest

                foreach (var quest in player.QuestLog)
                {
                    if (!quest.Completed && quest.Type == Quest.QuestType.FindMob)
                    {
                        //Find quest requires player to give item to the mob.

                        if (quest.QuestGiver == foundThing.Name && quest.QuestItem.name == foundItem.name)
                        {
                            // player completed quest

                            var mobQuest = foundThing.Quest.FirstOrDefault(x => x.Id.Equals(quest.Id));
                            if (mobQuest != null)
                            {
                                HubContext.SendToClient(
                                    foundThing.Name + " says to you " + mobQuest.RewardDialog.Message.Replace("$playerName", player.Name), player.HubGuid,
                                    null, true);
                            }

                            //award player
                        }
                    }
                }
            }

            //save to cache
            Cache.updateRoom(room, currentRoom);
            Cache.updatePlayer(player, currentPlayer);
            Score.UpdateUiInventory(player);
            var roomdata = LoadRoom.DisplayRoom(room, player.Name);

            Score.UpdateUiRoom(player, roomdata);
        }
示例#6
0
        /// <summary>
        /// Drops item from player inventory
        /// </summary>
        /// <param name="room">room object</param>
        /// <param name="player">player object</param>
        /// <param name="userInput">text entered by user</param>
        /// <param name="commandKey">command entered</param>
        public static void DropItem(Room room, Player player, string userInput, string commandKey)
        {
            var currentRoom   = room;
            var currentPlayer = player;

            string[] all          = userInput.Split();
            var      returnedItem = (KeyValuePair <Item, Item>)FindObject(room, player, commandKey, userInput, FindInventory);
            var      container    = returnedItem.Key;
            var      item         = returnedItem.Value;

            if (all[0].Equals("all", StringComparison.InvariantCultureIgnoreCase))
            {
                var playerInv      = player.Inventory;
                var playerInvCount = player.Inventory.Count;

                for (int i = playerInvCount - 1; i >= 0; i--)
                {
                    playerInv[i].location = Item.ItemLocation.Room;


                    if (container == null)
                    {
                        playerInv[i].location       = Item.ItemLocation.Room;
                        playerInv[i].isHiddenInRoom = false;
                        room.items.Add(playerInv[i]);


                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "You drop a " + playerInv[i].name, player.Name + " drops a " + playerInv[i].name);

                        player.Inventory.Remove(playerInv[i]);
                    }
                    else
                    {
                        if (container.locked == true)
                        {
                            BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "Container is locked", player.Name + " container is locked");

                            return;
                        }

                        if (container.open == false)
                        {
                            HubContext.SendToClient("You have to open the " + container.name + " before you can put something inside", player.HubGuid);
                            return;
                        }

                        container.containerItems.Add(playerInv[i]);

                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "You drop a " + playerInv[i].name + " into a " + container.name, player.Name + " drops a " + playerInv[i].name + " into a " + container.name);

                        player.Inventory.Remove(playerInv[i]);
                    }
                }
            }
            else
            {
                if (item == null)
                {
                    return;
                }



                if (container == null)
                {
                    player.Inventory.Remove(item);
                    item.location = Item.ItemLocation.Room;
                    room.items.Add(item);

                    BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "You drop  a " + item.name, player.Name + " drops  a " + item.name);
                }
                else
                {
                    if (container.locked == true)
                    {
                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "Container is locked", player.Name + " container is locked");

                        return;
                    }

                    if (container.open == false)
                    {
                        HubContext.SendToClient("You have to open the " + container.name + " before you can put something inside", player.HubGuid);
                        return;
                    }

                    player.Inventory.Remove(item);
                    item.location = Item.ItemLocation.Room;
                    container.containerItems.Add(item);

                    BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "You put a " + item.name + " inside the " + container.name, player.Name + " puts a " + item.name + " inside the " + container.name);
                }
            }

            //save to cache
            Cache.updateRoom(room, currentRoom);
            Cache.updatePlayer(player, currentPlayer);
            Score.UpdateUiInventory(player);
            var roomdata = LoadRoom.DisplayRoom(room, player.Name);

            Score.UpdateUiRoom(player, roomdata);
        }
示例#7
0
        /// <summary>
        /// Adds item from room to player inventory
        /// </summary>
        /// <param name="room">Room Object</param>
        /// <param name="player">Player Object</param>
        /// <param name="userInput">Text user entered</param>
        public static void GetItem(Room room, Player player, string userInput, string commandKey, string type)
        {
            //TODO handle container
            var currentRoom   = room;
            var currentPlayer = player;

            string[] all = userInput.Split();

            if (all[0] == "all")
            {
                type = "all";
            }


            var returnedItem = (KeyValuePair <Item, Item>)FindObject(room, player, commandKey, userInput, type);
            var container    = returnedItem.Key;
            var item         = returnedItem.Value;


            if (all[0].Equals("all", StringComparison.InvariantCultureIgnoreCase) && all.Length == 1)
            {
                var roomItems      = room.items;
                var roomItemsCount = roomItems.Count;

                for (int i = roomItemsCount - 1; i >= 0; i--)
                {
                    if (!roomItems[i].stuck)
                    {
                        //Get all Items from the room
                        if (roomItems[i].type != Item.ItemType.Gold)
                        {
                            roomItems[i].location = Item.ItemLocation.Inventory;
                            player.Inventory.Add(roomItems[i]);

                            BroadcastPlayerAction.BroadcastPlayerActions(
                                player.HubGuid,
                                player.Name,
                                room.players,
                                "You pick up a " + roomItems[i].name,
                                player.Name + " picks up a " + roomItems[i].name);
                            room.items.Remove(roomItems[i]);
                        }
                        else
                        {
                            player.Gold += roomItems[i].count;

                            BroadcastPlayerAction.BroadcastPlayerActions(
                                player.HubGuid,
                                player.Name,
                                room.players,
                                "You pick up " + roomItems[i].count + " " + roomItems[i].name,
                                player.Name + " picks up a " + roomItems[i].name);

                            room.items.Remove(roomItems[i]);
                        }
                    }
                    else
                    {
                        HubContext.SendToClient("You can't take that", player.HubGuid);
                    }
                }
            }
            else if (all[0].Equals("all", StringComparison.InvariantCultureIgnoreCase) && container != null)
            {
                if (container.locked == true)
                {
                    BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "Container is locked", player.Name + " container is locked");

                    return;
                }
                //get all from container
                var containerItems = container.containerItems;
                var containerCount = containerItems.Count;

                for (int i = containerCount - 1; i >= 0; i--)
                {
                    if (containerItems[i].type != Item.ItemType.Gold)
                    {
                        containerItems[i].location = Item.ItemLocation.Inventory;
                        player.Inventory.Add(containerItems[i]);

                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players,
                                                                     "You get a " + containerItems[i].name + " from a " + container.name,
                                                                     player.Name + " get a " + containerItems[i].name + " from a " + container.name);

                        containerItems.Remove(containerItems[i]);
                    }
                    else
                    {
                        player.Gold += containerItems[i].count;

                        BroadcastPlayerAction.BroadcastPlayerActions(
                            player.HubGuid,
                            player.Name,
                            room.players,
                            "You pick up " + item.count + " " + item.name + " from a " + container.name,
                            player.Name + " picks up a " + item.name + containerItems[i].name + " from a " + container.name);



                        containerItems.Remove(containerItems[i]);
                    }
                }
            }

            else if (item != null)
            {
                //get single Item

                if (container == null)
                {
                    if (!item.stuck)
                    {
                        if (item.type != Item.ItemType.Gold)
                        {
                            room.items.Remove(item);
                            item.location = Item.ItemLocation.Inventory;
                            player.Inventory.Add(item);


                            BroadcastPlayerAction.BroadcastPlayerActions(
                                player.HubGuid,
                                player.Name,
                                room.players,
                                "You pick up a " + item.name,
                                player.Name + " picks up a " + item.name);
                        }
                        else
                        {
                            room.items.Remove(item);
                            player.Gold += item.count;

                            BroadcastPlayerAction.BroadcastPlayerActions(
                                player.HubGuid,
                                player.Name,
                                room.players,
                                "You pick up " + item.count + " " + item.name,
                                player.Name + " picks up a " + item.name);
                        }
                    }
                    else
                    {
                        HubContext.SendToClient("You can't take that", player.HubGuid);
                    }
                }
                else
                {
                    if (container.locked == true)
                    {
                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "Container is locked", player.Name + " container is locked");

                        return;
                    }

                    //Get item from container

                    if (item.type != Item.ItemType.Gold)
                    {
                        container.containerItems.Remove(item);
                        container.location = Item.ItemLocation.Inventory;
                        player.Inventory.Add(item);

                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players,
                                                                     "You get a " + item.name + " from " + container.name,
                                                                     player.Name + " gets a " + item.name + " from " + container.name);
                    }
                    else
                    {
                        container.containerItems.Remove(item);

                        player.Gold += item.count;

                        BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "You get " + item.count + " " + item.name + "coin from a " + container.name, player.Name + " gets a " + item.name + " from a " + container.name);
                    }
                }
            }
            else
            {
                BroadcastPlayerAction.BroadcastPlayerActions(player.HubGuid, player.Name, room.players, "There is nothing here to pick up", player.Name + " searches for something to pick up");
                return;
            }

            //save to cache
            Cache.updateRoom(room, currentRoom);
            Cache.updatePlayer(player, currentPlayer);
            Score.UpdateUiInventory(player);
            var roomdata = LoadRoom.DisplayRoom(room, player.Name);

            Score.UpdateUiRoom(player, roomdata);
        }