Example #1
0
    def initGame(self):
        if ftlog.is_debug():
            ftlog.debug("<< |gameId:", self.GAME_ID, caller=self)

        self.gameInitTime = datetime.now()
        self._now = datetime.now()

        if self.GAME_ID == GAME_ID:
            return

        serverType = gdata.serverType()

        if serverType == gdata.SRV_TYPE_ROBOT:
            self.initRobotServerGame()
        elif serverType == gdata.SRV_TYPE_UTIL:
            self.initUtilServerGame()
        elif serverType == gdata.SRV_TYPE_TABLE:
            self.initGTServerGame()
        elif serverType == gdata.SRV_TYPE_HTTP:
            self.initHTServerGame()
        elif serverType == gdata.SRV_TYPE_ROOM:
            self.initGRServerGame()

        globalEventBus.subscribe(EventConfigure, self.onReloadConfig)
        globalEventBus.subscribe(EventHeartBeat, self.onEventHeartBeat)
Example #2
0
def _initialize(isCenter):
    ftlog.info('wx_official._initialize begin')
    subscribeOfficialMessageEvent()
    if isCenter:
        from poker.entity.events.tyeventbus import globalEventBus
        globalEventBus.subscribe(EventHeartBeat, _onTimer)
    ftlog.info('wx_official._initialize end')
Example #3
0
def _initialize(isCenter):
    ftlog.debug('hallled._initialize begin', isCenter)
    global _initialize_ok
    if not _initialize_ok:
        _initialize_ok = 1
        if isCenter:
            from poker.entity.events.tyeventbus import globalEventBus
            globalEventBus.subscribe(EventHeartBeat, onTimer)
    ftlog.debug('hallled._initialize end')
Example #4
0
def _initialize(isCenter):
    ftlog.debug('HallLotter initialize begin', isCenter)
    global _initialize_ok
    if not _initialize_ok:
        _initialize_ok = 1
        if isCenter:
            from poker.entity.events.tyeventbus import globalEventBus
            globalEventBus.subscribe(EventHeartBeat, onTimer)
    ftlog.debug('HallLotter initialize end')
Example #5
0
def _initialize(isCenter):
    global _inited
    if not _inited:
        _inited = True

    global _setUserSkin
    if not _setUserSkin and isCenter:
        from poker.entity.events.tyeventbus import globalEventBus
        from poker.entity.events.tyevent import EventHeartBeat
        globalEventBus.subscribe(EventHeartBeat, oldUserSetSkin)
Example #6
0
    def initGame(self):
        from majiang2.entity import majiang_account
        self._account = majiang_account
        serverType = gdata.serverType()

        if serverType == gdata.SRV_TYPE_ROBOT :
            self._robotmgr = MajiangRobotManager()
            globalEventBus.subscribe(EventHeartBeat, self._robotmgr.onHeartBeat)
            
        elif (serverType == gdata.SRV_TYPE_TABLE) or (serverType == gdata.SRV_TYPE_ROOM):
            CreateTableData.initialize(gdata.serverId())                # 初始化创建牌桌数据模块
            MJCreateTableRecord.initialize()                            # 初始化自建桌战绩模块
        elif serverType == gdata.SRV_TYPE_CENTER:
            pass
def _initialize(isCenter):
    ftlog.debug('dizhu_score_ranking._initialize begin')
    global _inited
    if not _inited:
        _inited = True
        _reloadConf()
        pkeventbus.globalEventBus.subscribe(EventConfigure, _onConfChanged)
        subscribeScoreRankList()
        TGHall.getEventBus().subscribe(TYOpenItemEvent, _onOpenItemEvent)
        if isCenter:
            from poker.entity.events.tyeventbus import globalEventBus
            globalEventBus.subscribe(EventHeartBeat, onTimer)

    ftlog.debug('dizhu_score_ranking._initialize end')
Example #8
0
    def initGame(self):
        from difang.majiang2.entity import majiang_account
        self._account = majiang_account
        serverType = gdata.serverType()

        if serverType == gdata.SRV_TYPE_ROBOT:
            self._robotmgr = MajiangRobotManager()
            globalEventBus.subscribe(EventHeartBeat, self._robotmgr.onHeartBeat)

        elif (serverType == gdata.SRV_TYPE_TABLE) or (serverType == gdata.SRV_TYPE_ROOM):
            CreateTableData.initialize(gdata.serverId())  # 初始化创建牌桌数据模块
            MJCreateTableRecord.initialize()  # 初始化自建桌战绩模块
        elif serverType == gdata.SRV_TYPE_CENTER:
            pass
Example #9
0
def _initialize(isCenter):
    from hall.game import TGHall
    ftlog.debug('Ranking initialize begin', isCenter)
    global rankingSystem
    global _inited
    if not _inited:
        _inited = True
        rankingSystem = TYRankingSystemImpl(TYRankingUserScoreInfoDaoImpl(), TYRankingDaoImpl(), RankRewardSender())
        _registerClasses()
        _reloadConf()
        TGHall.getEventBus().subscribe(EventUserLogin, _onUserLogin)
        pkeventbus.globalEventBus.subscribe(EventConfigure, _onConfChanged)

        if isCenter:
            from poker.entity.events.tyeventbus import globalEventBus
            globalEventBus.subscribe(EventHeartBeat, onTimer)

    ftlog.debug('Ranking initialize end')
Example #10
0
def initialize(isCenter):
    """初始化"""
    ftlog.info("newfish ranking_system initialize begin")
    global _inited
    if not _inited:
        _inited = True
        from poker.entity.events.tyevent import EventUserLogin, EventHeartBeat
        from newfish.game import TGFish
        from newfish.entity.event import StarfishChangeEvent, BulletChangeEvent, \
            SendMailEvent, ReceiveMailEvent, GameTimeLuckyAddEvent, OpenEggsEvent, \
            SlotMachineAddIntegralEvent, MoneyTreeAddCountEvent, NetIncomeChangeEvent, \
            FestivalTurntableAddIntegralEvent, SuperbossPointChangeEvent, ActivityItemChangeEvent, \
            PoseidonProfitAndLossEvent
        TGFish.getEventBus().subscribe(EventUserLogin, _refreshBulletRankData)
        TGFish.getEventBus().subscribe(StarfishChangeEvent,
                                       _refreshStarfishRankData)
        TGFish.getEventBus().subscribe(BulletChangeEvent,
                                       _refreshBulletRankData)
        TGFish.getEventBus().subscribe(SendMailEvent, _refreshBulletRankData)
        TGFish.getEventBus().subscribe(ReceiveMailEvent,
                                       _refreshBulletRankData)
        TGFish.getEventBus().subscribe(GameTimeLuckyAddEvent,
                                       _refreshLuckyBonusRankData)
        TGFish.getEventBus().subscribe(OpenEggsEvent,
                                       _refreshLuckyBonusRankData)
        TGFish.getEventBus().subscribe(SlotMachineAddIntegralEvent,
                                       _refreshSlotMachineRankData)
        TGFish.getEventBus().subscribe(MoneyTreeAddCountEvent,
                                       _refreshMoneyTreeRankData)
        TGFish.getEventBus().subscribe(NetIncomeChangeEvent,
                                       _refreshProfitCoinRankData)
        TGFish.getEventBus().subscribe(FestivalTurntableAddIntegralEvent,
                                       _refreshFestivalTurntableRankData)
        TGFish.getEventBus().subscribe(ActivityItemChangeEvent,
                                       _refreshCollectItemRankData)
        TGFish.getEventBus().subscribe(PoseidonProfitAndLossEvent,
                                       _refreshPoseidonWinRankData)
        TGFish.getEventBus().subscribe(SuperbossPointChangeEvent,
                                       _refreshSuperbossPointRankData)
        if isCenter:
            from poker.entity.events.tyeventbus import globalEventBus
            globalEventBus.subscribe(EventHeartBeat, onTimer)
    ftlog.info("newfish ranking_system initialize end")
Example #11
0
def _initialize(isCenter):
    from hall.game import TGHall
    ftlog.debug('Ranking initialize begin', isCenter)
    global rankingSystem
    global _inited
    if not _inited:
        _inited = True
        rankingSystem = TYRankingSystemImpl(TYRankingUserScoreInfoDaoImpl(),
                                            TYRankingDaoImpl(),
                                            RankRewardSender())
        _registerClasses()
        _reloadConf()
        TGHall.getEventBus().subscribe(EventUserLogin, _onUserLogin)
        pkeventbus.globalEventBus.subscribe(EventConfigure, _onConfChanged)

        if isCenter:
            from poker.entity.events.tyeventbus import globalEventBus
            globalEventBus.subscribe(EventHeartBeat, onTimer)

    ftlog.debug('Ranking initialize end')
Example #12
0
def _initializePoker(gdatas):
    '''
    初始化服务的基本(大厅通用)的HTTP和TCP命令入口
    '''
    if _DEBUG:
        debug('initializePoker begin')
    stype = gdata.serverType()

    # 启动全局配置系统的同步
    from poker.entity.configure import synccenter
    synccenter._initialize()
    globalEventBus.subscribe(EventHeartBeat, synccenter.doSyncData)

    from poker.entity.biz import integrate
    integrate._initialize()

    # 如果是CONN进程, 那么启动空闲TCP链接的检查
    if stype == gdata.SRV_TYPE_CONN:
        from poker.protocol.conn.protocols import doCleanUpEmptyTcp
        globalEventBus.subscribe(EventHeartBeat, doCleanUpEmptyTcp)

    # 如果是AGENT进程, 那么启用自身的命令处理器
    if stype == gdata.SRV_TYPE_AGENT:
        from poker.protocol.common.protocols import onAgentSelfCommand
        from freetime.support.tcpagent.protocol import A2SProtocol, A2AProtocol
        A2SProtocol.onCommand = onAgentSelfCommand
        A2AProtocol.onCommand = onAgentSelfCommand

    if gdata.isHttpProcess():
        from poker.protocol import runhttp
        runhttp.addWebRoot(gdata.pathWebroot())

    if stype == gdata.SRV_TYPE_UTIL:
        from poker.entity.dao import datasubscribe
        datasubscribe._initialize()

    if _DEBUG:
        debug('initializePoker end')
Example #13
0
def __initializePoker(gdatas):
    '''
    初始化服务的基本(大厅通用)的HTTP和TCP命令入口
    '''
    if _DEBUG:
        debug('initializePoker begin')
    stype = gdata.serverType()

    # 启动全局配置系统的同步
    from poker.entity.configure import synccenter
    synccenter._initialize()
    globalEventBus.subscribe(EventHeartBeat, synccenter.doSyncData)

    from poker.entity.biz import integrate
    integrate._initialize()

    # 如果是CONN进程, 那么启动空闲TCP链接的检查
    if stype == gdata.SRV_TYPE_CONN:
        from poker.protocol.conn.protocols import doCleanUpEmptyTcp
        globalEventBus.subscribe(EventHeartBeat, doCleanUpEmptyTcp)

    # 如果是AGENT进程, 那么启用自身的命令处理器
    if stype == gdata.SRV_TYPE_AGENT:
        from poker.protocol.common.protocols import onAgentSelfCommand
        from freetime.support.tcpagent.protocol import A2SProtocol, A2AProtocol
        A2SProtocol.onCommand = onAgentSelfCommand
        A2AProtocol.onCommand = onAgentSelfCommand

    if gdata.isHttpProcess():
        from poker.protocol import runhttp
        runhttp.addWebRoot(gdata.pathWebroot())

    if stype == gdata.SRV_TYPE_UTIL:
        from poker.entity.dao import datasubscribe
        datasubscribe._initialize()

    if _DEBUG:
        debug('initializePoker end')
Example #14
0
 def registerListener(cls, eventbus):
     ftlog.debug("DdzRedEnvelope.registerListener: enter")
     globalEventBus.subscribe(EventHeartBeat, cls.onHeartBeat)
Example #15
0
def initialize():
    from poker.entity.events.tyeventbus import globalEventBus
    globalEventBus.subscribe(EventHeartBeat, onTimer)
Example #16
0
    def initGame(self):
        from hall.entity import hallaccount
        self._account = hallaccount  # 大厅的账户处理类
        serverType = gdata.serverType()

        if serverType == gdata.SRV_TYPE_CENTER:
            centers = gdata.serverTypeMap().get(gdata.SRV_TYPE_CENTER, [])[:]
            centers.sort()
            sid = gdata.serverId()
            inits = gdata.centerServerLogics().get(sid, [])
            # 轮盘开奖信息的监听
            from hall.servers.center.rpc.roulette_remote import sendReward
            globalEventBus.subscribe(EventHeartBeat, sendReward)
            if inits:
                for pkg in inits:
                    ftlog.info('init center logic of ->', pkg)
                    exec 'from %s import _initialize; _initialize(1)' % (pkg)

        if serverType == gdata.SRV_TYPE_UTIL:
            from hall.servers.util.account_handler import updateOnLineInfos
            globalEventBus.subscribe(EventHeartBeat, updateOnLineInfos)
            # 在线信息初始化, ONLIE处理必须在UTIL服务
            from hall.entity import hallonline
            hallonline._initialize()

        if serverType == gdata.SRV_TYPE_TABLE or serverType == gdata.SRV_TYPE_ROOM:
            from hall.servers.room.room import reportRoomOnlineInfos
            globalEventBus.subscribe(EventHeartBeat, reportRoomOnlineInfos)
            from hall.entity import hallchatlog
            hallchatlog._initialize()

        # 注意: 各个模块间有先后初始化的顺序
        from hall.entity import hallitem, hallstore, hallvip, hallbenefits, \
            hallranking, hallshare, hallpromote, hallfree, hallgamelist, hallgamelist2, \
            halldailycheckin, hallmenulist, hallcoupon, hallmoduletip, \
            hallrename, hallads, hallflipcardluck, hallpopwnd, hallstartchip, \
            fivestarrate, match360kp, neituiguang, hallstocklimit, \
            hall_first_recharge, hallroulette, hallled, hall_exit_remind
        from hall.entity.hallactivity import activity
        from hall.entity.halltmpact import tmp_activity
        from hall.entity.hall_red_envelope import hall_red_envelope

        # 道具初始化
        hallitem._initialize()
        # 限购初始化
        hallstocklimit._initialize()
        # 商城初始化
        hallstore._initialize()
        # VIP系统初始化
        hallvip._initialize()
        # 救济金系统初始化
        hallbenefits._initialize()
        # 用户初始基金初始化
        hallstartchip._initialize()
        halldailycheckin._initialize()
        # 排行榜
        hallranking._initialize(0)
        # 活动系统初始化
        activity._initialize()
        hallcoupon._initialize()
        hallshare._initialize()
        hallgamelist._initialize()
        hallgamelist2._initialize()
        hallmenulist._initialize()
        hallrename._initialize()
        hallmoduletip._initialize()
        hallads._initialize()
        hallflipcardluck._initialize()
        hallpopwnd._initialize()
        hallpromote._initialize()
        hallfree._initialize()
        fivestarrate._initialize()
        match360kp._initialize()
        neituiguang._initialize()

        from hall.entity import halltask
        halltask.initialize()

        # 默认配置初始化
        hallmoduledefault._initialize()
        halllocalnotification._initialize()
        # 首冲礼包配置
        hall_first_recharge._initialize()
        tmp_activity._initialize()
        # 红包模块配置初始化
        hall_red_envelope._initialize()
        # 钻石抽奖初始化
        hallroulette._initialize()
        # led配置初始化
        hallled._initializeConfig()
        # 退出提醒
        hall_exit_remind._initialize()
        # 三方控制模块开关
        hall_third_sdk_switch._initialize()
        # 域名配置初始化
        halldomains._initialize()
        # 插件升级模块初始化
        hall_game_update._initialize()
        # 登录奖励模块初始化
        hall_login_reward._initialize()
        # 道具转换模块初始化
        hall_item_exchange._initialize()
        # 自建桌房间号初始化
        hall_friend_table._initialize()
        # 小推广系统初始化
        from hall.entity import hall_simple_invite
        hall_simple_invite.initialize()
        # 房卡购买提示信息模块初始化
        from hall.entity import hall_fangka_buy_info
        hall_fangka_buy_info._initialize()
Example #17
0
 def initRobotServerGame(self):
     self._robotmgr = self.RobotManagerClass(self.GAME_ID)
     globalEventBus.subscribe(EventHeartBeat, self._robotmgr.onHeartBeat)
Example #18
0
    def initGame(self):
        serverType = gdata.serverType()

        from dizhu.entity import dizhuaccount
        from dizhu.friendtable import ft_service
        from dizhu.activities.chargelead import ChargeLead

        self._account = dizhuaccount
        dizhuSkillScore = skillscore.GameSkillScore(DIZHU_GAMEID)
        dizhuSkillScore.init()
        skillscore.registerGameSkillScore(DIZHU_GAMEID, dizhuSkillScore)
        replay_service._initialize()
        ft_service._initialize()
        obsystem._initialize()
        dizhu_giftbag.initialize()

        tableskin._initialize(serverType == gdata.SRV_TYPE_CENTER)
        dizhu_score_ranking._initialize(serverType == gdata.SRV_TYPE_CENTER)
        dizhu_segment_match._initialize(serverType == gdata.SRV_TYPE_CENTER)
        dizhu_new_roundlist._initialize()
        wx_official._initialize(serverType == gdata.SRV_TYPE_CENTER)
        reward_async._initialize()
        dizhufishing._initialize()
        matchhistory._initialize()
        duobao.initialize()
        activity_wx._initialize()
        from dizhu.entity import wx_share_control
        wx_share_control._initialize()

        if serverType == gdata.SRV_TYPE_ROBOT :
            from dizhu.robot.robot import DizhuRobotManager
            self._robotmgr = DizhuRobotManager()
            globalEventBus.subscribe(EventHeartBeat, self._robotmgr.onHeartBeat)

        if serverType == gdata.SRV_TYPE_UTIL:
            from dizhu.entity import dizhuflipcard, dizhutask, dizhucoupon, dizhuranking, dizhuredenvelope
            from dizhu.activities import activitysystem
            from dizhu.activitynew import activitysystemnew
            dizhuflipcard._initialize()
            from dizhu.entity.segment import dizhu_segment_rewards
            dizhu_segment_rewards._initialize()
            dizhutask._initialize()
            dizhucoupon._initialize()
            activitysystem._initialize()
            dizhuranking._initialize()
            dizhuled._initialize()
            activitysystemnew._initialize()
            dizhuredenvelope._initialize()
            dizhu_red_envelope_bomb._initialize()
            dizhuworship._initialize()

            from dizhu.entity import dizhushare
            dizhushare.initialize()

            MatchRecord.initialize(self.getEventBus())
            ChargeLead.registerEvents(self.getEventBus())
            from hall.game import TGHall
            TGHall.getEventBus().subscribe(OnLineTcpChangedEvent, self.onOnLineTcpChangedEvent)

            dizhu_user_behaviour.initBehaviourReward()

            from dizhu.games.endgame import endgame
            endgame._initialize()

            from dizhu.entity import wx_follow
            wx_follow._initialize()

            from dizhu.entity import dizhu_share_count
            dizhu_share_count._initialize()

        from dizhu.entity.treasure_chest import treasure_chest
        treasure_chest._initialize()

        if serverType == gdata.SRV_TYPE_CENTER:
            from dizhu.activitynew import activity_score_ranking
            activity_score_ranking.initialize()

            dizhu_user_behaviour.initialize()
Example #19
0
    def initGame(self):
        from hall.entity import hallaccount
        self._account = hallaccount  # 大厅的账户处理类
        serverType = gdata.serverType()

        if serverType == gdata.SRV_TYPE_CENTER:
            centers = gdata.serverTypeMap().get(gdata.SRV_TYPE_CENTER, [])[:]
            centers.sort()
            sid = gdata.serverId()
            inits = gdata.centerServerLogics().get(sid, [])
            # 轮盘开奖信息的监听
            from hall.servers.center.rpc.roulette_remote import sendReward
            globalEventBus.subscribe(EventHeartBeat, sendReward)
            if inits:
                for pkg in inits:
                    ftlog.info('init center logic of ->', pkg)
                    exec 'from %s import _initialize; _initialize(1)' % (pkg)

        if serverType == gdata.SRV_TYPE_UTIL:
            from hall.servers.util.account_handler import updateOnLineInfos
            globalEventBus.subscribe(EventHeartBeat, updateOnLineInfos)
            # 在线信息初始化, ONLIE处理必须在UTIL服务
            from hall.entity import hallonline
            hallonline._initialize()

        if serverType == gdata.SRV_TYPE_TABLE or serverType == gdata.SRV_TYPE_ROOM:
            from hall.servers.room.room import reportRoomOnlineInfos
            globalEventBus.subscribe(EventHeartBeat, reportRoomOnlineInfos)
            from hall.entity import hallchatlog
            hallchatlog._initialize()

        # 注意: 各个模块间有先后初始化的顺序
        from hall.entity import hallitem, hallstore, hallvip, hallbenefits, \
            hallranking, hallshare, hallpromote, hallfree, hallgamelist, hallgamelist2, \
            halldailycheckin, hallmenulist, hallcoupon, hallmoduletip, \
            hallrename, hallads, hallflipcardluck, hallpopwnd, hallstartchip, \
            fivestarrate, match360kp, neituiguang, hallstocklimit, \
            hall_first_recharge, hallroulette, hallled, hall_exit_remind
        from hall.entity.hallactivity import activity
        from hall.entity.halltmpact import tmp_activity
        from hall.entity.hall_red_envelope import hall_red_envelope

        # 道具初始化
        hallitem._initialize()
        # 限购初始化
        hallstocklimit._initialize()
        # 商城初始化
        hallstore._initialize()
        # VIP系统初始化
        hallvip._initialize()
        # 救济金系统初始化
        hallbenefits._initialize()
        # 用户初始基金初始化
        hallstartchip._initialize()
        halldailycheckin._initialize()
        # 排行榜
        hallranking._initialize(0)
        # 活动系统初始化
        activity._initialize()
        hallcoupon._initialize()
        hallshare._initialize()
        hallgamelist._initialize()
        hallgamelist2._initialize()
        hallmenulist._initialize()
        hallrename._initialize()
        hallmoduletip._initialize()
        hallads._initialize()
        hallflipcardluck._initialize()
        hallpopwnd._initialize()
        hallpromote._initialize()
        hallfree._initialize()
        fivestarrate._initialize()
        match360kp._initialize()
        neituiguang._initialize()

        from hall.entity import halltask
        halltask.initialize()

        # 默认配置初始化
        hallmoduledefault._initialize()
        halllocalnotification._initialize()
        # 首冲礼包配置
        hall_first_recharge._initialize()
        tmp_activity._initialize()
        # 红包模块配置初始化
        hall_red_envelope._initialize()
        # 钻石抽奖初始化
        hallroulette._initialize()
        # led配置初始化
        hallled._initializeConfig()
        # 退出提醒
        hall_exit_remind._initialize()
        # 三方控制模块开关
        hall_third_sdk_switch._initialize()
        # 域名配置初始化
        halldomains._initialize()
        # 插件升级模块初始化
        hall_game_update._initialize()
        # 登录奖励模块初始化
        hall_login_reward._initialize()
        # 道具转换模块初始化
        hall_item_exchange._initialize()
        # 自建桌房间号初始化
        hall_friend_table._initialize()
        # 小推广系统初始化
        from hall.entity import hall_simple_invite
        hall_simple_invite.initialize()
        # 房卡购买提示信息模块初始化
        from hall.entity import hall_fangka_buy_info
        hall_fangka_buy_info._initialize()