Ejemplo n.º 1
0
    def equip_sell(self, ids):
        if not isinstance(ids, (set, list, tuple)):
            ids = [ids]

        f = Formation(self.char_id)
        ids = set(ids)
        for _id in ids:
            if not self.has_equip(_id):
                raise SanguoException(
                    errormsg.EQUIPMENT_NOT_EXIST,
                    self.char_id,
                    "Equipment Sell",
                    "Equipment {0} NOT exist".format(_id)
                )

            if f.find_socket_by_equip(_id):
                raise SanguoException(
                    errormsg.EQUIPMENT_CANNOT_SELL_FORMATION,
                    self.char_id,
                    "Equipment Sell",
                    "Equipment {0} in Formation, Can not sell".format(_id)
                )

        gold = 0
        for _id in ids:
            e = Equipment(self.char_id, _id, self.item)
            gold += e.sell_gold()

        resource = Resource(self.char_id, "Equipment Sell", "equipments {0}".format(ids))
        resource.check_and_remove(equipments=list(ids))
        resource.add(gold=gold)
Ejemplo n.º 2
0
def _equip_changed(char_id, equip_obj, **kwargs):
    equip_id = equip_obj.equip_id

    f = Formation(char_id)
    socket = f.find_socket_by_equip(equip_id)

    if socket:
        socket_changed_signal.send(sender=None, socket_obj=socket)
Ejemplo n.º 3
0
def _equip_changed(char_id, equip_obj, **kwargs):
    equip_id = equip_obj.equip_id

    f = Formation(char_id)
    socket = f.find_socket_by_equip(equip_id)

    if socket:
        socket_changed_signal.send(sender=None, socket_obj=socket)
Ejemplo n.º 4
0
    def equip_check_sell(self, ids):
        if not isinstance(ids, (set, list, tuple)):
            ids = [ids]

        f = Formation(self.char_id)
        ids = set(ids)
        for _id in ids:
            if not self.has_equip(_id):
                raise SanguoException(errormsg.EQUIPMENT_NOT_EXIST,
                                      self.char_id, "Equipment Check Sell",
                                      "Equipment {0} NOT exist".format(_id))

            if f.find_socket_by_equip(_id):
                raise SanguoException(
                    errormsg.EQUIPMENT_CANNOT_SELL_FORMATION, self.char_id,
                    "Equipment Check Sell",
                    "Equipment {0} in Formation, Can not sell".format(_id))
Ejemplo n.º 5
0
    def equip_check_sell(self, ids):
        if not isinstance(ids, (set, list, tuple)):
            ids = [ids]

        f = Formation(self.char_id)
        ids = set(ids)
        for _id in ids:
            if not self.has_equip(_id):
                raise SanguoException(
                    errormsg.EQUIPMENT_NOT_EXIST,
                    self.char_id,
                    "Equipment Check Sell",
                    "Equipment {0} NOT exist".format(_id)
                )

            if f.find_socket_by_equip(_id):
                raise SanguoException(
                    errormsg.EQUIPMENT_CANNOT_SELL_FORMATION,
                    self.char_id,
                    "Equipment Check Sell",
                    "Equipment {0} in Formation, Can not sell".format(_id)
                )