Пример #1
0
def insert_spell_records(curs, curs_list, section_id, spell):
	if spell.has_key('parent'):
		orig = fetch_complete_spell(curs, spell['parent'])
		if not orig:
			# Need to handle case where spell is in a previous book
			for c in curs_list:
				orig = fetch_complete_spell(c, spell['parent'])
				if orig:
					break
		if not orig:
			raise ProcessLastException(spell['parent'])
		spell = merge_spells(orig, spell)
	descriptor_text = ', '.join(spell.get('descriptor', []))
	if descriptor_text == "":
		descriptor_text = None
	else:
		spell['descriptor_text'] = descriptor_text
	level_list = []
	for level in spell.get('level', []):
		level_list.append(level['class'] + ": " + str(level['level']))
	level_text = "; ".join(level_list)
	spell['level_text'] = level_text
	insert_spell_detail(curs, **spell)
	if spell.has_key('subschool') and spell['subschool']:
		for subschool in subschool_list(spell['subschool']):
			insert_spell_subschool(curs, section_id, subschool)
	for descriptor in filter_descriptors(spell.get('descriptor', [])):
		insert_spell_descriptor(curs, section_id, descriptor)
	for level in spell.get('level', []):
		magic_type = find_magic_type(level['class'])
		insert_spell_list(curs, section_id, level['level'], cap_words(level['class']), magic_type)
	for component in spell.get('components', []):
		insert_spell_component(curs, section_id, component.get('type'), component.get('text'), 0)
	for effect in spell.get('effects', []):
		insert_spell_effect(curs, section_id, effect['name'], effect['text'])
Пример #2
0
def insert_spell_records(curs, section_id, spell):
	if spell.has_key('parent'):
		orig = fetch_complete_spell(curs, spell['parent'])
		if not orig:
			raise ProcessLastException(spell['parent'])
		spell = merge_spells(orig, spell)
	descriptor_text = ', '.join(spell.get('descriptor', []))
	if descriptor_text == "":
		descriptor_text = None
	else:
		spell['descriptor_text'] = descriptor_text
	level_list = []
	for level in spell.get('level', []):
		level_list.append(level['class'] + ": " + str(level['level']))
	level_text = "; ".join(level_list)
	spell['level_text'] = level_text
	insert_spell_detail(curs, **spell)
	for descriptor in spell.get('descriptor', []):
		insert_spell_descriptor(curs, section_id, descriptor)
	for level in spell.get('level', []):
		magic_type = find_magic_type(level['class'])
		insert_spell_list(curs, section_id, level['level'], cap_words(level['class']), magic_type)
	for component in spell.get('components', []):
		insert_spell_component(curs, section_id, component['type'], component.get('text'), 0)
	for effect in spell.get('effects', []):
		insert_spell_effect(curs, section_id, effect['name'], effect['text'])
Пример #3
0
def insert_spell_records(curs, section_id, spell):
	if spell.has_key('parent'):
		orig = fetch_complete_spell(curs, spell['parent'])
		if not orig:
			raise ProcessLastException(spell['parent'])
		spell = merge_spells(orig, spell)
	descriptor_text = ', '.join(spell.get('descriptor', []))
	if descriptor_text == "":
		descriptor_text = None
	else:
		spell['descriptor_text'] = descriptor_text
	level_list = []
	for level in spell.get('level', []):
		level_list.append(level['class'] + ": " + str(level['level']))
	level_text = "; ".join(level_list)
	spell['level_text'] = level_text
	insert_spell_detail(curs, **spell)
	for descriptor in spell.get('descriptor', []):
		insert_spell_descriptor(curs, section_id, descriptor)
	for level in spell.get('level', []):
		magic_type = find_magic_type(level['class'])
		insert_spell_list(curs, section_id, level['level'], cap_words(level['class']), magic_type)
	for component in spell.get('components', []):
		insert_spell_component(curs, section_id, component.get('type'), component.get('text'), 0)
	for effect in spell.get('effects', []):
		insert_spell_effect(curs, section_id, effect['name'], effect['text'])