Reformat entire PacketCreator
This commit is contained in:
@@ -78,7 +78,6 @@ import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Frz
|
||||
*/
|
||||
public class PacketCreator {
|
||||
@@ -574,7 +573,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a login failed packet.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>reason</code>:<br> 3: ID deleted or blocked<br>
|
||||
* 4: Incorrect password<br> 5: Not a registered id<br> 6: System error<br>
|
||||
* 7: Already logged in<br> 8: System error<br> 9: System error<br> 10:
|
||||
@@ -601,7 +600,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a login failed packet.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>reason</code>:<br> 2: ID deleted or blocked<br>
|
||||
* 3: ID deleted or blocked<br> 4: Incorrect password<br> 5: Not a
|
||||
* registered id<br> 6: Trouble logging into the game?<br> 7: Already logged
|
||||
@@ -682,7 +681,7 @@ public class PacketCreator {
|
||||
mplew.write(c.getGender());
|
||||
|
||||
boolean canFly = Server.getInstance().canFly(c.getAccID());
|
||||
mplew.writeBool((YamlConfig.config.server.USE_ENFORCE_ADMIN_ACCOUNT || canFly) ? c.getGMLevel() > 1 : false); // thanks Steve(kaito1410) for pointing the GM account boolean here
|
||||
mplew.writeBool((YamlConfig.config.server.USE_ENFORCE_ADMIN_ACCOUNT || canFly) && c.getGMLevel() > 1); // thanks Steve(kaito1410) for pointing the GM account boolean here
|
||||
mplew.write(((YamlConfig.config.server.USE_ENFORCE_ADMIN_ACCOUNT || canFly) && c.getGMLevel() > 1) ? 0x80 : 0); // Admin Byte. 0x80,0x40,0x20.. Rubbish.
|
||||
mplew.write(0); // Country Code.
|
||||
|
||||
@@ -703,7 +702,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a packet detailing a PIN operation.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>mode</code>:<br> 0 - PIN was accepted<br> 1 -
|
||||
* Register a new PIN<br> 2 - Invalid pin / Reenter<br> 3 - Connection
|
||||
* failed due to system error<br> 4 - Enter the pin
|
||||
@@ -798,7 +797,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a packet detailing a server status message.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>status</code>:<br> 0 - Normal<br> 1 - Highly
|
||||
* populated<br> 2 - Full
|
||||
*
|
||||
@@ -856,7 +855,7 @@ public class PacketCreator {
|
||||
* @param serverId The ID of the server requested.
|
||||
* @param status The charlist request result.
|
||||
* @return The character list packet.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>status</code>:
|
||||
* <br> 2: ID deleted or blocked<br>
|
||||
* <br> 3: ID deleted or blocked<br>
|
||||
@@ -1211,7 +1210,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a server notice packet.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 0: [Notice]<br> 1: Popup<br>
|
||||
* 2: Megaphone<br> 3: Super Megaphone<br> 4: Scrolling message at top<br>
|
||||
* 5: Pink Text<br> 6: Lightblue Text
|
||||
@@ -1226,7 +1225,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a server notice packet.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 0: [Notice]<br> 1: Popup<br>
|
||||
* 2: Megaphone<br> 3: Super Megaphone<br> 4: Scrolling message at top<br>
|
||||
* 5: Pink Text<br> 6: Lightblue Text
|
||||
@@ -1250,7 +1249,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a server message packet.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 0: [Notice]<br> 1: Popup<br>
|
||||
* 2: Megaphone<br> 3: Super Megaphone<br> 4: Scrolling message at top<br>
|
||||
* 5: Pink Text<br> 6: Lightblue Text<br> 7: BroadCasting NPC
|
||||
@@ -1482,9 +1481,15 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
// reflect packet structure found thanks to Arnah (Vertisy)
|
||||
if(pCounter != -1) mplew.writeInt(pCounter);// wPCounter_
|
||||
if(mCounter != -1) mplew.writeInt(mCounter);// wMCounter_
|
||||
if(pCounter != -1 || mCounter != -1) mplew.writeInt(100);// nCounterProb_
|
||||
if (pCounter != -1) {
|
||||
mplew.writeInt(pCounter);// wPCounter_
|
||||
}
|
||||
if (mCounter != -1) {
|
||||
mplew.writeInt(mCounter);// wMCounter_
|
||||
}
|
||||
if (pCounter != -1 || mCounter != -1) {
|
||||
mplew.writeInt(100);// nCounterProb_
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2594,7 +2599,9 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
public static byte[] updateAriantPQRanking(final MapleCharacter chr, final int score) {
|
||||
return updateAriantPQRanking(new LinkedHashMap<MapleCharacter, Integer>(){{put(chr, score);}});
|
||||
return updateAriantPQRanking(new LinkedHashMap<MapleCharacter, Integer>() {{
|
||||
put(chr, score);
|
||||
}});
|
||||
}
|
||||
|
||||
public static byte[] updateAriantPQRanking(Map<MapleCharacter, Integer> playerScore) {
|
||||
@@ -2789,7 +2796,6 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param chr
|
||||
* @param isSelf
|
||||
* @return
|
||||
@@ -2912,7 +2918,6 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cid
|
||||
* @param statups
|
||||
* @param mount
|
||||
@@ -2945,7 +2950,6 @@ public class PacketCreator {
|
||||
mplew.write(0);*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @param c
|
||||
* @param quest
|
||||
* @return
|
||||
@@ -2960,7 +2964,6 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param c
|
||||
* @param quest
|
||||
* @return
|
||||
@@ -2976,7 +2979,6 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param c
|
||||
* @param quest
|
||||
* @param npc
|
||||
@@ -3353,7 +3355,6 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param c
|
||||
* @param shop
|
||||
* @param owner
|
||||
@@ -3667,8 +3668,7 @@ public class PacketCreator {
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
public static byte[] QuickslotMappedInit(MapleQuickslotBinding pQuickslot)
|
||||
{
|
||||
public static byte[] QuickslotMappedInit(MapleQuickslotBinding pQuickslot) {
|
||||
final MaplePacketLittleEndianWriter pOutPacket = new MaplePacketLittleEndianWriter();
|
||||
|
||||
pOutPacket.writeShort(SendOpcode.QUICKSLOT_INIT.getValue());
|
||||
@@ -3678,7 +3678,7 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
public static byte[] getInventoryFull() {
|
||||
return modifyInventory(true, Collections.<ModifyInventory>emptyList());
|
||||
return modifyInventory(true, Collections.emptyList());
|
||||
}
|
||||
|
||||
public static byte[] getShowInventoryFull() {
|
||||
@@ -3790,7 +3790,6 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oid
|
||||
* @param remhppercentage
|
||||
* @return
|
||||
@@ -4539,7 +4538,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a Heracle/guild message packet.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>code</code>:<br> 28: guild name already in use<br>
|
||||
* 31: problem in locating players during agreement<br> 33/40: already joined a guild<br>
|
||||
* 35: Cannot make guild<br> 36: problem in player agreement<br> 38: problem during forming guild<br>
|
||||
@@ -4547,7 +4546,6 @@ public class PacketCreator {
|
||||
* 45/48: character not in guild<br> 52: problem in disbanding guild<br> 56: admin cannot make guild<br>
|
||||
* 57: problem in increasing guild size<br>
|
||||
*
|
||||
*
|
||||
* @param code The response code.
|
||||
* @return The guild message packet.
|
||||
*/
|
||||
@@ -4560,7 +4558,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a guild message packet appended with target name.
|
||||
*
|
||||
* <p>
|
||||
* 53: player not accepting guild invites<br>
|
||||
* 54: player already managing an invite<br> 55: player denied an invite<br>
|
||||
*
|
||||
@@ -6193,7 +6191,9 @@ public class PacketCreator {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.CANCEL_NAME_CHANGE_RESULT.getValue());
|
||||
mplew.writeBool(success);
|
||||
if(!success) mplew.write(0);
|
||||
if (!success) {
|
||||
mplew.write(0);
|
||||
}
|
||||
//mplew.writeMapleAsciiString("Custom message."); //only if ^ != 0
|
||||
return mplew.getPacket();
|
||||
}
|
||||
@@ -6202,7 +6202,9 @@ public class PacketCreator {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.CANCEL_TRANSFER_WORLD_RESULT.getValue());
|
||||
mplew.writeBool(success);
|
||||
if(!success) mplew.write(0);
|
||||
if (!success) {
|
||||
mplew.write(0);
|
||||
}
|
||||
//mplew.writeMapleAsciiString("Custom message."); //only if ^ != 0
|
||||
return mplew.getPacket();
|
||||
}
|
||||
@@ -6470,7 +6472,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Family Result Message
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br>
|
||||
* 64: You cannot add this character as a junior.
|
||||
* 65: The name could not be found or is not online.
|
||||
@@ -6512,7 +6514,9 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
public static byte[] getFamilyInfo(MapleFamilyEntry f) {
|
||||
if(f == null) return getEmptyFamilyInfo();
|
||||
if (f == null) {
|
||||
return getEmptyFamilyInfo();
|
||||
}
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.FAMILY_INFO_RESULT.getValue());
|
||||
mplew.writeInt(f.getReputation()); // cur rep left
|
||||
@@ -6564,34 +6568,50 @@ public class PacketCreator {
|
||||
}
|
||||
}
|
||||
for (MapleFamilyEntry junior : entry.getJuniors()) {
|
||||
if(junior == null) continue;
|
||||
if (junior == null) {
|
||||
continue;
|
||||
}
|
||||
entryCount++;
|
||||
for (MapleFamilyEntry superJunior : junior.getJuniors()) {
|
||||
if(superJunior == null) continue;
|
||||
if (superJunior == null) {
|
||||
continue;
|
||||
}
|
||||
entryCount++;
|
||||
superJuniors.add(superJunior);
|
||||
}
|
||||
}
|
||||
//write entries
|
||||
boolean missingEntries = entryCount == 2; //pedigree requires at least 3 entries to show leader, might only have 2 if leader's juniors leave
|
||||
if(missingEntries) entryCount++;
|
||||
if (missingEntries) {
|
||||
entryCount++;
|
||||
}
|
||||
mplew.writeInt(entryCount); //player count
|
||||
addPedigreeEntry(mplew, entry.getFamily().getLeader());
|
||||
if (entry.getSenior() != null) {
|
||||
if(entry.getSenior().getSenior() != null) addPedigreeEntry(mplew, entry.getSenior().getSenior());
|
||||
if (entry.getSenior().getSenior() != null) {
|
||||
addPedigreeEntry(mplew, entry.getSenior().getSenior());
|
||||
}
|
||||
addPedigreeEntry(mplew, entry.getSenior());
|
||||
}
|
||||
addPedigreeEntry(mplew, entry);
|
||||
if (hasOtherJunior) { //must be sent after own entry
|
||||
MapleFamilyEntry otherJunior = entry.getSenior().getOtherJunior(entry);
|
||||
if(otherJunior != null) addPedigreeEntry(mplew, otherJunior);
|
||||
if (otherJunior != null) {
|
||||
addPedigreeEntry(mplew, otherJunior);
|
||||
}
|
||||
}
|
||||
if (missingEntries) {
|
||||
addPedigreeEntry(mplew, entry);
|
||||
}
|
||||
if(missingEntries) addPedigreeEntry(mplew, entry);
|
||||
for (MapleFamilyEntry junior : entry.getJuniors()) {
|
||||
if(junior == null) continue;
|
||||
if (junior == null) {
|
||||
continue;
|
||||
}
|
||||
addPedigreeEntry(mplew, junior);
|
||||
for (MapleFamilyEntry superJunior : junior.getJuniors()) {
|
||||
if(superJunior != null) addPedigreeEntry(mplew, superJunior);
|
||||
if (superJunior != null) {
|
||||
addPedigreeEntry(mplew, superJunior);
|
||||
}
|
||||
}
|
||||
}
|
||||
mplew.writeInt(2 + superJuniors.size()); //member info count
|
||||
@@ -6788,7 +6808,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Sends a report response
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>mode</code>:<br> 0: You have succesfully
|
||||
* reported the user.<br> 1: Unable to locate the user.<br> 2: You may only
|
||||
* report users 10 times a day.<br> 3: You have been reported to the GM's by
|
||||
@@ -7058,7 +7078,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a gm effect packet (ie. hide, banned, etc.)
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 0x04: You have successfully
|
||||
* blocked access.<br>
|
||||
* 0x05: The unblocking has been successful.<br> 0x06 with Mode 0: You have
|
||||
@@ -7489,7 +7509,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a "block" packet (ie. the cash shop is unavailable, etc)
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 1: The portal is closed for
|
||||
* now.<br> 2: You cannot go to that place.<br> 3: Unable to approach due to
|
||||
* the force of the ground.<br> 4: You cannot teleport to or on this
|
||||
@@ -7509,7 +7529,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Gets a "block" packet (ie. the cash shop is unavailable, etc)
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 1: You cannot move that
|
||||
* channel. Please try again later.<br> 2: You cannot go into the cash shop.
|
||||
* Please try again later.<br> 3: The Item-Trading Shop is currently
|
||||
@@ -7538,7 +7558,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Sends a "levelup" packet to the guild or family.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 0: <Family> ? has reached Lv.
|
||||
* ?.<br> - The Reps you have received from ? will be reduced in half. 1:
|
||||
* <Family> ? has reached Lv. ?.<br> 2: <Guild> ? has reached Lv. ?.<br>
|
||||
@@ -7558,7 +7578,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Sends a "married" packet to the guild or family.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 0: <Guild ? is now married.
|
||||
* Please congratulate them.<br> 1: <Family ? is now married. Please
|
||||
* congratulate them.<br>
|
||||
@@ -7577,7 +7597,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Sends a "job advance" packet to the guild or family.
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>type</code>:<br> 0: <Guild ? has advanced to
|
||||
* a(an) ?.<br> 1: <Family ? has advanced to a(an) ?.<br>
|
||||
*
|
||||
@@ -7595,7 +7615,6 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type - (0:Light&Long 1:Heavy&Short)
|
||||
* @param delay - seconds
|
||||
* @return
|
||||
@@ -7777,7 +7796,7 @@ public class PacketCreator {
|
||||
|
||||
/**
|
||||
* Sends a Snowball Message<br>
|
||||
*
|
||||
* <p>
|
||||
* Possible values for <code>message</code>:<br> 1: ... Team's snowball has
|
||||
* passed the stage 1.<br> 2: ... Team's snowball has passed the stage
|
||||
* 2.<br> 3: ... Team's snowball has passed the stage 3.<br> 4: ... Team is
|
||||
@@ -7785,7 +7804,6 @@ public class PacketCreator {
|
||||
* again<br>
|
||||
*
|
||||
* @param message
|
||||
*
|
||||
*/
|
||||
public static byte[] snowballMessage(int team, int message) {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(7);
|
||||
@@ -8301,7 +8319,6 @@ public class PacketCreator {
|
||||
*
|
||||
* @param charid - Needs the specific Character ID
|
||||
* @return The packet
|
||||
*
|
||||
*/
|
||||
public static byte[] removeDragon(int chrid) {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
@@ -8318,7 +8335,6 @@ public class PacketCreator {
|
||||
* @param remove whether or not the remove or add the specified layer.
|
||||
* @param layer the targeted layer for removal or addition.
|
||||
* @param transition the time it takes to transition the effect.
|
||||
*
|
||||
* @return a packet to change the background effect of a specified layer.
|
||||
*/
|
||||
public static byte[] changeBackgroundEffect(boolean remove, int layer, int transition) {
|
||||
@@ -8400,8 +8416,7 @@ public class PacketCreator {
|
||||
|
||||
mplew.write(bHasPrize);
|
||||
|
||||
if(bHasPrize != 0)
|
||||
{
|
||||
if (bHasPrize != 0) {
|
||||
mplew.writeInt(nItemID1);
|
||||
mplew.writeInt(nItemID2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user