Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import BigWorld
- from gui import SystemMessages
- from ResMgr import openSection as _openSection
- from BigWorld import wg_getProductVersion as _productVersion
- from gui.Scaleform.daapi.view.lobby.LobbyView import LobbyView
- class testClass(object):
- def __init__(self):
- g_hookUtil.INJECT(LobbyView, '_populate')(self.__hooked_populate)
- def __hooked_populate(self, baseMethod, baseObject):
- baseMethod(baseObject)
- SystemMessages.pushMessage("Mod Enable", SystemMessages.SM_TYPE.Warning)
- def _overrideMethod(handler, cls, method):
- orig = getattr(cls, method)
- new = lambda *args, **kwargs: handler(orig, *args, **kwargs)
- setattr(cls, method, new if type(orig) is not property else property(new))
- def _overrideStaticMethod(handler, cls, method):
- orig = getattr(cls, method)
- new = staticmethod(lambda *args, **kwargs: handler(orig, *args, **kwargs))
- setattr(cls, method, new if type(orig) is not property else property(new))
- def _hookDecorator(func):
- def _oneDecorator(*args, **kwargs):
- def _twoDecorator(handler):
- func(handler, *args, **kwargs)
- return _twoDecorator
- return _oneDecorator
- class hookUtil():
- VERSION = tuple(map(int, _productVersion().split('.')))
- PATH = _openSection('../paths.xml')['Paths'].values()[0].asString
- MODS = '/'.join([PATH, 'scripts', 'client', 'mods'])
- GUI_MODS = '/'.join([PATH, 'scripts', 'client', 'gui', 'mods'])
- INJECT = staticmethod(_hookDecorator(_overrideMethod))
- OVERRIDE_STATIC = staticmethod(_hookDecorator(_overrideStaticMethod))
- g_hookUtil = hookUtil()
- g_testClass = testClass()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement