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:
@@ -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.")
|
||||
return
|
||||
}
|
||||
val loc = player.houseManager.location.exitLocation
|
||||
if(loc == null){
|
||||
player.sendMessage("You do not have a house whose portal you can teleport to.")
|
||||
val hasHouse = player.houseManager.location.exitLocation != null
|
||||
if(!hasHouse){
|
||||
player.sendMessage("You do not have a house you can teleport to.")
|
||||
return
|
||||
}
|
||||
|
||||
player.houseManager.preEnter(player, false)
|
||||
val teleType = TeleportManager.TeleportType.NORMAL
|
||||
|
||||
val loc = player.houseManager.getEnterLocation()
|
||||
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)
|
||||
addXP(player,30.0)
|
||||
setDelay(player,true)
|
||||
|
||||
Reference in New Issue
Block a user