Nature Spirit quest

This commit is contained in:
Ceikry
2021-08-16 02:22:10 +00:00
parent 0e2f51f851
commit b23aa7bc0d
38 changed files with 1345 additions and 298 deletions
@@ -26,16 +26,23 @@ public final class PositionedGraphicContext implements Context {
*/
private final Location location;
public int sceneX, sceneY;
public int offsetX, offsetY;
/**
* Constructs a new {@code PositionedGraphicContext} {@code Object}.
* @param player The player.
* @param graphic The graphic to display on the given location.
* @param location The location to display the graphic on.
*/
public PositionedGraphicContext(Player player, Graphics graphic, Location location) {
public PositionedGraphicContext(Player player, Graphics graphic, Location location, int offsetX, int offsetY) {
this.player = player;
this.graphic = graphic;
this.location = location;
this.sceneX = location.getSceneX(player.getPlayerFlags().getLastSceneGraph());
this.sceneY = location.getSceneY(player.getPlayerFlags().getLastSceneGraph());
this.offsetX = offsetX;
this.offsetY = offsetY;
}
@Override
@@ -338,7 +338,7 @@ 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)){
if(InteractionListeners.run(item.getId(), InteractionListener.Companion.getGROUNDITEM(), option.getName(),player,item)){
return;
}
item.getInteraction().handle(player, option);
@@ -5,6 +5,7 @@ import core.game.world.update.flag.context.Graphics;
import core.net.packet.IoBuffer;
import core.net.packet.OutgoingPacket;
import core.net.packet.context.PositionedGraphicContext;
import rs09.game.system.SystemLogger;
/**
* The positioned graphic outgoing packet.
@@ -16,8 +17,16 @@ public final class PositionedGraphic implements OutgoingPacket<PositionedGraphic
public void send(PositionedGraphicContext context) {
Location l = context.getLocation();
Graphics g = context.getGraphic();
IoBuffer buffer = UpdateAreaPosition.getBuffer(context.getPlayer(), l).put(17).put((l.getChunkOffsetX() << 4) | (l.getChunkOffsetY() & 0x7)).putShort(g.getId()).put(g.getHeight()).putShort(g.getDelay());
buffer.cypherOpcode(context.getPlayer().getSession().getIsaacPair().getOutput());context.getPlayer().getSession().write(buffer);
int offsetHash = (context.offsetX << 4) | context.offsetY;
IoBuffer buffer = new IoBuffer()
.put(26) //update current scene x and scene y client-side
.putC(context.sceneX) //this has to be done for each graphic being sent
.put(context.sceneY) //opcode 26 is the lastSceneX/lastSceneY update packet
.put(17).put(offsetHash) //send the graphics
.putShort(g.getId())
.put(g.getHeight())
.putShort(g.getDelay());
context.getPlayer().getSession().write(buffer);
}
}
}