def tag_change(self, tag, value): global lastPlayer if self.id == 3: lastPlayer = "The Innkeeper" else: lastPlayer = "Learner#11393" if tag == GameTag.CONTROLLER and not self._initial_controller: self._initial_controller = self.tags.get(GameTag.CONTROLLER, value) self.tags[tag] = value terminal_output("TAG UPDATED", self, tag, value) # push data to an end-point pass
def game(self, value): # this happens when game calls register_entity and entity sets self.game self._game = value if value is not None: if (self.id < 34): self.ownerstr = "Learner#11393" #self.tags[GameTag.CONTROLLER] = "Learner#11393" elif (self.id < 64): self.ownerstr = "The Innkeeper" #self.tags[GameTag.CONTROLLER] = "The Innkeeper" else: global lastPlayer self.ownerstr = lastPlayer #self.tags[GameTag.CONTROLLER] = lastPlayer terminal_output("ENTITY CREATED", self, self.controller) # push data to an end-point pass
def handle_option(self, packet): isHero = False #id represents the id of the option or the suboption if (packet.entity == 66) | (packet.entity == 64) | (packet.entity == 65): isHero = True #viable options which are not end turn if not packet.error: current_entity = self.game.find_entity_by_id(packet.entity) #suboptions don't have a type if not packet.type: if isHero: terminal_output("TARGET LISTED", packet.entity) else: terminal_output( "TARGET LISTED", current_entity, current_entity.tags.get(GameTag.ZONE_POSITION), current_entity.ownerstr) else: if isHero: terminal_output("OPTION LISTED", packet.entity) else: terminal_output( "OPTION LISTED", current_entity.zone, current_entity.tags.get(GameTag.ZONE_POSITION), packet.id) #option end turn if packet.type == 2: terminal_output("END TURN", packet.ts, packet.type, packet.id)
def update_callback(self, caller): terminal_output("ENTITY UPDATED", self, self.zone, self.ownerstr) # push data to an end-point pass
def handle_send_option(self, packet): terminal_output("sendoptions", packet.target, packet.position, packet.suboption)