当前位置: 首页>>代码示例>>Python>>正文


Python Formation.find_socket_by_equip方法代码示例

本文整理汇总了Python中core.formation.Formation.find_socket_by_equip方法的典型用法代码示例。如果您正苦于以下问题:Python Formation.find_socket_by_equip方法的具体用法?Python Formation.find_socket_by_equip怎么用?Python Formation.find_socket_by_equip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.formation.Formation的用法示例。


在下文中一共展示了Formation.find_socket_by_equip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: equip_sell

# 需要导入模块: from core.formation import Formation [as 别名]
# 或者: from core.formation.Formation import find_socket_by_equip [as 别名]
    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)
开发者ID:wyrover,项目名称:sanguo-server,代码行数:33,代码来源:item.py

示例2: _equip_changed

# 需要导入模块: from core.formation import Formation [as 别名]
# 或者: from core.formation.Formation import find_socket_by_equip [as 别名]
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)
开发者ID:yaosj,项目名称:sanguo-server,代码行数:10,代码来源:item.py

示例3: equip_check_sell

# 需要导入模块: from core.formation import Formation [as 别名]
# 或者: from core.formation.Formation import find_socket_by_equip [as 别名]
    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)
                )
开发者ID:yueyoum,项目名称:sanguo-server,代码行数:24,代码来源:item.py


注:本文中的core.formation.Formation.find_socket_by_equip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。