-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from avrae/limiteduse-builder
Add LimitedUse gamedata endpoint
- Loading branch information
Showing
6 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Misc endpoints to return gamedata (e.g. entitlements, limited uses) | ||
""" | ||
from flask import Blueprint, request | ||
|
||
from gamedata.compendium import compendium | ||
from lib.utils import success | ||
|
||
gamedata = Blueprint('gamedata', __name__) | ||
|
||
|
||
@gamedata.route("entitlements", methods=["GET"]) | ||
def get_entitlements(): | ||
""" | ||
Gets a dict of all valid entitlements. | ||
Query: free: bool - include free entities? | ||
{type-id -> entitlement} | ||
""" | ||
if 'free' in request.args: | ||
return success({f"{t}-{i}": sourced.to_dict() for (t, i), sourced in compendium.entitlement_lookup.items()}) | ||
return success({f"{t}-{i}": sourced.to_dict() for (t, i), sourced in compendium.entitlement_lookup.items() if | ||
not sourced.is_free}) | ||
|
||
|
||
@gamedata.route("limiteduse", methods=["GET"]) | ||
def get_limited_use(): | ||
"""Returns a list of valid entities for use in building an AbilityReference in the automation builder.""" | ||
return success(compendium.raw_limiteduse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters