summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDipesh Amin <yaypunkrock@gmail.com>2011-08-22 09:44:24 +0100
committerDipesh Amin <yaypunkrock@gmail.com>2011-08-22 09:44:24 +0100
commitacf5d486463147e68b9fab4899f83ce3aaaff107 (patch)
treecbc6e82f17c093e84f7e365a55e569765cab8fa8
parent152baa6eb8af6a24c6ee3966f5b47a664e239e84 (diff)
downloadmanamarket-acf5d486463147e68b9fab4899f83ce3aaaff107.tar.gz
manamarket-acf5d486463147e68b9fab4899f83ce3aaaff107.tar.bz2
manamarket-acf5d486463147e68b9fab4899f83ce3aaaff107.tar.xz
manamarket-acf5d486463147e68b9fab4899f83ce3aaaff107.zip
Add a relist_time setting to the configuration file.
-rw-r--r--config.py.template1
-rwxr-xr-xmain.py10
2 files changed, 6 insertions, 5 deletions
diff --git a/config.py.template b/config.py.template
index 068d432..df11a32 100644
--- a/config.py.template
+++ b/config.py.template
@@ -3,4 +3,5 @@ server = "caliban.homeip.net"
port = 6901
account = ""
password = ""
+relist_time = 604800 # Time in seconds before an item needs to be relisted.
character = 0 #slot character is in, 0 for first, 1 for second, 2 for third
diff --git a/main.py b/main.py
index 56de5cd..41f5059 100755
--- a/main.py
+++ b/main.py
@@ -64,7 +64,7 @@ def process_whisper(nick, msg, mapserv):
mapserv.sendall(whisper(nick, "No items for sale."))
for elem in sale_tree.root:
- if time.time() - float(elem.get('add_time')) < 604800: # Check if an items time is up.
+ if time.time() - float(elem.get('add_time')) < config.relist_time: # Check if an items time is up.
msg = "[selling] [" + elem.get("uid") + "] " + elem.get("amount") + " [@@" + \
elem.get("itemId") + "|" + ItemDB.getItem(int(elem.get("itemId"))).name + "@@] for " + elem.get("price") + "gp each"
mapserv.sendall(whisper(nick, msg))
@@ -74,7 +74,7 @@ def process_whisper(nick, msg, mapserv):
data = '\302\202B1'
for elem in sale_tree.root:
- if time.time() - float(elem.get('add_time')) < 604800:
+ if time.time() - float(elem.get('add_time')) < config.relist_time:
data += utils.encode_str(int(elem.get("itemId")), 2)
data += utils.encode_str(int(elem.get("price")), 4)
data += utils.encode_str(int(elem.get("amount")), 3)
@@ -105,7 +105,7 @@ def process_whisper(nick, msg, mapserv):
mapserv.sendall(whisper(nick, "Your have the following items for sale:"))
for elem in sale_tree.root:
if elem.get('name') == nick:
- if time.time() - float(elem.get('add_time')) > 604800:
+ if time.time() - float(elem.get('add_time')) > config.relist_time:
msg = "[expired] ["
else:
msg = "[selling] ["
@@ -184,7 +184,7 @@ def process_whisper(nick, msg, mapserv):
if item.isdigit(): # an id
for elem in sale_tree.root:
- if ((time.time() - float(elem.get('add_time'))) < 604800) \
+ if ((time.time() - float(elem.get('add_time'))) < config.relist_time) \
and int(elem.get("itemId")) == int(item): # Check if an items time is up.
msg = "[selling] [" + elem.get("uid") + "] " + elem.get("amount") + " [@@" + elem.get("itemId") + "|" \
+ ItemDB.getItem(int(elem.get("itemId"))).name + "@@] for " + elem.get("price") + "gp each"
@@ -192,7 +192,7 @@ def process_whisper(nick, msg, mapserv):
items_found = True
else: # an item name
for elem in sale_tree.root:
- if ((time.time() - float(elem.get('add_time'))) < 604800) \
+ if ((time.time() - float(elem.get('add_time'))) < config.relist_time) \
and item.lower() in ItemDB.getItem(int(elem.get("itemId"))).name.lower(): # Check if an items time is up.
msg = "[selling] [" + elem.get("uid") + "] " + elem.get("amount") + " [@@" + elem.get("itemId") + "|" \
+ ItemDB.getItem(int(elem.get("itemId"))).name + "@@] for " + elem.get("price") + "gp each"