Esempio n. 1
0
def DialogStarted():
    global ContinueWindow

    Container.CloseContainerWindow()

    # opening control size to maximum, enabling dialog window
    CommonWindow.SetGameGUIHidden(False)
    GemRB.GameSetScreenFlags(GS_DIALOG, OP_OR)

    # disable the 1-6 hotkeys, so they'll work for choosing answers
    GUICommonWindows.UpdatePortraitWindow()

    MessageWindow.UpdateControlStatus()

    ContinueWindow = OpenDialogButton(9)
def OnLoad():
	global PortraitWindow, OptionsWindow

	GemRB.GameSetPartySize (MAX_PARTY_SIZE)
	GemRB.GameSetProtagonistMode (2)
	GemRB.LoadWindowPack (GUICommon.GetWindowPack())

	GUICommonWindows.PortraitWindow = None
	GUICommonWindows.ActionsWindow = None
	GUICommonWindows.OptionsWindow = None

	#this is different in IWD (0) and HoW (25)
	if GameCheck.HasHOW():
		OptionsWindow = GemRB.LoadWindow (25)
	else:
		OptionsWindow = GemRB.LoadWindow (0)
	GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 1, None)
	PortraitWindow = GUICommonWindows.OpenPortraitWindow (1)

	ActionsWindow = GemRB.LoadWindow (3)
	GUICommonWindows.OpenActionsWindowControls (ActionsWindow)

	GemRB.SetVar ("PortraitWindow", PortraitWindow.ID)
	GemRB.SetVar ("ActionsWindow", ActionsWindow.ID)
	GemRB.SetVar ("OptionsWindow", OptionsWindow.ID)
	GemRB.SetVar ("TopWindow", -1)
	GemRB.SetVar ("OtherWindow", -1)
	GemRB.SetVar ("FloatWindow", -1)
	GemRB.SetVar ("PortraitPosition", 2) #Right
	GemRB.SetVar ("ActionsPosition", 4) #BottomAdded
	GemRB.SetVar ("OptionsPosition", 0) #Left
	GemRB.SetVar ("MessagePosition", 4) #BottomAdded
	GemRB.SetVar ("OtherPosition", 5) #Inactivating
	GemRB.SetVar ("TopPosition", 5) #Inactivating
	
	UpdateControlStatus ()
Esempio n. 3
0
def OpenStoreRentWindow ():
	global StoreRentWindow

	CloseWindows()

	StoreRentWindow = Window = GemRB.LoadWindow (7)

	# room types
	RentIndex = -1
	for i in range (4):
		ok = Store['StoreRoomPrices'][i]
		if ok >= 0:
			RentIndex = i
			break

	# RentIndex needs to be set before SetVarAssoc
	GemRB.SetVar ("RentIndex", RentIndex)

	for i in range (4):
		ok = Store['StoreRoomPrices'][i]
		Button = Window.GetControl (i)
		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateStoreRentWindow)
		if ok<0:
			Button.SetState (IE_GUI_BUTTON_DISABLED) #disabled room icons are selected, not disabled
		else:
			Button.SetVarAssoc ("RentIndex", i)

		Button = Window.GetControl (i+4)
		Button.SetText (14294+i)
		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateStoreRentWindow)
		Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
		Button.SetVarAssoc ("RentIndex", i)
		if GameCheck.IsBG1():
			#these bioware guys screw up everything possible
			#remove this line if you fixed guistore
			Button.SetSprites ("GUISTROC",0, 1,2,0,3)
		if ok<0:
			Button.SetState (IE_GUI_BUTTON_DISABLED)

	# Rent
	Button = Window.GetControl (11)
	Button.SetText (14293)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RentRoom)

	GUICommonWindows.SetSelectionChangeHandler( UpdateStoreRentWindow )
	UpdateStoreRentWindow ()
	Window.SetVisible (WINDOW_VISIBLE)
	return
Esempio n. 4
0
    def OnClose():
        GemRB.GamePause(False, 0)
        GUICommonWindows.SetSelectionChangeMultiHandler(None)

        if float_menu_selected == None:
            return

        if float_menu_mode == MENU_MODE_ITEMS:
            UseItem()
        elif float_menu_mode == MENU_MODE_WEAPONS:
            UseWeapon()
        elif float_menu_mode == MENU_MODE_SPELLS:
            UseSpell()
        elif float_menu_mode == MENU_MODE_ABILITIES:
            UseSpell()
        return
Esempio n. 5
0
def UpdateReformWindow ():
	Window = ReformPartyWindow

	select = GemRB.GetVar ("Selected")

	need_to_drop = GemRB.GetPartySize ()-PARTY_SIZE
	if need_to_drop<0:
		need_to_drop = 0

	#excess player number
	Label = Window.GetControl (0x1000000f)
	Label.SetText (str(need_to_drop) )

	#done
	Button = Window.GetControl (8)
	if need_to_drop:
		Button.SetState (IE_GUI_BUTTON_DISABLED)
	else:
		Button.SetState (IE_GUI_BUTTON_ENABLED)

	#remove
	Button = Window.GetControl (15)
	if select:
		Button.SetState (IE_GUI_BUTTON_ENABLED)
	else:
		Button.SetState (IE_GUI_BUTTON_DISABLED)

	for i in range (PARTY_SIZE+1):
		Button = Window.GetControl (i)
		if i+1 not in removable_pcs:
			Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
			Button.SetState (IE_GUI_BUTTON_LOCKED)
			continue

	for i in removable_pcs:
		Button = Window.GetControl (removable_pcs.index(i))
		Button.EnableBorder (FRAME_PC_SELECTED, select == i )
		pic = GemRB.GetPlayerPortrait (i, 1)
		if not pic:
			Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
			Button.SetState (IE_GUI_BUTTON_LOCKED)
			continue
		Button.SetState (IE_GUI_BUTTON_ENABLED)
		Button.SetFlags (IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_ALIGN_BOTTOM|IE_GUI_BUTTON_ALIGN_LEFT, OP_SET)
		Button.SetPicture (pic, "NOPORTSM")
	GUICommonWindows.UpdatePortraitWindow ()
	return
Esempio n. 6
0
def OpenStoreIdentifyWindow ():
	global StoreIdentifyWindow
	global LeftButton

	GemRB.SetVar ("Index", -1)
	GemRB.SetVar ("TopIndex", 0)
	CloseWindows()

	StoreIdentifyWindow = Window = GemRB.LoadWindow (4)

	ScrollBar = Window.GetControl (7)
	ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreIdentifyWindow)

	TextArea = Window.GetControl (23)
	TextArea.SetFlags (IE_GUI_TEXTAREA_AUTOSCROLL)

	# Identify
	LeftButton = Button = Window.GetControl (5)
	Button.SetText (14133)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, IdentifyPressed)
	Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoIdentifyWindow)

	# price ...
	Label = Window.GetControl (0x10000003)
	Label.SetText ("0")

	# 8-11 item slots, 0x1000000c-f labels
	for i in range (ItemButtonCount):
		Button = Window.GetControl (i+8)
		Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
		if GUICommon.GameIsIWD1() or GUICommon.GameIsIWD2():
			Button.SetSprites ("GUISTMSC", 0, 1,2,0,3)
			Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1)
		elif GUICommon.GameIsBG1():
			Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1)
		else:
			Button.SetBorder (0,0,0,0,0,0,0,128,160,0,1)
		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SelectID)
		Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoIdentifyWindow)
		Button.SetFont ("NUMBER")
		Button.SetFlags (IE_GUI_BUTTON_ALIGN_RIGHT|IE_GUI_BUTTON_ALIGN_TOP, OP_OR)
		Button.AttachScrollBar (ScrollBar)

	GUICommonWindows.SetSelectionChangeHandler( UpdateStoreIdentifyWindow )
	UpdateStoreIdentifyWindow ()
	Window.SetVisible (WINDOW_VISIBLE)
	return
Esempio n. 7
0
def OpenStoreStealWindow ():
	global StoreStealWindow
	global LeftButton

	GemRB.SetVar ("RightIndex", 0)
	GemRB.SetVar ("LeftIndex", 0)
	CloseWindows()

	StoreStealWindow = Window = GemRB.LoadWindow (7)

	for i in range (4):
		Button = Window.GetControl (i+5)
		Button.SetBorder (0,0,0,0,0,128,0,0,100,0,1)
		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RedrawStoreStealWindow)

		Button = Window.GetControl (i+14)
		Button.SetBorder (0,0,0,0,0,128,0,0,100,0,1)
		Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoRightWindow)

	# Steal
	LeftButton = Button = Window.GetControl (0)
	Button.SetText (45305)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, StealPressed)

	# encumbrance
	Button = Window.GetControl (22)
	Button.SetState (IE_GUI_BUTTON_LOCKED)
	GUICommon.SetEncumbranceLabels (Window, 22, None, GemRB.GameGetSelectedPCSingle (), True)
	Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
	Button.SetFont ('NUMBER')

	#Label = Window.CreateLabel (0x10000043, 15,325,60,15,"NUMBER","0:",IE_FONT_ALIGN_LEFT|IE_FONT_ALIGN_TOP)
	#Label = Window.CreateLabel (0x10000044, 15,365,80,15,"NUMBER","0:",IE_FONT_ALIGN_RIGHT|IE_FONT_ALIGN_TOP)

	# left scrollbar
	ScrollBar = Window.GetControl (4)
	ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreStealWindow)

	# right scrollbar
	ScrollBar = Window.GetControl (13)
	ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreStealWindow)

	GUICommonWindows.SetSelectionChangeHandler( UpdateStoreStealWindow )
	UpdateStoreStealWindow ()
	Window.SetVisible (WINDOW_VISIBLE)
	return
Esempio n. 8
0
def CloseOptionsWindow ():
	global GameOptionsWindow, OptionsWindow
	global OldOptionsWindow

	if GameOptionsWindow == None:
		return

	if GameOptionsWindow:
		GameOptionsWindow.Unload ()
	if OptionsWindow:
		OptionsWindow.Unload ()

	GameOptionsWindow = None
	GUICommonWindows.SetSelectionChangeHandler (None)
	GemRB.SetVar ("OtherWindow", -1)
	GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
	GUICommonWindows.OptionsWindow = OldOptionsWindow
	OldOptionsWindow = None
	return
Esempio n. 9
0
def OpenStoreHealWindow ():
	global StoreHealWindow

	GemRB.SetVar ("Index", -1)
	GemRB.SetVar ("TopIndex", 0)
	CloseWindows()

	StoreHealWindow = Window = GemRB.LoadWindow (5)

	ScrollBar = Window.GetControl (7)
	ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, UpdateStoreHealWindow)

	#spell buttons
	for i in range (ItemButtonCount):
		Button = Window.GetControl (i+8)
		Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateStoreHealWindow)
		Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoHealWindow)
		#Button.AttachScrollBar (ScrollBar)

	UnselectNoRedraw ()

	# price tag
	Label = Window.GetControl (0x10000003)
	Label.SetText ("0")

	# Heal
	Button = Window.GetControl (5)
	Button.SetText (13703)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, BuyHeal)
	Button.SetState (IE_GUI_BUTTON_DISABLED)

	Count = Store['StoreCureCount']
	if Count>4:
		Count = Count-4
	else:
		Count = 0
	ScrollBar.SetVarAssoc ("TopIndex", Count)

	GUICommonWindows.SetSelectionChangeHandler( UpdateStoreHealWindow )
	UpdateStoreHealWindow ()
	Window.SetVisible (WINDOW_VISIBLE)
	return
Esempio n. 10
0
def LevelUpDonePress():
    """Updates the PC with the new choices.

	Closes the window when finished."""
    import GUICommonWindows
    import GUIREC

    # proficiencies
    LUProfsSelection.ProfsSave(pc)

    # skills
    LUSkillsSelection.SkillsSave(pc)

    # level
    if DualSwap:  # swap the IE_LEVELs around if a backward dual
        GemRB.SetPlayerStat(pc, IE_LEVEL2, Level[0])
        GemRB.SetPlayerStat(pc, IE_LEVEL, Level[1])
    else:
        GemRB.SetPlayerStat(pc, IE_LEVEL, Level[0])
        GemRB.SetPlayerStat(pc, IE_LEVEL2, Level[1])
    GemRB.SetPlayerStat(pc, IE_LEVEL3, Level[2])

    print("Levels:", Level[0], "/", Level[1], "/", Level[2])

    # spells
    SaveNewSpells()

    # hlas
    # level, xp and other stuff by the core?

    # 5261 - Regained abilities from inactive class
    if IsDual:  # we're dual classed
        print("activation?")
        if (Level[0] - LevelDiff[0]) <= Level[1] and Level[0] > Level[
                1]:  # our new classes now surpasses our old class
            print("reactivating base class")
            ReactivateBaseClass()

    if LevelUpWindow:
        LevelUpWindow.Close()
    GUICommonWindows.UpdatePortraitWindow()
    return
Esempio n. 11
0
def OpenStoreRumourWindow ():
	global StoreRumourWindow

	GemRB.SetVar ("TopIndex", 0)
	CloseWindows()

	StoreRumourWindow = Window = GemRB.LoadWindow (8)

	#removing those pesky labels
	if not GameCheck.IsIWD2():
		for i in range (5):
			Window.DeleteControl (0x10000005+i)

	TextArea = None
	if GameCheck.IsIWD2():
		TextArea = Window.GetControl (13)
	else:
		TextArea = Window.GetControl (11)
	TextArea.SetText (14144)

	#tavern quality image
	if GameCheck.IsBG1() or GameCheck.IsBG2():
		BAM = "TVRNQUL%d"% ((Store['StoreFlags']>>9)&3)
		Button = Window.GetControl (12)
		Button.SetSprites (BAM, 0, 0, 0, 0, 0)
		Button.SetState (IE_GUI_BUTTON_LOCKED)

	ScrollBar = Window.GetControl (5)
	ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, UpdateStoreRumourWindow)
	Count = Store['StoreDrinkCount']
	if Count>5:
		Count = Count-5
	else:
		Count = 0
	ScrollBar.SetVarAssoc ("TopIndex", Count)

	GUICommonWindows.SetSelectionChangeHandler( UpdateStoreRumourWindow )
	UpdateStoreRumourWindow ()
	Window.SetVisible (WINDOW_VISIBLE)
	return
Esempio n. 12
0
def GetBonusSpells (pc):
	bonusSpells = {}
	classes = []
	# cheack each class/kit
	for i in range(11):
		level = GemRB.GetPlayerStat (pc, Classes[i])
		if not level:
			continue

		ClassTitle = GUICommonWindows.GetActorClassTitle (pc, i)
		# find the casting stat
		ClassName = GUICommon.GetClassRowName (i, "index")
		Stat = CommonTables.ClassSkills.GetValue (ClassName, "CASTING")
		if Stat == "*":
			continue
		Stat = GemRB.GetPlayerStat (pc, Stat)
		if Stat < 12: # boni start with positive modifiers
			continue

		# get max spell level we can cast, since only usable boni are displayed
		# check the relevant mxspl* table
		SpellTable = CommonTables.ClassSkills.GetValue (ClassName, "CLERICSPELL")
		if SpellTable == "*":
			SpellTable = CommonTables.ClassSkills.GetValue (ClassName, "MAGESPELL")
		SpellTable = GemRB.LoadTable (SpellTable)
		maxLevel = 0
		for i in range(SpellTable.GetColumnCount()):
			spells = SpellTable.GetValue (str(level), str(i+1)) # not all tables start at 1, so use a named lookup
			if not spells:
				break
			maxLevel = i+1

		classes.append(ClassTitle)
		# check if at casting stat size, there is any bonus spell in BonusSpellTable
		bonusSpells[ClassTitle] = [0] * maxLevel
		for level in range (1, maxLevel+1):
			bonusSpells[ClassTitle][level-1] = BonusSpellTable.GetValue (Stat-12, level-1)

	return bonusSpells, classes
Esempio n. 13
0
def ConfirmedSaveGame (Pos):
	global ConfirmWindow

	Label = ConfirmWindow.GetControl (ctrl_offset[7])
	Slotname = Label.QueryText ()
	Slotname = Slotname.replace ("/", "|") # can't have path separators in the name

	# Empty save name. We can get here if user presses Enter key
	if Slotname == "":
		return

	# We have to close floating window first
	CloseConfirmWindow ()
	#FIXME: make this work
	#LoadScreen.StartLoadScreen (LoadScreen.LS_TYPE_SAVING)

	CloseSaveWindow ()
	GUICommonWindows.CloseTopWindow ()

	if Pos < len(Games):
		GemRB.SaveGame (Games[Pos], Slotname, sav_version)
	else:
		GemRB.SaveGame (None, Slotname, sav_version)
	return
Esempio n. 14
0
def OpenContainerWindow():
    global ContainerWindow, Container

    if ContainerWindow:
        return

    hideflag = GemRB.HideGUI()

    GemRB.LoadWindowPack(GUICommon.GetWindowPack())
    ContainerWindow = Window = GemRB.LoadWindow(8)

    #stop gears from interfering
    if GameCheck.IsPST():
        GUIWORLD.OldPortraitWindow = GUIClasses.GWindow(
            GemRB.GetVar("PortraitWindow"))
        GUICommonWindows.DisableAnimatedWindows()

    if GameCheck.IsIWD2():
        GUIWORLD.OldMessageWindow = GUIClasses.GWindow(
            GemRB.GetVar("MessageWindow"))
        GemRB.SetVar("MessageWindow", Window.ID)
    else:
        GUIWORLD.OldActionsWindow = GUIClasses.GWindow(
            GemRB.GetVar("ActionsWindow"))
        GUIWORLD.OldMessageWindow = GUIClasses.GWindow(
            GemRB.GetVar("MessageWindow"))
        GemRB.SetVar("MessageWindow", -1)
        GemRB.SetVar("ActionsWindow", Window.ID)

    Container = GemRB.GetContainer(0)

    # Gears (time) when options pane is down
    if GameCheck.IsBG2():
        Button = Window.GetControl(62)
        Label = Button.CreateLabelOnButton(0x1000003e, "NORMAL",
                                           IE_FONT_SINGLE_LINE)

        Label.SetAnimation("CPEN")
        Button.SetAnimation("CGEAR")
        Button.SetBAM("CDIAL", 0, 0)
        Button.SetState(IE_GUI_BUTTON_ENABLED)
        Button.SetFlags(
            IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ANIMATED
            | IE_GUI_BUTTON_NORMAL, OP_SET)
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUICommon.GearsClicked)
        GUICommon.SetGamedaysAndHourToken()
        Button.SetTooltip(16041)

    # 0-5 - Ground Item
    for i in range(ground_size):
        Button = Window.GetControl(i)
        Button.SetVarAssoc("LeftIndex", i)
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, TakeItemContainer)
        if GameCheck.IsPST():
            Button.SetFont("NUMBER")
            Button.SetFlags(
                IE_GUI_BUTTON_ALIGN_RIGHT | IE_GUI_BUTTON_ALIGN_BOTTOM, OP_OR)

    # 10-13 - Personal Item
    for i in range(4):
        Button = Window.GetControl(i + 10)
        Button.SetVarAssoc("RightIndex", i)
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, DropItemContainer)
        if GameCheck.IsPST():
            Button.SetFont("NUMBER")
            Button.SetFlags(
                IE_GUI_BUTTON_ALIGN_RIGHT | IE_GUI_BUTTON_ALIGN_BOTTOM, OP_OR)

    # left scrollbar (container)
    ScrollBar = Window.GetControl(52)
    ScrollBar.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE, RedrawContainerWindow)

    # right scrollbar (inventory)
    ScrollBar = Window.GetControl(53)
    ScrollBar.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE, RedrawContainerWindow)

    # encumbrance and inventory icon
    # iwd has a handy button
    if Window.HasControl(54):
        Button = Window.GetControl(54)
        if GameCheck.IsPST():
            Button.SetFont("NUMBER")
            Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE, OP_SET)
        Button.CreateLabelOnButton(
            0x10000043, "NUMBER",
            IE_FONT_ALIGN_LEFT | IE_FONT_ALIGN_TOP | IE_FONT_SINGLE_LINE)
        Button.CreateLabelOnButton(
            0x10000044, "NUMBER",
            IE_FONT_ALIGN_RIGHT | IE_FONT_ALIGN_BOTTOM | IE_FONT_SINGLE_LINE)
    else:
        Label = Window.CreateLabel(
            0x10000043, 323, 14, 60, 15, "NUMBER", "0:",
            IE_FONT_ALIGN_LEFT | IE_FONT_ALIGN_TOP | IE_FONT_SINGLE_LINE)
        Label = Window.CreateLabel(
            0x10000044, 323, 20, 80, 15, "NUMBER", "0:",
            IE_FONT_ALIGN_RIGHT | IE_FONT_ALIGN_TOP | IE_FONT_SINGLE_LINE)

    # container icon
    Button = Window.GetControl(50)
    if GameCheck.IsPST():
        Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE, OP_SET)
    Button.SetState(IE_GUI_BUTTON_LOCKED)

    if not GameCheck.IsPST():
        Table = GemRB.LoadTable("containr")
        row = Container['Type']
        tmp = Table.GetValue(row, 0)
        if tmp != '*':
            GemRB.PlaySound(tmp)
        tmp = Table.GetValue(row, 1)
        if tmp != '*':
            Button.SetSprites(tmp, 0, 0, 0, 0, 0)

    # Done
    Button = Window.GetControl(51)
    if GameCheck.IsPST():
        Button.SetText(1403)
    else:
        Button.SetText("")
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, LeaveContainer)

    GemRB.SetVar("LeftTopIndex", 0)
    GemRB.SetVar("RightTopIndex", 0)
    UpdateContainerWindow()
    if hideflag:
        GemRB.UnhideGUI()
Esempio n. 15
0
def OpenOptionsWindow ():
	"""Open main options window (peacock tail)"""
	global OptionsWindow

	if GUICommon.CloseOtherWindow (OpenOptionsWindow):
		if VideoOptionsWindow: OpenVideoOptionsWindow ()
		if AudioOptionsWindow: OpenAudioOptionsWindow ()
		if GameplayOptionsWindow: OpenGameplayOptionsWindow ()
		if FeedbackOptionsWindow: OpenFeedbackOptionsWindow ()
		if AutopauseOptionsWindow: OpenAutopauseOptionsWindow ()
		if LoadMsgWindow: OpenLoadMsgWindow ()
		if QuitMsgWindow: OpenQuitMsgWindow ()
		if KeysWindow: OpenKeysWindow ()
		if MoviesWindow: OpenMoviesWindow ()
		
		GemRB.HideGUI ()
		if OptionsWindow:
			OptionsWindow.Unload ()
		GemRB.SetVar ("OtherWindow", -1)
		GUICommonWindows.EnableAnimatedWindows ()
		OptionsWindow = None
		
		GemRB.UnhideGUI ()
		return
		
	GemRB.HideGUI ()
	GemRB.LoadWindowPack ("GUIOPT")
	OptionsWindow = Window = GemRB.LoadWindow (0)
	GemRB.SetVar ("OtherWindow", OptionsWindow.ID)
	GUICommonWindows.DisableAnimatedWindows ()
	
	# Return to Game
	Button = Window.GetControl (0)
	Button.SetText (28638)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenOptionsWindow)

	# Quit Game
	Button = Window.GetControl (1)
	Button.SetText (2595)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenQuitMsgWindow)

	# Load Game
	Button = Window.GetControl (2)
	Button.SetText (2592)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenLoadMsgWindow)

	# Save Game
	Button = Window.GetControl (3)
	Button.SetText (20639)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, GUISAVE.OpenSaveWindow)

	# Video Options
	Button = Window.GetControl (4)
	Button.SetText (28781)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenVideoOptionsWindow)

	# Audio Options
	Button = Window.GetControl (5)
	Button.SetText (29720)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenAudioOptionsWindow)

	# Gameplay Options
	Button = Window.GetControl (6)
	Button.SetText (29722)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenGameplayOptionsWindow)

	# Keyboard Mappings
	Button = Window.GetControl (7)
	Button.SetText (29723)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenKeyboardMappingsWindow)

	# Movies
	Button = Window.GetControl (9)
	Button.SetText (38156)   # or  2594
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenMoviesWindow)

	# game version, e.g. v1.1.0000
	Label = Window.GetControl (0x10000007)
	Label.SetText (GEMRB_VERSION)
	
	#Window.SetVisible (WINDOW_VISIBLE)
	GemRB.UnhideGUI ()
Esempio n. 16
0
        PriestKnownSpellList.append(ks['SpellResRef'])
        Icon.SetVarAssoc("SpellButton", 100 + i)

    if known_cnt == 0: i = -1
    for i in range(i + 1, btncount):
        Icon = Window.GetControl(14 + i)
        Icon.SetFlags(IE_GUI_BUTTON_NO_IMAGE, OP_OR)
        Icon.SetEvent(IE_GUI_BUTTON_ON_PRESS, None)
        Icon.SetEvent(IE_GUI_BUTTON_ON_RIGHT_PRESS, None)
        Icon.SetTooltip('')

    return


TogglePriestWindow = GUICommonWindows.CreateTopWinLoader(
    3, "GUIPR", GUICommonWindows.ToggleWindow, InitPriestWindow,
    UpdatePriestWindow, WINDOW_TOP | WINDOW_HCENTER)
OpenPriestWindow = GUICommonWindows.CreateTopWinLoader(
    3, "GUIPR", GUICommonWindows.OpenWindowOnce, InitPriestWindow,
    UpdatePriestWindow, WINDOW_TOP | WINDOW_HCENTER)


def PriestPrevLevelPress():
    global PriestSpellLevel

    if PriestSpellLevel > 0:
        PriestSpellLevel = PriestSpellLevel - 1
        UpdatePriestWindow(PriestSpellWindow)


def PriestNextLevelPress():
Esempio n. 17
0
def OpenRecordsWindow():
    global RecordsWindow
    global StatTable

    StatTable = GemRB.LoadTable("abcomm")

    if GUICommon.CloseOtherWindow(OpenRecordsWindow):
        GemRB.HideGUI()
        if InformationWindow: OpenInformationWindow()

        if RecordsWindow:
            RecordsWindow.Unload()
        RecordsWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommonWindows.SetSelectionChangeHandler(None)

        GemRB.UnhideGUI()
        return

    GemRB.HideGUI()
    GemRB.LoadWindowPack("GUIREC")
    RecordsWindow = Window = GemRB.LoadWindow(3)
    GemRB.SetVar("OtherWindow", RecordsWindow.ID)

    # Information
    Button = Window.GetControl(7)
    Button.SetText(4245)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenInformationWindow)

    # Reform Party
    Button = Window.GetControl(8)
    Button.SetText(4244)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIWORLD.OpenReformPartyWindow)

    # Level Up
    Button = Window.GetControl(9)
    Button.SetText(4246)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenLevelUpWindow)

    statevents = (OnRecordsHelpStrength, OnRecordsHelpIntelligence,
                  OnRecordsHelpWisdom, OnRecordsHelpDexterity,
                  OnRecordsHelpConstitution, OnRecordsHelpCharisma)
    # stat buttons
    for i in range(6):
        Button = Window.GetControl(31 + i)
        Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE, OP_SET)
        Button.SetSprites("", 0, 0, 0, 0, 0)
        Button.SetState(IE_GUI_BUTTON_LOCKED)
        Button.SetEvent(IE_GUI_MOUSE_OVER_BUTTON, statevents[i])
        Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON, OnRecordsButtonLeave)

    # AC button
    Button = Window.GetControl(37)
    Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE, OP_SET)
    Button.SetSprites("", 0, 0, 0, 0, 0)
    Button.SetState(IE_GUI_BUTTON_LOCKED)
    Button.SetEvent(IE_GUI_MOUSE_OVER_BUTTON, OnRecordsHelpArmorClass)
    Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON, OnRecordsButtonLeave)

    # HP button
    Button = Window.GetControl(38)
    Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE, OP_SET)
    Button.SetSprites("", 0, 0, 0, 0, 0)
    Button.SetState(IE_GUI_BUTTON_LOCKED)
    Button.SetEvent(IE_GUI_MOUSE_OVER_BUTTON, OnRecordsHelpHitPoints)
    Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON, OnRecordsButtonLeave)

    GUICommonWindows.SetSelectionChangeHandler(UpdateRecordsWindow)
    UpdateRecordsWindow()

    GemRB.UnhideGUI()
Esempio n. 18
0
    Button.SetHotKey('m')

    # workaround for proper closure with ESC
    Button = Window.GetControl(99)
    if not Button:
        Button = Window.CreateButton(99, 0, 0, 0, 0)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, CloseMapWindow)
    Button.MakeEscape()

    return


def CloseMapWindow():
    global WorldMapControl, AreaMapControl

    WorldMapControl = None
    AreaMapControl = None
    GUICommonWindows.CloseTopWindow()


ToggleMapWindow = GUICommonWindows.CreateTopWinLoader(
    0, "GUIMAP", GUICommonWindows.ToggleWindow, InitMapWindow)
OpenMapWindow = GUICommonWindows.CreateTopWinLoader(
    0, "GUIMAP", GUICommonWindows.OpenWindowOnce, InitMapWindow)


def OpenTravelWindow():
    Window = OpenMapWindow()
    InitMapWindow(Window, True)
    return
Esempio n. 19
0
def OpenOptionsWindow():
    """Open main options window (peacock tail)"""
    global OptionsWindow

    if GUICommon.CloseOtherWindow(OpenOptionsWindow):
        GemRB.HideGUI()
        if OptionsWindow:
            OptionsWindow.Unload()
        GemRB.SetVar("OtherWindow", -1)
        GUICommonWindows.EnableAnimatedWindows()
        OptionsWindow = None

        GemRB.UnhideGUI()
        return

    GemRB.GamePause(1, 1)
    TrySavingConfiguration()

    CommonWindow.CloseContainerWindow()
    GemRB.HideGUI()
    GemRB.LoadWindowPack("GUIOPT")
    OptionsWindow = Window = GemRB.LoadWindow(0)
    GemRB.SetVar("OtherWindow", OptionsWindow.ID)
    GUICommonWindows.DisableAnimatedWindows()

    def ConfigOptButton(button, strref, action):
        button.SetText(strref)
        button.SetEvent(IE_GUI_BUTTON_ON_PRESS, action)
        button.SetFlags(IE_GUI_BUTTON_MULTILINE, OP_OR)

    # Return to Game
    ConfigOptButton(Window.GetControl(0), 28638, OpenOptionsWindow)

    # Quit Game
    ConfigOptButton(Window.GetControl(1), 2595, OpenQuitMsgWindow)

    # Load Game
    ConfigOptButton(Window.GetControl(2), 2592, OpenLoadMsgWindow)

    # Save Game
    ConfigOptButton(Window.GetControl(3), 20639, GUISAVE.OpenSaveWindow)

    # Video Options
    ConfigOptButton(Window.GetControl(4), 28781, OpenVideoOptionsWindow)

    # Audio Options
    ConfigOptButton(Window.GetControl(5), 29720, OpenAudioOptionsWindow)

    # Gameplay Options
    ConfigOptButton(Window.GetControl(6), 29722, OpenGameplayOptionsWindow)

    # Keyboard Mappings
    ConfigOptButton(Window.GetControl(7), 29723, OpenKeyboardMappingsWindow)

    # Movies
    ConfigOptButton(Window.GetControl(9), 38156, OpenMoviesWindow)

    # game version, e.g. v1.1.0000
    Label = Window.GetControl(0x10000007)
    Label.SetText(GEMRB_VERSION)

    GemRB.UnhideGUI()
Esempio n. 20
0
def OpenMapWindow():
    import GUICommonWindows
    global MapWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenMapWindow):
        if MapWindow:
            MapWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        MapWindow = None
        #this window type should block the game
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIMAP", 640, 480)
    MapWindow = Window = GemRB.LoadWindow(2)
    #this window type blocks the game normally, but map window doesn't
    GemRB.SetVar("OtherWindow", MapWindow.ID)
    #saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0, OpenMapWindow)
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)
    OptionsWindow.SetFrame()

    # World Map
    Button = Window.GetControl(1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenWorldMapWindowInside)

    # Hide or Show mapnotes
    Button = Window.GetControl(3)
    Button.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
    # Is this an option?
    GemRB.SetVar("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)
    Button.SetVarAssoc("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)

    Label = Window.GetControl(0x10000003)
    Label.SetText("")

    # Map Control
    Window.CreateMapControl(2, 0, 0, 0, 0, 0x10000003, "FLAG1")
    Map = Window.GetControl(2)
    Map.SetVarAssoc("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)
    Map.SetEvent(IE_GUI_MAP_ON_RIGHT_PRESS, AddNoteWindow)
    Map.SetEvent(IE_GUI_MAP_ON_DOUBLE_PRESS, LeftDoublePressMap)
    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    Map.SetStatus(IE_GUI_CONTROL_FOCUSED | IE_GUI_MAP_VIEW_NOTES)
    return
Esempio n. 21
0
def ShowMap():
    import GUICommonWindows
    global MapWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(ShowMap):
        if MapWindow:
            MapWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        MapWindow = None
        #this window type should block the game
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIMAP", 640, 480)
    MapWindow = Window = GemRB.LoadWindow(2)
    #this window type blocks the game normally, but map window doesn't
    GemRB.SetVar("OtherWindow", MapWindow.ID)
    #saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0, ShowMap)
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)
    OptionsWindow.SetFrame()

    # World Map
    Button = Window.GetControl(1)
    Button.SetState(IE_GUI_BUTTON_LOCKED)

    # Hide or Show mapnotes
    Button = Window.GetControl(3)
    Button.SetState(IE_GUI_BUTTON_LOCKED)

    Label = Window.GetControl(0x10000003)
    Label.SetText("")

    # Map Control
    Window.CreateMapControl(2, 0, 0, 0, 0, 0x10000003, "FLAG1")
    Map = Window.GetControl(2)
    GemRB.SetVar("ShowMapNotes", IE_GUI_MAP_REVEAL_MAP)
    Map.SetVarAssoc("ShowMapNotes", IE_GUI_MAP_REVEAL_MAP)
    Map.SetEvent(IE_GUI_MAP_ON_PRESS, RevealMap)
    Window.SetVisible(WINDOW_VISIBLE)
    OptionsWindow.SetVisible(WINDOW_GRAYED)
    PortraitWindow.SetVisible(WINDOW_GRAYED)
    OptionsWindow.SetVisible(WINDOW_FRONT)
    PortraitWindow.SetVisible(WINDOW_FRONT)
    Window.SetVisible(WINDOW_FRONT)
    Map.SetStatus(IE_GUI_CONTROL_FOCUSED | IE_GUI_MAP_REVEAL_MAP)
    GemRB.GamePause(0, 0)
    return
Esempio n. 22
0
	color = {'r' : 30, 'g' : 8, 'b' : 0, 'a' : 0xff}
	WorldMapControl = WMap = Window.ReplaceSubview (4, IE_GUI_WORLDMAP, "FONTDLG", "WMPTY", color, color, color)
	WMap.SetVarAssoc ("Travel", Travel)
	#center on current area
	WMap.Scroll (0,0)
	WMap.Focus()
	if Travel != -1:
		WMap.SetEvent (IE_GUI_WORLDMAP_ON_PRESS, GUIMACommon.MoveToNewArea)

	# Done
	Button = Window.GetControl (0)
	Button.SetText (1403)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, lambda: Window.Close())

ToggleMapWindow = GUICommonWindows.CreateTopWinLoader(3, "GUIMA", GUICommonWindows.ToggleWindow, InitMapWindow, None, WINDOW_TOP|WINDOW_HCENTER)
OpenMapWindow = GUICommonWindows.CreateTopWinLoader(3, "GUIMA", GUICommonWindows.OpenWindowOnce, InitMapWindow, None, WINDOW_TOP|WINDOW_HCENTER)

def NoteChanged (Edit):
	Edit.SetFlags(IE_GUI_VIEW_IGNORE_EVENTS, OP_OR)
	Text = Edit.QueryText ()
	Edit.SetText ("")
	PosX = GemRB.GetVar("MapControlX")
	PosY = GemRB.GetVar("MapControlY")
	GemRB.SetMapnote (PosX, PosY, 1, Text)

	Map = GemRB.GetView("MAP")
	Map.SetVarAssoc ("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)
	Map.SetStatus (IE_GUI_MAP_VIEW_NOTES)

	return
Esempio n. 23
0
def CloseMapWindow():
    global WorldMapControl, AreaMapControl

    WorldMapControl = None
    AreaMapControl = None
    GUICommonWindows.CloseTopWindow()
Esempio n. 24
0
def OpenOptionsWindow():
    global GameOptionsWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenOptionsWindow):
        CloseOptionsWindow()
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIOPT", 800, 600)
    GameOptionsWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", GameOptionsWindow.ID)
    #saving the original portrait window
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow()
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenOptionsWindow)
    Window.SetFrame()

    LoadButton = Window.GetControl(5)
    SaveButton = Window.GetControl(6)
    QuitButton = Window.GetControl(10)
    GraphicsButton = Window.GetControl(7)
    SoundButton = Window.GetControl(8)
    GamePlayButton = Window.GetControl(9)
    MoviesButton = Window.GetControl(14)
    KeyboardButton = Window.GetControl(13)
    ReturnButton = Window.GetControl(11)

    LoadButton.SetText(13729)
    LoadButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenLoadMsgWindow)
    SaveButton.SetText(13730)
    SaveButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenSaveMsgWindow)
    QuitButton.SetText(13731)
    QuitButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenQuitMsgWindow)
    GraphicsButton.SetText(17162)
    GraphicsButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenVideoOptionsWindow)
    SoundButton.SetText(17164)
    SoundButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenAudioOptionsWindow)
    GamePlayButton.SetText(17165)
    GamePlayButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenGameplayOptionsWindow)
    MoviesButton.SetText(15415)
    MoviesButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenMovieWindow)
    KeyboardButton.SetText(33468)
    KeyboardButton.SetEvent(IE_GUI_BUTTON_ON_PRESS,
                            None)  #TODO: OpenKeyboardWindow
    ReturnButton.SetText(10308)
    ReturnButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenOptionsWindow)
    ReturnButton.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    VersionLabel = Window.GetControl(0x1000000B)
    VersionLabel.SetText(GEMRB_VERSION)

    Window.SetVisible(WINDOW_VISIBLE)
    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    return
Esempio n. 25
0
def OpenOptionsWindow():
    """Open main options window"""

    global GameOptionsWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenOptionsWindow):
        CloseOptionsWindow()
        return

    GemRB.GamePause(1, 3)

    CommonWindow.CloseContainerWindow()
    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)
    if GameCheck.IsBG1():
        GUICommonWindows.SetSelectionChangeHandler(None)

    GemRB.LoadWindowPack("GUIOPT", WIDTH, HEIGHT)
    GameOptionsWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", GameOptionsWindow.ID)

    if OldOptionsWindow == None:
        # OptionsWindow is the leftmost menu bar window present in most of the games
        OldOptionsWindow = GUICommonWindows.OptionsWindow
        OptionsWindow = GemRB.LoadWindow(0)
        GUICommonWindows.MarkMenuButton(OptionsWindow)
        GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                                 OpenOptionsWindow)
        OptionsWindow.SetFrame()
        if not GameCheck.IsBG1(
        ):  #not in PST either, but it has its own OpenOptionsWindow()
            OptionsWindow.SetFrame()
            #saving the original portrait window
            OldPortraitWindow = GUICommonWindows.PortraitWindow
            PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    # Return to Game
    Button = Window.GetControl(11)
    Button.SetText(10308)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenOptionsWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    # Quit Game
    Button = Window.GetControl(10)
    Button.SetText(13731)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenQuitMsgWindow)

    # Load Game
    Button = Window.GetControl(5)
    Button.SetText(13729)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenLoadMsgWindow)

    # Save Game
    Button = Window.GetControl(6)
    Button.SetText(13730)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenSaveMsgWindow)

    # Video Options
    Button = Window.GetControl(7)
    Button.SetText(17162)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenVideoOptionsWindow)

    # Audio Options
    Button = Window.GetControl(8)
    Button.SetText(17164)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenAudioOptionsWindow)

    # Gameplay Options
    Button = Window.GetControl(9)
    Button.SetText(17165)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenGameplayOptionsWindow)

    # game version, e.g. v1.1.0000
    VersionLabel = Window.GetControl(0x1000000b)
    VersionLabel.SetText(GEMRB_VERSION)

    if GameCheck.IsIWD2():
        # Keyboard shortcuts
        KeyboardButton = Window.GetControl(13)
        KeyboardButton.SetText(33468)
        KeyboardButton.SetEvent(IE_GUI_BUTTON_ON_PRESS,
                                OpenHotkeyOptionsWindow)

        # Movies
        MoviesButton = Window.GetControl(14)
        MoviesButton.SetText(15415)
        MoviesButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenMovieWindow)

    RestoreWinVisibility()

    return
Esempio n. 26
0
        Count = 1
    ScrollBar.SetVarAssoc("TopIndex", Count)
    RefreshInventoryWindow(Window)

    # PST uses unhardcoded/avslots.2da to decide which slots do what per character
    row = GemRB.GetPlayerStat(pc, IE_SPECIFIC)
    SlotMap = list(map(int, AvSlotsTable.GetValue(row, 1, GTV_STR).split(',')))
    InventoryCommon.SlotMap = SlotMap

    # populate inventory slot controls
    for i in range(46):
        InventoryCommon.UpdateSlot(pc, i)


ToggleInventoryWindow = GUICommonWindows.CreateTopWinLoader(
    3, "GUIINV", GUICommonWindows.ToggleWindow, InitInventoryWindow,
    UpdateInventoryWindow, WINDOW_TOP | WINDOW_HCENTER)
OpenInventoryWindow = GUICommonWindows.CreateTopWinLoader(
    3, "GUIINV", GUICommonWindows.OpenWindowOnce, InitInventoryWindow,
    UpdateInventoryWindow, WINDOW_TOP | WINDOW_HCENTER)

InventoryCommon.UpdateInventoryWindow = UpdateInventoryWindow


def RefreshInventoryWindow(Window):
    """Partial redraw without resetting TopIndex."""

    pc = GemRB.GameGetSelectedPCSingle()

    # name
    Label = Window.GetControl(0x10000039)
Esempio n. 27
0
def SetupSpellIcons(Window, BookType, Start=0, Offset=0):
	actor = GemRB.GameGetFirstSelectedActor ()

	# check if we're dealing with a temporary spellbook
	if GemRB.GetVar("ActionLevel") == UAW_2DASPELLS:
		allSpells = GetSpellinfoSpells (actor, BookType)
	else:
		# construct the spellbook of usable (not depleted) memorized spells
		# the getters expect the BookType as: 0 priest, 1 mage, 2 innate
		if BookType == -1:
			# Nahal's reckless dweomer can use any known spell
			allSpells = GetKnownSpells (actor, IE_SPELL_TYPE_WIZARD)
		else:
			allSpells = []
			for i in range(16):
				if BookType & (1<<i):
					allSpells += GetUsableMemorizedSpells (actor, i)
			if not len(allSpells):
				raise AttributeError ("Error, unknown BookType passed to SetupSpellIcons: %d! Bailing out!" %(BookType))

	if BookType == -1:
		memorizedSpells = allSpells
		# reset Type, so we can choose the surge spell instead of just getting a redraw of the action bar
		GemRB.SetVar("Type", 3)
	else:
		memorizedSpells = SortUsableSpells(allSpells)

	# start creating the controls
	import GUICommonWindows
	# TODO: ASCOL, ROWS
	#AsCol = CommonTables.SpellDisplay.GetValue (layout, "AS_COL")
	#Rows = CommonTables.SpellDisplay.GetValue (layout, "ROWS")
	More = len(memorizedSpells) > 12 or Start > 0

	# scroll left button
	if More:
		Button = Window.GetControl (Offset)
		Button.SetText ("")
		if Start:
			GUICommonWindows.SetActionIconWorkaround (Button, ACT_LEFT, 0)
			Button.SetState (IE_GUI_BUTTON_UNPRESSED)
		else:
			Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
			Button.SetTooltip ("")
			Button.SetState (IE_GUI_BUTTON_DISABLED)

	# disable all spells if fx_disable_spellcasting was run with the same type
	# but only if there are any spells of that type to disable
	disabled_spellcasting = GemRB.GetPlayerStat(actor, IE_CASTING, 0)
	actionLevel = GemRB.GetVar ("ActionLevel")

	#order is: mage, cleric, innate, class, song, (defaults to 1, item)
	spellSections = [2, 4, 8, 16, 16]

	# create the spell icon buttons
	buttonCount = 12 - More * 2 # GUIBT_COUNT in PCStatsStruct
	for i in range (buttonCount):
		Button = Window.GetControl (i+Offset+More)
		Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, None)

		if i+Start >= len(memorizedSpells):
			Button.SetState (IE_GUI_BUTTON_DISABLED)
			Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
			Button.SetText ("")
			Button.SetTooltip ("")
			continue
		Spell = memorizedSpells[i+Start]
		spellType = Spell['SpellType']
		if spellType > 4:
			spellType = 1
		else:
			spellType = spellSections[spellType]
		if BookType == -1:
			Button.SetVarAssoc ("Spell", Spell['SpellIndex']+i+Start)
		else:
			Button.SetVarAssoc ("Spell", Spell['SpellIndex'])

		# disable spells that should be cast from the inventory or can't be cast while silenced or ...
		# see splspec.2da for all the reasons; silence is handled elsewhere
		specialSpell = GemRB.CheckSpecialSpell(actor, Spell['SpellResRef'])
		specialSpell = (specialSpell & SP_IDENTIFY) or ((specialSpell & SP_SURGE) and actionLevel == UAW_ALLMAGE)
		if specialSpell & SP_SILENCE and Spell['HeaderFlags'] & 0x2000000: # SF_IGNORES_SILENCE
			specialSpell ^= SP_SILENCE
		if specialSpell or (disabled_spellcasting&spellType):
			Button.SetState (IE_GUI_BUTTON_DISABLED)
			Button.EnableBorder(1, 0)
		else:
			Button.SetState (IE_GUI_BUTTON_UNPRESSED)
			Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, GUICommonWindows.SpellPressed)
			Button.SetEvent (IE_GUI_BUTTON_ON_SHIFT_PRESS, GUICommonWindows.SpellShiftPressed)

		if Spell['SpellResRef']:
			Button.SetSprites ("guibtbut", 0, 0,1,2,3)
			Button.SetSpellIcon (Spell['SpellResRef'], 1)
			Button.SetFlags (IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_ALIGN_BOTTOM|IE_GUI_BUTTON_ALIGN_RIGHT, OP_SET)
			Button.SetTooltip (Spell['SpellName'])

			if Spell['MemoCount'] > 0 and BookType != -1:
				Button.SetText (str(Spell['MemoCount']))
			else:
				Button.SetText ("")

	# scroll right button
	if More:
		Button = Window.GetControl (Offset+buttonCount+1)
		GUICommonWindows.SetActionIconWorkaround (Button, ACT_RIGHT, buttonCount)
		Button.SetText ("")
		if len(memorizedSpells) - Start > 10:
			Button.SetState (IE_GUI_BUTTON_UNPRESSED)
		else:
			Button.SetState (IE_GUI_BUTTON_DISABLED)
			Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
			Button.SetTooltip ("")
Esempio n. 28
0
def RefreshInventoryWindow(Window):
    """Partial redraw without resetting TopIndex."""

    pc = GemRB.GameGetSelectedPCSingle()

    # name
    Label = Window.GetControl(0x10000039)
    Label.SetText(GemRB.GetPlayerName(pc, 1))

    # portrait
    Button = Window.GetControl(44)
    Button.SetPicture(GUICommonWindows.GetActorPortrait(pc, 'INVENTORY'))

    # there's a label at 0x1000003a, but we don't need it
    GUICommon.SetEncumbranceLabels(Window, 46, None, pc)

    # armor class
    ac = GemRB.GetPlayerStat(pc, IE_ARMORCLASS)
    Label = Window.GetControl(0x1000003a)
    Label.SetText(str(ac))

    # hp current
    hp = GemRB.GetPlayerStat(pc, IE_HITPOINTS)
    Label = Window.GetControl(0x1000003b)
    Label.SetText(str(hp))

    # hp max
    hpmax = GemRB.GetPlayerStat(pc, IE_MAXHITPOINTS)
    Label = Window.GetControl(0x1000003c)
    Label.SetText(str(hpmax))

    # party gold
    Label = Window.GetControl(0x1000003e)
    Label.SetText(str(GemRB.GameGetPartyGold()))

    # class
    text = CommonTables.Classes.GetValue(GUICommon.GetClassRowName(pc),
                                         "NAME_REF")

    Label = Window.GetControl(0x1000003f)
    Label.SetText(text)

    GUICommon.AdjustWindowVisibility(Window, pc, False)

    # update ground inventory slots
    TopIndex = GemRB.GetVar("TopIndex")
    for i in range(10):
        Button = Window.GetControl(i + 47)
        if GemRB.IsDraggingItem():
            Button.SetState(IE_GUI_BUTTON_FAKEPRESSED)
        else:
            Button.SetState(IE_GUI_BUTTON_ENABLED)
        Button.SetAction(InventoryCommon.OnDragItemGround,
                         IE_ACT_DRAG_DROP_DST)
        Slot = GemRB.GetContainerItem(pc, i + TopIndex)
        if Slot != None:
            item = GemRB.GetItem(Slot['ItemResRef'])
            identified = Slot["Flags"] & IE_INV_ITEM_IDENTIFIED

            Button.SetItemIcon(Slot['ItemResRef'])
            Button.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
            if item['MaxStackAmount'] > 1:
                Button.SetText(str(Slot['Usages0']))
            else:
                Button.SetText('')
            if not identified or item["ItemNameIdentified"] == -1:
                Button.SetTooltip(item["ItemName"])
                Button.EnableBorder(0, 1)
            else:
                Button.SetTooltip(item["ItemNameIdentified"])
                Button.EnableBorder(0, 0)

            Button.SetValue(i + TopIndex)
            Button.SetAction(InventoryCommon.OnDragItemGround,
                             IE_ACT_DRAG_DROP_CRT)
            Button.SetEvent(IE_GUI_BUTTON_ON_PRESS,
                            InventoryCommon.OnDragItemGround)
            Button.SetEvent(IE_GUI_BUTTON_ON_RIGHT_PRESS,
                            InventoryCommon.OpenGroundItemInfoWindow)
            Button.SetEvent(IE_GUI_BUTTON_ON_SHIFT_PRESS,
                            InventoryCommon.OpenGroundItemAmountWindow)

        else:
            Button.SetFlags(IE_GUI_BUTTON_PICTURE, OP_NAND)
            Button.SetTooltip(4273)
            Button.SetText('')
            Button.EnableBorder(0, 0)
            Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, None)
            Button.SetEvent(IE_GUI_BUTTON_ON_RIGHT_PRESS, None)
            Button.SetEvent(IE_GUI_BUTTON_ON_SHIFT_PRESS, None)
    return
Esempio n. 29
0
def OpenInventoryWindow():
    """Opens the inventory window."""

    import GUICommonWindows

    global InventoryWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenInventoryWindow):
        if GemRB.IsDraggingItem() == 1:
            pc = GemRB.GameGetSelectedPCSingle()
            #store the item in the inventory before window is closed
            GemRB.DropDraggedItem(pc, -3)
            #dropping on ground if cannot store in inventory
            if GemRB.IsDraggingItem() == 1:
                GemRB.DropDraggedItem(pc, -2)

        InventoryCommon.CloseIdentifyItemWindow()
        InventoryCommon.CloseAbilitiesItemWindow()
        InventoryCommon.CancelColor()
        if InventoryCommon.ItemInfoWindow:
            InventoryCommon.ItemInfoWindow.Unload()
            InventoryCommon.ItemInfoWindow = None
        if InventoryCommon.ItemAmountWindow:
            InventoryCommon.ItemAmountWindow.Unload()
            InventoryCommon.ItemAmountWindow = None
        if InventoryCommon.ErrorWindow:
            InventoryCommon.ErrortWindow.Unload()
            InventoryCommon.ErrortWindow = None

        if InventoryWindow:
            InventoryWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        InventoryWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GemRB.SetVar("MessageLabel", -1)
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        GUICommonWindows.UpdatePortraitWindow()
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        #don't go back to multi selection mode when going to the store screen
        if not GemRB.GetVar("Inventory"):
            GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
            GemRB.UnhideGUI()
            GUICommonWindows.SetSelectionChangeHandler(None)
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIINV", 640, 480)
    InventoryWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", InventoryWindow.ID)
    GemRB.SetVar("MessageLabel", Window.GetControl(0x1000003f).ID)
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenInventoryWindow)
    OptionsWindow.SetFrame()
    #saving the original portrait window
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    #ground items scrollbar
    ScrollBar = Window.GetControl(66)
    ScrollBar.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE, RefreshInventoryWindow)

    #Ground Item
    for i in range(5):
        Button = Window.GetControl(i + 68)
        Button.SetEvent(IE_GUI_MOUSE_ENTER_BUTTON,
                        InventoryCommon.MouseEnterGround)
        Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON,
                        InventoryCommon.MouseLeaveGround)
        Button.SetVarAssoc("GroundItemButton", i)
        Button.SetSprites("STONSLOT", 0, 0, 2, 4, 3)

    #major & minor clothing color
    Button = Window.GetControl(62)
    Button.SetSprites("INVBUT", 0, 0, 1, 0, 0)
    Button.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, InventoryCommon.MajorPress)
    Button.SetTooltip(12007)

    Button = Window.GetControl(63)
    Button.SetSprites("INVBUT", 0, 0, 1, 0, 0)
    Button.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, InventoryCommon.MinorPress)
    Button.SetTooltip(12008)

    #portrait
    Button = Window.GetControl(50)
    Button.SetState(IE_GUI_BUTTON_LOCKED)
    Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PICTURE, OP_SET)
    Button.SetEvent(IE_GUI_BUTTON_ON_DRAG_DROP, InventoryCommon.OnAutoEquip)

    #encumbrance
    Button = Window.GetControl(67)
    r = Button.GetRect()
    Label = Window.CreateLabel(
        0x10000043, r["X"], r["Y"], r["Width"], 20, "NUMBER", "0:",
        IE_FONT_ALIGN_LEFT | IE_FONT_ALIGN_TOP | IE_FONT_SINGLE_LINE)
    Label = Window.CreateLabel(
        0x10000044, r["X"], r["Y"] + r["Height"] - 20, r["Width"], 20,
        "NUMBER", "0:",
        IE_FONT_ALIGN_RIGHT | IE_FONT_ALIGN_BOTTOM | IE_FONT_SINGLE_LINE)

    # armor class
    Label = Window.GetControl(0x10000038)
    Label.SetTooltip(17183)

    # hp current
    Label = Window.GetControl(0x10000039)
    Label.SetTooltip(17184)

    # hp max
    Label = Window.GetControl(0x1000003a)
    Label.SetTooltip(17378)

    # info label, game paused, etc
    Label = Window.GetControl(0x1000003f)
    Label.SetText("")

    SlotCount = GemRB.GetSlotType(-1)["Count"]
    for slot in range(SlotCount):
        SlotType = GemRB.GetSlotType(slot + 1)
        if SlotType["ID"]:
            Button = Window.GetControl(SlotType["ID"])
            Button.SetEvent(IE_GUI_MOUSE_ENTER_BUTTON,
                            InventoryCommon.MouseEnterSlot)
            Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON,
                            InventoryCommon.MouseLeaveSlot)
            Button.SetVarAssoc("ItemButton", slot + 1)
            #keeping 2 in the original place, because it is how
            #the gui resource has it, but setting the other cycles
            Button.SetSprites("STONSLOT", 0, 0, 2, 4, 3)

    # create a button so we can map it do ESC for quit exiting
    Button = Window.CreateButton(999, 0, 0, 1, 1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenInventoryWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    GemRB.SetVar("TopIndex", 0)
    GUICommonWindows.SetSelectionChangeHandler(UpdateInventoryWindow)
    UpdateInventoryWindow()
    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_FRONT)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetKeyPressEvent(GUICommonWindows.SwitchPCByKey)
    return
Esempio n. 30
0
def UpdateRecordsWindow():
    global stats_overview, faction_help, alignment_help

    Window = RecordsWindow
    if not RecordsWindow:
        print "SelectionChange handler points to non existing window\n"
        return

    pc = GemRB.GameGetSelectedPCSingle()

    # Setting up the character information
    GetCharacterHeader(pc)

    # Checking whether character has leveled up.
    Button = Window.GetControl(9)
    if avatar_header['SecoLevel'] == 0:
        if avatar_header['XP'] >= avatar_header['PrimNextLevXP']:
            Button.SetState(IE_GUI_BUTTON_ENABLED)
        else:
            Button.SetState(IE_GUI_BUTTON_DISABLED)
    else:
        # Character is Multi-Class
        if avatar_header['XP'] >= avatar_header[
                'PrimNextLevXP'] or avatar_header['XP'] >= avatar_header[
                    'SecoNextLevXP']:
            Button.SetState(IE_GUI_BUTTON_ENABLED)
        else:
            Button.SetState(IE_GUI_BUTTON_DISABLED)

    # name
    Label = Window.GetControl(0x1000000a)
    Label.SetText(GemRB.GetPlayerName(pc, 1))

    # portrait
    Image = Window.GetControl(2)
    Image.SetState(IE_GUI_BUTTON_LOCKED)
    Image.SetFlags(IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PICTURE, OP_SET)
    Image.SetPicture(GUICommonWindows.GetActorPortrait(pc, 'STATS'))

    # armorclass
    Label = Window.GetControl(0x1000000b)
    Label.SetText(str(GemRB.GetPlayerStat(pc, IE_ARMORCLASS)))
    Label.SetTooltip(4197)

    # hp now
    Label = Window.GetControl(0x1000000c)
    Label.SetText(str(GemRB.GetPlayerStat(pc, IE_HITPOINTS)))
    Label.SetTooltip(4198)

    # hp max
    Label = Window.GetControl(0x1000000d)
    Label.SetText(str(GemRB.GetPlayerStat(pc, IE_MAXHITPOINTS)))
    Label.SetTooltip(4199)

    # stats

    sstr = GemRB.GetPlayerStat(pc, IE_STR)
    bstr = GemRB.GetPlayerStat(pc, IE_STR, 1)
    sstrx = GemRB.GetPlayerStat(pc, IE_STREXTRA)
    bstrx = GemRB.GetPlayerStat(pc, IE_STREXTRA, 1)
    if (sstrx > 0) and (sstr == 18):
        sstr = "%d/%02d" % (sstr, sstrx % 100)
    if (bstrx > 0) and (bstr == 18):
        bstr = "%d/%02d" % (bstr, bstrx % 100)
    sint = GemRB.GetPlayerStat(pc, IE_INT)
    bint = GemRB.GetPlayerStat(pc, IE_INT, 1)
    swis = GemRB.GetPlayerStat(pc, IE_WIS)
    bwis = GemRB.GetPlayerStat(pc, IE_WIS, 1)
    sdex = GemRB.GetPlayerStat(pc, IE_DEX)
    bdex = GemRB.GetPlayerStat(pc, IE_DEX, 1)
    scon = GemRB.GetPlayerStat(pc, IE_CON)
    bcon = GemRB.GetPlayerStat(pc, IE_CON, 1)
    schr = GemRB.GetPlayerStat(pc, IE_CHR)
    bchr = GemRB.GetPlayerStat(pc, IE_CHR, 1)

    stats = (sstr, sint, swis, sdex, scon, schr)
    basestats = (bstr, bint, bwis, bdex, bcon, bchr)
    for i in range(6):
        Label = Window.GetControl(0x1000000e + i)
        if stats[i] != basestats[i]:
            Label.SetTextColor(255, 0, 0)
        else:
            Label.SetTextColor(255, 255, 255)
        Label.SetText(str(stats[i]))

    # race
    # HACK: for some strange reason, Morte's race is 1 (Human), instead of 45 (Morte)
    print "species: %d  race: %d" % (GemRB.GetPlayerStat(
        pc, IE_SPECIES), GemRB.GetPlayerStat(pc, IE_RACE))
    #be careful, some saves got this field corrupted
    race = GemRB.GetPlayerStat(pc, IE_SPECIES) - 1

    text = CommonTables.Races.GetValue(race, 0)

    Label = Window.GetControl(0x10000014)
    Label.SetText(text)

    # sex
    GenderTable = GemRB.LoadTable("GENDERS")
    text = GenderTable.GetValue(GemRB.GetPlayerStat(pc, IE_SEX) - 1, 0)

    Label = Window.GetControl(0x10000015)
    Label.SetText(text)

    # class
    text = CommonTables.Classes.GetValue(
        GemRB.GetPlayerStat(pc, IE_CLASS) - 1, 0)

    Label = Window.GetControl(0x10000016)
    Label.SetText(text)

    # alignment
    align = GemRB.GetPlayerStat(pc, IE_ALIGNMENT)
    ss = GemRB.LoadSymbol("ALIGN")
    sym = ss.GetValue(align)

    AlignmentTable = GemRB.LoadTable("ALIGNS")
    alignment_help = GemRB.GetString(AlignmentTable.GetValue(sym, 'DESC_REF'))
    frame = (3 * int(align / 16) + align % 16) - 4

    Button = Window.GetControl(5)
    Button.SetState(IE_GUI_BUTTON_LOCKED)
    Button.SetSprites('STALIGN', 0, frame, 0, 0, 0)
    Button.SetEvent(IE_GUI_MOUSE_OVER_BUTTON, OnRecordsHelpAlignment)
    Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON, OnRecordsButtonLeave)

    # faction
    faction = GemRB.GetPlayerStat(pc, IE_FACTION)
    FactionTable = GemRB.LoadTable("FACTIONS")
    faction_help = GemRB.GetString(FactionTable.GetValue(faction, 0))
    frame = FactionTable.GetValue(faction, 1)

    Button = Window.GetControl(6)
    Button.SetState(IE_GUI_BUTTON_LOCKED)
    Button.SetSprites('STFCTION', 0, frame, 0, 0, 0)
    Button.SetEvent(IE_GUI_MOUSE_OVER_BUTTON, OnRecordsHelpFaction)
    Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON, OnRecordsButtonLeave)

    # help, info textarea
    stats_overview = GetStatOverview(pc)
    Text = Window.GetControl(0)
    Text.SetText(stats_overview)
    return