summaryrefslogtreecommitdiff
path: root/runshop.py
diff options
context:
space:
mode:
authorLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
committerLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
commit9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch)
tree9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /runshop.py
parent11cc316b74d5f3f283413a33e7693b314741aa4a (diff)
downloadmanachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip
Initial commit
Diffstat (limited to 'runshop.py')
-rw-r--r--runshop.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/runshop.py b/runshop.py
new file mode 100644
index 0000000..22fd740
--- /dev/null
+++ b/runshop.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python2
+
+import asyncore
+import logging
+import sys
+from ConfigParser import ConfigParser
+
+try:
+ import construct
+ del construct
+except ImportError:
+ import os
+ sys.path.insert(0, os.path.join(os.getcwd(), "external"))
+
+import net
+import net.mapserv as mapserv
+import plugins
+from utils import extends
+from itemdb import load_itemdb
+from loggers import debuglog
+from logicmanager import logic_manager
+
+
+@extends('smsg_player_warp')
+def player_warp(data):
+ mapserv.cmsg_map_loaded()
+
+
+@extends('smsg_map_login_success')
+def map_login_success(data):
+ mapserv.cmsg_map_loaded()
+
+
+if __name__ == '__main__':
+ rootLogger = logging.getLogger('')
+ rootLogger.addHandler(logging.NullHandler())
+
+ dbgh = logging.StreamHandler(sys.stdout)
+ dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s",
+ datefmt="%Y-%m-%d %H:%M:%S"))
+ debuglog.addHandler(dbgh)
+ debuglog.setLevel(logging.INFO)
+
+ shoplog = logging.getLogger('ManaChat.Shop')
+ shoplog.setLevel(logging.INFO)
+ shoplog.addHandler(dbgh)
+
+ config = ConfigParser()
+ config.read('manachat.ini')
+
+ load_itemdb('itemdb.txt')
+
+ plugins.load_plugins(config)
+
+ net.login(host=config.get('Server', 'host'),
+ port=config.getint('Server', 'port'),
+ username=config.get('Player', 'username'),
+ password=config.get('Player', 'password'),
+ charname=config.get('Player', 'charname'))
+
+ while True:
+ asyncore.loop(timeout=0.2, count=5)
+ logic_manager.tick()