Merge pull request #3177 from open-osrs/upstream-2904
This commit is contained in:
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@@ -52,7 +52,7 @@ Before you submit your pull request consider the following guidelines:
|
|||||||
cd runelite/
|
cd runelite/
|
||||||
```
|
```
|
||||||
* After cloning, set a new remote [upstream](https://help.github.com/articles/configuring-a-remote-for-a-fork/) (this helps to keep your fork up to date)
|
* After cloning, set a new remote [upstream](https://help.github.com/articles/configuring-a-remote-for-a-fork/) (this helps to keep your fork up to date)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git remote add upstream https://github.com/open-osrs/runelite.git
|
git remote add upstream https://github.com/open-osrs/runelite.git
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
@@ -60,19 +60,13 @@ public class ItemDefinition
|
|||||||
|
|
||||||
public int ambient;
|
public int ambient;
|
||||||
public int contrast;
|
public int contrast;
|
||||||
|
|
||||||
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[]{null, null, null, null, "Drop"};
|
||||||
};
|
|
||||||
|
|
||||||
public String[] interfaceOptions = new String[]
|
|
||||||
{
|
|
||||||
null, null, null, null, "Drop"
|
|
||||||
};
|
|
||||||
|
|
||||||
public int maleModel0 = -1;
|
public int maleModel0 = -1;
|
||||||
public int maleModel1 = -1;
|
public int maleModel1 = -1;
|
||||||
@@ -87,7 +81,7 @@ public class ItemDefinition
|
|||||||
public int femaleOffset;
|
public int femaleOffset;
|
||||||
public int femaleHeadModel = -1;
|
public int femaleHeadModel = -1;
|
||||||
public int femaleHeadModel2 = -1;
|
public int femaleHeadModel2 = -1;
|
||||||
|
|
||||||
public int category;
|
public int category;
|
||||||
|
|
||||||
public int notedID = -1;
|
public int notedID = -1;
|
||||||
@@ -99,13 +93,13 @@ public class ItemDefinition
|
|||||||
|
|
||||||
public int boughtId = -1;
|
public int boughtId = -1;
|
||||||
public int boughtTemplateId = -1;
|
public int boughtTemplateId = -1;
|
||||||
|
|
||||||
public int placeholderId = -1;
|
public int placeholderId = -1;
|
||||||
public int placeholderTemplateId = -1;
|
public int placeholderTemplateId = -1;
|
||||||
|
|
||||||
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,7 @@ 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,
|
||||||
item.boughtId, quantity, border, shadowColor, false);
|
item.boughtId, quantity, border, 0, false);
|
||||||
if (auxSpritePixels == null)
|
if (auxSpritePixels == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -69,13 +69,16 @@ public class RSTextureProvider
|
|||||||
TextureDefinition var2 = this.textures[var1];
|
TextureDefinition var2 = this.textures[var1];
|
||||||
if (var2 != null)
|
if (var2 != null)
|
||||||
{
|
{
|
||||||
if (var2.pixels != null)
|
synchronized (var2)
|
||||||
{
|
{
|
||||||
|
if (var2.pixels != null)
|
||||||
|
{
|
||||||
|
return var2.pixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
var2.method2680(this.brightness, this.width, spriteProvider);
|
||||||
return var2.pixels;
|
return var2.pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean var3 = var2.method2680(this.brightness, this.width, spriteProvider);
|
|
||||||
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}
|
||||||
*/
|
*/
|
||||||
@@ -79,4 +81,21 @@ public interface ObjectComposition extends ParamHolder
|
|||||||
* 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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"),
|
||||||
|
|||||||
@@ -2,7 +2,12 @@ package net.runelite.mixins;
|
|||||||
|
|
||||||
import net.runelite.api.IterableHashTable;
|
import net.runelite.api.IterableHashTable;
|
||||||
import net.runelite.api.Node;
|
import net.runelite.api.Node;
|
||||||
import net.runelite.api.mixins.*;
|
import net.runelite.api.mixins.Copy;
|
||||||
|
import net.runelite.api.mixins.Inject;
|
||||||
|
import net.runelite.api.mixins.MethodHook;
|
||||||
|
import net.runelite.api.mixins.Mixin;
|
||||||
|
import net.runelite.api.mixins.Replace;
|
||||||
|
import net.runelite.api.mixins.Shadow;
|
||||||
import net.runelite.rs.api.RSBuffer;
|
import net.runelite.rs.api.RSBuffer;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSEvictingDualNodeHashTable;
|
import net.runelite.rs.api.RSEvictingDualNodeHashTable;
|
||||||
@@ -66,7 +71,10 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (opcode == 2) setName(buffer.readStringCp1252NullTerminated());
|
else if (opcode == 2)
|
||||||
|
{
|
||||||
|
setName(buffer.readStringCp1252NullTerminated());
|
||||||
|
}
|
||||||
else if (opcode == 5)
|
else if (opcode == 5)
|
||||||
{
|
{
|
||||||
var3 = buffer.readUnsignedByte();
|
var3 = buffer.readUnsignedByte();
|
||||||
@@ -88,27 +96,63 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (opcode == 14) setSizeX(buffer.readUnsignedByte());
|
else if (opcode == 14)
|
||||||
else if (opcode == 15) setSizeY(buffer.readUnsignedByte());
|
{
|
||||||
|
setSizeX(buffer.readUnsignedByte());
|
||||||
|
}
|
||||||
|
else if (opcode == 15)
|
||||||
|
{
|
||||||
|
setSizeY(buffer.readUnsignedByte());
|
||||||
|
}
|
||||||
else if (opcode == 17)
|
else if (opcode == 17)
|
||||||
{
|
{
|
||||||
setInteractType(0);
|
setInteractType(0);
|
||||||
setBoolean1(false);
|
setBoolean1(false);
|
||||||
}
|
}
|
||||||
else if (opcode == 18) setBoolean1(false);
|
else if (opcode == 18)
|
||||||
else if (opcode == 19) setInt1(buffer.readUnsignedByte());
|
{
|
||||||
else if (opcode == 21) setClipType(0);
|
setBoolean1(false);
|
||||||
else if (opcode == 22) setNonFlatShading(true);
|
}
|
||||||
else if (opcode == 23) setModelClipped(true);
|
else if (opcode == 19)
|
||||||
|
{
|
||||||
|
setInt1(buffer.readUnsignedByte());
|
||||||
|
}
|
||||||
|
else if (opcode == 21)
|
||||||
|
{
|
||||||
|
setClipType(0);
|
||||||
|
}
|
||||||
|
else if (opcode == 22)
|
||||||
|
{
|
||||||
|
setNonFlatShading(true);
|
||||||
|
}
|
||||||
|
else if (opcode == 23)
|
||||||
|
{
|
||||||
|
setModelClipped(true);
|
||||||
|
}
|
||||||
else if (opcode == 24)
|
else if (opcode == 24)
|
||||||
{
|
{
|
||||||
setAnimationId(buffer.readUnsignedShort());
|
setAnimationId(buffer.readUnsignedShort());
|
||||||
if (getAnimationId() == 65535) setAnimationId(-1);
|
if (getAnimationId() == 65535)
|
||||||
|
{
|
||||||
|
setAnimationId(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (opcode == 27)
|
||||||
|
{
|
||||||
|
setInteractType(1);
|
||||||
|
}
|
||||||
|
else if (opcode == 28)
|
||||||
|
{
|
||||||
|
setInt2(buffer.readUnsignedByte());
|
||||||
|
}
|
||||||
|
else if (opcode == 29)
|
||||||
|
{
|
||||||
|
setAmbient(buffer.readByte());
|
||||||
|
}
|
||||||
|
else if (opcode == 39)
|
||||||
|
{
|
||||||
|
setContrast(buffer.readByte() * 25);
|
||||||
}
|
}
|
||||||
else if (opcode == 27) setInteractType(1);
|
|
||||||
else if (opcode == 28) setInt2(buffer.readUnsignedByte());
|
|
||||||
else if (opcode == 29) setAmbient(buffer.readByte());
|
|
||||||
else if (opcode == 39) setContrast(buffer.readByte() * 25);
|
|
||||||
else if (opcode >= 30 && opcode < 35)
|
else if (opcode >= 30 && opcode < 35)
|
||||||
{
|
{
|
||||||
getActions()[opcode - 30] = buffer.readStringCp1252NullTerminated();
|
getActions()[opcode - 30] = buffer.readStringCp1252NullTerminated();
|
||||||
@@ -139,20 +183,62 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition
|
|||||||
getRetextureTo()[var4] = (short) buffer.readUnsignedShort();
|
getRetextureTo()[var4] = (short) buffer.readUnsignedShort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (opcode == 61) buffer.readUnsignedShort();
|
else if (opcode == 61)
|
||||||
else if (opcode == 62) setIsRotated(true);
|
{
|
||||||
else if (opcode == 64) setClipped(false);
|
buffer.readUnsignedShort();
|
||||||
else if (opcode == 65) setModelSizeX(buffer.readUnsignedShort());
|
}
|
||||||
else if (opcode == 66) setModelHeight(buffer.readUnsignedShort());
|
else if (opcode == 62)
|
||||||
else if (opcode == 67) setModelSizeY(buffer.readUnsignedShort());
|
{
|
||||||
else if (opcode == 68) setMapSceneId(buffer.readUnsignedShort());
|
setIsRotated(true);
|
||||||
else if (opcode == 69) accessBitMask = buffer.readUnsignedByte();
|
}
|
||||||
else if (opcode == 70) setOffsetX(buffer.readShort());
|
else if (opcode == 64)
|
||||||
else if (opcode == 71) setOffsetHeight(buffer.readShort());
|
{
|
||||||
else if (opcode == 72) setOffsetY(buffer.readShort());
|
setClipped(false);
|
||||||
else if (opcode == 73) setBoolean2(true) ;
|
}
|
||||||
else if (opcode == 74) setIsSolid(true);
|
else if (opcode == 65)
|
||||||
else if (opcode == 75) setInt3(buffer.readUnsignedByte());
|
{
|
||||||
|
setModelSizeX(buffer.readUnsignedShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 66)
|
||||||
|
{
|
||||||
|
setModelHeight(buffer.readUnsignedShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 67)
|
||||||
|
{
|
||||||
|
setModelSizeY(buffer.readUnsignedShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 68)
|
||||||
|
{
|
||||||
|
setMapSceneId(buffer.readUnsignedShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 69)
|
||||||
|
{
|
||||||
|
accessBitMask = buffer.readUnsignedByte();
|
||||||
|
}
|
||||||
|
else if (opcode == 70)
|
||||||
|
{
|
||||||
|
setOffsetX(buffer.readShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 71)
|
||||||
|
{
|
||||||
|
setOffsetHeight(buffer.readShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 72)
|
||||||
|
{
|
||||||
|
setOffsetY(buffer.readShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 73)
|
||||||
|
{
|
||||||
|
setBoolean2(true);
|
||||||
|
}
|
||||||
|
else if (opcode == 74)
|
||||||
|
{
|
||||||
|
setIsSolid(true);
|
||||||
|
}
|
||||||
|
else if (opcode == 75)
|
||||||
|
{
|
||||||
|
setInt3(buffer.readUnsignedByte());
|
||||||
|
}
|
||||||
else if (opcode != 77 && opcode != 92)
|
else if (opcode != 77 && opcode != 92)
|
||||||
{
|
{
|
||||||
if (opcode == 78)
|
if (opcode == 78)
|
||||||
@@ -174,9 +260,18 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition
|
|||||||
getSoundEffectIds()[var4] = buffer.readUnsignedShort();
|
getSoundEffectIds()[var4] = buffer.readUnsignedShort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (opcode == 81) setClipType(buffer.readUnsignedByte() * 256);
|
else if (opcode == 81)
|
||||||
else if (opcode == 82) setMapIconId(buffer.readUnsignedShort());
|
{
|
||||||
else if (opcode == 89) setBoolean3(false);
|
setClipType(buffer.readUnsignedByte() * 256);
|
||||||
|
}
|
||||||
|
else if (opcode == 82)
|
||||||
|
{
|
||||||
|
setMapIconId(buffer.readUnsignedShort());
|
||||||
|
}
|
||||||
|
else if (opcode == 89)
|
||||||
|
{
|
||||||
|
setBoolean3(false);
|
||||||
|
}
|
||||||
else if (opcode == 249)
|
else if (opcode == 249)
|
||||||
{
|
{
|
||||||
setParams((IterableHashTable<Node>) client.readStringIntParameters(buffer, getParams()));
|
setParams((IterableHashTable<Node>) client.readStringIntParameters(buffer, getParams()));
|
||||||
@@ -185,16 +280,25 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setTransformVarbit(buffer.readUnsignedShort());
|
setTransformVarbit(buffer.readUnsignedShort());
|
||||||
if (getTransformVarbit() == 65535) setTransformVarbit(-1);
|
if (getTransformVarbit() == 65535)
|
||||||
|
{
|
||||||
|
setTransformVarbit(-1);
|
||||||
|
}
|
||||||
setTransformVarp(buffer.readUnsignedShort());
|
setTransformVarp(buffer.readUnsignedShort());
|
||||||
if (getTransformVarp() == 65535) setTransformVarp(-1);
|
if (getTransformVarp() == 65535)
|
||||||
|
{
|
||||||
|
setTransformVarp(-1);
|
||||||
|
}
|
||||||
|
|
||||||
var3 = -1;
|
var3 = -1;
|
||||||
|
|
||||||
if (opcode == 92)
|
if (opcode == 92)
|
||||||
{
|
{
|
||||||
var3 = buffer.readUnsignedShort();
|
var3 = buffer.readUnsignedShort();
|
||||||
if (var3 == 65535) var3 = -1;
|
if (var3 == 65535)
|
||||||
|
{
|
||||||
|
var3 = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var4 = buffer.readUnsignedByte();
|
var4 = buffer.readUnsignedByte();
|
||||||
@@ -203,7 +307,10 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition
|
|||||||
for (int var5 = 0; var5 <= var4; ++var5)
|
for (int var5 = 0; var5 <= var4; ++var5)
|
||||||
{
|
{
|
||||||
getTransforms()[var5] = buffer.readUnsignedShort();
|
getTransforms()[var5] = buffer.readUnsignedShort();
|
||||||
if (getTransforms()[var5] == 65535) getTransforms()[var5] = -1;
|
if (getTransforms()[var5] == 65535)
|
||||||
|
{
|
||||||
|
getTransforms()[var5] = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTransforms()[var4 + 1] = var3;
|
getTransforms()[var4 + 1] = var3;
|
||||||
|
|||||||
@@ -235,12 +235,18 @@ public interface RSObjectComposition extends ObjectComposition
|
|||||||
@Import("transformVarbit")
|
@Import("transformVarbit")
|
||||||
int getTransformVarbit();
|
int getTransformVarbit();
|
||||||
|
|
||||||
|
@Import("transformVarbit")
|
||||||
|
int getVarbitId();
|
||||||
|
|
||||||
@Import("transformVarp")
|
@Import("transformVarp")
|
||||||
void setTransformVarp(int transformVarp);
|
void setTransformVarp(int transformVarp);
|
||||||
|
|
||||||
@Import("transformVarp")
|
@Import("transformVarp")
|
||||||
int getTransformVarp();
|
int getTransformVarp();
|
||||||
|
|
||||||
|
@Import("transformVarp")
|
||||||
|
int getVarPlayerId();
|
||||||
|
|
||||||
@Import("transforms")
|
@Import("transforms")
|
||||||
void setTransforms(int[] transforms);
|
void setTransforms(int[] transforms);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user