From 251f016a921e3346948e0521695d66342cd41d8a Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 11 Aug 2021 01:14:47 -0300 Subject: Summoning Protocol, Initial version (working) Summon is currently hard-coded. Expansion required. --- game/01_init.rpy | 1 + game/battle.rpy | 6 +++++- game/quest.rpy | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/game/01_init.rpy b/game/01_init.rpy index 1a774bc..4d91263 100644 --- a/game/01_init.rpy +++ b/game/01_init.rpy @@ -69,6 +69,7 @@ init -3 python: ERR_TIMEOUT=104 ERR_NOGEMS=105 ERR_INVFULL=106 + ERR_SUMMON=108 ERR_OK=200 # All error code library diff --git a/game/battle.rpy b/game/battle.rpy index 1d99471..1f207a3 100644 --- a/game/battle.rpy +++ b/game/battle.rpy @@ -107,11 +107,15 @@ label combat: if (do_action == ACT_TURN): $ response=loadbattle(Battle["party"]) elif (do_action == ACT_SUMMON): - $ response=Battle + $ response=loadsummon() else: $ stdout("INVALID ACTION CODE: %d" % do_action) jump combat + # Maybe nothing happened + if response == ERR_SUMMON: + $ response = Battle + # Maybe we error'ed out and should relog if (response in [FAILUREMSG, OFFLINEMSG, ERR_JSONDECODER, ERR_LOGIN_DEFAULT]): $ renpy.call_screen("msgbox", "Error:\n\n%s" % response) diff --git a/game/quest.rpy b/game/quest.rpy index 2185450..b0af279 100644 --- a/game/quest.rpy +++ b/game/quest.rpy @@ -36,6 +36,16 @@ init python: return ERR_JSONDECODER return bt + def loadsummon(): + global Battle + # FIXME: Retrieve summon ID, etc + raw=send_packet("summon", "[1]") + + bt=json_decode(raw) + if (bt == ERR_JSONDECODER): + return ERR_JSONDECODER + return bt + ################################################################### # TODO: Quest menus and selections should be auto-generated # World map structure: ["name", min_level, {quest1}, {quest2} ...] -- cgit v1.2.3-70-g09d2