def reset():
    logger = Logger('reset_friend_plunder_times.log')
    for f in MongoFriend.objects.all():
        friend = Friend(f.id)
        friend.daily_plunder_times_reset()

    logger.write("Friend Plunder Times Reset Done")
    logger.close()
Beispiel #2
0
def reset():
    logger = Logger('reset_friend_plunder_times.log')
    for f in MongoFriend.objects.all():
        friend = Friend(f.id)
        friend.daily_plunder_times_reset()

    logger.write("Friend Plunder Times Reset Done")
    logger.close()
Beispiel #3
0
    def test_normal_cancel(self):
        self._add(self.char_two_id)

        self._cancel(self.char_two_id)

        f = Friend(self.char_id)
        self.assertEqual(len(f.mf.friends), 0)
        f = Friend(self.char_two_id)
        self.assertEqual(len(f.mf.accepting), 0)
        app_test_helper._mongo_teardown_func()
Beispiel #4
0
    def test_norma_refuse(self):
        self._add(self.char_two_id)
        self._refuse(self.char_id, session=self.char_two_session)

        f = Friend(self.char_id)
        self.assertEqual(len(f.mf.friends), 0)

        f = Friend(self.char_two_id)
        self.assertEqual(len(f.mf.accepting), 0)
        self.assertEqual(len(f.mf.friends), 0)
        app_test_helper._mongo_teardown_func()
Beispiel #5
0
    def test_normal_add_id(self):
        self._add(self.char_two_id)

        f = Friend(self.char_id)
        self.assertTrue(str(self.char_two_id) in f.mf.friends)
        self.assertEqual(f.mf.friends[str(self.char_two_id)],
                         protomsg.FRIEND_ACK)

        f = Friend(self.char_two_id)
        self.assertTrue(self.char_id in f.mf.accepting)

        app_test_helper._mongo_teardown_func()
def reset(signum):
    logger = Logger('reset_friend_plunder_times.log')
    logger.write("Start")

    try:
        Friend.cron_job()
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Beispiel #7
0
    def test_normal_terminate(self):
        self._add(self.char_two_id)
        self._accept(self.char_id, session=self.char_two_session)
        self._terminate(self.char_two_id)

        f = Friend(self.char_id)
        self.assertEqual(len(f.mf.friends), 0)

        f = Friend(self.char_two_id)
        self.assertEqual(len(f.mf.friends), 0)

        app_test_helper._mongo_teardown_func()
Beispiel #8
0
def candidate_list(request):
    char_id = request._char_id

    f = Friend(char_id)
    res = f.candidate_list()

    response = protomsg.PlayerListResponse()
    response.ret = 0
    for r in res:
        msg = response.players.add()
        f._msg_friend(msg, r, FRIEND_NOT)

    return pack_msg(response)
Beispiel #9
0
def candidate_list(request):
    char_id = request._char_id

    f = Friend(char_id)
    res = f.candidate_list()

    response = protomsg.PlayerListResponse()
    response.ret = 0
    for r in res:
        msg = response.players.add()
        f._msg_friend(msg, r, FRIEND_NOT)

    return pack_msg(response)
Beispiel #10
0
    def test_normal_accept(self):
        self._add(self.char_two_id)
        self._accept(self.char_id, ret=0, session=self.char_two_session)

        f = Friend(self.char_id)
        self.assertTrue(str(self.char_two_id) in f.mf.friends)
        self.assertEqual(f.mf.friends[str(self.char_two_id)],
                         protomsg.FRIEND_OK)

        f = Friend(self.char_two_id)
        self.assertTrue(str(self.char_id) in f.mf.friends)
        self.assertEqual(f.mf.friends[str(self.char_id)], protomsg.FRIEND_OK)

        app_test_helper._mongo_teardown_func()
Beispiel #11
0
def login_notify(char_id):
    hero_objs = char_heros_obj(char_id)

    Char(char_id).send_notify()

    hero_notify(char_id, hero_objs)
    Item(char_id).send_notify()

    f = Formation(char_id)
    f.send_socket_notify()
    f.send_formation_notify()

    hang = Hang(char_id)
    hang.send_notify()

    Plunder(char_id).send_notify()

    p = Prison(char_id)
    p.send_prisoners_notify()

    Arena(char_id).send_notify()

    f = Friend(char_id)
    f.send_friends_notify()
    f.send_friends_amount_notify()

    m = Mail(char_id)
    m.send_mail_notify()

    CheckIn(char_id).send_notify()


    stage = Stage(char_id)
    stage.send_already_stage_notify()
    stage.send_new_stage_notify()

    stage_elite = EliteStage(char_id)
    stage_elite.send_notify()
    stage_elite.send_remained_times_notify()

    stage_activity = ActivityStage(char_id)
    stage_activity.send_notify()
    stage_activity.send_remained_times_notify()

    HeroPanel(char_id).send_notify()
    Task(char_id).send_notify()
    Achievement(char_id).send_notify()
    HeroSoul(char_id).send_notify()
    FunctionOpen(char_id).send_notify()
    Levy(char_id).send_notify()
    Attachment(char_id).send_notify()
Beispiel #12
0
def cancel(request):
    req = request._proto
    f = Friend(request._char_id)
    f.cancel(req.id)
    return None
Beispiel #13
0
def login_notify(char_id):
    message_clean(char_id)
    function_open = FunctionOpen(char_id)
    function_open.send_notify()

    hero_objs = char_heros_obj(char_id)

    Char(char_id).send_notify()
    VIP(char_id).send_notify()

    hero_notify(char_id, hero_objs)
    Item(char_id).send_notify()

    f = Formation(char_id)
    f.send_socket_notify()
    f.send_formation_notify()

    Plunder(char_id).send_notify()

    p = Prison(char_id)
    p.send_prisoners_notify()

    a = Arena(char_id)
    a.send_notify()
    a.login_process()

    f = Friend(char_id)
    f.send_friends_notify()
    f.send_friends_amount_notify()

    CheckIn(char_id).send_notify()

    stage = Stage(char_id)
    stage.send_already_stage_notify()
    stage.send_new_stage_notify()

    stage_elite = EliteStage(char_id)
    stage_elite.send_notify()
    stage_elite.send_times_notify()

    stage_activity = ActivityStage(char_id)
    stage_activity.check(send_notify=False)
    stage_activity.send_notify()
    stage_activity.send_remained_times_notify()

    HeroPanel(char_id).send_notify()
    Task(char_id).send_notify()
    Achievement(char_id).send_notify()
    HeroSoul(char_id).send_notify()
    Levy(char_id).send_notify()
    Attachment(char_id).send_notify()

    BasePurchaseAction(char_id).send_notify()

    SystemBroadcast(char_id).send_global_broadcast()
    ChatMessagePublish(char_id).send_notify()

    affairs = Affairs(char_id)
    affairs.send_city_notify()
    affairs.send_hang_notify()

    HorseFreeTimesManager(char_id).send_notify()
    Horse(char_id).send_notify()

    union.send_notify(char_id)

    ae = ActivityEntry(char_id, 50006)
    if ae and ae.is_valid():
        ae.enable(ae.get_current_value(char_id))

    ActivityStatic(char_id).send_notify()

    # mail notify 要放在最后,因为 其他功能初始化时可能会产生登录邮件
    Mail(char_id).send_notify()
Beispiel #14
0
def get_plunder_times(request):
    req = request._proto
    f = Friend(request._char_id)
    f.get_plunder_times(req.friend_id)
    return None
Beispiel #15
0
def add(request):
    req = request._proto
    f = Friend(request._char_id)
    f.add(req.id, req.name)
    return None
Beispiel #16
0
def login_notify(char_id):
    message_clean(char_id)
    function_open = FunctionOpen(char_id)
    function_open.send_notify()

    hero_objs = char_heros_obj(char_id)

    Char(char_id).send_notify()

    hero_notify(char_id, hero_objs)
    Item(char_id).send_notify()

    f = Formation(char_id)
    f.send_socket_notify()
    f.send_formation_notify()

    Plunder(char_id).send_notify()

    p = Prison(char_id)
    p.send_prisoners_notify()

    if Arena.FUNC_ID not in function_open.mf.freeze:
        arena = Arena(char_id)
        arena.send_notify()
        arena.login_process()

    f = Friend(char_id)
    f.send_friends_notify()
    f.send_friends_amount_notify()

    CheckIn(char_id).send_notify()

    stage = Stage(char_id)
    stage.send_already_stage_notify()
    stage.send_new_stage_notify()

    stage_elite = EliteStage(char_id)
    stage_elite.send_notify()
    stage_elite.send_remained_times_notify()

    stage_activity = ActivityStage(char_id)
    stage_activity.send_notify()
    stage_activity.send_remained_times_notify()

    HeroPanel(char_id).send_notify()
    Task(char_id).send_notify()
    Achievement(char_id).send_notify()
    HeroSoul(char_id).send_notify()
    Levy(char_id).send_notify()
    Attachment(char_id).send_notify()

    PurchaseAction(char_id).send_notify()

    SystemBroadcast(char_id).send_global_broadcast()

    affairs = Affairs(char_id)
    affairs.send_city_notify()
    affairs.send_hang_notify()

    # mail notify 要放在最后,因为 其他功能初始化时可能会产生登录邮件
    Mail(char_id).send_notify()
Beispiel #17
0
def terminate(request):
    req = request._proto
    f = Friend(request._char_id)
    f.terminate(req.id)
    return None
Beispiel #18
0
def get_plunder_times(request):
    req = request._proto
    f = Friend(request._char_id)
    f.get_plunder_times(req.friend_id)
    return None
Beispiel #19
0
def add(request):
    req = request._proto
    f = Friend(request._char_id)
    f.add(req.id, req.name)
    return None
Beispiel #20
0
def refuse(request):
    req = request._proto
    f = Friend(request._char_id)
    f.refuse(req.id)
    return None
Beispiel #21
0
def cancel(request):
    req = request._proto
    f = Friend(request._char_id)
    f.cancel(req.id)
    return None
Beispiel #22
0
def terminate(request):
    req = request._proto
    f = Friend(request._char_id)
    f.terminate(req.id)
    return None
Beispiel #23
0
def accept(request):
    req = request._proto
    f = Friend(request._char_id)
    f.accept(req.id)
    return None
Beispiel #24
0
def accept(request):
    req = request._proto
    f = Friend(request._char_id)
    f.accept(req.id)
    return None
Beispiel #25
0
def refuse(request):
    req = request._proto
    f = Friend(request._char_id)
    f.refuse(req.id)
    return None
Beispiel #26
0
def refresh(request):
    f = Friend(request._char_id)
    f.send_friends_notify()
    return None
Beispiel #27
0
def refresh(request):
    f = Friend(request._char_id)
    f.send_friends_notify()
    return None