Exemplo n.º 1
0
def DoneColorWindow():
    pc = GemRB.GameGetSelectedPCSingle()
    GemRB.SetPlayerStat(pc, IE_MINOR_COLOR, MinorColor)
    GemRB.SetPlayerStat(pc, IE_MAJOR_COLOR, MajorColor)
    GemRB.SetPlayerStat(pc, IE_SKIN_COLOR, SkinColor)
    GemRB.SetPlayerStat(pc, IE_HAIR_COLOR, HairColor)
    GUIRECCommon.CloseSubCustomizeWindow()
    return
Exemplo n.º 2
0
def DonePress():
    global HairColor, SkinColor, MajorColor, MinorColor
    global PickedColor

    GUIRECCommon.CloseSubSubCustomizeWindow()
    PickedColor = ColorTable.GetValue(ColorIndex, GemRB.GetVar("Selected"))
    if ColorIndex == 0:
        HairColor = PickedColor
        UpdatePaperDoll()
        return
    if ColorIndex == 1:
        SkinColor = PickedColor
        UpdatePaperDoll()
        return
    if ColorIndex == 2:
        MinorColor = PickedColor
        UpdatePaperDoll()
        return

    MajorColor = PickedColor
    UpdatePaperDoll()
    return
Exemplo n.º 3
0
def OpenInformationWindow():
    global InformationWindow

    if InformationWindow != None:
        GUIRECCommon.CloseBiographyWindow()
        CloseInformationWindow()
        return

    InformationWindow = Window = GemRB.LoadWindow(4)

    # Biography
    Button = Window.GetControl(26)
    Button.SetText(18003)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIRECCommon.OpenBiographyWindow)

    # Done
    Button = Window.GetControl(24)
    Button.SetText(11973)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, CloseInformationWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    TotalPartyExp = 0
    ChapterPartyExp = 0
    TotalPartyKills = 0
    ChapterCount = 0
    for i in range(1, GemRB.GetPartySize() + 1):
        stat = GemRB.GetPCStats(i)
        TotalPartyExp = TotalPartyExp + stat['KillsTotalXP']
        ChapterPartyExp = ChapterPartyExp + stat['KillsChapterXP']
        TotalPartyKills = TotalPartyKills + stat['KillsTotalCount']
        ChapterCount = ChapterCount + stat['KillsChapterCount']

    # These are used to get the stats
    pc = GemRB.GameGetSelectedPCSingle()
    stat = GemRB.GetPCStats(pc)

    Label = Window.GetControl(0x10000000)
    Label.SetText(GemRB.GetPlayerName(pc, 1))
    # class
    ClassTitle = GUICommon.GetActorClassTitle(pc)
    Label = Window.GetControl(0x10000018)
    Label.SetText(ClassTitle)

    #most powerful vanquished
    Label = Window.GetControl(0x10000005)
    #we need getstring, so -1 will translate to empty string
    Label.SetText(GemRB.GetString(stat['BestKilledName']))

    Label = Window.GetControl(0x10000006)
    GUICommon.SetCurrentDateTokens(stat)
    #actually it is 16043 <DURATION>, but duration is translated to
    #16041, hopefully this won't cause problem with international version
    Label.SetText(16041)

    #favourite spell
    Label = Window.GetControl(0x10000007)
    Label.SetText(stat['FavouriteSpell'])

    #favourite weapon
    Label = Window.GetControl(0x10000008)
    #actually it is 10479 <WEAPONNAME>, but weaponname is translated to
    #the real weapon name (which we should set using SetToken)
    #there are other strings like bow+wname/xbow+wname/sling+wname
    #are they used?
    Label.SetText(stat['FavouriteWeapon'])

    #total party xp
    Label = Window.GetControl(0x10000013)
    if TotalPartyExp != 0:
        PartyExp = int((stat['KillsTotalXP'] * 100) / TotalPartyExp)
        Label.SetText(str(PartyExp) + '%')
    else:
        Label.SetText("0%")

    # chapter party xp
    Label = Window.GetControl(0x1000000f)
    if ChapterPartyExp != 0:
        PartyExp = int((stat['KillsChapterXP'] * 100) / ChapterPartyExp)
        Label.SetText(str(PartyExp) + '%')
    else:
        Label.SetText("0%")

    # total kills
    Label = Window.GetControl(0x10000014)
    if TotalPartyKills != 0:
        PartyKills = int((stat['KillsTotalCount'] * 100) / TotalPartyKills)
        Label.SetText(str(PartyKills) + '%')
    else:
        Label.SetText("0%")

    # chapter kills
    Label = Window.GetControl(0x10000010)
    if ChapterCount != 0:
        PartyKills = int((stat['KillsChapterCount'] * 100) / ChapterCount)
        Label.SetText(str(PartyKills) + '%')
    else:
        Label.SetText("0%")

    Label = Window.GetControl(0x10000011)
    Label.SetText(str(stat['KillsChapterXP']))
    Label = Window.GetControl(0x10000015)
    Label.SetText(str(stat['KillsTotalXP']))

    #count of kills in chapter/game
    Label = Window.GetControl(0x10000012)
    Label.SetText(str(stat['KillsChapterCount']))
    Label = Window.GetControl(0x10000016)
    Label.SetText(str(stat['KillsTotalCount']))

    Window.ShowModal(MODAL_SHADOW_GRAY)
    return
Exemplo n.º 4
0
def OpenRecordsWindow():
    import GUICommonWindows

    global RecordsWindow, OptionsWindow, PortraitWindow, PauseState
    global OldPortraitWindow, OldOptionsWindow

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

        GUIRECCommon.CloseSubSubCustomizeWindow()
        GUIRECCommon.CloseSubCustomizeWindow()
        GUIRECCommon.CloseCustomizeWindow()
        GUIRECCommon.ExportCancelPress()
        GUIRECCommon.CloseBiographyWindow()
        KitDonePress()
        CloseInformationWindow()

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

        RecordsWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.UpdatePortraitWindow()
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        GUICommonWindows.SetSelectionChangeHandler(None)
        GemRB.GamePause(PauseState, 3)
        return

    PauseState = GemRB.GamePause(3, 1)
    GemRB.GamePause(1, 3)

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

    GemRB.LoadWindowPack("GUIREC", 640, 480)
    RecordsWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", RecordsWindow.ID)
    # saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenRecordsWindow)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    OptionsWindow.SetFrame()
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    # dual class
    Button = Window.GetControl(0)
    Button.SetText(7174)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, DualClass.DualClassWindow)

    # levelup
    Button = Window.GetControl(37)
    Button.SetText(7175)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, LevelUp.OpenLevelUpWindow)

    # information
    Button = Window.GetControl(1)
    Button.SetText(11946)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenInformationWindow)

    # reform party
    Button = Window.GetControl(51)
    Button.SetText(16559)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenRecReformPartyWindow)

    # customize
    Button = Window.GetControl(50)
    Button.SetText(10645)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIRECCommon.OpenCustomizeWindow)

    # export
    Button = Window.GetControl(36)
    Button.SetText(13956)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIRECCommon.OpenExportWindow)

    # kit info
    if GameCheck.IsBG2():
        Button = Window.GetControl(52)
        Button.SetText(61265)
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenKitInfoWindow)

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

    GUICommonWindows.SetSelectionChangeHandler(UpdateRecordsWindow)
    UpdateRecordsWindow()

    Window.SetKeyPressEvent(GUICommonWindows.SwitchPCByKey)

    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    return