From: <ids...@us...> - 2003-12-07 16:52:48
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/bg1 In directory sc8-pr-cvs1:/tmp/cvs-serv2215/gemrb/GUIScripts/bg1 Added Files: GUICG2.py CharGen3.py Log Message: BG1 GUI Scripts and resources to support selecting character class --- NEW FILE: GUICG2.py --- #character generation, class (GUICG2) import GemRB ClassWindow = 0 TextAreaControl = 0 DoneButton = 0 ClassTable = 0 def OnLoad(): global ClassWindow, TextAreaControl, DoneButton global ClassTable GemRB.LoadWindowPack("GUICG") ClassTable = GemRB.LoadTable("classes") ClassCount = GemRB.GetTableRowCount(ClassTable)+1 ClassWindow = GemRB.LoadWindow(2) TmpTable=GemRB.LoadTable("races") RaceName = GemRB.GetTableRowName(TmpTable, GemRB.GetVar("Race")-1 ) #radiobutton groups must be set up before doing anything else to them for i in range(1,ClassCount): if GemRB.GetTableValue(ClassTable,i-1,4): continue Button = GemRB.GetControl(ClassWindow, i+1) GemRB.SetButtonFlags(ClassWindow, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_SET) GemRB.SetButtonState(ClassWindow, Button, IE_GUI_BUTTON_DISABLED) GemRB.SetVar("MAGESCHOOL",0) HasMulti = 0 for i in range(1,ClassCount): ClassName = GemRB.GetTableRowName(ClassTable, i-1) Allowed = GemRB.GetTableValue(ClassTable, ClassName, RaceName) if GemRB.GetTableValue(ClassTable,i-1,4): if Allowed!=0: HasMulti = 1 continue Button = GemRB.GetControl(ClassWindow, i+1) t = GemRB.GetTableValue(ClassTable, i-1, 0) GemRB.SetText(ClassWindow, Button, t ) if Allowed==0: continue if Allowed==2: GemRB.SetVar("MAGESCHOOL",5) #illusionist GemRB.SetButtonState(ClassWindow, Button, IE_GUI_BUTTON_ENABLED) GemRB.SetEvent(ClassWindow, Button, IE_GUI_BUTTON_ON_PRESS, "ClassPress") GemRB.SetVarAssoc(ClassWindow, Button , "Class", i) MultiClassButton = GemRB.GetControl(ClassWindow, 10) GemRB.SetText(ClassWindow,MultiClassButton, 11993) if HasMulti == 0: GemRB.SetButtonState(ClassWindow,MultiClassButton, IE_GUI_BUTTON_DISABLED) SpecialistButton = GemRB.GetControl(ClassWindow, 11) GemRB.SetText(ClassWindow, SpecialistButton, 11994) BackButton = GemRB.GetControl(ClassWindow,14) GemRB.SetText(ClassWindow,BackButton,15416) DoneButton = GemRB.GetControl(ClassWindow,0) GemRB.SetText(ClassWindow,DoneButton,11973) TextAreaControl = GemRB.GetControl(ClassWindow, 13) Class = GemRB.GetVar("Class")-1 if Class<0: GemRB.SetText(ClassWindow,TextAreaControl,17242) GemRB.SetButtonState(ClassWindow,DoneButton,IE_GUI_BUTTON_DISABLED) else: GemRB.SetText(ClassWindow,TextAreaControl, GemRB.GetTableValue(ClassTable,Class,1) ) GemRB.SetButtonState(ClassWindow, DoneButton, IE_GUI_BUTTON_ENABLED) GemRB.SetEvent(ClassWindow,MultiClassButton,IE_GUI_BUTTON_ON_PRESS,"MultiClassPress") GemRB.SetEvent(ClassWindow, SpecialistButton, IE_GUI_BUTTON_ON_PRESS, "SpecialistPress") GemRB.SetEvent(ClassWindow,DoneButton,IE_GUI_BUTTON_ON_PRESS,"NextPress") GemRB.SetEvent(ClassWindow,BackButton,IE_GUI_BUTTON_ON_PRESS,"BackPress") GemRB.SetVisible(ClassWindow,1) return def MultiClassPress(): GemRB.SetVar("Class Kit",0) GemRB.UnloadWindow(ClassWindow) GemRB.SetNextScript("GUICG10") return def SpecialistPress(): GemRB.SetVar("Class Kit", 0) GemRB.SetVar("Class", 6) GemRB.SetNextScript("GUICG7") return def ClassPress(): Class = GemRB.GetVar("Class")-1 GemRB.SetText(ClassWindow,TextAreaControl, GemRB.GetTableValue(ClassTable,Class,1) ) GemRB.SetButtonState(ClassWindow, DoneButton, IE_GUI_BUTTON_ENABLED) #if no kit selection for this class, don't go to guicg22 #GemRB.DrawWindows() #GemRB.UnloadWindow(ClassWindow) #GemRB.SetNextScript("GUICG22") return def BackPress(): GemRB.UnloadWindow(ClassWindow) GemRB.SetNextScript("CharGen3") GemRB.SetVar("Class",0) #scrapping the class value return def NextPress(): GemRB.UnloadWindow(ClassWindow) GemRB.SetNextScript("CharGen4") #alignment return --- NEW FILE: CharGen3.py --- #character generation (GUICG 0) import GemRB CharGenWindow = 0 TextAreaControl = 0 def OnLoad(): global CharGenWindow, TextAreaControl GemRB.SetVar("Class",0) #class #GemRB.SetVar("Class Kit",0) #class kit GemRB.LoadWindowPack("GUICG") CharGenWindow = GemRB.LoadWindow(0) PortraitButton = GemRB.GetControl(CharGenWindow, 12) GemRB.SetButtonFlags(CharGenWindow, PortraitButton, IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_NO_IMAGE,OP_SET) PortraitTable = GemRB.LoadTable("pictures") PortraitName = GemRB.GetTableRowName(PortraitTable,GemRB.GetVar("PortraitIndex") ) GemRB.SetButtonPicture(CharGenWindow,PortraitButton, PortraitName+"L") RaceTable = GemRB.LoadTable("races") GenderButton = GemRB.GetControl(CharGenWindow,0) GemRB.SetText(CharGenWindow,GenderButton,11956) GemRB.SetButtonState(CharGenWindow,GenderButton,IE_GUI_BUTTON_DISABLED) RaceButton = GemRB.GetControl(CharGenWindow,1) GemRB.SetText(CharGenWindow,RaceButton, 11957) GemRB.SetButtonState(CharGenWindow,RaceButton,IE_GUI_BUTTON_DISABLED) ClassButton = GemRB.GetControl(CharGenWindow,2) GemRB.SetText(CharGenWindow,ClassButton, 11959) GemRB.SetButtonState(CharGenWindow,ClassButton,IE_GUI_BUTTON_ENABLED) AlignmentButton = GemRB.GetControl(CharGenWindow,3) GemRB.SetText(CharGenWindow,AlignmentButton, 11958) GemRB.SetButtonState(CharGenWindow,AlignmentButton,IE_GUI_BUTTON_DISABLED) AbilitiesButton = GemRB.GetControl(CharGenWindow,4) GemRB.SetText(CharGenWindow,AbilitiesButton, 11960) GemRB.SetButtonState(CharGenWindow,AbilitiesButton,IE_GUI_BUTTON_DISABLED) SkillButton = GemRB.GetControl(CharGenWindow,5) GemRB.SetText(CharGenWindow,SkillButton, 17372) GemRB.SetButtonState(CharGenWindow,SkillButton,IE_GUI_BUTTON_DISABLED) AppearanceButton = GemRB.GetControl(CharGenWindow,6) GemRB.SetText(CharGenWindow,AppearanceButton, 11961) GemRB.SetButtonState(CharGenWindow,AppearanceButton,IE_GUI_BUTTON_DISABLED) NameButton = GemRB.GetControl(CharGenWindow,7) GemRB.SetText(CharGenWindow,NameButton, 11963) GemRB.SetButtonState(CharGenWindow,NameButton,IE_GUI_BUTTON_DISABLED) BackButton = GemRB.GetControl(CharGenWindow, 11) #GemRB.SetText(CharGenWindow, BackButton, 15416) GemRB.SetButtonState(CharGenWindow,BackButton,IE_GUI_BUTTON_ENABLED) AcceptButton = GemRB.GetControl(CharGenWindow, 8) GemRB.SetText(CharGenWindow, AcceptButton, 11962) GemRB.SetButtonState(CharGenWindow,AcceptButton,IE_GUI_BUTTON_DISABLED) ImportButton = GemRB.GetControl(CharGenWindow, 13) GemRB.SetText(CharGenWindow, ImportButton, 13955) GemRB.SetButtonState(CharGenWindow,ImportButton,IE_GUI_BUTTON_DISABLED) CancelButton = GemRB.GetControl(CharGenWindow, 15) GemRB.SetText(CharGenWindow, CancelButton, 13727) GemRB.SetButtonState(CharGenWindow,CancelButton,IE_GUI_BUTTON_ENABLED) TextAreaControl= GemRB.GetControl(CharGenWindow,9) GemRB.SetText(CharGenWindow, TextAreaControl, 12135) GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") if GemRB.GetVar("Gender") == 1: GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1050) else: GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1051) GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,1048,-1) # new line GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(RaceTable,GemRB.GetVar("Race")-1,2)) GemRB.SetEvent(CharGenWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "CancelPress") GemRB.SetEvent(CharGenWindow, BackButton, IE_GUI_BUTTON_ON_PRESS, "BackPress") GemRB.SetEvent(CharGenWindow, ClassButton, IE_GUI_BUTTON_ON_PRESS, "NextPress") GemRB.SetVisible(CharGenWindow,1) return def NextPress(): GemRB.UnloadWindow(CharGenWindow) GemRB.SetNextScript("GUICG2") #class return def CancelPress(): GemRB.UnloadWindow(CharGenWindow) GemRB.SetNextScript("CharGen") return def BackPress(): GemRB.UnloadWindow(CharGenWindow) GemRB.SetNextScript("CharGen2") #appearance return |