Merge remote-tracking branch 'upstream/master'

This commit is contained in:
skelsoft
2021-07-05 10:48:56 +10:00
28 changed files with 265 additions and 120 deletions
+1
View File
@@ -18,6 +18,7 @@
· ·
<a href="https://github.com/2009scape/2009Scape/projects">Bug Board</a> <a href="https://github.com/2009scape/2009Scape/projects">Bug Board</a>
</p> </p>
<h3>NOTE: Do not report issues if you are running your own server. Chances are, the fault lies in your misconfiguration of the server or the issue has already long been fixed on live. Essentially: Your server. Your issues. We have enough to worry about with our own server.</h3>
<h3>ATTENTION: Starting October 5th, 2020 the development team will no longer be providing support for setting up your own server. Do not ping or private message Developers asking how to build the project. This in-depth guide will be continually updated if the building process changes. We are focusing all of our efforts on the development of features and bugfixes for the live server.</h3> <h3>ATTENTION: Starting October 5th, 2020 the development team will no longer be providing support for setting up your own server. Do not ping or private message Developers asking how to build the project. This in-depth guide will be continually updated if the building process changes. We are focusing all of our efforts on the development of features and bugfixes for the live server.</h3>
</p> </p>
+87 -87
View File
@@ -2393,15 +2393,15 @@
"main": [ "main": [
{ {
"minAmount": "1", "minAmount": "1",
"weight": "50.0", "weight": "25.0",
"id": "1315", "id": "1369",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "20", "minAmount": "1",
"weight": "50.0", "weight": "50.0",
"id": "828", "id": "1315",
"maxAmount": "20" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
@@ -2423,10 +2423,16 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "10.0",
"id": "1369", "id": "1303",
"maxAmount": "1" "maxAmount": "1"
}, },
{
"minAmount": "20",
"weight": "50.0",
"id": "828",
"maxAmount": "20"
},
{ {
"minAmount": "4", "minAmount": "4",
"weight": "25.0", "weight": "25.0",
@@ -2439,12 +2445,6 @@
"id": "811", "id": "811",
"maxAmount": "8" "maxAmount": "8"
}, },
{
"minAmount": "1",
"weight": "25.0",
"id": "1303",
"maxAmount": "1"
},
{ {
"minAmount": "4", "minAmount": "4",
"weight": "25.0", "weight": "25.0",
@@ -2483,7 +2483,7 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "50.0", "weight": "25.0",
"id": "205", "id": "205",
"maxAmount": "1" "maxAmount": "1"
}, },
@@ -2531,7 +2531,7 @@
}, },
{ {
"minAmount": "30", "minAmount": "30",
"weight": "50.0", "weight": "100.0",
"id": "995", "id": "995",
"maxAmount": "690" "maxAmount": "690"
}, },
@@ -2555,13 +2555,13 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "5.0", "weight": "15.8",
"id": "31", "id": "31",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "100.0", "weight": "150.0",
"id": "0", "id": "0",
"maxAmount": "1" "maxAmount": "1"
} }
@@ -2816,7 +2816,7 @@
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "25.0",
"id": "1355", "id": "1069",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
@@ -2828,19 +2828,7 @@
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "25.0",
"id": "1211", "id": "1355",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "1213",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "50.0",
"id": "1069",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
@@ -2849,15 +2837,33 @@
"id": "1197", "id": "1197",
"maxAmount": "1" "maxAmount": "1"
}, },
{
"minAmount": "1",
"weight": "25.0",
"id": "1245",
"maxAmount": "1"
},
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "25.0",
"id": "1161", "id": "1161",
"maxAmount": "1" "maxAmount": "1"
}, },
{
"minAmount": "1",
"weight": "5.0",
"id": "1213",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "1247",
"maxAmount": "1"
},
{ {
"minAmount": "75", "minAmount": "75",
"weight": "50.0", "weight": "25.0",
"id": "555", "id": "555",
"maxAmount": "75" "maxAmount": "75"
}, },
@@ -2880,10 +2886,10 @@
"maxAmount": "3" "maxAmount": "3"
}, },
{ {
"minAmount": "5", "minAmount": "8",
"weight": "5.0", "weight": "25.0",
"id": "560", "id": "565",
"maxAmount": "5" "maxAmount": "8"
}, },
{ {
"minAmount": "1", "minAmount": "1",
@@ -2905,7 +2911,7 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "50.0", "weight": "25.0",
"id": "205", "id": "205",
"maxAmount": "1" "maxAmount": "1"
}, },
@@ -2947,15 +2953,21 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "5.0", "weight": "25.0",
"id": "217", "id": "217",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "11", "minAmount": "320",
"weight": "50.0", "weight": "50.0",
"id": "995", "id": "995",
"maxAmount": "454" "maxAmount": "320"
},
{
"minAmount": "440",
"weight": "50.0",
"id": "995",
"maxAmount": "440"
}, },
{ {
"minAmount": "1", "minAmount": "1",
@@ -2977,13 +2989,13 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "5.0", "weight": "15.0",
"id": "31", "id": "31",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "100.0", "weight": "150.0",
"id": "0", "id": "0",
"maxAmount": "1" "maxAmount": "1"
} }
@@ -61785,27 +61797,21 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "15.0",
"id": "1185", "id": "1185",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "1.0", "weight": "5.0",
"id": "1333", "id": "1333",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "5.0", "weight": "25.0",
"id": "1165",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "50.0",
"id": "560", "id": "560",
"maxAmount": "15" "maxAmount": "20"
}, },
{ {
"minAmount": "1", "minAmount": "1",
@@ -61815,9 +61821,9 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "50.0", "weight": "25.0",
"id": "554", "id": "554",
"maxAmount": "65" "maxAmount": "58"
}, },
{ {
"minAmount": "1", "minAmount": "1",
@@ -61825,6 +61831,12 @@
"id": "565", "id": "565",
"maxAmount": "16" "maxAmount": "16"
}, },
{
"minAmount": "1",
"weight": "25.0",
"id": "564",
"maxAmount": "5"
},
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "25.0",
@@ -61959,39 +61971,33 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "50.0",
"id": "450", "id": "450",
"maxAmount": "1" "maxAmount": "1"
}, },
{
"minAmount": "1",
"weight": "25.0",
"id": "1623",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "25.0",
"id": "1621",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "1619",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "1617",
"maxAmount": "1"
},
{ {
"minAmount": "5", "minAmount": "5",
"weight": "25.0",
"id": "995",
"maxAmount": "5"
},
{
"minAmount": "100",
"weight": "50.0", "weight": "50.0",
"id": "995", "id": "995",
"maxAmount": "493" "maxAmount": "500"
},
{
"minAmount": "1",
"weight": "25.0",
"id": "6004",
"maxAmount": "2"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "229",
"maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
@@ -62001,13 +62007,7 @@
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "25.0", "weight": "6.0",
"id": "2841",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "31", "id": "31",
"maxAmount": "1" "maxAmount": "1"
} }
+1 -1
View File
@@ -6081,7 +6081,7 @@
}, },
{ {
"npc_id": "4250", "npc_id": "4250",
"loc_data": "{3302,3492,0,1,3}" "loc_data": "{3302,3492,0,1,6}"
}, },
{ {
"npc_id": "4251", "npc_id": "4251",
@@ -335,11 +335,14 @@ public class GrandExchangeInterface extends ComponentPlugin {
setOfferAmount(player, offer, amount + 1000); setOfferAmount(player, offer, amount + 1000);
return true; return true;
case 170: // value x case 170: // value x
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
if (player.getInterfaceManager().getChatbox().getId() == 389) { if (player.getInterfaceManager().getChatbox().getId() == 389) {
player.getPlayerGrandExchange().openSearch(); player.getPlayerGrandExchange().openSearch();
} }
setOfferAmount(player, offer, (int) value); String s = value.toString();
s = s.replace("k","000");
s = s.replace("K","000");
setOfferAmount(player, offer, Integer.parseInt(s));
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
return false; return false;
@@ -368,11 +371,14 @@ public class GrandExchangeInterface extends ComponentPlugin {
player.getPacketDispatch().sendMessage("Please select an offer first."); player.getPacketDispatch().sendMessage("Please select an offer first.");
return true; return true;
} }
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
if (player.getInterfaceManager().getChatbox().getId() == 389) { if (player.getInterfaceManager().getChatbox().getId() == 389) {
player.getPlayerGrandExchange().openSearch(); player.getPlayerGrandExchange().openSearch();
} }
setOfferValue(player, offer, (int) value); String s = value.toString();
s = s.replace("k","000");
s = s.replace("K","000");
setOfferValue(player, offer, Integer.parseInt(s));
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
return false; return false;
@@ -1,5 +1,6 @@
package core.game.interaction.inter; package core.game.interaction.inter;
import api.ContentAPI;
import core.game.component.Component; import core.game.component.Component;
import core.game.component.ComponentDefinition; import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin; import core.game.component.ComponentPlugin;
@@ -68,8 +68,12 @@ public final class TradeInterfacePlugin extends ComponentPlugin {
module.getContainer().withdraw(slot, module.getContainer().getAmount(module.getContainer().get(slot))); module.getContainer().withdraw(slot, module.getContainer().getAmount(module.getContainer().get(slot)));
break; break;
case 234: case 234:
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
module.getContainer().withdraw(slot, (int) value); String s = value.toString();
s = s.replace("k","000");
s = s.replace("K","000");
int val = Integer.parseInt(s);
module.getContainer().withdraw(slot, val);
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
break; break;
@@ -96,8 +100,12 @@ public final class TradeInterfacePlugin extends ComponentPlugin {
module.getContainer().offer(slot, player.getInventory().getAmount(player.getInventory().get(slot))); module.getContainer().offer(slot, player.getInventory().getAmount(player.getInventory().get(slot)));
break; break;
case 234: case 234:
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
module.getContainer().offer(slot, (int) value); String s = value.toString();
s = s.replace("k","000");
s = s.replace("K","000");
int val = Integer.parseInt(s);
module.getContainer().offer(slot, val);
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
break; break;
@@ -222,8 +222,12 @@ public final class FruitCuttingPlugin extends UseWithHandler {
amount = 5; amount = 5;
break; break;
case 4: case 4:
ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> {
cut(player, (int) value, slice); String s = value.toString();
s = s.replace("k","000");
s = s.replace("K","000");
int val = Integer.parseInt(s);
cut(player, val, slice);
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
return true; return true;
@@ -13,6 +13,7 @@ import core.game.node.item.Item;
import core.game.node.object.Scenery; import core.game.node.object.Scenery;
import core.plugin.Plugin; import core.plugin.Plugin;
import core.plugin.Initializable; import core.plugin.Initializable;
import rs09.game.node.entity.skill.skillcapeperks.SkillcapePerks;
import rs09.plugin.PluginManager; import rs09.plugin.PluginManager;
/** /**
@@ -70,7 +71,7 @@ public final class SmithingPlugin extends UseWithHandler {
player.getDialogueInterpreter().sendDialogue("Property of Doric the Dwarf."); player.getDialogueInterpreter().sendDialogue("Property of Doric the Dwarf.");
return true; return true;
} }
if (!player.getInventory().contains(2347, 1)) { if (!player.getInventory().contains(2347, 1) && !SkillcapePerks.isActive(SkillcapePerks.BAREFISTED_SMITHING,player)) {
player.getDialogueInterpreter().sendDialogue("You need a hammer to work the metal with."); player.getDialogueInterpreter().sendDialogue("You need a hammer to work the metal with.");
return true; return true;
} else { } else {
@@ -372,9 +372,13 @@ public final class BankingPlugin extends OptionHandler {
amount = p.getBank().getLastAmountX(); amount = p.getBank().getLastAmountX();
break; break;
case 234: case 234:
ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> {
p.getBank().takeItem(slot, (int) value); String s = value.toString();
p.getBank().updateLastAmountX((int) value); s = s.replace("k","000");
s = s.replace("K","000");
int val = Integer.parseInt(s);
p.getBank().takeItem(slot, val);
p.getBank().updateLastAmountX(val);
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
break; break;
@@ -446,9 +450,13 @@ public final class BankingPlugin extends OptionHandler {
p.getBank().addItem(slot, p.getBank().getLastAmountX()); p.getBank().addItem(slot, p.getBank().getLastAmountX());
break; break;
case 234: case 234:
ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> {
p.getBank().addItem(slot, (int) value); String s = value.toString();
p.getBank().updateLastAmountX((int) value); s = s.replace("k","000");
s = s.replace("K","000");
int val = Integer.parseInt(s);
p.getBank().addItem(slot, val);
p.getBank().updateLastAmountX(val);
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
break; break;
@@ -512,8 +520,12 @@ public final class BankingPlugin extends OptionHandler {
}); });
return true; return true;
case 234: case 234:
ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> { ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> {
p.getBank().addItem(slot, (int) value); String s = value.toString();
s = s.replace("k","000");
s = s.replace("K","000");
int val = Integer.parseInt(s);
p.getBank().addItem(slot, val);
InterfaceContainer.generateItems(p, p.getInventory().toArray(), new String[]{"Examine", "Deposit-X", "Deposit-All", "Deposit-10", "Deposit-5", "Deposit-1",}, 11, 15, 5, 7); InterfaceContainer.generateItems(p, p.getInventory().toArray(), new String[]{"Examine", "Deposit-X", "Deposit-All", "Deposit-10", "Deposit-5", "Deposit-1",}, 11, 15, 5, 7);
return Unit.INSTANCE; return Unit.INSTANCE;
}); });
@@ -464,6 +464,7 @@ public final class WeaponInterface extends Component {
Component component = new Component(id); Component component = new Component(id);
component.getDefinition().setTabIndex(0); component.getDefinition().setTabIndex(0);
component.getDefinition().setType(InterfaceType.TAB); component.getDefinition().setType(InterfaceType.TAB);
player.setAttribute("autocast_component",component);
player.getInterfaceManager().openTab(component); player.getInterfaceManager().openTab(component);
} }
@@ -110,14 +110,12 @@ public final class BindSpell extends CombatSpell {
if (state.getEstimatedHit() == -1) { if (state.getEstimatedHit() == -1) {
return; return;
} }
int tick = 0; int tick = 9;
if (getType() == SpellType.BIND) { if (getType() == SpellType.BIND) {
state.setEstimatedHit(-2); state.setEstimatedHit(-2);
} }
if (state.getSpell().getSpellId() == 12) { if (state.getSpell().getSpellId() == 30) {
tick = 8; tick = 17;
} else if (state.getSpell().getSpellId() == 30) {
tick = 16;
} else if (state.getSpell().getSpellId() == 56) { } else if (state.getSpell().getSpellId() == 56) {
tick = 25; tick = 25;
} }
@@ -76,6 +76,7 @@ public final class SkullManager {
return; return;
} }
skullCauses.add(o); skullCauses.add(o);
player.clearState("skull");
player.registerState("skull").init(); player.registerState("skull").init();
} }
@@ -267,6 +267,9 @@ public final class HouseManager {
int diffX = player.getLocation().getX() - r.getBaseLocation().getX(); int diffX = player.getLocation().getX() - r.getBaseLocation().getX();
int diffY = player.getLocation().getY() - r.getBaseLocation().getY(); int diffY = player.getLocation().getY() - r.getBaseLocation().getY();
int diffZ = player.getLocation().getZ() - r.getBaseLocation().getZ(); int diffZ = player.getLocation().getZ() - r.getBaseLocation().getZ();
RegionManager.getRegionCache().remove(r);
region.flagInactive();
dungeon.flagInactive();
region = null; region = null;
dungeon = null; dungeon = null;
enter(player, buildingMode, false); enter(player, buildingMode, false);
@@ -378,7 +381,8 @@ public final class HouseManager {
Region.load(from, true); Region.load(from, true);
RegionChunk defaultChunk = from.getPlanes()[style.getPlane()].getRegionChunk(1, 0); RegionChunk defaultChunk = from.getPlanes()[style.getPlane()].getRegionChunk(1, 0);
ZoneBorders borders = DynamicRegion.reserveArea(8, 8); ZoneBorders borders = DynamicRegion.reserveArea(8, 8);
region = new DynamicRegion(-1, borders.getSouthWestX() >> 6, borders.getSouthWestY() >> 6); //region = DynamicRegion.create(from.getRegionId());
region = new DynamicRegion(from.getRegionId(), borders.getSouthWestX() >> 6, borders.getSouthWestY() >> 6);
region.setBorders(borders); region.setBorders(borders);
region.setUpdateAllPlanes(true); region.setUpdateAllPlanes(true);
RegionManager.addRegion(region.getId(), region); RegionManager.addRegion(region.getId(), region);
@@ -3,6 +3,7 @@ package core.game.node.entity.skill.construction;
import core.game.node.entity.Entity; import core.game.node.entity.Entity;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import core.game.world.map.RegionManager;
import core.game.world.map.zone.MapZone; import core.game.world.map.zone.MapZone;
import core.game.world.map.zone.ZoneRestriction; import core.game.world.map.zone.ZoneRestriction;
@@ -70,6 +71,11 @@ public final class HouseZone extends MapZone {
if (e instanceof Player) { if (e instanceof Player) {
Player p = (Player) e; Player p = (Player) e;
HouseManager.leave(p); HouseManager.leave(p);
if(house.getRegion() == p.getHouseManager().getRegion()){
house.getRegion().flagActive();
house.getDungeonRegion().flagActive();
RegionManager.getRegionCache().remove(house.getRegion());
}
return true; return true;
} }
} }
@@ -48,6 +48,7 @@ public class PickableDoorHandler extends OptionHandler {
pickableDoors.add(new PickableDoor(new Location[]{Location.create(3190, 3957, 0)}, 32, 25, true)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(3190, 3957, 0)}, 32, 25, true));
pickableDoors.add(new PickableDoor(new Location[]{Location.create(2565, 3356, 0)}, 46, 37.5)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(2565, 3356, 0)}, 46, 37.5));
pickableDoors.add(new PickableDoor(new Location[]{Location.create(2579, 3286, 1)}, 61, 50)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(2579, 3286, 1)}, 61, 50));
pickableDoors.add(new PickableDoor(new Location[]{Location.create(2579, 3307, 1)}, 61, 50));
pickableDoors.add(new PickableDoor(new Location[]{Location.create(3018, 3187, 0)}, 1, 0.0)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(3018, 3187, 0)}, 1, 0.0));
pickableDoors.add(new PickableDoor(new Location[]{Location.create(2601, 9482, 0)}, 82, 0.0, true)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(2601, 9482, 0)}, 82, 0.0, true));
return this; return this;
@@ -245,7 +245,7 @@ public abstract class MapZone implements Zone {
/** /**
* Configures this map zone. * Configures this map zone.
*/ */
public abstract void configure(); public void configure(){};
/** /**
* Cleans items from a players inventory, equipment and bank. * Cleans items from a players inventory, equipment and bank.
+33 -2
View File
@@ -25,6 +25,9 @@ import core.game.system.task.Pulse
import core.game.world.map.Location import core.game.world.map.Location
import core.game.world.map.RegionManager import core.game.world.map.RegionManager
import core.game.world.map.path.Pathfinder import core.game.world.map.path.Pathfinder
import core.game.world.map.zone.MapZone
import core.game.world.map.zone.ZoneBorders
import core.game.world.map.zone.ZoneBuilder
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics import core.game.world.update.flag.context.Graphics
import core.tools.RandomFunction import core.tools.RandomFunction
@@ -956,8 +959,25 @@ object ContentAPI {
*/ */
@JvmStatic @JvmStatic
fun sendInputDialogue(player: Player, numeric: Boolean, prompt: String, handler: (value: Any) -> Unit){ fun sendInputDialogue(player: Player, numeric: Boolean, prompt: String, handler: (value: Any) -> Unit){
player.dialogueInterpreter.sendInput(!numeric, prompt) if(numeric) sendInputDialogue(player, InputType.NUMERIC, prompt, handler)
player.setAttribute("runscript",handler) //Handled in RunScriptPacketHandler else sendInputDialogue(player, InputType.STRING_SHORT, prompt, handler)
}
/**
* Send input dialogues based on type. Some dialogues are special and can't be covered by the other sendInputDialogue method
* @param player the player to send the input dialogue to
* @param type the input type to send - an enum is available for this called InputType
* @param prompt what to prompt the player
* @param handler the method that handles the value from the input dialogue
*/
@JvmStatic
fun sendInputDialogue(player: Player, type: InputType, prompt: String, handler: (value: Any) -> Unit){
when(type){
InputType.NUMERIC, InputType.STRING_SHORT -> player.dialogueInterpreter.sendInput(type != InputType.NUMERIC, prompt)
InputType.STRING_LONG -> player.dialogueInterpreter.sendLongInput(prompt)
InputType.MESSAGE -> player.dialogueInterpreter.sendMessageInput(prompt)
}
player.setAttribute("runscript", handler)
} }
/** /**
@@ -1005,4 +1025,15 @@ object ContentAPI {
fun sceneryDefinition(id: Int): SceneryDefinition{ fun sceneryDefinition(id: Int): SceneryDefinition{
return SceneryDefinition.forId(id) return SceneryDefinition.forId(id)
} }
/**
* Register a map zone
* @param zone the zone to register
* @param borders the ZoneBorders that compose the zone
*/
@JvmStatic
fun registerMapZone(zone: MapZone, borders: ZoneBorders){
ZoneBuilder.configure(zone)
zone.register(borders)
}
} }
+8
View File
@@ -0,0 +1,8 @@
package api
enum class InputType {
NUMERIC,
STRING_SHORT,
STRING_LONG,
MESSAGE
}
@@ -2,6 +2,7 @@ package rs09.game.interaction
import core.game.interaction.DestinationFlag import core.game.interaction.DestinationFlag
import core.game.interaction.MovementPulse import core.game.interaction.MovementPulse
import core.game.interaction.Option
import core.game.node.Node import core.game.node.Node
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.world.map.Location import core.game.world.map.Location
@@ -171,6 +172,8 @@ object InteractionListeners {
else -> DestinationFlag.OBJECT else -> DestinationFlag.OBJECT
} }
if(player.zoneMonitor.interact(node, Option(option, 0))) return true
if(player.locks.isInteractionLocked) return false if(player.locks.isInteractionLocked) return false
val method = get(id,type,option) ?: get(option,type) ?: return false val method = get(id,type,option) ?: get(option,type) ?: return false
@@ -0,0 +1,33 @@
package rs09.game.interaction.`object`
import api.ContentAPI
import core.game.interaction.Option
import core.game.node.Node
import core.game.node.entity.Entity
import core.game.world.map.zone.MapZone
import core.game.world.map.zone.ZoneBorders
import rs09.game.interaction.InteractionListener
class VarrockGuardSignpost : InteractionListener() {
override fun defineListeners() {
val zone = object : MapZone("Varrock Guards", true){
var pickpocketCounter = 0
override fun interact(e: Entity?, target: Node?, option: Option?): Boolean {
if(option != null && option.name.toLowerCase().contains("pickpocket") && target != null && target.name.toLowerCase().contains("guard")){
pickpocketCounter++
}
return false
}
}
ContentAPI.registerMapZone(zone, ZoneBorders(3225,3445,3198,3471))
ContentAPI.registerMapZone(zone, ZoneBorders(3222,3375,3199,3387))
ContentAPI.registerMapZone(zone, ZoneBorders(3180,3420,3165,3435))
ContentAPI.registerMapZone(zone, ZoneBorders(3280,3422,3266,3435))
on(31298, SCENERY, "read"){player, node ->
ContentAPI.sendDialogue(player, "Guards in the Varrock Palace are on full alert due to increasing levels of pickpocketing. So far today, ${zone.pickpocketCounter} guards have had their money pickpocketed in the palace or at the city gates.")
return@on true
}
}
}
@@ -1,5 +1,6 @@
package rs09.game.node.entity.combat package rs09.game.node.entity.combat
import core.game.component.Component
import core.game.container.Container import core.game.container.Container
import core.game.container.impl.EquipmentContainer import core.game.container.impl.EquipmentContainer
import core.game.node.Node import core.game.node.Node
@@ -7,8 +8,7 @@ import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.combat.InteractionType import core.game.node.entity.combat.InteractionType
import core.game.node.entity.combat.equipment.ArmourSet import core.game.node.entity.combat.equipment.*
import core.game.node.entity.combat.equipment.DegradableEquipment
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.audio.Audio import core.game.node.entity.player.link.audio.Audio
@@ -219,6 +219,20 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
* @return `True` if so. * @return `True` if so.
*/ */
open fun isAttackable(entity: Entity, victim: Entity): InteractionType? { open fun isAttackable(entity: Entity, victim: Entity): InteractionType? {
val comp = entity.getAttribute("autocast_component",null) as Component?
if((comp != null || type == CombatStyle.MAGIC) && (entity.properties.autocastSpell == null || entity.properties.autocastSpell.spellId == 0) && entity is Player){
val weapEx = entity.getExtension<Any>(WeaponInterface::class.java) as WeaponInterface?
if(comp != null){
entity.interfaceManager.close(comp)
entity.interfaceManager.openTab(weapEx)
entity.properties.combatPulse.stop()
entity.attack(victim)
entity.removeAttribute("autocast_component")
}
weapEx?.setAttackStyle(1)
weapEx?.updateInterface()
entity.debug("Adjusting attack style")
}
if (entity.location == victim.location) { if (entity.location == victim.location) {
return if (entity.index < victim.index && victim.properties.combatPulse.getVictim() === entity) { return if (entity.index < victim.index && victim.properties.combatPulse.getVictim() === entity) {
InteractionType.STILL_INTERACT InteractionType.STILL_INTERACT
@@ -1,6 +1,8 @@
package rs09.game.node.entity.skill.farming package rs09.game.node.entity.skill.farming
import api.ContentAPI
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item import core.game.node.item.Item
import core.tools.RandomFunction import core.tools.RandomFunction
import org.json.simple.JSONArray import org.json.simple.JSONArray
@@ -44,6 +46,8 @@ class CompostBin(val player: Player, val bin: CompostBins) {
isClosed = false isClosed = false
} }
updateBit() updateBit()
if(isSuperCompost) ContentAPI.rewardXP(player, Skills.FARMING, 8.5)
else ContentAPI.rewardXP(player, Skills.FARMING, 4.5)
return Item(item) return Item(item)
} }
@@ -1,5 +1,6 @@
package rs09.game.node.entity.skill.farming package rs09.game.node.entity.skill.farming
import api.ContentAPI
import core.game.interaction.NodeUsageEvent import core.game.interaction.NodeUsageEvent
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.item.Item import core.game.node.item.Item
@@ -123,6 +124,7 @@ object UseWithPatchHandler{
override fun pulse(): Boolean { override fun pulse(): Boolean {
if(player.inventory.remove(event.usedItem,false)){ if(player.inventory.remove(event.usedItem,false)){
p.compost = if(usedItem.id == Items.SUPERCOMPOST_6034) CompostType.SUPER else CompostType.NORMAL p.compost = if(usedItem.id == Items.SUPERCOMPOST_6034) CompostType.SUPER else CompostType.NORMAL
if(p.compost == CompostType.SUPER) ContentAPI.rewardXP(player, Skills.FARMING, 26.0) else ContentAPI.rewardXP(player, Skills.FARMING, 18.5)
if(p.plantable != null){ if(p.plantable != null){
p.harvestAmt += if(p.compost == CompostType.NORMAL) 1 else if(p.compost == CompostType.SUPER) 2 else 0 p.harvestAmt += if(p.compost == CompostType.NORMAL) 1 else if(p.compost == CompostType.SUPER) 2 else 0
} }
@@ -110,6 +110,7 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
if(!isActive(this,player)){ if(!isActive(this,player)){
player.setAttribute("/save:$attribute",true) player.setAttribute("/save:$attribute",true)
} }
player.debug("Activated ${this.name}")
if(this == CONSTANT_GLOW) if(this == CONSTANT_GLOW)
DarkZone.checkDarkArea(player) DarkZone.checkDarkArea(player)
} }
@@ -1,6 +1,7 @@
package rs09.game.system.command.sets package rs09.game.system.command.sets
import api.ContentAPI import api.ContentAPI
import api.InputType
import core.cache.def.impl.ItemDefinition import core.cache.def.impl.ItemDefinition
import core.cache.def.impl.NPCDefinition import core.cache.def.impl.NPCDefinition
import core.cache.def.impl.SceneryDefinition import core.cache.def.impl.SceneryDefinition
@@ -201,7 +202,7 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
if (player.attributes.containsKey("replyTo")) { if (player.attributes.containsKey("replyTo")) {
player.setAttribute("keepDialogueAlive", true) player.setAttribute("keepDialogueAlive", true)
val replyTo = player.getAttribute("replyTo", "").replace("_".toRegex(), " ") val replyTo = player.getAttribute("replyTo", "").replace("_".toRegex(), " ")
ContentAPI.sendInputDialogue(player, false ,StringUtils.formatDisplayName(replyTo)){value -> ContentAPI.sendInputDialogue(player, InputType.MESSAGE ,StringUtils.formatDisplayName(replyTo)){ value ->
CommunicationInfo.sendMessage(player, replyTo.toLowerCase(), value as String) CommunicationInfo.sendMessage(player, replyTo.toLowerCase(), value as String)
player.removeAttribute("keepDialogueAlive") player.removeAttribute("keepDialogueAlive")
} }
@@ -255,6 +255,7 @@ NPCConfigParser {
"aggressive", "aggressive",
"poisonous", "poisonous",
"poison_immune", "poison_immune",
"facing_booth",
"water_npc"-> configs.put(it.key.toString(), it.value.toString().toBoolean()) "water_npc"-> configs.put(it.key.toString(), it.value.toString().toBoolean())
else -> SystemLogger.logWarn("Unhandled key for npc config: ${it.key.toString()}") else -> SystemLogger.logWarn("Unhandled key for npc config: ${it.key.toString()}")
} }
@@ -31,6 +31,9 @@ class NPCSpawner {
npc.isWalks = tokens[3].trim { it <= ' ' } == "1" npc.isWalks = tokens[3].trim { it <= ' ' } == "1"
npc.direction = Direction.values()[Integer.valueOf(tokens[4].trim { it <= ' ' })] npc.direction = Direction.values()[Integer.valueOf(tokens[4].trim { it <= ' ' })]
npc.setAttribute("spawned:npc", true) npc.setAttribute("spawned:npc", true)
if(npc.definition.getConfiguration("facing_booth",false)){
npc.setAttribute("facing_booth",true)
}
npc.init() npc.init()
count++ count++
} }
@@ -25,7 +25,7 @@ import kotlin.collections.ArrayList
class MajorUpdateWorker { class MajorUpdateWorker {
var started = false var started = false
val sequence = UpdateSequence() val sequence = UpdateSequence()
val sdf = SimpleDateFormat("HH") val sdf = SimpleDateFormat("HHmm")
fun start() = GlobalScope.launch { fun start() = GlobalScope.launch {
started = true started = true
while(true){ while(true){