ade0b68b by Barry

Changed go to use the micropython version of .. whatever the hell it's

doing and fixed a few bugs
1 parent b3a05ac4
def go(id, params, players, mud, tokens, command):
# store the exit name
params = params.strip()
if params == '':
params = command
......@@ -50,4 +49,4 @@ def go(id, params, players, mud, tokens, command):
else:
# send back an 'unknown exit' message
mud.send_message(id, "Unknown exit '{}'".format(params))
next_command = go(id, params, players, mud, tokens, cmd)
\ No newline at end of file
next_command = go(id, params, players, mud, tokens, command)
\ No newline at end of file
......
......@@ -42,7 +42,7 @@ players = {}
# start the server
globals()['mud'] = MudServer()
def prompt(pid):
def show_prompt(pid):
if "prompt" not in players[pid]:
players[pid]["prompt"] = "> "
if 'hp' not in players[pid]:
......@@ -67,7 +67,7 @@ while True:
# use 100% CPU time
time.sleep(0.001)
tick += 0.001
if spawn >= 60:
if spawn >= 30:
spawn = 0
try:
ldict = {}
......@@ -76,7 +76,7 @@ while True:
except Exception as e:
print('spawner error:')
print(e)
if tick >= 3:
if tick >= 1:
spawn += tick
tick = 0
try:
......@@ -185,7 +185,7 @@ while True:
handler_results = cmd_handler.parse(id, command, params, mud, players)
prompt(id)
show_prompt(id)
# Start WIFI Setup
if 'esp' in sys.platform:
......
......@@ -46,7 +46,7 @@ def run_mobs(players, mud):
monster_template = utils.load_object_from_file('mobs/{}.json'.format(mon_name))
print(monster)
for active_monster in monster['active']:
if active_monster['action'] == "attack":
if active_monster['action'] == "attack" and active_monster['target'] == player['name']:
if active_monster['hp'] == 0:
DEAD = 1
if "d" in monster_template['aa']:
......
......@@ -5,6 +5,8 @@ files = [
"commandhandler.py",
"inventoryhandler.py",
"main.py",
"mobs.txt",
"spawner.txt",
"mudserver.py",
"roomloader.py",
"utils.py",
......@@ -24,9 +26,12 @@ for f in os.listdir('inventory'):
for f in os.listdir('commands'):
files.append('commands/' + f)
for f in os.listdir('mobs'):
files.append('mobs/' + f)
with open('releasepw.conf', 'r', encoding='utf-8') as f:
password = f.read()
for file in files:
os.system("python webrepl\webrepl_cli.py -p {} {} 192.168.1.189:/{}".format(password, file, file))
os.system("python webrepl\webrepl_cli.py -p {} {} 192.168.1.138:/{}".format(password, file, file))
......