Chase functionality (/c name) to warp to the exact location of the target

This commit is contained in:
RubenD96
2021-04-22 22:03:59 +02:00
parent f6452b2320
commit ade50bad5e
3 changed files with 23 additions and 3 deletions

View File

@@ -255,6 +255,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
private long lastExpGainTime;
private boolean pendingNameChange; //only used to change name on logout, not to be relied upon elsewhere
private long loginTime;
private boolean chasing = false;
private MapleCharacter() {
super.setListener(new AbstractCharacterListener() {
@@ -11323,5 +11324,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
public int getLanguage() {
return getClient().getLanguage();
}
public boolean isChasing() {
return chasing;
}
public void setChasing(boolean chasing) {
this.chasing = chasing;
}
}

View File

@@ -33,6 +33,7 @@ import tools.FilePrinter;
import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor;
import java.awt.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Calendar;
@@ -79,7 +80,13 @@ public final class ChangeMapHandler extends AbstractMaplePacketHandler {
String startwp = slea.readMapleAsciiString();
MaplePortal portal = chr.getMap().getPortal(startwp);
slea.readByte();
boolean wheel = slea.readShort() > 0;
boolean wheel = slea.readByte() > 0;
boolean chasing = slea.readByte() == 1 && chr.isGM();
if (chasing) {
chr.setChasing(true);
chr.setPosition(new Point(slea.readInt(), slea.readInt()));
}
if (targetid != -1) {
if (!chr.isAlive()) {

View File

@@ -1037,7 +1037,12 @@ public class MaplePacketCreator {
mplew.writeInt(to.getId());
mplew.write(spawnPoint);
mplew.writeShort(chr.getHp());
mplew.writeBool(false);
mplew.writeBool(chr.isChasing());
if (chr.isChasing()) {
chr.setChasing(false);
mplew.writeInt(chr.getPosition().x);
mplew.writeInt(chr.getPosition().y);
}
mplew.writeLong(getTime(Server.getInstance().getCurrentTime()));
return mplew.getPacket();
}