Montec 0 Posted August 28, 2015 Здравствуйте! Нужен скрипт, который бы выводил при входе в игру в "Центре уведомлений" сообщение с определенным текстом и ссылкой. Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #289027 Posted August 29, 2015 (edited) 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 Edited August 29, 2015 by ShadowHunterRUS 2 Quote Share this post Link to post Short link Share on other sites
Ekspoint 2,122 #289033 Posted August 29, 2015 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 shot_008.jpg а что бы оно всплывало что нужно сделать? 1 1 Quote Share this post Link to post Short link Share on other sites
AtotIK 580 #289034 Posted August 29, 2015 а что бы оно всплывало что нужно сделать? Хук Account.onBecomePlayer. 1 1 Quote Share this post Link to post Short link Share on other sites
Ekspoint 2,122 #289039 Posted August 29, 2015 Хук Account.onBecomePlayer. эт как 1 3 Quote Share this post Link to post Short link Share on other sites
Montec 0 #289075 Posted August 30, 2015 (edited) 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 shot_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 August 30, 2015 by Montec 1 1 Quote Share this post Link to post Short link Share on other sites
Ekspoint 2,122 #289087 Posted August 30, 2015 Вот вроде рабочий вариант (с 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 и где же тут кнопки в сообщении 3 Quote Share this post Link to post Short link Share on other sites
Montec 0 #289089 Posted August 30, 2015 и где же тут кнопки в сообщении Какие еще кнопки? Quote Share this post Link to post Short link Share on other sites
Ekspoint 2,122 #289090 Posted August 30, 2015 Какие еще кнопки? 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 1 1 Quote Share this post Link to post Short link Share on other sites