Refactor various minor things

This commit is contained in:
P0nk
2022-08-02 17:45:47 +02:00
parent 4fd1daada4
commit 5afb09d798
6 changed files with 19 additions and 16 deletions

View File

@@ -1929,8 +1929,7 @@ public class Character extends AbstractCharacterObject {
return; return;
} }
if (ob instanceof MapItem) { if (ob instanceof MapItem mapitem) {
MapItem mapitem = (MapItem) ob;
if (System.currentTimeMillis() - mapitem.getDropTime() < 400 || !mapitem.canBePickedBy(this)) { if (System.currentTimeMillis() - mapitem.getDropTime() < 400 || !mapitem.canBePickedBy(this)) {
sendPacket(PacketCreator.enableActions()); sendPacket(PacketCreator.enableActions());
return; return;

View File

@@ -61,8 +61,8 @@ public abstract class AbstractMovementPacketHandler extends AbstractPacketHandle
res.add(alm); res.add(alm);
break; break;
} }
case 1: case 1: // jump
case 2: case 2: // knockback
case 6: // fj case 6: // fj
case 12: case 12:
case 13: // Shot-jump-back thing case 13: // Shot-jump-back thing
@@ -79,8 +79,8 @@ public abstract class AbstractMovementPacketHandler extends AbstractPacketHandle
res.add(rlm); res.add(rlm);
break; break;
} }
case 3: case 3: // teleport disappear
case 4: // tele... -.- case 4: // teleport appear
case 7: // assaulter case 7: // assaulter
case 8: // assassinate case 8: // assassinate
case 9: // rush case 9: // rush

View File

@@ -33,7 +33,7 @@ public final class ReactorHitHandler extends AbstractPacketHandler {
@Override @Override
public final void handlePacket(InPacket p, Client c) { public final void handlePacket(InPacket p, Client c) {
//System.out.println(slea); //To see if there are any differences with packets //System.out.println(slea); //To see if there are any differences with packets
//CD 00 6B 00 00 00 01 00 00 00 03 00 00 00 20 03 F7 03 00 00 //[CD 00] [6B 00 00 00] [01 00 00 00] [03 00] [00 00 20 03] [F7 03 00 00]
//[CD 00] [66 00 00 00] [00 00 00 00] [02 00] [00 00 19 01] [00 00 00 00] //[CD 00] [66 00 00 00] [00 00 00 00] [02 00] [00 00 19 01] [00 00 00 00]
int oid = p.readInt(); int oid = p.readInt();
int charPos = p.readInt(); int charPos = p.readInt();

View File

@@ -36,12 +36,14 @@ public final class TouchReactorHandler extends AbstractPacketHandler {
public final void handlePacket(InPacket p, Client c) { public final void handlePacket(InPacket p, Client c) {
int oid = p.readInt(); int oid = p.readInt();
Reactor reactor = c.getPlayer().getMap().getReactorByOid(oid); Reactor reactor = c.getPlayer().getMap().getReactorByOid(oid);
if (reactor != null) { if (reactor == null) {
if (p.readByte() != 0) { return;
ReactorScriptManager.getInstance().touch(c, reactor); }
} else {
ReactorScriptManager.getInstance().untouch(c, reactor); if (p.readByte() != 0) {
} ReactorScriptManager.getInstance().touch(c, reactor);
} else {
ReactorScriptManager.getInstance().untouch(c, reactor);
} }
} }
} }

View File

@@ -504,7 +504,9 @@ public class MapleMap {
xLimits = bounds; xLimits = bounds;
} else { } else {
// assuming MINIMAP always have an equal-greater picture representation of the map area (players won't walk beyond the area known by the minimap). // assuming MINIMAP always have an equal-greater picture representation of the map area (players won't walk beyond the area known by the minimap).
Point lp = new Point(mapArea.x, mapArea.y), rp = new Point(mapArea.x + mapArea.width, mapArea.y), fallback = new Point(mapArea.x + (mapArea.width / 2), mapArea.y); Point lp = new Point(mapArea.x, mapArea.y);
Point rp = new Point(mapArea.x + mapArea.width, mapArea.y);
Point fallback = new Point(mapArea.x + (mapArea.width / 2), mapArea.y);
lp = bsearchDropPos(lp, fallback); // approximated leftmost fh node position lp = bsearchDropPos(lp, fallback); // approximated leftmost fh node position
rp = bsearchDropPos(rp, fallback); // approximated rightmost fh node position rp = bsearchDropPos(rp, fallback); // approximated rightmost fh node position

View File

@@ -256,8 +256,8 @@ public class Reactor extends AbstractMapObject {
cancelReactorTimeout(); cancelReactorTimeout();
attackHit = wHit; attackHit = wHit;
if (YamlConfig.config.server.USE_DEBUG == true) { if (YamlConfig.config.server.USE_DEBUG) {
c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid + " , STATE " + stats.getType(state) + " STATESIZE " + stats.getStateSize(state)); c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid + " , STATE " + state + " STATESIZE " + stats.getStateSize(state));
} }
ReactorScriptManager.getInstance().onHit(c, this); ReactorScriptManager.getInstance().onHit(c, this);