Merge remote-tracking branch 'upstream/master'

This commit is contained in:
skelsoft
2021-07-18 06:52:49 +10:00
9 changed files with 145 additions and 101 deletions
+66 -41
View File
@@ -2584,28 +2584,28 @@
],
"charm": [
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "3",
"weight": "16.0",
"id": "12158",
"maxAmount": "1"
"maxAmount": "3"
},
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "3",
"weight": "64.0",
"id": "12159",
"maxAmount": "1"
"maxAmount": "3"
},
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "3",
"weight": "16.0",
"id": "12160",
"maxAmount": "1"
"maxAmount": "3"
},
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "3",
"weight": "4.0",
"id": "12163",
"maxAmount": "1"
"maxAmount": "3"
}
],
"ids": "54,4673,4674,4675,4676",
@@ -3945,25 +3945,25 @@
"charm": [
{
"minAmount": "1",
"weight": "100.0",
"weight": "20.0",
"id": "12158",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "75.0",
"id": "12159",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "4.0",
"id": "12160",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "1.0",
"id": "12163",
"maxAmount": "1"
}
@@ -23116,7 +23116,32 @@
"maxAmount": "1"
}
],
"charm": [],
"charm": [
{
"minAmount": "1",
"weight": "28.0",
"id": "12158",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "14.0",
"id": "12159",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "56.0",
"id": "12160",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "2.0",
"id": "12163",
"maxAmount": "1"
}
],
"ids": "2455,2456",
"description": "Waterbirth Dagannoths",
"main": [
@@ -26326,25 +26351,25 @@
"charm": [
{
"minAmount": "1",
"weight": "100.0",
"weight": "12.0",
"id": "12158",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "12.0",
"id": "12159",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "72.0",
"id": "12160",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "4.0",
"id": "12163",
"maxAmount": "1"
}
@@ -34882,25 +34907,25 @@
"charm": [
{
"minAmount": "1",
"weight": "100.0",
"weight": "25.0",
"id": "12158",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "10.0",
"id": "12159",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "25.0",
"id": "12160",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "40.0",
"id": "12163",
"maxAmount": "1"
}
@@ -36939,28 +36964,28 @@
"default": [],
"charm": [
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "2",
"weight": "27.0",
"id": "12158",
"maxAmount": "1"
"maxAmount": "2"
},
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "2",
"weight": "18.0",
"id": "12159",
"maxAmount": "1"
"maxAmount": "2"
},
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "2",
"weight": "50.0",
"id": "12160",
"maxAmount": "1"
"maxAmount": "2"
},
{
"minAmount": "1",
"weight": "100.0",
"minAmount": "2",
"weight": "5.0",
"id": "12163",
"maxAmount": "1"
"maxAmount": "2"
}
],
"ids": "2889",
@@ -44420,25 +44445,25 @@
"charm": [
{
"minAmount": "1",
"weight": "100.0",
"weight": "13.0",
"id": "12158",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "5.0",
"id": "12159",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "80.0",
"id": "12160",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"weight": "2.0",
"id": "12163",
"maxAmount": "1"
}
+31 -31
View File
@@ -4438,7 +4438,7 @@
{
"ge_buy_limit": "25000",
"examine": "This needs refining.",
"grand_exchange_price": "230",
"grand_exchange_price": "204",
"tokkul_price": "25",
"durability": null,
"name": "Iron ore",
@@ -4467,7 +4467,7 @@
"low_alchemy": "30",
"high_alchemy": "45",
"weight": "2",
"grand_exchange_price": "205",
"grand_exchange_price": "180",
"name": "Silver ore",
"tradeable": "true",
"archery_ticket_price": "0",
@@ -4485,7 +4485,7 @@
{
"ge_buy_limit": "25000",
"examine": "This needs refining.",
"grand_exchange_price": "319",
"grand_exchange_price": "311",
"tokkul_price": "225",
"durability": null,
"name": "Gold ore",
@@ -4523,7 +4523,7 @@
"low_alchemy": "64",
"high_alchemy": "97",
"weight": "1.75",
"grand_exchange_price": "460",
"grand_exchange_price": "420",
"name": "Mithril ore",
"tradeable": "true",
"archery_ticket_price": "0",
@@ -4547,7 +4547,7 @@
"low_alchemy": "160",
"high_alchemy": "240",
"weight": "2.7",
"grand_exchange_price": "1330",
"grand_exchange_price": "1160",
"name": "Adamantite ore",
"tradeable": "true",
"archery_ticket_price": "0",
@@ -4588,7 +4588,7 @@
{
"ge_buy_limit": "25000",
"examine": "Hmm a non-renewable energy source!",
"grand_exchange_price": "350",
"grand_exchange_price": "320",
"tokkul_price": "67",
"durability": null,
"name": "Coal",
@@ -5539,7 +5539,7 @@
"shop_price": "17",
"ge_buy_limit": "25000",
"examine": "One of the 4 basic elemental Runes.",
"grand_exchange_price": "17",
"grand_exchange_price": "18",
"tokkul_price": "6",
"durability": null,
"name": "Fire rune",
@@ -5553,7 +5553,7 @@
"shop_price": "17",
"ge_buy_limit": "25000",
"examine": "One of the 4 basic elemental Runes.",
"grand_exchange_price": "17",
"grand_exchange_price": "18",
"tokkul_price": "6",
"durability": null,
"name": "Water rune",
@@ -5567,7 +5567,7 @@
"shop_price": "17",
"ge_buy_limit": "25000",
"examine": "One of the 4 basic elemental Runes.",
"grand_exchange_price": "17",
"grand_exchange_price": "18",
"tokkul_price": "6",
"durability": null,
"name": "Air rune",
@@ -5581,7 +5581,7 @@
"shop_price": "17",
"ge_buy_limit": "25000",
"examine": "One of the 4 basic elemental Runes.",
"grand_exchange_price": "17",
"grand_exchange_price": "18",
"tokkul_price": "6",
"durability": null,
"name": "Earth rune",
@@ -5595,7 +5595,7 @@
"shop_price": "17",
"ge_buy_limit": "25000",
"examine": "Used for basic missile spells.",
"grand_exchange_price": "17",
"grand_exchange_price": "18",
"tokkul_price": "4",
"durability": null,
"name": "Mind rune",
@@ -5623,7 +5623,7 @@
"shop_price": "310",
"ge_buy_limit": "25000",
"examine": "Used for medium missile spells.",
"grand_exchange_price": "235",
"grand_exchange_price": "320",
"durability": null,
"name": "Death rune",
"tradeable": "true",
@@ -5636,7 +5636,7 @@
"shop_price": "372",
"ge_buy_limit": "25000",
"examine": "Used for alchemy spells.",
"grand_exchange_price": "325",
"grand_exchange_price": "380",
"durability": null,
"name": "Nature rune",
"tradeable": "true",
@@ -5649,7 +5649,7 @@
"shop_price": "140",
"ge_buy_limit": "25000",
"examine": "Used for small missile spells.",
"grand_exchange_price": "145",
"grand_exchange_price": "140",
"durability": null,
"name": "Chaos rune",
"tradeable": "true",
@@ -5662,7 +5662,7 @@
"shop_price": "378",
"ge_buy_limit": "25000",
"examine": "Used for teleport spells.",
"grand_exchange_price": "350",
"grand_exchange_price": "380",
"durability": null,
"name": "Law rune",
"tradeable": "true",
@@ -5675,7 +5675,7 @@
"shop_price": "232",
"ge_buy_limit": "25000",
"examine": "Used for enchant spells.",
"grand_exchange_price": "180",
"grand_exchange_price": "240",
"durability": null,
"name": "Cosmic rune",
"tradeable": "true",
@@ -5688,7 +5688,7 @@
"shop_price": "550",
"ge_buy_limit": "25000",
"examine": "Used for large missile spells.",
"grand_exchange_price": "435",
"grand_exchange_price": "560",
"durability": null,
"name": "Blood rune",
"tradeable": "true",
@@ -5701,7 +5701,7 @@
"shop_price": "400",
"ge_buy_limit": "25000",
"examine": "Used for high level curse spells.",
"grand_exchange_price": "230",
"grand_exchange_price": "420",
"durability": null,
"name": "Soul rune",
"tradeable": "true",
@@ -17251,7 +17251,7 @@
{
"ge_buy_limit": "25000",
"examine": "Logs cut from a magic tree.",
"grand_exchange_price": "750",
"grand_exchange_price": "680",
"durability": null,
"name": "Magic logs",
"tradeable": "true",
@@ -17273,7 +17273,7 @@
{
"ge_buy_limit": "25000",
"examine": "Logs cut from a yew tree.",
"grand_exchange_price": "360",
"grand_exchange_price": "320",
"durability": null,
"name": "Yew logs",
"tradeable": "true",
@@ -17295,7 +17295,7 @@
{
"ge_buy_limit": "25000",
"examine": "Logs cut from a maple tree.",
"grand_exchange_price": "180",
"grand_exchange_price": "160",
"durability": null,
"name": "Maple logs",
"tradeable": "true",
@@ -17339,7 +17339,7 @@
{
"ge_buy_limit": "25000",
"examine": "Logs cut from an Oak Tree.",
"grand_exchange_price": "160",
"grand_exchange_price": "140",
"durability": null,
"name": "Oak logs",
"tradeable": "true",
@@ -18029,7 +18029,7 @@
{
"ge_buy_limit": "1000",
"examine": "A semi precious stone.",
"grand_exchange_price": "41",
"grand_exchange_price": "44",
"durability": null,
"name": "Opal",
"tradeable": "true",
@@ -18049,7 +18049,7 @@
},
{
"ge_buy_limit": "1000",
"grand_exchange_price": "83",
"grand_exchange_price": "84",
"durability": null,
"name": "Jade",
"archery_ticket_price": "0",
@@ -18067,7 +18067,7 @@
{
"ge_buy_limit": "1000",
"examine": "A semi precious stone.",
"grand_exchange_price": "103",
"grand_exchange_price": "120",
"durability": null,
"name": "Red topaz",
"tradeable": "true",
@@ -18112,7 +18112,7 @@
{
"ge_buy_limit": "500",
"examine": "An uncut diamond.",
"grand_exchange_price": "20000",
"grand_exchange_price": "2160",
"tokkul_price": "300",
"durability": null,
"name": "Uncut diamond",
@@ -18134,7 +18134,7 @@
{
"ge_buy_limit": "1000",
"examine": "An uncut ruby.",
"grand_exchange_price": "4970",
"grand_exchange_price": "1140",
"tokkul_price": "150",
"durability": null,
"name": "Uncut ruby",
@@ -18157,7 +18157,7 @@
"shop_price": "50",
"ge_buy_limit": "1000",
"examine": "An uncut emerald.",
"grand_exchange_price": "2621",
"grand_exchange_price": "580",
"tokkul_price": "75",
"durability": null,
"name": "Uncut emerald",
@@ -18180,7 +18180,7 @@
"shop_price": "25",
"ge_buy_limit": "1000",
"examine": "An uncut sapphire.",
"grand_exchange_price": "1851",
"grand_exchange_price": "420",
"tokkul_price": "37",
"durability": null,
"name": "Uncut sapphire",
@@ -19424,7 +19424,7 @@
{
"ge_buy_limit": "10000",
"examine": "I should take this to the tannery.",
"grand_exchange_price": "150",
"grand_exchange_price": "140",
"durability": null,
"name": "Cowhide",
"tradeable": "true",
@@ -19838,7 +19838,7 @@
{
"ge_buy_limit": "10000",
"examine": "I need a bow stave to attach this to.",
"grand_exchange_price": "250",
"grand_exchange_price": "240",
"durability": null,
"name": "Bow string",
"tradeable": "true",
@@ -604,6 +604,7 @@ public class Shop {
*/
public int getSellingValue(Item item, Player player) {
if (!item.getDefinition().isUnnoted()) {
player.setAttribute("shop:originalId",item.getId());
item = new Item(item.getNoteChange(), item.getAmount());
}
int amount = getContainer(1).getAmount(item);
@@ -622,8 +623,10 @@ public class Shop {
* @return the selling value.
*/
private int getSellValue(Player player, int amount, Item item) {
if(item.getAmount() > ContentAPI.amountInInventory(player, item.getId())){
item.setAmount(ContentAPI.amountInInventory(player, item.getId()));
int id = player.getAttribute("shop:originalId",item.getId());
if(item.getAmount() > ContentAPI.amountInInventory(player, id)){
item.setAmount(ContentAPI.amountInInventory(player, id));
player.removeAttribute("shop:originalId");
}
double diff = item.getDefinition().isStackable() ? 0.005 : 0.05;
double maxMod = 1.0 - (amount * diff);
@@ -635,6 +638,7 @@ public class Shop {
minMod = 0.25;
}
double mod = (maxMod + minMod) / 2;
SystemLogger.logInfo("" + item.getDefinition().getAlchemyValue(highAlch) + " " + mod + " " + item.getAmount());
int value = (int) (item.getDefinition().getAlchemyValue(highAlch) * mod * item.getAmount());
if(item.getId() == 12183){
value = 25 * item.getAmount();
@@ -62,6 +62,12 @@ public class AggressiveBehavior {
* @return {@code True} if the NPC can select the entity as a target.
*/
public boolean canSelectTarget(Entity entity, Entity target) {
int regionId = target.getLocation().getRegionId();
if(target instanceof Player) {
if (RegionManager.forId(regionId).isTolerated(target.asPlayer())) {
return false;
}
}
if (!target.isActive() || DeathTask.isDead(target)) {
return false;
}
@@ -81,9 +81,10 @@ public final class AggressiveHandler {
Entity target = behavior.getLogicalTarget(entity, behavior.getPossibleTargets(entity, radius));
if (target instanceof Player) {
if (target.getAttribute("ignore_aggression", false)) {
if (((Player) target).getRights().equals(Rights.ADMINISTRATOR)) {
return false;
}
return false;
}
if (((Player) target).getRights().equals(Rights.ADMINISTRATOR)) {
return false;
}
}
if (target != null) {
@@ -5,7 +5,9 @@ import core.game.node.entity.combat.BattleState;
import core.game.node.entity.npc.AbstractNPC;
import core.game.node.entity.npc.agg.AggressiveBehavior;
import core.game.node.entity.npc.agg.AggressiveHandler;
import core.game.node.entity.player.Player;
import core.game.world.map.Location;
import core.game.world.map.RegionManager;
import core.plugin.Initializable;
import core.tools.RandomFunction;
@@ -22,6 +24,10 @@ public final class RockCrabNPC extends AbstractNPC {
private static final AggressiveBehavior AGGRO_BEHAVIOR = new AggressiveBehavior() {
@Override
public boolean canSelectTarget(Entity entity, Entity target) {
int regionId = target.getLocation().getRegionId();
if(target instanceof Player){
if(RegionManager.forId(regionId).isTolerated(target.asPlayer())) return false;
}
RockCrabNPC npc = (RockCrabNPC) entity;
if (entity.getLocation().withinDistance(target.getLocation(), 3)) {
npc.aggresor = true;
@@ -267,16 +267,10 @@ public final class HouseManager {
int diffX = player.getLocation().getX() - r.getBaseLocation().getX();
int diffY = player.getLocation().getY() - r.getBaseLocation().getY();
int diffZ = player.getLocation().getZ() - r.getBaseLocation().getZ();
DynamicRegion dr = region;
DynamicRegion dd = dungeon;
RegionManager.getRegionCache().remove(dr);
RegionManager.getRegionCache().remove(dd);
region = null;
dungeon = null;
enter(player, buildingMode, false);
player.getProperties().setTeleportLocation((player.getViewport().getRegion() == dungeon ? dungeon : region).getBaseLocation().transform(diffX, diffY, diffZ));
dr.flagInactive();
dd.flagInactive();
}
/**
@@ -16,7 +16,9 @@ import rs09.game.world.repository.Repository;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* Represents a region.
@@ -60,6 +62,11 @@ public class Region {
*/
private final List<MusicZone> musicZones = new ArrayList<>(20);
/**
* Keeps track of players and time in region for tolerance purposes
*/
private final HashMap<String,Long> tolerances = new HashMap<>();
/**
* If the region is active.
*/
@@ -146,6 +153,7 @@ public class Region {
*/
public void add(Player player) {
planes[player.getLocation().getZ()].add(player);
tolerances.put(player.getUsername(), System.currentTimeMillis());
flagActive();
}
@@ -175,9 +183,17 @@ public class Region {
*/
public void remove(Player player) {
player.getViewport().getCurrentPlane().remove(player);
tolerances.remove(player.getUsername());
checkInactive();
}
/**
* Checks if player is tolerated by enemies in this region
*/
public boolean isTolerated(Player player){
return System.currentTimeMillis() - tolerances.getOrDefault(player.getUsername(), System.currentTimeMillis()) > TimeUnit.MINUTES.toMillis(10);
}
/**
* Checks if the region is inactive, if so it will start the inactivity flagging.
* @return {@code True} if the region is inactive.
@@ -299,31 +315,22 @@ public class Region {
}
}
/**
* Unloads a region - compatibility method for older uses
*/
private static void unload(Region r){
unload(r, false);
}
/**
* Unloads a region.
* @param r The region.
*/
private static void unload(Region r, boolean force) {
if(!force){
if (r.isViewed()) {
SystemLogger.logErr("Players viewing region!");
private static void unload(Region r) {
if (r.isViewed()) {
SystemLogger.logErr("Players viewing region!");
r.flagActive();
return;
}
for (RegionPlane p : r.planes) {
if (!p.getPlayers().isEmpty()) {
SystemLogger.logErr("Players still in region!");
r.flagActive();
return;
}
for (RegionPlane p : r.planes) {
if (!p.getPlayers().isEmpty()) {
SystemLogger.logErr("Players still in region!");
r.flagActive();
return;
}
}
}
for (RegionPlane p : r.planes) {
p.clear();
@@ -90,6 +90,7 @@ public final class MultiwayCombatZone extends MapZone {
registerRegion(12603);//Callisto
registerRegion(14939);//Kalphite Stronghold Cave
registerRegion(9532); //Isle north of Jatizso
registerRegion(10810); //Eastern rock crabs
}
@Override