net.runelite.api.Client Java Examples

The following examples show how to use net.runelite.api.Client. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TabInterface.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Inject
private TabInterface(
	final Client client,
	final ClientThread clientThread,
	final ItemManager itemManager,
	final TagManager tagManager,
	final TabManager tabManager,
	final ChatboxPanelManager chatboxPanelManager,
	final BankTagsConfig config,
	final Notifier notifier,
	final BankSearch bankSearch,
	final ChatboxItemSearch searchProvider)
{
	this.client = client;
	this.clientThread = clientThread;
	this.itemManager = itemManager;
	this.tagManager = tagManager;
	this.tabManager = tabManager;
	this.chatboxPanelManager = chatboxPanelManager;
	this.config = config;
	this.notifier = notifier;
	this.bankSearch = bankSearch;
	this.searchProvider = searchProvider;
}
 
Example #2
Source File: Notifier.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Inject
private Notifier(
	final ClientUI clientUI,
	final Client client,
	final RuneLiteConfig runeliteConfig,
	final ScheduledExecutorService executorService,
	final ChatMessageManager chatMessageManager,
	final EventBus eventBus)
{
	this.client = client;
	this.clientUI = clientUI;
	this.runeLiteConfig = runeliteConfig;
	this.executorService = executorService;
	this.chatMessageManager = chatMessageManager;
	this.eventBus = eventBus;
	this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png");

	// First check if we are running in launcher
	this.terminalNotifierAvailable =
		!Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion())
		&& isTerminalNotifierAvailable();

	storeIcon();
}
 
Example #3
Source File: OverlayRenderer.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Inject
private OverlayRenderer(
	final Client client,
	final OverlayManager overlayManager,
	final RuneLiteConfig runeLiteConfig,
	final MouseManager mouseManager,
	final KeyManager keyManager,
	final ClientUI clientUI)
{
	this.client = client;
	this.overlayManager = overlayManager;
	this.runeLiteConfig = runeLiteConfig;
	this.clientUI = clientUI;
	keyManager.registerKeyListener(this);
	mouseManager.registerMouseListener(this);
}
 
Example #4
Source File: HitPointsRenderer.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void update(Client client, StatusBarsOverlay overlay)
{
	maximumValue = client.getRealSkillLevel(Skill.HITPOINTS);
	currentValue = client.getBoostedSkillLevel(Skill.HITPOINTS);
	restore = overlay.getRestoreValue(Skill.HITPOINTS.getName());

	final int poisonState = client.getVar(VarPlayer.IS_POISONED);

	if (poisonState > 0 && poisonState < 50)
	{
		standardColor = COLOR_POISON;
	}
	else if (poisonState >= 1000000)
	{
		standardColor = COLOR_VENOM;
	}
	else
	{
		standardColor = COLOR_STANDARD;
	}
}
 
Example #5
Source File: NightmareZoneOverlay.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Inject
NightmareZoneOverlay(
		Client client,
		NightmareZoneConfig config,
		NightmareZonePlugin plugin,
		InfoBoxManager infoBoxManager,
		ItemManager itemManager)
{
	super(plugin);
	setPosition(OverlayPosition.TOP_LEFT);
	setPriority(OverlayPriority.LOW);
	this.client = client;
	this.config = config;
	this.plugin = plugin;
	this.infoBoxManager = infoBoxManager;
	this.itemManager = itemManager;
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "NMZ overlay"));
}
 
Example #6
Source File: MaxHitCalculator.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private BiFunction<Client, MaxHitCalculator, Double> getCustomFormula()
{
	for (CustomFormulaConfig customFormula : CustomFormulaConfig.values())
	{
		if (this.combatMethod != customFormula.getRequiredCombatMethod())
		{
			continue;
		}

		boolean meetsRequirements = customFormula.getRequirements().stream().allMatch(requirement -> requirement.meetsRequirements(this.client));

		if (meetsRequirements)
		{
			return customFormula.getCustomFormula();
		}
	}

	return null;
}
 
Example #7
Source File: SuperRestore.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public StatsChanges calculate(Client client)
{
	StatsChanges changes = new StatsChanges(0);

	SimpleStatBoost calc = new SimpleStatBoost(null, false, perc(percR, delta));
	PrayerPotion prayer = new PrayerPotion(delta, percR);
	changes.setStatChanges(Stream.concat(
		Stream.of(prayer.effect(client)),
		Stream.of(superRestoreStats)
			.filter(stat -> stat.getValue(client) < stat.getMaximum(client))
			.map(stat ->
			{
				calc.setStat(stat);
				return calc.effect(client);
			})
		).toArray(StatChange[]::new));
	changes.setPositivity(Stream.of(changes.getStatChanges()).map(sc -> sc.getPositivity()).max(Comparator.comparing(Enum::ordinal)).get());
	return changes;
}
 
Example #8
Source File: CannonSpotOverlay.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void renderCannonSpot(Graphics2D graphics, Client client, LocalPoint point, BufferedImage image, Color color)
{
	//Render tile
	Polygon poly = Perspective.getCanvasTilePoly(client, point);

	if (poly != null)
	{
		OverlayUtil.renderPolygon(graphics, poly, color);
	}

	//Render icon
	Point imageLoc = Perspective.getCanvasImageLocation(client, point, image, 0);

	if (imageLoc != null)
	{
		OverlayUtil.renderImageLocation(graphics, imageLoc, image);
	}
}
 
Example #9
Source File: ClueScrollMusicOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Inject
private ClueScrollMusicOverlay(ClueScrollPlugin plugin, Client client)
{
	setPosition(OverlayPosition.DYNAMIC);
	setLayer(OverlayLayer.ABOVE_WIDGETS);
	this.plugin = plugin;
	this.client = client;
}
 
Example #10
Source File: PrayerRenderer.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void update(Client client, StatusBarsOverlay overlay)
{
	maximumValue = client.getRealSkillLevel(Skill.PRAYER);
	currentValue = client.getBoostedSkillLevel(Skill.PRAYER);
	standardColor = client.getVar(Varbits.QUICK_PRAYER) == 1 ? COLOR_ACTIVE : COLOR_STANDARD;
	restore = overlay.getRestoreValue(Skill.PRAYER.getName());
}
 
Example #11
Source File: BoostIndicator.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
BoostIndicator(final Skill skill, final BufferedImage image, final BoostsPlugin plugin, final BoostsConfig config, final Client client)
{
	super(image, plugin);
	this.plugin = plugin;
	this.config = config;
	this.client = client;
	this.skill = skill;
	setTooltip(skill.getName() + " boost");
	setPriority(InfoBoxPriority.HIGH);
}
 
Example #12
Source File: WorldMapLocationOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
private WorldMapLocationOverlay(Client client, WorldMapOverlay worldMapOverlay, DevToolsPlugin plugin)
{
	this.client = client;
	this.worldMapOverlay = worldMapOverlay;
	this.plugin = plugin;
	setPosition(OverlayPosition.DYNAMIC);
	setPriority(OverlayPriority.HIGH);
	setLayer(OverlayLayer.ABOVE_MAP);
}
 
Example #13
Source File: MultipleOfItemRequirement.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public String getCollectiveName(Client client)
{
	ItemComposition definition = client.getItemDefinition(itemId);

	if (definition == null)
	{
		return "N/A";
	}

	return definition.getName() + " x" + this.quantity;
}
 
Example #14
Source File: ClientSessionManager.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
ClientSessionManager(ScheduledExecutorService executorService,
	@Nullable Client client,
	OkHttpClient okHttpClient)
{
	this.executorService = executorService;
	this.client = client;
	this.sessionClient = new SessionClient(okHttpClient);
}
 
Example #15
Source File: SingleItemRequirement.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getCollectiveName(Client client)
{
	ItemDefinition definition = client.getItemDefinition(itemId);

	if (definition == null)
	{
		return "N/A";
	}

	return definition.getName();
}
 
Example #16
Source File: GroundItemsOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Inject
private GroundItemsOverlay(final Client client, final GroundItemsPlugin plugin, final GroundItemsConfig config)
{
	setPosition(OverlayPosition.DYNAMIC);
	setLayer(OverlayLayer.ABOVE_SCENE);
	this.client = client;
	this.plugin = plugin;
	this.config = config;
	this.textComponent.setAlpha(true);
}
 
Example #17
Source File: ChatMessageManager.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
private ChatMessageManager(
	Client client,
	ChatColorConfig chatColorConfig,
	ClientThread clientThread)
{
	this.client = client;
	this.chatColorConfig = chatColorConfig;
	this.clientThread = clientThread;
}
 
Example #18
Source File: MultipleOfItemRequirement.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getCollectiveName(Client client)
{
	ItemDefinition definition = client.getItemDefinition(itemId);

	if (definition == null)
	{
		return "N/A";
	}

	return definition.getName() + " x" + this.quantity;
}
 
Example #19
Source File: SoundEffectOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
SoundEffectOverlay(Client client, DevToolsPlugin plugin)
{
	this.client = client;
	this.plugin = plugin;
	panelComponent.getChildren().add(LineComponent.builder()
		.left("Sound Effects")
		.leftColor(Color.CYAN)
		.build());
	setClearChildren(false);
	setPosition(OverlayPosition.TOP_LEFT);
}
 
Example #20
Source File: TitheFarmPlantOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Inject
TitheFarmPlantOverlay(final Client client, final TitheFarmPlugin plugin, final TitheFarmPluginConfig config)
{
	setPosition(OverlayPosition.DYNAMIC);
	setLayer(OverlayLayer.ABOVE_SCENE);
	this.plugin = plugin;
	this.config = config;
	this.client = client;
}
 
Example #21
Source File: TrapOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Inject
TrapOverlay(final Client client, final HunterPlugin plugin, final HunterConfig config)
{
	setPosition(OverlayPosition.DYNAMIC);
	setLayer(OverlayLayer.ABOVE_SCENE);

	this.plugin = plugin;
	this.config = config;
	this.client = client;
}
 
Example #22
Source File: BlastFurnaceCofferOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
private BlastFurnaceCofferOverlay(Client client, BlastFurnacePlugin plugin, BlastFurnaceConfig config)
{
	super(plugin);
	setPosition(OverlayPosition.TOP_LEFT);
	this.client = client;
	this.plugin = plugin;
	this.config = config;
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Coffer overlay"));
}
 
Example #23
Source File: SpicyStew.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Calculate the fields of a stat change tooltip row.
 *
 * @param stat       Stat that the spice boost affects.
 * @param spiceBoost Potential spice boost before capping.
 * @param client     Client API, needed to check current stat values.
 * @return StatChange object with all required values.
 */
private static StatChange statChangeOf(Stat stat, int spiceBoost, Client client)
{
	int currentValue = stat.getValue(client);
	int currentBase = stat.getMaximum(client);

	int currentBoost = currentValue - currentBase; // Can be negative
	int spiceBoostCapped = (currentBoost <= 0) ? spiceBoost : Math.max(0, spiceBoost - currentBoost);

	final RangeStatChange change = new RangeStatChange();
	change.setStat(stat);
	change.setMinRelative(-spiceBoost);
	change.setRelative(spiceBoostCapped);
	change.setMinTheoretical(-spiceBoost);
	change.setTheoretical(spiceBoost);
	change.setMinAbsolute(Math.max(-spiceBoost, -currentValue));
	change.setAbsolute(stat.getValue(client) + spiceBoostCapped);

	Positivity positivity;
	if (spiceBoostCapped == 0)
	{
		positivity = Positivity.NO_CHANGE;
	}
	else if (spiceBoost > spiceBoostCapped)
	{
		positivity = Positivity.BETTER_CAPPED;
	}
	else
	{
		positivity = Positivity.BETTER_UNCAPPED;
	}
	change.setPositivity(positivity);

	return change;
}
 
Example #24
Source File: RaidsOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
private RaidsOverlay(Client client, RaidsPlugin plugin, RaidsConfig config)
{
	super(plugin);
	setPosition(OverlayPosition.TOP_LEFT);
	setPriority(OverlayPriority.LOW);
	this.client = client;
	this.plugin = plugin;
	this.config = config;
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay"));
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, BROADCAST_ACTION, "Raids overlay"));
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, SCREENSHOT_ACTION, "Raids overlay"));
}
 
Example #25
Source File: MotherlodeOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
MotherlodeOverlay(Client client, MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config)
{
	super(plugin);
	setPosition(OverlayPosition.TOP_LEFT);
	this.client = client;
	this.plugin = plugin;
	this.motherlodeSession = motherlodeSession;
	this.config = config;
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, MINING_RESET, "Motherlode mine overlay"));
}
 
Example #26
Source File: GroundMarkerMinimapOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Inject
private GroundMarkerMinimapOverlay(final Client client, final GroundMarkerPlugin plugin, final GroundMarkerConfig config)
{
	this.client = client;
	this.plugin = plugin;
	this.config = config;
	
	setPosition(OverlayPosition.DYNAMIC);
	setPriority(OverlayPriority.LOW);
	setLayer(OverlayLayer.ABOVE_WIDGETS);
}
 
Example #27
Source File: FishingOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
public FishingOverlay(Client client, FishingPlugin plugin, FishingConfig config, XpTrackerService xpTrackerService)
{
	super(plugin);
	setPosition(OverlayPosition.TOP_LEFT);
	this.client = client;
	this.plugin = plugin;
	this.config = config;
	this.xpTrackerService = xpTrackerService;
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Fishing overlay"));
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, FISHING_RESET, "Fishing overlay"));
}
 
Example #28
Source File: CorpDamageOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Inject
private CorpDamageOverlay(final Client client, final CorpPlugin corpPlugin, final CorpConfig config)
{
	super(corpPlugin);
	setPosition(OverlayPosition.TOP_LEFT);
	setLayer(OverlayLayer.UNDER_WIDGETS);
	setPriority(OverlayPriority.LOW);
	this.client = client;
	this.corpPlugin = corpPlugin;
	this.config = config;
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Corp overlay"));
}
 
Example #29
Source File: CookingOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Inject
private CookingOverlay(Client client, CookingPlugin plugin, CookingConfig config, XpTrackerService xpTrackerService)
{
	super(plugin);
	setPosition(OverlayPosition.TOP_LEFT);
	this.client = client;
	this.plugin = plugin;
	this.config = config;
	this.xpTrackerService = xpTrackerService;
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Cooking overlay"));
	getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, COOKING_RESET, "Cooking overlay"));
}
 
Example #30
Source File: EquipmentItemRequirement.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean meetsRequirements(Client client)
{
	ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT);
	if (equipmentContainer == null)
	{
		return false;
	}
	Item[] equipedItems = equipmentContainer.getItems();
	return EquipmentHelper.wearsItem(equipedItems, this.item);
}