summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDipesh Amin <yaypunkrock@gmail.com>2011-09-09 17:42:39 +0100
committerDipesh Amin <yaypunkrock@gmail.com>2011-09-09 17:42:39 +0100
commitd070b62bb77bb67dcc38ad460e8f487a53b9ba50 (patch)
tree2c384a203e8f0f2bdf60113aac99a82e90406981
parentd3e9149e64ba85b0db120d721891f6be457f7fab (diff)
downloadmanamarket-d070b62bb77bb67dcc38ad460e8f487a53b9ba50.tar.gz
manamarket-d070b62bb77bb67dcc38ad460e8f487a53b9ba50.tar.bz2
manamarket-d070b62bb77bb67dcc38ad460e8f487a53b9ba50.tar.xz
manamarket-d070b62bb77bb67dcc38ad460e8f487a53b9ba50.zip
Add information about weight to !identify and !listusers.
-rwxr-xr-xmain.py10
-rw-r--r--utils.py5
2 files changed, 12 insertions, 3 deletions
diff --git a/main.py b/main.py
index 707a02d..105043e 100755
--- a/main.py
+++ b/main.py
@@ -264,7 +264,10 @@ def process_whisper(nick, msg, mapserv):
mapserv.sendall(whisper(nick, "Item not found. Please check the uid number and try again."))
return
- mapserv.sendall(whisper(nick, "That item belongs to: "+item_info.get("name")))
+ weight = ItemDB.item_names[int(item_info.get('itemId'))].weight*int(item_info.get("amount"))
+
+ mapserv.sendall(whisper(nick, "That item/s belongs to: "+item_info.get("name")))
+ mapserv.sendall(whisper(nick, "The weight used is: "+str(weight)+"/"+str(player_node.MaxWEIGHT)))
elif msg == '!listusers':
# Admin command - shows a list of all user.
@@ -301,7 +304,10 @@ def process_whisper(nick, msg, mapserv):
if len(data) > 0:
mapserv.sendall(whisper(nick, data[0:len(data)-2]+"."))
- mapserv.sendall(whisper(nick,"Number of users:"+str(no_users)+ ", Sale slots used: "+str(total_slots_used)+"/"+str(total_slots_reserved)+ ", Total Money: "+str(total_money)+", Char slots used: "+str(len(player_node.inventory))))
+ mapserv.sendall(whisper(nick,"Number of users:"+str(no_users)+ ", Sale slots used: "+ \
+ str(total_slots_used)+"/"+str(total_slots_reserved)+ ", Total Money: "+str(total_money)+\
+ ", Char slots used: "+str(len(player_node.inventory))+", Weight Used: "+\
+ str(player_node.WEIGHT)+"/"+str(player_node.MaxWEIGHT)))
elif broken_string[0] == '!setslots':
# Change the number of slots a user has - !setslots <slots> <name>
diff --git a/utils.py b/utils.py
index 0e870d5..fc4f8dd 100644
--- a/utils.py
+++ b/utils.py
@@ -57,7 +57,10 @@ class ItemDB:
item_struct = Item()
item_struct.name = item.get('name')
if item.get('weight'):
- item_struct.weight = item.get('weight')
+ item_struct.weight = int(item.get('weight'))
+ else:
+ item_struct.weight = 0
+
if item.get('type'):
item_struct.type = item.get('type')
item_struct.description = item.get('description')