Add: JSON Monolith #1

This commit is contained in:
skelsoft
2021-10-13 02:05:56 +00:00
committed by Ceikry
parent c712cd50d7
commit f53dfc0fab
18 changed files with 2634 additions and 7233 deletions
@@ -1,306 +1,307 @@
package core.game.content.global;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.diary.DiaryType;
import core.game.node.item.Item;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
/**
* Represents an enchanted jewellery.
* @author Vexia
*/
public enum EnchantedJewellery {
RING_OF_SLAYING(new String[] { "Slayer Tower.", "Fremmenik Slayer Dungeon.", "Pollniveach Slayer Dungeon.", "Nowhere." }, new Location[] { Location.create(3429, 3533, 0), Location.create(2793, 3615, 0), Location.create(3313, 2960, 0) }, true, 13281, 13282, 13283, 13284, 13285, 13286, 13287, 13288),
RING_OF_DUELING(new String[] { "Al Kharid Duel Arena.", "Castle Wars Arena.", "Nowhere." }, new Location[] { Location.create(3314, 3235, 0), Location.create(2442, 3089, 0) }, true, 2552, 2554, 2556, 2558, 2560, 2562, 2564, 2566),
AMULET_OF_GLORY(new String[] { "Edgeville", "Karamja", "Draynor Village", "Al-Kharid", "Nowhere." }, new Location[] { Location.create(3087, 3495, 0), Location.create(2919, 3175, 0), Location.create(3104, 3249, 0), Location.create(3304, 3124, 0) }, 1712, 1710, 1708, 1706, 1704),
AMULET_OF_GLORY_T(new String[] { "Edgeville", "Karamja", "Draynor Village", "Al-Kharid", "Nowhere." }, new Location[] { Location.create(3087, 3495, 0), Location.create(2919, 3175, 0), Location.create(3081, 3250, 0), Location.create(3304, 3124, 0) }, 10354, 10356, 10358, 10360, 10362),
GAMES_NECKLACE(new String[] { "Burthorpe", "Barbarian Assault", "Clan Wars", "Bounty Hunter", "Corporeal Beast" }, new Location[] { Location.create(2899, 3563, 0), Location.create(2520, 3571, 0), Location.create(3266, 3686, 0), Location.create(3179, 3685, 0), Location.create(2885, 4372, 2) }, true, 3853, 3855, 3857, 3859, 3861, 3863, 3865, 3867),
DIGSITE_PENDANT(new String[] {}, new Location[] { Location.create(3342, 3445, 0) }, true, 11194, 11193, 11192, 11191, 11190),
COMBAT_BRACELET(new String[] { "Champions' Guild", "Monastery", "Ranging Guild", "Warriors' Guild", "Nowhere." }, new Location[] { Location.create(3191, 3365, 0), Location.create(3052, 3472, 0), Location.create(2657, 3439, 0), Location.create(2878, 3546, 0) }, 11118, 11120, 11122, 11124, 11126),
SKILLS_NECKLACE(new String[] { "Fishing Guild", "Mining Guild", "Crafting Guild", "Cooking Guild", "Nowhere." }, new Location[] { Location.create(2611, 3392, 0), Location.create(3016, 3338, 0), Location.create(2933, 3290, 0), Location.create(3143, 3442, 0) }, 11105, 11107, 11109, 11111, 11113),
RING_OF_WEALTH(new String[] {"Grand Exchange","Nowhere."}, new Location[] {Location.create(3163, 3464, 0)},14646,14644,14642,14640,14638);
/**
* Represents the teleport animation.
*/
private static final Animation ANIMATION = new Animation(714);
/**
* Represents the graphics to use.
*/
private static final Graphics GRAPHICS = new Graphics(308, 100, 50);
/**
* Represents the charge numbers.
*/
private static final char[] NUMBERS = new char[] { '1', '2', '3', '4', '5', '6', '7', '8' };
/**
* Represents the teleport options.
*/
private final String[] options;
/**
* Represents the locations.
*/
private final Location[] locations;
/**
* Represents the ids of the jewellery.
*/
private final int[] ids;
/**
* Represents if it crumbles away into nothing.
*/
private final boolean crumble;
/**
* Constructs a new {@code EnchantedJewelleryPlugin} {@code Object}.
* @param options the options.
* @param locations the locations.
* @parma crumble if it crumbles.
* @param ids the ids.
*/
EnchantedJewellery(final String[] options, final Location[] locations, final boolean crumble, final int... ids) {
this.options = options;
this.locations = locations;
this.ids = ids;
this.crumble = crumble;
}
/**
* Constructs a new {@code EnchantedJewelleryPlugin} {@code Object}.
* @param options the options.
* @param locations the locations.
* @param ids the ids.
*/
EnchantedJewellery(final String[] options, final Location[] locations, final int... ids) {
this(options, locations, false, ids);
}
/**
* Method used to teleport the player to the desired location.
* @param player the player.
* @param item the item.
* @param index the index.
* @param operate If the player is operating.
*/
public void use(final Player player, final Item item, final int index, boolean operate) {
if ((index + 1) == getIds().length || item.getSlot() < 0) {
return;
}
if (index > getLocations().length - 1) {
return;
}
int itemIndex = getItemIndex(item);
Item replace = item;
if (!isLast(itemIndex)) {
if (!(isCrumble() && itemIndex == getIds().length - 1)) {
replace = getReplace(getNext(itemIndex));
}
} else {
if (!isCrumble()) {
replace = getReplace(getIds()[getIds().length - 1]);
}
}
if (index > getLocations().length - 1) {
return;
}
if (!operate && !player.getInventory().containsItem(item)) {
player.sendMessage("Ooops, you don't have it anymore ;)");
return;
} else if (operate && !player.getEquipment().containsItem(item)) {
player.sendMessage("Ooops, you don't have it anymore ;)");
return;
}
if (teleport(player, itemIndex, replace, getLocation(index))) {
if (!isLast(itemIndex) && !(isCrumble() && itemIndex == getIds().length - 1)) {
if (operate) {
player.getEquipment().replace(replace, item.getSlot());
} else {
player.getInventory().replace(replace, item.getSlot());
}
} else {
if (isCrumble()) {
if (operate) {
player.getEquipment().replace(null, item.getSlot());
} else {
if(item.getName().contains("slaying")){
player.getInventory().replace(new Item(4155, 1), item.getSlot());
player.sendMessage("Your Ring of Slaying reverts back into a regular enchanted gem.");
} else {
player.getInventory().replace(null, item.getSlot());
}
}
}
}
if (getLocation(index).withinDistance(new Location(2657,3439,0))) {
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE,2,0);
}
}
}
/**
* Method used to teleport to a location.
* @param player the player.
* @param itemIndex the old item index.
* @param item the item.
* @param location the location.
*/
private boolean teleport(final Player player, final int itemIndex, final Item item, final Location location) {
if (player.isTeleBlocked()) {
player.sendMessage("A magical force has stopped you from teleporting.");
return false;
}
if (!player.getZoneMonitor().teleport(1, item)) {
return false;
}
player.lock();
player.visualize(ANIMATION, GRAPHICS);
player.getImpactHandler().setDisabledTicks(4);
GameWorld.getPulser().submit(new Pulse(4, player) {
@Override
public boolean pulse() {
player.unlock();
player.getProperties().setTeleportLocation(location);
player.getAnimator().reset();
return true;
}
});
return true;
}
/**
* Gets the charges of an item.
* @param item the item.
* @return the charges.
*/
public static String getCharges(Item item) {
String[] tokens = item.getName().replace("(t", "(").replace("(", " ").replace(")", "").split(" ");
return tokens[tokens.length - 1];
}
/**
* Gets the replacement item.
* @param id the id.
* @return the item.
*/
public Item getReplace(int id) {
return new Item(id);
}
/**
* Gets the name.
* @param item the item.
* @return the name.
*/
public String getName(Item item) {
String name = item.getName().toLowerCase().replace("(t", "(").replace("(", "").replace(")", "");
for (char number : NUMBERS) {
name = name.replace(number, '/');
}
return name.trim().replace("/", "");
}
/**
* Gets the name type.
* @param item the item.
* @return
*/
public String getNameType(Item item) {
return this == GAMES_NECKLACE ? "games necklace" : this == DIGSITE_PENDANT ? "necklace" : this == COMBAT_BRACELET ? "bracelet" : this == SKILLS_NECKLACE ? "necklace" : item.getName().toLowerCase().split(" ")[0];
}
/**
* Checks if the index is last.
* @param index the index.
* @return {@code True} if so.
*/
public boolean isLast(int index) {
return !isCrumble() ? index == (ids.length - 1) : index == ids.length;
}
/**
* Gets the next index.
* @param index the index.
* @return the new id
*/
public int getNext(int index) {
return ids[index + 1];
}
/**
* Gets the location.
* @param index the index.
* @return the location.
*/
public Location getLocation(int index) {
if (index > locations.length) {
index = locations.length - 1;
}
return locations[index];
}
/**
* Gets the options.
* @return The options.
*/
public String[] getOptions() {
return options;
}
/**
* Gets the locations.
* @return The locations.
*/
public Location[] getLocations() {
return locations;
}
/**
* Gets the ids.
* @return The ids.
*/
public int[] getIds() {
return ids;
}
public boolean isCrumble() {
return crumble;
}
/**
* Gets the enchanted jewellery.
* @param item the item.
* @return {@code EnchantedJewellery}.
*/
public static EnchantedJewellery forItem(final Item item) {
for (EnchantedJewellery jewellery : values()) {
for (int i : jewellery.getIds()) {
if (i == item.getId()) {
return jewellery;
}
}
}
return null;
}
/**
* Gets the index.
* @param item the item.
* @return the item index.
*/
public int getItemIndex(Item item) {
for (int i = 0; i < getIds().length; i++) {
if (getIds()[i] == item.getId()) {
return i;
}
}
return -1;
}
package core.game.content.global;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.diary.DiaryType;
import core.game.node.item.Item;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
/**
* Represents an enchanted jewellery.
* @author Vexia
*/
public enum EnchantedJewellery {
RING_OF_SLAYING(new String[] { "Slayer Tower.", "Fremmenik Slayer Dungeon.", "Pollniveach Slayer Dungeon.", "Nowhere." }, new Location[] { Location.create(3429, 3533, 0), Location.create(2793, 3615, 0), Location.create(3313, 2960, 0) }, true, 13281, 13282, 13283, 13284, 13285, 13286, 13287, 13288),
RING_OF_DUELING(new String[] { "Al Kharid Duel Arena.", "Castle Wars Arena.", "Nowhere." }, new Location[] { Location.create(3314, 3235, 0), Location.create(2442, 3089, 0) }, true, 2552, 2554, 2556, 2558, 2560, 2562, 2564, 2566),
AMULET_OF_GLORY(new String[] { "Edgeville", "Karamja", "Draynor Village", "Al-Kharid", "Nowhere." }, new Location[] { Location.create(3087, 3495, 0), Location.create(2919, 3175, 0), Location.create(3104, 3249, 0), Location.create(3304, 3124, 0) }, 1712, 1710, 1708, 1706, 1704),
AMULET_OF_GLORY_T(new String[] { "Edgeville", "Karamja", "Draynor Village", "Al-Kharid", "Nowhere." }, new Location[] { Location.create(3087, 3495, 0), Location.create(2919, 3175, 0), Location.create(3081, 3250, 0), Location.create(3304, 3124, 0) }, 10354, 10356, 10358, 10360, 10362),
GAMES_NECKLACE(new String[] { "Burthorpe", "Barbarian Assault", "Clan Wars", "Bounty Hunter", "Corporeal Beast" }, new Location[] { Location.create(2899, 3563, 0), Location.create(2520, 3571, 0), Location.create(3266, 3686, 0), Location.create(3179, 3685, 0), Location.create(2885, 4372, 2) }, true, 3853, 3855, 3857, 3859, 3861, 3863, 3865, 3867),
DIGSITE_PENDANT(new String[] {}, new Location[] { Location.create(3342, 3445, 0) }, true, 11194, 11193, 11192, 11191, 11190),
COMBAT_BRACELET(new String[] { "Champions' Guild", "Monastery", "Ranging Guild", "Warriors' Guild", "Nowhere." }, new Location[] { Location.create(3191, 3365, 0), Location.create(3052, 3472, 0), Location.create(2657, 3439, 0), Location.create(2878, 3546, 0) }, 11118, 11120, 11122, 11124, 11126),
SKILLS_NECKLACE(new String[] { "Fishing Guild", "Mining Guild", "Crafting Guild", "Cooking Guild", "Nowhere." }, new Location[] { Location.create(2611, 3392, 0), Location.create(3016, 3338, 0), Location.create(2933, 3290, 0), Location.create(3143, 3442, 0) }, 11105, 11107, 11109, 11111, 11113),
RING_OF_WEALTH(new String[] {"Grand Exchange","Nowhere."}, new Location[] {Location.create(3163, 3464, 0)},14646,14644,14642,14640,14638);
/**
* Represents the teleport animation.
*/
private static final Animation ANIMATION = new Animation(714);
/**
* Represents the graphics to use.
*/
private static final Graphics GRAPHICS = new Graphics(308, 100, 50);
/**
* Represents the charge numbers.
*/
private static final char[] NUMBERS = new char[] { '1', '2', '3', '4', '5', '6', '7', '8' };
/**
* Represents the teleport options.
*/
private final String[] options;
/**
* Represents the locations.
*/
private final Location[] locations;
/**
* Represents the ids of the jewellery.
*/
private final int[] ids;
/**
* Represents if it crumbles away into nothing.
*/
private final boolean crumble;
/**
* Constructs a new {@code EnchantedJewelleryPlugin} {@code Object}.
* @param options the options.
* @param locations the locations.
* @parma crumble if it crumbles.
* @param ids the ids.
*/
EnchantedJewellery(final String[] options, final Location[] locations, final boolean crumble, final int... ids) {
this.options = options;
this.locations = locations;
this.ids = ids;
this.crumble = crumble;
}
/**
* Constructs a new {@code EnchantedJewelleryPlugin} {@code Object}.
* @param options the options.
* @param locations the locations.
* @param ids the ids.
*/
EnchantedJewellery(final String[] options, final Location[] locations, final int... ids) {
this(options, locations, false, ids);
}
/**
* Method used to teleport the player to the desired location.
* @param player the player.
* @param item the item.
* @param index the index.
* @param operate If the player is operating.
*/
public void use(final Player player, final Item item, final int index, boolean operate) {
if ((index + 1) == getIds().length || item.getSlot() < 0) {
return;
}
if (index > getLocations().length - 1) {
return;
}
int itemIndex = getItemIndex(item);
Item replace = item;
if (!isLast(itemIndex)) {
if (!(isCrumble() && itemIndex == getIds().length - 1)) {
replace = getReplace(getNext(itemIndex));
}
} else {
if (!isCrumble()) {
replace = getReplace(getIds()[getIds().length - 1]);
}
}
if (index > getLocations().length - 1) {
return;
}
if (!operate && !player.getInventory().containsItem(item)) {
player.sendMessage("Ooops, you don't have it anymore ;)");
return;
} else if (operate && !player.getEquipment().containsItem(item)) {
player.sendMessage("Ooops, you don't have it anymore ;)");
return;
}
if (teleport(player, itemIndex, replace, getLocation(index))) {
if (!isLast(itemIndex) && !(isCrumble() && itemIndex == getIds().length - 1)) {
if (operate) {
player.getEquipment().replace(replace, item.getSlot());
} else {
player.getInventory().replace(replace, item.getSlot());
}
} else {
if (isCrumble()) {
if (operate) {
player.getEquipment().replace(null, item.getSlot());
} else {
if(item.getName().contains("slaying")){
player.getInventory().replace(new Item(4155, 1), item.getSlot());
player.sendMessage("Your Ring of Slaying reverts back into a regular enchanted gem.");
} else {
player.getInventory().replace(null, item.getSlot());
}
}
}
}
if (getLocation(index).withinDistance(new Location(2657,3439,0))) {
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE,2,0);
}
}
}
/**
* Method used to teleport to a location.
* @param player the player.
* @param itemIndex the old item index.
* @param item the item.
* @param location the location.
*/
private boolean teleport(final Player player, final int itemIndex, final Item item, final Location location) {
if (player.isTeleBlocked()) {
player.sendMessage("A magical force has stopped you from teleporting.");
return false;
}
if (!player.getZoneMonitor().teleport(1, item)) {
return false;
}
player.lock();
player.visualize(ANIMATION, GRAPHICS);
player.getAudioManager().send(200);
player.getImpactHandler().setDisabledTicks(4);
GameWorld.getPulser().submit(new Pulse(4, player) {
@Override
public boolean pulse() {
player.unlock();
player.getProperties().setTeleportLocation(location);
player.getAnimator().reset();
return true;
}
});
return true;
}
/**
* Gets the charges of an item.
* @param item the item.
* @return the charges.
*/
public static String getCharges(Item item) {
String[] tokens = item.getName().replace("(t", "(").replace("(", " ").replace(")", "").split(" ");
return tokens[tokens.length - 1];
}
/**
* Gets the replacement item.
* @param id the id.
* @return the item.
*/
public Item getReplace(int id) {
return new Item(id);
}
/**
* Gets the name.
* @param item the item.
* @return the name.
*/
public String getName(Item item) {
String name = item.getName().toLowerCase().replace("(t", "(").replace("(", "").replace(")", "");
for (char number : NUMBERS) {
name = name.replace(number, '/');
}
return name.trim().replace("/", "");
}
/**
* Gets the name type.
* @param item the item.
* @return
*/
public String getNameType(Item item) {
return this == GAMES_NECKLACE ? "games necklace" : this == DIGSITE_PENDANT ? "necklace" : this == COMBAT_BRACELET ? "bracelet" : this == SKILLS_NECKLACE ? "necklace" : item.getName().toLowerCase().split(" ")[0];
}
/**
* Checks if the index is last.
* @param index the index.
* @return {@code True} if so.
*/
public boolean isLast(int index) {
return !isCrumble() ? index == (ids.length - 1) : index == ids.length;
}
/**
* Gets the next index.
* @param index the index.
* @return the new id
*/
public int getNext(int index) {
return ids[index + 1];
}
/**
* Gets the location.
* @param index the index.
* @return the location.
*/
public Location getLocation(int index) {
if (index > locations.length) {
index = locations.length - 1;
}
return locations[index];
}
/**
* Gets the options.
* @return The options.
*/
public String[] getOptions() {
return options;
}
/**
* Gets the locations.
* @return The locations.
*/
public Location[] getLocations() {
return locations;
}
/**
* Gets the ids.
* @return The ids.
*/
public int[] getIds() {
return ids;
}
public boolean isCrumble() {
return crumble;
}
/**
* Gets the enchanted jewellery.
* @param item the item.
* @return {@code EnchantedJewellery}.
*/
public static EnchantedJewellery forItem(final Item item) {
for (EnchantedJewellery jewellery : values()) {
for (int i : jewellery.getIds()) {
if (i == item.getId()) {
return jewellery;
}
}
}
return null;
}
/**
* Gets the index.
* @param item the item.
* @return the item index.
*/
public int getItemIndex(Item item) {
for (int i = 0; i < getIds().length; i++) {
if (getIds()[i] == item.getId()) {
return i;
}
}
return -1;
}
}
@@ -125,6 +125,7 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
player.getInventory().replace(new Item(4252), item.getSlot());
player.sendMessage("...and the world changes around you.", 4);
player.getTeleporter().send(Location.create(3658, 3517, 0), TeleportType.ECTOPHIAL);
player.getAudioManager().send(4580);
player.sendMessage("You empty the ectoplasm onto the ground around your feet...");
player.getPulseManager().run(new Pulse(9, player) {
@Override
@@ -1,5 +1,6 @@
package core.game.content.zone.phasmatys;
import api.ContentAPI;
import core.game.content.global.Bones;
import core.game.content.global.action.ClimbActionHandler;
import core.game.interaction.Option;
@@ -75,16 +76,16 @@ public final class PhasmatysZone extends MapZone implements Plugin<Object> {
return true;
case 5267:
player.animate(Animation.create(536));
player.getPacketDispatch().sendMessage("The trapdoor opens...");
ContentAPI.sendMessage(player, "The trapdoor opens...");
SceneryBuilder.replace((Scenery) target, ((Scenery) target).transform(5268));
return true;
case 5268:
if (option.getName().equals("Close")) {
player.animate(Animation.create(535));
player.getPacketDispatch().sendMessage("You close the trapdoor.");
ContentAPI.sendMessage(player, "You close the trapdoor.");
SceneryBuilder.replace((Scenery) target, ((Scenery) target).transform(5267));
} else {
player.getPacketDispatch().sendMessage("You climb down through the trapdoor...");
ContentAPI.sendMessage(player, "You climb down through the trapdoor...");
player.getProperties().setTeleportLocation(Location.create(3669, 9888, 3));
}
return true;
@@ -1,5 +1,6 @@
package core.game.interaction.city;
import api.ContentAPI;
import core.cache.def.impl.SceneryDefinition;
import core.game.content.global.action.ClimbActionHandler;
import core.game.interaction.OptionHandler;
@@ -8,11 +9,12 @@ import core.game.node.entity.player.Player;
import core.game.node.scenery.Scenery;
import core.game.node.scenery.SceneryBuilder;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to handle edgeville related interactions.
* Represents the plugin used to handle Edgeville related interactions.
*
* @author 'Vexia
* @version 1.0
@@ -31,6 +33,7 @@ public final class EdgevilleNodePlugin extends OptionHandler {
SceneryDefinition.forId(26933).getHandlers().put("option:open", this);
SceneryDefinition.forId(26934).getHandlers().put("option:close", this);
SceneryDefinition.forId(26934).getHandlers().put("option:climb-down", this);
return this;
}
@@ -41,7 +44,7 @@ public final class EdgevilleNodePlugin extends OptionHandler {
case 9262:
case 9261:
case 30806:
player.getPacketDispatch().sendMessage("There doesn't seem to be any seeds on this rosebush.");
ContentAPI.sendMessage(player, "There doesn't seem to be any seeds on this rosebush.");
break;
case 12265:
ClimbActionHandler.climb(player, null, Location.create(3078, 3493, 0));
@@ -53,14 +56,21 @@ public final class EdgevilleNodePlugin extends OptionHandler {
player.getConfigManager().set(680, 0);
}
break;
case 26933: // Trapdoors at edgeville dungeon entrance
case 26933: // Edgeville Dungeon trapdoor (when closed)
if (option.equalsIgnoreCase("open")) {
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(26934), 500);
player.animate(Animation.create(536));
ContentAPI.sendMessage(player, "The trapdoor opens...");
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(26934), 500);
}
break;
case 26934: // Trapdoors at edgeville dungeon entrance
case 26934: // Edgeville Dungeon trapdoor (when open)
if (option.equalsIgnoreCase("close")) {
player.animate(Animation.create(535));
ContentAPI.sendMessage(player, "You close the trapdoor.");
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(26933));
} else if (option.equalsIgnoreCase("climb-down")) {
ContentAPI.sendMessage(player, "You climb down through the trapdoor...");
ClimbActionHandler.climbLadder(player, (Scenery) node, option);
}
}
return true;
@@ -244,14 +244,14 @@ public final class TrollheimPlugin extends OptionHandler {
case "climb-up":
switch (id) {
case 18834:
ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_UP, new Location(2828, 3678), "You climb up the ladder to the surface.");
ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_UP, new Location(2828, 3678), "You clamber onto the windswept roof of the Troll Stronghold.");
break;
}
break;
case "climb-down":
switch (id) {
case 18833:
ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_DOWN, new Location(2831, 10076, 2), "You climb down the ladder.");
ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_DOWN, new Location(2831, 10076, 2), "You clamber back inside the Troll Stronghold.");
break;
}
break;
@@ -741,7 +741,7 @@ public final class TrollheimPlugin extends OptionHandler {
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
npc("Hello traveller. What can I do for you?");
npc("Hello traveler. What can I do for you?");
stage = 1;
break;
case 1:
@@ -794,7 +794,7 @@ public final class TrollheimPlugin extends OptionHandler {
break;
case 13:
if (!player.getInventory().hasSpaceFor(CLIMBING_BOOTS)) {
player("I don't have enough space in my backback right", "this second.");
player("I don't have enough space in my backpack right", "this second.");
stage = 50;
return true;
}
@@ -1,51 +1,51 @@
package core.game.interaction.item.withobject;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Fills an ectophial.
* @author Vexia
*/
@Initializable
public class EctophialFillPlugin extends UseWithHandler {
/**
* Constructs a new {@code EctophialFillPlugin} {@code Object}
*/
public EctophialFillPlugin() {
super(4252);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(5282, OBJECT_TYPE, this);
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
player.lock(3);
player.animate(Animation.create(1652));
GameWorld.getPulser().submit(new Pulse(3, player) {
@Override
public boolean pulse() {
if (player.getInventory().remove(new Item(4252))) {
player.getInventory().add(new Item(4251));
}
player.sendMessage("You refill the ectophial.");
return true;
}
});
return true;
}
}
package core.game.interaction.item.withobject;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Fills an ectophial.
* @author Vexia
*/
@Initializable
public class EctophialFillPlugin extends UseWithHandler {
/**
* Constructs a new {@code EctophialFillPlugin} {@code Object}
*/
public EctophialFillPlugin() {
super(4252);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(5282, OBJECT_TYPE, this);
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
player.lock(3);
player.animate(Animation.create(1652));
GameWorld.getPulser().submit(new Pulse(3, player) {
@Override
public boolean pulse() {
if (player.getInventory().remove(new Item(4252))) {
player.getInventory().add(new Item(4251));
}
player.sendMessage("You refill the ectophial from the Ectofuntus.");
return true;
}
});
return true;
}
}
@@ -78,6 +78,7 @@ public class MountedGloryPlugin extends OptionHandler {
}
player.lock();
player.visualize(ANIMATION, GRAPHICS);
player.getAudioManager().send(200);
player.getImpactHandler().setDisabledTicks(4);
GameWorld.getPulser().submit(new Pulse(4, player) {
@Override
@@ -1,139 +1,139 @@
package core.game.node.entity.skill.herblore;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.tools.StringUtils;
/**
* Represents the skill pulse used to handle the creating of potions.
* @author 'Vexia
*/
public final class HerblorePulse extends SkillPulse<Item> {
/**
* Represents the vial of water item.
*/
public static final Item VIAL_OF_WATER = new Item(227);
/**
* Represents the coonut milk item.
*/
public static final Item COCONUT_MILK = new Item(5935);
/**
* Represents the animation to use when making a potion.
*/
private static final Animation ANIMATION = new Animation(363);
/**
* Represents the generic potion.
*/
private final GenericPotion potion;
/**
* Represents the amount to make.
*/
private int amount;
/**
* Represents the initial amount to make.
*/
private int initialAmount;
/**
* Represents the cycles.
*/
private int cycles;
/**
* Constructs a new {@code HerblorePulse} {@code Object}.
* @param player the player.
* @param node the node.
*/
public HerblorePulse(final Player player, final Item node, final int amount, final GenericPotion potion) {
super(player, node);
this.amount = amount;
this.initialAmount = amount;
this.potion = potion;
}
@Override
public boolean checkRequirements() {
if (!player.getQuestRepository().isComplete("Druidic Ritual")) {
player.getPacketDispatch().sendMessage("You must complete the Druidic Ritual quest before you can use Herblore.");
return false;
}
if (player.getSkills().getLevel(Skills.HERBLORE) < potion.getLevel()) {
player.getPacketDispatch().sendMessage("You need a Herblore level of at least " + potion.getLevel() + " in order to do this.");
return false;
}
if (!player.getInventory().containsItem(potion.getBase()) || !player.getInventory().containsItem(potion.getIngredient())) {
return false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
if (potion.getBase().getId() == VIAL_OF_WATER.getId()) {
if (initialAmount == 1 && getDelay() == 1) {
player.animate(ANIMATION);
setDelay(3);
return false;
}
handleUnfinished();
} else {
if (initialAmount == 1 && getDelay() == 1) {
player.animate(ANIMATION);
setDelay(3);
return false;
}
if (getDelay() == 1) {
setDelay(3);
player.animate(ANIMATION);
return false;
}
handleFinished();
}
amount--;
return amount == 0;
}
/**
* Method used to handle the potion making of an unf-potion.
*/
public void handleUnfinished() {
if (cycles == 0) {
player.animate(ANIMATION);
}
if ((player.getInventory().containsItem(potion.getBase()) && player.getInventory().containsItem(potion.getIngredient())) && player.getInventory().remove(potion.getBase(), potion.getIngredient())) {
final Item item = potion.getProduct();
player.getInventory().add(item);
player.getPacketDispatch().sendMessage("You put the" + StringUtils.formatDisplayName(potion.getIngredient().getName().replace("Clean", "")) + " Leaf into the vial of water.");
if (cycles++ == 3) {
player.animate(ANIMATION);
cycles = 0;
}
}
}
/**
* Method used to handle the finished potion making.
*/
public void handleFinished() {
if ((player.getInventory().containsItem(potion.getBase()) && player.getInventory().containsItem(potion.getIngredient())) && player.getInventory().remove(potion.getBase(), potion.getIngredient())) {
final Item item = potion.getProduct();
player.getInventory().add(item);
player.getSkills().addExperience(Skills.HERBLORE, potion.getExperience(), true);
player.getPacketDispatch().sendMessage("You mix the " + potion.getIngredient().getName().toLowerCase() + " into your potion.");
player.animate(ANIMATION);
}
}
}
package core.game.node.entity.skill.herblore;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.tools.StringUtils;
/**
* Represents the skill pulse used to handle the creating of potions.
* @author 'Vexia
*/
public final class HerblorePulse extends SkillPulse<Item> {
/**
* Represents the vial of water item.
*/
public static final Item VIAL_OF_WATER = new Item(227);
/**
* Represents the coonut milk item.
*/
public static final Item COCONUT_MILK = new Item(5935);
/**
* Represents the animation to use when making a potion.
*/
private static final Animation ANIMATION = new Animation(363);
/**
* Represents the generic potion.
*/
private final GenericPotion potion;
/**
* Represents the amount to make.
*/
private int amount;
/**
* Represents the initial amount to make.
*/
private int initialAmount;
/**
* Represents the cycles.
*/
private int cycles;
/**
* Constructs a new {@code HerblorePulse} {@code Object}.
* @param player the player.
* @param node the node.
*/
public HerblorePulse(final Player player, final Item node, final int amount, final GenericPotion potion) {
super(player, node);
this.amount = amount;
this.initialAmount = amount;
this.potion = potion;
}
@Override
public boolean checkRequirements() {
if (!player.getQuestRepository().isComplete("Druidic Ritual")) {
player.getPacketDispatch().sendMessage("You must complete the Druidic Ritual quest before you can use Herblore.");
return false;
}
if (player.getSkills().getLevel(Skills.HERBLORE) < potion.getLevel()) {
player.getPacketDispatch().sendMessage("You need a Herblore level of at least " + potion.getLevel() + " in order to do this.");
return false;
}
if (!player.getInventory().containsItem(potion.getBase()) || !player.getInventory().containsItem(potion.getIngredient())) {
return false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
if (potion.getBase().getId() == VIAL_OF_WATER.getId()) {
if (initialAmount == 1 && getDelay() == 1) {
player.animate(ANIMATION);
setDelay(3);
return false;
}
handleUnfinished();
} else {
if (initialAmount == 1 && getDelay() == 1) {
player.animate(ANIMATION);
setDelay(3);
return false;
}
if (getDelay() == 1) {
setDelay(3);
player.animate(ANIMATION);
return false;
}
handleFinished();
}
amount--;
return amount == 0;
}
/**
* Method used to handle the potion making of an unf-potion.
*/
public void handleUnfinished() {
if (cycles == 0) {
player.animate(ANIMATION);
}
if ((player.getInventory().containsItem(potion.getBase()) && player.getInventory().containsItem(potion.getIngredient())) && player.getInventory().remove(potion.getBase(), potion.getIngredient())) {
final Item item = potion.getProduct();
player.getInventory().add(item);
player.getPacketDispatch().sendMessage("You put the" + StringUtils.formatDisplayName(potion.getIngredient().getName().toLowerCase().replace("clean", "")) + " leaf into the vial of water.");
if (cycles++ == 3) {
player.animate(ANIMATION);
cycles = 0;
}
}
}
/**
* Method used to handle the finished potion making.
*/
public void handleFinished() {
if ((player.getInventory().containsItem(potion.getBase()) && player.getInventory().containsItem(potion.getIngredient())) && player.getInventory().remove(potion.getBase(), potion.getIngredient())) {
final Item item = potion.getProduct();
player.getInventory().add(item);
player.getSkills().addExperience(Skills.HERBLORE, potion.getExperience(), true);
player.getPacketDispatch().sendMessage("You mix the " + potion.getIngredient().getName().toLowerCase() + " into your potion.");
player.animate(ANIMATION);
}
}
}