def OpenReformPartyWindow (): global ReformPartyWindow if GUICommon.CloseOtherWindow(OpenReformPartyWindow): GemRB.HideGUI () if ReformPartyWindow: ReformPartyWindow.Unload () ReformPartyWindow = None GemRB.SetVar ("OtherWindow", -1) GUICommonWindows.EnableAnimatedWindows () GemRB.LoadWindowPack ("GUIREC") GemRB.UnhideGUI () return GemRB.HideGUI () GemRB.LoadWindowPack (GUICommon.GetWindowPack()) ReformPartyWindow = Window = GemRB.LoadWindow (24) GemRB.SetVar ("OtherWindow", Window.ID) GUICommonWindows.DisableAnimatedWindows () # Remove Button = Window.GetControl (15) Button.SetText (42514) Button.SetState (IE_GUI_BUTTON_DISABLED) # TODO: implement removal # Done Button = Window.GetControl (8) Button.SetText (1403) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenReformPartyWindow) GemRB.UnhideGUI ()
def OpenJournalWindow(): global JournalWindow, PortraitWindow, ActionsWindow global StartTime Table = GemRB.LoadTable("YEARS") StartTime = Table.GetValue("STARTTIME", "VALUE") if GUICommon.CloseOtherWindow(OpenJournalWindow): if LogWindow: OpenLogWindow() if BeastsWindow: OpenBeastsWindow() if QuestsWindow: OpenQuestsWindow() GemRB.HideGUI() if JournalWindow: JournalWindow.Unload() #making the portraitwindow visible again GUICommonWindows.EnableAnimatedWindows() GemRB.SetVar("OtherWindow", -1) PortraitWindow = None ActionsWindow = None JournalWindow = None GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE) GemRB.UnhideGUI() return GemRB.HideGUI() GemRB.LoadWindowPack("GUIJRNL") JournalWindow = GemRB.LoadWindow(0) GemRB.SetVar("OtherWindow", JournalWindow.ID) GUICommonWindows.DisableAnimatedWindows() # Quests Button = JournalWindow.GetControl(0) Button.SetText(20430) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenQuestsWindow) # Beasts Button = JournalWindow.GetControl(1) Button.SetText(20634) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenBeastsWindow) # Journal Button = JournalWindow.GetControl(2) Button.SetText(20635) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenLogWindow) # Done Button = JournalWindow.GetControl(3) Button.SetText(20636) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenJournalWindow) Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR) Button.SetStatus(IE_GUI_CONTROL_FOCUSED) #JournalWindow.SetVisible (WINDOW_VISIBLE) GemRB.UnhideGUI()
def OpenFormationWindow (): global FormationWindow if GUICommon.CloseOtherWindow(OpenFormationWindow): GemRB.HideGUI () if FormationWindow: FormationWindow.Unload () FormationWindow = None GemRB.GameSetFormation (last_formation, 0) GUICommonWindows.EnableAnimatedWindows () GemRB.SetVar ("OtherWindow", -1) GemRB.UnhideGUI () return GemRB.HideGUI () GemRB.LoadWindowPack (GUICommon.GetWindowPack()) FormationWindow = Window = GemRB.LoadWindow (27) GemRB.SetVar ("OtherWindow", Window.ID) GUICommonWindows.DisableAnimatedWindows () # Done Button = Window.GetControl (13) Button.SetText (1403) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenFormationWindow) tooltips = ( 44957, # Follow 44958, # T 44959, # Gather 44960, # 4 and 2 44961, # 3 by 2 44962, # Protect 48152, # 2 by 3 44964, # Rank 44965, # V 44966, # Wedge 44967, # S 44968, # Line 44969, # None ) for i in range (13): Button = Window.GetControl (i) Button.SetVarAssoc ("SelectedFormation", i) Button.SetTooltip (tooltips[i]) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SelectFormation) GemRB.SetVar ("SelectedFormation", GemRB.GameGetFormation (0)) SelectFormation () GemRB.UnhideGUI ()
def WorldMapWindowCommon(Travel): global WorldMapWindow, WorldMapControl GemRB.HideGUI() if WorldMapWindow: if WorldMapWindow: WorldMapWindow.Unload() WorldMapWindow = None WorldMapControl = None GemRB.SetVar("OtherWindow", -1) GUICommonWindows.EnableAnimatedWindows() GemRB.UnhideGUI() return GUICommonWindows.DisableAnimatedWindows() GemRB.LoadWindowPack("GUIWMAP") WorldMapWindow = Window = GemRB.LoadWindow(0) MapWindow = None GemRB.SetVar("OtherWindow", WorldMapWindow.ID) Window.CreateWorldMapControl(4, 0, 62, 640, 418, Travel, "FONTDLG") WorldMapControl = Window.GetControl(4) WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_BACKGROUND, 0x84, 0x4a, 0x2c, 0x00) WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_NORMAL, 0x20, 0x20, 0x00, 0xff) WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_SELECTED, 0x20, 0x20, 0x00, 0xff) WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_NOTVISITED, 0x20, 0x20, 0x00, 0xa0) WorldMapControl.SetAnimation("WMPTY") #center on current area WorldMapControl.AdjustScrolling(0, 0) WorldMapControl.SetStatus(IE_GUI_CONTROL_FOCUSED) WorldMapControl.SetEvent(IE_GUI_WORLDMAP_ON_PRESS, GUIMACommon.MoveToNewArea) # Done Button = Window.GetControl(0) Button.SetText(1403) if Travel >= 0: Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenWorldMapWindow) else: Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenMapWindow) GemRB.UnhideGUI()
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()
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()
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 ()