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)
22 from GUIDefines
import *
23 from ie_stats
import *
32 #the size of the selection list
38 TopIndex
=GemRB
.GetVar("TopIndex")
39 for i
in range(LISTSIZE
):
40 Button
= RaceWindow
.GetControl(i
+6)
41 Val
= RaceTable
.GetValue(i
+TopIndex
,0)
44 Button
.SetState(IE_GUI_BUTTON_DISABLED
)
47 Button
.SetState(IE_GUI_BUTTON_ENABLED
)
48 Button
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, RacePress
)
49 Button
.SetVarAssoc("HatedRace",RaceTable
.GetValue(i
+TopIndex
,1) )
53 global RaceWindow
, TextAreaControl
, DoneButton
54 global RaceTable
, RaceCount
, TopIndex
, MyChar
56 MyChar
= GemRB
.GetVar ("Slot")
57 Class
= GemRB
.GetPlayerStat (MyChar
, IE_CLASS
)
58 Class
= CommonTables
.Classes
.FindValue (5, Class
)
59 ClassName
= CommonTables
.Classes
.GetRowName(Class
)
60 TableName
= CommonTables
.ClassSkills
.GetValue(ClassName
, "HATERACE")
62 GemRB
.SetNextScript("GUICG7")
64 GemRB
.LoadWindowPack("GUICG", 640, 480)
65 RaceWindow
= GemRB
.LoadWindow(15)
66 RaceTable
= GemRB
.LoadTable(TableName
)
67 RaceCount
= RaceTable
.GetRowCount()-LISTSIZE
+1
72 GemRB
.SetVar("TopIndex", 0)
73 ScrollBarControl
= RaceWindow
.GetControl(1)
74 ScrollBarControl
.SetVarAssoc("TopIndex", RaceCount
)
75 ScrollBarControl
.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE
, DisplayRaces
)
76 ScrollBarControl
.SetDefaultScrollBar ()
78 for i
in range(LISTSIZE
):
79 Button
= RaceWindow
.GetControl(i
+6)
80 Button
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
82 GemRB
.SetVar("HatedRace",0)
84 BackButton
= RaceWindow
.GetControl(4)
85 BackButton
.SetText(15416)
86 BackButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
87 DoneButton
= RaceWindow
.GetControl(5)
88 DoneButton
.SetText(11973)
89 DoneButton
.SetFlags(IE_GUI_BUTTON_DEFAULT
,OP_OR
)
90 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
92 TextAreaControl
= RaceWindow
.GetControl(2)
93 TextAreaControl
.SetText(17256)
95 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, NextPress
)
96 BackButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, BackPress
)
97 RaceWindow
.SetVisible(WINDOW_VISIBLE
)
102 Race
= GemRB
.GetVar("HatedRace")
103 Row
= RaceTable
.FindValue(1, Race
)
104 TextAreaControl
.SetText(RaceTable
.GetValue(Row
, 2) )
105 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
111 GemRB
.SetPlayerStat (MyChar
, IE_HATEDRACE
, 0) #scrapping the race value
112 GemRB
.SetNextScript("CharGen6")
118 # save the hated race
119 GemRB
.SetPlayerStat (MyChar
, IE_HATEDRACE
, GemRB
.GetVar ("HatedRace"))
121 GemRB
.SetNextScript("GUICG7") #mage spells