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, import (GUICG24)
22 #import from a character sheet
27 global ImportWindow
, TextAreaControl
29 GemRB
.LoadWindowPack("GUICG",640,480)
30 ImportWindow
= GemRB
.LoadWindow(20)
32 TextAreaControl
= ImportWindow
.GetControl(4)
33 TextAreaControl
.SetText(10963)
35 TextAreaControl
= ImportWindow
.GetControl(2)
36 TextAreaControl
.SetFlags (IE_GUI_TEXTAREA_SELECTABLE
)
37 TextAreaControl
.GetCharacters()
39 DoneButton
= ImportWindow
.GetControl(0)
40 DoneButton
.SetText(2610)
41 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
42 DoneButton
.SetFlags (IE_GUI_BUTTON_DEFAULT
, OP_OR
)
44 CancelButton
= ImportWindow
.GetControl(1)
45 CancelButton
.SetText(15416)
46 CancelButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
48 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, DonePress
)
49 CancelButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, CancelPress
)
50 TextAreaControl
.SetEvent(IE_GUI_TEXTAREA_ON_CHANGE
, SelectPress
)
51 ImportWindow
.SetVisible(WINDOW_VISIBLE
)
55 DoneButton
= ImportWindow
.GetControl(0)
56 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
60 FileName
= TextAreaControl
.QueryText()
61 Slot
= GemRB
.GetVar("Slot")
62 GemRB
.CreatePlayer(FileName
, Slot|
0x8000, 1, 11) # 11 = force bg2
65 # the medium portrait isn't available, so we copy the original hack
66 MediumPortrait
= GemRB
.GetPlayerPortrait (Slot
, 1)[0:-1] + "M"
67 GemRB
.SetToken("SmallPortrait", GemRB
.GetPlayerPortrait (Slot
, 1) )
68 GemRB
.SetToken("LargePortrait", MediumPortrait
)
69 GemRB
.SetNextScript("CharGen7")
75 GemRB
.SetNextScript(GemRB
.GetToken("NextScript"))