Repository reorganisation
Unified kotlin and java into just src/main Unified the rs09 and core packages Took all content out of the core package, and placed it into the new content package Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
package content.global.skill.prayer;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the bone bury option plugin.
|
||||
* @author Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public final class BoneBuryingOptionPlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* Represents the animation to use.
|
||||
*/
|
||||
private static final Animation ANIMATION = new Animation(827);
|
||||
|
||||
/**
|
||||
* Represents the sound to use.
|
||||
*/
|
||||
private static final Audio SOUND = new Audio(2738, 10, 1);
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Node node, String option) {
|
||||
if (player.getAttribute("delay:bury", -1) > GameWorld.getTicks()) {
|
||||
return true;
|
||||
}
|
||||
player.setAttribute("delay:bury", GameWorld.getTicks() + 2);
|
||||
final Item item = (Item) node;
|
||||
Bones bone = Bones.forId(item.getId());
|
||||
if (bone == null) {
|
||||
bone = Bones.BONES;
|
||||
}
|
||||
if (item.getSlot() < 0) {
|
||||
return false;
|
||||
}
|
||||
boolean remove = true;
|
||||
if (!remove) {
|
||||
player.sendMessage("The gods intervene and you keep your bones!");
|
||||
}
|
||||
if (remove) {
|
||||
if (player.getInventory().replace(null, item.getSlot()) != item) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
player.lock(2);
|
||||
player.animate(ANIMATION);
|
||||
player.getPacketDispatch().sendMessage("You dig a hole in the ground...");
|
||||
player.getAudioManager().send(SOUND);
|
||||
final Bones bonee = bone;
|
||||
GameWorld.getPulser().submit(new Pulse(2, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
player.getPacketDispatch().sendMessage("You bury the bones.");
|
||||
player.getSkills().addExperience(Skills.PRAYER, bonee.equals(Bones.LAVA_DRAGON_BONES) && player.getLocation().getY() >= 3794 && player.getLocation().getY() <= 3859 ? bonee.getExperience() * 3 : bonee.getExperience(), true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalk() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.setOptionHandler("bury", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package content.global.skill.prayer
|
||||
|
||||
import core.game.node.item.Item
|
||||
import java.util.ArrayList
|
||||
import java.util.HashMap
|
||||
|
||||
/**
|
||||
* Represents the type of bones.
|
||||
* @author Apache Ah64
|
||||
*/
|
||||
enum class Bones
|
||||
/**
|
||||
* Construct a new `Bones` `Object`.
|
||||
* @param itemId The item id.
|
||||
* @param experience The experience given by burying the bone.
|
||||
*/(
|
||||
/**
|
||||
* The bone item id.
|
||||
*/
|
||||
val itemId: Int,
|
||||
/**
|
||||
* The experience given by burying the bone.
|
||||
*/
|
||||
val experience: Double) {
|
||||
BONES(2530, 4.5),
|
||||
BONES_2(526, 4.5),
|
||||
WOLF_BONES(2859, 4.5),
|
||||
BURNT_BONES(528, 4.5),
|
||||
MONKEY_BONES(3183, 5.0),
|
||||
MONKEY_BONES2(3179, 5.0),
|
||||
BAT_BONES(530, 5.3),
|
||||
BIG_BONES(532, 15.0),
|
||||
JOGRE_BONES(3125, 15.0),
|
||||
ZOGRE_BONES(4812, 12.5),
|
||||
SHAIKAHAN_BONES(3123, 25.0),
|
||||
BABY_DRAGON_BONES(534, 30.0),
|
||||
WYVERN_BONES(6812, 50.0),
|
||||
DRAGON_BONES(536, 72.0),
|
||||
FAYRG(4830, 84.0),
|
||||
RAURG_BONES(4832, 96.0),
|
||||
DAGANNOTH(6729, 125.0),
|
||||
OURG_BONES(4834, 140.0),
|
||||
LAVA_DRAGON_BONES(14693, 85.0);
|
||||
/**
|
||||
* Get the bone experience given when you bury the bone.
|
||||
* @return The experience.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets the bone meal item.
|
||||
* @return the item.
|
||||
*/
|
||||
val boneMeal: Item
|
||||
get() {
|
||||
return when(this){
|
||||
FAYRG -> Item(4852)
|
||||
RAURG_BONES -> Item(4853)
|
||||
OURG_BONES -> Item(4854)
|
||||
else -> Item(4255 + ordinal)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the config value for the bone type.
|
||||
* @param hopper the hopper.
|
||||
* @return the value.
|
||||
*/
|
||||
fun getConfigValue(hopper: Boolean): Int {
|
||||
return (if (this == BONES_2) ordinal else ordinal - 1) or (if (hopper) 4 else 8) shl 16
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Holds all bones.
|
||||
*/
|
||||
private val bones = HashMap<Int, Bones>()
|
||||
|
||||
/**
|
||||
* Gets the bones for the bone meal.
|
||||
* @param itemId the item.
|
||||
* @return the bones.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun forBoneMeal(itemId: Int): Bones? {
|
||||
for (bone in values()) {
|
||||
if (bone.boneMeal.id == itemId) {
|
||||
return bone
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the config value for the bone.
|
||||
* @param value the value.
|
||||
* @param hopper hopper.
|
||||
* @return `True` if so.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun forConfigValue(value: Int, hopper: Boolean): Bones? {
|
||||
for (bone in values()) {
|
||||
if (bone.getConfigValue(hopper) == value) {
|
||||
return bone
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bone ids.
|
||||
* @return the ids.
|
||||
*/
|
||||
val array: IntArray
|
||||
@JvmStatic get() {
|
||||
val list: MutableList<Int> = ArrayList(20)
|
||||
for (i in bones.keys) {
|
||||
list.add(i)
|
||||
}
|
||||
return list.toIntArray()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bone.
|
||||
* @param itemId The item id.
|
||||
* @return The bone.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun forId(itemId: Int): Bones? {
|
||||
return bones[itemId]
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the bones.
|
||||
*/
|
||||
init {
|
||||
for (bone in values()) {
|
||||
bones[bone.itemId] = bone
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package content.global.skill.prayer;
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.component.Component;
|
||||
import core.game.node.entity.player.link.prayer.PrayerType;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.SkillRestoration;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.player.link.quest.Quest;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the praying at an alter.
|
||||
* @author Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class PrayerAltarPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.setOptionHandler("pray-at", this);
|
||||
SceneryDefinition.setOptionHandler("pray", this);
|
||||
SceneryDefinition.forId(61).getHandlers().put("option:check", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (option.equalsIgnoreCase("check")) {
|
||||
final Quest quest = player.getQuestRepository().getQuest("Merlin's Crystal");
|
||||
if (quest.getStage(player) == 70) {
|
||||
player.getDialogueInterpreter().sendDialogue("You find a small inscription at the bottom of the altar. It reads:", "'Snarthon Candtrick Termanto'.");
|
||||
quest.setStage(player, 80);
|
||||
return true;
|
||||
}
|
||||
player.getPacketDispatch().sendMessage("An altar of the evil god Zamorak.");
|
||||
return true;
|
||||
}
|
||||
Altar altar = Altar.forId(node.getId());
|
||||
if (altar != null) {
|
||||
altar.pray(player);
|
||||
visualize(player);
|
||||
return true;
|
||||
}
|
||||
if (player.getSkills().getPrayerPoints() == player.getSkills().getStaticLevel(Skills.PRAYER)) {
|
||||
player.getPacketDispatch().sendMessage("You already have full prayer points.");
|
||||
return true;
|
||||
}
|
||||
visualize(player);
|
||||
player.getSkills().rechargePrayerPoints();
|
||||
player.getPacketDispatch().sendMessage("You recharge your Prayer points.");
|
||||
if (node.getId() == 2640) {
|
||||
player.getSkills().setLevel(Skills.PRAYER, player.getSkills().getStaticLevel(Skills.PRAYER) + 2);
|
||||
}
|
||||
if (node.getId() == 409
|
||||
&& player.getLocation().withinDistance(new Location(3209, 3495, 1))
|
||||
&& player.getPrayer().getActive().contains(PrayerType.SMITE)) {
|
||||
player.getAchievementDiaryManager().finishTask(player,DiaryType.VARROCK,2, 4);
|
||||
}
|
||||
if (node.getId() == 39842
|
||||
&& player.getLocation().withinDistance(new Location(2995, 3177, 0))) {
|
||||
player.getAchievementDiaryManager().finishTask(player,DiaryType.FALADOR,0, 13);
|
||||
}
|
||||
// Seers task can be completed with either of camelot altar or seers church altar
|
||||
if (node.getId() == 19145
|
||||
&& player.getLocation().withinDistance(new Location(2749, 3496, 1))) {
|
||||
player.getAchievementDiaryManager().finishTask(player,DiaryType.SEERS_VILLAGE,0, 10);
|
||||
}
|
||||
if (node.getId() == 409
|
||||
&& player.getLocation().withinDistance(new Location(2694, 3462, 0))) {
|
||||
player.getAchievementDiaryManager().finishTask(player,DiaryType.SEERS_VILLAGE,0, 10);
|
||||
}
|
||||
|
||||
if (node.getLocation().equals(new Location(2571, 9499, 0))) {
|
||||
player.teleport(new Location(2583, 9576, 0));
|
||||
player.sendMessage("It's a trap!");
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visualizes the prayer.
|
||||
* @param player the player.
|
||||
*/
|
||||
public void visualize(Player player) {
|
||||
player.lock(3);
|
||||
player.getAudioManager().send(2674);
|
||||
player.animate(Animation.create(645));
|
||||
}
|
||||
|
||||
/**
|
||||
* An altar.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum Altar {
|
||||
ANCIENT(6552, SpellBook.ANCIENT.getInterfaceId(), "You feel a strange wisdom fill your mind...", "You feel a strange drain upon your memory...") {
|
||||
@Override
|
||||
public void pray(Player player) {
|
||||
if (player.getSkills().getStaticLevel(Skills.MAGIC) < 50) {
|
||||
player.sendMessage("You need a Magic level of at least 50 in order to do this.");
|
||||
return;
|
||||
}
|
||||
drain(player);
|
||||
if (!isPrayerType(player)) {
|
||||
switchToBook(player);
|
||||
player.sendMessage(getMessages()[0]);
|
||||
} else {
|
||||
revert(player);
|
||||
player.sendMessage(getMessages()[1]);
|
||||
}
|
||||
}
|
||||
},
|
||||
LUNAR(17010, SpellBook.LUNAR.getInterfaceId(), "Lunar spells activated!", "Modern spells activated!") {
|
||||
@Override
|
||||
public void pray(Player player) {
|
||||
if (player.getSkills().getStaticLevel(Skills.MAGIC) < 65) {
|
||||
player.sendMessage("You need a Magic level of at least 65 in order to do this.");
|
||||
return;
|
||||
}
|
||||
if (!isPrayerType(player)) {
|
||||
switchToBook(player);
|
||||
player.sendMessage(getMessages()[0]);
|
||||
} else {
|
||||
revert(player);
|
||||
player.sendMessage(getMessages()[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The id.
|
||||
*/
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* The book.
|
||||
*/
|
||||
private int book;
|
||||
|
||||
/**
|
||||
* The messages.
|
||||
*/
|
||||
private String[] messages;
|
||||
|
||||
/**
|
||||
* Constructs a new {@Code Altar} {@Code Object}
|
||||
* @param id the id.
|
||||
* @param book the book.
|
||||
* @param messages the messages.
|
||||
*/
|
||||
private Altar(int id, int book, String... messages) {
|
||||
this.id = id;
|
||||
this.book = book;
|
||||
this.messages = messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prays at the altar.
|
||||
* @param player the player.
|
||||
*/
|
||||
public void pray(Player player) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts the book.
|
||||
* @param player the player.
|
||||
*/
|
||||
public void revert(Player player) {
|
||||
player.getSpellBookManager().setSpellBook(SpellBook.MODERN);
|
||||
player.getInterfaceManager().openTab(new Component(SpellBook.values()[SpellBook.MODERN.ordinal()].getInterfaceId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Drains the player.
|
||||
* @param player the player.
|
||||
*/
|
||||
public void drain(Player player) {
|
||||
player.getSkills().decrementPrayerPoints(player.getSkills().getPrayerPoints());
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches to the book.
|
||||
* @param player the player.
|
||||
*/
|
||||
public void switchToBook(Player player) {
|
||||
player.getSpellBookManager().setSpellBook(SpellBook.forInterface(book));
|
||||
player.getInterfaceManager().openTab(new Component(book));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if it is the prayer type.
|
||||
* @param player the player.
|
||||
* @return true if so.
|
||||
*/
|
||||
public boolean isPrayerType(Player player) {
|
||||
return player.getSpellBookManager().getSpellBook() == book;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an altar.
|
||||
* @param id the id.
|
||||
* @return the altar.
|
||||
*/
|
||||
public static Altar forId(int id) {
|
||||
for (Altar altar : values()) {
|
||||
if (id == altar.getId()) {
|
||||
return altar;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
* @return the id
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the book.
|
||||
* @return the book
|
||||
*/
|
||||
public int getBook() {
|
||||
return book;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the messages.
|
||||
* @return the messages
|
||||
*/
|
||||
public String[] getMessages() {
|
||||
return messages;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user