Merge pull request #2953 from open-osrs/revert-2951-addstuff
Revert "project: add missing features"
This commit is contained in:
@@ -1651,20 +1651,6 @@ public interface Client extends GameEngine
|
||||
*/
|
||||
void setHiddenNpcIndices(List<Integer> npcIndices);
|
||||
|
||||
/**
|
||||
* Increments the counter for how many times this npc has been selected to be hidden on death
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void addHiddenNpcDeath(String name);
|
||||
|
||||
/**
|
||||
* Decrements the counter for how many times this npc has been selected to be hidden on death
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void removeHiddenNpcDeath(String name);
|
||||
|
||||
/**
|
||||
* Increments the counter for how many times this npc has been selected to be hidden
|
||||
*
|
||||
@@ -1679,21 +1665,6 @@ public interface Client extends GameEngine
|
||||
*/
|
||||
void removeHiddenNpcName(String name);
|
||||
|
||||
/**
|
||||
* Sets whether or not other players are hidden.
|
||||
*
|
||||
* @param state the new player hidden state
|
||||
*/
|
||||
void setPlayersHidden(boolean state);
|
||||
|
||||
/**
|
||||
* Sets whether 2D sprites (ie. overhead prayers, PK skull) related to
|
||||
* the other players are hidden.
|
||||
*
|
||||
* @param state the new player 2D hidden state
|
||||
*/
|
||||
void setPlayersHidden2D(boolean state);
|
||||
|
||||
/**
|
||||
* Sets whether projectiles are hidden.
|
||||
*
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.openosrs.client.game;
|
||||
|
||||
import lombok.Data;
|
||||
import net.runelite.api.Skill;
|
||||
|
||||
@Data
|
||||
public class XpDropEvent
|
||||
{
|
||||
private Skill skill;
|
||||
private int exp;
|
||||
}
|
||||
@@ -66,6 +66,7 @@ import net.runelite.client.discord.DiscordService;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.externalplugins.ExternalPluginManager;
|
||||
import net.runelite.client.game.WorldService;
|
||||
import net.runelite.client.game.XpDropManager;
|
||||
import net.runelite.client.plugins.OPRSExternalPluginManager;
|
||||
import net.runelite.client.rs.ClientLoader;
|
||||
import net.runelite.client.rs.ClientUpdateCheckMode;
|
||||
@@ -139,6 +140,9 @@ public class RuneLite
|
||||
@Inject
|
||||
private Provider<WorldMapOverlay> worldMapOverlay;
|
||||
|
||||
@Inject
|
||||
private Provider<XpDropManager> xpDropManager;
|
||||
|
||||
@Inject
|
||||
private WorldService worldService;
|
||||
|
||||
@@ -382,6 +386,9 @@ public class RuneLite
|
||||
WidgetOverlay.createOverlays(client).forEach(overlayManager::add);
|
||||
overlayManager.add(worldMapOverlay.get());
|
||||
overlayManager.add(tooltipOverlay.get());
|
||||
|
||||
// legacy method, i cant figure out how to make it work without garbage
|
||||
eventBus.register(xpDropManager.get());
|
||||
}
|
||||
|
||||
// Start plugins
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2021, ThatGamerBlue <thatgamerblue@gmail.com>
|
||||
* 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.events;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.api.Skill;
|
||||
|
||||
@Value
|
||||
public class XpDropEvent
|
||||
{
|
||||
Skill skill;
|
||||
int exp;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2021, ThatGamerBlue <thatgamerblue@gmail.com>
|
||||
* 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.game;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.StatChanged;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.XpDropEvent;
|
||||
|
||||
@Singleton
|
||||
public class XpDropManager
|
||||
{
|
||||
private final Map<Skill, Integer> previousSkillExpTable = new EnumMap<>(Skill.class);
|
||||
private final Client client;
|
||||
private final EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private XpDropManager(Client client, EventBus eventBus)
|
||||
{
|
||||
this.client = client;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onStatChanged(StatChanged event)
|
||||
{
|
||||
final Skill skill = event.getSkill();
|
||||
final int xp = client.getSkillExperience(skill);
|
||||
Integer previous = previousSkillExpTable.put(skill, xp);
|
||||
if (previous != null)
|
||||
{
|
||||
int previousExpGained = xp - previous;
|
||||
XpDropEvent xpDropEvent = new XpDropEvent(skill, previousExpGained);
|
||||
eventBus.post(xpDropEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatLineBuffer;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
@@ -131,14 +130,6 @@ public class FriendsChatPlugin extends Plugin
|
||||
private int joinedTick;
|
||||
|
||||
private boolean kickConfirmed = false;
|
||||
|
||||
private static final CopyOnWriteArrayList<Player> clanMembers = new CopyOnWriteArrayList<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static CopyOnWriteArrayList<Player> getClanMembers()
|
||||
{
|
||||
return (CopyOnWriteArrayList<Player>) clanMembers.clone();
|
||||
}
|
||||
|
||||
@Provides
|
||||
FriendsChatConfig getConfig(ConfigManager configManager)
|
||||
|
||||
@@ -35,8 +35,8 @@ dependencies {
|
||||
|
||||
tasks {
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
disableAutoTargetJvm()
|
||||
}
|
||||
withType<JavaCompile> {
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
@@ -41,12 +39,6 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
@Inject
|
||||
public static boolean isHidingEntities;
|
||||
|
||||
@Inject
|
||||
public static boolean hidePlayers;
|
||||
|
||||
@Inject
|
||||
public static boolean hidePlayers2D;
|
||||
|
||||
@Inject
|
||||
public static boolean hideOthers;
|
||||
|
||||
@@ -86,15 +78,9 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
@Inject
|
||||
public static boolean hideDeadNPCs;
|
||||
|
||||
@Inject
|
||||
public static Set<Integer> blacklistDeadNpcs = new HashSet<>();
|
||||
|
||||
@Inject
|
||||
public static List<String> hideSpecificPlayers = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
public static HashMap<String, Integer> hiddenNpcsDeath = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
public static HashMap<String, Integer> hiddenNpcsName = new HashMap<>();
|
||||
|
||||
@@ -206,41 +192,6 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
hideDeadNPCs = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void addHiddenNpcDeath(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
int i = hiddenNpcsDeath.getOrDefault(npc, 0);
|
||||
if (i == Integer.MAX_VALUE)
|
||||
{
|
||||
throw new RuntimeException("NPC death " + npc + " has been hidden Integer.MAX_VALUE times, is something wrong?");
|
||||
}
|
||||
|
||||
hiddenNpcsDeath.put(npc, ++i);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void removeHiddenNpcDeath(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
int i = hiddenNpcsDeath.getOrDefault(npc, 0);
|
||||
if (i == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hiddenNpcsDeath.put(npc, --i);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setBlacklistDeadNpcs(Set<Integer> blacklist)
|
||||
{
|
||||
blacklistDeadNpcs = blacklist;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void addHiddenNpcName(String npc)
|
||||
@@ -269,31 +220,17 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
hiddenNpcsName.put(npc, --i);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setPlayersHidden(boolean state)
|
||||
{
|
||||
hidePlayers = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setPlayersHidden2D(boolean state)
|
||||
{
|
||||
hidePlayers2D = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setHiddenNpcIndices(List<Integer> npcIndices)
|
||||
{
|
||||
hiddenNpcIndices = npcIndices;
|
||||
hiddenNpcIndices = new ArrayList<>(npcIndices);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public List<Integer> getHiddenNpcIndices()
|
||||
{
|
||||
return hiddenNpcIndices;
|
||||
return new ArrayList<>(hiddenNpcIndices);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import net.runelite.api.mixins.*;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.rs.api.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -42,12 +41,6 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
@Shadow("isHidingEntities")
|
||||
private static boolean isHidingEntities;
|
||||
|
||||
@Shadow("hidePlayers")
|
||||
private static boolean hidePlayers;
|
||||
|
||||
@Shadow("hidePlayers2D")
|
||||
private static boolean hidePlayers2D;
|
||||
|
||||
@Shadow("hideOthers")
|
||||
private static boolean hideOthers;
|
||||
|
||||
@@ -72,18 +65,9 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
@Shadow("hideNPCs")
|
||||
private static boolean hideNPCs;
|
||||
|
||||
@Shadow("hiddenNpcsName")
|
||||
private static HashMap<String, Integer> hiddenNpcsName;
|
||||
|
||||
@Shadow("hiddenNpcsDeath")
|
||||
private static HashMap<String, Integer> hiddenNpcsDeath;
|
||||
|
||||
@Shadow("hideSpecificPlayers")
|
||||
private static List<String> hideSpecificPlayers;
|
||||
|
||||
@Shadow("blacklistDeadNpcs")
|
||||
private static Set<Integer> blacklistDeadNpcs;
|
||||
|
||||
@Shadow("hideNPCs2D")
|
||||
private static boolean hideNPCs2D;
|
||||
|
||||
@@ -99,6 +83,9 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
@Shadow("hideDeadNPCs")
|
||||
private static boolean hideDeadNPCs;
|
||||
|
||||
@Shadow("hiddenNpcsName")
|
||||
private static HashMap<String, Integer> hiddenNpcsName;
|
||||
|
||||
@Shadow("hiddenNpcIndices")
|
||||
private static List<Integer> hiddenNpcIndices;
|
||||
|
||||
@@ -143,10 +130,17 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
|
||||
if (entity instanceof RSPlayer)
|
||||
{
|
||||
boolean local = drawingUI ? hideLocalPlayer2D : hideLocalPlayer;
|
||||
boolean other = drawingUI ? hidePlayers2D : hidePlayers;
|
||||
boolean isLocalPlayer = entity == client.getLocalPlayer();
|
||||
RSPlayer player = (RSPlayer) entity;
|
||||
RSPlayer local = client.getLocalPlayer();
|
||||
if (player.getName() == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player == local)
|
||||
{
|
||||
return drawingUI ? !hideLocalPlayer2D : !hideLocalPlayer;
|
||||
}
|
||||
|
||||
for (String name : hideSpecificPlayers)
|
||||
{
|
||||
@@ -159,37 +153,51 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
}
|
||||
}
|
||||
|
||||
if (isLocalPlayer ? local : other)
|
||||
if (hideAttackers && player.getInteracting() == local)
|
||||
{
|
||||
if (!hideAttackers)
|
||||
{
|
||||
if (player.getInteracting() == client.getLocalPlayer())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getName() == null)
|
||||
{
|
||||
// player.isFriend() and player.isClanMember() npe when the player has a null name
|
||||
return false;
|
||||
}
|
||||
|
||||
return (!hideFriends && player.isFriend()) ||
|
||||
(!isLocalPlayer && !hideClanMates && player.isFriendsChatMember());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (player.isFriend())
|
||||
{
|
||||
return !hideFriends;
|
||||
}
|
||||
|
||||
if (player.isFriendsChatMember())
|
||||
{
|
||||
return !hideClanMates;
|
||||
}
|
||||
|
||||
if (client.getFriendManager().isIgnored(player.getRsName()))
|
||||
{
|
||||
return !hideIgnores;
|
||||
}
|
||||
|
||||
|
||||
return drawingUI ? !hideOthers2D : !hideOthers;
|
||||
}
|
||||
else if (entity instanceof RSNPC)
|
||||
{
|
||||
RSNPC npc = (RSNPC) entity;
|
||||
|
||||
if (npc.getInteracting() == client.getLocalPlayer() && hideAttackers)
|
||||
if (hiddenNpcIndices.contains(npc.getIndex()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Integer> entry : hiddenNpcsName.entrySet())
|
||||
{
|
||||
String name = entry.getKey();
|
||||
int count = entry.getValue();
|
||||
if (name != null && !name.equals(""))
|
||||
{
|
||||
if (count > 0 && npc.getName() != null && npc.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npc.isDead() && hideDeadNPCs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -199,31 +207,11 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hideDeadNPCs && npc.getHealthRatio() == 0 && !blacklistDeadNpcs.contains(npc.getId()))
|
||||
if (npc.getInteracting() == client.getLocalPlayer() && hideAttackers)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (npc.getName() != null &&
|
||||
hiddenNpcsName.getOrDefault(Text.standardize(npc.getName().toLowerCase()), 0) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (npc.getName() != null && npc.getHealthRatio() == 0 &&
|
||||
hiddenNpcsDeath.getOrDefault(Text.standardize(npc.getName().toLowerCase()), 0) > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Integer index : hiddenNpcIndices)
|
||||
{
|
||||
if (index != null && npc.getIndex() == index)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return drawingUI ? !hideNPCs2D : !hideNPCs;
|
||||
}
|
||||
else if (entity instanceof RSProjectile)
|
||||
|
||||
Reference in New Issue
Block a user