def InitSpellSelection(obj, classLvlNew=-1, classLvlIncrement=1): if char_editor.get_class_code( ) != classEnum: # This is strictly a beguiler benefit (in case it's being accessed externally from something like Mystic Theurge / Archmage) return 0 classLvl = obj.stat_level_get(classEnum) if classLvlNew <= 0: classLvlNew = classLvl + 1 maxSpellLvl = char_editor.get_max_spell_level(obj, classEnum, classLvlNew) spAvail = GetAdvancedLearningList(obj, maxSpellLvl) # Add the spell level labels for p in range(1, maxSpellLvl + 1): spAvail.append( char_editor.KnownSpellInfo(spell_label_level_0 + p, 0, classEnum)) spAvail.sort() char_editor.append_available_spells(spAvail) # Add a single spell slot vacant_slot = char_editor.KnownSpellInfo(spell_vacant, 3, classEnum) spEnums = [vacant_slot] char_editor.append_spell_enums(spEnums) return 0
def InitSpellSelection(obj, classLvlNew = -1, classLvlIncrement = 1): classLvl = obj.stat_level_get(classEnum) classLvlNew = classLvl + 1 maxSpellLvl = char_editor.get_max_spell_level(obj, classEnum, classLvlNew) # this regards spell list extension by stuff like Mystic Theurge (no need to use spellListLvl as below) # Available Spells spAvail = char_editor.get_learnable_spells(obj, classEnum, maxSpellLvl) # add spell level labels for p in range(0, maxSpellLvl + 1): spAvail.append(char_editor.KnownSpellInfo(spell_label_level_0 + p, 0, classEnum)) spAvail.sort() char_editor.append_available_spells(spAvail) # Spell Slots spellListLvl = obj.stat_level_get(stat_spell_list_level, classEnum) + 1 # the effective level for getting the number of spells known spEnums = char_editor.get_known_class_spells(obj, classEnum) # get all spells known for this class for spellLvl in range(1, maxSpellLvl + 1): spEnums.append(char_editor.KnownSpellInfo(spell_label_level_0 + spellLvl, 0, classEnum)) # add label # add spell slots newSpellsKnownCount = char_class_utils.GetSpellsKnownAddedCount(spells_known, spellListLvl, spellLvl) for q in range(0, newSpellsKnownCount): spEnums.append(char_editor.KnownSpellInfo(spell_new_slot_lvl_0 + spellLvl, 3, classEnum)) isReplacing = 0 if spellListLvl >= 6 and ((spellListLvl - 6) % 2) == 0: # spell replacement isReplacing = 1 if char_editor.get_class_code() != classEnum: # grant this benefit only for strict levelup (also to prevent some headache...) isReplacing = 0 if isReplacing == 0: spEnums.sort() char_editor.append_spell_enums(spEnums) return 0 # mark as replaceable for p in range(0, len(spEnums)): spEnum = spEnums[p].spell_enum if spell_vacant <= spEnum <= spell_label_level_9: continue if spell_new_slot_lvl_0 <= spEnum <= spell_new_slot_lvl_9: continue if char_editor.get_spell_level(spEnum, classEnum) <= maxSpellLvl - 2: spEnums[p].spell_status = 1 spEnums.sort() char_editor.append_spell_enums(spEnums) return 0
def InitSpellSelection(obj, classLvlNew=-1, classLvlIncrement=1): classLvl = obj.stat_level_get(classEnum) if classLvlNew <= 0: classLvlNew = classLvl + 1 maxSpellLvl = char_editor.get_max_spell_level( obj, classEnum, classLvlNew ) # this regards spell list extension by stuff like Mystic Theurge # Available Spells spAvail = char_editor.get_learnable_spells(obj, classEnum, maxSpellLvl) # cull cantrips p = 0 while p < len(spAvail): if spAvail[p].spell_level == 0: del (spAvail[p]) else: p = p + 1 # add spell level labels for p in range(1, maxSpellLvl + 1): spAvail.append( char_editor.KnownSpellInfo(spell_label_level_0 + p, 0, classEnum)) spAvail.sort() char_editor.append_available_spells(spAvail) # Spell slots spEnums = [] vacant_slot = char_editor.KnownSpellInfo( spell_vacant, 3, classEnum) # sets it to spell level -1 if classLvlNew == 1: # newly taken class spEnums.append( char_editor.KnownSpellInfo(spell_label_level_1, 0, classEnum)) for p in range(0, 2): spEnums.append(vacant_slot) intScore = obj.stat_level_get(stat_intelligence) intMod = (intScore - 10) / 2 for p in range(0, intMod): spEnums.append(vacant_slot) else: # add 2 new spell slots for p in range(0, 2): spEnums.append(vacant_slot) char_editor.append_spell_enums(spEnums) return 0
def InitSpellSelection(obj, classLvlNew=-1, classLvlIncrement=1): classLvl = obj.stat_level_get(classEnum) if classLvlNew <= 0: classLvlNew = classLvl + 1 maxSpellLvl = char_editor.get_max_spell_level( obj, classEnum, classLvlNew ) # this regards spell list extension by stuff like Mystic Theurge # Available Spells (spells you can choose, on the left side) spAvail = char_editor.get_learnable_spells(obj, classEnum, maxSpellLvl) # add spell level labels for p in range(0, maxSpellLvl + 1): spAvail.append( char_editor.KnownSpellInfo(spell_label_level_0 + p, 0, classEnum)) spAvail.sort() char_editor.append_available_spells(spAvail) # Create Known Spells list (right side) spEnums # Case 1 - newly taken class if classLvlNew == 1: spEnums = [] spEnums.append( char_editor.KnownSpellInfo(spell_label_level_0, 0, classEnum)) # add "Level 0" label for p in range(0, 4): # 4 cantrips spEnums.append( char_editor.KnownSpellInfo(spell_new_slot_lvl_0, 3, classEnum)) spEnums.append( char_editor.KnownSpellInfo(spell_label_level_1, 0, classEnum)) # add "Level 1" label for p in range(0, 2): # 2 level 1 spells spEnums.append( char_editor.KnownSpellInfo(spell_new_slot_lvl_1, 3, classEnum)) char_editor.append_spell_enums(spEnums) return 0 # Case 2 - Incrementing class level spellListLvl = obj.stat_level_get( stat_spell_list_level, classEnum ) + classLvlIncrement # the effective level for getting the number of spells known if spellListLvl <= 20: spEnums = char_editor.get_known_class_spells( obj, classEnum) # get all spells known by this character for this class for spellLvl in range(0, maxSpellLvl + 1): spEnums.append( char_editor.KnownSpellInfo(spell_label_level_0 + spellLvl, 0, classEnum)) # add label # add spells newSpellsKnownCount = char_class_utils.GetSpellsKnownAddedCount( spells_known, spellListLvl, spellLvl) # print("new num spells for spell level " + str(spellLvl) + ": " + str(newSpellsKnownCount)) for q in range(0, newSpellsKnownCount): spEnums.append( char_editor.KnownSpellInfo(spell_new_slot_lvl_0 + spellLvl, 3, classEnum)) else: # Epic Level sorcerer - add a single spell of any level (kind of like a freebie Spell knowledge feat, since there isn't one yet) spEnums = [] vacant_slot = char_editor.KnownSpellInfo( spell_vacant, 3, classEnum) # sets it to spell level -1 spEnums.append(vacant_slot) char_editor.append_spell_enums(spEnums) return 0 # Handle spell replacement on even levels isReplacing = 0 if spellListLvl >= 4 and (spellListLvl % 2) == 0: # spell replacement isReplacing = 1 if char_editor.get_class_code( ) != classEnum: #grant this benefit only for strict levelup (also to prevent some headache...) isReplacing = 0 if isReplacing == 0: spEnums.sort() char_editor.append_spell_enums(spEnums) return 0 # mark as replaceable for p in range(0, len(spEnums)): spEnum = spEnums[p].spell_enum if spell_vacant <= spEnum <= spell_label_level_9: continue if spell_new_slot_lvl_0 <= spEnum <= spell_new_slot_lvl_9: continue if char_editor.get_spell_level(spEnum, classEnum) <= maxSpellLvl - 2: spEnums[p].spell_status = 1 # marked as replaceable # Finally, return spEnums list to the engine spEnums.sort() char_editor.append_spell_enums(spEnums) return 0
def InitSpellSelection( obj, classLvlNew = -1, classLvlIncrement = 1): classLvl = obj.stat_level_get(classEnum) if classLvlNew <= 0: classLvlNew = classLvl + 1 maxSpellLvl = char_editor.get_max_spell_level( obj, classEnum, classLvlNew ) # this regards spell list extension by stuff like Mystic Theurge # Available Spells spAvail = char_editor.get_learnable_spells(obj, classEnum, maxSpellLvl) # add spell level labels for p in range(0,maxSpellLvl+1): spAvail.append(char_editor.KnownSpellInfo(spell_label_level_0 + p, 0, classEnum)) spAvail.sort() char_editor.append_available_spells(spAvail) # newly taken class if classLvlNew == 1: spEnums = [] spEnums.append(char_editor.KnownSpellInfo(spell_label_level_0, 0, classEnum)) # add "Level 0" label for p in range(0,4): # 4 cantrips spEnums.append(char_editor.KnownSpellInfo(spell_new_slot_lvl_0, 3, classEnum)) spEnums.append(char_editor.KnownSpellInfo(spell_label_level_1, 0, classEnum)) # add "Level 1" label for p in range(0,2): # 2 level 1 spells spEnums.append(char_editor.KnownSpellInfo(spell_new_slot_lvl_1, 3, classEnum)) char_editor.append_spell_enums(spEnums) return 0 # Incrementing class level spellListLvl = obj.stat_level_get(stat_spell_list_level, classEnum) + classLvlIncrement # the effective level for getting the number of spells known spEnums = char_editor.get_known_class_spells(obj, classEnum) # get all spells known for this class for spellLvl in range(0, maxSpellLvl+1): spEnums.append(char_editor.KnownSpellInfo(spell_label_level_0 + spellLvl, 0, classEnum)) # add label # add spells newSpellsKnownCount = char_class_utils.GetSpellsKnownAddedCount( spells_known , spellListLvl, spellLvl) print "new num spells for spell level " + str(spellLvl) + ": " + str(newSpellsKnownCount) for q in range(0, newSpellsKnownCount): spEnums.append(char_editor.KnownSpellInfo(spell_new_slot_lvl_0 + spellLvl, 3, classEnum)) isReplacing = 0 if spellListLvl >= 4 and (spellListLvl % 2) == 0: # spell replacement isReplacing = 1 if char_editor.get_class_code() != classEnum: #grant this benefit only for strict levelup (also to prevent some headache...) isReplacing = 0 if isReplacing == 0: spEnums.sort() char_editor.append_spell_enums(spEnums) return 0 # mark as replaceable for p in range(0,len(spEnums)): spEnum = spEnums[p].spell_enum if spell_vacant <= spEnum <= spell_label_level_9: continue if spell_new_slot_lvl_0 <= spEnum <= spell_new_slot_lvl_9: continue if char_editor.get_spell_level(spEnum, classEnum) <= maxSpellLvl-2: spEnums[p].spell_status = 1 # marked as replaceable spEnums.sort() char_editor.append_spell_enums(spEnums) return 0