Rename and clean up MapleMiniGame
This commit is contained in:
@@ -68,7 +68,7 @@ import server.life.MobSkillFactory;
|
||||
import server.life.Monster;
|
||||
import server.life.PlayerNPC;
|
||||
import server.maps.*;
|
||||
import server.maps.MapleMiniGame.MiniGameResult;
|
||||
import server.maps.MiniGame.MiniGameResult;
|
||||
import server.minigame.MapleRockPaperScissor;
|
||||
import server.partyquest.AriantColiseum;
|
||||
import server.partyquest.MonsterCarnival;
|
||||
@@ -158,7 +158,7 @@ public class Character extends AbstractCharacterObject {
|
||||
private Inventory[] inventory;
|
||||
private Job job = Job.BEGINNER;
|
||||
private Messenger messenger = null;
|
||||
private MapleMiniGame miniGame;
|
||||
private MiniGame miniGame;
|
||||
private MapleRockPaperScissor rps;
|
||||
private Mount maplemount;
|
||||
private Party party;
|
||||
@@ -5338,7 +5338,7 @@ public class Character extends AbstractCharacterObject {
|
||||
setTargetHpBarTime(0);
|
||||
}
|
||||
|
||||
public MapleMiniGame getMiniGame() {
|
||||
public MiniGame getMiniGame() {
|
||||
return miniGame;
|
||||
}
|
||||
|
||||
@@ -5562,7 +5562,7 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
|
||||
public void closeMiniGame(boolean forceClose) {
|
||||
MapleMiniGame game = this.getMiniGame();
|
||||
MiniGame game = this.getMiniGame();
|
||||
if (game == null) {
|
||||
return;
|
||||
}
|
||||
@@ -9180,7 +9180,7 @@ public class Character extends AbstractCharacterObject {
|
||||
this.messengerposition = position;
|
||||
}
|
||||
|
||||
public void setMiniGame(MapleMiniGame miniGame) {
|
||||
public void setMiniGame(MiniGame miniGame) {
|
||||
this.miniGame = miniGame;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import net.packet.InPacket;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MapleTrade;
|
||||
import server.maps.*;
|
||||
import server.maps.MapleMiniGame.MiniGameType;
|
||||
import server.maps.MiniGame.MiniGameType;
|
||||
import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
|
||||
@@ -172,7 +172,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
MapleMiniGame game = new MapleMiniGame(chr, desc, pw);
|
||||
MiniGame game = new MiniGame(chr, desc, pw);
|
||||
chr.setMiniGame(game);
|
||||
game.setPieceType(type);
|
||||
game.setGameType(MiniGameType.OMOK);
|
||||
@@ -206,7 +206,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
MapleMiniGame game = new MapleMiniGame(chr, desc, pw);
|
||||
MiniGame game = new MiniGame(chr, desc, pw);
|
||||
game.setPieceType(type);
|
||||
if (type == 0) {
|
||||
game.setMatchesToWin(6);
|
||||
@@ -285,11 +285,11 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
if (ob instanceof MaplePlayerShop) {
|
||||
MaplePlayerShop shop = (MaplePlayerShop) ob;
|
||||
shop.visitShop(chr);
|
||||
} else if (ob instanceof MapleMiniGame) {
|
||||
} else if (ob instanceof MiniGame) {
|
||||
p.skip(1);
|
||||
String pw = p.available() > 1 ? p.readString() : "";
|
||||
|
||||
MapleMiniGame game = (MapleMiniGame) ob;
|
||||
MiniGame game = (MiniGame) ob;
|
||||
if(game.checkPassword(pw)) {
|
||||
if (game.hasFreeSlot() && !game.isVisitor(chr)) {
|
||||
game.addVisitor(chr);
|
||||
@@ -323,7 +323,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
shop.chat(c, p.readString());
|
||||
}
|
||||
} else if (chr.getMiniGame() != null) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
if (game != null) {
|
||||
game.chat(c, p.readString());
|
||||
}
|
||||
@@ -377,13 +377,13 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
chr.getMap().broadcastMessage(PacketCreator.spawnHiredMerchantBox(merchant));
|
||||
}
|
||||
} else if (mode == Action.READY.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
game.broadcast(PacketCreator.getMiniGameReady(game));
|
||||
} else if (mode == Action.UN_READY.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
game.broadcast(PacketCreator.getMiniGameUnReady(game));
|
||||
} else if (mode == Action.START.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
if (game.getGameType().equals(MiniGameType.OMOK)) {
|
||||
game.minigameMatchStarted();
|
||||
game.broadcast(PacketCreator.getMiniGameStart(game, game.getLoser()));
|
||||
@@ -395,7 +395,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
chr.getMap().broadcastMessage(PacketCreator.addMatchCardBox(game.getOwner(), 2, 1));
|
||||
}
|
||||
} else if (mode == Action.GIVE_UP.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
if (game.getGameType().equals(MiniGameType.OMOK)) {
|
||||
if (game.isOwner(chr)) {
|
||||
game.minigameMatchVisitorWins(true);
|
||||
@@ -410,7 +410,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.REQUEST_TIE.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
if (!game.isTieDenied(chr)) {
|
||||
if (game.isOwner(chr)) {
|
||||
game.broadcastToVisitor(PacketCreator.getMiniGameRequestTie(game));
|
||||
@@ -419,7 +419,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.ANSWER_TIE.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
if (p.readByte() != 0) {
|
||||
game.minigameMatchDraw();
|
||||
} else {
|
||||
@@ -432,7 +432,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.SKIP.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
if (game.isOwner(chr)) {
|
||||
game.broadcast(PacketCreator.getMiniGameSkipOwner(game));
|
||||
} else {
|
||||
@@ -446,7 +446,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
} else if (mode == Action.SELECT_CARD.getCode()) {
|
||||
int turn = p.readByte(); // 1st turn = 1; 2nd turn = 0
|
||||
int slot = p.readByte(); // slot
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
MiniGame game = chr.getMiniGame();
|
||||
int firstslot = game.getFirstSlot();
|
||||
if (turn == 1) {
|
||||
game.setFirstSlot(slot);
|
||||
@@ -758,7 +758,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
shop.banPlayer(p.readString());
|
||||
}
|
||||
} else if (mode == Action.EXPEL.getCode()) {
|
||||
MapleMiniGame miniGame = chr.getMiniGame();
|
||||
MiniGame miniGame = chr.getMiniGame();
|
||||
if(miniGame != null && miniGame.isOwner(chr)) {
|
||||
Character visitor = miniGame.getVisitor();
|
||||
|
||||
@@ -768,12 +768,12 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.EXIT_AFTER_GAME.getCode()) {
|
||||
MapleMiniGame miniGame = chr.getMiniGame();
|
||||
MiniGame miniGame = chr.getMiniGame();
|
||||
if(miniGame != null) {
|
||||
miniGame.setQuitAfterGame(chr, true);
|
||||
}
|
||||
} else if (mode == Action.CANCEL_EXIT_AFTER_GAME.getCode()) {
|
||||
MapleMiniGame miniGame = chr.getMiniGame();
|
||||
MiniGame miniGame = chr.getMiniGame();
|
||||
if(miniGame != null) {
|
||||
miniGame.setQuitAfterGame(chr, false);
|
||||
}
|
||||
|
||||
@@ -32,22 +32,21 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Matze
|
||||
* @author Ronan (HeavenMS)
|
||||
*/
|
||||
public class MapleMiniGame extends AbstractMapObject {
|
||||
public class MiniGame extends AbstractMapObject {
|
||||
private Character owner;
|
||||
private Character visitor;
|
||||
private String password;
|
||||
private final String password;
|
||||
private MiniGameType GameType = MiniGameType.UNDEFINED;
|
||||
private int piecetype;
|
||||
private int inprogress = 0;
|
||||
private int[] piece = new int[250];
|
||||
private List<Integer> list4x3 = new ArrayList<>();
|
||||
private List<Integer> list5x4 = new ArrayList<>();
|
||||
private List<Integer> list6x5 = new ArrayList<>();
|
||||
private String description;
|
||||
private final int[] piece = new int[250];
|
||||
private final List<Integer> list4x3 = new ArrayList<>();
|
||||
private final List<Integer> list5x4 = new ArrayList<>();
|
||||
private final List<Integer> list6x5 = new ArrayList<>();
|
||||
private final String description;
|
||||
private int loser = 1;
|
||||
private int firstslot = 0;
|
||||
private int visitorpoints = 0, visitorscore = 0, visitorforfeits = 0, lastvisitor = -1;
|
||||
@@ -56,24 +55,24 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
private long nextavailabletie = 0;
|
||||
private int matchestowin = 0;
|
||||
|
||||
public static enum MiniGameType {
|
||||
public enum MiniGameType {
|
||||
UNDEFINED(0), OMOK(1), MATCH_CARD(2);
|
||||
private int value = 0;
|
||||
|
||||
private MiniGameType(int value) {
|
||||
MiniGameType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum MiniGameResult {
|
||||
|
||||
public enum MiniGameResult {
|
||||
WIN, LOSS, TIE
|
||||
}
|
||||
|
||||
public MapleMiniGame(Character owner, String description, String password) {
|
||||
|
||||
public MiniGame(Character owner, String description, String password) {
|
||||
this.owner = owner;
|
||||
this.description = description;
|
||||
this.password = password;
|
||||
@@ -82,11 +81,11 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
|
||||
public boolean checkPassword(String sentPw) {
|
||||
return this.password.length() == 0 || sentPw.toLowerCase().contentEquals(this.password.toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
public boolean hasFreeSlot() {
|
||||
return visitor == null;
|
||||
}
|
||||
@@ -94,18 +93,18 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
public boolean isOwner(Character chr) {
|
||||
return owner.equals(chr);
|
||||
}
|
||||
|
||||
|
||||
public void addVisitor(Character challenger) {
|
||||
visitor = challenger;
|
||||
if (lastvisitor != challenger.getId()) {
|
||||
ownerscore = 0;
|
||||
ownerforfeits = 0;
|
||||
|
||||
|
||||
visitorscore = 0;
|
||||
visitorforfeits = 0;
|
||||
lastvisitor = challenger.getId();
|
||||
}
|
||||
|
||||
|
||||
Character owner = this.getOwner();
|
||||
if (GameType == MiniGameType.OMOK) {
|
||||
owner.sendPacket(PacketCreator.getMiniGameNewVisitor(this, challenger, 1));
|
||||
@@ -115,20 +114,20 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
owner.getMap().broadcastMessage(PacketCreator.addMatchCardBox(owner, 2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void closeRoom(boolean forceClose) {
|
||||
owner.getMap().broadcastMessage(PacketCreator.removeMinigameBox(owner));
|
||||
|
||||
|
||||
if (forceClose) {
|
||||
this.broadcastToOwner(PacketCreator.getMiniGameClose(false, 4));
|
||||
}
|
||||
this.broadcastToVisitor(PacketCreator.getMiniGameClose(true, 3));
|
||||
|
||||
|
||||
if (visitor != null) {
|
||||
visitor.setMiniGame(null);
|
||||
visitor = null;
|
||||
}
|
||||
|
||||
|
||||
owner.setMiniGame(null);
|
||||
owner = null;
|
||||
}
|
||||
@@ -138,10 +137,10 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
if (forceClose) {
|
||||
visitor.sendPacket(PacketCreator.getMiniGameClose(true, 4));
|
||||
}
|
||||
|
||||
|
||||
challenger.setMiniGame(null);
|
||||
visitor = null;
|
||||
|
||||
|
||||
this.getOwner().sendPacket(PacketCreator.getMiniGameRemoveVisitor());
|
||||
if (GameType == MiniGameType.OMOK) {
|
||||
this.getOwner().getMap().broadcastMessage(PacketCreator.addOmokBox(owner, 1, 0));
|
||||
@@ -161,7 +160,7 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
c.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void broadcastToVisitor(Packet packet) {
|
||||
if (visitor != null) {
|
||||
visitor.sendPacket(packet);
|
||||
@@ -179,7 +178,7 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
private void updateMiniGameBox() {
|
||||
this.getOwner().getMap().broadcastMessage(PacketCreator.addOmokBox(owner, visitor != null ? 2 : 1, inprogress));
|
||||
}
|
||||
|
||||
|
||||
private synchronized boolean minigameMatchFinish() {
|
||||
if (isMatchInProgress()) {
|
||||
inprogress = 0;
|
||||
@@ -188,23 +187,23 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void minigameMatchFinished() {
|
||||
updateMiniGameBox();
|
||||
|
||||
|
||||
if (ownerquit) {
|
||||
owner.closeMiniGame(true);
|
||||
} else if (visitorquit) {
|
||||
visitor.closeMiniGame(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void minigameMatchStarted() {
|
||||
inprogress = 1;
|
||||
ownerquit = false;
|
||||
visitorquit = false;
|
||||
}
|
||||
|
||||
|
||||
public void setQuitAfterGame(Character player, boolean quit) {
|
||||
if (isOwner(player)) {
|
||||
ownerquit = quit;
|
||||
@@ -212,11 +211,11 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
visitorquit = quit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isMatchInProgress() {
|
||||
return inprogress != 0;
|
||||
}
|
||||
|
||||
|
||||
public void denyTie(Character chr) {
|
||||
if (this.isOwner(chr)) {
|
||||
inprogress |= (1 << 1);
|
||||
@@ -224,7 +223,7 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
inprogress |= (1 << 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isTieDenied(Character chr) {
|
||||
if (this.isOwner(chr)) {
|
||||
return ((inprogress >> 2) % 2) == 1;
|
||||
@@ -232,53 +231,67 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
return ((inprogress >> 1) % 2) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void minigameMatchOwnerWins(boolean forfeit) {
|
||||
if (!minigameMatchFinish()) return;
|
||||
|
||||
if (!minigameMatchFinish()) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner.setMiniGamePoints(visitor, 1, this.isOmok());
|
||||
|
||||
if (visitorforfeits < 4 || !forfeit) ownerscore += 50;
|
||||
|
||||
if (visitorforfeits < 4 || !forfeit) {
|
||||
ownerscore += 50;
|
||||
}
|
||||
visitorscore += (15 * (forfeit ? -1 : 1));
|
||||
if (forfeit) visitorforfeits++;
|
||||
|
||||
if (forfeit) {
|
||||
visitorforfeits++;
|
||||
}
|
||||
|
||||
this.broadcast(PacketCreator.getMiniGameOwnerWin(this, forfeit));
|
||||
|
||||
|
||||
minigameMatchFinished();
|
||||
}
|
||||
|
||||
|
||||
public void minigameMatchVisitorWins(boolean forfeit) {
|
||||
if (!minigameMatchFinish()) return;
|
||||
|
||||
if (!minigameMatchFinish()) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner.setMiniGamePoints(visitor, 2, this.isOmok());
|
||||
|
||||
if (ownerforfeits < 4 || !forfeit) visitorscore += 50;
|
||||
|
||||
if (ownerforfeits < 4 || !forfeit) {
|
||||
visitorscore += 50;
|
||||
}
|
||||
ownerscore += (15 * (forfeit ? -1 : 1));
|
||||
if (forfeit) ownerforfeits++;
|
||||
|
||||
if (forfeit) {
|
||||
ownerforfeits++;
|
||||
}
|
||||
|
||||
this.broadcast(PacketCreator.getMiniGameVisitorWin(this, forfeit));
|
||||
|
||||
|
||||
minigameMatchFinished();
|
||||
}
|
||||
|
||||
|
||||
public void minigameMatchDraw() {
|
||||
if (!minigameMatchFinish()) return;
|
||||
|
||||
if (!minigameMatchFinish()) {
|
||||
return;
|
||||
}
|
||||
|
||||
owner.setMiniGamePoints(visitor, 3, this.isOmok());
|
||||
|
||||
|
||||
long timeNow = Server.getInstance().getCurrentTime();
|
||||
if (nextavailabletie <= timeNow) {
|
||||
visitorscore += 10;
|
||||
ownerscore += 10;
|
||||
|
||||
|
||||
nextavailabletie = timeNow + 5 * 60 * 1000;
|
||||
}
|
||||
|
||||
|
||||
this.broadcast(PacketCreator.getMiniGameTie(this));
|
||||
|
||||
|
||||
minigameMatchFinished();
|
||||
}
|
||||
|
||||
|
||||
public void setOwnerPoints() {
|
||||
ownerpoints++;
|
||||
if (ownerpoints + visitorpoints == matchestowin) {
|
||||
@@ -346,7 +359,7 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
public MiniGameType getGameType() {
|
||||
return GameType;
|
||||
}
|
||||
|
||||
|
||||
public boolean isOmok() {
|
||||
return GameType.equals(MiniGameType.OMOK);
|
||||
}
|
||||
@@ -500,11 +513,11 @@ public class MapleMiniGame extends AbstractMapObject {
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public int getOwnerScore() {
|
||||
return ownerscore;
|
||||
}
|
||||
|
||||
|
||||
public int getVisitorScore() {
|
||||
return visitorscore;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ import server.life.Monster;
|
||||
import server.life.NPC;
|
||||
import server.life.PlayerNPC;
|
||||
import server.maps.*;
|
||||
import server.maps.MapleMiniGame.MiniGameResult;
|
||||
import server.maps.MiniGame.MiniGameResult;
|
||||
import server.movement.LifeMovementFragment;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -1962,7 +1962,7 @@ public class PacketCreator {
|
||||
addAnnounceBox(p, mps, 1);
|
||||
}
|
||||
} else {
|
||||
MapleMiniGame miniGame = chr.getMiniGame();
|
||||
MiniGame miniGame = chr.getMiniGame();
|
||||
if (miniGame != null && miniGame.isOwner(chr)) {
|
||||
if (miniGame.hasFreeSlot()) {
|
||||
addAnnounceBox(p, miniGame, 1, 0);
|
||||
@@ -2145,7 +2145,7 @@ public class PacketCreator {
|
||||
p.writeByte(0);
|
||||
}
|
||||
|
||||
private static void addAnnounceBox(final OutPacket p, MapleMiniGame game, int ammount, int joinable) {
|
||||
private static void addAnnounceBox(final OutPacket p, MiniGame game, int ammount, int joinable) {
|
||||
p.writeByte(game.getGameType().getValue());
|
||||
p.writeInt(game.getObjectId()); // gameid/shopid
|
||||
p.writeString(game.getDescription()); // desc
|
||||
@@ -4580,7 +4580,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGame(Client c, MapleMiniGame minigame, boolean owner, int piece) {
|
||||
public static Packet getMiniGame(Client c, MiniGame minigame, boolean owner, int piece) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.ROOM.getCode());
|
||||
p.writeByte(1);
|
||||
@@ -4618,39 +4618,39 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameReady(MapleMiniGame game) {
|
||||
public static Packet getMiniGameReady(MiniGame game) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.READY.getCode());
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameUnReady(MapleMiniGame game) {
|
||||
public static Packet getMiniGameUnReady(MiniGame game) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.UN_READY.getCode());
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameStart(MapleMiniGame game, int loser) {
|
||||
public static Packet getMiniGameStart(MiniGame game, int loser) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.START.getCode());
|
||||
p.writeByte(loser);
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameSkipOwner(MapleMiniGame game) {
|
||||
public static Packet getMiniGameSkipOwner(MiniGame game) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.SKIP.getCode());
|
||||
p.writeByte(0x01);
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameRequestTie(MapleMiniGame game) {
|
||||
public static Packet getMiniGameRequestTie(MiniGame game) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.REQUEST_TIE.getCode());
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameDenyTie(MapleMiniGame game) {
|
||||
public static Packet getMiniGameDenyTie(MiniGame game) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.ANSWER_TIE.getCode());
|
||||
return p;
|
||||
@@ -4676,13 +4676,13 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameSkipVisitor(MapleMiniGame game) {
|
||||
public static Packet getMiniGameSkipVisitor(MiniGame game) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeShort(PlayerInteractionHandler.Action.SKIP.getCode());
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameMoveOmok(MapleMiniGame game, int move1, int move2, int move3) {
|
||||
public static Packet getMiniGameMoveOmok(MiniGame game, int move1, int move2, int move3) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.MOVE_OMOK.getCode());
|
||||
p.writeInt(move1);
|
||||
@@ -4691,7 +4691,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameNewVisitor(MapleMiniGame minigame, Character chr, int slot) {
|
||||
public static Packet getMiniGameNewVisitor(MiniGame minigame, Character chr, int slot) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.VISIT.getCode());
|
||||
p.writeByte(slot);
|
||||
@@ -4712,7 +4712,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
private static Packet getMiniGameResult(MapleMiniGame game, int tie, int result, int forfeit) {
|
||||
private static Packet getMiniGameResult(MiniGame game, int tie, int result, int forfeit) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.GET_RESULT.getCode());
|
||||
|
||||
@@ -4759,15 +4759,15 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMiniGameOwnerWin(MapleMiniGame game, boolean forfeit) {
|
||||
public static Packet getMiniGameOwnerWin(MiniGame game, boolean forfeit) {
|
||||
return getMiniGameResult(game, 0, 1, forfeit ? 1 : 0);
|
||||
}
|
||||
|
||||
public static Packet getMiniGameVisitorWin(MapleMiniGame game, boolean forfeit) {
|
||||
public static Packet getMiniGameVisitorWin(MiniGame game, boolean forfeit) {
|
||||
return getMiniGameResult(game, 0, 2, forfeit ? 1 : 0);
|
||||
}
|
||||
|
||||
public static Packet getMiniGameTie(MapleMiniGame game) {
|
||||
public static Packet getMiniGameTie(MiniGame game) {
|
||||
return getMiniGameResult(game, 1, 3, 0);
|
||||
}
|
||||
|
||||
@@ -4779,7 +4779,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMatchCard(Client c, MapleMiniGame minigame, boolean owner, int piece) {
|
||||
public static Packet getMatchCard(Client c, MiniGame minigame, boolean owner, int piece) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.ROOM.getCode());
|
||||
p.writeByte(2);
|
||||
@@ -4819,7 +4819,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMatchCardStart(MapleMiniGame game, int loser) {
|
||||
public static Packet getMatchCardStart(MiniGame game, int loser) {
|
||||
final OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.START.getCode());
|
||||
p.writeByte(loser);
|
||||
@@ -4840,7 +4840,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMatchCardNewVisitor(MapleMiniGame minigame, Character chr, int slot) {
|
||||
public static Packet getMatchCardNewVisitor(MiniGame minigame, Character chr, int slot) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.VISIT.getCode());
|
||||
p.writeByte(slot);
|
||||
@@ -4854,7 +4854,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getMatchCardSelect(MapleMiniGame game, int turn, int slot, int firstslot, int type) {
|
||||
public static Packet getMatchCardSelect(MiniGame game, int turn, int slot, int firstslot, int type) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.PLAYER_INTERACTION);
|
||||
p.writeByte(PlayerInteractionHandler.Action.SELECT_CARD.getCode());
|
||||
p.writeByte(turn);
|
||||
|
||||
Reference in New Issue
Block a user