Jump to content
Korean Random
Frost_DeatH

get name in python

Recommended Posts

hi i try this modpack notificator:

 

http://forum.worldoftanks.eu/index.php?/topic/501371-09-webiums-modpack-version-checker-009-beta/#topmost

 

text from mod_modpackchcek.pyc : (....0.9.15.0.1\scripts\client\gui\mods)

 

download file >>

 

# Embedded file name: mod_modpackCheck
""" Webium's modpack checker """
__author__ = 'webium'
__copyright__ = 'Copyright 2015'
__version__ = '0.0.9'
__email__ = '[email protected]'
__status__ = 'Beta'
import BigWorld
import os
from debug_utils import *
import GUI
import ResMgr
import urllib2
from urllib2 import Request, urlopen, URLError, HTTPError
import urllib
from xml.dom.minidom import parseString
from gui.shared.event_bus import SharedEvent

def checkVersion():
    versionXml = ResMgr.openSection('../configs/modpackVersion.xml')
    if versionXml is not None:
        installedVersion = versionXml.readString('Version')
        remote = versionXml.readString('RemoteServer')
    else:
        installedVersion = '0'
        remote = 'http://www.google.com'
        LOG_ERROR('Unable to load local file: configs/modpackVersion.xml')
    checkInterval = ''
    modpackXml = ResMgr.openSection('../configs/modpackCheck.xml')
    if modpackXml is not None:
        Toggle = modpackXml.readString('Toggle')
        checkInterval = modpackXml.readString('CheckInterval')
        modpackName = modpackXml.readString('ModpackName')
        modpackUrl = modpackXml.readString('UpdateLink')
        updateAvailable = modpackXml.readString('UpdateAvailable')
        upToDate = modpackXml.readString('UpToDate')
        updateText = modpackXml.readString('UpdateText')
        updateUrl = modpackXml.readString('UpdateLink')
        supportText = modpackXml.readString('SupportText')
        supportUrl = modpackXml.readString('SupportLink')
        ChangelogToggle = modpackXml.readString('ChangelogToggle')
        ChangelogTitle = modpackXml.readString('ChangelogTitle')
        Author = modpackXml.readString('Author')
        VersionText = modpackXml.readString('VersionText')
        ColorModpackName = modpackXml.readString('ColorModpackName')
        ColorAuthor = modpackXml.readString('ColorAuthor')
        ColorActual = modpackXml.readString('ColorActual')
        ColorOutdated = modpackXml.readString('ColorOutdated')
        ColorInfo = modpackXml.readString('ColorInfo')
        ColorBeta = modpackXml.readString('ColorBeta')
        ColorLink = modpackXml.readString('ColorLink')
        Icon = modpackXml.readString('Icon')
        IWidth = modpackXml.readString('IconWidth')
        IHeight = modpackXml.readString('IconHeight')
    else:
        Toggle = 'ON'
        checkInterval = '7200'
        modpackName = 'webium modpack'
        modpackUrl = 'http://www.mywotmods.com/'
        updateAvailable = ' is available. '
        upToDate = ' is up to date.'
        updateText = 'Download'
        updateUrl = 'http://www.mywotmods.com/mods/mod-packs/item/10-webium-s-mods-pack'
        supportText = ''
        supportUrl = ''
        ChangelogToggle = 'OFF'
        ChangelogTitle = 'Changelog:'
        Author = 'Author'
        VersionText = 'Version'
        ColorModpackName = '#00BEFF'
        ColorAuthor = '#FFFFFF'
        ColorActual = '#0EFE0E'
        ColorOutdated = '#FF0000'
        ColorInfo = '#30d3eb'
        ColorBeta = '#FBCF38'
        ColorLink = '#FBCF38'
        Icon = ''
        IWidth = ''
        IHeight = ''
        LOG_ERROR('Unable to load local file: configs/modpackCheck.xml')
    latestVersion = 'Unknown'
    changelogXml = '-'
    infoXml = '-'
    betaVersion = 'Beta'
    infoBeta = '-'
    hdr = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0'}
    request = urllib2.Request(remote, headers=hdr)
    try:
        file = urllib2.urlopen(request, timeout=1)
        data = file.read()
        file.close()
        dom = parseString(data)
        latestVersion = dom.getElementsByTagName('version')[0].firstChild.data
        changelogXml = dom.getElementsByTagName('changes')[0].firstChild.data
        infoXml = dom.getElementsByTagName('info')[0].firstChild.data
        infoBeta = dom.getElementsByTagName('beta')[0].firstChild.data
    except HTTPError as e:
        print "Remote file: The server couldn't fulfill the request."
        print 'Error code: ', e.code
    except URLError as e:
        print 'Remote file: We failed to reach a server.'
        print 'Reason: ', e.reason
    else:
        print modpackName + ' remote file: Everything seems OK'

    def new_NotificationsActionsHandlers_handleAction(self, model, typeID, entityID, actionName):
        import sys, re
        regex = re.compile('^https?://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+[A-Z]{2,6}\\.?|\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})(?::\\d+)?(?:/?|[/?]\\S+)$', re.IGNORECASE)
        if regex.match(actionName) is None:
            return old_NotificationsActionsHandlers_handleAction(self, model, typeID, entityID, actionName)
        else:
            from gui.shared import g_eventBus, events
            g_eventBus.handleEvent(events.OpenLinkEvent(events.OpenLinkEvent.SPECIFIED, actionName))
            return

    from notification.actions_handlers import NotificationsActionsHandlers
    old_NotificationsActionsHandlers_handleAction = NotificationsActionsHandlers.handleAction
    NotificationsActionsHandlers.handleAction = new_NotificationsActionsHandlers_handleAction
    from gui import SystemMessages, makeHtmlString
    linkText1 = updateText
    linkURL1 = modpackUrl
    linkText2 = supportText
    linkURL2 = supportUrl
    link1 = makeHtmlString('html_templates:lobby/system_messages', 'link', {'text': linkText1,
     'linkType': linkURL1})
    link2 = makeHtmlString('html_templates:lobby/system_messages', 'link', {'text': linkText2,
     'linkType': linkURL2})
    sys_msg = ''

    def message():
        try:
            if len(sys_msg) != 0:
                if SystemMessages.g_instance is None:
                    BigWorld.callback(4.0, message)
                else:
                    SystemMessages.pushMessage(sys_msg, type)
        except:
            LOG_CURRENT_EXCEPTION()
            return

        return

    if installedVersion == latestVersion:
        Color = ColorActual
    elif installedVersion < latestVersion:
        Color = ColorOutdated
    else:
        Color = ColorBeta
    if Icon == '':
        messageTitle = '<p align="center"><font color="' + ColorModpackName + '"><b>' + modpackName + '</b></font> <font color="' + Color + '"><b>' + installedVersion + '</b></font> <font color="' + ColorAuthor + '">' + Author + '</font></p>'
    else:
        messageTitle = '<img src="img://' + Icon + '" height="' + IHeight + '" width="' + IWidth + '"> <p align="center"><font color="' + ColorModpackName + '"><b>' + modpackName + '</b></font> <font color="' + Color + '"><b>' + installedVersion + '</b></font> <font color="' + ColorAuthor + '">' + Author + '</font></p>'
    actual = '<p align="center"><font color="' + ColorActual + '"><b>' + upToDate + '</b></font></p>'
    outdated = '<p align="center"><font color="' + Color + '" size="14"><b>' + VersionText + ' ' + latestVersion + ' ' + updateAvailable + '</b></font></p>'
    if ChangelogToggle == 'ON' and changelogXml != '-':
        ChangeLogMessage = '\n<p><font color="">' + ChangelogTitle + '</font></p>\n<p><font size="12" color="">' + changelogXml + '</font></p>'
    else:
        ChangeLogMessage = ''
    if infoXml == '-':
        infoMessage = ''
    else:
        infoMessage = '\n<p align="center"><font color="' + ColorInfo + '">' + infoXml + '</font></p>'
    if infoBeta == '-':
        betaMessage = ''
    else:
        betaMessage = '\n<p align="center"><font color="' + ColorInfo + '">' + infoBeta + '</font></p>'
    if installedVersion == latestVersion:
        type = SystemMessages.SM_TYPE.Information
        sys_msg = messageTitle + '\n' + actual + '         \n<p align="center"><font color="' + ColorLink + '" size="16">' + link2 + '</font></p>' + infoMessage
    elif installedVersion > latestVersion:
        type = SystemMessages.SM_TYPE.GameGreeting
        sys_msg = messageTitle + '         \n<p align="center"><font color="' + ColorLink + '"><b>' + betaVersion + ' ' + VersionText + '</b></font> ' + '</p>' + betaMessage
    elif installedVersion < latestVersion:
        type = SystemMessages.SM_TYPE.Warning
        sys_msg = messageTitle + '\n' + outdated + ChangeLogMessage + ' \t\n<p align="center"><font color="' + ColorLink + '" size="16"><b>' + link1 + '</b> + <b>' + link2 + '</b></font></p>' + infoMessage
    else:
        LOG_ERROR('Something went wrong')
    BigWorld.flushPythonLog()
    BigWorld.callback(6.0, message)
    if Toggle == 'ON' and checkInterval != '':
        BigWorld.callback(int(checkInterval), checkVersion)
    print '[INFO] ' + modpackName + ' installed: ', installedVersion, ', latest ' + modpackName + ' available: ', latestVersion
    print '[INFO] Toggle is ' + Toggle
    print '[INFO] Version check Interval: ' + checkInterval
    return


checkVersion()

 

i need load name in python, i want text : "player name" thx for download.

5tbTzVf.jpgazchEf1.jpg

 

i want rebuilt this notificator, i need load player name...thx for help.

 

 

modpackchcek009.rar

mod_modpackCheck.rar

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.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...