本文整理匯總了Python中core.formation.Formation.open_socket方法的典型用法代碼示例。如果您正苦於以下問題:Python Formation.open_socket方法的具體用法?Python Formation.open_socket怎麽用?Python Formation.open_socket使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.formation.Formation
的用法示例。
在下文中一共展示了Formation.open_socket方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: trig
# 需要導入模塊: from core.formation import Formation [as 別名]
# 或者: from core.formation.Formation import open_socket [as 別名]
def trig(self, char_level, stage_id=None):
try:
s = MongoStage.objects.get(id=self.char_id)
passed_stages = s.stages.keys()
except DoesNotExist:
passed_stages = []
passed_stages.append('0')
if stage_id:
passed_stages.append(str(stage_id))
opened_funcs = []
for func_id in self.mf.freeze[:]:
try:
this_func = FUNCTION_DEFINE[func_id]
except KeyError:
self.mf.freeze.remove(func_id)
continue
if char_level >= this_func.char_level and str(this_func.stage_id) in passed_stages:
# OPEN
self.mf.freeze.remove(func_id)
opened_funcs.append(func_id)
self.mf.save()
f = Formation(self.char_id)
for of in opened_funcs[:]:
if of in FUNC_SOCKET_AMOUNT_TABLE:
opened = f.open_socket(FUNC_SOCKET_AMOUNT_TABLE[of])
if not opened:
opened_funcs.remove(of)
return opened_funcs