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); }
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); }
static TraderFactory() { Trader hospitalVendingMachine = new Trader("Hospital Vending Machine"); hospitalVendingMachine.AddItemToInventory(ItemFactory.CreateGameItem(1001)); hospitalVendingMachine.AddMultipleItemsToInventory(ItemFactory.CreateGameItem(2001), 20); AddTraderToList(hospitalVendingMachine); }
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); }
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); }
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); }
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)); }
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); }
//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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); } }
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); } }
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); } }
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); } }