New spell listeners + other bugfixes
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
package core.game.content.activity.mta;
|
||||
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.entity.skill.magic.MagicSpell;
|
||||
import core.game.node.entity.skill.magic.Runes;
|
||||
import core.game.content.activity.mta.impl.AlchemistZone;
|
||||
import core.game.content.activity.mta.impl.AlchemistZone.AlchemistItem;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.equipment.SpellType;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.skill.magic.MagicSpell;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import core.game.content.activity.mta.impl.AlchemistZone;
|
||||
import core.game.content.activity.mta.impl.AlchemistZone.AlchemistItem;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
/**
|
||||
* Represents the plugin for the magic spell alchemy.
|
||||
@@ -55,8 +53,8 @@ public final class AlchemySpell extends MagicSpell {
|
||||
|
||||
@Override
|
||||
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
|
||||
SpellBook.MODERN.register(13, new AlchemySpell(21, 31, Animation.create(712), new Graphics(112, 96), false, Runes.FIRE_RUNE.getItem(3), Runes.NATURE_RUNE.getItem(1)));
|
||||
SpellBook.MODERN.register(34, new AlchemySpell(55, 65, Animation.create(713), new Graphics(113, 96), true, Runes.FIRE_RUNE.getItem(5), Runes.NATURE_RUNE.getItem(1)));
|
||||
//SpellBook.MODERN.register(13, new AlchemySpell(21, 31, Animation.create(712), new Graphics(112, 96), false, Runes.FIRE_RUNE.getItem(3), Runes.NATURE_RUNE.getItem(1)));
|
||||
//SpellBook.MODERN.register(34, new AlchemySpell(55, 65, Animation.create(713), new Graphics(113, 96), true, Runes.FIRE_RUNE.getItem(5), Runes.NATURE_RUNE.getItem(1)));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ public final class HansDialoguePlugin extends DialoguePlugin {
|
||||
case 110:
|
||||
switch (buttonId) {
|
||||
case 1: //I would like to be an Iron Man
|
||||
if (player.getSkills().getTotalLevel() > 500 || player.getQuestRepository().getPoints() > 10){
|
||||
if (player.getSkills().getTotalLevel() > 50 || player.getQuestRepository().getPoints() > 10){
|
||||
interpreter.sendDialogues(npc, FacialExpression.GUILTY, "Sorry, but you are too far along your journey.", "It would be unfair for those with other", " restrictions if your status were to be changed!");
|
||||
stage = 50;
|
||||
break;
|
||||
@@ -335,9 +335,7 @@ public final class HansDialoguePlugin extends DialoguePlugin {
|
||||
case 3: //ultimate ironman
|
||||
if (!player.getBank().isEmpty())
|
||||
{
|
||||
if (!inStartDungeon) {
|
||||
interpreter.sendDialogues(npc, FacialExpression.GUILTY, "Sorry, but your bank is has items in it.", "Please empty your bank and speak to me again.");
|
||||
}
|
||||
interpreter.sendDialogues(npc, FacialExpression.GUILTY, "Sorry, but your bank is has items in it.", "Please empty your bank and speak to me again.");
|
||||
stage = 50;
|
||||
break;
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,9 @@ import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.magic.MagicSpell;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import rs09.game.node.entity.skill.magic.SpellListener;
|
||||
import rs09.game.node.entity.skill.magic.SpellListeners;
|
||||
import rs09.game.node.entity.skill.magic.SpellUtils;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
@@ -31,6 +34,7 @@ public final class MagicBookInterface extends ComponentPlugin {
|
||||
if (GameWorld.getTicks() < player.getAttribute("magic:delay", -1)) {
|
||||
return true;
|
||||
}
|
||||
SpellListeners.run(button, SpellListener.NONE, SpellUtils.getBookFromInterface(component.getId()),player,null);
|
||||
return MagicSpell.castSpell(player, component.getId() == 192 ? SpellBook.MODERN : component.getId() == 193 ? SpellBook.ANCIENT : SpellBook.LUNAR, button, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
package core.game.node.entity.skill.magic;
|
||||
|
||||
import rs09.ServerConstants;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.equipment.SpellType;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.entity.player.link.TeleportManager.TeleportType;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.item.Item;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents the plugin to handle all teleport spells in the modern book.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class ModernTeleportPlugin extends MagicSpell {
|
||||
|
||||
/**
|
||||
* Represents the location to teleport to.
|
||||
*/
|
||||
private Location location;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ModernTeleportPlugin} {@code Object}.
|
||||
*/
|
||||
public ModernTeleportPlugin() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ModernTeleportPlugin.java} {@code Object}.
|
||||
* @param level the level.
|
||||
* @param experience the experience.
|
||||
* @param location the location.
|
||||
* @param items the items.
|
||||
*/
|
||||
public ModernTeleportPlugin(final int level, final double experience, final Location location, final Item... items) {
|
||||
super(SpellBook.MODERN, level, experience, null, null, null, items);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(Entity entity, Node target) {
|
||||
if (entity.getLocks().isTeleportLocked() || !super.meetsRequirements(entity, true, false)) {
|
||||
return false;
|
||||
}
|
||||
if (entity.getTeleporter().send(location.transform(0, RandomFunction.random(3), 0), getSpellId() == 0 ? TeleportType.HOME : TeleportType.NORMAL)) {
|
||||
if (!super.meetsRequirements(entity, true, true)) {
|
||||
entity.getTeleporter().getCurrentTeleport().stop();
|
||||
return false;
|
||||
}
|
||||
// Use the teleport to Varrock spell
|
||||
if (entity.isPlayer() && location.equals(Location.create(3213, 3424, 0))) {
|
||||
entity.asPlayer().getAchievementDiaryManager().finishTask(entity.asPlayer(),DiaryType.VARROCK,1, 13);
|
||||
}
|
||||
//
|
||||
if (entity.isPlayer() && location.getX() == 2758 && location.getY() == 3478) {
|
||||
entity.asPlayer().getAchievementDiaryManager().finishTask(entity.asPlayer(), DiaryType.SEERS_VILLAGE, 1, 5);
|
||||
}
|
||||
// Use the teleport Lumbridge spell
|
||||
if (entity.isPlayer() && location.equals(Location.create(3221, 3219, 0))) {
|
||||
entity.asPlayer().getAchievementDiaryManager().finishTask(entity.asPlayer(), DiaryType.LUMBRIDGE, 2, 2);
|
||||
}
|
||||
entity.setAttribute("teleport:items", super.runes);
|
||||
entity.setAttribute("magic-delay", GameWorld.getTicks() + 5);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
|
||||
// home
|
||||
SpellBook.MODERN.register(0, new ModernTeleportPlugin(0, 0, ServerConstants.HOME_LOCATION));
|
||||
// varrock
|
||||
SpellBook.MODERN.register(15, new ModernTeleportPlugin(25, 35, Location.create(3213, 3424, 0), new Item(Runes.FIRE_RUNE.getId()), new Item(Runes.AIR_RUNE.getId(), 3), new Item(Runes.LAW_RUNE.getId(), 1)));
|
||||
// lumby
|
||||
SpellBook.MODERN.register(18, new ModernTeleportPlugin(31, 41, Location.create(3221, 3219, 0), new Item(Runes.EARTH_RUNE.getId()), new Item(Runes.AIR_RUNE.getId(), 3), new Item(Runes.LAW_RUNE.getId(), 1)));
|
||||
// fally
|
||||
SpellBook.MODERN.register(21, new ModernTeleportPlugin(37, 47, Location.create(2965, 3378, 0), new Item(Runes.WATER_RUNE.getId()), new Item(Runes.AIR_RUNE.getId(), 3), new Item(Runes.LAW_RUNE.getId(), 1)));
|
||||
// camelot
|
||||
SpellBook.MODERN.register(26, new ModernTeleportPlugin(45, 55.5, Location.create(2758, 3478, 0), new Item(Runes.AIR_RUNE.getId(), 5), new Item(Runes.LAW_RUNE.getId(), 1)));
|
||||
// house
|
||||
SpellBook.MODERN.register(23, new HouseTeleportPlugin(40, 50, new Item(Runes.LAW_RUNE.getId()), new Item(Runes.AIR_RUNE.getId(), 1), new Item(Runes.EARTH_RUNE.getId(), 1)));
|
||||
// ardougne
|
||||
SpellBook.MODERN.register(32, new ModernTeleportPlugin(51, 61, Location.create(2662, 3307, 0), new Item(Runes.WATER_RUNE.getId(), 2), new Item(Runes.LAW_RUNE.getId(), 2)));
|
||||
// watchtower
|
||||
SpellBook.MODERN.register(37, new ModernTeleportPlugin(58, 68, Location.create(2549, 3112, 0), new Item(Runes.EARTH_RUNE.getId(), 2), new Item(Runes.LAW_RUNE.getId(), 2)));
|
||||
// trollheim
|
||||
SpellBook.MODERN.register(44, new ModernTeleportPlugin(61, 68, Location.create(2891, 3678, 0), new Item(Runes.FIRE_RUNE.getId(), 2), new Item(Runes.LAW_RUNE.getId(), 2)));
|
||||
// ape atol
|
||||
SpellBook.MODERN.register(47, new ModernTeleportPlugin(64, 74, Location.create(2754, 2784, 0), new Item(Runes.FIRE_RUNE.getId(), 2), new Item(Runes.WATER_RUNE.getId(), 2), new Item(Runes.LAW_RUNE.getId(), 2), new Item(1963, 1)));
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package core.game.node.entity.skill.magic;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.skill.smithing.smelting.Bar;
|
||||
import core.game.node.entity.skill.smithing.smelting.SmeltingPulse;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.Entity;
|
||||
import core.game.node.entity.combat.equipment.SpellType;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the super heat spell.
|
||||
* @author Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class SuperheatSpell extends MagicSpell {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SuperheatSpell} {@code Object}.
|
||||
*/
|
||||
public SuperheatSpell() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SuperheatSpell} {@code Object}.
|
||||
* @param level the level.
|
||||
* @param runes the runes.
|
||||
*/
|
||||
public SuperheatSpell(int level, Item... runes) {
|
||||
super(SpellBook.MODERN, level, 53.0, null, null, null, runes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
|
||||
SpellBook.MODERN.register(25, new SuperheatSpell(43, new Item(Runes.FIRE_RUNE.getId(), 4), new Item(Runes.NATURE_RUNE.getId(), 1)));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(Entity entity, Node target) {
|
||||
final Player player = ((Player) entity);
|
||||
final Item item = ((Item) target);
|
||||
player.getInterfaceManager().setViewedTab(6);
|
||||
if (player.inCombat()) {
|
||||
player.getPacketDispatch().sendMessage("You can't do that during combat.");
|
||||
return false;
|
||||
}
|
||||
if (!item.getName().contains("ore") && !item.getName().toLowerCase().equals("coal")) {
|
||||
player.getPacketDispatch().sendMessage("You need to cast superheat item on ore.");
|
||||
return false;
|
||||
}
|
||||
final Bar bar = Bar.forOre(item.getId());
|
||||
if (bar == null) {
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.SMITHING) < bar.getLevel()) {
|
||||
player.sendMessage("You need a Smithing level of at least " + bar.getLevel() + " to do this.");
|
||||
return false;
|
||||
}
|
||||
for (Item items : bar.getOres()) {
|
||||
if (!player.getInventory().contains(items.getId(), items.getAmount())) {
|
||||
player.getPacketDispatch().sendMessage("You do not have the required ores to make this bar.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!super.meetsRequirements(entity, true, true)) {
|
||||
return false;
|
||||
}
|
||||
player.getAudioManager().send(117);
|
||||
player.getPulseManager().run(new SmeltingPulse(player, item, bar, 1, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,9 @@ import core.game.node.entity.player.link.SpellBookManager;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.object.GameObject;
|
||||
import rs09.game.node.entity.skill.magic.SpellListener;
|
||||
import rs09.game.node.entity.skill.magic.SpellListeners;
|
||||
import rs09.game.node.entity.skill.magic.SpellUtils;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.RegionManager;
|
||||
@@ -55,6 +58,7 @@ public class InterfaceUseOnPacket implements IncomingPacket {
|
||||
break;
|
||||
}
|
||||
if (CombatSwingHandler.isProjectileClipped(player, groundItem, false)) {
|
||||
SpellListeners.run(spell, SpellListener.GROUND_ITEM, SpellUtils.getBookFromInterface(interfaceId),player,groundItem);
|
||||
MagicSpell.castSpell(player, SpellBookManager.SpellBook.MODERN, spell, groundItem);
|
||||
} else {
|
||||
player.getPulseManager().run(new MovementPulse(player, groundItem) {
|
||||
@@ -73,6 +77,7 @@ public class InterfaceUseOnPacket implements IncomingPacket {
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
SpellListeners.run(spell, SpellListener.GROUND_ITEM,SpellUtils.getBookFromInterface(interfaceId),player,groundItem);
|
||||
MagicSpell.castSpell(player, SpellBookManager.SpellBook.MODERN, spell, groundItem);
|
||||
return true;
|
||||
}
|
||||
@@ -92,6 +97,9 @@ public class InterfaceUseOnPacket implements IncomingPacket {
|
||||
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
|
||||
break;
|
||||
}
|
||||
if(!SpellUtils.getBookFromInterface(interfaceId).equals("none")){
|
||||
SpellListeners.run(componentId,SpellListener.PLAYER,SpellUtils.getBookFromInterface(interfaceId),player,target);
|
||||
}
|
||||
switch (interfaceId) {
|
||||
case 192:
|
||||
MagicSpell.castSpell(player, SpellBookManager.SpellBook.MODERN, componentId, target);
|
||||
@@ -144,6 +152,9 @@ public class InterfaceUseOnPacket implements IncomingPacket {
|
||||
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
|
||||
break;
|
||||
}
|
||||
if(!SpellUtils.getBookFromInterface(interfaceId).equals("none")){
|
||||
SpellListeners.run(componentId,SpellListener.OBJECT,SpellUtils.getBookFromInterface(interfaceId),player,object);
|
||||
}
|
||||
switch (interfaceId) {
|
||||
case 430:
|
||||
MagicSpell.castSpell(player, SpellBookManager.SpellBook.LUNAR, componentId, object);
|
||||
@@ -179,6 +190,9 @@ public class InterfaceUseOnPacket implements IncomingPacket {
|
||||
if (player.getAttribute("magic:delay", -1) > GameWorld.getTicks()) {
|
||||
break;
|
||||
}
|
||||
if(!SpellUtils.getBookFromInterface(interfaceId).equals("none")){
|
||||
SpellListeners.run(componentId,SpellListener.NPC, SpellUtils.getBookFromInterface(interfaceId),player,npc);
|
||||
}
|
||||
switch (interfaceId) {
|
||||
case 430:
|
||||
MagicSpell.castSpell(player, SpellBookManager.SpellBook.LUNAR, componentId, npc);
|
||||
@@ -222,6 +236,9 @@ public class InterfaceUseOnPacket implements IncomingPacket {
|
||||
if (item == null) {
|
||||
break;
|
||||
}
|
||||
if(!SpellUtils.getBookFromInterface(interfaceId).equals("none")){
|
||||
SpellListeners.run(componentId,SpellListener.ITEM,SpellUtils.getBookFromInterface(interfaceId),player,item);
|
||||
}
|
||||
switch (interfaceId) {
|
||||
case 430:
|
||||
if (player.getAttribute("magic:delay", -1) > GameWorld.getTicks()) {
|
||||
|
||||
Reference in New Issue
Block a user