Skip to content

Commit

Permalink
Merge pull request #568 from chsami/development
Browse files Browse the repository at this point in the history
1.6.5.2
  • Loading branch information
chsami authored Dec 12, 2024
2 parents c2099e2 + 14cca0f commit b7feb68
Show file tree
Hide file tree
Showing 32 changed files with 5,437 additions and 4,917 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "1.6.5.1"
automatic_release_tag: "1.6.5.2"
prerelease: false
title: "Release 1.6.5.1"
title: "Release 1.6.5.2"
files: |
/home/runner/work/Microbot/Microbot/runelite-client/target/microbot-*.jar
Expand Down
2 changes: 1 addition & 1 deletion runelite-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<git.commit.id.abbrev>nogit</git.commit.id.abbrev>
<git.dirty>false</git.dirty>
<shade.skip>false</shade.skip>
<microbot.version>1.6.5.1</microbot.version>
<microbot.version>1.6.5.2</microbot.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,10 @@ private Template createTemplate(int threadCount, int facesPerThread)
return "#define THREAD_COUNT " + threadCount + "\n" +
"#define FACES_PER_THREAD " + facesPerThread + "\n";
}
if ("texture_config".equals(key))
{
return "#define TEXTURE_COUNT " + TextureManager.TEXTURE_COUNT + "\n";
}
return null;
});
template.addInclude(GpuPlugin.class);
Expand Down Expand Up @@ -1508,6 +1512,15 @@ public void onGameStateChanged(GameStateChanged gameStateChanged)
// Avoid drawing the last frame's buffer during LOADING after LOGIN_SCREEN
targetBufferOffset = 0;
}
if (gameStateChanged.getGameState() == GameState.STARTING)
{
if (textureArrayId != -1)
{
textureManager.freeTextureArray(textureArrayId);
}
textureArrayId = -1;
lastAnisotropicFilteringLevel = -1;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@Slf4j
class TextureManager
{
static final int TEXTURE_COUNT = 256;
private static final int TEXTURE_SIZE = 128;

int initTextureArray(TextureProvider textureProvider)
Expand Down Expand Up @@ -223,8 +224,14 @@ private static byte[] convertPixels(int[] srcPixels, int width, int height, int
float[] computeTextureAnimations(TextureProvider textureProvider)
{
Texture[] textures = textureProvider.getTextures();
float[] anims = new float[256 * 2];
for (int i = 0; i < textures.length; ++i)

if (textures.length > TEXTURE_COUNT)
{
log.warn("texture limit exceeded: {} > {}", textures.length, TEXTURE_COUNT);
}

float[] anims = new float[TEXTURE_COUNT * 2];
for (int i = 0; i < Math.min(TEXTURE_COUNT, textures.length); ++i)
{
Texture texture = textures[i];
if (texture == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.InventoryID;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID;
import net.runelite.api.Skill;
import net.runelite.api.Varbits;
Expand Down Expand Up @@ -75,7 +76,8 @@ public StatChange effect(Client client)
multiplier += 0.2;
}

if (client.getItemContainer(InventoryID.EQUIPMENT).contains(ItemID.SUNLIT_BRACERS))
final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT);
if (equipment != null && equipment.contains(ItemID.SUNLIT_BRACERS))
{
multiplier += 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public boolean run() {

if (!isBankOpen || !Rs2Bank.isOpen()) return;

boolean shouldCutGems = plugin.getJewelry().getGem() != null
boolean shouldCutGems = plugin.getJewelry().getGem() != Gem.NONE
&& Rs2Bank.hasItem(plugin.getJewelry().getGem().getUncutItemID());

if (shouldCutGems) {
Expand All @@ -96,9 +96,9 @@ public boolean run() {
return;
}

int withdrawAmount = plugin.getJewelry().getGem() != null ? 13 : 27;
int withdrawAmount = plugin.getJewelry().getGem() != Gem.NONE ? 13 : 27;

boolean shouldCraftJewelry = plugin.getJewelry().getGem() != null
boolean shouldCraftJewelry = plugin.getJewelry().getGem() != Gem.NONE
? Rs2Bank.hasBankItem(plugin.getJewelry().getGem().getCutItemID(), withdrawAmount) && Rs2Bank.hasBankItem(plugin.getJewelry().getJewelryType().getItemID(), withdrawAmount)
: Rs2Bank.hasBankItem(plugin.getJewelry().getJewelryType().getItemID(), withdrawAmount);

Expand Down Expand Up @@ -394,7 +394,7 @@ private boolean shouldBank() {
}

private boolean hasFinishedCutting() {
if (plugin.getJewelry().getGem() == null) return false;
if (plugin.getJewelry().getGem() == Gem.NONE) return false;
if(!Rs2Inventory.hasItem(ItemID.CHISEL)) return false;
return Rs2Inventory.hasItem(plugin.getJewelry().getGem().getCutItemID()) && !Rs2Inventory.hasItem(plugin.getJewelry().getGem().getUncutItemID());
}
Expand All @@ -403,7 +403,7 @@ private boolean hasFinishedCrafting() {
if (!Rs2Inventory.hasItem(plugin.getJewelry().getToolItemID())) return false;

boolean hasCraftingItem = Rs2Inventory.hasItem(plugin.getJewelry().getJewelryType().getItemID());
boolean hasNoGem = plugin.getJewelry().getGem() == null;
boolean hasNoGem = plugin.getJewelry().getGem() == Gem.NONE;
boolean hasCutGem = Rs2Inventory.hasItem(plugin.getJewelry().getGem().getCutItemID());

return Rs2Inventory.hasItem(plugin.getJewelry().getItemID())
Expand All @@ -415,7 +415,7 @@ private boolean hasFinishedEnchanting() {
}

private boolean isCutting() {
if (plugin.getJewelry().getGem() == null) return false;
if (plugin.getJewelry().getGem() == Gem.NONE) return false;
if (!Rs2Inventory.hasItem(ItemID.CHISEL)) return false;
return Rs2Inventory.hasItem(plugin.getJewelry().getGem().getUncutItemID());
}
Expand All @@ -424,7 +424,7 @@ private boolean isCrafting() {
if(!Rs2Inventory.hasItem(plugin.getJewelry().getToolItemID())) return false;

boolean hasCraftingItem = Rs2Inventory.hasItem(plugin.getJewelry().getJewelryType().getItemID());
boolean hasNoGem = plugin.getJewelry().getGem() == null;
boolean hasNoGem = plugin.getJewelry().getGem() == Gem.NONE;
boolean hasCutGem = Rs2Inventory.hasItem(plugin.getJewelry().getGem().getCutItemID());

return hasNoGem ? hasCraftingItem : hasCraftingItem && hasCutGem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@Getter
@RequiredArgsConstructor
public enum Gem {
NONE("", "", 0, 0, 0),
OPAL("uncut opal", "opal",ItemID.UNCUT_OPAL, ItemID.OPAL, 1),
JADE("uncut jade", "jade", ItemID.UNCUT_JADE, ItemID.JADE, 13),
RED_TOPAZ("uncut red topaz", "red topaz",ItemID.UNCUT_RED_TOPAZ, ItemID.RED_TOPAZ, 16),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
@RequiredArgsConstructor
public enum Jewelry {

GOLD_RING("gold ring", ItemID.GOLD_RING, null, ItemID.RING_MOULD, JewelryType.GOLD, null, 5),
GOLD_NECKLACE("gold necklace", ItemID.GOLD_NECKLACE, null, ItemID.NECKLACE_MOULD, JewelryType.GOLD, null, 6),
GOLD_BRACELET("gold bracelet", ItemID.GOLD_BRACELET, null, ItemID.BRACELET_MOULD, JewelryType.GOLD, null, 7),
GOLD_RING("gold ring", ItemID.GOLD_RING, Gem.NONE, ItemID.RING_MOULD, JewelryType.GOLD, null, 5),
GOLD_NECKLACE("gold necklace", ItemID.GOLD_NECKLACE, Gem.NONE, ItemID.NECKLACE_MOULD, JewelryType.GOLD, null, 6),
GOLD_BRACELET("gold bracelet", ItemID.GOLD_BRACELET, Gem.NONE, ItemID.BRACELET_MOULD, JewelryType.GOLD, null, 7),
OPAL_RING("opal ring", ItemID.OPAL_RING, Gem.OPAL, ItemID.RING_MOULD, JewelryType.SILVER, EnchantSpell.LEVEL_1, 1),
OPAL_NECKLACE("opal necklace", ItemID.OPAL_NECKLACE, Gem.OPAL, ItemID.NECKLACE_MOULD, JewelryType.SILVER, EnchantSpell.LEVEL_1, 16),
OPAL_BRACELET("opal bracelet", ItemID.OPAL_BRACELET, Gem.OPAL, ItemID.BRACELET_MOULD, JewelryType.SILVER, EnchantSpell.LEVEL_1, 22),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import net.runelite.client.plugins.microbot.Script;
import net.runelite.client.plugins.microbot.crafting.CraftingConfig;
import net.runelite.client.plugins.microbot.crafting.enums.Glass;
import net.runelite.client.plugins.microbot.util.antiban.Rs2Antiban;
import net.runelite.client.plugins.microbot.util.antiban.Rs2AntibanSettings;
import net.runelite.client.plugins.microbot.util.bank.Rs2Bank;
import net.runelite.client.plugins.microbot.util.inventory.Rs2Inventory;
import net.runelite.client.plugins.microbot.util.math.Random;
import net.runelite.client.plugins.microbot.util.player.Rs2Player;
import net.runelite.client.plugins.microbot.util.widget.Rs2Widget;

import java.util.concurrent.TimeUnit;
Expand All @@ -31,27 +33,29 @@ public class GlassblowingScript extends Script {

public void run(CraftingConfig config) {

if (config.glassType() == Glass.PROGRESSIVE)
calculateItemToCraft();
if (config.glassType() == Glass.PROGRESSIVE) calculateItemToCraft();

Rs2Antiban.resetAntibanSettings();
Rs2Antiban.antibanSetupTemplates.applyCraftingSetup();
mainScheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
try {
if (!Microbot.isLoggedIn()) return;
if (!super.run()) return;
if (config.Afk() && Random.random(1, 100) == 2)
sleep(1000, 60000);

if (Rs2Player.isAnimating(2400) || Rs2Antiban.getCategory().isBusy() || Microbot.pauseAllScripts) return;
if (Rs2AntibanSettings.actionCooldownActive) return;

if (config.glassType() == Glass.PROGRESSIVE) {
itemToCraft = model.getItemToCraft();
} else {
itemToCraft = config.glassType();
}

if (Rs2Inventory.hasItem(moltenGlass)
&& Rs2Inventory.hasItem(glassblowingPipe)) {
if (Rs2Inventory.hasItem(moltenGlass) && Rs2Inventory.hasItem(glassblowingPipe)) {
craft(config);
return;
}
if (!Rs2Inventory.hasItem(moltenGlass)
|| !Rs2Inventory.hasItem(glassblowingPipe)) {
if (!Rs2Inventory.hasItem(moltenGlass) || !Rs2Inventory.hasItem(glassblowingPipe)) {
bank(config);
}

Expand All @@ -63,20 +67,19 @@ public void run(CraftingConfig config) {

private void bank(CraftingConfig config) {
Rs2Bank.openBank();
sleepUntilOnClientThread(() -> Rs2Bank.isOpen());
sleepUntil(Rs2Bank::isOpen);

Rs2Bank.depositAll(itemToCraft.getItemName());
sleepUntilOnClientThread(() -> !Rs2Inventory.hasItem(itemToCraft.getItemName()));
sleepUntil(() -> !Rs2Inventory.hasItem(itemToCraft.getItemName()));

Rs2Bank.withdrawItem(true, glassblowingPipe);
sleepUntilOnClientThread(() -> Rs2Inventory.hasItem(glassblowingPipe));
sleepUntil(() -> Rs2Inventory.hasItem(glassblowingPipe));

verifyItemInBank(moltenGlass);

Rs2Bank.withdrawAll(true, moltenGlass);
sleepUntilOnClientThread(() -> Rs2Inventory.hasItem(moltenGlass));
sleepUntil(() -> Rs2Inventory.hasItem(moltenGlass));

sleep(600, 3000);
Rs2Bank.closeBank();
}

Expand All @@ -92,13 +95,14 @@ private void verifyItemInBank(String item) {
private void craft(CraftingConfig config) {
Rs2Inventory.combine(glassblowingPipe, moltenGlass);

sleepUntilOnClientThread(() -> Rs2Widget.getWidget(17694736) != null);
Rs2Widget.sleepUntilHasWidgetText("How many do you wish to make?", 270, 5, false, 5000);

keyPress(itemToCraft.getMenuEntry());

sleepUntilOnClientThread(() -> Rs2Widget.getWidget(17694736) == null);
Rs2Widget.sleepUntilHasNotWidgetText("How many do you wish to make?", 270, 5, false, 5000);
Rs2Antiban.actionCooldown();

sleepUntilOnClientThread(() -> !Rs2Inventory.hasItem(moltenGlass), 60000);
sleepUntil(() -> !Rs2Inventory.hasItem(moltenGlass), 60000);
}

public ProgressiveGlassblowingModel calculateItemToCraft() {
Expand All @@ -125,6 +129,7 @@ public ProgressiveGlassblowingModel calculateItemToCraft() {

@Override
public void shutdown() {
Rs2Antiban.resetAntibanSettings();
super.shutdown();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package net.runelite.client.plugins.microbot.holidayevent;

import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;

@ConfigGroup("holiday")
public interface HolidayConfig extends Config {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package net.runelite.client.plugins.microbot.holidayevent;

import net.runelite.client.plugins.microbot.Microbot;
import net.runelite.client.ui.overlay.OverlayPanel;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.components.LineComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;

import javax.inject.Inject;
import java.awt.*;

public class HolidayOverlay extends OverlayPanel {

@Inject
HolidayOverlay(HolidayPlugin plugin)
{
super(plugin);
setPosition(OverlayPosition.TOP_LEFT);
setNaughty();
}
@Override
public Dimension render(Graphics2D graphics) {
try {
panelComponent.setPreferredSize(new Dimension(200, 300));
panelComponent.getChildren().add(TitleComponent.builder()
.text("Holiday Event V1.0.0")
.color(Color.GREEN)
.build());

panelComponent.getChildren().add(LineComponent.builder().build());

panelComponent.getChildren().add(LineComponent.builder()
.left(Microbot.status)
.build());


} catch(Exception ex) {
System.out.println(ex.getMessage());
}
return super.render(graphics);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package net.runelite.client.plugins.microbot.holidayevent;

import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.events.GameTick;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;

import javax.inject.Inject;
import java.awt.*;

@PluginDescriptor(
name = PluginDescriptor.Default + "Holiday events",
description = "Holiday event plugin",
tags = {"holiday", "microbot"},
enabledByDefault = false
)

@Slf4j
public class HolidayPlugin extends Plugin {
@Inject
private HolidayConfig config;
@Provides
HolidayConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(HolidayConfig.class);
}

@Inject
private OverlayManager overlayManager;
@Inject
private HolidayOverlay holidayOverlay;

@Inject
HolidayScript holidayScript;


@Override
protected void startUp() throws AWTException {
if (overlayManager != null) {
overlayManager.add(holidayOverlay);
}
holidayScript.run(config);
}

protected void shutDown() {
holidayScript.shutdown();
overlayManager.remove(holidayOverlay);
}
int ticks = 10;
@Subscribe
public void onGameTick(GameTick tick)
{
//System.out.println(getName().chars().mapToObj(i -> (char)(i + 3)).map(String::valueOf).collect(Collectors.joining()));

if (ticks > 0) {
ticks--;
} else {
ticks = 10;
}

}
}
Loading

0 comments on commit b7feb68

Please sign in to comment.