Initial Repository Push

This commit is contained in:
2022-04-30 09:41:17 -04:00
parent d4eef9097a
commit bbfdde57a3
835 changed files with 168392 additions and 0 deletions
@@ -0,0 +1,129 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class AppointGroupLeaderMsg extends ClientNetMsg {
private int targetType;
private int targetID;
private int response;
private String message;
/**
* This is the general purpose constructor.
*/
public AppointGroupLeaderMsg() {
super(Protocol.GROUPLEADERAPPOINT);
this.message = "You are already the group leader";
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
* past the limit) then this constructor Throws that Exception to the
* caller.
*/
public AppointGroupLeaderMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.GROUPLEADERAPPOINT, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(this.targetType);
writer.putInt(this.targetID);
writer.putInt(this.response);
if (this.response == 1)
writer.putString(this.message);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.targetType = reader.getInt();
this.targetID = reader.getInt();
this.response = reader.getInt();
if (this.response == 1)
this.message = reader.getString();
}
/**
* @return the targetType
*/
public int getTargetType() {
return targetType;
}
/**
* @param targetType
* the targetType to set
*/
public void setTargetType(int targetType) {
this.targetType = targetType;
}
/**
* @return the targetID
*/
public int getTargetID() {
return targetID;
}
/**
* @param targetID
* the targetID to set
*/
public void setTargetID(int targetID) {
this.targetID = targetID;
}
/**
* @return the response
*/
public int getResponse() {
return response;
}
/**
* @param response
* the response to set
*/
public void setResponse(int response) {
this.response = response;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message
* the message to set
*/
public void setMessage(String message) {
this.message = message;
}
}
@@ -0,0 +1,69 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class DisbandGroupMsg extends ClientNetMsg {
private int unknown01;
/**
* This is the general purpose constructor.
*/
public DisbandGroupMsg() {
super(Protocol.GROUPDISBAND);
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the ByteBuffer into a message. If a BufferUnderflow occurs (based on reading past the limit) then this constructor Throws that Exception to the caller.
*/
public DisbandGroupMsg(AbstractConnection origin, ByteBufferReader reader)
{
super(Protocol.GROUPDISBAND, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(this.unknown01);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.unknown01 = reader.getInt();
}
/**
* @return the unknown01
*/
public int getUnknown01() {
return unknown01;
}
/**
* @param unknown01
* the unknown01 to set
*/
public void setUnknown01(int unknown01) {
this.unknown01 = unknown01;
}
}
@@ -0,0 +1,112 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class FormationFollowMsg extends ClientNetMsg {
private boolean follow;
private int formation;
private int unknown01;
/**
* This is the general purpose constructor.
*/
public FormationFollowMsg() {
super(Protocol.GROUPFOLLOW);
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the ByteBuffer into a message. If a BufferUnderflow occurs (based on reading past the limit) then this constructor Throws that Exception to the caller.
*/
public FormationFollowMsg(AbstractConnection origin, ByteBufferReader reader)
{
super(Protocol.GROUPFOLLOW, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
if (this.follow) {
writer.putInt(1);
writer.putInt(0);
} else {
writer.putInt(0);
writer.putInt(1);
}
writer.putInt(this.formation);
writer.putInt(this.unknown01);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.follow = reader.getInt() == 1;
reader.getInt();
this.formation = reader.getInt();
this.unknown01 = reader.getInt();
}
/**
* @return the follow
*/
public boolean isFollow() {
return follow;
}
/**
* @param follow
* the follow to set
*/
public void setFollow(boolean follow) {
this.follow = follow;
}
/**
* @return the formation
*/
public int getFormation() {
return formation;
}
/**
* @param formation
* the formation to set
*/
public void setFormation(int formation) {
this.formation = formation;
}
/**
* @return the unknown01
*/
public int getUnknown01() {
return unknown01;
}
/**
* @param unknown01
* the unknown01 to set
*/
public void setUnknown01(int unknown01) {
this.unknown01 = unknown01;
}
}
@@ -0,0 +1,220 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class GroupInviteMsg extends ClientNetMsg {
private int sourceType;
private int sourceID;
private int targetType;
private int targetID;
private int groupType;
private int groupID;
private int unknown01;
private int invited;
private String name;
/**
* This is the general purpose constructor.
*/
public GroupInviteMsg() {
super(Protocol.INVITEGROUP);
this.name = "";
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
* past the limit) then this constructor Throws that Exception to the
* caller.
*/
public GroupInviteMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.INVITEGROUP, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(this.sourceType);
writer.putInt(this.sourceID);
writer.putInt(this.targetType);
writer.putInt(this.targetID);
writer.putInt(this.groupType);
writer.putInt(this.groupID);
writer.putInt(this.unknown01);
writer.putInt(this.invited);
if (this.invited == 1)
writer.putString(this.name);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.sourceType = reader.getInt();
this.sourceID = reader.getInt();
this.targetType = reader.getInt();
this.targetID = reader.getInt();
this.groupType = reader.getInt();
this.groupID = reader.getInt();
this.unknown01 = reader.getInt();
this.invited = reader.getInt();
if (this.invited == 1)
this.name = reader.getString();
}
/**
* @return the sourceType
*/
public int getSourceType() {
return sourceType;
}
/**
* @param sourceType
* the sourceType to set
*/
public void setSourceType(int sourceType) {
this.sourceType = sourceType;
}
/**
* @return the sourceID
*/
public int getSourceID() {
return sourceID;
}
/**
* @param sourceID
* the sourceID to set
*/
public void setSourceID(int sourceID) {
this.sourceID = sourceID;
}
/**
* @return the targetType
*/
public int getTargetType() {
return targetType;
}
/**
* @param targetType
* the targetType to set
*/
public void setTargetType(int targetType) {
this.targetType = targetType;
}
/**
* @return the targetID
*/
public int getTargetID() {
return targetID;
}
/**
* @param targetID
* the targetID to set
*/
public void setTargetID(int targetID) {
this.targetID = targetID;
}
/**
* @return the groupType
*/
public int getGroupType() {
return groupType;
}
/**
* @param groupType
* the groupType to set
*/
public void setGroupType(int groupType) {
this.groupType = groupType;
}
/**
* @return the groupID
*/
public int getGroupID() {
return groupID;
}
/**
* @param groupID
* the groupID to set
*/
public void setGroupID(int groupID) {
this.groupID = groupID;
}
/**
* @return the unknown01
*/
public int getUnknown01() {
return unknown01;
}
/**
* @param unknown01
* the unknown01 to set
*/
public void setUnknown01(int unknown01) {
this.unknown01 = unknown01;
}
/**
* @return the invited
*/
public int getInvited() {
return invited;
}
/**
* @param invited
* the invited to set
*/
public void setInvited(int invited) {
this.invited = invited;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
}
@@ -0,0 +1,123 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class GroupInviteResponseMsg extends ClientNetMsg {
private int groupType;
private int groupID;
private int unknown01;
private int unknown02;
/**
* This is the general purpose constructor.
*/
public GroupInviteResponseMsg() {
super(Protocol.JOINGROUP);
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the ByteBuffer into a message. If a BufferUnderflow occurs (based on reading past the limit) then this constructor Throws that Exception to the caller.
*/
public GroupInviteResponseMsg(AbstractConnection origin, ByteBufferReader reader)
{
super(Protocol.JOINGROUP, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(this.groupType);
writer.putInt(this.groupID);
writer.putInt(this.unknown01);
writer.putInt(this.unknown02);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.groupType = reader.getInt();
this.groupID = reader.getInt();
this.unknown01 = reader.getInt();
this.unknown02 = reader.getInt();
}
/**
* @return the groupType
*/
public int getGroupType() {
return groupType;
}
/**
* @param groupType
* the groupType to set
*/
public void setGroupType(int groupType) {
this.groupType = groupType;
}
/**
* @return the groupID
*/
public int getGroupID() {
return groupID;
}
/**
* @param groupID
* the groupID to set
*/
public void setGroupID(int groupID) {
this.groupID = groupID;
}
/**
* @return the unknown01
*/
public int getUnknown01() {
return unknown01;
}
/**
* @param unknown01
* the unknown01 to set
*/
public void setUnknown01(int unknown01) {
this.unknown01 = unknown01;
}
/**
* @return the unknown02
*/
public int getUnknown02() {
return unknown02;
}
/**
* @param unknown02
* the unknown02 to set
*/
public void setUnknown02(int unknown02) {
this.unknown02 = unknown02;
}
}
@@ -0,0 +1,352 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.Enum.GameObjectType;
import engine.gameManager.GroupManager;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
import engine.objects.Group;
import engine.objects.PlayerCharacter;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
//See GroupUpdateMsgBreakdown.txt is SBData directory.
public class GroupUpdateMsg extends ClientNetMsg {
private int messageType;
private int unknown02;
private int playerUUID;
private Set<PlayerCharacter> players;
private Group group;
/**
* This is the general purpose constructor.
*/
public GroupUpdateMsg() {
super(Protocol.UPDATEGROUP);
this.messageType = 1;
this.unknown02 = 1;
this.playerUUID = 0;
this.players = Collections.newSetFromMap(new ConcurrentHashMap<>());
}
public GroupUpdateMsg(int messageType, int unknown02, Set<PlayerCharacter> players, Group group) {
super(Protocol.UPDATEGROUP);
this.messageType = messageType;
this.unknown02 = unknown02;
this.playerUUID = 0;
this.players = players;
this.group = group;
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
* past the limit) then this constructor Throws that Exception to the
* caller.
*/
public GroupUpdateMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.UPDATEGROUP, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(GameObjectType.Group.ordinal());
writer.putInt(this.group.getObjectUUID());
writer.putInt(this.messageType);
// 5 breaks everything including movement etc
// 4 sends a party dissolved message
// 3 closes the group window and leaves the group
// 2 seems to update the location but not the stats correctly upon coming back into range
// 1 seems to add you to the group but if called by a job tops up your stats on the client and desyncs it
switch (messageType) {
case 4:
GroupUpdateMsg._serializeFour(writer);
break;
case 5:
this._serializeFive(writer);
break;
case 6:
this._serializeSix(writer);
break;
case 7:
this._serializeSeven(writer);
break;
case 8:
this._serializeEight(writer);
break;
default:
writer.putInt(this.unknown02);
// Send player data
writer.putInt(this.players.size());
int i = 0;
for (PlayerCharacter pc : this.players) {
this.serializePlayer(writer, pc, this.messageType, i++);
}
writer.putInt(0); // end data
break;
}
}
// *** Refactor: This method is an abortion. Needs to be re-written from scratch.
private void serializePlayer(ByteBufferWriter writer, PlayerCharacter player, int messageType, int count) {
if (messageType == 1) {
writer.putString((player != null) ? player.getFirstName() : "nullError");
writer.putString((player != null) ? player.getLastName() : "");
} else if (messageType == 2) {
if (count == 0) {
writer.putString((player != null) ? player.getFirstName() : "nullError");
writer.putString((player != null) ? player.getLastName() : "");
} else {
writer.putInt(0);
}
} else if (messageType == 3) {
writer.putString(" ");
writer.putString(" ");
} else {
writer.putInt(0);
writer.putInt(0);
}
if (messageType == 3) {
for (int i = 0; i < 6; i++) {
writer.putInt(0);
}
} else {
// mana health stam %
writer.putInt((int) (player.getHealth() / player.getHealthMax() * 100)); // should be health but does nothing
writer.putInt((int) (player.getStamina() / player.getStaminaMax() * 100)); // stam %
writer.putInt((int) (player.getMana() / player.getManaMax() * 100)); // mana %
writer.putInt((player != null) ? Float.floatToIntBits(player.getLoc().getX()) : 0);
writer.putInt((player != null) ? Float.floatToIntBits(player.getLoc().getY()) : 0);
writer.putInt((player != null) ? Float.floatToIntBits(player.getLoc().getZ()) : 0);
}
if (player == null)
writer.putLong(0);
else {
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
writer.putInt(player.getObjectUUID());
}
if (messageType == 3) {
writer.putInt(0);
writer.putInt(-1);
writer.putInt(0);
return;
} else if (messageType == 5) {
writer.putInt(0);
writer.putInt(0);
return;
}
if (group != null && player != null) {
writer.putInt((this.group.getGroupLead() == player) ? 2 : 1);
} else {
writer.putInt(1);
}
if (messageType == 2) {
writer.putInt(-1);
writer.putInt(0);
return;
}
writer.putInt(1);
writer.putInt(1);
writer.put((byte) 1);
// if sending message type 1 this seems to make the group window flicker the button
// i think getfollow and split gold might be the wrong way around
if (group != null) {
writer.put(this.group.getSplitGold() ? (byte) 1 : (byte) 0);
} else {
writer.put((byte) 0);
}
// always gets reset on a message type 1
if (player != null) {
writer.put(player.getFollow() ? (byte) 1 : (byte) 0);
} else {
writer.put((byte) 0);
}
}
private static void _serializeFour(ByteBufferWriter writer) {
// 4 sends a party dissolved window
for (int i = 0; i < 3; i++) {
writer.putInt(0);
}
}
//sync player's stats and position
private void _serializeFive(ByteBufferWriter writer) {
writer.putInt(1);
writer.putInt(players.size() - 1);
for (PlayerCharacter player : players) {
if (player.getObjectUUID() == this.playerUUID) {
continue; //skip self
}
writer.putInt((int) (player.getHealth() / player.getHealthMax() * 100));
writer.putInt((int) (player.getStamina() / player.getStaminaMax() * 100));
writer.putInt((int) (player.getMana() / player.getManaMax() * 100));
writer.putFloat(player.getLoc().x);
writer.putFloat(player.getLoc().y);
writer.putFloat(player.getLoc().z);
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
writer.putInt(player.getObjectUUID());
}
writer.putInt(0);
writer.putInt(0);
}
private void _serializeSix(ByteBufferWriter writer) {
writer.putInt(0);
if (this.group != null) {
writer.put(this.group.getSplitGold() ? (byte) 1 : (byte) 0);
} else {
writer.put((byte) 0);
}
writer.putInt(0);
writer.putInt(0);
}
private void _serializeSeven(ByteBufferWriter writer) {
PlayerCharacter player = this.players.iterator().next();
writer.putInt(0);
if (player != null) {
writer.put(player.getFollow() ? (byte) 1 : (byte) 0);
} else {
writer.put((byte) 0);
}
writer.putInt(0);
writer.putInt(0);
}
private void _serializeEight(ByteBufferWriter writer) {
PlayerCharacter player = this.players.iterator().next();;
writer.putInt(0);
if (player != null) {
writer.put(player.getFollow() ? (byte) 1 : (byte) 0);
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
writer.putInt(player.getObjectUUID());
} else {
writer.put((byte) 0);
writer.putLong(0L);
}
writer.putInt(0);
writer.putInt(0);
}
/**
* Deserializes the subclass specific items from the supplied
* ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.players = Collections.newSetFromMap(new ConcurrentHashMap<>());
reader.getInt();
this.group = GroupManager.getGroup(reader.getInt());
// TODO figure this mess out
}
public void addPlayer(PlayerCharacter value) {
this.players.add(value);
}
public void setPlayer(PlayerCharacter value) {
this.players.clear();
this.players.add(value);
}
/**
* @return the messageType
*/
public int getMessageType() {
return messageType;
}
/**
* @param messageType the messageType to set
*/
public void setMessageType(int messageType) {
this.messageType = messageType;
}
/**
* @return the unknown02
*/
public int getUnknown02() {
return unknown02;
}
/**
* @param unknown02 the unknown02 to set
*/
public void setUnknown02(int unknown02) {
this.unknown02 = unknown02;
}
/**
* @return the playerUUID
*/
public long getPlayerID() {
return playerUUID;
}
/**
* @param playerUUID the playerUUID to set
*/
public void setPlayerUUID(int playerUUID) {
this.playerUUID = playerUUID;
}
/**
* @return the players
*/
public Set<PlayerCharacter> getPlayers() {
return players;
}
/**
* @param players the players to set
*/
public void setPlayers(Set<PlayerCharacter> players) {
this.players = players;
}
/**
* @return the group
*/
public Group getGroup() {
return group;
}
/**
* @param group the group to set
*/
public void setGroup(Group group) {
this.group = group;
}
}
@@ -0,0 +1,122 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class LeaveGroupMsg extends ClientNetMsg {
private int unknown01;
private int unknown02;
private int unknown03;
private int unknown04;
/**
* This is the general purpose constructor.
*/
public LeaveGroupMsg() {
super(Protocol.LEAVEGROUP);
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the ByteBuffer into a message. If a BufferUnderflow occurs (based on reading past the limit) then this constructor Throws that Exception to the caller.
*/
public LeaveGroupMsg(AbstractConnection origin, ByteBufferReader reader)
{
super(Protocol.LEAVEGROUP, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(this.unknown01);
writer.putInt(this.unknown02);
writer.putInt(this.unknown03);
writer.putInt(this.unknown04);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.unknown01 = reader.getInt();
this.unknown02 = reader.getInt();
this.unknown03 = reader.getInt();
this.unknown04 = reader.getInt();
}
/**
* @return the unknown01
*/
public int getUnknown01() {
return unknown01;
}
/**
* @param unknown01
* the unknown01 to set
*/
public void setUnknown01(int unknown01) {
this.unknown01 = unknown01;
}
/**
* @return the unknown02
*/
public int getUnknown02() {
return unknown02;
}
/**
* @param unknown02
* the unknown02 to set
*/
public void setUnknown02(int unknown02) {
this.unknown02 = unknown02;
}
/**
* @return the unknown03
*/
public int getUnknown03() {
return unknown03;
}
/**
* @param unknown03
* the unknown03 to set
*/
public void setUnknown03(int unknown03) {
this.unknown03 = unknown03;
}
/**
* @return the unknown04
*/
public int getUnknown04() {
return unknown04;
}
/**
* @param unknown04
* the unknown04 to set
*/
public void setUnknown04(int unknown04) {
this.unknown04 = unknown04;
}
}
@@ -0,0 +1,129 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class RemoveFromGroupMsg extends ClientNetMsg {
private int targetType;
private int targetID;
private int response;
private String message;
/**
* This is the general purpose constructor.
*/
public RemoveFromGroupMsg() {
super(Protocol.GROUPREMOVE);
this.message = "Quit if you want to remove yourself";
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
* past the limit) then this constructor Throws that Exception to the
* caller.
*/
public RemoveFromGroupMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.GROUPREMOVE, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(this.targetType);
writer.putInt(this.targetID);
writer.putInt(this.response);
if (this.response == 1)
writer.putString(this.message);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.targetType = reader.getInt();
this.targetID = reader.getInt();
this.response = reader.getInt();
if (this.response == 1)
this.message = reader.getString();
}
/**
* @return the targetType
*/
public int getTargetType() {
return targetType;
}
/**
* @param targetType
* the targetType to set
*/
public void setTargetType(int targetType) {
this.targetType = targetType;
}
/**
* @return the targetID
*/
public int getTargetID() {
return targetID;
}
/**
* @param targetID
* the targetID to set
*/
public void setTargetID(int targetID) {
this.targetID = targetID;
}
/**
* @return the response
*/
public int getResponse() {
return response;
}
/**
* @param response
* the response to set
*/
public void setResponse(int response) {
this.response = response;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @param message
* the message to set
*/
public void setMessage(String message) {
this.message = message;
}
}
@@ -0,0 +1,72 @@
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.net.client.msg.group;
import engine.net.AbstractConnection;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.client.Protocol;
import engine.net.client.msg.ClientNetMsg;
public class ToggleGroupSplitMsg extends ClientNetMsg {
private int unknown01;
/**
* This is the general purpose constructor.
*/
public ToggleGroupSplitMsg() {
super(Protocol.GROUPTREASURE);
this.unknown01 = 1;
}
/**
* This constructor is used by NetMsgFactory. It attempts to deserialize the
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
* past the limit) then this constructor Throws that Exception to the
* caller.
*/
public ToggleGroupSplitMsg(AbstractConnection origin, ByteBufferReader reader) {
super(Protocol.GROUPTREASURE, origin, reader);
}
/**
* Serializes the subclass specific items to the supplied ByteBufferWriter.
*/
@Override
protected void _serialize(ByteBufferWriter writer) {
writer.putInt(this.unknown01);
}
/**
* Deserializes the subclass specific items from the supplied ByteBufferReader.
*/
@Override
protected void _deserialize(ByteBufferReader reader) {
this.unknown01 = reader.getInt();
}
/**
* @return the unknown01
*/
public int getUnknown01() {
return unknown01;
}
/**
* @param unknown01
* the unknown01 to set
*/
public void setUnknown01(int unknown01) {
this.unknown01 = unknown01;
}
}