summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorHoraK-FDF <horak-fdf@web.de>2024-06-20 20:45:04 +0200
committerHoraK-FDF <horak-fdf@web.de>2024-06-20 20:45:04 +0200
commitd99bf0dcf4cbe523253aaf21f4342738184bcd2b (patch)
treeec118578bbc9ec2101703b10d018c3800a8fecc8 /plugins
parent72db9dcb6fb4cbd81f88be3d0f0db29430818702 (diff)
parent97055867550f0beca2a2cb396ccd95f6e58320de (diff)
downloadmanachat-d99bf0dcf4cbe523253aaf21f4342738184bcd2b.tar.gz
manachat-d99bf0dcf4cbe523253aaf21f4342738184bcd2b.tar.bz2
manachat-d99bf0dcf4cbe523253aaf21f4342738184bcd2b.tar.xz
manachat-d99bf0dcf4cbe523253aaf21f4342738184bcd2b.zip
Merge branch 'shop_timeout'HEADmaster
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/shop.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/plugins/shop.py b/plugins/shop.py
index 5e3bf24..828c7ea 100755
--- a/plugins/shop.py
+++ b/plugins/shop.py
@@ -31,6 +31,10 @@ PLUGIN = {
shoplog = logging.getLogger('ManaChat.Shop')
trade_timeout = 60
+time_sleep = 10
+# default = 10
+# Use at your own risk if you think the default value is too slow.
+# 0 works too.
shop_admins = None
ignored_players = preloadArray("config/ignored.txt")
@@ -88,7 +92,7 @@ def selllist(nick, message, is_whisper, match):
# ~ if lastNickGreeted != nick:
# ~ if nick in nobuy:
# ~ mapserv.cmsg_chat_message("Special prize for you, " + nick + "!")
- # ~ time.sleep(10)
+ # ~ time.sleep(time_sleep)
# ~ else:
# ~ answer = random.choice(sell_greetings)
# ~ mapserv.cmsg_chat_message(answer.format(nick))
@@ -109,7 +113,7 @@ def selllist(nick, message, is_whisper, match):
data += encode_str(id_, 2)
data += encode_str(price, 4)
data += encode_str(amount, 3)
- time.sleep(10)
+ time.sleep(time_sleep)
whisper(nick, data)
@@ -123,7 +127,7 @@ def buylist(nick, message, is_whisper, match):
# ~ mapserv.cmsg_chat_message(answer.format(nick))
# ~ lastNickGreeted = nick
-
+
# Support for 4144's shop (Sell list)
data = '\302\202S1'
@@ -147,7 +151,7 @@ def buylist(nick, message, is_whisper, match):
data += encode_str(price, 4)
data += encode_str(amount, 3)
- time.sleep(10)
+ time.sleep(time_sleep)
whisper(nick, data)
def sellitem(nick, message, is_whisper, match):
@@ -156,7 +160,7 @@ def sellitem(nick, message, is_whisper, match):
if nick in ignored_players:
return
- time.sleep(10)
+ time.sleep(time_sleep)
item_id = amount = 0
# FIXME: check if amount=0 or id=0
@@ -176,7 +180,7 @@ def sellitem(nick, message, is_whisper, match):
else:
whisper(nick, "I am currently trading with someone")
return
-
+
player_id = mapserv.beings_cache.findId(nick)
if player_id < 0:
whisper(nick, "I don't see you nearby")
@@ -220,8 +224,8 @@ def buyitem(nick, message, is_whisper, match):
return
item_id = amount = 0
- time.sleep(10)
-
+ time.sleep(time_sleep)
+
# FIXME: check if amount=0 or id=0
try:
item_id = int(match.group(1))
@@ -286,7 +290,7 @@ def retrieve(nick, message, is_whisper, match):
if not shop_admins.check_player(nick):
return
- time.sleep(10)
+ time.sleep(time_sleep)
item_id = amount = 0
@@ -341,7 +345,7 @@ def invlist(nick, message, is_whisper, match):
if not shop_admins.check_player(nick):
return
- time.sleep(10)
+ time.sleep(time_sleep)
ls = status.invlists(50)
for l in ls:
@@ -377,7 +381,7 @@ def trade_response(data):
return
code = data.code
- time.sleep(10)
+ time.sleep(time_sleep)
if code == 0:
shoplog.info("%s is too far", s.player)
@@ -416,7 +420,7 @@ def trade_item_add(data):
cleanup()
return
- time.sleep(10)
+ time.sleep(time_sleep)
item_id, amount = data.id, data.amount
@@ -452,7 +456,7 @@ def trade_item_add_response(data):
cleanup()
return
- time.sleep(10)
+ time.sleep(time_sleep)
code = data.code
amount = data.amount
@@ -494,7 +498,7 @@ def trade_ok(data):
who = data.who
- time.sleep(10)
+ time.sleep(time_sleep)
if who == 0:
return
@@ -541,7 +545,7 @@ def trade_complete(data):
cleanup()
return
- time.sleep(10)
+ time.sleep(time_sleep)
if s.mode == 'sell':
shoplog.info("Trade with %s completed. I sold %d %s for %d GP",