Changed go to use the micropython version of .. whatever the hell it's
doing and fixed a few bugs
Showing
4 changed files
with
12 additions
and
8 deletions
1 | def go(id, params, players, mud, tokens, command): | 1 | def go(id, params, players, mud, tokens, command): |
2 | # store the exit name | 2 | # store the exit name |
3 | params = params.strip() | ||
4 | if params == '': | 3 | if params == '': |
5 | params = command | 4 | params = command |
6 | 5 | ||
... | @@ -50,4 +49,4 @@ def go(id, params, players, mud, tokens, command): | ... | @@ -50,4 +49,4 @@ def go(id, params, players, mud, tokens, command): |
50 | else: | 49 | else: |
51 | # send back an 'unknown exit' message | 50 | # send back an 'unknown exit' message |
52 | mud.send_message(id, "Unknown exit '{}'".format(params)) | 51 | mud.send_message(id, "Unknown exit '{}'".format(params)) |
53 | next_command = go(id, params, players, mud, tokens, cmd) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
52 | next_command = go(id, params, players, mud, tokens, command) | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -42,7 +42,7 @@ players = {} | ... | @@ -42,7 +42,7 @@ players = {} |
42 | # start the server | 42 | # start the server |
43 | globals()['mud'] = MudServer() | 43 | globals()['mud'] = MudServer() |
44 | 44 | ||
45 | def prompt(pid): | 45 | def show_prompt(pid): |
46 | if "prompt" not in players[pid]: | 46 | if "prompt" not in players[pid]: |
47 | players[pid]["prompt"] = "> " | 47 | players[pid]["prompt"] = "> " |
48 | if 'hp' not in players[pid]: | 48 | if 'hp' not in players[pid]: |
... | @@ -67,7 +67,7 @@ while True: | ... | @@ -67,7 +67,7 @@ while True: |
67 | # use 100% CPU time | 67 | # use 100% CPU time |
68 | time.sleep(0.001) | 68 | time.sleep(0.001) |
69 | tick += 0.001 | 69 | tick += 0.001 |
70 | if spawn >= 60: | 70 | if spawn >= 30: |
71 | spawn = 0 | 71 | spawn = 0 |
72 | try: | 72 | try: |
73 | ldict = {} | 73 | ldict = {} |
... | @@ -76,7 +76,7 @@ while True: | ... | @@ -76,7 +76,7 @@ while True: |
76 | except Exception as e: | 76 | except Exception as e: |
77 | print('spawner error:') | 77 | print('spawner error:') |
78 | print(e) | 78 | print(e) |
79 | if tick >= 3: | 79 | if tick >= 1: |
80 | spawn += tick | 80 | spawn += tick |
81 | tick = 0 | 81 | tick = 0 |
82 | try: | 82 | try: |
... | @@ -185,7 +185,7 @@ while True: | ... | @@ -185,7 +185,7 @@ while True: |
185 | 185 | ||
186 | handler_results = cmd_handler.parse(id, command, params, mud, players) | 186 | handler_results = cmd_handler.parse(id, command, params, mud, players) |
187 | 187 | ||
188 | prompt(id) | 188 | show_prompt(id) |
189 | 189 | ||
190 | # Start WIFI Setup | 190 | # Start WIFI Setup |
191 | if 'esp' in sys.platform: | 191 | if 'esp' in sys.platform: | ... | ... |
... | @@ -46,7 +46,7 @@ def run_mobs(players, mud): | ... | @@ -46,7 +46,7 @@ def run_mobs(players, mud): |
46 | monster_template = utils.load_object_from_file('mobs/{}.json'.format(mon_name)) | 46 | monster_template = utils.load_object_from_file('mobs/{}.json'.format(mon_name)) |
47 | print(monster) | 47 | print(monster) |
48 | for active_monster in monster['active']: | 48 | for active_monster in monster['active']: |
49 | if active_monster['action'] == "attack": | 49 | if active_monster['action'] == "attack" and active_monster['target'] == player['name']: |
50 | if active_monster['hp'] == 0: | 50 | if active_monster['hp'] == 0: |
51 | DEAD = 1 | 51 | DEAD = 1 |
52 | if "d" in monster_template['aa']: | 52 | if "d" in monster_template['aa']: | ... | ... |
... | @@ -5,6 +5,8 @@ files = [ | ... | @@ -5,6 +5,8 @@ files = [ |
5 | "commandhandler.py", | 5 | "commandhandler.py", |
6 | "inventoryhandler.py", | 6 | "inventoryhandler.py", |
7 | "main.py", | 7 | "main.py", |
8 | "mobs.txt", | ||
9 | "spawner.txt", | ||
8 | "mudserver.py", | 10 | "mudserver.py", |
9 | "roomloader.py", | 11 | "roomloader.py", |
10 | "utils.py", | 12 | "utils.py", |
... | @@ -24,9 +26,12 @@ for f in os.listdir('inventory'): | ... | @@ -24,9 +26,12 @@ for f in os.listdir('inventory'): |
24 | for f in os.listdir('commands'): | 26 | for f in os.listdir('commands'): |
25 | files.append('commands/' + f) | 27 | files.append('commands/' + f) |
26 | 28 | ||
29 | for f in os.listdir('mobs'): | ||
30 | files.append('mobs/' + f) | ||
31 | |||
27 | with open('releasepw.conf', 'r', encoding='utf-8') as f: | 32 | with open('releasepw.conf', 'r', encoding='utf-8') as f: |
28 | password = f.read() | 33 | password = f.read() |
29 | 34 | ||
30 | for file in files: | 35 | for file in files: |
31 | os.system("python webrepl\webrepl_cli.py -p {} {} 192.168.1.189:/{}".format(password, file, file)) | 36 | os.system("python webrepl\webrepl_cli.py -p {} {} 192.168.1.138:/{}".format(password, file, file)) |
32 | 37 | ... | ... |
-
Please register or sign in to post a comment