Ejemplo n.º 1
0
    def send_notify(self):
        msg = TaskNotify()
        for t in self.task.doing:
            this_task = TASKS[t]
            if this_task.func and not func_opened(self.char_id, this_task.func):
                # 对于没有开放功能的任务不显示
                continue

            msg_t = msg.tasks.add()
            msg_t.id = t

            current_times = self.task.tasks[str(this_task.tp)]
            if current_times > this_task.times:
                current_times = this_task.times

            msg_t.current_times = current_times

            if t in self.task.complete:
                status = MsgTask.COMPLETE
            elif t in self.task.finished:
                status = MsgTask.REWARD
            else:
                status = MsgTask.DOING

            msg_t.status = status

        publish_to_char(self.char_id, pack_msg(msg))
Ejemplo n.º 2
0
    def send_notify(self):
        msg = TaskNotify()
        for t in self.task.doing:
            this_task = TASKS[t]
            if this_task.func and not func_opened(self.char_id,
                                                  this_task.func):
                # 对于没有开放功能的任务不显示
                continue

            msg_t = msg.tasks.add()
            msg_t.id = t

            current_times = self.task.tasks[str(this_task.tp)]
            if current_times > this_task.times:
                current_times = this_task.times

            msg_t.current_times = current_times

            if t in self.task.complete:
                status = MsgTask.COMPLETE
            elif t in self.task.finished:
                status = MsgTask.REWARD
            else:
                status = MsgTask.DOING

            msg_t.status = status

        publish_to_char(self.char_id, pack_msg(msg))
Ejemplo n.º 3
0
 def wrap(request, *args, **kwargs):
     if not func_opened(request._char_id, func_id):
         if mute:
             return None
         raise SanguoException(errormsg.FUNC_FREEZE, request._char_id,
                               "Function Open Check",
                               "func {0} freeze".format(func_id))
     return func(request, *args, **kwargs)
Ejemplo n.º 4
0
    def initialize(self):
        if not func_opened(self.char_id, Arena.FUNC_ID):
            self.mongo_arena = None
            return

        try:
            self.mongo_arena = MongoArena.objects.get(id=self.char_id)
        except DoesNotExist:
            self.mongo_arena = MongoArena(id=self.char_id)
            self.mongo_arena.score = ArenaScoreManager.get_init_score()
            self.mongo_arena.save()
Ejemplo n.º 5
0
 def wrap(request, *args, **kwargs):
     if not func_opened(request._char_id, func_id):
         if mute:
             return None
         raise SanguoException(
             errormsg.FUNC_FREEZE,
             request._char_id,
             "Function Open Check",
             "func {0} freeze".format(func_id)
         )
     return func(request, *args, **kwargs)