#First steps coding, Add a new default command
Showing
2 changed files
with
28 additions
and
0 deletions
... | @@ -182,3 +182,29 @@ class Command(BaseCommand): | ... | @@ -182,3 +182,29 @@ class Command(BaseCommand): |
182 | # else: | 182 | # else: |
183 | # self.character = None | 183 | # self.character = None |
184 | # | 184 | # |
185 | |||
186 | class CmdAbilities(Command): | ||
187 | |||
188 | """ | ||
189 | List abilities | ||
190 | |||
191 | Usage: | ||
192 | abilities | ||
193 | |||
194 | Displays a list of your current ability values. | ||
195 | """ | ||
196 | |||
197 | key = "abilities" | ||
198 | aliases = ["abi"] | ||
199 | lock = "cmd:all()" | ||
200 | help_category = "General" | ||
201 | |||
202 | def func(self): | ||
203 | "implements the actual functionality" | ||
204 | |||
205 | str, agi, mag = self.caller.get_abilities() | ||
206 | string = "STR: %s, AGI: %s, MAG: %s" %(str, agi, mag) | ||
207 | self.caller.msg(string) | ||
208 | |||
209 | |||
210 | ... | ... |
... | @@ -15,6 +15,7 @@ own cmdsets by inheriting from them or directly from `evennia.CmdSet`. | ... | @@ -15,6 +15,7 @@ own cmdsets by inheriting from them or directly from `evennia.CmdSet`. |
15 | """ | 15 | """ |
16 | 16 | ||
17 | from evennia import default_cmds | 17 | from evennia import default_cmds |
18 | from commands.command import CmdAbilities | ||
18 | 19 | ||
19 | class CharacterCmdSet(default_cmds.CharacterCmdSet): | 20 | class CharacterCmdSet(default_cmds.CharacterCmdSet): |
20 | """ | 21 | """ |
... | @@ -32,6 +33,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet): | ... | @@ -32,6 +33,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet): |
32 | # | 33 | # |
33 | # any commands you add below will overload the default ones. | 34 | # any commands you add below will overload the default ones. |
34 | # | 35 | # |
36 | self.add(CmdAbilities()) | ||
35 | 37 | ||
36 | 38 | ||
37 | class PlayerCmdSet(default_cmds.PlayerCmdSet): | 39 | class PlayerCmdSet(default_cmds.PlayerCmdSet): | ... | ... |
-
Please register or sign in to post a comment