2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003 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.
21 # GUICommonWindows.py - functions to open common windows in lower part of the screen
23 ###################################################
26 from GUIDefines
import *
27 from ie_stats
import *
28 from ie_modal
import *
29 from ie_action
import *
30 from GUICommon
import *
31 from LUCommon
import *
39 DraggedPortrait
= None
41 def SetupMenuWindowControls (Window
, Gears
, ReturnToGame
):
42 # FIXME: add "(key)" to tooltips!
45 Button
= Window
.GetControl (0)
46 Button
.SetTooltip (16313)
47 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
48 Button
.SetVarAssoc ("SelectedWindow", 0)
49 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, ReturnToGame
)
50 Button
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
53 Button
= Window
.GetControl (1)
54 Button
.SetTooltip (16310)
55 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
56 Button
.SetVarAssoc ("SelectedWindow", 1)
57 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "OpenMapWindow")
60 Button
= Window
.GetControl (2)
61 Button
.SetTooltip (16308)
62 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
63 Button
.SetVarAssoc ("SelectedWindow", 2)
64 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "OpenJournalWindow")
67 Button
= Window
.GetControl (3)
68 Button
.SetTooltip (16307)
69 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
70 Button
.SetVarAssoc ("SelectedWindow", 3)
71 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "OpenInventoryWindow")
74 Button
= Window
.GetControl (4)
75 Button
.SetTooltip (16306)
76 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
77 Button
.SetVarAssoc ("SelectedWindow", 4)
78 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "OpenRecordsWindow")
81 Button
= Window
.GetControl (5)
82 Button
.SetTooltip (16309)
83 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
84 Button
.SetVarAssoc ("SelectedWindow", 5)
85 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "OpenMageWindow")
87 Button
= Window
.GetControl (6)
88 Button
.SetTooltip (14930)
89 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
90 Button
.SetVarAssoc ("SelectedWindow", 6)
91 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "OpenPriestWindow")
94 Button
= Window
.GetControl (7)
95 Button
.SetTooltip (16311)
96 #Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
97 Button
.SetVarAssoc ("SelectedWindow", 7)
98 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "OpenOptionsWindow")
101 Button
= Window
.GetControl (8)
102 Button
.SetTooltip (16312)
103 Button
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, None)
106 # Gears (time), how doesn't have this in the right place
108 pos
= GemRB
.GetSystemVariable (SV_HEIGHT
)-71
109 Window
.CreateButton (9, 6, pos
, 64, 71)
110 Button
= Window
.GetControl (9)
111 Button
.SetAnimation ("CGEAR")
112 Button
.SetState (IE_GUI_BUTTON_ENABLED
)
113 Button
.SetFlags (IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_ANIMATED|IE_GUI_BUTTON_NORMAL
, OP_SET
)
114 Button
.SetEventByName(IE_GUI_BUTTON_ON_PRESS
, "GearsClicked")
115 SetGamedaysAndHourToken()
116 Button
.SetTooltip(16041)
118 MarkMenuButton (Window
)
121 def MarkMenuButton (WindowIndex
):
122 Pressed
= WindowIndex
.GetControl( GemRB
.GetVar ("SelectedWindow") )
124 for button
in range (9):
125 Button
= WindowIndex
.GetControl (button
)
126 Button
.SetState (IE_GUI_BUTTON_ENABLED
)
130 else: # highlight return to game
131 Button
= WindowIndex
.GetControl (0)
133 Button
.SetState (IE_GUI_BUTTON_PRESSED
)
136 Button
= PortraitWindow
.GetControl (6)
137 AI
= GemRB
.GetMessageWindowSize () & GS_PARTYAI
139 GemRB
.GameSetScreenFlags (GS_PARTYAI
, OP_NAND
)
140 Button
.SetTooltip (15918)
142 GemRB
.GameSetScreenFlags (GS_PARTYAI
, OP_OR
)
143 Button
.SetTooltip (15917)
146 def EmptyControls ():
149 GemRB
.SetVar ("ActionLevel", 0)
150 Window
= ActionsWindow
152 Button
= Window
.GetControl (i
)
153 Button
.SetFlags (IE_GUI_BUTTON_NO_IMAGE
, OP_SET
)
154 Button
.SetPicture ("")
157 def SelectFormationPreset ():
158 GemRB
.GameSetFormation (GemRB
.GetVar ("Value"), GemRB
.GetVar ("Formation") )
162 def SetupFormation ():
165 Window
= ActionsWindow
167 Button
= Window
.GetControl (i
)
168 Button
.SetFlags (IE_GUI_BUTTON_NORMAL
, OP_SET
)
169 Button
.SetSprites ("GUIBTBUT",0,0,1,2,3)
170 Button
.SetBAM ("FORM%x"%i,0,0,-1)
171 Button
.SetVarAssoc ("Value", i
)
172 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "SelectFormationPreset")
175 def GroupControls ():
178 GemRB
.SetVar ("ActionLevel", 0)
179 Window
= ActionsWindow
180 Button
= Window
.GetControl (0)
181 Button
.SetActionIcon (7)
182 Button
= Window
.GetControl (1)
183 Button
.SetActionIcon (15)
184 Button
= Window
.GetControl (2)
185 Button
.SetActionIcon (21)
186 Button
= Window
.GetControl (3)
187 Button
.SetActionIcon (-1)
188 Button
= Window
.GetControl (4)
189 Button
.SetActionIcon (-1)
190 Button
= Window
.GetControl (5)
191 Button
.SetActionIcon (-1)
192 Button
= Window
.GetControl (6)
193 Button
.SetActionIcon (-1)
194 GemRB
.SetVar ("Formation", GemRB
.GameGetFormation ())
196 Button
= Window
.GetControl (7+i
)
197 Button
.SetState (IE_GUI_BUTTON_ENABLED
)
198 idx
= GemRB
.GameGetFormation (i
)
199 Button
.SetFlags (IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NORMAL
, OP_SET
)
200 Button
.SetSprites ("GUIBTBUT",0,i
*2,i
*2+1,i
*2+24,i
*2+25)
201 Button
.SetBAM ("FORM%x"%idx,0,0,-1)
202 Button
.SetVarAssoc ("Formation", i
)
203 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "SelectFormation")
204 Button
.SetEventByName (IE_GUI_BUTTON_ON_RIGHT_PRESS
, "SetupFormation")
205 str = GemRB
.GetString (4935)
206 Button
.SetTooltip ("F%d - %s"%(8+i
,str) )
209 def OpenActionsWindowControls (Window
):
212 ActionsWindow
= Window
213 UpdateActionsWindow ()
216 def UpdateActionsWindow ():
217 global ActionsWindow
, PortraitWindow
, OptionsWindow
219 if ActionsWindow
== -1:
222 if ActionsWindow
== None:
225 #fully redraw the side panes to cover the actions window
226 #do this only when there is no 'otherwindow'
227 if GemRB
.GetVar ("OtherWindow") != -1:
229 PortraitWindow
.Invalidate ()
231 OptionsWindow
.Invalidate ()
234 for i
in range (PARTY_SIZE
):
235 if GemRB
.GameIsPCSelected (i
+1):
243 Button
= ActionsWindow
.GetControl (i
)
244 Button
.SetBorder (1, 0, 0, 0, 0, 50,30,10,120, 0, 1)
245 Button
.SetFont ("NUMBER")
254 #this is based on class
256 level
= GemRB
.GetVar ("ActionLevel")
257 TopIndex
= GemRB
.GetVar ("TopIndex")
259 ActionsWindow
.SetupControls (pc
)
261 ActionsWindow
.SetupEquipmentIcons(pc
, TopIndex
)
262 elif level
== 2: #spells
263 GemRB
.SetVar ("Type", 3)
264 ActionsWindow
.SetupSpellIcons(pc
, 3, TopIndex
)
265 elif level
== 3: #innates
266 GemRB
.SetVar ("Type", 4)
267 ActionsWindow
.SetupSpellIcons(pc
, 4, TopIndex
)
270 def ActionQWeaponPressed (which
):
271 pc
= GemRB
.GameGetFirstSelectedPC ()
273 if GemRB
.GetEquippedQuickSlot (pc
,1)==which
and GemRB
.GameControlGetTargetMode() != TARGET_MODE_ATTACK
:
274 GemRB
.GameControlSetTargetMode (TARGET_MODE_ATTACK
)
276 GemRB
.GameControlSetTargetMode (TARGET_MODE_NONE
)
277 GemRB
.SetEquippedQuickSlot (pc
, which
)
279 ActionsWindow
.SetupControls (pc
)
280 UpdateActionsWindow ()
283 def ActionQWeapon1Pressed ():
284 ActionQWeaponPressed(0)
286 def ActionQWeapon2Pressed ():
287 ActionQWeaponPressed(1)
289 def ActionQWeapon3Pressed ():
290 ActionQWeaponPressed(2)
292 def ActionQWeapon4Pressed ():
293 ActionQWeaponPressed(3)
295 #no check needed because the button wouldn't be drawn if illegal
296 def ActionLeftPressed ():
297 TopIndex
= GemRB
.GetVar ("TopIndex")
302 GemRB
.SetVar ("TopIndex", TopIndex
)
303 UpdateActionsWindow ()
306 #no check needed because the button wouldn't be drawn if illegal
307 def ActionRightPressed ():
308 pc
= GemRB
.GameGetFirstSelectedPC ()
309 TopIndex
= GemRB
.GetVar ("TopIndex")
310 Type
= GemRB
.GetVar ("Type")
311 Max
= GemRB
.GetMemorizedSpellsCount(pc
, Type
)
313 if TopIndex
> Max
- 10:
319 GemRB
.SetVar ("TopIndex", TopIndex
)
320 UpdateActionsWindow ()
323 def ActionBardSongPressed ():
324 pc
= GemRB
.GameGetFirstSelectedPC ()
325 GemRB
.SetModalState (pc
, MS_BATTLESONG
)
326 GemRB
.PlaySound ("act_01")
327 UpdateActionsWindow ()
330 def ActionSearchPressed ():
331 pc
= GemRB
.GameGetFirstSelectedPC ()
332 GemRB
.SetModalState (pc
, MS_DETECTTRAPS
)
333 UpdateActionsWindow ()
336 def ActionStealthPressed ():
337 pc
= GemRB
.GameGetFirstSelectedPC ()
338 GemRB
.SetModalState (pc
, MS_STEALTH
)
339 GemRB
.PlaySound ("act_07")
340 UpdateActionsWindow ()
343 def ActionTurnPressed ():
344 pc
= GemRB
.GameGetFirstSelectedPC ()
345 GemRB
.SetModalState (pc
, MS_TURNUNDEAD
)
346 GemRB
.PlaySound ("act_06")
347 UpdateActionsWindow ()
350 def ActionUseItemPressed ():
351 GemRB
.SetVar ("TopIndex", 0)
352 GemRB
.SetVar ("ActionLevel", 1)
353 UpdateActionsWindow ()
356 def ActionCastPressed ():
357 GemRB
.SetVar ("TopIndex", 0)
358 GemRB
.SetVar ("ActionLevel", 2)
359 UpdateActionsWindow ()
362 def ActionInnatePressed ():
363 GemRB
.SetVar ("TopIndex", 0)
364 GemRB
.SetVar ("ActionLevel", 3)
365 UpdateActionsWindow ()
369 pc
= GemRB
.GameGetFirstSelectedPC ()
371 GemRB
.GameControlSetTargetMode (TARGET_MODE_CAST
)
372 Spell
= GemRB
.GetVar ("Spell")
373 Type
= GemRB
.GetVar ("Type")
374 GemRB
.SpellCast (pc
, Type
, Spell
)
375 GemRB
.SetVar ("ActionLevel", 0)
376 UpdateActionsWindow ()
379 def EquipmentPressed ():
380 pc
= GemRB
.GameGetFirstSelectedPC ()
382 GemRB
.GameControlSetTargetMode (TARGET_MODE_CAST
)
383 Item
= GemRB
.GetVar ("Equipment")
385 GemRB
.UseItem (pc
, -1, Item
)
386 GemRB
.SetVar ("ActionLevel", 0)
387 UpdateActionsWindow ()
390 SelectionChangeHandler
= None
392 def SetSelectionChangeHandler (handler
):
393 global SelectionChangeHandler
395 # Switching from walking to non-walking environment:
396 # set the first selected PC in walking env as a selected
398 if (not SelectionChangeHandler
) and handler
:
399 sel
= GemRB
.GameGetFirstSelectedPC ()
402 GemRB
.GameSelectPCSingle (sel
)
404 SelectionChangeHandler
= handler
406 # redraw selection on change main selection | single selection
409 def RunSelectionChangeHandler ():
410 if SelectionChangeHandler
:
411 SelectionChangeHandler ()
413 def OpenPortraitWindow (needcontrols
):
414 global PortraitWindow
416 #take care, this window is different in how/iwd
417 if HasHOW() and needcontrols
:
418 PortraitWindow
= Window
= GemRB
.LoadWindow (26)
420 PortraitWindow
= Window
= GemRB
.LoadWindow (1)
425 pos
= GemRB
.GetSystemVariable (SV_HEIGHT
) - 37
426 Window
.CreateButton (8, 6, pos
, 55, 37)
427 Button
= Window
.GetControl (8)
428 Button
.SetSprites ("GUIRSBUT", 0,0,1,0,0)
429 Button
.SetTooltip (11942)
430 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "RestPress")
433 Window
.CreateButton (6, 6, pos
, 27, 36)
435 Button
= Window
.GetControl (6)
436 #fixing a gui bug, and while we are at it, hacking it to be easier
437 Button
.SetSprites ("GUIBTACT", 0, 46, 47, 48, 49)
438 GSFlags
= GemRB
.GetMessageWindowSize ()&GS_PARTYAI
440 GemRB
.SetVar ("AI", GSFlags
)
441 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "AIPress")
442 Button
.SetFlags (IE_GUI_BUTTON_CHECKBOX
, OP_OR
)
443 Button
.SetVarAssoc ("AI", 1)
445 Button
.SetTooltip (15917)
447 Button
.SetTooltip (15918)
451 Window
.CreateButton (7, 33, pos
, 27, 36)
452 Button
= Window
.GetControl (7)
453 Button
.SetSprites ("GUIBTACT", 0, 50, 51, 50, 51)
454 Button
.SetTooltip (10485)
455 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "SelectAllOnPress")
458 Button
= PortraitWindow
.GetControl (8)
459 Button
.SetTooltip (11942)
460 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "RestPress")
462 pc
= GemRB
.GameGetSelectedPCSingle ()
463 Inventory
= GemRB
.GetVar ("Inventory")
465 for i
in range (PARTY_SIZE
):
466 Button
= Window
.GetControl (i
)
467 Button
.SetFont ("STATES")
468 Button
.SetVarAssoc ("PressedPortrait", i
)
471 Button
.SetEventByName (IE_GUI_BUTTON_ON_RIGHT_PRESS
, "OpenInventoryWindowClick")
473 Button
.SetEventByName (IE_GUI_BUTTON_ON_RIGHT_PRESS
, "PortraitButtonOnPress")
475 Button
.SetEventByName (IE_GUI_BUTTON_ON_PRESS
, "PortraitButtonOnPress")
476 Button
.SetEventByName (IE_GUI_BUTTON_ON_SHIFT_PRESS
, "PortraitButtonOnShiftPress")
477 Button
.SetEventByName (IE_GUI_BUTTON_ON_DRAG_DROP
, "OnDropItemToPC")
478 Button
.SetEventByName (IE_GUI_BUTTON_ON_DRAG
, "PortraitButtonOnDrag")
479 Button
.SetEventByName (IE_GUI_MOUSE_ENTER_BUTTON
, "PortraitButtonOnMouseEnter")
480 Button
.SetEventByName (IE_GUI_MOUSE_LEAVE_BUTTON
, "PortraitButtonOnMouseLeave")
481 if Inventory
and pc
!= i
+1:
482 Button
.SetFlags (IE_GUI_BUTTON_NO_IMAGE
, OP_SET
)
483 Button
.SetState (IE_GUI_BUTTON_DISABLED
)
485 Button
.SetTooltip ("")
487 # overlay a label, so we can display the hp with the correct font
488 Button
.CreateLabelOnButton(100+i
, "NUMFONT", IE_GUI_BUTTON_ALIGN_TOP|IE_GUI_BUTTON_ALIGN_LEFT
)
490 Button
.SetBorder (FRAME_PC_SELECTED
, 1, 1, 2, 2, 0, 255, 0, 255)
491 Button
.SetBorder (FRAME_PC_TARGET
, 3, 3, 4, 4, 255, 255, 0, 255)
493 UpdatePortraitWindow ()
497 def UpdatePortraitWindow ():
498 Window
= PortraitWindow
500 pc
= GemRB
.GameGetSelectedPCSingle ()
501 Inventory
= GemRB
.GetVar ("Inventory")
503 for portid
in range (PARTY_SIZE
):
504 Button
= Window
.GetControl (portid
)
505 pic
= GemRB
.GetPlayerPortrait (portid
+1, 1)
506 if Inventory
and pc
!= portid
+1:
510 Button
.SetFlags (IE_GUI_BUTTON_NO_IMAGE
, OP_SET
)
511 Button
.SetState (IE_GUI_BUTTON_DISABLED
)
513 Button
.SetTooltip ("")
516 sel
= GemRB
.GameGetSelectedPCSingle () == portid
+ 1
517 Button
.SetFlags (IE_GUI_BUTTON_PICTURE| \
518 IE_GUI_BUTTON_HORIZONTAL| \
519 IE_GUI_BUTTON_ALIGN_LEFT| IE_GUI_BUTTON_ALIGN_TOP| \
520 IE_GUI_BUTTON_DRAGGABLE|IE_GUI_BUTTON_MULTILINE
, OP_SET
)
521 Button
.SetState (IE_GUI_BUTTON_LOCKED
)
522 Button
.SetPicture (pic
, "NOPORTSM")
524 hp
= GemRB
.GetPlayerStat (portid
+1, IE_HITPOINTS
)
525 hp_max
= GemRB
.GetPlayerStat (portid
+1, IE_MAXHITPOINTS
)
526 state
= GemRB
.GetPlayerStat (portid
+1, IE_STATE_ID
)
531 ratio
= (hp
+0.0) / hp_max
533 if hp
<1 or (state
& STATE_DEAD
):
534 Button
.SetOverlay (0, 64,64,64,200, 64,64,64,200)
536 Button
.SetOverlay (ratio
, 255,0,0,200, 128,0,0,200)
537 ratio_str
= "\n%d/%d" %(hp
, hp_max
)
538 Button
.SetTooltip (GemRB
.GetPlayerName (portid
+1, 1) + ratio_str
)
540 #add effects on the portrait
541 #http://img.jeuxvideo.fr/00002663-photo-icewind-dale-heart-of-winter.jpg
542 effects
= GemRB
.GetPlayerStates (portid
+1)
544 for col
in range(len(effects
)):
545 states
= effects
[col
:col
+1] + states
546 if col
% 3 == 2: states
= "\n" + states
547 for x
in range(2 - (len(effects
)/3)):
548 states
= "\n" + states
549 states
= "\n" + states
552 # TODO: missing, maybe add another string tag to make glyphs 100% transparent?
553 flag
= blank
= chr(238)
555 # these two are missing too
558 #if GemRB.GetStore()!=None:
561 #if GemRB.GameGetSelectedPCSingle(1)==portid+1:
564 if CanLevelUp (portid
+1):
565 states
= flag
+blank
+chr(255) + states
567 #states = flag+blank+blank + states
568 #states = "\n" + states
570 Button
.SetText(states
)
572 HPLabel
= Window
.GetControl (100+portid
)
573 HPLabel
.SetText (ratio_str
) # TODO: color depending on the ratio
575 Button
.EnableBorder (FRAME_PC_SELECTED
, sel
)
578 def PortraitButtonOnDrag ():
579 global DraggedPortrait
582 DraggedPortrait
= GemRB
.GetVar ("PressedPortrait")+1
583 GemRB
.DragItem (DraggedPortrait
, -1, "")
586 def PortraitButtonOnPress ():
587 i
= GemRB
.GetVar ("PressedPortrait")
589 if (not SelectionChangeHandler
):
590 if GemRB
.GameIsPCSelected (i
+1):
591 GemRB
.GameControlSetScreenFlags (SF_CENTERONACTOR
, OP_OR
)
592 GemRB
.GameSelectPC (i
+ 1, True, SELECT_REPLACE
)
594 GemRB
.GameSelectPCSingle (i
+ 1)
596 RunSelectionChangeHandler ()
599 def PortraitButtonOnShiftPress ():
600 i
= GemRB
.GetVar ("PressedPortrait")
602 if (not SelectionChangeHandler
):
603 sel
= GemRB
.GameIsPCSelected (i
+ 1)
605 GemRB
.GameSelectPC (i
+ 1, sel
)
607 GemRB
.GameSelectPCSingle (i
+ 1)
609 RunSelectionChangeHandler ()
612 # Run by Game class when selection was changed
613 def SelectionChanged ():
614 global PortraitWindow
616 GemRB
.SetVar ("ActionLevel", 0)
617 # FIXME: hack. If defined, display single selection
618 if (not SelectionChangeHandler
):
619 UpdateActionsWindow ()
620 for i
in range (PARTY_SIZE
):
621 Button
= PortraitWindow
.GetControl (i
)
622 Button
.EnableBorder (FRAME_PC_SELECTED
, GemRB
.GameIsPCSelected (i
+ 1))
624 sel
= GemRB
.GameGetSelectedPCSingle ()
625 for i
in range (PARTY_SIZE
):
626 Button
= PortraitWindow
.GetControl (i
)
627 Button
.EnableBorder (FRAME_PC_SELECTED
, i
+ 1 == sel
)
630 def PortraitButtonOnMouseEnter ():
631 global DraggedPortrait
633 i
= GemRB
.GetVar ("PressedPortrait")
635 if DraggedPortrait
!= None:
636 GemRB
.DragItem (0, -1, "")
638 GemRB
.SwapPCs (DraggedPortrait
, i
+1)
639 DraggedPortrait
= None
642 if GemRB
.IsDraggingItem ():
643 Button
= PortraitWindow
.GetControl (i
)
644 Button
.EnableBorder (FRAME_PC_TARGET
, 1)
647 def PortraitButtonOnMouseLeave ():
648 i
= GemRB
.GetVar ("PressedPortrait")
649 Button
= PortraitWindow
.GetControl (i
)
650 Button
.EnableBorder (FRAME_PC_TARGET
, 0)
653 def CheckLevelUp(pc
):
654 GemRB
.SetVar ("CheckLevelUp"+str(pc
), CanLevelUp (pc
))