def create(self, ctx, callback=None):
     if not isinstance(ctx, TrainingSettingsCtx):
         LOG_ERROR('Invalid context to create training', ctx)
         if callback is not None:
             callback(False)
     elif not self.canCreate():
         if callback is not None:
             callback(False)
     elif prb_getters.getClientPrebattle() is None or ctx.isForced():
         ctx.startProcessing(callback=callback)
         BigWorld.player().prb_createTraining(ctx.getArenaTypeID(), ctx.getRoundLen(), ctx.isOpened(), ctx.getComment())
         cooldown.setPrbCreationCooldown()
     else:
         LOG_ERROR('First, player has to confirm exit from the current prebattle', prb_getters.getPrebattleType())
         if callback is not None:
             callback(False)
     return
Esempio n. 2
0
 def create(self, ctx, callback=None):
     if not self.canCreate():
         if callback is not None:
             callback(False)
     elif prb_getters.getClientPrebattle() is None or ctx.isForced():
         ctx.startProcessing(callback=callback)
         BigWorld.player().prb_createCompany(ctx.isOpened(),
                                             ctx.getComment(),
                                             ctx.getDivision())
         cooldown.setPrbCreationCooldown()
     else:
         LOG_ERROR(
             'First, player has to confirm exit from the current prebattle',
             prb_getters.getPrebattleType())
         if callback is not None:
             callback(False)
     return