Example #1
0
def GetActorPaperDoll(actor):
    anim_id = GemRB.GetPlayerStat(actor, IE_ANIMATION_ID)
    level = GemRB.GetPlayerStat(actor, IE_ARMOR_TYPE)
    row = "0x%04X" % anim_id
    which = "LEVEL%d" % (level + 1)
    doll = CommonTables.Pdolls.GetValue(row, which)
    if doll == "*":
        # guess a name
        import GUICommonWindows
        doll = GUICommonWindows.GetActorPaperDoll(actor) + "INV"
        if not GemRB.HasResource(doll, RES_BAM):
            print "GetActorPaperDoll: Missing paper doll for animation", row, which, doll
    return doll
Example #2
0
def RefreshInventoryWindow():
    Window = InventoryWindow

    pc = GemRB.GameGetSelectedPCSingle()

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

    # paperdoll
    Button = Window.GetControl(50)
    Color1 = GemRB.GetPlayerStat(pc, IE_METAL_COLOR)
    Color2 = GemRB.GetPlayerStat(pc, IE_MINOR_COLOR)
    Color3 = GemRB.GetPlayerStat(pc, IE_MAJOR_COLOR)
    Color4 = GemRB.GetPlayerStat(pc, IE_SKIN_COLOR)
    Color5 = GemRB.GetPlayerStat(pc, IE_LEATHER_COLOR)
    Color6 = GemRB.GetPlayerStat(pc, IE_ARMOR_COLOR)
    Color7 = GemRB.GetPlayerStat(pc, IE_HAIR_COLOR)

    Button.SetFlags(IE_GUI_BUTTON_CENTER_PICTURES, OP_OR)
    pdoll = GUICommonWindows.GetActorPaperDoll(pc) + "WK"
    # FIXME: animation bleeds through top window
    # NOTE: regenerate invenwin.png with a transparent hole if we
    # can ever keep drawing the gamecontrol underneath ...
    # and then remove this block
    if GemRB.HasResource(pdoll, RES_BAM):
        Button.SetAnimation(pdoll)
        Button.SetAnimationPalette(Color1, Color2, Color3, Color4, Color5,
                                   Color6, Color7, 0)

    # portrait
    Button = Window.GetControl(84)
    # NOTE: use FillPlayerInfo or code to switch pics iff the party will grow
    #Button.SetPicture (GemRB.GetPlayerPortrait (pc,0))
    Button.SetPicture("portr1L")

    # encumbrance
    GUICommon.SetEncumbranceLabels(Window, 0x10000042, None, pc)

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

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

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

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

    Button = Window.GetControl(62)
    Color = GemRB.GetPlayerStat(pc, IE_MAJOR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(63)
    Color = GemRB.GetPlayerStat(pc, IE_MINOR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(82)
    Color = GemRB.GetPlayerStat(pc, IE_HAIR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(83)
    Color = GemRB.GetPlayerStat(pc, IE_SKIN_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    # update ground inventory slots
    Container = GemRB.GetContainer(pc, 1)
    TopIndex = GemRB.GetVar("TopIndex")
    for i in range(6):
        if i < 5:
            Button = Window.GetControl(i + 68)
        else:
            Button = Window.GetControl(i + 76)

        if GemRB.IsDraggingItem() == 1:
            Button.SetState(IE_GUI_BUTTON_FAKEPRESSED)
        else:
            Button.SetState(IE_GUI_BUTTON_ENABLED)
        Button.SetEvent(IE_GUI_BUTTON_ON_DRAG_DROP,
                        InventoryCommon.OnDragItemGround)

        Slot = GemRB.GetContainerItem(pc, i + TopIndex)
        if Slot == None:
            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)
        else:
            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)

        InventoryCommon.UpdateInventorySlot(pc, Button, Slot, "ground")

    #if actor is uncontrollable, make this grayed
    GUICommon.AdjustWindowVisibility(Window, pc, False)
    return
Example #3
0
def RefreshInventoryWindow():
    Window = InventoryWindow

    pc = GemRB.GameGetSelectedPCSingle()

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

    # paperdoll
    Button = Window.GetControl(50)
    Button.SetFlags(IE_GUI_BUTTON_CENTER_PICTURES, OP_OR)
    pdoll = GUICommonWindows.GetActorPaperDoll(pc) + "G11"
    if GemRB.HasResource(pdoll, RES_BAM):
        pal = [
            GemRB.GetPlayerStat(pc, c)
            for c in range(IE_METAL_COLOR, IE_HAIR_COLOR + 1)
        ]
        Button.SetAnimation(pdoll, 0, 0, pal)

    # portrait
    Button = Window.GetControl(84)
    Button.SetPicture(GemRB.GetPlayerPortrait(pc, 0)["Sprite"])

    # encumbrance
    GUICommon.SetEncumbranceLabels(Window, 0x10000042, None, pc)

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

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

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

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

    Button = Window.GetControl(62)
    Color = GemRB.GetPlayerStat(pc, IE_MAJOR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(63)
    Color = GemRB.GetPlayerStat(pc, IE_MINOR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(82)
    Color = GemRB.GetPlayerStat(pc, IE_HAIR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(83)
    Color = GemRB.GetPlayerStat(pc, IE_SKIN_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    # update ground inventory slots
    TopIndex = GemRB.GetVar("TopIndex")
    for i in range(6):
        if i < 5:
            Button = Window.GetControl(i + 68)
        else:
            Button = Window.GetControl(i + 76)

        if GemRB.IsDraggingItem() == 1:
            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:
            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)
        else:
            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)

        InventoryCommon.UpdateInventorySlot(pc, Button, Slot, "ground")

    #if actor is uncontrollable, make this grayed
    GUICommon.AdjustWindowVisibility(Window, pc, False)
    return
Example #4
0
def RefreshInventoryWindow():
    Window = InventoryWindow

    pc = GemRB.GameGetSelectedPCSingle()

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

    # paperdoll
    Button = Window.GetControl(50)
    Color1 = GemRB.GetPlayerStat(pc, IE_METAL_COLOR)
    Color2 = GemRB.GetPlayerStat(pc, IE_MINOR_COLOR)
    Color3 = GemRB.GetPlayerStat(pc, IE_MAJOR_COLOR)
    Color4 = GemRB.GetPlayerStat(pc, IE_SKIN_COLOR)
    Color5 = GemRB.GetPlayerStat(pc, IE_LEATHER_COLOR)
    Color6 = GemRB.GetPlayerStat(pc, IE_ARMOR_COLOR)
    Color7 = GemRB.GetPlayerStat(pc, IE_HAIR_COLOR)

    Button.SetFlags(IE_GUI_BUTTON_CENTER_PICTURES, OP_OR)
    Button.SetAnimation(GUICommonWindows.GetActorPaperDoll(pc) + "G11")
    Button.SetAnimationPalette(Color1, Color2, Color3, Color4, Color5, Color6,
                               Color7, 0)

    # portrait
    Button = Window.GetControl(84)
    Button.SetPicture(GemRB.GetPlayerPortrait(pc, 0))

    # encumbrance
    GUICommon.SetEncumbranceLabels(Window, 0x10000042, None, pc)

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

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

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

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

    Button = Window.GetControl(62)
    Color = GemRB.GetPlayerStat(pc, IE_MAJOR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(63)
    Color = GemRB.GetPlayerStat(pc, IE_MINOR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(82)
    Color = GemRB.GetPlayerStat(pc, IE_HAIR_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    Button = Window.GetControl(83)
    Color = GemRB.GetPlayerStat(pc, IE_SKIN_COLOR, 1) & 0xFF
    Button.SetBAM("COLGRAD", 0, 0, Color)

    # update ground inventory slots
    Container = GemRB.GetContainer(pc, 1)
    TopIndex = GemRB.GetVar("TopIndex")
    for i in range(6):
        if i < 5:
            Button = Window.GetControl(i + 68)
        else:
            Button = Window.GetControl(i + 76)

        if GemRB.IsDraggingItem() == 1:
            Button.SetState(IE_GUI_BUTTON_SECOND)
        else:
            Button.SetState(IE_GUI_BUTTON_ENABLED)
        Button.SetEvent(IE_GUI_BUTTON_ON_DRAG_DROP,
                        InventoryCommon.OnDragItemGround)

        Slot = GemRB.GetContainerItem(pc, i + TopIndex)
        if Slot == None:
            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)
        else:
            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,
                            None)  #TODO: implement OpenGroundItemAmountWindow

        GUICommon.UpdateInventorySlot(pc, Button, Slot, "ground")

    #if actor is uncontrollable, make this grayed
    held = GemRB.GetPlayerStat(pc, IE_HELD) + GemRB.GetPlayerStat(
        pc, IE_CASTERHOLD)
    if held or GemRB.GetPlayerStat(pc, IE_STATE_ID) & STATE_DEAD:
        Window.SetVisible(WINDOW_GRAYED)
    else:
        Window.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    return