Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
+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;
|
||||
}
|
||||
|
||||
+51
-51
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-9
@@ -1,5 +1,6 @@
|
||||
package rs09.game.node.entity.skill.agility
|
||||
|
||||
import api.ContentAPI
|
||||
import core.cache.def.impl.ItemDefinition
|
||||
import core.cache.def.impl.NPCDefinition
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
@@ -61,14 +62,22 @@ class BarbarianOutpostCourse
|
||||
player.packetDispatch.sendMessage("You cannot climb from this side.")
|
||||
}
|
||||
val flag = if (node.location == Location(2536, 3553, 0)) 4 else if (node.location == Location(2539, 3553, 0)) 5 else 6
|
||||
player.packetDispatch.sendMessage("You climb the low wall...")
|
||||
ContentAPI.sendMessage(player, "You climb the low wall...")
|
||||
AgilityHandler.forceWalk(player, flag, node.location.transform(-1, 0, 0), node.location.transform(1, 0, 0), Animation.create(839), 10, 13.5, null)
|
||||
}
|
||||
455 -> player.barcrawlManager.read()
|
||||
385 -> {
|
||||
player.packetDispatch.sendMessage("The scorpion stings you!")
|
||||
ContentAPI.sendMessage(player, "The scorpion stings you!")
|
||||
player.impactHandler.manualHit(player, 3, HitsplatType.NORMAL)
|
||||
}
|
||||
386 -> {
|
||||
ContentAPI.sendMessage(player, "The scorpion stings you!")
|
||||
player.impactHandler.manualHit(player, 3, HitsplatType.NORMAL)
|
||||
}
|
||||
387 -> {
|
||||
ContentAPI.sendMessage(player, "The scorpion stings you!")
|
||||
player.impactHandler.manualHit(player, 3, HitsplatType.NORMAL)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -80,15 +89,15 @@ class BarbarianOutpostCourse
|
||||
*/
|
||||
private fun handleRopeSwing(player: Player, `object`: Scenery) {
|
||||
if (player.location.y < 3554) {
|
||||
player.packetDispatch.sendMessage("You cannot do that from here.")
|
||||
ContentAPI.sendMessage(player, "You cannot do that from here.")
|
||||
return
|
||||
}
|
||||
if (ropeDelay > GameWorld.ticks) {
|
||||
player.packetDispatch.sendMessage("The rope is being used.")
|
||||
ContentAPI.sendMessage(player, "The rope is being used.")
|
||||
return
|
||||
}
|
||||
if (AgilityHandler.hasFailed(player, 1, 0.1)) {
|
||||
AgilityHandler.fail(player, 0, Location.create(2549, 9951, 0), null, getHitAmount(player), "You slip and fall to the pit bellow.")
|
||||
AgilityHandler.fail(player, 0, Location.create(2549, 9951, 0), null, getHitAmount(player), "You slip and fall to the pit below.")
|
||||
return
|
||||
}
|
||||
ropeDelay = GameWorld.ticks + 2
|
||||
@@ -104,7 +113,7 @@ class BarbarianOutpostCourse
|
||||
private fun handleLogBalance(player: Player, `object`: Scenery) {
|
||||
val failed = AgilityHandler.hasFailed(player, 1, 0.5)
|
||||
val end = if (failed) Location.create(2545, 3546, 0) else Location.create(2541, 3546, 0)
|
||||
player.packetDispatch.sendMessage("You walk carefully across the slippery log...")
|
||||
ContentAPI.sendMessage(player, "You walk carefully across the slippery log...")
|
||||
AgilityHandler.walk(player, if (failed) -1 else 1, Location.create(2551, 3546, 0), end, Animation.create(155), if (failed) 0.0 else 13.5, if (failed) null else "...You make it safely to the other side.")
|
||||
if (failed) {
|
||||
AgilityHandler.walk(player, -1, player.location, Location.create(2545, 3546, 0), Animation.create(155), 0.0, null)
|
||||
@@ -152,9 +161,9 @@ class BarbarianOutpostCourse
|
||||
val failed = AgilityHandler.hasFailed(player, 1, 0.3)
|
||||
val end = if (failed) Location.create(2534, 3547, 1) else Location.create(2532, 3547, 1)
|
||||
AgilityHandler.walk(player, if (failed) -1 else 3, Location.create(2536, 3547, 1), end, Animation.create(157), if (failed) 0.0 else 22.0, if (failed) null else "You skillfully edge across the gap.")
|
||||
player.packetDispatch.sendMessage("You put your foot on the ledge and try to edge across..")
|
||||
ContentAPI.sendMessage(player, "You put your foot on the ledge and try to edge across..")
|
||||
if (failed) {
|
||||
AgilityHandler.fail(player, 3, Location.create(2534, 3545, 0), Animation(760), getHitAmount(player), "You slip and fall to the pit bellow.")
|
||||
AgilityHandler.fail(player, 3, Location.create(2534, 3545, 0), Animation(760), getHitAmount(player), "You slip and fall to the pit below.")
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -169,6 +178,8 @@ class BarbarianOutpostCourse
|
||||
SceneryDefinition.forId(1948).handlers["option:climb-over"] = this
|
||||
ItemDefinition.forId(455).handlers["option:read"] = this
|
||||
NPCDefinition.forId(385).handlers["option:pick-up"] = this
|
||||
NPCDefinition.forId(386).handlers["option:pick-up"] = this
|
||||
NPCDefinition.forId(387).handlers["option:pick-up"] = this
|
||||
PluginManager.definePlugin(BarbarianGuardDialogue())
|
||||
}
|
||||
|
||||
@@ -226,7 +237,7 @@ class BarbarianOutpostCourse
|
||||
}
|
||||
1 -> when (buttonId) {
|
||||
1 -> {
|
||||
player("I want to come throught his gate.")
|
||||
player("I want to come through this gate.")
|
||||
stage = 5
|
||||
}
|
||||
2 -> {
|
||||
|
||||
+10
-9
@@ -1,5 +1,6 @@
|
||||
package rs09.game.node.entity.skill.agility
|
||||
|
||||
import api.ContentAPI
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.node.Node
|
||||
import core.game.node.scenery.Scenery
|
||||
@@ -34,41 +35,41 @@ class GnomeStrongholdCourse
|
||||
when (`object`.id) {
|
||||
2295 -> {
|
||||
TRAINERS[0]!!.sendChat("Okay get over that log, quick quick!")
|
||||
player.packetDispatch.sendMessage("You walk carefully across the slippery log...")
|
||||
ContentAPI.sendMessage(player, "You walk carefully across the slippery log...")
|
||||
AgilityHandler.walk(player, 0, Location.create(2474, 3436, 0), Location.create(2474, 3429, 0), Animation.create(155), 7.5, "...You make it safely to the other side.")
|
||||
return true
|
||||
}
|
||||
2285 -> {
|
||||
TRAINERS[1]!!.sendChat("Move it, move it, move it!")
|
||||
player.packetDispatch.sendMessage("You climb the netting...")
|
||||
ContentAPI.sendMessage(player, "You climb the netting...")
|
||||
AgilityHandler.climb(player, 1, Animation.create(828), `object`.location.transform(0, -1, 1), 7.5, null)
|
||||
return true
|
||||
}
|
||||
35970 -> {
|
||||
TRAINERS[2]!!.sendChat("That's it - straight up.")
|
||||
player.packetDispatch.sendMessage("You climb the tree..")
|
||||
ContentAPI.sendMessage(player, "You climb the tree..")
|
||||
AgilityHandler.climb(player, 2, Animation.create(828), Location.create(2473, 3420, 2), 5.0, "...To the platform above.")
|
||||
return true
|
||||
}
|
||||
2312 -> {
|
||||
TRAINERS[3]!!.sendChat("Come on scaredy cat, get across that rope!")
|
||||
player.packetDispatch.sendMessage("You carefully cross the tightrope.")
|
||||
ContentAPI.sendMessage(player, "You carefully cross the tightrope.")
|
||||
AgilityHandler.walk(player, 3, Location.create(2477, 3420, 2), Location.create(2483, 3420, 2), Animation.create(155), 7.5, null)
|
||||
return true
|
||||
}
|
||||
4059 -> {
|
||||
player.packetDispatch.sendMessage("You can't do that from here.")
|
||||
ContentAPI.sendMessage(player, "You can't do that from here.")
|
||||
return true
|
||||
}
|
||||
2314, 2315 -> {
|
||||
player.packetDispatch.sendMessage("You climb down the tree..")
|
||||
ContentAPI.sendMessage(player, "You climb down the tree..")
|
||||
AgilityHandler.climb(player, 4, Animation.create(828), Location.create(2487, 3420, 0), 5.0, "You land on the ground.")
|
||||
return true
|
||||
}
|
||||
2286 -> {
|
||||
TRAINERS[4]!!.sendChat("My Granny can move faster than you.")
|
||||
player.faceLocation(player.location.transform(0, 2, 0))
|
||||
player.packetDispatch.sendMessage("You climb the netting...")
|
||||
ContentAPI.sendMessage(player, "You climb the netting...")
|
||||
AgilityHandler.climb(player, 5, Animation.create(828), player.location.transform(0, 2, 0), 7.5, null)
|
||||
return true
|
||||
}
|
||||
@@ -76,11 +77,11 @@ class GnomeStrongholdCourse
|
||||
val index = if (`object`.id == 154) 0 else 1 //If the player clicks on the left pipe, set index to 0, otherwise 1
|
||||
val x = 2484 + index * 3 //change the x coordinates for walking/animations depending on index multiplier
|
||||
if (`object`.location.y == 3435) {
|
||||
player.packetDispatch.sendMessage("You can't do that from here.")
|
||||
ContentAPI.sendMessage(player, "You can't do that from here.")
|
||||
return true
|
||||
}
|
||||
if (USED_PIPES[index] > GameWorld.ticks) {
|
||||
player.packetDispatch.sendMessage("The pipe is being used.")
|
||||
ContentAPI.sendMessage(player, "The pipe is being used.")
|
||||
return true
|
||||
}
|
||||
USED_PIPES[index] = GameWorld.ticks + 10
|
||||
|
||||
@@ -76,8 +76,8 @@ class WildernessCourse
|
||||
2 -> {
|
||||
val end = if (fail) Location.create(2998, 3924, 0) else if (`object`.id < 2309) Location.create(2998, 3917, 0) else Location.create(2998, 3930, 0)
|
||||
val start = if (`object`.id < 2309) player.location else Location.create(2998, 3917, 0)
|
||||
player.packetDispatch.sendMessage("You go through the gate and try to edge over the ridge...")
|
||||
AgilityHandler.walk(player, -1, start, end, Animation.create(155), if (fail) 0.0 else 15.00, if (fail) "You loose your footing and fail into the wolf pit." else "You skillfully balance across the ridge...")
|
||||
ContentAPI.sendMessage(player, "You go through the gate and try to edge over the ridge...")
|
||||
AgilityHandler.walk(player, -1, start, end, Animation.create(155), if (fail) 0.0 else 15.00, if (fail) "You lose your footing and fail into the wolf pit." else "You skillfully balance across the ridge...")
|
||||
}
|
||||
9 -> {
|
||||
if (fail) {
|
||||
@@ -104,7 +104,7 @@ class WildernessCourse
|
||||
*/
|
||||
private fun handlePipe(player: Player, `object`: Scenery) {
|
||||
if (`object`.location.y == 3948) {
|
||||
player.packetDispatch.sendMessage("You can't do that from here.")
|
||||
ContentAPI.sendMessage(player, "You can't do that from here.")
|
||||
return
|
||||
}
|
||||
if (player.skills.getLevel(Skills.AGILITY) < 49) {
|
||||
@@ -153,15 +153,15 @@ class WildernessCourse
|
||||
*/
|
||||
private fun handleRopeSwing(player: Player, `object`: Scenery) {
|
||||
if (player.location.y < 3554) {
|
||||
player.packetDispatch.sendMessage("You cannot do that from here.")
|
||||
ContentAPI.sendMessage(player, "You cannot do that from here.")
|
||||
return
|
||||
}
|
||||
if (ropeDelay > GameWorld.ticks) {
|
||||
player.packetDispatch.sendMessage("The rope is being used.")
|
||||
ContentAPI.sendMessage(player, "The rope is being used.")
|
||||
return
|
||||
}
|
||||
if (AgilityHandler.hasFailed(player, 1, 0.1)) {
|
||||
AgilityHandler.fail(player, 0, Location.create(3005, 10357, 0), null, getHitAmount(player), "You slip and fall to the pit bellow.")
|
||||
AgilityHandler.fail(player, 0, Location.create(3005, 10357, 0), null, getHitAmount(player), "You slip and fall to the pit below.")
|
||||
return
|
||||
}
|
||||
ropeDelay = GameWorld.ticks + 2
|
||||
@@ -206,7 +206,7 @@ class WildernessCourse
|
||||
private fun handleLogBalance(player: Player, `object`: Scenery) {
|
||||
val failed = AgilityHandler.hasFailed(player, 1, 0.5)
|
||||
val end = if (failed) Location.create(2998, 3945, 0) else Location.create(2994, 3945, 0)
|
||||
player.packetDispatch.sendMessage("You walk carefully across the slippery log...")
|
||||
ContentAPI.sendMessage(player, "You walk carefully across the slippery log...")
|
||||
AgilityHandler.walk(player, if (failed) -1 else 3, player.location, end, Animation.create(155), if (failed) 0.0 else 20.0, if (failed) null else "You skillfully edge across the gap.")
|
||||
if (failed) {
|
||||
GameWorld.Pulser.submit(object : Pulse(5, player) {
|
||||
|
||||
Reference in New Issue
Block a user