From 08ed7098e4df53a8ede5f65e27e77c783edfb901 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 11 Aug 2021 01:14:30 -0300 Subject: Summoning protocol, alpha version (working) --- battle/summons.py | 8 ++++---- protocol.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/battle/summons.py b/battle/summons.py index ff128e1..ec60b7c 100644 --- a/battle/summons.py +++ b/battle/summons.py @@ -28,8 +28,8 @@ def handle_summon(token, summon): global Battle, Player try: - # Log that summon was used - Battle[token]["log"].append(["", 0, SRV_SUMMON, summon["summon_id"], "", 0]) + # Log that summon was used (single action log) + Battle[token]["log"]=[["", 0, SRV_SUMMON, summon["summon_id"], "", 0]] # Summon strength is based on player rank force=summon["strength"]*Player[token]["level"] @@ -77,13 +77,13 @@ def summon(args, token): stdout("All fine thus far") except: # Invalid data - return ERR_SUMMON + return compress(ERR_SUMMON) # Already summoned (reverse logic) try: Battle["s"]+=1 Battle["s"]-=1 - return ERR_SUMMON + return compress(ERR_SUMMON) except: pass diff --git a/protocol.py b/protocol.py index b5327d2..fe71290 100644 --- a/protocol.py +++ b/protocol.py @@ -21,6 +21,7 @@ import utils import player import tavern import battle.main as battle +import battle.summons as summon from consts import ERR_BAD, ERR_DONE, PACKET_NACK, PACKET_ACK, PACKET_REGX # self.data structure: ; ; @@ -106,7 +107,7 @@ def parse(packet, conn): elif data[1] == "recruit": r=tavern.recruit(data[2], t) elif data[1] == "summon": - r=battle.summon(data[2], t) + r=summon.summon(data[2], t) else: r=ERR_BAD -- cgit v1.2.3-70-g09d2