def store_weapon_data(item_id, weapon_name, weapon_data): s = get_structure() if 'removed' in weapon_data: delete_item(item_id) else: new_item = Item() old_item = s.get_item_by_id(item_id) new_item.id = old_item.id new_item.name = old_item.name new_item.or_name = old_item.or_name new_item.type = old_item.type new_item.level = old_item.level new_item.set = old_item.set new_item.ankama_id = old_item.ankama_id new_item.ankama_type = old_item.ankama_type new_item.stats = old_item.stats new_item.min_stats_to_equip = old_item.min_stats_to_equip new_item.max_stats_to_equip = old_item.max_stats_to_equip for lang in NON_EN_LANGUAGES: new_item.localized_names[lang] = old_item.localized_names.get(lang) for lang in NON_EN_LANGUAGES: new_item.localized_extras[lang] = old_item.localized_extras.get(lang) new_item.localized_extras['en'] = old_item.localized_extras.get('en') for wc in WEIRD_CONDITIONS: new_item.weird_conditions[wc] = old_item.weird_conditions[wc] new_item = _convert_json_item_to_item(weapon_data, new_item, s) if '(' in old_item.name: new_item.name = old_item.name print 'Checking %s' % new_item.name update_item(old_item, new_item, None, False)
def store_item_set(item_name, set_id): s = get_structure() item = s.get_item_by_name(item_name, True) if not item: filetomod = open('MissingItemsInSets.txt', 'a') name_to_print = item_name + '\n' filetomod.write(name_to_print.encode('utf-8')) filetomod.close() return new_item = Item() new_item.id = item.id new_item.name = item.name new_item.or_name = item.or_name new_item.type = item.type new_item.level = item.level new_item.set = set_id new_item.ankama_id = item.ankama_id new_item.ankama_type = item.ankama_type new_item.is_one_handed = item.is_one_handed new_item.stats = item.stats new_item.min_stats_to_equip = item.min_stats_to_equip new_item.max_stats_to_equip = item.max_stats_to_equip new_item.localized_extras = item.localized_extras new_item.localized_names = item.localized_names new_item.accentless_local_names = item.accentless_local_names new_item.weird_conditions = item.weird_conditions new_item.removed = item.removed new_item.dofus_touch = item.dofus_touch weapon = s.get_weapon_by_name(item_name, True) update_item(item, new_item, weapon, False)