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 GUIDefines
import *
22 from ie_stats
import *
33 #the size of the selection list
39 TopIndex
=GemRB
.GetVar("TopIndex")
40 for i
in range(LISTSIZE
):
41 Button
= RaceWindow
.GetControl(i
+2)
42 Val
= RacialEnemyTable
.GetValue(i
+TopIndex
,0)
45 Button
.SetState(IE_GUI_BUTTON_DISABLED
)
48 Button
.SetState(IE_GUI_BUTTON_ENABLED
)
49 Button
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, RacePress
)
50 Button
.SetVarAssoc("HatedRace",RacialEnemyTable
.GetValue(i
+TopIndex
,1) )
54 global RaceWindow
, TextAreaControl
, DoneButton
55 global RacialEnemyTable
, RaceCount
, TopIndex
57 if GUICommon
.CloseOtherWindow (OnLoad
):
63 GemRB
.SetVar ("HatedRace",0)
65 ClassRow
= GemRB
.GetVar("Class")-1
66 Class
= CommonTables
.Classes
.GetValue(ClassRow
, 5)
67 ClassName
= CommonTables
.ClassSkills
.GetRowName(Class
)
68 TableName
= CommonTables
.ClassSkills
.GetValue(ClassName
, "HATERACE")
70 GemRB
.LoadWindowPack("GUICG")
71 RaceWindow
= GemRB
.LoadWindow(15)
72 RacialEnemyTable
= GemRB
.LoadTable(TableName
)
73 RaceCount
= RacialEnemyTable
.GetRowCount()-LISTSIZE
+1
77 for i
in range(LISTSIZE
):
78 Button
= RaceWindow
.GetControl(i
+2)
79 Button
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
80 Button
.SetSprites("GUIHRC",i
,0,1,2,3)
82 BackButton
= RaceWindow
.GetControl(10)
83 BackButton
.SetText(15416)
84 DoneButton
= RaceWindow
.GetControl(11)
85 DoneButton
.SetText(11973)
86 DoneButton
.SetFlags(IE_GUI_BUTTON_DEFAULT
,OP_OR
)
87 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
89 TextAreaControl
= RaceWindow
.GetControl(8)
90 TextAreaControl
.SetText(17256)
92 GemRB
.SetVar("TopIndex",0)
93 ScrollBarControl
= RaceWindow
.GetControl(1)
94 ScrollBarControl
.SetVarAssoc("TopIndex",RaceCount
)
95 ScrollBarControl
.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE
, DisplayRaces
)
97 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, NextPress
)
98 BackButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, CharGenCommon
.BackPress
)
99 RaceWindow
.ShowModal(MODAL_SHADOW_NONE
)
104 Race
= GemRB
.GetVar("HatedRace")
105 Row
= RacialEnemyTable
.FindValue(1, Race
)
106 TextAreaControl
.SetText(RacialEnemyTable
.GetValue(Row
, 2) )
107 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
111 MyChar
= GemRB
.GetVar ("Slot")
112 GemRB
.SetPlayerStat (MyChar
, IE_HATEDRACE
, GemRB
.GetVar ("HatedRace") )