Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # >> IMPORTS
- # =============================================================================
- # Flask-MOTDPlayer
- from motdplayer import WebRequestProcessor
- # =============================================================================
- # >> WEB REQUEST PROCESSORS
- # =============================================================================
- wrp_shop_page = WebRequestProcessor('warcraft', 'shop')
- # =============================================================================
- # >> WEB REQUEST PROCESSOR CALLBACKS
- # =============================================================================
- # shop_page
- @wrp_shop_page.register_regular_callback
- def callback(ex_data_func):
- response = ex_data_func({
- 'action': "get-items"
- })
- context = {
- 'available_items': response['availableItems']
- }
- return "warcraft/shop.html", context
- @wrp_shop_page.register_ajax_callback
- def callback(ex_data_func, data):
- if data['action'] != "buy-item":
- return
- if 'itemId' not in data:
- return
- item_id = data['itemId']
- if not isinstance(item_id, str):
- return
- item_id = item_id[:32] # От доса большими данными
- ex_data_func({
- 'action': "buy-item",
- 'itemId': item_id,
- })
- return {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement