Lunar spellbook work + easter event

This commit is contained in:
Ceikry
2021-03-31 21:20:42 -05:00
parent 3b8a9b15ad
commit df06d42c7e
30 changed files with 748 additions and 716 deletions
@@ -42,7 +42,7 @@ public final class GnomeStrongholdPlugin extends OptionHandler {
case 9317:
final boolean scale = player.getLocation().getY() <= object.getLocation().getY();
final Location end = object.getLocation().transform(scale ? 3 : -3, scale ? 6 : -6, 0);
if (player.getSkills().hasLevel(Skills.AGILITY, 37)) {
if (!player.getSkills().hasLevel(Skills.AGILITY, 37)) {
player.getPacketDispatch().sendMessage("You must be level 37 agility or higher to climb down the rocks.");
break;
}
@@ -94,7 +94,7 @@ public enum CookableItems {
public static HashMap<Integer,CookableItems>cookingMap = new HashMap<>();
public static HashMap<Integer, CookableItems>intentionalBurnMap = new HashMap<>();
public int raw,cooked,level,burnLevel,burnt;
double experience;
public double experience;
double low,high;
CookableItems(int cooked, int raw, int burnt, int level, double experience, int burnLevel, double low, double high){
this.raw = raw;
@@ -1,14 +1,11 @@
package core.game.node.entity.skill.magic;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
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.TeleportManager.TeleportType;
import core.game.node.entity.player.link.audio.Audio;
import core.game.node.item.Item;
import core.game.world.map.Location;
@@ -58,24 +55,6 @@ public final class TeleotherSpells extends MagicSpell {
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
ComponentDefinition.put(326, new ComponentPlugin() {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
return this;
}
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
if (button == 5) {
player.lock(2);
if (player.getTeleporter().send(player.getAttribute("t-o_location", player.getLocation()), TeleportType.TELE_OTHER)) {
player.visualize(Animation.create(1816), Graphics.create(342));
}
}
player.getInterfaceManager().close();
return true;
}
});
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)));
@@ -1,156 +0,0 @@
package core.game.node.entity.skill.magic.lunar;
import core.plugin.Initializable;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.skill.cooking.CookableItems;
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;
/**
* Represents the pie baking lunar spell.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class BakePieSpell extends MagicSpell {
/**
* Represents the animation of the spell.
*/
private static final Animation ANIMATION = Animation.create(4413);
/**
* Represents the graphics to use.
*/
private static final Graphics GRAPHIC = new Graphics(746, (150 << 16));
/**
* Constructs a new {@code BakePieSpell} {@code Object}.
*/
public BakePieSpell() {
super(SpellBook.LUNAR, 65, 60, null, null, null, new Item[] { new Item(Runes.ASTRAL_RUNE.getId(), 1), new Item(Runes.FIRE_RUNE.getId(), 5), new Item(Runes.WATER_RUNE.getId(), 4) });
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.LUNAR.register(15, this);
return this;
}
@Override
public boolean cast(Entity entity, Node target) {
final Player player = ((Player) entity);
if (!super.meetsRequirements(player, true, false)) {
return false;
}
Item foodItem = target.asItem();
CookableItems food = null;
for (Item item : player.getInventory().toArray()) {
if (item == null) {
continue;
}
if (item.getName().toLowerCase().contains("pie") && item.getName().toLowerCase().contains("uncooked") || item.getName().toLowerCase().contains("raw")) {
food = CookableItems.forId(item.getId());
}
}
if (food == null) {
player.getPacketDispatch().sendMessage("You need a pie in order to cast this spell.");
return false;
}
player.getPulseManager().run(new LunarPiePulse(player, foodItem, food));
return true;
}
/**
* Represents the skill pulse used to cook a pie.
* @author 'Vexia
*/
public final class LunarPiePulse extends SkillPulse<Item> {
//the pie
private CookableItems pie;
/**
* Constructs a new {@code BakePieSpell} {@code Object}.
* @param player the player.
* @param node the node.
*/
public LunarPiePulse(final Player player, final Item node, final CookableItems pie) {
super(player, node);
this.pie = pie;
}
@Override
public boolean checkRequirements() {
if (player.getSkills().getLevel(Skills.COOKING) < pie.level) {
player.getDialogueInterpreter().sendDialogue("You need to have a Cooking level of " + pie.level + " to cook this pie.");
return false;
}
if (!player.getInventory().containsItem(new Item(pie.raw))) {
stop();
return false;
}
return true;
}
@Override
public void animate() {
player.animate(ANIMATION);
player.graphics(GRAPHIC);
}
@Override
public boolean reward() {
if (getDelay() == 1) {
setDelay(5);
return false;
}
if (player.getInventory().remove(new Item(pie.raw)) && meetsRequirements(player, true, true)) {
player.getInventory().add(new Item(pie.cooked));
} else {
return true;
}
return nextPie() == null;
}
@Override
public void stop() {
super.stop();
player.graphics(new Graphics(-1));
}
@Override
public void message(int type) {
}
/**
* Method used to get the next pie.
* @return the pie.
*/
public CookableItems nextPie() {
for (Item item : player.getInventory().toArray()) {
if (item == null) {
continue;
}
if (item.getName().toLowerCase().contains("pie") && item.getName().toLowerCase().contains("uncooked") || item.getName().toLowerCase().contains("raw")) {
if(CookableItems.cookingMap.get(item.getId()) == null){
pie = null;
}
pie = CookableItems.forId(item.getId());
node = item;
}
}
return pie;
}
}
}
@@ -1,85 +0,0 @@
package core.game.node.entity.skill.magic.lunar;
import core.plugin.Initializable;
import core.game.node.entity.skill.Skills;
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.node.object.GameObject;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import rs09.game.node.entity.skill.farming.FarmingPatch;
import rs09.game.node.entity.skill.farming.Patch;
/**
* Cures a diseased plant.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class CurePlantSpell extends MagicSpell {
/**
* Represents the animation of the spell.
*/
private final static Animation ANIMATION = Animation.create(4409);
/**
* Represents the graphics to use.
*/
private final static Graphics GRAPHIC = new Graphics(742, 100);
/**
* Constructs a new {@code CurePlantSpell} {@code Object}.
*/
public CurePlantSpell() {
super(SpellBook.LUNAR, 66, 60, ANIMATION, GRAPHIC, null, new Item[] { new Item(Runes.ASTRAL_RUNE.getId(), 1), new Item(Runes.EARTH_RUNE.getId(), 8) });
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.LUNAR.register(32, this);
return this;
}
@Override
public boolean cast(Entity entity, Node target) {
final Player player = ((Player) entity);
if (!(target instanceof GameObject)) {
return false;
}
final GameObject object = ((GameObject) target);
FarmingPatch fPatch = FarmingPatch.forObject(object);
if(fPatch == null){
player.sendMessage("This spell is for plants... not whatever the heckies that is.");
return false;
}
Patch patch = fPatch.getPatchFor(player);
if(!patch.isDiseased() && !patch.isWeedy()){
player.sendMessage("It seems to be growing fine already, lad.");
return false;
}
if(patch.isWeedy()){
player.sendMessage("Trust me lad, the weeds are healthy enough as is.");
return false;
}
if(patch.isDead()){
player.sendMessage("It says 'Cure' not 'Resurrect'. Although death may arise from disease, it is not in itself a disease and hence cannot be cured. So there.");
return false;
}
if (!super.meetsRequirements(player, true, true)) {
return false;
}
patch.cureDisease();
player.animate(ANIMATION);
player.graphics(GRAPHIC);
player.getSkills().addExperience(Skills.FARMING, 91.5, true);
return true;
}
}
@@ -1,154 +0,0 @@
package core.game.node.entity.skill.magic.lunar;
import core.game.component.Component;
import core.plugin.Initializable;
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.entity.player.link.TeleportManager.TeleportType;
import core.game.node.item.Item;
import core.game.world.map.Location;
import core.game.world.map.RegionManager;
import core.plugin.Plugin;
/**
* Represents the plugin to handle all teleport spells.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class LunarTeleportPlugin extends MagicSpell {
/**
* Represents the component used for group spells.
*/
private static final Component COMPONENT = new Component(326);
/**
* Represents the location to teleport to.
*/
private Location location;
/**
* Represents if it's a group teleport.
*/
private boolean group;
/**
* Constructs a new {@code LunarTeleportPlugin} {@code Object}.
*/
public LunarTeleportPlugin() {
/**
* empty.
*/
}
/**
* Constructs a new {@code LunarTeleportPlugin} {@code Object}.
* @param level the level.
* @param experience the experience.
* @param items the items.
*/
public LunarTeleportPlugin(final int level, final double experience, final Location location, boolean group, final Item... items) {
super(SpellBook.LUNAR, level, experience, null, null, null, items);
this.location = location;
this.group = group;
}
@Override
public boolean cast(Entity entity, Node target) {
final Player player = (Player) entity;
if (player.getLocks().isTeleportLocked() || !meetsRequirements(player, true, false)) {
return false;
}
player.getTeleporter().send(location.transform(0, 0, 0), getSpellId() == 16 ? TeleportType.HOME : TeleportType.LUNAR);
if (!meetsRequirements(player, true, true)) {
return false;
}
entity.setAttribute("teleport:items", super.runes);
if (group) {
String destination = "Moonclan Island";
switch (getSpellId()) {
case 34:
destination = "Waterbirth Island";
break;
case 35:
destination = "Barbarian outpost";
break;
case 36:
destination = "Port Khazard";
break;
case 37:
destination = "Fishing guild";
break;
case 38:
destination = "Catherby";
break;
case 39:
destination = "Ice plateau";
break;
}
for (Player p : RegionManager.getLocalPlayers(player, 1)) {
if (p == player) {
continue;
}
if (!p.isActive() || p.getLocks().isTeleportLocked()) {
player.getPacketDispatch().sendMessage("The other player is currently busy.");
continue;
}
if (!p.getSettings().isAcceptAid()) {
player.getPacketDispatch().sendMessage("The player is not accepting any aid.");
continue;
}
visualize(entity, p);
p.setAttribute("t-o_location", location);
p.getPacketDispatch().sendString(player.getUsername(), 326, 1);
p.getPacketDispatch().sendString(destination, 326, 3);
p.getInterfaceManager().open(COMPONENT);
}
}
return true;
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
// home
SpellBook.LUNAR.register(16, new LunarTeleportPlugin(0, 0, Location.create(2100, 3914, 0), false));
// moonclan teleport
SpellBook.LUNAR.register(20, new LunarTeleportPlugin(69, 66, Location.create(2111, 3916, 0), false, new Item(Runes.LAW_RUNE.getId(), 1), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.EARTH_RUNE.getId(), 2)));
// moonclan group teleport
SpellBook.LUNAR.register(33, new LunarTeleportPlugin(70, 67, Location.create(2111, 3916, 0), true, new Item(Runes.LAW_RUNE.getId(), 1), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.EARTH_RUNE.getId(), 4)));
// ourina teleport
SpellBook.LUNAR.register(31, new LunarTeleportPlugin(71, 69, Location.create(2469, 3247, 0), false, new Item(Runes.LAW_RUNE.getId(), 1), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.EARTH_RUNE.getId(), 6)));
// waterbirth teleport
SpellBook.LUNAR.register(24, new LunarTeleportPlugin(72, 71, Location.create(2527, 3739, 0), false, new Item(Runes.LAW_RUNE.getId(), 1), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.WATER_RUNE.getId(), 1)));
// waterbirth group teleport
SpellBook.LUNAR.register(34, new LunarTeleportPlugin(73, 72, Location.create(2527, 3739, 0), true, new Item(Runes.LAW_RUNE.getId(), 1), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.WATER_RUNE.getId(), 5)));
// barbarian post teleport.
SpellBook.LUNAR.register(0, new LunarTeleportPlugin(75, 76, Location.create(2544, 3572, 0), false, new Item(Runes.LAW_RUNE.getId(), 2), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.FIRE_RUNE.getId(), 3)));
// barbarian group teleport
SpellBook.LUNAR.register(35, new LunarTeleportPlugin(77, 77, Location.create(2544, 3572, 0), true, new Item(Runes.LAW_RUNE.getId(), 2), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.FIRE_RUNE.getId(), 6)));
// khzard teleport
SpellBook.LUNAR.register(18, new LunarTeleportPlugin(78, 80, Location.create(2656, 3157, 0), false, new Item(Runes.LAW_RUNE.getId(), 2), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.WATER_RUNE.getId(), 4)));
// khzard group teleport
SpellBook.LUNAR.register(36, new LunarTeleportPlugin(79, 81, Location.create(2656, 3157, 0), true, new Item(Runes.LAW_RUNE.getId(), 2), new Item(Runes.ASTRAL_RUNE.getId(), 2), new Item(Runes.WATER_RUNE.getId(), 8)));
// fishing guild teleport
SpellBook.LUNAR.register(17, new LunarTeleportPlugin(85, 89, Location.create(2611, 3393, 0), false, new Item(Runes.LAW_RUNE.getId(), 3), new Item(Runes.ASTRAL_RUNE.getId(), 3), new Item(Runes.WATER_RUNE.getId(), 10)));
// fishing guild group teleport
SpellBook.LUNAR.register(37, new LunarTeleportPlugin(86, 90, Location.create(2611, 3393, 0), true, new Item(Runes.LAW_RUNE.getId(), 3), new Item(Runes.ASTRAL_RUNE.getId(), 3), new Item(Runes.WATER_RUNE.getId(), 14)));
// catherby teleport
SpellBook.LUNAR.register(21, new LunarTeleportPlugin(87, 92, Location.create(2804, 3433, 0), false, new Item(Runes.LAW_RUNE.getId(), 3), new Item(Runes.ASTRAL_RUNE.getId(), 3), new Item(Runes.WATER_RUNE.getId(), 10)));
// catherby group teleport
SpellBook.LUNAR.register(38, new LunarTeleportPlugin(88, 93, Location.create(2804, 3433, 0), true, new Item(Runes.LAW_RUNE.getId(), 3), new Item(Runes.ASTRAL_RUNE.getId(), 3), new Item(Runes.WATER_RUNE.getId(), 12)));
// ice plateua teleport
SpellBook.LUNAR.register(28, new LunarTeleportPlugin(89, 96, Location.create(2972, 3873, 0), false, new Item(Runes.LAW_RUNE.getId(), 3), new Item(Runes.ASTRAL_RUNE.getId(), 3), new Item(Runes.WATER_RUNE.getId(), 8)));
// ice plateua group teleport
SpellBook.LUNAR.register(39, new LunarTeleportPlugin(90, 99, Location.create(2972, 3873, 0), true, new Item(Runes.LAW_RUNE.getId(), 3), new Item(Runes.ASTRAL_RUNE.getId(), 3), new Item(Runes.WATER_RUNE.getId(), 16)));
return this;
}
}
@@ -1,93 +0,0 @@
package core.game.node.entity.skill.magic.lunar;
import core.game.component.CloseEvent;
import core.game.component.Component;
import core.plugin.Initializable;
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.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;
/**
* Represents the monster examine spell.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class MonsterExamineSpell extends MagicSpell {
/**
* Represents the animation of this spell.
*/
private final static Animation ANIMATION = new Animation(6293);
/**
* Repesents the graphics of this spell.
*/
private static final Graphics GRAPHIC = new Graphics(738, 130);
/**
* Represents the graphics of the eye.
*/
private static final Graphics EYE = new Graphics(1059);
/**
* Represents the animation of the spell.
*/
private static final Component COMPONENT = new Component(522);
/**
* Constructs a new {@code CurePlantSpell} {@code Object}.
*/
public MonsterExamineSpell() {
super(SpellBook.LUNAR, 66, 61, ANIMATION, null, null, new Item[] { new Item(Runes.COSMIC_RUNE.getId(), 1), new Item(Runes.ASTRAL_RUNE.getId(), 1), new Item(Runes.MIND_RUNE.getId(), 1) });
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.LUNAR.register(6, this);
return this;
}
@Override
public boolean cast(Entity entity, Node target) {
final Player player = ((Player) entity);
if (!(target instanceof NPC)) {
player.getPacketDispatch().sendMessage("You can only cast this spell on monsters.");
return false;
}
if (!super.meetsRequirements(player, true, true)) {
return false;
}
final NPC npc = ((NPC) target);
player.animate(ANIMATION);
player.face(npc);
player.getAudioManager().send(3621);
;
COMPONENT.setCloseEvent(new CloseEvent() {
@Override
public boolean close(Player player, Component c) {
player.getInterfaceManager().restoreTabs();
return true;
}
});
player.graphics(EYE);
npc.graphics(GRAPHIC);
npc.getSkills().updateCombatLevel();
player.getPacketDispatch().sendString("Monster name: " + npc.getName(), 522, 0);
player.getPacketDispatch().sendString("Combat level: " + npc.getDefinition().getCombatLevel(), 522, 1);
player.getPacketDispatch().sendString("Life points: " + npc.getSkills().getMaximumLifepoints(), 522, 2);
player.getPacketDispatch().sendString("Creature's max hit: " + npc.getSwingHandler(false).calculateHit(npc, npc, 1.0), 522, 3);
player.getPacketDispatch().sendString("", 522, 4);
player.getInterfaceManager().openSingleTab(COMPONENT);
return true;
}
}
@@ -1,183 +0,0 @@
package core.game.node.entity.skill.magic.lunar;
import core.game.component.Component;
import core.game.component.ComponentPlugin;
import core.plugin.Initializable;
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.tools.RandomFunction;
/**
* Represents the npc contact spell.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public class NPContactSpell extends MagicSpell {
/**
* Represents the animation of this graphics.
*/
private static final Animation ANIMATION = new Animation(4413);
/**
* Represents the graphhcics of the spell.
*/
private static final Graphics GRAPHIC = new Graphics(730, 130);
/**
* Constructs a new {@code CurePlantSpell} {@code Object}.
*/
public NPContactSpell() {
super(SpellBook.LUNAR, 67, 63, ANIMATION, GRAPHIC, null, new Item[] { new Item(Runes.COSMIC_RUNE.getId(), 1), new Item(Runes.ASTRAL_RUNE.getId(), 1), new Item(Runes.AIR_RUNE.getId(), 2) });
}
@Override
public Plugin<SpellType> newInstance(SpellType arg) throws Throwable {
SpellBook.LUNAR.register(4, this);
return this;
}
@Override
public boolean cast(Entity entity, Node target) {
final Player player = ((Player) entity);
final Component component = new Component(429);
if (meetsRequirements(player, true, true)) {
player.getInterfaceManager().open(component);
component.setPlugin(new ComponentPlugin() {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
return this;
}
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
switch (button) {
case 51:
player.getInterfaceManager().close();
break;
default:
NPCContact contact = NPCContact.forId(button);
if (contact == NPCContact.RANDOM) {
contact = NPCContact.values()[RandomFunction.random(NPCContact.values().length)];
}
if (contact == null) {
return true;
}
if (player.getDialogueInterpreter().open(contact.getNpc(), contact.getNpc())) {
player.animate(ANIMATION);
player.graphics(GRAPHIC);
player.getAudioManager().send(3618);
player.getInterfaceManager().close();
} else {
player.getPacketDispatch().sendMessage("This npc is unable to be contacted at this moment.");
}
return true;
}
return true;
}
});
return true;
}
return false;
}
/**
* Represents the npc's to contact.
* @author 'Vexia
*/
public enum NPCContact {
HONEST_JIMM(10, 4362),
BERT_THE_SANDMAN(11, 3108),
ADVISOR_GHRIM(12, 1375),
TURAEL(13, 8273),
LANTHUS(17, 1526),
SUMONA(27, 7780),
MAZCHNA(18, 8274),
DURADEL(23, 8275),
VANNAKA(28, 1597),
MURPHY(30, 466),
CHAELDAR(29, 1598),
CYRISUS(32, 5893),
LARRY(34, 5425),
RANDOM(35, -1);
/**
* Constructs a new {@code NPContactSpell} {@code Object}.
* @param button the button.
* @param npc the npc.
*/
NPCContact(int button, int npc) {
this.button = button;
this.npc = npc;
}
/**
* Represents the button of the npc to contact.
*/
private int button;
/**
* Represents the npc to contact.
*/
private int npc;
/**
* Gets the button.
* @return The button.
*/
public int getButton() {
return button;
}
/**
* Sets the button.
* @param button The button to set.
*/
public void setButton(int button) {
this.button = button;
}
/**
* Gets the npc.
* @return The npc.
*/
public int getNpc() {
return npc;
}
/**
* Sets the npc.
* @param npc The npc to set.
*/
public void setNpc(int npc) {
this.npc = npc;
}
/**
* Gets the npc.
* @param id the id.
* @return the npc contact.
*/
public static NPCContact forId(int id) {
for (NPCContact npc : NPCContact.values()) {
if (npc.getButton() == id) {
return npc;
}
}
return null;
}
}
}
@@ -22,6 +22,7 @@ import core.net.packet.context.PlayerContext;
import core.net.packet.out.ClearMinimapFlag;
import rs09.ServerConstants;
import rs09.game.ai.AIPlayer;
import rs09.game.interaction.InteractionListener;
import rs09.game.interaction.InteractionListeners;
import rs09.game.world.repository.Repository;
@@ -339,6 +340,9 @@ public final class InteractionPacket implements IncomingPacket {
player.debug("Handled by quest interaction manager.");
return;
}
if(InteractionListeners.run(item.getId(), InteractionListener.Companion.getITEM(),option.getName(),player,item)){
return;
}
item.getInteraction().handle(player, option);
}
@@ -51,9 +51,13 @@ public final class WalkPacket implements IncomingPacket {
player.face((Entity) null);
player.faceLocation((Location) null);
//player.getWalkingQueue().reset(running);
player.getPulseManager().run(new MovementPulse(player, Location.create(x, y, player.getLocation().getZ()), running) {
Player finalPlayer = player;
player.getPulseManager().run(new MovementPulse(finalPlayer, Location.create(x, y, player.getLocation().getZ()), running) {
@Override
public boolean pulse() {
if(running){
finalPlayer.getWalkingQueue().setRunning(false);
}
return true;
}
}, true, "movement");