diff options
author | Livio Recchia <recchialivio@libero.it> | 2020-04-26 19:28:29 +0200 |
---|---|---|
committer | Livio Recchia <recchialivio@libero.it> | 2020-04-26 19:28:29 +0200 |
commit | f26d6007ad6e64d2604b7c0acefd8c74b81a1d83 (patch) | |
tree | 477db1b63dbd64e0beb1893ddd6bf983e1d1e601 /plugins/shop.py | |
parent | d9d57ec2dbd7d6723baf5175db712b3a0acd441f (diff) | |
download | manachat-f26d6007ad6e64d2604b7c0acefd8c74b81a1d83.tar.gz manachat-f26d6007ad6e64d2604b7c0acefd8c74b81a1d83.tar.bz2 manachat-f26d6007ad6e64d2604b7c0acefd8c74b81a1d83.tar.xz manachat-f26d6007ad6e64d2604b7c0acefd8c74b81a1d83.zip |
ManaBoy™ module accepts command by whispering, shop.py got trade command commented due to spam triggering.
Diffstat (limited to 'plugins/shop.py')
-rwxr-xr-x | plugins/shop.py | 73 |
1 files changed, 44 insertions, 29 deletions
diff --git a/plugins/shop.py b/plugins/shop.py index d45dff2..5c0436a 100755 --- a/plugins/shop.py +++ b/plugins/shop.py @@ -17,7 +17,6 @@ from chat import send_whisper as whisper __all__ = [ 'PLUGIN', 'init', 'shoplog', 'buying', 'selling' ] - nobuy = [] PLUGIN = { @@ -35,6 +34,7 @@ shoplog = logging.getLogger('ManaChat.Shop') trade_timeout = 60 shop_admins = None +# Commented due to player abusing trade commands too many times per minute # FIXME Put on a specified library def preloadArray(nfile): try: @@ -49,16 +49,18 @@ def preloadArray(nfile): except: print "preloadArray: File " + nfile + " not found!" -sell_greetings = [ - "Hi {0}! Welcome to my shop!", -] +ignored_players = preloadArray("config/ignored.txt") + +# ~ sell_greetings = [ + # ~ "Hi {0}! Welcome to my shop!", +# ~ ] -buy_greetings = [ - "Okay, {0}! Let's see what you've got to sell!", -] +# ~ buy_greetings = [ + # ~ "Okay, {0}! Let's see what you've got to sell!", +# ~ ] -sell_greetings = preloadArray("config/sellGreetings.txt") -buy_greetings = preloadArray("config/buyGreetings.txt") +# ~ sell_greetings = preloadArray("config/sellGreetings.txt") +# ~ buy_greetings = preloadArray("config/buyGreetings.txt") class s: @@ -93,17 +95,20 @@ def cleanup(): s.start_time = 0 # ========================================================================= + def selllist(nick, message, is_whisper, match): if not is_whisper: return - if nick in nobuy: - mapserv.cmsg_chat_message("Special prize for you, " + nick + "!") - time.sleep(5) - else: - answer = random.choice(sell_greetings) - mapserv.cmsg_chat_message(answer.format(nick)) - - time.sleep(5) + if nick in ignored_players: + return + # ~ if lastNickGreeted != nick: + # ~ if nick in nobuy: + # ~ mapserv.cmsg_chat_message("Special prize for you, " + nick + "!") + # ~ time.sleep(1) + # ~ else: + # ~ answer = random.choice(sell_greetings) + # ~ mapserv.cmsg_chat_message(answer.format(nick)) + # ~ lastNickGreeted = nick # ~ return # Support for 4144's shop (Sell list) data = '\302\202B1' @@ -120,16 +125,21 @@ def selllist(nick, message, is_whisper, match): data += encode_str(id_, 2) data += encode_str(price, 4) data += encode_str(amount, 3) - + time.sleep(1) whisper(nick, data) def buylist(nick, message, is_whisper, match): if not is_whisper: return - answer = random.choice(buy_greetings) - mapserv.cmsg_chat_message(answer.format(nick)) - time.sleep(5) + if nick in ignored_players: + return + # ~ if lastNickGreeted != nick: + # ~ answer = random.choice(buy_greetings) + # ~ mapserv.cmsg_chat_message(answer.format(nick)) + + # ~ lastNickGreeted = nick + # Support for 4144's shop (Sell list) data = '\302\202S1' @@ -154,11 +164,13 @@ def buylist(nick, message, is_whisper, match): data += encode_str(amount, 3) whisper(nick, data) - + time.sleep(1) def sellitem(nick, message, is_whisper, match): if not is_whisper: return + if nick in ignored_players: + return item_id = amount = 0 @@ -216,6 +228,8 @@ def sellitem(nick, message, is_whisper, match): def buyitem(nick, message, is_whisper, match): if not is_whisper: return + if nick in ignored_players: + return item_id = amount = 0 # FIXME: check if amount=0 or id=0 @@ -271,7 +285,8 @@ def buyitem(nick, message, is_whisper, match): def retrieve(nick, message, is_whisper, match): if not is_whisper: return - + if nick in ignored_players: + return if shop_admins is None: return @@ -350,11 +365,12 @@ def zeny(nick, message, is_whisper, match): # ========================================================================= -@extends('smsg_trade_request') -def trade_request(data): - shoplog.info("Trade request from %s", data.nick) - mapserv.cmsg_trade_response(False) - selllist(data.nick, '', True, None) +# COMMENTED SECTION DUE TO SPAM TRIGGERING +# ~ @extends('smsg_trade_request') +# ~ def trade_request(data): + # ~ shoplog.info("Trade request from %s", data.nick) + # ~ mapserv.cmsg_trade_response(False) + # ~ selllist(data.nick, '', True, None) @extends('smsg_trade_response') @@ -580,7 +596,6 @@ def init(config): shoplog.warning('shop admin file not found : %s', shop_admins_file) print 'Error: shop admin file not found :' + shop_admins_file - badge.is_shop = True load_shop_list(config) |