Пример #1
0
def NextPress():
	# find the class from the class table
	ClassName = GUICommon.GetClassRowName (GemRB.GetVar ("Class")-1, "index")
	Class = CommonTables.Classes.GetValue (ClassName, "ID")
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_CLASS, Class)
	CharGenCommon.next()
Пример #2
0
def NextPress():
    MyChar = GemRB.GetVar("Slot")
    #GemRB.CreatePlayer ("charbase", MyChar | 0x8000 )
    Gender = GemRB.GetVar("Gender")
    GemRB.SetPlayerStat(MyChar, IE_SEX, Gender)
    CharGenCommon.next()
    return
Пример #3
0
def SpellsCancelPress():
    """Removes all known spells and close the window.

	This is only callable within character generation."""

    # remove all learned spells
    Spellbook.RemoveKnownSpells(pc, SpellBookType, 1, 9, 1)

    if GameCheck.IsBG2():
        # unload teh window and go back
        if SpellsWindow:
            SpellsWindow.Close()
        GemRB.SetNextScript("CharGen6")  #haterace
    elif GameCheck.IsBG1():
        if SpellsWindow:
            SpellsWindow.Close()
        import CharGenCommon
        CharGenCommon.back()
    elif IWD2:
        if SpellsWindow:
            SpellsWindow.Close()
        GemRB.SetNextScript("Feats")
    else:
        print("Uh-oh in SpellsCancelPress in", GemRB.GameType)
    return
Пример #4
0
def NextPress():
	global CharSoundWindow
	CharSound = VoiceList.QueryText ()
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerSound(MyChar,CharSound)
	CharGenCommon.next()
	return
Пример #5
0
def NextPress():
    AppearanceWindow.Close()
    PortraitTable = GemRB.LoadTable("pictures")
    PortraitName = PortraitTable.GetRowName(LastPortrait)
    GemRB.SetToken("SmallPortrait", PortraitName + "S")
    GemRB.SetToken("LargePortrait", PortraitName + "L")
    CharGenCommon.next()
Пример #6
0
def NextPress():
    MyChar = GemRB.GetVar("Slot")
    # GemRB.CreatePlayer ("charbase", MyChar | 0x8000 )
    Gender = GemRB.GetVar("Gender")
    GemRB.SetPlayerStat(MyChar, IE_SEX, Gender)
    CharGenCommon.next()
    return
Пример #7
0
def NextPress():
    #class
    ClassIndex = GemRB.GetVar("Class") - 1
    Class = CommonTables.Classes.GetValue(ClassIndex, 5)
    MyChar = GemRB.GetVar("Slot")
    GemRB.SetPlayerStat(MyChar, IE_CLASS, Class)
    CharGenCommon.next()
Пример #8
0
def NextPress():
	#class	
	ClassName = GUICommon.GetClassRowName (GemRB.GetVar ("Class")-1, "index")
	Class = CommonTables.Classes.GetValue (ClassName, "ID")
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_CLASS, Class)
	CharGenCommon.next()
Пример #9
0
def SpecialistPress():
	ClassWindow.Close ()
	GemRB.SetVar("Specialist",1)

	GemRB.SetVar("Class Kit", 0)
	GemRB.SetVar("Class", 6)
	CharGenCommon.next()
Пример #10
0
def NextPress():
	#class	
	ClassIndex = GemRB.GetVar ("Class")-1
	Class = CommonTables.Classes.GetValue (ClassIndex, 5)
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_CLASS, Class)
	CharGenCommon.next()
Пример #11
0
def NextPress():
    global CharSoundWindow
    CharSound = VoiceList.QueryText()
    MyChar = GemRB.GetVar("Slot")
    GemRB.SetPlayerSound(MyChar, CharSound)
    CharGenCommon.next()
    return
Пример #12
0
def setAccept():	
	#set my character up
	MyChar = GemRB.GetVar ("Slot")

	ClassName = GUICommon.GetClassRowName (MyChar)
	
	#reputation
	AllignID = GemRB.GetPlayerStat (MyChar, IE_ALIGNMENT)
	
	TmpTable=GemRB.LoadTable ("repstart")
	t = TmpTable.GetValue (AllignID,0) * 10
	GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t)

	#lore, thac0, hp, and saves
	GemRB.SetPlayerStat (MyChar, IE_MAXHITPOINTS, 0)
	GemRB.SetPlayerStat (MyChar, IE_HITPOINTS, 0)
	LUCommon.SetupSavingThrows (MyChar)
	LUCommon.SetupThaco (MyChar)
	LUCommon.SetupLore (MyChar)
	LUCommon.SetupHP (MyChar)

	#slot 1 is the protagonist
	if MyChar == 1:
		GemRB.GameSetReputation( t )

	#gold
	TmpTable=GemRB.LoadTable ("strtgold")
	t = GemRB.Roll (TmpTable.GetValue (ClassName,"ROLLS"),TmpTable.GetValue(ClassName,"SIDES"), TmpTable.GetValue (ClassName,"MODIFIER") )
	GemRB.SetPlayerStat (MyChar, IE_GOLD, t*TmpTable.GetValue (ClassName,"MULTIPLIER") )

	#set the base number of attacks; effects will add the proficiency bonus
	GemRB.SetPlayerStat (MyChar, IE_NUMBEROFATTACKS, 2)

	#colors
	GUICommon.SetColorStat (MyChar, IE_METAL_COLOR, 0x1B )
	GUICommon.SetColorStat (MyChar, IE_LEATHER_COLOR, 0x16 )
	GUICommon.SetColorStat (MyChar, IE_ARMOR_COLOR, 0x17 )

	#does all the rest
	LargePortrait = GemRB.GetToken ("LargePortrait")
	SmallPortrait = GemRB.GetToken ("SmallPortrait")
	GemRB.FillPlayerInfo (MyChar, LargePortrait, SmallPortrait)
	#10 is a weapon slot (see slottype.2da row 10)
	GemRB.CreateItem (MyChar, "staf01", 10, 1, 0, 0)
	GemRB.SetEquippedQuickSlot (MyChar, 0)
	#LETS PLAY!!
	playmode = GemRB.GetVar ("PlayMode")
	
	GUICommon.CloseOtherWindow(None)
	
	if playmode >=0:
		CharGenCommon.close()
		if GemRB.GetVar("GUIEnhancements"):
			GemRB.SaveCharacter ( GemRB.GetVar ("Slot"), "gembak" )
		GemRB.EnterGame()
	else:
		#show the export window
		GemRB.SetToken("NextScript","CharGen")
		GemRB.SetNextScript ("ExportFile")
Пример #13
0
def CancelPress ():
	ExportWindow.Close ()

	if GameCheck.IsBG1():
		CharGenCommon.jumpTo ("accept")
	else:
		GemRB.SetNextScript (GemRB.GetToken("NextScript"))
	return
Пример #14
0
def NextPress():
	MyChar = GemRB.GetVar ("Slot")
	GUICommon.SetColorStat (MyChar, IE_HAIR_COLOR, HairColor )
	GUICommon.SetColorStat (MyChar, IE_SKIN_COLOR, SkinColor )
	GUICommon.SetColorStat (MyChar, IE_MAJOR_COLOR, MajorColor)
	GUICommon.SetColorStat (MyChar, IE_MINOR_COLOR, MinorColor )
	CharGenCommon.next()
	return
Пример #15
0
def NextPress():
    Name = NameField.QueryText()
    #check length?
    #seems like a good idea to store it here for the time being
    MyChar = GemRB.GetVar("Slot")
    GemRB.SetPlayerName(MyChar, Name, 0)
    CharGenCommon.next()
    return
Пример #16
0
def NextPress():
	MyChar = GemRB.GetVar ("Slot")
	GUICommon.SetColorStat (MyChar, IE_HAIR_COLOR, HairColor )
	GUICommon.SetColorStat (MyChar, IE_SKIN_COLOR, SkinColor )
	GUICommon.SetColorStat (MyChar, IE_MAJOR_COLOR, MajorColor)
	GUICommon.SetColorStat (MyChar, IE_MINOR_COLOR, MinorColor )
	CharGenCommon.next()
	return
Пример #17
0
def NextPress():
	Name = NameField.QueryText()
	#check length?
	#seems like a good idea to store it here for the time being
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerName (MyChar, Name, 0)
	CharGenCommon.next()
	return
Пример #18
0
def CancelPress ():
	if GameCheck.IsBG1():
		CharGenCommon.jumpTo ("accept")
	else:
		if ExportWindow:
			ExportWindow.Unload ()
		GemRB.SetNextScript (GemRB.GetToken("NextScript"))
	return
Пример #19
0
def DonePress():
	FileName = TextAreaControl.QueryText()
	Slot = GemRB.GetVar("Slot")
	GemRB.CreatePlayer(FileName, Slot| 0x8000, 1)
	GemRB.SetToken("SmallPortrait", GemRB.GetPlayerPortrait (Slot, 1) )
	GemRB.SetToken("LargePortrait", GemRB.GetPlayerPortrait (Slot, 0) )
	CharGenCommon.jumpTo("appearance")
	return
Пример #20
0
def DonePress():
    FileName = TextAreaControl.QueryText()
    Slot = GemRB.GetVar("Slot")
    GemRB.CreatePlayer(FileName, Slot | 0x8000, 1)
    GemRB.SetToken("SmallPortrait", GemRB.GetPlayerPortrait(Slot, 1))
    GemRB.SetToken("LargePortrait", GemRB.GetPlayerPortrait(Slot, 0))
    CharGenCommon.jumpTo("appearance")
    return
Пример #21
0
def DonePress():
    FileNameEditBox = ExportWindow.GetControl(7)
    FileName = FileNameEditBox.QueryText()
    Slot = GemRB.GetVar("Slot")
    GemRB.SaveCharacter(Slot, FileName)
    GUICommon.CloseOtherWindow(None)
    CharGenCommon.close()
    GemRB.SetNextScript("Start")
    return
Пример #22
0
def DonePress():
    FileNameEditBox = ExportWindow.GetControl(7)
    FileName = FileNameEditBox.QueryText()
    Slot = GemRB.GetVar("Slot")
    GemRB.SaveCharacter(Slot, FileName)
    GUICommon.CloseOtherWindow(None)
    CharGenCommon.close()
    GemRB.SetNextScript("Start")
    return
Пример #23
0
def NextPress():
	CharSoundWindow.Close()
	CharSound = VoiceList.QueryText ()
	MyChar = GemRB.GetVar ("Slot")
	Gender = GemRB.GetPlayerStat (MyChar, IE_SEX)
	CharSound = GUICommon.OverrideDefaultVoiceSet (Gender, CharSound)
	GemRB.SetPlayerSound(MyChar,CharSound)
	CharGenCommon.next()
	return
Пример #24
0
def NextPress():
	# find the class from the class table
	ClassIndex = GemRB.GetVar ("Class") - 1
	Class = CommonTables.Classes.GetValue (ClassIndex, 5)
	#protect against barbarians
	ClassName = CommonTables.Classes.GetRowName (CommonTables.Classes.FindValue (5, Class) )
	
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_CLASS, Class)
	CharGenCommon.next()
Пример #25
0
def NextPress():
    # find the class from the class table
    ClassIndex = GemRB.GetVar("Class") - 1
    Class = CommonTables.Classes.GetValue(ClassIndex, 5)
    #protect against barbarians
    ClassName = CommonTables.Classes.GetRowName(
        CommonTables.Classes.FindValue(5, Class))

    MyChar = GemRB.GetVar("Slot")
    GemRB.SetPlayerStat(MyChar, IE_CLASS, Class)
    CharGenCommon.next()
Пример #26
0
def NextPress():
	#class	
	ClassIndex = GemRB.GetVar ("Class")-1
	Class = CommonTables.Classes.GetValue (ClassIndex, 5)
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_CLASS, Class)
	KitIndex = GemRB.GetVar ("Class Kit")
	#the same as the unusable field
	Kit = CommonTables.KitList.GetValue(KitIndex, 6)
	GemRB.SetPlayerStat (MyChar, IE_KIT, Kit)
	CharGenCommon.next()
Пример #27
0
def CustomDone():
    global AppearanceWindow

    Window = CustomWindow
    Portrait = PortraitList1.QueryText()
    GemRB.SetToken("LargePortrait", Portrait)
    Portrait = PortraitList2.QueryText()
    GemRB.SetToken("SmallPortrait", Portrait)
    if Window:
        Window.Unload()
    CharGenCommon.next()
    return
Пример #28
0
def CustomDone():
    global AppearanceWindow

    Window = CustomWindow
    Portrait = PortraitList1.QueryText()
    GemRB.SetToken("LargePortrait", Portrait)
    Portrait = PortraitList2.QueryText()
    GemRB.SetToken("SmallPortrait", Portrait)
    if Window:
        Window.Unload()
    CharGenCommon.next()
    return
Пример #29
0
def NextPress():
	#class	
	Class = CommonTables.Classes.GetValue (ClassName, "ID")
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_CLASS, Class)
	KitIndex = GemRB.GetVar ("Class Kit")
	if ClassName == "MAGE":
		GemRB.SetVar("MAGESCHOOL", KitIndex)
	#the same as the unusable field
	Kit = CommonTables.KitList.GetValue(KitIndex, 6)
	GemRB.SetPlayerStat (MyChar, IE_KIT, Kit)
	CharGenCommon.next()
Пример #30
0
def NextPress():
    AbilityWindow.Close()
    AbilityTable = GemRB.LoadTable("ability")
    AbilityCount = AbilityTable.GetRowCount()

    for i in range(AbilityCount):
        StatID = AbilityTable.GetValue(i, 3)
        StatValue = GemRB.GetVar("Ability " + str(i))
        GemRB.SetPlayerStat(MyChar, StatID, StatValue)

    GemRB.SetPlayerStat(MyChar, IE_STREXTRA, GemRB.GetVar("StrExtra"))

    CharGenCommon.next()
Пример #31
0
def DonePress():
    ImportWindow.Close()
    FileName = TextAreaControl.QueryText()
    Slot = GemRB.GetVar("Slot")
    GemRB.CreatePlayer(FileName, Slot | 0x8000, 1)

    GemRB.SetToken("CHARNAME", GemRB.GetPlayerName(Slot))
    GemRB.SetToken("SmallPortrait", GemRB.GetPlayerPortrait(Slot, 1)["ResRef"])
    GemRB.SetToken("LargePortrait", GemRB.GetPlayerPortrait(Slot, 0)["ResRef"])

    GemRB.SetVar("ImportedChar", 1)
    CharGenCommon.jumpTo("appearance")
    return
Пример #32
0
def DonePress ():
	FileNameEditBox = ExportWindow.GetControl (7)
	FileName = FileNameEditBox.QueryText ()
	Slot = GemRB.GetVar ("Slot")
	GemRB.SaveCharacter (Slot, FileName)
	if GameCheck.IsBG1():
		GUICommon.CloseOtherWindow (None)
		CharGenCommon.close()
		GemRB.SetNextScript ("Start")
	else:
		if ExportWindow:
			ExportWindow.Unload ()
		GemRB.SetNextScript (GemRB.GetToken("NextScript"))
	return
Пример #33
0
def DonePress ():
	FileNameEditBox = ExportWindow.GetControl (7)
	FileName = FileNameEditBox.QueryText ()
	Slot = GemRB.GetVar ("Slot")
	GemRB.SaveCharacter (Slot, FileName)

	ExportWindow.Close()

	if GameCheck.IsBG1():
		CharGenCommon.close()
		GemRB.SetNextScript ("Start")
	else:
		GemRB.SetNextScript (GemRB.GetToken("NextScript"))
	return
Пример #34
0
def OnLoad():
    global ColorWindow, DoneButton, PDollButton, ColorTable
    global HairButton, SkinButton, MajorButton, MinorButton
    global HairColor, SkinColor, MinorColor, MajorColor

    ColorWindow = GemRB.LoadWindow(13, "GUICG")

    ColorTable = GemRB.LoadTable("clowncol")
    #set these colors to some default
    PortraitTable = GemRB.LoadTable("pictures")
    PortraitName = GemRB.GetToken("LargePortrait")
    PortraitName = PortraitName[0:len(PortraitName) - 1]
    PortraitIndex = PortraitTable.GetRowIndex(PortraitName)
    if PortraitIndex < 0:
        HairColor = PortraitTable.GetValue(0, 1)
        SkinColor = PortraitTable.GetValue(0, 2)
        MinorColor = PortraitTable.GetValue(0, 3)
        MajorColor = PortraitTable.GetValue(0, 4)
    else:
        HairColor = PortraitTable.GetValue(PortraitIndex, 1)
        SkinColor = PortraitTable.GetValue(PortraitIndex, 2)
        MinorColor = PortraitTable.GetValue(PortraitIndex, 3)
        MajorColor = PortraitTable.GetValue(PortraitIndex, 4)

    PDollButton = ColorWindow.GetControl(1)
    PDollButton.SetState(IE_GUI_BUTTON_LOCKED)
    PDollButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)

    HairButton = ColorWindow.GetControl(2)
    HairButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    HairButton.OnPress(HairPress)
    HairButton.SetBAM("COLGRAD", 0, 0, HairColor)

    SkinButton = ColorWindow.GetControl(3)
    SkinButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    SkinButton.OnPress(SkinPress)
    SkinButton.SetBAM("COLGRAD", 0, 0, SkinColor)

    MajorButton = ColorWindow.GetControl(5)
    MajorButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    MajorButton.OnPress(MajorPress)
    MajorButton.SetBAM("COLGRAD", 0, 0, MinorColor)

    MinorButton = ColorWindow.GetControl(4)
    MinorButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    MinorButton.OnPress(MinorPress)
    MinorButton.SetBAM("COLGRAD", 0, 0, MajorColor)

    BackButton = ColorWindow.GetControl(13)
    BackButton.SetText(15416)
    DoneButton = ColorWindow.GetControl(0)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()

    DoneButton.OnPress(NextPress)
    BackButton.OnPress(lambda: CharGenCommon.back(ColorWindow))
    BGCommon.RefreshPDoll(PDollButton, MinorColor, MajorColor, SkinColor,
                          HairColor)
    ColorWindow.ShowModal(MODAL_SHADOW_NONE)
    return
Пример #35
0
def OnLoad():
    global GenderWindow, TextAreaControl, DoneButton, MyChar

    MyChar = GemRB.GetVar("Slot")

    GenderWindow = GemRB.LoadWindow(1, "GUICG")
    GenderWindow.SetFlags(WF_ALPHA_CHANNEL, OP_OR)
    CharGenCommon.PositionCharGenWin(GenderWindow)

    BackButton = GenderWindow.GetControl(6)
    BackButton.SetText(15416)
    BackButton.MakeEscape()
    DoneButton = GenderWindow.GetControl(0)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()

    TextAreaControl = GenderWindow.GetControl(5)
    TextAreaControl.SetText(17236)

    MaleButton = GenderWindow.GetControl(2)
    MaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR)

    FemaleButton = GenderWindow.GetControl(3)
    FemaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR)

    MaleButton.SetVarAssoc("Gender", 1)
    FemaleButton.SetVarAssoc("Gender", 2)
    MaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedMale)
    FemaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedFemale)
    DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
    BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BackPress)
    DoneButton.SetDisabled(True)
    GenderWindow.Focus()
    return
Пример #36
0
def OnLoad():
    global CharSoundWindow, VoiceList

    CharSoundWindow = GemRB.LoadWindow(19, "GUICG")
    CharGenCommon.PositionCharGenWin(CharSoundWindow)

    VoiceList = CharSoundWindow.GetControl(45)
    Voices = VoiceList.ListResources(CHR_SOUNDS)
    GUICommon.AddDefaultVoiceSet(VoiceList, Voices)
    # preselect the default entry to avoid an infinite loop if Play is pressed immediately
    VoiceList.SetVarAssoc("Selected", 0)

    PlayButton = CharSoundWindow.GetControl(47)
    PlayButton.SetState(IE_GUI_BUTTON_ENABLED)
    PlayButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, PlayPress)
    PlayButton.SetText(17318)

    TextArea = CharSoundWindow.GetControl(50)
    TextArea.SetText(11315)

    BackButton = CharSoundWindow.GetControl(10)
    BackButton.SetText(15416)
    BackButton.MakeEscape()
    DoneButton = CharSoundWindow.GetControl(0)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()

    VoiceList.SetEvent(IE_GUI_TEXTAREA_ON_SELECT, ChangeVoice)
    DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
    BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BackPress)
    CharSoundWindow.Focus()
    return
Пример #37
0
def OnLoad():
    global RaceWindow, TextAreaControl, DoneButton
    global RaceTable

    GemRB.SetVar("Race", 0)

    RaceWindow = GemRB.LoadWindow(8, "GUICG")

    RaceCount = CommonTables.Races.GetRowCount()

    for i in range(2, RaceCount + 2):
        Button = RaceWindow.GetControl(i)
        Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
    for i in range(2, RaceCount + 2):
        Button = RaceWindow.GetControl(i)
        Button.SetText(CommonTables.Races.GetValue(i - 2, 0))
        Button.SetState(IE_GUI_BUTTON_ENABLED)
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, RacePress)
        Button.SetVarAssoc("Race", i - 1)

    BackButton = RaceWindow.GetControl(10)
    BackButton.SetText(15416)
    DoneButton = RaceWindow.GetControl(0)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()
    DoneButton.SetState(IE_GUI_BUTTON_DISABLED)

    TextAreaControl = RaceWindow.GetControl(8)
    TextAreaControl.SetText(17237)

    DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
    BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS,
                        lambda: CharGenCommon.back(RaceWindow))
    RaceWindow.ShowModal(MODAL_SHADOW_NONE)
    return
Пример #38
0
def OnLoad():
	global ImportWindow, TextAreaControl

	ImportWindow = GemRB.LoadWindow(20, "GUICG")
	CharGenCommon.PositionCharGenWin(ImportWindow)

	TextAreaControl = ImportWindow.GetControl(4)
	TextAreaControl.SetText(10963)

	TextAreaControl = ImportWindow.GetControl(2)
	TextAreaControl.ListResources(CHR_EXPORTS)
 
	DoneButton = ImportWindow.GetControl(0)
	DoneButton.SetText(2610)
	DoneButton.SetDisabled(True)
	DoneButton.MakeDefault()

	CancelButton = ImportWindow.GetControl(1)
	CancelButton.SetText(15416)
	CancelButton.MakeEscape()

	DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DonePress)
	CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
	TextAreaControl.SetEvent(IE_GUI_TEXTAREA_ON_SELECT, SelectPress)
	ImportWindow.Focus()
	return
Пример #39
0
def OnLoad():
    global AppearanceWindow, PortraitButton, PortraitsTable, LastPortrait
    global Gender

    AppearanceWindow = GemRB.LoadWindow(11, "GUICG")

    #Load the Gender
    MyChar = GemRB.GetVar("Slot")
    Gender = GemRB.GetPlayerStat(MyChar, IE_SEX)

    #Load the Portraits Table
    PortraitsTable = GemRB.LoadTable("PICTURES")
    PortraitsStart = PortraitsTable.FindValue(0, 2)
    FemaleCount = PortraitsTable.GetRowCount() - PortraitsStart + 1
    if Gender == 2:
        LastPortrait = GemRB.Roll(1, FemaleCount, PortraitsStart - 1)
    else:
        LastPortrait = GemRB.Roll(1,
                                  PortraitsTable.GetRowCount() - FemaleCount,
                                  0)

    PortraitButton = AppearanceWindow.GetControl(1)
    PortraitButton.SetFlags(IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_NO_IMAGE,
                            OP_SET)
    PortraitButton.SetState(IE_GUI_BUTTON_LOCKED)

    LeftButton = AppearanceWindow.GetControl(2)
    RightButton = AppearanceWindow.GetControl(3)

    BackButton = AppearanceWindow.GetControl(5)
    BackButton.SetText(15416)

    CustomButton = AppearanceWindow.GetControl(6)
    CustomButton.SetText(17545)

    DoneButton = AppearanceWindow.GetControl(0)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()

    RightButton.OnPress(RightPress)
    LeftButton.OnPress(LeftPress)
    BackButton.OnPress(lambda: CharGenCommon.back(AppearanceWindow))
    CustomButton.OnPress(CustomPress)
    DoneButton.OnPress(NextPress)

    flag = False
    while True:
        if PortraitsTable.GetValue(LastPortrait, 0) == Gender:
            SetPicture()
            break
        LastPortrait = LastPortrait + 1
        if LastPortrait >= PortraitsTable.GetRowCount():
            LastPortrait = 0
            if flag:
                SetPicture()
                break
            flag = True

    AppearanceWindow.ShowModal(MODAL_SHADOW_NONE)
    return
Пример #40
0
def OnLoad():
	global SkillWindow, DoneButton

	SkillWindow = GemRB.LoadWindow(6, "GUICG")

	MyChar = GemRB.GetVar ("Slot")

	Levels = [GemRB.GetPlayerStat (MyChar, IE_LEVEL), \
			GemRB.GetPlayerStat (MyChar, IE_LEVEL2), \
			GemRB.GetPlayerStat (MyChar, IE_LEVEL3)]
	LUSkillsSelection.SetupSkillsWindow (MyChar, LUSkillsSelection.LUSKILLS_TYPE_CHARGEN, SkillWindow, RedrawSkills, [0,0,0], Levels,0,False)
	
	BackButton = SkillWindow.GetControl(25)
	BackButton.SetText(15416)
	BackButton.OnPress (lambda: CharGenCommon.back(SkillWindow))

	DoneButton = SkillWindow.GetControl(0)
	DoneButton.SetText(11973)
	DoneButton.MakeDefault()
	DoneButton.OnPress (NextPress)
	DoneButton.SetState(IE_GUI_BUTTON_DISABLED)

	RedrawSkills()
	SkillWindow.ShowModal(MODAL_SHADOW_NONE)
	return
Пример #41
0
def OnLoad():
    global SkillWindow, DoneButton

    SkillWindow = GemRB.LoadWindow(9, "GUICG")

    MyChar = GemRB.GetVar("Slot")
    Levels = [GemRB.GetPlayerStat (MyChar, IE_LEVEL), GemRB.GetPlayerStat (MyChar, IE_LEVEL2), \
      GemRB.GetPlayerStat (MyChar, IE_LEVEL3)]
    LUProfsSelection.SetupProfsWindow(MyChar,
                                      LUProfsSelection.LUPROFS_TYPE_CHARGEN,
                                      SkillWindow,
                                      RedrawSkills, [0, 0, 0],
                                      Levels,
                                      scroll=False,
                                      profTableOffset=0)

    BackButton = SkillWindow.GetControl(77)
    BackButton.SetText(15416)
    BackButton.MakeEscape()
    BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS,
                        lambda: CharGenCommon.back(SkillWindow))

    DoneButton = SkillWindow.GetControl(0)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()
    DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
    DoneButton.SetState(IE_GUI_BUTTON_DISABLED)

    SkillWindow.ShowModal(MODAL_SHADOW_NONE)
    return
Пример #42
0
def OnLoad():
	global GenderWindow, TextAreaControl, DoneButton
		
	GenderWindow = GemRB.LoadWindow(1, "GUICG")

	BackButton = GenderWindow.GetControl(6)
	BackButton.SetText(15416)
	DoneButton = GenderWindow.GetControl(0)
	DoneButton.SetText(11973)
	DoneButton.MakeDefault()

	TextAreaControl = GenderWindow.GetControl(5)
	TextAreaControl.SetText(17236)

	MaleButton = GenderWindow.GetControl(2)
	MaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR)

	FemaleButton = GenderWindow.GetControl(3)
	FemaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
	
	GemRB.SetVar("Gender",0)
	MaleButton.SetVarAssoc("Gender",1)
	FemaleButton.SetVarAssoc("Gender",2)
	MaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedMale)
	FemaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedFemale)
	DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
	BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, lambda: CharGenCommon.back(GenderWindow))
	DoneButton.SetState(IE_GUI_BUTTON_DISABLED)
	GenderWindow.ShowModal(MODAL_SHADOW_NONE)
	return
Пример #43
0
def OnLoad():
    global ImportWindow

    ImportWindow = GemRB.LoadWindow(20, "GUICG")
    CharGenCommon.PositionCharGenWin(ImportWindow)

    TextAreaControl = ImportWindow.GetControl(4)
    TextAreaControl.SetText(53774)

    TextAreaControl = ImportWindow.GetControl(2)
    #Fill TextArea Control with character sheets, make textarea a listbox

    DoneButton = ImportWindow.GetControl(0)
    DoneButton.SetText(2610)
    DoneButton.SetDisabled(True)
    DoneButton.MakeDefault()

    CancelButton = ImportWindow.GetControl(1)
    CancelButton.SetText(15416)
    CancelButton.MakeEscape()

    DoneButton.OnPress(Done1Press)
    CancelButton.OnPress(CancelPress)
    ImportWindow.Focus()
    return
Пример #44
0
def OnLoad():
    global BioWindow

    BioWindow = GemRB.LoadWindow(23, "GUICG")
    CharGenCommon.PositionCharGenWin(BioWindow)

    EditTextArea = BioWindow.ReplaceSubview(3, IE_GUI_TEXTAREA, "NORMAL")
    BIO = GemRB.GetToken("BIO")
    EditTextArea.AddAlias("BIO")
    EditTextArea.SetFlags(IE_GUI_TEXTAREA_EDITABLE, OP_OR)
    EditTextArea.SetColor(ColorWhitish, TA_COLOR_NORMAL)

    if BIO:
        EditTextArea.SetText(BIO)
    else:
        EditTextArea.SetText(15882)

    # done
    OkButton = BioWindow.GetControl(1)
    OkButton.SetText(11973)

    ClearButton = BioWindow.GetControl(4)
    ClearButton.SetText(34881)

    # back
    CancelButton = BioWindow.GetControl(2)
    CancelButton.SetText(12896)
    CancelButton.MakeEscape()

    OkButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OkPress)
    ClearButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClearBiography)
    CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
    EditTextArea.Focus()
    return
Пример #45
0
def NextPress():
	GemRB.SetRepeatClickFlags(GEM_RK_DISABLE, OP_OR)
	
	AbilityTable = GemRB.LoadTable ("ability")
	AbilityCount = AbilityTable.GetRowCount ()
	
	# print our diagnostic as we loop (so as not to duplicate)
	for i in range (AbilityCount):
		StatID = AbilityTable.GetValue (i, 3)
		StatName = AbilityTable.GetRowName (i)
		StatValue = GemRB.GetVar ("Ability "+str(i))
		GemRB.SetPlayerStat (MyChar, StatID, StatValue)
		print "\t",StatName,":\t", StatValue

	GemRB.SetPlayerStat (MyChar, IE_STREXTRA, GemRB.GetVar ("StrExtra"))
	print "\tSTREXTRA:\t",GemRB.GetVar ("StrExtra")

        GemRB.SetRepeatClickFlags(GEM_RK_DISABLE, OP_OR)

	CharGenCommon.next()
Пример #46
0
def MultiClassPress():
	GemRB.SetVar("Multi Class",1)
	CharGenCommon.next()
Пример #47
0
def NextPress():
    PortraitTable = GemRB.LoadTable("pictures")
    PortraitName = PortraitTable.GetRowName(LastPortrait)
    GemRB.SetToken("SmallPortrait", PortraitName + "S")
    GemRB.SetToken("LargePortrait", PortraitName + "L")
    CharGenCommon.next()
Пример #48
0
def BackPress():
	GemRB.SetRepeatClickFlags(GEM_RK_DISABLE, OP_OR)
	CharGenCommon.back()
Пример #49
0
def setAccept():	
	#set my character up
	MyChar = GemRB.GetVar ("Slot")

	ClassName = GUICommon.GetClassRowName (MyChar)
	
	#reputation
	AllignID = GemRB.GetPlayerStat (MyChar, IE_ALIGNMENT)
	
	TmpTable=GemRB.LoadTable ("repstart")
	t = TmpTable.GetValue (AllignID,0) * 10
	GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t)

	#lore, thac0, hp, and saves
	GemRB.SetPlayerStat (MyChar, IE_MAXHITPOINTS, 0)
	GemRB.SetPlayerStat (MyChar, IE_HITPOINTS, 0)
	LUCommon.SetupSavingThrows (MyChar)
	LUCommon.SetupThaco (MyChar)
	LUCommon.SetupLore (MyChar)
	LUCommon.SetupHP (MyChar)

	#slot 1 is the protagonist
	if MyChar == 1:
		GemRB.GameSetReputation( t )

	#gold
	TmpTable=GemRB.LoadTable ("strtgold")
	t = GemRB.Roll (TmpTable.GetValue (ClassName,"ROLLS"),TmpTable.GetValue(ClassName,"SIDES"), TmpTable.GetValue (ClassName,"MODIFIER") )
	GemRB.SetPlayerStat (MyChar, IE_GOLD, t*TmpTable.GetValue (ClassName,"MULTIPLIER") )

	#set the base number of attacks; effects will add the proficiency bonus
	GemRB.SetPlayerStat (MyChar, IE_NUMBEROFATTACKS, 2)

	#colors
	GUICommon.SetColorStat (MyChar, IE_METAL_COLOR, 0x1B )
	GUICommon.SetColorStat (MyChar, IE_LEATHER_COLOR, 0x16 )
	GUICommon.SetColorStat (MyChar, IE_ARMOR_COLOR, 0x17 )

	#does all the rest
	LargePortrait = GemRB.GetToken ("LargePortrait")
	SmallPortrait = GemRB.GetToken ("SmallPortrait")
	GemRB.FillPlayerInfo (MyChar, LargePortrait, SmallPortrait)
	#10 is a weapon slot (see slottype.2da row 10)
	GemRB.CreateItem (MyChar, "staf01", 10, 1, 0, 0)
	GemRB.SetEquippedQuickSlot (MyChar, 0)

	# apply class/kit abilities
	IsMulti = GUICommon.IsMultiClassed (MyChar, 1)
	Levels = [GemRB.GetPlayerStat (MyChar, IE_LEVEL), GemRB.GetPlayerStat (MyChar, IE_LEVEL2), \
			GemRB.GetPlayerStat (MyChar, IE_LEVEL3)]
	KitIndex = GUICommon.GetKitIndex (MyChar)
	if IsMulti[0]>1:
		#get the class abilites for each class
		for i in range (IsMulti[0]):
			TmpClassName = GUICommon.GetClassRowName (IsMulti[i+1], "class")
			ABTable = CommonTables.ClassSkills.GetValue (TmpClassName, "ABILITIES")
			if ABTable != "*" and GemRB.HasResource (ABTable, RES_2DA, 1):
				GUICommon.AddClassAbilities (MyChar, ABTable, Levels[i], Levels[i])
	else:
		if KitIndex:
			ABTable = CommonTables.KitList.GetValue (str(KitIndex), "ABILITIES")
		else:
			ABTable = CommonTables.ClassSkills.GetValue (ClassName, "ABILITIES")
		if ABTable != "*" and GemRB.HasResource (ABTable, RES_2DA, 1):
			GUICommon.AddClassAbilities (MyChar, ABTable, Levels[0], Levels[0])

	#LETS PLAY!!
	playmode = GemRB.GetVar ("PlayMode")
	
	GUICommon.CloseOtherWindow(None)
	
	if playmode >=0:
		CharGenCommon.close()
		if GemRB.GetVar("GUIEnhancements"):
			GemRB.SaveCharacter ( GemRB.GetVar ("Slot"), "gembak" )
		GemRB.EnterGame()
	else:
		#show the export window
		GemRB.SetToken("NextScript","CharGen")
		GemRB.SetNextScript ("ExportFile")
Пример #50
0
def NextPress():
	Race = GemRB.GetVar ("Race") - 1
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_RACE, CommonTables.Races.GetValue (Race, 3))
	CharGenCommon.next()
Пример #51
0
def NextPress():
	MyChar = GemRB.GetVar ("Slot")
	LUSkillsSelection.SkillsSave(MyChar)
	GemRB.SetRepeatClickFlags(GEM_RK_DISABLE, OP_OR)
	CharGenCommon.next()
Пример #52
0
def CancelPress():
    CharGenCommon.jumpTo("accept")
    return
Пример #53
0
def NextPress():
	MyChar = GemRB.GetVar ("Slot")
	LUProfsSelection.ProfsSave(MyChar, LUProfsSelection.LUPROFS_TYPE_CHARGEN)
	CharGenCommon.next()
Пример #54
0
def SpecialistPress():
	GemRB.SetVar("Specialist",1)

	GemRB.SetVar("Class Kit", 0)
	GemRB.SetVar("Class", 6)
	CharGenCommon.next()
Пример #55
0
def NextPress():
	MyChar = GemRB.GetVar ("Slot")
	GemRB.SetPlayerStat (MyChar, IE_HATEDRACE, GemRB.GetVar ("HatedRace") )
	CharGenCommon.next()
Пример #56
0
def NextPress():
	MyChar = GemRB.GetVar ("Slot")
	Alignment = GemRB.GetVar ("Alignment")
	GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, Alignment)
	CharGenCommon.next()