iwd: more gcw syncing with bg2 - actonpc and dragging
[gemrb.git] / gemrb / GUIScripts / bg2 / GUICG7.py
blobb9527253461fc4ed92d3c196398f2af38ba02369
1 # -*-python-*-
2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003-2004 The GemRB Project
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # character generation, mage spells (GUICG7)
21 import GemRB
22 import GUICommon
23 from ie_stats import *
24 from GUIDefines import *
25 import LUSpellSelection
27 def OnLoad():
28 KitTable = GemRB.LoadTable("magesch")
29 Slot = GemRB.GetVar ("Slot")
30 Class = GemRB.GetPlayerStat (Slot, IE_CLASS)
31 TableName = GUICommon.ClassSkillsTable.GetValue(Class, 2)
33 # make sure we have a correct table
34 if TableName == "*":
35 GemRB.SetNextScript("GUICG6")
36 return
37 if Class == 19:
38 # sorcerer's need their known not max table
39 TableName = "SPLSRCKN"
41 # get our kit index
42 KitIndex = GUICommon.GetKitIndex (Slot)
43 if KitIndex:
44 KitValue = KitTable.GetValue(KitIndex - 21, 3)
46 # bards have kits too
47 if KitValue == -1:
48 KitValue = 0x4000 # we only need it for the spells, so this is ok
49 else:
50 KitValue = 0x4000
52 # open up the spell selection window
53 # remember, it is pc, table, level, diff, kit, chargen
54 IsMulti = GUICommon.IsMultiClassed (Slot, 1)
55 Level = GemRB.GetPlayerStat (Slot, IE_LEVEL)
56 if IsMulti[0]>1:
57 for i in range (2, IsMulti[0]+1):
58 if GUICommon.ClassSkillsTable.GetValue (IsMulti[i], 2, 0) != "*":
59 Level = GemRB.GetPlayerStat (Slot, IE_LEVEL2+i-1)
60 break
61 LUSpellSelection.OpenSpellsWindow (Slot, TableName, Level, Level, KitValue, 1)
63 return