def send_update_notify(self, _id, h): hobj = OneHorse(int(_id), h.oid, h.attack, h.defense, h.hp) msg = HorsesUpdateNotify() msg.horse.MergeFrom(hobj.make_msg()) publish_to_char(self.char_id, pack_msg(msg)) f = Formation(self.char_id) socket = f.find_socket_by_horse(int(_id)) if socket: socket_changed_signal.send(sender=None, socket_obj=socket)
def check_sell(self, horse_id): if not self.has_horse(horse_id): raise SanguoException(errormsg.HORSE_NOT_EXIST, self.char_id, "Horse Check Sell", "horse {0} not exist".format(horse_id)) f = Formation(self.char_id) if f.find_socket_by_horse(horse_id): raise SanguoException( errormsg.HORSE_CAN_NOT_SELL_IN_FORMATION, self.char_id, "Horse Check Sell", "horse {0} in formation, can not sell".format(horse_id))
def send_update_notify(self, _id, h): hobj = OneHorse(int(_id), h.oid, h.attack, h.defense, h.hp) msg = HorsesUpdateNotify() msg.horse.MergeFrom(hobj.make_msg()) publish_to_char(self.char_id, pack_msg(msg)) f = Formation(self.char_id) socket = f.find_socket_by_horse(int(_id)) if socket: socket_changed_signal.send( sender=None, socket_obj=socket )
def check_sell(self, horse_id): if not self.has_horse(horse_id): raise SanguoException( errormsg.HORSE_NOT_EXIST, self.char_id, "Horse Check Sell", "horse {0} not exist".format(horse_id) ) f = Formation(self.char_id) if f.find_socket_by_horse(horse_id): raise SanguoException( errormsg.HORSE_CAN_NOT_SELL_IN_FORMATION, self.char_id, "Horse Check Sell", "horse {0} in formation, can not sell".format(horse_id) )