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, race (GUICG2)
21 from GUIDefines
import *
22 from ie_stats
import *
33 global RaceWindow
, TextAreaControl
, DoneButton
36 if GUICommon
.CloseOtherWindow (OnLoad
):
42 GemRB
.SetVar("Race",0)
44 GemRB
.LoadWindowPack("GUICG")
45 RaceWindow
= GemRB
.LoadWindow(8)
47 RaceCount
= CommonTables
.Races
.GetRowCount()
49 for i
in range(2,RaceCount
+2):
50 Button
= RaceWindow
.GetControl(i
)
51 Button
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
52 for i
in range(2, RaceCount
+2):
53 Button
= RaceWindow
.GetControl(i
)
54 Button
.SetText(CommonTables
.Races
.GetValue(i
-2,0) )
55 Button
.SetState(IE_GUI_BUTTON_ENABLED
)
56 Button
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, RacePress
)
57 Button
.SetVarAssoc("Race",i
-1)
59 BackButton
= RaceWindow
.GetControl(10)
60 BackButton
.SetText(15416)
61 DoneButton
= RaceWindow
.GetControl(0)
62 DoneButton
.SetText(11973)
63 DoneButton
.SetFlags(IE_GUI_BUTTON_DEFAULT
,OP_OR
)
64 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
66 TextAreaControl
= RaceWindow
.GetControl(8)
67 TextAreaControl
.SetText(17237)
69 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, NextPress
)
70 BackButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, CharGenCommon
.BackPress
)
71 RaceWindow
.ShowModal(MODAL_SHADOW_NONE
)
75 Race
= GemRB
.GetVar("Race")-1
76 TextAreaControl
.SetText(CommonTables
.Races
.GetValue(Race
,1) )
77 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
81 Race
= GemRB
.GetVar ("Race") - 1
82 MyChar
= GemRB
.GetVar ("Slot")
83 GemRB
.SetPlayerStat (MyChar
, IE_RACE
, CommonTables
.Races
.GetValue (Race
, 3))