1 # GemRB - Infinity Engine Emulator
2 # Copyright (C) 2003 The GemRB Project
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #character generation, multi-class (GUICG10)
22 from ie_stats
import *
23 from GUIDefines
import *
32 global ClassWindow
, TextAreaControl
, DoneButton
, MyChar
34 GemRB
.LoadWindowPack("GUICG", 640, 480)
35 ClassWindow
= GemRB
.LoadWindow(10)
37 MyChar
= GemRB
.GetVar ("Slot")
38 ClassCount
= CommonTables
.Classes
.GetRowCount()+1
39 Race
= GemRB
.GetPlayerStat (MyChar
, IE_RACE
)
40 RaceName
= CommonTables
.Races
.GetRowName(CommonTables
.Races
.FindValue (3, Race
) )
43 for i
in range(1,ClassCount
):
44 if CommonTables
.Classes
.GetValue(i
-1,4)==0:
47 Button
= ClassWindow
.GetControl(j
+7)
49 Button
= ClassWindow
.GetControl(j
+2)
50 Button
.SetState(IE_GUI_BUTTON_DISABLED
)
51 Button
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
54 for i
in range(1,ClassCount
):
55 ClassName
= CommonTables
.Classes
.GetRowName(i
-1)
56 Allowed
= CommonTables
.Classes
.GetValue(ClassName
, RaceName
)
57 if CommonTables
.Classes
.GetValue(i
-1,4)==0:
60 Button
= ClassWindow
.GetControl(j
+7)
62 Button
= ClassWindow
.GetControl(j
+2)
64 t
= CommonTables
.Classes
.GetValue(i
-1, 0)
69 Button
.SetState(IE_GUI_BUTTON_ENABLED
)
70 Button
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, ClassPress
)
71 Button
.SetVarAssoc("Class", i
) #multiclass, actually
73 BackButton
= ClassWindow
.GetControl(14)
74 BackButton
.SetText(15416)
75 BackButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
76 DoneButton
= ClassWindow
.GetControl(0)
77 DoneButton
.SetText(11973)
78 DoneButton
.SetFlags (IE_GUI_BUTTON_DEFAULT
, OP_OR
)
80 TextAreaControl
= ClassWindow
.GetControl(12)
81 TextAreaControl
.SetText(17244)
83 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, NextPress
)
84 BackButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, BackPress
)
85 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
86 ClassWindow
.SetVisible(WINDOW_VISIBLE
)
91 Class
= GemRB
.GetVar("Class")-1
92 TextAreaControl
.SetText(CommonTables
.Classes
.GetValue(Class
,1) )
93 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
97 GemRB
.SetVar("Class",0) # scrapping it
100 GemRB
.SetNextScript("GUICG2")
108 # find the class from the class table
109 ClassIndex
= GemRB
.GetVar ("Class") - 1
110 Class
= CommonTables
.Classes
.GetValue (ClassIndex
, 5)
111 #protect against barbarians
112 ClassName
= CommonTables
.Classes
.GetRowName (CommonTables
.Classes
.FindValue (5, Class
) )
113 GemRB
.SetPlayerStat (MyChar
, IE_CLASS
, Class
)
115 GemRB
.SetNextScript("CharGen4") #alignment