Compare commits

..

No commits in common. "master" and "Apr-19-2026" have entirely different histories.

250 changed files with 219107 additions and 210849 deletions

View file

@ -29,7 +29,6 @@
* [Prerequisites](#prerequisites)
* [Project Setup](#project-setup)
* [Running the project](#running-the-project)
* [Browser WebSocket Transport](#browser-websocket-transport)
* [License](#license)
* [Contact](#contact)
@ -126,40 +125,6 @@ Start the game server with the included run script. Use `./run -h` for more info
Start the game server with `run-server.bat`
#### Browser WebSocket Transport
Enable the listener in `Server/worldprops/default.conf`:
```properties
websocket_enabled = true
websocket_port = 0
```
When `websocket_port = 0`, the listener uses `53594 + world_id`. For world `1`, that is `53595`.
Both plain WebSocket (`ws://`) and secure WebSocket (`wss://`) are supported. Use `ws://` for local HTTP testing. PWA requires HTTPS/WSS.
Enable WSS with a Java keystore:
```properties
websocket_tls_enabled = true
websocket_tls_keystore_path = "certs/dev-wss.p12"
websocket_tls_keystore_password = "<keystore-password>"
```
The keystore password is optional. Leave `websocket_tls_keystore_password` blank when using a PKCS12 file exported with an empty password:
```bash
openssl pkcs12 -export \
-in fullchain.pem \
-inkey privkey.pem \
-out certs/dev-wss.p12 \
-name websocket \
-passout pass:
```
For local WSS development, create a certificate for your hostname or LAN IP that the browser will use, then point the server at a PKCS12 keystore. For production, use a normal certificate from certbot. Plain WS does not require a certificate.
#### Docker
Make sure [Docker Engine](https://docs.docker.com/engine/install/) & [Docker Compose](https://docs.docker.com/compose/install/) plugin are installed first:

View file

@ -8353,20 +8353,6 @@
"description": "",
"main": []
},
{
"default": [
{
"minAmount": "1",
"weight": "100.0",
"id": "526",
"maxAmount": "1"
}
],
"charm": [],
"ids": "1329",
"description": "",
"main": []
},
{
"default": [
{
@ -18356,7 +18342,7 @@
{
"minAmount": "1",
"weight": "5.0",
"id": "12070",
"id": "5733",
"maxAmount": "1"
},
{
@ -19698,14 +19684,7 @@
]
},
{
"default": [
{
"minAmount": "1",
"weight": "100.0",
"id": "526",
"maxAmount": "1"
}
],
"default": [],
"charm": [],
"ids": "1307",
"description": "",
@ -29831,10 +29810,10 @@
"maxAmount": "1"
},
{
"minAmount": "2",
"minAmount": "1",
"weight": "100.0",
"id": "12161",
"maxAmount": "2"
"maxAmount": "1"
},
{
"minAmount": "1",
@ -41196,7 +41175,7 @@
{
"minAmount": "1",
"weight": "5.0",
"id": "12070",
"id": "1",
"maxAmount": "1"
},
{

View file

@ -145,7 +145,7 @@
},
{
"item_id": "444",
"loc_data": "{1,3231,3739,0,250}-{1,3236,3741,0,250}-{1,3195,9821,0,150}-{1,2732,3224,0,250}-"
"loc_data": "{1,3231,3739,0,250}-{1,3236,3741,0,250}-{1,3195,9821,0,150}-"
},
{
"item_id": "480",
@ -415,10 +415,6 @@
"item_id": "1755",
"loc_data": "{1,2935,3286,0,90}-"
},
{
"item_id": "1773",
"loc_data": "{1,2563,3261,0,100}-"
},
{
"item_id": "1785",
"loc_data": "{1,2822,3355,0,150}-"

View file

@ -539,12 +539,6 @@
"walkable": "true",
"tabIndex": "-1"
},
{
"id": "375",
"interfaceType": "3",
"walkable": "false",
"tabIndex": "-1"
},
{
"id": "377",
"interfaceType": "8",

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1546,41 +1546,5 @@
"animation": "426",
"drop_ammo": "true",
"ammunition": "14202,14203,14204,14205,14206"
},
{
"itemId": "10149",
"name": "Swamp lizard",
"ammo_slot": "13",
"weapon_type": "0",
"animation": "5247",
"drop_ammo": "false",
"ammunition": "10142"
},
{
"itemId": "10146",
"name": "Orange salamander",
"ammo_slot": "13",
"weapon_type": "0",
"animation": "5247",
"drop_ammo": "false",
"ammunition": "10143"
},
{
"itemId": "10147",
"name": "Red salamander",
"ammo_slot": "13",
"weapon_type": "0",
"animation": "5247",
"drop_ammo": "false",
"ammunition": "10144"
},
{
"itemId": "10148",
"name": "Black salamander",
"ammo_slot": "13",
"weapon_type": "0",
"animation": "5247",
"drop_ammo": "false",
"ammunition": "10145"
}
]

View file

@ -6,7 +6,6 @@
<version>1.0.0</version>
<properties>
<project.mainClassName>core.Server</project.mainClassName>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<kotlin.version>1.8.20</kotlin.version>
<kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>
@ -91,11 +90,6 @@
<version>2.9.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.7</version>
</dependency>
</dependencies>
<build>

View file

@ -0,0 +1,172 @@
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),
;
/**
* 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>.");
}
}

View file

@ -1,72 +0,0 @@
package content.data
import core.api.sendMessage
import core.game.node.entity.player.Player
import org.rs09.consts.NPCs
/**
* Enumerates the bosses that have their kill counts tracked in a player's statistics (::stats).
* addToBossKillCount(player, npcId) should be added in the finalizeDeath() method of the combat handler for the boss.
* ORDINAL BOUND
* @author Bishop
*/
enum class BossKillCounter(val bossId: IntArray, val bossName: String) {
KING_BLACK_DRAGON(intArrayOf(NPCs.KING_BLACK_DRAGON_50), "King Black Dragon"),
BORK(intArrayOf(NPCs.BORK_7133, NPCs.BORK_7134), "Bork"),
DAGANNOTH_SUPREME(intArrayOf(NPCs.DAGANNOTH_SUPREME_2881), "Dagannoth Supreme"),
DAGANNOTH_PRIME(intArrayOf(NPCs.DAGANNOTH_PRIME_2882), "Dagannoth Prime"),
DAGANNOTH_REX(intArrayOf(NPCs.DAGANNOTH_REX_2883), "Dagannoth Rex"),
CHAOS_ELEMENTAL(intArrayOf(NPCs.CHAOS_ELEMENTAL_3200), "Chaos Elemental"),
GIANT_MOLE(intArrayOf(NPCs.GIANT_MOLE_3340), "Giant Mole"),
SARADOMIN(intArrayOf(NPCs.COMMANDER_ZILYANA_6247), "Commander Zilyana"),
ZAMORAK(intArrayOf(NPCs.KRIL_TSUTSAROTH_6203), "K'ril Tsutsaroth"),
BANDOS(intArrayOf(NPCs.GENERAL_GRAARDOR_6260), "General Graardor"),
ARMADYL(intArrayOf(NPCs.KREEARRA_6222), "Kree'arra"),
JAD(intArrayOf(NPCs.TZTOK_JAD_2745), "Tz-Tok Jad"),
KALPHITE_QUEEN(intArrayOf(NPCs.KALPHITE_QUEEN_1160), "Kalphite Queen"),
CORPOREAL_BEAST(intArrayOf(NPCs.CORPOREAL_BEAST_8133), "Corporeal Beast"),
TORMENTED_DEMONS(
intArrayOf(
NPCs.TORMENTED_DEMON_8349, NPCs.TORMENTED_DEMON_8350, NPCs.TORMENTED_DEMON_8351,
NPCs.TORMENTED_DEMON_8352, NPCs.TORMENTED_DEMON_8353, NPCs.TORMENTED_DEMON_8354,
NPCs.TORMENTED_DEMON_8355, NPCs.TORMENTED_DEMON_8356, NPCs.TORMENTED_DEMON_8357,
NPCs.TORMENTED_DEMON_8358, NPCs.TORMENTED_DEMON_8359, NPCs.TORMENTED_DEMON_8360,
NPCs.TORMENTED_DEMON_8361, NPCs.TORMENTED_DEMON_8362, NPCs.TORMENTED_DEMON_8363,
NPCs.TORMENTED_DEMON_8364, NPCs.TORMENTED_DEMON_8365, NPCs.TORMENTED_DEMON_8366),
"Tormented demon"
),
PENANCE_QUEEN(intArrayOf(NPCs.PENANCE_QUEEN_5247), "Penance Queen");
companion object {
private fun forBossId(npc: Int): BossKillCounter? {
for (kc in values()) {
for (i in kc.bossId) {
if (npc == i) {
return kc
}
}
}
return null
}
@JvmStatic
fun addToBossKillCount(killer: Player?, bossId: Int) {
if (killer == null) {
return
}
val boss: BossKillCounter = forBossId(bossId) ?: return
killer.getSavedData().globalData.bossCounters[boss.ordinal]++
sendMessage(killer, "Your ${boss.bossName} killcount is now: <col=ff0000>${killer.getSavedData().globalData.bossCounters[boss.ordinal]}</col>.")
}
fun addToBarrowsChestCount(player: Player?) {
if (player == null) {
return
}
player.getSavedData().globalData.barrowsLoots++
sendMessage(player, "Your Barrows chest count is: <col=ff0000>${player.getSavedData().globalData.barrowsLoots}</col>.")
}
}
}

View file

@ -9,14 +9,15 @@ import core.game.event.TeleportEvent
import core.game.interaction.QueueStrength
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.TeleportManager
import core.game.node.entity.player.link.diary.DiaryType
import core.game.node.item.Item
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.game.world.update.flag.context.Graphics
import core.tools.Log
import org.rs09.consts.Items
import core.game.world.GameWorld.Pulser
import core.tools.Log
import org.rs09.consts.Sounds
import java.util.*
@ -193,7 +194,7 @@ enum class EnchantedJewellery(
),
RING_OF_LIFE(arrayOf<String>(),
arrayOf(
Location.create(ServerConstants.HOME_LOCATION!!)
Location.create(ServerConstants.HOME_LOCATION)
),
true,
Items.RING_OF_LIFE_2570
@ -246,13 +247,7 @@ enum class EnchantedJewellery(
when (stage) {
0 -> {
lock(player, 4)
// This is an intentional teleport animation & graphics difference as these two jewellery
// animations are authentic to 2009 while others are currently unknown.
if (this == RING_OF_DUELING || this == GAMES_NECKLACE) {
visualize(player, JEWELLERY_ANIMATION, JEWELLERY_GRAPHICS)
} else {
visualize(player, ANIMATION, GRAPHICS)
}
visualize(player, ANIMATION, GRAPHICS)
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
player.impactHandler.disabledTicks = 4
closeInterface(player)
@ -261,16 +256,8 @@ enum class EnchantedJewellery(
1 -> {
teleport(player, location)
resetAnimator(player)
if (this == RING_OF_DUELING || this == GAMES_NECKLACE) {
player.graphics(JEWELLERY_GRAPHICS)
}
unlock(player)
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
if (DIGSITE_PENDANT.ids.contains(item.id)) {
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 1, 10)
}
if (!replace) {
return@queueScript stopExecuting(player)
}
@ -379,8 +366,6 @@ enum class EnchantedJewellery(
companion object {
private val ANIMATION = Animation(714)
private val GRAPHICS = Graphics(308, 100, 50)
private val JEWELLERY_ANIMATION = Animation(9603)
private val JEWELLERY_GRAPHICS = Graphics(1684)
val idMap = HashMap<Int, EnchantedJewellery>()
init {

View file

@ -118,8 +118,6 @@ public enum Consumables {
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)))),
CHOPPED_TUNA(new Food(new int[] {7086, 1923}, new HealingEffect(10))),
CHOPPED_ONION(new Food(new int[] {1871, 1923}, new HealingEffect(1))),
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))),
@ -319,7 +317,6 @@ public enum Consumables {
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))),
CAVIAR(new Food(new int[]{11326}, new HealingEffect(5))),
EQUA_LEAVES(new Food(new int[]{2128}, new HealingEffect(1))),
CHOC_ICE(new Food(new int[]{6794}, new HealingEffect(7))),
EDIBLE_SEAWEED(new Food(new int[] {403}, new HealingEffect(4))),
@ -346,14 +343,14 @@ public enum Consumables {
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)))),
SARA_BREW(new Potion(new int[] {6685, 6687, 6689, 6691}, new MultiEffect(new PercentHeal(0, .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, 0, 0.25)))),
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 EnergyEffect(10))),
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 RestoreEffect(8, 0.25, true))),
ZAMMY_BREW(new Potion(new int[] {2450, 189, 191, 193}, new MultiEffect(new DamageEffect(10, true, 2), new SkillEffect(Skills.ATTACK, 2, 0.20), new SkillEffect(Skills.STRENGTH, 2, 0.12), new SkillEffect(Skills.DEFENCE, -2, -0.10), new PrayerEffect(0.0, 0.10, true)))),
ZAMMY_BREW(new Potion(new int[] {2450, 189, 191, 193}, new MultiEffect(new DamageEffect(10, true), new SkillEffect(Skills.ATTACK, 0, 0.25), new SkillEffect(Skills.STRENGTH, 0, 0.15), new SkillEffect(Skills.DEFENCE, 0, -0.1)))),
ANTIFIRE(new Potion(new int[] {2452, 2454, 2456, 2458}, new AddTimerEffect("dragonfire:immunity", 600, true))),
GUTH_REST(new Potion(new int[] {4417, 4419, 4421, 4423}, new MultiEffect(new RemoveTimerEffect("poison"), new EnergyEffect(5), new HealingEffect(5)))),
MAGIC_ESS(new Potion(new int[] {9021, 9022, 9023, 9024}, new SkillEffect(Skills.MAGIC,3,0))),
@ -363,7 +360,7 @@ public enum Consumables {
/** 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 ZamorakMixEffect(), new SkillEffect(Skills.ATTACK, 2, 0.20), new SkillEffect(Skills.STRENGTH, 2, 0.12), new SkillEffect(Skills.DEFENCE, -2, -0.10)))),
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)))),
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 AddTimerEffect("poison:immunity", secondsToTicks(90)), new HealingEffect(3)))),
RELIC_MIX(new BarbarianMix(new int[] {11437, 11439}, new MultiEffect(new CureDiseaseEffect(), new HealingEffect(3)))),

View file

@ -7,21 +7,15 @@ import core.game.node.entity.player.Player;
public class DamageEffect extends ConsumableEffect {
final double amt;
final boolean isPercent;
final int baseAmount;
public DamageEffect(double amt, boolean isPercent) {
this(amt, isPercent, 0);
}
public DamageEffect(double amt, boolean isPercent, int baseAmount) {
public DamageEffect(double amt,boolean isPercent){
this.amt = amt;
this.isPercent = isPercent;
this.baseAmount = baseAmount;
}
@Override
public void activate(Player p) {
p.getImpactHandler().manualHit(p, -getHealthEffectValue(p), ImpactHandler.HitsplatType.NORMAL);
p.getImpactHandler().manualHit(p,-getHealthEffectValue(p), ImpactHandler.HitsplatType.NORMAL);
}
@Override
@ -29,8 +23,8 @@ public class DamageEffect extends ConsumableEffect {
double amount = amt;
if (isPercent) {
amount /= 100;
return (int) -(amount * player.getSkills().getLifepoints() + baseAmount);
return (int) -(amount * player.getSkills().getLifepoints());
}
return (int) -(amt + baseAmount);
return (int) -amt;
}
}

View file

@ -5,18 +5,16 @@ import core.game.consumable.ConsumableEffect
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import org.rs09.consts.Items
import kotlin.math.ceil
import kotlin.math.floor
class PrayerEffect @JvmOverloads constructor(var base: Double, var bonus: Double, private val roundUp: Boolean = false) : ConsumableEffect() {
class PrayerEffect(var base: Double, var bonus: Double) : ConsumableEffect() {
override fun activate(player: Player?) {
if(player == null) return
val level = getStatLevel(player, Skills.PRAYER)
var b = bonus
if(inInventory(player, Items.HOLY_WRENCH_6714))
b += 0.02 // Leaving this in for futureproofing. Current update is for properly rounding down.
val rawAmount = base + (level * b)
val amount = if (roundUp) ceil(rawAmount) else floor(rawAmount)
val amount = floor(base + (level * b))
modPrayerPoints(player, amount)
}
}

View file

@ -1,25 +0,0 @@
package content.data.consumables.effects;
import core.game.consumable.ConsumableEffect;
import core.game.node.entity.combat.ImpactHandler;
import core.game.node.entity.player.Player;
/**
* The Zamorak mix shows the regular Zamorak brew hitsplat (10% of pre-drink lifepoints + 2, rounded down)
* but also heals 6 lifepoints. The heal must be applied before the hit so the net change can never kill
* the player, while the hitsplat still reflects the pre-heal lifepoints.
*/
public class ZamorakMixEffect extends ConsumableEffect {
@Override
public void activate(Player p) {
int damage = (int) (p.getSkills().getLifepoints() * 0.10 + 2);
p.getSkills().heal(6);
p.getImpactHandler().manualHit(p, damage, ImpactHandler.HitsplatType.NORMAL);
}
@Override
public int getHealthEffectValue(Player player) {
return 6 - (int) (player.getSkills().getLifepoints() * 0.10 + 2);
}
}

View file

@ -1,6 +1,8 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.container.impl.EquipmentContainer
import core.game.global.action.EquipHandler
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.npc.AbstractNPC
@ -60,11 +62,12 @@ class LesserDemonChampionNPC(id: Int = 0, location: Location? = null) : Abstract
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (player.equipment.isEmpty) {
if (!player.equipment[3].hasItemPlugin()) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
} else {
sendMessage(player, "You cannot wear any equipment in this challenge.")
EquipHandler.unequip(player, EquipmentContainer.SLOT_WEAPON, id)
sendMessage(player, "You cannot use weapons in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return

View file

@ -63,8 +63,8 @@ class ZombieChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(i
val player = state.attacker
if (player is Player) {
if (state.style == CombatStyle.MELEE || state.style == CombatStyle.RANGE) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
state.neutralizeHits()
}
if (state.style == CombatStyle.MAGIC) {
sendMessage(player, "You cannot use spells in this challenge.")

View file

@ -30,7 +30,7 @@ class PenguinManager{
return tagMapping[Penguin.forLocation(location)?.ordinal]?.contains(player.username.toLowerCase()) ?: false
}
fun updateStoreFile(){
private fun updateStoreFile(){
val jsonTags = JSONArray()
tagMapping.filter { it.value.isNotEmpty() }.forEach { (ordinal,taggers) ->
log(this::class.java, Log.FINE, "$ordinal - ${taggers.first()}")

View file

@ -44,65 +44,18 @@ enum class Penguin(val id: Int, val hint: String, val location: Location){
BUSH_8(NPCs.BUSH_8105,"located in the kingdom of Asgarnia.",Location.create(2951, 3511, 0)),
BUSH_9(NPCs.BUSH_8105,"located in the northern desert.",Location.create(3350, 3311, 0)),
BUSH_10(NPCs.BUSH_8105,"located somewhere in the kingdom of Kandarin.",Location.create(2633, 3501, 0)),
BUSH_11(NPCs.BUSH_8105,"located where wizards study.",Location.create(3112, 3149, 0)),
BUSH_11(NPCs.BUSH_8105,"located south of Ardougne.",Location.create(2440, 3206, 0)),
BUSH_12(NPCs.BUSH_8105,"located where wizards study.",Location.create(3112, 3149, 0)),
ROCK_1(NPCs.ROCK_8109,"located where the Imperial Guard train.",Location.create(2852, 3578, 0)),
ROCK_2(NPCs.ROCK_8109,"located in the kingdom of Misthalin.",Location.create(3356, 3416, 0)),
ROCK_3(NPCs.ROCK_8109,"located near some ogres.",Location.create(2631, 2980, 0)), //potentially incorrect location
ROCK_3(NPCs.ROCK_8109,"located near some ogres.",Location.create(2631, 2980, 0)),
ROCK_4(NPCs.ROCK_8109,"located in the Kingdom of Asgarnia.",Location.create(3013, 3501, 0)),
ROCK_5(NPCs.ROCK_8109,"located between Fremennik and barbarians.",Location.create(2532, 3630, 0)),
CRATE_1(NPCs.CRATE_8108,"located in the kingdom of Misthalin.",Location.create(3112, 3332, 0)),
CRATE_2(NPCs.CRATE_8108,"located in the Kingdom of Misthalin.",Location.create(3305, 3508, 0)),
CRATE_3(NPCs.CRATE_8108,"located south of Ardougne.",Location.create(2440, 3206, 0)),
BARREL_1(NPCs.BARREL_8104,"located where no weapons may go.",Location.create(2806, 3383, 0)),
BARREL_1(NPCs.CRATE_8108,"located where no weapons may go.",Location.create(2806, 3383, 0)),
TOADSTOOL_1(NPCs.TOADSTOOL_8110,"located in the kingdom of Misthalin.",Location.create(3156, 3178, 0)),
TOADSTOOL_2(NPCs.TOADSTOOL_8110,"located in the fairy realm.",Location.create(2409, 4462, 0)), //potentially a spawn from 2010
BUSH_12(NPCs.BUSH_8105,"located on an island.",Location.create(2534, 3871, 0)),
BARREL_2(NPCs.BARREL_8104,"located near the ghost town.",Location.create(3654, 3491, 0)),
BUSH_13(NPCs.BUSH_8105,"located where bloodsuckers rule.",Location.create(3600, 3487, 0)),
BUSH_14(NPCs.BUSH_8105,"located on islands where brothers quarrel.",Location.create(2355, 3848, 0)),
ROCK_6(NPCs.ROCK_8109,"located on a large crescent island.",Location.create(2118, 3943, 0)),
ROCK_7(NPCs.ROCK_8109,"located on islands where brothers quarrel.",Location.create(2357, 3797, 0)),
ROCK_8(NPCs.ROCK_8109,"located in the Wilderness.",Location.create(3169, 3650, 0)),
BARREL_3(NPCs.BARREL_8104,"located where pirates feel mostly harmless.",Location.create(3738, 3001, 0)),
CACTUS_3(NPCs.CACTUS_8107,"located in the southern desert.",Location.create(3276, 2797, 0)),
TOADSTOOL_3(NPCs.TOADSTOOL_8110,"located near the pointy-eared ones.",Location.create(2314, 3174, 0)),
BUSH_15(NPCs.BUSH_8105,"located deep in the jungle.",Location.create(2938, 2978, 0)),
TOADSTOOL_4(NPCs.TOADSTOOL_8110,"located near the pointy-eared ones.",Location.create(2219, 3227, 0)),
BARREL_4(NPCs.BARREL_8104,"located south of Ardougne.",Location.create(2662, 3152, 0)),
//BARREL_5(NPCs.BARREL_8104,"located where monkeys rule.",Location.create(2751, 2700, 0)),
//currently not well accessible, will need to add when Ape Atoll is sorted.
//BUSH_16(NPCs.BUSH_8105,"located on islands where brothers quarrel.",Location.create(2353, 3834, 0)),
//currently not well accessible, will need to add when Neitiznot bridges are fixed.
ROCK_9(NPCs.ROCK_8109,"located near a mountain of wolves.",Location.create(2852, 3504, 0)),
ROCK_10(NPCs.ROCK_8109,"located on islands where brothers quarrel.",Location.create(2413, 3846, 0)),
BUSH_17(NPCs.BUSH_8105,"located near some ogres.",Location.create(2578, 2909, 0)),
CRATE_4(NPCs.CRATE_8108,"located where banana smugglers dwell.",Location.create(2869, 3157, 0)),
//CRATE_5(NPCs.CRATE_8108,"located near the island of Dragontooth.",Location.create(3824, 3562, 0)),
//current not accessible, will need to add when Dragontooth island is sorted.
ROCK_11(NPCs.ROCK_8109,"located where bloodsuckers rule.",Location.create(3550, 3439, 0)),
TOADSTOOL_5(NPCs.TOADSTOOL_8110,"located near the pointy-eared ones.",Location.create(2181, 3172, 0)),
BUSH_18(NPCs.BUSH_8105,"located where bloodsuckers rule.",Location.create(3472, 3392, 0)),
BUSH_19(NPCs.BUSH_8105,"located near Port Sarim.",Location.create(2989, 3121, 0)),
CRATE_6(NPCs.CRATE_8108,"located where fishers colonise.",Location.create(2322, 3658, 0)),
ROCK_12(NPCs.ROCK_8109,"located between Fremennik and barbarians.",Location.create(2675, 3717, 0)),
ROCK_13(NPCs.ROCK_8109,"located near the pointy-eared ones.",Location.create(2296, 3270, 0)),
CRATE_7(NPCs.CRATE_8108,"located where bloodsuckers rule.",Location.create(3637, 3486, 0)),
TOADSTOOL_6(NPCs.TOADSTOOL_8110,"located where bloodsuckers rule.",Location.create(3416, 3437, 0)),
BUSH_20(NPCs.BUSH_8105,"located where monkeys rule.",Location.create(2802, 2806, 0)),
ROCK_14(NPCs.ROCK_8109,"located near some ogres.",Location.create(2438, 3050, 0)),
CACTUS_4(NPCs.CACTUS_8107,"located in the southern desert.",Location.create(3252, 2963, 0)),
ROCK_15(NPCs.ROCK_8109,"located near some ogres.",Location.create(2340, 3064, 0)),
ROCK_16(NPCs.ROCK_8109,"located in the Wilderness.",Location.create(3108, 3837, 0)),
CACTUS_5(NPCs.CACTUS_8107,"located in the southern desert.",Location.create(3433, 3000, 0)),
CACTUS_6(NPCs.CACTUS_8107,"located in the southern desert.",Location.create(3274, 2813, 0)),
ROCK_17(NPCs.ROCK_8109,"located in the Wilderness.",Location.create(3019, 3866, 0)),
ROCK_18(NPCs.ROCK_8109,"located in the Wilderness.",Location.create(2991, 3824, 0)),
BUSH_21(NPCs.BUSH_8105,"located north of Ardougne.",Location.create(2398, 3361, 0)),
ROCK_19(NPCs.ROCK_8109,"located near the coast.",Location.create(2733, 3283, 0)),
ROCK_20(NPCs.ROCK_8109,"located in the Wilderness.",Location.create(3236, 3927, 0));
TOADSTOOL_2(NPCs.TOADSTOOL_8110,"located in the fairy realm.",Location.create(2409, 4462, 0));
companion object {
private val locationMap = values().map { it.location.toString() to it }.toMap()

View file

@ -1,10 +1,8 @@
package content.global.ame
import content.global.ame.events.surpriseexam.MysteriousOldManNPC
import core.api.getAttribute
import core.api.playGlobalAudio
import core.api.poofClear
import core.api.removeAttribute
import core.api.sendMessage
import core.api.setAttribute
import core.api.utils.WeightBasedTable
@ -27,6 +25,8 @@ import core.tools.secondsToTicks
import core.tools.ticksToCycles
import org.rs09.consts.NPCs
import org.rs09.consts.Sounds
import kotlin.math.ceil
import kotlin.math.min
import kotlin.random.Random
import kotlin.reflect.full.createInstance
@ -37,8 +37,8 @@ abstract class RandomEventNPC(id: Int) : NPC(id) {
val SMOKE_GRAPHICS = Graphics(86)
var initialized = false
var finalized = false
var timerPaused = false
var ticksLeft = secondsToTicks(180)
private val combatBracket = intArrayOf(10, 20, 40, 60, 90)
open fun create(player: Player, loot: WeightBasedTable? = null, type: String = ""): RandomEventNPC {
val event = this::class.createInstance()
@ -56,7 +56,6 @@ abstract class RandomEventNPC(id: Int) : NPC(id) {
poofClear(this)
playGlobalAudio(this.location, Sounds.SMOKEPUFF_1930, ticksToCycles(1))
}
removeAttribute(player, "random:pause")
finalized = true
}
@ -93,6 +92,7 @@ abstract class RandomEventNPC(id: Int) : NPC(id) {
override fun init() {
initialized = true
finalized = false
timerPaused = false
spawnLocation ?: terminate()
location = spawnLocation
player.setAttribute("re-npc", this)
@ -144,13 +144,12 @@ abstract class RandomEventNPC(id: Int) : NPC(id) {
}
fun idForCombatLevel(ids: List<Int>, player: Player): Int {
val index = combatBracket.indexOfFirst { player.properties.currentCombatLevel <= it }.takeIf { it != -1 }?: ids.lastIndex
val index = min(ids.size, ceil(player.properties.currentCombatLevel / 20.0).toInt()) - 1
return ids[index]
}
fun sayLine(npc: NPC, phrases: Array<String>, hasOpeningPhrase: Boolean, hasOverTimePhrase: Boolean) {
val inInteraction = getAttribute(player, "random:pause", false) //used by Certer
if ((ticksLeft % 20 == 0 || ticksLeft <= 2) && !inInteraction) { //speak every 20 ticks, or in the 2nd-to-last tick before attack/note-&-teleport
if (!timerPaused && (ticksLeft % 20 == 0 || ticksLeft <= 2)) { //unless the Certer interface is up, speak every 20 ticks, or in the 2nd-to-last tick before attack/note-&-teleport
var playDwarfWhistle = true
if (ticksLeft == secondsToTicks(180) && hasOpeningPhrase) {
sendChat(phrases[0])

View file

@ -6,7 +6,6 @@ import org.rs09.consts.NPCs
import content.global.ame.RandomEventNPC
import core.api.animate
import core.api.lock
import core.api.setAttribute
import core.api.utils.WeightBasedTable
class CerterNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.GILES_2538) {
@ -34,7 +33,8 @@ class CerterNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NP
"It's really rude to ignore someone, ${player.username}!",
"No-one ignores me!"
)
setAttribute(player, "certer:reward", false)
player.setAttribute("random:pause", false)
player.setAttribute("certer:reward", false)
animate(this, Emotes.BOW.animation, true)
}
@ -42,4 +42,4 @@ class CerterNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NP
noteAndTeleport()
terminate()
}
}
}

View file

@ -76,20 +76,6 @@ class MazeInterface : InteractionListener, EventHook<TickEvent>, MapArea {
WeightedItem(Items.DEFENCE_POTION2_135,1,1,1.0),
)
private val ONE_WAY_WALL = mapOf(
Location.create(2904, 4573, 0) to setOf( // Diagonal entries
Location.create(2904, 4573, 0),
Location.create(2904, 4572, 0),
Location.create(2904, 4574, 0),
),
Location.create(2906, 4586, 0) to setOf( // Diagonal entries
Location.create(2906, 4586, 0),
Location.create(2907, 4586, 0),
),
Location.create(2902, 4575, 0) to setOf(Location.create(2903, 4575, 0)),
Location.create(2924, 4583, 0) to setOf(Location.create(2923, 4583, 0)),
)
fun initMaze(player: Player) {
setAttribute(player, MAZE_ATTRIBUTE_TICKS_LEFT, 300)
setVarp(player, MAZE_TIMER_VARP, (getAttribute<Int>(player, MAZE_ATTRIBUTE_TICKS_LEFT, 0) / 3),false)
@ -204,25 +190,10 @@ class MazeInterface : InteractionListener, EventHook<TickEvent>, MapArea {
return@on true
}
on(
intArrayOf(
Scenery.WALL_3628,
Scenery.WALL_3629,
Scenery.WALL_3630,
Scenery.WALL_3631,
Scenery.WALL_3632,
),
IntType.SCENERY,
"open"
) { player, node ->
val scenery = node as core.game.node.scenery.Scenery
if (ONE_WAY_WALL[scenery.location]?.contains(player.location) == true) {
sendDialogue(player, "I don't think that's the right way.")
} else {
DoorActionHandler.handleAutowalkDoor(player, scenery)
}
on(Scenery.WALL_3628, IntType.SCENERY, "open") { player, node ->
// Door opening workaround
// Ignore 3629(WALL_3629) and 3630(WALL_3630) in handleAutowalkDoor ignoreSecondDoor
DoorActionHandler.handleAutowalkDoor(player, node as core.game.node.scenery.Scenery)
return@on true
}

View file

@ -23,7 +23,7 @@ class QuizMasterNPC(var type: String = "", override var loot: WeightBasedTable?
super.init()
sendChat("Hey ${player.username}! It's your lucky day!")
face(player)
kidnapPlayer(this, player, Location(1952, 4764, 1)) { player, _ ->
kidnapPlayer(this, player, Location(1952, 4764, 0)) { player, _ ->
setAttribute(player, QuizMasterDialogueFile.QUIZMASTER_ATTRIBUTE_QUESTIONS_CORRECT, 0)
sendMessage(player, "Answer four questions correctly in a row to be teleported back where you came from.")
sendMessage(player, "You will need to relog in if you lose the quiz dialog.") // Inauthentic, but there to notify the player in case.

View file

@ -5,7 +5,6 @@ import core.game.bots.SkillingBotAssembler
import core.game.bots.Script
import core.game.interaction.IntType
import core.game.interaction.InteractionListeners
import core.game.node.entity.skill.Skills
import java.util.*
class ManThiever : Script() {
@ -23,6 +22,6 @@ class ManThiever : Script() {
}
init {
skills[Skills.THIEVING] = 20
equipment.addAll(Arrays.asList(Item(1103), Item(1139), Item(1265)))
}
}

View file

@ -2,7 +2,6 @@ package content.global.dialogue;
import content.global.handlers.item.book.GeneralRuleBook;
import core.game.dialogue.DialoguePlugin;
import core.game.diary.DiaryLevel;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.diary.DiaryType;
@ -11,10 +10,6 @@ import core.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.tools.RandomFunction;
import org.rs09.consts.NPCs;
import static content.region.misthalin.lumbridge.diary.LumbridgeAchivementDiary.Companion.BeginnerTasks.DRAYNOR_TALK_TO_TOWNCRIER_ABOUT_RULES;
import static core.api.ContentAPIKt.finishTask;
/**
* Represents the town crier dialogue plugin.
@ -132,8 +127,9 @@ public final class TownCrierDialogue extends DialoguePlugin {
return true;
}
});
if (npc.getId() == NPCs.TOWN_CRIER_6136) {
finishTask(player, DiaryType.LUMBRIDGE, DiaryLevel.BEGINNER, DRAYNOR_TALK_TO_TOWNCRIER_ABOUT_RULES);
// Find out about the Rules of Conduct from the Draynor<br><br>Town Crier
if (npc.getId() == 6136) {
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 0, 10);
}
stage = 71;
break;

View file

@ -6,7 +6,6 @@ import core.game.component.ComponentDefinition
import core.game.component.ComponentPlugin
import core.game.container.access.InterfaceContainer
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.DiaryType
import core.game.node.item.Item
import core.plugin.Initializable
import core.plugin.Plugin
@ -166,10 +165,6 @@ class FurClothingInterface : ComponentPlugin(){
if (removeItem(player, requiredFur, Container.INVENTORY) &&
removeItem(player, coins, Container.INVENTORY)) {
addItem(player, clothing.product.id, amount)
if (clothing == FUR_CLOTHING.DASH_CAPE) {
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 2, 2)
}
}
}

View file

@ -0,0 +1,37 @@
package content.global.handlers.iface;
import static core.api.ContentAPIKt.*;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import content.global.travel.glider.GliderPulse;
import content.global.travel.glider.Gliders;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the glider interface component.
* @author Emperor
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class GliderInterface extends ComponentPlugin {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ComponentDefinition.put(138, this);
return this;
}
@Override
public boolean handle(final Player player, Component component, int opcode, int button, int slot, int itemId) {
final Gliders glider = Gliders.forId(button);
if (glider == null) {
return true;
}
submitWorldPulse(new GliderPulse(1, player, glider));
return true;
}
}

View file

@ -1,17 +0,0 @@
package content.global.handlers.iface
import core.api.submitWorldPulse
import content.global.travel.glider.GliderPulse
import content.global.travel.glider.Gliders
import core.game.interaction.InterfaceListener
import org.rs09.consts.Components
class GliderInterface : InterfaceListener {
override fun defineInterfaceListeners() {
on(Components.GLIDERMAP_138) { player, _, _, button, _, _ ->
val glider = Gliders.forId(button) ?: return@on true
submitWorldPulse(GliderPulse(1, player, glider))
return@on true
}
}
}

View file

@ -0,0 +1,90 @@
package content.global.handlers.iface;
import static core.api.ContentAPIKt.*;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import content.global.skill.crafting.TanningProduct;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
import kotlin.Unit;
/**
* @author Vexia
* @version 1.2
*/
@Initializable
public class TanningInterface extends ComponentPlugin {
/**
* Method used to create a new instance.
* @param arg
* @return
* @throws Throwable
*/
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ComponentDefinition.put(324, this);
return this;
}
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
TanningProduct def = null;
switch (button) {
case 1:
def = TanningProduct.SOFT_LEATHER;
break;
case 2:
def = TanningProduct.HARD_LEATHER;
break;
case 3:
def = TanningProduct.SNAKESKIN;
break;
case 4:
def = TanningProduct.SNAKESKIN2;
break;
case 5:
def = TanningProduct.GREEN_DHIDE;
break;
case 6:
def = TanningProduct.BLUEDHIDE;
break;
case 7:
def = TanningProduct.REDDHIDE;
break;
case 8:
def = TanningProduct.BLACKDHIDE;
break;
}
if (def == null) {
return true;
}
int amount = 0;
final TanningProduct deff = def;
switch (opcode){
case 155:
amount = 1;
break;
case 196:
amount = 5;
break;
case 124:
amount = 10;
case 199:
sendInputDialogue(player, true, "Enter the amount:", (value) -> {
TanningProduct.tan(player, (int) value, deff);
return Unit.INSTANCE;
});
break;
case 234:
amount = player.getInventory().getAmount(new Item(def.getItem(), 1));
break;
}
TanningProduct.tan(player, amount, def);
return true;
}
}

View file

@ -1,25 +0,0 @@
package content.global.handlers.iface
import content.global.skill.crafting.TanningProduct
import core.api.amountInInventory
import core.api.sendInputDialogue
import core.game.interaction.InterfaceListener
class TanningInterface : InterfaceListener {
override fun defineInterfaceListeners() {
on(324) { player, _, opcode, buttonID, _, _ ->
val product = TanningProduct.forId(buttonID)
when (opcode) {
155 -> TanningProduct.tan(player, 1, product)
196 -> TanningProduct.tan(player, 5, product)
124 -> TanningProduct.tan(player, 10, product)
199 -> sendInputDialogue(player, true, "Enter the amount:") { value ->
TanningProduct.tan(player, value as Int, product)
}
234 -> TanningProduct.tan(player, amountInInventory(player, product.item), product)
}
return@on true
}
}
}

View file

@ -127,7 +127,7 @@ private const val F_FLARES = 72
private const val F_PLAIN_TROUSERS = 70
private const val F_SHORTS = 77
private val femaleLegIDs = intArrayOf(F_FINE_SKIRT, F_FRILLED_SKIRT, F_LAYERED_SKIRT, F_LONG_NARROW_SKIRT, F_RAGGED_SKIRT, F_TATTERED_SKIRT, F_SHORT_SKIRT, F_SASHED_SKIRT, F_FITTED_SKIRT, F_TORN_TROUSERS, F_LONG_SKIRT, F_TURN_UPS, F_FLARES, F_PLAIN_TROUSERS, F_SHORTS)
private val femaleLegIDs = intArrayOf(F_FINE_SKIRT, F_FRILLED_SKIRT, F_LAYERED_SKIRT, F_LONG_NARROW_SKIRT, F_RAGGED_SKIRT, F_TATTERED_SKIRT, F_SHORT_SKIRT, F_SASHED_SKIRT, F_FITTED_SKIRT, F_TORN_TROUSERS, F_LONG_SKIRT, F_TURN_UPS, F_FLARES, F_FLARES, F_PLAIN_TROUSERS, F_SHORTS)
private val COINS = Item(995,1000)

View file

@ -0,0 +1,39 @@
package content.global.handlers.iface;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Handles the world map interface.
* @author Emperor
*
*/
@Initializable
public final class WorldMapInterface extends ComponentPlugin {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ComponentDefinition.forId(755).setPlugin(this);
return this;
}
//Thanks snicker!
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
switch (button) {
case 3:
player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548), 2);
player.getPacketDispatch().sendRunScript(1187, "ii", 0, 0);
player.updateSceneGraph(true);
return true;
default:
//log(this.getClass(), Log.ERR, "World map: buttonid: " + button + ", opcode: " + opcode + ", slot: " + slot);
return true;
}
}
}

View file

@ -1,23 +0,0 @@
package content.global.handlers.iface
import core.game.component.Component
import core.game.interaction.InterfaceListener
import org.rs09.consts.Components
class WorldMapInterface : InterfaceListener {
override fun defineInterfaceListeners() {
on(Components.WORLDMAP_755) { player, _, _, button, _, _ ->
if (button == 3) {
val paneId = if (player.interfaceManager.isResizable) {
Components.TOPLEVEL_FULLSCREEN_746
} else {
Components.TOPLEVEL_548
}
player.interfaceManager.openWindowsPane(Component(paneId), 2)
player.packetDispatch.sendRunScript(1187, "ii", 0, 0)
player.updateSceneGraph(true)
}
return@on true
}
}
}

View file

@ -2,6 +2,7 @@ package content.global.handlers.item
import content.global.skill.slayer.SlayerUtils
import core.api.*
import content.global.skill.slayer.Tasks
import org.rs09.consts.Items
import core.game.dialogue.DialogueFile
import core.game.dialogue.IfTopic
@ -38,7 +39,12 @@ class EnchantedGemDialogue() : DialogueFile() {
if(!hasSlayerTask(player!!)) {
npcl(core.game.dialogue.FacialExpression.HALF_THINKING, "You need something new to hunt. Come and see me when you can and I'll give you a new task.").also { stage = 1 }
} else {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "You're currently assigned to kill ${SlayerUtils.pluralise(getSlayerTaskName(player!!))}; only ${getSlayerTaskKillsRemaining(player!!)} more to go.")
if(getSlayerTask(player!!) == Tasks.JAD) {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "You're currently assigned to kill TzTok-Jad!")
} else {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "You're currently assigned to kill ${SlayerUtils.pluralise(
getSlayerTaskName(player!!))}; only ${getSlayerTaskKillsRemaining(player!!)} more to go.")
}
setVarp(player!!, 2502, getSlayerTaskFlags(player!!) shr 4)
stage = 1
}

View file

@ -1,77 +0,0 @@
package content.global.handlers.item
import core.api.*
import core.game.interaction.InteractionListener
import core.game.interaction.InterfaceListener
import core.game.node.entity.player.Player
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import org.rs09.consts.Sounds
/**
* Handles morphing with the Ring of Stone and Easter Ring.
*/
class MorphItemListener : InteractionListener, InterfaceListener {
// the morphing items
private val morphItems = intArrayOf(Items.RING_OF_STONE_6583, Items.EASTER_RING_7927)
// the NPCs to morph into
private val easterEggs = intArrayOf(
NPCs.EGG_3689,
NPCs.EGG_3690,
NPCs.EGG_3691,
NPCs.EGG_3692,
NPCs.EGG_3693,
NPCs.EGG_3694
)
private val stone = intArrayOf(NPCs.ROCKS_2626)
// the "unmorph" interface
private val morphIface = 375
// equipping the morph items
override fun defineListeners() {
onEquip(morphItems) { player, item ->
morph(player, item.id)
return@onEquip false
}
}
// the interface that appears when you morph
override fun defineInterfaceListeners() {
// hitting the 'unmorph' button
on(morphIface){ player, _, _, buttonID, _, _ ->
when(buttonID) {
3 -> closeAllInterfaces(player)
}
return@on true
}
// after the interface closes
onClose(morphIface) { player, _ ->
unmorph(player)
return@onClose true
}
}
// morphs the player
private fun morph(player: Player, item: Int) {
val morphId = when (item) {
Items.RING_OF_STONE_6583 -> stone.random()
else -> easterEggs.random()
}
playAudio(player, Sounds.EASTER06_HUMAN_INTO_EGG_1520)
stopWalk(player)
closeAllInterfaces(player)
player.appearance.transformNPC(morphId)
openInterface(player, morphIface)
}
// unmorphs the player
private fun unmorph(player: Player) {
player.appearance.transformNPC(-1)
}
}

View file

@ -0,0 +1,113 @@
package content.global.handlers.item;
import core.cache.def.impl.ItemDefinition;
import core.game.component.CloseEvent;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.world.GameWorld;
import core.plugin.Initializable;
import core.plugin.Plugin;
import core.plugin.ClassScanner;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles a morph item.
* @author Vexia
*/
@Initializable
public class MorphItemPlugin implements Plugin<Object> {
/**
* The easter egg ids.
*/
protected static final int[] EASTER_EGG_IDS = new int[] { 3689, 3690, 3691, 3692, 3693, 3694 };
/**
* The morph component.
*/
private static final Component COMPONENT = new Component(375).setCloseEvent(new CloseEvent() {
@Override
public boolean close(Player player, Component c) {
unmorph(player);
return true;
}
});
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ItemDefinition.forId(7927).getHandlers().put("equipment", this);
ItemDefinition.forId(6583).getHandlers().put("equipment", this);
ClassScanner.definePlugin(new MorphInterfacePlugin());
return this;
}
@Override
public Object fireEvent(String identifier, Object... args) {
final Player player = (Player) args[0];
final Item item = (Item) args[1];
switch (identifier) {
case "equip":
morph(player, item);
return false;
}
return true;
}
/**
* Morphs the player.
* @param player the player.
* @param item the item.
*/
private void morph(Player player, Item item) {
int morphId = item.getId() == 6583 ? 2626 : EASTER_EGG_IDS[RandomFunction.random(EASTER_EGG_IDS.length)];
playAudio(player, 1520);
player.getInterfaceManager().close();
player.getAppearance().transformNPC(morphId);
player.getInterfaceManager().removeTabs(0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
player.getLocks().lockMovement(GameWorld.getTicks() + 900000000);
player.getLocks().lockInteractions(GameWorld.getTicks() + 90000000);
player.getLocks().lockTeleport(GameWorld.getTicks() + 900000000);
player.getInterfaceManager().openSingleTab(COMPONENT);
player.getAppearance().sync();
player.getWalkingQueue().reset();
}
/**
* Unmorphs the player.
* @param player the player.
*/
private static void unmorph(Player player) {
player.getAppearance().transformNPC(-1);
player.unlock();
player.getInterfaceManager().restoreTabs();
}
/**
* Handles the morph interface plugin.
* @author Vexia
*/
public class MorphInterfacePlugin extends ComponentPlugin {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ComponentDefinition.forId(375).setPlugin(this);
return this;
}
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
player.getInterfaceManager().closeSingleTab();
return true;
}
}
}

View file

@ -129,9 +129,9 @@ class SheepBehavior : NPCBehavior(*sheepIds), InteractionListener {
val sheepDirection = Direction.getDirection(sheepLocation, playerLocation) // Get direction sheep is facing, from the player's location
val sheepOppositeDirection = sheepDirection.getOpposite() // Switch to opposite direction
val xWalkLocation = sheepLocation.x + (sheepOppositeDirection.getStepX() * 3) // Gets x location, if set, 3 steps away from player
val yWalkLocation = sheepLocation.y + (sheepOppositeDirection.getStepY() * 3) // Gets y location, if set, 3 steps away from player
val sheepWalkToLocation = Location(xWalkLocation, yWalkLocation, sheepLocation.z); // New location for pathfinding
val xWalkLocation = sheepLocation.getX() + (sheepOppositeDirection.getStepX() * 3) // Gets x location, if set, 3 steps away from player
val yWalkLocation = sheepLocation.getY() + (sheepOppositeDirection.getStepY() * 3) // Gets y location, if set, 3 steps away from player
val sheepWalkToLocation = Location(xWalkLocation, yWalkLocation, sheepLocation.getZ()); // New location for pathfinding
sendMessage(player, messagePlayer)

View file

@ -139,13 +139,6 @@ public final class AgilityHandler {
* @return The force movement instance, if force movement is used.
*/
public static ForceMovement forceWalk(final Player player, final int courseIndex, Location start, Location end, Animation animation, int speed, final double experience, final String message) {
return forceWalk(player, courseIndex, start, end, animation, speed, experience, message, null);
}
/**
* Walks across an obstacle while using an explicit force-movement facing direction.
*/
public static ForceMovement forceWalk(final Player player, final int courseIndex, Location start, Location end, Animation animation, int speed, final double experience, final String message, Direction direction) {
player.logoutListeners.put("forcewalk", p -> {
p.setLocation(player.getLocation().transform(0,0,0));
return Unit.INSTANCE;
@ -165,9 +158,6 @@ public final class AgilityHandler {
player.logoutListeners.remove("forcewalk");
}
};
if (direction != null) {
movement.setDirection(direction);
}
movement.start();
GameWorld.getPulser().submit(movement);
return movement;

View file

@ -2,7 +2,6 @@ package content.global.skill.agility
import core.api.*
import core.cache.def.impl.SceneryDefinition
import core.game.interaction.QueueStrength
import core.game.node.Node
import core.game.node.scenery.Scenery
import core.game.node.entity.player.Player
@ -169,27 +168,25 @@ class WildernessCourse
private fun handleSteppingStones(player: Player, `object`: Scenery) {
lock(player, 50)
val fail = AgilityHandler.hasFailed(player, 1, 0.3)
queueScript(player, 0, QueueStrength.SOFT) { stage ->
val courseIndex = if (stage == 5) 2 else -1
val start = player.location
val end = player.location.transform(-1, 0, 0)
val anim = Animation(741)
val xp = if (stage == 5) 20.0 else 0.0
val message = if (stage == 0) "You carefully start crossing the stepping stones..." else null
AgilityHandler.forceWalk(player, courseIndex, start, end, anim, 10, xp, message)
if (stage == 2 && fail) {
val dest = Location(3001, 3963, 0)
val failanim = Animation(771)
val hit = (player.skills.lifepoints * 0.26).toInt()
AgilityHandler.fail(player, -1, dest, failanim, hit, "... You lose your footing and fall into the lava.")
return@queueScript stopExecuting(player)
}
if (stage == 5) {
unlock(player)
return@queueScript stopExecuting(player)
}
return@queueScript delayScript(player, 2)
val origLoc = player.location
registerLogoutListener(player, "steppingstone"){p ->
player.location = origLoc
}
submitWorldPulse(object : Pulse(2, player){
var counter = 0
override fun pulse(): Boolean {
if (counter == 3 && fail) {
AgilityHandler.fail(player, -1, Location.create(3001, 3963, 0), Animation.create(771), (player.skills.lifepoints * 0.26).toInt(), "...You lose your footing and fall into the lava.")
return true
}
AgilityHandler.forceWalk(player, if (counter == 5) 2 else -1, player.location, player.location.transform(-1, 0, 0), Animation.create(741), 10, if (counter == 5) 20.0 else 0.0, if (counter != 0) null else "You carefully start crossing the stepping stones...")
if(++counter == 6){
unlock(player)
clearLogoutListener(player, "steppingstone")
}
return counter == 6
}
})
}
/**

View file

@ -5,9 +5,6 @@ import core.game.node.entity.Entity;
import core.game.node.entity.player.Player;
import core.game.system.task.MovementHook;
import core.game.system.task.Pulse;
import core.net.packet.PacketRepository;
import core.net.packet.context.PlayerContext;
import core.net.packet.out.ClearMinimapFlag;
import kotlin.Unit;
import core.game.world.GameWorld;
import core.game.world.map.Direction;
@ -27,10 +24,6 @@ public final class BladeTrap implements MovementHook {
final Direction dir = e.getDirection();
final Player player = (Player) e;
final Location start = l.transform(-dir.getStepX(), -dir.getStepY(), 0);
player.getPulseManager().clear();
player.getWalkingQueue().reset();
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
e.lock(5);
if(e.isPlayer())
{

View file

@ -119,8 +119,6 @@ public final class BrimhavenCourse extends OptionHandler {
final Direction dir = direction;
final Direction faceDirection = Direction.get(object.getDirection().toInteger() - 1 & 3);
final Location start = player.getLocation();
player.setDirection(faceDirection);
player.faceLocation(start.transform(faceDirection));
player.getAppearance().setAnimations(Animation.create(1118 + m));
player.getAppearance().sync();
AgilityHandler.climb(player, -1, new Animation(1117 + m), start.transform(dir), 0.0, null);
@ -145,12 +143,12 @@ public final class BrimhavenCourse extends OptionHandler {
} else if (count == 6) {
player.getAppearance().setAnimations();
player.getAppearance().sync();
AgilityHandler.forceWalk(player, -1, last, last.transform(dir), Animation.create(1120 + m), 5, getExp(player, 22.0), null, faceDirection);
AgilityHandler.forceWalk(player, -1, last, last.transform(dir), Animation.create(1120 + m), 5, getExp(player, 22.0), null).setDirection(faceDirection);
player.logoutListeners.remove("brimcourse");
return true;
}
player.logoutListeners.remove("brimcourse");
AgilityHandler.forceWalk(player, -1, last, last = last.transform(dir), Animation.create(1118 + m), 5, 0.0, null, faceDirection);
AgilityHandler.forceWalk(player, -1, last, last = last.transform(dir), Animation.create(1118 + m), 5, 0.0, null).setDirection(faceDirection);
return false;
}
});
@ -274,7 +272,7 @@ public final class BrimhavenCourse extends OptionHandler {
public boolean pulse() {
if (!finish) {
setDelay(2);
AgilityHandler.fail(player, 1, player.getLocation().transform(0, 0, -3), Animation.create(768), getHitAmount(player), "You stepped on a broken piece of plank!");
AgilityHandler.fail(player, 1, player.getLocation().transform(0, 0, -3), Animation.create(189), getHitAmount(player), "You stepped on a broken piece of plank!");
finish = true;
return false;
}
@ -284,7 +282,7 @@ public final class BrimhavenCourse extends OptionHandler {
});
return;
}
AgilityHandler.walk(player, -1, start, end, Animation.create(1426), getExp(player, 6.0), null);
AgilityHandler.walk(player, -1, start, end, ForceMovement.WALK_ANIMATION, getExp(player, 6.0), null);
}
/**
@ -391,7 +389,6 @@ public final class BrimhavenCourse extends OptionHandler {
}
break;
case 3551:
case 3583:
return n.getLocation();
}
return null;

View file

@ -7,8 +7,6 @@ import core.game.node.entity.impl.Projectile;
import core.game.node.entity.player.Player;
import core.game.system.task.MovementHook;
import core.game.system.task.Pulse;
import core.net.packet.context.PlayerContext;
import core.net.packet.out.ClearMinimapFlag;
import kotlin.Unit;
import core.game.world.GameWorld;
import core.game.world.map.Direction;
@ -31,9 +29,6 @@ public final class DartTrap implements MovementHook {
final Direction dir = e.getDirection();
final Player player = (Player) e;
final Location start = l.transform(-dir.getStepX(), -dir.getStepY(), 0);
player.getPulseManager().clear();
player.getWalkingQueue().reset();
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
e.lock(6);
if(e.isPlayer())
{

View file

@ -6,9 +6,6 @@ import core.game.node.entity.Entity;
import core.game.node.entity.player.Player;
import core.game.system.task.MovementHook;
import core.game.system.task.Pulse;
import core.net.packet.PacketRepository;
import core.net.packet.context.PlayerContext;
import core.net.packet.out.ClearMinimapFlag;
import kotlin.Unit;
import core.game.world.GameWorld;
import core.game.world.map.Direction;
@ -27,9 +24,6 @@ public final class FloorSpikes implements MovementHook {
final Direction dir = e.getDirection();
final Player player = (Player) e;
final Location start = l.transform(-dir.getStepX(), -dir.getStepY(), 0);
player.getPulseManager().clear();
player.getWalkingQueue().reset();
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
e.lock(5);
if(e.isPlayer())
{

View file

@ -6,9 +6,6 @@ import core.game.node.entity.Entity;
import core.game.node.entity.player.Player;
import core.game.system.task.MovementHook;
import core.game.system.task.Pulse;
import core.net.packet.PacketRepository;
import core.net.packet.context.PlayerContext;
import core.net.packet.out.ClearMinimapFlag;
import kotlin.Unit;
import core.game.world.GameWorld;
import core.game.world.map.Direction;
@ -27,10 +24,6 @@ public final class PressurePad implements MovementHook {
final Direction dir = e.getDirection();
final Player player = (Player) e;
final Location start = dest.transform(-dir.getStepX(), -dir.getStepY(), 0);
player.getPulseManager().clear();
player.getWalkingQueue().reset();
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
e.lock(5);
if(e.isPlayer())
{

View file

@ -6,9 +6,6 @@ import core.game.node.entity.Entity;
import core.game.node.entity.player.Player;
import core.game.system.task.MovementHook;
import core.game.system.task.Pulse;
import core.net.packet.PacketRepository;
import core.net.packet.context.PlayerContext;
import core.net.packet.out.ClearMinimapFlag;
import kotlin.Unit;
import core.game.world.GameWorld;
import core.game.world.map.Direction;
@ -27,9 +24,6 @@ public final class SpinningBlades implements MovementHook {
final Direction dir = e.getDirection();
final Player player = (Player) e;
final Location start = l.transform(-dir.getStepX(), -dir.getStepY(), 0);
player.getPulseManager().clear();
player.getWalkingQueue().reset();
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
e.lock(5);
if(e.isPlayer())
{
@ -76,4 +70,4 @@ public final class SpinningBlades implements MovementHook {
}
player.getPacketDispatch().sendSceneryAnimation(RegionManager.getObject(l), Animation.create(1107));
}
}
}

View file

@ -96,12 +96,12 @@ public final class HouseZone extends MapZone {
Player p = (Player) e;
// if the player is moving between the dungeon and main house, don't trigger the leave sequence
if (house.getDungeonRegion() != null && !logout) {
if (!logout) {
// current loc
Location dest = p.getProperties().getTeleportLocation();
int currentRegionId = p.getLocation().getRegionId();
int houseId = house.getHouseRegion().getId();
int dungeonId = house.getDungeonRegion().getId();
int dungeonId = (house.getDungeonRegion() != null) ? house.getDungeonRegion().getId() : -1;
// check if still in house
boolean currentlyInHouse = (currentRegionId == houseId || currentRegionId == dungeonId);
@ -122,7 +122,7 @@ public final class HouseZone extends MapZone {
house.expelGuests(p);
int toRemove = previousRegion;
int dungRemove = previousDungeon;
submitWorldPulse(new Pulse(1) {
submitWorldPulse(new Pulse(2) {
public boolean pulse() {
Region r = RegionManager.forId(toRemove);
Region dr = dungRemove != -1 ? RegionManager.forId(dungRemove) : null;

View file

@ -1,68 +0,0 @@
package content.global.skill.construction.decoration.skillhall
import content.global.skill.construction.HouseManager
import core.api.openDialogue
import core.game.dialogue.DialogueFile
import core.game.dialogue.FacialExpression
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.world.repository.Repository
import core.tools.END_DIALOGUE
import org.rs09.consts.NPCs
import org.rs09.consts.Scenery as Sceneries
class MountedCockatriceHead : InteractionListener {
override fun defineListeners() {
on(Sceneries.COCKATRICE_HEAD_13482, IntType.SCENERY, "talk-to") { player, _ ->
val house = player.getAttribute<HouseManager>("poh_entry", player.houseManager)
if (house == player.houseManager) {
openDialogue(player, MountedCockatriceHeadOwnerDialogue())
} else {
val ownerName = Repository.players.first { it.houseManager == house }.username.capitalize()
openDialogue(player, MountedCockatriceHeadGuestDialogue(ownerName))
}
return@on true
}
}
}
class MountedCockatriceHeadOwnerDialogue : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (stage) {
0 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_NORMAL, "You deaded me!").also { stage++ }
1 -> playerl(FacialExpression.NEUTRAL, "Well, yes.").also { stage++ }
2 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_NORMAL, "What did you do that for?").also { stage++ }
3 -> options("A Slayer Master told me to.", "So I could mount your head on my wall.", "I just wanted to.").also { stage++ }
4 -> when (buttonID) {
1 -> playerl(FacialExpression.NEUTRAL, "A Slayer Master told me to.").also { stage = 10 }
2 -> playerl(FacialExpression.NEUTRAL, "So I could mount your head on my wall.").also { stage = 20 }
3 -> playerl(FacialExpression.NEUTRAL, "I just wanted to.").also { stage = 30 }
}
10 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_SAD, "Why do the Slayer Masters all pick on poor cockatrice?").also { stage++ }
11 -> playerl(FacialExpression.NEUTRAL, "They pick on lots of other creatures too.").also { stage++ }
12 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_SAD, "Then mount one of them on your wall and let poor cockatrice rest in peace!").also { stage = END_DIALOGUE }
20 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_SAD, "Another cockatrice falls victim to the dreaded mirror shield!").also { stage++ }
21 -> playerl(FacialExpression.NEUTRAL, "Don't take it personally. You look good on my wall.").also { stage++ }
22 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_SAD, "I don't care! I think I looked better with a body!").also { stage = END_DIALOGUE }
30 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_ANGRY, "You dirty rotten swine, you!").also { stage++ }
31 -> playerl(FacialExpression.AMAZED, "Steady on.").also { stage++ }
32 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_ANGRY, "I will kill you with my paralyzing-type magic eyes look!").also { stage++ }
33 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_ANGRY, "Dots appear in air between eyes and victim. Dot! Dot! Dotty!").also { stage++ }
34 -> playerl(FacialExpression.NEUTRAL, "Er, nothing's happening...").also { stage++ }
35 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_ANGRY, "Concentrates mental power. Eyes narrow beak clenches veins on head stand out.").also { stage++ }
36 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_ANGRY, "Strain!").also { stage++ }
37 -> playerl(FacialExpression.ASKING, "You're dead, cockatrice. Your eyes are glass beads. It won't work.").also { stage++ }
38 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_ANGRY, "STRA-A-AIN!").also { stage++ }
39 -> playerl(FacialExpression.ASKING, "I think I'll leave you to it.").also { stage = END_DIALOGUE }
}
}
}
class MountedCockatriceHeadGuestDialogue(private val ownerName: String) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (stage) {
0 -> playerl(FacialExpression.HAPPY, "Hey, a cockatrice!").also { stage++ }
1 -> npcl(NPCs.COCKATRICE_4227, FacialExpression.CHILD_SAD, "$ownerName deaded me! That wasn't very nice!").also { stage = END_DIALOGUE }
}
}
}

View file

@ -1,39 +0,0 @@
package content.global.skill.cooking
import core.api.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.skill.Skills
import org.rs09.consts.Items
class CakeListener : InteractionListener {
private val cakeArr = intArrayOf(
Items.EGG_1944,
Items.BUCKET_OF_MILK_1927,
Items.POT_OF_FLOUR_1933
)
override fun defineListeners() {
onUseWith(IntType.ITEM, cakeArr, Items.CAKE_TIN_1887) { player, _, _ ->
if (getDynLevel(player, Skills.COOKING) < 40) {
sendMessage(player, "You need a Cooking level of at least 40 in order to do this.")
return@onUseWith true
}
if(inInventory(player, Items.EGG_1944) && inInventory(player, Items.BUCKET_OF_MILK_1927) && inInventory(player, Items.POT_OF_FLOUR_1933) && inInventory(player, Items.CAKE_TIN_1887)) {
if(removeItem(player, Items.EGG_1944) && removeItem(player, Items.BUCKET_OF_MILK_1927) && removeItem(player, Items.POT_OF_FLOUR_1933) && removeItem(player, Items.CAKE_TIN_1887)){
addItem(player, Items.EMPTY_POT_1931)
addItem(player, Items.UNCOOKED_CAKE_1889)
addItem(player, Items.BUCKET_1925)
sendMessage(player, "You mix the milk, flour and egg together to make a raw cake mix.")
}
}
else{
// Not sure about the authentic message
sendMessage(player, "You don't have enough ingredients to make that.")
}
return@onUseWith true
}
}
}

View file

@ -0,0 +1,69 @@
package content.global.skill.cooking;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to make a cake.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class CakeMakingPlugin extends UseWithHandler {
/**
* Represents the bucket of milk item.
*/
private static final Item BUCKET_OF_MILK = new Item(1927);
/**
* Represents the egg item.
*/
private static final Item EGG = new Item(1944);
/**
* Represents the cake tin item.
*/
private static final Item CAKE_TIN = new Item(1887);
/**
* Represents the pot of flour item.
*/
private static final Item POT_OF_FLOUR = new Item(1933);
/**
* Represents the uncooked cake item.
*/
private static final Item UNCOOKED_CAKE = new Item(1889);
/**
* Constructs a new {@code CakeMakingPlugin} {@code Object}.
*/
public CakeMakingPlugin() {
super(1933);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(1887, ITEM_TYPE, this);
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
if (event.getUsedItem().getId() == 1887 && ((Item) event.getUsedWith()).getId() == 1933 || event.getUsedWith().getName().equalsIgnoreCase("cake tin") && ((Item) event.getUsedItem()).getName().equalsIgnoreCase("pot of flour")) {
if (event.getPlayer().getInventory().contains(1933, 1) && event.getPlayer().getInventory().contains(1927, 1) && event.getPlayer().getInventory().contains(1944, 1)) {
if (event.getPlayer().getInventory().remove(BUCKET_OF_MILK, EGG, CAKE_TIN, POT_OF_FLOUR)) {
event.getPlayer().getInventory().add(UNCOOKED_CAKE);
event.getPlayer().getPacketDispatch().sendMessage("You mix the milk, flour and egg together to make a raw cake mix.");
return true;
}
}
}
return false;
}
}

View file

@ -1,31 +0,0 @@
package content.global.skill.cooking
import core.api.addItem
import core.api.removeItem
import core.api.sendMessage
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class CoconutListener : InteractionListener {
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.COCONUT_5974, Items.HAMMER_2347) { player, used, _ ->
if(removeItem(player, used.id)) {
addItem(player, Items.COCONUT_5976)
sendMessage(player, "You crush the coconut with a hammer.")
return@onUseWith true
}
return@onUseWith false
}
onUseWith(IntType.ITEM, Items.COCONUT_5976, Items.VIAL_229) { player, used, with ->
if(removeItem(player, used.id) && removeItem(player, with.id)) {
addItem(player, Items.COCONUT_SHELL_5978)
addItem(player, Items.COCONUT_MILK_5935)
sendMessage(player, "You overturn the coconut into a vial.")
return@onUseWith true
}
return@onUseWith false
}
}
}

View file

@ -0,0 +1,56 @@
package content.global.skill.cooking;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to make a coconut.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class CoconutMakePlugin extends UseWithHandler {
/**
* Represents the items related to coconut making plugin.
*/
private static final Item[] ITEMS = new Item[] { new Item(5974, 1), new Item(5976, 1), new Item(229), new Item(5935, 1), new Item(5978) };
/**
* Constructs a new {@code CoconutMakePlugin} {@code Object}.
*/
public CoconutMakePlugin() {
super(5974, 5976);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(2347, ITEM_TYPE, this);
addHandler(229, ITEM_TYPE, this);
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
final Item usedWith = (Item) event.getUsedWith();
if (usedWith.getId() == 5974 && event.getUsedItem().getId() == 2347 || usedWith.getId() == 2347 && event.getUsedItem().getId() == 5974) {
player.getInventory().remove(ITEMS[0]);
player.getInventory().add(ITEMS[1]);
player.getPacketDispatch().sendMessage("You crush the coconut with a hammer.");
}
if (usedWith.getId() == 5976 && event.getUsedItem().getId() == 229 || usedWith.getId() == 229 && event.getUsedItem().getId() == 5976) {
player.getInventory().remove(ITEMS[1]);
player.getInventory().remove(ITEMS[2]);
player.getInventory().add(ITEMS[3]);
player.getInventory().add(ITEMS[4]);
player.getPacketDispatch().sendMessage("You overturn the coconut into a vial.");
}
return true;
}
}

View file

@ -0,0 +1,134 @@
package content.global.skill.cooking;
import content.global.skill.cooking.recipe.Recipe;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.system.task.Pulse;
import core.plugin.Initializable;
import core.plugin.Plugin;
import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
import core.game.dialogue.SkillDialogueHandler;
import java.util.ArrayList;
import java.util.List;
/**
* Represents a cooking recipe plugin. This is used to handle the multiple
* recipes used in cooking these recipes can range from making a pizza or making
* a pie.
* @author 'Vexia
* @version 1.9
*/
@Initializable
public final class CookingRecipePlugin extends UseWithHandler {
/**
* Constructs a new {@code CookingRecipePlugin} {@code Object}.
*/
public CookingRecipePlugin() {
super(getAllowedNodes());
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (Recipe recipe : Recipe.RECIPES) {
for (Item ingredient : recipe.getIngredients()) {
addHandler(ingredient.getId(), ITEM_TYPE, this);
}
}
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
Recipe recipe = null;
Item part = null;
// TODO: Transitioning to a Listener would save an O(n) pass through the recipes list on every use-with
recipeloop:
for (Recipe temp : Recipe.RECIPES) {
if (temp.isSingular()) {
if (temp.getBase().getId() == event.getUsedItem().getId() || temp.getBase().getId() == event.getBaseItem().getId()) {
for (Item ingredient : temp.getIngredients()) {
if (ingredient.getId() == event.getBaseItem().getId() || ingredient.getId() == event.getUsedItem().getId()) {
recipe = temp;
break recipeloop;
}
}
}
} else {
for (int k = 0; k < temp.getParts().length; k++) {
for (int i = 0; i < temp.getIngredients().length; i++) {
Item tempPart = temp.getParts()[k];
Item ingredient = temp.getIngredients()[i];
if (tempPart.getId() == event.getUsedItem().getId() && ingredient.getId() == event.getBaseItem().getId() || tempPart.getId() == event.getBaseItem().getId() && ingredient.getId() == event.getUsedItem().getId()) {
if (k == i) {// represents that this ingredient can
// mix with the other.
recipe = temp;
part = tempPart;
break recipeloop;
}
}
}
}
}
}
if (recipe != null) {
final Player player = event.getPlayer();
final Recipe recipe_ = recipe;
final Item part_ = part;
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, recipe.getProduct()) {
@Override
public void create(final int amount, int index) {
player.getPulseManager().run(new Pulse(2) {
int count = 0;
@Override
public boolean pulse() {
recipe_.mix(player, event);
return ++count >= amount;
}
});
}
@Override
public int getAll(int index) {
return player.getInventory().getAmount(part_ != null ? part_ : recipe_.getBase());
}
};
if (player.getInventory().getAmount(recipe.getBase()) == 1) {
recipe_.mix(player, event);
} else {
handler.open();
}
return true;
}
return false;
}
/**
* Method used to get the allowed nodes for this plugin.
* @return the allowed nodes.
*/
private final static int[] getAllowedNodes() {
List<Integer> bases = new ArrayList<>(10);
for (Recipe recipe : Recipe.RECIPES) {
for (Item base : recipe.getParts()) {
if (bases.contains(base.getId())) {
continue;
}
bases.add(base.getId());
}
if (bases.contains(recipe.getBase().getId())) {
continue;
}
bases.add(recipe.getBase().getId());
}
int[] baseArray = new int[bases.size()];
for (int i = 0; i < bases.size(); i++) {
baseArray[i] = bases.get(i);
}
return baseArray;
}
}

View file

@ -43,6 +43,7 @@ public class IntentionalBurnPulse extends StandardCookingPulse {
@Override
public boolean cook(Player player, Scenery object, boolean burned, int initial, int product) {
super.animate();
Item initialItem = new Item(initial);
Item productItem = new Item(product);
@ -50,7 +51,6 @@ public class IntentionalBurnPulse extends StandardCookingPulse {
player.getInventory().add(productItem);
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
playAudio(player, Sounds.FRY_2577);
super.animate();
return true;
}
return false;

View file

@ -0,0 +1,56 @@
package content.global.skill.cooking;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the pie shell making plugin.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class PieShellPlugin extends UseWithHandler {
/**
* Represents the pie sell item.
*/
private static final Item PIE_SHELL = new Item(2315, 1);
/**
* Represents the pie dish item.
*/
private static final Item PIE_DISH = new Item(2313, 1);
/**
* Represents the pastry dough item.
*/
private static final Item PASTRY_DOUGH = new Item(1953, 1);
/**
* Constructs a new {@code PieMakingPlugin} {@code Object}.
*/
public PieShellPlugin() {
super(1953);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(2313, ITEM_TYPE, this);
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
if (player.getInventory().remove(PASTRY_DOUGH, PIE_DISH)) {
player.getInventory().add(PIE_SHELL);
player.getPacketDispatch().sendMessage("You put the pastry dough into the pie dish to make a pie shell.");
}
return true;
}
}

View file

@ -1,38 +0,0 @@
package content.global.skill.cooking
import core.api.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.skill.Skills
import org.rs09.consts.Items
class SkeweredFoodListener : InteractionListener {
val skewerMap = hashMapOf(
Items.RAW_CHOMPY_2876 to Items.SKEWERED_CHOMPY_7230,
Items.RAW_RABBIT_3226 to Items.SKEWERED_RABBIT_7224,
Items.RAW_BIRD_MEAT_9978 to Items.SKEWERED_BIRD_MEAT_9984,
Items.RAW_BEAST_MEAT_9986 to Items.SKEWERED_BEAST_9992
)
override fun defineListeners() {
onUseWith(IntType.ITEM, skewerMap.keys.toIntArray(), Items.IRON_SPIT_7225) { player, used, with ->
val level = when (used.id) {
Items.RAW_BIRD_MEAT_9978 -> 11
Items.RAW_RABBIT_3226 -> 16
Items.RAW_BEAST_MEAT_9986 -> 21
Items.RAW_CHOMPY_2876 -> 30
else -> 0
}
if (getDynLevel(player, Skills.COOKING) < level) {
sendMessage(player, "You need a Cooking level of at least $level in order to do this.")
return@onUseWith true
}
if (removeItem(player, used.id) && removeItem(player, with.id)) {
skewerMap[used.id]?.let { addItem(player, it) }
return@onUseWith true
}
return@onUseWith false
}
}
}

View file

@ -0,0 +1,115 @@
package content.global.skill.cooking;
import core.game.node.entity.skill.Skills;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Items;
/**
* Represents the plugin used to make skwered items.
* @author 'Vexia
* @date 22/12/2013
*/
@Initializable
public class SkeweredFoodPlugin extends UseWithHandler {
/**
* Represents the level required.
*/
private final int LEVEL = 20;
/**
* Constructs a new {@code SkeweredFoodPlugin} {@code Object}.
*/
public SkeweredFoodPlugin() {
super(7225);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (SkeweredSet set : SkeweredSet.values()) {
addHandler(set.getRaw().getId(), ITEM_TYPE, this);
}
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
if (player.getSkills().getLevel(Skills.FIREMAKING) < LEVEL) {
player.getPacketDispatch().sendMessage("You meed a Firemaking level of at least " + LEVEL + " in order to do this.");
return true;
}
final SkeweredSet set = SkeweredSet.forItem(event.getBaseItem().getId() == 7225 ? event.getUsedItem() : event.getBaseItem());
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
player.getInventory().add(set.getProduct());
}
return true;
}
/**
* Represents a set of skwered items.
* @author 'Vexia
* @date 22/12/2013
*/
public enum SkeweredSet {
CHOMPY(new Item(Items.RAW_CHOMPY_2876), new Item(Items.SKEWERED_CHOMPY_7230)),
RABBIT(new Item(Items.RAW_RABBIT_3226), new Item(Items.SKEWERED_RABBIT_7224)),
BIRD(new Item(Items.RAW_BIRD_MEAT_9978), new Item(Items.SKEWERED_BIRD_MEAT_9984)),
BEAST(new Item(Items.RAW_BEAST_MEAT_9986), new Item(Items.SKEWERED_BEAST_9992));
/**
* Represents the raw item.
*/
private final Item raw;
/**
* Represents the product item.
*/
private final Item product;
/**
* Constructs a new {@code SkeweredFoodPlugin} {@code Object}.
* @param raw the raw item.
* @param product the product.
*/
private SkeweredSet(Item raw, Item product) {
this.raw = raw;
this.product = product;
}
/**
* Gets the raw.
* @return The raw.
*/
public Item getRaw() {
return raw;
}
/**
* Gets the product.
* @return The product.
*/
public Item getProduct() {
return product;
}
/**
* Gets the skwered set.
* @param item the item.
* @return the set.
*/
public static SkeweredSet forItem(final Item item) {
for (SkeweredSet set : values()) {
if (set.getRaw().getId() == item.getId()) {
return set;
}
}
return null;
}
}
}

View file

@ -149,6 +149,7 @@ public class StandardCookingPulse extends Pulse {
public boolean cook(final Player player, final Scenery object, final boolean burned, final int initial, final int product) {
Item initialItem = new Item(initial);
Item productItem = new Item(product);
animate();
//handle special cooking results (spits, cake, etc) that don't justify separate plugin
switch (initial) {
@ -187,7 +188,6 @@ public class StandardCookingPulse extends Pulse {
}
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
playAudio(player, Sounds.FRY_2577);
animate();
return true;
}
return false;

View file

@ -1,20 +0,0 @@
package content.global.skill.cooking
import core.api.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class WatermelonSliceListener : InteractionListener {
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.WATERMELON_5982, Items.KNIFE_946) { player, used, _ ->
if(removeItem(player, used.asItem())) {
addItemOrDrop(player, Items.WATERMELON_SLICE_5984, 3)
sendMessage(player, "You slice the watermelon into three slices.")
return@onUseWith true
}
return@onUseWith false
}
}
}

View file

@ -0,0 +1,59 @@
package content.global.skill.cooking;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.item.GroundItemManager;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to slice a watermelon.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class WatermelonSlicePlugin extends UseWithHandler {
/**
* Represents the knife item.
*/
private static final Item KNIFE = new Item(946);
/**
* Represents the watermelon item.
*/
private static final Item WATERMELON = new Item(5982);
/**
* Represents the watermelon slice item.
*/
private static final Item WATERMELON_SLICE = new Item(5984);
/**
* Constructs a new {@code WatermelonSlicePlugin.java} {@code Object}.
*/
public WatermelonSlicePlugin() {
super(KNIFE.getId());
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(5982, ITEM_TYPE, this);
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
if (event.getPlayer().getInventory().remove(WATERMELON)) {
for (int i = 0; i < 3; i++) {
if (!event.getPlayer().getInventory().add(WATERMELON_SLICE)) {
GroundItemManager.create(WATERMELON_SLICE, event.getPlayer());
}
}
event.getPlayer().getPacketDispatch().sendMessage("You slice the watermelon into three slices.");
}
return true;
}
}

View file

@ -1,30 +0,0 @@
package content.global.skill.cooking
import content.global.skill.cooking.fermenting.WineFermentingPulse
import core.api.addItem
import core.api.getDynLevel
import core.api.removeItem
import core.api.sendMessage
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.skill.Skills
import core.game.world.GameWorld.Pulser
import org.rs09.consts.Items
class WineFermentListener : InteractionListener {
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.GRAPES_1987, Items.JUG_OF_WATER_1937) { player, used, with ->
if (getDynLevel(player, Skills.COOKING) < 35) {
sendMessage(player, "You need a cooking level of 35 to do this.")
return@onUseWith true
}
if (removeItem(player, used.id) && removeItem(player, with.id)) {
addItem(player, Items.UNFERMENTED_WINE_1995)
Pulser.submit(WineFermentingPulse(1, player))
return@onUseWith true
}
return@onUseWith false
}
}
}

View file

@ -0,0 +1,63 @@
package content.global.skill.cooking;
import core.plugin.Initializable;
import core.game.node.entity.skill.Skills;
import content.global.skill.cooking.fermenting.WineFermentingPulse;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.world.GameWorld;
import core.plugin.Plugin;
/**
* Represents the plugin used to ferment wine.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class WineFermentPlugin extends UseWithHandler {
/**
* Represents the grapes item.
*/
private static final Item GRAPES = new Item(1987, 1);
/**
* Represents the jug of water item.
*/
private static final Item JUG_OF_WATER = new Item(1937, 1);
/**
* Represents the unfermented wine item.
*/
private static final Item UNFERMENTED_WINE = new Item(1995, 1);
/**
* Constructs a new {@code WineFermentPlugin} {@code Object}.
*/
public WineFermentPlugin() {
super(1937);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(1987, ITEM_TYPE, this);
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
if (player.getSkills().getLevel(Skills.COOKING) < 35) {
player.getPacketDispatch().sendMessage("You need a cooking level of 35 to do this.");
return true;
}
if (player.getInventory().remove(GRAPES, JUG_OF_WATER)) {
player.getInventory().add(UNFERMENTED_WINE);
GameWorld.getPulser().submit(new WineFermentingPulse(1, player));
}
return true;
}
}

View file

@ -1,31 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class ChocolateCakeListener : InteractionListener {
val chocolate = intArrayOf(Items.CHOCOLATE_BAR_1973, Items.CHOCOLATE_DUST_1975)
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.CAKE_1891, *chocolate) { player, used, with ->
val product = Items.CHOCOLATE_CAKE_1897
val level = 50
val experience = 30.0
val message = ""
val failMessage = "You need a Cooking level of $level in order to do that."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
}

View file

@ -1,37 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.item.Item
import org.rs09.consts.Items
class CurryListener : InteractionListener {
val added = intArrayOf(Items.CURRY_LEAF_5970, Items.SPICE_2007)
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.UNCOOKED_STEW_2001, *added) { player, used, with ->
val product = Items.UNCOOKED_CURRY_2009
val amountAdded = when (with.id) {
Items.CURRY_LEAF_5970 -> 3
Items.SPICE_2007 -> 1
else -> 0
}
val level = 60
val experience = 0.0
val message = "You mix the spice with the stew."
val failMessage = "You need a Cooking level of at least $level in order to do this."
return@onUseWith standardMix(
player,
used.asItem(),
Item(with.id, amountAdded),
product,
level,
experience,
message,
failMessage
)
}
}
}

View file

@ -1,72 +0,0 @@
package content.global.skill.cooking.recipe
import core.api.*
import core.game.dialogue.SkillDialogueHandler
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import kotlin.math.min
fun standardMix(player: Player, used: Item, with: Item, product: Int, level: Int, experience: Double, message: String, failMessage: String): Boolean {
// Avoids sending dialogue if not enough ingredients to create (relevant only for curry leaves)
if (amountInInventory(player, used.id) < used.amount || amountInInventory(player, with.id) < with.amount) {
// Not sure about the authentic message
sendMessage(player, "You don't have enough ingredients to make that.")
return true
}
// Avoids sending dialogue if only one can be created
if (amountInInventory(player, used.id) == used.amount || amountInInventory(player, with.id) == with.amount) {
if (getDynLevel(player, Skills.COOKING) < level) {
sendDialogue(player, failMessage)
return true
}
if (removeItem(player, used) && removeItem(player, with)) {
sendMessage(player, message)
rewardXP(player, Skills.COOKING, experience)
addItem(player, product)
containerIngredient(player, used.id)
containerIngredient(player, with.id)
}
return true
}
mixHandler(
player,
used,
with,
product,
level,
experience,
message,
failMessage
).open()
return true
}
private fun mixHandler(player: Player, used: Item, with: Item, product: Int, level: Int, experience: Double, message: String, failMessage: String): SkillDialogueHandler {
val handler: SkillDialogueHandler =
object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, product.asItem()) {
override fun create(amount: Int, index: Int) {
if (!playerMeetsInitialRequirements()) return
MixScript(player, used, with, product, amount, level, experience, message, failMessage).invoke()
}
private fun playerMeetsInitialRequirements(): Boolean {
if (getDynLevel(player, Skills.COOKING) < level) {
sendDialogue(player, failMessage)
return false
}
return true
}
override fun getAll(index: Int): Int {
return min(
amountInInventory(player, used.id)/used.amount,
amountInInventory(player, with.id)/with.amount
)
}
}
return handler
}

View file

@ -1,57 +0,0 @@
package content.global.skill.cooking.recipe
import core.api.*
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import org.rs09.consts.Items
class MixScript(
private val player: Player,
private val used: Item,
private val with: Item,
private val product: Int,
private val sets: Int,
private val level: Int,
private val experience: Double,
private val message: String,
private val failMessage: String
) {
private val delay = 2
fun invoke() {
queueScript(player, delay) { stage -> Int
if (getDynLevel(player, Skills.COOKING) < level) {
sendDialogue(player, failMessage)
return@queueScript stopExecuting(player)
}
if (inInventory(player, used.id, used.amount) && inInventory(player, with.id, with.amount)) {
if(removeItem(player, used) && removeItem(player, with)) {
sendMessage(player, message)
rewardXP(player, Skills.COOKING, experience)
addItem(player, product)
containerIngredient(player, used.id)
containerIngredient(player, with.id)
}
} else {
return@queueScript stopExecuting(player)
}
if (stage >= sets - 1) {
return@queueScript stopExecuting(player)
}
return@queueScript delayScript(player, delay)
}
}
}
fun containerIngredient(player: Player, ingredient: Int): Boolean{
return when (ingredient) {
Items.BUCKET_OF_WATER_1929, Items.COMPOST_6032 -> addItem(player, Items.BUCKET_1925)
Items.FRIED_MUSHROOMS_7082 -> addItem(player, Items.BOWL_1923)
else -> false
}
}

View file

@ -0,0 +1,57 @@
package content.global.skill.cooking.recipe;
import org.rs09.consts.Items;
import core.game.node.entity.skill.Skills;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* @author afaroutdude
*/
public class OomlieWrap extends Recipe {
private static final Item OOMLIE_WRAP = new Item(Items.WRAPPED_OOMLIE_2341);
private static final Item RAW_OOMLIE = new Item(Items.RAW_OOMLIE_2337);
private static final Item PALM_LEAF = new Item(Items.PALM_LEAF_2339);
@Override
public void mix(final Player player, final NodeUsageEvent event) {
if (player.getSkills().getLevel(Skills.COOKING) < 50) {
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of 50 in order to do that.");
return;
}
super.mix(player, event);
}
@Override
public Item getBase() {
return RAW_OOMLIE;
}
@Override
public Item getProduct() {
return OOMLIE_WRAP;
}
@Override
public Item[] getIngredients() {
return new Item[] { PALM_LEAF };
}
@Override
public Item[] getParts() {
return new Item[] {};
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return "You wrap the raw oomlie in the palm leaf.";
}
@Override
public boolean isSingular() {
return true;
}
}

View file

@ -1,29 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class OomlieWrapListener : InteractionListener {
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.RAW_OOMLIE_2337, Items.PALM_LEAF_2339) { player, used, with ->
val product = Items.WRAPPED_OOMLIE_2341
val level = 50
val experience = 0.0
val message = "You wrap the raw oomlie in the palm leaf."
val failMessage = "You need a Cooking level of at least $level in order to do that."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
}

View file

@ -1,79 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class PieListener : InteractionListener {
val base = PieProduct.values().map { it.base }.toIntArray()
val added = PieProduct.values().map { it.added }.toIntArray()
override fun defineListeners() {
onUseWith(IntType.ITEM, base, *added) { player, used, with ->
val pie = PieProduct.productMap[used.id] ?: return@onUseWith true
if (pie.added != with.id) {
return@onUseWith false
}
val product = pie.product
val level = pie.minimumLevel
val experience = 0.0
val message = "You fill the pie with ${pie.ingredientMessage}."
val failMessage = "You need a Cooking level of ${pie.minimumLevel} to make this."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
enum class PieProduct(
val base: Int,
val added: Int,
val product: Int,
val minimumLevel: Int,
val ingredientMessage: String,
) {
REDBERRY_PIE(Items.REDBERRIES_1951, Items.PIE_SHELL_2315, Items.UNCOOKED_BERRY_PIE_2321, 10, "redberries"),
MEAT_PIE(Items.COOKED_MEAT_2142, Items.PIE_SHELL_2315, Items.UNCOOKED_MEAT_PIE_2319, 20, "meat"),
MUD_PIE_1(Items.COMPOST_6032, Items.PIE_SHELL_2315, Items.PART_MUD_PIE_7164, 29, "compost"),
MUD_PIE_2(Items.PART_MUD_PIE_7164, Items.BUCKET_OF_WATER_1929, Items.PART_MUD_PIE_7166, 29, "water"),
MUD_PIE_3(Items.PART_MUD_PIE_7166, Items.CLAY_434, Items.RAW_MUD_PIE_7168, 29, "clay"),
APPLE_PIE(Items.COOKING_APPLE_1955, Items.PIE_SHELL_2315, Items.UNCOOKED_APPLE_PIE_2317, 30, "cooking apple"),
GARDEN_PIE_1(Items.TOMATO_1982, Items.PIE_SHELL_2315, Items.PART_GARDEN_PIE_7172, 34, "tomato"),
GARDEN_PIE_2(Items.PART_GARDEN_PIE_7172, Items.ONION_1957, Items.PART_GARDEN_PIE_7174, 34, "onion"),
GARDEN_PIE_3(Items.PART_GARDEN_PIE_7174, Items.CABBAGE_1965, Items.RAW_GARDEN_PIE_7176, 34, "cabbage"),
FISH_PIE_1(Items.TROUT_333, Items.PIE_SHELL_2315, Items.PART_FISH_PIE_7182, 47, "trout"),
FISH_PIE_2(Items.PART_FISH_PIE_7182, Items.COD_339, Items.PART_FISH_PIE_7184, 47, "cod"),
FISH_PIE_3(Items.PART_FISH_PIE_7184, Items.POTATO_1942, Items.RAW_FISH_PIE_7186, 47, "potato"),
ADMIRAL_PIE_1(Items.SALMON_329, Items.PIE_SHELL_2315, Items.PART_ADMIRAL_PIE_7192, 70, "salmon"),
ADMIRAL_PIE_2(Items.PART_ADMIRAL_PIE_7192, Items.TUNA_361, Items.PART_ADMIRAL_PIE_7194, 70, "tuna"),
ADMIRAL_PIE_3(Items.PART_ADMIRAL_PIE_7194, Items.POTATO_1942, Items.RAW_ADMIRAL_PIE_7196, 70, "potato"),
WILD_PIE_1(Items.RAW_BEAR_MEAT_2136, Items.PIE_SHELL_2315, Items.PART_WILD_PIE_7202, 85, "raw bear meat"),
WILD_PIE_2(Items.PART_WILD_PIE_7202, Items.RAW_CHOMPY_2876, Items.PART_WILD_PIE_7204, 85, "raw chompy"),
WILD_PIE_3(Items.PART_WILD_PIE_7204, Items.RAW_RABBIT_3226, Items.RAW_WILD_PIE_7206, 85, "raw rabbit"),
SUMMER_PIE_1(Items.STRAWBERRY_5504, Items.PIE_SHELL_2315, Items.PART_SUMMER_PIE_7212, 95, "strawberry"),
SUMMER_PIE_2(Items.PART_SUMMER_PIE_7212, Items.WATERMELON_5982, Items.PART_SUMMER_PIE_7214, 95, "watermelon"),
SUMMER_PIE_3(Items.PART_SUMMER_PIE_7214, Items.COOKING_APPLE_1955, Items.RAW_SUMMER_PIE_7216, 95, "apple"),
;
companion object {
val productMap = HashMap<Int, PieProduct>()
init {
for (pie in PieProduct.values()) {
productMap[pie.base] = pie
}
}
}
}
}

View file

@ -1,29 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class PieShellListener : InteractionListener {
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.PIE_DISH_2313, Items.PASTRY_DOUGH_1953) { player, used, with ->
val product = Items.PIE_SHELL_2315
val level = 1
val experience = 0.0
val message = "You put the pastry dough into the pie dish to make a pie shell."
val failMessage = ""
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
}

View file

@ -1,66 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class PizzaListener : InteractionListener {
val base = PizzaProduct.values().map { it.base }.toIntArray()
val added = PizzaProduct.values().map { it.added }.toIntArray()
override fun defineListeners() {
onUseWith(IntType.ITEM, base, *added) { player, used, with ->
val pizza = PizzaProduct.productMap[used.id] ?: return@onUseWith true
if (pizza.added != with.id) {
return@onUseWith false
}
val product = pizza.product
val level = pizza.minimumLevel
val experience = pizza.experience
val message = "You add the ${pizza.message} to the pizza."
val failMessage = "You need a Cooking level of at least ${pizza.minimumLevel} in order to do this."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
enum class PizzaProduct(
val base: Int,
val added: Int,
val product: Int,
val minimumLevel: Int,
val experience: Double,
val message: String,
) {
PIZZA_1(Items.TOMATO_1982, Items.PIZZA_BASE_2283, Items.INCOMPLETE_PIZZA_2285, 35, 0.0,"tomato"),
PIZZA_2(Items.CHEESE_1985, Items.INCOMPLETE_PIZZA_2285, Items.UNCOOKED_PIZZA_2287, 35, 0.0, "cheese"),
MEAT_PIZZA_1(Items.COOKED_MEAT_2142, Items.PLAIN_PIZZA_2289, Items.MEAT_PIZZA_2293, 45, 26.0, "meat"),
MEAT_PIZZA_2(Items.COOKED_CHICKEN_2140, Items.PLAIN_PIZZA_2289, Items.MEAT_PIZZA_2293, 45, 26.0, "cooked chicken"),
ANCHOVY_PIZZA(Items.ANCHOVIES_319, Items.PLAIN_PIZZA_2289, Items.ANCHOVY_PIZZA_2297, 55, 39.0, "anchovies"),
PINEAPPLE_PIZZA_1(Items.PINEAPPLE_CHUNKS_2116, Items.PLAIN_PIZZA_2289, Items.PINEAPPLE_PIZZA_2301, 65, 52.0, "pineapple"),
PINEAPPLE_PIZZA_2(Items.PINEAPPLE_RING_2118, Items.PLAIN_PIZZA_2289, Items.PINEAPPLE_PIZZA_2301, 65, 52.0, "pineapple"),
;
companion object {
val productMap = HashMap<Int, PizzaProduct>()
init {
for (pizza in PizzaProduct.values()) {
productMap[pizza.base] = pizza
}
}
}
}
}

View file

@ -1,77 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class PotatoListener : InteractionListener {
val added = PotatoProduct.values().map { it.added }.toIntArray()
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.BAKED_POTATO_6701, Items.PAT_OF_BUTTER_6697) { player, used, with ->
val product = Items.POTATO_WITH_BUTTER_6703
val level = 39
val experience = 40.5
val message = "You add a pat of butter to the potato."
val failMessage = "You need a Cooking level of at least $level in order to do this."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
onUseWith(IntType.ITEM, added, Items.POTATO_WITH_BUTTER_6703) { player, used, with ->
val topping = PotatoProduct.productMap[used.id] ?: return@onUseWith true
val product = topping.product
val level = topping.minimumLevel
val experience = topping.experience
val message = ""
val failMessage = "You need a Cooking level of at least $level in order to do this."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
enum class PotatoProduct(
val added: Int,
val product: Int,
val minimumLevel: Int,
val experience: Double,
val message: String
) {
CHEESE_POTATO(Items.CHEESE_1985, Items.POTATO_WITH_CHEESE_6705, 47, 10.0, ""),
CHILLI_POTATO(Items.CHILLI_CON_CARNE_7062, Items.CHILLI_POTATO_7054, 41, 15.0, ""),
EGG_POTATO(Items.EGG_AND_TOMATO_7064, Items.EGG_POTATO_7056, 51, 50.0, ""),
TUNA_POTATO(Items.TUNA_AND_CORN_7068, Items.TUNA_POTATO_7060, 68, 10.0, ""),
MUSHROOM_POTATO(Items.MUSHROOM_AND_ONION_7066, Items.MUSHROOM_POTATO_7058, 64, 55.0, ""),
;
companion object {
val productMap = HashMap<Int, PotatoProduct>()
init {
for (topping in PotatoProduct.values()) {
productMap[topping.added] = topping
}
}
}
}
}

View file

@ -0,0 +1,134 @@
package content.global.skill.cooking.recipe;
import content.global.skill.cooking.recipe.pie.impl.*;
import content.global.skill.cooking.recipe.pizza.impl.AnchovyPizza;
import content.global.skill.cooking.recipe.pizza.impl.MeatPizza;
import content.global.skill.cooking.recipe.pizza.impl.PineapplePizza;
import content.global.skill.cooking.recipe.pizza.impl.PlainPizza;
import content.global.skill.cooking.recipe.potato.impl.*;
import content.global.skill.cooking.recipe.stew.CurryRecipe;
import content.global.skill.cooking.recipe.stew.StewRecipe;
import content.global.skill.cooking.recipe.topping.impl.*;
import content.global.skill.cooking.recipe.cake.ChocolateCake;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents a cooking recipe, this is dynamic that can range from a pie to a
* pizza.
* @author 'Vexia
* @date 21/12/2013
*/
public abstract class Recipe {
/**
* Represents the array of active recipes in 2009Scape.
*/
// TODO:
// - Making this an enum would drastically save on file/line count, since the recipes seem to mostly be plain-old-data classes
// - Making pie shells a recipe would make make-x for them just work
// - Making pineapple cutting a recipe would probably fix their make-x making all with any option
public static final Recipe[] RECIPES = new Recipe[] {
new RedberryPie(), new MeatPie(), new ApplePie(), new MudPie(), new GardenPie(), new FishPie(), new AdmiralPie(), new WildPie(), new SummerPie(),
new StewRecipe(), new CurryRecipe(),
new PlainPizza(), new MeatPizza(), new AnchovyPizza(), new PineapplePizza(),
new ChocolateCake(),
new ButterPotato(), new ChilliPotato(), new CheesePotato(), new EggPotato(), new MushroomPotato(), new TunaPotato(),
new SpicySauce(), new ChilliConCarne(), new UncookedEgg(), new EggAndTomato(), new MushroomAndOnion(), new ChoppedOnion(), new SlicedMushroom(), new ChoppedTuna(), new TunaAndCorn(), new OomlieWrap()
};
/**
* Method used to get the base item.
* @return the item.
*/
public abstract Item getBase();
/**
* Method used to get the product item.
* @return the product item.
*/
public abstract Item getProduct();
/**
* Method used to get the ingredients in this recipe.
* @return the ingredients.
*/
public abstract Item[] getIngredients();
/**
* Method used to get the part items made from ingredients.
* @return the part items.
*/
public abstract Item[] getParts();
/**
* Method used to get the mixing message.
* @param event the node usage event.
* @return the message used to mix.
*/
public abstract String getMixMessage(final NodeUsageEvent event);
/**
* Method used to check if this is a singular one step recipe.
* @return <code>True</code> if so.
*/
public abstract boolean isSingular();
/**
* Method used to mix this recipes ingredients.
* @param player the player.
* @param event the event.
*/
public void mix(final Player player, final NodeUsageEvent event) {
if (getIngredients().length == 1) {
singleMix(player, event);
} else {
multipleMix(player, event);
}
}
/**
* Method used to handle a single mixing.
* @param player the player.
* @param event the event.
*/
public void singleMix(final Player player, final NodeUsageEvent event) {
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
player.getInventory().add(getProduct());
String message = getMixMessage(event);
if (message != null) {
player.getPacketDispatch().sendMessage(message);
}
}
}
/**
* Method used to handle mixing multiple item recipes.
* @param player the player.
* @param event the event.
*/
public void multipleMix(final Player player, final NodeUsageEvent event) {
Item item = null;
int index = -1;
for (int counter = 0; counter < getIngredients().length; counter++) {
item = getIngredients()[counter];
if (item.getId() == event.getUsedItem().getId() || item.getId() == event.getBaseItem().getId()) {
index = counter;
break;
}
}
if (index != -1) {
if (!player.getInventory().containItems(event.getBaseItem().getId(), event.getUsedItem().getId())) {
return;
}
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
player.getInventory().add(getParts()[index + 1]);
String message = getMixMessage(event);
if (message != null) {
player.getPacketDispatch().sendMessage(message);
}
}
}
}
}

View file

@ -1,62 +0,0 @@
package content.global.skill.cooking.recipe
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class StewListener : InteractionListener {
val base = StewProduct.values().map { it.base }.toIntArray()
val added = StewProduct.values().map { it.added }.toIntArray()
override fun defineListeners() {
onUseWith(IntType.ITEM, base, *added) { player, used, with ->
val stew = StewProduct.productMap[used.id] ?: return@onUseWith true
if (stew.added != with.id) {
return@onUseWith false
}
val product = stew.product
val level = stew.minimumLevel
val experience = 0.0
val message = "You cut up the ${stew.message} and put it into the stew."
val failMessage = "You need a Cooking level of at least ${stew.minimumLevel} in order to do this."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
enum class StewProduct(
val base: Int,
val added: Int,
val product: Int,
val minimumLevel: Int,
val message: String,
) {
STEW_1(Items.POTATO_1942, Items.BOWL_OF_WATER_1921, Items.INCOMPLETE_STEW_1997, 25, "potato"),
STEW_2(Items.INCOMPLETE_STEW_1997, Items.COOKED_MEAT_2142, Items.UNCOOKED_STEW_2001, 25, "meat"),
STEW_3(Items.COOKED_MEAT_2142, Items.BOWL_OF_WATER_1921, Items.INCOMPLETE_STEW_1999, 25, "meat"),
STEW_4(Items.INCOMPLETE_STEW_1999, Items.POTATO_1942, Items.UNCOOKED_STEW_2001, 25, "potato"),
;
companion object {
val productMap = HashMap<Int, StewProduct>()
init {
for (stew in StewProduct.values()) {
productMap[stew.base] = stew
}
}
}
}
}

View file

@ -1,84 +0,0 @@
package content.global.skill.cooking.recipe
import core.api.inInventory
import core.api.sendDialogue
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class ToppingListener : InteractionListener {
val base = ToppingProduct.values().map { it.base }.toIntArray()
val added = ToppingProduct.values().map { it.added }.toIntArray()
override fun defineListeners() {
onUseWith(IntType.ITEM, base, *added) { player, used, with ->
val topping = ToppingProduct.productMap[used.id] ?: return@onUseWith true
val verb = if (with.id == Items.COOKED_MEAT_2142) "cut" else "slice"
if (topping.added != with.id) {
return@onUseWith false
}
if (topping.cut_name != "" && !inInventory(player, Items.KNIFE_946)) {
sendDialogue(player, "You need a knife in order to $verb up the ${topping.cut_name}.")
return@onUseWith true
}
val product = topping.product
val level = topping.minimumLevel
val experience = topping.experience
val message = topping.message
val failMessage = "You need a Cooking level of at least ${topping.minimumLevel} in order to do this."
return@onUseWith standardMix(
player,
used.asItem(),
with.asItem(),
product,
level,
experience,
message,
failMessage
)
}
}
enum class ToppingProduct(
val base: Int,
val added: Int,
val product: Int,
val minimumLevel: Int,
val experience: Double,
val message: String,
val cut_name: String
) {
//Tuna and Corn: https://www.youtube.com/watch?v=wAavERc9p2c
//Uncooked Egg: https://www.youtube.com/watch?v=LiLq6PhCc2M
//Bowl of sweetcorn (OSRS source is only I could find) https://www.youtube.com/watch?v=pz8epXjkKYE
UNCOOKED_EGG(Items.EGG_1944, Items.BOWL_1923, Items.UNCOOKED_EGG_7076, 1, 0.0, "You carefully break the egg into the bowl.", ""),
BOWL_OF_SWEETCORN(Items.COOKED_SWEETCORN_5988, Items.BOWL_1923, Items.SWEETCORN_7088, 1, 0.0, "You put the cooked sweetcorn into the bowl.", ""),
SLICED_MUSHROOM(Items.MUSHROOM_6004, Items.BOWL_1923, Items.SLICED_MUSHROOMS_7080, 1, 0.0, "You chop the mushrooms into the bowl.", "mushrooms"),
CHOPPED_TUNA(Items.TUNA_361, Items.BOWL_1923, Items.CHOPPED_TUNA_7086, 1, 0.0, "You chop the tuna into the bowl.", "tuna"),
CHOPPED_ONION(Items.ONION_1957, Items.BOWL_1923, Items.CHOPPED_ONION_1871, 1, 0.0, "You chop the onion into the bowl.", "onion"),
CHOPPED_GARLIC(Items.GARLIC_1550, Items.BOWL_1923, Items.CHOPPED_GARLIC_7074, 1, 0.0, "You chop the garlic into the bowl.", "garlic"),
SPICY_SAUCE(Items.CHOPPED_GARLIC_7074, Items.GNOME_SPICE_2169, Items.SPICY_SAUCE_7072, 9, 25.0, "You mix the ingredients to make the topping.", ""), //inauthentic, used generic mixing message
CHILLI_CON_CARNE(Items.SPICY_SAUCE_7072, Items.COOKED_MEAT_2142, Items.CHILLI_CON_CARNE_7062, 9, 0.0, "You mix the ingredients to make the topping.", "meat"), //inauthentic, used generic mixing message
EGG_AND_TOMATO(Items.TOMATO_1982, Items.SCRAMBLED_EGG_7078, Items.EGG_AND_TOMATO_7064, 23, 50.0, "You mix the ingredients to make the topping.", ""),
MUSHROOM_AND_ONION(Items.FRIED_MUSHROOMS_7082, Items.FRIED_ONIONS_7084, Items.MUSHROOM_AND_ONION_7066, 57, 120.0, "You mix the ingredients to make the topping.", ""),
TUNA_AND_CORN_1(Items.CHOPPED_TUNA_7086, Items.COOKED_SWEETCORN_5988, Items.TUNA_AND_CORN_7068, 67, 204.0, "You mix the ingredients to make the topping.", ""),
TUNA_AND_CORN_2(Items.SWEETCORN_7088, Items.TUNA_361, Items.TUNA_AND_CORN_7068, 67, 204.0, "You mix the ingredients to make the topping.", "tuna"),
;
companion object {
val productMap = HashMap<Int, ToppingProduct>()
init {
for (topping in ToppingProduct.values()) {
productMap[topping.base] = topping
}
}
}
}
}

View file

@ -0,0 +1,72 @@
package content.global.skill.cooking.recipe.cake;
import content.global.skill.cooking.recipe.Recipe;
import core.game.node.entity.skill.Skills;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the chocolate cake recipe. This recipe consists of adding a
* chocolate bar to a cake.
* @author 'Vexia
* @date 22/12/2013
*/
public class ChocolateCake extends Recipe {
/**
* Represents the cake item.
*/
private static final Item CAKE = new Item(1891);
/**
* Represents the chocolate cake item.
*/
private static final Item CHOCOLATE_CAKE = new Item(1897);
/**
* Represents the chocolate bar item.
*/
private static final Item CHOCOLATE_BAR = new Item(1973);
@Override
public void mix(final Player player, final NodeUsageEvent event) {
if (player.getSkills().getLevel(Skills.COOKING) < 50) {
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of 50 in order to do that.");
return;
}
super.mix(player, event);
player.getSkills().addExperience(Skills.COOKING, 30, true);
}
@Override
public Item getBase() {
return CAKE;
}
@Override
public Item getProduct() {
return CHOCOLATE_CAKE;
}
@Override
public Item[] getIngredients() {
return new Item[] { CHOCOLATE_BAR };
}
@Override
public Item[] getParts() {
return new Item[] {};
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return "You add chocolate to the cake.";
}
@Override
public boolean isSingular() {
return true;
}
}

View file

@ -0,0 +1,38 @@
package content.global.skill.cooking.recipe.pie;
import content.global.skill.cooking.recipe.Recipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.item.Item;
/**
* Represents the generic recipe for a pie.
* @author 'Vexia
* @date 21/12/2013
*/
public abstract class PieRecipe extends Recipe {
/**
* Represents the pie shell item.
*/
protected static final Item PIE_SHELL = new Item(2315);
@Override
public Item[] getParts() {
return new Item[] {};
}
@Override
public Item getBase() {
return PIE_SHELL;
}
@Override
public String getMixMessage(final NodeUsageEvent event) {
return "You fill the pie with " + (event.getBaseItem().getId() == 2315 ? event.getUsedItem().getName().toLowerCase() : event.getBaseItem().getName().toLowerCase()) + ".";
}
@Override
public boolean isSingular() {
return true;
}
}

View file

@ -0,0 +1,64 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents the admiral pie recipe. This recipe conists of pixing a salmon,
* tuna and potato together.
* @author 'Vexia
* @date 21/12/2013
*/
public class AdmiralPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(7196);
/**
* Represents the salmon ingredient item.
*/
private static final Item SALMON = new Item(329);
/**
* Represents the tuna ingredient item.
*/
private static final Item TUNA = new Item(361);
/**
* Represents the potato item.
*/
private static final Item POTATO = new Item(1942);
/**
* Represents the part one pie item.
*/
private static final Item PART_ONE = new Item(7192);
/**
* Represents the part two pie item.
*/
private static final Item PART_TWO = new Item(7194);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { SALMON, TUNA, POTATO };
}
@Override
public Item[] getParts() {
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
}
@Override
public boolean isSingular() {
return false;
}
}

View file

@ -0,0 +1,34 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents the apple pie recipe. This recipe consists of cooking apples and a
* pie shell.
* @author 'Vexia
* @date 21/12/2013
*/
public class ApplePie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(2317);
/**
* Represents the cooking apple item.
*/
private static final Item COOKING_APPLE = new Item(1955);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { COOKING_APPLE };
}
}

View file

@ -0,0 +1,64 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents the garden pie recipe. This pie consists of mixing, tomato, onion,
* and cabbage together.
* @author 'Vexia
* @date 21/12/2013
*/
public class FishPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(7186);
/**
* Represents the trout item ingredient.
*/
private static final Item TROUT = new Item(333);
/**
* Represents the cod item ingredient.
*/
private static final Item COD = new Item(339);
/**
* Represents the potato item.
*/
private static final Item POTATO = new Item(1942);
/**
* Represents the part one pie item.
*/
private static final Item PART_ONE = new Item(7182);
/**
* Represents the part two pie item.
*/
private static final Item PART_TWO = new Item(7184);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { TROUT, COD, POTATO };
}
@Override
public Item[] getParts() {
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
}
@Override
public boolean isSingular() {
return false;
}
}

View file

@ -0,0 +1,64 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents the garden pie recipe. This pie consists of mixing, tomato, onion,
* and cabbage together.
* @author 'Vexia
* @date 21/12/2013
*/
public class GardenPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(7176);
/**
* Represents the tomato ingredient item.
*/
private static final Item TOMATO = new Item(1982);
/**
* Represents the onion ingredient item.
*/
private static final Item ONION = new Item(1957);
/**
* Represents the cabbage ingredient item.
*/
private static final Item CABBAGE = new Item(1965);
/**
* Represents the part one pie item.
*/
private static final Item PART_ONE = new Item(7172);
/**
* Represents the part two pie item.
*/
private static final Item PART_TWO = new Item(7174);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { TOMATO, ONION, CABBAGE };
}
@Override
public Item[] getParts() {
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
}
@Override
public boolean isSingular() {
return false;
}
}

View file

@ -0,0 +1,58 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the meat pie recipe.
* @author 'Vexia
* @date 21/12/2013
*/
public class MeatPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(2319);
/**
* Represents the cooked meat item.
*/
private static final Item COOKED_MEAT = new Item(2142);
/**
* Represents the cooked chicken item.
*/
private static final Item COOKED_CHICKEN = new Item(2140);
/**
* Represents the cooked rabbit.
*/
private static final Item COOKED_RABBIT = new Item(3228);
@Override
public void mix(final Player player, final NodeUsageEvent event) {
if (player.getInventory().remove(event.getUsedItem()) && player.getInventory().remove(event.getBaseItem())) {
player.getInventory().add(getProduct());
player.getPacketDispatch().sendMessage(getMixMessage(event));
return;
}
}
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { COOKED_MEAT, COOKED_CHICKEN, COOKED_RABBIT };
}
@Override
public String getMixMessage(final NodeUsageEvent event) {
return "You fill the pie with meat.";
}
}

View file

@ -0,0 +1,64 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents the mud pie recipe. A mud pie consists of mixing compost, water
* and clay together.
* @author 'Vexia
* @date 21/12/2013
*/
public class MudPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(7168);
/**
* Represents the compost item.
*/
private static final Item COMPOST = new Item(6032);
/**
* Represents the bucket of water item.
*/
private static final Item BUCKET_OF_WATER = new Item(1929);
/**
* Represents the clay item.
*/
private static final Item CLAY = new Item(434);
/**
* Represents the part one pie item.
*/
private static final Item PART_ONE = new Item(7164);
/**
* Represents the part two pie item.
*/
private static final Item PART_TWO = new Item(7166);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { COMPOST, BUCKET_OF_WATER, CLAY };
}
@Override
public Item[] getParts() {
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
}
@Override
public boolean isSingular() {
return false;
}
}

View file

@ -0,0 +1,33 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents a redberry pie recipe.
* @author 'Vexia
* @date 21/12/2013
*/
public class RedberryPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(2321);
/**
* Represents the redberries pie.
*/
private static final Item REDBERRIES = new Item(1951);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { REDBERRIES };
}
}

View file

@ -0,0 +1,64 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents the summer pie recipe. This recipe consists of mixing stawberry,
* watermelon, and an apple.
* @author 'Vexia
* @date 21/12/2013
*/
public class SummerPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(7216);
/**
* Represents the strawberry item.
*/
private static final Item STRAWBERRY = new Item(5504);
/**
* Represents the watermelon item.
*/
private static final Item WATERMELON = new Item(5982);
/**
* Represents the cooking apple item.
*/
private static final Item COOKING_APPLE = new Item(1955);
/**
* Represents the part one pie item.
*/
private static final Item PART_ONE = new Item(7212);
/**
* Represents the part two pie item.
*/
private static final Item PART_TWO = new Item(7214);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { STRAWBERRY, WATERMELON, COOKING_APPLE };
}
@Override
public Item[] getParts() {
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
}
@Override
public boolean isSingular() {
return false;
}
}

View file

@ -0,0 +1,64 @@
package content.global.skill.cooking.recipe.pie.impl;
import content.global.skill.cooking.recipe.pie.PieRecipe;
import core.game.node.item.Item;
/**
* Represents the wild pie recipe. This recipe consists of mixing raw beat meat,
* raw chomp, and raw rabbit into a pie shell.
* @author 'Vexia
* @date 21/12/2013
*/
public class WildPie extends PieRecipe {
/**
* Represents the uncooked redberry pie.
*/
private static final Item UNCOOKED_PIE = new Item(7206);
/**
* Represents the raw bear meat item.
*/
private static final Item BEAR_MEAT = new Item(2136);
/**
* Represents the raw chompy meat item.
*/
private static final Item CHOMPY_MEAT = new Item(2876);
/**
* Represents the raw rabbit meat item.
*/
private static final Item RABBIT_MEAT = new Item(3226);
/**
* Represents the part one pie item.
*/
private static final Item PART_ONE = new Item(7202);
/**
* Represents the part two pie item.
*/
private static final Item PART_TWO = new Item(7204);
@Override
public Item getProduct() {
return UNCOOKED_PIE;
}
@Override
public Item[] getIngredients() {
return new Item[] { BEAR_MEAT, CHOMPY_MEAT, RABBIT_MEAT };
}
@Override
public Item[] getParts() {
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
}
@Override
public boolean isSingular() {
return false;
}
}

View file

@ -0,0 +1,63 @@
package content.global.skill.cooking.recipe.pizza;
import core.game.node.entity.skill.Skills;
import content.global.skill.cooking.recipe.Recipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the generic recipe for a pizza.
* @author ceikry
*/
public abstract class PizzaRecipe extends Recipe {
/**
* Represents the plain pizza.
*/
protected static final Item PLAIN_PIZZA = new Item(2289);
/**
* Method used to get the experience gained from adding the final
* ingredient.
* @return the experience.
*/
public abstract double getExperience();
/**
* Method used to get the level required.
* @return the level required.
*/
public abstract int getLevel();
@Override
public void mix(final Player player, final NodeUsageEvent event) {
if (player.getSkills().getLevel(Skills.COOKING) < getLevel()) {
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + getLevel() + " in order to do this.");
return;
}
super.singleMix(player, event);
player.getSkills().addExperience(Skills.COOKING, getExperience(), true);
}
@Override
public Item[] getParts() {
return new Item[] {};
}
@Override
public Item getBase() {
return PLAIN_PIZZA;
}
@Override
public String getMixMessage(final NodeUsageEvent event) {
return "You add " + event.getBaseItem().getName().toLowerCase() + " to the pizza.";
}
@Override
public boolean isSingular() {
return true;
}
}

View file

@ -0,0 +1,44 @@
package content.global.skill.cooking.recipe.pizza.impl;
import content.global.skill.cooking.recipe.pizza.PizzaRecipe;
import core.game.node.item.Item;
/**
* Represents the anchovy pizza. This recipe consists of adding anchovies to a
* plain pizza.
* @author 'Vexia
* @date 22/12/2013
*/
public class AnchovyPizza extends PizzaRecipe {
/**
* Represents the anchovy pizza item.
*/
private static final Item ANCHOVY_PIZZA = new Item(2297);
/**
* Represents the anchovies item.
*/
private static final Item ANCHOVIES = new Item(319);
@Override
public double getExperience() {
return 39;
}
@Override
public Item getProduct() {
return ANCHOVY_PIZZA;
}
@Override
public Item[] getIngredients() {
return new Item[] { ANCHOVIES };
}
@Override
public int getLevel() {
return 55;
}
}

View file

@ -0,0 +1,49 @@
package content.global.skill.cooking.recipe.pizza.impl;
import content.global.skill.cooking.recipe.pizza.PizzaRecipe;
import core.game.node.item.Item;
/**
* Represents the meat pizza recipe. This recipe consists of adding cooked meat
* to a plain pizza.
* @author 'Vexia
* @date 22/12/2013
*/
public class MeatPizza extends PizzaRecipe {
/**
* Represents the meat pizza item.
*/
private static final Item MEAT_PIZZA = new Item(2293);
/**
* Represents the cooked meat item.
*/
private static final Item COOKED_MEAT = new Item(2142);
/**
* Represents the cooked chicken item.
*/
private static final Item COOKED_CHICKEN = new Item(2140);
@Override
public double getExperience() {
return 26;
}
@Override
public int getLevel() {
return 45;
}
@Override
public Item getProduct() {
return MEAT_PIZZA;
}
@Override
public Item[] getIngredients() {
return new Item[] { COOKED_MEAT, COOKED_CHICKEN };
}
}

View file

@ -0,0 +1,55 @@
package content.global.skill.cooking.recipe.pizza.impl;
import content.global.skill.cooking.recipe.pizza.PizzaRecipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.item.Item;
/**
* Represents the pineapple pizza recipe. This recipe consists of mixing either
* pineapple chunks or pineapple rings.
* @author 'Vexia
* @date 22/12/2013
*/
public class PineapplePizza extends PizzaRecipe {
/**
* Represents the pineapple pizza item.
*/
private static final Item PINEAPPLE_PIZZA = new Item(2301);
/**
* Represents the pineapple ring item.
*/
private static final Item PINEAPPLE_RING = new Item(2118);
/**
* Represents the pineapple chunk item.
*/
private static final Item PINEAPPLE_CHUNKS = new Item(2116);
@Override
public double getExperience() {
return 52;
}
@Override
public int getLevel() {
return 65;
}
@Override
public Item getProduct() {
return PINEAPPLE_PIZZA;
}
@Override
public Item[] getIngredients() {
return new Item[] { PINEAPPLE_CHUNKS, PINEAPPLE_RING };
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return "You add the " + event.getBaseItem().getName().toLowerCase() + " to the pizza.";
}
}

View file

@ -0,0 +1,81 @@
package content.global.skill.cooking.recipe.pizza.impl;
import core.game.node.entity.skill.Skills;
import content.global.skill.cooking.recipe.Recipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the plain pizza recipe. This recipe consists of mixing tomato, and
* cheese to a pizza base.
* @author 'Vexia
* @date 22/12/2013
*/
public class PlainPizza extends Recipe {
/**
* Represents the pizza base.
*/
private static final Item PIZZA_BASE = new Item(2283);
/**
* Represents the uncooked pizza.
*/
private static final Item UNCOOKED_PIZZA = new Item(2287);
/**
* Represents the incomplete pizza.
*/
private static final Item INCOMPLETE_PIZZA = new Item(2285);
/**
* Represents the tomato ingredient item.
*/
private static final Item TOMATO = new Item(1982);
/**
* Represents the cheese item.
*/
private static final Item CHEESE = new Item(1985);
@Override
public void mix(final Player player, final NodeUsageEvent event) {
if (player.getSkills().getLevel(Skills.COOKING) < 35) {
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 35 + " in order to do this.");
return;
}
super.mix(player, event);
}
@Override
public Item getBase() {
return PIZZA_BASE;
}
@Override
public Item getProduct() {
return UNCOOKED_PIZZA;
}
@Override
public Item[] getIngredients() {
return new Item[] { TOMATO, CHEESE };
}
@Override
public Item[] getParts() {
return new Item[] { PIZZA_BASE, INCOMPLETE_PIZZA, UNCOOKED_PIZZA };
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return "You add the " + event.getBaseItem().getName().toLowerCase() + " to the pizza.";
}
@Override
public boolean isSingular() {
return false;
}
}

View file

@ -0,0 +1,76 @@
package content.global.skill.cooking.recipe.potato;
import core.game.node.entity.skill.Skills;
import content.global.skill.cooking.recipe.Recipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents a generic potato topping recipe.
* @author 'Vexia
* @date 22/12/2013
*/
public abstract class PotatoRecipe extends Recipe {
/**
* Represents the potato with butter.
*/
private static final Item POTATO_WITH_BUTTER = new Item(6703);
/**
* Represents the bowl item.
*/
protected static final Item BOWL = new Item(1923);
@Override
public void mix(final Player player, final NodeUsageEvent event) {
if (player.getSkills().getLevel(Skills.COOKING) < getLevel()) {
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + getLevel() + " in order to do this.");
return;
}
super.singleMix(player, event);
if (isTopping()) {
player.getInventory().add(BOWL);
}
player.getSkills().addExperience(Skills.COOKING, getExperience(), true);
}
@Override
public Item getBase() {
return POTATO_WITH_BUTTER;
}
@Override
public Item[] getParts() {
return new Item[] {};
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return null;
}
@Override
public boolean isSingular() {
return true;
}
/**
* Method used to check if it is a topping recipe.
* @return <code>True</code> if it is a topping.
*/
public abstract boolean isTopping();
/**
* Method used to get the level required.
* @return the level.
*/
public abstract int getLevel();
/**
* Method used to get the experience gained.
* @return the experience.
*/
public abstract double getExperience();
}

View file

@ -0,0 +1,72 @@
package content.global.skill.cooking.recipe.potato.impl;
import content.global.skill.cooking.recipe.Recipe;
import core.game.node.entity.skill.Skills;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the butter potato recipe. This recipe consists of adding a pat of
* butter to a potato.
* @author 'Vexia
* @date 22/12/2013
*/
public class ButterPotato extends Recipe {
/**
* Represents the baked potato.
*/
private static final Item BAKED_POTATO = new Item(6701);
/**
* Represents the potato with butter.
*/
private static final Item POTATO_WITH_BUTTER = new Item(6703);
/**
* Represents the pat of butter.
*/
private static final Item PAT_OF_BUTTER = new Item(6697);
@Override
public void mix(final Player player, final NodeUsageEvent event) {
if (player.getSkills().getLevel(Skills.COOKING) < 39) {
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 39 + " in order to do this.");
return;
}
super.singleMix(player, event);
player.getSkills().addExperience(Skills.COOKING, 40.5, true);
}
@Override
public Item getBase() {
return BAKED_POTATO;
}
@Override
public Item getProduct() {
return POTATO_WITH_BUTTER;
}
@Override
public Item[] getIngredients() {
return new Item[] { PAT_OF_BUTTER };
}
@Override
public Item[] getParts() {
return new Item[] {};
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return "You add a pat of butter to the potato.";
}
@Override
public boolean isSingular() {
return true;
}
}

View file

@ -0,0 +1,49 @@
package content.global.skill.cooking.recipe.potato.impl;
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
import core.game.node.item.Item;
/**
* Represents the cheese potato. This recipe consists of mixing cheese witha
* baked potato.
* @author 'Vexia
* @date 22/12/2013
*/
public class CheesePotato extends PotatoRecipe {
/**
* Represents the cheese potato.
*/
private static final Item CHEESE_POTATO = new Item(6705);
/**
* Represents the cheese item.
*/
private static final Item CHEESE = new Item(1985);
@Override
public Item getProduct() {
return CHEESE_POTATO;
}
@Override
public Item[] getIngredients() {
return new Item[] { CHEESE };
}
@Override
public boolean isTopping() {
return false;
}
@Override
public int getLevel() {
return 47;
}
@Override
public double getExperience() {
return 10;
}
}

View file

@ -0,0 +1,49 @@
package content.global.skill.cooking.recipe.potato.impl;
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
import core.game.node.item.Item;
/**
* Represents the chilli potato recipe. This recipe consists of adding chilli
* con carne to a baked butter potato.
* @author 'Vexia
* @date 22/12/2013
*/
public class ChilliPotato extends PotatoRecipe {
/**
* Represents the chilli potato item.
*/
private static final Item CHILLI_POTATO = new Item(7054);
/**
* Represents the chilli con carne item/
*/
private static final Item CHILLI_CON_CARNE = new Item(7062);
@Override
public Item getProduct() {
return CHILLI_POTATO;
}
@Override
public Item[] getIngredients() {
return new Item[] { CHILLI_CON_CARNE };
}
@Override
public boolean isTopping() {
return true;
}
@Override
public int getLevel() {
return 41;
}
@Override
public double getExperience() {
return 10;
}
}

View file

@ -0,0 +1,49 @@
package content.global.skill.cooking.recipe.potato.impl;
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
import core.game.node.item.Item;
/**
* Represents the egg potato recipe. This recipe consists of mixing a egg and a
* tomato.
* @author 'Vexia
* @date 22/12/2013
*/
public class EggPotato extends PotatoRecipe {
/**
* Represents the egg potato.
*/
private static final Item EGG_POTATO = new Item(7056);
/**
* Represents the topping item.
*/
private static final Item TOPPING = new Item(7064);
@Override
public Item getProduct() {
return EGG_POTATO;
}
@Override
public Item[] getIngredients() {
return new Item[] { TOPPING };
}
@Override
public boolean isTopping() {
return true;
}
@Override
public int getLevel() {
return 51;
}
@Override
public double getExperience() {
return 10;
}
}

View file

@ -0,0 +1,49 @@
package content.global.skill.cooking.recipe.potato.impl;
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
import core.game.node.item.Item;
/**
* Represents the mushrrom potato. This recipe consists of mixing a baked potato
* with mushroom and onion toppings.
* @author 'Vexia
* @date 22/12/2013
*/
public class MushroomPotato extends PotatoRecipe {
/**
* Represents the egg potato.
*/
private static final Item MUSHROOM_POTATO = new Item(7058);
/**
* Represents the topping item.
*/
private static final Item TOPPING = new Item(7066);
@Override
public Item getProduct() {
return MUSHROOM_POTATO;
}
@Override
public Item[] getIngredients() {
return new Item[] { TOPPING };
}
@Override
public boolean isTopping() {
return true;
}
@Override
public int getLevel() {
return 64;
}
@Override
public double getExperience() {
return 10;
}
}

View file

@ -0,0 +1,49 @@
package content.global.skill.cooking.recipe.potato.impl;
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
import core.game.node.item.Item;
/**
* Represents the tuna potato recipe. This recipe consists of mixing tuna and
* corn toppings.
* @author 'Vexia
* @date 22/12/2013
*/
public class TunaPotato extends PotatoRecipe {
/**
* Represents the tuna potato.
*/
private static final Item TUNA_POTATO = new Item(7060);
/**
* Represents the topping item.
*/
private static final Item TOPPING = new Item(7068);
@Override
public Item getProduct() {
return TUNA_POTATO;
}
@Override
public Item[] getIngredients() {
return new Item[] { TOPPING };
}
@Override
public boolean isTopping() {
return true;
}
@Override
public int getLevel() {
return 68;
}
@Override
public double getExperience() {
return 10;
}
}

View file

@ -0,0 +1,89 @@
package content.global.skill.cooking.recipe.stew;
import content.global.skill.cooking.recipe.Recipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the curry recipe. This recipe consists of mixing 3 curry leaves or
* a spice into a stew.
* @author 'Vexia
* @date 22/12/2013
*/
public class CurryRecipe extends Recipe {
/**
* Represents the uncooked curry item.
*/
private static final Item UNCOOKED_CURRY = new Item(2009);
/**
* Represents the uncooked stew item.
*/
private static final Item UNCOOKED_STEW = new Item(2001);
/**
* Represents the spice item.
*/
private static final Item SPICE = new Item(2007);
/**
* Represents the curry leaf.
*/
private static final Item CURRY_LEAF = new Item(5970);
@Override
public void mix(Player player, NodeUsageEvent event) {
if (event.getBaseItem().getId() == CURRY_LEAF.getId() || event.getUsedItem().getId() == CURRY_LEAF.getId()) {
Item stew = event.getBaseItem().getId() == UNCOOKED_STEW.getId() ? event.getBaseItem() : event.getUsedItem();
if (stew.getCharge() == 1000) {
stew.setCharge(1);
}
int charge = stew.getCharge();
if (charge < 3) {
player.getInventory().remove(CURRY_LEAF);
stew.setCharge(charge + 1);
} else {
if (player.getInventory().remove(stew) && player.getInventory().remove(CURRY_LEAF)) {
player.getInventory().add(UNCOOKED_CURRY);
}
}
return;
}
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
player.getInventory().add(getProduct());
}
}
@Override
public Item getBase() {
return UNCOOKED_STEW;
}
@Override
public Item getProduct() {
return UNCOOKED_CURRY;
}
@Override
public Item[] getIngredients() {
return new Item[] { SPICE, CURRY_LEAF };
}
@Override
public Item[] getParts() {
return new Item[] { UNCOOKED_STEW };
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return "You mix the spice with the stew.";
}
@Override
public boolean isSingular() {
return true;
}
}

View file

@ -0,0 +1,92 @@
package content.global.skill.cooking.recipe.stew;
import content.global.skill.cooking.recipe.Recipe;
import core.game.interaction.NodeUsageEvent;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the stew recipe. This recipe consists of mixing meat and a raw
* potato in a bowl of water.
* @author 'Vexia
* @date 22/12/2013
*/
public class StewRecipe extends Recipe {
/**
* Represents the uncooked stew item.
*/
private static final Item UNCOOKED_STEW = new Item(2001);
/**
* Represents the bowl of water item.
*/
private static final Item BOWL_OF_WATER = new Item(1921);
/**
* Represents the meat item.
*/
private static final Item MEAT = new Item(2142);
/**
* Represents the potato item.
*/
private static final Item POTATO = new Item(1942);
/**
* Represents the incomplete stew.
*/
private static final Item INCOMPLETE_STEW = new Item(1997);
/**
* Represents the second incomplete stew.
*/
private static final Item INCOMPLETE_STEW2 = new Item(1999);
@Override
public void mix(Player player, NodeUsageEvent event) {
Item first = event.getUsedItem();
Item second = event.getBaseItem();
if(first != null && second != null) {
if (player.getInventory().remove(first) && player.getInventory().remove(second)) {
if (first.getId() == BOWL_OF_WATER.getId() || second.getId() == BOWL_OF_WATER.getId()) {
player.getInventory().add(first.getId() == POTATO.getId() ? INCOMPLETE_STEW : first.getId() == MEAT.getId() ? INCOMPLETE_STEW2 : second.getId() == POTATO.getId() ? INCOMPLETE_STEW : second.getId() == MEAT.getId() ? INCOMPLETE_STEW2 : null);
} else {
player.getInventory().add(UNCOOKED_STEW);
}
player.getPacketDispatch().sendMessage(getMixMessage(event));
}
}
}
@Override
public Item getBase() {
return BOWL_OF_WATER;
}
@Override
public Item getProduct() {
return UNCOOKED_STEW;
}
@Override
public Item[] getIngredients() {
return new Item[] { MEAT, POTATO, MEAT, POTATO };
}
@Override
public Item[] getParts() {
return new Item[] { BOWL_OF_WATER, BOWL_OF_WATER, INCOMPLETE_STEW, INCOMPLETE_STEW2 };
}
@Override
public String getMixMessage(NodeUsageEvent event) {
return "You cut up the " + (event.getUsedItem().getName().toLowerCase().contains("incomplete") ? event.getBaseItem().getName().toLowerCase() : event.getUsedItem().getName().toLowerCase().replace("cooked", "").trim()) + " and put it into the stew.";
}
@Override
public boolean isSingular() {
return false;
}
}

Some files were not shown because too many files have changed in this diff Show more