Fixed Teleport to House to teleport the player inside the house, rather than outside the entrance portal
Removed HouseTeleportPlugin.java deadcode
This commit is contained in:
@@ -10,19 +10,22 @@ class HouseTeleTabOptionListener : InteractionListener {
|
|||||||
override fun defineListeners() {
|
override fun defineListeners() {
|
||||||
val homeTabID = 8013
|
val homeTabID = 8013
|
||||||
on(homeTabID, IntType.ITEM, "break") {player, node ->
|
on(homeTabID, IntType.ITEM, "break") {player, node ->
|
||||||
var location = player.houseManager.location.exitLocation
|
var hasHouse = player.houseManager.location.exitLocation != null
|
||||||
if (location == null) {
|
if (!hasHouse) {
|
||||||
sendMessage( player, "You must have a house to teleport to before attempting that.")
|
sendMessage( player, "You must have a house to teleport to before attempting that.")
|
||||||
return@on false
|
return@on false
|
||||||
}
|
}
|
||||||
closeInterface(player)
|
closeInterface(player)
|
||||||
lock(player, 5)
|
lock(player, 5)
|
||||||
if (inInventory(player, node.id)) {
|
if (inInventory(player, node.id)) {
|
||||||
|
player.houseManager.preEnter(player, false)
|
||||||
|
val location = player.houseManager.getEnterLocation()
|
||||||
if (teleport(player, location, TeleportManager.TeleportType.TELETABS)) {
|
if (teleport(player, location, TeleportManager.TeleportType.TELETABS)) {
|
||||||
removeItem(player, Item(node.id, 1))
|
removeItem(player, Item(node.id, 1))
|
||||||
|
player.houseManager.postEnter(player, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,11 +185,11 @@ public final class HouseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter's the player's house.
|
* Prepares for entering the player's house.
|
||||||
* @param player
|
* @param player
|
||||||
* @param buildingMode
|
* @param buildingMode
|
||||||
*/
|
*/
|
||||||
public void enter(final Player player, boolean buildingMode) {
|
public void preEnter(final Player player, boolean buildingMode) {
|
||||||
if (this.buildingMode != buildingMode || !isLoaded()) {
|
if (this.buildingMode != buildingMode || !isLoaded()) {
|
||||||
this.buildingMode = buildingMode;
|
this.buildingMode = buildingMode;
|
||||||
construct();
|
construct();
|
||||||
@@ -197,8 +197,26 @@ public final class HouseManager {
|
|||||||
player.setAttribute("poh_entry", HouseManager.this);
|
player.setAttribute("poh_entry", HouseManager.this);
|
||||||
player.lock(1);
|
player.lock(1);
|
||||||
player.sendMessage("House location: " + houseRegion.getBaseLocation() + ", entry: " + getEnterLocation());
|
player.sendMessage("House location: " + houseRegion.getBaseLocation() + ", entry: " + getEnterLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the player's house and plays the ding sound.
|
||||||
|
* @param player
|
||||||
|
* @param buildingMode
|
||||||
|
*/
|
||||||
|
public void enter(final Player player, boolean buildingMode) {
|
||||||
|
preEnter(player, buildingMode);
|
||||||
player.getProperties().setTeleportLocation(getEnterLocation());
|
player.getProperties().setTeleportLocation(getEnterLocation());
|
||||||
openLoadInterface(player);
|
openLoadInterface(player);
|
||||||
|
postEnter(player, buildingMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs post-house-enter administration.
|
||||||
|
* @param player
|
||||||
|
* @param buildingMode
|
||||||
|
*/
|
||||||
|
public void postEnter(final Player player, boolean buildingMode) {
|
||||||
checkForAndSpawnServant(player);
|
checkForAndSpawnServant(player);
|
||||||
updateVarbits(player, buildingMode);
|
updateVarbits(player, buildingMode);
|
||||||
unlockMusicTrack(player);
|
unlockMusicTrack(player);
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
package content.global.skill.magic.modern;
|
|
||||||
|
|
||||||
import core.game.node.Node;
|
|
||||||
import core.game.node.entity.Entity;
|
|
||||||
import core.game.node.entity.combat.spell.SpellType;
|
|
||||||
import core.game.node.entity.combat.spell.MagicSpell;
|
|
||||||
import core.game.node.entity.player.Player;
|
|
||||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
|
||||||
import core.game.node.entity.player.link.TeleportManager.TeleportType;
|
|
||||||
import core.game.node.item.Item;
|
|
||||||
import core.game.world.GameWorld;
|
|
||||||
import core.game.world.map.Location;
|
|
||||||
import core.plugin.Plugin;
|
|
||||||
import core.tools.RandomFunction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* For house teleportation.
|
|
||||||
*
|
|
||||||
* @author Jamix77
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class HouseTeleportPlugin extends MagicSpell {
|
|
||||||
|
|
||||||
public HouseTeleportPlugin(final int level, final double experience, final Item... items) {
|
|
||||||
super(SpellBook.MODERN, level, experience, null, null, null, items);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean cast(Entity entity, Node target) {
|
|
||||||
if (((Player)entity).getHouseManager().getLocation().getExitLocation() == null) {
|
|
||||||
((Player)entity).sendMessage("You must have a house to teleport to before attempting that.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Location location = ((Player)entity).getHouseManager().getLocation().getExitLocation();
|
|
||||||
if (entity.getLocks().isTeleportLocked() || !super.meetsRequirements(entity, true, false)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (entity.getTeleporter().send(location.transform(0, RandomFunction.random(3), 0), TeleportType.NORMAL)) {
|
|
||||||
entity.setAttribute("teleport:items", super.runes);
|
|
||||||
entity.setAttribute("magic-delay", GameWorld.getTicks() + 5);
|
|
||||||
((Player) entity).getInventory().remove(super.runes);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -294,15 +294,17 @@ class ModernListeners : SpellListener("modern"){
|
|||||||
player.sendMessage("A magical force prevents you from teleporting.")
|
player.sendMessage("A magical force prevents you from teleporting.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val loc = player.houseManager.location.exitLocation
|
val hasHouse = player.houseManager.location.exitLocation != null
|
||||||
if(loc == null){
|
if(!hasHouse){
|
||||||
player.sendMessage("You do not have a house whose portal you can teleport to.")
|
player.sendMessage("You do not have a house you can teleport to.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player.houseManager.preEnter(player, false)
|
||||||
val teleType = TeleportManager.TeleportType.NORMAL
|
val teleType = TeleportManager.TeleportType.NORMAL
|
||||||
|
val loc = player.houseManager.getEnterLocation()
|
||||||
player.teleporter.send(loc, teleType)
|
player.teleporter.send(loc, teleType)
|
||||||
|
player.houseManager.postEnter(player, false) //this actually runs when the teleport is SUBMITTED rather than EXECUTED, but this is fine
|
||||||
removeRunes(player)
|
removeRunes(player)
|
||||||
addXP(player,30.0)
|
addXP(player,30.0)
|
||||||
setDelay(player,true)
|
setDelay(player,true)
|
||||||
|
|||||||
Reference in New Issue
Block a user