Example #1
0
    def after_staff_change(self, staff_id, force_load_staffs=False):
        # force_load_staffs: 只有这个staff的改变可能会影响到其他staff的时候,才为True
        from core.club import Club
        from core.plunder import Plunder
        from core.championship import Championship

        if force_load_staffs:
            Club(self.server_id, self.char_id, load_staffs=False).force_load_staffs(send_notify=True)
        else:
            Club(self.server_id, self.char_id).send_notify()

        p = Plunder(self.server_id, self.char_id)
        if p.find_way_id_by_staff_id(staff_id):
            p.send_formation_notify()

        c = Championship(self.server_id, self.char_id)
        if c.find_way_id_by_staff_id(staff_id):
            c.send_formation_notify()
Example #2
0
    def after_staff_change(self, staff_id, force_load_staffs=False):
        # force_load_staffs: 只有这个staff的改变可能会影响到其他staff的时候,才为True
        from core.club import Club
        from core.plunder import Plunder
        from core.championship import Championship

        if force_load_staffs:
            Club(self.server_id, self.char_id,
                 load_staffs=False).force_load_staffs(send_notify=True)
        else:
            Club(self.server_id, self.char_id).send_notify()

        p = Plunder(self.server_id, self.char_id)
        if p.find_way_id_by_staff_id(staff_id):
            p.send_formation_notify()

        c = Championship(self.server_id, self.char_id)
        if c.find_way_id_by_staff_id(staff_id):
            c.send_formation_notify()
Example #3
0
    def after_change(self, uid):
        from core.formation import Formation
        from core.plunder import Plunder
        from core.championship import Championship

        self.load_units()
        unit = self.get_unit_object(uid)
        all_units = self.get_units_data()

        all_units_object = [
            self.get_unit_object(k) for k, _ in all_units.iteritems()
        ]

        changed_units = {}

        for u in all_units_object:
            if u.config.race == unit.config.race:
                changed_units[u.id] = u

        self.send_notify_with_unit_objs(changed_units.values())

        fm = Formation(self.server_id, self.char_id)

        _changed = False
        for k, v in fm.in_formation_staffs().iteritems():
            if v['unit_id'] in changed_units:
                _changed = True
                break

        if _changed:
            club = Club(self.server_id, self.char_id, load_staffs=False)
            club.force_load_staffs(send_notify=True)

        _p = Plunder(self.server_id, self.char_id)
        if _p.find_way_id_by_unit_id(uid):
            _p.send_formation_notify()

        _c = Championship(self.server_id, self.char_id)
        if _c.find_way_id_by_unit_id(uid):
            _c.send_formation_notify()
Example #4
0
    def after_change(self, uid):
        from core.formation import Formation
        from core.plunder import Plunder
        from core.championship import Championship

        self.load_units()
        unit = self.get_unit_object(uid)
        all_units = self.get_units_data()

        all_units_object = [self.get_unit_object(k) for k, _ in all_units.iteritems()]

        changed_units = {}

        for u in all_units_object:
            if u.config.race == unit.config.race:
                changed_units[u.id] = u

        self.send_notify_with_unit_objs(changed_units.values())

        fm = Formation(self.server_id, self.char_id)

        _changed = False
        for k, v in fm.in_formation_staffs().iteritems():
            if v['unit_id'] in changed_units:
                _changed = True
                break

        if _changed:
            club = Club(self.server_id, self.char_id, load_staffs=False)
            club.force_load_staffs(send_notify=True)

        _p = Plunder(self.server_id, self.char_id)
        if _p.find_way_id_by_unit_id(uid):
            _p.send_formation_notify()

        _c = Championship(self.server_id, self.char_id)
        if _c.find_way_id_by_unit_id(uid):
            _c.send_formation_notify()
Example #5
0
def game_start_handler(server_id, char_id, **kwargs):
    MessagePipe(char_id).clean()

    msg = UTCNotify()
    msg.timestamp = arrow.utcnow().timestamp
    MessagePipe(char_id).put(msg=msg)

    msg = SocketServerNotify()
    ss = random.choice(settings.SOCKET_SERVERS)
    msg.ip = ss['host']
    msg.port = ss['tcp']
    MessagePipe(char_id).put(msg=msg)

    _Resource.send_notify(server_id, char_id)

    UnitManager(server_id, char_id).send_notify()

    Bag(server_id, char_id).send_notify()

    StaffManger(server_id, char_id).send_notify()
    StaffRecruit(server_id, char_id).send_notify()

    f = Formation(server_id, char_id)
    f.send_formation_notify()
    f.send_slot_notify()

    club = Club(server_id, char_id)
    club.set_login()
    club.send_notify()

    msg = CreateDaysNotify()
    msg.days = days_passed(club.create_at)
    msg.create_at = club.create_at
    MessagePipe(char_id).put(msg=msg)

    chall = Challenge(server_id, char_id)
    chall.send_chapter_notify()
    chall.send_challenge_notify()

    FriendManager(server_id, char_id).send_notify()
    MailManager(server_id, char_id).send_notify()

    TaskMain(server_id, char_id).send_notify()
    TaskDaily(server_id, char_id).send_notify()

    Chat(server_id, char_id).send_notify()

    Notification(server_id, char_id).send_notify()

    FinanceStatistics(server_id, char_id).send_notify()

    TalentManager(server_id, char_id).send_notify()

    Dungeon(server_id, char_id).send_notify()

    a = Arena(server_id, char_id)
    a.send_notify()
    a.send_honor_notify()

    t = Tower(server_id, char_id)
    t.send_notify()
    t.send_goods_notify()

    Territory(server_id, char_id).send_notify()
    TerritoryStore(server_id, char_id).send_notify()
    TerritoryFriend(server_id, char_id).send_remained_times_notify()

    Store(server_id, char_id).send_notify()
    VIP(server_id, char_id).send_notify()
    Collection(server_id, char_id).send_notify()

    Energy(server_id, char_id).send_notify()

    w = Welfare(server_id, char_id)
    w.send_signin_notify()
    w.send_new_player_notify()
    w.send_level_reward_notify()
    w.send_energy_reward_notify()

    Union(server_id, char_id).send_all_notify()

    Purchase(server_id, char_id).send_notify()

    ac = ActivityNewPlayer(server_id, char_id)
    ac.send_notify()
    ac.send_daily_buy_notify()

    ActivityOnlineTime(server_id, char_id).send_notify()
    ActivityChallenge(server_id, char_id).send_notify()
    ActivityPurchaseDaily(server_id, char_id).send_notify()
    ActivityPurchaseContinues(server_id, char_id).send_notify()
    ActivityLevelGrowing(server_id, char_id).send_notify()

    p = Plunder(server_id, char_id)

    p.send_search_notify()
    p.send_result_notify()
    p.send_revenge_notify()
    p.send_station_notify()
    p.send_formation_notify()
    p.send_plunder_times_notify()
    p.send_plunder_daily_reward_notify()

    SpecialEquipmentGenerator(server_id, char_id).send_notify()

    Party(server_id, char_id).send_notify()

    ins = Inspire(server_id, char_id)
    ins.try_open_slots(send_notify=False)
    ins.send_notify()

    cs = Championship(server_id, char_id)
    cs.try_initialize(send_notify=False)
    cs.send_notify()

    WinningPlunder(server_id, char_id).send_notify()
    WinningArena(server_id, char_id).send_notify()
    WinningChampionship(server_id, char_id).send_notify()
    Worship(server_id, char_id).send_notify()
    CommonArenaWinningChat(server_id, char_id).send_notify()
    CommonPlunderWinningChat(server_id, char_id).send_notify()
    CommonChampionshipChat(server_id, char_id).send_notify()

    send_system_notify(server_id, char_id)
    BroadCast(server_id, char_id).try_cast_login_notify()
Example #6
0
def game_start_handler(server_id, char_id, **kwargs):
    MessagePipe(char_id).clean()

    msg = UTCNotify()
    msg.timestamp = arrow.utcnow().timestamp
    MessagePipe(char_id).put(msg=msg)


    msg = SocketServerNotify()
    ss = random.choice(settings.SOCKET_SERVERS)
    msg.ip = ss['host']
    msg.port = ss['tcp']
    MessagePipe(char_id).put(msg=msg)

    _Resource.send_notify(server_id, char_id)

    UnitManager(server_id, char_id).send_notify()

    Bag(server_id, char_id).send_notify()

    StaffManger(server_id, char_id).send_notify()
    StaffRecruit(server_id, char_id).send_notify()

    f = Formation(server_id, char_id)
    f.send_formation_notify()
    f.send_slot_notify()

    club = Club(server_id, char_id)
    club.set_login()
    club.send_notify()

    msg = CreateDaysNotify()
    msg.days = days_passed(club.create_at)
    msg.create_at = club.create_at
    MessagePipe(char_id).put(msg=msg)

    chall = Challenge(server_id, char_id)
    chall.send_chapter_notify()
    chall.send_challenge_notify()

    FriendManager(server_id, char_id).send_notify()
    MailManager(server_id, char_id).send_notify()

    TaskMain(server_id, char_id).send_notify()
    TaskDaily(server_id, char_id).send_notify()

    Chat(server_id, char_id).send_notify()

    Notification(server_id, char_id).send_notify()

    FinanceStatistics(server_id, char_id).send_notify()

    TalentManager(server_id, char_id).send_notify()

    Dungeon(server_id, char_id).send_notify()

    a = Arena(server_id, char_id)
    a.send_notify()
    a.send_honor_notify()

    t = Tower(server_id, char_id)
    t.send_notify()
    t.send_goods_notify()

    Territory(server_id, char_id).send_notify()
    TerritoryStore(server_id, char_id).send_notify()
    TerritoryFriend(server_id, char_id).send_remained_times_notify()

    Store(server_id, char_id).send_notify()
    VIP(server_id, char_id).send_notify()
    Collection(server_id, char_id).send_notify()

    Energy(server_id, char_id).send_notify()

    w = Welfare(server_id, char_id)
    w.send_signin_notify()
    w.send_new_player_notify()
    w.send_level_reward_notify()
    w.send_energy_reward_notify()

    Union(server_id, char_id).send_all_notify()

    Purchase(server_id, char_id).send_notify()

    ac = ActivityNewPlayer(server_id, char_id)
    ac.send_notify()
    ac.send_daily_buy_notify()

    ActivityOnlineTime(server_id, char_id).send_notify()
    ActivityChallenge(server_id, char_id).send_notify()
    ActivityPurchaseDaily(server_id, char_id).send_notify()
    ActivityPurchaseContinues(server_id, char_id).send_notify()
    ActivityLevelGrowing(server_id, char_id).send_notify()

    p = Plunder(server_id, char_id)

    p.send_search_notify()
    p.send_result_notify()
    p.send_revenge_notify()
    p.send_station_notify()
    p.send_formation_notify()
    p.send_plunder_times_notify()
    p.send_plunder_daily_reward_notify()

    SpecialEquipmentGenerator(server_id, char_id).send_notify()

    Party(server_id, char_id).send_notify()

    ins = Inspire(server_id, char_id)
    ins.try_open_slots(send_notify=False)
    ins.send_notify()

    cs = Championship(server_id, char_id)
    cs.try_initialize(send_notify=False)
    cs.send_notify()

    WinningPlunder(server_id, char_id).send_notify()
    WinningArena(server_id, char_id).send_notify()
    WinningChampionship(server_id, char_id).send_notify()
    Worship(server_id, char_id).send_notify()
    CommonArenaWinningChat(server_id, char_id).send_notify()
    CommonPlunderWinningChat(server_id, char_id).send_notify()
    CommonChampionshipChat(server_id, char_id).send_notify()

    send_system_notify(server_id, char_id)
    BroadCast(server_id, char_id).try_cast_login_notify()