Example #1
0
 def __update_item(self):
     updated_item = Item()
     updated_item.id = self.id.get()
     updated_item.name = self.name.get()
     updated_item.nominal = self.nominal.get()
     updated_item.min = self.min.get()
     updated_item.lifetime = self.lifetime.get()
     updated_item.restock = self.restock.get()
     usages = self.usagesListBox.curselection()
     values = [self.usagesListBox.get(i) for i in usages]
     usages = ",".join(values)
     updated_item.usage = usages
     tires = self.tiersListBox.curselection()
     tire_values = [self.tiersListBox.get(i) for i in tires]
     tires = ",".join(tire_values)
     updated_item.tire = tires
     updated_item.rarity = self.rarity.get()
     updated_item.item_type = self.type.get()
     updated_item.sub_type = self.subtypeAutoComp.get()
     updated_item.mod = self.mod.get()
     print(updated_item.mod)
     updated_item.trader = self.trader.get()
     updated_item.dynamic_event = self.dynamic_event.get()
     updated_item.count_in_hoarder = self.count_in_hoarder.get()
     updated_item.count_in_cargo = self.count_in_cargo.get()
     updated_item.count_in_map = self.count_in_map.get()
     updated_item.count_in_player = self.count_in_player.get()
     self.database.update_item(updated_item)
     self.__populate_items()
Example #2
0
 def get_items(self):
     items = list()
     for item_value in self.xml.iter('type'):
         item = Item()
         usages = list()
         tiers = list()
         item.name = item_value.attrib['name']
         for i in item_value:
             if i.tag == 'nominal':
                 item.nominal = i.text
             elif i.tag == 'restock':
                 item.restock = i.text
             elif i.tag == 'min':
                 item.min = i.text
             elif i.tag == 'category':
                 category = i.attrib['name']
                 if category != 'weapons':
                     item.item_type = category
                 else:
                     item.item_type = self.__get_type(name=item.name)
             elif i.tag == 'lifetime':
                 item.lifetime = i.text
             elif i.tag == 'usage':
                 usages.append(i.attrib['name'])
             elif i.tag == 'value':
                 tiers.append(i.attrib['name'])
             elif i.tag == 'flags':
                 item.dynamic_event = i.attrib['deloot']
                 item.count_in_hoarder = i.attrib['count_in_hoarder']
                 item.count_in_cargo = i.attrib['count_in_cargo']
                 item.count_in_player = i.attrib['count_in_player']
                 item.count_in_map = i.attrib['count_in_map']
         item.usage = ",".join(usages)
         item.tire = ",".join(tiers)
         items.append(item)
     return items