def onAction(self, action): chatCommands = g_sessionProvider.getChatCommands() if action in self.TARGET_ACTIONS: chatCommands.sendTargetedCommand(action, self.__currentTarget.id) elif action == self.RELOADING_GUN_ACTION: chatCommands.sendReloadingCommand() else: chatCommands.sendCommand(action)
def __onMapClickInSimpleMode(self, x, y, bHighlightCellNVehicleSpecific): localPos = (x - 0.5, y - 0.5) mapSize = Minimap.__MINIMAP_SIZE player = BigWorld.player() if bHighlightCellNVehicleSpecific: cellCount = Minimap.__MINIMAP_CELLS row = int(cellCount[0] * localPos[0] / mapSize[0]) column = int(cellCount[1] * localPos[1] / mapSize[1]) g_sessionProvider.getChatCommands().sendAttentionToCell(row * int(cellCount[1]) + column) elif 'SPG' in player.vehicleTypeDescriptor.type.tags: arenaDesc = BigWorld.player().arena.arenaType (bottomLeft, upperRight,) = arenaDesc.boundingBox spaceSize = upperRight - bottomLeft viewpoint = (upperRight + bottomLeft) * 0.5 viewpointTranslate = Math.Matrix() viewpointTranslate.setTranslate((viewpoint.x, 0.0, viewpoint.y)) pos = ((localPos[0] - mapSize[0] * 0.5) / mapSize[0], (localPos[1] - mapSize[1] * 0.5) / mapSize[1]) worldPos = Math.Matrix(viewpointTranslate).applyPoint((pos[0] * spaceSize[0], 0.0, -pos[1] * spaceSize[1])) player.inputHandler.onMinimapClicked(worldPos)
def getCommandfactory(self): from gui.battle_control import g_sessionProvider cmdFc = g_sessionProvider.getChatCommands().proto.battleCmd if cmdFc is None: LOG_ERROR('Commands factory is not defined') return cmdFc