Beispiel #1
0
        private void createLocations()
        {
            startUp =
                new Location("an office with paper strewn everywhere, how anyone works effectively here is a mystery",
                    "Julies Office");
            Location lounge =
                new Location("an open space containing comfortable looking couches and artwork of dubious quality",
                    "Airport Lounge");
            Shop shop = new Shop("Some shop", "Shop");
            Location t127 = new Location("a lecture theatre", "T127");
            Location gregsoffice = new Location("a spinning vortex of terror", "Greg's Office");

            startUp.AddExit("south", new Exit("you see an open space to the south", lounge));
            lounge.AddExit("north", new Exit("you see a mound of paper to the north", startUp));
            startUp.AddExit("east", new Exit("you see a shop in the east", shop));
            shop.AddExit("west", new Exit("you see a mound of paper to the west", startUp));

            Key gregKey = new Key(10, 5, "Key Greg's office");
            Key dummyKey = new Key(5, 5, "Dumb key");
            shop.Items.Add("gregkey", gregKey);
            shop.Items.Add("dummykey", dummyKey);

            startUp.AddExit("west", new Exit("you see a terrifying office to the west", gregsoffice));
            gregsoffice.AddExit("east", new Exit("you see a mound of paper to the east", startUp));

            t127.AddExit("south", new Exit("you see a mound of paper to the south", startUp));
            startUp.AddExit("north", new Exit("you see a bleak place to the north", t127));

            lounge.AddExit("northwest", new Exit("you see a terrifying office to the northwest", gregsoffice));
            gregsoffice.AddExit("southeast", new Exit("you see an open space to the southeast", lounge));

            gregsoffice.Locked = true;
            gregKey.Location = gregsoffice;
        }
Beispiel #2
0
        public static String displayItems(Player player, Shop shop)
        {
            StringBuilder returnMsg = new StringBuilder();

            foreach (String key in shop.Items)
            {
                returnMsg.Append(key + " " + shop.Items[key].ToString());
            }

            returnMsg.Append("\n\nItems in inventory:\n\n");

            foreach (String key in player.Inventory)
            {
                returnMsg.Append(key + " " + player.Inventory[key].ToString());
            }

            return returnMsg.ToString();
        }
Beispiel #3
0
        public override CommandResponse Execute(ParsedInput userInput, Player thePlayer)
        {
            Hashtable inventory = new Hashtable();
            Shop shop = new Shop();

            if (userInput.Arguments.Count == 0)
            {
                return new CommandResponse("If you want to sell something need to tell me what");
            }

            String itemLabel = (String)userInput.Arguments[0];
            shop = (Shop)thePlayer.CurrentLocation;
            Item desiredItem = (Item)thePlayer.Inventory[itemLabel];

            if (desiredItem == null)
            {
                return new CommandResponse("There is no such item. Try buying something else!!");
            }

            shop.Items.Add(itemLabel, desiredItem);
            return new CommandResponse("You successfully sold " + itemLabel + " and find yourself somewhere else\n\n" + thePlayer.CurrentLocation.ToString());
        }
Beispiel #4
0
        private void CreateLocations()
        {
            startUp =
                new Location("an office with paper strewn everywhere, how anyone works effectively here is a mystery",
                    "Julies Office");
            lounge =
                new Location("an open space containing comfortable looking couches and artwork of dubious quality",
                    "Airport Lounge");

            Shop shop = new Shop("Some shop", "Shop");

            t127 = new Location("a lecture theatre", "T127");
            gregsOffice = new Location("a spinning vortex of terror", "Greg's Office");
            evansCave = new Shop("a crowded room full of technology related stuff", "Crazy Evan's Discount Technology");

            startUp.ExitCollection.AddExit("south", new Exit("you see an open space to the south", lounge));
            startUp.ExitCollection.AddExit("west", new Exit("you see a terrifying office to the west", gregsOffice));
            startUp.ExitCollection.AddExit("north", new Exit("you see a bleak place to the north", t127));

            lounge.ExitCollection.AddExit("north", new Exit("you see a mound of paper to the north", startUp));
            lounge.ExitCollection.AddExit("northwest", new Exit("you see a terrifying office to the northwest", gregsOffice));
            startUp.ExitCollection.AddExit("east", new Exit("you see a shop in the east", shop));
            shop.ExitCollection.AddExit("west", new Exit("you see a mound of paper to the west", startUp));

            t127.ExitCollection.AddExit("south", new Exit("you see a mound of paper to the south", startUp));

            gregsOffice.ExitCollection.AddExit("east", new Exit("you see a mound of paper to the east", startUp));
            gregsOffice.ExitCollection.AddExit("southeast", new Exit("you see an open space to the southeast", lounge));
            gregsOffice.ExitCollection.AddExit("west",
                new Exit("you see shiny stuff to the west.. it looks outdated, retro even", evansCave));

            evansCave.ExitCollection.AddExit("east", new Exit("you see a terrifying office to the east", gregsOffice));

            Key gregKey = new Key("gregkey", 10, 5, "Key Greg's office");
            Key dummyKey = new Key("dummykey",5, 5, "Dumb key");
            shop.Items.AddItem( gregKey);
            shop.Items.AddItem(dummyKey);
            gregsOffice.Locked = true;
            gregKey.Location = gregsOffice;
            lounge.CharacterList.Add("Fred", new NonPlayerCharacter("Fred"));
        }
Beispiel #5
0
 public void Init()
 {
     shop = new Shop();
     item = new Key("dummykey", 5, 5, "Dumb key");
     shop.Items.AddItem(item);
 }