コード例 #1
0
    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)
コード例 #2
0
    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))
コード例 #3
0
ファイル: horse.py プロジェクト: yueyoum/sanguo-server
    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
            )
コード例 #4
0
ファイル: horse.py プロジェクト: yueyoum/sanguo-server
    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)
            )