本文整理匯總了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)
示例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)
示例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)
)