示例#1
0
def _vip_change(char_id, old_vip, new_vip, **kwargs):
    Prison(char_id).vip_changed(new_vip)
    m = Mail(char_id)
    m.add(name=MAIL_VIP_CHANGED_TITLE, content=MAIL_VIP_CHANGED_CONTENT.format(new_vip))

    # 增加掠夺次数
    plunder_times_change_value = VIP_FUNCTION[new_vip].plunder - VIP_FUNCTION[old_vip].plunder
    if plunder_times_change_value:
        plunder = Plunder(char_id)
        plunder.change_current_plunder_times(plunder_times_change_value, allow_overflow=True)

    vip_activies = []
    if has_activity(22001):
        vip_activies.append(22001)
    if has_activity(40007):
        vip_activies.append(40007)
    if has_activity(40008):
        vip_activies.append(40008)
    if has_activity(50006):
        vip_activies.append(50006)

    if vip_activies:
        ActivityStatic(char_id).send_update_notify(activity_ids=vip_activies)

    ae = ActivityEntry(char_id, 50006)
    if ae and ae.is_valid():
        ae.enable(new_vip)
        ActivityStatic(char_id).send_update_notify(activity_ids=[50006])
示例#2
0
    def get_plunder_times(self, sender_id):
        if sender_id not in self.mf.plunder_senders:
            raise SanguoException(
                errormsg.FRIEND_GET_PLUNDER_TIMES_NOT_EXIST,
                self.char_id,
                "Friend Get Plunder Times",
                "{0} try to get plunder times, buy {1} not give".format(self.char_id, sender_id)
            )

        if sender_id in self.mf.plunder_gots:
            raise SanguoException(
                errormsg.FRIEND_GET_PLUNDER_TIMES_ALREADY_GOT,
                self.char_id,
                "Friend Get Plunder Times",
                "{0} try to get plunder times, buy already got from {1}".format(self.char_id, sender_id)
            )

        if len(self.mf.plunder_gots) >= self.max_amount:
            raise SanguoException(
                errormsg.PLUNDER_GET_TIMES_FULL,
                self.char_id,
                "Friend Get Plunder Times",
                "{0} try to get plunder times, buy already reach max friends amount".format(self.char_id)
            )


        self.mf.plunder_senders.remove(sender_id)
        self.mf.plunder_gots.append(sender_id)
        self.mf.save()

        p = Plunder(self.char_id)
        p.change_current_plunder_times(change_value=1, allow_overflow=True)

        self.send_update_friend_notify(sender_id)
示例#3
0
    def get_plunder_times(self, sender_id):
        if sender_id not in self.mf.plunder_senders:
            raise SanguoException(
                errormsg.FRIEND_GET_PLUNDER_TIMES_NOT_EXIST, self.char_id,
                "Friend Get Plunder Times",
                "{0} try to get plunder times, buy {1} not give".format(
                    self.char_id, sender_id))

        if sender_id in self.mf.plunder_gots:
            raise SanguoException(
                errormsg.FRIEND_GET_PLUNDER_TIMES_ALREADY_GOT, self.char_id,
                "Friend Get Plunder Times",
                "{0} try to get plunder times, buy already got from {1}".
                format(self.char_id, sender_id))

        if len(self.mf.plunder_gots) >= self.max_amount:
            raise SanguoException(
                errormsg.PLUNDER_GET_TIMES_FULL, self.char_id,
                "Friend Get Plunder Times",
                "{0} try to get plunder times, buy already reach max friends amount"
                .format(self.char_id))

        self.mf.plunder_senders.remove(sender_id)
        self.mf.plunder_gots.append(sender_id)
        self.mf.save()

        p = Plunder(self.char_id)
        p.change_current_plunder_times(change_value=1, allow_overflow=True)

        self.send_update_friend_notify(sender_id)
示例#4
0
def search(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    p = Plunder(server_id, char_id)
    p.search()

    response = PlunderSearchResponse()
    response.ret = 0
    return ProtobufResponse(response)
示例#5
0
def _vip_change(char_id, old_vip, new_vip, **kwargs):
    Prison(char_id).vip_changed(new_vip)
    m = Mail(char_id)
    m.add(name=MAIL_VIP_CHANGED_TITLE, content=MAIL_VIP_CHANGED_CONTENT.format(new_vip))

    # 增加掠夺次数
    plunder_times_change_value = VIP_FUNCTION[new_vip].plunder - VIP_FUNCTION[old_vip].plunder
    if plunder_times_change_value:
        plunder = Plunder(char_id)
        plunder.change_current_plunder_times(plunder_times_change_value, allow_overflow=True)
示例#6
0
def main():
    logger = Logger('add_plunder_times.log')
    logger.write("start")
    chars = MongoCharacter.objects.all()
    for char in chars:
        plunder = Plunder(char.id)
        plunder.change_current_plunder_times(change_value=1, allow_overflow=False)

    logger.write("add done")
    logger.close()
示例#7
0
def buy_plunder_times(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    p = Plunder(server_id, char_id)
    p.buy_plunder_times()

    response = PlunderBuyTimesResponse()
    response.ret = 0
    return ProtobufResponse(response)
示例#8
0
def main():
    logger = Logger('add_plunder_times.log')
    logger.write("start")
    chars = MongoCharacter.objects.all()
    for char in chars:
        plunder = Plunder(char.id)
        plunder.change_current_plunder_times(change_value=1,
                                             allow_overflow=False)

    logger.write("add done")
    logger.close()
示例#9
0
def get_station_product(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    p = Plunder(server_id, char_id)
    drop = p.get_station_product()

    response = BaseStationGetProductResponse()
    response.ret = 0
    response.drop.MergeFrom(drop.make_protomsg())
    return ProtobufResponse(response)
示例#10
0
def reset_times(signum):
    logger = Logger("plunder_reset_times.log")
    logger.write("Start")

    try:
        Plunder.cron_job()
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("done")
    finally:
        logger.close()
示例#11
0
def plunder(request):
    char_id = request._char_id

    p = Plunder(char_id)
    msg, drop = p.plunder()

    response = PlunderResponse()
    response.ret = 0
    response.battle.MergeFrom(msg)
    response.drop.MergeFrom(standard_drop_to_attachment_protomsg(drop))

    return pack_msg(response)
示例#12
0
def spy(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    target_id = request._proto.id

    p = Plunder(server_id, char_id)
    p.spy(target_id)

    response = PlunderSpyResponse()
    response.ret = 0
    return ProtobufResponse(response)
示例#13
0
def reset_times(signum):
    logger = Logger("plunder_reset_times.log")
    logger.write("Start")

    try:
        Plunder.cron_job()
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("done")
    finally:
        logger.close()
示例#14
0
def plunder(request):
    req = request._proto
    char_id = request._char_id

    p = Plunder(char_id)
    msg = p.plunder(req.id)

    response = PlunderResponse()
    response.ret = 0
    response.battle.MergeFrom(msg)

    return pack_msg(response)
示例#15
0
def plunder(request):
    req = request._proto
    char_id = request._char_id

    p = Plunder(char_id)
    msg = p.plunder(req.id)

    response = PlunderResponse()
    response.ret = 0
    response.battle.MergeFrom(msg)

    return pack_msg(response)
示例#16
0
def plunder(request):
    char_id = request._char_id

    p = Plunder(char_id)
    msg, drop = p.plunder()

    response = PlunderResponse()
    response.ret = 0
    response.battle.MergeFrom(msg)
    response.drop.MergeFrom(standard_drop_to_attachment_protomsg(drop))

    return pack_msg(response)
示例#17
0
def report(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    key = request._proto.key
    win = request._proto.win

    p = Plunder(server_id, char_id)
    p.plunder_report(key, win)

    response = PlunderReportResponse()
    response.ret = 0
    return ProtobufResponse(response)
示例#18
0
def get_reward(request):
    req = request._proto
    char_id = request._char_id

    p = Plunder(char_id)
    attachment_msg = p.get_reward(req.tp)

    response = PlunderGetRewardResponse()
    response.ret = 0
    response.tp = req.tp
    response.reward.MergeFrom(attachment_msg)

    return pack_msg(response)
示例#19
0
def get_reward(request):
    req = request._proto
    char_id = request._char_id

    p = Plunder(char_id)
    attachment_msg = p.get_reward(req.tp)

    response = PlunderGetRewardResponse()
    response.ret = 0
    response.tp = req.tp
    response.reward.MergeFrom(attachment_msg)

    return pack_msg(response)
示例#20
0
def get_daily_reward(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    _id = request._proto.id

    p = Plunder(server_id, char_id)
    drop = p.daily_reward_get(_id)

    response = PlunderDailyRewardGetResponse()
    response.ret = 0
    response.drop.MergeFrom(drop.make_protomsg())
    return ProtobufResponse(response)
示例#21
0
def get_reward(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    p = Plunder(server_id, char_id)
    result, drop = p.get_reward()

    response = PlunderGetRewardResponse()
    response.ret = 0
    response.result.extend(result)
    response.drop.MergeFrom(drop.make_protomsg())

    return ProtobufResponse(response)
示例#22
0
def set_unit(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    way_id = request._proto.way
    slot_id = request._proto.slot_id
    unit_id = request._proto.unit_id

    p = Plunder(server_id, char_id)
    p.set_unit(way_id, slot_id, unit_id)

    response = PlunderFormationSetUnitResponse()
    response.ret = 0
    return ProtobufResponse(response)
示例#23
0
def plunder_refresh(request):
    req = request._proto
    char_id = request._char_id
    p = Plunder(char_id)
    target = p.get_plunder_target(req.city_id)

    response = PlunderRefreshResponse()
    if not target:
        response.ret = errormsg.PLUNDER_NO_RIVAL
    else:
        response.ret = 0
        response.plunder.MergeFrom(target.make_plunder_msg(Char(char_id).mc.level))

    return pack_msg(response)
示例#24
0
def set_staff(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    way_id = request._proto.way
    slot_id = request._proto.slot_id
    staff_id = request._proto.staff_id

    p = Plunder(server_id, char_id)
    p.set_staff(way_id, slot_id, staff_id)

    response = PlunderFormationSetStaffResponse()
    response.ret = 0
    return ProtobufResponse(response)
示例#25
0
def plunder_reset_station(*args):
    logger = Logger("plunder_reset_station")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.make_product(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
示例#26
0
def plunder_reset_station(*args):
    logger = Logger("plunder_reset_station")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.make_product(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
示例#27
0
def plunder_refresh(request):
    req = request._proto
    char_id = request._char_id
    p = Plunder(char_id)
    target = p.get_plunder_target(req.city_id)

    response = PlunderRefreshResponse()
    if not target:
        response.ret = errormsg.PLUNDER_NO_RIVAL
    else:
        response.ret = 0
        response.plunder.MergeFrom(
            target.make_plunder_msg(Char(char_id).mc.level))

    return pack_msg(response)
示例#28
0
    def add(self, server_id, char_id, message=""):
        from core.club import Club
        from core.bag import Bag
        from core.staff import StaffManger, StaffRecruit
        from core.talent import TalentManager
        from core.territory import Territory
        from core.vip import VIP
        from core.arena import Arena
        from core.energy import Energy
        from core.plunder import Plunder

        club_property = self.money_as_text_dict()
        if self.club_exp:
            club_property['exp'] = self.club_exp
        if club_property:
            club_property['message'] = message
            Club(server_id, char_id).update(**club_property)

        if self.vip_exp:
            VIP(server_id, char_id).add_exp(self.vip_exp)

        if self.bag:
            bag = Bag(server_id, char_id)
            bag.batch_add(self.bag)

        sm = StaffManger(server_id, char_id)
        if self.staff:
            sm.batch_add(self.staff)

        if self.staff_exp_pool:
            sm.add_exp_pool(self.staff_exp_pool)

        if self.talent_point:
            TalentManager(server_id,
                          char_id).add_talent_points(self.talent_point)

        if self.arena_point:
            Arena(server_id, char_id).add_point(self.arena_point)

        if self.territory_product:
            Territory(server_id, char_id).add_product(self.territory_product)

        if self.work_card:
            Territory(server_id, char_id).add_work_card(self.work_card)

        if self.energy:
            Energy(server_id, char_id).add(self.energy)

        if self.staff_recruit_score:
            StaffRecruit(server_id,
                         char_id).add_score(self.staff_recruit_score)

        if self.station_exp:
            Plunder(server_id, char_id).add_station_exp(self.station_exp)

        if self.resource_data:
            _r = _Resource()
            _r.resource = dict(self.resource_data)
            _r.add(server_id, char_id)
示例#29
0
def challenge_match_handler(server_id, char_id, challenge_id, star, **kwargs):
    TaskMain(server_id, char_id).trig(challenge_id)
    if star > 0:
        Formation(server_id, char_id).try_open_slots()
        Inspire(server_id, char_id).try_open_slots()
        TaskDaily(server_id, char_id).try_open()
        Plunder(server_id, char_id).try_initialize()
        ActivityChallenge(server_id, char_id).trig_notify(challenge_id)
示例#30
0
def plunder_list(request):
    char_id = request._char_id
    p = Plunder(char_id)
    res = p.get_plunder_list()

    response = PlunderListResponse()
    response.ret = 0

    for _id, name, power, formation, is_robot, gold in res:
        plunder = response.plunders.add()
        plunder.id = _id
        plunder.name = name
        plunder.gold = gold
        plunder.power = power
        plunder.hero_original_ids.extend(formation)

    return pack_msg(response)
示例#31
0
def plunder_list(request):
    char_id = request._char_id
    p = Plunder(char_id)
    res = p.get_plunder_list()

    response = PlunderListResponse()
    response.ret = 0

    for _id, name, power, formation, is_robot, gold in res:
        plunder = response.plunders.add()
        plunder.id = _id
        plunder.name = name
        plunder.gold = gold
        plunder.power = power
        plunder.hero_original_ids.extend(formation)

    return pack_msg(response)
示例#32
0
def add_times(signum):
    hour = arrow.utcnow().to(settings.TIME_ZONE).hour
    if hour >= 1 and hour < 8:
        return

    logger = Logger('add_plunder_times.log')
    logger.write("Start")

    char_ids = get_char_ids_by_last_login(limit=3)
    for char_id in char_ids:
        plunder = Plunder(char_id)
        try:
            plunder.change_current_plunder_times(change_value=1, allow_overflow=False)
        except:
            logger.error(traceback.format_exc())

    logger.write("add done")
    logger.close()
示例#33
0
文件: staff.py 项目: yueyoum/dianjing
    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()
示例#34
0
def plunder_auto_add_times(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.hour not in AUTO_CRON_HOUR:
        return

    logger = Logger("plunder_auto_add_times")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.auto_add_plunder_times(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
示例#35
0
def plunder_auto_add_times(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.hour not in AUTO_CRON_HOUR:
        return

    logger = Logger("plunder_auto_add_times")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.auto_add_plunder_times(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
示例#36
0
def add_times(signum):
    hour = arrow.utcnow().to(settings.TIME_ZONE).hour
    if hour >= 1 and hour < 8:
        return

    logger = Logger('add_plunder_times.log')
    logger.write("Start")

    char_ids = get_char_ids_by_last_login(limit=3)
    for char_id in char_ids:
        plunder = Plunder(char_id)
        try:
            plunder.change_current_plunder_times(change_value=1,
                                                 allow_overflow=False)
        except:
            logger.error(traceback.format_exc())

    logger.write("add done")
    logger.close()
示例#37
0
def sync_station(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    p = Plunder(server_id, char_id)
    p.send_station_notify()
    p.send_plunder_times_notify()
    p.send_revenge_notify()

    response = BaseStationSyncResponse()
    response.ret = 0
    return ProtobufResponse(response)
示例#38
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()
示例#39
0
def start(request):
    server_id = request._game_session.server_id
    char_id = request._game_session.char_id

    _id = request._proto.id
    formation_slots = parse_protocol_sync_formation_slots(request._proto.slots)
    tp = request._proto.tp

    if request._proto.HasField('win'):
        win = request._proto.win
    else:
        win = None

    p = Plunder(server_id, char_id)
    match = p.plunder_start(_id, tp, formation_slots, win)

    response = PlunderStartResponse()
    response.ret = 0
    if match:
        response.match.MergeFrom(match)
    return ProtobufResponse(response)
示例#40
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()
示例#41
0
    def try_initialize(self, send_notify=True):
        if self.doc['active']:
            return

        # 从 掠夺阵型 拷贝
        p = Plunder(self.server_id, self.char_id)
        for i in [1, 2, 3]:
            way = p.get_way_object(i)
            doc = way.get_or_create_doc()

            WAY_MAP[i].MONGO_COLLECTION.db(self.server_id).delete_one(
                {'_id': self.char_id})
            WAY_MAP[i].MONGO_COLLECTION.db(self.server_id).insert_one(doc)

        self.doc['active'] = True
        MongoChampionship.db(self.server_id).update_one(
            {'_id': self.char_id}, {'$set': {
                'active': True
            }})

        if send_notify:
            self.send_notify()
示例#42
0
    def __init__(self, server_id, char_id):
        from core.formation import Formation
        from core.plunder import Plunder
        from core.inspire import Inspire
        from core.championship import Championship

        self.server_id = server_id
        self.char_id = char_id

        self.formation = Formation(server_id, char_id)

        p = Plunder(server_id, char_id)
        self.plunder_formation_1 = p.get_way_object(1)
        self.plunder_formation_2 = p.get_way_object(2)
        self.plunder_formation_3 = p.get_way_object(3)

        c = Championship(server_id, char_id)
        self.championship_formation_1 = c.get_way_object(1)
        self.championship_formation_2 = c.get_way_object(2)
        self.championship_formation_3 = c.get_way_object(3)

        self.inspire = Inspire(server_id, char_id)
示例#43
0
    def __init__(self, server_id, char_id):
        from core.formation import Formation
        from core.plunder import Plunder
        from core.inspire import Inspire
        from core.championship import Championship

        self.server_id = server_id
        self.char_id = char_id

        self.formation = Formation(server_id, char_id)

        p = Plunder(server_id, char_id)
        self.plunder_formation_1 = p.get_way_object(1)
        self.plunder_formation_2 = p.get_way_object(2)
        self.plunder_formation_3 = p.get_way_object(3)

        c = Championship(server_id, char_id)
        self.championship_formation_1 = c.get_way_object(1)
        self.championship_formation_2 = c.get_way_object(2)
        self.championship_formation_3 = c.get_way_object(3)

        self.inspire = Inspire(server_id, char_id)
示例#44
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()
示例#45
0
文件: unit.py 项目: yueyoum/dianjing
    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()
示例#46
0
文件: game.py 项目: yueyoum/dianjing
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()