Skip to content

Commit

Permalink
Quests with ask for things (not parts) can be asked for and received …
Browse files Browse the repository at this point in the history
…automatically
  • Loading branch information
Natlies committed Aug 22, 2021
1 parent b5c7166 commit a236aca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions empires-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def post_gateway():
elif reqq.functionName == 'WorldService.updateRoads':
resps.append(update_roads_response(reqq.params[0]))
elif reqq.functionName == 'UserService.streamPublish':
resps.append(stream_publish_response())
resps.append(stream_publish_response(reqq.params))
elif reqq.functionName == 'WorldService.stopMayhemEvent':
resps.append(stop_mayhem_response())
elif reqq.functionName == 'UserService.saveOptions':
Expand Down Expand Up @@ -1971,8 +1971,10 @@ def update_roads_response(roads):
return update_roads_response


def stream_publish_response():
stream_publish_response = {"errorType": 0, "userId": 1, "metadata": {"newPVE": 0},
def stream_publish_response(params):
meta = {"newPVE": 0}
handle_quest_progress(meta, progress_feed(params[0]))
stream_publish_response = {"errorType": 0, "userId": 1, "metadata": meta,
"data": []}
return stream_publish_response

Expand Down
7 changes: 7 additions & 0 deletions quest_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ def progress_quest_task(name, index):
progress_total_amount(task["_total"], task["_total"], extra, progress)


def progress_feed(feed_name):
return lambda task, progress, i, extra, quest_name, *args: \
task["_action"] == "feedReceived" and \
task["_feed"] == feed_name and \
progress_total_amount(task["_total"], task["_total"], extra, progress)


def prepopulate_task(task):
if task["_action"] == 'countPlaced' and "_item" in task:
item = lookup_item_by_code(task["_item"])
Expand Down

0 comments on commit a236aca

Please sign in to comment.