Reformat entire PacketCreator
This commit is contained in:
1 parent
e184f25184
commit
e93428f457
1 file changed
+115
-100
@@ -78,7 +78,6 @@ import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Frz
|
||||
*/
|
||||
public class PacketCreator {
|
||||
@@ -211,7 +210,7 @@ public class PacketCreator {
|
||||
Set<NewYearCardRecord> received = chr.getReceivedNewYearRecords();
|
||||
|
||||
mplew.writeShort(received.size());
|
||||
for(NewYearCardRecord nyc : received) {
|
||||
for (NewYearCardRecord nyc : received) {
|
||||
encodeNewYearCard(nyc, mplew);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -1464,7 +1463,7 @@ public class PacketCreator {
|
||||
mplew.writeShort(mobSkill.getSkillId());
|
||||
mplew.writeShort(mobSkill.getSkillLevel());
|
||||
|
||||
switch(s.getKey()) {
|
||||
switch (s.getKey()) {
|
||||
case WEAPON_REFLECT:
|
||||
pCounter = mobSkill.getX();
|
||||
break;
|
||||
@@ -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_
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1537,7 +1542,7 @@ public class PacketCreator {
|
||||
|
||||
if (life.getParentMobOid() != 0) {
|
||||
MapleMonster parentMob = life.getMap().getMonsterByOid(life.getParentMobOid());
|
||||
if(parentMob != null && parentMob.isAlive()) {
|
||||
if (parentMob != null && parentMob.isAlive()) {
|
||||
mplew.write(effect != 0 ? effect : -3);
|
||||
mplew.writeInt(life.getParentMobOid());
|
||||
} else {
|
||||
@@ -1860,7 +1865,7 @@ public class PacketCreator {
|
||||
*
|
||||
* @param guildName The Guild name, blank for nothing.
|
||||
*/
|
||||
public static byte[] guildNameChanged(int chrid, String guildName){
|
||||
public static byte[] guildNameChanged(int chrid, String guildName) {
|
||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.GUILD_NAME_CHANGED.getValue());
|
||||
mplew.writeInt(chrid);
|
||||
@@ -1868,7 +1873,7 @@ public class PacketCreator {
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
public static byte[] guildMarkChanged(int chrid, MapleGuild guild){
|
||||
public static byte[] guildMarkChanged(int chrid, MapleGuild guild) {
|
||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.GUILD_MARK_CHANGED.getValue());
|
||||
mplew.writeInt(chrid);
|
||||
@@ -2013,7 +2018,7 @@ public class PacketCreator {
|
||||
mplew.writeInt(chr.getItemEffect());
|
||||
mplew.writeInt(ItemConstants.getInventoryType(chr.getChair()) == MapleInventoryType.SETUP ? chr.getChair() : 0);
|
||||
|
||||
if(enteringField) {
|
||||
if (enteringField) {
|
||||
Point spawnPos = new Point(chr.getPosition());
|
||||
spawnPos.y -= 42;
|
||||
mplew.writePos(spawnPos);
|
||||
@@ -2079,11 +2084,11 @@ public class PacketCreator {
|
||||
|
||||
private static void encodeNewYearCardInfo(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
|
||||
Set<NewYearCardRecord> newyears = chr.getReceivedNewYearRecords();
|
||||
if(!newyears.isEmpty()) {
|
||||
if (!newyears.isEmpty()) {
|
||||
mplew.write(1);
|
||||
|
||||
mplew.writeInt(newyears.size());
|
||||
for(NewYearCardRecord nyc : newyears) {
|
||||
for (NewYearCardRecord nyc : newyears) {
|
||||
mplew.writeInt(nyc.getId());
|
||||
}
|
||||
} else {
|
||||
@@ -2304,14 +2309,14 @@ public class PacketCreator {
|
||||
private static void rebroadcastMovementList(LittleEndianWriter lew, SeekableLittleEndianAccessor slea, long movementDataLength) {
|
||||
//movement command length is sent by client, probably not a big issue? (could be calculated on server)
|
||||
//if multiple write/reads are slow, could use (and cache?) a byte[] buffer
|
||||
for(long i = 0; i < movementDataLength; i++) {
|
||||
for (long i = 0; i < movementDataLength; i++) {
|
||||
lew.write(slea.readByte());
|
||||
}
|
||||
}
|
||||
|
||||
private static void serializeMovementList(LittleEndianWriter lew, List<LifeMovementFragment> moves) {
|
||||
lew.write(moves.size());
|
||||
for(LifeMovementFragment move : moves) {
|
||||
for (LifeMovementFragment move : moves) {
|
||||
move.serialize(lew);
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -2680,7 +2687,7 @@ public class PacketCreator {
|
||||
mplew.writeInt(0);
|
||||
}
|
||||
mplew.writeInt(damage);
|
||||
if(skill != -4) {
|
||||
if (skill != -4) {
|
||||
mplew.writeInt(monsteridfrom);
|
||||
mplew.write(direction);
|
||||
if (pgmr) {
|
||||
@@ -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
|
||||
@@ -3384,8 +3385,8 @@ public class PacketCreator {
|
||||
mplew.writeMapleAsciiString(shop.getOwner().getName());
|
||||
|
||||
MapleCharacter[] visitors = shop.getVisitors();
|
||||
for(int i = 0; i < 3; i++) {
|
||||
if(visitors[i] != null) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (visitors[i] != null) {
|
||||
mplew.write(i + 1);
|
||||
addCharLook(mplew, visitors[i], false);
|
||||
mplew.writeMapleAsciiString(visitors[i].getName());
|
||||
@@ -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
|
||||
@@ -3818,7 +3817,7 @@ public class PacketCreator {
|
||||
private static Pair<Integer, Integer> normalizedCustomMaxHP(long currHP, long maxHP) {
|
||||
int sendHP, sendMaxHP;
|
||||
|
||||
if(maxHP <= Integer.MAX_VALUE) {
|
||||
if (maxHP <= Integer.MAX_VALUE) {
|
||||
sendHP = (int) currHP;
|
||||
sendMaxHP = (int) maxHP;
|
||||
} else {
|
||||
@@ -3893,7 +3892,7 @@ public class PacketCreator {
|
||||
if (partyDoors.size() > 0) {
|
||||
MapleDoor door = partyDoors.get(partycharid);
|
||||
|
||||
if(door != null) {
|
||||
if (door != null) {
|
||||
MapleDoorObject mdo = door.getAreaDoor();
|
||||
mplew.writeInt(mdo.getTo().getId());
|
||||
mplew.writeInt(mdo.getFrom().getId());
|
||||
@@ -4008,7 +4007,7 @@ public class PacketCreator {
|
||||
if (partychar.getChannel() == forchannel && !leaving) {
|
||||
if (partyDoors.size() > 0) {
|
||||
MapleDoor door = partyDoors.get(partychar.getId());
|
||||
if(door != null) {
|
||||
if (door != null) {
|
||||
MapleDoorObject mdo = door.getTownDoor();
|
||||
lew.writeInt(mdo.getTown().getId());
|
||||
lew.writeInt(mdo.getArea().getId());
|
||||
@@ -4415,7 +4414,7 @@ public class PacketCreator {
|
||||
mplew.writeShort(SendOpcode.FIELD_OBSTACLE_ONOFF_LIST.getValue());
|
||||
mplew.writeInt(envList.size());
|
||||
|
||||
for(Entry<String, Integer> envMove : envList) {
|
||||
for (Entry<String, Integer> envMove : envList) {
|
||||
mplew.writeMapleAsciiString(envMove.getKey());
|
||||
mplew.writeInt(envMove.getValue());
|
||||
}
|
||||
@@ -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>
|
||||
*
|
||||
@@ -5667,7 +5665,7 @@ public class PacketCreator {
|
||||
MaplePlayerShopItem item = hme.getLeft();
|
||||
AbstractMapleMapObject mo = hme.getRight();
|
||||
|
||||
if(mo instanceof MaplePlayerShop) {
|
||||
if (mo instanceof MaplePlayerShop) {
|
||||
MaplePlayerShop ps = (MaplePlayerShop) mo;
|
||||
MapleCharacter owner = ps.getOwner();
|
||||
|
||||
@@ -5931,37 +5929,37 @@ public class PacketCreator {
|
||||
Map<Short, Integer> equip = npc.getEquips();
|
||||
Map<Short, Integer> myEquip = new LinkedHashMap<>();
|
||||
Map<Short, Integer> maskedEquip = new LinkedHashMap<>();
|
||||
for(short position : equip.keySet()) {
|
||||
for (short position : equip.keySet()) {
|
||||
short pos = (byte) (position * -1);
|
||||
if(pos < 100 && myEquip.get(pos) == null) {
|
||||
if (pos < 100 && myEquip.get(pos) == null) {
|
||||
myEquip.put(pos, equip.get(position));
|
||||
} else if((pos > 100 && pos != 111) || pos == -128) { // don't ask. o.o
|
||||
} else if ((pos > 100 && pos != 111) || pos == -128) { // don't ask. o.o
|
||||
pos -= 100;
|
||||
if(myEquip.get(pos) != null) {
|
||||
if (myEquip.get(pos) != null) {
|
||||
maskedEquip.put(pos, myEquip.get(pos));
|
||||
}
|
||||
myEquip.put(pos, equip.get(position));
|
||||
} else if(myEquip.get(pos) != null) {
|
||||
} else if (myEquip.get(pos) != null) {
|
||||
maskedEquip.put(pos, equip.get(position));
|
||||
}
|
||||
}
|
||||
for(Entry<Short, Integer> entry : myEquip.entrySet()) {
|
||||
for (Entry<Short, Integer> entry : myEquip.entrySet()) {
|
||||
mplew.write(entry.getKey());
|
||||
mplew.writeInt(entry.getValue());
|
||||
}
|
||||
mplew.write(0xFF);
|
||||
for(Entry<Short, Integer> entry : maskedEquip.entrySet()) {
|
||||
for (Entry<Short, Integer> entry : maskedEquip.entrySet()) {
|
||||
mplew.write(entry.getKey());
|
||||
mplew.writeInt(entry.getValue());
|
||||
}
|
||||
mplew.write(0xFF);
|
||||
Integer cWeapon = equip.get((byte) -111);
|
||||
if(cWeapon != null) {
|
||||
if (cWeapon != null) {
|
||||
mplew.writeInt(cWeapon);
|
||||
} else {
|
||||
mplew.writeInt(0);
|
||||
}
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mplew.writeInt(0);
|
||||
}
|
||||
return mplew.getPacket();
|
||||
@@ -6133,10 +6131,10 @@ public class PacketCreator {
|
||||
mplew.write(error);
|
||||
mplew.writeInt(0);
|
||||
mplew.writeBool(error == 0); //0 = ?, otherwise list servers
|
||||
if(error == 0) {
|
||||
if (error == 0) {
|
||||
List<World> worlds = Server.getInstance().getWorlds();
|
||||
mplew.writeInt(worlds.size());
|
||||
for(World world : worlds) {
|
||||
for (World world : worlds) {
|
||||
mplew.writeMapleAsciiString(GameConstants.WORLD_NAMES[world.getId()]);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -6309,13 +6311,13 @@ public class PacketCreator {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.CASHSHOP_OPERATION.getValue());
|
||||
mplew.write(0x59);
|
||||
mplew.write((byte)cashItems.size());
|
||||
for(Item item : cashItems) {
|
||||
mplew.write((byte) cashItems.size());
|
||||
for (Item item : cashItems) {
|
||||
addCashItemInformation(mplew, item, accountId);
|
||||
}
|
||||
mplew.writeInt(maplePoints);
|
||||
mplew.writeInt(items.size());
|
||||
for(Pair<Integer, Integer> itemPair : items) {
|
||||
for (Pair<Integer, Integer> itemPair : items) {
|
||||
int quantity = itemPair.getLeft();
|
||||
mplew.writeShort((short) quantity); //quantity (0 = 1 for cash items)
|
||||
mplew.writeShort(0x1F); //0 = ?, >=0x20 = ?, <0x20 = ? (does nothing?)
|
||||
@@ -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
|
||||
@@ -6525,7 +6529,7 @@ public class PacketCreator {
|
||||
mplew.writeMapleAsciiString(f.getFamily().getName());
|
||||
mplew.writeMapleAsciiString(f.getFamily().getMessage()); //family message
|
||||
mplew.writeInt(MapleFamilyEntitlement.values().length); //Entitlement info count
|
||||
for(MapleFamilyEntitlement entitlement : MapleFamilyEntitlement.values()) {
|
||||
for (MapleFamilyEntitlement entitlement : MapleFamilyEntitlement.values()) {
|
||||
mplew.writeInt(entitlement.ordinal()); //ID
|
||||
mplew.writeInt(f.isEntitlementUsed(entitlement) ? 1 : 0); //Used count
|
||||
}
|
||||
@@ -6557,41 +6561,57 @@ public class PacketCreator {
|
||||
int entryCount = 2; //2 guaranteed, leader and self
|
||||
entryCount += Math.min(2, entry.getTotalSeniors());
|
||||
//needed since MaplePacketLittleEndianWriter doesn't have any seek functionality
|
||||
if(entry.getSenior() != null) {
|
||||
if(entry.getSenior().getJuniorCount() == 2) {
|
||||
if (entry.getSenior() != null) {
|
||||
if (entry.getSenior().getJuniorCount() == 2) {
|
||||
entryCount++;
|
||||
hasOtherJunior = true;
|
||||
}
|
||||
}
|
||||
for(MapleFamilyEntry junior : entry.getJuniors()) {
|
||||
if(junior == null) continue;
|
||||
for (MapleFamilyEntry junior : entry.getJuniors()) {
|
||||
if (junior == null) {
|
||||
continue;
|
||||
}
|
||||
entryCount++;
|
||||
for(MapleFamilyEntry superJunior : junior.getJuniors()) {
|
||||
if(superJunior == null) continue;
|
||||
for (MapleFamilyEntry superJunior : junior.getJuniors()) {
|
||||
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() != null) {
|
||||
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
|
||||
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);
|
||||
}
|
||||
for (MapleFamilyEntry junior : entry.getJuniors()) {
|
||||
if (junior == null) {
|
||||
continue;
|
||||
}
|
||||
if(missingEntries) addPedigreeEntry(mplew, entry);
|
||||
for(MapleFamilyEntry junior : entry.getJuniors()) {
|
||||
if(junior == null) continue;
|
||||
addPedigreeEntry(mplew, junior);
|
||||
for(MapleFamilyEntry superJunior : junior.getJuniors()) {
|
||||
if(superJunior != null) addPedigreeEntry(mplew, superJunior);
|
||||
for (MapleFamilyEntry superJunior : junior.getJuniors()) {
|
||||
if (superJunior != null) {
|
||||
addPedigreeEntry(mplew, superJunior);
|
||||
}
|
||||
}
|
||||
}
|
||||
mplew.writeInt(2 + superJuniors.size()); //member info count
|
||||
@@ -6600,7 +6620,7 @@ public class PacketCreator {
|
||||
mplew.writeInt(entry.getFamily().getTotalMembers());
|
||||
mplew.writeInt(0);
|
||||
mplew.writeInt(entry.getTotalSeniors()); //client subtracts provided seniors
|
||||
for(MapleFamilyEntry superJunior : superJuniors) {
|
||||
for (MapleFamilyEntry superJunior : superJuniors) {
|
||||
mplew.writeInt(superJunior.getChrId());
|
||||
mplew.writeInt(superJunior.getTotalJuniors());
|
||||
}
|
||||
@@ -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
|
||||
@@ -7180,14 +7200,14 @@ public class PacketCreator {
|
||||
}
|
||||
|
||||
// Cash Shop Surprise packets found thanks to Arnah (Vertisy)
|
||||
public static byte[] onCashItemGachaponOpenFailed(){
|
||||
public static byte[] onCashItemGachaponOpenFailed() {
|
||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.CASHSHOP_CASH_ITEM_GACHAPON_RESULT.getValue());
|
||||
mplew.write(0xE4);
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
public static byte[] onCashGachaponOpenSuccess(int accountid, long sn, int remainingBoxes, Item item, int itemid, int nSelectedItemCount, boolean bJackpot){
|
||||
public static byte[] onCashGachaponOpenSuccess(int accountid, long sn, int remainingBoxes, Item item, int itemid, int nSelectedItemCount, boolean bJackpot) {
|
||||
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.CASHSHOP_CASH_ITEM_GACHAPON_RESULT.getValue());
|
||||
mplew.write(0xE5); // subopcode thanks to Ubaware
|
||||
@@ -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
|
||||
@@ -7682,7 +7701,7 @@ public class PacketCreator {
|
||||
mplew.writeInt(ring.getItemId());
|
||||
}
|
||||
|
||||
if(chr.getPartnerId() > 0) {
|
||||
if (chr.getPartnerId() > 0) {
|
||||
MapleRing marriageRing = chr.getMarriageRing();
|
||||
|
||||
mplew.writeShort(1);
|
||||
@@ -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) {
|
||||
@@ -8352,7 +8368,7 @@ public class PacketCreator {
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
private static byte[] MassacreResult(byte nRank,int nIncExp) {
|
||||
private static byte[] MassacreResult(byte nRank, int nIncExp) {
|
||||
//CField_MassacreResult__OnMassacreResult @ 0x005617C5
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.PYRAMID_SCORE.getValue()); //MASSACRERESULT | 0x009E
|
||||
@@ -8390,7 +8406,7 @@ public class PacketCreator {
|
||||
return mplew.getPacket();
|
||||
}
|
||||
|
||||
private static byte[] Tournament__SetPrize(byte bSetPrize, byte bHasPrize,int nItemID1,int nItemID2) {
|
||||
private static byte[] Tournament__SetPrize(byte bSetPrize, byte bHasPrize, int nItemID1, int nItemID2) {
|
||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||
mplew.writeShort(SendOpcode.TOURNAMENT_SET_PRIZE.getValue());
|
||||
|
||||
@@ -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