state sync; the basic early game works
This commit is contained in:
@@ -4,7 +4,7 @@ import subprocess
|
||||
|
||||
import flask
|
||||
|
||||
from . import core, items
|
||||
from . import core, items, jsonizer
|
||||
|
||||
def generate_flavor_text():
|
||||
if core.desktop_mode:
|
||||
@@ -47,10 +47,10 @@ def tick():
|
||||
case 10: # ENCHUMAN
|
||||
result["items"] = {
|
||||
# TODO: read ranges from XML rule files
|
||||
"food": [items.TickItem("food", random.uniform(0.0, 20.0), "humans")],
|
||||
"shinies": [items.TickItem("food", random.uniform(0.0, 20.0), "humans")]
|
||||
"food": [items.TickItem("food", round(random.uniform(0.0, 20.0), 2), "humans") for i in range(random.randint(0, 3))],
|
||||
"shinies": [items.TickItem("shinies", round(random.uniform(0.0, 20.0), 2), "humans") for i in range(random.randint(0, 3))]
|
||||
}
|
||||
case _:
|
||||
core.log.warning("undefined tick: {0}".format(result["event_type"]))
|
||||
|
||||
return flask.Response(json.dumps(result), status=200, content_type="application/json")
|
||||
return flask.Response(json.dumps(result, cls=jsonizer.JSONizer), status=200, content_type="application/json")
|
Reference in New Issue
Block a user