Java Code Examples for net.runelite.api.widgets.Widget#getText()

The following examples show how to use net.runelite.api.widgets.Widget#getText() . 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: CombatLevelPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected void shutDown() throws Exception
{
	overlayManager.remove(overlay);
	Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL);

	if (combatLevelWidget != null)
	{
		String widgetText = combatLevelWidget.getText();

		if (widgetText.contains("."))
		{
			combatLevelWidget.setText(widgetText.substring(0, widgetText.indexOf(".")));
		}
	}

	shutDownAttackLevelRange();
}
 
Example 2
Source File: FriendsChatPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void colorIgnoredPlayers(Color ignoreColor)
{
	Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST);
	if (chatList == null || chatList.getChildren() == null)
	{
		return;
	}

	NameableContainer<Ignore> ignoreContainer = client.getIgnoreContainer();
	// Iterate every 3 widgets, since the order of widgets is name, world, icon
	for (int i = 0; i < chatList.getChildren().length; i += 3)
	{
		Widget listWidget = chatList.getChild(i);
		String memberName = listWidget.getText();
		if (memberName.isEmpty() || ignoreContainer.findByName(memberName) == null)
		{
			continue;
		}

		listWidget.setTextColor(ignoreColor.getRGB());
	}
}
 
Example 3
Source File: OneClickPlugin.java    From ExternalPlugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onGameTick(GameTick event)
{
	tick = false;

	if (type == Types.BA_HEALER)
	{
		Widget widget = client.getWidget(WidgetInfo.BA_HEAL_LISTEN_TEXT);

		if (widget != null && widget.getText() != null)
		{
			roleText = widget.getText().trim();
		}
		else
		{
			roleText = "";
		}
	}
}
 
Example 4
Source File: AlchemyRoom.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private AlchemyItem getBest()
{
	for (int i = 0; i < INFO_LENGTH; i++)
	{
		Widget textWidget = client.getWidget(WidgetID.MTA_ALCHEMY_GROUP_ID, INFO_ITEM_START + i);
		if (textWidget == null)
		{
			return null;
		}

		String item = textWidget.getText();
		Widget pointsWidget = client.getWidget(WidgetID.MTA_ALCHEMY_GROUP_ID, INFO_POINT_START + i);
		int points = Integer.parseInt(pointsWidget.getText());

		if (points == BEST_POINTS)
		{
			return AlchemyItem.find(item);
		}
	}

	return null;
}
 
Example 5
Source File: LeagueChatIconsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Update the player name in the chatbox input
 */
private void setChatboxName(String name)
{
	Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT);
	if (chatboxInput != null)
	{
		String text = chatboxInput.getText();
		int idx = text.indexOf(':');
		if (idx != -1)
		{
			String newText = name + text.substring(idx);
			chatboxInput.setText(newText);
		}
	}
}
 
Example 6
Source File: CombatLevelPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void shutDownAttackLevelRange()
{
	if (WorldType.isPvpWorld(client.getWorldType()))
	{
		return;
	}

	final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL);
	if (wildernessLevelWidget != null)
	{
		String wildernessLevelText = wildernessLevelWidget.getText();
		if (wildernessLevelText.contains("<br>"))
		{
			wildernessLevelWidget.setText(wildernessLevelText.substring(0, wildernessLevelText.indexOf("<br>")));
		}
		wildernessLevelWidget.setOriginalY(originalWildernessLevelTextPosition);
		clientThread.invoke(wildernessLevelWidget::revalidate);
	}
	originalWildernessLevelTextPosition = -1;

	final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER);
	if (skullContainer != null)
	{
		skullContainer.setOriginalY(originalSkullContainerPosition);
		clientThread.invoke(skullContainer::revalidate);
	}
	originalSkullContainerPosition = -1;
}
 
Example 7
Source File: CombatLevelPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void appendAttackLevelRangeText()
{
	final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL);
	if (wildernessLevelWidget == null)
	{
		return;
	}

	final String wildernessLevelText = wildernessLevelWidget.getText();
	final Matcher m = WILDERNESS_LEVEL_PATTERN.matcher(wildernessLevelText);
	if (!m.matches()
		|| WorldType.isPvpWorld(client.getWorldType()))
	{
		return;
	}

	final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER);
	if (originalWildernessLevelTextPosition == -1)
	{
		originalWildernessLevelTextPosition = wildernessLevelWidget.getOriginalY();
	}
	if (originalSkullContainerPosition == -1)
	{
		originalSkullContainerPosition = skullContainer.getRelativeY();
	}

	final int wildernessLevel = Integer.parseInt(m.group(1));
	final int combatLevel = client.getLocalPlayer().getCombatLevel();

	wildernessLevelWidget.setText(wildernessLevelText + "<br>" + combatAttackRange(combatLevel, wildernessLevel));
	wildernessLevelWidget.setOriginalY(WILDERNESS_LEVEL_TEXT_ADJUSTED_ORIGINAL_Y);
	skullContainer.setOriginalY(SKULL_CONTAINER_ADJUSTED_ORIGINAL_Y);

	clientThread.invoke(wildernessLevelWidget::revalidate);
	clientThread.invoke(skullContainer::revalidate);
}
 
Example 8
Source File: PuzzleSolverPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onWidgetLoaded(WidgetLoaded widget)
{
	if (widget.getGroupId() != WidgetID.VARROCK_MUSEUM_QUIZ_GROUP_ID)
	{
		return;
	}

	final Widget questionWidget = client.getWidget(WidgetInfo.VARROCK_MUSEUM_QUESTION);

	if (questionWidget == null)
	{
		return;
	}

	final Widget answerWidget = VarrockMuseumAnswer.findCorrect(
		client,
		questionWidget.getText(),
		WidgetInfo.VARROCK_MUSEUM_FIRST_ANSWER,
		WidgetInfo.VARROCK_MUSEUM_SECOND_ANSWER,
		WidgetInfo.VARROCK_MUSEUM_THIRD_ANSWER);

	if (answerWidget == null)
	{
		return;
	}

	final String answerText = answerWidget.getText();
	if (answerText.equals(Text.removeTags(answerText)))
	{
		answerWidget.setText(ColorUtil.wrapWithColorTag(answerText, CORRECT_MUSEUM_PUZZLE_ANSWER_COLOR));
	}
}
 
Example 9
Source File: KeyRemappingPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setChatboxWidgetInput(Widget widget, String input)
{
	String text = widget.getText();
	int idx = text.indexOf(':');
	if (idx != -1)
	{
		String newText = text.substring(0, idx) + ": " + input;
		widget.setText(newText);
	}
}
 
Example 10
Source File: PuzzleSolverPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onWidgetLoaded(WidgetLoaded widget)
{
	if (widget.getGroupId() != WidgetID.VARROCK_MUSEUM_QUIZ_GROUP_ID)
	{
		return;
	}

	final Widget questionWidget = client.getWidget(WidgetInfo.VARROCK_MUSEUM_QUESTION);

	if (questionWidget == null)
	{
		return;
	}

	final Widget answerWidget = VarrockMuseumAnswer.findCorrect(
		client,
		questionWidget.getText(),
		WidgetInfo.VARROCK_MUSEUM_FIRST_ANSWER,
		WidgetInfo.VARROCK_MUSEUM_SECOND_ANSWER,
		WidgetInfo.VARROCK_MUSEUM_THIRD_ANSWER);

	if (answerWidget == null)
	{
		return;
	}

	final String answerText = answerWidget.getText();
	if (answerText.equals(Text.removeTags(answerText)))
	{
		answerWidget.setText(ColorUtil.wrapWithColorTag(answerText, CORRECT_MUSEUM_PUZZLE_ANSWER_COLOR));
	}
}
 
Example 11
Source File: ItemChargePlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void checkDestroyWidget()
{
	final int currentTick = client.getTickCount();
	if (lastCheckTick == currentTick)
	{
		return;
	}
	lastCheckTick = currentTick;

	final Widget widgetDestroyItemName = client.getWidget(WidgetInfo.DESTROY_ITEM_NAME);
	if (widgetDestroyItemName == null)
	{
		return;
	}

	switch (widgetDestroyItemName.getText())
	{
		case "Binding necklace":
			updateBindingNecklaceCharges(MAX_BINDING_CHARGES);
			break;
		case "Dodgy necklace":
			updateDodgyNecklaceCharges(MAX_DODGY_CHARGES);
			break;
		case "Ring of forging":
			updateRingOfForgingCharges(MAX_RING_OF_FORGING_CHARGES);
			break;
		case "Amulet of chemistry":
			updateAmuletOfChemistryCharges(MAX_AMULET_OF_CHEMISTRY_CHARGES);
			break;
	}
}
 
Example 12
Source File: CombatLevelPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void shutDownAttackLevelRange()
{
	if (WorldType.isPvpWorld(client.getWorldType()))
	{
		return;
	}

	final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL);
	if (wildernessLevelWidget != null)
	{
		String wildernessLevelText = wildernessLevelWidget.getText();
		if (wildernessLevelText.contains("<br>"))
		{
			wildernessLevelWidget.setText(wildernessLevelText.substring(0, wildernessLevelText.indexOf("<br>")));
		}
		wildernessLevelWidget.setOriginalY(originalWildernessLevelTextPosition);
		clientThread.invoke(wildernessLevelWidget::revalidate);
	}
	originalWildernessLevelTextPosition = -1;

	final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER);
	if (skullContainer != null)
	{
		skullContainer.setOriginalY(originalSkullContainerPosition);
		clientThread.invoke(skullContainer::revalidate);
	}
	originalSkullContainerPosition = -1;
}
 
Example 13
Source File: CombatLevelPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void appendAttackLevelRangeText()
{
	final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL);
	if (wildernessLevelWidget == null)
	{
		return;
	}

	final String wildernessLevelText = wildernessLevelWidget.getText();
	final Matcher m = WILDERNESS_LEVEL_PATTERN.matcher(wildernessLevelText);
	if (!m.matches()
		|| WorldType.isPvpWorld(client.getWorldType()))
	{
		return;
	}

	final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER);
	if (originalWildernessLevelTextPosition == -1)
	{
		originalWildernessLevelTextPosition = wildernessLevelWidget.getOriginalY();
	}
	if (originalSkullContainerPosition == -1)
	{
		originalSkullContainerPosition = skullContainer.getRelativeY();
	}

	final int wildernessLevel = Integer.parseInt(m.group(1));
	final int combatLevel = client.getLocalPlayer().getCombatLevel();

	wildernessLevelWidget.setText(wildernessLevelText + "<br>" + combatAttackRange(combatLevel, wildernessLevel));
	wildernessLevelWidget.setOriginalY(WILDERNESS_LEVEL_TEXT_ADJUSTED_ORIGINAL_Y);
	skullContainer.setOriginalY(SKULL_CONTAINER_ADJUSTED_ORIGINAL_Y);

	clientThread.invoke(wildernessLevelWidget::revalidate);
	clientThread.invoke(skullContainer::revalidate);
}
 
Example 14
Source File: StealingArtefactsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Parses any existing npc dialog widget text and updates the artefact house and hint arrows if applicable.
 */
private void updateStealingArtefactsHouse()
{
	Widget widgetDialogNpcText = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT);

	if (widgetDialogNpcText == null)
	{
		return;
	}

	String text = widgetDialogNpcText.getText();

	if (!text.startsWith(HOUSE_TEXT_PREFIX))
	{
		return;
	}

	StealingArtefactsHouse stealingArtefactsHouse =
		getStealingArtefactsHouseFromNpcDialogText(Text.sanitizeMultilineText(text));

	if (stealingArtefactsHouse == null)
	{
		return;
	}

	this.stealingArtefactsHouse = stealingArtefactsHouse;

	removeWorldMapPoint();
	removeHintArrow();

	if (displayHintArrow)
	{
		addWorldMapPoint();
		addHintArrow();
	}
}
 
Example 15
Source File: RaidsPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
private void updatePartyMembers(boolean force)
{
	int partySize = client.getVar(Varbits.RAID_PARTY_SIZE);
	if (partySize <= 0)
	{
		return;
	}

	if (startingPartyMembers.size() == partySize && !force)
	{
		// Skip update if the part is as big as when we started
		missingPartyMembers.clear(); // Clear missing members in case someone came back
		return;
	}

	// Only update while in raid
	if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 || force)
	{
		Widget[] widgets;
		try
		{
			widgets = client.getWidget(WidgetInfo.RAIDING_PARTY).getStaticChildren()[2].getStaticChildren()[3].getDynamicChildren();
		}
		catch (NullPointerException e)
		{
			return; // Raid widget not loaded
		}

		partyMembers.clear();
		for (Widget widget : widgets)
		{
			if (widget == null || widget.getText() == null)
			{
				continue;
			}

			String name = widget.getName();

			if (name.length() > 1)
			{
				partyMembers.add(name.substring(name.indexOf('>') + 1, name.indexOf('<', 1)));
			}
		}

		// If we don't have any starting members, update starting members
		if (startingPartyMembers.size() == 0 || force)
		{
			missingPartyMembers.clear();
			startingPartyMembers.clear();
			startingPartyMembers.addAll(partyMembers);
		}
		else
		{

			// Check if anyone left
			if (startingPartyMembers.size() > partyMembers.size())
			{
				missingPartyMembers.clear();
				missingPartyMembers.addAll(startingPartyMembers);
				missingPartyMembers.removeAll(partyMembers);
			}
		}
	}
}
 
Example 16
Source File: ChatHistoryPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Subscribe
public void onMenuOpened(MenuOpened event)
{
	if (event.getMenuEntries().length < 2 || !config.copyToClipboard())
	{
		return;
	}

	// Use second entry as first one can be walk here with transparent chatbox
	final MenuEntry entry = event.getMenuEntries()[event.getMenuEntries().length - 2];

	if (entry.getType() != MenuAction.CC_OP_LOW_PRIORITY.getId() && entry.getType() != MenuAction.RUNELITE.getId())
	{
		return;
	}

	final int groupId = TO_GROUP(entry.getParam1());
	final int childId = TO_CHILD(entry.getParam1());

	if (groupId != WidgetInfo.CHATBOX.getGroupId())
	{
		return;
	}

	final Widget widget = client.getWidget(groupId, childId);
	final Widget parent = widget.getParent();

	if (WidgetInfo.CHATBOX_MESSAGE_LINES.getId() != parent.getId())
	{
		return;
	}

	// Get child id of first chat message static child so we can substract this offset to link to dynamic child
	// later
	final int first = WidgetInfo.CHATBOX_FIRST_MESSAGE.getChildId();

	// Convert current message static widget id to dynamic widget id of message node with message contents
	// When message is right clicked, we are actually right clicking static widget that contains only sender.
	// The actual message contents are stored in dynamic widgets that follow same order as static widgets.
	// Every first dynamic widget is message sender and every second one is message contents.
	final int dynamicChildId = (childId - first) * 2 + 1;

	// Extract and store message contents when menu is opened because dynamic children can change while right click
	// menu is open and dynamicChildId will be outdated
	final Widget messageContents = parent.getChild(dynamicChildId);
	if (messageContents == null)
	{
		return;
	}

	currentMessage = messageContents.getText();

	final MenuEntry menuEntry = new MenuEntry();
	menuEntry.setOption(COPY_TO_CLIPBOARD);
	menuEntry.setTarget(entry.getTarget());
	menuEntry.setType(MenuAction.RUNELITE.getId());
	menuEntry.setParam0(entry.getParam0());
	menuEntry.setParam1(entry.getParam1());
	menuEntry.setIdentifier(entry.getIdentifier());
	client.setMenuEntries(ArrayUtils.insert(1, client.getMenuEntries(), menuEntry));
}
 
Example 17
Source File: ChatHistoryPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
public void onMenuOpened(MenuOpened event)
{
	if (event.getMenuEntries().length < 2 || !config.copyToClipboard())
	{
		return;
	}

	// Use second entry as first one can be walk here with transparent chatbox
	final MenuEntry entry = event.getMenuEntries()[event.getMenuEntries().length - 2];

	if (entry.getOpcode() != MenuOpcode.CC_OP_LOW_PRIORITY.getId() && entry.getOpcode() != MenuOpcode.RUNELITE.getId())
	{
		return;
	}

	final int groupId = TO_GROUP(entry.getParam1());
	final int childId = TO_CHILD(entry.getParam1());

	if (groupId != WidgetInfo.CHATBOX.getGroupId())
	{
		return;
	}

	final Widget widget = client.getWidget(groupId, childId);
	final Widget parent = widget.getParent();

	if (WidgetInfo.CHATBOX_MESSAGE_LINES.getId() != parent.getId())
	{
		return;
	}

	// Get child id of first chat message static child so we can substract this offset to link to dynamic child
	// later
	final int first = WidgetInfo.CHATBOX_FIRST_MESSAGE.getChildId();

	// Convert current message static widget id to dynamic widget id of message node with message contents
	// When message is right clicked, we are actually right clicking static widget that contains only sender.
	// The actual message contents are stored in dynamic widgets that follow same order as static widgets.
	// Every first dynamic widget is message sender and every second one is message contents.
	final int dynamicChildId = (childId - first) * 2 + 1;

	// Extract and store message contents when menu is opened because dynamic children can change while right click
	// menu is open and dynamicChildId will be outdated
	final Widget messageContents = parent.getChild(dynamicChildId);
	if (messageContents == null)
	{
		return;
	}

	currentMessage = messageContents.getText();

	final MenuEntry menuEntry = new MenuEntry();
	menuEntry.setOption(COPY_TO_CLIPBOARD);
	menuEntry.setTarget(entry.getTarget());
	menuEntry.setOpcode(MenuOpcode.RUNELITE.getId());
	menuEntry.setParam0(entry.getParam0());
	menuEntry.setParam1(entry.getParam1());
	menuEntry.setIdentifier(entry.getIdentifier());
	client.setMenuEntries(ArrayUtils.insert(1, client.getMenuEntries(), menuEntry));
}
 
Example 18
Source File: GrandExchangePlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
private void highlightSearchMatches()
{
	if (!wasFuzzySearch)
	{
		return;
	}
	String input = client.getVar(VarClientStr.INPUT_TEXT);

	String underlineTag = "<u=" + ColorUtil.colorToHexCode(FUZZY_HIGHLIGHT_COLOR) + ">";

	Widget results = client.getWidget(WidgetInfo.CHATBOX_GE_SEARCH_RESULTS);
	Widget[] children = results.getDynamicChildren();
	int resultCount = children.length / 3;

	for (int i = 0; i < resultCount; i++)
	{
		Widget itemNameWidget = children[i * 3 + 1];
		String itemName = itemNameWidget.getText();

		List<Integer> indices;
		String otherName = itemName.replace('-', ' ');
		if (!itemName.contains("-") || FUZZY.fuzzyScore(itemName, input) >= FUZZY.fuzzyScore(otherName, input))
		{
			indices = findFuzzyIndices(itemName, input);
		}
		else
		{
			indices = findFuzzyIndices(otherName, input);
		}
		Collections.reverse(indices);

		StringBuilder newItemName = new StringBuilder(itemName);
		for (int index : indices)
		{
			if (wasFuzzySearch && (itemName.charAt(index) == ' ' || itemName.charAt(index) == '-'))
			{
				continue;
			}
			newItemName.insert(index + 1, "</u>");
			newItemName.insert(index, underlineTag);
		}

		itemNameWidget.setText(newItemName.toString());
	}
}
 
Example 19
Source File: GrandExchangePlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void rebuildGeText()
{
	if (grandExchangeText == null || grandExchangeItem == null || grandExchangeItem.isHidden())
	{
		return;
	}

	final Widget geText = grandExchangeText;
	final int itemId = grandExchangeItem.getItemId();

	if (itemId == OFFER_DEFAULT_ITEM_ID || itemId == -1)
	{
		// This item is invalid/nothing has been searched for
		return;
	}

	if (geText.getText() == grandExchangeExamine)
	{
		// if we've already set the text, don't set it again
		return;
	}

	String text = geText.getText();

	if (config.enableGELimits())
	{
		final ItemStats itemStats = itemManager.getItemStats(itemId, false);

		// If we have item buy limit, append it
		if (itemStats != null && itemStats.getGeLimit() > 0)
		{
			text += BUY_LIMIT_GE_TEXT + QuantityFormatter.formatNumber(itemStats.getGeLimit());
		}
	}

	if (config.enableGELimitReset())
	{
		Instant resetTime = getLimitResetTime(itemId);
		if (resetTime != null)
		{
			Duration remaining = Duration.between(Instant.now(), resetTime);
			text += " (" + DurationFormatUtils.formatDuration(remaining.toMillis(), "H:mm") + ")";
		}
	}

	grandExchangeExamine = text;
	geText.setText(text);

	if (!config.enableOsbPrices())
	{
		return;
	}

	// If we already have the result, use it
	if (osbGrandExchangeResult != null && osbGrandExchangeResult.getItem_id() == itemId && osbGrandExchangeResult.getOverall_average() > 0)
	{
		grandExchangeExamine = text + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbGrandExchangeResult.getOverall_average());
		geText.setText(grandExchangeExamine);
	}

	if (osbItem == itemId)
	{
		// avoid starting duplicate lookups
		return;
	}

	osbItem = itemId;

	log.debug("Looking up OSB item price {}", itemId);

	final String start = text;
	executorService.submit(() ->
	{
		try
		{
			final OSBGrandExchangeResult result = osbGrandExchangeClient.lookupItem(itemId);
			if (result != null && result.getOverall_average() > 0)
			{
				osbGrandExchangeResult = result;
				// Update the text on the widget too
				grandExchangeExamine = start + OSB_GE_TEXT + QuantityFormatter.formatNumber(result.getOverall_average());
				geText.setText(grandExchangeExamine);
			}
		}
		catch (IOException e)
		{
			log.debug("Error getting price of item {}", itemId, e);
		}
	});
}
 
Example 20
Source File: BanListPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onGameTick(GameTick event)
{
	final Widget raidingParty = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY);
	if (raidingParty == null)
	{
		return;
	}

	String allNames = raidingParty.getText();

	if (allNames.equalsIgnoreCase(tobNames))
	{
		return;
	}

	tobNames = allNames;

	String[] split = allNames.split("<br>");

	for (String name : split)
	{
		if (!name.equals("-"))
		{
			String stdName = Text.standardize(name);

			ListType scamList = checkScamList(stdName);

			if (scamList != null)
			{
				sendWarning(name, scamList);
			}

			ListType toxicList = checkToxicList(stdName);

			if (toxicList != null)
			{
				sendWarning(name, toxicList);
			}
		}
	}
}