def SpellsCancelPress(): """Removes all known spells and close the window. This is only callable within character generation.""" # remove all learned spells Spellbook.RemoveKnownSpells(pc, SpellBookType, 1, 9, 1) if GameCheck.IsBG2(): # unload teh window and go back if SpellsWindow: SpellsWindow.Close() GemRB.SetNextScript("CharGen6") #haterace elif GameCheck.IsBG1(): if SpellsWindow: SpellsWindow.Close() import CharGenCommon CharGenCommon.back() elif IWD2: if SpellsWindow: SpellsWindow.Close() GemRB.SetNextScript("Feats") else: print("Uh-oh in SpellsCancelPress in", GemRB.GameType) return
def OnLoad(): global RaceWindow, TextAreaControl, DoneButton global RaceTable GemRB.SetVar("Race", 0) RaceWindow = GemRB.LoadWindow(8, "GUICG") RaceCount = CommonTables.Races.GetRowCount() for i in range(2, RaceCount + 2): Button = RaceWindow.GetControl(i) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR) for i in range(2, RaceCount + 2): Button = RaceWindow.GetControl(i) Button.SetText(CommonTables.Races.GetValue(i - 2, 0)) Button.SetState(IE_GUI_BUTTON_ENABLED) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, RacePress) Button.SetVarAssoc("Race", i - 1) BackButton = RaceWindow.GetControl(10) BackButton.SetText(15416) DoneButton = RaceWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() DoneButton.SetState(IE_GUI_BUTTON_DISABLED) TextAreaControl = RaceWindow.GetControl(8) TextAreaControl.SetText(17237) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(RaceWindow)) RaceWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global SkillWindow, DoneButton SkillWindow = GemRB.LoadWindow(6, "GUICG") MyChar = GemRB.GetVar ("Slot") Levels = [GemRB.GetPlayerStat (MyChar, IE_LEVEL), \ GemRB.GetPlayerStat (MyChar, IE_LEVEL2), \ GemRB.GetPlayerStat (MyChar, IE_LEVEL3)] LUSkillsSelection.SetupSkillsWindow (MyChar, LUSkillsSelection.LUSKILLS_TYPE_CHARGEN, SkillWindow, RedrawSkills, [0,0,0], Levels,0,False) BackButton = SkillWindow.GetControl(25) BackButton.SetText(15416) BackButton.OnPress (lambda: CharGenCommon.back(SkillWindow)) DoneButton = SkillWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() DoneButton.OnPress (NextPress) DoneButton.SetState(IE_GUI_BUTTON_DISABLED) RedrawSkills() SkillWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global SkillWindow, DoneButton SkillWindow = GemRB.LoadWindow(9, "GUICG") MyChar = GemRB.GetVar("Slot") Levels = [GemRB.GetPlayerStat (MyChar, IE_LEVEL), GemRB.GetPlayerStat (MyChar, IE_LEVEL2), \ GemRB.GetPlayerStat (MyChar, IE_LEVEL3)] LUProfsSelection.SetupProfsWindow(MyChar, LUProfsSelection.LUPROFS_TYPE_CHARGEN, SkillWindow, RedrawSkills, [0, 0, 0], Levels, scroll=False, profTableOffset=0) BackButton = SkillWindow.GetControl(77) BackButton.SetText(15416) BackButton.MakeEscape() BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(SkillWindow)) DoneButton = SkillWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) DoneButton.SetState(IE_GUI_BUTTON_DISABLED) SkillWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global ColorWindow, DoneButton, PDollButton, ColorTable global HairButton, SkinButton, MajorButton, MinorButton global HairColor, SkinColor, MinorColor, MajorColor ColorWindow = GemRB.LoadWindow(13, "GUICG") ColorTable = GemRB.LoadTable("clowncol") #set these colors to some default PortraitTable = GemRB.LoadTable("pictures") PortraitName = GemRB.GetToken("LargePortrait") PortraitName = PortraitName[0:len(PortraitName) - 1] PortraitIndex = PortraitTable.GetRowIndex(PortraitName) if PortraitIndex < 0: HairColor = PortraitTable.GetValue(0, 1) SkinColor = PortraitTable.GetValue(0, 2) MinorColor = PortraitTable.GetValue(0, 3) MajorColor = PortraitTable.GetValue(0, 4) else: HairColor = PortraitTable.GetValue(PortraitIndex, 1) SkinColor = PortraitTable.GetValue(PortraitIndex, 2) MinorColor = PortraitTable.GetValue(PortraitIndex, 3) MajorColor = PortraitTable.GetValue(PortraitIndex, 4) PDollButton = ColorWindow.GetControl(1) PDollButton.SetState(IE_GUI_BUTTON_LOCKED) PDollButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR) HairButton = ColorWindow.GetControl(2) HairButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR) HairButton.OnPress(HairPress) HairButton.SetBAM("COLGRAD", 0, 0, HairColor) SkinButton = ColorWindow.GetControl(3) SkinButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR) SkinButton.OnPress(SkinPress) SkinButton.SetBAM("COLGRAD", 0, 0, SkinColor) MajorButton = ColorWindow.GetControl(5) MajorButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR) MajorButton.OnPress(MajorPress) MajorButton.SetBAM("COLGRAD", 0, 0, MinorColor) MinorButton = ColorWindow.GetControl(4) MinorButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR) MinorButton.OnPress(MinorPress) MinorButton.SetBAM("COLGRAD", 0, 0, MajorColor) BackButton = ColorWindow.GetControl(13) BackButton.SetText(15416) DoneButton = ColorWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() DoneButton.OnPress(NextPress) BackButton.OnPress(lambda: CharGenCommon.back(ColorWindow)) BGCommon.RefreshPDoll(PDollButton, MinorColor, MajorColor, SkinColor, HairColor) ColorWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global CharSoundWindow, VoiceList CharSoundWindow=GemRB.LoadWindow(19, "GUICG") VoiceList = CharSoundWindow.GetControl (45) Voices = VoiceList.ListResources (CHR_SOUNDS) GUICommon.AddDefaultVoiceSet (VoiceList, Voices) # preselect the default entry to avoid an infinite loop if Play is pressed immediately VoiceList.SetVarAssoc ("Selected", 0) PlayButton = CharSoundWindow.GetControl (47) PlayButton.SetState (IE_GUI_BUTTON_ENABLED) PlayButton.SetEvent (IE_GUI_BUTTON_ON_PRESS, PlayPress) PlayButton.SetText (17318) TextArea = CharSoundWindow.GetControl (50) TextArea.SetText (11315) BackButton = CharSoundWindow.GetControl(10) BackButton.SetText(15416) DoneButton = CharSoundWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() VoiceList.SetEvent(IE_GUI_TEXTAREA_ON_SELECT, ChangeVoice) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(CharSoundWindow)) CharSoundWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global AppearanceWindow, PortraitButton, PortraitsTable, LastPortrait global Gender AppearanceWindow = GemRB.LoadWindow(11, "GUICG") #Load the Gender MyChar = GemRB.GetVar("Slot") Gender = GemRB.GetPlayerStat(MyChar, IE_SEX) #Load the Portraits Table PortraitsTable = GemRB.LoadTable("PICTURES") PortraitsStart = PortraitsTable.FindValue(0, 2) FemaleCount = PortraitsTable.GetRowCount() - PortraitsStart + 1 if Gender == 2: LastPortrait = GemRB.Roll(1, FemaleCount, PortraitsStart - 1) else: LastPortrait = GemRB.Roll(1, PortraitsTable.GetRowCount() - FemaleCount, 0) PortraitButton = AppearanceWindow.GetControl(1) PortraitButton.SetFlags(IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_NO_IMAGE, OP_SET) PortraitButton.SetState(IE_GUI_BUTTON_LOCKED) LeftButton = AppearanceWindow.GetControl(2) RightButton = AppearanceWindow.GetControl(3) BackButton = AppearanceWindow.GetControl(5) BackButton.SetText(15416) CustomButton = AppearanceWindow.GetControl(6) CustomButton.SetText(17545) DoneButton = AppearanceWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() RightButton.OnPress(RightPress) LeftButton.OnPress(LeftPress) BackButton.OnPress(lambda: CharGenCommon.back(AppearanceWindow)) CustomButton.OnPress(CustomPress) DoneButton.OnPress(NextPress) flag = False while True: if PortraitsTable.GetValue(LastPortrait, 0) == Gender: SetPicture() break LastPortrait = LastPortrait + 1 if LastPortrait >= PortraitsTable.GetRowCount(): LastPortrait = 0 if flag: SetPicture() break flag = True AppearanceWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global GenderWindow, TextAreaControl, DoneButton GenderWindow = GemRB.LoadWindow(1, "GUICG") BackButton = GenderWindow.GetControl(6) BackButton.SetText(15416) DoneButton = GenderWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() TextAreaControl = GenderWindow.GetControl(5) TextAreaControl.SetText(17236) MaleButton = GenderWindow.GetControl(2) MaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR) FemaleButton = GenderWindow.GetControl(3) FemaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR) GemRB.SetVar("Gender",0) MaleButton.SetVarAssoc("Gender",1) FemaleButton.SetVarAssoc("Gender",2) MaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedMale) FemaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedFemale) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(GenderWindow)) DoneButton.SetState(IE_GUI_BUTTON_DISABLED) GenderWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global TextAreaControl, DoneButton ClassWindow = GemRB.LoadWindow(10, "GUICG") ClassCount = CommonTables.Classes.GetRowCount() + 1 RaceName = CommonTables.Races.GetRowName(GemRB.GetVar("Race") - 1) j = 0 for i in range(1, ClassCount): ClassName = CommonTables.Classes.GetRowName(i - 1) if CommonTables.Classes.GetValue(ClassName, "MULTI") == 0: continue if j > 11: Button = ClassWindow.GetControl(j + 7) else: Button = ClassWindow.GetControl(j + 2) Button.SetState(IE_GUI_BUTTON_DISABLED) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR) j = j + 1 j = 0 for i in range(1, ClassCount): ClassName = CommonTables.Classes.GetRowName(i - 1) Allowed = CommonTables.Classes.GetValue(ClassName, RaceName) if CommonTables.Classes.GetValue(ClassName, "MULTI") == 0: continue if j > 11: Button = ClassWindow.GetControl(j + 7) else: Button = ClassWindow.GetControl(j + 2) t = CommonTables.Classes.GetValue(ClassName, "NAME_REF") Button.SetText(t) j = j + 1 if Allowed == 0: continue Button.SetState(IE_GUI_BUTTON_ENABLED) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClassPress) Button.SetVarAssoc("Class", i) #multiclass, actually BackButton = ClassWindow.GetControl(14) BackButton.SetText(15416) DoneButton = ClassWindow.GetControl(0) DoneButton.SetText(11973) TextAreaControl = ClassWindow.GetControl(12) TextAreaControl.SetText(17244) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: NextPress(ClassWindow)) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(ClassWindow)) DoneButton.SetState(IE_GUI_BUTTON_DISABLED) ClassWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global AlignmentWindow, TextAreaControl, DoneButton MyChar = GemRB.GetVar("Slot") GemRB.SetVar("Alignment", -1) KitName = GUICommon.GetClassRowName(MyChar) AlignmentOk = GemRB.LoadTable("ALIGNMNT") AlignmentWindow = GemRB.LoadWindow(3, "GUICG") # This section enables or disables different alignment selections # based on Class, and depends on the ALIGNMNT.2DA table # # For now, we just enable all buttons for i in range(9): Button = AlignmentWindow.GetControl(i + 2) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR) Button.SetText(CommonTables.Aligns.GetValue(i, 0)) if AlignmentOk.GetValue(KitName, CommonTables.Aligns.GetValue(i, 4)) != 0: Button.SetState(IE_GUI_BUTTON_ENABLED) else: Button.SetState(IE_GUI_BUTTON_DISABLED) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, AlignmentPress) Button.SetVarAssoc("Alignment", i) BackButton = AlignmentWindow.GetControl(13) BackButton.SetText(15416) DoneButton = AlignmentWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() TextAreaControl = AlignmentWindow.GetControl(11) TextAreaControl.SetText(9602) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(AlignmentWindow)) DoneButton.SetState(IE_GUI_BUTTON_DISABLED) AlignmentWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global RaceWindow, TextAreaControl, DoneButton global RacialEnemyTable, RaceCount, TopIndex GemRB.SetVar("HatedRace", 0) ClassName = GUICommon.GetClassRowName(GemRB.GetVar("Class") - 1, "index") TableName = CommonTables.ClassSkills.GetValue(ClassName, "HATERACE") RaceWindow = GemRB.LoadWindow(15, "GUICG") RacialEnemyTable = GemRB.LoadTable(TableName) RaceCount = RacialEnemyTable.GetRowCount() - LISTSIZE if RaceCount < 0: RaceCount = 0 for i in range(LISTSIZE): Button = RaceWindow.GetControl(i + 2) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR) Button.SetSprites("GUIHRC", i, 0, 1, 2, 3) BackButton = RaceWindow.GetControl(10) BackButton.SetText(15416) DoneButton = RaceWindow.GetControl(11) DoneButton.SetText(11973) DoneButton.MakeDefault() DoneButton.SetState(IE_GUI_BUTTON_DISABLED) TextAreaControl = RaceWindow.GetControl(8) TextAreaControl.SetText(17256) TopIndex = 0 GemRB.SetVar("TopIndex", 0) ScrollBarControl = RaceWindow.GetControl(1) ScrollBarControl.SetVarAssoc("TopIndex", RaceCount) ScrollBarControl.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE, DisplayRaces) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(RaceWindow)) RaceWindow.ShowModal(MODAL_SHADOW_NONE) DisplayRaces() return
def OnLoad(): global NameWindow, NameField, DoneButton NameWindow = GemRB.LoadWindow(5, "GUICG") BackButton = NameWindow.GetControl(3) BackButton.SetText(15416) DoneButton = NameWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() DoneButton.SetState(IE_GUI_BUTTON_DISABLED) NameField = NameWindow.GetControl(2) NameField.SetText(GemRB.GetToken("CHARNAME")) EditChange() DoneButton.OnPress(NextPress) BackButton.OnPress(lambda: CharGenCommon.back(NameWindow)) NameField.OnChange(EditChange) NameWindow.ShowModal(MODAL_SHADOW_NONE) NameField.Focus() return
def BackPress(): GemRB.SetRepeatClickFlags(GEM_RK_DISABLE, OP_OR) CharGenCommon.back()
def OnLoad(): global KitWindow, TextAreaControl, DoneButton global SchoolList, ClassName RaceName = CommonTables.Races.GetRowName(GemRB.GetVar("Race") - 1) ClassName = GUICommon.GetClassRowName(GemRB.GetVar("Class") - 1, "index") KitTable = GemRB.LoadTable("kittable") KitTableName = KitTable.GetValue(ClassName, RaceName) KitTable = GemRB.LoadTable(KitTableName, 1) SchoolList = GemRB.LoadTable("magesch") #there is only a specialist mage window for bg1 KitWindow = GemRB.LoadWindow(12, "GUICG") for i in range(8): Button = KitWindow.GetControl(i + 2) Button.SetState(IE_GUI_BUTTON_DISABLED) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR) if not KitTable: RowCount = 1 else: RowCount = KitTable.GetRowCount() for i in range(RowCount): Button = KitWindow.GetControl(i + 2) if not KitTable: if ClassName == "MAGE": Kit = GemRB.GetVar("MAGESCHOOL") KitName = SchoolList.GetValue(i, 0) else: Kit = 0 KitName = CommonTables.Classes.GetValue(ClassName, "NAME_REF") else: Kit = KitTable.GetValue(i, 0) if ClassName == "MAGE": if Kit: Kit = Kit - 21 KitName = SchoolList.GetValue(Kit, 0) else: if Kit: KitName = CommonTables.KitList.GetValue(Kit, 1) else: KitName = CommonTables.Classes.GetValue( ClassName, "NAME_REF") Button.SetState(IE_GUI_BUTTON_ENABLED) Button.SetText(KitName) Button.SetVarAssoc("Class Kit", Kit) if i == 0: GemRB.SetVar("Class Kit", Kit) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, KitPress) BackButton = KitWindow.GetControl(12) BackButton.SetText(15416) DoneButton = KitWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() TextAreaControl = KitWindow.GetControl(11) TextAreaControl.SetText(17245) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(KitWindow)) #KitPress() KitWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global AbilityWindow, TextAreaControl, DoneButton global PointsLeft, HasStrExtra global AbilityTable, Abclasrq, Abclsmod, Abracerq, Abracead global KitIndex, Minimum, Maximum, MyChar Abracead = GemRB.LoadTable("ABRACEAD") Abclasrq = GemRB.LoadTable("ABCLASRQ") Abracerq = GemRB.LoadTable("ABRACERQ") MyChar = GemRB.GetVar("Slot") Kit = GUICommon.GetKitIndex(MyChar) ClassName = GUICommon.GetClassRowName(MyChar) if Kit == 0: KitName = ClassName else: #rowname is just a number, first value row what we need here KitName = CommonTables.KitList.GetValue(Kit, 0) #if the class uses the warrior table for saves, then it may have the extra strength HasStrExtra = CommonTables.Classes.GetValue(ClassName, "STREXTRA", GTV_INT) KitIndex = Abclasrq.GetRowIndex(KitName) AbilityTable = GemRB.LoadTable("ability") AbilityWindow = GemRB.LoadWindow(4, "GUICG") RerollButton = AbilityWindow.GetControl(2) RerollButton.SetText(11982) StoreButton = AbilityWindow.GetControl(37) StoreButton.SetText(17373) RecallButton = AbilityWindow.GetControl(38) RecallButton.SetText(17374) BackButton = AbilityWindow.GetControl(36) BackButton.SetText(15416) BackButton.MakeEscape() DoneButton = AbilityWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() DoneButton.SetState(IE_GUI_BUTTON_ENABLED) RollPress() StorePress() for i in range(6): Button = AbilityWindow.GetControl(i + 30) Button.OnPress(JustPress) Button.SetVarAssoc("Ability", i) Button = AbilityWindow.GetControl(i * 2 + 16) Button.OnPress(LeftPress) Button.SetVarAssoc("Ability", i) Button.SetActionInterval(200) Button = AbilityWindow.GetControl(i * 2 + 17) Button.OnPress(RightPress) Button.SetVarAssoc("Ability", i) Button.SetActionInterval(200) TextAreaControl = AbilityWindow.GetControl(29) TextAreaControl.SetText(17247) StoreButton.OnPress(StorePress) RecallButton.OnPress(RecallPress) RerollButton.OnPress(RollPress) DoneButton.OnPress(NextPress) BackButton.OnPress(lambda: CharGenCommon.back(AbilityWindow)) AbilityWindow.ShowModal(MODAL_SHADOW_NONE) return
def OnLoad(): global ClassWindow, TextAreaControl, DoneButton MyChar = GemRB.GetVar ("Slot") GemRB.SetVar("Class",0) GemRB.SetVar("Multi Class",0) GemRB.SetVar("Specialist",0) GemRB.SetVar("Class Kit",0) ClassCount = CommonTables.Classes.GetRowCount()+1 ClassWindow = GemRB.LoadWindow(2, "GUICG") RaceRow = CommonTables.Races.FindValue(3,GemRB.GetPlayerStat (MyChar, IE_RACE)) RaceName = CommonTables.Races.GetRowName(RaceRow) #radiobutton groups must be set up before doing anything else to them for i in range(1,ClassCount): ClassName = CommonTables.Classes.GetRowName (i-1) if CommonTables.Classes.GetValue(ClassName, "MULTI"): continue Button = ClassWindow.GetControl(i+1) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR) Button.SetState(IE_GUI_BUTTON_DISABLED) GemRB.SetVar("MAGESCHOOL",0) HasMulti = 0 for i in range(1,ClassCount): ClassName = CommonTables.Classes.GetRowName(i-1) Allowed = CommonTables.Classes.GetValue(ClassName, RaceName) if CommonTables.Classes.GetValue (ClassName, "MULTI"): if Allowed!=0: HasMulti = 1 continue Button = ClassWindow.GetControl(i+1) t = CommonTables.Classes.GetValue(ClassName, "NAME_REF") Button.SetText(t ) if Allowed==2: GemRB.SetVar("MAGESCHOOL",5) #illusionist if Allowed!=1: continue Button.SetState(IE_GUI_BUTTON_ENABLED) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClassPress) Button.SetVarAssoc("Class", i) MultiClassButton = ClassWindow.GetControl(10) MultiClassButton.SetText(11993) if HasMulti == 0: MultiClassButton.SetState(IE_GUI_BUTTON_DISABLED) Allowed = CommonTables.Classes.GetValue ("MAGE", RaceName) SpecialistButton = ClassWindow.GetControl(11) SpecialistButton.SetText(11994) if Allowed == 0: SpecialistButton.SetState(IE_GUI_BUTTON_DISABLED) BackButton = ClassWindow.GetControl(14) BackButton.SetText(15416) DoneButton = ClassWindow.GetControl(0) DoneButton.SetText(11973) DoneButton.MakeDefault() TextAreaControl = ClassWindow.GetControl(13) ClassName = GUICommon.GetClassRowName (GemRB.GetVar ("Class")-1, "index") if ClassName == "": TextAreaControl.SetText(17242) DoneButton.SetState(IE_GUI_BUTTON_DISABLED) else: TextAreaControl.SetText (CommonTables.Classes.GetValue (ClassName, "DESC_REF")) DoneButton.SetState(IE_GUI_BUTTON_ENABLED) MultiClassButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, MultiClassPress) SpecialistButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, SpecialistPress) DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress) BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(ClassWindow)) ClassWindow.ShowModal(MODAL_SHADOW_NONE) return