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, racial enemy (GUICG15)
21 from GUICommon
import *
30 #the size of the selection list
36 TopIndex
=GemRB
.GetVar("TopIndex")
37 for i
in range(LISTSIZE
):
38 Button
= RaceWindow
.GetControl(i
+6)
39 Val
= RaceTable
.GetValue(i
+TopIndex
,0)
42 Button
.SetState(IE_GUI_BUTTON_DISABLED
)
45 Button
.SetState(IE_GUI_BUTTON_ENABLED
)
46 Button
.SetEvent(IE_GUI_BUTTON_ON_PRESS
,"RacePress")
47 Button
.SetVarAssoc("HatedRace",RaceTable
.GetValue(i
+TopIndex
,1) )
51 global RaceWindow
, TextAreaControl
, DoneButton
52 global RaceTable
, RaceCount
, TopIndex
, MyChar
54 MyChar
= GemRB
.GetVar ("Slot")
55 Class
= GemRB
.GetPlayerStat (MyChar
, IE_CLASS
)
56 Class
= ClassTable
.FindValue (5, Class
)
57 ClassName
= ClassTable
.GetRowName(Class
)
58 TableName
= ClassSkillsTable
.GetValue(ClassName
, "HATERACE")
60 GemRB
.SetNextScript("GUICG7")
62 GemRB
.LoadWindowPack("GUICG", 640, 480)
63 RaceWindow
= GemRB
.LoadWindowObject(15)
64 RaceTable
= GemRB
.LoadTableObject(TableName
)
65 RaceCount
= RaceTable
.GetRowCount()-LISTSIZE
+1
70 GemRB
.SetVar("TopIndex", 0)
71 ScrollBarControl
= RaceWindow
.GetControl(1)
72 ScrollBarControl
.SetVarAssoc("TopIndex", RaceCount
)
73 ScrollBarControl
.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE
, "DisplayRaces")
74 ScrollBarControl
.SetDefaultScrollBar ()
76 for i
in range(LISTSIZE
):
77 Button
= RaceWindow
.GetControl(i
+6)
78 Button
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
80 GemRB
.SetVar("HatedRace",0)
82 BackButton
= RaceWindow
.GetControl(4)
83 BackButton
.SetText(15416)
84 BackButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
85 DoneButton
= RaceWindow
.GetControl(5)
86 DoneButton
.SetText(11973)
87 DoneButton
.SetFlags(IE_GUI_BUTTON_DEFAULT
,OP_OR
)
88 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
90 TextAreaControl
= RaceWindow
.GetControl(2)
91 TextAreaControl
.SetText(17256)
93 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
,"NextPress")
94 BackButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
,"BackPress")
95 RaceWindow
.SetVisible(WINDOW_VISIBLE
)
100 Race
= GemRB
.GetVar("HatedRace")
101 Row
= RaceTable
.FindValue(1, Race
)
102 TextAreaControl
.SetText(RaceTable
.GetValue(Row
, 2) )
103 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
109 GemRB
.SetPlayerStat (MyChar
, IE_HATEDRACE
, 0) #scrapping the race value
110 GemRB
.SetNextScript("CharGen6")
116 # save the hated race
117 GemRB
.SetPlayerStat (MyChar
, IE_HATEDRACE
, GemRB
.GetVar ("HatedRace"))
119 GemRB
.SetNextScript("GUICG7") #mage spells