Fixed random variation on tablet teleport to house
Corrected drop table for hero Rewrote tablet teleports in kotlin as listener Added new ::runekit admin command, which gives 1k of each Rune type to make testing easier
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package content.global.handlers.item
|
||||
|
||||
import core.api.*
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.entity.player.link.TeleportManager
|
||||
import core.game.node.item.Item
|
||||
|
||||
class HouseTeleTabOptionListener : InteractionListener {
|
||||
override fun defineListeners() {
|
||||
val homeTabID = 8013
|
||||
on(homeTabID, IntType.ITEM, "break") {player, node ->
|
||||
var location = player.houseManager.location.exitLocation
|
||||
if (location == null) {
|
||||
sendMessage( player, "You must have a house to teleport to before attempting that.")
|
||||
return@on false
|
||||
}
|
||||
closeInterface(player)
|
||||
lock(player, 5)
|
||||
if (inInventory(player, node.id)) {
|
||||
if (teleport(player, location, TeleportManager.TeleportType.TELETABS)) {
|
||||
removeItem(player, Item(node.id, 1))
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package content.global.handlers.item;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.TeleportManager.TeleportType;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
@Initializable
|
||||
public class HouseTeleTabOptionPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.forId(8013).getHandlers().put("option:break", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (player.getHouseManager().getLocation().getExitLocation() == null) {
|
||||
player.sendMessage("You must have a house to teleport to before attempting that.");
|
||||
return false;
|
||||
}
|
||||
player.getInterfaceManager().close();
|
||||
player.lock(5);
|
||||
Location location = player.getHouseManager().getLocation().getExitLocation();
|
||||
if (player.getInventory().contains(node.asItem().getId(), 1)) {
|
||||
if (player.getTeleporter().send(location.transform(0, RandomFunction.random(3), 0), TeleportType.TELETABS, 1)) {
|
||||
player.getInventory().remove(new Item(node.asItem().getId(),1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package content.global.handlers.item
|
||||
|
||||
import core.api.inInventory
|
||||
import core.api.removeItem
|
||||
import core.api.teleport
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.entity.player.link.TeleportManager
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
|
||||
class TeleTabsListener : InteractionListener {
|
||||
|
||||
enum class TeleTabs(val item: Int, val location: Location, val exp: Double) {
|
||||
ADDOUGNE_TELEPORT(8011, Location.create(2662, 3307, 0), 61.0),
|
||||
AIR_ALTAR_TELEPORT(13599, Location.create(2978, 3296, 0), 0.0),
|
||||
ASTRAL_ALTAR_TELEPORT(13611, Location.create(2156, 3862, 0), 0.0),
|
||||
BLOOD_ALTAR_TELEPORT(13610, Location.create(3559, 9778, 0), 0.0),
|
||||
BODY_ALTAR_TELEPORT(13604, Location.create(3055, 3443, 0), 0.0),
|
||||
CAMELOT_TELEPORT(8010, Location.create(2757, 3477, 0), 55.5),
|
||||
CHAOS_ALTAR_TELEPORT(13606, Location.create(3058, 3593, 0), 0.0),
|
||||
COSMIC_ALTAR_TELEPORT(13605, Location.create(2411, 4380, 0), 0.0),
|
||||
DEATH_ALTAR_TELEPORT(13609, Location.create(1863, 4639, 0), 0.0),
|
||||
EARTH_ALTAR_TELEPORT(13602, Location.create(3304, 3472, 0), 0.0),
|
||||
FALADOR_TELEPORT(8009, Location.create(2966, 3380, 0), 47.0),
|
||||
FIRE_ALTAR_TELEPORT(13603, Location.create(3311, 3252, 0), 0.0),
|
||||
LAW_ALTAR_TELEPORT(13608, Location.create(2857, 3378, 0), 0.0),
|
||||
LUMBRIDGE_TELEPORT(8008, Location.create(3222, 3218, 0), 41.0),
|
||||
MIND_ALTAR_TELEPORT(13600, Location.create(2979, 3510, 0), 0.0),
|
||||
NATURE_ALTAR_TELEPORT(13607, Location.create(2868, 3013, 0), 0.0),
|
||||
VARROCK_TELEPORT(8007, Location.create(3212, 3423, 0), 35.00),
|
||||
WATCH_TOWER_TELEPORT(8012, Location.create(2548, 3114, 0), 68.00),
|
||||
WATER_ALTAR_TELEPORT(13601, Location.create(3182, 3162, 0), 0.0);
|
||||
|
||||
companion object {
|
||||
val idMap = values().map { it.item to it }.toMap()
|
||||
fun forId(id: Int): TeleTabs? {
|
||||
return idMap[id]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
val tabIDs = TeleTabs.values().map { it.item }.toIntArray()
|
||||
on(tabIDs, IntType.ITEM, "break") {player, node ->
|
||||
val tab = node.id
|
||||
val tabEnum = TeleTabs.forId(tab)
|
||||
if (tabEnum != null && inInventory(player,tab)) {
|
||||
val tabloc = tabEnum.location
|
||||
if (inInventory(player, tab)) {
|
||||
if (teleport(player, tabloc, TeleportManager.TeleportType.TELETABS)) {
|
||||
removeItem(player, Item(node.id, 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
package content.global.handlers.item;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.TeleportManager.TeleportType;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle teletabs.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class TeleTabsOptionPlugin extends OptionHandler {
|
||||
|
||||
/**
|
||||
* Represents the enum of tele tabs.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum TeleTabs {
|
||||
ADDOUGNE_TELEPORT(8011, Location.create(2662, 3307, 0), 61),
|
||||
AIR_ALTAR_TELEPORT(13599, Location.create(2978, 3296, 0), 0),
|
||||
ASTRAL_ALTAR_TELEPORT(13611, Location.create(2156, 3862, 0), 0),
|
||||
BLOOD_ALTAR_TELEPORT(13610, Location.create(3559, 9778, 0), 0),
|
||||
BODY_ALTAR_TELEPORT(13604, Location.create(3055, 3443, 0), 0),
|
||||
CAMELOT_TELEPORT(8010, Location.create(2757, 3477, 0), 55.5),
|
||||
CHAOS_ALTAR_TELEPORT(13606, Location.create(3058, 3593, 0), 0),
|
||||
COSMIC_ALTAR_TELEPORT(13605, Location.create(2411, 4380, 0), 0),
|
||||
DEATH_ALTAR_TELEPORT(13609, Location.create(1863, 4639, 0), 0),
|
||||
EARTH_ALTAR_TELEPORT(13602, Location.create(3304, 3472, 0), 0),
|
||||
FALADOR_TELEPORT(8009, Location.create(2966, 3380, 0), 47),
|
||||
FIRE_ALTAR_TELEPORT(13603, Location.create(3311, 3252, 0), 0),
|
||||
LAW_ALTAR_TELEPORT(13608, Location.create(2857, 3378, 0), 0),
|
||||
LUMBRIDGE_TELEPORT(8008, Location.create(3222, 3218, 0), 41),
|
||||
MIND_ALTAR_TELEPORT(13600, Location.create(2979, 3510, 0), 0),
|
||||
NATURE_ALTAR_TELEPORT(13607, Location.create(2868, 3013, 0), 0),
|
||||
VARROCK_TELEPORT(8007, Location.create(3212, 3423, 0), 35),
|
||||
WATCH_TOWER_TELEPORT(8012, Location.create(2548, 3114, 0), 68),
|
||||
WATER_ALTAR_TELEPORT(13601, Location.create(3182, 3162, 0), 0);
|
||||
|
||||
/**
|
||||
* Method used to get the teletab by the id.
|
||||
* @param id the id.
|
||||
* @return the teletab.
|
||||
*/
|
||||
public static TeleTabs forId(int id) {
|
||||
for (TeleTabs tab : TeleTabs.values()) {
|
||||
if (tab == null)
|
||||
continue;
|
||||
if (tab.getItem() == id)
|
||||
return tab;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The location.
|
||||
*/
|
||||
private Location location;
|
||||
|
||||
/**
|
||||
* The item id.
|
||||
*/
|
||||
private int item;
|
||||
|
||||
/**
|
||||
* The experience gained.
|
||||
*/
|
||||
private double exp;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code TeleTabsOptionPlugin} {@code Object}.
|
||||
* @param item the item.
|
||||
* @param location the location.
|
||||
* @param exp the exp.
|
||||
*/
|
||||
TeleTabs(int item, Location location, double exp) {
|
||||
setItem(item);
|
||||
setLocation(location);
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item
|
||||
*/
|
||||
public int getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item the item to set
|
||||
*/
|
||||
private void setItem(int item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param location the location to set
|
||||
*/
|
||||
private void setLocation(Location location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the exp.
|
||||
*/
|
||||
public double getExp() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exp the exp to set.
|
||||
*/
|
||||
private void setExp(double exp) {
|
||||
this.exp = exp;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final Player player, Node node, String option) {
|
||||
final Item item = (Item) node;
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
final TeleTabs tab = TeleTabs.forId(item.getId());
|
||||
if (tab == null) {
|
||||
return false;
|
||||
}
|
||||
player.getInterfaceManager().close();
|
||||
player.lock(5);
|
||||
if (player.getInventory().contains(item.getId(), 1)) {
|
||||
if (player.getTeleporter().send(tab.getLocation(), TeleportType.TELETABS, 1)) {
|
||||
player.getInventory().remove(new Item(item.getId()), item.getSlot(), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalk() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.setOptionHandler("break", this);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package content.global.skill.construction.decoration.study
|
||||
|
||||
import content.global.handlers.item.TeleTabsListener
|
||||
import core.api.*
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.component.Component
|
||||
import core.game.interaction.OptionHandler
|
||||
import content.global.handlers.item.TeleTabsOptionPlugin
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
@@ -47,21 +47,21 @@ class LecternPlugin : OptionHandler() {
|
||||
* The required decoration (lectern)
|
||||
*/
|
||||
private val requiredDecorations: Array<Decoration>, vararg requiredItems: Item) {
|
||||
ARDOUGNE(2, 51, 61.0, Item(TeleTabsOptionPlugin.TeleTabs.ADDOUGNE_TELEPORT.item), arrayOf<Decoration>(Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563, 2), Item(555, 2)),
|
||||
ARDOUGNE(2, 51, 61.0, Item(TeleTabsListener.TeleTabs.ADDOUGNE_TELEPORT.item), arrayOf<Decoration>(Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563, 2), Item(555, 2)),
|
||||
BONES_TO_BANANNAS(3, 15, 25.0, Item(8014), arrayOf<Decoration>(Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(561, 1), Item(557, 2), Item(555, 2)),
|
||||
BONES_TO_PEACHES(4, 60, 35.5, Item(8015), arrayOf<Decoration>(Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(561, 2), Item(557, 4), Item(555, 4)),
|
||||
CAMELOT(5, 45, 55.5, Item(TeleTabsOptionPlugin.TeleTabs.CAMELOT_TELEPORT.item), arrayOf<Decoration>(Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(556, 5)),
|
||||
CAMELOT(5, 45, 55.5, Item(TeleTabsListener.TeleTabs.CAMELOT_TELEPORT.item), arrayOf<Decoration>(Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(556, 5)),
|
||||
ENCHANT_DIAMOND(6, 57, 67.0, Item(8019), arrayOf<Decoration>(Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(557, 10)),
|
||||
ENCHANT_DRAGONSTONE(7, 68, 78.0, Item(8020), arrayOf<Decoration>(Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(557, 15), Item(555, 15)),
|
||||
ENCHANT_EMERALD(8, 27, 37.0, Item(8017), arrayOf<Decoration>(Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(556, 3)),
|
||||
ENCHANT_ONYX(9, 87, 97.0, Item(8021), arrayOf<Decoration>(Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(557, 20), Item(554, 20)),
|
||||
ENCHANT_RUBY(10, 49, 59.0, Item(8018), arrayOf<Decoration>(Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(554, 5)),
|
||||
ENCHANT_SAPPHIRE(11, 7, 17.5, Item(8016), arrayOf<Decoration>(Decoration.OAK_LECTERN, Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN, Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(564), Item(555)),
|
||||
FALADOR(12, 37, 48.0, Item(TeleTabsOptionPlugin.TeleTabs.FALADOR_TELEPORT.item), arrayOf<Decoration>(Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(555), Item(556, 3)),
|
||||
LUMBRIDGE(13, 31, 41.0, Item(TeleTabsOptionPlugin.TeleTabs.LUMBRIDGE_TELEPORT.item), arrayOf<Decoration>(Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(557), Item(556, 3)),
|
||||
FALADOR(12, 37, 48.0, Item(TeleTabsListener.TeleTabs.FALADOR_TELEPORT.item), arrayOf<Decoration>(Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(555), Item(556, 3)),
|
||||
LUMBRIDGE(13, 31, 41.0, Item(TeleTabsListener.TeleTabs.LUMBRIDGE_TELEPORT.item), arrayOf<Decoration>(Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(557), Item(556, 3)),
|
||||
HOUSE(14, 40, 30.0, Item(8013), arrayOf<Decoration>(Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563), Item(557), Item(556)),
|
||||
VARROCK(15, 25, 35.0, Item(TeleTabsOptionPlugin.TeleTabs.VARROCK_TELEPORT.item), arrayOf<Decoration>(Decoration.OAK_LECTERN, Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN, Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(563), Item(554), Item(556, 3)),
|
||||
WATCHTOWER(16, 58, 68.0, Item(TeleTabsOptionPlugin.TeleTabs.WATCH_TOWER_TELEPORT.item), arrayOf<Decoration>(Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563, 2), Item(557, 2));
|
||||
VARROCK(15, 25, 35.0, Item(TeleTabsListener.TeleTabs.VARROCK_TELEPORT.item), arrayOf<Decoration>(Decoration.OAK_LECTERN, Decoration.EAGLE_LECTERN, Decoration.TEAK_EAGLE_LECTERN, Decoration.MAHOGANY_EAGLE_LECTERN, Decoration.DEMON_LECTERN, Decoration.TEAK_DEMON_LECTERN, Decoration.MAHOGANY_DEMON_LECTERN), SOFT_CLAY, Item(563), Item(554), Item(556, 3)),
|
||||
WATCHTOWER(16, 58, 68.0, Item(TeleTabsListener.TeleTabs.WATCH_TOWER_TELEPORT.item), arrayOf<Decoration>(Decoration.MAHOGANY_EAGLE_LECTERN), SOFT_CLAY, Item(563, 2), Item(557, 2));
|
||||
|
||||
/**
|
||||
* The required items
|
||||
|
||||
@@ -2,10 +2,7 @@ package core.game.system.command.sets
|
||||
|
||||
import content.global.activity.jobs.JobManager
|
||||
import content.global.skill.slayer.Master
|
||||
import core.api.log
|
||||
import core.api.removeAttribute
|
||||
import core.api.getItemName
|
||||
import core.api.sendMessage
|
||||
import core.api.*
|
||||
import core.cache.Cache
|
||||
import core.cache.def.impl.DataMap
|
||||
import core.cache.def.impl.NPCDefinition
|
||||
@@ -33,7 +30,7 @@ import core.tools.Log
|
||||
@Initializable
|
||||
class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) {
|
||||
val farmKitItems = arrayListOf(Items.RAKE_5341, Items.SPADE_952, Items.SEED_DIBBER_5343, Items.WATERING_CAN8_5340, Items.SECATEURS_5329, Items.GARDENING_TROWEL_5325)
|
||||
|
||||
val runeKitItems = arrayListOf(Items.AIR_RUNE_556, Items.EARTH_RUNE_557, Items.FIRE_RUNE_554, Items.WATER_RUNE_555, Items.MIND_RUNE_558, Items.BODY_RUNE_559, Items.DEATH_RUNE_560, Items.NATURE_RUNE_561, Items.CHAOS_RUNE_562, Items.LAW_RUNE_563, Items.COSMIC_RUNE_564, Items.BLOOD_RUNE_565, Items.SOUL_RUNE_566, Items.ASTRAL_RUNE_9075)
|
||||
override fun defineCommands() {
|
||||
|
||||
/**
|
||||
@@ -210,5 +207,11 @@ class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) {
|
||||
notify(player, "$i: $name")
|
||||
}
|
||||
}
|
||||
|
||||
define("runekit", Privilege.ADMIN, "", "Gives 1k of each Rune type" ) { player, args ->
|
||||
for(item in runeKitItems) {
|
||||
addItem(player, item, 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user