summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDipesh Amin <yaypunkrock@gmail.com>2012-03-31 23:29:09 +0100
committerDipesh Amin <yaypunkrock@gmail.com>2012-03-31 23:29:09 +0100
commite453af5cb5f85b175cea8f06f211d1e36db67d08 (patch)
tree1b1adabd2fee326051080d25049c58e16beace32
parenta91e699353fc5fde38583b6be21b5a454a66eac2 (diff)
downloadmanamarket-e453af5cb5f85b175cea8f06f211d1e36db67d08.tar.gz
manamarket-e453af5cb5f85b175cea8f06f211d1e36db67d08.tar.bz2
manamarket-e453af5cb5f85b175cea8f06f211d1e36db67d08.tar.xz
manamarket-e453af5cb5f85b175cea8f06f211d1e36db67d08.zip
Fix: Play nice with other bots!
Remove some old changes.
-rwxr-xr-xmain.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/main.py b/main.py
index a37eceb..8957cb2 100755
--- a/main.py
+++ b/main.py
@@ -58,6 +58,11 @@ def process_whisper(nick, msg, mapserv):
msg = filter(lambda x: x in utils.allowed_chars, msg)
if len(msg) == 0:
return
+
+ # Infinite chat loop anyone?
+ if nick == "guild":
+ return
+
user = user_tree.get_user(nick)
broken_string = msg.split()
@@ -755,17 +760,6 @@ def main():
trader_state.timer = time.time()
mapserv.sendall(str(PacketOut(CMSG_TRADE_CANCEL_REQUEST)))
- # If a player has logged off/left the map.
- nick = ''
- if trader_state.item:
- nick = trader_state.item.player
- elif trader_state.money:
- nick = trader_state.money
-
- player_id = beingManager.findId(nick)
- if player_id == -10:
- trader_state.reset()
-
for packet in pb:
if packet.is_type(SMSG_MAP_LOGIN_SUCCESS): # connected
logging.info("Map login success.")
@@ -783,7 +777,9 @@ def main():
msg_len = packet.read_int16() - 26
nick = packet.read_string(24)
message = packet.read_raw_string(msg_len)
- logging.info("Whisper: " + nick + ": " + message)
+ # Clean up the logs.
+ if nick != 'AuctionBot':
+ logging.info("Whisper: " + nick + ": " + message)
process_whisper(nick, utils.remove_colors(message), mapserv)
elif packet.is_type(SMSG_PLAYER_STAT_UPDATE_1):