From: Jaka K. <lyn...@us...> - 2012-08-22 15:28:36
|
gemrb: Infinity Engine emulator The branch master has been updated via ca9334719e500f727d0d9af9ad2dc99298d5d4d5 (commit) via 2910105747cc4690b48707e32bd7d4d59423e94b (commit) Summary of changes: gemrb/GUIScripts/CommonTables.py | 7 +++++-- gemrb/GUIScripts/DualClass.py | 5 ++--- gemrb/GUIScripts/GUICommon.py | 8 +++++--- gemrb/GUIScripts/GUIREC.py | 7 ++++--- gemrb/GUIScripts/Spellbook.py | 10 ++++------ gemrb/GUIScripts/bg1/CharGenGui.py | 7 ++----- gemrb/GUIScripts/bg1/GUICG3.py | 11 ++++------- gemrb/GUIScripts/bg2/CharGenCommon.py | 5 ++--- gemrb/GUIScripts/bg2/CharGenEnd.py | 3 +-- gemrb/GUIScripts/bg2/GUICG3.py | 16 +++++++--------- gemrb/GUIScripts/iwd/CharGen.py | 18 ++++++++---------- gemrb/GUIScripts/iwd2/Alignment.py | 9 +++------ gemrb/GUIScripts/iwd2/CharGen9.py | 6 ++---- gemrb/GUIScripts/iwd2/GUIREC.py | 5 ++--- 14 files changed, 51 insertions(+), 66 deletions(-) from 0064bfd2e6b239a48f417c1be8c260a3b56976db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=ca9334719e500f727d0d9af9ad2dc99298d5d4d5 commit ca9334719e500f727d0d9af9ad2dc99298d5d4d5 Author: Jaka Kranjc <lyn...@us...> Date: Wed Aug 22 16:41:34 2012 +0200 CommonTables: preload aligns.2da diff --git a/gemrb/GUIScripts/CommonTables.py b/gemrb/GUIScripts/CommonTables.py index 1b6242c..122d5ef 100644 --- a/gemrb/GUIScripts/CommonTables.py +++ b/gemrb/GUIScripts/CommonTables.py @@ -17,17 +17,18 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # the place for preloading the most commonly used tables +# helps with code deduplication, reduced log spam and tiny lookup savings import GemRB from ie_restype import RES_2DA # these two are only used in SetEncumbranceLabels, but that is called very often StrMod = StrModEx = None Classes = KitList = ClassSkills = Races = NextLevel = None -Pdolls = SpellDisplay = None +Pdolls = SpellDisplay = Aligns = None def Load(): global Classes, KitList, ClassSkills, Races, NextLevel - global Pdolls, StrModEx, StrMod, SpellDisplay + global Pdolls, StrModEx, StrMod, SpellDisplay, Aligns print # so the following output isn't appended to an existing line if not Classes: @@ -47,3 +48,5 @@ def Load(): StrModEx = GemRB.LoadTable ("strmodex") if not SpellDisplay: SpellDisplay = GemRB.LoadTable ("spldisp") + if not Aligns and GemRB.HasResource("aligns", RES_2DA): + Aligns = GemRB.CommonTables.Aligns diff --git a/gemrb/GUIScripts/DualClass.py b/gemrb/GUIScripts/DualClass.py index 100dbd6..9746ee3 100644 --- a/gemrb/GUIScripts/DualClass.py +++ b/gemrb/GUIScripts/DualClass.py @@ -383,10 +383,9 @@ def CanDualInto (index): # make sure we aren't restricted by alignment AlignmentTable = GemRB.LoadTable ("alignmnt") - AlignsTable = GemRB.LoadTable ("aligns") Alignment = GemRB.GetPlayerStat (pc, IE_ALIGNMENT) # our alignment - Alignment = AlignsTable.FindValue (3, Alignment) - Alignment = AlignsTable.GetValue (Alignment, 4) # convert the alignment + Alignment = CommonTables.Aligns.FindValue (3, Alignment) + Alignment = CommonTables.Aligns.GetValue (Alignment, 4) # convert the alignment if not AlignmentTable.GetValue (DCClasses[index], Alignment, 1): # check it return 0 diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index e03128c..53b14d2 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -650,10 +650,9 @@ def CanDualClass(actor): return 1 AlignmentTable = GemRB.LoadTable ("alignmnt") - AlignsTable = GemRB.LoadTable ("aligns") Alignment = GemRB.GetPlayerStat (actor, IE_ALIGNMENT) - AlignmentColName = AlignsTable.FindValue (3, Alignment) - AlignmentColName = AlignsTable.GetValue (AlignmentColName, 4) + AlignmentColName = CommonTables.Aligns.FindValue (3, Alignment) + AlignmentColName = CommonTables.Aligns.GetValue (AlignmentColName, 4) if AlignmentColName == "*": print "CannotDualClass: extraordinary character alignment" return 1 diff --git a/gemrb/GUIScripts/GUIREC.py b/gemrb/GUIScripts/GUIREC.py index 873f7a2..eded45a 100644 --- a/gemrb/GUIScripts/GUIREC.py +++ b/gemrb/GUIScripts/GUIREC.py @@ -263,12 +263,13 @@ def UpdateRecordsWindow (): Label = Window.GetControl (0x1000000f) Label.SetText (text) - Table = GemRB.LoadTable ("aligns") - - text = Table.GetValue (Table.FindValue ( 3, GemRB.GetPlayerStat (pc, IE_ALIGNMENT) ), 0) + # alignment + text = CommonTables.Aligns.FindValue (3, GemRB.GetPlayerStat (pc, IE_ALIGNMENT)) + text = CommonTables.Aligns.GetValue (text, 0) Label = Window.GetControl (0x10000010) Label.SetText (text) + # gender Label = Window.GetControl (0x10000011) if GemRB.GetPlayerStat (pc, IE_SEX) == 1: Label.SetText (7198) diff --git a/gemrb/GUIScripts/Spellbook.py b/gemrb/GUIScripts/Spellbook.py index fa755b0..f57d36b 100644 --- a/gemrb/GUIScripts/Spellbook.py +++ b/gemrb/GUIScripts/Spellbook.py @@ -298,9 +298,8 @@ def SetupSpellIcons(Window, BookType, Start=0, Offset=0): def GetMageSpells (Kit, Alignment, Level): MageSpells = [] SpellType = 99 - Table = GemRB.LoadTable ("aligns") - v = Table.FindValue (3, Alignment) - Usability = Kit | Table.GetValue(v, 5) + v = CommonTables.Aligns.FindValue (3, Alignment) + Usability = Kit | CommonTables.Aligns.GetValue(v, 5) SpellsTable = GemRB.LoadTable ("spells") for i in range(SpellsTable.GetValue ("MAGE", str(Level), 1) ): @@ -336,10 +335,9 @@ def GetLearnableMageSpells (Kit, Alignment, Level): def GetLearnablePriestSpells (Class, Alignment, Level): Learnable =[] - Table=GemRB.LoadTable("aligns") - v = Table.FindValue(3, Alignment) + v = CommonTables.Aligns.FindValue(3, Alignment) #usability is the bitset we look for - Usability=Table.GetValue(v, 5) + Usability = CommonTables.Aligns.GetValue(v, 5) SpellsTable = GemRB.LoadTable ("spells") for i in range(SpellsTable.GetValue ("PRIEST", str (Level), 1) ): diff --git a/gemrb/GUIScripts/bg1/CharGenGui.py b/gemrb/GUIScripts/bg1/CharGenGui.py index 8db9afe..32fe7b7 100644 --- a/gemrb/GUIScripts/bg1/CharGenGui.py +++ b/gemrb/GUIScripts/bg1/CharGenGui.py @@ -84,15 +84,13 @@ def unsetAlignment(): GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT,0) def getAlignment(area): - AlignmentTable = GemRB.LoadTable("aligns") - MyChar = GemRB.GetVar ("Slot") AllignID = GemRB.GetPlayerStat (MyChar, IE_ALIGNMENT) area.Append(1049, -1) area.Append(": ") - AllignIndex = AlignmentTable.FindValue(3,AllignID) - AllignCap = AlignmentTable.GetValue(AllignIndex,2) + AllignIndex = CommonTables.Aligns.FindValue (3, AllignID) + AllignCap = CommonTables.Aligns.GetValue (AllignIndex, 2) area.Append(AllignCap) area.Append("\n") @@ -342,7 +340,6 @@ def setAccept(): AllignID = GemRB.GetPlayerStat (MyChar, IE_ALIGNMENT) TmpTable=GemRB.LoadTable ("repstart") - AlignmentTable = GemRB.LoadTable ("aligns") t = TmpTable.GetValue (AllignID,0) * 10 GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t) diff --git a/gemrb/GUIScripts/bg1/GUICG3.py b/gemrb/GUIScripts/bg1/GUICG3.py index d15afd0..a2bedb0 100644 --- a/gemrb/GUIScripts/bg1/GUICG3.py +++ b/gemrb/GUIScripts/bg1/GUICG3.py @@ -28,11 +28,9 @@ import CommonTables AlignmentWindow = 0 TextAreaControl = 0 DoneButton = 0 -AlignmentTable = 0 def OnLoad(): global AlignmentWindow, TextAreaControl, DoneButton - global AlignmentTable if GUICommon.CloseOtherWindow (OnLoad): if(AlignmentWindow): @@ -51,14 +49,13 @@ def OnLoad(): AlignmentOk = GemRB.LoadTable("ALIGNMNT") GemRB.LoadWindowPack("GUICG", 640, 480) - AlignmentTable = GemRB.LoadTable("aligns") AlignmentWindow = GemRB.LoadWindow(3) for i in range(9): Button = AlignmentWindow.GetControl(i+2) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR) Button.SetState(IE_GUI_BUTTON_DISABLED) - Button.SetText(AlignmentTable.GetValue(i,0) ) + Button.SetText (CommonTables.Aligns.GetValue (i,0)) # This section enables or disables different alignment selections # based on Class, and depends on the ALIGNMNT.2DA table @@ -66,7 +63,7 @@ def OnLoad(): # For now, we just enable all buttons for i in range(9): Button = AlignmentWindow.GetControl(i+2) - if AlignmentOk.GetValue(KitName, AlignmentTable.GetValue(i, 4) ) != 0: + if AlignmentOk.GetValue (KitName, CommonTables.Aligns.GetValue (i, 4)) != 0: Button.SetState(IE_GUI_BUTTON_ENABLED) else: Button.SetState(IE_GUI_BUTTON_DISABLED) @@ -91,9 +88,9 @@ def OnLoad(): def AlignmentPress(): Alignment = GemRB.GetVar("Alignment") - TextAreaControl.SetText(AlignmentTable.GetValue(Alignment,1) ) + TextAreaControl.SetText (CommonTables.Aligns.GetValue (Alignment,1)) DoneButton.SetState(IE_GUI_BUTTON_ENABLED) - GemRB.SetVar("Alignment",AlignmentTable.GetValue(Alignment,3) ) + GemRB.SetVar ("Alignment", CommonTables.Aligns.GetValue (Alignment,3)) return def NextPress(): diff --git a/gemrb/GUIScripts/bg2/CharGenCommon.py b/gemrb/GUIScripts/bg2/CharGenCommon.py index dbf1d3b..95d347a 100644 --- a/gemrb/GUIScripts/bg2/CharGenCommon.py +++ b/gemrb/GUIScripts/bg2/CharGenCommon.py @@ -124,7 +124,6 @@ def DisplayOverview(step): ### # Stat overview ### - AlignmentTable = GemRB.LoadTable ("aligns") AbilityTable = GemRB.LoadTable ("ability") MyChar = GemRB.GetVar ("Slot") @@ -163,8 +162,8 @@ def DisplayOverview(step): TextAreaControl.Append (1049, -1) TextAreaControl.Append (": ") stat = GemRB.GetPlayerStat (MyChar, IE_ALIGNMENT) - v = AlignmentTable.FindValue (3, stat) - TextAreaControl.Append (AlignmentTable.GetValue (v,2)) + v = CommonTables.Aligns.FindValue (3, stat) + TextAreaControl.Append (CommonTables.Aligns.GetValue (v,2)) elif part == 6: TextAreaControl.Append ("\n") ClassID = GemRB.GetPlayerStat (MyChar, IE_CLASS) diff --git a/gemrb/GUIScripts/bg2/CharGenEnd.py b/gemrb/GUIScripts/bg2/CharGenEnd.py index d975061..5789a11 100644 --- a/gemrb/GUIScripts/bg2/CharGenEnd.py +++ b/gemrb/GUIScripts/bg2/CharGenEnd.py @@ -83,8 +83,7 @@ def OnLoad(): # apply starting (alignment dictated) abilities # pc, table, new level, level diff, alignment - AlignmentTable = GemRB.LoadTable ("aligns") - AlignmentAbbrev = AlignmentTable.FindValue (3, GemRB.GetPlayerStat (MyChar, IE_ALIGNMENT)) + AlignmentAbbrev = CommonTables.Aligns.FindValue (3, GemRB.GetPlayerStat (MyChar, IE_ALIGNMENT)) GUICommon.AddClassAbilities (MyChar, "abstart", 6,6, AlignmentAbbrev) # setup starting gold (uses a roll dictated by class diff --git a/gemrb/GUIScripts/bg2/GUICG3.py b/gemrb/GUIScripts/bg2/GUICG3.py index bc1886e..8d04e51 100644 --- a/gemrb/GUIScripts/bg2/GUICG3.py +++ b/gemrb/GUIScripts/bg2/GUICG3.py @@ -26,12 +26,11 @@ from GUIDefines import * AlignmentWindow = 0 TextAreaControl = 0 DoneButton = 0 -AlignmentTable = 0 MyChar = 0 def OnLoad(): global AlignmentWindow, TextAreaControl, DoneButton - global AlignmentTable, MyChar + global MyChar MyChar = GemRB.GetVar ("Slot") Kit = GUICommon.GetKitIndex (MyChar) @@ -46,18 +45,18 @@ def OnLoad(): AlignmentOk = GemRB.LoadTable("ALIGNMNT") GemRB.LoadWindowPack("GUICG", 640, 480) - AlignmentTable = GemRB.LoadTable("aligns") + CommonTables.Aligns = CommonTables.Aligns AlignmentWindow = GemRB.LoadWindow(3) for i in range(9): Button = AlignmentWindow.GetControl(i+2) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR) Button.SetState(IE_GUI_BUTTON_DISABLED) - Button.SetText(AlignmentTable.GetValue(i,0) ) + Button.SetText (CommonTables.Aligns.GetValue (i,0)) for i in range(9): Button = AlignmentWindow.GetControl(i+2) - if AlignmentOk.GetValue(KitName, AlignmentTable.GetValue(i, 4) ) != 0: + if AlignmentOk.GetValue(KitName, CommonTables.Aligns.GetValue (i, 4)) != 0: Button.SetState(IE_GUI_BUTTON_ENABLED) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, AlignmentPress) Button.SetVarAssoc("Alignment", i) @@ -80,9 +79,9 @@ def OnLoad(): def AlignmentPress(): Alignment = GemRB.GetVar("Alignment") - TextAreaControl.SetText(AlignmentTable.GetValue(Alignment,1) ) + TextAreaControl.SetText (CommonTables.Aligns.GetValue (Alignment, 1)) DoneButton.SetState(IE_GUI_BUTTON_ENABLED) - GemRB.SetVar("Alignment",AlignmentTable.GetValue(Alignment,3) ) + GemRB.SetVar ("Alignment", CommonTables.Aligns.GetValue (Alignment, 3)) return def BackPress(): @@ -100,12 +99,11 @@ def NextPress(): # reputation # alignment abilities Alignment = GemRB.GetVar ("Alignment") - AlignmentTable = GemRB.LoadTable ("aligns") GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, Alignment) # use the alignment to apply starting reputation RepTable = GemRB.LoadTable ("repstart") - AlignmentAbbrev = AlignmentTable.FindValue (3, Alignment) + AlignmentAbbrev = CommonTables.Aligns.FindValue (3, Alignment) Rep = RepTable.GetValue (AlignmentAbbrev, 0) * 10 GemRB.SetPlayerStat (MyChar, IE_REPUTATION, Rep) diff --git a/gemrb/GUIScripts/iwd/CharGen.py b/gemrb/GUIScripts/iwd/CharGen.py index 330e57b..f9dc88f 100644 --- a/gemrb/GUIScripts/iwd/CharGen.py +++ b/gemrb/GUIScripts/iwd/CharGen.py @@ -67,7 +67,6 @@ KitDoneButton = 0 AlignmentButton = 0 AlignmentWindow = 0 -AlignmentTable = 0 AlignmentTextArea = 0 AlignmentDoneButton = 0 @@ -156,13 +155,12 @@ def OnLoad(): global CharGenWindow, CharGenState, TextArea, PortraitButton, AcceptButton global GenderButton, RaceButton, ClassButton, AlignmentButton global AbilitiesButton, SkillsButton, AppearanceButton, BiographyButton, NameButton - global KitTable, ProficienciesTable, AlignmentTable, RacialEnemyTable + global KitTable, ProficienciesTable, RacialEnemyTable global AbilitiesTable, SkillsTable, PortraitsTable global MyChar, ImportedChar KitTable = GemRB.LoadTable ("magesch") ProficienciesTable = GemRB.LoadTable ("weapprof") - AlignmentTable = GemRB.LoadTable ("aligns") RacialEnemyTable = GemRB.LoadTable ("haterace") AbilitiesTable = GemRB.LoadTable ("ability") SkillsTable = GemRB.LoadTable ("skills") @@ -371,7 +369,7 @@ def AcceptPress(): LUSkillsSelection.SkillsSave (MyChar) TmpTable = GemRB.LoadTable ("repstart") - t = AlignmentTable.FindValue (3, t) + t = CommonTables.Aligns.FindValue (3, t) t = TmpTable.GetValue (t, 0) * 10 GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t) # set the party rep if this in the main char @@ -474,8 +472,8 @@ def SetCharacterDescription(): if CharGenState > 3: TextArea.Append (1049, -1) TextArea.Append (": ") - Alignment = AlignmentTable.FindValue (3, GemRB.GetPlayerStat(MyChar, IE_ALIGNMENT) ) - TextArea.Append (AlignmentTable.GetValue (Alignment, 2) ) + Alignment = CommonTables.Aligns.FindValue (3, GemRB.GetPlayerStat(MyChar, IE_ALIGNMENT)) + TextArea.Append (CommonTables.Aligns.GetValue (Alignment, 2)) if CharGenState > 4: strextra = GemRB.GetPlayerStat (MyChar, IE_STREXTRA) TextArea.Append ("", -1) @@ -1223,7 +1221,7 @@ def AlignmentPress(): else: AlignmentSelectButton.SetState (IE_GUI_BUTTON_ENABLED) AlignmentSelectButton.SetEvent (IE_GUI_BUTTON_ON_PRESS, AlignmentSelectPress) - AlignmentSelectButton.SetText (AlignmentTable.GetValue (i, 0) ) + AlignmentSelectButton.SetText (CommonTables.Aligns.GetValue (i, 0)) AlignmentSelectButton.SetVarAssoc ("Alignment", i + 1) AlignmentTextArea = AlignmentWindow.GetControl (11) @@ -1248,7 +1246,7 @@ def AlignmentSelectPress(): global AlignmentWindow, AlignmentTextArea, AlignmentDoneButton Alignment = GemRB.GetVar ("Alignment") - 1 - AlignmentTextArea.SetText (AlignmentTable.GetValue (Alignment, 1)) + AlignmentTextArea.SetText (CommonTables.Aligns.GetValue (Alignment, 1)) AlignmentDoneButton.SetState (IE_GUI_BUTTON_ENABLED) return @@ -1263,7 +1261,7 @@ def AlignmentDonePress(): AbilitiesButton.SetState (IE_GUI_BUTTON_ENABLED) AbilitiesButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR) - Alignment = AlignmentTable.GetValue (GemRB.GetVar ("Alignment")-1, 3) + Alignment = CommonTables.Aligns.GetValue (GemRB.GetVar ("Alignment")-1, 3) GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, Alignment ) CharGenState = 4 @@ -2202,7 +2200,7 @@ def PriestSpellsMemorize(SpellTable, Level, SpellLevel): CharGenWindow.SetVisible (WINDOW_INVISIBLE) PriestMemorizeWindow = GemRB.LoadWindow (17) - t = AlignmentTable.GetValue ( GemRB.GetVar ("Alignment")-1, 3) + t = CommonTables.Aligns.GetValue (GemRB.GetVar ("Alignment")-1, 3) Learnable = Spellbook.GetLearnablePriestSpells( ClassFlag, t, SpellLevel) MaxSpellsPriestTable = GemRB.LoadTable (SpellTable) diff --git a/gemrb/GUIScripts/iwd2/Alignment.py b/gemrb/GUIScripts/iwd2/Alignment.py index 356b780..e0db0c6 100644 --- a/gemrb/GUIScripts/iwd2/Alignment.py +++ b/gemrb/GUIScripts/iwd2/Alignment.py @@ -24,11 +24,9 @@ import CommonTables AlignmentWindow = 0 TextAreaControl = 0 DoneButton = 0 -AlignmentTable = 0 def OnLoad(): global AlignmentWindow, TextAreaControl, DoneButton - global AlignmentTable Class = GemRB.GetVar("Class")-1 KitName = CommonTables.Classes.GetRowName(Class) @@ -36,17 +34,16 @@ def OnLoad(): AlignmentOk = GemRB.LoadTable("ALIGNMNT") GemRB.LoadWindowPack("GUICG", 800, 600) - AlignmentTable = GemRB.LoadTable("aligns") AlignmentWindow = GemRB.LoadWindow(3) for i in range(9): Button = AlignmentWindow.GetControl(i+2) Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR) Button.SetState(IE_GUI_BUTTON_DISABLED) - Button.SetText(AlignmentTable.GetValue(i,0) ) + Button.SetText (CommonTables.Aligns.GetValue (i, 0)) for i in range(9): Button = AlignmentWindow.GetControl(i+2) - if AlignmentOk.GetValue(KitName, AlignmentTable.GetValue(i, 4) ) != 0: + if AlignmentOk.GetValue (KitName, CommonTables.Aligns.GetValue (i, 4)) != 0: Button.SetState(IE_GUI_BUTTON_ENABLED) Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, AlignmentPress) Button.SetVarAssoc("Alignment", i+1) @@ -70,7 +67,7 @@ def OnLoad(): def AlignmentPress(): Alignment = GemRB.GetVar("Alignment")-1 - TextAreaControl.SetText(AlignmentTable.GetValue(Alignment,1) ) + TextAreaControl.SetText (CommonTables.Aligns.GetValue (Alignment, 1)) DoneButton.SetState(IE_GUI_BUTTON_ENABLED) return diff --git a/gemrb/GUIScripts/iwd2/CharGen9.py b/gemrb/GUIScripts/iwd2/CharGen9.py index 475c5fb..422e8f0 100644 --- a/gemrb/GUIScripts/iwd2/CharGen9.py +++ b/gemrb/GUIScripts/iwd2/CharGen9.py @@ -29,7 +29,6 @@ BioWindow = 0 BioData = 0 BioStrRef = 0 EditControl = 0 -AlignmentTable = 0 PortraitName = "" def OnLoad(): @@ -156,11 +155,10 @@ def NextPress(): GemRB.SetPlayerStat (MyChar, IE_CLASS, Class) #kit GemRB.SetPlayerStat (MyChar, IE_KIT, GemRB.GetVar ("Class") ) - AlignmentTable = GemRB.LoadTable ("aligns") t=GemRB.GetVar ("Alignment") - GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, AlignmentTable.GetValue (t, 3) ) + GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, CommonTables.Aligns.GetValue (t, 3)) TmpTable=GemRB.LoadTable ("repstart") - #t=AlignmentTable.FindValue (3,t) + #t=CommonTables.Aligns.FindValue (3,t) t=TmpTable.GetValue (t,0) GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t) TmpTable=GemRB.LoadTable ("strtgold") diff --git a/gemrb/GUIScripts/iwd2/GUIREC.py b/gemrb/GUIScripts/iwd2/GUIREC.py index 1b004bf..554f110 100644 --- a/gemrb/GUIScripts/iwd2/GUIREC.py +++ b/gemrb/GUIScripts/iwd2/GUIREC.py @@ -238,7 +238,6 @@ def DisplayGeneral (pc): #favoured class RecordsTextArea.Append (40310,-1) - AlignTable = GemRB.LoadTable("aligns") #get the subrace value Value = GemRB.GetPlayerStat(pc,IE_RACE) @@ -296,8 +295,8 @@ def DisplayGeneral (pc): RecordsTextArea.Append ("\n\n[color=ffff00]") RecordsTextArea.Append (1049) RecordsTextArea.Append ("[/color]") - tmp = AlignTable.FindValue ( 3, GemRB.GetPlayerStat (pc, IE_ALIGNMENT) ) - Align = AlignTable.GetValue (tmp, 2) + tmp = CommonTables.Aligns.FindValue (3, GemRB.GetPlayerStat (pc, IE_ALIGNMENT)) + Align = CommonTables.Aligns.GetValue (tmp, 2) RecordsTextArea.Append (Align,-1) #saving throws http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=2910105747cc4690b48707e32bd7d4d59423e94b commit 2910105747cc4690b48707e32bd7d4d59423e94b Author: Jaka Kranjc <lyn...@us...> Date: Wed Aug 22 16:21:09 2012 +0200 CanDualClass: handle bad alignments diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index 2a842f8..e03128c 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -654,6 +654,9 @@ def CanDualClass(actor): Alignment = GemRB.GetPlayerStat (actor, IE_ALIGNMENT) AlignmentColName = AlignsTable.FindValue (3, Alignment) AlignmentColName = AlignsTable.GetValue (AlignmentColName, 4) + if AlignmentColName == "*": + print "CannotDualClass: extraordinary character alignment" + return 1 Sum = 0 for classy in matches: Sum += AlignmentTable.GetValue (classy, AlignmentColName) ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |