From: Jaka K. <lyn...@us...> - 2013-01-02 16:38:05
|
gemrb: Infinity Engine emulator The branch master has been updated via c97940184920d7e92cbe49424d5432a210ecbc61 (commit) via 2849c8bef9402696d221065397d76049651fd917 (commit) via eba624739d4788ae3a7649c866f96b0546a97783 (commit) Summary of changes: gemrb/GUIScripts/GUICommon.py | 1 + gemrb/GUIScripts/iwd2/GUIREC.py | 101 +++++++++++++++++++++++++++++-------- gemrb/unhardcoded/iwd2/races.2da | 34 ++++++------ 3 files changed, 97 insertions(+), 39 deletions(-) from e0e4937ebbf8d6c2911aa916c66f6ca098fbd71a (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=c97940184920d7e92cbe49424d5432a210ecbc61 commit c97940184920d7e92cbe49424d5432a210ecbc61 Author: Jaka Kranjc <lyn...@us...> Date: Wed Jan 2 17:25:03 2013 +0100 iwd2::guirec: display and use the effective character level diff --git a/gemrb/GUIScripts/iwd2/GUIREC.py b/gemrb/GUIScripts/iwd2/GUIREC.py index c0c1dd7..b8c28a9 100644 --- a/gemrb/GUIScripts/iwd2/GUIREC.py +++ b/gemrb/GUIScripts/iwd2/GUIREC.py @@ -235,6 +235,20 @@ def GetFavoredClass (pc, code): return code-1 +# returns the race or subrace +def GetRace (pc): + Race = GemRB.GetPlayerStat (pc, IE_RACE) + Subrace = GemRB.GetPlayerStat (pc, IE_SUBRACE) + if Subrace: + Race = Race<<16 | Subrace + return CommonTables.Races.FindValue (3, Race) + +# returns the effective character level modifier +def GetECL (pc): + RaceIndex = GetRace (pc) + RaceRowName = CommonTables.Races.GetRowName (RaceIndex) + return CommonTables.Races.GetValue (RaceRowName, "ECL") + #class is ignored def GetNextLevelExp (Level, Adjustment, string=0): if Adjustment>5: @@ -292,8 +306,8 @@ def DisplayGeneral (pc): RecordsTextArea.Append (" - ") RecordsTextArea.Append (40309) levelsum = GemRB.GetPlayerStat (pc, IE_CLASSLEVELSUM) - #TODO: get special level penalty for subrace - adj = 0 + # get special level penalty for subrace + adj = GetECL (pc) RecordsTextArea.Append (": "+str(levelsum) ) RecordsTextArea.Append ("[/color]") #the class name for highest @@ -320,13 +334,9 @@ def DisplayGeneral (pc): RecordsTextArea.Append (40310,-1) #get the subrace value - Value = GemRB.GetPlayerStat(pc,IE_RACE) - Value2 = GemRB.GetPlayerStat(pc,IE_SUBRACE) - if Value2: - Value = Value<<16 | Value2 - tmp = CommonTables.Races.FindValue (3, Value) - Race = CommonTables.Races.GetValue (tmp, 2) - tmp = CommonTables.Races.GetValue (tmp, 8) + RaceIndex = GetRace (pc) + Race = CommonTables.Races.GetValue (RaceIndex, 2) + tmp = CommonTables.Races.GetValue (RaceIndex, 8) if tmp == -1: tmp = highest @@ -941,8 +951,7 @@ def UpdateRecordsWindow (): #level up Button = Window.GetControl (37) levelsum = GemRB.GetPlayerStat (pc, IE_CLASSLEVELSUM) - #TODO: get special level penalty for subrace - if GetNextLevelExp(levelsum, 0) <= GemRB.GetPlayerStat (pc, IE_XP): + if GetNextLevelExp(levelsum, GetECL(pc)) <= GemRB.GetPlayerStat (pc, IE_XP): Button.SetState (IE_GUI_BUTTON_ENABLED) else: Button.SetState (IE_GUI_BUTTON_DISABLED) diff --git a/gemrb/unhardcoded/iwd2/races.2da b/gemrb/unhardcoded/iwd2/races.2da index 48c4784..3d87812 100644 --- a/gemrb/unhardcoded/iwd2/races.2da +++ b/gemrb/unhardcoded/iwd2/races.2da @@ -1,19 +1,19 @@ 2DA V1.0 -1 - NAME_REF DESC_REF CAP_REF ID USABILITY HAIR SKIN SKILL_COLUMN FAVORED_CLASS FEATBONUS -HUMAN 7193 9550 1096 1 0x08000000 HAIRNORM SKINNORM 23 -1 1 -DWARF 7182 9551 1100 4 0x01000000 HAIRNORM SKINNORM 29 0x505 0 -ELF 7194 9552 1097 2 0x00800000 HAIRNORM SKINNORM 26 0xb0b 0 -GNOME 7196 9553 1099 6 0x10000000 HAIRNORM SKINNORM 35 0xb0b 0 -HALF_ELF 7197 9555 1098 3 0x02000000 HAIRNORM SKINNORM 37 -1 0 -HALF_ORC 22 25 23 7 0x80000000 HAIRNORM SKINNORM 38 0x101 0 -HALFLING 7195 9554 5374 5 0x04000000 HAIRNORM SKINNORM 32 0x909 0 -HUMAN_AASIMAR 5377 5386 5377 0x10001 0x00000000 HAIRAASM SKINAASM 24 0x707 0 -HUMAN_TIEFLING 5378 5388 5378 0x10002 0x00000000 HAIRTIEF SKINTIEF 25 0x909 0 -ELF_DROW 5379 5394 5379 0x20001 0x00000000 HAIRDARK SKINDARK 27 0x30b 0 -ELF_WILD 5380 5397 5380 0x20002 0x00000000 HAIRWOOD SKINWOOD 28 0xa0a 0 -DWARF_GOLD 5381 5413 5381 0x40001 0x00000000 HAIRGOLD SKINGOLD 30 0x505 0 -DWARF_GRAY 5382 5416 5382 0x40002 0x00000000 HAIRGRAY SKINGRAY 31 0x505 0 -HALFLING_STRONGHEART 5383 5660 5383 0x50001 0x00000000 HAIRNORM SKINNORM 33 0x909 0 -HALFLING_GHOSTWISE 5384 5661 5384 0x50002 0x00000000 HAIRNORM SKINNORM 34 0x101 0 -GNOME_DEEP 5385 5662 5385 0x60001 0x00000000 HAIRNORM SKINNORM 36 0xb0b 0 + NAME_REF DESC_REF CAP_REF ID USABILITY HAIR SKIN SKILL_COLUMN FAVORED_CLASS FEATBONUS ECL +HUMAN 7193 9550 1096 1 0x08000000 HAIRNORM SKINNORM 23 -1 1 0 +DWARF 7182 9551 1100 4 0x01000000 HAIRNORM SKINNORM 29 0x505 0 0 +ELF 7194 9552 1097 2 0x00800000 HAIRNORM SKINNORM 26 0xb0b 0 0 +GNOME 7196 9553 1099 6 0x10000000 HAIRNORM SKINNORM 35 0xb0b 0 0 +HALF_ELF 7197 9555 1098 3 0x02000000 HAIRNORM SKINNORM 37 -1 0 0 +HALF_ORC 22 25 23 7 0x80000000 HAIRNORM SKINNORM 38 0x101 0 0 +HALFLING 7195 9554 5374 5 0x04000000 HAIRNORM SKINNORM 32 0x909 0 0 +HUMAN_AASIMAR 5377 5386 5377 0x10001 0x00000000 HAIRAASM SKINAASM 24 0x707 0 1 +HUMAN_TIEFLING 5378 5388 5378 0x10002 0x00000000 HAIRTIEF SKINTIEF 25 0x909 0 1 +ELF_DROW 5379 5394 5379 0x20001 0x00000000 HAIRDARK SKINDARK 27 0x30b 0 2 +ELF_WILD 5380 5397 5380 0x20002 0x00000000 HAIRWOOD SKINWOOD 28 0xa0a 0 0 +DWARF_GOLD 5381 5413 5381 0x40001 0x00000000 HAIRGOLD SKINGOLD 30 0x505 0 0 +DWARF_GRAY 5382 5416 5382 0x40002 0x00000000 HAIRGRAY SKINGRAY 31 0x505 0 2 +HALFLING_STRONGHEART 5383 5660 5383 0x50001 0x00000000 HAIRNORM SKINNORM 33 0x909 0 0 +HALFLING_GHOSTWISE 5384 5661 5384 0x50002 0x00000000 HAIRNORM SKINNORM 34 0x101 0 0 +GNOME_DEEP 5385 5662 5385 0x60001 0x00000000 HAIRNORM SKINNORM 36 0xb0b 0 3 http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=2849c8bef9402696d221065397d76049651fd917 commit 2849c8bef9402696d221065397d76049651fd917 Author: Jaka Kranjc <lyn...@us...> Date: Wed Jan 2 17:03:14 2013 +0100 iwd2::guirec: show bonus spells if any diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index e1135a6..9442c83 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -464,6 +464,7 @@ def GetKitIndex (actor): return KitIndex # fetches the rowname of the passed actor's (base) class from classes.2da +# NOTE: only the "index" method is iwd2-ready, since you can have multiple classes and kits def GetClassRowName(value, which=-1): if which == "index": ClassIndex = value diff --git a/gemrb/GUIScripts/iwd2/GUIREC.py b/gemrb/GUIScripts/iwd2/GUIREC.py index c21437d..c0c1dd7 100644 --- a/gemrb/GUIScripts/iwd2/GUIREC.py +++ b/gemrb/GUIScripts/iwd2/GUIREC.py @@ -46,10 +46,17 @@ PortraitWindow = None OptionsWindow = None OldPortraitWindow = None OldOptionsWindow = None +BonusSpellTable = None + +#barbarian, bard, cleric, druid, fighter, monk, paladin, ranger, rogue, sorcerer, wizard +Classes = [IE_LEVELBARBARIAN, IE_LEVELBARD, IE_LEVELCLERIC, IE_LEVELDRUID, \ +IE_LEVEL, IE_LEVELMONK, IE_LEVELPALADIN, IE_LEVELRANGER, IE_LEVEL3, \ +IE_LEVELSORCEROR, IE_LEVEL2] def OpenRecordsWindow (): global RecordsWindow, OptionsWindow, PortraitWindow global OldPortraitWindow, OldOptionsWindow, SelectWindow + global BonusSpellTable if GUICommon.CloseOtherWindow (OpenRecordsWindow): if RecordsWindow: @@ -84,6 +91,9 @@ def OpenRecordsWindow (): GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 0, OpenRecordsWindow) Window.SetFrame () + if not BonusSpellTable: + BonusSpellTable = GemRB.LoadTable ("mxsplbon") + #portrait icon Button = Window.GetControl (2) Button.SetState (IE_GUI_BUTTON_LOCKED) @@ -165,8 +175,45 @@ def ColorDiff2 (Window, Label, diff): Label.SetTextColor (255, 255, 255) return -def HasBonusSpells (pc): - return False +def GetBonusSpells (pc): + bonusSpells = [] + classes = [] + # cheack each class/kit + for i in range(11): + level = GemRB.GetPlayerStat (pc, Classes[i]) + if not level: + continue + + ClassTitle = GUICommonWindows.GetActorClassTitle (pc, i) + # find the casting stat + ClassName = GUICommon.GetClassRowName (i, "index") + Stat = CommonTables.ClassSkills.GetValue (ClassName, "CASTING") + if Stat == "*": + continue + Stat = GemRB.GetPlayerStat (pc, Stat) + if Stat < 12: # boni start with positive modifiers + continue + + # get max spell level we can cast, since only usable boni are displayed + # check the relevant mxspl* table + SpellTable = CommonTables.ClassSkills.GetValue (ClassName, "CLERICSPELL") + if SpellTable == "*": + SpellTable = CommonTables.ClassSkills.GetValue (ClassName, "MAGESPELL") + SpellTable = GemRB.LoadTable (SpellTable) + maxLevel = 0 + for i in range(SpellTable.GetColumnCount()): + spells = SpellTable.GetValue (str(level), str(i+1)) # not all tables start at 1, so use a named lookup + if not spells: + break + maxLevel = i+1 + + classes.append(ClassTitle) + # check if at casting stat size, there is any bonus spell in BonusSpellTable + bonusSpells = [0] * maxLevel + for level in range (1, maxLevel+1): + bonusSpells[level-1] = BonusSpellTable.GetValue (Stat-12, level-1) + + return bonusSpells, classes def HasClassFeatures (pc): #clerics turning @@ -201,11 +248,6 @@ def GetNextLevelExp (Level, Adjustment, string=0): return GemRB.GetString(24342) #godhood return 0 -#barbarian, bard, cleric, druid, fighter, monk, paladin, ranger, rogue, sorcerer, wizard -Classes = [IE_LEVELBARBARIAN, IE_LEVELBARD, IE_LEVELCLERIC, IE_LEVELDRUID, \ -IE_LEVEL, IE_LEVELMONK, IE_LEVELPALADIN, IE_LEVELRANGER, IE_LEVEL3, \ -IE_LEVELSORCEROR, IE_LEVEL2] - def DisplayCommon (pc): Window = RecordsWindow @@ -365,12 +407,18 @@ def DisplayGeneral (pc): #TODO: fix elsewhere, when a new racial enemy is added, the boni to the previous ones are incremented by 1 #bonus spells - if HasBonusSpells(pc): + bonusSpells, classes = GetBonusSpells(pc) + if sum(bonusSpells): RecordsTextArea.Append ("\n\n[color=ffff00]") RecordsTextArea.Append (10344) RecordsTextArea.Append ("[/color]\n") - #TODO: class/kit name - # indent, Level X: +Y + for c in classes: + # class/kit name + RecordsTextArea.Append (c) + for level in range(len(bonusSpells)): + AddIndent() + # Level X: +Y + RecordsTextArea.Append (delimited_txt(7192, " " + str(level+1)+":", "+" + str(bonusSpells[level]), 0)) #ability statistics RecordsTextArea.Append ("\n\n[color=ffff00]") http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=eba624739d4788ae3a7649c866f96b0546a97783 commit eba624739d4788ae3a7649c866f96b0546a97783 Author: Jaka Kranjc <lyn...@us...> Date: Wed Jan 2 17:26:53 2013 +0100 iwd2::guirec: don't display a double separator for current xp diff --git a/gemrb/GUIScripts/iwd2/GUIREC.py b/gemrb/GUIScripts/iwd2/GUIREC.py index 706d9a8..c21437d 100644 --- a/gemrb/GUIScripts/iwd2/GUIREC.py +++ b/gemrb/GUIScripts/iwd2/GUIREC.py @@ -302,7 +302,7 @@ def DisplayGeneral (pc): RecordsTextArea.Append (36928,-1) xp = GemRB.GetPlayerStat (pc, IE_XP) - RecordsTextArea.Append (": "+str(xp) ) + RecordsTextArea.Append (str(xp)) RecordsTextArea.Append (17091,-1) tmp = GetNextLevelExp (levelsum, adj, 1) RecordsTextArea.Append (": "+tmp ) ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |