コード例 #1
0
ファイル: API.py プロジェクト: SEA-group/wowp_scripts
    def updateSquad(self, squadID, squadInfo):
        """ Temporary method for receiving detailed info about our squad
            (regardless of whether a voice channel exists).
        
        @param squadID:   unique squad ID (used only for further communication with Game Server)
        @param squadInfo: dictionary with 'accountIDs' and 'ownerID' keys
        """
        if 'accountIDs' in squadInfo:
            self.__squadID = squadID
            self.__squadMembers = [int(id) for id in squadInfo['accountIDs']]
            self.__squadOwnerDbID = int(squadInfo['ownerID'])
            LOG_TRACE('VOIP updateSquad: squad ID {0}, owner {1}'.format(
                self.__squadID, self.__squadOwnerDbID))
            self.__channelsMgr.updateChannel(consts.VOIP.CHANNEL_TYPES.SQUAD,
                                             self.__squadMembers,
                                             self.__squadOwnerDbID)
            for dbid in self.__squadMembers:
                self.__channelsMgr.refreshMemberState(dbid)

        else:
            LOG_TRACE('VOIP updateSquad: no squad')
            self.__squadID = None
            self.__squadMembers = []
            self.__squadOwnerDbID = None
        return
コード例 #2
0
    def initialize(self, tsIdentities, muteList):
        if self.__initialized:
            LOG_ERROR('Already initialized!')
            return
        elif tsIdentities is None or muteList is None:
            return
        else:
            self.__tsIdentities = tsIdentities
            self.__muteList = set(muteList)
            LOG_TRACE('Initialized with TS3 identities: {0}'.format(
                self.__tsIdentities))
            LOG_TRACE('Initialized with mute list: {0}'.format(
                self.__muteList))
            numChannelTypes = len(self.__tsIdentities)
            LOG_DEBUG('verify')
            verify(numChannelTypes == consts.VOIP.CHANNEL_TYPES.QUANTITY)
            args = {ENGINE_PROTOCOL.KEY_PLAYER_DATABASE_ID: str(self.playerID)}
            numSupportedChannels = 0
            for type in xrange(numChannelTypes):
                if self.__tsIdentities[type]:
                    args[
                        ENGINE_PROTOCOL.KEY_CHANNEL_TYPE_INDEXED %
                        numSupportedChannels] = consts.VOIP.CHANNEL_TYPES.getConstNameByValue(
                            type)
                    args[ENGINE_PROTOCOL.KEY_TS_IDENTITY_INDEXED %
                         numSupportedChannels] = self.__tsIdentities[type]
                numSupportedChannels += 1

            args[ENGINE_PROTOCOL.KEY_NUM_CHANNEL_TYPES] = str(
                numSupportedChannels)
            self.__initArgs = args
            if self.__enabled:
                self.__initializeInternal()
            return
コード例 #3
0
ファイル: API.py プロジェクト: SEA-group/wowp_scripts
    def __onReceiveInitData(self, operation, returnCode, tsIdentities,
                            muteList):
        """ Callback for receiving initialization data for client's VOIP module from Game Server.
        
        @param operation:    not used
        @param returnCode:   not used
        @param tsIdentities: list of TeamSpeak identities for specific channel types (consts.VOIP_CHANNEL_TYPES)
        @param muteList:     list of database IDs of players in our personal mute list
        """
        if self.__channelsMgr.initialized:
            LOG_WARNING(
                'VOIP __onReceiveInitData: already initialized, ignoring')
            return
        g_xmppChatHandler.receiveMuteList([str(id) for id in muteList])
        self.__voipSupported = False
        self.__arenaChannelSupported = False
        for id in tsIdentities:
            if id:
                self.__voipSupported = True
                self.__arenaChannelSupported = bool(
                    tsIdentities[consts.VOIP.CHANNEL_TYPES.ARENA])
                break

        LOG_TRACE('VOIP __onReceiveInitData: voice chat %s' %
                  ('SUPPORTED' if self.__voipSupported else 'NOT SUPPORTED'))
        LOG_TRACE(
            'VOIP __onReceiveInitData: arena channel %s' %
            ('SUPPORTED' if self.__arenaChannelSupported else 'NOT SUPPORTED'))
        self.__channelsMgr.initialize(tsIdentities, muteList)
        self.__applyCaptureDevice()
        self.__refreshVolume()
        for callback in self.__muteListRequests:
            callback(self.__channelsMgr.muteList)

        self.__muteListRequests = []
コード例 #4
0
    def runXmppChatCore(self, spaID, token):
        self.params['spaID'] = spaID
        chatConfig = Settings.g_instance.scriptConfig.xmppChatConfig
        connections = []
        testPortStr = chatConfig.get('useTestPort')
        if testPortStr:
            LOG_TRACE("Xmpp chat: using test port for connection... '%s'" %
                      testPortStr)
            try:
                testPort = int(testPortStr)
                for conn in self.params['xmpp_connections']:
                    connections.append((conn[0], testPort))

            except:
                LOG_TRACE("Xmpp chat: can not use test port '%s'" %
                          testPortStr)

        if connections == []:
            connections = self.params['xmpp_connections']
        BigWorld.XMPPChat.startClient(self.params['xmpp_host'], str(spaID),
                                      str(token),
                                      self.params['xmpp_std_rooms_svc'],
                                      self.params['xmpp_user_rooms_svc'],
                                      self.params['xmpp_specific_rooms_svc'],
                                      self.params['xmpp_clan_rooms_svc'],
                                      connections,
                                      self.params['xmpp_resource'],
                                      Settings.g_instance.clusterID,
                                      chatConfig)
        self.onUpdateChatSettings()
コード例 #5
0
    def __initializeInternal(self):
        VoipEngine.initialise(self.__initArgs)
        self.__initialized = True
        self.__initArgs = {}
        LOG_TRACE('Calling deferred actions...')
        for action in self.__deferredActions:
            action()

        self.__deferredActions = []
        LOG_TRACE('Deferred actions finished.')
コード例 #6
0
ファイル: Channel.py プロジェクト: SEA-group/wowp_scripts
 def onServerMessage(self, msg, args):
     if msg == consts.VOIP.SERVER_MESSAGES.CHAT_CREDENTIALS:
         LOG_TRACE('VOIP channel %s (%s) - received credentials' % (self.typeName, self.stateName))
         self.__voipServiceDown = False
         self._provisioningKey = args['key']
         self._securityHash = args['hash']
         self.processEvent(_FSM_EVENTS.CREDENTIALS_RECEIVED)
     elif msg == consts.VOIP.SERVER_MESSAGES.CHAT_UNAVAILABLE:
         LOG_TRACE('VOIP channel %s (%s) - service is down! ceasing reconnect attempts until further notice' % (self.typeName, self.stateName))
         self.__voipServiceDown = True
         self.processEvent(_FSM_EVENTS.SERVICE_UNAVAILABLE)
コード例 #7
0
    def refreshMemberState(self, dbid):
        channels = dict()
        talkingToChannel = None
        for channelType in xrange(consts.VOIP.CHANNEL_TYPES.QUANTITY):
            stateInChannel = self.__channels[channelType].getMemberState(dbid)
            if stateInChannel != MEMBER_STATES.UNKNOWN:
                channels[
                    channelType] = stateInChannel > MEMBER_STATES.DISCONNECTED
            if talkingToChannel is None and stateInChannel == MEMBER_STATES.TALKING:
                talkingToChannel = channelType

        LOG_TRACE(
            'refreshMemberState: db ID %d, channels %r, talking to channel %s, active channel %s'
            % (dbid, channels,
               consts.VOIP.CHANNEL_TYPES.getConstNameByValue(talkingToChannel),
               consts.VOIP.CHANNEL_TYPES.getConstNameByValue(
                   self.__activeChannel)))
        serviceError = False
        if self.enabled:
            if self.__activeChannel is not None and self.__channels[
                    self.__activeChannel].serviceError:
                serviceError = True
            elif any((channel.serviceError for channel in self.__channels)):
                serviceError = True
        if serviceError and dbid == self.playerID:
            iconID = VOIP_ICON_TYPES.UNAVAILABLE
        else:
            iconID = VOIP_ICON_TYPES.NONE
        if not serviceError and self.connectedAnywhere:
            if self.muteList is not None and dbid in self.muteList:
                iconID = VOIP_ICON_TYPES.MUTED
            elif talkingToChannel == consts.VOIP.CHANNEL_TYPES.ARENA:
                iconID = VOIP_ICON_TYPES.ARENA_CHANNEL_TALKING
            elif talkingToChannel == consts.VOIP.CHANNEL_TYPES.SQUAD:
                iconID = VOIP_ICON_TYPES.SQUAD_CHANNEL_TALKING
            elif talkingToChannel == consts.VOIP.CHANNEL_TYPES.SQUADRON:
                iconID = VOIP_ICON_TYPES.SQUAD_CHANNEL_TALKING
            elif dbid == self.playerID and talkingToChannel is None:
                if self.__activeChannel == consts.VOIP.CHANNEL_TYPES.ARENA:
                    iconID = VOIP_ICON_TYPES.ARENA_CHANNEL
                elif self.__activeChannel == consts.VOIP.CHANNEL_TYPES.SQUAD:
                    iconID = VOIP_ICON_TYPES.SQUAD_CHANNEL
                elif self.__activeChannel == consts.VOIP.CHANNEL_TYPES.SQUADRON:
                    iconID = VOIP_ICON_TYPES.SQUAD_CHANNEL
                else:
                    iconID = VOIP_ICON_TYPES.LISTENING
            elif dbid != self.playerID and self.__activeChannel is not None and self.__activeChannel in channels and not channels[
                    self.__activeChannel]:
                iconID = VOIP_ICON_TYPES.DISCONNECTED
        LOG_TRACE('refreshMemberState: icon %s' %
                  VOIP_ICON_TYPES.getConstNameByValue(iconID))
        self.eventMemberStateChanged(dbid, iconID)
        return
コード例 #8
0
ファイル: Channel.py プロジェクト: SEA-group/wowp_scripts
    def processMessage(self, message, data):
        LOG_TRACE('VOIP channel %s (%s) processMessage: %s' % (self.typeName, self.stateName, ENGINE_PROTOCOL.MESSAGES.getConstNameByValue(message)))
        if message == ENGINE_PROTOCOL.MESSAGES.vmLoggedIn:
            self.processEvent(_FSM_EVENTS.SERVICE_CONNECTED)
            self.__members[self.__mgr.playerID] = MEMBER_STATES.CONNECTED
            self.__onMembersChanged()
            for dbid in self.__mgr.muteList:
                self.applyMemberMuteFlag(dbid, True)

            self.__mgr.refreshVoiceTransmission()
        elif message == ENGINE_PROTOCOL.MESSAGES.vmLoginFailed:
            self.processEvent(_FSM_EVENTS.SERVICE_ERROR, error=int(data[ENGINE_PROTOCOL.KEY_STATUS_CODE]))
        elif message == ENGINE_PROTOCOL.MESSAGES.vmLoggedOut:
            self.processEvent(_FSM_EVENTS.SERVICE_DISCONNECTED, error=int(data[ENGINE_PROTOCOL.KEY_STATUS_CODE]))
            for dbid in self.__members:
                self.__members[dbid] = MEMBER_STATES.DISCONNECTED

            self.__onMembersChanged()
            self.__mgr.refreshVoiceTransmission()
        elif message == ENGINE_PROTOCOL.MESSAGES.vmClientTalkingStatus:
            clientID = int(data[ENGINE_PROTOCOL.KEY_PLAYER_DATABASE_ID])
            talking = data[ENGINE_PROTOCOL.KEY_STATE] == 'True'
            LOG_TRACE('client %d %s' % (clientID, 'TALKING' if talking else 'SILENT'))
            if clientID in self.__members:
                if talking:
                    if self.__members[clientID] != MEMBER_STATES.DISCONNECTED:
                        self.__members[clientID] = MEMBER_STATES.TALKING
                    else:
                        LOG_ERROR('client talking while not connected!')
                elif self.__members[clientID] == MEMBER_STATES.TALKING:
                    self.__members[clientID] = MEMBER_STATES.CONNECTED
                self.__onMembersChanged(clientID)
            elif talking:
                LOG_ERROR('unknown client!')
        elif message == ENGINE_PROTOCOL.MESSAGES.vmClientMoved:
            clientID = int(data[ENGINE_PROTOCOL.KEY_PLAYER_DATABASE_ID])
            LOG_DEBUG('verify')
            verify(clientID != self.__mgr.playerID)
            joined = data[ENGINE_PROTOCOL.KEY_TS_CHANNEL_ID] != '0'
            LOG_TRACE('client %d %s' % (clientID, 'JOINED' if joined else 'LEAVING'))
            if clientID in self.__members:
                if joined:
                    if self.__members[clientID] == MEMBER_STATES.DISCONNECTED:
                        self.__members[clientID] = MEMBER_STATES.CONNECTED
                    muted = clientID in self.__mgr.muteList
                    LOG_TRACE('re-applying mute status (%s) for joined client' % muted)
                    self.applyMemberMuteFlag(clientID, muted)
                else:
                    self.__members[clientID] = MEMBER_STATES.DISCONNECTED
                self.__onMembersChanged(clientID)
            elif joined:
                LOG_ERROR('unknown client joined!')
コード例 #9
0
 def __loadHangarSpace(self, hangarConfig, overrideSpace = None):
     LOG_TRACE('_HangarSpace::__loadHangarSpace', self.__space.spaceLoading(), self.__isVechicleLoading)
     if self.__inLoading():
         LOG_TRACE('_HangarSpace::__loadHangarSpace(hangarConfig=' + str(hangarConfig) + ') - is delayed until space load is done')
         self.__delayedSpaceData = (hangarConfig, overrideSpace)
     else:
         camTargetShifted = False
         if self.__spaceLoaded:
             camTargetShifted = self.__space.hangarCamera.getStateObject().targetShifted
             self.__spaceLoaded = False
             self.__space.destroy()
         waitingID = Waiting.show(HANGAR_LOBBY_WAITING_SCREEN_MESSAGE, WaitingFlags.WORLD_DRAW_DISABLE | WaitingFlags.LOADING_FPS_MODE)
         self.__hangarConfig = hangarConfig
         self.__space.create(hangarConfig, partial(self.__spaceDone, waitingID), overrideSpace=overrideSpace)
         self.__space.hangarCamera.getStateObject().setCameraTargetShift(camTargetShifted)
コード例 #10
0
ファイル: API.py プロジェクト: SEA-group/wowp_scripts
 def setPushToTalk(self, channelType, status, force=False):
     """ Activate or deactivate microphone for talking to a specific channel.
         Even when the microphone is active, actual voice transmission only occurs
         if its volume exceeds the "voice activation level" setting.
     
     @param channelType: Channel we want to talk to (member of consts.VOIP_CHANNEL_TYPES).
                         If push-to-talk is active for several different channels at the same time,
                         only one of them is chosen (e.g. arena has higher priority than squad).
     
                         Push-to-talk changes are ignored in the following cases:
                         - channel is not available or not connected;
                         - channel is explicitly disabled by player;
                         - VOIP module is currently in local test mode.
     
                         All of these cases can be overridden by force argument.
     
     @param status:      True to activate, False to deactivate talking to this channel.
     
     @param force:       True to change status regardless of channel availability and connection status.
                         This must be used for real "push-to-talk" behavior (in battle) when the corresponding
                         hot key must be held, as opposed to toggle-button behavior in lobby.
     """
     if status == self.__channelsMgr.getChannelPushToTalkStatus(
             channelType):
         return
     else:
         LOG_TRACE(
             'VOIP setPushToTalk %s (force %s): channel %s' %
             (status, force,
              consts.VOIP.CHANNEL_TYPES.getConstNameByValue(channelType)))
         if self.__testMode and not force:
             LOG_WARNING('VOIP setPushToTalk ignored in local test mode')
         elif channelType == consts.VOIP.CHANNEL_TYPES.SQUAD and self.__squadID is not None and status == True and not self.__channelsMgr.isChannelAvailable(
                 consts.VOIP.CHANNEL_TYPES.SQUAD
         ) and self.__channelsMgr.enabled:
             LOG_TRACE(
                 'VOIP setPushToTalk: requesting squad channel creation on demand'
             )
             self.setSquadChannelStatus(True)
             self.__channelsMgr.setPushToTalk(channelType, status, force)
         elif not status or force or self.__channelsMgr.canTalkToChannel(
                 channelType):
             self.__channelsMgr.setPushToTalk(channelType, status, force)
         else:
             LOG_WARNING(
                 'VOIP setPushToTalk ignored for unavailable/unconnected channel'
             )
         return
コード例 #11
0
    def getUpgradesList(self, callbacksList, planeID, reload3DModel):
        LOG_TRACE('getUpgradesList(planeID)', planeID)
        if self.__planeSelected is None and planeID is None:
            return
        else:
            aircraftID = planeID or self.__planeSelected.planeID
            upgradesList = self.inventory.getAircraftUpgradesData(aircraftID)
            installedWeapons = self.inventory.getSlotsConfiguration(aircraftID)
            slotsInfo = self.inventory.getAircraftInstalledWeaponsData(aircraftID)
            customPresetUpgrades = self.inventory.getCustomPreset(aircraftID)
            presetAvailableList = self.inventory.getAvailablePresets(aircraftID, True)
            installedPreset = self.inventory.getInstalledPreset(aircraftID)
            if planeID is not None:
                plane = self.getCarouselAirplane(planeID)
                if plane is None:
                    plane = getLobbyAirplane(planeID)
            else:
                plane = self.__planeSelected
            if plane is None or plane.planeID not in self.inventory.aircraftsData:
                LOG_ERROR('getUpgradesList() error', plane is None, plane is not None and plane.planeID not in self.inventory.aircraftsData)
                return
            plane.modules = LobbyAirplaneModules(plane.planeID, upgradesList)
            plane.weapons = LobbyAirplaneWeapons(plane.planeID, upgradesList, installedWeapons)
            plane.weapons.updateSlotsInfo(slotsInfo)
            plane.presets = LobbyAirplanePresets(plane.planeID, plane.modules, plane.weapons, customPresetUpgrades, presetAvailableList, installedPreset)
            plane.presets.fillPresets()
            plane.partTypes = plane.modules.getPartTypes()
            if planeID is None:
                if reload3DModel:
                    self.queryRefresh3DModel(self.__planeSelected)
                self.sendUpgradesListToAS()
            for callback in callbacksList:
                callback()

            return
コード例 #12
0
 def onDestroyChannel(self, type):
     if not self.initialized:
         LOG_TRACE('NOT INITIALIZED - deferring onDestroyChannel()...')
         self.__deferredActions.append(lambda: self.onDestroyChannel(type))
         return
     LOG_TRACE('onDestroyChannel: type {0}'.format(
         consts.VOIP.CHANNEL_TYPES.getConstNameByValue(type)))
     if not self.__tsIdentities[type]:
         LOG_ERROR('unsupported channel type - ignoring')
         return
     channel = self.__channels[type]
     if channel.available:
         channel.onDestroy()
         self.refreshVoiceTransmission()
     else:
         LOG_ERROR('channel does not exist!')
コード例 #13
0
 def enabled(self, enabled):
     if self.__enabled != enabled:
         LOG_TRACE('VOIP: enabled = %s' % enabled)
         self.__enabled = enabled
         self.eventEnabledFlagChanged(self.__enabled)
         for dbid in self.getAllKnownMembers():
             self.refreshMemberState(dbid)
コード例 #14
0
 def visualizeMemberState(self, dbid, iconID, muted, observerType,
                          observer):
     """ Request refresh of a member state (silent/talking/...) icon in GUI.
     
     @param dbid:         database ID of a voice channel member
     @param iconID:       state icon ID - member of clientconsts.VOIP_ICON_TYPES
     @param muted:        is member currently in our mute list (may be used for context menus and such)
     @param observerType: member of consts.VOIP.MEMBER_STATUS_OBSERVER_TYPES
     @param observer:     data specific to observerType (see implementation)
     """
     if observerType == consts.VOIP.MEMBER_STATUS_OBSERVER_TYPES.LOBBY_SQUAD_PANEL:
         from gui.WindowsManager import g_windowsManager
         if g_windowsManager.getLobbyUI() is not None:
             from gui.Scaleform.windows import CustomObject
             args = CustomObject()
             args.dbid = str(dbid)
             args.state = iconID
             g_windowsManager.getLobbyUI().call_1(observer, args)
         else:
             LOG_TRACE('no lobby!')
     elif observerType == consts.VOIP.MEMBER_STATUS_OBSERVER_TYPES.ARENA_HUD:
         if dbid in observer:
             avatarID = observer[dbid]
         else:
             LOG_ERROR('unknown dbid %d' % dbid)
     else:
         LOG_ERROR(
             'visualizeMemberState - invalid observer type {0}'.format(
                 observerType))
     return
コード例 #15
0
    def __call__(self, message, data=None):
        """ Handler for messages from C++ part (BigWorld.VOIP) """
        if data is None:
            data = {}
        if message != ENGINE_PROTOCOL.MESSAGES.vmTick:
            LOG_TRACE('__call__: {0} {1}'.format(
                ENGINE_PROTOCOL.MESSAGES.getConstNameByValue(message), data))
        if ENGINE_PROTOCOL.KEY_CHANNEL_TYPE in data:
            for channel in self.__channels:
                if channel.typeName == data[ENGINE_PROTOCOL.KEY_CHANNEL_TYPE]:
                    channel.processMessage(message, data)
                    break
            else:
                LOG_ERROR('invalid channel type %s' %
                          data[ENGINE_PROTOCOL.KEY_CHANNEL_TYPE])

        elif message == ENGINE_PROTOCOL.MESSAGES.vmCaptureDevices:
            numDevices = int(data[ENGINE_PROTOCOL.KEY_COUNT])
            devices = [
                str(data[ENGINE_PROTOCOL.KEY_CAPTURE_DEVICE_INDEXED % i])
                for i in xrange(numDevices)
            ]
            currentDevice = str(
                data[ENGINE_PROTOCOL.KEY_CURRENT_CAPTURE_DEVICE])
            self.eventCaptureDevicesUpdated(devices, currentDevice)
        elif message == ENGINE_PROTOCOL.MESSAGES.vmTick:
            self.eventTick()
        else:
            LOG_ERROR('unrecognized non-channel-specific message')
        return
コード例 #16
0
 def __syncAircraftsData(self, aircraftID, onSyncedCallback, sendASCallbacks = True):
     if aircraftID < 0:
         self.queryRefresh3DModel(None)
         return
     else:
         carouselAirplane = self.getCarouselAirplane(aircraftID)
         if self.__lobby is not None:
             if carouselAirplane:
                 airplane = self.inventory.getCarouselAircraft(aircraftID)
                 self.__updateCarouselAirplane(carouselAirplane, airplane)
                 if self.inventory.isAircraftBought(aircraftID):
                     if carouselAirplane.blockType & BLOCK_TYPE.IN_BATTLE:
                         GameSound().ui.onPlaneBlocked(aircraftID)
                     elif carouselAirplane.blockType == BLOCK_TYPE.UNLOCKED:
                         GameSound().ui.onPlaneUnlocked(aircraftID)
                     if sendASCallbacks:
                         self.__lobby.call_1('hangar.updateCarouselSlot', aircraftID, carouselAirplane.getCarouselAirplaneObject())
                 else:
                     self.inventory.addAircrafttoBoughtList(aircraftID)
                     if sendASCallbacks:
                         LOG_TRACE('Added new plane to carousel: planeID {0}'.format(carouselAirplane.planeID))
                         self.__lobby.call_1('hangar.addPlaneCarousel', carouselAirplane.getCarouselAirplaneObject(), self.airplanesCount())
                         self.__lobby.call_1('hangar.setSelectedAircraftID', aircraftID)
                         self.queryRefresh3DModel(carouselAirplane)
                     SyncOperationKeeper.stop(FLAGS_CODE.BUY_PLANE)
             if self.__lobby.mode == HANGAR_MODE.RESEARCH:
                 if self.__lobby.researchTreeHelper.enteredInAircraftID:
                     pass
                 else:
                     self.__lobby.researchTreeHelper.reloadCurrentBranch()
         if onSyncedCallback is not None:
             onSyncedCallback(aircraftID)
             if self.__lobby is not None and self.__lobby.mode == HANGAR_MODE.AMMUNITION:
                 self.updateSpecs()
         return
コード例 #17
0
def Init():
    global g_instance
    LOG_TRACE('Init()')
    if g_instance == None:
        g_instance = CameraEffectManager()
        g_instance.init()
    return g_instance
コード例 #18
0
 def __updateCarouselAirplane(self, carouselAirplane, airplane, force = False):
     if carouselAirplane is None:
         LOG_ERROR('Airplane not found', airplane['plane'])
         return
     elif airplane is None:
         return
     else:
         LOG_TRACE('__updateCarouselAirplane() setting block type {0} for {1}'.format(airplane['blockType'], carouselAirplane.planeID))
         from Account import PLANE_BLOCK_TYPE
         PLANE_BLOCK_TYPE[carouselAirplane.planeID] = airplane['blockType']
         carouselAirplane.blockType = airplane['blockType']
         carouselAirplane.repairCost = airplane['repairCost']
         carouselAirplane.experience = airplane['planeXP']
         carouselAirplane.isPrimary = airplane['isPrimary']
         carouselAirplane.autoRepair = airplane['autoRepair']
         carouselAirplane.autoRefill = airplane['autoRefill']
         if carouselAirplane.weapons is not None:
             carouselAirplane.weapons.setInstalledWeapons(airplane['weaponsSlot'])
         if carouselAirplane.modules is not None:
             carouselAirplane.modules.setInstalledModules(airplane['modules'])
         carouselAirplane.sellPrice = airplane['sellPrice']
         carouselAirplane.isPremium = airplane['isPremium']
         carouselAirplane.isElite = airplane['isElite']
         if not carouselAirplane.extraExperience and airplane['dailyFirstWinXPFactor'] or force:
             carouselAirplane.extraExperience = airplane['dailyFirstWinXPFactor']
         if not carouselAirplane.extraRemains and airplane['dailyFirstWinRemains'] or force:
             carouselAirplane.extraRemains = airplane['dailyFirstWinRemains']
         carouselAirplane.isBought = True
         return
コード例 #19
0
 def setMainEntity(self, entity):
     """set main matrix for all camera states from entity"""
     LOG_TRACE('Camera.setMainEntity', entity.id)
     self.__setContext(CameraContext(entity))
     self.__cancelZoomCallback()
     self.__context.entity.setModelVisible(not (
         self.curZoomData.hideModel if self.curZoomData else False))
コード例 #20
0
ファイル: API.py プロジェクト: SEA-group/wowp_scripts
 def setSquadronChannelStatus(self, channelEnabled):
     """ Request to create or delete current squadron's voice channel (affects all squadron members).
         Channel creation is allowed for any member of the squadron, but only squadron leader can delete the channel.
     
     @param channelEnabled: True to request creation of squadron channel, False to request deletion
     """
     if self.__channelsMgr.isChannelSupported(
             consts.VOIP.CHANNEL_TYPES.SQUADRON):
         if self.__squadronID is not None:
             if channelEnabled or self.__squadronOwnerDbID == self.__channelsMgr.playerID:
                 LOG_TRACE(
                     'VOIP setSquadronChannelStatus: squadron %s, status %s'
                     % (self.__squadronID, channelEnabled))
                 self.__channelsMgr.outbox.sendSquadronChannelStatus(
                     self.__squadronID, channelEnabled)
             else:
                 LOG_ERROR(
                     'VOIP setSquadronChannelStatus: only leader can delete the channel!'
                 )
         else:
             LOG_ERROR(
                 'VOIP setSquadronChannelStatus: not a squadron member!')
     else:
         LOG_ERROR(
             'VOIP setSquadronChannelStatus: channel not supported by server'
         )
     return
コード例 #21
0
ファイル: API.py プロジェクト: SEA-group/wowp_scripts
 def onLeaveArenaChannel(self):
     """  Must be called when our arena voice channel is destroyed by Game Server
          (or when this player is no longer allowed inside the channel).
          We must leave it (if not kicked already) and cease any reconnection attempts.
     """
     LOG_TRACE('VOIP onLeaveArenaChannel')
     self.__channelsMgr.onDestroyChannel(consts.VOIP.CHANNEL_TYPES.ARENA)
コード例 #22
0
 def onRoomCreateInitialized(self):
     LOG_DEBUG('onRoomCreateInitialized')
     self.__getAccountCmd().getTrainingCreateRoomFilters(
         self.__setCreateRoomFiltersResponse)
     LOG_TRACE('onRoomCreateInitialized() disabling battle button')
     self.__account.call_1('hangar.isInBattleEnabled', False)
     self.__roomCreateActive = True
コード例 #23
0
def Destroy():
    global g_instance
    LOG_TRACE('Destroy()')
    if g_instance != None:
        g_instance.destroy()
        g_instance = None
    return
コード例 #24
0
ファイル: WebBrowser.py プロジェクト: SEA-group/wowp_scripts
    def performInitialization(self):
        LOG_TRACE('WebBrowser: initializing...')
        areaID = connectionManager.areaID
        loginName = connectionManager.loginName
        if areaID is None or loginName is None:
            LOG_ERROR(
                'WebBrowser: Unable to open browser: bad areaID or loginName in script_config.xml',
                areaID, loginName)
            return
        else:
            try:
                self.kongUrl = Settings.g_instance.scriptConfig.urls[
                    WebBrowser.URL_KONG]
                self.areaID = areaID
                self.userEncoded = base64.b64encode(loginName)
                self.shadow = BigWorld.WebBrowser()
                self.shadow.awesomium.script = self
                GlobalEvents.onKeyEvent += self.handleKeyEvent
                GlobalEvents.onMouseEvent.insert(0, self.handleMouseWheelEvent)
                BigWorld.player().tokenManager.requestToken(
                    self.receiveDatabaseIDAndContinueInitialization)
            except:
                LOG_ERROR('WebBrowser: initialization failed')

            return
コード例 #25
0
    def __refreshFlags():
        flags = WaitingFlags.NONE
        for messageinfo in Waiting.__waitingDict.itervalues():
            flags |= messageinfo.flags

        LOG_TRACE('Current waiting flags: {0}'.format(
            Waiting.__printableFlags(flags)))
        Waiting.__setFlags(flags)
コード例 #26
0
 def updateChannel(self, type, members, leader):
     if not self.initialized:
         LOG_TRACE('NOT INITIALIZED - deferring updateChannel()...')
         self.__deferredActions.append(
             lambda: self.updateChannel(type, members, leader))
         return
     LOG_TRACE('updateChannel: type %s, members: %r, leader: %r' %
               (consts.VOIP.CHANNEL_TYPES.getConstNameByValue(type),
                members, leader))
     if not self.__tsIdentities[type]:
         LOG_ERROR('unsupported channel type - ignoring')
         return
     channel = self.__channels[type]
     if channel.available:
         channel.setMembers(members, leader)
     else:
         LOG_ERROR('channel not registered!')
コード例 #27
0
 def syncClanChatChannel(self):
     import BWPersonality
     LOG_TRACE('Xmpp chat: try to sync chat channel for clan: ',
               BWPersonality.g_initPlayerInfo.clanDBID)
     if int(BWPersonality.g_initPlayerInfo.clanDBID) > 0:
         GameServerMessenger.g_instance.syncClanChatChannel(
             self.__onSyncClanChatChannel)
     else:
         self.__onSyncClanChatChannel(0, 1)
コード例 #28
0
 def syncServData(self):
     LOG_TRACE('syncServData')
     if self.inventory is None:
         waitingSyncID = Waiting.show('LOBBY_LOAD_HANGAR_SPACE_VEHICLE', WaitingFlags.WORLD_DRAW_DISABLE)
         from InventoryClient import InventoryClient
         self.inventory = InventoryClient(BigWorld.player().accountCmd, partial(self.onFinishSyncServData, waitingSyncID))
         self.inventory.setOpSender(BigWorld.player().accountCmd)
     BigWorld.player().syncActionList()
     return
コード例 #29
0
ファイル: API.py プロジェクト: SEA-group/wowp_scripts
 def onLeaveArenaScreen(self):
     """ Must be called when user leaves the arena screen.
         Connection to the arena channel can only be active when in arena screen,
         regardless of the status of the channel itself and any user settings.
     """
     LOG_TRACE('VOIP onLeaveArenaScreen')
     self.__inArenaScreen = False
     self.__channelsMgr.setChannelEnabled(consts.VOIP.CHANNEL_TYPES.ARENA,
                                          False)
コード例 #30
0
ファイル: WebBrowser.py プロジェクト: SEA-group/wowp_scripts
 def receiveDatabaseIDAndContinueInitialization(self, databaseID, token):
     self.databaseID = databaseID
     self.kongUrl = self.kongUrl % {
         'userEncoded': self.userEncoded,
         'areaID': self.areaID,
         'databaseID': self.databaseID
     }
     self.shadow.awesomium.loadURL(self.kongUrl)
     LOG_TRACE('WebBrowser: initialized.')