Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GUICommon: added shared clab setter from bg1

  • Loading branch information...
commit 13a1585e4ed59fcb7cccd0a307c70f119a50b0d2 1 parent 2ac6c40
@lynxlynxlynx lynxlynxlynx authored
Showing with 24 additions and 19 deletions.
  1. +23 −1 gemrb/GUIScripts/GUICommon.py
  2. +1 −18 gemrb/GUIScripts/bg1/CharGenGui.py
View
24 gemrb/GUIScripts/GUICommon.py
@@ -23,7 +23,7 @@
import GameCheck
import GUIClasses
import CommonTables
-from ie_restype import RES_CHU
+from ie_restype import RES_CHU, RES_2DA
from ie_spells import LS_MEMO
from GUIDefines import *
from ie_stats import *
@@ -163,6 +163,28 @@ def Gain(infostr, ability):
GemRB.SetToken ('SPECIALABILITYNAME', GemRB.GetString(int(ability) ) )
GemRB.DisplayString (infostr)
+# chargen version of AddClassAbilities
+def ResolveClassAbilities (pc, ClassName):
+ # apply class/kit abilities
+ IsMulti = IsMultiClassed (pc, 1)
+ Levels = [GemRB.GetPlayerStat (pc, IE_LEVEL), GemRB.GetPlayerStat (pc, IE_LEVEL2), \
+ GemRB.GetPlayerStat (pc, IE_LEVEL3)]
+ KitIndex = GetKitIndex (pc)
+ if IsMulti[0]>1:
+ #get the class abilites for each class
+ for i in range (IsMulti[0]):
+ TmpClassName = GetClassRowName (IsMulti[i+1], "class")
+ ABTable = CommonTables.ClassSkills.GetValue (TmpClassName, "ABILITIES")
+ if ABTable != "*" and GemRB.HasResource (ABTable, RES_2DA, 1):
+ AddClassAbilities (pc, 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):
+ AddClassAbilities (pc, ABTable, Levels[0], Levels[0])
+
# Adds class/kit abilities
def AddClassAbilities (pc, table, Level=1, LevelDiff=1, align=-1):
TmpTable = GemRB.LoadTable (table)
View
19 gemrb/GUIScripts/bg1/CharGenGui.py
@@ -369,24 +369,7 @@ def setAccept():
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])
+ GUICommon.ResolveClassAbilities (MyChar, ClassName)
#LETS PLAY!!
playmode = GemRB.GetVar ("PlayMode")
Please sign in to comment.
Something went wrong with that request. Please try again.