예제 #1
0
        static TraderFactory()
        {
            Trader river = new Trader("River", "Trader.jpg");

            river.AddItemToInventory(ItemFactory.CreateGameItem(2002), 10);
            river.AddItemToInventory(ItemFactory.CreateGameItem(1004));

            Trader davidTheFarmer = new Trader("David the farmer", "Farmer.jpg");

            davidTheFarmer.AddItemToInventory(ItemFactory.CreateGameItem(1003));

            Trader florian = new Trader("Florian Flower", "Herbalist.jpg");

            florian.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            florian.AddItemToInventory(ItemFactory.CreateGameItem(2001), 40);

            Trader tore = new Trader("Tore the bug expert", "Tore.jpg");

            tore.AddItemToInventory(ItemFactory.CreateGameItem(1001), 2);
            tore.AddItemToInventory(ItemFactory.CreateGameItem(2003));

            AddTraderToList(river);
            AddTraderToList(davidTheFarmer);
            AddTraderToList(florian);
            AddTraderToList(tore);
        }
예제 #2
0
        static TraderFactory()
        {
            Trader oldLady = new Trader("Old Lady");

            oldLady.AddItemToInventory(ItemFactory.CreateItem(2004));
            oldLady.AddItemToInventory(ItemFactory.CreateItem(2003));
            oldLady.AddItemToInventory(ItemFactory.CreateItem(1000));

            AddTrader(oldLady);
        }
예제 #3
0
        static TraderFactory()
        {
            Trader hospitalVendingMachine = new Trader("Hospital Vending Machine");

            hospitalVendingMachine.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            hospitalVendingMachine.AddMultipleItemsToInventory(ItemFactory.CreateGameItem(2001), 20);

            AddTraderToList(hospitalVendingMachine);
        }
예제 #4
0
        static TraderFactory()
        {
            Trader Kiana = new Trader("Kiana");

            Kiana.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader Josh = new Trader("Josh");

            Josh.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader Joseph = new Trader("Joseph");

            Josh.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(Kiana);
            AddTraderToList(Josh);
            AddTraderToList(Joseph);
        }
예제 #5
0
        static TraderFactory()
        {
            Trader susan = new Trader("Pavla");

            susan.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader farmerTed = new Trader("Farmář Pepa");

            farmerTed.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader peteTheHerbalist = new Trader("Herbalista Péťa");

            peteTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            peteTheHerbalist.AddItemToInventory(SpellFactory.CreateSpell(1002));

            AddTraderToList(susan);
            AddTraderToList(farmerTed);
            AddTraderToList(peteTheHerbalist);
        }
예제 #6
0
        static TraderFactory()
        {
            Trader susan = new Trader("Susan");

            susan.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            susan.AddItemToInventory(ItemFactory.CreateGameItem(1999));

            Trader farmerTed = new Trader("Farmer Ted");

            farmerTed.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader peteTheHerbalist = new Trader("Pete the Herbalist");

            peteTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(susan);
            AddTraderToList(farmerTed);
            AddTraderToList(peteTheHerbalist);
        }
        static TraderFactory()
        {
            Trader captain = new Trader("Captain");

            captain.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader weaponsmith = new Trader("Weaponsmith");

            weaponsmith.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(captain);
            AddTraderToList(weaponsmith);
        }
예제 #8
0
        static TraderFactory()
        {
            Trader susan = new Trader("Susan");

            susan.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader ted = new Trader("Farmer Ted");

            ted.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader herbalistPete = new Trader("Herbalist Pete");

            herbalistPete.AddItemToInventory(ItemFactory.CreateGameItem(1001));
        }
예제 #9
0
        static TraderFactory()
        {
            Trader susan = new Trader(1, "Susan");

            susan.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            susan.AddItemToInventory(ItemFactory.CreateGameItem(123));
            susan.AddItemToInventory(ItemFactory.CreateGameItem(69));
            susan.AddItemToInventory(ItemFactory.CreateGameItem(9001));

            Trader farmerTed = new Trader(2, "Farmer Ted");

            farmerTed.AddItemToInventory(ItemFactory.CreateGameItem(666));
            farmerTed.AddItemToInventory(ItemFactory.CreateGameItem(9001));

            Trader peteTheHerbalist = new Trader(3, "Pete the ganja man");

            peteTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            peteTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(9001));

            AddTraderToList(susan);
            AddTraderToList(farmerTed);
            AddTraderToList(peteTheHerbalist);
        }
예제 #10
0
        //methods
        static TraderFactory()
        {
            Trader Ted = new Trader("Farmer Ted");

            Ted.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            Trader Susan = new Trader("Susan the Trader");

            Susan.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            Trader Pete = new Trader("Pete the Herbalist");

            Pete.AddItemToInventory(ItemFactory.CreateGameItem(1001));
            Traders.Add(Ted);
            Traders.Add(Susan);
            Traders.Add(Pete);
        }
예제 #11
0
        static TraderFactory()
        {
            Trader lou = new Trader("Lou");

            lou.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader pauline = new Trader("Farmer Pauline");

            pauline.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader myriam = new Trader("Myriam the Herbalist");

            myriam.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(lou);
            AddTraderToList(pauline);
            AddTraderToList(myriam);
        }
예제 #12
0
        private static readonly List <Trader> _traders = new List <Trader>(); //list of traders

        static TraderFactory()
        {
            Trader susan = new Trader("Susan"); //initialize trader, initialize inventory

            susan.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader farmerTed = new Trader("Farmer Ted");

            farmerTed.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader peteTheHerbalist = new Trader("Pete the Herbalist");

            peteTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(susan); //add trader to the list
            AddTraderToList(farmerTed);
            AddTraderToList(peteTheHerbalist);
        }
예제 #13
0
        static TraderFactory()
        {
            Trader susan = new Trader("苏珊");

            susan.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader farmerTed = new Trader("农夫泰德");

            farmerTed.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader peteTheHerbalist = new Trader("草药医生皮特");

            peteTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(susan);
            AddTraderToList(farmerTed);
            AddTraderToList(peteTheHerbalist);
        }
예제 #14
0
        static TraderFactory()
        {
            Trader oana = new Trader("Oana");

            oana.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader farmerTed = new Trader("Farmer Ted");

            farmerTed.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader peteTheHerbalist = new Trader("Pete the Herbalist");

            peteTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(oana);
            AddTraderToList(farmerTed);
            AddTraderToList(peteTheHerbalist);
        }
예제 #15
0
        static TraderFactory()
        {
            Trader sarah = new Trader("Sarah");

            sarah.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader farmerFrank = new Trader("Farmer Frank");

            farmerFrank.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader angelaTheHerbalist = new Trader("Angela the Herbalist");

            angelaTheHerbalist.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(sarah);
            AddTraderToList(farmerFrank);
            AddTraderToList(angelaTheHerbalist);
        }
예제 #16
0
        static TraderFactory()
        {
            Trader samtvsung = new Trader("Sam TeVi Sung", 1);

            samtvsung.AddItemToInventory(LootFactory.CreateLoot(1002));

            Trader meatkeeper = new Trader("Meat Keeper", 2);

            meatkeeper.AddItemToInventory(LootFactory.CreateLoot(1003));

            Trader chinchilla = new Trader("Besya The Chinchilla", 3);

            chinchilla.AddItemToInventory(LootFactory.CreateLoot(1004));

            AddTrader(samtvsung);
            AddTrader(meatkeeper);
            AddTrader(chinchilla);
        }
예제 #17
0
        static TraderFactory()
        {
            Trader chiaki = new Trader("Chiaki");

            chiaki.AddItemToInventory(ItemFactory.createItem(1001));

            Trader isamu = new Trader("Isamu");

            isamu.AddItemToInventory(ItemFactory.createItem(1001));

            Trader hikawa = new Trader("Hikawa");

            hikawa.AddItemToInventory(ItemFactory.createItem(1001));

            AddTraderToList(chiaki);
            AddTraderToList(isamu);
            AddTraderToList(hikawa);
        }
예제 #18
0
        static TraderFactory()
        {
            Trader OldPrisoner = new Trader("Old Prisoner");

            OldPrisoner.AddItemToInventory(ItemFactory.CreateGameItem(5004));

            Trader Mouse = new Trader("Shady Mouse");

            Mouse.AddItemToInventory(ItemFactory.CreateGameItem(5006));

            Trader MagicalBox = new Trader("Magical Trading Box");

            MagicalBox.AddItemToInventory(ItemFactory.CreateGameItem(1002));

            AddTraderToList(OldPrisoner);
            AddTraderToList(Mouse);
            AddTraderToList(MagicalBox);
        }
예제 #19
0
        static TraderFactory()
        {
            Trader skullKid = new Trader("Skull Kid");

            skullKid.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader kodeeQ = new Trader("Kodee Q");

            kodeeQ.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            Trader peterPeterPumpkinEater = new Trader("Peter Peter the Pumpkin Eater");

            peterPeterPumpkinEater.AddItemToInventory(ItemFactory.CreateGameItem(1001));

            AddTraderToList(skullKid);
            AddTraderToList(kodeeQ);
            AddTraderToList(peterPeterPumpkinEater);
        }
예제 #20
0
        private static void LoadTradersFromNodes(XmlNodeList nodes)
        {
            foreach (XmlNode node in nodes)
            {
                Trader trader =
                    new Trader(node.AttributeAsInt("ID"),
                               node.SelectSingleNode("./Name")?.InnerText ?? "");

                foreach (XmlNode childNode in node.SelectNodes("./InventoryItems/Item"))
                {
                    int quantity = childNode.AttributeAsInt("Quantity");

                    for (int i = 0; i < quantity; i++)
                    {
                        trader.AddItemToInventory(ItemFactory.CreateGameItem(childNode.AttributeAsInt("ID")));
                    }
                }

                _traders.Add(trader);
            }
        }
예제 #21
0
        private static void LoadTradersFromNodes(XmlNodeList nodes)
        {
            foreach (XmlNode node in nodes)
            {
                var trader = new Trader(node.AttributeAsInt("ID"), node.SelectSingleNode("./Name")?.InnerText ?? "");

                foreach (XmlNode childNode in node.SelectNodes("./InventoryItems/Item"))
                {
                    int quantity = childNode.AttributeAsInt("Quantity");

                    // Create a new GameItem object for each item we add.
                    // This is to allow for unique items, like swords with enchantments.
                    for (int i = 0; i < quantity; i++)
                    {
                        trader.AddItemToInventory(ItemFactory.CreateGameItem(childNode.AttributeAsInt("ID")));
                    }
                }

                _traders.Add(trader);
            }
        }
예제 #22
0
        private static void LoadTradersFromNodes(XmlNodeList nodes)
        {
            foreach (XmlNode node in nodes)
            {
                Trader trader =
                    new Trader(node.GetXmlAttributeAsInt("ID"),
                               node.SelectSingleNode("./Name")?.InnerText ?? "",
                               node.GetXmlAttributeAsBool("HasWeapons"));

                foreach (XmlNode childNode in node.SelectNodes("./InventoryItems/Item"))
                {
                    trader.AddItemToInventory(ItemFactory.CreateGameItem(childNode.GetXmlAttributeAsInt("ID")),
                                              childNode.GetXmlAttributeAsInt("Quantity"));
                }

                foreach (XmlNode childNode in node.SelectNodes("./Weapons/Weapon"))
                {
                    trader.AddWeaponToWeapons(WeaponFactory.CreateWeapon(childNode.GetXmlAttributeAsInt("ID")));
                }

                AddTraderToList(trader);
            }
        }
예제 #23
0
        private static void LoadTradersFromNodes(XmlNodeList xmlNodeList)
        {
            if (xmlNodeList == null)
            {
                return;
            }
            foreach (XmlNode traderNode in xmlNodeList)
            {
                Trader newTrader = new Trader(
                    traderNode.GetXMLAttributeValue <int>("Id"),
                    traderNode.GetXMLAttributeValue <string>("Name")
                    );

                foreach (XmlNode item in traderNode.SelectNodes("./Inventory/Item"))
                {
                    int quantity = item.GetXMLAttributeValue <int>("Quantity");
                    for (int i = 0; i < quantity; i++)
                    {
                        newTrader.AddItemToInventory(ItemFactory.CreateItem(item.GetXMLAttributeValue <int>("Id")));
                    }
                }
                _traders.Add(newTrader);
            }
        }