Skip to content

Commit

Permalink
A few fixes to the race/culture section.
Browse files Browse the repository at this point in the history
Selecting "Dwarf" no longer crashes the program.
  • Loading branch information
Lunderberg committed Oct 29, 2013
1 parent 2b1b15a commit 14d09d5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
2 changes: 0 additions & 2 deletions backend/Character.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ def __repr__(self):
return '{0}(Value={4}, Name="{1}", Options={2}, Parents={3}, Costs={5},Description="{6}")'.format(
self.Type,self.Name,self.Options,self.requestedParents,self.Value,self.Costs,self.Description)
def ValueBonus(self,asker=None,levelled=False):
print self
print [(par.Name,par.ExtraValue(self)) for par in self.Parents]
return 0 if self.NoBonus else _skillBonuses(self._valueAndExtra + (self.Delta if levelled else 0))
@property
def CommonlyUsed(self):
Expand Down
4 changes: 3 additions & 1 deletion backend/Parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ def makeCharacter(m):
for tag,item in m:
if tag in ['Name','PlayerName','Profession','Level','Experience']:
output.SetMisc(tag,item)
elif tag in ['Stat','Skill','Resistance','Item','Race']:
elif tag in ['Stat','Skill','Resistance','Item']:
output.AddVal(item)
elif tag=='Culture':
output.Culture = item
elif tag=='Race':
output.Race = item
elif tag=='WeaponCosts':
output.WeaponCostList = item
elif tag=='WeaponOrder':
Expand Down
13 changes: 4 additions & 9 deletions build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,12 @@ def make_windows_exe():
dir_util.remove_tree(builddir)

def name_exes(name='unstable'):
outputdir = join('downloads','unstable' if name=='unstable' else 'release')
try:
os.makedirs(outputdir)
except OSError:
pass
os.rename('pyCharGen.zip',join(outputdir,'pyCharGen-win-{0}.zip'.format(name)))
os.rename('pyCharGen.tar.gz',join(outputdir,'pyCharGen-linux-{0}.tar.gz'.format(name)))
os.rename('pyCharGen.zip','pyCharGen-win-{0}.zip'.format(name)))
os.rename('pyCharGen.tar.gz','pyCharGen-linux-{0}.tar.gz'1.format(name)))



if __name__=='__main__':
#make_linux_exe()
make_linux_exe()
make_windows_exe()
#name_exes(sys.argv[1] if len(sys.argv)>=2 else 'unstable')
name_exes(sys.argv[1] if len(sys.argv)>=2 else 'unstable')
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Added pdf output of character sheets.
- Changed format of saved files slightly to accomodate formal parsing.
- Implemented Races, Cultures.


####################
Expand Down
23 changes: 14 additions & 9 deletions gui/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ def __init__(self):

#Profession setup
self.MakeProfessionList()
self.Connect(self.b.get_object('profBox'),'changed',self.FromProfessionChange)
self.Connect(self.b.get_object('profBox'),'changed',self.FromProfessionSelect)

#Culture setup
self.MakeCultureList()
self.Connect(self.b.get_object('cultureBox'),'changed',self.FromCultureChange)
self.Connect(self.b.get_object('cultureBox'),'changed',self.FromCultureSelect)

#Race setup
self.MakeRaceList()
self.Connect(self.b.get_object('raceBox'),'changed',self.FromRaceChange)
self.Connect(self.b.get_object('raceBox'),'changed',self.FromRaceSelect)

#Set up a default character.
self.registered = []
Expand Down Expand Up @@ -216,10 +216,11 @@ def LoadChar(self,char):
('Skill Removed',self.weaponSkillStore.OnValueRemove),
('Resistance Changed',self.OnResistanceChange),
('Item Added',self.itemStore.OnValueAdd),
#('Item Changed',self.OnItemChange),
('Item Changed',self.itemStore.OnValueChange),
('Item Removed',self.itemStore.OnValueRemove),
('Item Removed',self.OnItemRemove),
('Culture Added',self.OnCultureChange),
('Race Added',self.OnRaceChange),
]
for key,func in self.registered:
self.char.Events.Register(key,func)
Expand Down Expand Up @@ -269,7 +270,7 @@ def MakeProfessionList(self):
combobox_boilerplate(profBox)
for key in self._profdict:
profBox.append_text(key)
def FromProfessionChange(self,wid):
def FromProfessionSelect(self,wid):
profname = wid.get_active_text()
self.char.LoadProfession(profname,self._profdict[profname])
self.Update()
Expand All @@ -279,7 +280,7 @@ def MakeCultureList(self):
combobox_boilerplate(cultureBox)
for proto in self._cultureList:
cultureBox.append_text(proto.Name)
def FromCultureChange(self,*args):
def FromCultureSelect(self,*args):
selection = self.b.get_object('cultureBox').get_active()
prototype = self._cultureList[selection]
prototype.char = self.char
Expand All @@ -297,7 +298,7 @@ def MakeRaceList(self):
combobox_boilerplate(raceBox)
for race in self._racelist:
raceBox.append_text(race.Name)
def FromRaceChange(self,*args):
def FromRaceSelect(self,*args):
selection = self.b.get_object('raceBox').get_active()
self.char.Race = self._racelist[selection]
self.Update()
Expand Down Expand Up @@ -335,8 +336,8 @@ def UpdateMisc(self,*args):
self.b.get_object('playerName').set_text(self.char.GetMisc('PlayerName'))
self.b.get_object('characterName').set_text(self.char.GetMisc('Name'))
self.b.get_object('profName').set_text(self.char.GetMisc('Profession'))
#self.b.get_object('raceName').set_text(self.char.GetMisc('Race'))
#self.b.get_object('cultureName').set_text(self.char.GetMisc('Culture'))
self.b.get_object('raceName').set_text(self.char.Race.Name if self.char.Race is not None else '')
self.b.get_object('cultureName').set_text(self.char.Culture.Name if self.char.Culture is not None else '')
self.b.get_object('charLevel').set_text(str(self.char.GetMisc('Level')))
self.b.get_object('experience').set_text(str(self.char.GetMisc('Experience')))
def SetUpStatView(self):
Expand Down Expand Up @@ -613,6 +614,10 @@ def StatSensitivity(self):
for widName in ['statNameBox','statCurrentBox','statPotentialBox','statDescriptionBox']:
wid = self.b.get_object(widName)
wid.set_sensitive(self.activeStat is not None)
def OnRaceChange(self,race):
self.b.get_object('raceName').set_text(race.Name)
def OnCultureChange(self,culture):
self.b.get_object('cultureName').set_text(culture.Name)
def OnStatChange(self,stat):
self.UpdateStatOverview(stat)
if stat is self.activeStat and stat is not None:
Expand Down
2 changes: 1 addition & 1 deletion tables/Cultures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CulturePrototype: Nomads
CulturePrototype: Reaver
{Linguistics+10r, Lore/Region\, Own+3r, Lore/*+1r, Mathematics+1r, Body Development+2r,
Running+1r, Unarmed Combat+1r, Survival/Region\, Own+1r, Perception+1r, Tracking+1r,
Stalk/Hide+1r, (Crafting|Composition|Performance Art)/*+1r, Medical/First Aid+1r,
Stalk\/Hide+1r, (Crafting|Composition|Performance Art)/*+1r, Medical/First Aid+1r,
Vocation/*+1r, Vocation/*+1r}

CulturePrototype: Rural
Expand Down

0 comments on commit 14d09d5

Please sign in to comment.