source: branches/active/character_customization/game/parpg/charactercreationcontroller.py @ 758

Revision 756, 9.2 KB checked in by aspidites, 8 years ago (diff)

Patch by Aspidites:

+ maps load properly once again
+ obsoleted get/set methods in settings.py

  • pc speed is no longer set, so walk speed is unbearably slow
Line 
1#   This file is part of PARPG.
2#
3#   PARPG is free software: you can redistribute it and/or modify
4#   it under the terms of the GNU General Public License as published by
5#   the Free Software Foundation, either version 3 of the License, or
6#   (at your option) any later version.
7#
8#   PARPG is distributed in the hope that it will be useful,
9#   but WITHOUT ANY WARRANTY; without even the implied warranty of
10#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11#   GNU General Public License for more details.
12#
13#   You should have received a copy of the GNU General Public License
14#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
15"""Provides the controller that defines the behavior of the character creation
16   screen."""
17from controllerbase import ControllerBase
18from gamescenecontroller import GameSceneController
19from gamesceneview import GameSceneView
20
21class CharacterCreationController(ControllerBase):
22    """Controller defining the behavior of the character creation screen."""
23    def __init__(self, engine, view, model, application):
24        """Construct a new L{CharacterCreationController} instance.
25           @param engine: Rendering engine used to display the associated view.
26           @type engine: L{fife.Engine}
27           @param view: View used to display the character creation screen.
28           @type view: L{ViewBase}
29           @param model: Model of the game state.
30           @type model: L{GameModel}
31           @param application: Application used to glue the various MVC
32               components together.
33           @type application:
34               L{fife.extensions.basicapplication.ApplicationBase}"""
35        ControllerBase.__init__(self, engine, view, model, application)
36        self.view.start_new_game_callback = self.startNewGame
37        self.view.cancel_new_game_callback = self.cancelNewGame
38        self.view.show()
39   
40    def startNewGame(self):
41        """Create the new character and start a new game.
42           @return: None"""
43        view = GameSceneView(self.engine, self.model)
44        controller = GameSceneController(self.engine, view, self.model,
45                                         self.application)
46        self.application.view = view
47        self.application.switchController(controller)
48        start_map = self.model.settings.parpg.Map
49        self.model.changeMap(start_map)
50   
51    def cancelNewGame(self):
52        """Exit the character creation view and return the to main menu.
53           @return: None"""
54        # KLUDGE Technomage 2010-12-24: This is to prevent a circular import
55        #     but a better fix needs to be thought up.
56        from mainmenucontroller import MainMenuController
57        from mainmenuview import MainMenuView
58        view = MainMenuView(self.engine, self.model)
59        controller = MainMenuController(self.engine, view, self.model,
60                                        self.application)
61        self.application.view = view
62        self.application.switchController(controller)
63   
64    def onStop(self):
65        """Called when the controller is removed from the list.
66           @return: None"""
67        self.view.hide()
68       
69    @property
70    def name(self):
71        """Returns the name of the character.
72        @return: Name of the character"""
73        #TODO: Replace once an actual value is stored
74        return ""
75   
76    @property
77    def age(self):
78        """Returns the age of the character.
79        @return: Age of the character"""
80        #TODO: Replace once an actual value is stored
81        return 0
82   
83    @property
84    def gender(self):
85        """Returns the gender of the character.
86        @return: Gender of the character"""
87        #TODO: Replace once an actual value is stored
88        return ""
89   
90    @property
91    def origin(self):
92        """Returns the origin of the character.
93        @return: Origin of the character"""
94        #TODO: Replace once an actual value is stored
95        return ""
96   
97    @property
98    def picture(self):
99        """Returns the ID of the current picture of the character."""
100        #TODO: Replace once an actual value is stored
101        return "" 
102   
103    def increaseStatistic(self, statistic):
104        """Increases the given statistic by one.
105        @param statistic: Name of the statistic to increase
106        @type statistic: string""" 
107        #TODO: Add Code
108        pass
109   
110    def canIncreaseStatistic(self, statistic):
111        """Checks whether the given statistic can be increased or not.
112        @param statistic: Name of the statistic to check
113        @type statistic: string
114        @return: True if the statistic can be increased, False if not."""
115        #TODO: Add Code
116        return False
117   
118    def decreaseStatistic(self, statistic):
119        """Decreases the given statistic by one.
120        @param statistic: Name of the statistic to decrease
121        @type statistic: string""" 
122        #TODO: Add Code
123        pass
124   
125    def canDecreaseStatistic(self, statistic):
126        """Checks whether the given statistic can be decreased or not.
127        @param statistic: Name of the statistic to check
128        @type statistic: string
129        @return: True if the statistic can be decreased, False if not."""
130        #TODO: Add Code
131        return False
132   
133    def getStatisticValue(self, statistic):
134        """Returns the value of the given statistic.
135        @param statistic: Name of the primary or secondary statistic
136        @type statistic: string
137        @return: Value of the given statistic"""
138        #TODO: Add Code
139        return 0
140   
141    def setName(self, name):
142        """Sets the name of the character to the given value.
143        @param name: New name
144        @type name: string"""
145        #TODO: Add Code
146        pass
147   
148    def isNameValid(self, name):
149        """Checks whether the name is valid.
150        @param name: Name to check
151        @type name: string
152        @return: True if the name is valid, False if not"""
153        #TODO: Add Code
154        return False
155   
156    def changeOrigin(self, origin):
157        """Changes the origin of the character to the given value.
158        @param origin: New origin
159        @type origin: string?"""
160        #TODO: Add Code
161        pass 
162   
163    def isOriginValid(self, origin):
164        """Checks whether the origin is valid.
165        @param origin: Origin to check
166        @type origin: string?
167        @return: True if the origin is valid, False if not"""
168        #TODO: Add Code
169        return False
170   
171    def changeGender(self, gender):
172        """Changes the gender of the character to the given value.
173        @param gender: New gender
174        @param gender: string?"""
175        #TODO: Add Code
176        pass
177   
178    def isGenderValid(self, gender):
179        """Checks whether the gender is valid.
180        @param gender: Gender to check
181        @type gender: string?
182        @return: True if the origin is valid, False if not"""
183        #TODO: Add Code
184        return False
185   
186    def changeAge(self, age):
187        """Sets the age of the character to the given value.
188        @param age: New age
189        @type age: integer
190        """
191        #TODO: Add Code
192        pass
193   
194    def isAgeValid(self, age):
195        """Checks whether the age is valid.
196        @param age: Age to check
197        @type age: integer
198        @return: True if the origin is valid, False if not"""
199        #TODO: Add Code
200        return False
201   
202    def setPicture(self, picture):
203        """Set picture of the character.
204        @param picture: ID of the new picture
205        @type picture: string"""
206        pass
207   
208    def isPictureValid(self, picture):
209        """Checks whether the picture is valid.
210        @param picture: ID of the picture to check
211        @type picture: string
212        @return: True if the picture is valid, False if not"""
213        #TODO: Add Code
214        return False
215   
216    def addTrait(self, trait):
217        """Adds a trait to the character.
218        @param trait: ID of the trait to add
219        @type trait: string"""
220        #TODO: Add Code
221        pass
222   
223    def canAddAnotherTrait(self):
224        """Checks whether another trait can be added.
225        @return: True if another trait can be added, False if not"""
226        #TODO: Add Code
227        return False
228   
229    def removeTrait(self, trait):
230        """Remove trait from character.
231        @param trait: ID of the trait to remove
232        @type trait: string"""
233        #TODO: Add Code
234        pass
235   
236    def hasTrait(self, trait):
237        """Checks whether the character has the trait.
238        @param trait: ID of the trait to check
239        @type trait: string
240        @return: True if the character has the trait, False if not"""
241        #TODO: Add Code
242        return False
243   
244    def isTraitValid(self, trait):
245        """Checks whether the trait is valid.
246        @param trait: ID of the trait to check
247        @type trait: string
248        @return: True if the trait is valid, False if not"""
249        #TODO: Add Code
250        return False
251   
252    def areCurrentTraitsValid(self):
253        """Checks whether the characters traits are valid.
254        @return: True if the traits are valid, False if not"""
255        #TODO: Add Code
256        return False
257   
258    def isCharacterValid(self):
259        """Checks whether the character as a whole is valid."""
260        #TODO: Add code
261        return False
Note: See TracBrowser for help on using the repository browser.