Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2021-10-28 11:01:49 +02:00
16 changed files with 918 additions and 593 deletions

View File

@@ -776,6 +776,12 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
final Scene scene = client.getScene();
scene.setDrawDistance(getDrawDistance());
// Only reset the target buffer offset right before drawing the scene. That way if there are frames
// after this that don't involve a scene draw, like during LOADING/HOPPING/CONNECTION_LOST, we can
// still redraw the previous frame's scene to emulate the client behavior of not painting over the
// viewport buffer.
targetBufferOffset = 0;
invokeOnMainThread(() ->
{
// UBO. Only the first 32 bytes get modified here, the rest is the constant sin/cos table.
@@ -1029,21 +1035,9 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
private void drawFrame(int overlayColor)
{
if (jawtWindow.getAWTComponent() != client.getCanvas())
{
// We inject code in the game engine mixin to prevent the client from doing canvas replacement,
// so this should not ever be hit
log.warn("Canvas invalidated!");
shutDown();
startUp();
return;
}
if (client.getGameState() == GameState.LOADING || client.getGameState() == GameState.HOPPING)
{
// While the client is loading it doesn't draw
return;
}
// We inject code in the game engine mixin to prevent the client from doing canvas replacement,
// so this should not ever be tripped
assert jawtWindow.getAWTComponent() == client.getCanvas() : "canvas invalidated";
final int canvasHeight = client.getCanvasHeight();
final int canvasWidth = client.getCanvasWidth();
@@ -1105,7 +1099,8 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
// Draw 3d scene
final TextureProvider textureProvider = client.getTextureProvider();
if (textureProvider != null)
final GameState gameState = client.getGameState();
if (textureProvider != null && gameState.getState() >= GameState.LOADING.getState())
{
if (textureArrayId == -1)
{
@@ -1265,7 +1260,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
modelBufferSmall.clear();
modelBufferUnordered.clear();
targetBufferOffset = 0;
smallModels = largeModels = unorderedModels = 0;
tempOffset = 0;
tempUvOffset = 0;

View File

@@ -272,19 +272,15 @@ class SkillCalculator extends JPanel
private void adjustCheckboxes(JCheckBox target, SkillBonus bonus)
{
adjustXPBonus(0);
bonusCheckBoxes.forEach(otherSelectedCheckbox ->
for (JCheckBox otherSelectedCheckbox : bonusCheckBoxes)
{
if (otherSelectedCheckbox != target)
{
otherSelectedCheckbox.setSelected(false);
}
});
if (target.isSelected())
{
adjustXPBonus(bonus.getValue());
}
adjustXPBonus(target.isSelected() ? bonus.getValue() : 0f);
}
private void renderActionSlots()
@@ -347,7 +343,8 @@ class SkillCalculator extends JPanel
int actionCount = 0;
int neededXP = targetXP - currentXP;
SkillAction action = slot.getAction();
double xp = (action.isIgnoreBonus()) ? action.getXp() : action.getXp() * xpFactor;
final float bonus = action.isIgnoreBonus() ? 1f : xpFactor;
final double xp = Math.round(action.getXp() * bonus * 10f) / 10d;
if (neededXP > 0)
{

View File

@@ -86,4 +86,15 @@ public interface SpecialCounterConfig extends Config
{
return 0;
}
@ConfigItem(
position = 5,
keyName = "bulwarkThreshold",
name = "Dinh's Bulwark",
description = "Threshold for Dinh's Bulwark (0 to disable)"
)
default int bulwarkThreshold()
{
return 0;
}
}

View File

@@ -40,7 +40,7 @@ enum SpecialWeapon
BARRELCHEST_ANCHOR("Barrelchest Anchor", new int[]{ItemID.BARRELCHEST_ANCHOR}, true, (c) -> 0),
BONE_DAGGER("Bone Dagger", new int[]{ItemID.BONE_DAGGER, ItemID.BONE_DAGGER_P, ItemID.BONE_DAGGER_P_8876, ItemID.BONE_DAGGER_P_8878}, true, (c) -> 0),
DORGESHUUN_CROSSBOW("Dorgeshuun Crossbow", new int[]{ItemID.DORGESHUUN_CROSSBOW}, true, (c) -> 0),
BULWARK("Dinh's Bulwark", new int[]{ItemID.DINHS_BULWARK}, false, c -> 0);
BULWARK("Dinh's Bulwark", new int[]{ItemID.DINHS_BULWARK}, false, SpecialCounterConfig::bulwarkThreshold);
private final String name;
private final int[] itemID;

View File

@@ -28,6 +28,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
import net.runelite.client.plugins.woodcutting.config.ClueNestTier;
@ConfigGroup("woodcutting")
public interface WoodcuttingConfig extends Config
@@ -57,6 +58,17 @@ public interface WoodcuttingConfig extends Config
@ConfigItem(
position = 3,
keyName = "clueNestNotifyTier",
name = "Clue nest notification",
description = "Configures the clue tier from which to start notifying of a clue nest spawn"
)
default ClueNestTier clueNestNotifyTier()
{
return ClueNestTier.BEGINNER;
}
@ConfigItem(
position = 4,
keyName = "showWoodcuttingStats",
name = "Show session stats",
description = "Configures whether to display woodcutting session stats"
@@ -67,7 +79,7 @@ public interface WoodcuttingConfig extends Config
}
@ConfigItem(
position = 4,
position = 5,
keyName = "showRedwoods",
name = "Show Redwood trees",
description = "Configures whether to show a indicator for redwood trees"
@@ -78,7 +90,7 @@ public interface WoodcuttingConfig extends Config
}
@ConfigItem(
position = 5,
position = 6,
keyName = "showRespawnTimers",
name = "Show respawn timers",
description = "Configures whether to display the respawn timer overlay"

View File

@@ -51,6 +51,7 @@ import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemSpawned;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -58,6 +59,7 @@ import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.woodcutting.config.ClueNestTier;
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
@@ -107,6 +109,7 @@ public class WoodcuttingPlugin extends Plugin
private final List<TreeRespawn> respawns = new ArrayList<>();
private boolean recentlyLoggedIn;
private int currentPlane;
private ClueNestTier clueTierSpawned;
@Provides
WoodcuttingConfig getConfig(ConfigManager configManager)
@@ -130,6 +133,7 @@ public class WoodcuttingPlugin extends Plugin
treeObjects.clear();
session = null;
axe = null;
clueTierSpawned = null;
}
@Subscribe
@@ -148,6 +152,7 @@ public class WoodcuttingPlugin extends Plugin
public void onGameTick(GameTick gameTick)
{
recentlyLoggedIn = false;
clueTierSpawned = null;
currentPlane = client.getPlane();
respawns.removeIf(TreeRespawn::isExpired);
@@ -190,11 +195,26 @@ public class WoodcuttingPlugin extends Plugin
if (event.getMessage().contains("A bird's nest falls out of the tree") && config.showNestNotification())
{
notifier.notify("A bird nest has spawned!");
if (clueTierSpawned == null || clueTierSpawned.ordinal() >= config.clueNestNotifyTier().ordinal())
{
notifier.notify("A bird nest has spawned!");
}
// Clear the clue tier that has previously spawned
clueTierSpawned = null;
}
}
}
@Subscribe
public void onItemSpawned(ItemSpawned itemSpawned)
{
if (clueTierSpawned == null)
{
// This will be set only if one of the clue nests has spawned. It will then be reset the next game tick.
clueTierSpawned = ClueNestTier.getTierFromItem(itemSpawned.getItem().getId());
}
}
@Subscribe
public void onGameObjectSpawned(final GameObjectSpawned event)
{

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2021, Tal <https://github.com/talsk>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.woodcutting.config;
import com.google.common.collect.ImmutableMap;
import net.runelite.api.ItemID;
public enum ClueNestTier
{
BEGINNER,
EASY,
MEDIUM,
HARD,
ELITE,
DISABLED;
private static final ImmutableMap<Integer, ClueNestTier> CLUE_NEST_ID_TO_TIER = new ImmutableMap.Builder<Integer, ClueNestTier>()
.put(ItemID.CLUE_NEST_ELITE, ClueNestTier.ELITE)
.put(ItemID.CLUE_NEST_HARD, ClueNestTier.HARD)
.put(ItemID.CLUE_NEST_MEDIUM, ClueNestTier.MEDIUM)
.put(ItemID.CLUE_NEST_EASY, ClueNestTier.EASY)
.put(ItemID.CLUE_NEST_BEGINNER, ClueNestTier.BEGINNER)
.build();
static public ClueNestTier getTierFromItem(int itemId)
{
return CLUE_NEST_ID_TO_TIER.get(itemId);
}
}