Jump to content
Korean Random

Вопросы по prbEntityProperty и QueueProvider


Recommended Posts

Всем привет! Захотел научиться делать моды для танков на python и решил начать с открытого мода от spoter  restart random queue. (мод после 5 секунд в очереди рестартит её)

import BigWorld
import constants
from PlayerEvents import g_playerEvents
from gui.Scaleform.daapi.view.lobby.battle_queue import QueueProvider
from gui.prb_control import prbEntityProperty
from helpers import dependency
from skeletons.gui.lobby_context import ILobbyContext
from CurrentVehicle import g_currentVehicle
from gui.shared.gui_items.Vehicle import VEHICLE_CLASS_NAME
from gui.prb_control.dispatcher import g_prbLoader
from gui.Scaleform.daapi.view.lobby.header import battle_selector_items

class Mod:
    lobbyContext = dependency.descriptor(ILobbyContext)

    def __init__(self):
        g_playerEvents.onQueueInfoReceived += self.processQueueInfo
        self._count = 0
        self._exitCallback = None
        return

    @prbEntityProperty
    def prbEntity(self):
        return None

    def processQueueInfo(self, _):
        if self.prbEntity is None:
            self._count = 0
            self._exitCallback = None
            return
        else:
            currPlayer = BigWorld.player()
            if currPlayer is not None and hasattr(currPlayer, 'requestQueueInfo'):
                prbDispatcher = g_prbLoader.getDispatcher()
                if prbDispatcher is not None and self.lobbyContext.isFightButtonPressPossible() and self.prbEntity.getQueueType() == constants.ARENA_GUI_TYPE.RANDOM and self._count:
                    state = prbDispatcher.getFunctionalState()
                    if battle_selector_items.getItems().update(state).isInSquad(state):
                        return
                    vehicle = g_currentVehicle.item
                    if vehicle is not None and vehicle.type != VEHICLE_CLASS_NAME.SPG:
                        self.prbEntity.exitFromQueue()
                        self.restartEnqueueRandom()
            self._count += 1
            return

    def restartEnqueueRandom(self):
        if not self.prbEntity:
            return
        if not self.prbEntity.isInQueue():
            self.prbEntity.exitFromQueue()
            return
        self._exitCallback = BigWorld.callback(0.7, self.restartEnqueueRandom)

    def start(self):
        self._count = 0
        self._exitCallback = None
        return


mod = Mod()

def newStart(self):
    oldStart(self)
    mod.start()


oldStart = QueueProvider.start
QueueProvider.start = newStart
print '[LOAD_MOD]:  [mod_restartRandomQueue 1.12 (13-08-2023), by spoter]'

Как тут реализован отсчет до 5 сек? Как я понимаю prbEntityProperty отвечает только за состояние кнопки "В бой" это так или у нее есть еще какие-то фишки? А с помощью QueueProvider в данном скрипте реализован вход и окончание очереди? Какая функция в данном скрипте заканчивает очередь и начинает ее? 

Link to comment
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...