diff options
author | Dipesh Amin <yaypunkrock@gmail.com> | 2011-08-23 22:42:42 +0100 |
---|---|---|
committer | Dipesh Amin <yaypunkrock@gmail.com> | 2011-08-23 22:42:42 +0100 |
commit | 2cd71629569e8501667f3243cad50b8aa3a2efd6 (patch) | |
tree | d13cfa5641e652b9edc4d045057f3eb044a57137 | |
parent | eac0a33f4862ebdff5ac8e00fb819dbe34422597 (diff) | |
download | manamarket-2cd71629569e8501667f3243cad50b8aa3a2efd6.tar.gz manamarket-2cd71629569e8501667f3243cad50b8aa3a2efd6.tar.bz2 manamarket-2cd71629569e8501667f3243cad50b8aa3a2efd6.tar.xz manamarket-2cd71629569e8501667f3243cad50b8aa3a2efd6.zip |
Add some code to prevent problems with the !add command.
Prevents the case where a person tries to add more than one piece of
equiptment per slot.
I also added some code to stop people adding items for free.
-rwxr-xr-x | main.py | 7 | ||||
-rw-r--r-- | utils.py | 2 |
2 files changed, 9 insertions, 0 deletions
@@ -358,6 +358,13 @@ def process_whisper(nick, msg, mapserv): mapserv.sendall(whisper(nick, "Item not found, check spelling.")) return + if amount > 1 and 'equip' in ItemDB.getItem(ItemDB.findId(item_name)).type: + mapserv.sendall(whisper(nick, "You can only add one piece of equiptment per slot.")) + return + elif price == 0: + mapserv.sendall(whisper(nick, "Nothing in life is free.")) + return + item = Item() item.player = nick item.get = 1 # 1 = get, 0 = give @@ -58,6 +58,8 @@ class ItemDB: item_struct.name = item.get('name') if item.get('weight'): item_struct.weight = item.get('weight') + if item.get('type'): + item_struct.type = item.get('type') item_struct.description = item.get('description') self.item_names[int(item.get('id'))] = item_struct |