diff options
author | Dipesh Amin <yaypunkrock@gmail.com> | 2011-09-09 13:57:15 +0100 |
---|---|---|
committer | Dipesh Amin <yaypunkrock@gmail.com> | 2011-09-09 13:57:15 +0100 |
commit | b2cc60c0e414320673e1a33bcc332484335090aa (patch) | |
tree | dc6080bb7c0405cba95f31ffa0ad6a62f74b7eee | |
parent | a908b2daf3b7508599f6412337ca10ffffd2332c (diff) | |
download | manamarket-b2cc60c0e414320673e1a33bcc332484335090aa.tar.gz manamarket-b2cc60c0e414320673e1a33bcc332484335090aa.tar.bz2 manamarket-b2cc60c0e414320673e1a33bcc332484335090aa.tar.xz manamarket-b2cc60c0e414320673e1a33bcc332484335090aa.zip |
A few Changes
- Log the name of the seller in the sale.log
- Give some of the bot stats for the !listusers command.
- Fix the sell chatbot response.
-rw-r--r-- | eliza.py | 2 | ||||
-rwxr-xr-x | main.py | 14 | ||||
-rw-r--r-- | utils.py | 4 |
3 files changed, 15 insertions, 5 deletions
@@ -56,7 +56,7 @@ patternResps = [ [[[0,'we'],'i','have',[0,'thing']],['how','is', 'your',[0,'thing'],'?']], [[[0,'we'],'is','great'],['how','is',[0,'we'],'great','?']], [['i','like',[0,'a']],['Interesting','i','appreciate',[0,'a'],'too']], - [['sell',[0,'stuff']],['To','sell',[0,'stuff'],'use','my','!add','command.'], + [['sell',[0,'stuff']],['To','sell',[0,'stuff'],'use','my','!add','command.']], [['i','said',[0,'we']],['Why','did','you','say',[0,'we']]], [[0,'you',[1,'b'],'me'],['What','gave','you','the','impression','I',[1,'b'],'you ?']], [['i','feel',[0,'a']],['How','long','have','you','felt',[0,'a'],'?']], @@ -255,13 +255,21 @@ def process_whisper(nick, msg, mapserv): return data = '' - + total_money = 0 + total_slots_reserved = 0 + total_slots_used = 0 + no_users = 0 + for user in user_tree.root: + no_users += 1 name = user.get('name') accesslevel = user.get('accesslevel') slots = user.get('stalls') + total_slots_reserved += int(slots) used_slots = user.get('used_stalls') + total_slots_used += int(used_slots) money = user.get('money') + total_money += int(money) data += name+" ("+accesslevel+") "+used_slots+"/"+slots+" "+money+'gp, ' # Format ManaMarket (20) 2/5 100000gp, @@ -272,6 +280,8 @@ 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)))) + elif broken_string[0] == '!setslots': # Change the number of slots a user has - !setslots <slots> <name> if user == -10: @@ -989,7 +999,7 @@ def main(): user_tree.get_user(seller).set("money", str(current_money + trader_state.item.price * trader_state.item.amount)) if trader_state.item.price * trader_state.item.amount != 0: - ItemLog.add_item(int(item.get('itemId')), trader_state.item.amount, trader_state.item.price * trader_state.item.amount) + ItemLog.add_item(int(item.get('itemId')), trader_state.item.amount, trader_state.item.price * trader_state.item.amount, item.get('name')) commitMessage = "Buy or Getback" elif trader_state.money and trader_state.item == 0: # !money @@ -77,9 +77,9 @@ class ItemLog: def __init__(self): self.log_file = 'data/logs/sale.log' - def add_item(self, item_id, amount, price): + def add_item(self, item_id, amount, price, name): file_node = open(self.log_file, 'a') - file_node.write(str(item_id)+" "+str(amount)+" "+str(price)+" "+str(time.time())+"\n") + file_node.write(str(item_id)+" "+str(amount)+" "+str(price)+" "+str(time.time())+" "+name+"\n") file_node.close() class TraderState: |