All packet creating methods now create Packet instead of byte[]
This commit got way too big... - Remove deprecated methods for sending packets - Favor OutPacket & Packet over MaplePacketLittleEndianWriter, LittleEndianWriter, and byte array - Split up some packet creating methods into separate classes
This commit is contained in:
@@ -18,7 +18,7 @@ public class MapleRockPaperScissor{
|
||||
private boolean win = false;
|
||||
|
||||
public MapleRockPaperScissor(final MapleClient c, final byte mode){
|
||||
c.announce(PacketCreator.rpsMode((byte) (9 + mode)));
|
||||
c.sendPacket(PacketCreator.rpsMode((byte) (9 + mode)));
|
||||
if(mode == 0){
|
||||
c.getPlayer().gainMeso(-1000, true, true, true);
|
||||
}
|
||||
@@ -28,14 +28,14 @@ public class MapleRockPaperScissor{
|
||||
if(ableAnswer && !win && answer >= 0 && answer <= 2){
|
||||
final int response = Randomizer.nextInt(3);
|
||||
if(response == answer){
|
||||
c.announce(PacketCreator.rpsSelection((byte) response, (byte) round));
|
||||
c.sendPacket(PacketCreator.rpsSelection((byte) response, (byte) round));
|
||||
// dont do anything. they can still answer once a draw
|
||||
}else if((answer == 0 && response == 2) || (answer == 1 && response == 0) || (answer == 2 && response == 1)){ // they win
|
||||
c.announce(PacketCreator.rpsSelection((byte) response, (byte) (round + 1)));
|
||||
c.sendPacket(PacketCreator.rpsSelection((byte) response, (byte) (round + 1)));
|
||||
ableAnswer = false;
|
||||
win = true;
|
||||
}else{ // they lose
|
||||
c.announce(PacketCreator.rpsSelection((byte) response, (byte) -1));
|
||||
c.sendPacket(PacketCreator.rpsSelection((byte) response, (byte) -1));
|
||||
ableAnswer = false;
|
||||
}
|
||||
return true;
|
||||
@@ -47,7 +47,7 @@ public class MapleRockPaperScissor{
|
||||
public final boolean timeOut(final MapleClient c){
|
||||
if(ableAnswer && !win){
|
||||
ableAnswer = false;
|
||||
c.announce(PacketCreator.rpsMode((byte) 0x0A));
|
||||
c.sendPacket(PacketCreator.rpsMode((byte) 0x0A));
|
||||
return true;
|
||||
}
|
||||
reward(c);
|
||||
@@ -60,7 +60,7 @@ public class MapleRockPaperScissor{
|
||||
if(round < 10){
|
||||
win = false;
|
||||
ableAnswer = true;
|
||||
c.announce(PacketCreator.rpsMode((byte) 0x0C));
|
||||
c.sendPacket(PacketCreator.rpsMode((byte) 0x0C));
|
||||
return true;
|
||||
} else {
|
||||
round = 10;
|
||||
@@ -79,6 +79,6 @@ public class MapleRockPaperScissor{
|
||||
|
||||
public final void dispose(final MapleClient c){
|
||||
reward(c);
|
||||
c.announce(PacketCreator.rpsMode((byte) 0x0D));
|
||||
c.sendPacket(PacketCreator.rpsMode((byte) 0x0D));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user