Beispiel #1
0
        public bool Execute(Player player)
        {
            string itemName = "";

            //this allows for an unlimited number of words
            while (QWords.Count > 0)
            {
                itemName += QWords.Dequeue() + " ";
            }
            itemName = itemName.TrimEnd();

            if (player.Bag.CheckForItem(itemName) == false)
            {
                player.OutputMessage("\nYou don't have this item");
            }
            else if (itemName == "bag")
            {
                player.OutputMessage("\nYou shouldn't sell your bag");
            }
            else
            {
                if (player.Bag.CheckForItem(itemName) == true)
                {
                    IItem item = player.Take(itemName);
                    player.GetMoney(item.SellPrice);
                    player.OutputMessage("\nYou recieved " + item.SellPrice + " money");
                }
            }
            return(false);
        }
Beispiel #2
0
        public bool Execute(Player player)
        {
            string grabItem = "";

            if (QWords.Count == 0)
            {
                player.OutputMessage("\nWhat would you like to pick up?");
            }
            if (player.Bag == null)
            {
                player.OutputMessage("\nYou have nowhere to store this item.");
            }
            else
            {
                //this allows for an unlimited number of words
                while (QWords.Count > 0)
                {
                    grabItem += QWords.Dequeue() + " ";
                }
                grabItem = grabItem.TrimEnd();
                player.PickUp(grabItem);
                player.OutputMessage(player.CurrentRoom.Description());
            }
            return(false);
        }
Beispiel #3
0
        public bool Execute(Player player)
        {
            string lockedDoor = "";

            if (QWords.Count == 0)
            {
                player.OutputMessage("\nOpen What?");
            }
            else
            {
                while (QWords.Count > 0)
                {
                    lockedDoor += QWords.Dequeue() + " ";
                }
                lockedDoor = lockedDoor.TrimEnd();
                player.Open(lockedDoor);

                if (lockedDoor == "boss lair")
                {
                    player.OutputMessage("****");
                    player.OutputMessage("You enter the boss room and fight a grueling fight against the terror in the cave, and save the princess. You then leave the dungeon and collect your reward.");
                    player.OutputMessage("****");
                    return(true);
                }
            }
            return(false);
        }
Beispiel #4
0
        public bool Execute(Player player)
        {
            string inspect = "";

            if (QWords.Count == 0)
            {
                player.OutputMessage("\nInspect What?");
            }
            else
            {
                while (QWords.Count > 0)
                {
                    inspect += QWords.Dequeue() + " ";
                }
                inspect = inspect.TrimEnd();
                player.Inspect(inspect);
            }
            return(false);
        }
Beispiel #5
0
        public bool Execute(Player player)
        {
            string rooms = "";

            if (QWords.Count == 0)
            {
                player.OutputMessage("\nGo Where?");
            }
            else
            {
                //this allows for an unlimited number of words
                while (QWords.Count > 0)
                {
                    rooms += QWords.Dequeue() + " ";
                }
                rooms = rooms.TrimEnd();
                player.WaltTo(rooms);
            }
            return(false);
        }
Beispiel #6
0
        public bool Execute(Player player)
        {
            string dropItem = "";

            if (QWords.Count == 0)
            {
                player.OutputMessage("\nDrop What?");
            }
            else
            {
                //this allows for an unlimited number of words
                while (QWords.Count > 0)
                {
                    dropItem += QWords.Dequeue() + " ";
                }
                dropItem = dropItem.TrimEnd();
                player.Take(dropItem);
                player.OutputMessage(player.CurrentRoom.Description());
            }
            return(false);
        }
Beispiel #7
0
        public bool Execute(Player player)
        {
            if (QWords.Count > 0)
            {
                string itemName = "";
                //this allows for an unlimited number of words
                while (QWords.Count > 0)
                {
                    itemName += QWords.Dequeue() + " ";
                }
                itemName = itemName.TrimEnd();

                BlackSmith character = (BlackSmith)player.CurrentRoom.GetNpc("blacksmith");
                if (character != null)
                {
                    IItem item = null;
                    character.Inventory.TryGetValue(itemName, out item);
                    if (item != null)
                    {
                        if (player.Bag.SpaceInBag(item) && player.EnoughMoney(item.BuyPrice))
                        {
                            player.BuyItem(item.BuyPrice);
                            player.Bag.AddItem(item);
                            NotificationCenter.Instance.PostNotification(new Notification("BuyMessage"));
                        }
                    }
                    else
                    {
                        player.OutputMessage("I ain't got that. Here is what do got.");
                        NotificationCenter.Instance.PostNotification(new Notification("ViewGoods", this));
                    }
                }
            }
            else
            {
                player.OutputMessage("\nWhat would you like to buy?");
                NotificationCenter.Instance.PostNotification(new Notification("ViewGoods", this));
            }
            return(false);
        }