Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ceb2866aa1 | ||
|
|
11c1e4655e | ||
|
|
aca9cbf91d | ||
|
|
08b089d9be | ||
|
|
8b254a294e | ||
|
|
7004de6e71 | ||
|
|
738e1b24e6 | ||
|
|
5a4200cc8e | ||
|
|
cb0320a471 |
@@ -23,7 +23,12 @@ function action(mode, type, selection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cm.isEventLeader()) {
|
if (!cm.isEventLeader()) {
|
||||||
cm.sendYesNo("I wish for your leader to talk to me. Alternatively, you may be wanting to quit. Are you going to abandon this campaign?");
|
// Player chose "No" or "End Chat"
|
||||||
|
if (mode <= 0) {
|
||||||
|
cm.dispose();
|
||||||
|
} else {
|
||||||
|
cm.sendYesNo("I wish for your leader to talk to me. Alternatively, you may be wanting to quit. Are you going to abandon this campaign?");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var eim = cm.getEventInstance();
|
var eim = cm.getEventInstance();
|
||||||
if (eim == null) {
|
if (eim == null) {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public class ByteBufInPacket implements InPacket {
|
|||||||
public byte readByte() {
|
public byte readByte() {
|
||||||
return byteBuf.readByte();
|
return byteBuf.readByte();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public short readUnsignedByte() { return byteBuf.readUnsignedByte(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short readShort() {
|
public short readShort() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.awt.*;
|
|||||||
|
|
||||||
public interface InPacket extends Packet {
|
public interface InPacket extends Packet {
|
||||||
byte readByte();
|
byte readByte();
|
||||||
|
short readUnsignedByte();
|
||||||
short readShort();
|
short readShort();
|
||||||
int readInt();
|
int readInt();
|
||||||
long readLong();
|
long readLong();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public final class NPCMoreTalkHandler extends AbstractPacketHandler {
|
|||||||
if (p.available() >= 4) {
|
if (p.available() >= 4) {
|
||||||
selection = p.readInt();
|
selection = p.readInt();
|
||||||
} else if (p.available() > 0) {
|
} else if (p.available() > 0) {
|
||||||
selection = p.readByte();
|
selection = p.readUnsignedByte();
|
||||||
}
|
}
|
||||||
if (c.getQM() != null) {
|
if (c.getQM() != null) {
|
||||||
if (c.getQM().isStart()) {
|
if (c.getQM().isStart()) {
|
||||||
|
|||||||
@@ -228,10 +228,10 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
short flag = eq.getFlag();
|
short flag = eq.getFlag();
|
||||||
flag |= ItemConstants.LOCK;
|
if (eq.getExpiration() > -1 && (eq.getFlag() & ItemConstants.LOCK) != ItemConstants.LOCK) {
|
||||||
if (eq.getExpiration() > -1) {
|
|
||||||
return; //No perma items pls
|
return; //No perma items pls
|
||||||
}
|
}
|
||||||
|
flag |= ItemConstants.LOCK;
|
||||||
eq.setFlag(flag);
|
eq.setFlag(flag);
|
||||||
|
|
||||||
long period = 0;
|
long period = 0;
|
||||||
@@ -246,7 +246,8 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (period > 0) {
|
if (period > 0) {
|
||||||
eq.setExpiration(currentServerTime() + DAYS.toMillis(period));
|
long expiration = eq.getExpiration() > -1 ? eq.getExpiration() : currentServerTime();
|
||||||
|
eq.setExpiration(expiration + DAYS.toMillis(period));
|
||||||
}
|
}
|
||||||
|
|
||||||
// double-remove found thanks to BHB
|
// double-remove found thanks to BHB
|
||||||
|
|||||||
@@ -38,6 +38,36 @@ class ByteBufInPacketTest {
|
|||||||
assertEquals(writtenByte, readByte);
|
assertEquals(writtenByte, readByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void readUnsignedByte() {
|
||||||
|
final byte writtenByte = Byte.MAX_VALUE;
|
||||||
|
byteBuf.writeByte(writtenByte);
|
||||||
|
|
||||||
|
short readUnsignedByte = inPacket.readUnsignedByte();
|
||||||
|
|
||||||
|
assertEquals(writtenByte, readUnsignedByte);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void readUnsignedByte_shouldBeNonnegative() {
|
||||||
|
final byte writtenByte = Byte.MIN_VALUE;
|
||||||
|
byteBuf.writeByte(writtenByte);
|
||||||
|
|
||||||
|
short readUnsignedByte = inPacket.readUnsignedByte();
|
||||||
|
|
||||||
|
assertEquals((short)writtenByte + 256, readUnsignedByte);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void readUnsignedByte_shouldBeNonnegative2() {
|
||||||
|
final byte writtenByte = -1;
|
||||||
|
byteBuf.writeByte(writtenByte);
|
||||||
|
|
||||||
|
short readUnsignedByte = inPacket.readUnsignedByte();
|
||||||
|
|
||||||
|
assertEquals((short)writtenByte + 256, readUnsignedByte);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void readShort() {
|
void readShort() {
|
||||||
final short writtenShort = 12_345;
|
final short writtenShort = 12_345;
|
||||||
|
|||||||
Reference in New Issue
Block a user