Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -70,6 +70,30 @@ public class ItemManager implements ItemProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void link()
|
||||||
|
{
|
||||||
|
for (ItemDefinition oc : items.values())
|
||||||
|
{
|
||||||
|
link(oc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void link(ItemDefinition item)
|
||||||
|
{
|
||||||
|
if (item.notedTemplate != -1)
|
||||||
|
{
|
||||||
|
item.linkNote(getItem(item.notedTemplate), getItem(item.notedID));
|
||||||
|
}
|
||||||
|
if (item.boughtTemplateId != -1)
|
||||||
|
{
|
||||||
|
item.linkBought(getItem(item.boughtTemplateId), getItem(item.boughtId));
|
||||||
|
}
|
||||||
|
if (item.placeholderTemplateId != -1)
|
||||||
|
{
|
||||||
|
item.linkPlaceholder(getItem(item.placeholderTemplateId), getItem(item.placeholderId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<ItemDefinition> getItems()
|
public Collection<ItemDefinition> getItems()
|
||||||
{
|
{
|
||||||
return Collections.unmodifiableCollection(items.values());
|
return Collections.unmodifiableCollection(items.values());
|
||||||
|
|||||||
@@ -64,15 +64,9 @@ public class ItemDefinition
|
|||||||
public int[] countCo;
|
public int[] countCo;
|
||||||
public int[] countObj;
|
public int[] countObj;
|
||||||
|
|
||||||
public String[] options = new String[]
|
public String[] options = new String[]{null, null, "Take", null, null};
|
||||||
{
|
|
||||||
null, null, "Take", null, null
|
|
||||||
};
|
|
||||||
|
|
||||||
public String[] interfaceOptions = new String[]
|
public String[] interfaceOptions = new String[]{null, null, null, null, "Drop"};
|
||||||
{
|
|
||||||
null, null, null, null, "Drop"
|
|
||||||
};
|
|
||||||
|
|
||||||
public int maleModel0 = -1;
|
public int maleModel0 = -1;
|
||||||
public int maleModel1 = -1;
|
public int maleModel1 = -1;
|
||||||
@@ -105,7 +99,7 @@ public class ItemDefinition
|
|||||||
|
|
||||||
public Map<Integer, Object> params = null;
|
public Map<Integer, Object> params = null;
|
||||||
|
|
||||||
public void updateNote(ItemDefinition notedItem, ItemDefinition unnotedItem)
|
public void linkNote(ItemDefinition notedItem, ItemDefinition unnotedItem)
|
||||||
{
|
{
|
||||||
this.inventoryModel = notedItem.inventoryModel;
|
this.inventoryModel = notedItem.inventoryModel;
|
||||||
this.zoom2d = notedItem.zoom2d;
|
this.zoom2d = notedItem.zoom2d;
|
||||||
@@ -123,4 +117,65 @@ public class ItemDefinition
|
|||||||
this.cost = unnotedItem.cost;
|
this.cost = unnotedItem.cost;
|
||||||
this.stackable = 1;
|
this.stackable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void linkBought(ItemDefinition var1, ItemDefinition var2)
|
||||||
|
{
|
||||||
|
this.inventoryModel = var1.inventoryModel;
|
||||||
|
this.zoom2d = var1.zoom2d;
|
||||||
|
this.xan2d = var1.xan2d;
|
||||||
|
this.yan2d = var1.yan2d;
|
||||||
|
this.zan2d = var1.zan2d;
|
||||||
|
this.xOffset2d = var1.xOffset2d;
|
||||||
|
this.yOffset2d = var1.yOffset2d;
|
||||||
|
this.colorFind = var2.colorFind;
|
||||||
|
this.colorReplace = var2.colorReplace;
|
||||||
|
this.textureFind = var2.textureFind;
|
||||||
|
this.textureReplace = var2.textureReplace;
|
||||||
|
this.name = var2.name;
|
||||||
|
this.members = var2.members;
|
||||||
|
this.stackable = var2.stackable;
|
||||||
|
this.maleModel0 = var2.maleModel0;
|
||||||
|
this.maleModel1 = var2.maleModel1;
|
||||||
|
this.maleModel2 = var2.maleModel2;
|
||||||
|
this.femaleModel0 = var2.femaleModel0;
|
||||||
|
this.femaleModel1 = var2.femaleModel1;
|
||||||
|
this.femaleModel2 = var2.femaleModel2;
|
||||||
|
this.maleHeadModel = var2.maleHeadModel;
|
||||||
|
this.maleHeadModel2 = var2.maleHeadModel2;
|
||||||
|
this.femaleHeadModel = var2.femaleHeadModel;
|
||||||
|
this.femaleHeadModel2 = var2.femaleHeadModel2;
|
||||||
|
this.team = var2.team;
|
||||||
|
this.options = var2.options;
|
||||||
|
this.interfaceOptions = new String[5];
|
||||||
|
if (var2.interfaceOptions != null)
|
||||||
|
{
|
||||||
|
for (int var3 = 0; var3 < 4; ++var3)
|
||||||
|
{
|
||||||
|
this.interfaceOptions[var3] = var2.interfaceOptions[var3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.interfaceOptions[4] = "Discard";
|
||||||
|
this.cost = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void linkPlaceholder(ItemDefinition var1, ItemDefinition var2)
|
||||||
|
{
|
||||||
|
this.inventoryModel = var1.inventoryModel;
|
||||||
|
this.zoom2d = var1.zoom2d;
|
||||||
|
this.xan2d = var1.xan2d;
|
||||||
|
this.yan2d = var1.yan2d;
|
||||||
|
this.zan2d = var1.zan2d;
|
||||||
|
this.xOffset2d = var1.xOffset2d;
|
||||||
|
this.yOffset2d = var1.yOffset2d;
|
||||||
|
this.colorFind = var1.colorFind;
|
||||||
|
this.colorReplace = var1.colorReplace;
|
||||||
|
this.textureFind = var1.textureFind;
|
||||||
|
this.textureReplace = var1.textureReplace;
|
||||||
|
this.stackable = var1.stackable;
|
||||||
|
this.name = var2.name;
|
||||||
|
this.cost = 0;
|
||||||
|
this.members = false;
|
||||||
|
this.isTradeable = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,11 +72,6 @@ public class ItemSpriteFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.notedTemplate != -1)
|
|
||||||
{
|
|
||||||
item.updateNote(itemProvider.provide(item.notedTemplate), itemProvider.provide(item.notedID));
|
|
||||||
}
|
|
||||||
|
|
||||||
Model itemModel = getModel(modelProvider, item);
|
Model itemModel = getModel(modelProvider, item);
|
||||||
if (itemModel == null)
|
if (itemModel == null)
|
||||||
{
|
{
|
||||||
@@ -96,7 +91,11 @@ public class ItemSpriteFactory
|
|||||||
else if (item.boughtTemplateId != -1)
|
else if (item.boughtTemplateId != -1)
|
||||||
{
|
{
|
||||||
auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
|
auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
|
||||||
|
<<<<<<< HEAD
|
||||||
item.boughtId, quantity, border, shadowColor, false);
|
item.boughtId, quantity, border, shadowColor, false);
|
||||||
|
=======
|
||||||
|
item.boughtId, quantity, border, 0, false);
|
||||||
|
>>>>>>> runelite/master
|
||||||
if (auxSpritePixels == null)
|
if (auxSpritePixels == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -68,15 +68,18 @@ public class RSTextureProvider
|
|||||||
{
|
{
|
||||||
TextureDefinition var2 = this.textures[var1];
|
TextureDefinition var2 = this.textures[var1];
|
||||||
if (var2 != null)
|
if (var2 != null)
|
||||||
|
{
|
||||||
|
synchronized (var2)
|
||||||
{
|
{
|
||||||
if (var2.pixels != null)
|
if (var2.pixels != null)
|
||||||
{
|
{
|
||||||
return var2.pixels;
|
return var2.pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean var3 = var2.method2680(this.brightness, this.width, spriteProvider);
|
var2.method2680(this.brightness, this.width, spriteProvider);
|
||||||
return var2.pixels;
|
return var2.pixels;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
119
cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java
vendored
Normal file
119
cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java
vendored
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
|
* 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.cache.item;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.cache.IndexType;
|
||||||
|
import net.runelite.cache.ItemManager;
|
||||||
|
import net.runelite.cache.SpriteManager;
|
||||||
|
import net.runelite.cache.StoreLocation;
|
||||||
|
import net.runelite.cache.TextureManager;
|
||||||
|
import net.runelite.cache.definitions.ItemDefinition;
|
||||||
|
import net.runelite.cache.definitions.ModelDefinition;
|
||||||
|
import net.runelite.cache.definitions.loaders.ModelLoader;
|
||||||
|
import net.runelite.cache.definitions.providers.ModelProvider;
|
||||||
|
import net.runelite.cache.fs.Archive;
|
||||||
|
import net.runelite.cache.fs.Index;
|
||||||
|
import net.runelite.cache.fs.Store;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ItemSpriteFactoryTest
|
||||||
|
{
|
||||||
|
@Rule
|
||||||
|
public TemporaryFolder folder = StoreLocation.getTemporaryFolder();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void test() throws IOException
|
||||||
|
{
|
||||||
|
File base = StoreLocation.LOCATION,
|
||||||
|
outDir = folder.newFolder();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
try (Store store = new Store(base))
|
||||||
|
{
|
||||||
|
store.load();
|
||||||
|
|
||||||
|
ItemManager itemManager = new ItemManager(store);
|
||||||
|
itemManager.load();
|
||||||
|
itemManager.link();
|
||||||
|
|
||||||
|
ModelProvider modelProvider = new ModelProvider()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ModelDefinition provide(int modelId) throws IOException
|
||||||
|
{
|
||||||
|
Index models = store.getIndex(IndexType.MODELS);
|
||||||
|
Archive archive = models.getArchive(modelId);
|
||||||
|
|
||||||
|
byte[] data = archive.decompress(store.getStorage().loadArchive(archive));
|
||||||
|
ModelDefinition inventoryModel = new ModelLoader().load(modelId, data);
|
||||||
|
return inventoryModel;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SpriteManager spriteManager = new SpriteManager(store);
|
||||||
|
spriteManager.load();
|
||||||
|
|
||||||
|
TextureManager textureManager = new TextureManager(store);
|
||||||
|
textureManager.load();
|
||||||
|
|
||||||
|
for (ItemDefinition itemDef : itemManager.getItems())
|
||||||
|
{
|
||||||
|
if (itemDef.name == null || itemDef.name.equalsIgnoreCase("null"))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BufferedImage sprite = ItemSpriteFactory.createSprite(itemManager, modelProvider, spriteManager, textureManager,
|
||||||
|
itemDef.id, 1, 1, 3153952, false);
|
||||||
|
|
||||||
|
File out = new File(outDir, itemDef.id + ".png");
|
||||||
|
BufferedImage img = sprite;
|
||||||
|
ImageIO.write(img, "PNG", out);
|
||||||
|
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.warn("error dumping item {}", itemDef.id, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Dumped {} item images to {}", count, outDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
|
import net.runelite.api.annotations.Varbit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about a specific {@link ObjectID}
|
* Information about a specific {@link ObjectID}
|
||||||
*/
|
*/
|
||||||
@@ -75,8 +77,26 @@ public interface ObjectComposition extends ParamHolder
|
|||||||
ObjectComposition getImpostor();
|
ObjectComposition getImpostor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
<<<<<<< HEAD
|
||||||
* Get the bitmask that contains information on which directions you can interact
|
* Get the bitmask that contains information on which directions you can interact
|
||||||
* with this object from.
|
* with this object from.
|
||||||
*/
|
*/
|
||||||
int getAccessBitMask();
|
int getAccessBitMask();
|
||||||
|
=======
|
||||||
|
* Gets the {@link Varbits} used to switch this multiloc, or {@code -1} if this is not switched by a Varbit
|
||||||
|
*
|
||||||
|
* @see #getImpostor()
|
||||||
|
* @see #getImpostorIds()
|
||||||
|
*/
|
||||||
|
@Varbit
|
||||||
|
int getVarbitId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link VarPlayer} used to switch this multiloc, or {@code -1} if this is not switched by a VarPlayer
|
||||||
|
*
|
||||||
|
* @see #getImpostor()
|
||||||
|
* @see #getImpostorIds()
|
||||||
|
*/
|
||||||
|
int getVarPlayerId();
|
||||||
|
>>>>>>> runelite/master
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -549,9 +549,15 @@ public class RuneLite
|
|||||||
{
|
{
|
||||||
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
||||||
.pingInterval(30, TimeUnit.SECONDS)
|
.pingInterval(30, TimeUnit.SECONDS)
|
||||||
.addNetworkInterceptor(chain ->
|
.addInterceptor(chain ->
|
||||||
{
|
{
|
||||||
Request userAgentRequest = chain.request()
|
Request request = chain.request();
|
||||||
|
if (request.header("User-Agent") != null)
|
||||||
|
{
|
||||||
|
return chain.proceed(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
Request userAgentRequest = request
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.header("User-Agent", USER_AGENT)
|
.header("User-Agent", USER_AGENT)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
|
|||||||
.put(new WorldPoint(2318, 2954, 0), new CoordinateClueInfo("North-east corner of the Isle of Souls.", BANDOSIAN_GUARD))
|
.put(new WorldPoint(2318, 2954, 0), new CoordinateClueInfo("North-east corner of the Isle of Souls.", BANDOSIAN_GUARD))
|
||||||
.put(new WorldPoint(2094, 2889, 0), new CoordinateClueInfo("West side of the Isle of Souls.", ARMADYLEAN_GUARD))
|
.put(new WorldPoint(2094, 2889, 0), new CoordinateClueInfo("West side of the Isle of Souls.", ARMADYLEAN_GUARD))
|
||||||
.put(new WorldPoint(1451, 3509, 0), new CoordinateClueInfo("Ruins of Morra.", ARMADYLEAN_OR_BANDOSIAN_GUARD))
|
.put(new WorldPoint(1451, 3509, 0), new CoordinateClueInfo("Ruins of Morra.", ARMADYLEAN_OR_BANDOSIAN_GUARD))
|
||||||
|
.put(new WorldPoint(3318, 2706, 0), new CoordinateClueInfo("Necropolis mine", ARMADYLEAN_OR_BANDOSIAN_GUARD))
|
||||||
// Master
|
// Master
|
||||||
.put(new WorldPoint(2178, 3209, 0), new CoordinateClueInfo("South of Iorwerth Camp.", BRASSICAN_MAGE))
|
.put(new WorldPoint(2178, 3209, 0), new CoordinateClueInfo("South of Iorwerth Camp.", BRASSICAN_MAGE))
|
||||||
.put(new WorldPoint(2155, 3100, 0), new CoordinateClueInfo("South of Port Tyras (BJS if 76 Agility).", BRASSICAN_MAGE))
|
.put(new WorldPoint(2155, 3100, 0), new CoordinateClueInfo("South of Port Tyras (BJS if 76 Agility).", BRASSICAN_MAGE))
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
|||||||
new CrypticClue("Search the crates in the Port Sarim Fishing shop.", CRATE_9534, new WorldPoint(3012, 3222, 0), "Search the crates, by the door, in Gerrant's Fishy Business in Port Sarim."),
|
new CrypticClue("Search the crates in the Port Sarim Fishing shop.", CRATE_9534, new WorldPoint(3012, 3222, 0), "Search the crates, by the door, in Gerrant's Fishy Business in Port Sarim."),
|
||||||
new CrypticClue("Speak to The Lady of the Lake.", "The Lady of the Lake", new WorldPoint(2924, 3405, 0), "Talk to The Lady of the Lake in Taverley."),
|
new CrypticClue("Speak to The Lady of the Lake.", "The Lady of the Lake", new WorldPoint(2924, 3405, 0), "Talk to The Lady of the Lake in Taverley."),
|
||||||
new CrypticClue("Rotting next to a ditch. Dig next to the fish.", new WorldPoint(3547, 3183, 0), "Dig next to a fishing spot on the south-east side of Burgh de Rott."),
|
new CrypticClue("Rotting next to a ditch. Dig next to the fish.", new WorldPoint(3547, 3183, 0), "Dig next to a fishing spot on the south-east side of Burgh de Rott."),
|
||||||
new CrypticClue("The King's magic won't be wasted by me.", "Guardian mummy", new WorldPoint(1934, 4427, 0), "Talk to the Guardian mummy inside the Pyramid Plunder minigame in Sophanem."),
|
new CrypticClue("The King's magic shouldn't be wasted by me.", "Guardian mummy", new WorldPoint(1934, 4427, 0), "Talk to the Guardian mummy inside the Pyramid Plunder minigame in Sophanem."),
|
||||||
new CrypticClue("Dig where the forces of Zamorak and Saradomin collide.", new WorldPoint(3049, 4839, 0), "Dig next to the law rift in the Abyss."),
|
new CrypticClue("Dig where the forces of Zamorak and Saradomin collide.", new WorldPoint(3049, 4839, 0), "Dig next to the law rift in the Abyss."),
|
||||||
new CrypticClue("Search the boxes in the goblin house near Lumbridge.", BOXES, new WorldPoint(3245, 3245, 0), "Goblin house on the eastern side of the river outside of Lumbridge."),
|
new CrypticClue("Search the boxes in the goblin house near Lumbridge.", BOXES, new WorldPoint(3245, 3245, 0), "Goblin house on the eastern side of the river outside of Lumbridge."),
|
||||||
new CrypticClue("W marks the spot.", new WorldPoint(2867, 3546, 0), "Dig in the middle of the Warriors' Guild entrance hall."),
|
new CrypticClue("W marks the spot.", new WorldPoint(2867, 3546, 0), "Dig in the middle of the Warriors' Guild entrance hall."),
|
||||||
|
|||||||
@@ -186,36 +186,36 @@ public class DpsCounterPlugin extends Plugin
|
|||||||
|
|
||||||
Hitsplat hitsplat = hitsplatApplied.getHitsplat();
|
Hitsplat hitsplat = hitsplatApplied.getHitsplat();
|
||||||
|
|
||||||
|
final int npcId = ((NPC) actor).getId();
|
||||||
|
final boolean isBoss = BOSSES.contains(npcId);
|
||||||
|
|
||||||
if (hitsplat.isMine())
|
if (hitsplat.isMine())
|
||||||
{
|
{
|
||||||
final int npcId = ((NPC) actor).getId();
|
int hit = hitsplat.getAmount();
|
||||||
boolean isBoss = BOSSES.contains(npcId);
|
PartyMember localMember = partyService.getLocalMember();
|
||||||
|
|
||||||
|
// broadcast damage
|
||||||
|
if (localMember != null)
|
||||||
|
{
|
||||||
|
final DpsUpdate dpsUpdate = new DpsUpdate(hit, isBoss);
|
||||||
|
dpsUpdate.setMemberId(localMember.getMemberId());
|
||||||
|
wsClient.send(dpsUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
if (dpsConfig.bossDamage() && !isBoss)
|
if (dpsConfig.bossDamage() && !isBoss)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hit = hitsplat.getAmount();
|
|
||||||
// Update local member
|
|
||||||
PartyMember localMember = partyService.getLocalMember();
|
|
||||||
// If not in a party, user local player name
|
// If not in a party, user local player name
|
||||||
final String name = localMember == null ? player.getName() : localMember.getName();
|
final String name = localMember == null ? player.getName() : localMember.getName();
|
||||||
DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new);
|
DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new);
|
||||||
dpsMember.addDamage(hit);
|
dpsMember.addDamage(hit);
|
||||||
|
|
||||||
// broadcast damage
|
|
||||||
if (localMember != null)
|
|
||||||
{
|
|
||||||
final DpsUpdate specialCounterUpdate = new DpsUpdate(hit);
|
|
||||||
specialCounterUpdate.setMemberId(localMember.getMemberId());
|
|
||||||
wsClient.send(specialCounterUpdate);
|
|
||||||
}
|
|
||||||
// apply to total
|
// apply to total
|
||||||
}
|
}
|
||||||
else if (hitsplat.isOthers())
|
else if (hitsplat.isOthers())
|
||||||
{
|
{
|
||||||
final int npcId = ((NPC) actor).getId();
|
|
||||||
boolean isBoss = BOSSES.contains(npcId);
|
|
||||||
if ((dpsConfig.bossDamage() || actor != player.getInteracting()) && !isBoss)
|
if ((dpsConfig.bossDamage() || actor != player.getInteracting()) && !isBoss)
|
||||||
{
|
{
|
||||||
// only track damage to npcs we are attacking, or is a nearby common boss
|
// only track damage to npcs we are attacking, or is a nearby common boss
|
||||||
@@ -246,6 +246,12 @@ public class DpsCounterPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Received non-boss damage, but we only want boss damage
|
||||||
|
if (!dpsUpdate.isBoss() && dpsConfig.bossDamage())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
unpause();
|
unpause();
|
||||||
|
|
||||||
DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new);
|
DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 Adam <Adam@sigterm.info>
|
* Copyright (c) 2020 Adam <Adam@sigterm.info>
|
||||||
|
* Copyright (c) 2021, Jonathan Rousseau <https://github.com/JoRouss>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -33,4 +34,5 @@ import net.runelite.http.api.ws.messages.party.PartyMemberMessage;
|
|||||||
public class DpsUpdate extends PartyMemberMessage
|
public class DpsUpdate extends PartyMemberMessage
|
||||||
{
|
{
|
||||||
private int hit;
|
private int hit;
|
||||||
|
private boolean isBoss;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public enum FairyRings
|
|||||||
AJQ("Cave south of Dorgesh-Kaan"),
|
AJQ("Cave south of Dorgesh-Kaan"),
|
||||||
AJR("Slayer cave"),
|
AJR("Slayer cave"),
|
||||||
AJS("Penguins near Miscellania"),
|
AJS("Penguins near Miscellania"),
|
||||||
|
AKP("Necropolis"),
|
||||||
AKQ("Piscatoris Hunter area"),
|
AKQ("Piscatoris Hunter area"),
|
||||||
AKS("Feldip Hunter area"),
|
AKS("Feldip Hunter area"),
|
||||||
ALP("(Island) Lighthouse"),
|
ALP("(Island) Lighthouse"),
|
||||||
|
|||||||
Reference in New Issue
Block a user