This commit is contained in:
Ceikry
2021-03-24 18:25:37 -05:00
parent 302f8b22a4
commit 5aca465653
9 changed files with 99 additions and 142 deletions
@@ -1,129 +0,0 @@
package core.game.content.activity.mta;
import core.game.node.entity.skill.magic.MagicSpell;
import core.game.node.entity.skill.magic.Runes;
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.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.GraveyardZone;
/**
* Represents the bones to banana spell.
* @author Emperor
* @author 'Vexia
* @version 1.0
*/
public final class BonesConvertingSpells extends MagicSpell {
/**
* The bone ids.
*/
private static final int[] BONES = new int[] { 526, 532, 6904, 6905, 6906, 6907 };
/**
* The graphic.
*/
private static final Graphics GRAPHIC = new Graphics(141, 96);
/**
* The animation.
*/
private static final Animation ANIMATION = new Animation(722);
/**
* The item to replace the bones with.
*/
private Item converted;
/**
* Constructs a new {@code BonesConvertingSpells} {@code Object}.
*/
public BonesConvertingSpells() {
/**
* empty.
*/
}
/**
* Constructs a new {@code BonesConvertingSpells} {@code Object}.
* @param level The level required.
* @param converted The item to replace the bones with.
* @param anim The animation.
* @param graphic The graphic.
* @param runes The runes.
*/
public BonesConvertingSpells(int level, final double experience, Item converted, Animation anim, Graphics graphic, Item... runes) {
super(SpellBook.MODERN, level, experience, anim, graphic, null, runes);
this.converted = converted;
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.MODERN.register(9, new BonesConvertingSpells(15, 25, new Item(1963), ANIMATION, GRAPHIC, Runes.EARTH_RUNE.getItem(2), Runes.WATER_RUNE.getItem(2), Runes.NATURE_RUNE.getItem(1)));
SpellBook.MODERN.register(40, new BonesConvertingSpells(60, 65, new Item(6883), ANIMATION, GRAPHIC, Runes.EARTH_RUNE.getItem(4), Runes.WATER_RUNE.getItem(4), Runes.NATURE_RUNE.getItem(2)));
return this;
}
@Override
public boolean meetsRequirements(Entity caster, boolean message, boolean remove) {
if (getSpellId() == 40 && !caster.asPlayer().getSavedData().getActivityData().isBonesToPeaches()) {
caster.asPlayer().sendMessage("You can only learn this spell from the Mage Training Arena.");
return false;
}
if (!hasBones(caster.asPlayer())) {
if (message) {
((Player) caster).getPacketDispatch().sendMessage("You aren't holding any bones!");
}
return false;
}
return super.meetsRequirements(caster, message, remove);
}
@Override
public boolean cast(Entity entity, Node target) {
Player p = (Player) entity;
boolean inGrave = p.getZoneMonitor().isInZone("Creature Graveyard");
if (p.getAttribute("cbs_tab", false) && inGrave && target.getId() >= 6904 && target.getId() <= 6907) {
p.sendMessage("This tablet cannot be used on bones from the Mage Training Arena.");
return false;
}
if (!p.getAttribute("cbs_tab", false) && !meetsRequirements(entity, true, true)) {
return false;
}
p.removeAttribute("cbs_tab");
for (int id : BONES) {
if (p.getInventory().contains(id, 1)) {
int amount = p.getInventory().getAmount(id);
if (inGrave) {
amount *= (GraveyardZone.BoneType.forItem(new Item(id)).ordinal() + 1);
}
p.getInventory().remove(new Item(id, amount));
p.getInventory().add(new Item(converted.getId(), amount));
}
}
visualize(entity, target);
return true;
}
/**
* Checks if the player has bones.
* @param player the player.
* @return {@code True} if so.
*/
private boolean hasBones(Player player) {
for (int id : BONES) {
if (player.getInventory().contains(id, 1)) {
return true;
}
}
return false;
}
}
@@ -52,7 +52,7 @@ public class MageTrainingArenaPlugin extends OptionHandler {
ItemDefinition.forId(TelekineticZone.STATUE).getHandlers().put("option:observe", this);
ItemDefinition.forId(TelekineticZone.STATUE).getHandlers().put("option:reset", this);
NPCDefinition.forId(3102).getHandlers().put("option:talk-to", this);
PluginManager.definePlugins(new CharmedWarriorDialogue(), new EntranceGuardianDialogue(), new RewardsGuardianDialogue(), new ProgressHatDialogue(), new EnchantmentGuardianDialogue(), new EnchantSpell(), new BonesConvertingSpells(), new GraveyardGuardianDialogue(), new AlchemyGuardianDialogue(), new TelekineticGrabSpell(), new TelekineticGuardianDialogue(), new MazeGuardianDialogue());
PluginManager.definePlugins(new CharmedWarriorDialogue(), new EntranceGuardianDialogue(), new RewardsGuardianDialogue(), new ProgressHatDialogue(), new EnchantmentGuardianDialogue(), new EnchantSpell(), new GraveyardGuardianDialogue(), new AlchemyGuardianDialogue(), new TelekineticGrabSpell(), new TelekineticGuardianDialogue(), new MazeGuardianDialogue());
return this;
}
@@ -141,6 +141,7 @@ public final class TzhaarFightCavesPlugin extends ActivityPlugin {
public void leave(Player player, int wave) {
activeNPCs.clear();
player.getProperties().setTeleportLocation(getSpawnLocation());
player.getSkills().restore();
if (wave == 63) {
if (!player.getInventory().add(new Item(6570))) {
GroundItemManager.create(new Item(6570), getSpawnLocation(), player);
@@ -3,13 +3,12 @@ package core.game.interaction.inter;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.skill.crafting.GlassProduct;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.RunScript;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.skill.crafting.GlassProduct;
import core.game.node.item.Item;
import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
@@ -100,7 +99,8 @@ public final class GlassInterface extends ComponentPlugin {
public static void make(final Player player, final GlassProduct glass, final int amount) {
player.getInterfaceManager().close();
player.animate(ANIMATION);
GameWorld.getPulser().submit(new Pulse(2, player) {
player.getPulseManager().clear();
player.getPulseManager().run(new Pulse(2, player) {
int amt = amount;
@Override
@@ -11,7 +11,6 @@ import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.system.task.Pulse;
import core.game.world.map.Location;
import core.game.world.map.MapDistance;
import core.game.world.map.RegionManager;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
@@ -50,7 +49,7 @@ public final class ChainhitSpecialHandler extends RangeSwingHandler implements P
/**
* The door support locations.
*/
private static final Location[] DOOR_SUPPORTS = new Location[] { Location.create(2545, 10145, 0), Location.create(2545, 10141, 0) };
private static final Location[] DOOR_SUPPORTS = new Location[] { Location.create(2545, 10145, 0), Location.create(2545, 10141, 0),Location.create(2543, 10143, 0) };
@Override
public Object fireEvent(String identifier, Object... args) {
@@ -75,7 +74,7 @@ public final class ChainhitSpecialHandler extends RangeSwingHandler implements P
}
if (victim instanceof NPC) {
NPC npc = victim.asNpc();
if (npc.getId() == 2443) {
if (npc.getId() == 2440) {
for (Location l : DOOR_SUPPORTS) {
final NPC n = Repository.findNPC(l);
if (n == null) {
@@ -176,7 +175,7 @@ public final class ChainhitSpecialHandler extends RangeSwingHandler implements P
private List<? extends Entity> getVictimsList(Entity e, Entity victim) {
List<? extends Entity> list = e.getAttribute("chain-hit_v");
if (list == null) {
int distance = MapDistance.RENDERING.getDistance() / 3;
int distance = 5;
if (victim instanceof NPC) {
e.setAttribute("chain-hit_v", list = RegionManager.getLocalNpcs(e, distance));
} else {
@@ -106,6 +106,9 @@ public class TeleportManager {
p.getDialogueInterpreter().close();
}
}
if(entity.getAttribute("tablet-spell",false)){
type = TeleportType.TELETABS;
}
this.teleportType = teleportType;
entity.getWalkingQueue().reset();
lastTeleport = currentTeleport;