当前位置: 首页>>代码示例>>Python>>正文


Python PyDatagram.addServerHeader方法代码示例

本文整理汇总了Python中direct.distributed.PyDatagram.addServerHeader方法的典型用法代码示例。如果您正苦于以下问题:Python PyDatagram.addServerHeader方法的具体用法?Python PyDatagram.addServerHeader怎么用?Python PyDatagram.addServerHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在direct.distributed.PyDatagram的用法示例。


在下文中一共展示了PyDatagram.addServerHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: login

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def login(self, cookie, sig):
        self.notify.debug("Received login cookie %r from %d" % (cookie, self.air.getMsgSender()))

        sender = self.air.getMsgSender()

        if not self.loginsEnabled:
            # Logins are currently disabled... RIP!
            dg = PyDatagram()
            dg.addServerHeader(sender, self.air.ourChannel, CLIENTAGENT_EJECT)
            dg.addUint16(200)
            dg.addString("Logins are currently disabled. Please try again later.")
            self.air.send(dg)

        if sender >> 32:
            # Oops, they have an account ID on their connection already!
            self.killConnection(sender, "Client is already logged in.")
            return

        # Test the signature
        key = (
            config.GetString("csmud-secret", "streetlamps")
            + config.GetString("server-version", "no_version_set")
            + FIXED_KEY
        )
        computedSig = hmac.new(key, cookie, hashlib.sha256).digest()
        if sig != computedSig:
            self.killConnection(sender, "The accounts database rejected your cookie")
            return

        if sender in self.connection2fsm:
            self.killConnectionFSM(sender)
            return

        self.connection2fsm[sender] = LoginAccountFSM(self, sender)
        self.connection2fsm[sender].request("Start", cookie)
开发者ID:TLOTT-PS,项目名称:ttr-src,代码行数:37,代码来源:ClientServicesManagerUD.py

示例2: enterControlled

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
 def enterControlled(self, avId, accId):
     self.driverId = avId
     fieldList = ['setComponentL',
      'setComponentX',
      'setComponentY',
      'setComponentZ',
      'setComponentH',
      'setComponentP',
      'setComponentR',
      'setComponentT',
      'setSmStop',
      'setSmH',
      'setSmZ',
      'setSmXY',
      'setSmXZ',
      'setSmPos',
      'setSmHpr',
      'setSmXYH',
      'setSmXYZH',
      'setSmPosHpr',
      'setSmPosHprL',
      'clearSmoothing',
      'suggestResync',
      'returnResync']
     #self.air.setAllowClientSend(avId, self, fieldList, accId)
     #hack until CLIENTAGENT_SET_FIELDS_SENDABLE works
     #probably should not be kept for any longer than it needs to
     dg = PyDatagram()
     dg.addServerHeader(self.doId, self.air.ourChannel, STATESERVER_OBJECT_SET_OWNER)
     dg.addUint64(accId << 32 | avId)
     self.air.send(dg)
     self.d_setState('C', self.driverId)
开发者ID:ToontownBattlefront,项目名称:Toontown-Battlefront,代码行数:34,代码来源:DistributedVehicleAI.py

示例3: handleConnected

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def handleConnected(self):
        self.notify.info('Yarn. Waking up (This may take a while!).')
        ToontownInternalRepository.handleConnected(self)
        self.districtId = self.allocateChannel()
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(
            self.districtId, self.getGameDoId(), 2)

        # Claim ownership of that district...
        dg = PyDatagram()
        dg.addServerHeader(
            self.districtId,
            self.ourChannel,
            STATESERVER_OBJECT_SET_AI)
        dg.addChannel(self.ourChannel)
        self.send(dg)

        self.notify.info('Creating Global Managers')
        self.createGlobals()
        self.notify.info('Creating Toontown')
        self.createZones()

        self.statusSender.start()

        self.distributedDistrict.b_setAvailable(1)
        self.notify.info('District is now ready.')
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:29,代码来源:ToontownAIRepository.py

示例4: enterSetAvatar

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def enterSetAvatar(self):
        channel = self.csm.GetAccountConnectionChannel(self.target)

        # First, give them a POSTREMOVE to unload the avatar, just in case they
        # disconnect while we're working.
        datagramCleanup = PyDatagram()
        datagramCleanup.addServerHeader(
            self.avId,
            channel,
            STATESERVER_OBJECT_DELETE_RAM)
        datagramCleanup.addUint32(self.avId)
        datagram = PyDatagram()
        datagram.addServerHeader(
            channel,
            self.csm.air.ourChannel,
            CLIENTAGENT_ADD_POST_REMOVE)
        datagram.addString(datagramCleanup.getMessage())
        self.csm.air.send(datagram)

        # Activate the avatar on the DBSS:
        self.csm.air.sendActivate(
            self.avId, 0, 0, self.csm.air.dclassesByName['DistributedToonUD'],
            {'setAdminAccess': [self.account.get('ACCESS_LEVEL', 100)]})

        # Next, add them to the avatar channel:
        datagram = PyDatagram()
        datagram.addServerHeader(
            channel,
            self.csm.air.ourChannel,
            CLIENTAGENT_OPEN_CHANNEL)
        datagram.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
        self.csm.air.send(datagram)

        # Now set their sender channel to represent their account affiliation:
        datagram = PyDatagram()
        datagram.addServerHeader(
            channel,
            self.csm.air.ourChannel,
            CLIENTAGENT_SET_CLIENT_ID)
        datagram.addChannel(self.target<<32 | self.avId)
        self.csm.air.send(datagram)

        # Finally, grant ownership and shut down.
        datagram = PyDatagram()
        datagram.addServerHeader(
            self.avId,
            self.csm.air.ourChannel,
            STATESERVER_OBJECT_SET_OWNER)
        datagram.addChannel(self.target<<32 | self.avId)
        self.csm.air.send(datagram)

        # Tell TTRFriendsManager somebody is logging in:
        self.csm.air.friendsManager.toonOnline(self.avId, self.avatar)

        # Tell the GlobalPartyManager as well:
        self.csm.air.globalPartyMgr.avatarJoined(self.avId)

        self.csm.air.writeServerEvent('avatarChosen', self.avId, self.target)
        self.demand('Off')
开发者ID:Keithybub,项目名称:ToonTownReviveOld,代码行数:61,代码来源:ClientServicesManagerUD.py

示例5: killConnection

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
 def killConnection(self, connId, reason):
     datagram = PyDatagram()
     datagram.addServerHeader(
         connId,
         self.air.ourChannel,
         CLIENTAGENT_EJECT)
     datagram.addUint16(122)
     datagram.addString(reason)
     self.air.send(datagram)
开发者ID:Toonerz,项目名称:TTI-Leak--From-2015-,代码行数:11,代码来源:ClientServicesManagerUD.py

示例6: __ready

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
 def __ready(self):
     dg = PyDatagram()
     dg.addServerHeader(self.districtStats.doId, self.ourChannel, STATESERVER_OBJECT_DELETE_RAM)
     dg.addUint32(self.districtStats.doId)
     self.addPostRemove(dg)
     
     self.apiMgr = self.generateGlobalObject(100001, "ShardAPIManager")
     self.apiMgr.start()
     self.apiMgr.d_setShardData()
     
     self.banMgr = self.generateGlobalObject(100002, "BanManager")
开发者ID:Teku16,项目名称:MikeyTheRepository,代码行数:13,代码来源:ToontownAIRepository.py

示例7: login

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def login(self, cookie):
        target = self.air.getMsgSender()

        datagram = PyDatagram()
        datagram.addServerHeader(
            target,
            self.air.ourChannel,
            CLIENTAGENT_SET_STATE)
        datagram.addUint16(2)
        self.air.send(datagram)

        self.sendUpdateToChannel(target, 'acceptLogin', [])
开发者ID:PiratesOnline,项目名称:PiratesOfTheCarribeanOnline,代码行数:14,代码来源:ClientServicesManagerUD.py

示例8: handleConnected

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def handleConnected(self):
        self.districtId = self.allocateChannel()
        self.distributedDistrict = ToontownDistrictAI(self)
        self.distributedDistrict.setName(self.districtName)
        self.distributedDistrict.generateWithRequiredAndId(simbase.air.districtId, self.getGameDoId(), 2)

        dg = PyDatagram()
        dg.addServerHeader(simbase.air.districtId, simbase.air.ourChannel, STATESERVER_OBJECT_SET_AI)
        dg.addChannel(simbase.air.ourChannel)
        simbase.air.send(dg)

        self.createGlobals()
        self.createZones()
开发者ID:Spiderlover,项目名称:Toontown-Crystal-TTH-Edition,代码行数:15,代码来源:ToontownAIRepository.py

示例9: enterSetAvatarTask

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def enterSetAvatarTask(self, channel, task):
        # Finally, grant ownership and shut down.
        datagram = PyDatagram()
        datagram.addServerHeader(
            self.avId,
            self.csm.air.ourChannel,
            STATESERVER_OBJECT_SET_OWNER)
        datagram.addChannel(self.target<<32 | self.avId)
        self.csm.air.send(datagram)

        self.csm.air.writeServerEvent('avatarChosen', self.avId, self.target)
        self.demand('Off')
        return task.done
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:15,代码来源:ClientServicesManagerUD.py

示例10: enterUnloadAvatar

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def enterUnloadAvatar(self):
        channel = self.csm.GetAccountConnectionChannel(self.target)

        # Fire off the avatarOffline message.
        self.csm.air.netMessenger.send("avatarOffline", [self.avId])

        # Get lost, POST_REMOVES!:
        dg = PyDatagram()
        dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLEAR_POST_REMOVES)
        self.csm.air.send(dg)

        # Remove avatar channel:
        dg = PyDatagram()
        dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLOSE_CHANNEL)
        dg.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
        self.csm.air.send(dg)

        # Reset sender channel:
        dg = PyDatagram()
        dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
        dg.addChannel(self.target << 32)  # accountId in high 32 bits, no avatar in low
        self.csm.air.send(dg)

        # Unload avatar object:
        dg = PyDatagram()
        dg.addServerHeader(self.avId, channel, STATESERVER_OBJECT_DELETE_RAM)
        dg.addUint32(self.avId)
        self.csm.air.send(dg)

        # Done!
        self.csm.air.writeServerEvent("avatar-unload", avId=self.avId)
        self.demand("Off")
开发者ID:TLOTT-PS,项目名称:ttr-src,代码行数:34,代码来源:ClientServicesManagerUD.py

示例11: enterUnloadAvatar

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def enterUnloadAvatar(self):
        channel = self.csm.GetAccountConnectionChannel(self.target)
        
        # Tell FriendsManager somebody is logging off:
        self.csm.air.friendsManager.toonOffline(self.avId)

        # Clear off POSTREMOVE:
        dg = PyDatagram()
        dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLEAR_POST_REMOVES)
        self.csm.air.send(dg)

        # Remove avatar channel:
        dg = PyDatagram()
        dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_CLOSE_CHANNEL)
        dg.addChannel(self.csm.GetPuppetConnectionChannel(self.avId))
        self.csm.air.send(dg)

        # Reset sender channel:
        dg = PyDatagram()
        dg.addServerHeader(channel, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
        dg.addChannel(self.target<<32) # accountId in high 32 bits, no avatar in low
        self.csm.air.send(dg)

        # Unload avatar object:
        dg = PyDatagram()
        dg.addServerHeader(self.avId, channel, STATESERVER_OBJECT_DELETE_RAM)
        dg.addUint32(self.avId)
        self.csm.air.send(dg)

        # Done!
        self.csm.air.writeServerEvent('avatarUnload', self.avId)
        self.demand('Off')
开发者ID:Spiderlover,项目名称:Toontown-Crystal-TTH-Edition,代码行数:34,代码来源:ClientServicesManagerUD.py

示例12: enterSetAccount

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def enterSetAccount(self):
        # First, if there's anybody on the account, kill 'em for redundant login:
        dg = PyDatagram()
        dg.addServerHeader(self.csm.GetAccountConnectionChannel(int(self.databaseId)),
                           self.csm.air.ourChannel, CLIENTAGENT_EJECT)
        dg.addUint16(100)
        dg.addString('This account has been logged in elsewhere.')
        self.csm.air.send(dg)

        # Next, add this connection to the account channel.
        dg = PyDatagram()
        dg.addServerHeader(self.target, self.csm.air.ourChannel, CLIENTAGENT_OPEN_CHANNEL)
        dg.addChannel(self.csm.GetAccountConnectionChannel(self.databaseId))
        self.csm.air.send(dg)

        # Now set their sender channel to represent their account affiliation:
        dg = PyDatagram()
        dg.addServerHeader(self.target, self.csm.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID)
        dg.addChannel(self.databaseId << 32) # accountId in high 32 bits, 0 in low (no avatar)
        self.csm.air.send(dg)

        # Un-sandbox them!
        dg = PyDatagram()
        dg.addServerHeader(self.target, self.csm.air.ourChannel, CLIENTAGENT_SET_STATE)
        dg.addUint16(2) # ESTABLISHED state. BIG FAT SECURITY RISK!!!
        self.csm.air.send(dg)

        # We're done.
        self.csm.sendUpdateToChannel(self.target, 'acceptLogin', [])
        self.demand('Off')
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:32,代码来源:ClientServicesManagerUD.py

示例13: toonOnline

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def toonOnline(self, doId, friendsList):
        self.onlineToons.append(doId)

        channel = self.GetPuppetConnectionChannel(doId)
        dgcleanup = self.dclass.aiFormatUpdate('goingOffline', self.doId, self.doId, self.air.ourChannel, [doId])
        dg = PyDatagram()
        dg.addServerHeader(channel, self.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE)
        dg.addString(dgcleanup.getMessage())
        self.air.send(dg)

        for friend in friendsList:
            friendId = friend[0]
            if friend[0] in self.onlineToons:
                self.sendUpdateToAvatarId(doId, 'friendOnline', [friendId, 0, 0])
            self.sendUpdateToAvatarId(friendId, 'friendOnline', [doId, 0, 0])
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:17,代码来源:TTSFriendsManagerUD.py

示例14: enterSetAvatarTask

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def enterSetAvatarTask(self, channel, task):
        # Finally, grant ownership and shut down.
        datagram = PyDatagram()
        datagram.addServerHeader(
            self.avId,
            self.csm.air.ourChannel,
            STATESERVER_OBJECT_SET_OWNER)
        datagram.addChannel(self.target<<32 | self.avId)
        self.csm.air.send(datagram)

        # Tell the GlobalPartyManager as well:
        self.csm.air.globalPartyMgr.avatarJoined(self.avId)

        self.csm.air.writeServerEventMessage('avatarChosen', self.avId, self.target)
        self.demand('Off')
        return task.done
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:18,代码来源:ClientServicesManagerUD.py

示例15: __offlineToonOnline

# 需要导入模块: from direct.distributed import PyDatagram [as 别名]
# 或者: from direct.distributed.PyDatagram import addServerHeader [as 别名]
    def __offlineToonOnline(self, avId, activated, otherId=None, accId=None):
        if not (otherId and activated and accId):
            return
        # Undeclare to the friend!
        dg = PyDatagram()
        dg.addServerHeader(self.GetPuppetConnectionChannel(avId), self.air.ourChannel, CLIENTAGENT_UNDECLARE_OBJECT)
        dg.addUint32(otherId)
        self.air.send(dg)

        # Undeclare to our now-offline avId (they may still be around, about to log into a new toon!)
        dg = PyDatagram()
        dg.addServerHeader(self.GetAccountConnectionChannel(accId), self.air.ourChannel, CLIENTAGENT_UNDECLARE_OBJECT)
        dg.addUint32(avId)
        self.air.send(dg)

        # Tell them they're offline!
        self.sendUpdateToAvatarId(avId, 'friendOffline', [otherId])
开发者ID:AdrianF98,项目名称:Toontown-Rewritten,代码行数:19,代码来源:TTRFriendsManagerUD.py


注:本文中的direct.distributed.PyDatagram.addServerHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。