Jump to content
Korean Random
Montec

[Заказ] Нужен скрипт

Recommended Posts

Здравствуйте! Нужен скрипт, который бы выводил при входе в игру в "Центре уведомлений" сообщение с определенным текстом и ссылкой.

Share this post


Link to post

Short link
Share on other sites

http://www.koreanrandom.com/forum/topic/25584-как-создать-сообщение-с-кнопками-в-центре-уведо/?p=280614

http://www.koreanrandom.com/forum/topic/22719-как-сделать-ссылку-в-центре-уведомлений-кликаб/?p=265852

 

"Собрал воедино"

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

from notification.actions_handlers import NotificationsActionsHandlers
old_NotificationsActionsHandlers_handleAction = NotificationsActionsHandlers.handleAction
NotificationsActionsHandlers.handleAction = new_NotificationsActionsHandlers_handleAction
from notification.NotificationListView import NotificationListView

old_populate = NotificationListView._populate
def new_populate(self):
    message = {
        'typeID': 1,
        'message': {
            'bgIcon': '',
            'defaultIcon': '',
            'savedData': 0,
            'timestamp': -1,
            'filters': [],
            'message': '<a href="event:http://yandex.ru">YANDEX</a>',
            'type': 'black',
            'icon': '',
        },
        'entityID': 99999,
        'auxData': ['GameGreeting']
    }
    old_populate(self)
    self.as_appendMessageS(message)

NotificationListView._populate = new_populate

post-16296-0-14088200-1440840180_thumb.jpg

Edited by ShadowHunterRUS
  • Upvote 2

Share this post


Link to post

Short link
Share on other sites

http://www.koreanrandom.com/forum/topic/25584-как-создать-сообщение-с-кнопками-в-центре-уведо/?p=280614

http://www.koreanrandom.com/forum/topic/22719-как-сделать-ссылку-в-центре-уведомлений-кликаб/?p=265852

 

"Собрал воедино"

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

from notification.actions_handlers import NotificationsActionsHandlers
old_NotificationsActionsHandlers_handleAction = NotificationsActionsHandlers.handleAction
NotificationsActionsHandlers.handleAction = new_NotificationsActionsHandlers_handleAction
from notification.NotificationListView import NotificationListView

old_populate = NotificationListView._populate
def new_populate(self):
    message = {
        'typeID': 1,
        'message': {
            'bgIcon': '',
            'defaultIcon': '',
            'savedData': 0,
            'timestamp': -1,
            'filters': [],
            'message': '<a href="event:http://yandex.ru">YANDEX</a>',
            'type': 'black',
            'icon': '',
        },
        'entityID': 99999,
        'auxData': ['GameGreeting']
    }
    old_populate(self)
    self.as_appendMessageS(message)

NotificationListView._populate = new_populate

attachicon.gifshot_008.jpg

 

а что бы оно всплывало что нужно сделать?

  • Upvote 1
  • Downvote 1

Share this post


Link to post

Short link
Share on other sites

а что бы оно всплывало что нужно сделать?

Хук Account.onBecomePlayer.

  • Upvote 1
  • Downvote 1

Share this post


Link to post

Short link
Share on other sites

http://www.koreanrandom.com/forum/topic/25584-как-создать-сообщение-с-кнопками-в-центре-уведо/?p=280614

http://www.koreanrandom.com/forum/topic/22719-как-сделать-ссылку-в-центре-уведомлений-кликаб/?p=265852

 

"Собрал воедино"

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

from notification.actions_handlers import NotificationsActionsHandlers
old_NotificationsActionsHandlers_handleAction = NotificationsActionsHandlers.handleAction
NotificationsActionsHandlers.handleAction = new_NotificationsActionsHandlers_handleAction
from notification.NotificationListView import NotificationListView

old_populate = NotificationListView._populate
def new_populate(self):
    message = {
        'typeID': 1,
        'message': {
            'bgIcon': '',
            'defaultIcon': '',
            'savedData': 0,
            'timestamp': -1,
            'filters': [],
            'message': '<a href="event:http://yandex.ru">YANDEX</a>',
            'type': 'black',
            'icon': '',
        },
        'entityID': 99999,
        'auxData': ['GameGreeting']
    }
    old_populate(self)
    self.as_appendMessageS(message)

NotificationListView._populate = new_populate

attachicon.gifshot_008.jpg

 

 

Ссылка не работает

 

а что бы оно всплывало что нужно сделать?

 

 

Вот вроде рабочий вариант (с XVM и без). Во всплывающем окне.

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

from notification.actions_handlers import NotificationsActionsHandlers
old_NotificationsActionsHandlers_handleAction = NotificationsActionsHandlers.handleAction
NotificationsActionsHandlers.handleAction = new_NotificationsActionsHandlers_handleAction

import BigWorld
from gui import SystemMessages
from Account import Account

link = Account.onBecomePlayer

def _First(self):
        link(self)
        msg = 'Сайт игры <a href="event:http://worldoftanks.ru">worldoftanks.ru</a>'
        type = SystemMessages.SM_TYPE.GameGreeting
        SystemMessages.pushMessage(msg, type)
        Account.onBecomePlayer = link

Account.onBecomePlayer = _First
Edited by Montec
  • Upvote 1
  • Downvote 1

Share this post


Link to post

Short link
Share on other sites

Вот вроде рабочий вариант (с XVM и без). Во всплывающем окне.

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

from notification.actions_handlers import NotificationsActionsHandlers
old_NotificationsActionsHandlers_handleAction = NotificationsActionsHandlers.handleAction
NotificationsActionsHandlers.handleAction = new_NotificationsActionsHandlers_handleAction

import BigWorld
from gui import SystemMessages
from Account import Account

link = Account.onBecomePlayer

def _First(self):
        link(self)
        msg = 'Сайт игры <a href="event:http://worldoftanks.ru">worldoftanks.ru</a>'
        type = SystemMessages.SM_TYPE.GameGreeting
        SystemMessages.pushMessage(msg, type)
        Account.onBecomePlayer = link

Account.onBecomePlayer = _First

и где же тут кнопки в сообщении

  • Downvote 3

Share this post


Link to post

Short link
Share on other sites

Какие еще кнопки?

from sys import modules
from gui.shared import g_eventBus
from gui.shared.events import OpenLinkEvent
from notification.NotificationListView import NotificationListView
from notification.actions_handlers import NotificationsActionsHandlers

def new_NotificationsActionsHandlers_handleAction(self, model, typeID, entityID, actionName):
    if actionName.lower().find('http://') or actionName.lower().find('https://') is None:
        return old_NotificationsActionsHandlers_handleAction(self, model, typeID, entityID, actionName)
    else:
        if 'xfw' not in modules:
            g_eventBus.handleEvent(OpenLinkEvent(OpenLinkEvent.SPECIFIED, actionName))
        return None


old_NotificationsActionsHandlers_handleAction = NotificationsActionsHandlers.handleAction
NotificationsActionsHandlers.handleAction = new_NotificationsActionsHandlers_handleAction

def new_populate(self):
    message = {'typeID': 1,
     'message': {'bgIcon': '',
                 'defaultIcon': '',
                 'savedData': 0,
                 'timestamp': -1,
                 'filters': [],
                 'buttonsLayout': [],
                 'message': '<a href="event:http://yandex.ru">YANDEX</a>',
                 'type': 'black',
                 'icon': 'img://gui/maps/icons/buttons/remove.png'
                 }
                 },
     'entityID': 99999,
     'auxData': ['GameGreeting']}
    message['message']['buttonsLayout'].append({
        'action': 'dummy',
		'type': 'cancel',
        'width': 40,
        'label': 'dummy'})
    message['message']['buttonsLayout'].append({
        'action': 'Reload',
		'type': 'submit',
        'width': 40,
        'label': 'submit'})

    old_populate(self)
    self.as_appendMessageS(message)

old_populate = NotificationListView._populate
NotificationListView._populate = new_populate 

  • Upvote 1
  • Downvote 1

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...