public string LookAtIn(string thingId, IHaveInventory container)
 {
     if (container.Locate(thingId) != null)
     {
         return(container.Locate(thingId).FullDescription);
     }
     return("Could not find " + thingId);
 }
Exemplo n.º 2
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            if (container.Locate(thingId) != null)
            {
                return(container.Locate(thingId).FullDescription);
            }

            return($"I can't find the {thingId}");
        }
Exemplo n.º 3
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            if (container.Locate(thingId) != null)
            {
                return(container.Locate(thingId).LongDescription);
            }

            return("Could not find " + thingId + ".");
        }
Exemplo n.º 4
0
 private string LookAtIn(string thingId, IHaveInventory container)
 {
     if (container.Locate(thingId) != null)
     {
         return(container.Locate(thingId).FullDescription);
     }
     else
     {
         return("I can not find the " + thingId + ".");
     }
 }
Exemplo n.º 5
0
        public string LookAtIn(string thingId, IHaveInventory container)
        {
            if (container.Locate(thingId) == null)
            {
                return("I cannot find the " + thingId);
            }
            else
            {
                GameObject obj = container.Locate(thingId) as GameObject;

                return(obj.FullDescription);
            }
        }
Exemplo n.º 6
0
        private String TakeItemFrom(Player p, string thingId, IHaveInventory container)
        {
            if (container.Locate(thingId) == null)
            {
                return("Could not find " + thingId + "\r\n");
            }

            GameObject _itemFound  = container.Locate(thingId);
            Item       itemGrabbed = container.Take(thingId) as Item;

            if (itemGrabbed == null)
            {
                return("You can't take " + _itemFound.ShortDescription + " with you.\r\n");
            }
            p.Inventory.Put(itemGrabbed);

            return("You have taken the " + thingId + ".\r\n");
        }
Exemplo n.º 7
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            var thing = container.Locate(thingId);

            if (thing == null)
            {
                return(null);
            }
            return(thing.FullDescription);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Looks at in.
        /// </summary>
        /// <returns>The at in.</returns>
        /// <param name="p">P.</param>
        /// <param name="thingId">Thing identifier.</param>
        /// <param name="containerId">Container identifier.</param>
        private string LookAtIn(Player p, string thingId, string containerId)
        {
            IHaveInventory container = p.Locate(containerId) as IHaveInventory;

            if (container == null)
            {
                return("I cannot find the " + containerId);
            }
            else
            {
                if (container.Locate(thingId) != null)
                {
                    return(container.Locate(thingId).FullDescription);
                }
                else
                {
                    return("I cannot find the " + thingId + " in the " + containerId);
                }
            }
        }
Exemplo n.º 9
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            var result = container.Locate(thingId);

            if (result != null)
            {
                return(result.LongDescription);
            }
            else
            {
                return("");
            }
        }
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            GameObject obj = container.Locate(thingId);

            if (obj != null)
            {
                return(obj.FullDescription);
            }
            else
            {
                return($"I cannot find the {thingId} in the {container.Name}");
            }
        }
Exemplo n.º 11
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            GameObject itemFound = container.Locate(thingId);

            if (itemFound != null)
            {
                return(itemFound.FullDescription);
            }
            else
            {
                return("I cannot find the " + thingId + " in the " + container.Name);
            }
        }
Exemplo n.º 12
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            GameObject obj = container.Locate(thingId);

            if (obj != null)
            {
                return(obj.FullDescription);
            }
            else
            {
                string result = "I cannot find the " + thingId + " in the " + container.Name;
                return(result);
            }
        }
        private string TakeFrom(string thingId, Player player, IHaveInventory container)
        {
            GameObject obj = container.Locate(thingId);

            if (obj != null)
            {
                player.Inventory.Put(container.Inventory.Take(thingId) as Item);
                return($"You have taken {obj.Name} from {container.Name}");
            }
            else
            {
                return($"I cannot find the {thingId} in the {container.Name}");
            }
        }
Exemplo n.º 14
0
        private string TakeAndKeep(IHaveInventory container, Player p, string thingId)
        {
            GameObject i = container.Locate(thingId);

            if (i != null)
            {
                Item takenItem = container.Inventory.Take(thingId);
                p.Inventory.Put(takenItem);
                return(string.Format("  You have taken the {0} from the {1}", thingId, container.Name));
            }
            else
            {
                return(string.Format("  I cant find {0} in the {1}", thingId, container.Name));
            }
        }
        public string TakeItemFrom(Player p, string thingId, IHaveInventory container)
        {
            if (container.Locate(thingId) != null)
            {
                Item _item = container.Take(thingId) as Item;
                if (_item == null)
                {
                    return("Could not take " + thingId);
                }
                p.Inventory.Put(_item);

                return("You have taken the " + thingId + ".\r\n");
            }
            return("Could not find " + thingId);
        }
Exemplo n.º 16
0
        private string PutItem(Player p, string thingId, string containerId)
        {
            IHaveInventory container = FetchContainer(p, containerId);

            if (container == null)
            {
                return("I cannot find the " + containerId);
            }
            GameObject containerThing = container.Locate(thingId);

            if (containerThing == null)
            {
                return("I cannot find the " + thingId + (containerId == null ? "" : " in the " + containerId));
            }
            return(containerThing.FullDescription);
        }
Exemplo n.º 17
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            GameObject item = container.Locate(thingId);

            if (container.Name != "bag" && item == null)
            {
                return("I can't find the " + thingId);
            }
            else if (container.Name == "bag" && item == null)
            {
                return("I can't find the " + thingId + " in the bag");
            }
            else
            {
                return(item.FullDescription);
            }
        }
Exemplo n.º 18
0
 // Look inside a Container (as an Inventory) for an Item:
 public string LookAtIn(string thingId, IHaveInventory container)
 {
     if (container != null)
     {
         GameObject result = container.Locate(thingId);
         if (result != null)
         {
             return(result.ShortDescription);
         }
         else
         {
             return("I can't find the " + thingId);
         }
     }
     else
     {
         return("Container is null");
     }
 }
Exemplo n.º 19
0
        private string LookAtIn(string thingId, IHaveInventory container)
        {
            if (container != null)
            {
                GameObject itm = container.Locate(thingId);

                if (itm != null)
                {
                    return(itm.FullDescription);
                }
                else
                {
                    return("I can't find the " + thingId);
                }
            }
            else
            {
                return("I can't find the bag");
            }
        }
Exemplo n.º 20
0
        public string LookAtIn(Player p, string thingId, string containerId)
        {
            if (p.AreYou(thingId))
            {
                return(p.LongDesc);
            }

            GameObject     wantedItem      = null;
            IHaveInventory wantedInventory = p.Locate(containerId) as IHaveInventory;

            if (p.AreYou(containerId) || containerId == "")
            {
                wantedInventory = (IHaveInventory)p;
                //return p.LongDesc;
            }

            if (wantedInventory == null)
            {
                return("i cannot find the " + containerId);
            }

            wantedItem = wantedInventory.Locate(thingId);

            if (wantedItem == null)
            {
                if (containerId == "")
                {
                    return("i cannot find the " + thingId);
                }
                else
                {
                    return("i cannot find the " + thingId + " in " + containerId);
                }
            }

            return(wantedItem.LongDesc);
        }
Exemplo n.º 21
0
        public override string Execute(Player p, string[] text)
        {
            IHaveInventory Container   = null;
            string         ItemId      = null;
            string         ContainerId = null;
            int            TextLength  = text.Length;

            // The length of the text is either 3 or 5.
            if ((TextLength != 3) && (TextLength != 5) && (TextLength != 1))
            {
                return("I dont know how to look like that");
            }
            //Look at the location of the player
            if ((text[0] == "look") && (text.Length == 1))
            {
                return(p.Currentlocation.FullDescription);
            }
            //The first word must be "look".
            if (text[0] != "look")
            {
                return("Error in look input");
            }
            //The second word must be "at".
            if (text[1] != "at")
            {
                return("What do you want to look at?");
            }
            //If the text has 3 words, the container must be player p.
            if (TextLength == 3)
            {
                ContainerId = p.Name;
                Container   = p as IHaveInventory;
            }
            //If the length of text is 5, the fourth word must be "in".
            if (TextLength == 5)
            {
                if (text[3] == "in")
                {
                    ContainerId = text[4];
                    Container   = FetchContainer(p, ContainerId);
                }
                else
                {
                    return("What do you want to look in?");
                }
            }
            //The third word must be the ItemId
            ItemId = text[2];

            if (Container == null)
            {
                return("I cannot find the " + ContainerId);
            }

            if (Container.Locate(ItemId) == null)
            {
                return("I cannot find the " + ItemId + " in the " + ContainerId);
            }

            return(LookAtIn(ItemId, Container));
        }