本文整理匯總了Python中core.formation.Formation.sync_slots方法的典型用法代碼示例。如果您正苦於以下問題:Python Formation.sync_slots方法的具體用法?Python Formation.sync_slots怎麽用?Python Formation.sync_slots使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.formation.Formation
的用法示例。
在下文中一共展示了Formation.sync_slots方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: start
# 需要導入模塊: from core.formation import Formation [as 別名]
# 或者: from core.formation.Formation import sync_slots [as 別名]
def start(self, dungeon_id, formation_slots=None):
grade_conf = ConfigDungeonGrade.get(dungeon_id)
if not grade_conf:
raise GameException(ConfigErrorMessage.get_error_id("DUNGEON_NOT_EXIST"))
map_name = ConfigDungeon.get(grade_conf.belong).map_name
club_level = get_club_property(self.server_id, self.char_id, 'level')
if grade_conf.need_level > club_level:
raise GameException(ConfigErrorMessage.get_error_id("DUNGEON_CLUB_LEVEL_NOT_ENOUGH"))
f = Formation(self.server_id, self.char_id)
if formation_slots:
f.sync_slots(formation_slots)
Energy(self.server_id, self.char_id).check(ConfigDungeon.get(grade_conf.belong).cost)
ri = TimesInfo(self.server_id, self.char_id, grade_conf.belong)
if not ri.remained_match_times:
# 購買
self.buy_times(grade_conf.belong)
club_one = Club(self.server_id, self.char_id)
club_two = ConfigNPCFormation.get(grade_conf.npc)
msg = ClubMatch(club_one, club_two, 6, f.get_skill_sequence(), {}).start()
msg.key = str(dungeon_id)
msg.map_name = map_name
return msg
示例2: start
# 需要導入模塊: from core.formation import Formation [as 別名]
# 或者: from core.formation.Formation import sync_slots [as 別名]
def start(self, challenge_id, formation_slots=None):
config = ConfigChallengeMatch.get(challenge_id)
if not config:
raise GameException(ConfigErrorMessage.get_error_id("CHALLENGE_NOT_EXIST"))
if config.condition_challenge:
doc = MongoChallenge.db(self.server_id).find_one(
{'_id': self.char_id},
{'challenge_star.{0}'.format(config.condition_challenge): 1}
)
if str(config.condition_challenge) not in doc['challenge_star']:
raise GameException(ConfigErrorMessage.get_error_id("CHALLENGE_NOT_OPEN"))
rt = RemainedTimes(self.server_id, self.char_id, challenge_id)
if not rt.remained_match_times:
raise GameException(ConfigErrorMessage.get_error_id("CHALLENGE_WITHOUT_TIMES"))
f = Formation(self.server_id, self.char_id)
if formation_slots:
f.sync_slots(formation_slots)
Energy(self.server_id, self.char_id).check(config.energy)
club_one = Club(self.server_id, self.char_id)
club_two = ChallengeNPCClub(challenge_id)
match = ClubMatch(club_one, club_two, 6, f.get_skill_sequence(), {})
msg = match.start()
msg.key = str(challenge_id)
msg.map_name = config.map_name
return msg
示例3: match_start
# 需要導入模塊: from core.formation import Formation [as 別名]
# 或者: from core.formation.Formation import sync_slots [as 別名]
def match_start(self, key, formation_slots=None):
try:
friend_id, building_id, event_id = key.split(':')
friend_id = int(friend_id)
building_id = int(building_id)
event_id = int(event_id)
except:
raise GameException(ConfigErrorMessage.get_error_id("BAD_MESSAGE"))
f = Formation(self.server_id, self.char_id)
if formation_slots:
f.sync_slots(formation_slots)
config = ConfigTerritoryEvent.get(event_id)
npc_club = ConfigNPCFormation.get(config.npc)
my_club = Club(self.server_id, self.char_id)
match = ClubMatch(my_club, npc_club, 6, f.get_skill_sequence(), {})
msg = match.start()
msg.key = "{0}:{1}:{2}".format(friend_id, building_id, event_id)
msg.map_name = GlobalConfig.value_string("MATCH_MAP_TERRITORY_FRIEND")
return msg
示例4: match
# 需要導入模塊: from core.formation import Formation [as 別名]
# 或者: from core.formation.Formation import sync_slots [as 別名]
def match(self, formation_slots=None):
sweep_end_at = self.doc.get('sweep_end_at', 0)
if sweep_end_at:
raise GameException(ConfigErrorMessage.get_error_id("TOWER_IN_SWEEP_CANNOT_OPERATE"))
level = self.get_current_level()
if not level:
raise GameException(ConfigErrorMessage.get_error_id("TOWER_ALREADY_ALL_PASSED"))
f = Formation(self.server_id, self.char_id)
if formation_slots:
f.sync_slots(formation_slots)
config = ConfigTowerLevel.get(level)
club_one = Club(self.server_id, self.char_id)
if config.talent_id:
club_one.add_talent_effects([config.talent_id])
club_two = config.make_club()
if not club_one.formation_staffs:
club_one.load_staffs()
if not club_two.formation_staffs:
club_two.load_staffs()
club_one.add_tower_temporary_talent_effects()
club_one.make_temporary_staff_calculate()
club_two.add_tower_temporary_talent_effects()
club_two.make_temporary_staff_calculate()
club_match = ClubMatch(club_one, club_two, 6, f.get_skill_sequence(), {})
msg = club_match.start()
msg.key = str(level)
msg.map_name = config.map_name
return msg
示例5: match
# 需要導入模塊: from core.formation import Formation [as 別名]
# 或者: from core.formation.Formation import sync_slots [as 別名]
def match(self, formation_slots=None):
doc = MongoArena.db(self.server_id).find_one(
{'_id': str(self.char_id)},
{'rival': 1}
)
rival_id = doc['rival']
if not rival_id:
raise GameException(ConfigErrorMessage.get_error_id("ARENA_MATCH_NO_RIVAL"))
f = Formation(self.server_id, self.char_id)
if formation_slots:
f.sync_slots(formation_slots)
self.check_and_buy_times()
club_one = Club(self.server_id, self.char_id)
club_two = ArenaClub(self.server_id, rival_id)
club_match = ClubMatch(club_one, club_two, 6, f.get_skill_sequence(), {})
msg = club_match.start()
msg.key = rival_id
msg.map_name = GlobalConfig.value_string("MATCH_MAP_ARENA")
return msg