Converted ChampionsGuildDoor to Kotlin + InteractionListener
This commit is contained in:
@@ -1,49 +0,0 @@
|
|||||||
package core.game.interaction.object;
|
|
||||||
|
|
||||||
import core.cache.def.impl.SceneryDefinition;
|
|
||||||
import core.game.content.global.action.DoorActionHandler;
|
|
||||||
import core.game.interaction.OptionHandler;
|
|
||||||
import core.game.node.Node;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.game.node.entity.player.link.diary.DiaryType;
|
|
||||||
import core.game.node.scenery.Scenery;
|
|
||||||
import core.game.world.map.Location;
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the plugin used to handle the interaction with the champions guild
|
|
||||||
* door.
|
|
||||||
* @author 'Vexia
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Initializable
|
|
||||||
public final class ChampionsGuildDoor extends OptionHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(Player player, Node node, String option) {
|
|
||||||
if (player.getLocation().getY() > 3362 && player.getQuestRepository().getPoints() < 32) {
|
|
||||||
player.getDialogueInterpreter().open(70099, "You have not proved yourself worthy to enter here yet.");
|
|
||||||
player.getPacketDispatch().sendMessage("The door won't open - you need at least 32 Quest Points.");
|
|
||||||
} else {
|
|
||||||
if (player.getLocation().getX() == 3191 && player.getLocation().getY() == 3363) {
|
|
||||||
player.getDialogueInterpreter().sendDialogues(198, null, "Greetings bold adventurer. Welcome to the guild of", "Champions.");
|
|
||||||
}
|
|
||||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 1, 1);
|
|
||||||
DoorActionHandler.handleAutowalkDoor(player, (Scenery) node);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
|
||||||
SceneryDefinition.forId(1805).getHandlers().put("option:open", this);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getDestination(Node node, Node n) {
|
|
||||||
return DoorActionHandler.getDestination(((Player) node), ((Scenery) n));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package core.game.interaction.`object`
|
||||||
|
|
||||||
|
import core.game.content.global.action.DoorActionHandler
|
||||||
|
import core.game.node.entity.player.link.diary.DiaryType
|
||||||
|
import core.plugin.Initializable
|
||||||
|
import org.rs09.consts.Scenery
|
||||||
|
import rs09.game.interaction.IntType
|
||||||
|
import rs09.game.interaction.InteractionListener
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the plugin used to handle the interaction with the champions guild
|
||||||
|
* door.
|
||||||
|
* @author 'Vexia
|
||||||
|
* @author dginovker
|
||||||
|
* @version 2.0
|
||||||
|
*/
|
||||||
|
@Initializable
|
||||||
|
class ChampionsGuildDoor : InteractionListener {
|
||||||
|
override fun defineListeners() {
|
||||||
|
on(Scenery.DOOR_1805, IntType.SCENERY, "open") {player, node ->
|
||||||
|
if (player.location.y > 3362 && player.questRepository.points < 32) {
|
||||||
|
player.dialogueInterpreter.open(70099, "You have not proved yourself worthy to enter here yet.")
|
||||||
|
player.packetDispatch.sendMessage("The door won't open - you need at least 32 Quest Points.")
|
||||||
|
} else {
|
||||||
|
if (player.location.x == 3191 && player.location.y == 3363) {
|
||||||
|
player.dialogueInterpreter.sendDialogues(
|
||||||
|
198,
|
||||||
|
null,
|
||||||
|
"Greetings bold adventurer. Welcome to the guild of",
|
||||||
|
"Champions."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 1, 1)
|
||||||
|
DoorActionHandler.handleAutowalkDoor(player, node as core.game.node.scenery.Scenery)
|
||||||
|
}
|
||||||
|
return@on true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user