Repository reorganisation

Unified kotlin and java into just src/main
Unified the rs09 and core packages
Took all content out of the core package, and placed it into the new content package
Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
Ceikry
2023-01-26 13:59:28 +00:00
committed by Ryan
parent e4b799c44a
commit a100affda2
3156 changed files with 24205 additions and 30585 deletions
@@ -0,0 +1,126 @@
package content.global.skill.magic.modern;
import core.plugin.Initializable;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
/**
* Represents the combat spell plugin used to handle air spells.
* @author Emperor
* @version 1.0
*/
@Initializable
public final class AirSpell extends CombatSpell {
/**
* The start graphic for Air strike.
*/
private static final Graphics STRIKE_START = new Graphics(90, 96);
/**
* The projectile for Air strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 91, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Air strike.
*/
private static final Graphics STRIKE_END = new Graphics(92, 96);
/**
* The start graphic for Air bolt.
*/
private static final Graphics BOLT_START = new Graphics(117, 96);
/**
* The projectile for Air bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 118, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Air bolt.
*/
private static final Graphics BOLT_END = new Graphics(119, 96);
/**
* The start graphic for Air blast.
*/
private static final Graphics BLAST_START = new Graphics(132, 96); // 129
/**
* The projectile for Air blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 133, 40, 36, 52, 75, 15, 11); // 130
/**
* The end graphic for Air blast.
*/
private static final Graphics BLAST_END = new Graphics(134, 96); // 131
/**
* The start graphic for Air wave.
*/
private static final Graphics WAVE_START = new Graphics(158, 96);
/**
* The projectile for Air wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 159, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Air wave.
*/
private static final Graphics WAVE_END = new Graphics(160, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code AirSpell} {@Code Object}
*/
public AirSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code AirSpell} {@Code Object}
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private AirSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 1);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(1, new AirSpell(SpellType.STRIKE, 1, 5.5, 220, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.AIR_RUNE.getItem(1)));
SpellBook.MODERN.register(10, new AirSpell(SpellType.BOLT, 17, 13.5, 218, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(24, new AirSpell(SpellType.BLAST, 41, 25.5, 216, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(45, new AirSpell(SpellType.WAVE, 62, 36.0, 222, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.AIR_RUNE.getItem(5)));
return this;
}
}
@@ -0,0 +1,146 @@
package content.global.skill.magic.modern;
import core.plugin.Initializable;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
/**
* Represents the binding combat spell.
* @author 'Vexia
* @author Emperor
* @version 1.0
*/
@Initializable
public final class BindSpell extends CombatSpell {
/**
* The start graphic for Earth strike.
*/
private static final Graphics BIND_START = new Graphics(177, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile BIND_PROJECTILE = Projectile.create((Entity) null, null, 178, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics BIND_END = new Graphics(181, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics SNARE_START = new Graphics(177, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile SNARE_PROJECTILE = Projectile.create((Entity) null, null, 178, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics SNARE_END = new Graphics(180, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics ENTANGLE_START = new Graphics(177, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile ENTANGLE_PROJECTILE = Projectile.create((Entity) null, null, 178, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics ENTANGLE_END = new Graphics(179, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(710, Priority.HIGH);
/**
* Constructs a new {@code BindSpell} {@Code Object}
*/
public BindSpell() {
/**
* empty.
*/
}
/**
* Constructs a new {@code BindSpell} {@code Object}.
* @param type the type.
* @param level the level.
* @param sound the sound.
* @param start the start.
* @param projectile the projectile.
* @param end the end.
* @param runes the runes.
*/
private BindSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, -1, ANIMATION, start, projectile, end, runes);
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (victim instanceof NPC) {
NPC npc = (NPC) victim;
if (npc.getName().contains("impling")) {
state.setEstimatedHit(-2);
}
}
if (state.getEstimatedHit() == -1) {
return;
}
int tick = 9;
if (getType() == SpellType.BIND) {
state.setEstimatedHit(-2);
}
if (state.getSpell().getSpellId() == 30) {
tick = 17;
} else if (state.getSpell().getSpellId() == 56) {
tick = 25;
}
if (!victim.getLocks().isMovementLocked() && victim instanceof Player) {
((Player) victim).getPacketDispatch().sendMessage("A magical force stops you from moving!");
}
victim.getWalkingQueue().reset();
victim.getLocks().lockMovement(tick);
entity.setAttribute("entangleDelay", GameWorld.getTicks() + tick + 2);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType() == SpellType.ENTANGLE ? 5 : 3;
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
// TODO: bind/snare/entangle have separate casting and onhit components
// to their sound effects, in order for splashes to sound distinct, currently
// these just sound like the spells should on success, even if they splash
SpellBook.MODERN.register(12, new BindSpell(SpellType.BIND, 20, 30.0, 101, BIND_START, BIND_PROJECTILE, BIND_END, Runes.NATURE_RUNE.getItem(2), Runes.EARTH_RUNE.getItem(3), Runes.WATER_RUNE.getItem(3)));
SpellBook.MODERN.register(30, new BindSpell(SpellType.SNARE, 50, 60.0, 186, SNARE_START, SNARE_PROJECTILE, SNARE_END, Runes.NATURE_RUNE.getItem(3), Runes.EARTH_RUNE.getItem(4), Runes.WATER_RUNE.getItem(4)));
SpellBook.MODERN.register(56, new BindSpell(SpellType.ENTANGLE, 79, 89.0, 152, ENTANGLE_START, ENTANGLE_PROJECTILE, ENTANGLE_END, Runes.NATURE_RUNE.getItem(4), Runes.EARTH_RUNE.getItem(5), Runes.WATER_RUNE.getItem(5)));
return this;
}
}
@@ -0,0 +1,205 @@
package content.global.skill.magic.modern;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.entity.combat.spell.MagicSpell;
import core.game.node.entity.player.link.diary.DiaryType;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.node.scenery.Scenery;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the the charging orb magic spell.
*
* @author Emperor
* @version 1.0
*/
@Initializable
public final class ChargeOrbSpells extends MagicSpell {
/**
* The animation.
*/
private static final Animation ANIMATION = Animation.create(791);
/**
* The unpowered orb item.
*/
private static final Item UNPOWERED_ORB = new Item(567);
/**
* The object id.
*/
private int objectId;
/**
* The item id.
*/
private int itemId;
/**
* The button that was clicked.
*/
private int buttonId;
/**
* Constructs a new {@code ChargeOrbSpells} {@code Object}
*/
public ChargeOrbSpells() {
/*
* empty.
*/
}
/**
* Constructs a new {@code ChargeOrbSpells} {@code Object}.
*
* @param level The level required.
* @param objectId The object id.
* @param itemId The item to add.
* @param buttonId the button clicked
* @param g The graphics.
* @param runes The runes required.
*/
public ChargeOrbSpells(int level, int objectId, int itemId, int buttonId, Graphics g, Audio a, Item... runes) {
super(SpellBook.MODERN, level, level + 10, ANIMATION, g, a, runes);
this.objectId = objectId;
this.itemId = itemId;
this.buttonId = buttonId;
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(35, new ChargeOrbSpells(56, 2151, 571, 35, new Graphics(149, 96), new Audio(118), Runes.WATER_RUNE.getItem(30), Runes.COSMIC_RUNE.getItem(3), UNPOWERED_ORB));
SpellBook.MODERN.register(39, new ChargeOrbSpells(60, 29415, 575, 39, new Graphics(151, 96), new Audio(115), Runes.EARTH_RUNE.getItem(30), Runes.COSMIC_RUNE.getItem(3), UNPOWERED_ORB));
SpellBook.MODERN.register(46, new ChargeOrbSpells(63, 2153, 569, 46, new Graphics(152, 96), new Audio(117), Runes.FIRE_RUNE.getItem(30), Runes.COSMIC_RUNE.getItem(3), UNPOWERED_ORB));
SpellBook.MODERN.register(49, new ChargeOrbSpells(66, 2152, 573, 49, new Graphics(150, 96), new Audio(116), Runes.AIR_RUNE.getItem(30), Runes.COSMIC_RUNE.getItem(3), UNPOWERED_ORB));
return this;
}
@Override
public boolean cast(Entity entity, Node target) {
if (!(target instanceof Scenery)) {
return false;
}
Player p = (Player) entity;
Scenery obj = (Scenery) target;
if (obj == null || obj.getId() != objectId) {
p.getPacketDispatch().sendMessage("You can't cast this spell on this object!");
return false;
}
if (obj.getLocation().getDistance(p.getLocation()) > 3) {
p.getPacketDispatch().sendMessage("You're standing too far from the obelisk's reach.");
return false;
}
if (!p.getAchievementDiaryManager().hasCompletedTask(DiaryType.SEERS_VILLAGE, 2, 9)
&& objectId == 2151
&& p.getInventory().containsItems(Runes.COSMIC_RUNE.getItem(15), Runes.WATER_RUNE.getItem(150), new Item(UNPOWERED_ORB.getId(), 5))) {
p.setAttribute("/save:diary:seers:water-orb-can-earn", true);
System.out.println("can_earn_true");
p.setAttribute("/save:diary:seers:water-orb", 1);
}
if (!meetsRequirements(entity, true, true)) {
return false;
}
p.faceLocation(obj.getLocation());
visualize(p, target);
if (!p.getPulseManager().hasPulseRunning()) {
p.getPulseManager().run(new ChargeOrbPulse(p, new Item(itemId), target, buttonId));
}
p.getInventory().add(new Item(itemId));
return true;
}
/**
* Represents the pulse for automatically charging orbs on obelisks.
*
* @author Splinter
* @version 1.0
*/
public static class ChargeOrbPulse extends SkillPulse<Item> {
/**
* The item we are going to recieve (always an orb).
*/
public Item item;
/**
* The target of the spell.
*/
public Node target;
/**
* The button (spell) that we clicked.
*/
public int buttonId;
/**
* The unpowered orb item.
*/
private static final Item UNPOWERED_ORB = new Item(567, 1);
/**
* Constructs a new {@code ChargeOrbPulse} {@code Object}.
*
* @param player the player.
* @param target the node.
* @param item the item.
* @param buttonId the clicked button
*/
public ChargeOrbPulse(Player player, Item item, Node target, int buttonId) {
super(player, item);
this.item = item;
this.target = target;
this.buttonId = buttonId;
}
@Override
public boolean checkRequirements() {
if (player.getInventory().contains(UNPOWERED_ORB.getId(), 1)) {
return true;
}
return false;
}
@Override
public void animate() {
player.animate(new Animation(791));
}
@Override
public boolean reward() {
if (getDelay() == 1) {
super.setDelay(4);
return false;
}
if (ChargeOrbSpells.castSpell(player, SpellBook.MODERN, buttonId, target)) {
if (!player.getAchievementDiaryManager().hasCompletedTask(DiaryType.SEERS_VILLAGE, 2, 9)
&& player.getAttribute("diary:seers:water-orb-can-earn", false)) {
player.setAttribute("/save:diary:seers:water-orb", 1 + player.getAttribute("diary:seers:water-orb", 0));
}
if (player.getAttribute("diary:seers:water-orb", 0) >= 5) {
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 2, 9);
player.removeAttribute("diary:seers:water-orb-can-earn");
}
return false;
} else {
return true;
}
}
@Override
public void stop() {
player.removeAttribute("diary:seers:water-orb-can-earn");
}
}
}
@@ -0,0 +1,55 @@
package content.global.skill.magic.modern;
import core.game.node.entity.combat.spell.Runes;
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.audio.Audio;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the charge spell magic spell.
* @author Emperor
* @version 1.0
*/
@Initializable
public final class ChargeSpell extends MagicSpell {
/**
* Constructs a new {@code ChargeSpell} {@code Object}.
*/
public ChargeSpell() {
super(SpellBook.MODERN, 80, 180, Animation.create(811), new Graphics(6, 96), new Audio(1651), new Item[] { Runes.FIRE_RUNE.getItem(3), Runes.BLOOD_RUNE.getItem(3), Runes.AIR_RUNE.getItem(3) });
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(58, this);
return this;
}
@Override
public boolean cast(Entity entity, Node target) {
final Player p = (Player) entity;
if (p.getLocks().isLocked("charge_cast")) {
p.getPacketDispatch().sendMessage("You need to wait for the spell to recharge.");
return false;
}
if (!meetsRequirements(entity, true, true)) {
return false;
}
p.getLocks().lock("charge_cast", 100);
visualize(entity, target);
p.registerState("godcharge").init();
p.getPacketDispatch().sendMessage("You feel charged with magic power.");
return true;
}
}
@@ -0,0 +1,55 @@
package content.global.skill.magic.modern;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Handles the crumble undead spell.
* @author Emperor
* @version 1.0
*/
@Initializable
public final class CrumbleUndead extends CombatSpell {
/**
* Constructs a new {@code CrumbleUndead} {@code Object}.
*/
public CrumbleUndead() {
super(SpellType.CRUMBLE_UNDEAD, SpellBook.MODERN, 39, 24.5, 122, 123, new Animation(724, Priority.HIGH), new Graphics(145, 96), Projectile.create((Entity) null, null, 146, 40, 36, 52, 75, 15, 11), new Graphics(147, 96), Runes.EARTH_RUNE.getItem(2), Runes.AIR_RUNE.getItem(2), Runes.CHAOS_RUNE.getItem(1));
}
@Override
public boolean cast(Entity entity, Node target) {
NPC npc = target instanceof NPC ? (NPC) target : null;
if (npc == null || npc.getTask() == null || !npc.getTask().undead) {
((Player) entity).getPacketDispatch().sendMessage("This spell only affects the undead.");
return false;
}
return super.cast(entity, target);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(22, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 0);
}
}
@@ -0,0 +1,200 @@
package content.global.skill.magic.modern;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the curse spells.
* @author Emperor
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class CurseSpells extends CombatSpell {
/**
* The start graphic for Earth strike.
*/
private static final Graphics CONFUSE_START = new Graphics(102, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile CONFUSE_PROJECTILE = Projectile.create((Entity) null, null, 103, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics CONFUSE_END = new Graphics(104, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics WEAKEN_START = new Graphics(105, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile WEAKEN_PROJECTILE = Projectile.create((Entity) null, null, 106, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics WEAKEN_END = new Graphics(107, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics CURSE_START = new Graphics(108, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile CURSE_PROJECTILE = Projectile.create((Entity) null, null, 109, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics CURSE_END = new Graphics(110, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics VULNER_START = new Graphics(167, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile VULNER_PROJECTILE = Projectile.create((Entity) null, null, 168, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics VULNER_END = new Graphics(169, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics ENFEEBLE_START = new Graphics(170, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile ENFEEBLE_PROJECTILE = Projectile.create((Entity) null, null, 171, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics ENFEEBLE_END = new Graphics(172, 96);
/**
* The start graphic for Earth strike.
*/
private static final Graphics STUN_START = new Graphics(173, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile STUN_PROJECTILE = Projectile.create((Entity) null, null, 174, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics STUN_END = new Graphics(107, 96);
/**
* The cast animation.
*/
private static final Animation LOW_ANIMATION = new Animation(716, Priority.HIGH);
/**
* The cast animation.
*/
private static final Animation HIGH_ANIMATION = new Animation(729, Priority.HIGH);
/**
* Constructs a new {@code EarthSpell} {@Code Object}
*/
public CurseSpells() {
/**
* empty.
*/
}
/**
* Constructs a new {@code CurseSpells} {@code Object}.
* @param type the type.
* @param level the level.
* @param sound the sound.
* @param start the start.
* @param projectile the projectile.
* @param end the end.
* @param runes the runes.
*/
private CurseSpells(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, -1, type.ordinal() <= SpellType.CURSE.ordinal() ? LOW_ANIMATION : HIGH_ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return 1;
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if (state.getEstimatedHit() == -1) {
return;
}
state.setEstimatedHit(-2);
switch (getType()) {
case CONFUSE:
victim.getSkills().drainLevel(Skills.ATTACK, 0.05, 0.05);
break;
case WEAKEN:
victim.getSkills().drainLevel(Skills.STRENGTH, 0.05, 0.05);
break;
case CURSE:
victim.getSkills().drainLevel(Skills.DEFENCE, 0.05, 0.05);
break;
case VULNERABILITY:
victim.getSkills().drainLevel(Skills.DEFENCE, 0.10, 0.10);
break;
case ENFEEBLE:
victim.getSkills().drainLevel(Skills.STRENGTH, 0.10, 0.10);
break;
case STUN:
victim.getSkills().drainLevel(Skills.ATTACK, 0.10, 0.10);
break;
default:
}
}
@Override
public void addExperience(Entity entity, int hit) {
entity.getSkills().addExperience(Skills.MAGIC, getExperience());
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(2, new CurseSpells(SpellType.CONFUSE, 3, 13.0, 99, CONFUSE_START, CONFUSE_PROJECTILE, CONFUSE_END, Runes.BODY_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(2), Runes.WATER_RUNE.getItem(3)));
SpellBook.MODERN.register(7, new CurseSpells(SpellType.WEAKEN, 11, 21.0, 100, WEAKEN_START, WEAKEN_PROJECTILE, WEAKEN_END, Runes.BODY_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(2), Runes.WATER_RUNE.getItem(3)));
SpellBook.MODERN.register(11, new CurseSpells(SpellType.CURSE, 19, 29.0, 101, CURSE_START, CURSE_PROJECTILE, CURSE_END, Runes.BODY_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(3), Runes.WATER_RUNE.getItem(2)));
SpellBook.MODERN.register(50, new CurseSpells(SpellType.VULNERABILITY, 66, 76.0, 119, VULNER_START, VULNER_PROJECTILE, VULNER_END, Runes.SOUL_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(5), Runes.WATER_RUNE.getItem(5)));
SpellBook.MODERN.register(53, new CurseSpells(SpellType.ENFEEBLE, 73, 83.0, 120, ENFEEBLE_START, ENFEEBLE_PROJECTILE, ENFEEBLE_END, Runes.SOUL_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(8), Runes.WATER_RUNE.getItem(8)));
SpellBook.MODERN.register(57, new CurseSpells(SpellType.STUN, 80, 90.0, 121, STUN_START, STUN_PROJECTILE, STUN_END, Runes.SOUL_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(12), Runes.WATER_RUNE.getItem(12)));
return this;
}
}
@@ -0,0 +1,127 @@
package content.global.skill.magic.modern;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the earth combat spells.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class EarthSpell extends CombatSpell {
/**
* The start graphic for Earth strike.
*/
private static final Graphics STRIKE_START = new Graphics(96, 96);
/**
* The projectile for Earth strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 97, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth strike.
*/
private static final Graphics STRIKE_END = new Graphics(98, 96);
/**
* The start graphic for Earth bolt.
*/
private static final Graphics BOLT_START = new Graphics(123, 96);
/**
* The projectile for Earth bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 124, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth bolt.
*/
private static final Graphics BOLT_END = new Graphics(125, 96);
/**
* The start graphic for Earth blast.
*/
private static final Graphics BLAST_START = new Graphics(138, 96);
/**
* The projectile for Earth blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 139, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth blast.
*/
private static final Graphics BLAST_END = new Graphics(140, 96);
/**
* The start graphic for Earth wave.
*/
private static final Graphics WAVE_START = new Graphics(164, 96);
/**
* The projectile for Earth wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 165, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Earth wave.
*/
private static final Graphics WAVE_END = new Graphics(166, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code EarthSpell} {@Code Object}
*/
public EarthSpell() {
/**
* empty.
*/
}
/**
* Constructs a new {@code EarthSpell} {@Code Object}.
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private EarthSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 3);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(6, new EarthSpell(SpellType.STRIKE, 9, 9.5, 132, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(2), Runes.AIR_RUNE.getItem(1)));
SpellBook.MODERN.register(17, new EarthSpell(SpellType.BOLT, 29, 19.5, 130, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(3), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(33, new EarthSpell(SpellType.BLAST, 53, 31.5, 128, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(4), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(52, new EarthSpell(SpellType.WAVE, 70, 40.0, 134, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(7), Runes.AIR_RUNE.getItem(5)));
return this;
}
}
@@ -0,0 +1,45 @@
package content.global.skill.magic.modern;
import core.game.component.Component;
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.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the enchant crossbow spell.
* @author 'Vexia.
* @version 1.0
*/
@Initializable
public final class EnchantCrossbowSpell extends MagicSpell {
/**
* Constructs a new {@code EnchantCrossbowSpell} {@code Object}.
*/
public EnchantCrossbowSpell() {
super(SpellBook.MODERN, 4, 0, null, null, null, null);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(3, this);
return null;
}
@Override
public boolean cast(Entity entity, Node target) {
final Player player = ((Player) entity);
player.getInterfaceManager().open(new Component(432));
int[][] data = new int[][] { { 17, 879 }, { 21, 9335 }, { 25, 880 }, { 28, 9336 }, { 31, 9337 }, { 34, 9338 }, { 37, 9339 }, { 40, 9340 }, { 43, 9341 }, { 46, 9342 } };
for (int i = 0; i < data.length; i++) {
player.getPacketDispatch().sendItemZoomOnInterface(data[i][1], 10, 270, 432, data[i][0]);
}
return true;
}
}
@@ -0,0 +1,128 @@
package content.global.skill.magic.modern;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Handles the fire spells.
* @author Emperor
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class FireSpell extends CombatSpell {
/**
* The start graphic for Fire strike.
*/
private static final Graphics STRIKE_START = new Graphics(99, 96);
/**
* The projectile for Fire strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 100, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire strike.
*/
private static final Graphics STRIKE_END = new Graphics(101, 96);
/**
* The start graphic for Fire bolt.
*/
private static final Graphics BOLT_START = new Graphics(126, 96);
/**
* The projectile for Fire bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 127, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire bolt.
*/
private static final Graphics BOLT_END = new Graphics(128, 96);
/**
* The start graphic for Fire blast.
*/
private static final Graphics BLAST_START = new Graphics(129, 96);
/**
* The projectile for Fire blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 130, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire blast.
*/
private static final Graphics BLAST_END = new Graphics(131, 96);
/**
* The start graphic for Fire wave.
*/
private static final Graphics WAVE_START = new Graphics(155, 96);
/**
* The projectile for Fire wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 156, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Fire wave.
*/
private static final Graphics WAVE_END = new Graphics(157, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code FireSpell} {@Code Object}
*/
public FireSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code FireSpell} {@code Object}.
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private FireSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 4);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(8, new FireSpell(SpellType.STRIKE, 13, 11.5, 160, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(3), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(20, new FireSpell(SpellType.BOLT, 35, 22.5, 157, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(4), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(38, new FireSpell(SpellType.BLAST, 59, 34.5, 155, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(5), Runes.AIR_RUNE.getItem(4)));
SpellBook.MODERN.register(55, new FireSpell(SpellType.WAVE, 75, 42.5, 162, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.FIRE_RUNE.getItem(7), Runes.AIR_RUNE.getItem(5)));
return this;
}
}
@@ -0,0 +1,193 @@
package content.global.skill.magic.modern;
import core.cache.def.impl.ItemDefinition;
import core.game.container.impl.EquipmentContainer;
import core.plugin.Initializable;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import org.rs09.consts.Items;
/**
* Handles the god spells.
* @author Emperor
* @author 'Vexia
*/
@Initializable
public final class GodSpells extends CombatSpell {
/**
* The spell names.
*/
private static final String[] NAMES = new String[] { "Saradomin strike", "Guthix claws", "Flames of Zamorak" };
/**
* The start graphic for Air strike.
*/
private static final Graphics SARA_START = null;
/**
* The projectile for Air strike.
*/
private static final Projectile SARA_PROJECTILE = null;
/**
* The end graphic for Air strike.
*/
private static final Graphics SARA_END = new Graphics(76, 0);
/**
* The start graphic for Air strike.
*/
private static final Graphics GUTHIX_START = null;
/**
* The projectile for Air strike.
*/
private static final Projectile GUTHIX_PROJECTILE = null;
/**
* The end graphic for Air strike.
*/
private static final Graphics GUTHIX_END = new Graphics(77, 0);
/**
* The start graphic for Air strike.
*/
private static final Graphics ZAM_START = null;
/**
* The projectile for Air strike.
*/
private static final Projectile ZAM_PROJECTILE = null;
/**
* The end graphic for Air strike.
*/
private static final Graphics ZAM_END = new Graphics(78, 0);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(811, Priority.HIGH);
/**
* Constructs a new {@code AirSpell} {@Code Object}
*/
public GodSpells() {
/*
* empty.
*/
}
/**
* Constructs a new {@code GodSpells} {@code Object}.
* @param type the type.
* @param sound the sound.
* @param start the start.
* @param projectile the projectile.
* @param end the end.
* @param runes the runes.
*/
private GodSpells(SpellType type, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, 60, 35.0, -1, -1, ANIMATION, start, projectile, end, runes);
}
@Override
public boolean meetsRequirements(Entity caster, boolean message, boolean remove) {
if (caster instanceof NPC) {
return true;
}
if (caster instanceof Player) {
int staffId = ((Player) caster).getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId();
int required = -1;
int index = 0;
switch (runes[1].getAmount()) {
case 2: // Saradomin strike
required = 2415;
break;
case 1: // Guthix claws
required = 2416;
index = 1;
break;
case 4: // Flames of Zamorak
required = 2417;
index = 2;
break;
}
Player p = (Player) caster;
if (p.getSavedData().getActivityData().getGodCasts()[index] < 100 && !p.getZoneMonitor().isInZone("mage arena")) {
p.sendMessage("You need to cast " + NAMES[index] + " " + (100 - p.getSavedData().getActivityData().getGodCasts()[index]) + " more times inside the Mage Arena.");
return false;
}
if (staffId != required && !(index == 1 && staffId == Items.VOID_KNIGHT_MACE_8841)) {
if (message) {
((Player) caster).getPacketDispatch().sendMessage("You need to wear a " + ItemDefinition.forId(required).getName() + " to cast this spell.");
}
return false;
}
}
return super.meetsRequirements(caster, message, remove);
}
@Override
public void visualize(Entity entity, Node target) {
super.visualize(entity, target);
if (entity instanceof NPC) {
NPC n = (NPC) entity;
if (n.getId() > 911 && n.getId() < 915 || (n.getId() > 906 && n.getId() < 912)) {
n.getAnimator().forceAnimation(n.getProperties().getAttackAnimation());
}
}
}
@Override
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
if (entity instanceof Player) {
int index = 0; // Saradomin strike
switch (runes[1].getAmount()) {
case 1: // Guthix claws
index = 1;
break;
case 4: // Flames of Zamorak
index = 2;
break;
}
Player p = (Player) entity;
if (p.getSavedData().getActivityData().getGodCasts()[index] < 100) {
p.getSavedData().getActivityData().getGodCasts()[index]++;
if (p.getSavedData().getActivityData().getGodCasts()[index] >= 100) {
p.sendMessage("You can now cast " + NAMES[index] + " outside the Arena.");
}
}
}
super.visualizeImpact(entity, target, state);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 0);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(41, new GodSpells(SpellType.GOD_STRIKE, -1, SARA_START, SARA_PROJECTILE, SARA_END, Runes.BLOOD_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(2), Runes.AIR_RUNE.getItem(4)));
SpellBook.MODERN.register(42, new GodSpells(SpellType.GOD_STRIKE, -1, GUTHIX_START, GUTHIX_PROJECTILE, GUTHIX_END, Runes.BLOOD_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(1), Runes.AIR_RUNE.getItem(4)));
SpellBook.MODERN.register(43, new GodSpells(SpellType.GOD_STRIKE, -1, ZAM_START, ZAM_PROJECTILE, ZAM_END, Runes.BLOOD_RUNE.getItem(2), Runes.FIRE_RUNE.getItem(4), Runes.AIR_RUNE.getItem(1)));
return this;
}
}
@@ -0,0 +1,46 @@
package content.global.skill.magic.modern
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.audio.Audio
import core.game.system.task.Pulse
import org.json.simple.JSONObject
import core.game.node.entity.state.PlayerState
import core.game.node.entity.state.State
import core.game.world.GameWorld;
@PlayerState("godcharge")
class GodspellChargedState(player: Player? = null) : State(player) {
val DURATION = 700
var startTick: Int = 0
override fun save(root: JSONObject) {
root.put("ticks_elapsed", GameWorld.ticks - startTick)
}
override fun parse(_data: JSONObject) {
if(_data.containsKey("ticks_elapsed")){
startTick = GameWorld.ticks - _data["ticks_elapsed"].toString().toInt()
}
}
override fun newInstance(player: Player?): State {
var ret = GodspellChargedState(player)
ret.startTick = GameWorld.ticks
return ret
}
override fun createPulse() {
player ?: return
if(GameWorld.ticks - startTick >= DURATION) return
pulse = object : Pulse(DURATION) {
override fun pulse(): Boolean {
player.sendMessage("Your magical charge fades away.")
player.clearState("godcharge")
player.audioManager.send(Audio(1650))
pulse = null
return true
}
}
}
}
@@ -0,0 +1,54 @@
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;
}
}
@@ -0,0 +1,53 @@
package content.global.skill.magic.modern;
import core.game.container.impl.EquipmentContainer;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the iban blast spell.
* @author Emperor
* @version 1.0
*/
@Initializable
public final class IbanBlast extends CombatSpell {
/**
* Constructs a new {@code IbanBlast} {@code Object}.
*/
public IbanBlast() {
super(SpellType.IBANS_BLAST, SpellBook.MODERN, 50, 60.5, -1, -1, new Animation(708, Priority.HIGH), new Graphics(87, 96), Projectile.create((Entity) null, null, 88, 40, 36, 52, 75, 15, 11), new Graphics(89, 96), Runes.FIRE_RUNE.getItem(5), Runes.DEATH_RUNE.getItem(1));
}
@Override
public boolean cast(Entity entity, Node target) {
if (((Player) entity).getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId() != 1409) {
((Player) entity).getPacketDispatch().sendMessage("You need to wear Iban's staff to cast this spell.");
return false;
}
return super.cast(entity, target);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(29, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 0);
}
}
@@ -0,0 +1,57 @@
package content.global.skill.magic.modern;
import core.game.container.impl.EquipmentContainer;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Handles the magic dart spell.
* @author Emperor
*/
@Initializable
public class MagicDart extends CombatSpell {
/**
* Constructs a new {@code MagicDart} {@code Object}.
*/
public MagicDart() {
super(SpellType.MAGIC_DART, SpellBook.MODERN, 50, 30.0, 218, 219, new Animation(1576, Priority.HIGH), null, Projectile.create((Entity) null, null, 330, 40, 36, 52, 75, 15, 11), new Graphics(331, 96), Runes.DEATH_RUNE.getItem(1), Runes.MIND_RUNE.getItem(4));
}
@Override
public boolean cast(Entity entity, Node target) {
if (entity.getSkills().getLevel(Skills.SLAYER) < 55) {
((Player) entity).getPacketDispatch().sendMessage("You need a Slayer level of 55 to cast this spell.");
return false;
}
if (((Player) entity).getEquipment().getNew(EquipmentContainer.SLOT_WEAPON).getId() != 4170) {
((Player) entity).getPacketDispatch().sendMessage("You need to wear a Slayer's staff to cast this spell.");
return false;
}
return super.cast(entity, target);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(31, this);
return this;
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return type.getImpactAmount(entity, victim, 0);
}
}
@@ -0,0 +1,302 @@
package content.global.skill.magic.modern
import content.global.skill.magic.SpellListener
import content.global.skill.magic.TeleportMethod
import content.global.skill.magic.spellconsts.Modern
import core.game.event.ItemAlchemizationEvent
import core.game.event.TeleportEvent
import core.api.getAttribute
import core.api.sendMessage
import content.global.skill.prayer.Bones
import core.game.interaction.MovementPulse
import core.game.node.entity.Entity
import core.game.node.entity.impl.Projectile
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.TeleportManager
import core.game.node.entity.player.link.audio.Audio
import core.game.node.entity.player.link.diary.DiaryType
import core.game.node.entity.skill.Skills
import content.global.skill.smithing.smelting.Bar
import content.global.skill.smithing.smelting.SmeltingPulse
import core.game.node.item.Item
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics
import org.rs09.consts.Items
import core.ServerConstants
import core.api.EquipmentSlot
import core.api.getItemFromEquipment
import core.game.node.entity.combat.spell.MagicStaff
import core.game.node.entity.impl.Animator
class ModernListeners : SpellListener("modern"){
private val CONFUSE_START = Graphics(102, 96)
private val CONFUSE_PROJECTILE = Projectile.create(null as Entity?, null, 103, 40, 36, 52, 75, 15, 11)
private val CONFUSE_END = Graphics(104, 96)
private val WEAKEN_START = Graphics(105, 96)
private val WEAKEN_PROJECTILE = Projectile.create(null as Entity?, null, 106, 40, 36, 52, 75, 15, 11)
private val WEAKEN_END = Graphics(107, 96)
private val CURSE_START = Graphics(108, 96)
private val CURSE_PROJECTILE = Projectile.create(null as Entity?, null, 109, 40, 36, 52, 75, 15, 11)
private val CURSE_END = Graphics(110, 96)
private val VULNER_START = Graphics(167, 96)
private val VULNER_PROJECTILE = Projectile.create(null as Entity?, null, 168, 40, 36, 52, 75, 15, 11)
private val VULNER_END = Graphics(169, 96)
private val ENFEEBLE_START = Graphics(170, 96)
private val ENFEEBLE_PROJECTILE = Projectile.create(null as Entity?, null, 171, 40, 36, 52, 75, 15, 11)
private val ENFEEBLE_END = Graphics(172, 96)
private val STUN_START = Graphics(173, 96)
private val STUN_PROJECTILE = Projectile.create(null as Entity?, null, 174, 40, 36, 52, 75, 15, 11)
private val STUN_END = Graphics(107, 96)
private val LOW_ANIMATION = Animation(716, Animator.Priority.HIGH)
private val HIGH_ANIMATION = Animation(729, Animator.Priority.HIGH)
private val LOW_ALCH_ANIM = Animation(712)
private val LOW_ALCH_GFX = Graphics(112,5)
private val HIGH_ALCH_ANIM = Animation(713)
private val HIGH_ALCH_GFX = Graphics(113,5)
private val BONE_CONVERT_GFX = Graphics(141, 96)
private val BONE_CONVERT_ANIM = Animation(722)
override fun defineListeners() {
onCast(Modern.HOME_TELEPORT, NONE){ player, _ ->
if (!getAttribute(player, "tutorial:complete", false)) {
return@onCast
}
requires(player)
player.teleporter.send(ServerConstants.HOME_LOCATION,TeleportManager.TeleportType.HOME)
setDelay(player,true)
}
onCast(Modern.VARROCK_TELEPORT, NONE){ player, _->
requires(player,25, arrayOf(Item(Items.FIRE_RUNE_554),Item(Items.AIR_RUNE_556,3),Item(Items.LAW_RUNE_563)))
val alternateTeleport = getAttribute(player, "diaries:varrock:alttele", false)
val dest = if(alternateTeleport) Location.create(3165, 3472, 0) else Location.create(3213, 3424, 0)
sendTeleport(player,35.0, dest)
}
onCast(Modern.LUMBRIDGE_TELEPORT, NONE){ player, _ ->
requires(player,31, arrayOf(Item(Items.EARTH_RUNE_557),Item(Items.AIR_RUNE_556,3),Item(Items.LAW_RUNE_563)))
sendTeleport(player,41.0,Location.create(3221, 3219, 0))
}
onCast(Modern.FALADOR_TELEPORT, NONE){ player, _ ->
requires(player,37, arrayOf(Item(Items.WATER_RUNE_555),Item(Items.AIR_RUNE_556,3),Item(Items.LAW_RUNE_563)))
sendTeleport(player,47.0,Location.create(2965, 3378, 0))
}
onCast(Modern.CAMELOT_TELEPORT, NONE){ player, _->
requires(player,45, arrayOf(Item(Items.AIR_RUNE_556,5),Item(Items.LAW_RUNE_563)))
player.achievementDiaryManager.finishTask(player, DiaryType.SEERS_VILLAGE, 1, 5);
sendTeleport(player,55.5, Location.create(2758, 3478, 0))
}
onCast(Modern.ARDOUGNE_TELEPORT, NONE){ player, _ ->
requires(player,51, arrayOf(Item(Items.WATER_RUNE_555,2),Item(Items.LAW_RUNE_563,2)))
sendTeleport(player,61.0, Location.create(2662, 3307, 0))
}
onCast(Modern.WATCHTOWER_TELEPORT, NONE){ player, _ ->
requires(player,58, arrayOf(Item(Items.EARTH_RUNE_557,2),Item(Items.LAW_RUNE_563,2)))
sendTeleport(player,68.0, Location.create(2549, 3112, 0))
}
onCast(Modern.TROLLHEIM_TELEPORT, NONE){ player, _ ->
requires(player,61, arrayOf(Item(Items.FIRE_RUNE_554,2),Item(Items.LAW_RUNE_563,2)))
sendTeleport(player,68.0, Location.create(2891, 3678, 0))
}
onCast(Modern.APE_ATOLL_TELEPORT, NONE){ player, _ ->
requires(player,64, arrayOf(Item(Items.FIRE_RUNE_554,2),Item(Items.WATER_RUNE_555,2),Item(Items.LAW_RUNE_563,2),Item(Items.BANANA_1963)))
sendTeleport(player,74.0, Location.create(2754, 2784, 0))
}
onCast(Modern.TELEPORT_TO_HOUSE, NONE){ player, _ ->
requires(player,40, arrayOf(Item(Items.LAW_RUNE_563), Item(Items.AIR_RUNE_556), Item(Items.EARTH_RUNE_557)))
attemptHouseTeleport(player)
}
onCast(Modern.LOW_ALCHEMY, ITEM){ player, node ->
val item = node?.asItem() ?: return@onCast
requires(player,21, arrayOf(Item(Items.FIRE_RUNE_554,3),Item(Items.NATURE_RUNE_561)))
alchemize(player,item,high = false)
}
onCast(Modern.HIGH_ALCHEMY, ITEM){ player, node ->
val item = node?.asItem() ?: return@onCast
requires(player,55, arrayOf(Item(Items.FIRE_RUNE_554,5),Item(Items.NATURE_RUNE_561,1)))
alchemize(player,item,high = true)
}
onCast(Modern.SUPERHEAT, ITEM){ player, node ->
val item = node?.asItem() ?: return@onCast
requires(player,43, arrayOf(Item(Items.FIRE_RUNE_554,4),Item(Items.NATURE_RUNE_561,1)))
superheat(player,item)
}
onCast(Modern.BONES_TO_BANANAS, NONE){ player, _ ->
requires(player,15, arrayOf(Item(Items.EARTH_RUNE_557,2), Item(Items.WATER_RUNE_555,2), Item(Items.NATURE_RUNE_561,1)))
boneConvert(player,true)
}
onCast(Modern.BONES_TO_PEACHES, NONE){ player, _ ->
requires(player,60, arrayOf(Item(Items.EARTH_RUNE_557,4), Item(Items.WATER_RUNE_555,4), Item(Items.NATURE_RUNE_561,2)))
boneConvert(player,false)
}
}
private fun boneConvert(player: Player,bananas: Boolean){
val isInMTA = player.zoneMonitor.isInZone("Creature Graveyard")
if(isInMTA && player.getAttribute("tablet-spell",false)){
player.sendMessage("You can not use this tablet in the Mage Training Arena.")
return
}
if(!bananas && !player.savedData.activityData.isBonesToPeaches && !player.getAttribute("tablet-spell",false)){
player.sendMessage("You can only learn this spell from the Mage Training Arena.")
return
}
val bones = if(isInMTA) intArrayOf(6904,6905,6906,6907) else Bones.values().map { it.itemId }.toIntArray()
for(item in player.inventory.toArray()){
item ?: continue
if(isInMTA){
if(bones.contains(item.id)){
val inInventory = player.inventory.getAmount(item.id)
val amount = inInventory * (content.minigame.mta.impl.GraveyardZone.BoneType.forItem(Item(item.id)).ordinal + 1)
if(amount > 0){
player.inventory.remove(Item(item.id,inInventory))
player.inventory.add(Item(if(bananas) Items.BANANA_1963 else Items.PEACH_6883,amount))
}
}
} else {
if(bones.contains(item.id)){
val inInventory = player.inventory.getAmount(item.id)
player.inventory.remove(Item(item.id,inInventory))
player.inventory.add(Item(if(bananas) Items.BANANA_1963 else Items.PEACH_6883,inInventory))
}
}
}
visualizeSpell(player,BONE_CONVERT_ANIM, BONE_CONVERT_GFX)
player.audioManager.send(Audio(114))
removeRunes(player)
addXP(player,if(bananas) 25.0 else 65.0)
setDelay(player,false)
}
private fun superheat(player: Player,item: Item){
if(!item.name.contains("ore") && !item.name.toLowerCase().equals("coal")){
player.sendMessage("You can only cast this spell on ore.")
return
}
// Elemental Workshop I special interaction
if(item.id == Items.ELEMENTAL_ORE_2892) {
sendMessage(player, "Even this spell is not hot enough to heat this item.")
return
}
var bar = Bar.forOre(item.id) ?: return
if(bar == Bar.IRON && player.inventory.getAmount(Items.COAL_453) >= 2 && player.skills.getLevel(Skills.SMITHING) >= Bar.STEEL.level && player.inventory.contains(Items.IRON_ORE_441,1)) bar = Bar.STEEL
if(player.skills.getLevel(Skills.SMITHING) < bar.level){
player.sendMessage("You need a smithing level of ${bar.level} to superheat that ore.")
return
}
for (items in bar.ores) {
if (!player.inventory.contains(items.id, items.amount)) {
player.packetDispatch.sendMessage("You do not have the required ores to make this bar.")
return
}
}
player.lock(3)
removeRunes(player)
addXP(player,53.0)
player.audioManager.send(117)
showMagicTab(player)
player.pulseManager.run(SmeltingPulse(player, item, bar, 1, true))
setDelay(player,false)
}
private fun alchemize(player: Player,item: Item,high:Boolean){
if(item.name == "Coins") player.sendMessage("You can't alchemize something that's already gold!").also { return }
if(!item.definition.isTradeable) player.sendMessage("You can't cast this spell on something like that.").also { return }
if(player.zoneMonitor.isInZone("Alchemists' Playground")){
player.sendMessage("You can only alch items from the cupboards!")
return
}
val coins = Item(995, item.definition.getAlchemyValue(high))
if (coins.amount > 0 && !player.inventory.hasSpaceFor(coins)) {
player.sendMessage("Not enough space in your inventory!")
return
}
if (player.pulseManager.current !is MovementPulse) {
player.pulseManager.clear()
}
val weapon = player.equipment.getItem(getItemFromEquipment(player, EquipmentSlot.WEAPON))
if (weapon != null && !weapon.equals(MagicStaff.FIRE_RUNE)) {
player.animate(Animation(if (high) 9633 else 9625))
player.graphics(Graphics(if (high) 1693 else 1692))
} else {
player.animate(Animation(if (high) 713 else 712))
player.graphics(Graphics(if (high) 113 else 112))
}
if (coins.amount > 0)
player.inventory.add(coins)
player.dispatch(ItemAlchemizationEvent(item.id, high))
player.inventory.remove(Item(item.id, 1))
removeRunes(player)
addXP(player, if (high) 65.0 else 31.0)
showMagicTab(player)
setDelay(player, 5)
}
private fun sendTeleport(player: Player, xp: Double, location: Location){
if(player.locks.isTeleportLocked){
player.removeAttribute("spell:runes")
player.sendMessage("A magical force prevents you from teleporting.")
return
}
val teleType = TeleportManager.TeleportType.NORMAL
if (player.teleporter.send(location, teleType)) {
player.dispatch(TeleportEvent(teleType, TeleportMethod.SPELL, -1, location))
removeRunes(player)
addXP(player, xp)
setDelay(player, true)
}
}
private fun attemptHouseTeleport(player: Player){
if(player.locks.isTeleportLocked){
player.removeAttribute("spell:runes")
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.")
return
}
val teleType = TeleportManager.TeleportType.NORMAL
player.teleporter.send(loc, teleType)
removeRunes(player)
addXP(player,30.0)
setDelay(player,true)
}
}
@@ -0,0 +1,61 @@
package content.global.skill.magic.modern;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the sonic wave spell of an evil chicken.
* @author 'Vexia
* @date 24/11/2013
*/
@Initializable
public final class SonicWaveSpell extends CombatSpell {
/**
* The projectile for Earth strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 337, 8, 8, 52, 100, 15, 1);
/**
* Constructs a new {@code EarthSpell} {@Code Object}
*/
public SonicWaveSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code EarthSpell} {@Code Object}.
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private SonicWaveSpell(SpellType type, int level, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, 0.0, sound, sound + 1, null, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 5);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(63232, new SonicWaveSpell(SpellType.STRIKE, 1, -1, new Graphics(337), STRIKE_PROJECTILE, null));
return this;
}
}
@@ -0,0 +1,125 @@
package content.global.skill.magic.modern;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.entity.player.link.prayer.PrayerType;
import core.game.node.entity.state.EntityState;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Handles the teleportation block spell in the modern spellbook.
* @author Splinter
*
*/
@Initializable
public final class TeleblockSpell extends CombatSpell {
/**
* The projectile for the teleblock spell.
*/
private static final Projectile TELEBLOCK_ORB = Projectile.create((Entity) null, null, 1842, 40, 36, 52, 75, 15, 11);
/**
* The ending graphic for the teleblock spell.
*/
private static final Graphics TELEBLOCK_SUCCESS = new Graphics(1843, 0);
/**
* The starting graphic for the teleblock spell.
*/
private static final Graphics TELEBLOCK_START = new Graphics(1841, 0);
/**
* Constructs a new {@code TeleblockSpell} {@code Object}.
*/
public TeleblockSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code TeleblockSpell} {@code Object}.
* @param level - the level needed to cast this spell
* @param baseExperience - the base amount of experience we need to give
* @param impactSound -the sound played on successful impact
* @param anim - the animation to play
* @param start - the starting graphic
* @param projectile - the projectile to send
* @param end - the ending graphic
*/
public TeleblockSpell(SpellType type, int level, double baseExperience, int impactSound, Animation anim, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, 202, 203, anim, TELEBLOCK_START, TELEBLOCK_ORB, TELEBLOCK_SUCCESS, runes);
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(63, new TeleblockSpell(SpellType.TELEBLOCK, 85, 80, 203, new Animation(10503, Priority.HIGH), TELEBLOCK_START, TELEBLOCK_ORB, TELEBLOCK_SUCCESS, Runes.LAW_RUNE.getItem(1), Runes.DEATH_RUNE.getItem(1), Runes.CHAOS_RUNE.getItem(1)));
return this;
}
@Override
public void visualize(Entity entity, Node target) {
entity.graphics(graphic);
if (projectile != null) {
projectile.transform(entity, (Entity) target, false, 58, 10).send();
}
entity.animate(animation);
sendAudio(entity, audio);
}
@Override
public boolean cast(Entity entity, Node target) {
if (!(target instanceof Player)) {
entity.asPlayer().sendMessage("You can only cast this spell on another player.");
return false;
}
if (!entity.getZoneMonitor().isInZone("Wilderness") || !((Player) target).getZoneMonitor().isInZone("Wilderness")) {
entity.asPlayer().sendMessage("You and your opponent must both be in the wilderness for you to use this spell.");
return false;
}
if (((Player) target).isTeleBlocked()) {
entity.asPlayer().sendMessage("That player is already affected by this spell.");
return false;
}
if (!meetsRequirements(entity, true, false)) {
return false;
}
return super.cast(entity, target);
}
@Override
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
super.visualizeImpact(entity, target, state);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return 0;
}
@Override
public void fireEffect(Entity entity, Entity victim, BattleState state) {
if(!victim.isTeleBlocked() && victim instanceof Player && state.getStyle().getSwingHandler().isAccurateImpact(entity, victim) && state.getEstimatedHit() > 0){
int ticks = 500;
if(((Player) victim).getPrayer().get(PrayerType.PROTECT_FROM_MAGIC)){
ticks /= 2;
}
victim.getStateManager().set(EntityState.TELEBLOCK, ticks);
} else if(victim.isTeleBlocked()){
entity.asPlayer().sendMessage("Your target is already blocked from teleporting.");
}
}
}
@@ -0,0 +1,102 @@
package content.global.skill.magic.modern;
import core.game.node.entity.combat.spell.Runes;
import core.game.component.Component;
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.audio.Audio;
import core.game.node.item.Item;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Handles the teleport other spells.
* @author Emperor
*/
@Initializable
public final class TeleotherSpells extends MagicSpell {
/**
* The destination.
*/
private String destination;
/**
* The destination location.
*/
private Location location;
/**
* Constructs a new {@code TeleotherSpells} {@code Object}.
*/
public TeleotherSpells() {
/*
* empty.
*/
}
/**
* Constructs a new {@code TeleotherSpells} {@code Object}.
* @param level The level required.
* @param destination The destination name.
* @param location The location to teleport to.
* @param runes The runes required.
*/
public TeleotherSpells(int level, double experience, String destination, Location location, Item... runes) {
super(SpellBook.MODERN, level, experience, Animation.create(1818), Graphics.create(343), new Audio(199, 0, 0), runes);
this.destination = destination;
this.location = location;
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(54, new TeleotherSpells(74, 84, "Lumbridge", Location.create(3222, 3217, 0), Runes.SOUL_RUNE.getItem(1), Runes.LAW_RUNE.getItem(1), Runes.EARTH_RUNE.getItem(1)));
SpellBook.MODERN.register(59, new TeleotherSpells(82, 92, "Falador", Location.create(2965, 3378, 0), Runes.SOUL_RUNE.getItem(1), Runes.LAW_RUNE.getItem(1), Runes.WATER_RUNE.getItem(1)));
SpellBook.MODERN.register(62, new TeleotherSpells(90, 100, "Camelot", Location.create(2758, 3478, 0), Runes.SOUL_RUNE.getItem(2), Runes.LAW_RUNE.getItem(1)));
return this;
}
@Override
public boolean cast(Entity entity, Node target) {
Player p = (Player) entity;
if (!(target instanceof Player)) {
p.getPacketDispatch().sendMessage("You can only cast this spell on other players.");
return false;
}
if (!entity.getZoneMonitor().teleport(0, null)) {
return false;
}
Player o = (Player) target;
if (!o.isActive() || o.getLocks().isTeleportLocked() || o.getInterfaceManager().isOpened()) {
p.getPacketDispatch().sendMessage("The other player is currently busy.");
return false;
}
if(o.getZoneMonitor().isInZone("Wilderness") && o.getProperties().getCombatPulse().isInCombat()){
p.sendMessage("The other player has their hands full at the moment!");
return true;
}
if (!o.getSettings().isAcceptAid()) {
p.getPacketDispatch().sendMessage("The player is not accepting any aid.");
return false;
}
if (!meetsRequirements(entity, true, true)) {
return false;
}
visualize(entity, target);
Graphics.send(new Graphics(342), o.getLocation());
p.faceLocation(o.getLocation());
o.setAttribute("t-o_location", location);
o.getPacketDispatch().sendString(p.getUsername(), 326,1);
o.getPacketDispatch().sendString(destination, 326, 3);
o.getInterfaceManager().open(new Component(326));
return true;
}
}
@@ -0,0 +1,127 @@
package content.global.skill.magic.modern;
import core.plugin.Initializable;
import core.game.node.entity.combat.spell.Runes;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.BattleState;
import core.game.node.entity.combat.spell.CombatSpell;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.impl.Animator.Priority;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
/**
* Represents the water spells.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class WaterSpell extends CombatSpell {
/**
* The start graphic for Water strike.
*/
private static final Graphics STRIKE_START = new Graphics(93, 96);
/**
* The projectile for Water strike.
*/
private static final Projectile STRIKE_PROJECTILE = Projectile.create((Entity) null, null, 94, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Water strike.
*/
private static final Graphics STRIKE_END = new Graphics(95, 96);
/**
* The start graphic for Water bolt.
*/
private static final Graphics BOLT_START = new Graphics(120, 96);
/**
* The projectile for Water bolt.
*/
private static final Projectile BOLT_PROJECTILE = Projectile.create((Entity) null, null, 121, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Water bolt.
*/
private static final Graphics BOLT_END = new Graphics(122, 96);
/**
* The start graphic for Water blast.
*/
private static final Graphics BLAST_START = new Graphics(135, 96); // 129
/**
* The projectile for Water blast.
*/
private static final Projectile BLAST_PROJECTILE = Projectile.create((Entity) null, null, 136, 40, 36, 52, 75, 15, 11); // 130
/**
* The end graphic for Water blast.
*/
private static final Graphics BLAST_END = new Graphics(137, 96); // 131
/**
* The start graphic for Water wave.
*/
private static final Graphics WAVE_START = new Graphics(161, 96);
/**
* The projectile for Water wave.
*/
private static final Projectile WAVE_PROJECTILE = Projectile.create((Entity) null, null, 162, 40, 36, 52, 75, 15, 11);
/**
* The end graphic for Water wave.
*/
private static final Graphics WAVE_END = new Graphics(163, 96);
/**
* The cast animation.
*/
private static final Animation ANIMATION = new Animation(711, Priority.HIGH);
/**
* Constructs a new {@code WaterSpell} {@Code Object}
*/
public WaterSpell() {
/*
* empty.
*/
}
/**
* Constructs a new {@code WaterSpell} {@Code Object}
* @param type The spell type.
* @param level The level requirement.
* @param sound The cast sound.
* @param start The start graphics.
* @param projectile The projectile.
* @param end The end graphics.
* @param runes The rune requirements.
*/
private WaterSpell(SpellType type, int level, double baseExperience, int sound, Graphics start, Projectile projectile, Graphics end, Item... runes) {
super(type, SpellBook.MODERN, level, baseExperience, sound, sound + 1, ANIMATION, start, projectile, end, runes);
}
@Override
public int getMaximumImpact(Entity entity, Entity victim, BattleState state) {
return getType().getImpactAmount(entity, victim, 2);
}
@Override
public Plugin<SpellType> newInstance(SpellType type) throws Throwable {
SpellBook.MODERN.register(4, new WaterSpell(SpellType.STRIKE, 5, 7.5, 211, STRIKE_START, STRIKE_PROJECTILE, STRIKE_END, Runes.MIND_RUNE.getItem(1), Runes.WATER_RUNE.getItem(1), Runes.AIR_RUNE.getItem(1)));
SpellBook.MODERN.register(14, new WaterSpell(SpellType.BOLT, 23, 16.5, 209, BOLT_START, BOLT_PROJECTILE, BOLT_END, Runes.CHAOS_RUNE.getItem(1), Runes.WATER_RUNE.getItem(2), Runes.AIR_RUNE.getItem(2)));
SpellBook.MODERN.register(27, new WaterSpell(SpellType.BLAST, 47, 28.5, 207, BLAST_START, BLAST_PROJECTILE, BLAST_END, Runes.DEATH_RUNE.getItem(1), Runes.WATER_RUNE.getItem(3), Runes.AIR_RUNE.getItem(3)));
SpellBook.MODERN.register(48, new WaterSpell(SpellType.WAVE, 65, 37.5, 213, WAVE_START, WAVE_PROJECTILE, WAVE_END, Runes.BLOOD_RUNE.getItem(1), Runes.WATER_RUNE.getItem(7), Runes.AIR_RUNE.getItem(5)));
return this;
}
}