mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 13:30:27 -07:00
Add interaction/city/lumbridge Listeners, move LumbridgeListeners to package
This commit is contained in:
parent
8144faa37b
commit
f9b10bc1a7
7 changed files with 82 additions and 158 deletions
|
|
@ -1,63 +0,0 @@
|
||||||
package core.game.interaction.city.lumbridge;
|
|
||||||
|
|
||||||
import static api.ContentAPIKt.*;
|
|
||||||
|
|
||||||
import api.ContentAPIKt;
|
|
||||||
import core.cache.def.impl.SceneryDefinition;
|
|
||||||
import core.game.content.dialogue.DialoguePlugin;
|
|
||||||
import core.game.interaction.OptionHandler;
|
|
||||||
import core.game.node.Node;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
import rs09.GlobalStats;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cow field sign manager
|
|
||||||
* @author ceik
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Initializable
|
|
||||||
public class CowFieldSign extends OptionHandler {
|
|
||||||
private int DIALOGUE_KEY = 87905733;
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable{
|
|
||||||
new SignDialogue().init();
|
|
||||||
SceneryDefinition.forId(31297).getHandlers().put("option:read",this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean handle(Player player, Node node, String option){
|
|
||||||
if(node.getId() == 31297){
|
|
||||||
player.getDialogueInterpreter().open(DIALOGUE_KEY);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public final class SignDialogue extends DialoguePlugin{
|
|
||||||
public SignDialogue(){
|
|
||||||
/**
|
|
||||||
* Empty
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
public SignDialogue(Player player){super(player);}
|
|
||||||
@Override
|
|
||||||
public DialoguePlugin newInstance(Player player){return new SignDialogue(player);}
|
|
||||||
@Override
|
|
||||||
public boolean open(Object... args){
|
|
||||||
int dailyCowDeaths = GlobalStats.getDailyCowDeaths();
|
|
||||||
if(dailyCowDeaths > 0) {
|
|
||||||
ContentAPIKt.sendDialogue(player,"Local cowherders have reported that " + dailyCowDeaths + " cows have been slain in this field today by passing adventurers. Farmers throughout the land fear this may be an epidemic.");
|
|
||||||
} else {
|
|
||||||
ContentAPIKt.sendDialogue(player,"The Lumbridge cow population has been thriving today, without a single cow death to worry about!" );
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(int componentId, int buttonId){
|
|
||||||
end();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public int[] getIds() {return new int[] {DIALOGUE_KEY};}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
package core.game.interaction.city.lumbridge;
|
|
||||||
|
|
||||||
import core.cache.def.impl.SceneryDefinition;
|
|
||||||
import core.game.interaction.OptionHandler;
|
|
||||||
import core.game.node.Node;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.game.node.scenery.Scenery;
|
|
||||||
import core.game.node.scenery.SceneryBuilder;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the chest in farmer fred's house
|
|
||||||
*
|
|
||||||
* @author ceik
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Initializable
|
|
||||||
public class FredChest extends OptionHandler {
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable{
|
|
||||||
SceneryDefinition.forId(37009).getHandlers().put("option:open",this);
|
|
||||||
SceneryDefinition.forId(37010).getHandlers().put("option:shut",this);
|
|
||||||
SceneryDefinition.forId(37010).getHandlers().put("option:search",this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean handle(Player player, Node node, String option){
|
|
||||||
if(option.equals("open")){
|
|
||||||
SceneryBuilder.replace(node.asScenery(),new Scenery(37010,node.asScenery().getLocation(),node.asScenery().getRotation()));
|
|
||||||
} else if (option.equals("shut")){
|
|
||||||
SceneryBuilder.replace(node.asScenery(),new Scenery(37009,node.asScenery().getLocation(),node.asScenery().getRotation()));
|
|
||||||
} else if (option.equals("search")){
|
|
||||||
player.getPacketDispatch().sendMessage("You search the chest but find nothing.");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package core.game.interaction.city.lumbridge;
|
|
||||||
|
|
||||||
import core.cache.def.impl.SceneryDefinition;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.game.content.dialogue.DialoguePlugin;
|
|
||||||
import core.game.interaction.OptionHandler;
|
|
||||||
import core.game.node.Node;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
@Initializable
|
|
||||||
public class GnomeCopterSign extends OptionHandler {
|
|
||||||
public int DIALOGUE_ID = 989769182;
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
new SignDialogue().init();
|
|
||||||
SceneryDefinition.forId(30037).getHandlers().put("option:read",this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(Player player, Node node, String string) {
|
|
||||||
if (node.getId() == 30037) {
|
|
||||||
player.getDialogueInterpreter().open(DIALOGUE_ID);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public final class SignDialogue extends DialoguePlugin{
|
|
||||||
public SignDialogue(){
|
|
||||||
/**
|
|
||||||
* Empty
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
public SignDialogue(Player player){super(player);}
|
|
||||||
@Override
|
|
||||||
public DialoguePlugin newInstance(Player player){ return new SignDialogue(player);}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean open(Object... args){
|
|
||||||
interpreter.sendPlainMessage(false,"Come check out our gnome copters up north!","Disclaimer: EXTREMELY WIP");
|
|
||||||
stage = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean handle(int componentId, int buttonId){
|
|
||||||
end();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int[] getIds(){return new int[] {DIALOGUE_ID};}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
package rs09.game.interaction.region
|
package rs09.game.interaction.region.lumbridge
|
||||||
|
|
||||||
import api.*
|
import api.*
|
||||||
|
import org.rs09.consts.Scenery
|
||||||
import rs09.GlobalStats
|
import rs09.GlobalStats
|
||||||
import rs09.game.interaction.InteractionListener
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
class LumbridgeListeners : InteractionListener() {
|
class ChurchSignListener : InteractionListener() {
|
||||||
|
|
||||||
val CHURCH_SIGN = 31299
|
val CHURCH_SIGN = Scenery.SIGNPOST_31299
|
||||||
|
|
||||||
override fun defineListeners() {
|
override fun defineListeners() {
|
||||||
on(CHURCH_SIGN, SCENERY, "read"){player, _ ->
|
on(CHURCH_SIGN, SCENERY, "read"){player, _ ->
|
||||||
val deaths = GlobalStats.getDailyDeaths()
|
val deaths = GlobalStats.getDailyDeaths()
|
||||||
if(deaths > 0){
|
if(deaths > 0) {
|
||||||
sendDialogue(player, "So far today $deaths unlucky adventurers have died on RuneScape and been sent to their respawn location. Be careful out there.")
|
sendDialogue(player, "So far today $deaths unlucky adventurers have died on RuneScape and been sent to their respawn location. Be careful out there.")
|
||||||
} else {
|
} else {
|
||||||
sendDialogue(player, "So far today not a single adventurer on RuneScape has met their end grisly or otherwise. Either the streets are getting safer or adventurers are getting warier.")
|
sendDialogue(player, "So far today not a single adventurer on RuneScape has met their end grisly or otherwise. Either the streets are getting safer or adventurers are getting warier.")
|
||||||
|
|
@ -19,5 +20,4 @@ class LumbridgeListeners : InteractionListener() {
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package rs09.game.interaction.region.lumbridge
|
||||||
|
|
||||||
|
import api.*
|
||||||
|
import org.rs09.consts.Scenery
|
||||||
|
import rs09.GlobalStats
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bushtail
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CowFieldSignListener : InteractionListener() {
|
||||||
|
|
||||||
|
val SIGN = Scenery.SIGNPOST_31297
|
||||||
|
|
||||||
|
override fun defineListeners() {
|
||||||
|
on(SIGN, SCENERY, "read") { player, _ ->
|
||||||
|
val COW_DEATHS = GlobalStats.getDailyCowDeaths()
|
||||||
|
if(COW_DEATHS > 0) {
|
||||||
|
sendDialogue(player, "Local cowherders have reported that $COW_DEATHS cows have been slain in this field today by passing adventurers. Farmers throughout the land fear this may be an epidemic.")
|
||||||
|
} else {
|
||||||
|
sendDialogue(player,"The Lumbridge cow population has been thriving today, without a single cow death to worry about!")
|
||||||
|
}
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package rs09.game.interaction.region.lumbridge
|
||||||
|
|
||||||
|
import api.*
|
||||||
|
import core.game.world.map.Direction
|
||||||
|
import org.rs09.consts.Scenery
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bushtail
|
||||||
|
*/
|
||||||
|
|
||||||
|
class FredChestListener : InteractionListener() {
|
||||||
|
val SHUT = Scenery.CLOSED_CHEST_37009
|
||||||
|
val OPEN = Scenery.OPEN_CHEST_37010
|
||||||
|
|
||||||
|
override fun defineListeners() {
|
||||||
|
on(SHUT, SCENERY, "open") { _, node ->
|
||||||
|
replaceScenery(node.asScenery(), OPEN, -1, node.location)
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
on(OPEN, SCENERY, "shut") { _, node ->
|
||||||
|
replaceScenery(node.asScenery(), SHUT, -1, node.location)
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
on(OPEN, SCENERY, "search") { player, _ ->
|
||||||
|
sendMessage(player, "You search the chest but find nothing.")
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package rs09.game.interaction.region.lumbridge
|
||||||
|
|
||||||
|
import api.sendDialogue
|
||||||
|
import api.sendMessage
|
||||||
|
import org.rs09.consts.Scenery
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bushtail
|
||||||
|
*/
|
||||||
|
|
||||||
|
class GnomeCopterSignListener : InteractionListener() {
|
||||||
|
val SIGN = Scenery.ADVERTISEMENT_30037
|
||||||
|
override fun defineListeners() {
|
||||||
|
on(SIGN, SCENERY, "read") { player, _ ->
|
||||||
|
sendDialogue(player, "Come check our gnome copters up north! Disclaimer: EXTREMELY WIP")
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue