Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Barry
/
esp8266-Mud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ade0b68b
authored
2018-05-03 02:02:24 -0700
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Changed go to use the micropython version of .. whatever the hell it's
doing and fixed a few bugs
1 parent
b3a05ac4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
8 deletions
commands/go.txt
main.py
mobs.txt
release.py
commands/go.txt
View file @
ade0b68
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
...
...
main.py
View file @
ade0b68
...
...
@@ -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
>=
6
0
:
if
spawn
>=
3
0
:
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
:
...
...
mobs.txt
View file @
ade0b68
...
...
@@ -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']:
...
...
release.py
View file @
ade0b68
...
...
@@ -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.1
89
:/{}"
.
format
(
password
,
file
,
file
))
os
.
system
(
"python webrepl
\
webrepl_cli.py -p {} {} 192.168.1.1
38
:/{}"
.
format
(
password
,
file
,
file
))
...
...
Please
register
or
sign in
to post a comment