當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。