Mercurial > openrpg
changeset 563:b69b7409e0f3
change /effect to take just one type parameter, fixed bug, improved error message
author | davidbyron |
---|---|
date | Sat, 10 Apr 2010 19:07:44 -0500 |
parents | a095896cdd8a |
children | 5c7a3bb1572f |
files | orpg/chat/commands.py plugins/xxbonuses.py |
diffstat | 2 files changed, 9 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/orpg/chat/commands.py Sat Apr 10 17:56:36 2010 -0500 +++ b/orpg/chat/commands.py Sat Apr 10 19:07:44 2010 -0500 @@ -48,7 +48,7 @@ var_list.append(value) elif keyword in key_var_map: old_value = key_var_map[keyword] - if isinstance(old_value, str): + if isinstance(old_value, (str, unicode)): key_var_map[keyword] = [old_value, value] else: old_value.append(value)
--- a/plugins/xxbonuses.py Sat Apr 10 17:56:36 2010 -0500 +++ b/plugins/xxbonuses.py Sat Apr 10 19:07:44 2010 -0500 @@ -103,8 +103,8 @@ self.plugin_addcommand('/bonus', self.on_bonus, '/bonus number target [type]') self.plugin_addcommand('/effect', self.on_effect, - '/effect name desc= alias= expire= number= '\ - 'path= [type=] number= path= [type=]') + '/effect name alias= [desc=] [expire=] [type=] number= '\ + 'path= number= path=') self.plugin_commandalias('/b', '/bonus') self.plugin_addcommand('/view_effects', self.on_view_effects, 'bring up the effects view (use this to '\ @@ -215,7 +215,7 @@ if namespace_name != "" and\ open_rpg.get_component('tree').\ get_namespace_by_name(namespace_name) is None: - chat.InfoPost("/effect: the alias passed was not a namespace.") + chat.InfoPost("/effect: the alias passed ('"+namespace_name+"') was not a namespace.") return else: context = chat.chat_cmds.context @@ -230,6 +230,10 @@ expire = key_values['expire'] else: expire = '' + if 'type' in key_values: + effect_type = key_values['type'] + else: + effect_type = '' numbers = key_values['number'] if not isinstance(numbers, list): numbers = [numbers] @@ -239,16 +243,6 @@ if len(numbers) != len(paths): chat.InfoPost("/effect: number and path params must be paired.") return - if 'type' in key_values: - types = key_values['type'] - if not isinstance(types, list): - types = [types] - if len(numbers) != len(types): - chat.InfoPost("/effect: number and type params must be "\ - "matched if any type is given.") - return - else: - types = [''] * len(numbers) bonus_list = [] for i in range(len(numbers)): # check validity of path / replace with fullpath (not leaf) @@ -269,7 +263,7 @@ path = namespace_path else: path = fullpath - bonus_list.append(Bonus(numbers[i], path, types[i])) + bonus_list.append(Bonus(numbers[i], path, effect_type)) effect = Effect(name, desc, namespace_name, expire, bonus_list) chat.add_effect(effect)