Jump to content
Korean Random
Sign in to follow this  
arom

Не чинил ли кто voip_manager ?

Recommended Posts

Попробовал старенький экспойнтовский voip_manager, не работает и жалуется на импорт cannot import name g_appLoader.

Не починит ли уважаемый кто-нибудь?

 

import re
import Keys
import game
import codecs
import BigWorld
from json import dumps
from json import loads
from os import makedirs
from os.path import isdir
from os.path import exists
from os.path import isfile
from ResMgr import openSection
from game import convertKeyEvent
from gui.app_loader import g_appLoader
from gui.SystemMessages import SM_TYPE
from gui.SystemMessages import pushMessage
from account_helpers.settings_core import settings_constants

class Config(ConfigClass):
    
    def __init__(self):
        self.data = { }
        self.version = '0.1.0'
        self.author = 'Ekspoint'
        self.appName = 'voip_manager'
        self.path = self.json_section()[3]
        self.appFile = 'mod_' + self.appName + '.json'
        self.default()
        self.load_info()
        self.load_json(self.appFile, self.path)

    
    def default(self):
        self.data = {
            'Voice_hotKey': 'KEY_NUMPADPERIOD',
            'Mic_hotKey': 'KEY_NUMPAD0' }


configs = Config()

class MicGetSetting(object):
    
    def __init__(self):
        self.data = False


mic_setting = MicGetSetting()
from gui.Scaleform.framework import ViewTypes
from gui.Scaleform.daapi.view.battle.shared.messages.fading_messages import _COLOR_TO_METHOD as COLOR_MESSAGES

def showMessageOnPanel(msgType, msgKey, msgText, msgColor):
    if g_appLoader.getDefBattleApp() is not None and msgType in ('Vehicle', 'VehicleError', 'Player'):
        panel = g_appLoader.getDefBattleApp().containerManager.getContainer(ViewTypes.VIEW).getView().components['battle' + msgType + 'Messages']
        if msgColor in COLOR_MESSAGES:
            getattr(panel, COLOR_MESSAGES[msgColor])(msgKey, msgText)
        


def handleKeyEvent(event):
    if hotKeys.getLobby() and hotKeys.hotKey(event, configs.data['Voice_hotKey']):
        if skeletons.settingsCore.getSetting(settings_constants.SOUND.VOIP_ENABLE) == True:
            skeletons.settingsCore.applySetting(settings_constants.SOUND.VOIP_ENABLE, False)
            pushMessage(u"<font color='#eb2222'>\xd0\x93\xd0\xbe\xd0\xbb\xd0\xbe\xd1\x81\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x8f \xd1\x81\xd0\xb2\xd1\x8f\xd0\xb7\xd1\x8c \xd0\xb2\xd1\x8b\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd\xd0\xb0.</font>", SM_TYPE.GameGreeting)
        else:
            skeletons.settingsCore.applySetting(settings_constants.SOUND.VOIP_ENABLE, True)
            pushMessage(u"<font color='#12c812'>\xd0\x93\xd0\xbe\xd0\xbb\xd0\xbe\xd1\x81\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x8f \xd1\x81\xd0\xb2\xd1\x8f\xd0\xb7\xd1\x8c \xd0\xb2\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd\xd0\xb0.</font>", SM_TYPE.GameGreeting)
    
    if hotKeys.getBattle() and hotKeys.hotKey(event, configs.data['Voice_hotKey']):
        if skeletons.settingsCore.getSetting(settings_constants.SOUND.VOIP_ENABLE) == True:
            skeletons.settingsCore.applySetting(settings_constants.SOUND.VOIP_ENABLE, False)
            showMessageOnPanel('Player', 0, u'\xd0\x93\xd0\xbe\xd0\xbb\xd0\xbe\xd1\x81\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x8f \xd1\x81\xd0\xb2\xd1\x8f\xd0\xb7\xd1\x8c \xd0\xb2\xd1\x8b\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd\xd0\xb0.', 'red')
        else:
            skeletons.settingsCore.applySetting(settings_constants.SOUND.VOIP_ENABLE, True)
            showMessageOnPanel('Player', 0, u'\xd0\x93\xd0\xbe\xd0\xbb\xd0\xbe\xd1\x81\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x8f \xd1\x81\xd0\xb2\xd1\x8f\xd0\xb7\xd1\x8c \xd0\xb2\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd\xd0\xb0.', 'green')
    
    if hotKeys.getLobby() and hotKeys.hotKey(event, configs.data['Mic_hotKey']):
        if skeletons.settingsCore.getSetting(settings_constants.SOUND.VOIP_ENABLE) == True and mic_setting.data == True:
            mic_setting.data = False
            BigWorld.VOIP.disableMicrophone()
            pushMessage(u"<font color='#eb2222'>\xd0\x9c\xd0\xb8\xd0\xba\xd1\x80\xd0\xbe\xd1\x84\xd0\xbe\xd0\xbd \xd0\xb2\xd1\x8b\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd.</font>", SM_TYPE.GameGreeting)
        elif skeletons.settingsCore.getSetting(settings_constants.SOUND.VOIP_ENABLE) == True and mic_setting.data == False:
            mic_setting.data = True
            BigWorld.VOIP.enableMicrophone()
            pushMessage(u"<font color='#12c812'>\xd0\x9c\xd0\xb8\xd0\xba\xd1\x80\xd0\xbe\xd1\x84\xd0\xbe\xd0\xbd \xd0\xb2\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd.</font>", SM_TYPE.GameGreeting)
        
    
    if hotKeys.getBattle() and hotKeys.hotKey(event, configs.data['Mic_hotKey']):
        if skeletons.settingsCore.getSetting(settings_constants.SOUND.VOIP_ENABLE) == True and mic_setting.data == True:
            mic_setting.data = False
            BigWorld.VOIP.disableMicrophone()
            showMessageOnPanel('Player', 0, u'\xd0\x9c\xd0\xb8\xd0\xba\xd1\x80\xd0\xbe\xd1\x84\xd0\xbe\xd0\xbd \xd0\xb2\xd1\x8b\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd.', 'red')
        elif skeletons.settingsCore.getSetting(settings_constants.SOUND.VOIP_ENABLE) == True and mic_setting.data == False:
            mic_setting.data = True
            BigWorld.VOIP.enableMicrophone()
            showMessageOnPanel('Player', 0, u'\xd0\x9c\xd0\xb8\xd0\xba\xd1\x80\xd0\xbe\xd1\x84\xd0\xbe\xd0\xbd \xd0\xb2\xd0\xba\xd0\xbb\xd1\x8e\xd1\x87\xd0\xb5\xd0\xbd.', 'green')
        
    

hotKeys.handleKeyEvent += handleKeyEvent

 

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...