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,177 @@
|
||||
package content.data;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
/**
|
||||
* The BossKillcounter keeps track of the amount of bosses the player has slain.
|
||||
* addtoKillcount(player, npcId) should be added in the finalizeDeath() method of the combat handler for the boss.
|
||||
* @author Splinter
|
||||
*/
|
||||
public enum BossKillCounter {
|
||||
|
||||
|
||||
/* ORDINAL BOUND */
|
||||
KING_BLACK_DRAGON(new int[] { 50 }, "King Black Dragon", 14649),
|
||||
BORK(new int[] { 7133, 7134 }, "Bork", -1),
|
||||
DAGANNOTH_SUPREME(new int[] { 2881 }, "Dagannoth Supreme", 14639),
|
||||
DAGANNOTH_PRIME(new int[] { 2882 }, "Dagannoth Prime", 14640),
|
||||
DAGANNOTH_REX(new int[] { 2883 }, "Dagannoth Rex", 14641),
|
||||
CHAOS_ELEMENTAL(new int[] { 3200 }, "Chaos Elemental", 14638),
|
||||
GIANT_MOLE(new int[] { 3340 }, "Giant Mole", 14642),
|
||||
SARADOMIN(new int[] { 6247 }, "Commander Zilyana", 14647),
|
||||
ZAMORAK(new int[] { 6203 }, "K'ril Tsutsaroth", 14648),
|
||||
BANDOS(new int[] { 6260 }, "General Graardor", 14646),
|
||||
ARMADYL(new int[] { 6222 }, "Kree'arra", 14645),
|
||||
JAD(new int[] { 2745 }, "Tz-Tok Jad", 14828),
|
||||
KALPHITE_QUEEN(new int[] { 1160 }, "Kalphite Queen", 14650),
|
||||
CORPOREAL_BEAST(new int[] { 8133 }, "Corporeal Beast", 14653),
|
||||
TORMENTED_DEMONS(new int[] {
|
||||
8349, 8350, 8351, 8352, 8353, 8354,
|
||||
8355, 8356, 8357, 8358, 8359, 8360,
|
||||
8361, 8362, 8363, 8364, 8365, 8366,
|
||||
}, "Tormented demon", -1),
|
||||
CALLISTO(new int[] { 8610 }, "Callisto", 14658),
|
||||
SCORPIA(new int[] { 8611 }, "Scorpia", 14661),
|
||||
VENENATIS(new int[] { 8612 }, "Venenatis", 14657),
|
||||
VETION(new int[] { 8613 }, "Vet'ion", 14659),
|
||||
KRAKEN(new int[] { 8614 }, "Cave Kraken", 14651),
|
||||
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* The npcs that can increase the killcounter
|
||||
*/
|
||||
private final int[] npc;
|
||||
|
||||
/**
|
||||
* The name of the NPC, to be displayed as a sendMessage
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The item ID of the pet relating to the boss.
|
||||
*/
|
||||
private final int petId;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BossKillCounter} {@code Object}.
|
||||
* @param npc the npc.
|
||||
* @param name the npc's string name
|
||||
*/
|
||||
BossKillCounter(final int[] npc, final String name, final int petId) {
|
||||
this.npc = npc;
|
||||
this.name = name;
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the npc.
|
||||
* @return The npc.
|
||||
*/
|
||||
public int[] getNpc() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the NPC's name
|
||||
* @return their name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the petId
|
||||
* @return The petId
|
||||
*/
|
||||
public int getPetId() {
|
||||
return petId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type for the npc.
|
||||
* @param npc the npc.
|
||||
* @return the BossKillcounter
|
||||
*/
|
||||
public static BossKillCounter forNPC(final int npc) {
|
||||
for (BossKillCounter kc : BossKillCounter.values()) {
|
||||
for (int i : kc.getNpc()) {
|
||||
if (npc == i) {
|
||||
return kc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds to the player's killcount for that particular boss.
|
||||
* @param killer The player who killed the npc
|
||||
* @param npcid the ID of the npc that just died
|
||||
*/
|
||||
public static void addtoKillcount(Player killer, int npcid) {
|
||||
if (killer == null) {
|
||||
return;
|
||||
}
|
||||
BossKillCounter boss = BossKillCounter.forNPC(npcid);
|
||||
if (boss == null) {
|
||||
return;
|
||||
}
|
||||
killer.getSavedData().getGlobalData().getBossCounters()[boss.ordinal()]++;
|
||||
killer.getPacketDispatch().sendMessage("Your " + boss.getName() + " killcount is now: <col=ff0000>" + killer.getSavedData().getGlobalData().getBossCounters()[boss.ordinal()] + "</col>.");
|
||||
// addBossPet(killer, npcid, boss);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Gives the player the pet if they killed a certain boss.
|
||||
// * The chance by default is 1/5000. This rate lowers to 1/2200 if the <GlobalEvents> for Boss Pets is active.
|
||||
// * Note: Not all bosses have pet versions of themselves.
|
||||
// */
|
||||
// private static void addBossPet(Player killer, int npcid, BossKillCounter boss){
|
||||
// if(boss.getPetId() == -1){ //The boss does not have a pet version.
|
||||
// return;
|
||||
// }
|
||||
// int number = 5000;
|
||||
// if (npcid == 2745) {
|
||||
// number = 200;
|
||||
// if (killer.getSlayer().getTask() == Tasks.JAD) {
|
||||
// number = 100;
|
||||
// }
|
||||
// } else if (npcid == 3200) {
|
||||
// number = 300;
|
||||
// }
|
||||
// int rand = number;
|
||||
// if(rand == 10){
|
||||
// for (int i = 0; i < killer.getFamiliarManager().getInsuredPets().size(); i++) {
|
||||
// if (killer.getFamiliarManager().getInsuredPets().get(i).getBabyItemId() == boss.getPetId()) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// if(killer.getFamiliarManager().hasFamiliar() && killer.getInventory().freeSlots() < 1){
|
||||
// return;
|
||||
// }
|
||||
// if(!killer.getFamiliarManager().hasFamiliar()){
|
||||
// killer.getFamiliarManager().summon(new Item(boss.getPetId()), true);
|
||||
// killer.sendNotificationMessage("You have a funny feeling like you're being followed.");
|
||||
// } else if (killer.getInventory().freeSlots() > 0){
|
||||
// killer.getInventory().add(new Item(boss.getPetId(), 1));
|
||||
// killer.sendNotificationMessage("You feel something weird sneaking into your backpack.");
|
||||
// }
|
||||
// Repository.sendNews(killer.getUsername()+" now commands a miniature "+(boss.equals(CORPOREAL_BEAST) ? "Dark core" : boss.getName())+"!");
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Increments the player's Barrows chest counter.
|
||||
* @param player the player
|
||||
*/
|
||||
public static void addtoBarrowsCount(Player player) {
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
player.getSavedData().getGlobalData().setBarrowsLoots(player.getSavedData().getGlobalData().getBarrowsLoots() + 1);
|
||||
player.getPacketDispatch().sendMessage("Your Barrows chest count is: <col=ff0000>" + player.getSavedData().getGlobalData().getBarrowsLoots() + "</col>.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package content.data;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a dye.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum Dyes {
|
||||
BLACK(new Item(4622)),
|
||||
RED(new Item(1763)),
|
||||
YELLOW(new Item(1765)),
|
||||
BLUE(new Item(1767)),
|
||||
ORANGE(new Item(1769)),
|
||||
GREEN(new Item(1771)),
|
||||
PURPLE(new Item(1773)),
|
||||
PINK(new Item(6955));
|
||||
|
||||
/**
|
||||
* The dye item.
|
||||
*/
|
||||
private final Item item;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code Dyes} {@code Object}.
|
||||
* @param item the item.
|
||||
*/
|
||||
Dyes(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dye for the item.
|
||||
* @param item the item.
|
||||
* @return the dye.
|
||||
*/
|
||||
public static Dyes forItem(Item item) {
|
||||
for (Dyes d : values()) {
|
||||
if (d.getItem().getId() == item.getId()) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item.
|
||||
* @return The item.
|
||||
*/
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
package content.data
|
||||
|
||||
import content.global.skill.magic.TeleportMethod
|
||||
import content.global.skill.slayer.SlayerManager.Companion.getInstance
|
||||
import core.api.*
|
||||
import core.game.event.TeleportEvent
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.TeleportManager
|
||||
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.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import org.rs09.consts.Items
|
||||
import core.game.world.GameWorld.Pulser
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Represents an enchanted jewellery.
|
||||
* @author Vexia & downthecrop
|
||||
*/
|
||||
enum class EnchantedJewellery(
|
||||
|
||||
val options: Array<String>,
|
||||
val locations: Array<Location>, crumble: Boolean, vararg val ids: Int) {
|
||||
RING_OF_SLAYING(
|
||||
arrayOf(
|
||||
"Sumona in Pollnivneach.",
|
||||
"Morytania Slayer Tower.",
|
||||
"Rellekka Slayer Caves.",
|
||||
"Nowhere. Give me a slayer update."
|
||||
),
|
||||
arrayOf(
|
||||
Location.create(3361, 2994, 0),
|
||||
Location.create(3428, 3535, 0),
|
||||
Location.create(2792, 3615, 0),
|
||||
),
|
||||
true,
|
||||
Items.RING_OF_SLAYING8_13281,
|
||||
Items.RING_OF_SLAYING7_13282,
|
||||
Items.RING_OF_SLAYING6_13283,
|
||||
Items.RING_OF_SLAYING5_13284,
|
||||
Items.RING_OF_SLAYING4_13285,
|
||||
Items.RING_OF_SLAYING3_13286,
|
||||
Items.RING_OF_SLAYING2_13287,
|
||||
Items.RING_OF_SLAYING1_13288
|
||||
),
|
||||
|
||||
RING_OF_DUELING(
|
||||
arrayOf(
|
||||
"Al Kharid Duel Arena.",
|
||||
"Castle Wars Arena.",
|
||||
"Fist of Guthix", "Nowhere."
|
||||
),
|
||||
arrayOf(
|
||||
Location.create(3314, 3235, 0),
|
||||
Location.create(2442, 3089, 0),
|
||||
Location.create(1693, 5600, 0)
|
||||
),
|
||||
true,
|
||||
Items.RING_OF_DUELLING8_2552,
|
||||
Items.RING_OF_DUELLING7_2554,
|
||||
Items.RING_OF_DUELLING6_2556,
|
||||
Items.RING_OF_DUELLING5_2558,
|
||||
Items.RING_OF_DUELLING4_2560,
|
||||
Items.RING_OF_DUELLING3_2562,
|
||||
Items.RING_OF_DUELLING2_2564,
|
||||
Items.RING_OF_DUELLING1_2566
|
||||
),
|
||||
AMULET_OF_GLORY(
|
||||
arrayOf(
|
||||
"Edgeville",
|
||||
"Karamja",
|
||||
"Draynor Village",
|
||||
"Al-Kharid",
|
||||
"Nowhere."
|
||||
),
|
||||
arrayOf(
|
||||
Location.create(3087, 3495, 0),
|
||||
Location.create(2919, 3175, 0),
|
||||
Location.create(3104, 3249, 0),
|
||||
Location.create(3304, 3124, 0)
|
||||
),
|
||||
Items.AMULET_OF_GLORY4_1712,
|
||||
Items.AMULET_OF_GLORY3_1710,
|
||||
Items.AMULET_OF_GLORY2_1708,
|
||||
Items.AMULET_OF_GLORY1_1706,
|
||||
Items.AMULET_OF_GLORY_1704
|
||||
),
|
||||
AMULET_OF_GLORY_T(
|
||||
AMULET_OF_GLORY.options,
|
||||
AMULET_OF_GLORY.locations,
|
||||
Items.AMULET_OF_GLORYT4_10354,
|
||||
Items.AMULET_OF_GLORYT3_10356,
|
||||
Items.AMULET_OF_GLORYT2_10358,
|
||||
Items.AMULET_OF_GLORYT1_10360,
|
||||
Items.AMULET_OF_GLORYT_10362
|
||||
),
|
||||
GAMES_NECKLACE(
|
||||
arrayOf(
|
||||
"Burthorpe Games Room.",
|
||||
"Barbarian Outpost.",
|
||||
"Clan Wars.",
|
||||
"Wilderness Volcano.",
|
||||
"Corporeal Beast"
|
||||
),
|
||||
arrayOf(
|
||||
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,
|
||||
Items.GAMES_NECKLACE8_3853,
|
||||
Items.GAMES_NECKLACE7_3855,
|
||||
Items.GAMES_NECKLACE6_3857,
|
||||
Items.GAMES_NECKLACE5_3859,
|
||||
Items.GAMES_NECKLACE4_3861,
|
||||
Items.GAMES_NECKLACE3_3863,
|
||||
Items.GAMES_NECKLACE2_3865,
|
||||
Items.GAMES_NECKLACE1_3867
|
||||
),
|
||||
DIGSITE_PENDANT(arrayOf<String>(),
|
||||
arrayOf(
|
||||
Location.create(3342, 3445, 0)
|
||||
),
|
||||
true,
|
||||
Items.DIGSITE_PENDANT_5_11194,
|
||||
Items.DIGSITE_PENDANT_4_11193,
|
||||
Items.DIGSITE_PENDANT_3_11192,
|
||||
Items.DIGSITE_PENDANT_2_11191,
|
||||
Items.DIGSITE_PENDANT_1_11190
|
||||
),
|
||||
COMBAT_BRACELET(
|
||||
arrayOf(
|
||||
"Champions' Guild",
|
||||
"Monastery",
|
||||
"Ranging Guild",
|
||||
"Warriors' Guild",
|
||||
"Nowhere."
|
||||
),
|
||||
arrayOf(
|
||||
Location.create(3191, 3365, 0),
|
||||
Location.create(3052, 3472, 0),
|
||||
Location.create(2657, 3439, 0),
|
||||
Location.create(2878, 3546, 0)
|
||||
),
|
||||
Items.COMBAT_BRACELET4_11118,
|
||||
Items.COMBAT_BRACELET3_11120,
|
||||
Items.COMBAT_BRACELET2_11122,
|
||||
Items.COMBAT_BRACELET1_11124,
|
||||
Items.COMBAT_BRACELET_11126
|
||||
),
|
||||
SKILLS_NECKLACE(
|
||||
arrayOf(
|
||||
"Fishing Guild",
|
||||
"Mining Guild",
|
||||
"Crafting Guild",
|
||||
"Cooking Guild",
|
||||
"Nowhere."
|
||||
),
|
||||
arrayOf(
|
||||
Location.create(2611, 3392, 0),
|
||||
Location.create(3016, 3338, 0),
|
||||
Location.create(2933, 3290, 0),
|
||||
Location.create(3143, 3442, 0)
|
||||
),
|
||||
Items.SKILLS_NECKLACE4_11105,
|
||||
Items.SKILLS_NECKLACE3_11107,
|
||||
Items.SKILLS_NECKLACE2_11109,
|
||||
Items.SKILLS_NECKLACE1_11111,
|
||||
Items.SKILLS_NECKLACE_11113
|
||||
),
|
||||
RING_OF_WEALTH(
|
||||
arrayOf(
|
||||
"Grand Exchange",
|
||||
"Nowhere."
|
||||
),
|
||||
arrayOf(
|
||||
Location.create(3163, 3464, 0)
|
||||
),
|
||||
Items.RING_OF_WEALTH4_14646,
|
||||
Items.RING_OF_WEALTH3_14644,
|
||||
Items.RING_OF_WEALTH2_14642,
|
||||
Items.RING_OF_WEALTH1_14640,
|
||||
Items.RING_OF_WEALTH_14638
|
||||
);
|
||||
|
||||
val isCrumble: Boolean = crumble
|
||||
|
||||
/**
|
||||
* Constructs a new `EnchantedJewelleryPlugin` `Object`.
|
||||
* @param options the dialogue options.
|
||||
* @param locations the teleport locations.
|
||||
* @param ids the ordered item ids.
|
||||
*/
|
||||
constructor(options: Array<String>, locations: Array<Location>, vararg ids: Int) : this(options, locations, false, *ids)
|
||||
|
||||
/**
|
||||
* Method used to teleport the player to the desired location.
|
||||
* @param player the player.
|
||||
* @param item the used jewellery item.
|
||||
* @param buttonID the button id.
|
||||
* @param isEquipped If the player is operating.
|
||||
*/
|
||||
fun use(player: Player, item: Item, buttonID: Int, isEquipped: Boolean) {
|
||||
if (buttonID > locations.size - 1) {
|
||||
if (isSlayerRing(item)) {
|
||||
slayerProgressDialogue(player)
|
||||
}
|
||||
return
|
||||
}
|
||||
val itemIndex = getItemIndex(item)
|
||||
val nextJewellery = Item(getNext(itemIndex))
|
||||
if (canTeleport(player, nextJewellery)) {
|
||||
Pulser.submit(object : Pulse(0) {
|
||||
private var count = 0
|
||||
private var location = getLocation(buttonID)
|
||||
override fun pulse(): Boolean {
|
||||
when (count) {
|
||||
0 -> {
|
||||
lock(player,4)
|
||||
visualize(player, ANIMATION, GRAPHICS)
|
||||
playAudio(player, AUDIO, true)
|
||||
player.impactHandler.disabledTicks = 4
|
||||
}
|
||||
3 -> {
|
||||
teleport(player,location)
|
||||
resetAnimator(player)
|
||||
if (isLastItemIndex(itemIndex)) {
|
||||
if (isCrumble) crumbleJewellery(player, item, isEquipped)
|
||||
} else {
|
||||
replaceJewellery(player, item, nextJewellery, isEquipped)
|
||||
}
|
||||
unlock(player)
|
||||
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
|
||||
return true
|
||||
}
|
||||
}
|
||||
count += 1
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun replaceJewellery(player: Player, item: Item, nextJewellery: Item, isEquipped: Boolean) {
|
||||
if (isEquipped) {
|
||||
replaceSlot(player, item.slot, nextJewellery, item, Container.EQUIPMENT)
|
||||
} else {
|
||||
replaceSlot(player, item.slot, nextJewellery)
|
||||
}
|
||||
}
|
||||
|
||||
private fun crumbleJewellery(player: Player, item: Item, isEquipped: Boolean) {
|
||||
if (isEquipped) {
|
||||
removeItem(player, item, Container.EQUIPMENT)
|
||||
} else {
|
||||
removeItem(player, item)
|
||||
}
|
||||
if (isSlayerRing(item)) {
|
||||
addItem(player, Items.ENCHANTED_GEM_4155)
|
||||
sendMessage(player, "Your Ring of Slaying reverts back into a regular enchanted gem.")
|
||||
}
|
||||
}
|
||||
|
||||
private fun isSlayerRing(item: Item): Boolean {
|
||||
return (item.id in RING_OF_SLAYING.ids)
|
||||
}
|
||||
|
||||
private fun slayerProgressDialogue(player: Player) {
|
||||
val slayerManager = getInstance(player)
|
||||
if (!slayerManager.hasTask()) {
|
||||
sendNPCDialogue(player, slayerManager.master!!.npc, "You need something new to hunt. Come and " +
|
||||
"see me When you can and I'll give you a new task.", core.game.dialogue.FacialExpression.HALF_GUILTY)
|
||||
return
|
||||
}
|
||||
sendNPCDialogue(player, slayerManager.master!!.npc, "You're currently " +
|
||||
"assigned to kill ${getSlayerTaskName(player).lowercase(Locale.getDefault())}'s; " +
|
||||
"only ${getSlayerTaskKillsRemaining(player)} more to go.", core.game.dialogue.FacialExpression.FRIENDLY)
|
||||
// Slayer tracker UI
|
||||
setVarbit(player, 2502, 0, slayerManager.flags.taskFlags shr 4)
|
||||
}
|
||||
|
||||
private fun canTeleport(player: Player, item: Item): Boolean {
|
||||
return player.zoneMonitor.teleport(1, item)
|
||||
}
|
||||
|
||||
private fun getNext(index: Int): Int {
|
||||
val i = index + 1
|
||||
if (i > ids.size - 1) {
|
||||
return ids[ids.size - 1]
|
||||
}
|
||||
return ids[i]
|
||||
}
|
||||
|
||||
private fun getLocation(index: Int): Location {
|
||||
if (index > locations.size - 1) {
|
||||
return locations[locations.size - 1]
|
||||
}
|
||||
return locations[index]
|
||||
}
|
||||
|
||||
fun getJewelleryName(item: Item): String {
|
||||
return item.name.replace(""" ?\(t?[0-9]?\)""".toRegex(), "")
|
||||
}
|
||||
|
||||
fun getJewelleryType(item: Item): String {
|
||||
return when {
|
||||
this == GAMES_NECKLACE -> "games necklace"
|
||||
this == DIGSITE_PENDANT -> "necklace"
|
||||
this == COMBAT_BRACELET -> "bracelet"
|
||||
this == SKILLS_NECKLACE -> "necklace"
|
||||
else -> item.name.split(" ")[0].lowercase(Locale.getDefault())
|
||||
}
|
||||
}
|
||||
|
||||
fun isLastItemIndex(index: Int): Boolean = index == ids.size - 1
|
||||
|
||||
fun getItemIndex(item: Item): Int {
|
||||
return ids.indexOf(item.id)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val ANIMATION = Animation(714)
|
||||
private val AUDIO = Audio(200)
|
||||
private val GRAPHICS = Graphics(308, 100, 50)
|
||||
val idMap = HashMap<Int, EnchantedJewellery>()
|
||||
|
||||
init {
|
||||
values().forEach { entry ->
|
||||
entry.ids.forEach { idMap[it] = entry }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
package content.data;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* A god book.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum GodBook {
|
||||
HOLY_BOOK("Holy Book of Saradomin", new Item(3840), new Item(3839), new Item[] { new Item(1718) }, new Item(3827), new Item(3828), new Item(3829), new Item(3830)), BOOK_OF_BALANCE("Guthix's Book of Balance", new Item(3844), new Item(3843), new Item[] { new Item(1718), new Item(1724) }, new Item(3835), new Item(3836), new Item(3837), new Item(3838)), UNHOLY_BOOK("Unholy Book of Zamorak", new Item(3842), new Item(3841), new Item[] { new Item(1724) }, new Item(3831), new Item(3832), new Item(3833), new Item(3834));
|
||||
|
||||
/**
|
||||
* The books name.
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The god book.
|
||||
*/
|
||||
private final Item book;
|
||||
|
||||
/**
|
||||
* The damaged book.
|
||||
*/
|
||||
private final Item damagedBook;
|
||||
|
||||
/**
|
||||
* The items the book can bless.
|
||||
*/
|
||||
private final Item[] blessItems;
|
||||
|
||||
/**
|
||||
* The pages of items.
|
||||
*/
|
||||
private final Item[] pages;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GodBook} {@code Object}
|
||||
* @param book the book.
|
||||
* @param damagedBook the damged book.
|
||||
* @param name the name of the book.
|
||||
* @param pages the pages.
|
||||
*/
|
||||
private GodBook(String name, Item book, Item damagedBook, Item[] blessedItems, Item... pages) {
|
||||
this.book = book;
|
||||
this.damagedBook = damagedBook;
|
||||
this.name = name;
|
||||
this.blessItems = blessedItems;
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the god book for the item.
|
||||
* @param item the item.
|
||||
* @param damaged Flagged for the damaged book.
|
||||
* @return {@code GodBook} the god book.
|
||||
*/
|
||||
public static GodBook forItem(Item item, boolean damaged) {
|
||||
for (GodBook book : values()) {
|
||||
if ((!damaged ? book.getBook().getId() : book.getDamagedBook().getId()) == item.getId()) {
|
||||
return book;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has this god book.
|
||||
* @param player the player.
|
||||
* @param both if we are checking for the damaged/good.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasGodBook(Player player, boolean both) {
|
||||
return player.getInventory().containsItems(both ? new Item[] { book, damagedBook } : new Item[] { book });
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a good book based on the page id.
|
||||
* @param page the page.
|
||||
* @return the respective god book.
|
||||
*/
|
||||
public static GodBook forPage(Item page) {
|
||||
for (GodBook book : values()) {
|
||||
for (Item i : book.getPages()) {
|
||||
if (i.getId() == page.getId()) {
|
||||
return book;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a page into the book.
|
||||
* @param player the player.
|
||||
* @param book the book.
|
||||
* @param page the page.
|
||||
*/
|
||||
public void insertPage(Player player, Item book, Item page) {
|
||||
if (hasPage(player, book, page)) {
|
||||
player.sendMessage("The book already has that page.");
|
||||
return;
|
||||
}
|
||||
if (player.getInventory().remove(new Item(page.getId(), 1))) {
|
||||
setPageHash(player, book, getPageIndex(page));
|
||||
player.sendMessage("You add the page to the book...");
|
||||
if (isComplete(player, book)) {
|
||||
player.getSavedData().getGlobalData().setGodPages(new boolean[4]);
|
||||
player.getSavedData().getGlobalData().setGodBook(-1);
|
||||
player.getInventory().replace(this.book, book.getSlot());
|
||||
player.getSavedData().getGlobalData().setGodBook(this);
|
||||
player.sendMessage("The book is now complete!");
|
||||
String message = this == UNHOLY_BOOK ? "unholy symbols" : this == HOLY_BOOK ? "holy symbols" : "unblessed holy symbols";
|
||||
player.sendMessage("You can now use it to bless " + (message) + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this item is a page of the book.
|
||||
* @param asItem the item.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isPage(Item asItem) {
|
||||
for (Item item : pages) {
|
||||
if (item.getId() == asItem.getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a book is complete.
|
||||
* @param book the book.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isComplete(Player player, Item book) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!hasPage(player, book, i + 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there is a page in a book.
|
||||
* @param book the book.
|
||||
* @param page the page.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasPage(Player player, Item book, Item page) {
|
||||
return hasPage(player, book, getPageIndex(page));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a page hash.
|
||||
* @param book the book.
|
||||
* @param pageId the page Id.
|
||||
*/
|
||||
public void setPageHash(Player player, Item book, int pageId) {
|
||||
// int hash = getHash(book);
|
||||
// hash |= hash | (1 << pageId);
|
||||
// book.setCharge(1000 + hash);
|
||||
player.getSavedData().getGlobalData().getGodPages()[pageId - 1] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the book has a page.
|
||||
* @param book the book.
|
||||
* @param pageId the id of the page.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean hasPage(Player player, Item book, int pageId) {
|
||||
// return (getHash(book) & (1 << pageId)) != 0;
|
||||
return player.getSavedData().getGlobalData().getGodPages()[pageId - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hash.
|
||||
* @param book the book.
|
||||
* @return the hash.
|
||||
*/
|
||||
public int getHash(Item book) {
|
||||
return book.getCharge() - 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the page index.
|
||||
* @param page the page.
|
||||
* @return the index.
|
||||
*/
|
||||
public int getPageIndex(Item page) {
|
||||
for (int i = 0; i < pages.length; i++) {
|
||||
if (pages[i].getId() == page.getId()) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the god book.
|
||||
* @return the name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the book.
|
||||
* @return the book
|
||||
*/
|
||||
public Item getBook() {
|
||||
return book;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the damagedBook.
|
||||
* @return the damagedBook
|
||||
*/
|
||||
public Item getDamagedBook() {
|
||||
return damagedBook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pages.
|
||||
* @return the pages
|
||||
*/
|
||||
public Item[] getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the blessItem.
|
||||
* @return the blessItem
|
||||
*/
|
||||
public Item[] getBlessItem() {
|
||||
return blessItems;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
package content.data;
|
||||
|
||||
import core.game.dialogue.DialogueAction;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.GroundItem;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* A god type.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum GodType {
|
||||
SARADOMIN(new Item(2412), new Item(2415), 2873, 913, "The cape disappears in a flash of light as it touches the ground."), GUTHIX(new Item(2413), new Item(2416), 2875, 914, "The cape disintegrates as it touches the earth."), ZAMORAK(new Item(2414), new Item(2417), 2874, 912, "The cape ignites and burns up as it touches the ground.");
|
||||
|
||||
/**
|
||||
* The cape.
|
||||
*/
|
||||
private final Item cape;
|
||||
|
||||
/**
|
||||
* The staff.
|
||||
*/
|
||||
private final Item staff;
|
||||
|
||||
/**
|
||||
* The statue id.
|
||||
*/
|
||||
private final int statueId;
|
||||
|
||||
/**
|
||||
* The npc id.
|
||||
*/
|
||||
private final int npcId;
|
||||
|
||||
/**
|
||||
* The drop message.
|
||||
*/
|
||||
private final String dropMessage;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GodCape} {@code Object}.
|
||||
* @param cape the cape.
|
||||
* @param staff the staff.
|
||||
* @param statueId the id.
|
||||
*/
|
||||
private GodType(Item cape, Item staff, int statueId, int npcId, String dropMessage) {
|
||||
this.cape = cape;
|
||||
this.staff = staff;
|
||||
this.statueId = statueId;
|
||||
this.npcId = npcId;
|
||||
this.dropMessage = dropMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prays at a statue.
|
||||
* @param player the player.
|
||||
* @param statue the statue.
|
||||
*/
|
||||
public void pray(final Player player, final Scenery statue) {
|
||||
if (hasAny(player)) {
|
||||
player.lock(3);
|
||||
player.animate(Animation.create(645));
|
||||
player.sendMessages("You kneel and begin to chant to " + getName() + "...", "...but there is no response.");
|
||||
return;
|
||||
}
|
||||
player.getDialogueInterpreter().sendDialogue("You kneel and begin to chant to " + getName() + "...");
|
||||
player.getDialogueInterpreter().addAction(new DialogueAction() {
|
||||
|
||||
@Override
|
||||
public void handle(final Player player, int buttonId) {
|
||||
player.lock();
|
||||
player.animate(Animation.create(645));
|
||||
GameWorld.getPulser().submit(new Pulse(3, player) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
Location loc = statue.getLocation().transform(0, -1, 0);
|
||||
GroundItem g = GroundItemManager.get(cape.getId(), loc, player);
|
||||
if (g == null) {
|
||||
GroundItemManager.create(cape, loc, player);
|
||||
}
|
||||
player.getPacketDispatch().sendPositionedGraphic(86, 0, 0, loc);
|
||||
player.unlock();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the god type by the statue id.
|
||||
* @param object the object.
|
||||
* @return the type.
|
||||
*/
|
||||
public static GodType forObject(int object) {
|
||||
for (GodType type : values()) {
|
||||
if (type.getStatueId() == object) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if they have a god cape & which one.
|
||||
* @param player the player.
|
||||
* @param invyOnly if invy check only.
|
||||
* @return {@code GodCape} the cape.
|
||||
*/
|
||||
public static GodType getCape(Player player, boolean invyOnly) {
|
||||
for (GodType cape : values()) {
|
||||
if (invyOnly ? player.getInventory().containsItems(cape.getCape()) : (player.getEquipment().containsItem(cape.getCape()) || player.getInventory().containsItems(cape.getCape()))) {
|
||||
return cape;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if they have a god cape.
|
||||
* @param player the player.
|
||||
* @return the cape.
|
||||
*/
|
||||
public static GodType getCape(Player player) {
|
||||
return getCape(player, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a god cape type by the id.
|
||||
* @param cape the cape.
|
||||
* @return the cape.
|
||||
*/
|
||||
public static GodType forCape(final Item cape) {
|
||||
for (GodType g : values()) {
|
||||
if (g.getCape().getId() == cape.getId()) {
|
||||
return g;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player is friendly.
|
||||
* @param player the player.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean isFriendly(Player player) {
|
||||
return player.getEquipment().containsItem(cape);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mage type.
|
||||
* @param id the id.
|
||||
* @return te type.
|
||||
*/
|
||||
public static GodType forId(int id) {
|
||||
for (GodType type : values()) {
|
||||
if (type.getNpcId() == id) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has any capes.
|
||||
* @param player the player.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public static boolean hasAny(Player player) {
|
||||
for (GodType t : values()) {
|
||||
if (player.hasItem(t.getCape())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cape.
|
||||
* @return The cape.
|
||||
*/
|
||||
public Item getCape() {
|
||||
return cape;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the staff.
|
||||
* @return The staff.
|
||||
*/
|
||||
public Item getStaff() {
|
||||
return staff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the statueId.
|
||||
* @return The statueId.
|
||||
*/
|
||||
public int getStatueId() {
|
||||
return statueId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dropMessage.
|
||||
* @return The dropMessage.
|
||||
*/
|
||||
public String getDropMessage() {
|
||||
return dropMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the npcId.
|
||||
* @return The npcId.
|
||||
*/
|
||||
public int getNpcId() {
|
||||
return npcId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
* @return the name.
|
||||
*/
|
||||
public String getName() {
|
||||
return StringUtils.formatDisplayName(name().toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package content.data;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents an experience lamp.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum Lamps {
|
||||
GENIE_LAMP(new Item(2528), 10),
|
||||
STRONGHOLD_LAMP(new Item(4447), 500),
|
||||
|
||||
K_ACHIEVEMENT_1(new Item(11137), 1000, 30),
|
||||
K_ACHIEVEMENT_2(new Item(11139), 5000, 40),
|
||||
K_ACHIEVEMENT_3(new Item(11141), 10000, 50),
|
||||
|
||||
V_ACHIEVEMENT_1(new Item(11753), 1000, 30),
|
||||
V_ACHIEVEMENT_2(new Item(11754), 5000, 40),
|
||||
V_ACHIEVEMENT_3(new Item(11755), 10000, 50),
|
||||
|
||||
L_ACHIEVEMENT_1(new Item(11185), 500, 1),
|
||||
L_ACHIEVEMENT_2(new Item(11186), 1000, 30),
|
||||
L_ACHIEVEMENT_3(new Item(11187), 1500, 35),
|
||||
|
||||
FALLY_ACHIEVEMENT_1(new Item(14580), 1000, 30),
|
||||
FALLY_ACHIEVEMENT_2(new Item(14581), 5000, 40),
|
||||
FALLY_ACHIEVEMENT_3(new Item(14582), 10000, 50),
|
||||
|
||||
FREM_ACHIEVEMENT_1(new Item(14574), 5000, 30),
|
||||
FREM_ACHIEVEMENT_2(new Item(14575), 10000, 40),
|
||||
FREM_ACHIEVEMENT_3(new Item(14576), 15000, 50),
|
||||
|
||||
SEERS_ACHIEVEMENT_1(new Item(14633), 1000, 30),
|
||||
SEERS_ACHIEVEMENT_2(new Item(14634), 5000, 40),
|
||||
SEERS_ACHIEVEMENT_3(new Item(14635), 10000, 50);
|
||||
|
||||
/**
|
||||
* The item id.
|
||||
*/
|
||||
private final Item item;
|
||||
|
||||
/**
|
||||
* The experience gained.
|
||||
*/
|
||||
private final int experience;
|
||||
|
||||
/**
|
||||
* The level requirement.
|
||||
*/
|
||||
private final int levelRequirement;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code Lamps} {@code Object}
|
||||
* @param item the item.
|
||||
* @param experience the exp.
|
||||
* @param levelRequirement the level requirement to meet.
|
||||
*/
|
||||
Lamps(Item item, int experience, int levelRequirement) {
|
||||
this.item = item;
|
||||
this.experience = experience;
|
||||
this.levelRequirement = levelRequirement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code Lamps} {@code Object}
|
||||
* @param item the item.
|
||||
* @param experience the exp.
|
||||
*/
|
||||
Lamps(Item item, int experience) {
|
||||
this(item, experience, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lamp by the item.
|
||||
* @param item the item.
|
||||
* @return the lamp.
|
||||
*/
|
||||
public static Lamps forItem(Item item) {
|
||||
for (Lamps l : values()) {
|
||||
if (l.getItem().getId() == item.getId()) {
|
||||
return l;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item.
|
||||
* @return the item
|
||||
*/
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mod.
|
||||
* @return the mod
|
||||
*/
|
||||
public int getExp() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the levelRequirement.
|
||||
* @return the levelRequirement
|
||||
*/
|
||||
public int getLevelRequirement() {
|
||||
return levelRequirement;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package content.data;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import org.rs09.consts.Components;
|
||||
|
||||
import static org.rs09.consts.Items.*;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a light source.
|
||||
* @author Vexia
|
||||
* @author Emperor
|
||||
*/
|
||||
public enum LightSource {
|
||||
CANDLE(1, new Item(CANDLE_36, 1), new Item(LIT_CANDLE_33, 1), true, Components.DARKNESS_MEDIUM_98),
|
||||
BLACK_CANDLE(1, new Item(BLACK_CANDLE_38, 1), new Item(LIT_BLACK_CANDLE_32, 1), true, Components.DARKNESS_MEDIUM_98),
|
||||
TORCH(1, new Item(UNLIT_TORCH_596, 1), new Item(LIT_TORCH_594, 1), true, Components.DARKNESS_MEDIUM_98),
|
||||
CANDLE_LANTERN(4, new Item(CANDLE_LANTERN_4527, 1), new Item(CANDLE_LANTERN_4531, 1), false, Components.DARKNESS_MEDIUM_98),
|
||||
OIL_LAMP(12, new Item(OIL_LAMP_4522, 1), new Item(OIL_LAMP_4524, 1), true, Components.DARKNESS_LIGHT_97),
|
||||
OIL_LANTERN(26, new Item(OIL_LANTERN_4535, 1), new Item(OIL_LANTERN_4539, 1), false, Components.DARKNESS_LIGHT_97),
|
||||
BULLSEYE_LANTERN(49, new Item(BULLSEYE_LANTERN_4548, 1), new Item(BULLSEYE_LANTERN_4550, 1), false, -1),
|
||||
SAPPHIRE_LANTERN(49, new Item(SAPPHIRE_LANTERN_4701, 1), new Item(SAPPHIRE_LANTERN_4702, 1), false, -1),
|
||||
EMERALD_LANTERN(49, new Item(EMERALD_LANTERN_9064, 1), new Item(EMERALD_LANTERN_9065, 1), false, -1),
|
||||
MINING_HELMET(65, new Item(MINING_HELMET_5014, 1), new Item(MINING_HELMET_5013, 1), false, Components.DARKNESS_LIGHT_97);
|
||||
|
||||
/**
|
||||
* Represents the level required.
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* Represents the raw item.
|
||||
*/
|
||||
private Item raw;
|
||||
|
||||
/**
|
||||
* Represents the product.
|
||||
*/
|
||||
private Item product;
|
||||
|
||||
/**
|
||||
* If the light source is open (eg. candles, torches, ...).
|
||||
*/
|
||||
private final boolean open;
|
||||
|
||||
/**
|
||||
* The interface id.
|
||||
*/
|
||||
private final int interfaceId;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code LightSource} {@code Object}.
|
||||
* @param level the level.
|
||||
* @param raw the raw.
|
||||
* @param product the product.
|
||||
* @param open If it's an open light source.
|
||||
* @param interfaceId The overlay interface id to display.
|
||||
*/
|
||||
LightSource(int level, Item raw, Item product, boolean open, int interfaceId) {
|
||||
this.level = level;
|
||||
this.raw = raw;
|
||||
this.product = product;
|
||||
this.open = open;
|
||||
this.interfaceId = interfaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has a lit light source.
|
||||
* @param player The player.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public static boolean hasActiveLightSource(Player player) {
|
||||
return getActiveLightSource(player) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the light source used by the player.
|
||||
* @param player The player.
|
||||
* @return The light source object, or null if the player didn't have any
|
||||
* light source.
|
||||
*/
|
||||
public static LightSource getActiveLightSource(Player player) {
|
||||
LightSource source;
|
||||
for (Item item : player.getInventory().toArray()) {
|
||||
if (item != null && (source = forProductId(item.getId())) != null) {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
for (Item item : player.getEquipment().toArray()) {
|
||||
if (item != null && (source = forProductId(item.getId())) != null) {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the light source by the id.
|
||||
* @param id the id.
|
||||
* @return the source.
|
||||
*/
|
||||
public static LightSource forId(int id) {
|
||||
for (LightSource light : LightSource.values()) {
|
||||
if (light.raw.getId() == id) {
|
||||
return light;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the light souce by the product id.
|
||||
* @param id the id.
|
||||
* @return the light source.
|
||||
*/
|
||||
public static LightSource forProductId(int id) {
|
||||
for (LightSource light : LightSource.values()) {
|
||||
if (light.product.getId() == id) {
|
||||
return light;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the strength of the light source (1=dim, 2=medium, 3=bright).
|
||||
* @return The strength.
|
||||
*/
|
||||
public int getStrength() {
|
||||
switch (interfaceId) {
|
||||
case Components.DARKNESS_LIGHT_97:
|
||||
return 1;
|
||||
case Components.DARKNESS_MEDIUM_98:
|
||||
return 2;
|
||||
case -1:
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the light source.
|
||||
* @return The name.
|
||||
*/
|
||||
public String getName() {
|
||||
return super.name().toLowerCase().replaceAll("_", " ");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the raw item.
|
||||
* @return the raw.
|
||||
*/
|
||||
public Item getRaw() {
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product.
|
||||
* @return the product.
|
||||
*/
|
||||
public Item getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return the level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the open.
|
||||
* @return The open.
|
||||
*/
|
||||
public boolean isOpen() {
|
||||
return open;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the interfaceId.
|
||||
* @return The interfaceId.
|
||||
*/
|
||||
public int getInterfaceId() {
|
||||
return interfaceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ids of the raw items.
|
||||
* @return The raw item ids.
|
||||
*/
|
||||
public static int[] getRawIds() {
|
||||
int array[] = new int[LightSource.values().length];
|
||||
for (int i = 0; i < LightSource.values().length -1; i++) {
|
||||
array[i] = LightSource.values()[i].getRaw().getId();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package content.data
|
||||
|
||||
enum class MeatState {
|
||||
INEDIBLE_RAW,
|
||||
INEDIBLE_BURNT,
|
||||
INEDIBLE_SPECIAL, // could be a quest item
|
||||
EDIBLE_COOKED,
|
||||
}
|
||||
|
||||
enum class Meat(val id: Int, val state: MeatState) {
|
||||
ENCHANTED_BEEF(522, MeatState.INEDIBLE_SPECIAL),
|
||||
ENCHANTED_RAT_MEAT(523, MeatState.INEDIBLE_SPECIAL),
|
||||
ENCHANTED_BEAR_MEAT(524, MeatState.INEDIBLE_SPECIAL),
|
||||
ENCHANTED_CHICKEN(525, MeatState.INEDIBLE_SPECIAL),
|
||||
RAW_UGTHANKI_MEAT(1859, MeatState.INEDIBLE_RAW),
|
||||
UGTHANKI_MEAT(1861, MeatState.EDIBLE_COOKED),
|
||||
RAW_BEEF(2132, MeatState.INEDIBLE_RAW),
|
||||
RAW_RAT_MEAT(2134, MeatState.INEDIBLE_RAW),
|
||||
RAW_BEAR_MEAT(2136, MeatState.INEDIBLE_RAW),
|
||||
RAW_CHICKEN(2138, MeatState.INEDIBLE_RAW),
|
||||
COOKED_CHICKEN(2140, MeatState.EDIBLE_COOKED),
|
||||
BURNT_CHICKEN(2140, MeatState.INEDIBLE_BURNT),
|
||||
COOKED_MEAT(2142, MeatState.EDIBLE_COOKED),
|
||||
BURNT_MEAT(2146, MeatState.INEDIBLE_BURNT),
|
||||
THIN_SNAIL_MEAT(3369, MeatState.EDIBLE_COOKED),
|
||||
LEAN_SNAIL_MEAT(3371, MeatState.EDIBLE_COOKED),
|
||||
FAT_SNAIL_MEAT(3373, MeatState.EDIBLE_COOKED),
|
||||
RAW_BEEF_UNDEAD(4287, MeatState.INEDIBLE_RAW),
|
||||
RAW_CHICKEN_UNDEAD(4289, MeatState.INEDIBLE_RAW),
|
||||
COOKED_CHICKEN_UNDEAD(4291, MeatState.EDIBLE_COOKED),
|
||||
COOKED_MEAT_UNDEAD(4293, MeatState.EDIBLE_COOKED),
|
||||
RAW_CRAB_MEAT(7518, MeatState.INEDIBLE_RAW),
|
||||
BURNT_CRAB_MEAT(7520, MeatState.INEDIBLE_BURNT),
|
||||
COOKED_CRAB_MEAT_5(7521, MeatState.EDIBLE_COOKED),
|
||||
COOKED_CRAB_MEAT_4(7523, MeatState.EDIBLE_COOKED),
|
||||
COOKED_CRAB_MEAT_3(7524, MeatState.EDIBLE_COOKED),
|
||||
COOKED_CRAB_MEAT_2(7525, MeatState.EDIBLE_COOKED),
|
||||
COOKED_CRAB_MEAT_1(7526, MeatState.EDIBLE_COOKED),
|
||||
GROUND_CRAB_MEAT(7527, MeatState.INEDIBLE_RAW),
|
||||
LOCUST_MEAT(9052, MeatState.EDIBLE_COOKED),
|
||||
RAW_BIRD_MEAT(9978, MeatState.INEDIBLE_RAW),
|
||||
ROAST_BIRD_MEAT(9980, MeatState.EDIBLE_COOKED),
|
||||
BURNT_BIRD_MEAT(9982, MeatState.INEDIBLE_BURNT),
|
||||
SKEWERED_BIRD_MEAT(9982, MeatState.INEDIBLE_RAW),
|
||||
RAW_BEAST_MEAT(9986, MeatState.INEDIBLE_RAW),
|
||||
ROAST_BEAST_MEAT(9988, MeatState.EDIBLE_COOKED),
|
||||
BURNT_BEAST_MEAT(9990, MeatState.INEDIBLE_BURNT),
|
||||
RAW_YAK_MEAT(10816, MeatState.INEDIBLE_RAW),
|
||||
RAW_PAWYA_MEAT(12535, MeatState.INEDIBLE_RAW),
|
||||
ENCHANTED_PAWYA_MEAT(12546, MeatState.INEDIBLE_SPECIAL);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package content.data;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the repair item type.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum RepairItem {
|
||||
BRONZE_HATCHET(new Item(494, 1), new Item(1351, 1), 0),
|
||||
BRONZE_PICKAXE(new Item(468, 1), new Item(1265, 1), 0),
|
||||
IRON_HATCHET(new Item(496, 1), new Item(1349, 1), 0),
|
||||
IRON_PICKAXE(new Item(470, 1), new Item(1267, 1), 0),
|
||||
STEEL_HATCHET(new Item(498, 1), new Item(1353, 1), 0),
|
||||
STEEL_PICKAXE(new Item(472, 1), new Item(1269, 1), 14),
|
||||
BLACK_HATCHET(new Item(500, 1), new Item(1361, 1), 10),
|
||||
MITHRIL_HATCHET(new Item(502, 1), new Item(1355, 1), 18),
|
||||
MITHRIL_PICKAXE(new Item(474, 1), new Item(1273, 1), 43),
|
||||
ADAMANT_HATCHET(new Item(504, 1), new Item(1357, 1), 43),
|
||||
ADAMANT_PICKAXE(new Item(476, 1), new Item(1271, 1), 107),
|
||||
RUNE_HATCHET(new Item(506, 1), new Item(1359, 1), 427),
|
||||
RUNE_PICKAXE(new Item(478, 1), new Item(1275, 1), 1100),
|
||||
DRAGON_HATCHET(new Item(6741, 1), new Item(6739, 1), 1800);
|
||||
|
||||
/**
|
||||
* The item id.
|
||||
*/
|
||||
private final Item item;
|
||||
|
||||
/**
|
||||
* The product item.
|
||||
*/
|
||||
private final Item product;
|
||||
|
||||
/**
|
||||
* The cost of the money to repair.
|
||||
*/
|
||||
private final int cost;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BobRepairItem} {@code Object}.
|
||||
* @param item the item.
|
||||
* @param product the product.
|
||||
* @param cost the cost.
|
||||
*/
|
||||
RepairItem(Item item, Item product, int cost) {
|
||||
this.item = item;
|
||||
this.product = product;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item.
|
||||
* @return The item.
|
||||
*/
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product.
|
||||
* @return The product.
|
||||
*/
|
||||
public Item getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cost.
|
||||
* @return The cost.
|
||||
*/
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reapir item by the id.
|
||||
* @param id the id.
|
||||
* @return the repair item.
|
||||
*/
|
||||
public static RepairItem forId(int id) {
|
||||
for (RepairItem item : RepairItem.values())
|
||||
if (item.item.getId() == id)
|
||||
return item;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
package content.data.consumables;
|
||||
|
||||
import content.data.consumables.effects.*;
|
||||
import core.game.consumable.*;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.state.EntityState;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.data.consumables.effects.KegOfBeerEffect;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* Represents a repository of active consumables in the framework.
|
||||
*/
|
||||
public enum Consumables {
|
||||
|
||||
/** Meats */
|
||||
COOKED_MEAT(new Food(new int[] {2142}, new HealingEffect(3))),
|
||||
SHRIMPS(new Food(new int[] {315}, new HealingEffect(3))),
|
||||
COOKED_CHICKEN(new Food(new int[] {2140}, new HealingEffect(3))),
|
||||
COOKED_RABBIT(new Food(new int[] {3228}, new HealingEffect(5))),
|
||||
ANCHOVIES(new Food(new int[] {319}, new HealingEffect(1))),
|
||||
SARDINE(new Food(new int[] {325}, new HealingEffect(4))),
|
||||
POISON_KARAMBWAN(new Food(new int[] {3146}, new PoisonKarambwanEffect())),
|
||||
UGTHANKI_MEAT(new Food(new int[] {1861}, new HealingEffect(3))),
|
||||
HERRING(new Food(new int[] {347}, new HealingEffect(5))),
|
||||
MACKEREL(new Food(new int[] {355}, new HealingEffect(6))),
|
||||
ROAST_BIRD_MEAT(new Food(new int[] {9980}, new HealingEffect(6))),
|
||||
THIN_SNAIL(new Food(new int[] {3369}, new HealingEffect(5))),
|
||||
TROUT(new Food(new int[] {333}, new HealingEffect(7))),
|
||||
SPIDER_ON_STICK(new Food(new int[] {6297, 6305}, new HealingEffect(7))),
|
||||
SPIDER_ON_SHAFT(new Food(new int[] {6299}, new HealingEffect(7))),
|
||||
ROAST_RABBIT(new Food(new int[] {7223}, new HealingEffect(7))),
|
||||
LEAN_SNAIL(new Food(new int[] {3371}, new HealingEffect(8))),
|
||||
COD(new Food(new int[] {339}, new HealingEffect(7))),
|
||||
PIKE(new Food(new int[] {351}, new HealingEffect(8))),
|
||||
ROAST_BEAST_MEAT(new Food(new int[] {9988}, new HealingEffect(8))),
|
||||
COOKED_CRAB_MEAT(new Food(new int[] {7521, 7523, 7524, 7525, 7526}, new HealingEffect(2))),
|
||||
FAT_SNAIL(new Food(new int[] {3373}, new HealingEffect(9))),
|
||||
SALMON(new Food(new int[] {329}, new HealingEffect(9))),
|
||||
SLIMY_EEL(new Food(new int[] {3381}, new HealingEffect(6))),
|
||||
TUNA(new Food(new int[] {361}, new HealingEffect(10))),
|
||||
COOKED_KARAMBWAN(new Food(new int[] {3144}, new HealingEffect(18))),
|
||||
COOKED_CHOMPY(new Food(new int[] {2878}, new HealingEffect(10))),
|
||||
RAINBOW_FISH(new Food(new int[] {10136}, new HealingEffect(11))),
|
||||
CAVE_EEL(new Food(new int[] {5003}, new HealingEffect(7))),
|
||||
LOBSTER(new Food(new int[] {379}, new HealingEffect(12))),
|
||||
COOKED_JUBBLY(new Food(new int[] {7568}, new HealingEffect(15))),
|
||||
BASS(new Food(new int[] {365}, new HealingEffect(13))),
|
||||
SWORDFISH(new Food(new int[] {373}, new HealingEffect(14))),
|
||||
LAVA_EEL(new Food(new int[] {2149}, new HealingEffect(14))),
|
||||
MONKFISH(new Food(new int[] {7946}, new HealingEffect(16))),
|
||||
SHARK(new Food(new int[] {385}, new HealingEffect(20))),
|
||||
SEA_TURTLE(new Food(new int[] {397}, new HealingEffect(21))),
|
||||
MANTA_RAY(new Food(new int[] {391}, new HealingEffect(22))),
|
||||
KARAMBWANJI(new Food(new int[] {3151}, new HealingEffect(3))),
|
||||
STUFFED_SNAKE(new Food(new int[] {7579}, new HealingEffect(20), "You eat the stuffed snake-it's quite a meal! It tastes like chicken.")),
|
||||
CRAYFISH(new Food(new int[] {13433}, new HealingEffect(2))),
|
||||
GIANT_FROG_LEGS(new Food(new int [] {4517}, new HealingEffect(6))),
|
||||
|
||||
/** Breads */
|
||||
BREAD(new Food(new int[] {2309}, new HealingEffect(5))),
|
||||
BAGUETTE(new Food(new int[] {6961}, new HealingEffect(6))),
|
||||
|
||||
/** Sandwiches */
|
||||
TRIANGLE_SANDWICH(new Food(new int[] {6962}, new HealingEffect(6))),
|
||||
SQUARE_SANDWICH(new Food(new int[] {6965}, new HealingEffect(6))),
|
||||
SEAWEED_SANDWICH(new FakeConsumable(3168, new String[] {"You really, really do not want to eat that."})),
|
||||
FROGBURGER(new Food(new int[] {10962}, new HealingEffect(2))),
|
||||
|
||||
/** Kebabs */
|
||||
UGTHANKI_KEBAB(new Food(new int[] {1883}, new UgthankiKebabEffect())),
|
||||
UGTHANKI_KEBAB_SMELLING(new Food(new int[] {1885}, new SmellingUgthankiKebabEffect())),
|
||||
KEBAB(new Food(new int[] {1971}, new KebabEffect())),
|
||||
SUPER_KEBAB(new Food(new int[] {4608}, new SuperKebabEffect())),
|
||||
|
||||
/** Pies */
|
||||
REDBERRY_PIE(new HalfableFood(new int[] {2325, 2333, 2313}, new HealingEffect(5))),
|
||||
MEAT_PIE(new HalfableFood(new int[] {2327, 2331, 2313}, new HealingEffect(6))),
|
||||
APPLE_PIE(new HalfableFood(new int[] {2323, 2335, 2313}, new HealingEffect(7))),
|
||||
GARDEN_PIE(new HalfableFood(new int[] {7178, 7180, 2313}, new MultiEffect(new HealingEffect(6), new SkillEffect(Skills.FARMING, 3, 0)))),
|
||||
FISH_PIE(new HalfableFood(new int[] {7188, 7190, 2313}, new MultiEffect(new HealingEffect(6), new SkillEffect(Skills.FISHING, 3, 0)))),
|
||||
ADMIRAL_PIE(new HalfableFood(new int[] {7198, 7200, 2313}, new MultiEffect(new HealingEffect(8), new SkillEffect(Skills.FISHING, 5, 0)))),
|
||||
WILD_PIE(new HalfableFood(new int[] {7208, 7210, 2313}, new MultiEffect(new SkillEffect(Skills.SLAYER, 5, 0), new SkillEffect(Skills.RANGE, 4, 0), new HealingEffect(11)))),
|
||||
SUMMER_PIE(new HalfableFood(new int[] {7218, 7220, 2313}, new MultiEffect(new HealingEffect(11), new SkillEffect(Skills.AGILITY, 5, 0), new EnergyEffect(10)))),
|
||||
|
||||
/** Stews */
|
||||
STEW(new Food(new int[] {2003, 1923}, new HealingEffect(11))),
|
||||
SPICY_STEW(new Food(new int[] {7479, 1923}, new HealingEffect(11))),
|
||||
CURRY(new Food(new int[] {2011, 1923}, new HealingEffect(19))),
|
||||
BANANA_STEW(new Food(new int[] {4016, 1923}, new HealingEffect(11))),
|
||||
|
||||
/** Pizzas */
|
||||
PLAIN_PIZZA(new HalfableFood(new int[] {2289, 2291}, new HealingEffect(7))),
|
||||
MEAT_PIZZA(new HalfableFood(new int[] {2293, 2295}, new HealingEffect(8))),
|
||||
ANCHOVY_PIZZA(new HalfableFood(new int[] {2297, 2299}, new HealingEffect(9))),
|
||||
PINEAPPLE_PIZZA(new HalfableFood(new int[] {2301, 2303}, new HealingEffect(11))),
|
||||
|
||||
/** Cakes */
|
||||
CAKE(new Cake(new int[] {1891, 1893, 1895}, new HealingEffect(4), "You eat part of the cake.", "You eat some more cake.", "You eat the slice of cake.")),
|
||||
CHOCOLATE_CAKE(new Cake(new int[] {1897, 1899, 1901}, new HealingEffect(5), "You eat part of the chocolate cake.", "You eat some more of the chocolate cake.", "You eat the slice of cake.")),
|
||||
ROCK_CAKE(new Food(new int[] {2379}, new RockCakeEffect(), "The rock cake resists all attempts to eat it.")),
|
||||
DWARVEN_ROCK_CAKE(new Food(new int[] {7510, 7510}, new DwarvenRockCakeEffect(), "Ow! You nearly broke a tooth!", "The rock cake resists all attempts to eat it.")),
|
||||
HOT_DWARVEN_ROCK_CAKE(new Food(new int[] {7509, 7509}, new DwarvenRockCakeEffect(), "Ow! You nearly broke a tooth!", "The rock cake resists all attempts to eat it.")),
|
||||
COOKED_FISHCAKE(new Food(new int[] {7530}, new HealingEffect(11))),
|
||||
MINT_CAKE(new Food(new int[] {9475}, new EnergyEffect(50))),
|
||||
|
||||
/** Vegetables */
|
||||
POTATO(new Food(new int[] {1942}, new HealingEffect(1))),
|
||||
BAKED_POTATO(new Food(new int[] {6701}, new HealingEffect(2))),
|
||||
SPICY_SAUCE(new Food(new int[] {7072, 1923}, new HealingEffect(2))),
|
||||
CHILLI_CON_CARNE(new Food(new int[] {7062, 1923}, new HealingEffect(5))),
|
||||
SCRAMBLED_EGG(new Food(new int[] {7078, 1923}, new HealingEffect(5))),
|
||||
EGG_AND_TOMATO(new Food(new int[] {7064, 1923}, new HealingEffect(8))),
|
||||
SWEET_CORN(new Food(new int[] {5988}, new MultiEffect(new HealingEffect(1), new PercentageHealthEffect(10)))),
|
||||
SWEETCORN_BOWL(new Food(new int[] {7088, 1923}, new MultiEffect(new HealingEffect(1), new PercentageHealthEffect(10)))),
|
||||
POTATO_WITH_BUTTER(new Food(new int[] {6703}, new HealingEffect(7))),
|
||||
CHILLI_POTATO(new Food(new int[] {7054}, new HealingEffect(14))),
|
||||
FRIED_ONIONS(new Food(new int[] {7084, 1923}, new HealingEffect(5))),
|
||||
FRIED_MUSHROOMS(new Food(new int[] {7082, 1923}, new HealingEffect(5))),
|
||||
POTATO_WITH_CHEESE(new Food(new int[] {6705}, new HealingEffect(16))),
|
||||
EGG_POTATO(new Food(new int[] {7056}, new HealingEffect(11))),
|
||||
MUSHROOMS_AND_ONIONS(new Food(new int[] {7066, 1923}, new HealingEffect(11))),
|
||||
MUSHROOM_POTATO(new Food(new int[] {7058}, new HealingEffect(20))),
|
||||
TUNA_AND_CORN(new Food(new int[] {7068, 1923}, new HealingEffect(13))),
|
||||
TUNA_POTATO(new Food(new int[] {7060}, new HealingEffect(22))),
|
||||
ONION(new Food(new int[] {1957}, new HealingEffect(2), "It's always sad to see a grown man/woman cry.")),
|
||||
CABBAGE(new Food(new int[] {1965}, new HealingEffect(2), "You eat the cabbage. Yuck!")),
|
||||
DRAYNOR_CABBAGE(new Food(new int[] {1967}, new DraynorCabbageEffect(), "You eat the cabbage.", "It seems to taste nicer than normal.")),
|
||||
EVIL_TURNIP(new Food(new int[] {12134, 12136, 12138}, new HealingEffect(6))),
|
||||
SPINACH_ROLL(new Food(new int[] {1969}, new HealingEffect(2))),
|
||||
|
||||
/** Dairies */
|
||||
POT_OF_CREAM(new Food(new int[] {2130}, new HealingEffect(1))),
|
||||
CHEESE(new Food(new int[] {1985}, new HealingEffect(2))),
|
||||
CHOCOLATEY_MILK(new Drink(new int[] {1977, 1925}, new HealingEffect(4))),
|
||||
|
||||
/** Fruits */
|
||||
BANANA(new Food(new int[] {1963}, new HealingEffect(2))),
|
||||
SLICED_BANANA(new Food(new int[] {3162}, new HealingEffect(2))),
|
||||
RED_BANANA(new Food(new int[] {7572}, new HealingEffect(5), "You eat the red banana. It's tastier than your average banana.")),
|
||||
SLICED_RED_BANANA(new Food(new int[] {7574}, new HealingEffect(5), "You eat the sliced red banana. Yum.")),
|
||||
ORANGE(new Food(new int[] {2108}, new HealingEffect(2))),
|
||||
ORANGE_CHUNKS(new Food(new int[] {2110}, new HealingEffect(2))),
|
||||
ORANGE_SLICES(new Food(new int[] {2112}, new HealingEffect(2))),
|
||||
PAPAYA_FRUIT(new Food(new int[] {5972}, new HealingEffect(2))),
|
||||
TENTI_PINEAPPLE(new FakeConsumable(1851, new String[] {"Try using a knife to slice it into pieces."})),
|
||||
PINEAPPLE(new FakeConsumable(2114, new String[] {"Try using a knife to slice it into pieces."})),
|
||||
PINEAPPLE_CHUNKS(new Food(new int[] {2116}, new HealingEffect(2))),
|
||||
PINEAPPLE_RING(new Food(new int[] {2118}, new HealingEffect(2))),
|
||||
DWELLBERRIES(new Food(new int[] {2126}, new HealingEffect(2))),
|
||||
JANGERBERRIES(new Food(new int[] {247}, new MultiEffect(new SkillEffect(Skills.ATTACK, 2, 0), new SkillEffect(Skills.STRENGTH, 1, 0), new PrayerEffect(1, 0), new SkillEffect(Skills.DEFENCE, -1, 0)))),
|
||||
STRAWBERRY(new Food(new int[] {5504}, new MultiEffect(new HealingEffect(1), new PercentageHealthEffect(6)))),
|
||||
TOMATO(new Food(new int[] {1982}, new HealingEffect(2))),
|
||||
WATERMELON(new FakeConsumable(5982, new String[] {"Try using a knife to slice it into pieces."})),
|
||||
WATERMELON_SLICE(new Food(new int[] {5984}, new PercentageHealthEffect(5))),
|
||||
LEMON(new Food(new int[] {2102}, new HealingEffect(2))),
|
||||
LEMON_CHUNKS(new Food(new int[] {2104}, new HealingEffect(2))),
|
||||
LEMON_SLICES(new Food(new int[] {2106}, new HealingEffect(2))),
|
||||
LIME(new Food(new int[] {2120}, new HealingEffect(2))),
|
||||
LIME_CHUNKS(new Food(new int[] {2122}, new HealingEffect(2))),
|
||||
LIME_SLICES(new Food(new int[] {2124}, new HealingEffect(2))),
|
||||
PEACH(new Food(new int[] {6883}, new HealingEffect(8))),
|
||||
WHITE_TREE_FRUIT(new Food(new int[] {6469}, new MultiEffect(new RandomEnergyEffect(5, 10), new HealingEffect(3)))),
|
||||
STRANGE_FRUIT(new Food(new int[] {464}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new EnergyEffect(30)))),
|
||||
|
||||
/** Gnome Cooking */
|
||||
TOAD_CRUNCHIES(new Food(new int[] {2217}, new HealingEffect(12))),
|
||||
PREMADE_TD_CRUNCH(new Food(new int[] {2243}, new HealingEffect(12))),
|
||||
SPICY_CRUNCHIES(new Food(new int[] {2213}, new HealingEffect(7))),
|
||||
PREMADE_SY_CRUNCH(new Food(new int[] {2241}, new HealingEffect(7))),
|
||||
WORM_CRUNCHIES(new Food(new int[] {2205}, new HealingEffect(8))),
|
||||
PREMADE_WM_CRUNC(new Food(new int[] {2237}, new HealingEffect(8))),
|
||||
CHOCCHIP_CRUNCHIES(new Food(new int[] {2209}, new HealingEffect(7))),
|
||||
PREMADE_CH_CRUNCH(new Food(new int[] {2239}, new HealingEffect(7))),
|
||||
FRUIT_BATTA(new Food(new int[] {2277}, new HealingEffect(11))),
|
||||
PREMADE_FRT_BATTA(new Food(new int[] {2225}, new HealingEffect(11))),
|
||||
TOAD_BATTA(new Food(new int[] {2255}, new HealingEffect(11))),
|
||||
PREMADE_TD_BATTA(new Food(new int[] {2221}, new HealingEffect(11))),
|
||||
WORM_BATTA(new Food(new int[] {2253}, new HealingEffect(11))),
|
||||
PREMADE_WM_BATTA(new Food(new int[] {2219}, new HealingEffect(11))),
|
||||
VEGETABLE_BATTA(new Food(new int[] {2281}, new HealingEffect(11))),
|
||||
PREMADE_VEG_BATTA(new Food(new int[] {2227}, new HealingEffect(11))),
|
||||
CHEESE_AND_TOMATOES_BATTA(new Food(new int[] {2259}, new HealingEffect(11))),
|
||||
PREMADE_CT_BATTA(new Food(new int[] {2223}, new HealingEffect(11))),
|
||||
WORM_HOLE(new Food(new int[] {2191}, new HealingEffect(12))),
|
||||
PREMADE_WORM_HOLE(new Food(new int[] {2233}, new HealingEffect(12))),
|
||||
VEG_BALL(new Food(new int[] {2195}, new HealingEffect(12))),
|
||||
PREMADE_VEG_BALL(new Food(new int[] {2235}, new HealingEffect(12))),
|
||||
TANGLED_TOADS_LEGS(new Food(new int[] {2187}, new HealingEffect(15))),
|
||||
PREMADE_TTL(new Food(new int[] {2231}, new HealingEffect(15))),
|
||||
CHOCOLATE_BOMB(new Food(new int[] {2195}, new HealingEffect(15))),
|
||||
PREMADE_CHOC_BOMB(new Food(new int[] {2229}, new HealingEffect(15))),
|
||||
TOAD_LEGS(new Food(new int[] {2152}, new HealingEffect(3))),
|
||||
KING_WORM(new Food(new int[] {2162}, new HealingEffect(2))),
|
||||
|
||||
/** Ales */
|
||||
ASGOLDIAN_ALE(new FakeConsumable(7508, new String[] {"I don't think I'd like gold in beer thanks. Leave it for the dwarves."})),
|
||||
ASGARNIAN_ALE(new Drink(new int[] {1905, 1919}, new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)), "You drink the ale. You feel slightly reinvigorated...", "...and slightly dizzy too.")),
|
||||
ASGARNIAN_ALE_KEG(new Drink(new int[] {5785, 5783, 5781, 5779, 5769}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)), new Animation(2289), "You drink the ale. You feel slightly reinvigorated...", "...and slightly dizzy too.")),
|
||||
ASGARNIAN_ALE_M(new Drink(new int[] {5739, 1919}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)))),
|
||||
ASGARNIAN_ALE_M_KEG(new Drink(new int[] {5865, 5863, 5861, 5859, 5769}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)), new Animation(2289))),
|
||||
AXEMANS_FOLLY(new Drink(new int[] {5751, 1919}, new MultiEffect(new SkillEffect(Skills.WOODCUTTING, 1, 0), new HealingEffect(1), new SkillEffect(Skills.STRENGTH, -3, 0), new SkillEffect(Skills.ATTACK, -3, 0)))),
|
||||
AXEMANS_FOLLY_KEG(new Drink(new int[] {5825, 5823, 5821, 5819, 5769}, new MultiEffect(new SkillEffect(Skills.WOODCUTTING, 1, 0), new HealingEffect(1), new SkillEffect(Skills.STRENGTH, -3, 0), new SkillEffect(Skills.ATTACK, -3, 0)), new Animation(2289))),
|
||||
AXEMANS_FOLLY_M(new Drink(new int[] {5753, 1919}, new MultiEffect(new SkillEffect(Skills.WOODCUTTING, 2, 0), new HealingEffect(2), new SkillEffect(Skills.STRENGTH, -4, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
AXEMANS_FOLLY_M_KEG(new Drink(new int[] {5905, 5903, 5901, 5899, 5769}, new MultiEffect(new SkillEffect(Skills.WOODCUTTING, 2, 0), new HealingEffect(2), new SkillEffect(Skills.STRENGTH, -4, 0), new SkillEffect(Skills.ATTACK, -4, 0)), new Animation(2289))),
|
||||
BANDITS_BREW(new Drink(new int[] {4627, 1919}, new MultiEffect(new SkillEffect(Skills.THIEVING, 1, 0), new SkillEffect(Skills.ATTACK, 1, 0), new SkillEffect(Skills.STRENGTH, -1, 0), new SkillEffect(Skills.DEFENCE, -6, 0), new HealingEffect(1)), "You drink the beer. You feel slightly reinvigorated...", "...and slightly dizzy too.")),
|
||||
BEER(new Drink(new int[] {1917, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 0, 0.04), new SkillEffect(Skills.ATTACK, 0, -0.07)), "You drink the beer. You feel slightly reinvigorated...", "...and slightly dizzy too.")),
|
||||
BEER_TANKARD(new Drink(new int[] {3803, 3805}, new MultiEffect(new SkillEffect(Skills.ATTACK, -9, 0), new SkillEffect(Skills.STRENGTH, 4, 0)), "You quaff the beer. You feel slightly reinvigorated...", "...but very dizzy too.")),
|
||||
KEG_OF_BEER(new Drink(new int[] {3801}, new KegOfBeerEffect(), new Animation(1330), "You chug the keg. You feel reinvigorated...", "...but extremely drunk too.")),
|
||||
CHEFS_DELIGHT(new Drink(new int[] {5755, 1919}, new MultiEffect(new SkillEffect(Skills.COOKING, 1, 0.05), new HealingEffect(1), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)))),
|
||||
CHEFS_DELIGHT_KEG(new Drink(new int[] {5833, 5831, 5829, 5827, 5769}, new MultiEffect(new SkillEffect(Skills.COOKING, 1, 0.05), new HealingEffect(1), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)), new Animation(2289))),
|
||||
CHEFS_DELIGHT_M(new Drink(new int[] {5757, 1919}, new MultiEffect(new SkillEffect(Skills.COOKING, 2, 0.05), new HealingEffect(2), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0)))),
|
||||
CHEFS_DELIGHT_M_KEG(new Drink(new int[] {5913, 5911, 5909, 5907, 5769}, new MultiEffect(new SkillEffect(Skills.COOKING, 2, 0.05), new HealingEffect(2), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0)), new Animation(2289))),
|
||||
CIDER(new Drink(new int[] {5763, 1919}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 1, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0))))),
|
||||
CIDER_KEG(new Drink(new int[] {5849, 5847, 5845, 5843, 5769}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 1, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0))), new Animation(2289))),
|
||||
MATURE_CIDER(new Drink(new int[] {5765, 1919}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 2, 0), new SkillEffect(Skills.ATTACK, -5, 0), new SkillEffect(Skills.STRENGTH, -5, 0))))),
|
||||
CIDER_M_KEG(new Drink(new int[] {5929, 5927, 5925, 5923, 5769}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 2, 0), new SkillEffect(Skills.ATTACK, -5, 0), new SkillEffect(Skills.STRENGTH, -5, 0))), new Animation(2289))),
|
||||
DRAGON_BITTER(new Drink(new int[] {1911, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
DRAGON_BITTER_KEG(new Drink(new int[] {5809, 5807, 5805, 5803, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)), new Animation(2289))),
|
||||
DRAGON_BITTER_M(new Drink(new int[] {5745, 1919}, new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)))),
|
||||
DRAGON_BITTER_M_KEG(new Drink(new int[] {5889, 5887, 5885, 5883, 5769}, new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)), new Animation(2289))),
|
||||
DWARVEN_STOUT(new Drink(new int[] {1913, 1919}, new MultiEffect(new SkillEffect(Skills.MINING, 1, 0), new SkillEffect(Skills.SMITHING, 1 ,0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0), new SkillEffect(Skills.DEFENCE, -2, 0), new HealingEffect(1)), "You drink the Dwarven Stout. It tastes foul.", "It tastes pretty strong too.")),
|
||||
DWARVEN_STOUT_KEG(new Drink(new int[] {5777, 5775, 5773, 5771, 5769}, new MultiEffect(new SkillEffect(Skills.MINING, 1, 0), new SkillEffect(Skills.SMITHING, 1 ,0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0), new SkillEffect(Skills.DEFENCE, -2, 0), new HealingEffect(1)), new Animation(2289), "You drink the Dwarven Stout. It tastes foul.", "It tastes pretty strong too.")),
|
||||
DWARVEN_STOUT_M(new Drink(new int[] {5747, 1919}, new MultiEffect(new SkillEffect(Skills.MINING, 2, 0), new SkillEffect(Skills.SMITHING, 2 ,0), new SkillEffect(Skills.ATTACK, -7, 0), new SkillEffect(Skills.STRENGTH, -7, 0), new SkillEffect(Skills.DEFENCE, -7, 0), new HealingEffect(1)))),
|
||||
DWARVEN_STOUT_M_KEG(new Drink(new int[] {5857, 5855, 5853, 5851, 5769}, new MultiEffect(new SkillEffect(Skills.MINING, 2, 0), new SkillEffect(Skills.SMITHING, 2 ,0), new SkillEffect(Skills.ATTACK, -7, 0), new SkillEffect(Skills.STRENGTH, -7, 0), new SkillEffect(Skills.DEFENCE, -7, 0), new HealingEffect(1)), new Animation(2289))),
|
||||
GREENMANS_ALE(new Drink(new int[] {1909, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 1, 0), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0), new SkillEffect(Skills.DEFENCE, -3, 0)))),
|
||||
GREENMANS_ALE_KEG(new Drink(new int[] {5793, 5791, 5789, 5787, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 1, 0), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0), new SkillEffect(Skills.DEFENCE, -3, 0)), new Animation(2289))),
|
||||
GREENMANS_ALE_M(new Drink(new int[] {5743, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 2, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)))),
|
||||
GREENMANS_ALE_M_KEG(new Drink(new int[] {5873, 5871, 5869, 5867, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 2, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)), new Animation(2289))),
|
||||
GROG(new Drink(new int[] {1915, 1919}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)))),
|
||||
MOONLIGHT_MEAD(new Drink(new int[] {2955, 1919}, new HealingEffect(4), "It tastes like something just died in your mouth.")),
|
||||
MOONLIGHT_MEAD_KEG(new Drink(new int[] {5817, 5815, 5813, 5811, 5769}, new HealingEffect(4), new Animation(2289), "It tastes like something just died in your mouth.")),
|
||||
MOONLIGHT_MEAD_M(new Drink(new int[] {5749, 1919}, new HealingEffect(6))),
|
||||
MOONLIGHT_MEAD_M_KEG(new Drink(new int[] {5897, 5895, 5893, 5891, 5769}, new HealingEffect(6), new Animation(2289))),
|
||||
SLAYERS_RESPITE(new Drink(new int[] {5759, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.SLAYER, 2, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)))),
|
||||
SLAYERS_RESPITE_KEG(new Drink(new int[] {5841, 5839, 5837, 5835, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.SLAYER, 2, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)), new Animation(2289))),
|
||||
SLAYERS_RESPITE_M(new Drink(new int[] {5761, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.SLAYER, 4, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)))),
|
||||
SLAYERS_RESPITE_M_KEG(new Drink(new int[] {5841, 5839, 5837, 5835, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.SLAYER, 4, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)), new Animation(2289))),
|
||||
WIZARDS_MIND_BOMB(new Drink(new int[] {1907, 1919}, new WizardsMindBombEffect(), "You drink the Wizard's Mind Bomb.", "You feel very strange.")),
|
||||
MATURE_WMB(new Drink(new int[] {5741, 1919}, new MatureWmbEffect())),
|
||||
|
||||
/** Cocktails */
|
||||
FRUIT_BLAST(new Drink(new int[] {2084, 2026}, new HealingEffect(9))),
|
||||
PREMADE_FR_BLAST(new Food(new int[] {2034, 2026}, new HealingEffect(9))),
|
||||
PINEAPPLE_PUNCH(new Drink(new int[] {2048, 2026}, new HealingEffect(9), "You drink the cocktail. It tastes great.")),
|
||||
PREMADE_P_PUNCH(new Drink(new int[] {2036, 2026}, new HealingEffect(9), "You drink the cocktail. It tastes great.")),
|
||||
WIZARD_BLIZZARD(new Drink(new int[] {2054, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 6, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
PREMADE_WIZ_BLZD(new Drink(new int[] {2040, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 6, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
SHORT_GREEN_GUY(new Drink(new int[] {2080, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 4, 0), new SkillEffect(Skills.ATTACK, -3, 0)))),
|
||||
PREMADE_SGG(new Drink(new int[] {2038, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 4, 0), new SkillEffect(Skills.ATTACK, -3, 0)))),
|
||||
DRUNK_DRAGON(new Drink(new int[] {2092, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 7, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
PREMADE_DR_DRAGON(new Drink(new int[] {2032, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 7, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
CHOC_SATURDAY(new Drink(new int[] {2074, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 7, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
PREMADE_CHOC_SDY(new Drink(new int[] {2030, 2026}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 7, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
BLURBERRY_SPECIAL(new Drink(new int[] {2064, 2026}, new MultiEffect(new HealingEffect(6), new SkillEffect(Skills.STRENGTH, 6, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
PREMADE_BLURB_SP(new Drink(new int[] {2028, 2026}, new MultiEffect(new HealingEffect(6), new SkillEffect(Skills.STRENGTH, 6, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
|
||||
/** Bottled Drinks */
|
||||
KARAMJAN_RUM(new Drink(new int[] {431}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 5, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
BRAINDEATH_RUM(new Drink(new int[] {7157}, new MultiEffect(new SkillEffect(Skills.DEFENCE, 0, -0.1), new SkillEffect(Skills.ATTACK, 0, -0.05), new SkillEffect(Skills.PRAYER, 0, -0.05), new SkillEffect(Skills.RANGE, 0, -0.05), new SkillEffect(Skills.MAGIC, 0, -0.05), new SkillEffect(Skills.HERBLORE, 0, -0.05), new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.MINING, 1, 0)), "With a sense of impending doom you drink the 'rum'. You try very hard not to die.")),
|
||||
RUM_TROUBLE_BREWING_RED(new Drink(new int[] {8940, 8940}, new TroubleBrewingRumEffect("Oh gods! It tastes like burning!"), new Animation(9605))),
|
||||
RUM_TROUBLE_BREWING_BLUE(new Drink(new int[] {8941, 8941}, new TroubleBrewingRumEffect("My Liver! My Liver is melting!"), new Animation(9604))),
|
||||
VODKA(new Drink(new int[] {2015}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -3, 0)))),
|
||||
GIN(new Drink(new int[] {2019}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 1, 0), new SkillEffect(Skills.ATTACK, 4, 0), new RandomHealthEffect(3, 4)))),
|
||||
BRANDY(new Drink(new int[] {2021}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.ATTACK, 4, 0)))),
|
||||
WHISKY(new Drink(new int[] {2017}, new MultiEffect(new HealingEffect(5), new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -4, 0)))),
|
||||
BOTTLE_OF_WINE(new Drink(new int[] {2015, 7921}, new MultiEffect(new HealingEffect(14), new SkillEffect(Skills.ATTACK, -3, 0)))),
|
||||
|
||||
/** Wine */
|
||||
JUG_OF_WINE(new Drink(new int[] {1993, 1935}, new MultiEffect(new HealingEffect(11), new SkillEffect(Skills.ATTACK, -2, 0)))),
|
||||
HALF_FULL_WINE_JUG(new Drink(new int[] {1989, 1935}, new HealingEffect(7))),
|
||||
|
||||
/** Tea */
|
||||
CUP_OF_TEA(new Drink(new int[] {712, 1980}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 3, 0)), "Aaah, nothing like a nice cuppa tea!")),
|
||||
CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new EnergyEffect(10))),
|
||||
CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new EnergyEffect(10))),
|
||||
NETTLE_TEA(new Drink(new int[] {4239, 1980}, new NettleTeaEffect())),
|
||||
NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1980}, new NettleTeaEffect())),
|
||||
CUP_OF_TEA_CLAY(new Drink(new int[] {7730, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")),
|
||||
CUP_OF_TEA_CLAY_MILKY(new Drink(new int[] {7731, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0))),
|
||||
CUP_OF_TEA_WHITE(new Drink(new int[] {7733, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0), "You feel refreshed and ready for more building.")),
|
||||
CUP_OF_TEA_WHITE_MILKY(new Drink(new int[] {7734, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0))),
|
||||
CUP_OF_TEA_GOLD(new Drink(new int[] {7736, 7735}, new SkillEffect(Skills.CONSTRUCTION, 3, 0), "You feel refreshed and ready for more building.")),
|
||||
CUP_OF_TEA_GOLD_MILKY(new Drink(new int[] {7737, 7735}, new SkillEffect(Skills.CONSTRUCTION, 3, 0))),
|
||||
|
||||
/** Miscellaneous */
|
||||
CHOCOLATE_BAR(new Food(new int[] {1973}, new HealingEffect(3))),
|
||||
PURPLE_SWEETS(new Food(new int[] {4561}, new HealingEffect(0))),
|
||||
PURPLE_SWEETS_STACKABLE(new Food(new int[] {10476}, new MultiEffect(new EnergyEffect(10), new RandomHealthEffect(1, 3)), "The sugary goodness heals some energy.", "The sugary goodness is yummy.")),
|
||||
FIELD_RATION(new Food(new int[] {7934}, new HealingEffect(10))),
|
||||
ROLL(new Food(new int[] {6963}, new HealingEffect(6))),
|
||||
TCHIKI_MONKEY_NUTS(new Food(new int[] {7573}, new HealingEffect(5), "You eat the Tchiki monkey nuts. They taste nutty.")),
|
||||
TCHIKI_MONKEY_PASTE(new Food(new int[] {7575}, new HealingEffect(5), "You eat the Tchiki monkey nut paste. It sticks to the roof of your mouth.")),
|
||||
OOMLIE_WRAP(new Food(new int[] {Items.COOKED_OOMLIE_WRAP_2343}, new MultiEffect(new HealingEffect(14), new AchievementEffect(DiaryType.KARAMJA, 2, 2)))),
|
||||
ROE(new Food(new int[]{11324}, new HealingEffect(3))),
|
||||
EQUA_LEAVES(new Food(new int[]{2128}, new HealingEffect(1))),
|
||||
CHOC_ICE(new Food(new int[]{6794}, new HealingEffect(6))),
|
||||
EDIBLE_SEAWEED(new Food(new int[] {403}, new HealingEffect(4))),
|
||||
|
||||
/** Special Events */
|
||||
PUMPKIN(new Food(new int[] {1959}, new HealingEffect(14))),
|
||||
EASTER_EGG(new Food(new int[] {1961}, new HealingEffect(14))),
|
||||
|
||||
/** Potions */
|
||||
STRENGTH(new Potion(new int[] {113, 115, 117, 119}, new SkillEffect(Skills.STRENGTH, 3, 0.1))),
|
||||
ATTACK(new Potion(new int[] {2428, 121, 123, 125}, new SkillEffect(Skills.ATTACK, 3, 0.1))),
|
||||
DEFENCE(new Potion(new int[] {2432, 133, 135, 137}, new SkillEffect(Skills.DEFENCE, 3, 0.1))),
|
||||
RANGING(new Potion(new int[] {2444, 169, 171, 173}, new SkillEffect(Skills.RANGE, 3, 0.1))),
|
||||
MAGIC(new Potion(new int[] {3040, 3042, 3044, 3046}, new SkillEffect(Skills.MAGIC, 3, 0.1))),
|
||||
SUPER_STRENGTH(new Potion(new int[] {2440, 157, 159, 161}, new SkillEffect(Skills.STRENGTH, 3, 0.2))),
|
||||
SUPER_ATTACK(new Potion(new int[] {2436, 145, 147, 149}, new SkillEffect(Skills.ATTACK, 3, 0.2))),
|
||||
SUPER_DEFENCE(new Potion(new int[] {2442, 163, 165, 167}, new SkillEffect(Skills.DEFENCE, 3, 0.2))),
|
||||
ANTIPOISON(new Potion(new int[] {2446, 175, 177, 179}, new MultiEffect(new SetAttributeEffect("poison:immunity", 143), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
|
||||
ANTIPOISON_(new Potion(new int[] {5943, 5945, 5947, 5949}, new MultiEffect(new SetAttributeEffect("poison:immunity", 863), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
|
||||
ANTIPOISON__(new Potion(new int[] {5952, 5954, 5956, 5958}, new MultiEffect(new SetAttributeEffect("poison:immunity", 2000), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
|
||||
SUPER_ANTIP(new Potion(new int[] {2448, 181, 183, 185}, new MultiEffect(new SetAttributeEffect("poison:immunity", 1000), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
|
||||
RELICYM(new Potion(new int[] {4842, 4844, 4846, 4848}, new MultiEffect(new SetAttributeEffect("disease:immunity", 300), new RemoveStateEffect("disease")))),
|
||||
AGILITY(new Potion(new int[] {3032, 3034, 3036, 3038}, new SkillEffect(Skills.AGILITY, 3, 0))),
|
||||
HUNTER(new Potion(new int[] {9998, 10000, 10002, 10004}, new SkillEffect(Skills.HUNTER, 3, 0))),
|
||||
RESTORE(new Potion(new int[] {2430, 127, 129, 131}, new RestoreEffect(10, 0.3))),
|
||||
SARA_BREW(new Potion(new int[] {6685, 6687, 6689, 6691}, new MultiEffect(new PercentHeal(2, .15), new SkillEffect(Skills.ATTACK, 0, -0.10), new SkillEffect(Skills.STRENGTH, 0, -0.10), new SkillEffect(Skills.MAGIC, 0, -0.10), new SkillEffect(Skills.RANGE, 0, -0.10), new SkillEffect(Skills.DEFENCE, 2, 0.2)))),
|
||||
SUMMONING(new Potion(new int[] {12140, 12142, 12144, 12146}, new MultiEffect(new RestoreSummoningSpecial(), new SummoningEffect(7, 0.25)))),
|
||||
COMBAT(new Potion(new int[] {9739, 9741, 9743, 9745}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, .1), new SkillEffect(Skills.ATTACK, 3, .1)))),
|
||||
ENERGY(new Potion(new int[] {3008, 3010, 3012, 3014}, new MultiEffect(new EnergyEffect(10), new HealingEffect(3)))),
|
||||
FISHING(new Potion(new int[] {2438, 151, 153, 155}, new SkillEffect(Skills.FISHING, 3, 0))),
|
||||
PRAYER(new Potion(new int[] {2434, 139, 141, 143}, new PrayerEffect(7, 0.25))),
|
||||
SUPER_RESTO(new Potion(new int[] {3024, 3026, 3028, 3030}, new MultiEffect(new RestoreEffect(8, 0.25), new PrayerEffect(8, 0.25), new SummoningEffect(8, 0.25)))),
|
||||
ZAMMY_BREW(new Potion(new int[] {2450, 189, 191, 193}, new MultiEffect(new DamageEffect(10, true), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
|
||||
ANTIFIRE(new Potion(new int[] {2452, 2454, 2456, 2458}, new SetAttributeEffect("fire:immune", 600, true))),
|
||||
GUTH_REST(new Potion(new int[] {4417, 4419, 4421, 4423}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new EnergyEffect(5), new HealingEffect(5)))),
|
||||
MAGIC_ESS(new Potion(new int[] {11491, 11489}, new SkillEffect(Skills.MAGIC,3,0))),
|
||||
SANFEW(new Potion(new int[] {10925, 10927, 10929, 10931}, new MultiEffect(new RestoreEffect(8,0.25), new PrayerEffect(8,0.25), new RemoveStateEffect(EntityState.POISONED.ordinal()), new RemoveStateEffect("disease")))),
|
||||
SUPER_ENERGY(new Potion(new int[] {3016, 3018, 3020, 3022}, new EnergyEffect(20))),
|
||||
BLAMISH_OIL(new FakeConsumable(1582, new String[] {"You know... I'd really rather not."})),
|
||||
|
||||
/** Barbarian Mixes */
|
||||
PRAYERMIX(new BarbarianMix(new int[] {11465, 11467}, new MultiEffect(new PrayerEffect(7, 0.25), new HealingEffect(6)))),
|
||||
ZAMMY_MIX(new BarbarianMix(new int[] {11521, 11523}, new MultiEffect(new DamageEffect(10, true), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
|
||||
ATT_MIX(new BarbarianMix(new int[] {11429, 11431}, new MultiEffect(new SkillEffect(Skills.ATTACK, 3, 0.1), new HealingEffect(3)))),
|
||||
ANTIP_MIX(new BarbarianMix(new int[] {11433, 11435}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new SetAttributeEffect("poison:immunity", 143), new HealingEffect(3)))),
|
||||
RELIC_MIX(new BarbarianMix(new int[] {11437, 11439}, new MultiEffect(new RemoveStateEffect("disease"), new SetAttributeEffect("disease:immunity", 300), new HealingEffect(3)))),
|
||||
STR_MIX(new BarbarianMix(new int[] {11443, 11441}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0.1), new HealingEffect(3)))),
|
||||
RESTO_MIX(new BarbarianMix(new int[] {11449, 11451}, new MultiEffect(new RestoreEffect(10, 0.3), new HealingEffect(3)))),
|
||||
ENERGY_MIX(new BarbarianMix(new int[] {11453, 11455}, new MultiEffect(new EnergyEffect(10), new HealingEffect(6)))),
|
||||
DEF_MIX(new BarbarianMix(new int[] {11457, 11459}, new MultiEffect(new SkillEffect(Skills.DEFENCE, 3, 0.1), new HealingEffect(6)))),
|
||||
AGIL_MIX(new BarbarianMix(new int[] {11461, 11463}, new MultiEffect(new SkillEffect(Skills.AGILITY, 3, 0), new HealingEffect(6)))),
|
||||
COMBAT_MIX(new BarbarianMix(new int[] {11445, 11447}, new MultiEffect(new SkillEffect(Skills.ATTACK, 3, 0.1), new SkillEffect(Skills.STRENGTH, 3, 0.1), new HealingEffect(6)))),
|
||||
SUPER_ATT_MIX(new BarbarianMix(new int[] {11469, 11471}, new MultiEffect(new SkillEffect(Skills.ATTACK, 5, 0.15), new HealingEffect(6)))),
|
||||
FISH_MIX(new BarbarianMix(new int[] {11477, 11479}, new MultiEffect(new SkillEffect(Skills.FISHING, 3, 0), new HealingEffect(6)))),
|
||||
SUPER_ENERGY_MIX(new BarbarianMix(new int[] {11481, 11483}, new MultiEffect(new EnergyEffect(20), new HealingEffect(6)))),
|
||||
HUNTING_MIX(new BarbarianMix(new int[] {11517, 11519}, new MultiEffect(new SkillEffect(Skills.HUNTER, 3, 0), new HealingEffect(6)))),
|
||||
SUPER_STR_MIX(new BarbarianMix(new int[] {11485, 11487}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 5, 0.15), new HealingEffect(6)))),
|
||||
|
||||
/** Stealing creation potions */
|
||||
SC_PRAYER(new Potion(new int[] {14207, 14209, 14211, 14213, 14215}, new PrayerEffect(7, 0.25))),
|
||||
SC_ENERGY(new Potion(new int[] {14217, 14219, 14221, 14223, 14225}, new EnergyEffect(20))),
|
||||
SC_ATTACK(new Potion(new int[] {14227, 14229, 14231, 14233, 14235}, new SkillEffect(Skills.ATTACK, 3, 0.2))),
|
||||
SC_STRENGTH(new Potion(new int[] {14237, 14239, 14241, 14243, 14245}, new SkillEffect(Skills.STRENGTH, 3, 0.2))),
|
||||
SC_RANGE(new Potion(new int[] {14247, 14249, 14251, 14253, 14255}, new SkillEffect(Skills.RANGE, 3, 0.1))),
|
||||
SC_DEFENCE(new Potion(new int[] {14257, 14259, 14261, 14263, 14265}, new SkillEffect(Skills.DEFENCE, 3, 0.1))),
|
||||
SC_MAGIC(new Potion(new int[] {14267, 14269, 14271, 14273, 14275}, new SkillEffect(Skills.MAGIC, 3, 0.1))),
|
||||
SC_SUMMONING(new Potion(new int[] {14277, 14279, 14281, 14283, 14285}, new SummoningEffect(7, 0.25)));
|
||||
|
||||
public static HashMap<Integer,Consumable> consumables = new HashMap<>();
|
||||
|
||||
private final Consumable consumable;
|
||||
|
||||
Consumables(Consumable consumable) {
|
||||
this.consumable = consumable;
|
||||
}
|
||||
|
||||
public Consumable getConsumable() {
|
||||
return consumable;
|
||||
}
|
||||
|
||||
public static Consumable getConsumableById(final int itemId) {
|
||||
return consumables.get(itemId);
|
||||
}
|
||||
|
||||
public static void add(final Consumable consumable) {
|
||||
for (int id : consumable.getIds()) {
|
||||
consumables.putIfAbsent(id, consumable);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Static modifier used to populate search engine lists.
|
||||
*/
|
||||
static {
|
||||
for (Consumables consumable : Consumables.values()) {
|
||||
add(consumable.consumable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
|
||||
public class AchievementEffect extends ConsumableEffect {
|
||||
private final DiaryType diary;
|
||||
private final int level;
|
||||
private final int task;
|
||||
public AchievementEffect(DiaryType diary, int level, int task) {
|
||||
this.diary = diary;
|
||||
this.level = level;
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
p.getAchievementDiaryManager().finishTask(p, diary, level, task);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.combat.ImpactHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class DamageEffect extends ConsumableEffect {
|
||||
final double amt;
|
||||
final boolean isPercent;
|
||||
|
||||
public DamageEffect(double amt,boolean isPercent){
|
||||
this.amt = amt;
|
||||
this.isPercent = isPercent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
p.getImpactHandler().manualHit(p,-getHealthEffectValue(p), ImpactHandler.HitsplatType.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
double amount = amt;
|
||||
if (isPercent) {
|
||||
amount /= 100;
|
||||
return (int) -(amount * player.getSkills().getLifepoints());
|
||||
}
|
||||
return (int) -amt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
public class DraynorCabbageEffect extends ConsumableEffect {
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final HealingEffect effect = new HealingEffect(getHealthEffectValue(p));
|
||||
effect.activate(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return player.getSkills().getLevel(Skills.DEFENCE) > 50 ? 3 : 4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class DwarvenRockCakeEffect extends ConsumableEffect {
|
||||
|
||||
private static final DamageEffect effect = new DamageEffect(1, false);
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if (p.getSkills().getLifepoints() > 2) {
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return player.getSkills().getLifepoints() > 2 ? -1 : 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class EnergyEffect extends ConsumableEffect {
|
||||
double amt;
|
||||
public EnergyEffect(int amt){
|
||||
this.amt = amt;
|
||||
}
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
p.getSettings().updateRunEnergy(-amt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
|
||||
public class HealingEffect extends ConsumableEffect {
|
||||
int amt;
|
||||
public HealingEffect(int amount){
|
||||
this.amt = amount;
|
||||
}
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
p.getSkills().heal(amt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return amt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
/**
|
||||
* According to the OSRS wiki, a kebab has the following possible outcomes:
|
||||
* 66% chance to heal 10% of total Hitpoints level, rounded down. Accompanied with the message "It heals some health."
|
||||
* 21% chance to heal 10–20 Hitpoints. Accompanied with the message "That was a good kebab. You feel a lot better."
|
||||
* 9% chance to heal nothing. Accompanied with the message "That kebab didn't seem to do a lot."
|
||||
* In addition, there is a chance that a non-combat skill is lowered by 3 (with the message "That tasted a bit dodgy. You feel a bit ill."), or that melee skills are lowered by 3 (with the message "That tasted very dodgy. You feel very ill.").
|
||||
* 4% chance to heal 30 Hitpoints and gain 1–3 levels in Attack, Strength and Defence. Accompanied with the message "Wow, that was an amazing kebab! You feel really invigorated."
|
||||
*/
|
||||
public class KebabEffect extends ConsumableEffect {
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final int randomNumber = RandomFunction.nextInt(100);
|
||||
ConsumableEffect effect;
|
||||
String message;
|
||||
if (randomNumber < 66) {
|
||||
effect = new PercentageHealthEffect(10);
|
||||
final int initialLifePoints = p.getSkills().getLifepoints();
|
||||
effect.activate(p);
|
||||
if (p.getSkills().getLifepoints() > initialLifePoints) {
|
||||
message = "It heals some health.";
|
||||
p.getPacketDispatch().sendMessage(message);
|
||||
}
|
||||
} else if (randomNumber < 87) {
|
||||
effect = new RandomHealthEffect(10, 20);
|
||||
effect.activate(p);
|
||||
message = "That was a good kebab. You feel a lot better.";
|
||||
p.getPacketDispatch().sendMessage(message);
|
||||
} else if (randomNumber < 96) {
|
||||
if (RandomFunction.nextInt(100) < 50) { // As the probability of lowering by 3 a non-combat skill or all melee skills is not specified, 50% is the percentage that was chosen.
|
||||
final int affectedSkillSlot = RandomFunction.nextInt(Skills.NUM_SKILLS - 1);
|
||||
switch (affectedSkillSlot) {
|
||||
case Skills.ATTACK:
|
||||
case Skills.DEFENCE:
|
||||
case Skills.STRENGTH:
|
||||
effect = new MultiEffect(new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.DEFENCE, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0));
|
||||
break;
|
||||
default:
|
||||
effect = new SkillEffect(affectedSkillSlot, -3, 0);
|
||||
}
|
||||
message = "That tasted a bit dodgy. You feel a bit ill.";
|
||||
p.getPacketDispatch().sendMessage(message);
|
||||
effect.activate(p);
|
||||
} else {
|
||||
message = "That kebab didn't seem to do a lot.";
|
||||
p.getPacketDispatch().sendMessage(message);
|
||||
}
|
||||
} else {
|
||||
effect = new MultiEffect(new HealingEffect(30), new RandomSkillEffect(Skills.ATTACK, 1, 3), new RandomSkillEffect(Skills.DEFENCE, 1, 3), new RandomSkillEffect(Skills.STRENGTH, 1, 3));
|
||||
effect.activate(p);
|
||||
message = "Wow, that was an amazing kebab! You feel really invigorated.";
|
||||
p.getPacketDispatch().sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package content.data.consumables.effects
|
||||
|
||||
import core.game.consumable.ConsumableEffect
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.skill.Skills
|
||||
|
||||
|
||||
class KegOfBeerEffect : ConsumableEffect() {
|
||||
|
||||
override fun activate(p: Player?) {
|
||||
val effect = MultiEffect(HealingEffect(15), SkillEffect(Skills.STRENGTH, 10.0, 0.0), SkillEffect(Skills.ATTACK, -40.0, 0.0))
|
||||
effect.activate(p)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
public class MatureWmbEffect extends ConsumableEffect {
|
||||
|
||||
private final static int healing = 1;
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final int magicLevelBoost = p.getSkills().getLevel(Skills.MAGIC) > 50 ? 4 : 3;
|
||||
final MultiEffect effect = new MultiEffect(new SkillEffect(Skills.MAGIC, magicLevelBoost, 0), new HealingEffect(healing), new SkillEffect(Skills.ATTACK, -5, 0), new SkillEffect(Skills.STRENGTH, -5, 0), new SkillEffect(Skills.DEFENCE, -5, 0));
|
||||
effect.activate(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return healing;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class MultiEffect extends ConsumableEffect {
|
||||
private ConsumableEffect[] effects;
|
||||
public MultiEffect(ConsumableEffect... effects){
|
||||
this.effects = effects;
|
||||
}
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
for(ConsumableEffect e : effects){
|
||||
e.activate(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
int healing = 0;
|
||||
for (ConsumableEffect effect : effects) {
|
||||
healing += effect.getHealthEffectValue(player);
|
||||
}
|
||||
return healing;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class NettleTeaEffect extends ConsumableEffect {
|
||||
|
||||
private final static int healing = 3;
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final ConsumableEffect effect = p.getSkills().getLifepoints() < p.getSkills().getMaximumLifepoints() ? new MultiEffect(new HealingEffect(3), new EnergyEffect(5)) : new HealingEffect(3);
|
||||
effect.activate(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return healing;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class PercentHeal extends ConsumableEffect {
|
||||
int base = 0;
|
||||
double percent = 0.0;
|
||||
|
||||
public PercentHeal(int base, double percent){
|
||||
this.base = base;
|
||||
this.percent = percent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
int maxHp = p.getSkills().getMaximumLifepoints();
|
||||
int curHp = p.getSkills().getLifepoints();
|
||||
int amount = (int) Math.floor(maxHp * percent);
|
||||
amount = base + Math.min(amount, (int)((1.0 + percent) * (double)maxHp - (double)curHp));
|
||||
p.getSkills().healNoRestrictions(amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
|
||||
public class PercentageHealthEffect extends ConsumableEffect {
|
||||
|
||||
private final double percentage;
|
||||
|
||||
public PercentageHealthEffect(final int percentage) {
|
||||
this.percentage = percentage * 0.01;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final HealingEffect effect = new HealingEffect(getHealthEffectValue(p));
|
||||
effect.activate(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return (int) (player.getSkills().getMaximumLifepoints() * percentage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.combat.ImpactHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class PoisonEffect extends ConsumableEffect {
|
||||
|
||||
private final int amount;
|
||||
|
||||
public PoisonEffect(final int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
p.getImpactHandler().manualHit(p, amount, ImpactHandler.HitsplatType.POISON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return -amount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class PoisonKarambwanEffect extends ConsumableEffect {
|
||||
|
||||
private final PoisonEffect effect = new PoisonEffect(5);
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if (p.getSkills().getLifepoints() > 5) {
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
public class PrayerEffect extends ConsumableEffect {
|
||||
double base, bonus;
|
||||
public PrayerEffect(double base, double bonus){
|
||||
this.base = base;
|
||||
this.bonus = bonus;
|
||||
}
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
int level = p.getSkills().getStaticLevel(Skills.PRAYER);
|
||||
double amt = base + (level * bonus);
|
||||
p.getSkills().incrementPrayerPoints(amt);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
public class RandomEnergyEffect extends ConsumableEffect {
|
||||
|
||||
private final int a, b;
|
||||
|
||||
public RandomEnergyEffect(final int a, final int b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final EnergyEffect effect = new EnergyEffect(RandomFunction.random(a, b));
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
public class RandomHealthEffect extends ConsumableEffect {
|
||||
|
||||
private final int a, b;
|
||||
|
||||
public RandomHealthEffect(final int a, final int b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
ConsumableEffect effect;
|
||||
final int healthEffectValue = getHealthEffectValue(p);
|
||||
if (healthEffectValue > 0) {
|
||||
effect = new HealingEffect(healthEffectValue);
|
||||
} else {
|
||||
effect = new DamageEffect(healthEffectValue, false);
|
||||
}
|
||||
effect.activate(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return RandomFunction.random(a, b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
|
||||
public class RandomPrayerEffect extends ConsumableEffect {
|
||||
|
||||
private final int a, b;
|
||||
|
||||
public RandomPrayerEffect(final int a, final int b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final PrayerEffect effect = new PrayerEffect(RandomFunction.random(a, b), 0);
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
public class RandomSkillEffect extends ConsumableEffect {
|
||||
|
||||
private final int skillSlot, a, b;
|
||||
|
||||
public RandomSkillEffect(final int skillSlot, final int a, final int b) {
|
||||
this.skillSlot = skillSlot;
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final SkillEffect effect = new SkillEffect(skillSlot, RandomFunction.random(a, b), 0);
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.state.EntityState;
|
||||
|
||||
public class RemoveStateEffect extends ConsumableEffect {
|
||||
int state = -1;
|
||||
String statekey;
|
||||
@Deprecated
|
||||
public RemoveStateEffect(int state){
|
||||
this.state = state;
|
||||
}
|
||||
public RemoveStateEffect(String key){
|
||||
statekey = key;
|
||||
}
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if(state == -1){
|
||||
p.clearState(statekey);
|
||||
return;
|
||||
}
|
||||
p.getStateManager().remove(EntityState.values()[state]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
public class RestoreEffect extends ConsumableEffect {
|
||||
double base,bonus;
|
||||
public RestoreEffect(double base, double bonus){
|
||||
this.base = base;
|
||||
this.bonus = bonus;
|
||||
}
|
||||
final int[] SKILLS = new int[] { Skills.DEFENCE, Skills.ATTACK, Skills.STRENGTH, Skills.MAGIC, Skills.RANGE };
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
Skills sk = p.getSkills();
|
||||
for(int skill : SKILLS){
|
||||
int statL = sk.getStaticLevel(skill);
|
||||
int curL = sk.getLevel(skill);
|
||||
if(curL < statL){
|
||||
int boost = (int) (base + (statL * bonus));
|
||||
p.getSkills().updateLevel(skill, boost, statL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package content.data.consumables.effects
|
||||
|
||||
import core.game.consumable.ConsumableEffect
|
||||
import core.game.node.entity.player.Player
|
||||
|
||||
class RestoreSummoningSpecial : ConsumableEffect(){
|
||||
override fun activate(p: Player) {
|
||||
val f = p.familiarManager.familiar
|
||||
f?.updateSpecialPoints(-15)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class RockCakeEffect extends ConsumableEffect {
|
||||
|
||||
private static final DamageEffect effect = new DamageEffect(10, true);
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if (p.getSkills().getLifepoints() > 1) {
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return (int) (player.getSkills().getLifepoints() * -0.1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.GameWorld;
|
||||
|
||||
public class SetAttributeEffect extends ConsumableEffect {
|
||||
String attrString;
|
||||
Object attrValue;
|
||||
boolean isTicks;
|
||||
|
||||
public SetAttributeEffect(String attr, Object value, boolean isTicks){
|
||||
this.attrString = attr;
|
||||
this.attrValue = value;
|
||||
this.isTicks = isTicks;
|
||||
}
|
||||
|
||||
public SetAttributeEffect(String attr, Object value){
|
||||
this.attrString = attr;
|
||||
this.attrValue = value;
|
||||
if (value instanceof Integer){
|
||||
this.isTicks = true;
|
||||
} else {
|
||||
this.isTicks = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if(isTicks){
|
||||
int val = (Integer) attrValue + GameWorld.getTicks();
|
||||
p.setAttribute(attrString,val);
|
||||
return;
|
||||
}
|
||||
p.setAttribute(attrString,attrValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
public class SkillEffect extends ConsumableEffect {
|
||||
private final int skill_slot;
|
||||
private final double base;
|
||||
private final double bonus;
|
||||
public SkillEffect(int skill_slot, double base, double bonus){
|
||||
this.skill_slot = skill_slot;
|
||||
this.base = base;
|
||||
this.bonus = bonus;
|
||||
}
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
Skills skills = p.getSkills();
|
||||
int slevel = skills.getStaticLevel(skill_slot);
|
||||
int delta = (int)(base + (bonus * slevel));
|
||||
skills.updateLevel(skill_slot, delta, delta >= 0 ? slevel + delta : 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* According to the OSRS wiki, the smelling ugthanki kebab will usually heal nothing when eaten, but sometimes heals for 9.
|
||||
* As the chances of healing are unknown, the percentage is set to 10%.
|
||||
*/
|
||||
public class SmellingUgthankiKebabEffect extends ConsumableEffect {
|
||||
|
||||
private static final int percentage = 10;
|
||||
|
||||
private static final int healing = 9;
|
||||
|
||||
private static final HealingEffect effect = new HealingEffect(healing);
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if (RandomFunction.nextInt(100) < percentage) {
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return RandomFunction.nextInt(100) < percentage ? healing : 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
public class SummoningEffect extends ConsumableEffect {
|
||||
double base, bonus;
|
||||
public SummoningEffect(double base, double bonus){
|
||||
this.base = base;
|
||||
this.bonus = bonus;
|
||||
}
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
int level = p.getSkills().getStaticLevel(Skills.SUMMONING);
|
||||
double amt = base + (level * bonus);
|
||||
p.getSkills().updateLevel(Skills.SUMMONING, (int)amt, level);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.tools.RandomFunction;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
|
||||
public class SuperKebabEffect extends ConsumableEffect {
|
||||
|
||||
private static final MultiEffect healingEffect = new MultiEffect(new HealingEffect(3), new PercentageHealthEffect(7));
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if (RandomFunction.nextInt(8) < 5) {
|
||||
healingEffect.activate(p);
|
||||
}
|
||||
if (RandomFunction.nextInt(32) < 1) {
|
||||
final SkillEffect effect = new SkillEffect(RandomFunction.nextInt(Skills.NUM_SKILLS), -1, 0);
|
||||
effect.activate(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return RandomFunction.nextInt(8) < 5 ? (int) (3 + (player.getSkills().getMaximumLifepoints() * 0.07)) : 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.Location;
|
||||
|
||||
public class TroubleBrewingRumEffect extends ConsumableEffect {
|
||||
|
||||
private static final Location TROUBLE_BREWING_MINIGAME = new Location(3813, 3022);
|
||||
|
||||
private final String forceChatMessage;
|
||||
|
||||
public TroubleBrewingRumEffect(final String forceChatMessage) {
|
||||
this.forceChatMessage = forceChatMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final Pulse teleportation = new Pulse(6) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
p.teleport(TROUBLE_BREWING_MINIGAME);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
final Pulse mainPulse = new Pulse(4) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
p.sendChat(forceChatMessage);
|
||||
p.getPulseManager().run(teleportation);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
p.getPulseManager().run(mainPulse);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
public class UgthankiKebabEffect extends ConsumableEffect {
|
||||
|
||||
private static final int healing = 19;
|
||||
|
||||
private static final HealingEffect effect = new HealingEffect(healing);
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
if (p.getSkills().getLifepoints() < p.getSkills().getMaximumLifepoints()) {
|
||||
p.sendChat("Yum!");
|
||||
}
|
||||
effect.activate(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return healing;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package content.data.consumables.effects;
|
||||
|
||||
import core.game.consumable.ConsumableEffect;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
|
||||
public class WizardsMindBombEffect extends ConsumableEffect {
|
||||
|
||||
private final static int healing = 1;
|
||||
|
||||
@Override
|
||||
public void activate(Player p) {
|
||||
final int magicLevelBoost = p.getSkills().getLevel(Skills.MAGIC) > 50 ? 3 : 2;
|
||||
final MultiEffect effect = new MultiEffect(new SkillEffect(Skills.MAGIC, magicLevelBoost, 0), new HealingEffect(healing), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -4, 0), new SkillEffect(Skills.DEFENCE, -4, 0));
|
||||
effect.activate(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return healing;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package content.data.skill;
|
||||
|
||||
/**
|
||||
* Handles the skillcape perks.
|
||||
* @author Empathy
|
||||
*
|
||||
*/
|
||||
public enum SkillcapePerks {
|
||||
|
||||
ATTACK(9747, 9748),
|
||||
STRENGTH(9750, 9751),
|
||||
DEFENCE(9753, 9754),
|
||||
RANGING(9756, 9757),
|
||||
PRAYER(9759, 9760),
|
||||
MAGIC(9762, 9763),
|
||||
RUNECRAFTING(9765, 9766),
|
||||
HITPOINTS(9768, 9769),
|
||||
AGILITY(9771, 9772),
|
||||
HERBLORE(9774, 9775),
|
||||
THIEVEING(9777, 9778),
|
||||
CRAFTING(9780, 9781),
|
||||
FLETCHING(9783, 9784),
|
||||
SLAYER(9786, 9787),
|
||||
CONSTRUCTION(9789, 9790),
|
||||
MINING(9792, 9793),
|
||||
SMITHING(9795, 9796),
|
||||
FISHING(9798, 9799),
|
||||
COOKING(9801, 9802),
|
||||
FIREMAKING(9804, 9805),
|
||||
WOODCUTTING(9807, 9808),
|
||||
FARMING(9810, 9811),
|
||||
HUNTING(9948, 9949),
|
||||
SUMMONING(12169,12170),
|
||||
MAX_CAPE(14831, 14833, 14835, 14839, 14840)
|
||||
;
|
||||
|
||||
/**
|
||||
* The skillcape Ids.
|
||||
*/
|
||||
private final int[] skillcapeIds;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Constructs a new {@code SkillcapePerks} object.
|
||||
* @param skillcapeIds
|
||||
*/
|
||||
SkillcapePerks(int... skillcapeIds) {
|
||||
this.skillcapeIds = skillcapeIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* The skillcapeIds.
|
||||
* @return the skillcape ids.
|
||||
*/
|
||||
public int[] getSkillcapeIds() {
|
||||
return skillcapeIds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package content.data.skill;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.repository.Repository;
|
||||
|
||||
/**
|
||||
* Represents the skilling pets obtained randomly.
|
||||
* @author Empathy
|
||||
*
|
||||
*/
|
||||
public enum SkillingPets {
|
||||
|
||||
BABY_RED_CHINCHOMPA(new Item(14823), "Baby Chinchompa", Skills.HUNTER),
|
||||
BABY_GREY_CHINCHOMPA(new Item(14824), "Baby Chinchompa", Skills.HUNTER),
|
||||
BEAVER(new Item(14821), "Beaver", Skills.WOODCUTTING),
|
||||
GOLEM(new Item(14822), "Rock Golem", Skills.MINING),
|
||||
HERON(new Item(14827), "Heron", Skills.FISHING);
|
||||
|
||||
/**
|
||||
* The pet item drop.
|
||||
*/
|
||||
private final Item pet;
|
||||
|
||||
/**
|
||||
* The name.
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The skill.
|
||||
*/
|
||||
private final int skill;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SkillingPets} object.
|
||||
* @param skill The skill id.
|
||||
* @param pet The pet item.
|
||||
*/
|
||||
SkillingPets(Item pet, String name, int skill) {
|
||||
this.pet = pet;
|
||||
this.name = name;
|
||||
this.skill = skill;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the pet drop.
|
||||
* @param player The player.
|
||||
* @param pet The pet drop to check.
|
||||
*/
|
||||
public static void checkPetDrop(Player player, SkillingPets pet) {
|
||||
if (pet == null) {
|
||||
return;
|
||||
}
|
||||
int defaultChance = 15000;
|
||||
int newChance = (defaultChance / player.getSkills().getStaticLevel(pet.getSkill()) * 55);
|
||||
int outOf = (newChance > defaultChance ? defaultChance : newChance);
|
||||
int getChance = outOf;
|
||||
if (getChance != 1) {
|
||||
return;
|
||||
}
|
||||
if (player.hasItem(pet.getPet())) {
|
||||
return;
|
||||
}
|
||||
if (player.getFamiliarManager().hasFamiliar() && player.getInventory().isFull()) {
|
||||
return;
|
||||
}
|
||||
if (player.getFamiliarManager().hasFamiliar()) {
|
||||
if (player.getFamiliarManager().getFamiliar().getName().equalsIgnoreCase(pet.getName())) {
|
||||
return;
|
||||
}
|
||||
player.getInventory().add(pet.getPet());
|
||||
player.sendNotificationMessage("You feel something weird sneaking into your backpack.");
|
||||
} else {
|
||||
player.getFamiliarManager().summon(pet.getPet(), true);
|
||||
player.sendNotificationMessage("You have a funny feeling like you're being followed.");
|
||||
}
|
||||
Repository.sendNews(player.getUsername() + " has found a " + pet.getPet().getName() + "!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the pet
|
||||
*/
|
||||
public Item getPet() {
|
||||
return pet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pet name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skill.
|
||||
*/
|
||||
public int getSkill() {
|
||||
return skill;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
package content.data.skill;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
/**
|
||||
* Represents a skilling tool (such as knife, axe, needle, ...)
|
||||
* @author Emperor
|
||||
*/
|
||||
public enum SkillingTool {
|
||||
/**
|
||||
* Represents a bronze axe (woodcutting).
|
||||
*/
|
||||
BRONZE_AXE(1351, 1, 0.05D, new Animation(879)),
|
||||
|
||||
/**
|
||||
* Represents an iron axe (woodcutting).
|
||||
*/
|
||||
IRON_AXE(1349, 1, 0.1D, new Animation(877)),
|
||||
|
||||
/**
|
||||
* Represents a steel axe (woodcutting).
|
||||
*/
|
||||
STEEL_AXE(1353, 6, 0.2D, new Animation(875)),
|
||||
|
||||
/**
|
||||
* Represents a black axe (woodcutting).
|
||||
*/
|
||||
BLACK_AXE(1361, 6, 0.25D, new Animation(873)),
|
||||
|
||||
/**
|
||||
* Represents a mithril axe (woodcutting).
|
||||
*/
|
||||
MITHRIL_AXE(1355, 21, 0.30D, new Animation(871)),
|
||||
|
||||
/**
|
||||
* Represents an adamant axe (woodcutting).
|
||||
*/
|
||||
ADAMANT_AXE(1357, 31, 0.45D, new Animation(869)),
|
||||
|
||||
/**
|
||||
* Represents a rune axe (woodcutting).
|
||||
*/
|
||||
RUNE_AXE(1359, 41, 0.65D, new Animation(867)),
|
||||
|
||||
/**
|
||||
* Represents a dragon axe (woodcutting).
|
||||
*/
|
||||
DRAGON_AXE(6739, 61, 0.85D, new Animation(2846)),
|
||||
|
||||
/**
|
||||
* Represents a bronze pickaxe (mining).
|
||||
*/
|
||||
BRONZE_PICKAXE(1265, 1, 0.05D, new Animation(625)),
|
||||
|
||||
/**
|
||||
* Represents an iron pickaxe (mining).
|
||||
*/
|
||||
IRON_PICKAXE(1267, 1, 0.1D, new Animation(626)),
|
||||
|
||||
/**
|
||||
* Represents a steel pickaxe (mining).
|
||||
*/
|
||||
STEEL_PICKAXE(1269, 6, 0.2D, new Animation(627)),
|
||||
|
||||
/**
|
||||
* Represents a mithril pickaxe (mining).
|
||||
*/
|
||||
MITHRIL_PICKAXE(1273, 21, 0.30D, new Animation(629)),
|
||||
|
||||
/**
|
||||
* Represents an adamant pickaxe (mining).
|
||||
*/
|
||||
ADAMANT_PICKAXE(1271, 31, 0.45D, new Animation(628)),
|
||||
|
||||
/**
|
||||
* Represents a rune pickaxe (mining).
|
||||
*/
|
||||
RUNE_PICKAXE(1275, 41, 0.65D, new Animation(624)),
|
||||
|
||||
/**
|
||||
* Represents the Inferno Adze (woodcutting)
|
||||
*/
|
||||
INFERNO_ADZE(13661, 61, 0.85D, new Animation(10251)),
|
||||
|
||||
/**
|
||||
* Represents the Inferno Adze (mining)
|
||||
*/
|
||||
INFERNO_ADZE2(13661, 61, 1.0D, new Animation(10222)),
|
||||
|
||||
HATCHET_CLASS1(Items.HATCHET_CLASS_1_14132, 1, 0.1, new Animation(10603)),
|
||||
HATCHET_CLASS2(Items.HATCHET_CLASS_2_14134, 20, 0.3, new Animation(10604)),
|
||||
HATCHET_CLASS3(Items.HATCHET_CLASS_3_14136, 40, 0.65, new Animation(10605)),
|
||||
HATCHET_CLASS4(Items.HATCHET_CLASS_4_14138, 60, 0.85, new Animation(10606)),
|
||||
HATCHET_CLASS5(Items.HATCHET_CLASS_5_14140, 80, 1.0, new Animation(10607)),
|
||||
PICKAXE_CLASS1(Items.PICKAXE_CLASS_1_14122, 1, 0.1, new Animation(10608)),
|
||||
PICKAXE_CLASS2(Items.PICKAXE_CLASS_2_14124, 20, 0.3, new Animation(10609)),
|
||||
PICKAXE_CLASS3(Items.PICKAXE_CLASS_3_14126, 40, 0.65, new Animation(10610)),
|
||||
PICKAXE_CLASS4(Items.PICKAXE_CLASS_4_14128, 60, 0.85, new Animation(10611)),
|
||||
PICKAXE_CLASS5(Items.PICKAXE_CLASS_5_14130, 80, 1.0, new Animation(10612)),
|
||||
HARPOON_CLASS1(Items.HARPOON_CLASS_1_14142, 1, 0.1, new Animation(10613)),
|
||||
HARPOON_CLASS2(Items.HARPOON_CLASS_2_14144, 20, 0.3, new Animation(10614)),
|
||||
HARPOON_CLASS3(Items.HARPOON_CLASS_3_14146, 40, 0.65, new Animation(10615)),
|
||||
HARPOON_CLASS4(Items.HARPOON_CLASS_4_14148, 60, 0.85, new Animation(10616)),
|
||||
HARPOON_CLASS5(Items.HARPOON_CLASS_5_14150, 80, 1.0, new Animation(10617)),
|
||||
BUTTERFLY_NET_CLASS1(Items.BUTTERFLY_NET_CLASS_1_14152, 1, 0.1, new Animation(10618)),
|
||||
BUTTERFLY_NET_CLASS2(Items.BUTTERFLY_NET_CLASS_2_14154, 20, 0.3, new Animation(10619)),
|
||||
BUTTERFLY_NET_CLASS3(Items.BUTTERFLY_NET_CLASS_3_14156, 40, 0.65, new Animation(10620)),
|
||||
BUTTERFLY_NET_CLASS4(Items.BUTTERFLY_NET_CLASS_4_14158, 60, 0.85, new Animation(10621)),
|
||||
BUTTERFLY_NET_CLASS5(Items.BUTTERFLY_NET_CLASS_5_14160, 80, 1.0, new Animation(10622));
|
||||
|
||||
|
||||
/**
|
||||
* The tool id.
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* The level required.
|
||||
*/
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* The ratio.
|
||||
*/
|
||||
private final double ratio;
|
||||
|
||||
/**
|
||||
* The animation.
|
||||
*/
|
||||
private final Animation animation;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SkillingTool} {@code Object}.
|
||||
* @param id The tool item id.
|
||||
* @param level The level required to use this.
|
||||
* @param ratio The ratio.
|
||||
* @param animation The animation.
|
||||
*/
|
||||
private SkillingTool(int id, int level, double ratio, Animation animation) {
|
||||
this.id = id;
|
||||
this.level = level;
|
||||
this.ratio = ratio;
|
||||
this.animation = animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tool by the item id.
|
||||
* @param itemId The item id.
|
||||
* @return The skilling tool, or {@code null} if the tool wasn't found.
|
||||
*/
|
||||
public static SkillingTool forId(int itemId) {
|
||||
for (SkillingTool tool : SkillingTool.values()) {
|
||||
if (tool.id == itemId) {
|
||||
return tool;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hatchet used by the player.
|
||||
* @param player The player.
|
||||
* @return The hatchet.
|
||||
*/
|
||||
public static SkillingTool getHatchet(Player player) {
|
||||
SkillingTool tool = null;
|
||||
SkillingTool[] hatchetPriority = new SkillingTool[] {
|
||||
SkillingTool.HATCHET_CLASS5,
|
||||
SkillingTool.HATCHET_CLASS4,
|
||||
SkillingTool.DRAGON_AXE,
|
||||
SkillingTool.HATCHET_CLASS3,
|
||||
SkillingTool.RUNE_AXE,
|
||||
SkillingTool.ADAMANT_AXE,
|
||||
SkillingTool.HATCHET_CLASS2,
|
||||
SkillingTool.MITHRIL_AXE,
|
||||
SkillingTool.BLACK_AXE,
|
||||
SkillingTool.STEEL_AXE,
|
||||
SkillingTool.HATCHET_CLASS1,
|
||||
SkillingTool.IRON_AXE,
|
||||
SkillingTool.BRONZE_AXE
|
||||
};
|
||||
for(SkillingTool hatchet : hatchetPriority) {
|
||||
if (checkTool(player, Skills.WOODCUTTING, hatchet)) {
|
||||
tool = hatchet;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (checkTool(player, Skills.WOODCUTTING, SkillingTool.INFERNO_ADZE)) {
|
||||
if(player.getSkills().getLevel(Skills.FIREMAKING) >= 92) {
|
||||
tool = SkillingTool.INFERNO_ADZE;
|
||||
}
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pickaxe used by the player.
|
||||
* @param player The player.
|
||||
* @return The hatchet.
|
||||
*/
|
||||
public static SkillingTool getPickaxe(Player player) {
|
||||
SkillingTool tool = null;
|
||||
SkillingTool[] pickaxePriority = new SkillingTool[] {
|
||||
SkillingTool.PICKAXE_CLASS5,
|
||||
SkillingTool.PICKAXE_CLASS4,
|
||||
SkillingTool.RUNE_PICKAXE,
|
||||
SkillingTool.PICKAXE_CLASS3,
|
||||
SkillingTool.ADAMANT_PICKAXE,
|
||||
SkillingTool.PICKAXE_CLASS2,
|
||||
SkillingTool.MITHRIL_PICKAXE,
|
||||
SkillingTool.STEEL_PICKAXE,
|
||||
SkillingTool.PICKAXE_CLASS1,
|
||||
SkillingTool.IRON_PICKAXE,
|
||||
SkillingTool.BRONZE_PICKAXE,
|
||||
};
|
||||
for(SkillingTool pickaxe : pickaxePriority) {
|
||||
if (checkTool(player, Skills.MINING, pickaxe)) {
|
||||
tool = pickaxe;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (checkTool(player, Skills.MINING, SkillingTool.INFERNO_ADZE2)) {
|
||||
if (player.getSkills().getLevel(Skills.FIREMAKING) >= 92) {
|
||||
tool = SkillingTool.INFERNO_ADZE2;
|
||||
}
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
||||
public static SkillingTool getHarpoon(Player player) {
|
||||
SkillingTool tool = null;
|
||||
SkillingTool[] harpoonPriority = new SkillingTool[] {
|
||||
SkillingTool.BUTTERFLY_NET_CLASS5,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS4,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS3,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS2,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS1,
|
||||
};
|
||||
for(SkillingTool harpoon : harpoonPriority) {
|
||||
if (checkTool(player, Skills.FISHING, harpoon)) {
|
||||
tool = harpoon;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
||||
public static SkillingTool getButterflyNet(Player player) {
|
||||
SkillingTool tool = null;
|
||||
SkillingTool[] butterflyNetPriority = new SkillingTool[] {
|
||||
SkillingTool.BUTTERFLY_NET_CLASS5,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS4,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS3,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS2,
|
||||
SkillingTool.BUTTERFLY_NET_CLASS1,
|
||||
};
|
||||
for(SkillingTool butterflyNet : butterflyNetPriority) {
|
||||
if (checkTool(player, Skills.HUNTER, butterflyNet)) {
|
||||
tool = butterflyNet;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
||||
public static SkillingTool getToolForSkill(Player player, int skill) {
|
||||
switch(skill) {
|
||||
case Skills.MINING:
|
||||
return getPickaxe(player);
|
||||
case Skills.WOODCUTTING:
|
||||
return getHatchet(player);
|
||||
case Skills.FISHING:
|
||||
return getHarpoon(player);
|
||||
case Skills.HUNTER:
|
||||
return getButterflyNet(player);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player has a tool and if he can use it.
|
||||
* @param tool The tool.
|
||||
* @return {@code True} if the tool is usable.
|
||||
*/
|
||||
public static boolean checkTool(Player player, int skillId, SkillingTool tool) {
|
||||
if (player.getSkills().getStaticLevel(skillId) < tool.getLevel()) {
|
||||
return false;
|
||||
}
|
||||
if (player.getEquipment().getNew(3).getId() == tool.getId()) {
|
||||
return true;
|
||||
}
|
||||
return player.getInventory().contains(tool.getId(), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
* @return The id.
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the level.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ratio.
|
||||
* @return The ratio.
|
||||
*/
|
||||
public double getRatio() {
|
||||
return ratio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the animation.
|
||||
* @return The animation.
|
||||
*/
|
||||
public Animation getAnimation() {
|
||||
return animation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package content.data.tables;
|
||||
|
||||
import core.api.StartupListener;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.item.WeightedChanceItem;
|
||||
import core.tools.RandomFunction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import core.ServerConstants;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.SystemLogger.logInfo;
|
||||
|
||||
/**
|
||||
* Handles the allotment seed drop table.
|
||||
* @author Von Hresvelg
|
||||
*/
|
||||
public final class AllotmentSeedDropTable implements StartupListener {
|
||||
|
||||
/**
|
||||
* The item id of the item representing the allotment seed drop table slot in a drop
|
||||
* table.
|
||||
*/
|
||||
public static final int SLOT_ITEM_ID = 14430;
|
||||
|
||||
/**
|
||||
* The allotment seed drop table.
|
||||
*/
|
||||
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize needed objects for xml reading/writing
|
||||
*/
|
||||
static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
static DocumentBuilder builder;
|
||||
|
||||
static {
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public AllotmentSeedDropTable() throws ParserConfigurationException {}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
if(ServerConstants.ASDT_DATA_PATH != null && !new File(ServerConstants.ASDT_DATA_PATH).exists()){
|
||||
SystemLogger.logErr(this.getClass(), "Can't locate ASDT file at " + ServerConstants.ASDT_DATA_PATH);
|
||||
return;
|
||||
}
|
||||
parse(ServerConstants.ASDT_DATA_PATH);
|
||||
logInfo(this.getClass(), "Initialized Allotment Seed Drop Table from " + ServerConstants.ASDT_DATA_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the xml file for the allotment seed drop table.
|
||||
* @param file the .xml file containing the allotment seed drop table.
|
||||
*/
|
||||
public static void parse(String file){
|
||||
try {
|
||||
Document doc = builder.parse(file);
|
||||
|
||||
NodeList itemNodes = doc.getElementsByTagName("item");
|
||||
for(int i = 0; i < itemNodes.getLength(); i++){
|
||||
Node itemNode = itemNodes.item(i);
|
||||
if(itemNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element item = (Element) itemNode;
|
||||
int itemId = Integer.parseInt(item.getAttribute("id"));
|
||||
int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
|
||||
int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
|
||||
int weight = Integer.parseInt(item.getAttribute("weight"));
|
||||
|
||||
TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item retrieve() {return RandomFunction.rollWeightedChanceTable(TABLE);}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package content.data.tables;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.entity.npc.drop.NPCDropTables;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.ChanceItem;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import core.tools.RandomFunction;
|
||||
import core.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* Represents a birds nest.
|
||||
* @author Vexia
|
||||
*/
|
||||
public enum BirdNest {
|
||||
SEED(new ChanceItem(5073, 1, 65),
|
||||
new ChanceItem(Items.ACORN_5312, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.APPLE_TREE_SEED_5283, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.WILLOW_SEED_5313, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.BANANA_TREE_SEED_5284, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.ORANGE_TREE_SEED_5285, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.CURRY_TREE_SEED_5286, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.MAPLE_SEED_5314, 1, NPCDropTables.DROP_RATES[1]),
|
||||
new ChanceItem(Items.PINEAPPLE_SEED_5287, 1, NPCDropTables.DROP_RATES[1]),
|
||||
new ChanceItem(Items.PAPAYA_TREE_SEED_5288, 1, NPCDropTables.DROP_RATES[1]),
|
||||
new ChanceItem(Items.YEW_SEED_5315, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.PALM_TREE_SEED_5289, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.CALQUAT_TREE_SEED_5290, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.SPIRIT_SEED_5317, 1, NPCDropTables.DROP_RATES[3]),
|
||||
new ChanceItem(Items.MAGIC_SEED_5316, 1, NPCDropTables.DROP_RATES[3])),
|
||||
RING(new ChanceItem(5074, 1, 30),
|
||||
new ChanceItem(Items.GOLD_RING_1635, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.SAPPHIRE_RING_1637, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.EMERALD_RING_1639, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.RUBY_RING_1641, 1, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.DIAMOND_RING_1643, 1, NPCDropTables.DROP_RATES[2])),
|
||||
RED(new ChanceItem(5070, 1, 5), new ChanceItem(5076)),
|
||||
GREEN(new ChanceItem(5071, 1, 5), new ChanceItem(5078)),
|
||||
BLUE(new ChanceItem(5072, 1, 5), new ChanceItem(5077)),
|
||||
RAVEN(new ChanceItem(11966, 1, 5), new ChanceItem(11964)),
|
||||
|
||||
WYSON(new ChanceItem(7413, 1, 1),
|
||||
new ChanceItem(Items.POTATO_SEED_5318, 14, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.SWEETCORN_SEED_5320, 3, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.TOMATO_SEED_5322, 6, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.CABBAGE_SEED_5324, 9, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.LIMPWURT_SEED_5100, 2, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.ONION_SEED_5319, 11, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.STRAWBERRY_SEED_5323, 3, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.WATERMELON_SEED_5321, 2, NPCDropTables.DROP_RATES[0]),
|
||||
new ChanceItem(Items.ACORN_5312, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.RANARR_SEED_5295, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.WILLOW_SEED_5313, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.MAPLE_SEED_5314, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.YEW_SEED_5315, 1, NPCDropTables.DROP_RATES[2]),
|
||||
new ChanceItem(Items.MAGIC_SEED_5316, 1, NPCDropTables.DROP_RATES[3]),
|
||||
new ChanceItem(Items.SPIRIT_SEED_5317, 1, NPCDropTables.DROP_RATES[3]));
|
||||
|
||||
/**
|
||||
* The random nest items.
|
||||
*/
|
||||
private static final ChanceItem[] NESTS = new ChanceItem[6];
|
||||
|
||||
/**
|
||||
* The empty birds nest item.
|
||||
*/
|
||||
private static final Item EMPTY = new Item(5075);
|
||||
|
||||
/**
|
||||
* The birds nest item.
|
||||
*/
|
||||
private final ChanceItem nest;
|
||||
|
||||
/**
|
||||
* The loot item from the nest.
|
||||
*/
|
||||
private final ChanceItem[] loot;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code BirdNest} {@code Object}.
|
||||
* @param nest the nest.
|
||||
* @param loot the loot.
|
||||
*/
|
||||
private BirdNest(final ChanceItem nest, final ChanceItem... loot) {
|
||||
this.nest = nest;
|
||||
this.loot = loot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops a birds nest.
|
||||
* @param player the player.
|
||||
*/
|
||||
public static void drop(final Player player) {
|
||||
final BirdNest nest = getRandomNest(false);
|
||||
player.getAudioManager().send(1997);
|
||||
GroundItemManager.create(nest.getNest(), player);
|
||||
player.getPacketDispatch().sendMessage("<col=FF0000>A bird's nest falls out of the tree.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches a bird nest.
|
||||
* @param player the player.
|
||||
* @param item the item searched.
|
||||
*/
|
||||
public void search(final Player player, Item item) {
|
||||
if (player.getInventory().freeSlots() < 1) {
|
||||
player.getPacketDispatch().sendMessage("You don't have enough inventory space.");
|
||||
return;
|
||||
}
|
||||
final ChanceItem loot = ordinal() > 1 && this != WYSON ? getLoot()[0] : RandomFunction.getChanceItem(getLoot());
|
||||
final String name = loot.getName().toLowerCase();
|
||||
final String input = (StringUtils.isPlusN(name) ? "an" : "a") + " " + name;
|
||||
player.lock(1);
|
||||
player.getInventory().add(loot);
|
||||
player.getInventory().replace(EMPTY, item.getSlot());
|
||||
player.getPacketDispatch().sendMessage("You take " + input + " out of the bird's nest.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the random nest.
|
||||
* @return the nest.
|
||||
*/
|
||||
public static BirdNest getRandomNest(boolean wyson) {
|
||||
ChanceItem item = RandomFunction.getChanceItem(NESTS);
|
||||
for (BirdNest n : BirdNest.values()) {
|
||||
if (n.getNest() == item) {
|
||||
if (wyson && n == SEED) {
|
||||
return WYSON;
|
||||
} else if (!wyson && n == WYSON) {
|
||||
return SEED;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nest by the id.
|
||||
* @param nest the nest.
|
||||
* @return the nest.
|
||||
*/
|
||||
public static BirdNest forNest(final Item nest) {
|
||||
for (BirdNest n : values()) {
|
||||
if (n.getNest().getId() == nest.getId()) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nest.
|
||||
* @return The nest.
|
||||
*/
|
||||
public ChanceItem getNest() {
|
||||
return nest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the loot.
|
||||
* @return The loot.
|
||||
*/
|
||||
public ChanceItem[] getLoot() {
|
||||
return loot;
|
||||
}
|
||||
|
||||
/**
|
||||
* static-block to add nests.
|
||||
*/
|
||||
static {
|
||||
for (int i = 0; i < NESTS.length; i++) {
|
||||
NESTS[i] = values()[i].getNest();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package content.data.tables;
|
||||
|
||||
import core.api.StartupListener;
|
||||
import core.ServerConstants;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.item.WeightedChanceItem;
|
||||
import core.tools.SystemLogger;
|
||||
import core.tools.RandomFunction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.SystemLogger.logInfo;
|
||||
|
||||
/**
|
||||
* Handles the Chaos Elemental's minor drop table. It is supposed to roll this table alongside its standard major drops on the main table.
|
||||
* @author Crash
|
||||
*/
|
||||
public final class CELEMinorTable implements StartupListener {
|
||||
|
||||
/**
|
||||
* The item id of the item representing the C. Ele minor drop table slot in a drop
|
||||
* table.
|
||||
*/
|
||||
public static final int SLOT_ITEM_ID = 799; // Crash: Item ID 799 is currently a null, blank paper note object. Unsure if used for cutscene/cutscene items, but hijacking this as C.Ele's item container as it'll never be dropped or obtained in normal gameplay.
|
||||
|
||||
/**
|
||||
* The rare drop table.
|
||||
*/
|
||||
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize needed objects for xml reading/writing
|
||||
*/
|
||||
static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
static DocumentBuilder builder;
|
||||
|
||||
static {
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public CELEMinorTable() throws ParserConfigurationException {}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
if(ServerConstants.CELEDT_DATA_PATH != null && !new File(ServerConstants.CELEDT_DATA_PATH).exists()){
|
||||
SystemLogger.logErr(this.getClass(), "Can't locate CELEDT file at " + ServerConstants.CELEDT_DATA_PATH);
|
||||
return;
|
||||
}
|
||||
parse(ServerConstants.CELEDT_DATA_PATH);
|
||||
logInfo(this.getClass(), "Loaded up Chaos Elemental drop table from " + ServerConstants.CELEDT_DATA_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the xml file for the CELEDT.
|
||||
* @param file the .xml file containing the CELEDT.
|
||||
*/
|
||||
public static void parse(String file){
|
||||
try {
|
||||
Document doc = builder.parse(file);
|
||||
|
||||
NodeList itemNodes = doc.getElementsByTagName("item");
|
||||
for(int i = 0; i < itemNodes.getLength(); i++){
|
||||
Node itemNode = itemNodes.item(i);
|
||||
if(itemNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element item = (Element) itemNode;
|
||||
int itemId = Integer.parseInt(item.getAttribute("id"));
|
||||
int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
|
||||
int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
|
||||
int weight = Integer.parseInt(item.getAttribute("weight"));
|
||||
|
||||
TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item retrieve(){
|
||||
return RandomFunction.rollWeightedChanceTable(TABLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package content.data.tables;
|
||||
|
||||
import core.api.StartupListener;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.item.WeightedChanceItem;
|
||||
import core.tools.RandomFunction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import core.ServerConstants;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.SystemLogger.logInfo;
|
||||
|
||||
/**
|
||||
* Handles the gem drop table.
|
||||
* @author Von Hresvelg
|
||||
*/
|
||||
public final class GemDropTable implements StartupListener {
|
||||
|
||||
/**
|
||||
* The item id of the item representing the gem drop table slot in a drop
|
||||
* table.
|
||||
*/
|
||||
public static final int SLOT_ITEM_ID = 14426;
|
||||
|
||||
/**
|
||||
* The gem drop table.
|
||||
*/
|
||||
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize needed objects for xml reading/writing
|
||||
*/
|
||||
static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
static DocumentBuilder builder;
|
||||
|
||||
static {
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public GemDropTable() throws ParserConfigurationException {}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
if(ServerConstants.GDT_DATA_PATH != null && !new File(ServerConstants.GDT_DATA_PATH).exists()){
|
||||
SystemLogger.logErr(this.getClass(), "Can't locate GDT file at " + ServerConstants.GDT_DATA_PATH);
|
||||
return;
|
||||
}
|
||||
parse(ServerConstants.GDT_DATA_PATH);
|
||||
logInfo(this.getClass(), "Initialized Gem Drop Table from " + ServerConstants.GDT_DATA_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the xml file for the gem drop table.
|
||||
* @param file the .xml file containing the gem drop table.
|
||||
*/
|
||||
public static void parse(String file){
|
||||
try {
|
||||
Document doc = builder.parse(file);
|
||||
|
||||
NodeList itemNodes = doc.getElementsByTagName("item");
|
||||
for(int i = 0; i < itemNodes.getLength(); i++){
|
||||
Node itemNode = itemNodes.item(i);
|
||||
if(itemNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element item = (Element) itemNode;
|
||||
int itemId = Integer.parseInt(item.getAttribute("id"));
|
||||
int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
|
||||
int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
|
||||
int weight = Integer.parseInt(item.getAttribute("weight"));
|
||||
|
||||
TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item retrieve(){
|
||||
return RandomFunction.rollWeightedChanceTable(TABLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package content.data.tables;
|
||||
|
||||
import core.api.StartupListener;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.item.WeightedChanceItem;
|
||||
import core.tools.RandomFunction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import core.ServerConstants;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.SystemLogger.logInfo;
|
||||
|
||||
/**
|
||||
* Handles the herb drop table.
|
||||
* @author Von Hresvelg
|
||||
*/
|
||||
public final class HerbDropTable implements StartupListener {
|
||||
|
||||
/**
|
||||
* The item id of the item representing the herb drop table slot in a drop
|
||||
* table.
|
||||
*/
|
||||
public static final int SLOT_ITEM_ID = 14424;
|
||||
|
||||
/**
|
||||
* The herb drop table.
|
||||
*/
|
||||
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize needed objects for xml reading/writing
|
||||
*/
|
||||
static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
static DocumentBuilder builder;
|
||||
|
||||
static {
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public HerbDropTable() throws ParserConfigurationException {}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
if(ServerConstants.HDT_DATA_PATH != null && !new File(ServerConstants.HDT_DATA_PATH).exists()){
|
||||
SystemLogger.logErr(this.getClass(), "Can't locate HDT file at " + ServerConstants.HDT_DATA_PATH);
|
||||
return;
|
||||
}
|
||||
parse(ServerConstants.HDT_DATA_PATH);
|
||||
logInfo(this.getClass(), "Initialized Herb Drop Table from " + ServerConstants.HDT_DATA_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the xml file for the herb drop table.
|
||||
* @param file the .xml file containing the herb drop table.
|
||||
*/
|
||||
public static void parse(String file){
|
||||
try {
|
||||
Document doc = builder.parse(file);
|
||||
|
||||
NodeList itemNodes = doc.getElementsByTagName("item");
|
||||
for(int i = 0; i < itemNodes.getLength(); i++){
|
||||
Node itemNode = itemNodes.item(i);
|
||||
if(itemNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element item = (Element) itemNode;
|
||||
int itemId = Integer.parseInt(item.getAttribute("id"));
|
||||
int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
|
||||
int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
|
||||
int weight = Integer.parseInt(item.getAttribute("weight"));
|
||||
|
||||
TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item retrieve(){
|
||||
return RandomFunction.rollWeightedChanceTable(TABLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package content.data.tables;
|
||||
|
||||
import core.api.StartupListener;
|
||||
import core.ServerConstants;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.item.WeightedChanceItem;
|
||||
import core.tools.SystemLogger;
|
||||
import core.tools.RandomFunction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.SystemLogger.logInfo;
|
||||
|
||||
/**
|
||||
* Handles the rare drop table.
|
||||
* @author Ceikry
|
||||
*/
|
||||
public final class RareDropTable implements StartupListener {
|
||||
|
||||
/**
|
||||
* The item id of the item representing the rare drop table slot in a drop
|
||||
* table.
|
||||
*/
|
||||
public static final int SLOT_ITEM_ID = 31;
|
||||
|
||||
/**
|
||||
* The rare drop table.
|
||||
*/
|
||||
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize needed objects for xml reading/writing
|
||||
*/
|
||||
static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
static DocumentBuilder builder;
|
||||
|
||||
static {
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public RareDropTable() throws ParserConfigurationException {}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
if(ServerConstants.RDT_DATA_PATH != null && !new File(ServerConstants.RDT_DATA_PATH).exists()){
|
||||
SystemLogger.logErr(this.getClass(), "Can't locate RDT file at " + ServerConstants.RDT_DATA_PATH);
|
||||
return;
|
||||
}
|
||||
parse(ServerConstants.RDT_DATA_PATH);
|
||||
logInfo(this.getClass(), "Initialized Rare Drop Table from " + ServerConstants.RDT_DATA_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the xml file for the RDT.
|
||||
* @param file the .xml file containing the RDT.
|
||||
*/
|
||||
public static void parse(String file){
|
||||
try {
|
||||
Document doc = builder.parse(file);
|
||||
|
||||
NodeList itemNodes = doc.getElementsByTagName("item");
|
||||
for(int i = 0; i < itemNodes.getLength(); i++){
|
||||
Node itemNode = itemNodes.item(i);
|
||||
if(itemNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element item = (Element) itemNode;
|
||||
int itemId = Integer.parseInt(item.getAttribute("id"));
|
||||
int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
|
||||
int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
|
||||
int weight = Integer.parseInt(item.getAttribute("weight"));
|
||||
|
||||
TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item retrieve(){
|
||||
return RandomFunction.rollWeightedChanceTable(TABLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package content.data.tables;
|
||||
|
||||
import core.api.StartupListener;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.item.WeightedChanceItem;
|
||||
import core.tools.RandomFunction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import core.ServerConstants;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.SystemLogger.logInfo;
|
||||
|
||||
/**
|
||||
* Handles the rare seed drop table.
|
||||
* @author Von Hresvelg
|
||||
*/
|
||||
public final class RareSeedDropTable implements StartupListener {
|
||||
|
||||
/**
|
||||
* The item id of the item representing the rare seed drop table slot in a drop
|
||||
* table.
|
||||
*/
|
||||
public static final int SLOT_ITEM_ID = 14428;
|
||||
|
||||
/**
|
||||
* The rare seed drop table.
|
||||
*/
|
||||
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize needed objects for xml reading/writing
|
||||
*/
|
||||
static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
static DocumentBuilder builder;
|
||||
|
||||
static {
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public RareSeedDropTable() throws ParserConfigurationException {}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
if(ServerConstants.RSDT_DATA_PATH != null && !new File(ServerConstants.RSDT_DATA_PATH).exists()){
|
||||
SystemLogger.logErr(this.getClass(), "Can't locate RSDT file at " + ServerConstants.RSDT_DATA_PATH);
|
||||
return;
|
||||
}
|
||||
parse(ServerConstants.RSDT_DATA_PATH);
|
||||
logInfo(this.getClass(), "Initialized Rare Seed Drop Table from " + ServerConstants.RSDT_DATA_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the xml file for the rare seed drop table.
|
||||
* @param file the .xml file containing the rare seed drop table.
|
||||
*/
|
||||
public static void parse(String file){
|
||||
try {
|
||||
Document doc = builder.parse(file);
|
||||
|
||||
NodeList itemNodes = doc.getElementsByTagName("item");
|
||||
for(int i = 0; i < itemNodes.getLength(); i++){
|
||||
Node itemNode = itemNodes.item(i);
|
||||
if(itemNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element item = (Element) itemNode;
|
||||
int itemId = Integer.parseInt(item.getAttribute("id"));
|
||||
int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
|
||||
int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
|
||||
int weight = Integer.parseInt(item.getAttribute("weight"));
|
||||
|
||||
TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item retrieve(){
|
||||
return RandomFunction.rollWeightedChanceTable(TABLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package content.data.tables;
|
||||
|
||||
import core.api.StartupListener;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.item.WeightedChanceItem;
|
||||
import core.tools.RandomFunction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import core.ServerConstants;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.tools.SystemLogger.logInfo;
|
||||
|
||||
/**
|
||||
* Handles the uncommon seed drop table.
|
||||
* @author Von Hresvelg
|
||||
*/
|
||||
public final class UncommonSeedDropTable implements StartupListener {
|
||||
|
||||
/**
|
||||
* The item id of the item representing the uncommon seed drop table slot in a drop
|
||||
* table.
|
||||
*/
|
||||
public static final int SLOT_ITEM_ID = 14422;
|
||||
|
||||
/**
|
||||
* The uncommon seed drop table.
|
||||
*/
|
||||
private static final List<WeightedChanceItem> TABLE = new ArrayList<>(20);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize needed objects for xml reading/writing
|
||||
*/
|
||||
static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
static DocumentBuilder builder;
|
||||
|
||||
static {
|
||||
try {
|
||||
builder = factory.newDocumentBuilder();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public UncommonSeedDropTable() throws ParserConfigurationException {}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
if(ServerConstants.USDT_DATA_PATH != null && !new File(ServerConstants.USDT_DATA_PATH).exists()){
|
||||
SystemLogger.logErr(this.getClass(), "Can't locate USDT file at " + ServerConstants.USDT_DATA_PATH);
|
||||
return;
|
||||
}
|
||||
parse(ServerConstants.USDT_DATA_PATH);
|
||||
logInfo(this.getClass(), "Initialized Uncommon Seed Drop Table from " + ServerConstants.USDT_DATA_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the xml file for the uncommon seed drop table.
|
||||
* @param file the .xml file containing the uncommon seed drop table.
|
||||
*/
|
||||
public static void parse(String file){
|
||||
try {
|
||||
Document doc = builder.parse(file);
|
||||
|
||||
NodeList itemNodes = doc.getElementsByTagName("item");
|
||||
for(int i = 0; i < itemNodes.getLength(); i++){
|
||||
Node itemNode = itemNodes.item(i);
|
||||
if(itemNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element item = (Element) itemNode;
|
||||
int itemId = Integer.parseInt(item.getAttribute("id"));
|
||||
int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
|
||||
int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
|
||||
int weight = Integer.parseInt(item.getAttribute("weight"));
|
||||
|
||||
TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item retrieve(){
|
||||
return RandomFunction.rollWeightedChanceTable(TABLE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user