I noticed that Mini Games are not working in all the released sources (reason for that is that the noobs copied it from each other). This fixes the creation of a game (it doesn't fix Match Card and Omok itself, do this on your own). I also added the password protection, a step closer to GMS - yay?
PlayerInteractionHandler.java
Change
toCode:IPlayerInteractionManager game = new MapleMiniGame(c.getPlayer(), type, desc);
AddCode:IPlayerInteractionManager game = new MapleMiniGame(c.getPlayer(), type, desc, pass);
afterCode:else if (ips.getShopType() == 3 || ips.getShopType() == 4) { //mini game String pass = null; if (slea.readByte() == 1) { //a password has been entered pass = slea.readMapleAsciiString(); } if (pass != null && !pass.equals(ips.getPassword())) { c.getPlayer().dropMessage(1, "The password is not correct."); return; } }
HiredMerchant.javaCode:else if (ips.getShopType() == 2) { if (((MaplePlayerShop) ips).isBanned(c.getPlayer().getName())) { c.getPlayer().dropMessage(1, "You have been banned from this store."); return; } }
Change
toCode:super(owner, itemId % 10, desc, 3);
IPlayerInteractionManager.javaCode:super(owner, itemId % 10, desc, null, 3);
Add
MapleMiniGame.javaCode:public String getPassword();
Change
toCode:public MapleMiniGame(MapleCharacter owner, int type, String desc) { super(owner, type, desc, 1);
MaplePlayerShop.javaCode:public MapleMiniGame(MapleCharacter owner, int type, String desc, String pass) { super(owner, type, desc, pass, 1);
Change
toCode:public MaplePlayerShop(MapleCharacter owner, int itemId, String desc) { super(owner, itemId % 10, desc, 3);
PlayerInteractionManager.javaCode:public MaplePlayerShop(MapleCharacter owner, int itemId, String desc) { super(owner, itemId % 10, desc, null, 3);
Add
ChangeCode:private String password = "";
toCode:public PlayerInteractionManager(MapleCharacter owner, int type, String desc, int capacity) { this.setPosition(owner.getPosition()); this.ownerName = owner.getName(); this.ownerId = owner.getId(); this.type = (byte) type; this.capacity = (short) capacity; this.description = desc;
AddCode:public PlayerInteractionManager(MapleCharacter owner, int type, String desc, String pass, int capacity) { this.setPosition(owner.getPosition()); this.ownerName = owner.getName(); this.ownerId = owner.getId(); this.type = (byte) type; this.capacity = (short) capacity; this.description = desc; this.password = pass;
MaplePacketCreator.javaCode:@Override public String getPassword() { return password; }
Change your addAnnounceBox() function to
MapleMiniGame.javaCode:private static void addAnnounceBox(MaplePacketLittleEndianWriter mplew, IPlayerInteractionManager interaction) { if (interaction.getShopType() == 2) { mplew.write(4); //Shop mplew.writeInt(((MaplePlayerShop) interaction).getObjectId()); } else if (interaction.getShopType() == 3) { mplew.write(2); //Match Card mplew.writeInt(((MapleMiniGame) interaction).getObjectId()); } else if (interaction.getShopType() == 4) { mplew.write(1); //Omok mplew.writeInt(((MapleMiniGame) interaction).getObjectId()); } mplew.writeMapleAsciiString(interaction.getDescription()); // desc if (interaction.getPassword() != null) mplew.write(1); //private else mplew.write(0); //public mplew.write(interaction.getItemType()); mplew.write(1); if (interaction.getShopType() == 2) { mplew.write(interaction.getFreeSlot() > -1 ? 4 : 1); mplew.write(0); } else { mplew.write(interaction.getFreeSlot() > -1 ? 2 : 1); //4 slots, but only 2 can enter mplew.write(((MapleMiniGame) interaction).getStarted() ? 1 : 0); } }
Replace
withCode:public void setOwnerPoints() { ownerpoints++; if (ownerpoints + visitorpoints == matchestowin) { if (ownerpoints == visitorpoints) { broadcast(MaplePacketCreator.getMiniGameTie(this), true); } else if (ownerpoints > visitorpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 0), true); } else if (visitorpoints > ownerpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 1), true); } } ownerpoints = 0; visitorpoints = 0; } public void setVisitorPoints() { visitorpoints++; if ((ownerpoints + visitorpoints) == matchestowin) { if (ownerpoints > visitorpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 0), true); } else if (visitorpoints > ownerpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 1), true); } else if (ownerpoints == visitorpoints) { broadcast(MaplePacketCreator.getMiniGameTie(this), true); } } ownerpoints = 0; visitorpoints = 0; }
Finish the rest on your own...Code:public void setOwnerPoints() { ownerpoints++; if (ownerpoints + visitorpoints == matchestowin) { if (ownerpoints == visitorpoints) { broadcast(MaplePacketCreator.getMiniGameTie(this), true); } else if (ownerpoints > visitorpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 0), true); } else if (visitorpoints > ownerpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 1), true); } ownerpoints = 0; visitorpoints = 0; } } public void setVisitorPoints() { visitorpoints++; if ((ownerpoints + visitorpoints) == matchestowin) { if (ownerpoints > visitorpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 0), true); } else if (visitorpoints > ownerpoints) { broadcast(MaplePacketCreator.getMiniGameWin(this, 1), true); } else if (ownerpoints == visitorpoints) { broadcast(MaplePacketCreator.getMiniGameTie(this), true); } ownerpoints = 0; visitorpoints = 0; } }
By the way...
Code:EXPEL_PLAYER(0x36), //Game Expel


). I also added the password protection, a step closer to GMS - yay?
Reply With Quote


