Mercurial > parpg-source
comparison charactercreationcontroller.py @ 154:4dc7951c3bfc
Moved code from CharacterCreationController to GameModel
author | KarstenBock@gmx.net |
---|---|
date | Sat, 05 Nov 2011 14:53:12 +0100 |
parents | 741d7d193bad |
children | f017f8cac2c2 |
comparison
equal
deleted
inserted
replaced
153:741d7d193bad | 154:4dc7951c3bfc |
---|---|
15 """Provides the controller that defines the behaviour of the character creation | 15 """Provides the controller that defines the behaviour of the character creation |
16 screen.""" | 16 screen.""" |
17 | 17 |
18 from parpg import vfs | 18 from parpg import vfs |
19 import characterstatistics as char_stats | 19 import characterstatistics as char_stats |
20 from serializers import XmlSerializer | |
21 from controllerbase import ControllerBase | 20 from controllerbase import ControllerBase |
22 from gamescenecontroller import GameSceneController | 21 from gamescenecontroller import GameSceneController |
23 from gamesceneview import GameSceneView | 22 from gamesceneview import GameSceneView |
24 from parpg.world import World | 23 from parpg.world import World |
25 from parpg.entities import General | 24 from parpg.entities import General |
85 self.settings = self.model.settings | 84 self.settings = self.model.settings |
86 self.view.start_new_game_callback = self.startNewGame | 85 self.view.start_new_game_callback = self.startNewGame |
87 self.view.cancel_new_game_callback = self.cancelNewGame | 86 self.view.cancel_new_game_callback = self.cancelNewGame |
88 | 87 |
89 def reset_character(self): | 88 def reset_character(self): |
90 # FIXME M. George Hansen 2011-06-06: character stats scripts aren't | |
91 # finished, unfortunately. | |
92 #primary_stats_file = \ | |
93 # vfs.VFS.open('character_scripts/primary_stats.xml') | |
94 #primary_stats = XmlSerializer.deserialize(primary_stats_file) | |
95 #secondary_stats_file = \ | |
96 # vfs.VFS.open('character_scripts/secondary_stats.xml') | |
97 #secondary_stats = XmlSerializer.deserialize(secondary_stats_file) | |
98 primary_stats = [] | |
99 secondary_stats = [] | |
100 inventory = [] | 89 inventory = [] |
101 for x in xrange(self.INV_SLOTS): | 90 for x in xrange(self.INV_SLOTS): |
102 inventory.append(None) | 91 inventory.append(None) |
103 self.char_data = General(self, "PlayerCharacter") | 92 self.char_data = General(self, "PlayerCharacter") |
104 self.char_data.description.view_name = "Player" | 93 self.char_data.description.view_name = "Player" |
107 self.char_data.characterstats.origin = self.ORIGINS.keys()[0] | 96 self.char_data.characterstats.origin = self.ORIGINS.keys()[0] |
108 self.char_data.characterstats.age = 20 | 97 self.char_data.characterstats.age = 20 |
109 self.char_data.characterstats.picture = ( | 98 self.char_data.characterstats.picture = ( |
110 self.PICTURES[self.GENDERS[0]][0] | 99 self.PICTURES[self.GENDERS[0]][0] |
111 ) | 100 ) |
112 for primary_stat in primary_stats: | 101 for primary_stat in self.model.primary_stats: |
113 long_name = primary_stat.long_name | 102 long_name = primary_stat.long_name |
114 self.char_data.characterstats.primary_stats[long_name] = ( | 103 self.char_data.characterstats.primary_stats[long_name] = ( |
115 char_stats.PrimaryStatisticValue( | 104 char_stats.PrimaryStatisticValue( |
116 primary_stat, self.char_data.characterstats, | 105 primary_stat, self.char_data.characterstats, |
117 DEFAULT_STAT_VALUE) | 106 DEFAULT_STAT_VALUE) |
118 ) | 107 ) |
119 for secondary_stat in secondary_stats: | 108 for secondary_stat in self.model.secondary_stats: |
120 name = secondary_stat.name | 109 name = secondary_stat.name |
121 self.char_data.characterstats.secondary_stats[name] = ( | 110 self.char_data.characterstats.secondary_stats[name] = ( |
122 char_stats.SecondaryStatisticValue(secondary_stat, | 111 char_stats.SecondaryStatisticValue(secondary_stat, |
123 self.char_data. | 112 self.char_data. |
124 characterstats) | 113 characterstats) |