Add interaction/city/lumbridge Listeners, move LumbridgeListeners to package
This commit is contained in:
@@ -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};}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user