本文整理汇总了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)
)