Example #1
0
 def populate(self, cardlist):
     xml = ET.parse(cardlist)
     iter = xml.getiterator('card')
     self.deck = [] # reset the deck when loading a new one.
     for element in iter:
         card = Card()
         for child in element:
             if (child.tag == "cid"): 
                 card.cid = child.text
             if (child.tag == "name"):
                 card.name = child.text
             if (child.tag == "type"):
                 card.type = child.text
             if (child.tag == "subtype1"):
                 card.subtype1 = child.text
             if (child.tag == "subtype2"):
                 card.subtype2 = child.text
             if (child.tag == "cost"):
                 card.cost = child.text
             if (child.tag == "installCost"):
                 card.installCost = child.text
             if (child.tag == "rezCost"):
                 card.rezCost = child.text
             if (child.tag == "trashCost"):
                 card.trashCost = child.text
             if (child.tag == "strength"):
                 card.strength = child.text
             if (child.tag == "mu"):
                 card.mu = child.text
             if (child.tag == "rarity"):
                 card.rarity = child.text
             if (child.tag == "artist"):
                 card.artist = child.text
             if (child.tag == "text"):
                 card.text = child.text
             if (child.tag == "quote"):
                 card.quote = child.text
             if (child.tag == "release"):
                 card.release = child.text
             if (child.tag == "difficulty"):
                 card.difficulty = child.text
             if (child.tag == "agendaPoints"):
                 card.agendaPoints = child.text
             if (child.tag == "image"):
                 card.imageloc = child.text
             if (child.tag == "playertype"):
                 card.playertype = child.text
             #print child.tag, child.text
         #print "name: ", card.name
         #print "uuid: ", card.uuid
         self.addCard(card)