Jump to content
Korean Random
P.vasiliy

isAnonymized

Recommended Posts

Подсткажите уважаемые гуру. Как я могу получить информацию о том что у меня активен режим анонима, находясь в бою.

Пробую получить таким образом:

from Vehicle import Vehicle
from helpers import dependency
from skeletons.gui.game_control import IAnonymizerController

ctrl = IAnonymizerController
old_onEnterWorld = Vehicle.onEnterWorld

def new_onEnterWorld(self, prereqs):
    print ctrl.isAnonymized
    return old_onEnterWorld(self, prereqs)

Vehicle.onEnterWorld = new_onEnterWorld

В логе получаю лишь слекдующее:

INFO: <property object at 0x207AAE10>

Пробовал так:

from Vehicle import Vehicle
from helpers import dependency
from skeletons.gui.shared import IItemsCache

itemsCache = dependency.descriptor(IItemsCache)
old_onEnterWorld = Vehicle.onEnterWorld

def new_onEnterWorld(self, prereqs):
    print itemsCache.items.anonymizer.isPlayerAnonymized
    return old_onEnterWorld(self, prereqs)

Vehicle.onEnterWorld = new_onEnterWorld

Получаю:

ERROR:     print itemsCache.items.anonymizer.isPlayerAnonymized
ERROR: AttributeError: '_ServiceDescriptor' object has no attribute 'items'

Как правильно делать запрос?

Share this post


Link to post

Short link
Share on other sites

Ничего не утверждаю, но может в первом варианте нужно вместо

ctrl = IAnonymizerController

писать так:

ctrl = dependency.descriptor(IAnonymizerController)

?

Судя по импортам, так и задумывалось...

Share this post


Link to post

Short link
Share on other sites
16 часов назад, MakcT40 сказал:

писать так

 

from Vehicle import Vehicle
from helpers import dependency
from skeletons.gui.game_control import IAnonymizerController

ctrl = dependency.descriptor(IAnonymizerController)
old_onEnterWorld = Vehicle.onEnterWorld

def new_onEnterWorld(self, prereqs):
    print ctrl.isAnonymized
    return old_onEnterWorld(self, prereqs)

Vehicle.onEnterWorld = new_onEnterWorld
ERROR:     print ctrl.isAnonymized
ERROR: AttributeError: '_ServiceDescriptor' object has no attribute 'isAnonymized'
16 часов назад, MakcT40 сказал:

Судя по импортам, так и задумывалось

 

В скриптах клиента так прописано было.

В этом скрипте

Share this post


Link to post

Short link
Share on other sites

@P.vasiliy , можно через сравнение ника.

from Vehicle import Vehicle
from helpers import dependency
from skeletons.gui.battle_session import IBattleSessionProvider

sessionProvider = dependency.descriptor(IBattleSessionProvider)
old_onEnterWorld = Vehicle.onEnterWorld

def new_onEnterWorld(self, prereqs):
    if self.isPlayerVehicle:
        vInfoVO = sessionProvider.getArenaDP().getVehicleInfo(self.id)
            if vInfoVO.player.name != vInfoVO.player.fakeName:
                print 'isAnonymized'
    return old_onEnterWorld(self, prereqs)

Vehicle.onEnterWorld = new_onEnterWorld

 

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

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