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.
20 # LevelUp.py - scripts to control the level up functionality and windows
22 from GUIDefines
import *
23 from ie_stats
import *
24 from ie_restype
import RES_2DA
25 from GUICommon
import HasTOB
, GetLearnablePriestSpells
, GetMageSpells
, HasSpell
, AddClassAbilities
, GameIsBG2
26 from GUIREC
import GetStatOverview
, UpdateRecordsWindow
, GetActorClassTitle
, GSNN
27 from GUICommonWindows
import *
28 from LUCommon
import *
29 from LUSpellSelection
import *
31 from LUHLASelection
import *
32 from LUProfsSelection
import *
33 from LUSkillsSelection
import *
54 # old values (so we don't add too much)
55 OldHPMax
= 0 # << old maximum hitpoints
56 OldSaves
= [0]*5 # << old saves
57 OldThaco
= 0 # << old thac0 value
58 OldLore
= 0 # << old lore value
59 OldDSpells
= [0]*7 # << old divine spells per level
60 OldWSpells
= [0]*9 # << old wizard spells per level
61 NewDSpells
= [0]*7 # << new divine spells per level
62 NewWSpells
= [0]*9 # << new wizard spells per level
63 DeltaDSpells
= 0 # << total new divine spells
64 DeltaWSpells
= 0 # << total new wizard spells
66 def OpenLevelUpWindow():
67 """Sets up the level up window."""
69 global LevelUpWindow
, TextAreaControl
, NewProfPoints
, actor
71 global NewSkillPoints
, KitName
, LevelDiff
, RaceTable
72 global ClassTable
, Level
, Classes
, NumClasses
, DualSwap
, ClassSkillsTable
, IsMulti
73 global OldHPMax
, OldSaves
, OldLore
, OldThaco
, DeltaDSpells
, DeltaWSpells
74 global NewDSpells
, NewWSpells
, OldDSpells
, OldWSpells
, pc
, HLACount
, ClassName
, IsDual
76 LevelUpWindow
= GemRB
.LoadWindowObject (3)
78 InfoButton
= LevelUpWindow
.GetControl (125)
79 InfoButton
.SetText (13707)
80 InfoButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, "LevelUpInfoPress")
82 DoneButton
= LevelUpWindow
.GetControl (0)
83 DoneButton
.SetText (11962)
84 DoneButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, "LevelUpDonePress")
85 DoneButton
.SetState (IE_GUI_BUTTON_DISABLED
)
86 DoneButton
.SetFlags (IE_GUI_BUTTON_DEFAULT
, OP_OR
)
88 # hide "Character Generation"
89 Label
= LevelUpWindow
.CreateLabel (0x1000007e, 0,0,0,0,"NUMBER","",1)
92 pc
= GemRB
.GameGetSelectedPCSingle ()
94 Label
= LevelUpWindow
.GetControl (0x10000000+90)
95 Label
.SetText (GemRB
.GetPlayerName (pc
))
98 OldHPMax
= GemRB
.GetPlayerStat (pc
, IE_MAXHITPOINTS
, 1)
99 OldThaco
= GemRB
.GetPlayerStat (pc
, IE_TOHIT
, 1)
100 OldLore
= GemRB
.GetPlayerStat (pc
, IE_LORE
, 1)
102 OldSaves
[i
] = GemRB
.GetPlayerStat (pc
, IE_SAVEVSDEATH
+i
, 1)
105 Label
= LevelUpWindow
.GetControl (0x10000000+106)
106 Label
.SetText (GetActorClassTitle (pc
))
107 print "Title:",GetActorClassTitle (pc
),"\tActor Title:",actor
.ClassTitle()
109 Class
= GemRB
.GetPlayerStat (pc
, IE_CLASS
)
110 print "Class:",Class
,"\tActor Class:",actor
.classid
111 ClassIndex
= ClassTable
.FindValue (5, Class
)
112 SkillTable
= GemRB
.LoadTableObject("skills")
115 ClassName
= ClassTable
.GetRowName(ClassIndex
)
116 Kit
= GetKitIndex (pc
)
117 print "Kit:", Kit
, "\tActor Kit:",actor
.KitIndex()
118 print "ClassName:",ClassName
,"\tActor ClassNames:",actor
.ClassNames()
120 # need this for checking gnomes
121 RaceName
= GemRB
.GetPlayerStat (pc
, IE_RACE
, 1)
122 RaceName
= RaceTable
.FindValue (3, RaceName
)
123 RaceName
= RaceTable
.GetRowName (RaceName
)
125 # figure our our proficiency table and index
129 #rowname is just a number, the kitname is the first data column
130 KitName
= KitListTable
.GetValue(Kit
, 0)
132 # our multiclass variables
133 IsMulti
= IsMultiClassed (pc
, 1)
134 Classes
= [IsMulti
[1], IsMulti
[2], IsMulti
[3]]
135 NumClasses
= IsMulti
[0] # 2 or 3 if IsMulti; 0 otherwise
136 IsMulti
= NumClasses
> 1
140 # not multi, check dual
142 # check if we're dual classed
143 IsDual
= IsDualClassed (pc
, 1)
144 Classes
= [IsDual
[2], IsDual
[1]] # make sure the new class is first
146 # either dual or single only care about 1 class
149 # not dual, must be single
152 else: # make sure Classes[1] is a class, not a kit
153 if IsDual
[0] == 1: # kit
154 Classes
[1] = KitListTable
.GetValue (IsDual
[1], 7)
156 Classes
[1] = ClassTable
.GetValue (Classes
[1], 5)
158 # store a boolean for IsDual
159 IsDual
= IsDual
[0] > 0
161 print "NumClasses:",NumClasses
,"\tActor NumClasses:",actor
.NumClasses()
166 # reorganize the leves if we're dc so the one we want to use is in Level[0]
167 # and the old one is in Level[1] (used to regain old class abilities)
169 # convert the classes from indicies to class id's
170 DualSwap
= IsDualSwap (pc
)
171 ClassName
= ClassTable
.GetRowName (Classes
[0])
172 KitName
= ClassName
# for simplicity throughout the code
173 Classes
[0] = ClassTable
.GetValue (Classes
[0], 5)
174 # Class[1] is taken care of above
176 # we need the old level as well
178 Level
[1] = GemRB
.GetPlayerStat (pc
, IE_LEVEL
)
180 Level
[1] = GemRB
.GetPlayerStat (pc
, IE_LEVEL2
)
182 print "Classes:",Classes
,"\tActor Classes:",actor
.Classes()
183 print "IsDual:",IsDual
>0,"\tActor IsDual",actor
.isdual
190 # get a bunch of different things each level
191 for i
in range(NumClasses
):
192 # print "Class:",Classes[i]
193 # we don't care about the current level, but about the to-be-achieved one
195 Level
[i
] = GetNextLevelFromExp (GemRB
.GetPlayerStat (pc
, IE_XP
)/NumClasses
, Classes
[i
])
196 TmpIndex
= ClassTable
.FindValue (5, Classes
[i
])
197 TmpName
= ClassTable
.GetRowName (TmpIndex
)
199 # print "Name:",TmpName
201 # find the level diff for each classes (3 max, obviously)
204 LevelDiff
[i
] = Level
[i
] - GemRB
.GetPlayerStat (pc
, IE_LEVEL2
)
206 LevelDiff
[i
] = Level
[i
] - GemRB
.GetPlayerStat (pc
, IE_LEVEL
)
208 LevelDiff
[i
] = Level
[i
] - GemRB
.GetPlayerStat (pc
, IE_LEVEL2
)
210 LevelDiff
[i
] = Level
[i
] - GemRB
.GetPlayerStat (pc
, IE_LEVEL3
)
212 # print "Level (",i,"):",Level[i]
213 # print "Level Diff (",i,"):",LevelDiff[i]
215 # save our current and next spell amounts
216 StartLevel
= Level
[i
] - LevelDiff
[i
]
217 DruidTable
= ClassSkillsTable
.GetValue (Classes
[i
], 0, 0)
218 ClericTable
= ClassSkillsTable
.GetValue (Classes
[i
], 1, 0)
219 MageTable
= ClassSkillsTable
.GetValue (Classes
[i
], 2, 0)
221 # see if we have mage spells
223 # we get 1 extra spell per level if we're a specialist
225 if KitListTable
.GetValue (Kit
, 7) == 1: # see if we're a kitted mage
227 MageTable
= GemRB
.LoadTableObject (MageTable
)
228 # loop through each spell level and save the amount possible to cast (current)
229 for j
in range (MageTable
.GetColumnCount ()):
230 NewWSpells
[j
] = MageTable
.GetValue (str(Level
[i
]), str(j
+1), 1)
231 OldWSpells
[j
] = MageTable
.GetValue (str(StartLevel
), str(j
+1), 1)
232 if NewWSpells
[j
] > 0: # don't want specialist to get 1 in levels they should have 0
233 NewWSpells
[j
] += Specialist
234 if OldWSpells
[j
] > 0:
235 OldWSpells
[j
] += Specialist
236 DeltaWSpells
= sum(NewWSpells
)-sum(OldWSpells
)
237 elif ClericTable
!= "*":
238 # check for cleric spells
239 ClericTable
= GemRB
.LoadTableObject (ClericTable
)
242 for j
in range (ClericTable
.GetColumnCount ()):
243 NewDSpells
[j
] = ClericTable
.GetValue (str(Level
[i
]), str(j
+1), 1)
244 OldDSpells
[j
] = ClericTable
.GetValue (str(StartLevel
), str(j
+1), 1)
245 DeltaDSpells
= sum(NewDSpells
)-sum(OldDSpells
)
246 elif DruidTable
!= "*":
247 # clerics have precedence in multis (ranger/cleric)
249 #use MXSPLPRS if we can't find the resource (SoA fix)
250 if not GemRB
.HasResource (DruidTable
, RES_2DA
):
251 DruidTable
= "MXSPLPRS"
254 DruidTable
= GemRB
.LoadTableObject (DruidTable
)
256 for j
in range (DruidTable
.GetColumnCount ()):
257 NewDSpells
[j
] = DruidTable
.GetValue (str(Level
[i
]), str(j
+1), 1)
258 OldDSpells
[j
] = DruidTable
.GetValue (str(StartLevel
), str(j
+1), 1)
259 DeltaDSpells
= sum(NewDSpells
)-sum(OldDSpells
)
261 # setup class bonuses for this class
262 if IsMulti
or IsDual
or Kit
== 0:
263 ABTable
= ClassSkillsTable
.GetValue (TmpName
, "ABILITIES")
264 else: # single-classed with a kit
265 ABTable
= KitListTable
.GetValue (str(Kit
), "ABILITIES")
267 # add the abilites if we aren't a mage and have a table to ref
268 if ABTable
!= "*" and ABTable
[:6] != "CLABMA":
269 AddClassAbilities (pc
, ABTable
, Level
[i
], LevelDiff
[i
])
271 print "Actor CurrentLevels:",actor
.Levels()
272 print "Levels:",Level
,"Actor NextLevels:",actor
.NextLevels()
273 print "LevelDiffs:",LevelDiff
,"Actor LevelDiffs:",actor
.LevelDiffs()
275 #update our saves, thaco, hp and lore
276 SetupSavingThrows (pc
, Level
)
277 SetupThaco (pc
, Level
)
278 SetupLore (pc
, LevelDiff
)
279 SetupHP (pc
, Level
, LevelDiff
)
281 # use total levels for HLAs
283 if HasTOB(): # make sure SoA doesn't try to get it
284 HLATable
= GemRB
.LoadTableObject("lunumab")
285 # we need to check each level against a multi value (this is kinda screwy)
287 print "Actor HLA Names:",["MULTI"+str(actor
.NumClasses())+name \
288 for name
in actor
.ClassNames()]
290 print "Actor HLA Names:",actor
.ClassNames()
292 for i
in range (NumClasses
):
294 # get the row name for lookup ex. MULTI2FIGHTER, MULTI3THIEF
295 MultiName
= ClassTable
.FindValue (5, Classes
[i
])
296 MultiName
= ClassTable
.GetRowName (MultiName
)
297 MultiName
= "MULTI" + str(NumClasses
) + MultiName
299 MultiName
= ClassName
301 # if we can't learn for this class, we can't learn at all
302 FirstLevel
= HLATable
.GetValue (MultiName
, "FIRST_LEVEL", 1)
303 if Level
[i
] < FirstLevel
:
307 if (Level
[i
] - LevelDiff
[i
]) < FirstLevel
:
308 # count only from FirstLevel up
309 HLACount
+= (Level
[i
] - FirstLevel
+ 1)
311 HLACount
+= LevelDiff
[i
]
313 # set values required by the hla level up code
314 HLACount
= HLACount
/ HLATable
.GetValue (ClassName
, "RATE", 1)
315 GemRB
.SetVar ("HLACount", HLACount
)
316 HLAButton
= LevelUpWindow
.GetControl (126)
318 HLAButton
.SetText (4954)
319 HLAButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, "LevelUpHLAPress")
321 HLAButton
.SetFlags (IE_GUI_BUTTON_DISABLED
, OP_OR
)
325 for i
in range (len (Level
)):
326 Level1
.append (Level
[i
]-LevelDiff
[i
])
327 SetupProfsWindow (pc
, LUPROFS_TYPE_LEVELUP
, LevelUpWindow
, RedrawSkills
, Level1
, Level
)
328 NewProfPoints
= GemRB
.GetVar ("ProfsPointsLeft")
330 #we autohide the skills and let SetupSkillsWindow show them if needbe
333 SetupSkillsWindow (pc
, LUSKILLS_TYPE_LEVELUP
, LevelUpWindow
, RedrawSkills
, Level1
, Level
)
334 NewSkillPoints
= GemRB
.GetVar ("SkillPointsLeft")
336 TextAreaControl
= LevelUpWindow
.GetControl(110)
337 TextAreaControl
.SetText(GetLevelUpNews())
340 GemRB
.SetRepeatClickFlags (GEM_RK_DISABLE
, OP_NAND
)
341 LevelUpWindow
.ShowModal (MODAL_SHADOW_GRAY
)
343 # if we have a sorcerer who can learn spells, we need to do spell selection
344 if (Classes
[0] == 19) and (DeltaWSpells
> 0): # open our sorc spell selection window
345 OpenSpellsWindow (pc
, "SPLSRCKN", Level
[0], LevelDiff
[0])
348 """Hides the given skill label from view."""
351 Label
= LevelUpWindow
.GetControl (0x10000000+32+i
)
353 Button1
= LevelUpWindow
.GetControl(i
*2+17)
354 Button1
.SetState(IE_GUI_BUTTON_DISABLED
)
355 Button1
.SetFlags(IE_GUI_BUTTON_NO_IMAGE
,OP_OR
)
356 Button2
= LevelUpWindow
.GetControl(i
*2+18)
357 Button2
.SetState(IE_GUI_BUTTON_DISABLED
)
358 Button2
.SetFlags(IE_GUI_BUTTON_NO_IMAGE
,OP_OR
)
359 Label
= LevelUpWindow
.GetControl(0x10000000+43+i
)
363 """Redraws the entire window.
365 Called whenever a state changes, such as a proficiency or skill being
366 added or taken away."""
368 global DoneButton
, LevelUpWindow
, HLACount
370 # we need to disable the HLA button if we don't have any HLAs left
371 HLACount
= GemRB
.GetVar ("HLACount")
373 # turn the HLA button off
374 HLAButton
= LevelUpWindow
.GetControl (126)
375 HLAButton
.SetState(IE_GUI_BUTTON_DISABLED
)
377 # enable the done button if they've allocated all points
378 # sorcerer spell selection (if applicable) comes after hitting the done button
379 ProfPointsLeft
= GemRB
.GetVar ("ProfsPointsLeft")
380 SkillPointsLeft
= GemRB
.GetVar ("SkillPointsLeft")
381 if ProfPointsLeft
== 0 and SkillPointsLeft
== 0 and HLACount
== 0:
382 DoneButton
.SetState (IE_GUI_BUTTON_ENABLED
)
384 DoneButton
.SetState (IE_GUI_BUTTON_DISABLED
)
387 def GetLevelUpNews():
388 """Returns a string containing improvements gain on level up.
390 These include: HP, spells per level, and lore, among others."""
392 News
= GemRB
.GetString (5259) + '\n\n'
394 # display if our class has been reactivated
396 if (Level
[0] - LevelDiff
[0]) <= Level
[1] and Level
[0] > Level
[1]:
397 News
= GemRB
.GetString (5261) + '\n\n'
399 # 5271 - Additional weapon proficiencies
400 if NewProfPoints
> 0:
401 News
+= GemRB
.GetString (5271) + ": " + str(NewProfPoints
) + '\n\n'
403 # temps to compare all our new saves against (we get the best of our saving throws)
407 for i
in range(NumClasses
):
409 TmpClassName
= ClassTable
.FindValue (5, Classes
[i
])
410 TmpClassName
= ClassTable
.GetRowName (TmpClassName
)
413 # NOTE: Stalkers and assassins should get the correct mods at the correct levels based
414 # on AP_SPCL332 in their respective CLAB files.
415 # APND: Stalkers appear to get the correct mod at the correct levels; however, because they start
416 # at backstab multi x1, they are x1 too many at their respective levels.
417 if Classes
[i
] == 4 and GemRB
.GetPlayerStat (pc
, IE_BACKSTABDAMAGEMULTIPLIER
, 1) > 1: # we have a thief who can backstab (2 at level 1)
418 # save the backstab multiplier if we have a thief
419 BackstabTable
= GemRB
.LoadTableObject ("BACKSTAB")
420 BackstabMult
= BackstabTable
.GetValue (0, Level
[i
])
423 if (ClassSkillsTable
.GetValue (Classes
[i
], 6) != "*"):
424 # inquisitors and undead hunters don't get lay on hands out the chute, whereas cavaliers
425 # and unkitted paladins do; therefore, we check for the existence of lay on hands to ensure
426 # the character should get the new value; LoH is defined in GA_SPCL211 if anyone wants to
427 # make a pally kit with LoH
428 if (HasSpell (pc
, IE_SPELL_TYPE_INNATE
, 0, "SPCL211") >= 0):
429 LOHTable
= GemRB
.LoadTableObject ("layhands")
430 LOHGain
= LOHTable
.GetValue (0, Level
[i
]) - LOHTable
.GetValue (0, Level
[i
]-LevelDiff
[i
])
438 # include in news if the save is updated
441 CurrentSave
= GemRB
.GetPlayerStat (pc
, IE_SAVEVSDEATH
+i
, 1)
448 if CurrentSave
< OldSaves
[i
]:
449 News
+= GemRB
.GetString (SaveString
) + ": " + str(OldSaves
[i
]-CurrentSave
) + '\n'
454 # 5305 - THAC0 Reduced by
455 # only output if there is a change in thaco
456 NewThaco
= GemRB
.GetPlayerStat (pc
, IE_TOHIT
, 1)
457 if (NewThaco
< OldThaco
):
458 News
+= GemRB
.GetString (5305) + ": " + str(OldThaco
-NewThaco
) + '\n\n'
461 # 5373 - Additional Priest Spells
462 # 5374 - Additional Mage Spells
463 # 61269 - Level <LEVEL> Spells
464 if DeltaDSpells
> 0: # new divine spells
465 News
+= GemRB
.GetString (5373) + '\n'
466 for i
in range (len (NewDSpells
)):
467 # only display classes with new spells
468 if (NewDSpells
[i
]-OldDSpells
[i
]) == 0:
470 GemRB
.SetToken("level", str(i
+1))
471 News
+= GemRB
.GetString(61269)+": " + str(NewDSpells
[i
]-OldDSpells
[i
]) + '\n'
473 if DeltaWSpells
> 0: # new wizard spells
474 News
+= GemRB
.GetString (5374) + '\n'
475 for i
in range (len (NewWSpells
)):
476 # only display classes with new spells
477 if (NewWSpells
[i
]-OldWSpells
[i
]) == 0:
479 GemRB
.SetToken("level", str(i
+1))
480 News
+= GemRB
.GetString(61269)+": " + str(NewWSpells
[i
]-OldWSpells
[i
]) + '\n'
483 # 5375 - Backstab Multiplier Increased by
484 # this auto-updates... we just need to inform of the update
485 BSGain
= BackstabMult
- GemRB
.GetPlayerStat (pc
, IE_BACKSTABDAMAGEMULTIPLIER
, 1)
487 News
+= GemRB
.GetString (5375) + ": " + str(BSGain
) + '\n\n'
489 # 5376 - Lay on Hands increased
491 News
+= GemRB
.GetString (5376) + ": " + str(LOHGain
) + '\n\n'
493 # 5293 - HP increased by
494 if (OldHPMax
!= GemRB
.GetPlayerStat (pc
, IE_MAXHITPOINTS
, 1)):
495 News
+= GemRB
.GetString (5293) + ": " + str(GemRB
.GetPlayerStat (pc
, IE_MAXHITPOINTS
, 1) - OldHPMax
) + '\n'
497 # 5377 - Lore Increased by
498 # add the lore gain if we haven't done so already
499 NewLore
= GemRB
.GetPlayerStat (pc
, IE_LORE
, 1)
500 if NewLore
> OldLore
:
501 News
+= GemRB
.GetString (5377) + ": " + str(NewLore
-OldLore
) + '\n\n'
503 # 5378 - Additional Skill Points
504 # ranger and bard skill(point) gain is not mentioned here in the original
505 if NewSkillPoints
> 0:
506 News
+= GemRB
.GetString (5378) + ": " + str(NewSkillPoints
) + '\n'
510 def LevelUpInfoPress():
511 """Displays new abilites gained on level up.
513 Alternates between overall and modified stats."""
515 global LevelUpWindow
, TextAreaControl
, InfoCounter
, LevelDiff
518 # call GetStatOverview with the new levels, so the future overview is shown
519 # TODO: show only xp, levels, thac0, #att, lore, reputation, backstab, saving throws
520 TextAreaControl
.SetText(GetStatOverview(pc
, LevelDiff
))
522 TextAreaControl
.SetText(GetLevelUpNews())
527 def LevelUpDonePress():
528 """Updates the PC with the new choices.
530 Closes the window when finished."""
541 if DualSwap
: # swap the IE_LEVELs around if a backward dual
542 GemRB
.SetPlayerStat (pc
, IE_LEVEL2
, Level
[0])
543 GemRB
.SetPlayerStat (pc
, IE_LEVEL
, Level
[1])
545 GemRB
.SetPlayerStat (pc
, IE_LEVEL
, Level
[0])
546 GemRB
.SetPlayerStat (pc
, IE_LEVEL2
, Level
[1])
547 GemRB
.SetPlayerStat (pc
, IE_LEVEL3
, Level
[2])
549 print "Levels:",Level
[0],"/",Level
[1],"/",Level
[2]
551 # save our number of memorizable spells per level
553 # loop through each wizard spell level
554 for i
in range(len(NewWSpells
)):
555 if NewWSpells
[i
] > 0: # we have new spells, so update
556 GemRB
.SetMemorizableSpellsCount(pc
, NewWSpells
[i
], IE_SPELL_TYPE_WIZARD
, i
)
558 # save our number of memorizable priest spells
559 if DeltaDSpells
> 0: # druids and clerics count
560 for i
in range (len(NewDSpells
)):
562 if NewDSpells
[i
] > 0:
563 GemRB
.SetMemorizableSpellsCount (pc
, NewDSpells
[i
], IE_SPELL_TYPE_PRIEST
, i
)
565 # learn all the spells we're given, but don't have, up to our given casting level
566 if GemRB
.GetMemorizableSpellsCount (pc
, IE_SPELL_TYPE_PRIEST
, i
, 1) > 0: # we can memorize spells of this level
567 for j
in range(NumClasses
): # loop through each class
568 IsDruid
= ClassSkillsTable
.GetValue (Classes
[j
], 0, 0)
569 IsCleric
= ClassSkillsTable
.GetValue (Classes
[j
], 1, 0)
570 if IsCleric
== "*" and IsDruid
== "*": # no divine spells (so mage/cleric multis don't screw up)
572 elif IsCleric
== "*": # druid spells
574 else: # cleric spells
577 Learnable
= GetLearnablePriestSpells(ClassFlag
, GemRB
.GetPlayerStat (pc
, IE_ALIGNMENT
), i
+1)
578 for k
in range(len(Learnable
)): # loop through all the learnable spells
579 if HasSpell (pc
, IE_SPELL_TYPE_PRIEST
, i
, Learnable
[k
]) < 0: # only write it if we don't yet know it
580 GemRB
.LearnSpell(pc
, Learnable
[k
])
583 # level, xp and other stuff by the core?
585 # 5261 - Regained abilities from inactive class
586 if IsDual
: # we're dual classed
588 if (Level
[0] - LevelDiff
[0]) <= Level
[1] and Level
[0] > Level
[1]: # our new classes now surpasses our old class
589 print "reactivating base class"
590 ReactivateBaseClass ()
593 LevelUpWindow
.Unload()
594 UpdatePortraitWindow ()
595 UpdateRecordsWindow()
597 GemRB
.SetRepeatClickFlags (GEM_RK_DISABLE
, OP_OR
)
600 def LevelUpHLAPress ():
601 """Opens the HLA selection window."""
603 # we can turn the button off and temporarily set HLACount to 0
604 # because there is no cancel button on the HLA window; therefore,
605 # it's guaranteed to come back as 0
606 TmpCount
= GemRB
.GetVar ("HLACount")
607 GemRB
.SetVar ("HLACount", 0)
609 GemRB
.SetVar ("HLACount", TmpCount
)
611 OpenHLAWindow (pc
, NumClasses
, Classes
, Level
)