forked from MagicBane/Server
Initial Repository Push
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class AbandonAssetMsg extends ClientNetMsg {
|
||||
|
||||
private int pad = 0;
|
||||
private int objectType;
|
||||
private int objectUUID;
|
||||
|
||||
/**
|
||||
* 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 AbandonAssetMsg(AbstractConnection origin, ByteBufferReader reader){
|
||||
super(Protocol.ABANDONASSET, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.pad = reader.getInt();
|
||||
this.objectType = reader.getInt();
|
||||
this.objectUUID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(this.pad);
|
||||
writer.putInt(this.objectType);
|
||||
writer.putInt(this.objectUUID);
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(int value) {
|
||||
this.objectType = value;
|
||||
}
|
||||
|
||||
public void setPad(int value) {
|
||||
this.pad = value;
|
||||
}
|
||||
|
||||
public int getUUID() {
|
||||
return objectUUID;
|
||||
|
||||
}
|
||||
|
||||
public int getPad() {
|
||||
return pad;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
HashSet<Integer> playerFriendSet = PlayerFriendsMap.get(playerUID);
|
||||
playerFriendSet.add(friendUID); * Copyright 2013 MagicBane Emulator Project
|
||||
* All Rights Reserved
|
||||
*/
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
public class AcceptFriendMsg extends ClientNetMsg {
|
||||
|
||||
public String sourceName;
|
||||
public String friendName;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public AcceptFriendMsg(PlayerCharacter pc) {
|
||||
super(Protocol.FRIENDACCEPT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AcceptFriendMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.FRIENDACCEPT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public AcceptFriendMsg(AcceptFriendMsg msg) {
|
||||
super(Protocol.FRIENDACCEPT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
//Do we even want to try this?
|
||||
this.sourceName = reader.getString(); //This is source name.. this friends list must never been updated since launch, not using IDS.
|
||||
this.friendName = reader.getString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putString(this.sourceName);
|
||||
writer.putString(this.friendName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
/**
|
||||
* Accept trade request
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class AcceptTradeRequestMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01; //pad?
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public AcceptTradeRequestMsg(int unknown01, AbstractGameObject player, AbstractGameObject target) {
|
||||
super(Protocol.REQUESTTRADEOK);
|
||||
this.unknown01 = unknown01;
|
||||
this.playerType = player.getObjectType().ordinal();
|
||||
this.playerID =player.getObjectUUID();
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID =target.getObjectUUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AcceptTradeRequestMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.REQUESTTRADEOK, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
playerType = reader.getInt();
|
||||
playerID = reader.getInt();
|
||||
targetType = reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putInt(targetType);
|
||||
writer.putInt(targetID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown01
|
||||
*/
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown01 the unknown01 to set
|
||||
*/
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public int getPlayerType() {
|
||||
return playerType;
|
||||
}
|
||||
|
||||
public void setPlayerType(int playerType) {
|
||||
this.playerType = playerType;
|
||||
}
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public void setTargetType(int targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setTargetID(int targetID) {
|
||||
this.targetID = targetID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
* Bank window opened
|
||||
*
|
||||
* @author Burfo
|
||||
*/
|
||||
public class AckBankWindowOpenedMsg extends ClientNetMsg {
|
||||
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private long unknown01; // possibly NPC ID?
|
||||
private long unknown02;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public AckBankWindowOpenedMsg(PlayerCharacter pc, long unknown01, long unknown02) {
|
||||
super(Protocol.COSTTOOPENBANK);
|
||||
this.playerType = pc.getObjectType().ordinal();
|
||||
this.playerID = pc.getObjectUUID();
|
||||
this.unknown01 = unknown01;
|
||||
this.unknown02 = unknown02;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AckBankWindowOpenedMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.COSTTOOPENBANK, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
playerType = reader.getInt();
|
||||
playerID = reader.getInt();
|
||||
unknown01 = reader.getLong();
|
||||
unknown02 = reader.getLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putLong(unknown01);
|
||||
writer.putLong(unknown02);
|
||||
}
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
public int getPlayerType() {
|
||||
return playerType;
|
||||
}
|
||||
|
||||
public void setPlayerType(int playerType) {
|
||||
this.playerType = playerType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ActivateNPCMessage extends ClientNetMsg {
|
||||
|
||||
private ArrayList<Item> ItemList;
|
||||
private int unknown01;
|
||||
private int unknown02;
|
||||
private int buildingUUID;
|
||||
private int unknown03;
|
||||
private int unknown04;
|
||||
private int unknown05;
|
||||
private int size;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ActivateNPCMessage() {
|
||||
this(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
*/
|
||||
public ActivateNPCMessage(ArrayList<Item> items) {
|
||||
super(Protocol.ACTIVATENPC);
|
||||
this.unknown01 = 0;
|
||||
this.size = 0;
|
||||
this.ItemList = items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ActivateNPCMessage(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ACTIVATENPC, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
//Larger size for historically larger opcodes
|
||||
return (16); // 2^16 == 64k
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.putInt(this.size);
|
||||
for (Item item : this.ItemList) {
|
||||
writer.putInt(item.getObjectType().ordinal());
|
||||
writer.putInt(item.getObjectUUID());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
unknown01 = reader.getInt();
|
||||
unknown02 = reader.getInt();
|
||||
reader.getInt(); // Object Type Padding
|
||||
buildingUUID = reader.getInt();
|
||||
unknown03 = reader.getInt();
|
||||
unknown04 = reader.getInt();
|
||||
unknown05 = reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
// TODO fix ArrayList Accessability.
|
||||
|
||||
public int size() {
|
||||
return this.ItemList.size();
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return unknown02;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return unknown03;
|
||||
}
|
||||
|
||||
public int getUnknown04() {
|
||||
return unknown04;
|
||||
}
|
||||
|
||||
public int getUnknown05() {
|
||||
return unknown05;
|
||||
}
|
||||
|
||||
public int buildingUUID() {
|
||||
return buildingUUID;
|
||||
}
|
||||
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void setUnknown02(int unknown02) {
|
||||
this.unknown02 = unknown02;
|
||||
}
|
||||
|
||||
public void setUnknown03(int unknown03) {
|
||||
this.unknown03 = unknown03;
|
||||
}
|
||||
|
||||
public void setUnknown04(int unknown04) {
|
||||
this.unknown04 = unknown04;
|
||||
}
|
||||
|
||||
public void setUnknown05(int unknown05) {
|
||||
this.unknown05 = unknown05;
|
||||
}
|
||||
|
||||
public void setItemList(ArrayList<Item> value) {
|
||||
this.ItemList = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
HashSet<Integer> playerFriendSet = PlayerFriendsMap.get(playerUID);
|
||||
playerFriendSet.add(friendUID); * Copyright 2013 MagicBane Emulator Project
|
||||
* All Rights Reserved
|
||||
*/
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
public class AddFriendMessage extends ClientNetMsg {
|
||||
|
||||
public PlayerCharacter friend;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public AddFriendMessage(PlayerCharacter pc) {
|
||||
super(Protocol.ADDFRIEND);
|
||||
friend = pc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AddFriendMessage(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ADDFRIEND, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public AddFriendMessage(AddFriendMessage msg) {
|
||||
super(Protocol.ADDFRIEND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
//message is serialize only, no need for deserialize.
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(friend.getObjectUUID());
|
||||
writer.putString(friend.getName());
|
||||
writer.putInt(0); //possibly available, busy, away?
|
||||
writer.putInt(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class AddGoldToTradeWindowMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private long playerCompID;
|
||||
private int amount;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public AddGoldToTradeWindowMsg(int unknown01, long playerCompID, int amount) {
|
||||
super(Protocol.TRADEADDGOLD);
|
||||
this.unknown01 = unknown01;
|
||||
this.playerCompID = playerCompID;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AddGoldToTradeWindowMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.TRADEADDGOLD, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
playerCompID = reader.getLong();
|
||||
amount = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putLong(playerCompID);
|
||||
writer.putInt(amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown01
|
||||
*/
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown01 the unknown01 to set
|
||||
*/
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount
|
||||
*/
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param amount the amount to set
|
||||
*/
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
public class AddItemToTradeWindowMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private int itemID;
|
||||
private int itemType;
|
||||
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public AddItemToTradeWindowMsg(int unknown01, AbstractGameObject player, AbstractGameObject item) {
|
||||
super(Protocol.TRADEADDOBJECT);
|
||||
this.unknown01 = unknown01;
|
||||
this.playerType = player.getObjectType().ordinal();
|
||||
this.playerID = player.getObjectUUID();
|
||||
this.itemType = item.getObjectType().ordinal();
|
||||
this.itemID = item.getObjectUUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AddItemToTradeWindowMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.TRADEADDOBJECT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
playerType = reader.getInt();
|
||||
playerID = reader.getInt();
|
||||
itemType = reader.getInt();
|
||||
itemID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putInt(itemType);
|
||||
writer.putInt(itemID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown01
|
||||
*/
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown01 the unknown01 to set
|
||||
*/
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int getPlayerType() {
|
||||
return playerType;
|
||||
}
|
||||
|
||||
public void setPlayerType(int playerType) {
|
||||
this.playerType = playerType;
|
||||
}
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
public int getItemID() {
|
||||
return itemID;
|
||||
}
|
||||
|
||||
public void setItemID(int itemID) {
|
||||
this.itemID = itemID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
|
||||
public class AllianceChangeMsg extends ClientNetMsg {
|
||||
public final static int MAKE_ENEMY = 4;
|
||||
public final static int MAKE_ALLY = 6;
|
||||
public final static int REMOVE = 7;
|
||||
public final static byte INFO_SUCCESS = 0;
|
||||
public final static byte ERROR_NOT_RECOMMENDED = 1;
|
||||
public final static byte ERROR_NOT_SAME_GUILD = 2;
|
||||
public final static byte ERROR_NOT_AUTHORIZED = 4;
|
||||
public final static byte ERROR_NOT_SAME_FACTION = 7;
|
||||
public final static byte ERROR_TOO_MANY = 13;
|
||||
public final static byte ERROR_TO0_EARLY = 14;
|
||||
private byte msgType;
|
||||
private int sourceGuildID;
|
||||
private int targetGuildID;
|
||||
private int secondsToWait;
|
||||
private boolean ally;
|
||||
|
||||
|
||||
public AllianceChangeMsg(PlayerCharacter player, int sourceGuildID,int targetGuildID, byte msgType, int secondsToWait) {
|
||||
super(Protocol.ALLIANCECHANGE);
|
||||
this.sourceGuildID = sourceGuildID;
|
||||
this.targetGuildID = targetGuildID;
|
||||
this.msgType = msgType;
|
||||
this.secondsToWait = secondsToWait;
|
||||
|
||||
}
|
||||
|
||||
public AllianceChangeMsg() {
|
||||
super(Protocol.ALLIANCECHANGE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 AllianceChangeMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ALLIANCECHANGE, origin, reader);
|
||||
}
|
||||
//CALL THIS AFTER SANITY CHECKS AND BEFORE UPDATING HEALTH/GOLD.
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.msgType = reader.get();
|
||||
|
||||
switch (this.msgType){
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case MAKE_ENEMY:
|
||||
case MAKE_ALLY:
|
||||
case REMOVE:
|
||||
case 5:
|
||||
reader.getInt(); //source guild type;
|
||||
this.sourceGuildID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.targetGuildID = reader.getInt();
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Precache and configure this message before we serialize it
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.put(this.msgType);
|
||||
if (this.msgType == ERROR_TO0_EARLY)
|
||||
writer.putInt(this.secondsToWait);
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(this.sourceGuildID);
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(this.targetGuildID);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getSecondsToWait() {
|
||||
return secondsToWait;
|
||||
}
|
||||
|
||||
public void setSecondsToWait(int secondsToWait) {
|
||||
this.secondsToWait = secondsToWait;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return msgType;
|
||||
}
|
||||
|
||||
public int getSourceGuildID() {
|
||||
return sourceGuildID;
|
||||
}
|
||||
|
||||
public int getTargetGuildID() {
|
||||
return targetGuildID;
|
||||
}
|
||||
|
||||
public boolean isAlly() {
|
||||
return ally;
|
||||
}
|
||||
|
||||
public void setMsgType(byte msgType) {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.GuildAlliances;
|
||||
import engine.objects.GuildTag;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
|
||||
public class AllyEnemyListMsg extends ClientNetMsg {
|
||||
|
||||
|
||||
private int guildID;
|
||||
|
||||
|
||||
public AllyEnemyListMsg(PlayerCharacter player) {
|
||||
super(Protocol.ALLYENEMYLIST);
|
||||
this.guildID = player.getGuildUUID();
|
||||
|
||||
}
|
||||
|
||||
public AllyEnemyListMsg() {
|
||||
super(Protocol.ALLYENEMYLIST);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 AllyEnemyListMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ALLYENEMYLIST, origin, reader);
|
||||
}
|
||||
//CALL THIS AFTER SANITY CHECKS AND BEFORE UPDATING HEALTH/GOLD.
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
this.guildID = reader.getInt();
|
||||
}
|
||||
|
||||
|
||||
// Precache and configure this message before we serialize it
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(this.guildID);
|
||||
|
||||
Guild guild = Guild.getGuild(this.guildID);
|
||||
|
||||
writer.putInt(guild.getAllyList().size());
|
||||
|
||||
for (Guild ally: guild.getAllyList()){
|
||||
writer.putInt(GameObjectType.Guild.ordinal());//guildType
|
||||
writer.putInt(ally.getObjectUUID());//GuildID
|
||||
writer.putString(ally.getName());
|
||||
GuildTag._serializeForDisplay(ally.getGuildTag(),writer);
|
||||
writer.put((byte)0);
|
||||
}
|
||||
|
||||
|
||||
writer.putInt(guild.getEnemyList().size());
|
||||
|
||||
for (Guild enemy: guild.getEnemyList()){
|
||||
writer.putInt(GameObjectType.Guild.ordinal());//guildType
|
||||
writer.putInt(enemy.getObjectUUID());//GuildID
|
||||
writer.putString(enemy.getName());
|
||||
GuildTag._serializeForDisplay(enemy.getGuildTag(),writer);
|
||||
writer.put((byte)1);
|
||||
}
|
||||
|
||||
|
||||
writer.putInt(guild.getRecommendList().size());
|
||||
for (Guild recommended: guild.getRecommendList()){
|
||||
|
||||
GuildAlliances guildAlliance = guild.guildAlliances.get(recommended.getObjectUUID());
|
||||
writer.putInt(GameObjectType.Guild.ordinal());//guildType
|
||||
writer.putInt(recommended.getObjectUUID());//GuildID
|
||||
writer.putString(recommended.getName());
|
||||
GuildTag._serializeForDisplay(recommended.getGuildTag(),writer);
|
||||
writer.put((byte)1); // ?
|
||||
writer.putString(guildAlliance.getRecommender()); // recommender name.
|
||||
writer.put((byte) (guildAlliance.isAlly()?1:0)); //ally 1 enemy 0
|
||||
|
||||
}
|
||||
|
||||
writer.put((byte)1);
|
||||
|
||||
}
|
||||
|
||||
public int getGuildID() {
|
||||
return guildID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class ApplyBuildingEffectMsg extends ClientNetMsg {
|
||||
|
||||
protected int unknown01;
|
||||
protected int unknown02;
|
||||
protected int buildingType;
|
||||
protected int buildingID;
|
||||
protected int unknown03;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ApplyBuildingEffectMsg() {
|
||||
super(Protocol.VISUALUPDATE);
|
||||
}
|
||||
|
||||
public ApplyBuildingEffectMsg(int unknown01, int unknown02, int buildingType, int buildingID, int unknown03) {
|
||||
super(Protocol.VISUALUPDATE);
|
||||
this.unknown01 = unknown01;
|
||||
this.unknown02 = unknown02;
|
||||
this.buildingType = buildingType;
|
||||
this.buildingID = buildingID;
|
||||
this.unknown03 = unknown03;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ApplyBuildingEffectMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.VISUALUPDATE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.unknown02);
|
||||
if (this.unknown02 == 0){
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.buildingType);
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(0);
|
||||
return;
|
||||
}
|
||||
writer.putInt(this.buildingType);
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(this.unknown03);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
}
|
||||
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
public void setUnknown02(int unknown02) {
|
||||
this.unknown02 = unknown02;
|
||||
}
|
||||
|
||||
public void setBuildingID(int buildingID) {
|
||||
this.buildingID = buildingID;
|
||||
}
|
||||
|
||||
public void setUnknown03(int unknown03) {
|
||||
this.unknown03 = unknown03;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return unknown02;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
return buildingID;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return unknown03;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
|
||||
public class ApplyEffectMsg extends ClientNetMsg {
|
||||
|
||||
protected int numTrains;
|
||||
protected int effectID;
|
||||
protected int sourceType;
|
||||
protected int sourceID;
|
||||
protected int targetType;
|
||||
protected int targetID;
|
||||
|
||||
protected int unknown02;
|
||||
protected int unknown03;
|
||||
protected int duration;
|
||||
protected int unknown05;
|
||||
protected byte unknown06;
|
||||
|
||||
protected int powerUsedID;
|
||||
|
||||
protected String powerUsedName;
|
||||
private int effectSourceType = 0;
|
||||
private int effectSourceID = 0;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ApplyEffectMsg() {
|
||||
super(Protocol.POWERACTION);
|
||||
this.numTrains = 0;
|
||||
this.effectID = 0;
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
|
||||
this.unknown02 = 0;
|
||||
this.unknown03 = 0;
|
||||
this.duration = 0;
|
||||
this.unknown05 = 0;
|
||||
this.unknown06 = (byte) 0;
|
||||
|
||||
this.powerUsedID = 0;
|
||||
this.powerUsedName = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ApplyEffectMsg(AbstractWorldObject source, AbstractWorldObject target, int numTrains, int effectID, int duration,
|
||||
int powerUsedID, String powerUsedName) {
|
||||
super(Protocol.POWERACTION);
|
||||
this.numTrains = numTrains;
|
||||
this.effectID = effectID;
|
||||
|
||||
if (source != null) {
|
||||
this.sourceType = source.getObjectType().ordinal();
|
||||
this.sourceID = source.getObjectUUID();
|
||||
} else {
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
}
|
||||
|
||||
if (target != null) {
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
} else {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
}
|
||||
this.unknown02 = 0;
|
||||
this.unknown03 = 0;
|
||||
this.duration = duration;
|
||||
this.unknown05 = 0;
|
||||
this.unknown06 = (byte) 0;
|
||||
|
||||
this.powerUsedID = powerUsedID;
|
||||
this.powerUsedName = powerUsedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ApplyEffectMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.POWERACTION, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.numTrains);
|
||||
writer.putInt(this.effectID);
|
||||
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
|
||||
writer.putInt(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.duration);
|
||||
writer.putInt(this.unknown05);
|
||||
writer.put(this.unknown06);
|
||||
|
||||
if (this.unknown06 == (byte) 1) {
|
||||
writer.putInt(this.effectSourceType);
|
||||
writer.putInt(this.effectSourceID);
|
||||
}
|
||||
|
||||
else {
|
||||
writer.putInt(this.powerUsedID);
|
||||
}
|
||||
|
||||
writer.putString(this.powerUsedName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.numTrains = reader.getInt();
|
||||
this.effectID = reader.getInt();
|
||||
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.duration = reader.getInt();
|
||||
this.unknown05 = reader.getInt();
|
||||
this.unknown06 = reader.get();
|
||||
|
||||
this.powerUsedID = reader.getInt();
|
||||
|
||||
this.powerUsedName = reader.getString();
|
||||
}
|
||||
|
||||
public int getNumTrains() {
|
||||
return this.numTrains;
|
||||
}
|
||||
|
||||
public int getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public int getSourceType() {
|
||||
return this.sourceType;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return this.sourceID;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return this.targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return this.targetID;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return this.unknown03;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return this.duration;
|
||||
}
|
||||
|
||||
public int getUnknown05() {
|
||||
return this.unknown05;
|
||||
}
|
||||
|
||||
public byte getUnknown06() {
|
||||
return this.unknown06;
|
||||
}
|
||||
|
||||
public void setNumTrains(int value) {
|
||||
this.numTrains = value;
|
||||
}
|
||||
|
||||
public void setEffectID(int value) {
|
||||
this.effectID = value;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
|
||||
public void setDuration(int value) {
|
||||
this.duration = value;
|
||||
}
|
||||
|
||||
public void setUnknown05(int value) {
|
||||
this.unknown05 = value;
|
||||
}
|
||||
|
||||
public void setUnknown06(byte value) {
|
||||
this.unknown06 = value;
|
||||
}
|
||||
|
||||
public void setPowerUsedID(int value) {
|
||||
this.powerUsedID = value;
|
||||
}
|
||||
|
||||
public void setPowerUsedName(String value) {
|
||||
this.powerUsedName = value;
|
||||
}
|
||||
|
||||
public void setEffectSourceType(int effectSourceType) {
|
||||
this.effectSourceType = effectSourceType;
|
||||
}
|
||||
|
||||
public void setEffectSourceID(int effectSourceID) {
|
||||
this.effectSourceID = effectSourceID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,393 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.net.*;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.CharacterRune;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.RuneBase;
|
||||
import engine.objects.RuneBaseAttribute;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ApplyRuneMsg extends ClientNetMsg {
|
||||
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private int removeRuneBase;
|
||||
private int runeBase;
|
||||
private int runeType;
|
||||
private int runeID;
|
||||
private Boolean isPromo;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ApplyRuneMsg(int targetType, int targetID, int runeBase, int runeType, int runeID, Boolean isPromo) {
|
||||
super(Protocol.SETRUNE);
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
this.runeBase = runeBase;
|
||||
this.runeType = runeType;
|
||||
this.runeID = runeID;
|
||||
this.isPromo = isPromo;
|
||||
this.removeRuneBase = 0;
|
||||
}
|
||||
|
||||
public ApplyRuneMsg(int targetType, int targetID, int removeRuneBase) {
|
||||
super(Protocol.SETRUNE);
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
this.runeBase = 0;
|
||||
this.runeType = 0;
|
||||
this.runeID = 0;
|
||||
this.isPromo = false;
|
||||
this.removeRuneBase = removeRuneBase;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ApplyRuneMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.SETRUNE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.removeRuneBase);
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.runeBase);
|
||||
writer.putInt(this.runeType);
|
||||
writer.putInt(this.runeID);
|
||||
if (this.isPromo) {
|
||||
writer.put((byte) 1);
|
||||
} else {
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.removeRuneBase = reader.getInt();
|
||||
reader.getInt();
|
||||
this.runeBase = reader.getInt();
|
||||
this.runeType = reader.getInt();
|
||||
this.runeID = reader.getInt();
|
||||
this.isPromo = (reader.get() == 1) ? true : false;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public int getRuneID() {
|
||||
return runeID;
|
||||
}
|
||||
|
||||
public void setRuneID(int value) {
|
||||
this.runeID = value;
|
||||
}
|
||||
|
||||
public static boolean applyRune(int runeID, ClientConnection origin, PlayerCharacter playerCharacter) {
|
||||
|
||||
RuneBase rb = RuneBase.getRuneBase(runeID);
|
||||
Dispatch dispatch;
|
||||
|
||||
if (playerCharacter == null || origin == null || rb == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Check race is met
|
||||
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
|
||||
if (races.size() > 0) {
|
||||
int raceID = playerCharacter.getRaceID();
|
||||
boolean valid = false;
|
||||
for (int validID : races.keySet()) {
|
||||
if (validID == raceID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check base class is met
|
||||
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
|
||||
if (baseClasses.size() > 0) {
|
||||
int baseClassID = playerCharacter.getBaseClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : baseClasses.keySet()) {
|
||||
if (validID == baseClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check promotion class is met
|
||||
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
||||
if (promotionClasses.size() > 0) {
|
||||
int promotionClassID = playerCharacter.getPromotionClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : promotionClasses.keySet()) {
|
||||
if (validID == promotionClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check disciplines are met
|
||||
ArrayList<CharacterRune> runes = playerCharacter.getRunes();
|
||||
ConcurrentHashMap<Integer, Boolean> disciplines = rb.getDiscipline();
|
||||
if (disciplines.size() > 0) {
|
||||
for (CharacterRune cr : runes) {
|
||||
int runeBaseID = cr.getRuneBaseID();
|
||||
for (Integer prohID : disciplines.keySet()) {
|
||||
if (runeBaseID == prohID) {
|
||||
return false; //Prohibited rune
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int discCount = 0;
|
||||
for (CharacterRune cr : runes) {
|
||||
int runeBaseID = cr.getRuneBaseID();
|
||||
//count number of discipline runes
|
||||
if (runeBaseID > 3000 && runeBaseID < 3049) {
|
||||
discCount++;
|
||||
}
|
||||
//see if rune is already applied
|
||||
if (runeBaseID == runeID) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check level is met
|
||||
if (playerCharacter.getLevel() < rb.getLevelRequired()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int strTotal = 0;
|
||||
int dexTotal = 0;
|
||||
int conTotal = 0;
|
||||
int intTotal = 0;
|
||||
int spiTotal = 0;
|
||||
int cost = 0;
|
||||
|
||||
//Check any attributes are met
|
||||
ArrayList<RuneBaseAttribute> attrs = rb.getAttrs();
|
||||
|
||||
if (rb.getAttrs() != null)
|
||||
for (RuneBaseAttribute rba : attrs) {
|
||||
int attrID = rba.getAttributeID();
|
||||
int mod = rba.getModValue();
|
||||
switch (attrID) {
|
||||
case MBServerStatics.RUNE_COST_ATTRIBUTE_ID:
|
||||
if (mod > playerCharacter.getUnusedStatPoints()) {
|
||||
return false;
|
||||
}
|
||||
cost = mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_STR_MIN_NEEDED_ATTRIBUTE_ID:
|
||||
if ((int) playerCharacter.statStrBase < mod) {
|
||||
return false;
|
||||
}
|
||||
strTotal = mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_DEX_MIN_NEEDED_ATTRIBUTE_ID:
|
||||
if ((int) playerCharacter.statDexBase < mod) {
|
||||
return false;
|
||||
}
|
||||
dexTotal = mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_CON_MIN_NEEDED_ATTRIBUTE_ID:
|
||||
if ((int) playerCharacter.statConBase < mod) {
|
||||
return false;
|
||||
}
|
||||
conTotal = mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_INT_MIN_NEEDED_ATTRIBUTE_ID:
|
||||
if ((int) playerCharacter.statIntBase < mod) {
|
||||
return false;
|
||||
}
|
||||
intTotal = mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_SPI_MIN_NEEDED_ATTRIBUTE_ID:
|
||||
if ((int) playerCharacter.statSpiBase < mod) {
|
||||
return false;
|
||||
}
|
||||
spiTotal = mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_STR_ATTRIBUTE_ID:
|
||||
strTotal += mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_DEX_ATTRIBUTE_ID:
|
||||
dexTotal += mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_CON_ATTRIBUTE_ID:
|
||||
conTotal += mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_INT_ATTRIBUTE_ID:
|
||||
intTotal += mod;
|
||||
break;
|
||||
case MBServerStatics.RUNE_SPI_ATTRIBUTE_ID:
|
||||
spiTotal += mod;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if max number runes already reached
|
||||
if (runes.size() > 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//if discipline, check number applied
|
||||
if (isDiscipline(runeID)) {
|
||||
if (playerCharacter.getLevel() < 70) {
|
||||
if (discCount > 2) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (discCount > 3) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Everything succeeded. Let's apply the rune
|
||||
//Attempt add rune to database
|
||||
CharacterRune runeWithoutID = new CharacterRune(rb, playerCharacter.getObjectUUID());
|
||||
CharacterRune cr;
|
||||
try {
|
||||
cr = DbManager.CharacterRuneQueries.ADD_CHARACTER_RUNE(runeWithoutID);
|
||||
} catch (Exception e) {
|
||||
cr = null;
|
||||
Logger.error(e);
|
||||
}
|
||||
if (cr == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//remove any overridden runes from player
|
||||
ArrayList<Integer> overwrite = rb.getOverwrite();
|
||||
CharacterRune toRemove = null;
|
||||
if (overwrite.size() > 0) {
|
||||
for (int overwriteID : overwrite) {
|
||||
toRemove = playerCharacter.removeRune(overwriteID);
|
||||
}
|
||||
}
|
||||
|
||||
//add rune to player
|
||||
playerCharacter.addRune(cr);
|
||||
|
||||
// recalculate all bonuses/formulas/skills/powers
|
||||
playerCharacter.recalculate();
|
||||
|
||||
//if overwriting a stat rune, add any amount granted from previous rune.
|
||||
if (toRemove != null) {
|
||||
RuneBase rbs = toRemove.getRuneBase();
|
||||
if (rbs != null && rbs.getObjectUUID() > 249999 && rbs.getObjectUUID() < 250045) {
|
||||
//add any additional stats to match old amount
|
||||
int dif = strTotal - (int) playerCharacter.statStrBase;
|
||||
if (dif > 0 && strTotal < (int) playerCharacter.statStrMax) {
|
||||
playerCharacter.addStr(dif);
|
||||
}
|
||||
dif = dexTotal - (int) playerCharacter.statDexBase;
|
||||
if (dif > 0 && dexTotal < (int) playerCharacter.statDexMax) {
|
||||
playerCharacter.addDex(dif);
|
||||
}
|
||||
dif = conTotal - (int) playerCharacter.statConBase;
|
||||
if (dif > 0 && conTotal < (int) playerCharacter.statConMax) {
|
||||
playerCharacter.addCon(dif);
|
||||
}
|
||||
dif = intTotal - (int) playerCharacter.statIntBase;
|
||||
if (dif > 0 && intTotal < (int) playerCharacter.statIntMax) {
|
||||
playerCharacter.addInt(dif);
|
||||
}
|
||||
dif = spiTotal - (int) playerCharacter.statSpiBase;
|
||||
if (dif > 0 && spiTotal < (int) playerCharacter.statSpiMax) {
|
||||
playerCharacter.addSpi(dif);
|
||||
}
|
||||
|
||||
// recalculate all bonuses/formulas/skills/powers
|
||||
playerCharacter.recalculate();
|
||||
}
|
||||
}
|
||||
|
||||
if (cost > 0) {
|
||||
ModifyStatMsg msm = new ModifyStatMsg((0 - cost), 0, 3);
|
||||
dispatch = Dispatch.borrow(playerCharacter, msm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
//send apply rune message to client
|
||||
ApplyRuneMsg arm = new ApplyRuneMsg(playerCharacter.getObjectType().ordinal(), playerCharacter.getObjectUUID(), runeID, cr.getObjectType().ordinal(), cr.getObjectUUID(), false);
|
||||
dispatch = Dispatch.borrow(playerCharacter, arm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
//alert them of success
|
||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 160);
|
||||
|
||||
//reapply bonuses
|
||||
playerCharacter.applyBonuses();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isDiscipline(int runeID) {
|
||||
|
||||
return runeID > 3000 && runeID < 3050;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class ArcLoginNotifyMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private int unknown02;
|
||||
private int unknown03;
|
||||
private short unknown04;
|
||||
private byte unknown05;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ArcLoginNotifyMsg() {
|
||||
super(Protocol.ARCLOGINNOTIFY);
|
||||
this.unknown01 = 0x40A5BDB0;
|
||||
this.unknown02 = 0x342AA9F0;
|
||||
this.unknown03 = 0;
|
||||
this.unknown04 = (short) 0;
|
||||
this.unknown05 = (byte) 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ArcLoginNotifyMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCLOGINNOTIFY, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putShort(this.unknown04);
|
||||
writer.put(this.unknown05);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.unknown01 = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.unknown04 = reader.getShort();
|
||||
this.unknown05 = reader.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 short getUnknown04() {
|
||||
return unknown04;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown04
|
||||
* the unknown04 to set
|
||||
*/
|
||||
public void setUnknown04(short unknown04) {
|
||||
this.unknown04 = unknown04;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown05
|
||||
*/
|
||||
public byte getUnknown05() {
|
||||
return unknown05;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown05
|
||||
* the unknown05 to set
|
||||
*/
|
||||
public void setUnknown05(byte unknown05) {
|
||||
this.unknown05 = unknown05;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class ArcMineChangeProductionMsg extends ClientNetMsg {
|
||||
|
||||
private int mineID;
|
||||
private int resourceHash;
|
||||
|
||||
/**
|
||||
* 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 ArcMineChangeProductionMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCMINECHANGEPRODUCTION, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.mineID = reader.getInt();
|
||||
this.resourceHash = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(this.mineID);
|
||||
writer.putInt(this.resourceHash);
|
||||
}
|
||||
|
||||
public int getMineID() {
|
||||
return this.mineID;
|
||||
}
|
||||
|
||||
public int getResourceHash() {
|
||||
return this.resourceHash;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Guild;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Seconds;
|
||||
|
||||
public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
|
||||
private int buildingUUID;
|
||||
private Building treeOfLife;
|
||||
|
||||
private int currentMineHour;
|
||||
private Seconds secondsLeft;
|
||||
private DateTime lateTime;
|
||||
private int late;
|
||||
|
||||
/**
|
||||
* 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 ArcMineWindowAvailableTimeMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCMINEWINDOWAVAILABLETIME, origin, reader);
|
||||
}
|
||||
|
||||
public ArcMineWindowAvailableTimeMsg(Building treeOfLife, int timeLeft) {
|
||||
super(Protocol.ARCMINEWINDOWAVAILABLETIME);
|
||||
this.treeOfLife = treeOfLife;
|
||||
this.buildingUUID = treeOfLife.getObjectUUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt(); // Object type padding (We know it's a building)
|
||||
this.buildingUUID = reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
// Configures and pre-caches values for this message
|
||||
// so everything is already available during serialisation.
|
||||
|
||||
public void configure() {
|
||||
|
||||
Guild guild;
|
||||
guild = this.treeOfLife.getGuild();
|
||||
|
||||
if (guild != null)
|
||||
currentMineHour = guild.getMineTime();
|
||||
|
||||
late = MBServerStatics.MINE_LATE_WINDOW;
|
||||
lateTime = DateTime.now();
|
||||
|
||||
if (late == 0)
|
||||
lateTime = lateTime.plusDays(1);
|
||||
|
||||
lateTime = lateTime.hourOfDay().setCopy(late);
|
||||
|
||||
late = ((late > 23) ? (late - 24) : late);
|
||||
secondsLeft = Seconds.secondsBetween(DateTime.now(), lateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
writer.putInt(MBServerStatics.MINE_EARLY_WINDOW); //15);
|
||||
writer.putInt(late);
|
||||
writer.putInt(currentMineHour);
|
||||
|
||||
writer.putInt(this.treeOfLife.getObjectType().ordinal());
|
||||
writer.putInt(this.treeOfLife.getObjectUUID());
|
||||
|
||||
writer.putInt((int)secondsLeft.getSeconds());
|
||||
}
|
||||
|
||||
public int getBuildingUUID() {
|
||||
return buildingUUID;
|
||||
}
|
||||
|
||||
public void setBuildingUUID(int buildingUUID) {
|
||||
this.buildingUUID = buildingUUID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class ArcMineWindowChangeMsg extends ClientNetMsg {
|
||||
|
||||
private int time;
|
||||
private int buildingType;
|
||||
private int buildingID;
|
||||
|
||||
/**
|
||||
* 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 ArcMineWindowChangeMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCMINEWINDOWCHANGE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.time = reader.getInt();
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(this.time);
|
||||
writer.putInt(this.buildingType);
|
||||
writer.putInt(this.buildingID);
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
return this.buildingID;
|
||||
}
|
||||
|
||||
public void setTime(int value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
public void setBuildingID(int value) {
|
||||
this.buildingID = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Mine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ArcOwnedMinesListMsg extends ClientNetMsg {
|
||||
|
||||
ArrayList<Mine> mineList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 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 ArcOwnedMinesListMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCOWNEDMINESLIST, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(mineList.size());
|
||||
for (Mine mine : mineList) {
|
||||
mine.serializeForMineProduction(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMineList(ArrayList<Mine> mineList) {
|
||||
this.mineList = mineList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class ArcSiegeSpireMsg extends ClientNetMsg {
|
||||
|
||||
private int buildingUUID;
|
||||
|
||||
/**
|
||||
* 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 ArcSiegeSpireMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCSIEGESPIRE, origin, reader);
|
||||
}
|
||||
|
||||
public ArcSiegeSpireMsg() {
|
||||
super(Protocol.ARCSIEGESPIRE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt(); // object type padding
|
||||
this.buildingUUID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
}
|
||||
|
||||
public int getBuildingUUID() {
|
||||
return buildingUUID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.TransactionType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ArcViewAssetTransactionsMsg extends ClientNetMsg {
|
||||
|
||||
private int warehouseID;
|
||||
private Warehouse warehouse;
|
||||
private int transactionID;
|
||||
private ArrayList<Transaction> transactions;
|
||||
Building warehouseBuilding;
|
||||
|
||||
/**
|
||||
* 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 ArcViewAssetTransactionsMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCVIEWASSETTRANSACTIONS, origin, reader);
|
||||
}
|
||||
|
||||
public ArcViewAssetTransactionsMsg(Warehouse warehouse, ArcViewAssetTransactionsMsg msg) {
|
||||
super(Protocol.ARCVIEWASSETTRANSACTIONS);
|
||||
this.warehouseID = msg.warehouseID;
|
||||
this.transactionID = msg.transactionID;
|
||||
this.warehouse = warehouse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.transactionID = reader.getInt(); //some odd type?
|
||||
this.warehouseID = reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
// Method pre-caches and configures values so they are
|
||||
// available before we attempt serialization
|
||||
|
||||
public void configure() {
|
||||
|
||||
warehouseBuilding = BuildingManager.getBuilding(this.warehouse.getBuildingUID());
|
||||
transactions = new ArrayList<>(50);
|
||||
|
||||
if (this.warehouse.getTransactions().size() > 150){
|
||||
transactions.addAll(this.warehouse.getTransactions().subList(this.warehouse.getTransactions().size() - 150, this.warehouse.getTransactions().size()));
|
||||
}else
|
||||
transactions = this.warehouse.getTransactions();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
writer.putInt(this.transactionID);
|
||||
writer.putInt(this.warehouse.getBuildingUID());
|
||||
writer.putInt(transactions.size()); //list Size
|
||||
|
||||
for (Transaction transaction:transactions){
|
||||
String name = "No Name";
|
||||
switch (transaction.getTargetType()){
|
||||
case Building:
|
||||
Building building = BuildingManager.getBuildingFromCache(transaction.getTargetUUID());
|
||||
if (building != null)
|
||||
name = building.getName();
|
||||
Mine mine = Mine.getMineFromTower(transaction.getTargetUUID());
|
||||
//
|
||||
if (mine != null)
|
||||
name = mine.getZoneName();
|
||||
|
||||
if (transaction.getTransactionType().equals(TransactionType.TAXRESOURCE) || transaction.getTransactionType().equals(TransactionType.TAXRESOURCEDEPOSIT)){
|
||||
City city = building.getCity();
|
||||
|
||||
if (city != null)
|
||||
name = city.getCityName();
|
||||
}
|
||||
|
||||
break;
|
||||
case PlayerCharacter:
|
||||
PlayerCharacter pc = PlayerCharacter.getPlayerCharacter(transaction.getTargetUUID());
|
||||
if (pc != null)
|
||||
name = pc.getCombinedName();
|
||||
break;
|
||||
case NPC:
|
||||
NPC npc = NPC.getFromCache(transaction.getTargetUUID());
|
||||
if (npc != null){
|
||||
|
||||
if (npc.getBuilding() != null)
|
||||
name = npc.getBuilding().getName();
|
||||
else
|
||||
name = npc.getName();
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
writer.putInt(transaction.getTargetType().ordinal()); //Type
|
||||
writer.putInt(transaction.getTargetUUID()); //ID
|
||||
writer.putString(name); //Name of depositer/withdrawler or mine name
|
||||
writer.putInt(GameObjectType.Building.ordinal()); //Type
|
||||
writer.putInt(warehouse.getBuildingUID()); //ID
|
||||
writer.putString(warehouseBuilding.getName()); //warehouse
|
||||
writer.putInt(transaction.getTransactionType().getID()); //79,80 withdrew, 81 mine produced, 82 deposit
|
||||
writer.putInt(transaction.getAmount()); //amount
|
||||
writer.putString(transaction.getResource().name().toLowerCase()); //item type
|
||||
writer.putDateTime(transaction.getDate());
|
||||
}
|
||||
|
||||
|
||||
//writer.putString("balls");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
return (16); // 2^14 == 16384
|
||||
}
|
||||
|
||||
public int getWarehouseID() {
|
||||
return warehouseID;
|
||||
}
|
||||
public int getTransactionID() {
|
||||
return transactionID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.Enum;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
|
||||
public class AssetSupportMsg extends ClientNetMsg {
|
||||
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
private int buildingType;
|
||||
private int buildingID;
|
||||
private int messageType;
|
||||
private int pad = 0;
|
||||
private int objectType;
|
||||
private int objectUUID;
|
||||
private int protectedBuildingType;
|
||||
private int protectedBuildingID;
|
||||
private int profitTax;
|
||||
private int weeklyTax;
|
||||
private byte enforceKOS;
|
||||
private Enum.SupportMsgType supportMsgType;
|
||||
public static int confirmProtect;
|
||||
|
||||
|
||||
/**
|
||||
* 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 AssetSupportMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ASSETSUPPORT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
this.messageType = reader.getInt();
|
||||
this.supportMsgType = Enum.SupportMsgType.typeLookup.get(this.messageType);
|
||||
|
||||
if (this.supportMsgType == null) {
|
||||
this.supportMsgType = Enum.SupportMsgType.NONE;
|
||||
Logger.error("No enumeration for support type" + this.messageType);
|
||||
}
|
||||
|
||||
switch (supportMsgType) {
|
||||
|
||||
case PROTECT:
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.protectedBuildingType = reader.getInt();
|
||||
this.protectedBuildingID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.weeklyTax = reader.getInt();
|
||||
this.profitTax = reader.getInt();
|
||||
this.enforceKOS = reader.get();
|
||||
reader.get();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
break;
|
||||
|
||||
case UNPROTECT:
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
this.protectedBuildingType = reader.getInt();
|
||||
this.protectedBuildingID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
break;
|
||||
case VIEWUNPROTECTED:
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
break;
|
||||
case REMOVETAX:
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
break;
|
||||
|
||||
case ACCEPTTAX:
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
writer.putInt(this.messageType);
|
||||
this.supportMsgType = Enum.SupportMsgType.typeLookup.get(this.messageType);
|
||||
|
||||
if (this.supportMsgType == null) {
|
||||
this.supportMsgType = Enum.SupportMsgType.NONE;
|
||||
Logger.error("No enumeration for support type" + this.messageType);
|
||||
}
|
||||
|
||||
switch (this.supportMsgType) {
|
||||
|
||||
case PROTECT:
|
||||
writer.putInt(this.buildingType);
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(npcType);
|
||||
writer.putInt(npcID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.protectedBuildingType);
|
||||
writer.putInt(this.protectedBuildingID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.weeklyTax);
|
||||
writer.putInt(this.profitTax);
|
||||
writer.put(this.enforceKOS);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
break;
|
||||
case CONFIRMPROTECT:
|
||||
writer.putInt(this.buildingType);
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(this.npcType);
|
||||
writer.putInt(this.npcID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
|
||||
|
||||
break;
|
||||
case UNPROTECT:
|
||||
writer.putInt(this.buildingType);
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(npcType);
|
||||
writer.putInt(npcID);
|
||||
writer.putInt(this.protectedBuildingType);
|
||||
writer.putInt(this.protectedBuildingID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
break;
|
||||
case VIEWUNPROTECTED:
|
||||
writer.putInt(this.buildingType);
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(npcType);
|
||||
writer.putInt(npcID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(int value) {
|
||||
this.objectType = value;
|
||||
}
|
||||
|
||||
public void setPad(int value) {
|
||||
this.pad = value;
|
||||
}
|
||||
|
||||
public int getUUID() {
|
||||
return objectUUID;
|
||||
}
|
||||
|
||||
public int getPad() {
|
||||
return pad;
|
||||
}
|
||||
|
||||
|
||||
public int getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public void setMessageType(int messageType) {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
|
||||
public int getNpcType() {
|
||||
return npcType;
|
||||
}
|
||||
|
||||
public void setNpcType(int npcType) {
|
||||
this.npcType = npcType;
|
||||
}
|
||||
|
||||
public int getNpcID() {
|
||||
return npcID;
|
||||
}
|
||||
|
||||
public void setNpcID(int npcID) {
|
||||
this.npcID = npcID;
|
||||
}
|
||||
|
||||
public int getBuildingType() {
|
||||
return buildingType;
|
||||
}
|
||||
|
||||
public void setBuildingType(int buildingType) {
|
||||
this.buildingType = buildingType;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
return buildingID;
|
||||
}
|
||||
|
||||
public void setBuildingID(int buildingID) {
|
||||
this.buildingID = buildingID;
|
||||
}
|
||||
|
||||
public int getProtectedBuildingType() {
|
||||
return protectedBuildingType;
|
||||
}
|
||||
|
||||
public void setProtectedBuildingType(int protectedBuildingType) {
|
||||
this.protectedBuildingType = protectedBuildingType;
|
||||
}
|
||||
|
||||
public int getProtectedBuildingID() {
|
||||
return protectedBuildingID;
|
||||
}
|
||||
|
||||
public void setProtectedBuildingID(int protectedBuildingID) {
|
||||
this.protectedBuildingID = protectedBuildingID;
|
||||
}
|
||||
|
||||
public int getWeeklyTax() {
|
||||
return weeklyTax;
|
||||
}
|
||||
|
||||
public void setWeeklyTax(int weeklyTax) {
|
||||
this.weeklyTax = weeklyTax;
|
||||
}
|
||||
|
||||
public int getProfitTax() {
|
||||
return profitTax;
|
||||
}
|
||||
|
||||
public void setProfitTax(int profitTax) {
|
||||
this.profitTax = profitTax;
|
||||
}
|
||||
|
||||
public byte getEnforceKOS() {
|
||||
return enforceKOS;
|
||||
}
|
||||
|
||||
public void setEnforceKOS(byte enforceKOS) {
|
||||
this.enforceKOS = enforceKOS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class AttackCmdMsg extends ClientNetMsg {
|
||||
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public AttackCmdMsg(int sourceType, int sourceID, int targetType, int targetID) {
|
||||
super(Protocol.REQUESTMELEEATTACK);
|
||||
this.sourceType = sourceType;
|
||||
this.sourceID = sourceID;
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AttackCmdMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.REQUESTMELEEATTACK, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceType
|
||||
*/
|
||||
public int getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceID
|
||||
*/
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetType
|
||||
*/
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetID
|
||||
*/
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Item;
|
||||
|
||||
public class BuyFromNPCMsg extends ClientNetMsg {
|
||||
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
private int itemType;
|
||||
private int itemID;
|
||||
private byte unknown01;
|
||||
private Item item;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public BuyFromNPCMsg() {
|
||||
super(Protocol.BUYFROMNPC);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 BuyFromNPCMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.BUYFROMNPC, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
this.itemType = reader.getInt();
|
||||
this.itemID = reader.getInt();
|
||||
this.unknown01 = reader.get();
|
||||
reader.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
|
||||
writer.putInt(this.npcType);
|
||||
writer.putInt(this.npcID);
|
||||
|
||||
if (this.item != null){
|
||||
writer.putInt(this.item.getObjectType().ordinal());
|
||||
writer.putInt(this.item.getObjectUUID());
|
||||
}else{
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemID);
|
||||
}
|
||||
|
||||
writer.put(this.unknown01);
|
||||
if (item != null) {
|
||||
writer.put((byte) 1);
|
||||
Item.serializeForClientMsgWithoutSlot(item,writer);
|
||||
} else {
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
return (16); // 2^14 == 16384
|
||||
}
|
||||
public int getNPCType() {
|
||||
return this.npcType;
|
||||
}
|
||||
|
||||
public int getNPCID() {
|
||||
return this.npcID;
|
||||
}
|
||||
|
||||
public int getItemType() {
|
||||
return this.itemType;
|
||||
}
|
||||
|
||||
public int getItemID() {
|
||||
return this.itemID;
|
||||
}
|
||||
|
||||
public byte getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public void setNPCType(int value) {
|
||||
this.npcType = value;
|
||||
}
|
||||
|
||||
public void setNPCID(int value) {
|
||||
this.npcID = value;
|
||||
}
|
||||
|
||||
public void setItemType(int value) {
|
||||
this.itemType = value;
|
||||
}
|
||||
|
||||
public void setItemID(int value) {
|
||||
this.itemID = value;
|
||||
}
|
||||
|
||||
public void setUnknown01(byte value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.ItemType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
private float unknown02;
|
||||
private byte unknown03;
|
||||
private int unknown04;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public BuyFromNPCWindowMsg(int unknown01, int npcType, int npcID,
|
||||
float unknown02, byte unknown03, int unknown04) {
|
||||
super(Protocol.SHOPLIST);
|
||||
this.unknown01 = unknown01;
|
||||
this.npcType = npcType;
|
||||
this.npcID = npcID;
|
||||
this.unknown02 = unknown02;
|
||||
this.unknown03 = unknown03;
|
||||
this.unknown04 = unknown04;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 BuyFromNPCWindowMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.SHOPLIST, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
// Larger size for historically larger opcodes
|
||||
return (16);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
npcType = reader.getInt();
|
||||
npcID = reader.getInt();
|
||||
unknown02 = reader.getFloat();
|
||||
unknown03 = reader.get();
|
||||
unknown04 = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
|
||||
ClientConnection clientConnection = (ClientConnection) this.getOrigin();
|
||||
PlayerCharacter player = null;
|
||||
|
||||
if (clientConnection != null)
|
||||
player = clientConnection.getPlayerCharacter();
|
||||
|
||||
float sellPercent = 1;
|
||||
|
||||
NPC npc = NPC.getFromCache(npcID);
|
||||
CharacterItemManager man = null;
|
||||
ArrayList<Item> inventory = null;
|
||||
ArrayList<MobEquipment> sellInventory = null;
|
||||
|
||||
if (npc != null) {
|
||||
man = npc.getCharItemManager();
|
||||
Contract contract = npc.getContract();
|
||||
if (player != null){
|
||||
float barget = player.getBargain();
|
||||
float profit = npc.getSellPercent(player) - barget;
|
||||
|
||||
if (profit < 1)
|
||||
profit = 1;
|
||||
|
||||
sellPercent = 1 * profit;
|
||||
}
|
||||
|
||||
else sellPercent = 1 * npc.getSellPercent();
|
||||
|
||||
if (contract != null)
|
||||
sellInventory = contract.getSellInventory();
|
||||
}
|
||||
|
||||
if (man != null)
|
||||
inventory = man.getInventory();
|
||||
|
||||
writer.putInt(unknown01);
|
||||
writer.putInt(npcType);
|
||||
writer.putInt(npcID);
|
||||
|
||||
writer.putFloat(sellPercent); //npc sell markup
|
||||
|
||||
int size = 0;
|
||||
|
||||
if (inventory != null)
|
||||
size += inventory.size();
|
||||
|
||||
if (sellInventory != null)
|
||||
size += sellInventory.size();
|
||||
|
||||
if (size == 0) {
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0);
|
||||
return;
|
||||
}
|
||||
|
||||
writer.put((byte) 1);
|
||||
|
||||
int ownerID = npc.getObjectUUID();
|
||||
int indexPosition = writer.position();
|
||||
writer.putInt(0); //placeholder for item cnt
|
||||
int total = 0;
|
||||
|
||||
//add generic sell inventory from contract
|
||||
if (sellInventory != null) {
|
||||
|
||||
for (MobEquipment mobEquipment : sellInventory) {
|
||||
try {
|
||||
MobEquipment.serializeForVendor(mobEquipment,writer, sellPercent);
|
||||
} catch (SerializationException se) {
|
||||
continue;
|
||||
}
|
||||
++total;
|
||||
}
|
||||
}
|
||||
|
||||
//add npc inventory
|
||||
if (inventory != null) {
|
||||
for (Item item : inventory) {
|
||||
if (item.getOwnerID() != ownerID)
|
||||
continue;
|
||||
if (item.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
if (item.getNumOfItems() == 0)
|
||||
continue;
|
||||
}
|
||||
Item.serializeForClientMsgForVendorWithoutSlot(item,writer, sellPercent);
|
||||
++total;
|
||||
}
|
||||
}
|
||||
writer.putIntAt(total, indexPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 float getUnknown02() {
|
||||
return unknown02;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown02
|
||||
* the unknown02 to set
|
||||
*/
|
||||
public void setUnknown02(float unknown02) {
|
||||
this.unknown02 = unknown02;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown03
|
||||
*/
|
||||
public byte getUnknown03() {
|
||||
return unknown03;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown03
|
||||
* the unknown03 to set
|
||||
*/
|
||||
public void setUnknown03(byte 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the npcType
|
||||
*/
|
||||
public int getNpcType() {
|
||||
return npcType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npcType
|
||||
* the npcType to set
|
||||
*/
|
||||
public void setNpcType(int npcType) {
|
||||
this.npcType = npcType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the npcID
|
||||
*/
|
||||
public int getNpcID() {
|
||||
return npcID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npcID
|
||||
* the npcID to set
|
||||
*/
|
||||
public void setNpcID(int npcID) {
|
||||
this.npcID = npcID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class ChangeAltitudeMsg extends ClientNetMsg {
|
||||
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private boolean up;
|
||||
private float startAlt;
|
||||
private float targetAlt;
|
||||
private float amountToMove;
|
||||
private byte unknown01 = (byte) 0;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ChangeAltitudeMsg() {
|
||||
super(Protocol.CHANGEALTITUDE);
|
||||
}
|
||||
|
||||
public ChangeAltitudeMsg(int sourceType, int sourceID, boolean up, float startAlt, float targetAlt, float amountToMove) {
|
||||
super(Protocol.CHANGEALTITUDE);
|
||||
this.sourceType = sourceType;
|
||||
this.sourceID = sourceID;
|
||||
this.startAlt = startAlt;
|
||||
this.targetAlt = targetAlt;
|
||||
this.amountToMove = amountToMove;
|
||||
this.up = up;
|
||||
}
|
||||
|
||||
public static ChangeAltitudeMsg GroundPlayerMsg(PlayerCharacter pc){
|
||||
|
||||
ChangeAltitudeMsg msg = new ChangeAltitudeMsg(pc.getObjectType().ordinal(),pc.getObjectUUID(),false,pc.getAltitude(),0,pc.getAltitude());
|
||||
return msg;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ChangeAltitudeMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CHANGEALTITUDE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.put((this.up ? (byte) 1 : (byte) 0));
|
||||
writer.putFloat(this.startAlt);
|
||||
writer.putFloat(this.targetAlt);
|
||||
writer.putFloat(this.amountToMove);
|
||||
writer.put((byte)0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.up = (reader.get() == (byte) 1);
|
||||
this.startAlt = reader.getFloat();
|
||||
this.targetAlt = reader.getFloat();
|
||||
this.amountToMove = reader.getFloat();
|
||||
this.unknown01 = reader.get();
|
||||
}
|
||||
|
||||
public int getSourceType() {
|
||||
return this.sourceType;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return this.sourceID;
|
||||
}
|
||||
|
||||
public boolean up() {
|
||||
return this.up;
|
||||
}
|
||||
|
||||
public float getStartAlt() {
|
||||
return this.startAlt;
|
||||
}
|
||||
|
||||
public float getTargetAlt() {
|
||||
return this.targetAlt;
|
||||
}
|
||||
|
||||
public float getAmountToMove() {
|
||||
return this.amountToMove;
|
||||
}
|
||||
|
||||
public byte getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setUp(boolean value) {
|
||||
this.up = value;
|
||||
}
|
||||
|
||||
public void setStartAlt(float value) {
|
||||
this.startAlt = value;
|
||||
}
|
||||
|
||||
public void setTargetAlt(float value) {
|
||||
this.targetAlt = value;
|
||||
}
|
||||
|
||||
public void setAmountToMove(float value) {
|
||||
this.amountToMove = value;
|
||||
}
|
||||
|
||||
public void setUnknown01(byte value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class ChangeGuildLeaderMsg extends ClientNetMsg {
|
||||
|
||||
private int targetID;
|
||||
|
||||
|
||||
/**
|
||||
* 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 ChangeGuildLeaderMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CHANGEGUILDLEADER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(targetID);
|
||||
writer.put((byte)100);
|
||||
writer.putInt(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setTargetID(int targetID) {
|
||||
this.targetID = targetID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class ChatFilterMsg extends ClientNetMsg {
|
||||
|
||||
private int channel;
|
||||
private byte mute;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param channel
|
||||
*/
|
||||
public ChatFilterMsg(int channel) {
|
||||
super(Protocol.CHANNELMUTE);
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ChatFilterMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CHANNELMUTE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.channel);
|
||||
writer.put(this.mute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.channel = reader.getInt();
|
||||
this.mute = reader.get();
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public byte getMute() {
|
||||
return mute;
|
||||
}
|
||||
|
||||
public void setMute(byte mute) {
|
||||
this.mute = mute;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ProtectionState;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Zone;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class CityAssetMsg extends ClientNetMsg {
|
||||
|
||||
Set<Building> allCityAssets;
|
||||
Set<Building> canProtectAssets;
|
||||
private int type;
|
||||
private int buildingID;
|
||||
private int size;
|
||||
private int pad = 0;
|
||||
|
||||
/**
|
||||
* 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 CityAssetMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CITYASSET, origin, reader);
|
||||
}
|
||||
|
||||
public CityAssetMsg() {
|
||||
super(Protocol.CITYASSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
// Larger size for historically larger opcodes
|
||||
return (12);
|
||||
}
|
||||
|
||||
|
||||
// Precache and configure this message before we serialize it
|
||||
|
||||
public void configure() {
|
||||
|
||||
Building tol;
|
||||
Zone zone;
|
||||
City city;
|
||||
|
||||
canProtectAssets = new HashSet<>();
|
||||
|
||||
tol = BuildingManager.getBuildingFromCache(this.buildingID);
|
||||
|
||||
if (tol == null) {
|
||||
Logger.debug("TOL is null");
|
||||
return;
|
||||
}
|
||||
|
||||
zone = tol.getParentZone();
|
||||
|
||||
if (zone == null) {
|
||||
Logger.debug("Zone is null");
|
||||
return;
|
||||
}
|
||||
|
||||
city = City.getCity(zone.getPlayerCityUUID());
|
||||
|
||||
if (city == null) {
|
||||
Logger.debug( "Failed to load city data for Tree of life.");
|
||||
return;
|
||||
}
|
||||
|
||||
allCityAssets = zone.zoneBuildingSet;
|
||||
|
||||
for (Building building : allCityAssets) {
|
||||
|
||||
if (building.getBlueprint() == null)
|
||||
continue;
|
||||
|
||||
// Protected assets do not show up on list
|
||||
|
||||
if (building.assetIsProtected() == true)
|
||||
continue;
|
||||
|
||||
if (building.getProtectionState() == ProtectionState.PENDING)
|
||||
continue;
|
||||
|
||||
// Shouldn't need this but just in case
|
||||
|
||||
if (building.getBlueprint().isWallPiece())
|
||||
continue;
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))
|
||||
continue;
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
|
||||
continue;
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE))
|
||||
continue;
|
||||
|
||||
if (!city.isLocationOnCityGrid(building.getLoc()))
|
||||
continue;
|
||||
|
||||
canProtectAssets.add(building);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
String buildingName;
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
|
||||
writer.putInt(canProtectAssets.size());
|
||||
|
||||
for (Building cityBuilding : canProtectAssets) {
|
||||
|
||||
buildingName = cityBuilding.getName();
|
||||
|
||||
if (buildingName.isEmpty() && cityBuilding.getBlueprint() != null) {
|
||||
buildingName = cityBuilding.getBlueprint().getName();
|
||||
}
|
||||
|
||||
writer.putInt(cityBuilding.getObjectType().ordinal());
|
||||
writer.putInt(cityBuilding.getObjectUUID());
|
||||
|
||||
writer.putString(buildingName);
|
||||
writer.putString(cityBuilding.getGuild().getName());
|
||||
writer.putInt(20);// \/ Temp \/
|
||||
writer.putInt(cityBuilding.getRank());
|
||||
|
||||
if (cityBuilding.getBlueprint() != null) {
|
||||
writer.putInt(cityBuilding.getBlueprint().getIcon());
|
||||
}
|
||||
else {
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.putInt(7); //TODO identify these Guild tags??
|
||||
writer.putInt(17);
|
||||
writer.putInt(14);
|
||||
writer.putInt(14);
|
||||
writer.putInt(98);// /\ Temp /\
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getPad() {
|
||||
return pad;
|
||||
}
|
||||
|
||||
public void setPad(int value) {
|
||||
this.pad = value;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
return buildingID;
|
||||
}
|
||||
|
||||
public void setBuildingID(int buildingID) {
|
||||
this.buildingID = buildingID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
public class CityChoiceMsg extends ClientNetMsg {
|
||||
|
||||
private PlayerCharacter pc;
|
||||
private boolean isTeleport;
|
||||
private int msgType;
|
||||
private int cityID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public CityChoiceMsg(PlayerCharacter pc, boolean isTeleport) {
|
||||
super(Protocol.CITYCHOICE);
|
||||
this.pc = pc;
|
||||
this.isTeleport = isTeleport;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CityChoiceMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CITYCHOICE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public CityChoiceMsg(CityChoiceMsg msg) {
|
||||
super(Protocol.CITYCHOICE);
|
||||
this.pc = msg.pc;
|
||||
this.isTeleport = msg.isTeleport;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
// Larger size for historically larger opcodes
|
||||
return (12);
|
||||
}
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
//Do we even want to try this?
|
||||
this.msgType = reader.getInt();
|
||||
reader.getInt();
|
||||
this.cityID = reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
}
|
||||
|
||||
public PlayerCharacter pc() {
|
||||
return this.pc;
|
||||
}
|
||||
|
||||
public boolean isTeleport() {
|
||||
return this.isTeleport;
|
||||
}
|
||||
|
||||
public void setPC(PlayerCharacter pc) {
|
||||
this.pc = pc;
|
||||
}
|
||||
|
||||
public void setIsTeleport(boolean value) {
|
||||
this.isTeleport = value;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return msgType;
|
||||
}
|
||||
|
||||
public int getCityID() {
|
||||
return cityID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Zone;
|
||||
|
||||
public class CityZoneMsg extends ClientNetMsg {
|
||||
|
||||
private int messageType; //1 or 2
|
||||
private int zoneType;
|
||||
private int zoneID;
|
||||
private float locX;
|
||||
private float locY;
|
||||
private float locZ;
|
||||
private String name;
|
||||
private float radiusX;
|
||||
private float radiusZ;
|
||||
private int unknown01 = 0;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
|
||||
public CityZoneMsg(int messageType, float locX, float locY, float locZ, String name, Zone zone, float radiusX, float radiusZ) {
|
||||
super(Protocol.CITYZONE);
|
||||
this.messageType = messageType; //only 1 or 2 used on message type
|
||||
this.zoneType = GameObjectType.Zone.ordinal();
|
||||
this.zoneID = zone.getObjectUUID();
|
||||
this.locX = locX;
|
||||
this.locY = locY;
|
||||
this.locZ = locZ;
|
||||
this.name = name;
|
||||
this.radiusX = radiusX;
|
||||
this.radiusZ = radiusZ;
|
||||
this.unknown01 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CityZoneMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.CITYZONE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
|
||||
writer.putInt(this.messageType);
|
||||
|
||||
|
||||
//MSGTYPE 3 SERIALIZATION
|
||||
if (this.messageType == 3){
|
||||
writer.putInt(1);
|
||||
writer.putInt(this.zoneType);
|
||||
writer.putInt(this.zoneID);
|
||||
writer.putString("RuinedCity");
|
||||
writer.putString("Ruined");
|
||||
writer.putFloat(this.locX);
|
||||
writer.putFloat(this.locY);
|
||||
writer.putFloat(this.locZ);
|
||||
writer.putInt(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//END SERIALIZIONTYPE 3
|
||||
|
||||
// writer.putInt(this.messageType);
|
||||
if (this.messageType == 1){
|
||||
writer.putInt(this.zoneType);
|
||||
writer.putInt(this.zoneID);
|
||||
}
|
||||
|
||||
writer.putFloat(this.locX);
|
||||
writer.putFloat(this.locY);
|
||||
writer.putFloat(this.locZ);
|
||||
writer.putString(this.name);
|
||||
if (this.messageType == 1) {
|
||||
writer.putFloat(this.radiusX);
|
||||
writer.putFloat(this.radiusZ);
|
||||
}
|
||||
writer.putInt(this.unknown01);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
// this.locX = reader.getFloat();
|
||||
// this.locY = reader.getFloat();
|
||||
// this.locZ = reader.getFloat();
|
||||
// this.name = reader.getString();
|
||||
// this.unknown01 = reader.getInt();
|
||||
}
|
||||
|
||||
public float getLocX() {
|
||||
return this.locX;
|
||||
}
|
||||
|
||||
public float getLocY() {
|
||||
return this.locY;
|
||||
}
|
||||
|
||||
public float getLocZ() {
|
||||
return this.locZ;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public void setLocX(float value) {
|
||||
this.locX = value;
|
||||
}
|
||||
|
||||
public void setLocY(float value) {
|
||||
this.locY = value;
|
||||
}
|
||||
|
||||
public void setLocZ(float value) {
|
||||
this.locZ = value;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class ClaimAssetMsg extends ClientNetMsg {
|
||||
private int pad;
|
||||
private int objectType;
|
||||
private int objectUUID;
|
||||
|
||||
public ClaimAssetMsg(int objectType, int objectUUID) {
|
||||
super(Protocol.CLAIMASSET);
|
||||
this.pad = 0;
|
||||
this.objectType = objectType;
|
||||
this.objectUUID = objectUUID;
|
||||
}
|
||||
/**
|
||||
* 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 ClaimAssetMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CLAIMASSET, origin, reader);
|
||||
}
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.pad = reader.getInt();
|
||||
this.objectType = reader.getInt();
|
||||
this.objectUUID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(this.pad);
|
||||
writer.putInt(this.objectType);
|
||||
writer.putInt(this.objectUUID);
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(int value) {
|
||||
this.objectType = value;
|
||||
}
|
||||
|
||||
public int getUUID() {
|
||||
return objectUUID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
/**
|
||||
* Open manage city asset window
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class ClaimGuildTreeMsg extends ClientNetMsg {
|
||||
|
||||
// 2 = manage this asset. 20 = manage entire city
|
||||
|
||||
private int messageType;
|
||||
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
|
||||
private int charter;
|
||||
private int bgc1;
|
||||
private int bgc2;
|
||||
private int symbolColor;
|
||||
private int bgDesign;
|
||||
private int symbol;
|
||||
private int unknown07;
|
||||
private int unknown08;
|
||||
private int unknown09;
|
||||
private int unknown10;
|
||||
private int unknown11;
|
||||
|
||||
private String CityName;
|
||||
private String OwnerName;
|
||||
private String GuildName;
|
||||
private int unknown12;
|
||||
private byte UnkByte01;
|
||||
private int unknown13;
|
||||
private int unknown14;
|
||||
private int unknown15;
|
||||
private int unknown16;
|
||||
private int unknown17;
|
||||
private int unknown18;
|
||||
|
||||
private byte UnkByte02;
|
||||
private byte UnkByte03;
|
||||
private byte UnkByte04;
|
||||
private byte UnkByte05;
|
||||
|
||||
private int unknown19; //Arraylist motto length?
|
||||
private String motto; //motto Length 60 max?
|
||||
public static final int RENAME_TREE = 2;
|
||||
public static final int OPEN_CITY = 4;
|
||||
public static final int CLOSE_CITY = 5;
|
||||
private String treeName;
|
||||
|
||||
// private int unknown01;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public ClaimGuildTreeMsg() {
|
||||
super(Protocol.CLAIMGUILDTREE);
|
||||
this.messageType = 0;
|
||||
this.targetType=0;
|
||||
this.targetID = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ClaimGuildTreeMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.CLAIMGUILDTREE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
this.messageType = reader.getInt();
|
||||
switch (this.messageType){
|
||||
case OPEN_CITY:
|
||||
case CLOSE_CITY:
|
||||
targetType = reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
break;
|
||||
case RENAME_TREE:
|
||||
targetType = reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.treeName = reader.getString();
|
||||
break;
|
||||
default:
|
||||
targetType = reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.treeName = reader.getString();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer){
|
||||
writer.putInt(this.messageType);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
if (this.messageType == RENAME_TREE)
|
||||
writer.putString(this.treeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the charter
|
||||
*/
|
||||
public int getcharter() {
|
||||
return charter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public int getbgc1() {
|
||||
return bgc1;
|
||||
}
|
||||
public int getbgc2() {
|
||||
return bgc2;
|
||||
}
|
||||
public int getsymbolColor() {
|
||||
return symbolColor;
|
||||
}
|
||||
public int getbgDesign() {
|
||||
return bgDesign;
|
||||
}
|
||||
public int getsymbol() {
|
||||
return symbol;
|
||||
}
|
||||
public int getUnknown07() {
|
||||
return unknown07;
|
||||
}
|
||||
public int getUnknown08() {
|
||||
return unknown08;
|
||||
}
|
||||
public int getUnknown09() {
|
||||
return unknown09;
|
||||
}
|
||||
public int getUnknown10() {
|
||||
return unknown10;
|
||||
}
|
||||
public int getUnknown11() {
|
||||
return unknown11;
|
||||
}
|
||||
public int getUnknown12() {
|
||||
return unknown12;
|
||||
}
|
||||
public int getUnknown13() {
|
||||
return unknown13;
|
||||
}
|
||||
public int getUnknown14() {
|
||||
return unknown14;
|
||||
}
|
||||
public int getUnknown15() {
|
||||
return unknown15;
|
||||
}
|
||||
public int getUnknown16() {
|
||||
return unknown16;
|
||||
}
|
||||
public int getUnknown17() {
|
||||
return unknown17;
|
||||
}
|
||||
public int getUnknown18() {
|
||||
return unknown18;
|
||||
}
|
||||
public int getUnknown19() {
|
||||
return unknown19;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String getOwnerName() {
|
||||
return OwnerName;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return CityName;
|
||||
}
|
||||
|
||||
public String getGuildName() {
|
||||
return GuildName;
|
||||
}
|
||||
public void setcharter(int charter) {
|
||||
this.charter = charter;
|
||||
}
|
||||
public void setbgc1 (int bgc1) {
|
||||
this.bgc1 = bgc1;
|
||||
}
|
||||
public void setbgc2 (int bgc2) {
|
||||
this.bgc2 = bgc2;
|
||||
}
|
||||
public void setsymbolColor (int symbolColor) {
|
||||
this.symbolColor = symbolColor;
|
||||
}
|
||||
public void setbgDesign (int bgDesign) {
|
||||
this.bgDesign = bgDesign;
|
||||
}
|
||||
public void setsymbol (int symbol) {
|
||||
this.symbol = symbol;
|
||||
}
|
||||
public void setUnknown07 (int unknown07) {
|
||||
this.unknown07 = unknown07;
|
||||
}
|
||||
public void setUnknown08 (int unknown08) {
|
||||
this.unknown08 = unknown08;
|
||||
}
|
||||
public void setUnknown09 (int unknown09) {
|
||||
this.unknown09 = unknown09;
|
||||
}
|
||||
public void setUnknown10 (int unknown10) {
|
||||
this.unknown10 = unknown10;
|
||||
}
|
||||
public void setUnknown11 (int unknown11) {
|
||||
this.unknown11 = unknown11;
|
||||
}
|
||||
public void setUnknown12 (int unknown12) {
|
||||
this.unknown12 = unknown12;
|
||||
}
|
||||
public void setUnknown13 (int unknown13) {
|
||||
this.unknown13 = unknown13;
|
||||
}
|
||||
public void setUnknown14 (int unknown14) {
|
||||
this.unknown14 = unknown14;
|
||||
}
|
||||
public void setUnknown15 (int unknown15) {
|
||||
this.unknown15 = unknown15;
|
||||
}
|
||||
public void setUnknown16 (int unknown16) {
|
||||
this.unknown16 = unknown16;
|
||||
}
|
||||
public void setUnknown17 (int unknown17) {
|
||||
this.unknown17 = unknown17;
|
||||
}
|
||||
public void setUnknown18 (int unknown18) {
|
||||
this.unknown18 = unknown18;
|
||||
}
|
||||
public void setUnknown19 (int unknown19) {
|
||||
this.unknown19 = unknown19;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void setUnkByte01 (byte UnkByte01) {
|
||||
this.UnkByte01 = UnkByte01;
|
||||
}
|
||||
public void setUnkByte02 (byte UnkByte02) {
|
||||
this.UnkByte02 = UnkByte02;
|
||||
}
|
||||
public void setUnkByte03 (byte UnkByte03) {
|
||||
this.UnkByte03 = UnkByte03;
|
||||
}
|
||||
public void setUnkByte04 (byte UnkByte04) {
|
||||
this.UnkByte04 = UnkByte04;
|
||||
}
|
||||
|
||||
|
||||
public void setOwnerName(String OwnerName) {
|
||||
this.OwnerName = OwnerName;
|
||||
}
|
||||
|
||||
public void setCityName(String CityName) {
|
||||
this.CityName = CityName;
|
||||
}
|
||||
|
||||
public void setGuildName(String GuildName) {
|
||||
this.GuildName = GuildName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setMotto(String motto) {
|
||||
this.motto = motto;
|
||||
}
|
||||
|
||||
public String getMotto() {
|
||||
return motto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setUnkByte05(byte unkByte05) {
|
||||
UnkByte05 = unkByte05;
|
||||
}
|
||||
|
||||
public byte getUnkByte05() {
|
||||
return UnkByte05;
|
||||
}
|
||||
|
||||
public void setMessageType(int value) {
|
||||
this.messageType = value;
|
||||
}
|
||||
|
||||
public int getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setTargetID(int targetID) {
|
||||
this.targetID = targetID;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public void setTargetType(int targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
|
||||
public String getTreeName() {
|
||||
return treeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Debug Info
|
||||
//Run: Failed to make object TEMPLATE:135700 INSTANCE:1717987027141... (t=50.46) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:108760 INSTANCE:1717987027161... (t=50.46) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:108760 INSTANCE:1717987027177... (t=50.67) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:60040 INSTANCE:1717987027344... (t=50.87) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:3 INSTANCE:1717987027164... (t=50.88) (r=7/4/2011 11:56:39)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public abstract class ClientNetMsg extends AbstractNetMsg {
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
protected ClientNetMsg(Protocol protocolMsg) {
|
||||
super(protocolMsg);
|
||||
}
|
||||
|
||||
protected ClientNetMsg(Protocol protocolMsg, ClientNetMsg msg) {
|
||||
super(protocolMsg, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
protected ClientNetMsg(Protocol protocolMsg, AbstractConnection origin,
|
||||
ByteBufferReader reader) {
|
||||
super(protocolMsg, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected abstract void _deserialize(ByteBufferReader reader)
|
||||
;
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected abstract void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException;
|
||||
|
||||
/*
|
||||
* return the header size of 4 for ClientMsgs
|
||||
*/
|
||||
@Override
|
||||
protected int getHeaderSize() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write in the header for ClientMsgs
|
||||
*/
|
||||
@Override
|
||||
protected void writeHeaderAt(int startPos, ByteBufferWriter writer) {
|
||||
writer.putIntAt(this.getProtocolMsg().opcode, startPos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
/**
|
||||
* Commit to trade
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class CloseTradeWindowMsg extends ClientNetMsg {
|
||||
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private int unknown01;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public CloseTradeWindowMsg(AbstractGameObject player, int unknown01) {
|
||||
super(Protocol.TRADECLOSE);
|
||||
this.playerType = player.getObjectType().ordinal();
|
||||
this.playerID = player.getObjectUUID();
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CloseTradeWindowMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.TRADECLOSE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
playerType = reader.getInt();
|
||||
playerID = reader.getInt();
|
||||
unknown01 = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
|
||||
writer.putInt(unknown01);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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,95 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
/**
|
||||
* Commit to trade
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class CommitToTradeMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private long playerCompID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public CommitToTradeMsg(int unknown01, long playerCompID) {
|
||||
super(Protocol.TRADECONFIRM);
|
||||
this.unknown01 = unknown01;
|
||||
this.playerCompID = playerCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CommitToTradeMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.TRADECONFIRM, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
playerCompID = reader.getLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putLong(playerCompID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown01
|
||||
*/
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown01 the unknown01 to set
|
||||
*/
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the playerCompID
|
||||
*/
|
||||
public long getPlayerCompID() {
|
||||
return playerCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param playerCompID the playerCompID to set
|
||||
*/
|
||||
public void setPlayerCompID(long playerCompID) {
|
||||
this.playerCompID = playerCompID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class ConfirmPromoteMsg extends ClientNetMsg {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param channel
|
||||
*/
|
||||
public ConfirmPromoteMsg(int channel) {
|
||||
super(Protocol.CONFIRMPROMOTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ConfirmPromoteMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CONFIRMPROMOTE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
HashSet<Integer> playerFriendSet = PlayerFriendsMap.get(playerUID);
|
||||
playerFriendSet.add(friendUID); * Copyright 2013 MagicBane Emulator Project
|
||||
* All Rights Reserved
|
||||
*/
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
public class DeclineFriendMsg extends ClientNetMsg {
|
||||
|
||||
public String sourceName;
|
||||
public String friendName;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public DeclineFriendMsg(PlayerCharacter pc) {
|
||||
super(Protocol.FRIENDDECLINE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 DeclineFriendMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.FRIENDDECLINE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public DeclineFriendMsg(DeclineFriendMsg msg) {
|
||||
super(Protocol.FRIENDDECLINE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
//Do we even want to try this?
|
||||
this.sourceName = reader.getString(); //This is source name.. this friends list must never been updated since launch, not using IDS.
|
||||
this.friendName = reader.getString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putString(this.sourceName);
|
||||
writer.putString(this.friendName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class DeleteItemMsg extends ClientNetMsg {
|
||||
|
||||
private int type;
|
||||
private int objectUUID;
|
||||
private int unknown1, unknown2;
|
||||
|
||||
public DeleteItemMsg(int type, int objectUUID) {
|
||||
super(Protocol.DELETEOBJECT);
|
||||
this.type = type;
|
||||
this.objectUUID = objectUUID;
|
||||
this.unknown1 = 0;
|
||||
this.unknown2 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 DeleteItemMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.DELETEOBJECT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
this.objectUUID = reader.getInt();
|
||||
this.unknown1 = reader.getInt();
|
||||
this.unknown2 = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(this.type);
|
||||
writer.putInt(this.objectUUID);
|
||||
writer.putInt(this.unknown1);
|
||||
writer.putInt(this.unknown2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the objectUUID
|
||||
*/
|
||||
public int getUUID() {
|
||||
return objectUUID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class DestroyBuildingMsg extends ClientNetMsg {
|
||||
private int pad = 0;
|
||||
private int objectType;
|
||||
private int objectUUID;
|
||||
|
||||
/**
|
||||
* 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 DestroyBuildingMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.DESTROYBUILDING, origin, reader);
|
||||
}
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.pad = reader.getInt();
|
||||
this.objectType = reader.getInt();
|
||||
this.objectUUID = reader.getInt();;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(this.pad);
|
||||
writer.putInt(this.objectType);
|
||||
writer.putInt(this.objectUUID);
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(int value) {
|
||||
this.objectType = value;
|
||||
}
|
||||
|
||||
public void setPad(int value) {
|
||||
this.pad = value;
|
||||
}
|
||||
|
||||
public int getUUID() {
|
||||
return objectUUID;
|
||||
}
|
||||
|
||||
public int getPad() {
|
||||
return pad;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class DoorTryOpenMsg extends ClientNetMsg {
|
||||
|
||||
private int unk1;
|
||||
private int doorID;
|
||||
private int buildingUUID;
|
||||
private int playerUUID;
|
||||
private byte toggle;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public DoorTryOpenMsg(int doorID, int targetID, int senderID, byte toggle) {
|
||||
super(Protocol.DOORTRYOPEN);
|
||||
this.unk1 = 0;
|
||||
this.doorID = doorID;
|
||||
this.buildingUUID = targetID;
|
||||
this.playerUUID = senderID;
|
||||
this.toggle = toggle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 DoorTryOpenMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.DOORTRYOPEN, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
if (this.unk1 == 2) {
|
||||
writer.putInt(2);
|
||||
for (int i=0;i<6;i++)
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
} else {
|
||||
writer.putInt(0); //0 or 2. If 2 all other variables are 0
|
||||
writer.putInt(0);
|
||||
writer.putInt(doorID);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(buildingUUID);
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(playerUUID);
|
||||
writer.put(toggle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.unk1 = reader.getInt();
|
||||
reader.getInt();
|
||||
this.doorID = reader.getInt();
|
||||
reader.getInt(); // type padding
|
||||
this.buildingUUID = reader.getInt();
|
||||
reader.getInt(); // type padding
|
||||
this.playerUUID = reader.getInt();
|
||||
this.toggle = reader.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown1
|
||||
*/
|
||||
public int getDoorID() {
|
||||
return doorID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the buildingUUID
|
||||
*/
|
||||
public int getBuildingUUID() {
|
||||
return buildingUUID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the playerUUID
|
||||
*/
|
||||
public int playerUUID() {
|
||||
return playerUUID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the toggle
|
||||
*/
|
||||
public byte getToggle() {
|
||||
return toggle;
|
||||
}
|
||||
|
||||
public int getUnk1() {
|
||||
return this.unk1;
|
||||
}
|
||||
|
||||
public void setUnk1(int value) {
|
||||
this.unk1 = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class DropGoldMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private int unknown02;
|
||||
private int unknown03;
|
||||
private short unknown04;
|
||||
private byte unknown05;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public DropGoldMsg() {
|
||||
super(Protocol.DROPGOLD);
|
||||
this.unknown01 = 0x40A5BDB0;
|
||||
this.unknown02 = 0x342AA9F0;
|
||||
this.unknown03 = 0;
|
||||
this.unknown04 = (short) 0;
|
||||
this.unknown05 = (byte) 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 DropGoldMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.DROPGOLD, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 short getUnknown04() {
|
||||
return unknown04;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown04
|
||||
* the unknown04 to set
|
||||
*/
|
||||
public void setUnknown04(short unknown04) {
|
||||
this.unknown04 = unknown04;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown05
|
||||
*/
|
||||
public byte getUnknown05() {
|
||||
return unknown05;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown05
|
||||
* the unknown05 to set
|
||||
*/
|
||||
public void setUnknown05(byte unknown05) {
|
||||
this.unknown05 = unknown05;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class EnterWorldReceivedMsg extends ClientNetMsg {
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public EnterWorldReceivedMsg() {
|
||||
super(Protocol.READYTOENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 EnterWorldReceivedMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.READYTOENTER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
return 18; //65536 bytes for enter world.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.net.*;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class ErrorPopupMsg extends ClientNetMsg {
|
||||
|
||||
//1: Sorry, but that individual is not a banker
|
||||
//2: Sorry, but you must be closer to the banker to access your account
|
||||
//3: Sorry, but you have insufficient funds to access your acount
|
||||
//4: The shop is closed
|
||||
//5: You must come closer to shop
|
||||
//6: You do not have enough money to purchase that
|
||||
//7: You cannot carry that item
|
||||
//8: The banker cannot carry that item
|
||||
//9: You do not have that much gold to drop
|
||||
//10: That item cannot be dropped
|
||||
//11: You cannot drop what you do not have
|
||||
//12: Sorry, but this container is locked
|
||||
//13: Sorry, but this container is barred
|
||||
//14: You must come closer to me
|
||||
//15: You no longer have that item to sell
|
||||
//16: I won't buy that kind of item
|
||||
//17: I cannot afford that item
|
||||
//18: You can't really afford that
|
||||
//19: This item is gone from inventory
|
||||
//20: Your resurection has been declined
|
||||
//21: I cannot carry that weight
|
||||
//22: You just dropped that item on the ground
|
||||
//23: This corpse has no experience to return
|
||||
//24: This player is not in world
|
||||
//25: This player is not online
|
||||
//26: You selected an invalid location
|
||||
//27: You are dead. Try again when you are not so...well, dead
|
||||
//28: Your target is dead and cannot be summoned
|
||||
//29: Your summons has been declined
|
||||
//30: That person cannot carry that item
|
||||
//31: An unexpected error has occurred and the trade is being canceled
|
||||
//32: You must choose a promotion class before gaining your next level. Speak to a class trainer
|
||||
//33: Promotion failed
|
||||
//34: Come back when you've gained more experience
|
||||
//35: This hireling failed to buy the item
|
||||
//36: I don't buy items
|
||||
//37: I don't sell items
|
||||
//38: You appear to be in a building normally
|
||||
//39: There does not appear to be a building where you are
|
||||
//40: I don't swear guilds
|
||||
//41: I server no sovereign
|
||||
//42: Your guild is not errant
|
||||
//43: Members of your guild are too high in level
|
||||
//44: You cannot afford this service
|
||||
//45: Failure to swear guild
|
||||
//46: Cannot swear under ruins
|
||||
//47: Your guild is the wrong type to swear to this guild
|
||||
//48: Hireling could not hire
|
||||
//49: I do not hire
|
||||
//50: This pet is gone
|
||||
//51: You have successfully promoted to a new class
|
||||
//52: You have successfully added a new discipline
|
||||
//53: You no longer meet the level requirement to stay in this guild
|
||||
//54: That item is too advanced
|
||||
//55: All production slots are taken
|
||||
//56: That enchantment is too advanced
|
||||
//57: That formula is too advanced
|
||||
//58: The formula is beyond the means of this facility
|
||||
//59: This hireling does not have this formula
|
||||
//60: Hireling does not possess that item!
|
||||
//61: Hireling does not work with such items
|
||||
//62: You may only trade with items in your inventory
|
||||
//63: You must be within your building to do that
|
||||
//64: You are too far from the building to do that
|
||||
//65: I cannot enthrall creatures
|
||||
//66: I cannot repledge you
|
||||
//67: I cannot teleport you
|
||||
//68: You have no valid thralls
|
||||
//69: You have a thrall that I do not understand
|
||||
//70: I cannot afford your thrall
|
||||
//71: There are no cities to which you can repledge
|
||||
//72: There are no cities to which you can teleport
|
||||
//73: You are too low level to repledge
|
||||
//74: You are too low level to teleport
|
||||
//75: You must leave your current guild before you can repledge
|
||||
//76: Failure to repledge
|
||||
//77: Failure to teleport
|
||||
//78: You do not meet the qualifications to join that city
|
||||
//79: There are too many furniture items in this asset
|
||||
//80: Attempting to add furniture to bad location
|
||||
//81: This deed codes for a bad furniture prop
|
||||
//82: Object is not an appropriate furniture deed
|
||||
//83: Unable to find corresponding furniture on asset
|
||||
//84: The chose game world is not valid <- will kick out of world
|
||||
//85: The game world is temporarily unavailable <- will kick out of world
|
||||
//86: The runegate is unnaffected by this power
|
||||
//87: You are not powerful enough to activate this gate
|
||||
//88: This runegate is already on
|
||||
//89: You cannot unbanish this one until the timestamp expires
|
||||
//90: You cannot trade while either you or the target is invisible
|
||||
//91: You cannot trade while in combat mode
|
||||
//92: That person is already engaged in a trade
|
||||
//93: You must be closer to trade
|
||||
//94: The trade was successful
|
||||
//95: The trade was not successful
|
||||
//96: The trade has failed because one of you would exceed your gold limit
|
||||
//97: You must be closer to open that
|
||||
//98: You cannot loot while flying
|
||||
//99: Your target is not dead
|
||||
//100: You cannot loot a trainer
|
||||
//101: You cannot loot a shopkeeper
|
||||
//102: You cannot loot a banker
|
||||
//103: You cannot add this individual to the condemn list
|
||||
//104: You cannot add the owner's guild to the condemn list
|
||||
//105: You cannot add the owner's nation to the condemn list
|
||||
//106: Failure to add to the condemn list
|
||||
//107: Unable to find desired group
|
||||
//108: Group is at maximum membership
|
||||
//109: Failed to add item to hireling
|
||||
//110: Failer to remove item from hireling
|
||||
//111: This item cannot be removed from inventory
|
||||
//112: Your account has no characters
|
||||
//113: Failure to start support
|
||||
//114: Cannot add another support
|
||||
//115: This type of asset cannot receive protection
|
||||
//116: This asset already has protection upon it
|
||||
//117: Failure to remove support
|
||||
//118: Failure to complete support
|
||||
//119: Failure to reject support
|
||||
//120: This asset is not a banecircle
|
||||
//121: You are not a CSR who can advance banecircle stage
|
||||
//122: Failure to advance banecircle stage
|
||||
//123: You do not have the authority within your guild to modify this banecircle
|
||||
//124: Banecircle cannot advance once in final stage
|
||||
//125: Failure to repair Asset
|
||||
//126: Asset does not require repair
|
||||
//127: No gold in asset strongbox
|
||||
//128: Insufficient funds for even one point of repair
|
||||
//129: You cannot bond where you are killed-on-sight
|
||||
//130: You cannot join where you are killed-on-sight
|
||||
//131: You do not meet the level required for this SWORN guild
|
||||
//132: You are already a member of this guild
|
||||
//133: Your banishment from this guild has not yet been lifted
|
||||
//134: Your QUIT status from this guild has not yet expired
|
||||
//135: Character is considered BANISHED by guild leadership
|
||||
//136: Your class is not allowed to teleport here
|
||||
//137: You have no affiliation with this tree
|
||||
//138: You can never join this type of tree
|
||||
//139: You do not meet the safehold level requirement
|
||||
//140: Ruined trees are invalid
|
||||
//141: Unclaimed trees are invalid
|
||||
//142: You are the wrong race for this city
|
||||
//143: You are the wrong class for this city
|
||||
//144: You are the wrong sex for this city
|
||||
//145: You are too low level for this city
|
||||
//146: You do not meet the level requirements for this city
|
||||
//147: Tree must be rank 5 to open city
|
||||
//148: Unable to find a matching petition to complete guild creation
|
||||
//149: Guild name fails profanity check
|
||||
//150: Guild motto fails profanity check
|
||||
//151: Guild name is not unique
|
||||
//152: Guild crest is not unique
|
||||
//153: Guild crest is reserved
|
||||
//154: All three crest colors cannot be the same
|
||||
//155: Please choose another name
|
||||
//156: You cannot bank and trade at the same time
|
||||
//157: You must not move or engage in combat for 10 seconds before stuck will work
|
||||
//158: Your gold has been dropped on the ground
|
||||
//159: Merchant cannot purchase item without exceeding his reserve
|
||||
//160: Rune succesfully applied
|
||||
//161: You cannot apply that rune
|
||||
//162: You rely too heavily on that rune to remove it
|
||||
//163: This shrine does not take offerings of that type
|
||||
//164: This hireling cannot grant boons
|
||||
//165: This hireling cannot display the leaderboard
|
||||
//166: There is no more favor in this shrine to loot
|
||||
//167: There are no more resources in this warehouse to loot
|
||||
//168: This boon is only for guild members belonging to this shrine
|
||||
//169: You do not meet the race/class requirements for this boon
|
||||
//170: This shrine is no longer capable of granting boons
|
||||
//171: This asset cannot be destroyed during times of war
|
||||
//172: This shrine has no favor
|
||||
//173: You must be the leader of a guild to receive a blessing
|
||||
//174: This siege spire cannot be toggled yet. Please try again later
|
||||
//175: You cannot teleport into that zone at the moment
|
||||
//176: Only guild leaders can claim a territory
|
||||
//177: Your nation has already reached the maximum number of capitals
|
||||
//178: This territory is already claimed
|
||||
//179: Only landed guilds may claim a territory
|
||||
//180: This territory cannot be ruled by anyone
|
||||
//181: Your tree must be rank 7 before claiming a territory
|
||||
//182: This realm is in turmoil and cannot be claimed yet
|
||||
//183: You cannot rule a guild under a different faction then your parent guild
|
||||
//184: Insufficient gold or resources to upgrade to capital
|
||||
//185: You must seek the blessing of the three sages before you can rule
|
||||
//186: Your tree is not inside a territory!
|
||||
//187: This realm is in turmoil and cannot yet be claimed!
|
||||
//188: You must have a warehouse to become a capital
|
||||
//189: You are not the owner of this building
|
||||
//190: This building cannot be upgraded further
|
||||
//191: You don't have the required funds
|
||||
//192: This building is already upgrading
|
||||
//193: Production denied: This building must be protected to gain access to warehouse resources..
|
||||
//194: The operation failed because you reached your gold limit
|
||||
//195: That player is currently busy completing the last trade. Try again in a few moments
|
||||
//196: You are currently busy completing the last trade. Try again in a few moments
|
||||
//197: You cannot join a guild whose nation has a guild that is currently involved in a siege
|
||||
//198: You cannot repledge while you are involved in a siege
|
||||
//199: You already have this boon
|
||||
//200: Your vault cannot contain that item
|
||||
//201: You can't put that much gold there
|
||||
//202: You can't carry that much gold
|
||||
//203: You don't have that much gold to transfer
|
||||
//204: That item is not in the vault
|
||||
//205: That item is not in the inventory
|
||||
//206: This building can hold no more gold
|
||||
private int message;
|
||||
private String custom = "";
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ErrorPopupMsg(int message) {
|
||||
super(Protocol.STANDARDALERT);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ErrorPopupMsg(int message, String custom) {
|
||||
super(Protocol.STANDARDALERT);
|
||||
this.message = message;
|
||||
this.custom = custom;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ErrorPopupMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.STANDARDALERT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public ErrorPopupMsg(ErrorPopupMsg msg) {
|
||||
super(Protocol.STANDARDALERT);
|
||||
this.message = msg.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.message = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.message);
|
||||
writer.putString(this.custom);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unknown01
|
||||
*/
|
||||
|
||||
// Popup Window with no title and arbitrary text.
|
||||
// Find an Enum for generic ERROR or way to set perhaps?
|
||||
|
||||
public static void sendErrorMsg(PlayerCharacter player, String errorMessage) {
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
|
||||
ErrorPopupMsg popupMessage;
|
||||
Dispatch errorDispatch;
|
||||
|
||||
popupMessage = new ErrorPopupMsg(300, errorMessage);
|
||||
|
||||
errorDispatch = Dispatch.borrow(player, popupMessage);
|
||||
DispatchMessage.dispatchMsgDispatch(errorDispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
public static void sendErrorPopup(PlayerCharacter player, int popupID) {
|
||||
|
||||
ErrorPopupMsg errorPopup;
|
||||
Dispatch errorDispatch;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
errorPopup = new ErrorPopupMsg(popupID);
|
||||
|
||||
errorDispatch = Dispatch.borrow(player, errorPopup);
|
||||
DispatchMessage.dispatchMsgDispatch(errorDispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
HashSet<Integer> playerFriendSet = PlayerFriendsMap.get(playerUID);
|
||||
playerFriendSet.add(friendUID); * Copyright 2013 MagicBane Emulator Project
|
||||
* All Rights Reserved
|
||||
*/
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
public class FriendRequestMsg extends ClientNetMsg {
|
||||
|
||||
public String sourceName;
|
||||
public String friendName;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public FriendRequestMsg(PlayerCharacter pc) {
|
||||
super(Protocol.PLAYERFRIENDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 FriendRequestMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.PLAYERFRIENDS, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public FriendRequestMsg(FriendRequestMsg msg) {
|
||||
super(Protocol.PLAYERFRIENDS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
//Do we even want to try this?
|
||||
this.sourceName = reader.getString(); //This is source name.. this friends list must never been updated since launch, not using IDS.
|
||||
this.friendName = reader.getString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putString(this.sourceName);
|
||||
writer.putString(this.friendName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class FurnitureMsg extends ClientNetMsg {
|
||||
|
||||
|
||||
private int type;
|
||||
private int buildingID;
|
||||
private int size;
|
||||
private int pad = 0;
|
||||
private int itemID;
|
||||
private Vector3fImmutable furnitureLoc;
|
||||
private int floor;
|
||||
private float rot;
|
||||
private float w;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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 FurnitureMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.FURNITURE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
if (this.type == 3){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.itemID = reader.getInt();
|
||||
this.furnitureLoc = reader.getVector3fImmutable();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
// Larger size for historically larger opcodes
|
||||
return (15);
|
||||
}
|
||||
|
||||
|
||||
// Precache and configure this message before we serialize it
|
||||
|
||||
public void configure() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
if (this.type == 3 || this.type == 4){
|
||||
writer.putInt(this.type);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(GameObjectType.Item.ordinal());
|
||||
writer.putInt(62280);
|
||||
writer.putVector3f(this.furnitureLoc);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
writer.putInt(2); //Type
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
writer.put((byte)1);
|
||||
writer.putInt(1);
|
||||
writer.putInt(GameObjectType.Item.ordinal());
|
||||
writer.putInt(62280);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(1);
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(362003);
|
||||
writer.putInt(GameObjectType.Item.ordinal());
|
||||
writer.putInt(62280);
|
||||
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.put((byte)0);
|
||||
|
||||
// writer.putInt(0);
|
||||
//writer.putInt(0);
|
||||
|
||||
// writer.putInt(1);
|
||||
// writer.putInt(GameObjectType.Building.ordinal());
|
||||
// writer.putInt(62281);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(362003);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.put((byte)1);
|
||||
// writer.putInt(1);
|
||||
// writer.putInt(GameObjectType.Building.ordinal());
|
||||
// writer.putInt(62281);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(362003);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.put((byte)0);
|
||||
|
||||
|
||||
|
||||
|
||||
// else{
|
||||
// writer.putInt(building.getFurnitureList().size());
|
||||
// for (int furnitureID: building.getFurnitureList()){
|
||||
// Building furniture = Building.getBuildingFromCache(furnitureID);
|
||||
// writer.putInt(GameObjectType.Building.ordinal());
|
||||
// writer.putInt(furniture.getObjectUUID());
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.put((byte)0);
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
// else{
|
||||
// writer.putInt(building.getFurnitureList().size());
|
||||
// for (int furnitureID: building.getFurnitureList()){
|
||||
// Building furniture = Building.getBuildingFromCache(furnitureID);
|
||||
// writer.putInt(GameObjectType.Building.ordinal());
|
||||
// writer.putInt(furniture.getObjectUUID());
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.putInt(0);
|
||||
// writer.put((byte)0);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
public int getPad() {
|
||||
return pad;
|
||||
}
|
||||
|
||||
public void setPad(int value) {
|
||||
this.pad = value;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
return buildingID;
|
||||
}
|
||||
|
||||
public void setBuildingID(int buildingID) {
|
||||
this.buildingID = buildingID;
|
||||
}
|
||||
|
||||
public int getItemID() {
|
||||
return itemID;
|
||||
}
|
||||
|
||||
public void setItemID(int itemID) {
|
||||
this.itemID = itemID;
|
||||
}
|
||||
|
||||
public Vector3fImmutable getFurnitureLoc() {
|
||||
return furnitureLoc;
|
||||
}
|
||||
|
||||
public void setFurnitureLoc(Vector3fImmutable furnitureLoc) {
|
||||
this.furnitureLoc = furnitureLoc;
|
||||
}
|
||||
|
||||
public int getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor(int floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
public float getRot() {
|
||||
return rot;
|
||||
}
|
||||
|
||||
public void setRot(float rot) {
|
||||
this.rot = rot;
|
||||
}
|
||||
|
||||
public float getw() {
|
||||
return w;
|
||||
}
|
||||
|
||||
public void setw(float w) {
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class GrantExperienceMsg extends ClientNetMsg {
|
||||
|
||||
private int xpGranted;
|
||||
private int objectType;
|
||||
private int objectID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public GrantExperienceMsg(PlayerCharacter pc, int xpGranted) {
|
||||
super(Protocol.EXPERIENCE);
|
||||
this.xpGranted = xpGranted;
|
||||
this.objectType = pc.getObjectType().ordinal();
|
||||
this.objectID = pc.getObjectUUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 GrantExperienceMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.EXPERIENCE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public GrantExperienceMsg(GrantExperienceMsg msg) {
|
||||
super(Protocol.EXPERIENCE);
|
||||
this.xpGranted = msg.xpGranted;
|
||||
this.objectType = msg.objectType;
|
||||
this.objectID = msg.objectID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied
|
||||
* ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.get();
|
||||
this.xpGranted = reader.getInt();
|
||||
this.objectType = reader.getInt();
|
||||
this.objectID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.xpGranted);
|
||||
writer.putInt(this.objectType);
|
||||
writer.putInt(this.objectID);
|
||||
}
|
||||
|
||||
public int getXPGranted() {
|
||||
return this.xpGranted;
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return this.objectType;
|
||||
}
|
||||
|
||||
public int getObjectID() {
|
||||
return this.objectID;
|
||||
}
|
||||
|
||||
public void setXPGranted(int value) {
|
||||
this.xpGranted = value;
|
||||
}
|
||||
|
||||
public void setObjectType(int value) {
|
||||
this.objectType = value;
|
||||
}
|
||||
|
||||
public void setObjectID(int value) {
|
||||
this.objectID = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class GuildTreeStatusMsg extends ClientNetMsg {
|
||||
|
||||
// 2 = manage this asset. 20 = manage entire city
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private String CityName;
|
||||
private String OwnerName;
|
||||
private String GuildName;
|
||||
|
||||
private String motto; //motto Length 60 max?
|
||||
private Building treeOfLife;
|
||||
private PlayerCharacter player;
|
||||
private City city;
|
||||
private Zone cityZone;
|
||||
private GuildTag cityGuildTag;
|
||||
private GuildTag cityNationTag;
|
||||
private java.time.LocalDateTime cityDate;
|
||||
private boolean canAccess = false;
|
||||
private byte canBind = 0;
|
||||
private int accessType = 0;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public GuildTreeStatusMsg() {
|
||||
super(Protocol.GUILDTREESTATUS);
|
||||
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.OwnerName = "";
|
||||
this.CityName = "";
|
||||
this.GuildName = "";
|
||||
this.cityGuildTag = null;
|
||||
this.cityNationTag = null;
|
||||
}
|
||||
|
||||
public GuildTreeStatusMsg(Building treeOfLife, PlayerCharacter sourcePlayer) {
|
||||
super(Protocol.GUILDTREESTATUS);
|
||||
this.treeOfLife = treeOfLife;
|
||||
this.player = sourcePlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 GuildTreeStatusMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.GUILDTREESTATUS, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
|
||||
targetType = reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
reader.monitorInt(0, "GuildTreeStatusMSG");
|
||||
}
|
||||
}
|
||||
|
||||
public void configure() {
|
||||
|
||||
this.targetType = treeOfLife.getObjectType().ordinal();
|
||||
this.targetID = treeOfLife.getObjectUUID();
|
||||
this.OwnerName = treeOfLife.getOwner() != null ? treeOfLife.getOwnerName() : "Abandoned";
|
||||
this.CityName = treeOfLife.getCityName();
|
||||
this.GuildName = treeOfLife.getGuildName();
|
||||
|
||||
this.cityGuildTag = treeOfLife.getGuild().getGuildTag();
|
||||
this.cityNationTag = this.treeOfLife.getGuild().getNation().getGuildTag();
|
||||
|
||||
canAccess = this.canModify();
|
||||
canBind = 0;
|
||||
|
||||
if (player.getGuild() != null && this.treeOfLife.getGuild() != null && !this.treeOfLife.getGuild().isErrant()
|
||||
&& player.getGuild().getNation() == this.treeOfLife.getGuild().getNation())
|
||||
canBind = 1;
|
||||
|
||||
|
||||
if (this.treeOfLife.getGuild() != null && this.treeOfLife.getGuild().getOwnedCity() == null)
|
||||
accessType = 9;
|
||||
|
||||
//accessType not 9 not null city
|
||||
if (accessType != 9)
|
||||
if (this.treeOfLife.getGuild().getOwnedCity().isForceRename() && canAccess )
|
||||
accessType = 10;
|
||||
else accessType = 8;
|
||||
|
||||
cityZone = this.treeOfLife.getParentZone();
|
||||
city = null;
|
||||
|
||||
if (cityZone != null)
|
||||
if (cityZone.isPlayerCity())
|
||||
city = City.GetCityFromCache(cityZone.getPlayerCityUUID());
|
||||
else
|
||||
if (this.treeOfLife != null && this.treeOfLife.getGuild() != null)
|
||||
city = this.treeOfLife.getGuild().getOwnedCity();
|
||||
|
||||
|
||||
if (city == null)
|
||||
CityName = "None";
|
||||
else
|
||||
CityName = city.getCityName();
|
||||
|
||||
if (city == null)
|
||||
cityDate = LocalDateTime.now();
|
||||
else
|
||||
cityDate = city.established;
|
||||
|
||||
}
|
||||
|
||||
private boolean canModify() {
|
||||
|
||||
return this.player.getGuild() == this.treeOfLife.getGuild() && GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
writer.putInt(targetType);
|
||||
writer.putInt(targetID);
|
||||
|
||||
if (canAccess)
|
||||
writer.putInt(accessType);
|
||||
|
||||
else
|
||||
writer.putInt(9);
|
||||
|
||||
GuildTag._serializeForDisplay(cityGuildTag,writer);
|
||||
GuildTag._serializeForDisplay(cityNationTag,writer);
|
||||
|
||||
writer.putString(CityName);
|
||||
writer.putString(GuildName);
|
||||
writer.putString(OwnerName);
|
||||
|
||||
writer.putLocalDateTime(cityDate);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
if (city == null)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt(city.isOpen() ? 1 : 0); //check mark for open city
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put(canBind);
|
||||
writer.put((byte) 0);
|
||||
|
||||
if (canAccess)
|
||||
writer.put((byte) 1);
|
||||
else
|
||||
writer.put((byte) 0);
|
||||
|
||||
writer.put((byte) 0);
|
||||
|
||||
writer.putInt(1);
|
||||
writer.putString(city != null ? city.getDescription() : "None");
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class HirelingServiceMsg extends ClientNetMsg {
|
||||
|
||||
|
||||
public int npcID;
|
||||
public int buildingID;
|
||||
public int messageType;
|
||||
public int repairCost;
|
||||
|
||||
public static final int SETREPAIRCOST = 2;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param channel
|
||||
*/
|
||||
public HirelingServiceMsg(int channel) {
|
||||
super(Protocol.HIRELINGSERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 HirelingServiceMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.HIRELINGSERVICE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.messageType);
|
||||
switch (this.messageType){
|
||||
case SETREPAIRCOST:
|
||||
this.writeSetRepairCost(writer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.messageType = reader.getInt();
|
||||
|
||||
switch (this.messageType){
|
||||
case SETREPAIRCOST:
|
||||
this.readSetRepairCost(reader);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void readSetRepairCost(ByteBufferReader reader){
|
||||
reader.getInt(); //building type;
|
||||
this.buildingID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt(); //3
|
||||
this.repairCost = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
private void writeSetRepairCost(ByteBufferWriter writer){
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(GameObjectType.NPC.ordinal());
|
||||
writer.putInt(this.npcID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(3);
|
||||
writer.putInt(this.repairCost);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
private void writeTest(ByteBufferWriter writer){
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(GameObjectType.NPC.ordinal());
|
||||
writer.putInt(this.npcID);
|
||||
writer.putInt(3);
|
||||
writer.putInt(1);
|
||||
writer.putInt(1);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(GameObjectType.NPC.ordinal());
|
||||
writer.putInt(this.npcID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(3);
|
||||
writer.putInt(1);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.math.FastMath;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class HotzoneChangeMsg extends ClientNetMsg {
|
||||
|
||||
private int zoneType;
|
||||
private int zoneID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public HotzoneChangeMsg(int zoneType, int zoneID) {
|
||||
super(Protocol.ARCHOTZONECHANGE);
|
||||
this.zoneType = zoneType;
|
||||
this.zoneID = zoneID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 HotzoneChangeMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.ARCHOTZONECHANGE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.zoneType);
|
||||
writer.putInt(this.zoneID);
|
||||
writer.putInt(FastMath.secondsUntilNextHour());
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.zoneType = reader.getInt();
|
||||
this.zoneID = reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
public int getZoneType() {
|
||||
return this.zoneType;
|
||||
}
|
||||
|
||||
public int getZoneID() {
|
||||
return this.zoneID;
|
||||
}
|
||||
|
||||
public void setZoneType(int value) {
|
||||
this.zoneType = value;
|
||||
}
|
||||
|
||||
public void setZoneID(int value) {
|
||||
this.zoneID = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class IgnoreListMsg extends ClientNetMsg {
|
||||
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private String playerName;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public IgnoreListMsg() {
|
||||
super(Protocol.ARCIGNORELISTUPDATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 IgnoreListMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCIGNORELISTUPDATE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.names.size());
|
||||
for (String name : this.names) {
|
||||
writer.putString(name);
|
||||
}
|
||||
writer.putInt(this.playerType);
|
||||
writer.putInt(this.playerID);
|
||||
writer.putString(this.playerName);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
int size = reader.getInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.names.add(reader.getString());
|
||||
}
|
||||
this.playerType = reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
this.playerName = reader.getString();
|
||||
reader.get();
|
||||
}
|
||||
|
||||
public ArrayList<String> getNames() {
|
||||
return this.names;
|
||||
}
|
||||
|
||||
public void addName(String value) {
|
||||
this.names.add(value);
|
||||
}
|
||||
|
||||
public void removeName(String value) {
|
||||
this.names.remove(value);
|
||||
}
|
||||
|
||||
public int getPlayerType() {
|
||||
return this.playerType;
|
||||
}
|
||||
|
||||
public void setPlayerType(int value) {
|
||||
this.playerType = value;
|
||||
}
|
||||
|
||||
public int getPlayerID() {
|
||||
return this.playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int value) {
|
||||
this.playerID = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.playerName;
|
||||
}
|
||||
|
||||
public void setName(String value) {
|
||||
this.playerName = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Account;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
public class IgnoreMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown1;
|
||||
private int unknown2;
|
||||
private String nameToIgnore;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public IgnoreMsg() {
|
||||
super(Protocol.IGNORE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 IgnoreMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.IGNORE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(unknown1);
|
||||
writer.putInt(unknown2);
|
||||
writer.putUnicodeString(nameToIgnore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
unknown1 = reader.getInt();
|
||||
unknown2 = reader.getInt();
|
||||
nameToIgnore = reader.getUnicodeString();
|
||||
}
|
||||
|
||||
public void handleRequest(ClientConnection origin) {
|
||||
|
||||
PlayerCharacter pcSource = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (nameToIgnore.isEmpty()) { // list ignored players
|
||||
String[] ignoredPlayers = pcSource.getIgnoredPlayerNames();
|
||||
String crlf = "\r\n";
|
||||
String out = "Ignored players (" + ignoredPlayers.length + "):";
|
||||
for (String name : ignoredPlayers) {
|
||||
out += crlf + name;
|
||||
}
|
||||
ChatManager.chatSystemInfo(pcSource, out);
|
||||
return;
|
||||
}
|
||||
|
||||
//FIX THIS, USE OUR CACHE!
|
||||
PlayerCharacter pcToIgnore = PlayerCharacter.getByFirstName(nameToIgnore);
|
||||
|
||||
if (pcSource == null) {
|
||||
return;
|
||||
}
|
||||
if (pcToIgnore == null || pcToIgnore.getAccount() == null) {
|
||||
ChatManager.chatSystemError(pcSource, "Character name " + nameToIgnore + " does not exist and cannot be ignored.");
|
||||
return;
|
||||
}
|
||||
if (pcToIgnore.getObjectUUID() == pcSource.getObjectUUID()) {
|
||||
ChatManager.chatSystemError(pcSource, "Try as you might, you are unable to ignore yourself!");
|
||||
return;
|
||||
}
|
||||
String fn = pcToIgnore.getFirstName();
|
||||
|
||||
Account ac = pcSource.getAccount();
|
||||
|
||||
if (ac == null)
|
||||
return;
|
||||
|
||||
if (pcSource.isIgnoringPlayer(pcToIgnore)) {
|
||||
|
||||
if (ac != null) {
|
||||
if (!DbManager.PlayerCharacterQueries.SET_IGNORE_LIST(ac.getObjectUUID(), pcToIgnore.getObjectUUID(), false, pcToIgnore.getFirstName())) {
|
||||
ChatManager.chatSystemError(pcSource, "Unable to update database ignore list.");
|
||||
}
|
||||
} else {
|
||||
ChatManager.chatSystemError(pcSource, "Unable to update database ignore list.");
|
||||
}
|
||||
|
||||
pcSource.removeIgnoredPlayer(pcToIgnore.getAccount());
|
||||
ChatManager.chatSystemInfo(pcSource, "Character " + fn + " is no longer ignored.");
|
||||
} else {
|
||||
if (!PlayerCharacter.isIgnorable()) {
|
||||
ChatManager.chatSystemError(pcSource, "This character cannot be ignored.");
|
||||
return;
|
||||
}
|
||||
if (PlayerCharacter.isIgnoreListFull()) {
|
||||
ChatManager.chatSystemError(pcSource, "Your ignore list is already full.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ac != null) {
|
||||
if (!DbManager.PlayerCharacterQueries.SET_IGNORE_LIST(ac.getObjectUUID(), pcToIgnore.getObjectUUID(), true, pcToIgnore.getFirstName())) {
|
||||
ChatManager.chatSystemError(pcSource, "Unable to update database ignore list. This ignore will not persist past server down.");
|
||||
}
|
||||
} else {
|
||||
ChatManager.chatSystemError(pcSource, "Unable to update database ignore list.");
|
||||
}
|
||||
|
||||
pcSource.addIgnoredPlayer(pcToIgnore.getAccount(), pcToIgnore.getFirstName());
|
||||
ChatManager.chatSystemInfo(pcSource, "Character " + fn + " is now being ignored.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown1
|
||||
*/
|
||||
public int getUnknown1() {
|
||||
return unknown1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown1 the unknown1 to set
|
||||
*/
|
||||
public void setUnknown1(int unknown1) {
|
||||
this.unknown1 = unknown1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown2
|
||||
*/
|
||||
public int getUnknown2() {
|
||||
return unknown2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown2 the unknown2 to set
|
||||
*/
|
||||
public void setUnknown2(int unknown2) {
|
||||
this.unknown2 = unknown2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nameToIgnore
|
||||
*/
|
||||
public String getNameToIgnore() {
|
||||
return nameToIgnore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nameToIgnore the nameToIgnore to set
|
||||
*/
|
||||
public void setNameToIgnore(String nameToIgnore) {
|
||||
this.nameToIgnore = nameToIgnore;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
/**
|
||||
* Invalid trade request.
|
||||
* Attempt to trade with player who is already trading.
|
||||
*/
|
||||
|
||||
public class InvalidTradeRequestMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private int busyType;
|
||||
private int busyID;
|
||||
private int requesterType;
|
||||
private int requesterID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public InvalidTradeRequestMsg(int unknown01, AbstractGameObject busy, AbstractGameObject requester) {
|
||||
super(Protocol.ARCREQUESTTRADEBUSY);
|
||||
this.busyType = busy.getObjectType().ordinal();
|
||||
this.busyID = busy.getObjectUUID();
|
||||
this.requesterType = requester.getObjectType().ordinal();
|
||||
this.requesterID = requester.getObjectUUID();
|
||||
this.unknown01 = unknown01;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 InvalidTradeRequestMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.ARCREQUESTTRADEBUSY, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
busyType = reader.getInt();
|
||||
busyID = reader.getInt();
|
||||
requesterType = reader.getInt();
|
||||
requesterID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putInt(busyType);
|
||||
writer.putInt(busyID);
|
||||
writer.putInt(requesterType);
|
||||
writer.putInt(requesterID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown01
|
||||
*/
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown01 the unknown01 to set
|
||||
*/
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
public int getRequesterID() {
|
||||
return requesterID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
|
||||
public class ItemEffectMsg extends ClientNetMsg {
|
||||
|
||||
protected int numTrains;
|
||||
protected int effectID;
|
||||
protected int sourceType;
|
||||
protected int sourceID;
|
||||
protected int targetType;
|
||||
protected int targetID;
|
||||
|
||||
protected int unknown02;
|
||||
protected int unknown03;
|
||||
protected int duration;
|
||||
protected int unknown05;
|
||||
protected byte unknown06;
|
||||
protected int ItemType;
|
||||
protected int powerTypeID;
|
||||
protected String powerUsedName;
|
||||
protected int itemID;
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ItemEffectMsg() {
|
||||
super(Protocol.POWERACTION);
|
||||
this.numTrains = 0;
|
||||
this.effectID = 0;
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
|
||||
this.unknown02 = 0;
|
||||
this.unknown03 = 0;
|
||||
this.duration = 0;
|
||||
this.unknown05 = 0;
|
||||
this.unknown06 = (byte) 0;
|
||||
|
||||
this.ItemType = 0;
|
||||
this.itemID = 0;
|
||||
this.powerUsedName = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ItemEffectMsg(AbstractWorldObject source, AbstractWorldObject target, int numTrains, int effectID, int duration,
|
||||
int powerUsedID, String powerUsedName) {
|
||||
super(Protocol.POWERACTION);
|
||||
this.numTrains = numTrains;
|
||||
this.effectID = effectID;
|
||||
|
||||
if (source != null) {
|
||||
this.sourceType = source.getObjectType().ordinal();
|
||||
this.sourceID = source.getObjectUUID();
|
||||
} else {
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
}
|
||||
|
||||
if (target != null) {
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
} else {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
}
|
||||
this.unknown02 = 0; //0 = apply, 2= remove
|
||||
this.unknown03 = 0;
|
||||
this.duration = duration;
|
||||
this.unknown05 = 0; //1 = remove item effect
|
||||
this.unknown06 = (byte) 0; //1 = remove item effect
|
||||
this.ItemType = powerUsedID;
|
||||
this.itemID = 0;
|
||||
this.powerUsedName = powerUsedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ItemEffectMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.POWERACTION, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.numTrains);
|
||||
writer.putInt(this.effectID);
|
||||
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
|
||||
writer.putInt(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.duration);
|
||||
writer.putInt(this.unknown05);
|
||||
writer.put(this.unknown06);
|
||||
|
||||
writer.putInt(this.ItemType);
|
||||
writer.putInt(this.itemID);
|
||||
|
||||
writer.putString(this.powerUsedName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.numTrains = reader.getInt();
|
||||
this.effectID = reader.getInt();
|
||||
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.duration = reader.getInt();
|
||||
this.unknown05 = reader.getInt();
|
||||
this.unknown06 = reader.get();
|
||||
|
||||
this.ItemType = reader.getInt();
|
||||
this.itemID = reader.getInt();
|
||||
|
||||
this.powerUsedName = reader.getString();
|
||||
}
|
||||
|
||||
public int getNumTrains() {
|
||||
return this.numTrains;
|
||||
}
|
||||
|
||||
public int getEffectID() {
|
||||
return this.effectID;
|
||||
}
|
||||
|
||||
public int getSourceType() {
|
||||
return this.sourceType;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return this.sourceID;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return this.targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return this.targetID;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return this.unknown03;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return this.duration;
|
||||
}
|
||||
|
||||
public int getUnknown05() {
|
||||
return this.unknown05;
|
||||
}
|
||||
|
||||
public byte getUnknown06() {
|
||||
return this.unknown06;
|
||||
}
|
||||
|
||||
public int getItemType() {
|
||||
return this.ItemType;
|
||||
}
|
||||
public int getItemID() {
|
||||
return this.itemID;
|
||||
}
|
||||
|
||||
public String getPowerUsedName() {
|
||||
return this.powerUsedName;
|
||||
}
|
||||
|
||||
public void setNumTrains(int value) {
|
||||
this.numTrains = value;
|
||||
}
|
||||
|
||||
public void setEffectID(int value) {
|
||||
this.effectID = value;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
|
||||
public void setDuration(int value) {
|
||||
this.duration = value;
|
||||
}
|
||||
|
||||
public void setUnknown05(int value) {
|
||||
this.unknown05 = value;
|
||||
}
|
||||
|
||||
public void setUnknown06(byte value) {
|
||||
this.unknown06 = value;
|
||||
}
|
||||
|
||||
public void setItemType(int value) {
|
||||
this.ItemType = value;
|
||||
}
|
||||
public void setItemID(int value){
|
||||
this.itemID = value;
|
||||
}
|
||||
|
||||
public void setPowerUsedName(String value) {
|
||||
this.powerUsedName = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class ItemHealthUpdateMsg extends ClientNetMsg {
|
||||
|
||||
private int slot;
|
||||
private float newDurability;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ItemHealthUpdateMsg(int slot, float newDurability) {
|
||||
super(Protocol.ITEMHEALTHUPDATE);
|
||||
this.slot = slot;
|
||||
this.newDurability = newDurability;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ItemHealthUpdateMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ITEMHEALTHUPDATE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.slot);
|
||||
writer.putFloat(this.newDurability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.slot = reader.getInt();
|
||||
this.newDurability = reader.getFloat();
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return this.slot;
|
||||
}
|
||||
|
||||
public void setSlot(int value) {
|
||||
this.slot = value;
|
||||
}
|
||||
|
||||
public float getNewDurability() {
|
||||
return this.newDurability;
|
||||
}
|
||||
|
||||
public void setNewDurability(float value) {
|
||||
this.newDurability = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,567 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.MobLoot;
|
||||
import engine.objects.NPC;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ItemProductionMsg extends ClientNetMsg {
|
||||
|
||||
private static final int ACTION_PRODUCE = 1;
|
||||
private static final int ACTION_JUNK = 2;
|
||||
private static final int ACTION_RECYCLE = 3;
|
||||
private static final int ACTION_COMPLETE = 4;
|
||||
private static final int ACTION_DEPOSIT = 6;
|
||||
private static final int ACTION_SETPRICE = 5;
|
||||
private static final int ACTION_TAKE = 7;
|
||||
private static final int ACTION_CONFIRM_SETPRICE = 9;
|
||||
private static final int ACTION_CONFIRM_DEPOSIT = 10;
|
||||
private static final int ACTION_CONFIRM_TAKE = 11; // Unsure. Sent by client
|
||||
private static final int ACTION_CONFIRM_PRODUCE = 8;
|
||||
|
||||
private ArrayList<Long> ItemList;
|
||||
private int size;
|
||||
private int buildingUUID;
|
||||
private int unknown01;
|
||||
private int itemUUID;
|
||||
private int itemType;
|
||||
public void setItemUUID(int itemUUID) {
|
||||
this.itemUUID = itemUUID;
|
||||
}
|
||||
|
||||
private int totalProduction;
|
||||
private int unknown03;
|
||||
private int pToken;
|
||||
private int sToken;
|
||||
private String name;
|
||||
private int actionType;
|
||||
private int npcUUID;
|
||||
private boolean add;
|
||||
private int itemPrice;
|
||||
private boolean isMultiple;
|
||||
|
||||
private HashMap<Integer,Integer> itemIDtoTypeMap;;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
|
||||
public ItemProductionMsg() {
|
||||
super(Protocol.ITEMPRODUCTION);
|
||||
this.actionType = 0;
|
||||
this.size = 0;
|
||||
this.buildingUUID = 0;
|
||||
this.unknown01 = 0;
|
||||
this.itemUUID = 0;
|
||||
this.totalProduction = 0;
|
||||
this.unknown03 = 0;
|
||||
this.pToken = 0;
|
||||
this.sToken = 0;
|
||||
this.name = "";
|
||||
this.itemPrice = 0;
|
||||
this.itemType = 0;
|
||||
|
||||
}
|
||||
|
||||
public ItemProductionMsg(Building building, NPC vendor, Item item, int actionType, boolean add) {
|
||||
super(Protocol.ITEMPRODUCTION);
|
||||
this.actionType = actionType;
|
||||
this.size = 0;
|
||||
this.buildingUUID = building.getObjectUUID();
|
||||
this.npcUUID = vendor.getObjectUUID();
|
||||
this.itemType = item.getObjectType().ordinal();
|
||||
this.itemUUID = item.getObjectUUID();
|
||||
this.unknown01 = 0;
|
||||
this.totalProduction = 0;
|
||||
this.unknown03 = 0;
|
||||
this.pToken = 0;
|
||||
this.sToken = 0;
|
||||
this.name = "";
|
||||
this.add = add;
|
||||
this.itemPrice = item.getValue();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ItemProductionMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ITEMPRODUCTION, origin, reader);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
//Larger size for historically larger opcodes
|
||||
return (16); // 2^16 == 64k
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
Building building = BuildingManager.getBuildingFromCache(this.buildingUUID);
|
||||
if (building == null)
|
||||
return;
|
||||
// Common Header
|
||||
|
||||
writer.putInt(this.actionType);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingUUID);
|
||||
writer.putInt(GameObjectType.NPC.ordinal());
|
||||
writer.putInt(this.npcUUID);
|
||||
|
||||
switch (this.actionType) {
|
||||
|
||||
case ACTION_CONFIRM_DEPOSIT:
|
||||
writer.putInt(0); // Not item ordinal?
|
||||
writer.putInt(0); // Not item uuid?
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
|
||||
if (!add) {
|
||||
writer.put((byte) 1);
|
||||
Item item = Item.getFromCache(this.itemUUID);
|
||||
if (item != null)
|
||||
Item.serializeForClientMsgWithoutSlot(item,writer);
|
||||
writer.putInt(building.getStrongboxValue());
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte) 0);
|
||||
break;
|
||||
}
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte) 1);
|
||||
Item item;
|
||||
if (this.itemType == GameObjectType.Item.ordinal())
|
||||
item = Item.getFromCache(this.itemUUID);
|
||||
else
|
||||
item = MobLoot.getFromCache(this.itemUUID);
|
||||
if (item != null)
|
||||
Item.serializeForClientMsgWithoutSlot(item,writer);
|
||||
writer.putInt(building.getStrongboxValue());
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte) 0);
|
||||
break;
|
||||
case ACTION_CONFIRM_TAKE:
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemUUID);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte) 0);
|
||||
break;
|
||||
case ACTION_SETPRICE:
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemUUID);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.itemPrice); // new price
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
break;
|
||||
case ACTION_CONFIRM_SETPRICE:
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemUUID);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte)1);
|
||||
writer.putInt(building.getStrongboxValue()); // new price
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
//writer.put((byte) 0);
|
||||
break;
|
||||
case ACTION_DEPOSIT:
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemUUID);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte) 0);
|
||||
break;
|
||||
case ACTION_TAKE:
|
||||
case ACTION_RECYCLE:
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte) 1);
|
||||
writer.putInt(building.getStrongboxValue());
|
||||
|
||||
if (this.itemIDtoTypeMap != null){
|
||||
writer.putInt(this.itemIDtoTypeMap.size());
|
||||
|
||||
for (int itemID : this.itemIDtoTypeMap.keySet()) {
|
||||
writer.putInt(this.itemIDtoTypeMap.get(itemID));
|
||||
writer.putInt(itemID);
|
||||
}
|
||||
|
||||
}else
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
break;
|
||||
case ACTION_CONFIRM_PRODUCE:
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(1);
|
||||
MobLoot toRoll = MobLoot.getFromCache(this.itemUUID);
|
||||
writer.putInt(-1497023830);
|
||||
if (toRoll != null && toRoll.getPrefix() != null && !toRoll.getPrefix().isEmpty()){
|
||||
EffectsBase eb = PowersManager.getEffectByIDString(toRoll.getPrefix());
|
||||
if (eb == null)
|
||||
this.pToken = 0;
|
||||
else
|
||||
this.pToken = eb.getToken();
|
||||
}
|
||||
|
||||
if (toRoll != null && toRoll.getSuffix() != null && !toRoll.getSuffix().isEmpty()){
|
||||
EffectsBase eb = PowersManager.getEffectByIDString(toRoll.getSuffix());
|
||||
if (eb == null)
|
||||
this.sToken = 0;
|
||||
else
|
||||
this.sToken = eb.getToken();
|
||||
}
|
||||
if (toRoll.isRandom() == false || (toRoll != null && toRoll.isComplete())){
|
||||
writer.putInt(this.pToken);
|
||||
writer.putInt(this.sToken);
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
writer.putString(toRoll.getCustomName());;
|
||||
writer.putInt(GameObjectType.MobLoot.ordinal());
|
||||
writer.putInt(this.itemUUID);
|
||||
writer.putInt(0); //items left to produce?
|
||||
if (toRoll != null){
|
||||
writer.putInt(toRoll.getItemBaseID());
|
||||
writer.putInt(toRoll.getValue());
|
||||
}
|
||||
else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
NPC vendor = NPC.getFromCache(this.npcUUID);
|
||||
if (vendor != null){
|
||||
if (toRoll.isComplete()){
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}else{
|
||||
long timeLeft = toRoll.getDateToUpgrade() - System.currentTimeMillis();
|
||||
|
||||
timeLeft /=1000;
|
||||
writer.putInt((int)timeLeft);
|
||||
writer.putInt(vendor.getRollingTimeInSeconds(toRoll.getItemBaseID()));
|
||||
}
|
||||
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
if (toRoll.isComplete())
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt(1);
|
||||
writer.put((byte)0);
|
||||
|
||||
if (toRoll != null && toRoll.isComplete())
|
||||
writer.put((byte)1);
|
||||
else
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)1);
|
||||
writer.putInt(vendor.getBuilding().getStrongboxValue());
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
//writer.putInt(0); //error popup
|
||||
|
||||
break;
|
||||
case ACTION_COMPLETE:
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemUUID);
|
||||
writer.putInt(this.totalProduction);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.pToken);
|
||||
writer.putInt(this.sToken);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
break;
|
||||
case ACTION_JUNK:
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemUUID);
|
||||
writer.putInt(this.totalProduction);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.pToken);
|
||||
writer.putInt(this.sToken);
|
||||
writer.putString(this.name);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putShort((short)0);
|
||||
writer.put((byte)0);
|
||||
break;
|
||||
default:
|
||||
writer.putInt(0);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
// Common header
|
||||
|
||||
this.actionType = reader.getInt();
|
||||
reader.getInt(); // Building type padding
|
||||
this.buildingUUID = reader.getInt();
|
||||
reader.getInt(); // NPC type padding
|
||||
this.npcUUID = reader.getInt();
|
||||
|
||||
switch (this.actionType) {
|
||||
case ACTION_SETPRICE:
|
||||
this.itemType = reader.getInt();
|
||||
this.itemUUID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.itemPrice = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
break;
|
||||
case ACTION_RECYCLE:
|
||||
case ACTION_TAKE:
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
this.size = reader.getInt();
|
||||
HashMap<Integer,Integer> tempIDs = new HashMap<>();
|
||||
for (int i = 0; i < this.size; i++) {
|
||||
int type = reader.getInt(); // Item type padding
|
||||
this.itemUUID = reader.getInt();
|
||||
tempIDs.put(this.itemUUID, type);
|
||||
}
|
||||
reader.getInt();
|
||||
this.itemIDtoTypeMap = tempIDs;
|
||||
break;
|
||||
case ACTION_DEPOSIT:
|
||||
this.itemType = reader.getInt();
|
||||
this.itemUUID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
break;
|
||||
case ACTION_JUNK:
|
||||
this.itemType = reader.getInt();
|
||||
this.itemUUID = reader.getInt();
|
||||
this.totalProduction =reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.pToken = reader.getInt();
|
||||
this.sToken = reader.getInt();
|
||||
this.name = reader.getString();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
break;
|
||||
default:
|
||||
this.itemType = reader.getInt();
|
||||
this.itemUUID = reader.getInt();
|
||||
this.totalProduction =reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.pToken = reader.getInt();
|
||||
this.sToken = reader.getInt();
|
||||
this.name = reader.getString();
|
||||
this.isMultiple = reader.getInt() != 0 ? true:false;
|
||||
reader.getInt();
|
||||
|
||||
if (this.actionType == ACTION_COMPLETE || this.actionType == ACTION_JUNK)
|
||||
reader.get();
|
||||
else
|
||||
reader.getShort();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
// TODO fix ArrayList Accessability.
|
||||
public ArrayList<Long> getItemList() {
|
||||
return this.ItemList;
|
||||
}
|
||||
|
||||
public void addItem(Long item) {
|
||||
this.ItemList.add(item);
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
public int getTotalProduction() {
|
||||
return totalProduction;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return unknown03;
|
||||
}
|
||||
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
public void setTotalProduction(int unknown02) {
|
||||
this.totalProduction = unknown02;
|
||||
}
|
||||
|
||||
public void setUnknown03(int unknown03) {
|
||||
this.unknown03 = unknown03;
|
||||
}
|
||||
|
||||
public void setItemList(ArrayList<Long> value) {
|
||||
this.ItemList = value;
|
||||
}
|
||||
|
||||
public int getItemUUID() {
|
||||
return itemUUID;
|
||||
}
|
||||
|
||||
public void setpToken(int pToken) {
|
||||
this.pToken = pToken;
|
||||
}
|
||||
|
||||
public int getpToken() {
|
||||
return pToken;
|
||||
}
|
||||
|
||||
public void setsToken(int sToken) {
|
||||
this.sToken = sToken;
|
||||
}
|
||||
|
||||
public int getsToken() {
|
||||
return sToken;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public int getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
|
||||
public final void setActionType(int actionType) {
|
||||
this.actionType = actionType;
|
||||
}
|
||||
|
||||
public int getNpcUUID() {
|
||||
return npcUUID;
|
||||
}
|
||||
|
||||
public HashMap<Integer,Integer> getItemIDtoTypeMap() {
|
||||
return itemIDtoTypeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the itemPrice
|
||||
*/
|
||||
public int getItemPrice() {
|
||||
return itemPrice;
|
||||
}
|
||||
|
||||
public boolean isMultiple() {
|
||||
return isMultiple;
|
||||
}
|
||||
|
||||
public void setMultiple(boolean isMultiple) {
|
||||
this.isMultiple = isMultiple;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class KeepAliveServerClientMsg extends ClientNetMsg {
|
||||
|
||||
private int firstData; // First 4 bytes
|
||||
private int secondData; // Second 4 bytes
|
||||
|
||||
private double timeLoggedIn;
|
||||
private byte endData; // Last byte
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public KeepAliveServerClientMsg(int firstData, int secondData, byte endData) {
|
||||
super(Protocol.KEEPALIVESERVERCLIENT);
|
||||
this.firstData = firstData;
|
||||
this.secondData = secondData;
|
||||
this.endData = endData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 KeepAliveServerClientMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.KEEPALIVESERVERCLIENT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putDouble(this.timeLoggedIn);
|
||||
writer.put((byte)0);
|
||||
//writer.putDouble(1000);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.timeLoggedIn = reader.getDouble();
|
||||
this.endData = reader.get();
|
||||
}
|
||||
|
||||
public int getFirstData() {
|
||||
return firstData;
|
||||
}
|
||||
|
||||
public int getSecondData() {
|
||||
return secondData;
|
||||
}
|
||||
|
||||
public byte getEndData() {
|
||||
return endData;
|
||||
}
|
||||
|
||||
public double getTimeLoggedIn() {
|
||||
return timeLoggedIn;
|
||||
}
|
||||
|
||||
public void setTimeLoggedIn(double timeLoggedIn) {
|
||||
this.timeLoggedIn = timeLoggedIn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.ShrineType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.GuildTag;
|
||||
import engine.objects.Shrine;
|
||||
|
||||
public class LeaderboardMessage extends ClientNetMsg {
|
||||
|
||||
/**
|
||||
* 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 LeaderboardMessage(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.LEADERBOARD, origin, reader);
|
||||
}
|
||||
|
||||
public LeaderboardMessage() {
|
||||
super(Protocol.LEADERBOARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
writer.putInt(ShrineType.values().length);//??
|
||||
|
||||
for (ShrineType shrineType : ShrineType.values()) {
|
||||
writer.putInt(shrineType.ordinal());
|
||||
writer.putInt(shrineType.getShrinesCopy().size());
|
||||
int i = 0;
|
||||
for (Shrine shrine : shrineType.getShrinesCopy()) {
|
||||
i++;
|
||||
writer.putInt(shrine.getFavors());
|
||||
Building shrineBuilding = BuildingManager.getBuilding(shrine.getBuildingID());
|
||||
if (shrineBuilding != null) {
|
||||
Guild shrineGuild = shrineBuilding.getGuild();
|
||||
if (shrineGuild != null) {
|
||||
writer.putInt(shrineGuild.getObjectType().ordinal());
|
||||
writer.putInt(shrineGuild.getObjectUUID());
|
||||
|
||||
GuildTag._serializeForDisplay(shrineGuild.getGuildTag(),writer);
|
||||
writer.putString(shrineGuild.getName());
|
||||
} else {
|
||||
writer.putLong(0);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putString("");
|
||||
}
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
}
|
||||
}
|
||||
writer.putString(shrineType.name());
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
return (14); // 2^14 == 16384
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class LeaveWorldMsg extends ClientNetMsg {
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LeaveWorldMsg() {
|
||||
super(Protocol.LEAVEREQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LeaveWorldMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.LEAVEREQUEST, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
|
||||
public class LoadCharacterMsg extends ClientNetMsg {
|
||||
|
||||
private AbstractCharacter absChar;
|
||||
private Corpse corpse;
|
||||
private boolean hideNonAscii;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LoadCharacterMsg(AbstractCharacter ch, boolean laln) {
|
||||
super(Protocol.LOADCHARACTER);
|
||||
this.absChar = ch;
|
||||
this.corpse = null;
|
||||
this.hideNonAscii = laln;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LoadCharacterMsg(Corpse corpse, boolean laln) {
|
||||
super(Protocol.LOADCHARACTER);
|
||||
this.corpse = corpse;
|
||||
this.absChar = null;
|
||||
this.hideNonAscii = laln;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LoadCharacterMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.LOADCHARACTER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
//Larger size for historically larger opcodes
|
||||
return (17); // 2^17 == 131,072
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
if (absChar != null && absChar.getObjectType() == GameObjectType.NPC) {
|
||||
NPC npc = (NPC)absChar;
|
||||
|
||||
|
||||
|
||||
if (npc.getBuilding() != null){
|
||||
writer.putInt(npc.getBuildingLevel());
|
||||
writer.putInt(npc.getBuildingFloor());
|
||||
}else{
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
}
|
||||
|
||||
|
||||
} else if (absChar != null) {
|
||||
|
||||
if (absChar.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
Regions region = absChar.getRegion();
|
||||
|
||||
if (region == null){
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
}else{
|
||||
Building regionBuilding = Regions.GetBuildingForRegion(region);
|
||||
if (regionBuilding == null){
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
}else{
|
||||
writer.putInt(region.getLevel());
|
||||
writer.putInt(region.getRoom());
|
||||
}
|
||||
}
|
||||
//TODO below is Mob Region Serialization, not implemented. default to -1, which is ground.
|
||||
}else{
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else if (corpse != null){
|
||||
writer.putInt(-1);
|
||||
writer.putInt(-1);
|
||||
}
|
||||
if (corpse != null) {
|
||||
writer.putInt(Float.floatToIntBits(corpse.getLoc().getX()));
|
||||
writer.putInt(Float.floatToIntBits(corpse.getLoc().getY()));
|
||||
writer.putInt(Float.floatToIntBits(corpse.getLoc().getZ()));
|
||||
writer.put((byte) 0);
|
||||
} else if (absChar != null) {
|
||||
|
||||
writer.putFloat(absChar.getLoc().getX());
|
||||
writer.putFloat(absChar.getLoc().getY());
|
||||
writer.putFloat(absChar.getLoc().getZ());
|
||||
|
||||
if (absChar.isMoving()) {
|
||||
writer.put((byte) 1);
|
||||
writer.putFloat(absChar.getEndLoc().x);
|
||||
writer.putFloat(absChar.getEndLoc().y);
|
||||
writer.putFloat(absChar.getEndLoc().z);
|
||||
} else
|
||||
writer.put((byte) 0);
|
||||
} else {
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
|
||||
if (corpse != null)
|
||||
Corpse._serializeForClientMsg(corpse, writer, this.hideNonAscii);
|
||||
else if (absChar != null)
|
||||
AbstractCharacter.serializeForClientMsgOtherPlayer(this.absChar,writer, this.hideNonAscii);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
int unknown1 = reader.getInt();
|
||||
int unknown2 = reader.getInt();
|
||||
int unknown3 = reader.getInt();
|
||||
int unknown4 = reader.getInt();
|
||||
int unknown5 = reader.getInt();
|
||||
// TODO finish deserialization impl
|
||||
}
|
||||
|
||||
public AbstractCharacter getChar() {
|
||||
return this.absChar;
|
||||
}
|
||||
|
||||
public void setChar(AbstractCharacter value) {
|
||||
this.absChar = value;
|
||||
}
|
||||
|
||||
public void setCorpse(Corpse value) {
|
||||
this.corpse = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.AbstractNetMsg;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Building;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class LoadStructureMsg extends ClientNetMsg {
|
||||
|
||||
private ArrayList<Building> structureList;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LoadStructureMsg() {
|
||||
this(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*
|
||||
* @param structures
|
||||
*/
|
||||
public LoadStructureMsg(ArrayList<Building> structures) {
|
||||
super(Protocol.LOADSTRUCTURE);
|
||||
this.structureList = structures;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LoadStructureMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.LOADSTRUCTURE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractNetMsg#getPowerOfTwoBufferSize()
|
||||
*/
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
//Larger size for historically larger opcodes
|
||||
return (18); // 2^16 == 64k
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(this.structureList.size());
|
||||
|
||||
for (Building building:this.structureList){
|
||||
Building._serializeForClientMsg(building, writer);
|
||||
}
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
int size = reader.getInt();
|
||||
// TODO finish Deserialize impl
|
||||
}
|
||||
|
||||
// TODO fix ArrayList Accessability.
|
||||
public ArrayList<Building> getStructureList() {
|
||||
return this.structureList;
|
||||
}
|
||||
|
||||
public void addObject(Building obj) {
|
||||
this.structureList.add(obj);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.structureList.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class LockUnlockDoorMsg extends ClientNetMsg {
|
||||
|
||||
private int doorID;
|
||||
private long targetID;
|
||||
private int unk1;
|
||||
private int unk2;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LockUnlockDoorMsg() {
|
||||
super(Protocol.LOCKUNLOCKDOOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LockUnlockDoorMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.LOCKUNLOCKDOOR, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(0);
|
||||
writer.putInt(doorID);
|
||||
writer.putLong(targetID);
|
||||
writer.putInt(unk1);
|
||||
writer.putInt(unk2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
this.doorID = reader.getInt();
|
||||
this.targetID = reader.getLong();
|
||||
this.unk1 = reader.getInt();
|
||||
this.unk2 = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown1
|
||||
*/
|
||||
public int getDoorID() {
|
||||
return doorID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown1
|
||||
* the unknown1 to set
|
||||
*/
|
||||
public void setDoorID(int doorID) {
|
||||
this.doorID = doorID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetID
|
||||
*/
|
||||
public long getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetID
|
||||
* the targetID to set
|
||||
*/
|
||||
public void setTargetID(long targetID) {
|
||||
this.targetID = targetID;
|
||||
}
|
||||
|
||||
public int getUnk1() {
|
||||
return this.unk1;
|
||||
}
|
||||
|
||||
public void setUnk1(int value) {
|
||||
this.unk1 = value;
|
||||
}
|
||||
|
||||
public int getUnk2() {
|
||||
return this.unk2;
|
||||
}
|
||||
|
||||
public void setUnk2(int value) {
|
||||
this.unk2 = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class LoginToGameServerMsg extends ClientNetMsg {
|
||||
|
||||
private String secKey;
|
||||
private int Unknown01;
|
||||
private int Unknown02;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LoginToGameServerMsg() {
|
||||
super(Protocol.LOGINTOGAMESERVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LoginToGameServerMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.LOGINTOGAMESERVER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putHexString(this.secKey);
|
||||
writer.putInt(this.Unknown01);
|
||||
writer.putInt(this.Unknown02);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.secKey = reader.getHexString();
|
||||
|
||||
this.Unknown01 = reader.monitorInt(1065353216, "ValidateGameServerMsg 01");
|
||||
this.Unknown02 = reader.monitorInt(1065353216, "ValidateGameServerMsg 02");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the secKey
|
||||
*/
|
||||
public String getSecKey() {
|
||||
return secKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param secKey
|
||||
* the secKey to set
|
||||
*/
|
||||
public void setSecKey(String secKey) {
|
||||
this.secKey = secKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown01
|
||||
*/
|
||||
public int getUnknown01() {
|
||||
return Unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown01
|
||||
* the unknown01 to set
|
||||
*/
|
||||
public void setUnknown01(int unknown01) {
|
||||
Unknown01 = unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown02
|
||||
*/
|
||||
public int getUnknown02() {
|
||||
return Unknown02;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown02
|
||||
* the unknown02 to set
|
||||
*/
|
||||
public void setUnknown02(int unknown02) {
|
||||
Unknown02 = unknown02;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.MobEquipment;
|
||||
|
||||
public class LootMsg extends ClientNetMsg {
|
||||
|
||||
private Item item;
|
||||
private int sourceType1;
|
||||
private int sourceID1;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private int sourceType2;
|
||||
private int sourceID2;
|
||||
|
||||
private int unknown01;
|
||||
private int unknown02;
|
||||
private int unknown03;
|
||||
private int unknown04;
|
||||
private int unknown05;
|
||||
private byte unknown06 = (byte) 0;
|
||||
private int unknown07;
|
||||
private int unknown08;
|
||||
|
||||
private MobEquipment mobEquipment = null;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LootMsg(int sourceType, int sourceID, int targetType, int targetID, Item item) {
|
||||
super(Protocol.MOVEOBJECTTOCONTAINER);
|
||||
this.sourceType1 = sourceType;
|
||||
this.sourceID1 = sourceID;
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
this.sourceType2 = sourceType;
|
||||
this.sourceID2 = sourceID;
|
||||
this.item = item;
|
||||
this.unknown01 = 0;
|
||||
this.unknown02 = 0;
|
||||
this.unknown03 = 0;
|
||||
this.unknown04 = 0;
|
||||
this.unknown05 = 0;
|
||||
this.unknown07 = 0;
|
||||
this.unknown08 = 0;
|
||||
}
|
||||
|
||||
//for MobEquipment
|
||||
|
||||
public LootMsg(int sourceType, int sourceID, int targetType, int targetID, MobEquipment mobEquipment) {
|
||||
super(Protocol.MOVEOBJECTTOCONTAINER);
|
||||
this.sourceType1 = sourceType;
|
||||
this.sourceID1 = sourceID;
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
this.sourceType2 = sourceType;
|
||||
this.sourceID2 = sourceID;
|
||||
this.item = null;
|
||||
this.mobEquipment = mobEquipment;
|
||||
|
||||
this.unknown01 = 0;
|
||||
this.unknown02 = 0;
|
||||
this.unknown03 = 0;
|
||||
this.unknown04 = 0;
|
||||
this.unknown05 = 0;
|
||||
this.unknown07 = 0;
|
||||
this.unknown08 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LootMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.MOVEOBJECTTOCONTAINER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
if (this.item != null)
|
||||
Item.serializeForClientMsgWithoutSlot(this.item,writer);
|
||||
else if (this.mobEquipment != null)
|
||||
try {
|
||||
MobEquipment._serializeForClientMsg(this.mobEquipment,writer, false);
|
||||
} catch (SerializationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
writer.putInt(this.sourceType1);
|
||||
writer.putInt(this.sourceID1);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
writer.putInt(this.sourceType2);
|
||||
writer.putInt(this.sourceID2);
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.unknown04);
|
||||
writer.putInt(this.unknown05);
|
||||
writer.put(this.unknown06);
|
||||
writer.putInt(this.unknown07);
|
||||
writer.putInt(this.unknown08);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.item = Item.deserializeFromClientMsg(reader, false);
|
||||
this.sourceType1 = reader.getInt();
|
||||
this.sourceID1 = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
this.sourceType2 = reader.getInt();
|
||||
this.sourceID2 = reader.getInt();
|
||||
this.unknown01 = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.unknown04 = reader.getInt();
|
||||
this.unknown05 = reader.getInt();
|
||||
this.unknown06 = reader.get();
|
||||
this.unknown07 = reader.getInt();
|
||||
this.unknown08 = reader.getInt();
|
||||
}
|
||||
|
||||
public int getSourceType1() {
|
||||
return this.sourceType1;
|
||||
}
|
||||
|
||||
public int getSourceID1() {
|
||||
return this.sourceID1;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return this.targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return this.targetID;
|
||||
}
|
||||
|
||||
public int getSourceType2() {
|
||||
return this.sourceType2;
|
||||
}
|
||||
|
||||
public int getSourceID2() {
|
||||
return this.sourceID2;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return this.unknown03;
|
||||
}
|
||||
|
||||
public int getUnknown04() {
|
||||
return this.unknown04;
|
||||
}
|
||||
|
||||
public int getUnknown05() {
|
||||
return this.unknown05;
|
||||
}
|
||||
|
||||
public byte getUnknown06() {
|
||||
return this.unknown06;
|
||||
}
|
||||
|
||||
public int getUnknown07() {
|
||||
return this.unknown07;
|
||||
}
|
||||
|
||||
public int getUnknown08() {
|
||||
return this.unknown08;
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
|
||||
public void setUnknown04(int value) {
|
||||
this.unknown04 = value;
|
||||
}
|
||||
|
||||
public void setUnknown05(int value) {
|
||||
this.unknown05 = value;
|
||||
}
|
||||
|
||||
public void setUnknown06(byte value) {
|
||||
this.unknown06 = value;
|
||||
}
|
||||
|
||||
public void setUnknown07(int value) {
|
||||
this.unknown07 = value;
|
||||
}
|
||||
|
||||
public void setUnknown08(int value) {
|
||||
this.unknown08 = value;
|
||||
}
|
||||
|
||||
public void setSourceType1(int value) {
|
||||
this.sourceType1 = value;
|
||||
}
|
||||
|
||||
public void setSourceID1(int value) {
|
||||
this.sourceID1 = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public void setSourceType2(int value) {
|
||||
this.sourceType2 = value;
|
||||
}
|
||||
|
||||
public void setSourceID2(int value) {
|
||||
this.sourceID2 = value;
|
||||
}
|
||||
|
||||
public void setItem(Item value) {
|
||||
this.item = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class LootWindowRequestMsg extends ClientNetMsg {
|
||||
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LootWindowRequestMsg(int sourceType, int sourceID, int targetType, int targetID) {
|
||||
super(Protocol.REQUESTCONTENTS);
|
||||
this.sourceType = sourceType;
|
||||
this.sourceID = sourceID;
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LootWindowRequestMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.REQUESTCONTENTS, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceType
|
||||
*/
|
||||
public int getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceID
|
||||
*/
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetType
|
||||
*/
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetID
|
||||
*/
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class LootWindowResponseMsg extends ClientNetMsg {
|
||||
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private ArrayList<Item> inventory;
|
||||
private int unknown01 = 45;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public LootWindowResponseMsg(int targetType, int targetID, ArrayList<Item> inventory) {
|
||||
super(Protocol.WEIGHTINVENTORY);
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 LootWindowResponseMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.WEIGHTINVENTORY, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.put((byte) 1);
|
||||
Item.putList(writer, this.inventory, false, this.targetID);
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public ArrayList<Item> getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public void setInventory(ArrayList<Item> value) {
|
||||
this.inventory = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
// Larger size for historically larger opcodes
|
||||
return 17; // 2^15 == 32,768
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,866 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.*;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Period;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Open manage city asset window
|
||||
*/
|
||||
public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
|
||||
//messageType
|
||||
//C->S 2: S->C: 0, 3, 4, 6
|
||||
//C->S 15: S->C: 15
|
||||
//C->S 14: S->C: 14
|
||||
//C->S ?: S->C: 10, 11, 16
|
||||
|
||||
//C->S 2 = manage this asset
|
||||
// 20 = manage entire city
|
||||
|
||||
//S->C, 0 = error message
|
||||
// 3 = manage asset
|
||||
// 4 = no access / building info
|
||||
|
||||
public int actionType;
|
||||
private int targetID;
|
||||
private int targetType;
|
||||
private int targetType1;
|
||||
private int targetType2;
|
||||
private int targetType3;
|
||||
private int targetID1;
|
||||
private int targetID2;
|
||||
private int targetID3;
|
||||
public String assetName;
|
||||
private String AssetName1;
|
||||
public String CityName;
|
||||
private int rank;
|
||||
private int symbol;
|
||||
public int upgradeCost;
|
||||
private int unknown04;
|
||||
private int unknown05;
|
||||
private int unknown06;
|
||||
private int unknown07;
|
||||
private int unknown14;
|
||||
private int unknown15;
|
||||
private int unknown16;
|
||||
private int unknown17;
|
||||
private int unknown54;
|
||||
private int preName01;
|
||||
|
||||
private byte UnkByte03;
|
||||
private byte UnkByte04;
|
||||
private int strongbox;
|
||||
|
||||
private int baneHour;
|
||||
private PlayerCharacter assetManager;
|
||||
private Building asset;
|
||||
public byte labelProtected;
|
||||
public byte labelSiege;
|
||||
public byte labelCeaseFire;
|
||||
public byte buttonTransfer;
|
||||
public byte buttonDestroy;
|
||||
public byte buttonAbandon;
|
||||
public byte buttonUpgrade;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public ManageCityAssetsMsg() {
|
||||
super(Protocol.MANAGECITYASSETS);
|
||||
this.actionType = 0;
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.preName01 = 0;
|
||||
this.assetName = "";
|
||||
this.CityName = "";
|
||||
this.rank = 0;
|
||||
this.symbol = 0;
|
||||
this.unknown04 = 0;
|
||||
this.unknown06 = 0;
|
||||
this.unknown07 = 0;
|
||||
this.unknown14 = 0;
|
||||
this.unknown15 = 0;
|
||||
this.unknown16 = 0;
|
||||
this.unknown17 = 0;
|
||||
|
||||
this.strongbox = 0;
|
||||
|
||||
this.targetType1 = 0;
|
||||
this.targetType2 = 0;
|
||||
this.targetType3 = 0;
|
||||
|
||||
this.targetID1 = 0;
|
||||
this.targetID2 = 0;
|
||||
this.targetID3 = 0;
|
||||
this.UnkByte03 = 0;
|
||||
this.UnkByte04 = 0;
|
||||
this.AssetName1 = "";
|
||||
this.unknown54 = 0;
|
||||
this.strongbox = 0;
|
||||
this.upgradeCost = 0;
|
||||
|
||||
this.labelProtected = 0;
|
||||
this.labelSiege = 0;
|
||||
this.labelCeaseFire = 0;
|
||||
this.buttonTransfer = 0;
|
||||
this.buttonDestroy = 0;
|
||||
this.buttonAbandon = 0;
|
||||
this.buttonUpgrade = 0;
|
||||
|
||||
}
|
||||
|
||||
public ManageCityAssetsMsg(PlayerCharacter pc, Building asset) {
|
||||
super(Protocol.MANAGECITYASSETS);
|
||||
this.assetManager = pc;
|
||||
this.asset = asset;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ManageCityAssetsMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.MANAGECITYASSETS, origin, reader);
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
return (20); // 2^10 == 1024
|
||||
}
|
||||
public void setTargetID(int targetID) {
|
||||
this.targetID = targetID;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public void setTargetType(int targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
public void setTargetType3(int targetType3) {
|
||||
this.targetType3 = targetType3;
|
||||
}
|
||||
|
||||
public void setTargetID3(int targetID3) {
|
||||
this.targetID3 = targetID3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
actionType = reader.getInt();
|
||||
targetType = reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
if (this.actionType == 20) {
|
||||
reader.getInt();
|
||||
this.baneHour = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
} else if (this.actionType == 5) { //rename building.
|
||||
reader.getInt();
|
||||
assetName = reader.getString();
|
||||
for (int i = 0; i < 5; i++)
|
||||
reader.getInt();
|
||||
} else if (this.actionType == 2) {
|
||||
reader.getInt();
|
||||
this.strongbox = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
|
||||
}else{
|
||||
for (int i = 0; i < 6; i++)
|
||||
reader.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.actionType);
|
||||
|
||||
if (this.actionType == 2) {
|
||||
writer.putInt(asset.getObjectType().ordinal());
|
||||
writer.putInt(asset.getObjectUUID());
|
||||
writer.putInt(0);
|
||||
writer.putInt(asset.reserve);
|
||||
writer.putInt(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.actionType == 13) {
|
||||
writer.putInt(asset.getObjectType().ordinal());
|
||||
writer.putInt(asset.getObjectUUID());
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(asset.getHirelings().size());
|
||||
for (AbstractCharacter hireling : asset.getHirelings().keySet()){
|
||||
if (!hireling.getObjectType().equals(GameObjectType.NPC))
|
||||
writer.putString(hireling.getName());
|
||||
else{
|
||||
NPC npc = (NPC)hireling;
|
||||
if (!npc.getNameOverride().isEmpty()){
|
||||
writer.putString(npc.getNameOverride());
|
||||
}else
|
||||
|
||||
if (npc.getContract() != null) {
|
||||
if (npc.getContract().isTrainer()) {
|
||||
writer.putString(npc.getName() + ", " + npc.getContract().getName());
|
||||
} else {
|
||||
writer.putString(npc.getName() + " " + npc.getContract().getName());
|
||||
}
|
||||
} else {
|
||||
writer.putString(npc.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
//Bane window
|
||||
|
||||
if (this.actionType == 11) {
|
||||
writer.putInt(asset.getObjectType().ordinal());
|
||||
writer.putInt(asset.getObjectUUID());
|
||||
for (int a = 0;a<5;a++)
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(asset.getHirelings().size());
|
||||
|
||||
for (AbstractCharacter npcHire : asset.getHirelings().keySet()) {
|
||||
writer.putInt(npcHire.getObjectType().ordinal());
|
||||
writer.putInt(npcHire.getObjectUUID());
|
||||
if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||
writer.putString(((NPC)npcHire).getContract().getName());
|
||||
else
|
||||
writer.putString("Guard Captain");
|
||||
writer.putString(npcHire.getName());
|
||||
writer.putInt(1);
|
||||
writer.putInt(Blueprint.getNpcMaintCost(npcHire.getRank()));
|
||||
if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||
writer.putInt(((NPC)npcHire).getContract().getIconID()); // Was 60
|
||||
else if (npcHire.getObjectType() == GameObjectType.Mob){
|
||||
writer.putInt(((Mob)npcHire).getContract().getIconID()); // Was 60
|
||||
}
|
||||
else
|
||||
writer.putInt(5);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.actionType == 15) {
|
||||
writer.putInt(1);
|
||||
writer.putInt(1);
|
||||
City city = null;
|
||||
Zone playerZone = ZoneManager.findSmallestZone(assetManager.getLoc());
|
||||
Set<Building> buildings = ZoneManager.findSmallestZone(assetManager.getLoc()).zoneBuildingSet;
|
||||
|
||||
Building tol = null;
|
||||
if (playerZone.getPlayerCityUUID() != 0)
|
||||
city = City.GetCityFromCache(playerZone.getPlayerCityUUID());
|
||||
|
||||
if (city != null)
|
||||
tol = city.getTOL();
|
||||
|
||||
|
||||
|
||||
writer.putInt(0); // 1 + String = custom message, cant control assets.
|
||||
writer.putInt(0);
|
||||
writer.putInt(0); //array
|
||||
|
||||
writer.putInt(buildings.size());
|
||||
|
||||
int i = 0;
|
||||
for (Building building: buildings){
|
||||
|
||||
i++;
|
||||
writer.putString(building.getName()); //ARRAY
|
||||
writer.putInt(building.getObjectType().ordinal()); //?
|
||||
writer.putInt(building.getObjectUUID()); //?
|
||||
|
||||
writer.putInt(4);
|
||||
writer.putInt(4);
|
||||
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)1);
|
||||
writer.put((byte)1);
|
||||
|
||||
//max distance to bypass clientside check.
|
||||
float maxDistance = 2000;
|
||||
|
||||
|
||||
writer.putFloat(maxDistance);
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
if (building.getPatrolPoints() != null){
|
||||
writer.putInt(building.getPatrolPoints().size());
|
||||
for (Vector3fImmutable patrolPoint: building.getPatrolPoints()){
|
||||
writer.putVector3f(patrolPoint);
|
||||
}
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.putInt(0); //Sentry Point
|
||||
|
||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK){
|
||||
writer.putInt(1); //Tab left Random Town? //Opens up 16 Bytes
|
||||
writer.putInt(4);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(4);
|
||||
}else
|
||||
writer.putInt(0);
|
||||
writer.putInt(0); //array with size 32 bytes. // Adds information of building
|
||||
}
|
||||
writer.putInt(0); //ARRAY
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
if (this.actionType == 18) {
|
||||
Zone zone = asset.getParentZone();
|
||||
|
||||
if (zone == null)
|
||||
return;
|
||||
|
||||
City banedCity = City.getCity(zone.getPlayerCityUUID());
|
||||
|
||||
if (banedCity == null)
|
||||
return;
|
||||
|
||||
Bane bane = banedCity.getBane();
|
||||
|
||||
if (bane == null)
|
||||
return;
|
||||
|
||||
Guild attackerGuild = bane.getOwner().getGuild();
|
||||
|
||||
if (attackerGuild == null)
|
||||
return;
|
||||
|
||||
writer.putInt(asset.getObjectType().ordinal());
|
||||
writer.putInt(asset.getObjectUUID());
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putString(attackerGuild.getName());
|
||||
writer.putString(Guild.GetGL(attackerGuild).getName());
|
||||
writer.putInt(bane.getSiegePhase().ordinal()); //1 challenge //2 standoff //3 war
|
||||
writer.put((byte) 0);
|
||||
|
||||
if (!bane.isAccepted() && this.assetManager.getGuild() == banedCity.getGuild() && GuildStatusController.isInnerCouncil(this.assetManager.getGuildStatus()))
|
||||
writer.put((byte) 1); //canSetTime
|
||||
else
|
||||
writer.put((byte) 0);
|
||||
|
||||
DateTime placedOn = bane.getLiveDate();
|
||||
|
||||
if (placedOn == null)
|
||||
placedOn = new DateTime(DateTime.now());
|
||||
|
||||
//set Calander to date of bane live.
|
||||
DateTime now = DateTime.now();
|
||||
DateTime defaultTime = new DateTime(bane.getPlacementDate());
|
||||
DateTime playerEnterWorldTime = new DateTime(this.assetManager.getTimeStamp("EnterWorld"));
|
||||
Period period = new Period(playerEnterWorldTime.getMillis(), now.getMillis());
|
||||
int hoursLoggedIn = period.getHours();
|
||||
hoursLoggedIn = hoursLoggedIn < 0 ? 0 : hoursLoggedIn;
|
||||
|
||||
defaultTime = defaultTime.plusDays(2);
|
||||
defaultTime = defaultTime.hourOfDay().setCopy(22);
|
||||
defaultTime = defaultTime.minuteOfHour().setCopy(0);
|
||||
defaultTime = defaultTime.secondOfMinute().setCopy(0);
|
||||
|
||||
long curTime = now.getMillis();
|
||||
long timeLeft = 0;
|
||||
|
||||
if (bane.getLiveDate() != null)
|
||||
timeLeft = bane.getLiveDate().getMillis() - curTime;
|
||||
else
|
||||
timeLeft = defaultTime.getMillis() - curTime + 1000;
|
||||
|
||||
//DO not touch these. They are static formula's until i get the correct converter for SB Time.
|
||||
|
||||
writer.put((byte) placedOn.dayOfMonth().get());
|
||||
writer.put((byte) placedOn.monthOfYear().get());
|
||||
writer.putInt(placedOn.year().get() - 1900);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
|
||||
if (timeLeft < 0)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt((int) timeLeft / 1000); // Time remaing until bane/Seconds
|
||||
|
||||
if (attackerGuild.getGuildState() == GuildState.Sworn)
|
||||
writer.putInt(4); //3 capture/errant,4 capture/sworn, 5 destroy/soveirgn.
|
||||
else
|
||||
writer.putInt(5);
|
||||
|
||||
writer.put((byte) (16 - hoursLoggedIn)); // hour start
|
||||
writer.put((byte) (24 - hoursLoggedIn)); // hour end
|
||||
writer.put((byte) 2);
|
||||
writer.putString(banedCity.getCityName());
|
||||
writer.putString(Guild.GetGL(bane.getOwner().getGuild()) != null ? Guild.GetGL(bane.getOwner().getGuild()).getName() : "No Guild Leader");
|
||||
GuildTag._serializeForDisplay(attackerGuild.getGuildTag(),writer);
|
||||
GuildTag._serializeForDisplay(attackerGuild.getNation().getGuildTag(),writer);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
if (this.actionType == 3) {
|
||||
|
||||
writer.putInt(targetType);
|
||||
writer.putInt(targetID);
|
||||
|
||||
Guild nation = null;
|
||||
Building building = BuildingManager.getBuildingFromCache(targetID);
|
||||
Guild guild = building.getGuild();
|
||||
Zone zone = ZoneManager.findSmallestZone(building.getLoc());
|
||||
|
||||
writer.putInt(0);//unknown Might be to allow manager to open or not!
|
||||
writer.putString(building.getName());
|
||||
|
||||
AbstractCharacter buildingOwner = building.getOwner();
|
||||
|
||||
if (buildingOwner == null)
|
||||
writer.putString("Morloch");
|
||||
else
|
||||
writer.putString(buildingOwner.getName());
|
||||
|
||||
if (zone == null)
|
||||
writer.putString("Forlord");
|
||||
else
|
||||
writer.putString(zone.getName());
|
||||
|
||||
writer.putString(building.getGuild().getName());
|
||||
|
||||
writer.putInt(building.getRank());
|
||||
|
||||
// Maintenance costs include resource if
|
||||
// this structure is an R8 tree
|
||||
|
||||
if (building.getRank() == 8)
|
||||
writer.putInt(5); // Resources included
|
||||
else
|
||||
writer.putInt(1); // Gold only
|
||||
|
||||
writer.putInt(2308551); //Gold
|
||||
if (building.getBlueprint() == null)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt(building.getBlueprint().getMaintCost(building.getRank())); // maint cost
|
||||
|
||||
if (building.getRank() == 8) {
|
||||
writer.putInt(74856115); // Stone
|
||||
writer.putInt(1500); // maint cost
|
||||
writer.putInt(-1603256692); // Lumber
|
||||
writer.putInt(1500); // maint cost
|
||||
writer.putInt(-1596311545); // Galvor
|
||||
writer.putInt(5); // maint cost
|
||||
writer.putInt(1532478436); // Wormwood
|
||||
writer.putInt(5); // maint cost
|
||||
}
|
||||
|
||||
LocalDateTime maintDate = building.maintDateTime;
|
||||
|
||||
if (maintDate == null)
|
||||
maintDate = LocalDateTime.now();
|
||||
writer.putLocalDateTime(LocalDateTime.now()); // current time
|
||||
|
||||
// utc offset?
|
||||
writer.putInt((int)java.time.Duration.between(LocalDateTime.now(), maintDate).getSeconds()); // Seconds to maint date
|
||||
|
||||
writer.putInt(building.getStrongboxValue());
|
||||
writer.putInt(building.reserve);//reserve Sets the buildings reserve display
|
||||
writer.putInt(0);//prosperity under maintenance (wtf is prosperity?)
|
||||
writer.putInt(10);
|
||||
writer.putFloat((float) .1);
|
||||
|
||||
if (this.buttonUpgrade == 1) {
|
||||
if (building.getBlueprint() == null)
|
||||
this.upgradeCost = Integer.MAX_VALUE;
|
||||
else
|
||||
if (building.getRank() == building.getBlueprint().getMaxRank())
|
||||
this.upgradeCost = Integer.MAX_VALUE;
|
||||
else
|
||||
this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7));
|
||||
|
||||
writer.putInt(this.upgradeCost);
|
||||
}
|
||||
else
|
||||
writer.putInt(0);
|
||||
|
||||
LocalDateTime uc = LocalDateTime.now();
|
||||
|
||||
if (building.getDateToUpgrade() != null)
|
||||
uc = building.getDateToUpgrade();
|
||||
|
||||
long timeLeft = uc.atZone(ZoneId.systemDefault())
|
||||
.toInstant().toEpochMilli() - System.currentTimeMillis();
|
||||
long hour = timeLeft / 3600000;
|
||||
long noHour = timeLeft - (hour * 3600000);
|
||||
long minute = noHour / 60000;
|
||||
long noMinute = noHour - (minute * 60000);
|
||||
long second = noMinute / 1000;
|
||||
|
||||
writer.put((byte) 0);//Has to do with repair time. A 1 here puts 23.9 hours in repair time A 2 here is 1.9 days
|
||||
writer.put((byte) 0);//unknown
|
||||
writer.putInt(0); //unknown
|
||||
|
||||
if (LocalDateTime.now().isAfter(uc)) {
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
else {
|
||||
writer.put((byte) (hour));
|
||||
writer.put((byte) minute);
|
||||
writer.put((byte) second);
|
||||
}
|
||||
|
||||
if (timeLeft < 0)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt((int) timeLeft);
|
||||
|
||||
writer.putInt((int) building.getCurrentHitpoints());
|
||||
writer.putInt((int) building.getMaxHitPoints());
|
||||
writer.putInt(BuildingManager.GetRepairCost(building));//sets the repair cost.
|
||||
writer.putInt(0);//unknown
|
||||
|
||||
if (building.getBlueprint() == null)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt(building.getBlueprint().getSlotsForRank(building.getRank()));
|
||||
writer.put((byte) 1);//Has to do with removing update timer and putting in cost for upgrade
|
||||
|
||||
writer.put(labelProtected); // 1 sets protection to invulnerable.
|
||||
writer.put(labelSiege);// 1 sets the protection under siege
|
||||
writer.put(labelCeaseFire); //0 with 1 set above sets to under siege // 1 with 1 set above sets protection status to under siege(cease fire)
|
||||
|
||||
writer.put(buttonTransfer);// 1 enables the transfer asset button
|
||||
writer.put(buttonDestroy);// 1 enables the destroy asset button
|
||||
writer.put(buttonAbandon);// 1 here enables the abandon asset button
|
||||
writer.put(buttonUpgrade); //disable upgrade building
|
||||
|
||||
if (building.getBlueprint() == null)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt(building.getBlueprint().getIcon()); //Symbol
|
||||
|
||||
if (guild == null) {
|
||||
for (int i = 0; i < 3; i++)
|
||||
writer.putInt(16);
|
||||
for (int i = 0; i < 2; i++)
|
||||
writer.putInt(0);
|
||||
}
|
||||
else {
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(),writer);
|
||||
nation = guild.getNation();
|
||||
}
|
||||
|
||||
if (nation == null) {
|
||||
for (int i = 0; i < 3; i++)
|
||||
writer.putInt(16);
|
||||
for (int i = 0; i < 2; i++)
|
||||
writer.putInt(0);
|
||||
}
|
||||
else {
|
||||
GuildTag._serializeForDisplay(nation.getGuildTag(),writer);
|
||||
}
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);//1 makes it so manage window does not open.
|
||||
|
||||
if (!building.assetIsProtected() && !building.getProtectionState().equals(ProtectionState.PENDING)){
|
||||
writer.putInt(0);
|
||||
}
|
||||
else{
|
||||
writer.putInt(1); //kos on/off?
|
||||
writer.putInt(3); // was 3
|
||||
if (zone.getPlayerCityUUID() != 0 && asset.assetIsProtected()){
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(City.getCity(zone.getPlayerCityUUID()).getTOL().getObjectUUID());
|
||||
}
|
||||
else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(targetType3);
|
||||
writer.putInt(targetID3);
|
||||
|
||||
|
||||
if (building.getProtectionState() == ProtectionState.PENDING)
|
||||
writer.put((byte)1); //Accept or decline.
|
||||
else
|
||||
writer.put((byte)0);
|
||||
|
||||
if (building.taxType == TaxType.NONE)
|
||||
writer.put((byte)0); //? ??
|
||||
else if(building.taxDateTime != null)
|
||||
writer.put((byte)1);
|
||||
else
|
||||
writer.put((byte)0);
|
||||
|
||||
writer.putString(""); //tree of life protection tax
|
||||
writer.putInt(0); //??
|
||||
writer.putInt(0); //??
|
||||
if (building.taxType == TaxType.NONE){
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}else if (building.taxType == TaxType.WEEKLY){
|
||||
writer.putInt(building.taxAmount);
|
||||
writer.putInt(0);
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(building.taxAmount);
|
||||
}
|
||||
|
||||
|
||||
writer.put(building.enforceKOS ? (byte)1:0); //enforceKOS
|
||||
writer.put((byte) 0); //?
|
||||
writer.putInt(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ConcurrentHashMap<AbstractCharacter, Integer> npcList = building.getHirelings();
|
||||
writer.putInt(npcList.size());
|
||||
if (npcList.size() > 0) {
|
||||
for (AbstractCharacter npcHire : npcList.keySet()) {
|
||||
writer.putInt(npcHire.getObjectType().ordinal());
|
||||
if (npcHire.getObjectType() == GameObjectType.Mob)
|
||||
writer.putInt(((Mob)npcHire).getDBID());
|
||||
else
|
||||
writer.putInt(npcHire.getObjectUUID());
|
||||
if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||
writer.putString(((NPC)npcHire).getContract().getName());
|
||||
else
|
||||
writer.putString("Guard Captain");
|
||||
writer.putString(npcHire.getName());
|
||||
writer.putInt(npcHire.getRank());
|
||||
writer.putInt(Blueprint.getNpcMaintCost(npcHire.getRank()));
|
||||
if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||
writer.putInt(((NPC)npcHire).getContract().getIconID()); // Was 60
|
||||
else if (npcHire.getObjectType() == GameObjectType.Mob)
|
||||
writer.putInt(((Mob)npcHire).getContract().getIconID()); // Was 60
|
||||
|
||||
int contractID = 0;
|
||||
|
||||
|
||||
if (npcHire.getObjectType() == GameObjectType.Mob)
|
||||
contractID = ((Mob)npcHire).getContract().getContractID();
|
||||
else if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||
contractID = ((NPC)npcHire).getContract().getContractID();
|
||||
|
||||
if (contractID ==830){
|
||||
writer.putInt(24580);
|
||||
}
|
||||
else if (building.getBlueprint() != null && (building.getBlueprint().getBuildingGroup() == BuildingGroup.FORGE ||building.getBlueprint().getBuildingGroup() == BuildingGroup.MAGICSHOP||building.getBlueprint().getBuildingGroup() == BuildingGroup.TAILOR)){
|
||||
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)4);
|
||||
writer.put((byte)128);
|
||||
writer.put((byte)0);
|
||||
|
||||
}else{
|
||||
writer.put((byte)0);
|
||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
||||
writer.put((byte)1);
|
||||
else
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
}
|
||||
|
||||
|
||||
if (!npcHire.isAlive()){
|
||||
writer.put((byte) 1); // 1 SHOWs respawning
|
||||
writer.putInt(10); // Seconds in respawn.
|
||||
writer.putInt(20);
|
||||
}
|
||||
else
|
||||
writer.put((byte)0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.actionType == 4) {
|
||||
writer.putInt(targetType);
|
||||
writer.putInt(targetID);
|
||||
Building building = BuildingManager.getBuildingFromCache(targetID);
|
||||
|
||||
writer.putInt(preName01);
|
||||
writer.putString(building.getName()); //assetName
|
||||
writer.putString(building.getOwnerName()); //ownerName
|
||||
writer.putString(building.getGuild().getName());//guild name
|
||||
writer.putString(building.getCityName()); //City Name
|
||||
writer.putInt(building.getRank());
|
||||
if (building.getBlueprint() == null)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt(building.getBlueprint().getIcon());
|
||||
|
||||
//tags
|
||||
GuildTag._serializeForDisplay(building.getGuild().getGuildTag(), writer);
|
||||
GuildTag._serializeForDisplay(building.getGuild().getNation().getGuildTag(), writer);
|
||||
|
||||
writer.putInt(unknown14);
|
||||
writer.putInt(unknown15);
|
||||
writer.putInt(unknown16);
|
||||
writer.putInt(unknown17);
|
||||
writer.putInt(0); // previously uninitialized unknown18
|
||||
}
|
||||
}
|
||||
|
||||
public int getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
public void setRank(int rank) {
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public int getSymbol() {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public void setSymbol(int symbol) {
|
||||
this.symbol = symbol;
|
||||
}
|
||||
|
||||
public int getUnknown04() {
|
||||
return unknown04;
|
||||
}
|
||||
|
||||
public void setUnknown04(int unknown04) {
|
||||
this.unknown04 = unknown04;
|
||||
}
|
||||
|
||||
public int getUnknown05() {
|
||||
return unknown05;
|
||||
}
|
||||
|
||||
public void setUnknown05(int unknown05) {
|
||||
this.unknown05 = unknown05;
|
||||
}
|
||||
|
||||
public int getUnknown06() {
|
||||
return unknown06;
|
||||
}
|
||||
|
||||
public void setUnknown06(int unknown06) {
|
||||
this.unknown06 = unknown06;
|
||||
}
|
||||
|
||||
public void setUnknown07(int unknown07) {
|
||||
this.unknown07 = unknown07;
|
||||
}
|
||||
|
||||
public String getAssetName() {
|
||||
return assetName;
|
||||
}
|
||||
|
||||
public void setAssetName(String AssetName) {
|
||||
this.assetName = AssetName;
|
||||
}
|
||||
|
||||
public void setAssetName1(String AssetName1) {
|
||||
this.AssetName1 = AssetName1;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return CityName;
|
||||
}
|
||||
|
||||
public void setUnknown54(int unknown54) {
|
||||
this.unknown54 = unknown54;
|
||||
}
|
||||
|
||||
public int getStrongbox() {
|
||||
return strongbox;
|
||||
}
|
||||
|
||||
public void setStrongbox(int strongbox) {
|
||||
this.strongbox = strongbox;
|
||||
}
|
||||
|
||||
public int getBaneHour() {
|
||||
return baneHour;
|
||||
}
|
||||
|
||||
public Building getAsset() {
|
||||
return asset;
|
||||
}
|
||||
|
||||
public void setAsset(Building asset) {
|
||||
this.asset = asset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Debug Info
|
||||
//Run: Failed to make object TEMPLATE:135700 INSTANCE:1717987027141... (t=50.46) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:108760 INSTANCE:1717987027161... (t=50.46) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:108760 INSTANCE:1717987027177... (t=50.67) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:60040 INSTANCE:1717987027344... (t=50.87) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:3 INSTANCE:1717987027164... (t=50.88) (r=7/4/2011 11:56:39)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,228 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class MerchantMsg extends ClientNetMsg {
|
||||
|
||||
private int type;
|
||||
private int unknown01;
|
||||
private int unknown02;
|
||||
private int unknown03;
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
private int cityType;
|
||||
private int cityID;
|
||||
private int teleportTime;
|
||||
private int unknown04;
|
||||
private int itemType;
|
||||
private int itemID;
|
||||
private int amount;
|
||||
private int hashID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public MerchantMsg() {
|
||||
super(Protocol.MERCHANT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 MerchantMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.MERCHANT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public MerchantMsg(MerchantMsg msg) {
|
||||
super(Protocol.MERCHANT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
this.unknown01 = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
if (this.type == 11 || type == 13) {
|
||||
this.cityType = reader.getInt();
|
||||
this.cityID = reader.getInt();
|
||||
this.teleportTime = reader.getInt();
|
||||
}else if(this.type == 18){
|
||||
this.itemType = reader.getInt();
|
||||
this.itemID = reader.getInt();
|
||||
this.amount = reader.getInt();
|
||||
}else if (this.type == 17){
|
||||
this.hashID = reader.getInt();
|
||||
this.amount = reader.getInt();
|
||||
}else if (this.type == 19){
|
||||
this.hashID = reader.getInt();
|
||||
}else {
|
||||
|
||||
this.cityType = 0;
|
||||
this.cityID = 0;
|
||||
this.teleportTime = 0;
|
||||
}
|
||||
this.unknown04 = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.type);
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.npcType);
|
||||
writer.putInt(this.npcID);
|
||||
if (this.type == 11 || type == 13) {
|
||||
writer.putInt(this.cityType);
|
||||
writer.putInt(this.cityID);
|
||||
writer.putInt(this.teleportTime);
|
||||
}
|
||||
writer.putInt(this.unknown04);
|
||||
if (this.type == 5){
|
||||
writer.putInt(2097253);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return this.unknown03;
|
||||
}
|
||||
|
||||
public int getNPCType() {
|
||||
return this.npcType;
|
||||
}
|
||||
|
||||
public int getNPCID() {
|
||||
return this.npcID;
|
||||
}
|
||||
|
||||
public int getCityType() {
|
||||
return this.cityType;
|
||||
}
|
||||
|
||||
public int getCityID() {
|
||||
return this.cityID;
|
||||
}
|
||||
|
||||
public int getTeleportTime() {
|
||||
return this.teleportTime;
|
||||
}
|
||||
|
||||
public int getUnknown04() {
|
||||
return this.unknown04;
|
||||
}
|
||||
|
||||
public void setType(int value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
|
||||
public void setNPCType(int value) {
|
||||
this.npcType = value;
|
||||
}
|
||||
|
||||
public void setNPCID(int value) {
|
||||
this.npcID = value;
|
||||
}
|
||||
|
||||
public void setCityType(int value) {
|
||||
this.cityType = value;
|
||||
}
|
||||
|
||||
public void setCityID(int value) {
|
||||
this.cityID = value;
|
||||
}
|
||||
|
||||
public void setTeleportTime(int value) {
|
||||
this.teleportTime = value;
|
||||
}
|
||||
|
||||
public void setUnknown04(int value) {
|
||||
this.unknown04 = value;
|
||||
}
|
||||
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setItemType(int itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public int getItemID() {
|
||||
return itemID;
|
||||
}
|
||||
|
||||
public void setItemID(int itemID) {
|
||||
this.itemID = itemID;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public int getHashID() {
|
||||
return hashID;
|
||||
}
|
||||
|
||||
public void setHashID(int hashID) {
|
||||
this.hashID = hashID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class MinionTrainingMessage extends ClientNetMsg {
|
||||
private int npcID;
|
||||
private int npcType;
|
||||
private int buildingID;
|
||||
private int buildingType;
|
||||
private int type;
|
||||
private int pad = 0;
|
||||
private int objectType;
|
||||
private int objectUUID;
|
||||
private boolean isTreb = false;
|
||||
private boolean isMangonal = false;
|
||||
private boolean isBallista = false;
|
||||
private int minion;
|
||||
private int mobType;
|
||||
private int mobID;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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 MinionTrainingMessage(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.MINIONTRAINING, origin, reader);
|
||||
}
|
||||
|
||||
public MinionTrainingMessage() {
|
||||
super(Protocol.MINIONTRAINING);
|
||||
}
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
if (this.type == 2){
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
this.objectType = reader.getInt();
|
||||
this.objectUUID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
}else{
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.minion = reader.getInt();
|
||||
if (this.minion == 1)
|
||||
this.isTreb = true;
|
||||
else if(this.minion == 2)
|
||||
this.isBallista = true;
|
||||
else if (this.minion == 3)
|
||||
this.isMangonal = true;
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(int value) {
|
||||
this.objectType = value;
|
||||
}
|
||||
|
||||
public void setPad(int value) {
|
||||
this.pad = value;
|
||||
}
|
||||
|
||||
public int getUUID() {
|
||||
return objectUUID;
|
||||
|
||||
}
|
||||
|
||||
public int getPad() {
|
||||
return pad;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
public boolean isTreb() {
|
||||
return isTreb;
|
||||
}
|
||||
public void setTreb(boolean isTreb) {
|
||||
this.isTreb = isTreb;
|
||||
}
|
||||
public boolean isMangonal() {
|
||||
return isMangonal;
|
||||
}
|
||||
public void setMangonal(boolean isMangonal) {
|
||||
this.isMangonal = isMangonal;
|
||||
}
|
||||
public boolean isBallista() {
|
||||
return isBallista;
|
||||
}
|
||||
public void setBallista(boolean isBallista) {
|
||||
this.isBallista = isBallista;
|
||||
}
|
||||
public int getMinion() {
|
||||
return minion;
|
||||
}
|
||||
public void setMinion(int minion) {
|
||||
this.minion = minion;
|
||||
}
|
||||
|
||||
public int getNpcID() {
|
||||
return npcID;
|
||||
}
|
||||
|
||||
public void setNpcID(int npcID) {
|
||||
this.npcID = npcID;
|
||||
}
|
||||
|
||||
public int getNpcType() {
|
||||
return npcType;
|
||||
}
|
||||
|
||||
public void setNpcType(int npcType) {
|
||||
this.npcType = npcType;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
return buildingID;
|
||||
}
|
||||
|
||||
public void setBuildingID(int buildingID) {
|
||||
this.buildingID = buildingID;
|
||||
}
|
||||
|
||||
public int getBuildingType() {
|
||||
return buildingType;
|
||||
}
|
||||
|
||||
public void setBuildingType(int buildingType) {
|
||||
this.buildingType = buildingType;
|
||||
}
|
||||
|
||||
public int getMobType() {
|
||||
return mobType;
|
||||
}
|
||||
|
||||
public void setMobType(int mobType) {
|
||||
this.mobType = mobType;
|
||||
}
|
||||
|
||||
public int getMobID() {
|
||||
return mobID;
|
||||
}
|
||||
|
||||
public void setMobID(int mobID) {
|
||||
this.mobID = mobID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
/**
|
||||
* Commit to trade
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class ModifyCommitToTradeMsg extends ClientNetMsg {
|
||||
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private byte commit1;
|
||||
private byte commit2;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public ModifyCommitToTradeMsg(AbstractGameObject player, AbstractGameObject target, byte commit1, byte commit2) {
|
||||
super(Protocol.TRADECONFIRMSTATUS);
|
||||
this.playerType = player.getObjectType().ordinal();
|
||||
this.playerID = player.getObjectUUID();
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
this.commit1 = commit1;
|
||||
this.commit2 = commit2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ModifyCommitToTradeMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.TRADECONFIRMSTATUS, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
this.playerType = reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
commit1 = reader.get();
|
||||
commit2 = reader.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putInt(targetType);
|
||||
writer.putInt(targetID);
|
||||
writer.put(commit1);
|
||||
writer.put(commit2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the commit1
|
||||
*/
|
||||
public byte getCommit1() {
|
||||
return commit1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param commit1 the commit1 to set
|
||||
*/
|
||||
public void setCommit1(byte commit1) {
|
||||
this.commit1 = commit1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the commit2
|
||||
*/
|
||||
public byte getCommit2() {
|
||||
return commit2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param commit2 the commit2 to set
|
||||
*/
|
||||
public void setCommit2(byte commit2) {
|
||||
this.commit2 = commit2;
|
||||
}
|
||||
|
||||
public int getPlayerType() {
|
||||
return playerType;
|
||||
}
|
||||
|
||||
public void setPlayerType(int playerType) {
|
||||
this.playerType = playerType;
|
||||
}
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public void setTargetType(int targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setTargetID(int targetID) {
|
||||
this.targetID = targetID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractCharacter;
|
||||
|
||||
public class ModifyHealthKillMsg extends ClientNetMsg {
|
||||
|
||||
private int trains;
|
||||
private int unknownID; //effectID
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private int unknown02 = 0; //1 heal, 0 hurt?
|
||||
private int unknown03 = 0; //0=normalCast, 1to4=powerFailed, 5=targetIsImmune, 6=targetResisted
|
||||
private int unknown04 = -1;
|
||||
private int unknown05 = 0;
|
||||
private byte unknownByte = (byte) 0; //0
|
||||
private int powerID;
|
||||
private String powerName;
|
||||
private float health;
|
||||
private float healthMod;
|
||||
private float mana;
|
||||
private float manaMod;
|
||||
private float stamina;
|
||||
private float staminaMod;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
|
||||
public ModifyHealthKillMsg(AbstractCharacter source, AbstractCharacter target, float healthMod, float manaMod, float staminaMod, int powerID, String powerName, int trains, int effectID) {
|
||||
super(Protocol.POWERACTIONDDDIE);
|
||||
if (source != null) {
|
||||
this.sourceType = source.getObjectType().ordinal();
|
||||
this.sourceID = source.getObjectUUID();
|
||||
} else {
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
}
|
||||
if (target != null) {
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
this.health = target.getCurrentHitpoints();
|
||||
this.healthMod = healthMod;
|
||||
this.mana = target.getMana();
|
||||
this.manaMod = manaMod;
|
||||
this.stamina = target.getStamina();
|
||||
this.staminaMod = staminaMod;
|
||||
} else {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.health = 0;
|
||||
this.healthMod = 0;
|
||||
this.mana = 0;
|
||||
this.manaMod = 0;
|
||||
this.stamina = 0;
|
||||
this.staminaMod = 0;
|
||||
}
|
||||
this.unknownID = effectID;
|
||||
this.trains = trains;
|
||||
this.powerID = powerID;
|
||||
this.powerName = powerName;
|
||||
|
||||
this.unknown02 = 0;
|
||||
}
|
||||
|
||||
//called for kills
|
||||
public ModifyHealthKillMsg(AbstractCharacter source, AbstractCharacter target, int powerID, String powerName, int trains, int effectID) {
|
||||
super(Protocol.POWERACTIONDDDIE);
|
||||
if (source != null) {
|
||||
this.sourceType = source.getObjectType().ordinal();
|
||||
this.sourceID = source.getObjectUUID();
|
||||
} else {
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
}
|
||||
if (target != null) {
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
this.mana = target.getMana();
|
||||
this.stamina = target.getStamina();
|
||||
} else {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.mana = 0f;
|
||||
this.stamina = 0f;
|
||||
}
|
||||
this.health = -50f;
|
||||
this.healthMod = 0f;
|
||||
this.manaMod = 0f;
|
||||
this.staminaMod = 0f;
|
||||
this.unknown02 = 0;
|
||||
this.unknownID = effectID;
|
||||
this.trains = trains;
|
||||
this.powerID = powerID;
|
||||
this.powerName = powerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ModifyHealthKillMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.POWERACTIONDDDIE, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.trains);
|
||||
writer.putInt(this.unknownID);
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
writer.putInt(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.unknown04);
|
||||
writer.putInt(this.unknown05);
|
||||
writer.put(this.unknownByte);
|
||||
writer.putInt(this.powerID);
|
||||
writer.putString(this.powerName);
|
||||
writer.putFloat(this.health);
|
||||
writer.putFloat(this.healthMod);
|
||||
writer.putFloat(this.mana);
|
||||
writer.putFloat(this.manaMod);
|
||||
writer.putFloat(this.stamina);
|
||||
writer.putFloat(this.staminaMod);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.trains = reader.getInt();
|
||||
this.unknownID = reader.getInt();
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.unknown04 = reader.getInt();
|
||||
this.unknown05 = reader.getInt();
|
||||
this.unknownByte = reader.get();
|
||||
this.powerID = reader.getInt();
|
||||
this.powerName = reader.getString();
|
||||
this.health = reader.getFloat();
|
||||
this.healthMod = reader.getFloat();
|
||||
this.mana = reader.getFloat();
|
||||
this.manaMod = reader.getFloat();
|
||||
this.stamina = reader.getFloat();
|
||||
this.staminaMod = reader.getFloat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceType
|
||||
*/
|
||||
public int getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceID
|
||||
*/
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetType
|
||||
*/
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public float getHealthMod() {
|
||||
return healthMod;
|
||||
}
|
||||
|
||||
public float getManaMod() {
|
||||
return manaMod;
|
||||
}
|
||||
|
||||
public float getStaminaMod() {
|
||||
return manaMod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetID
|
||||
*/
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.Building;
|
||||
|
||||
public class ModifyHealthMsg extends ClientNetMsg {
|
||||
|
||||
private int trains;
|
||||
private int unknownID; //effectID
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private int omitFromChat = 0; //1 heal, 0 hurt?
|
||||
private int unknown03 = 0; //0=normalCast, 1to4=powerFailed, 5=targetIsImmune, 6=targetResisted
|
||||
private int unknown04 = -1;
|
||||
private int unknown05 = 0;
|
||||
private byte unknownByte = (byte) 0; //0
|
||||
private int powerID;
|
||||
private String powerName;
|
||||
private float health;
|
||||
private float healthMod;
|
||||
private float mana;
|
||||
private float manaMod;
|
||||
private float stamina;
|
||||
private float staminaMod;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ModifyHealthMsg(AbstractCharacter source, Building target, float healthMod, float manaMod, float staminaMod, int powerID, String powerName, int trains, int effectID) {
|
||||
super(Protocol.POWERACTIONDD);
|
||||
if (source != null) {
|
||||
this.sourceType = source.getObjectType().ordinal();
|
||||
this.sourceID = source.getObjectUUID();
|
||||
} else {
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
}
|
||||
if (target != null) {
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
this.health = target.getCurrentHitpoints();
|
||||
this.healthMod = healthMod;
|
||||
this.mana = 0;
|
||||
this.manaMod = 0;
|
||||
this.stamina = 0;
|
||||
this.staminaMod = 0;
|
||||
} else {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.health = 0;
|
||||
this.healthMod = 0;
|
||||
this.mana = 0;
|
||||
this.manaMod = 0;
|
||||
this.stamina = 0;
|
||||
this.staminaMod = 0;
|
||||
}
|
||||
this.unknownID = effectID;
|
||||
this.trains = trains;
|
||||
this.powerID = powerID;
|
||||
this.powerName = powerName;
|
||||
|
||||
this.omitFromChat = 0;
|
||||
}
|
||||
|
||||
public ModifyHealthMsg(AbstractCharacter source, AbstractCharacter target, float healthMod, float manaMod, float staminaMod, int powerID, String powerName, int trains, int effectID) {
|
||||
super(Protocol.POWERACTIONDD);
|
||||
if (source != null) {
|
||||
this.sourceType = source.getObjectType().ordinal();
|
||||
this.sourceID = source.getObjectUUID();
|
||||
} else {
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
}
|
||||
if (target != null) {
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
this.health = target.getCurrentHitpoints();
|
||||
this.healthMod = healthMod;
|
||||
this.mana = target.getMana();
|
||||
this.manaMod = manaMod;
|
||||
this.stamina = target.getStamina();
|
||||
this.staminaMod = staminaMod;
|
||||
} else {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.health = 0;
|
||||
this.healthMod = 0;
|
||||
this.mana = 0;
|
||||
this.manaMod = 0;
|
||||
this.stamina = 0;
|
||||
this.staminaMod = 0;
|
||||
}
|
||||
this.unknownID = effectID;
|
||||
this.trains = trains;
|
||||
this.powerID = powerID;
|
||||
this.powerName = powerName;
|
||||
|
||||
this.omitFromChat = 0;
|
||||
}
|
||||
|
||||
//called for kills
|
||||
public ModifyHealthMsg(AbstractCharacter source, AbstractCharacter target, int powerID, String powerName, int trains, int effectID) {
|
||||
super(Protocol.POWERACTIONDD);
|
||||
if (source != null) {
|
||||
this.sourceType = source.getObjectType().ordinal();
|
||||
this.sourceID = source.getObjectUUID();
|
||||
} else {
|
||||
this.sourceType = 0;
|
||||
this.sourceID = 0;
|
||||
}
|
||||
if (target != null) {
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
this.mana = target.getMana();
|
||||
this.stamina = target.getStamina();
|
||||
} else {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.mana = 0f;
|
||||
this.stamina = 0f;
|
||||
}
|
||||
this.health = -50f;
|
||||
this.healthMod = 0f;
|
||||
this.manaMod = 0f;
|
||||
this.staminaMod = 0f;
|
||||
this.omitFromChat = 0;
|
||||
this.unknownID = effectID;
|
||||
this.trains = trains;
|
||||
this.powerID = powerID;
|
||||
this.powerName = powerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ModifyHealthMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.POWERACTIONDD, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.trains);
|
||||
writer.putInt(this.unknownID);
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
writer.putInt(this.omitFromChat);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.unknown04);
|
||||
writer.putInt(this.unknown05);
|
||||
writer.put(this.unknownByte);
|
||||
writer.putInt(this.powerID);
|
||||
writer.putString(this.powerName);
|
||||
writer.putFloat(this.health);
|
||||
writer.putFloat(this.healthMod);
|
||||
writer.putFloat(this.mana);
|
||||
writer.putFloat(this.manaMod);
|
||||
writer.putFloat(this.stamina);
|
||||
writer.putFloat(this.staminaMod);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.trains = reader.getInt();
|
||||
this.unknownID = reader.getInt();
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
this.omitFromChat = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.unknown04 = reader.getInt();
|
||||
this.unknown05 = reader.getInt();
|
||||
this.unknownByte = reader.get();
|
||||
this.powerID = reader.getInt();
|
||||
this.powerName = reader.getString();
|
||||
this.health = reader.getFloat();
|
||||
this.healthMod = reader.getFloat();
|
||||
this.mana = reader.getFloat();
|
||||
this.manaMod = reader.getFloat();
|
||||
this.stamina = reader.getFloat();
|
||||
this.staminaMod = reader.getFloat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceType
|
||||
*/
|
||||
public int getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sourceID
|
||||
*/
|
||||
public int getSourceID() {
|
||||
return sourceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetType
|
||||
*/
|
||||
public int getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public float getHealthMod() {
|
||||
return healthMod;
|
||||
}
|
||||
|
||||
public float getManaMod() {
|
||||
return manaMod;
|
||||
}
|
||||
|
||||
public float getStaminaMod() {
|
||||
return manaMod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetID
|
||||
*/
|
||||
public int getTargetID() {
|
||||
return targetID;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public void setOmitFromChat(int value) {
|
||||
this.omitFromChat = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class ModifyStatMsg extends ClientNetMsg {
|
||||
|
||||
private int amount;
|
||||
private int type;
|
||||
private int unknown01;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ModifyStatMsg() {
|
||||
super(Protocol.RAISEATTR);
|
||||
}
|
||||
|
||||
public ModifyStatMsg(int amount, int type, int unknown01) {
|
||||
super(Protocol.RAISEATTR);
|
||||
this.amount = amount;
|
||||
this.type = type;
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ModifyStatMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.RAISEATTR, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.amount);
|
||||
writer.putInt(this.type);
|
||||
writer.putInt(this.unknown01);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.amount = reader.getInt();
|
||||
this.type = reader.getInt();
|
||||
this.unknown01 = reader.getInt();
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public void setAmount(int value) {
|
||||
this.amount = value;
|
||||
}
|
||||
|
||||
public void setType(int value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractCharacter;
|
||||
|
||||
public class MoveCorrectionMsg extends ClientNetMsg {
|
||||
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private float startLat;
|
||||
private float startAlt;
|
||||
private float startLon;
|
||||
private float endLat;
|
||||
private float endAlt;
|
||||
private float endLon;
|
||||
private int unknown01 = 2;
|
||||
private int unknown02 = 0;
|
||||
private int unknown03 = 0;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public MoveCorrectionMsg(AbstractCharacter ac, boolean teleport) {
|
||||
super(Protocol.MOVECORRECTION);
|
||||
this.sourceType = ac.getObjectType().ordinal();
|
||||
this.sourceID = ac.getObjectUUID();
|
||||
this.startLat = ac.getLoc().x;
|
||||
this.startAlt = ac.getLoc().y;
|
||||
this.startLon = ac.getLoc().z;
|
||||
if (teleport){
|
||||
this.endLat = ac.getLoc().x;
|
||||
this.endAlt = ac.getLoc().y;
|
||||
this.endLon = ac.getLoc().z;
|
||||
}else{
|
||||
if (ac.isMoving()){
|
||||
this.endLat = ac.getEndLoc().x;
|
||||
this.endAlt = ac.getEndLoc().y;
|
||||
this.endLon = ac.getEndLoc().z;
|
||||
}else{
|
||||
this.endLat = ac.getLoc().x;
|
||||
this.endAlt = ac.getLoc().y;
|
||||
this.endLon = ac.getLoc().z;
|
||||
}
|
||||
}
|
||||
|
||||
this.unknown01 = Float.floatToIntBits(ac.getAltitude());
|
||||
this.unknown02 =Float.floatToIntBits(ac.getAltitude());
|
||||
this.unknown03 = Float.floatToIntBits(ac.getAltitude());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 MoveCorrectionMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.MOVECORRECTION, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
|
||||
writer.putFloat(this.startLat);
|
||||
writer.putFloat(this.startAlt);
|
||||
writer.putFloat(this.startLon);
|
||||
|
||||
writer.putFloat(this.endLat);
|
||||
writer.putFloat(this.endAlt);
|
||||
writer.putFloat(this.endLon);
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
|
||||
this.startLat = reader.getFloat();
|
||||
this.startAlt = reader.getFloat();
|
||||
this.startLon = reader.getFloat();
|
||||
|
||||
this.endLat = reader.getFloat();
|
||||
this.endAlt = reader.getFloat();
|
||||
this.endLon = reader.getFloat();
|
||||
|
||||
this.unknown01 = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
public int getSourceType() {
|
||||
return this.sourceType;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return this.sourceID;
|
||||
}
|
||||
|
||||
public float getStartLat() {
|
||||
return this.startLat;
|
||||
}
|
||||
|
||||
public float getStartLon() {
|
||||
return this.startLon;
|
||||
}
|
||||
|
||||
public float getStartAlt() {
|
||||
return this.startAlt;
|
||||
}
|
||||
|
||||
public float getEndLat() {
|
||||
return this.endLat;
|
||||
}
|
||||
|
||||
public float getEndLon() {
|
||||
return this.endLon;
|
||||
}
|
||||
|
||||
public float getEndAlt() {
|
||||
return this.endAlt;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setStartLat(float value) {
|
||||
this.startLat = value;
|
||||
}
|
||||
|
||||
public void setStartLon(float value) {
|
||||
this.startLon = value;
|
||||
}
|
||||
|
||||
public void setStartAlt(float value) {
|
||||
this.startAlt = value;
|
||||
}
|
||||
|
||||
public void setStartCoord(Vector3fImmutable value) {
|
||||
this.startLat = value.x;
|
||||
this.startAlt = value.y;
|
||||
this.startLon = value.z;
|
||||
}
|
||||
|
||||
public void setEndLat(float value) {
|
||||
this.endLat = value;
|
||||
}
|
||||
|
||||
public void setEndLon(float value) {
|
||||
this.endLon = value;
|
||||
}
|
||||
|
||||
public void setEndAlt(float value) {
|
||||
this.endAlt = value;
|
||||
}
|
||||
|
||||
public void setEndCoord(Vector3fImmutable value) {
|
||||
this.endLat = value.x;
|
||||
this.endAlt = value.y;
|
||||
this.endLon = value.z;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
|
||||
public void setPlayer(AbstractCharacter ac) {
|
||||
this.sourceType = 85;
|
||||
this.sourceID = ac.getObjectUUID();
|
||||
this.setStartCoord(ac.getLoc());
|
||||
this.setEndCoord(ac.getEndLoc());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.Building;
|
||||
|
||||
public class MoveToPointMsg extends ClientNetMsg {
|
||||
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private float startLat;
|
||||
private float startLon;
|
||||
private float startAlt;
|
||||
private float endLat;
|
||||
private float endLon;
|
||||
private float endAlt;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
private int inBuilding; // 0=true, -1=false 0/1/2 = floor you are on
|
||||
private int unknown01;
|
||||
private byte unknown02;
|
||||
private byte unknown03;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public MoveToPointMsg() {
|
||||
super(Protocol.MOVETOPOINT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MoveToPointMsg(MoveToPointMsg msg) {
|
||||
super(Protocol.MOVETOPOINT);
|
||||
this.sourceType = msg.sourceType;
|
||||
this.sourceID = msg.sourceID;
|
||||
this.startLat = msg.startLat;
|
||||
this.startLon = msg.startLon;
|
||||
this.startAlt = msg.startAlt;
|
||||
this.endLat = msg.endLat;
|
||||
this.endLon = msg.endLon;
|
||||
this.endAlt = msg.endAlt;
|
||||
this.targetType = msg.targetType;
|
||||
this.targetID = msg.targetID;
|
||||
this.inBuilding = msg.inBuilding;
|
||||
this.unknown01 = msg.unknown01;
|
||||
this.unknown02 = msg.unknown02;
|
||||
this.unknown03 = msg.unknown03;
|
||||
}
|
||||
//Moving Furniture out of building to unload properly. //for outside regions only
|
||||
public MoveToPointMsg(Building building) {
|
||||
super(Protocol.MOVETOPOINT);
|
||||
this.sourceType = building.getObjectType().ordinal();
|
||||
this.sourceID = building.getObjectUUID();
|
||||
this.startLat = building.getLoc().x;
|
||||
this.startLon = building.getLoc().z;
|
||||
this.startAlt = building.getLoc().y;
|
||||
this.endLat = building.getLoc().x;
|
||||
this.endLon = building.getLoc().z;
|
||||
this.endAlt = building.getLoc().y;
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.inBuilding = -1;
|
||||
this.unknown01 = -1;
|
||||
this.unknown02 = 0;
|
||||
this.unknown03 = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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 MoveToPointMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.MOVETOPOINT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
|
||||
writer.putFloat(this.startLat);
|
||||
writer.putFloat(this.startAlt);
|
||||
writer.putFloat(this.startLon);
|
||||
|
||||
writer.putFloat(this.endLat);
|
||||
writer.putFloat(this.endAlt);
|
||||
writer.putFloat(this.endLon);
|
||||
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
|
||||
writer.putInt(this.inBuilding);
|
||||
writer.putInt(this.unknown01);
|
||||
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
|
||||
this.startLat = reader.getFloat();
|
||||
this.startAlt = reader.getFloat();
|
||||
this.startLon = reader.getFloat();
|
||||
|
||||
this.endLat = reader.getFloat();
|
||||
this.endAlt = reader.getFloat();
|
||||
this.endLon = reader.getFloat();
|
||||
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
|
||||
this.inBuilding = reader.getInt();
|
||||
this.unknown01 = reader.getInt();
|
||||
|
||||
this.unknown02 = reader.get();
|
||||
this.unknown03 = reader.get();
|
||||
}
|
||||
|
||||
public int getSourceType() {
|
||||
return this.sourceType;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return this.sourceID;
|
||||
}
|
||||
|
||||
public float getStartLat() {
|
||||
return this.startLat;
|
||||
}
|
||||
|
||||
public float getStartLon() {
|
||||
return this.startLon;
|
||||
}
|
||||
|
||||
public float getStartAlt() {
|
||||
return this.startAlt;
|
||||
}
|
||||
|
||||
public float getEndLat() {
|
||||
return this.endLat;
|
||||
}
|
||||
|
||||
public float getEndLon() {
|
||||
return this.endLon;
|
||||
}
|
||||
|
||||
public float getEndAlt() {
|
||||
return this.endAlt;
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return this.targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return this.targetID;
|
||||
}
|
||||
|
||||
public int getInBuilding() {
|
||||
return this.inBuilding;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setStartLat(float value) {
|
||||
this.startLat = value;
|
||||
}
|
||||
|
||||
public void setStartLon(float value) {
|
||||
this.startLon = value;
|
||||
}
|
||||
|
||||
public void setStartAlt(float value) {
|
||||
this.startAlt = value;
|
||||
}
|
||||
|
||||
public void setStartCoord(Vector3fImmutable value) {
|
||||
this.startLat = value.x;
|
||||
this.startAlt = value.y;
|
||||
this.startLon = value.z;
|
||||
}
|
||||
|
||||
public void setEndLat(float value) {
|
||||
this.endLat = value;
|
||||
}
|
||||
|
||||
public void setEndLon(float value) {
|
||||
this.endLon = value;
|
||||
}
|
||||
|
||||
public void setEndAlt(float value) {
|
||||
this.endAlt = value;
|
||||
}
|
||||
|
||||
public void setEndCoord(Vector3fImmutable value) {
|
||||
this.endLat = value.x;
|
||||
this.endAlt = value.y;
|
||||
this.endLon = value.z;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
|
||||
public void clearTarget() {
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
}
|
||||
|
||||
public void setInBuilding(int value) {
|
||||
this.inBuilding = value;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public void setPlayer(AbstractCharacter ac) {
|
||||
this.sourceType = ac.getObjectType().ordinal();
|
||||
this.sourceID = ac.getObjectUUID();
|
||||
this.setStartCoord(ac.getLoc());
|
||||
this.setEndCoord(ac.getEndLoc());
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.inBuilding = ac.getInBuilding();
|
||||
this.unknown01 = ac.getInFloorID();
|
||||
|
||||
}
|
||||
|
||||
public void setTarget(AbstractCharacter ac, Building target){
|
||||
if (target == null){
|
||||
this.setStartCoord(ac.getLoc());
|
||||
this.setEndCoord(ac.getEndLoc());
|
||||
this.targetType = 0;
|
||||
this.targetID = 0;
|
||||
this.inBuilding = -1;
|
||||
this.unknown01 = -1;
|
||||
}else{
|
||||
Vector3fImmutable convertLocStart = ZoneManager.convertWorldToLocal(target, ac.getLoc());
|
||||
Vector3fImmutable convertLocEnd = convertLocStart;
|
||||
if (ac.isMoving())
|
||||
convertLocEnd = ZoneManager.convertWorldToLocal(target, ac.getEndLoc());
|
||||
|
||||
this.setStartCoord(convertLocStart);
|
||||
this.setEndCoord(convertLocEnd);
|
||||
this.targetType = GameObjectType.Building.ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
this.inBuilding = ac.getInBuilding();
|
||||
this.unknown01 = ac.getInFloorID();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return unknown03;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return unknown02;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* Use item
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class ObjectActionMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private int unknown02;
|
||||
private ArrayList<Long> targetCompID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public ObjectActionMsg(int unknown01, int unknown02, ArrayList<Long> targetCompID) {
|
||||
super(Protocol.OBJECTACTION);
|
||||
this.unknown01 = unknown01;
|
||||
this.unknown02 = unknown02;
|
||||
this.targetCompID = targetCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ObjectActionMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.OBJECTACTION, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
if (targetCompID == null)
|
||||
targetCompID = new ArrayList<>();
|
||||
unknown01 = reader.getInt();
|
||||
unknown02 = reader.getInt();
|
||||
for (int i=0; i<unknown01; i++)
|
||||
targetCompID.add(reader.getLong());
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putInt(unknown02);
|
||||
for (int i=0; i<unknown01; i++)
|
||||
writer.putLong(targetCompID.get(i));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 targetCompID
|
||||
*/
|
||||
public ArrayList<Long> getTargetCompID() {
|
||||
return targetCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetCompID the targetCompID to set
|
||||
*/
|
||||
public void setTargetCompID(ArrayList<Long> targetCompID) {
|
||||
this.targetCompID = targetCompID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,931 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class OpenFriendsCondemnListMsg extends ClientNetMsg {
|
||||
|
||||
private int messageType;
|
||||
private ArrayList<Integer> characterList;
|
||||
private int buildingType;
|
||||
private int buildingID;
|
||||
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private int guildID;
|
||||
private int inviteType;
|
||||
private ConcurrentHashMap<Integer,BuildingFriends>friends;
|
||||
private int removeFriendType;
|
||||
private int removeFriendID;
|
||||
private boolean reverseKOS; //TODO Rename this for to fit ReverseKOS/Activate/deactive Condemned.
|
||||
private ConcurrentHashMap<Integer,Condemned> guildCondemned;
|
||||
private int nationID;
|
||||
|
||||
public OpenFriendsCondemnListMsg(int messageType,ConcurrentHashMap<Integer,BuildingFriends>friends) {
|
||||
super(Protocol.OPENFRIENDSCONDEMNLIST);
|
||||
this.messageType = messageType;
|
||||
this.friends = friends;
|
||||
|
||||
}
|
||||
|
||||
public OpenFriendsCondemnListMsg(int messageType,ConcurrentHashMap<Integer,Condemned> guildCondemned ,boolean reverse) {
|
||||
super(Protocol.OPENFRIENDSCONDEMNLIST);
|
||||
this.messageType = messageType;
|
||||
this.guildCondemned = guildCondemned;
|
||||
this.reverseKOS = reverse;
|
||||
}
|
||||
|
||||
// clone
|
||||
|
||||
public OpenFriendsCondemnListMsg(OpenFriendsCondemnListMsg openFriendsCondemnListMsg) {
|
||||
super(Protocol.OPENFRIENDSCONDEMNLIST);
|
||||
this.messageType = openFriendsCondemnListMsg.messageType;
|
||||
this.guildCondemned = openFriendsCondemnListMsg.guildCondemned;
|
||||
this.reverseKOS = openFriendsCondemnListMsg.reverseKOS;
|
||||
this.playerType = openFriendsCondemnListMsg.playerType;
|
||||
this.playerID = openFriendsCondemnListMsg.playerID;
|
||||
this.inviteType = openFriendsCondemnListMsg.inviteType;
|
||||
this.removeFriendID = openFriendsCondemnListMsg.removeFriendID;
|
||||
this.removeFriendType = openFriendsCondemnListMsg.removeFriendType;
|
||||
this.reverseKOS = openFriendsCondemnListMsg.reverseKOS;
|
||||
this.nationID = openFriendsCondemnListMsg.nationID;
|
||||
this.buildingType = openFriendsCondemnListMsg.buildingType;
|
||||
this.buildingID = openFriendsCondemnListMsg.buildingID;
|
||||
this.friends = openFriendsCondemnListMsg.friends;
|
||||
this.characterList = openFriendsCondemnListMsg.characterList;
|
||||
}
|
||||
|
||||
public void configure() {
|
||||
|
||||
// Pre-Cache all players and guild targets
|
||||
|
||||
if (characterList == null)
|
||||
return;
|
||||
|
||||
for (Integer uuid : characterList) {
|
||||
|
||||
PlayerCharacter player = (PlayerCharacter) DbManager.getObject(GameObjectType.PlayerCharacter, uuid);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
Guild guild = player.getGuild();
|
||||
|
||||
if (guild == null)
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void configureHeraldry(PlayerCharacter player){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 OpenFriendsCondemnListMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.OPENFRIENDSCONDEMNLIST, origin, reader); // openFriendsCondemnList =1239809615
|
||||
characterList = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.messageType);
|
||||
|
||||
if (this.messageType == 2){
|
||||
this.showHeraldy(writer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 4){
|
||||
this.writeAddHealrdy(writer);
|
||||
return;
|
||||
}
|
||||
if (this.messageType == 26){
|
||||
showBuildingFriends(writer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 12){
|
||||
this.showCondemnList(writer);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 15){
|
||||
this.removeCondemned(writer);
|
||||
return;
|
||||
}
|
||||
if (this.messageType == 17){
|
||||
this.handleActivateCondemned(writer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.characterList.size());
|
||||
writer.putInt(this.characterList.size());
|
||||
|
||||
for (Integer uuid : characterList) {
|
||||
|
||||
PlayerCharacter player = (PlayerCharacter) DbManager.getObject(GameObjectType.PlayerCharacter, uuid);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(1);
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(player.getObjectUUID());
|
||||
Guild guild = player.getGuild();
|
||||
Guild nation = null;
|
||||
|
||||
if (guild != null) {
|
||||
writer.putInt(guild.getObjectType().ordinal());
|
||||
writer.putInt(guild.getObjectUUID());
|
||||
nation = guild.getNation();
|
||||
if (nation != null) {
|
||||
writer.putInt(nation.getObjectType().ordinal());
|
||||
writer.putInt(nation.getObjectUUID());
|
||||
} else {
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
} else {
|
||||
for (int i=0;i<4;i++)
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.putShort((short)0);
|
||||
writer.put((byte)0);
|
||||
writer.putString(player.getFirstName());
|
||||
|
||||
if (guild != null) {
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(),writer);
|
||||
} else {
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
if (nation != null) {
|
||||
GuildTag._serializeForDisplay(nation.getGuildTag(),writer);
|
||||
} else {
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
if (guild != null)
|
||||
writer.putString(guild.getName());
|
||||
else
|
||||
writer.putString("[No Guild]");
|
||||
if (nation != null)
|
||||
writer.putString(nation.getName());
|
||||
else
|
||||
writer.putString("[No Nation]");
|
||||
writer.putInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void readHandleToItem(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.getInt(); //object Type;
|
||||
reader.getInt(); //objectID;
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
private void writeHandleToItem(ByteBufferWriter writer){
|
||||
}
|
||||
|
||||
private void removeCondemned(ByteBufferWriter writer){
|
||||
writer.putInt(0);
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(removeFriendType);
|
||||
writer.putInt(removeFriendID);
|
||||
writer.putInt(buildingType);
|
||||
writer.putInt(buildingID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putShort((short) 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.messageType = reader.getInt(); //25 on open of friends list // 28 friends list // 11 open condemned list // 14 Open condemned selection of (indivual, guild, nation)
|
||||
|
||||
if (this.messageType == 1){
|
||||
this.viewHealrdy(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 4){
|
||||
this.readAddHealrdy(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 6){
|
||||
this.readRemoveHeraldry(reader);
|
||||
return;
|
||||
}
|
||||
if (this.messageType == 11){
|
||||
this.ackBuildingFriends(reader);
|
||||
reader.get();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 14){
|
||||
this.addGuildCondemn(reader);
|
||||
return;
|
||||
}
|
||||
if (this.messageType == 15){
|
||||
this.removeFriendList(reader);
|
||||
reader.get();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 17){
|
||||
this.handleActivateCondemned(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 18){
|
||||
this.handleCondemnErrant(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (this.messageType == 19){
|
||||
this.handleKOS(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.messageType == 23){
|
||||
this.readHandleToItem(reader);
|
||||
return;
|
||||
}
|
||||
if (this.messageType == 28){
|
||||
addFriendsList(reader);
|
||||
return;
|
||||
}
|
||||
if (this.messageType == 30){
|
||||
removeFriendList(reader);
|
||||
return;
|
||||
}
|
||||
if (this.messageType == 25){
|
||||
ackBuildingFriends(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
reader.getInt();
|
||||
int size = reader.getInt();
|
||||
reader.getInt(); //size again
|
||||
for (int i=0;i<size;i++) {
|
||||
reader.get();
|
||||
reader.getInt(); //0
|
||||
reader.getInt(); //0
|
||||
reader.getInt(); //1
|
||||
reader.getInt(); //Player Type
|
||||
int ID = reader.getInt(); //Player ID
|
||||
reader.getLong(); //Guild ID
|
||||
reader.getLong(); //Nation ID
|
||||
reader.getShort();
|
||||
reader.get();
|
||||
reader.getString(); //name
|
||||
for (int j=0;j<10;j++)////////The problem is in here its stops here!!!!
|
||||
reader.getInt(); //Guild and Nation tags
|
||||
reader.getString(); //guild name
|
||||
reader.getString(); //nation name
|
||||
reader.getInt();
|
||||
this.characterList.add(ID);
|
||||
}
|
||||
}
|
||||
|
||||
private void readRemoveHeraldry(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.playerType = reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
private void handleActivateCondemned(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
this.removeFriendType=reader.getInt();
|
||||
this.removeFriendID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
this.reverseKOS = reader.get() == 1? true:false;
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
}
|
||||
|
||||
private void handleCondemnErrant(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
this.removeFriendType=reader.getInt();
|
||||
this.removeFriendID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
this.reverseKOS = reader.get() == 1? true:false;
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
}
|
||||
private void handleActivateCondemned(ByteBufferWriter writer){
|
||||
writer.putInt(0);
|
||||
writer.putInt(removeFriendType);
|
||||
writer.putInt(removeFriendID);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(buildingID);
|
||||
writer.put(reverseKOS ? (byte)1 : (byte)0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
}
|
||||
@Override
|
||||
protected int getPowerOfTwoBufferSize() {
|
||||
// Larger size for historically larger opcodes
|
||||
return 12;
|
||||
}
|
||||
|
||||
private void addGuildCondemn(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
this.inviteType = reader.getInt();
|
||||
reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.guildID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.nationID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
reader.getLong();
|
||||
reader.getShort();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void addFriendsList(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
this.inviteType = reader.getInt(); //7 individual, 8 guild, 9 guild IC
|
||||
this.playerType = reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
reader.getInt();
|
||||
this.guildID = reader.getInt();
|
||||
|
||||
reader.getLong(); //Nation, do we need this?
|
||||
reader.getLong();
|
||||
reader.getLong();
|
||||
reader.getLong();
|
||||
reader.getInt();
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
|
||||
}
|
||||
|
||||
private void handleKOS(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
reader.get();
|
||||
byte reverse = reader.get();
|
||||
this.reverseKOS = reverse == 1 ? true : false;
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
private void removeFriendList(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
this.playerType = reader.getInt();
|
||||
this.playerID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.removeFriendType = reader.getInt();
|
||||
this.removeFriendID = reader.getInt();
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getRemoveFriendID() {
|
||||
return removeFriendID;
|
||||
}
|
||||
|
||||
private void showCondemnList(ByteBufferWriter writer){
|
||||
String name = "";
|
||||
PlayerCharacter pc = null;
|
||||
Guild guild = null;
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
writer.put(reverseKOS ? (byte)1 : 0); //Reverse?
|
||||
|
||||
int listSize = this.guildCondemned.size();
|
||||
writer.putInt(listSize);
|
||||
writer.putInt(listSize);
|
||||
|
||||
for (Condemned condemned:this.guildCondemned.values()){
|
||||
|
||||
|
||||
writer.put((byte)1);
|
||||
|
||||
switch (condemned.getFriendType()){
|
||||
case 2:
|
||||
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getObject(engine.Enum.GameObjectType.PlayerCharacter, condemned.getPlayerUID());
|
||||
|
||||
|
||||
guild = playerCharacter.getGuild();
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(condemned.getPlayerUID());
|
||||
writer.putInt(condemned.getFriendType());
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(condemned.getPlayerUID());
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
if (guild != null)
|
||||
writer.putInt(guild.getObjectUUID());
|
||||
else
|
||||
writer.putInt(0);
|
||||
writer.put(condemned.isActive() ?(byte)1:(byte)0);
|
||||
writer.put((byte)0);
|
||||
writer.put(condemned.isActive() ?(byte)1:(byte)0);
|
||||
|
||||
if (playerCharacter != null)
|
||||
writer.putString(playerCharacter.getFirstName());
|
||||
else
|
||||
writer.putInt(0);
|
||||
GuildTag._serializeForDisplay(GuildTag.ERRANT,writer);
|
||||
if (guild != null)
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(),writer);
|
||||
else{
|
||||
GuildTag._serializeForDisplay(GuildTag.ERRANT,writer);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
guild = Guild.getGuild(condemned.getGuildUID());
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(condemned.getGuildUID());
|
||||
writer.putInt(condemned.getFriendType());
|
||||
writer.putLong(0);
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(condemned.getGuildUID());
|
||||
writer.putLong(0);
|
||||
writer.put((byte)0);
|
||||
writer.put(condemned.isActive() ?(byte)1:(byte)0);
|
||||
writer.put((byte)0);
|
||||
if (guild != null)
|
||||
writer.putString(guild.getName());
|
||||
else
|
||||
writer.putInt(0);
|
||||
|
||||
if (guild != null)
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(),writer);
|
||||
else
|
||||
GuildTag._serializeForDisplay(GuildTag.ERRANT,writer);
|
||||
GuildTag._serializeForDisplay(GuildTag.ERRANT,writer);
|
||||
break;
|
||||
case 5:
|
||||
guild = Guild.getGuild(condemned.getGuildUID());
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(condemned.getGuildUID());
|
||||
writer.putInt(condemned.getFriendType());
|
||||
writer.putLong(0);
|
||||
writer.putLong(0);
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(condemned.getGuildUID());
|
||||
writer.put((byte)0);
|
||||
writer.put((byte)0);
|
||||
writer.put(condemned.isActive() ?(byte)1:(byte)0);
|
||||
if (guild != null)
|
||||
writer.putString(guild.getName());
|
||||
else
|
||||
writer.putInt(0);
|
||||
GuildTag._serializeForDisplay(GuildTag.ERRANT,writer);
|
||||
if (guild != null)
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(),writer);
|
||||
else{
|
||||
GuildTag._serializeForDisplay(GuildTag.ERRANT,writer);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void showBuildingFriends(ByteBufferWriter writer){
|
||||
|
||||
|
||||
String name = "";
|
||||
PlayerCharacter pc = null;
|
||||
Guild guild = null;
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
int listSize = this.friends.size();
|
||||
writer.putInt(listSize);
|
||||
writer.putInt(listSize);
|
||||
|
||||
for (BuildingFriends friend:this.friends.values()){
|
||||
pc = PlayerCharacter.getFromCache(friend.getPlayerUID());
|
||||
guild = Guild.getGuild(friend.getGuildUID());
|
||||
if (friend.getFriendType() == 7){
|
||||
if (pc != null)
|
||||
name = pc.getCombinedName();
|
||||
}
|
||||
|
||||
else if (guild != null)
|
||||
name = guild.getName();
|
||||
writer.put((byte)1);
|
||||
if (friend.getFriendType() == 7){
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(friend.getPlayerUID());
|
||||
}else{
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(friend.getGuildUID());
|
||||
}
|
||||
writer.putInt(friend.getFriendType());
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
if (guild != null) {
|
||||
writer.putInt(guild.getObjectType().ordinal());
|
||||
writer.putInt(guild.getObjectUUID());
|
||||
|
||||
if (!guild.getNation().isErrant()) {
|
||||
writer.putInt(guild.getNation().getObjectType().ordinal());
|
||||
writer.putInt(guild.getNation().getObjectUUID());
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
}else{
|
||||
writer.putLong(0);
|
||||
writer.putLong(0);
|
||||
}
|
||||
writer.putShort((short)0);
|
||||
writer.put((byte)0);
|
||||
writer.putString(name);
|
||||
if (guild != null)
|
||||
GuildTag._serializeForDisplay(guild.getGuildTag(),writer);
|
||||
else{
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ackBuildingFriends(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingType = reader.getInt();
|
||||
this.buildingID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
|
||||
}
|
||||
|
||||
private void viewHealrdy(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
private void showHeraldy(ByteBufferWriter writer){
|
||||
|
||||
PlayerCharacter player = ((ClientConnection)this.getOrigin()).getPlayerCharacter();
|
||||
writer.putInt(0); //error pop up msg
|
||||
writer.putInt(0);
|
||||
|
||||
// writer.putInt(0);
|
||||
|
||||
HashMap<Integer,Integer> heraldryMap = Heraldry.HeraldyMap.get(player.getObjectUUID());
|
||||
|
||||
//send empty list if no heraldry
|
||||
if (heraldryMap == null || heraldryMap.isEmpty()){
|
||||
writer.putInt(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
writer.putInt(heraldryMap.size());
|
||||
|
||||
for (int characterID : heraldryMap.keySet()){
|
||||
AbstractCharacter heraldryCharacter = null;
|
||||
int characterType = heraldryMap.get(characterID);
|
||||
if (characterType == GameObjectType.PlayerCharacter.ordinal())
|
||||
heraldryCharacter = PlayerCharacter.getFromCache(characterID);
|
||||
else if (characterType == GameObjectType.NPC.ordinal())
|
||||
heraldryCharacter = NPC.getFromCache(characterID);
|
||||
else if (characterType == GameObjectType.Mob.ordinal())
|
||||
heraldryCharacter = Mob.getFromCache(characterID);
|
||||
|
||||
if (heraldryCharacter == null)
|
||||
this.showNullHeraldryCharacter(writer);
|
||||
else{
|
||||
writer.put((byte)1);
|
||||
writer.putInt(heraldryCharacter.getObjectType().ordinal());
|
||||
writer.putInt(heraldryCharacter.getObjectUUID());
|
||||
|
||||
writer.putInt(9);
|
||||
writer.putInt(heraldryCharacter.getObjectType().ordinal());
|
||||
writer.putInt(heraldryCharacter.getObjectUUID());
|
||||
|
||||
if (heraldryCharacter.getGuild() != null) {
|
||||
writer.putInt(heraldryCharacter.getGuild().getObjectType().ordinal());
|
||||
writer.putInt(heraldryCharacter.getGuild().getObjectUUID());
|
||||
|
||||
if (!heraldryCharacter.getGuild().getNation().isErrant()) {
|
||||
writer.putInt(heraldryCharacter.getGuild().getNation().getObjectType().ordinal());
|
||||
writer.putInt(heraldryCharacter.getGuild().getNation().getObjectUUID());
|
||||
}else{
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
}else{
|
||||
writer.putLong(0);
|
||||
writer.putLong(0);
|
||||
}
|
||||
writer.putShort((short)0);
|
||||
writer.put((byte)0);
|
||||
writer.putString(heraldryCharacter.getName());
|
||||
if (heraldryCharacter.getGuild() != null)
|
||||
GuildTag._serializeForDisplay(heraldryCharacter.getGuild().getGuildTag(),writer);
|
||||
else{
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
if (heraldryCharacter.getGuild() == null){
|
||||
writer.putString("Errant");
|
||||
writer.putString("Errant");
|
||||
}
|
||||
else{
|
||||
writer.putString(heraldryCharacter.getGuild().getName());
|
||||
if (heraldryCharacter.getGuild().getNation() == null)
|
||||
writer.putString("Errant");
|
||||
else
|
||||
writer.putString(heraldryCharacter.getGuild().getNation().getName());
|
||||
}
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void readAddHealrdy(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.playerType = reader.getInt(); //player object type;
|
||||
this.playerID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
private void writeAddHealrdy(ByteBufferWriter writer){
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.playerType); //player object type;
|
||||
writer.putInt(this.playerID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
public int getMessageType() {
|
||||
return this.messageType;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getList() {
|
||||
return this.characterList;
|
||||
}
|
||||
|
||||
public void setMessageType(int value) {
|
||||
this.messageType = value;
|
||||
}
|
||||
|
||||
public void setList(ArrayList<Integer> value) {
|
||||
this.characterList = value;
|
||||
}
|
||||
|
||||
public void updateMsg(int messageType, ArrayList<Integer> list) {
|
||||
this.messageType = messageType;
|
||||
this.characterList = list;
|
||||
this.configure();
|
||||
}
|
||||
|
||||
public int getInviteType() {
|
||||
return inviteType;
|
||||
}
|
||||
|
||||
public int getPlayerType() {
|
||||
return playerType;
|
||||
}
|
||||
|
||||
public void setPlayerType(int playerType) {
|
||||
this.playerType = playerType;
|
||||
}
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
public int getGuildID() {
|
||||
return guildID;
|
||||
}
|
||||
|
||||
public int getNationID() {
|
||||
return nationID;
|
||||
}
|
||||
|
||||
public void setGuildID(int guildID) {
|
||||
this.guildID = guildID;
|
||||
}
|
||||
|
||||
public int getBuildingID() {
|
||||
return buildingID;
|
||||
}
|
||||
|
||||
public void setBuildingID(int buildingID) {
|
||||
this.buildingID = buildingID;
|
||||
}
|
||||
|
||||
public boolean isReverseKOS() {
|
||||
return reverseKOS;
|
||||
}
|
||||
|
||||
public void setReverseKOS(boolean reverseKOS) {
|
||||
this.reverseKOS = reverseKOS;
|
||||
}
|
||||
|
||||
|
||||
private void showNullHeraldryCharacter(ByteBufferWriter writer){
|
||||
writer.put((byte)1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(6);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
|
||||
writer.putLong(0);
|
||||
writer.putLong(0);
|
||||
writer.putShort((short)0);
|
||||
writer.put((byte)0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(16);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
/**
|
||||
* Open trade window
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class OpenTradeWindowMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01;
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public OpenTradeWindowMsg(int unknown01, AbstractGameObject player, AbstractGameObject target) {
|
||||
super(Protocol.INITIATETRADEHUDS);
|
||||
this.unknown01 = unknown01;
|
||||
this.playerType = player.getObjectType().ordinal();
|
||||
this.playerID = player.getObjectUUID();
|
||||
this.targetType = target.getObjectType().ordinal();
|
||||
this.targetID = target.getObjectUUID();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 OpenTradeWindowMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.INITIATETRADEHUDS, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
playerType = reader.getInt();
|
||||
playerID = reader.getInt();
|
||||
targetType = reader.getInt();
|
||||
targetID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putInt(targetType);
|
||||
writer.putInt(targetID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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,76 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
/**
|
||||
* Vault window opened
|
||||
* @author Eighty
|
||||
*/
|
||||
public class OpenVaultMsg extends ClientNetMsg {
|
||||
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public OpenVaultMsg(AbstractGameObject ago, AbstractGameObject target) {
|
||||
super(Protocol.OPENVAULT);
|
||||
this.playerType = ago.getObjectType().ordinal();
|
||||
this.playerID = ago.getObjectUUID();
|
||||
this.npcType = target.getObjectType().ordinal();
|
||||
this.npcID = target.getObjectUUID();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 OpenVaultMsg(AbstractConnection origin,
|
||||
ByteBufferReader reader) {
|
||||
super(Protocol.OPENVAULT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
playerType = reader.getInt();
|
||||
playerID = reader.getInt();
|
||||
npcType = reader.getInt();
|
||||
npcID = reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putInt(npcType);
|
||||
writer.putInt(npcID);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class OrderNPCMsg extends ClientNetMsg {
|
||||
|
||||
// 2 = manage this asset. 20 = manage entire city
|
||||
private int objectType;
|
||||
private int npcUUID;
|
||||
private int buildingUUID;
|
||||
private int unknown02;
|
||||
private ArrayList<Vector3fImmutable> patrolPoints;
|
||||
private ArrayList<Vector3fImmutable> sentryPoints;
|
||||
private int patrolSize;
|
||||
private int sentrySize;
|
||||
|
||||
private int actionType;
|
||||
private float buySellPercent;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public OrderNPCMsg() {
|
||||
super(Protocol.ORDERNPC);
|
||||
this.actionType = 0;
|
||||
this.unknown02 = 0;
|
||||
this.npcUUID = 0;
|
||||
this.buildingUUID = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 OrderNPCMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.ORDERNPC, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
actionType = reader.getInt();
|
||||
if (this.actionType == 28){
|
||||
this.handleCityCommand(reader);
|
||||
return;
|
||||
}
|
||||
unknown02 = reader.getInt();
|
||||
this.objectType = reader.getInt(); // Object Type Padding
|
||||
npcUUID = reader.getInt();
|
||||
reader.getInt(); // Object Type Padding
|
||||
buildingUUID = reader.getInt();
|
||||
this.buySellPercent = reader.getFloat();
|
||||
if (actionType > 6 && actionType < 13)
|
||||
reader.getInt();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(actionType);
|
||||
writer.putInt(unknown02);
|
||||
writer.putInt(GameObjectType.NPC.ordinal());
|
||||
writer.putInt(npcUUID);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(buildingUUID);
|
||||
writer.putFloat(this.buySellPercent);
|
||||
writer.putInt(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void handleCityCommand(ByteBufferReader reader){
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
this.buildingUUID = reader.getInt();
|
||||
reader.get();
|
||||
reader.get();
|
||||
reader.getInt();
|
||||
patrolSize = reader.getInt();
|
||||
if (patrolSize > 0){
|
||||
this.patrolPoints = new ArrayList<>();
|
||||
for (int i = 0;i<patrolSize;i++){
|
||||
float x = reader.getFloat();
|
||||
float y = reader.getFloat();
|
||||
float z = reader.getFloat();
|
||||
if (this.patrolPoints.size() < 4)
|
||||
this.patrolPoints.add(new Vector3fImmutable(x,y,z));
|
||||
}
|
||||
}
|
||||
sentrySize = reader.getInt();
|
||||
if (sentrySize > 0){
|
||||
this.sentryPoints = new ArrayList<>();
|
||||
for (int i = 0;i<sentrySize;i++){
|
||||
float x = reader.getFloat();
|
||||
float y = reader.getFloat();
|
||||
float z = reader.getFloat();
|
||||
if (this.sentryPoints.size() < 4)
|
||||
this.sentryPoints.add(new Vector3fImmutable(x,y,z));
|
||||
}
|
||||
}
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the npcUUID
|
||||
*/
|
||||
public int getNpcUUID() {
|
||||
return npcUUID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
|
||||
|
||||
public int getBuildingUUID() {
|
||||
return buildingUUID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param buildingUUID the buildingUUID to set
|
||||
*/
|
||||
public void setBuildingUUID(int buildingUUID) {
|
||||
this.buildingUUID = buildingUUID;
|
||||
}
|
||||
|
||||
public float getBuySellPercent() {
|
||||
return buySellPercent;
|
||||
}
|
||||
|
||||
public void setBuySellPercent(float buySellPercent) {
|
||||
this.buySellPercent = buySellPercent;
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(int objectType) {
|
||||
this.objectType = objectType;
|
||||
}
|
||||
|
||||
public ArrayList<Vector3fImmutable> getPatrolPoints() {
|
||||
return patrolPoints;
|
||||
}
|
||||
|
||||
public ArrayList<Vector3fImmutable> getSentryPoints() {
|
||||
return sentryPoints;
|
||||
}
|
||||
|
||||
public int getPatrolSize() {
|
||||
return patrolSize;
|
||||
}
|
||||
|
||||
public void setPatrolSize(int patrolSize) {
|
||||
this.patrolSize = patrolSize;
|
||||
}
|
||||
|
||||
public int getSentrySize() {
|
||||
return sentrySize;
|
||||
}
|
||||
|
||||
public void setSentrySize(int sentrySize) {
|
||||
this.sentrySize = sentrySize;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Debug Info
|
||||
//Run: Failed to make object TEMPLATE:135700 INSTANCE:1717987027141... (t=50.46) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:108760 INSTANCE:1717987027161... (t=50.46) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:108760 INSTANCE:1717987027177... (t=50.67) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:60040 INSTANCE:1717987027344... (t=50.87) (r=7/4/2011 11:56:39)
|
||||
//C:\ArcanePrime\Main_Branch\Shadowbane\Source\ArcObjectLoader.cpp(466):ERROR: ArcObjectLoader::Run: Failed to make object TEMPLATE:3 INSTANCE:1717987027164... (t=50.88) (r=7/4/2011 11:56:39)
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class PassiveMessageTriggerMsg extends ClientNetMsg {
|
||||
|
||||
private byte animation; //not sure if it's animation, 0 or 1.
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PassiveMessageTriggerMsg(byte animation) {
|
||||
super(Protocol.PASSIVEMESSAGETRIGGER);
|
||||
this.animation = animation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PassiveMessageTriggerMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.PASSIVEMESSAGETRIGGER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.put(this.animation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.animation = reader.get();
|
||||
}
|
||||
|
||||
public byte getAnimation() {
|
||||
return this.animation;
|
||||
}
|
||||
|
||||
public void setAnimation(byte value) {
|
||||
this.animation = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class PerformActionMsg extends ClientNetMsg {
|
||||
|
||||
protected int powerUsedID;
|
||||
protected int numTrains;
|
||||
protected int sourceType;
|
||||
protected int sourceID;
|
||||
protected int targetType;
|
||||
protected int targetID;
|
||||
|
||||
protected float targetX;
|
||||
protected float targetY;
|
||||
protected float targetZ;
|
||||
protected int unknown04; //1, 2, 6
|
||||
protected int unknown05;
|
||||
|
||||
protected int realTrains; //not serialized. Used for mob AI tracking.
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PerformActionMsg() {
|
||||
super(Protocol.POWER);
|
||||
}
|
||||
|
||||
public PerformActionMsg(int powerUsedID, int numTrains, int sourceType, int sourceID, int targetType, int targetID, float targetX, float targetY, float targetZ, int unknown04, int unknown05) {
|
||||
super(Protocol.POWER);
|
||||
this.powerUsedID = powerUsedID;
|
||||
this.numTrains = numTrains;
|
||||
this.sourceType = sourceType;
|
||||
this.sourceID = sourceID;
|
||||
this.targetType = targetType;
|
||||
this.targetID = targetID;
|
||||
this.targetX = targetX;
|
||||
this.targetY = targetY;
|
||||
this.targetZ = targetZ;
|
||||
this.unknown04 = unknown04;
|
||||
this.unknown05 = unknown05;
|
||||
|
||||
this.realTrains = this.numTrains;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public PerformActionMsg(PerformActionMsg msg) {
|
||||
super(Protocol.POWER);
|
||||
this.powerUsedID = msg.powerUsedID;
|
||||
this.numTrains = msg.numTrains;
|
||||
this.sourceType = msg.sourceType;
|
||||
this.sourceID = msg.sourceID;
|
||||
this.targetType = msg.targetType;
|
||||
this.targetID = msg.targetID;
|
||||
this.targetX = msg.targetX;
|
||||
this.targetY = msg.targetY;
|
||||
this.targetZ = msg.targetZ;
|
||||
this.unknown04 = msg.unknown04;
|
||||
this.unknown05 = msg.unknown05;
|
||||
this.realTrains = msg.realTrains;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PerformActionMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.POWER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.powerUsedID);
|
||||
writer.putInt(this.numTrains);
|
||||
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
|
||||
writer.putFloat(this.targetX);
|
||||
writer.putFloat(this.targetY);
|
||||
writer.putFloat(this.targetZ);
|
||||
writer.putInt(this.unknown04);
|
||||
writer.putInt(this.unknown05);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.powerUsedID = reader.getInt();
|
||||
this.numTrains = reader.getInt();
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
|
||||
this.targetX = reader.getFloat();
|
||||
this.targetY = reader.getFloat();
|
||||
this.targetZ = reader.getFloat();
|
||||
this.unknown04 = reader.getInt();
|
||||
this.unknown05 = reader.getInt(); //2=FailToCast, 3=Miss, 4=Dodge, 5=Immune, 6=resisted, 7=targetDead, 8=PowerInterupted, 9=NoValidTargets, 10=NotBeenGrantedPower
|
||||
this.realTrains = this.numTrains;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the powerUsedID
|
||||
*/
|
||||
public int getPowerUsedID() {
|
||||
return powerUsedID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param powerUsedID
|
||||
* the powerUsedID to set
|
||||
*/
|
||||
public void setPowerUsedID(int powerUsedID) {
|
||||
this.powerUsedID = powerUsedID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the numTrains
|
||||
*/
|
||||
public int getNumTrains() {
|
||||
return numTrains;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param numTrains
|
||||
* the numTrains to set
|
||||
*/
|
||||
public void setNumTrains(int numTrains) {
|
||||
this.numTrains = numTrains;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 unknown01
|
||||
*/
|
||||
public float getTargetX() {
|
||||
return targetX;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void setTargetX(float targetX) {
|
||||
this.targetX = targetX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown02
|
||||
*/
|
||||
public float getTargetY() {
|
||||
return targetY;
|
||||
}
|
||||
|
||||
public void setTargetY(float targetY) {
|
||||
this.targetY = targetY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown03
|
||||
*/
|
||||
public float getTargetZ() {
|
||||
return targetZ;
|
||||
}
|
||||
|
||||
|
||||
public void setTargetZ(float targetZ) {
|
||||
this.targetZ = targetZ;
|
||||
}
|
||||
|
||||
public void setTargetLoc(Vector3f targetLoc) {
|
||||
this.targetX = targetLoc.x;
|
||||
this.targetY = targetLoc.y;
|
||||
this.targetZ = targetLoc.z;
|
||||
}
|
||||
|
||||
public Vector3fImmutable getTargetLoc() {
|
||||
return new Vector3fImmutable(this.targetX, this.targetY, this.targetZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown04
|
||||
*/
|
||||
public int getUnknown04() {
|
||||
return unknown04;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown04
|
||||
* the unknown04 to set
|
||||
*/
|
||||
public void setUnknown04(int unknown04) {
|
||||
this.unknown04 = unknown04;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown05
|
||||
*/
|
||||
public int getUnknown05() {
|
||||
return unknown05;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown05
|
||||
* the unknown05 to set
|
||||
*/
|
||||
public void setUnknown05(int unknown05) {
|
||||
this.unknown05 = unknown05;
|
||||
}
|
||||
|
||||
public int getRealTrains() {
|
||||
return this.realTrains;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class PetAttackMsg extends ClientNetMsg {
|
||||
|
||||
private int targetType;
|
||||
private int targetID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PetAttackMsg() {
|
||||
super(Protocol.ARCPETATTACK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PetAttackMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCPETATTACK, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.targetType);
|
||||
writer.putInt(this.targetID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.targetType = reader.getInt();
|
||||
this.targetID = reader.getInt();
|
||||
}
|
||||
|
||||
public int getTargetType() {
|
||||
return this.targetType;
|
||||
}
|
||||
|
||||
public int getTargetID() {
|
||||
return this.targetID;
|
||||
}
|
||||
|
||||
public void setTargetType(int value) {
|
||||
this.targetType = value;
|
||||
}
|
||||
|
||||
public void setTargetID(int value) {
|
||||
this.targetID = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class PetCmdMsg extends ClientNetMsg {
|
||||
|
||||
private int type;
|
||||
|
||||
//1: stop attack
|
||||
//2: dismiss
|
||||
//3: toggle assist
|
||||
//5: rest
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PetCmdMsg(int type) {
|
||||
super(Protocol.ARCPETCMD);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PetCmdMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCPETCMD, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(int value) {
|
||||
this.type = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Mob;
|
||||
|
||||
public class PetMsg extends ClientNetMsg {
|
||||
|
||||
private int type; //5 or 6
|
||||
private Mob pet;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PetMsg(int type, Mob pet) {
|
||||
super(Protocol.PET);
|
||||
if (this.type != 6)
|
||||
this.type = 5;
|
||||
this.pet = pet;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PetMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.PET, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.type);
|
||||
|
||||
if (this.pet != null) {
|
||||
writer.putInt(pet.getObjectType().ordinal());
|
||||
writer.putInt(pet.getObjectUUID());
|
||||
} else {
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
if (type == 6) {
|
||||
writer.putInt(0);
|
||||
} else if (type == 5) {
|
||||
if (pet != null){
|
||||
writer.putInt((int)(pet.getCurrentHitpoints() / pet.getHealthMax())); //suspect %health left
|
||||
writer.putInt((int)(pet.getMana() / pet.getManaMax())); //suspect %mana left
|
||||
writer.putInt((int)(pet.getStamina() / pet.getStaminaMax())); //suspect %stamina left
|
||||
writer.putString(pet.getName());
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
}else{
|
||||
writer.putInt(0); //suspect %health left
|
||||
writer.putInt(0); //suspect %mana left
|
||||
writer.putInt(0); //suspect %stamina left
|
||||
writer.putString("No Pet");
|
||||
writer.putInt(0);
|
||||
writer.put((byte)0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
reader.getInt();
|
||||
int petID = reader.getInt();
|
||||
this.pet = Mob.getFromCache(petID);
|
||||
if (this.type == 5) {
|
||||
reader.getInt();
|
||||
} else if (this.type == 6) {
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getString();
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
}
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public Mob getPet() {
|
||||
return this.pet;
|
||||
}
|
||||
|
||||
public void setType(int value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
public void setPet(Mob value) {
|
||||
this.pet = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class PetitionReceivedMsg extends ClientNetMsg {
|
||||
|
||||
// TODO pull these statics out into SBEmuStatics.java
|
||||
private static final int PETITION_NEW = 1;
|
||||
private static final int PETITION_CANCEL = 2;
|
||||
|
||||
private static final int TYPE_GENERAL_HELP = 1;
|
||||
private static final int TYPE_FEEDBACK = 2;
|
||||
private static final int TYPE_STUCK = 3;
|
||||
private static final int TYPE_HARASSMENT = 4;
|
||||
private static final int TYPE_EXPLOIT = 5;
|
||||
private static final int TYPE_BUG = 6;
|
||||
private static final int TYPE_GAME_STOPPER = 7;
|
||||
private static final int TYPE_TECH_SUPPORT = 8;
|
||||
|
||||
private static final int SUBTYPE_EXPLOIT_DUPE = 1;
|
||||
private static final int SUBTYPE_EXPLOIT_LEVELING = 2;
|
||||
private static final int SUBTYPE_EXPLOIT_SKILL_GAIN = 3;
|
||||
private static final int SUBTYPE_EXPLOIT_KILLING = 4;
|
||||
private static final int SUBTYPE_EXPLOIT_POLICY = 5;
|
||||
private static final int SUBTYPE_EXPLOIT_OTHER = 6;
|
||||
private static final int SUBTYPE_TECH_VIDEO = 7;
|
||||
private static final int SUBTYPE_TECH_SOUND = 8;
|
||||
private static final int SUBTYPE_TECH_NETWORK = 9;
|
||||
private static final int SUBTYPE_TECH_OTHER = 10;
|
||||
|
||||
private int petition;
|
||||
private int unknown01;
|
||||
private int unknown02;
|
||||
private byte unknownByte01;
|
||||
private int unknown03;
|
||||
private int unknown04;
|
||||
private int unknown05;
|
||||
private int unknown06;
|
||||
private int type;
|
||||
private int subType;
|
||||
private String compType;
|
||||
private String language;
|
||||
private int unknown07;
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PetitionReceivedMsg() {
|
||||
super(Protocol.CUSTOMERPETITION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PetitionReceivedMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.CUSTOMERPETITION, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.petition);
|
||||
if (this.petition == PETITION_NEW) {
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.unknown02);
|
||||
writer.put(this.unknownByte01);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.unknown04);
|
||||
writer.putInt(this.unknown05);
|
||||
writer.putInt(this.unknown06);
|
||||
writer.putInt(this.type);
|
||||
writer.putInt(this.subType);
|
||||
writer.putString(this.compType);
|
||||
writer.putString(this.language);
|
||||
writer.putInt(this.unknown07);
|
||||
writer.putUnicodeString(message);
|
||||
} else if (this.petition == PETITION_CANCEL) {
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.unknown02);
|
||||
writer.put(this.unknownByte01);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.unknown04);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
petition = reader.getInt();
|
||||
if (petition == PETITION_NEW) {
|
||||
this.unknown01 = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknownByte01 = reader.get();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.unknown04 = reader.getInt();
|
||||
this.unknown05 = reader.getInt();
|
||||
this.unknown06 = reader.getInt();
|
||||
this.type = reader.getInt();
|
||||
this.subType = reader.getInt();
|
||||
this.compType = reader.getString();
|
||||
this.language = reader.getString();
|
||||
this.unknown07 = reader.getInt();
|
||||
this.message = reader.getUnicodeString();
|
||||
} else if (petition == PETITION_CANCEL) {
|
||||
this.unknown01 = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknownByte01 = reader.get();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.unknown04 = reader.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the petition
|
||||
*/
|
||||
public int getPetition() {
|
||||
return petition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param petition
|
||||
* the petition to set
|
||||
*/
|
||||
public void setPetition(int petition) {
|
||||
this.petition = petition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subType
|
||||
*/
|
||||
public int getSubType() {
|
||||
return subType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subType
|
||||
* the subType to set
|
||||
*/
|
||||
public void setSubType(int subType) {
|
||||
this.subType = subType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* the message to set
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return this.unknown03;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
|
||||
public int getUnknown04() {
|
||||
return this.unknown04;
|
||||
}
|
||||
|
||||
public void setUnknown04(int value) {
|
||||
this.unknown04 = value;
|
||||
}
|
||||
|
||||
public int getUnknown05() {
|
||||
return this.unknown05;
|
||||
}
|
||||
|
||||
public void setUnknown05(int value) {
|
||||
this.unknown05 = value;
|
||||
}
|
||||
|
||||
public int getUnknown06() {
|
||||
return this.unknown06;
|
||||
}
|
||||
|
||||
public void setUnknown06(int value) {
|
||||
this.unknown06 = value;
|
||||
}
|
||||
|
||||
public int getUnknown07() {
|
||||
return this.unknown07;
|
||||
}
|
||||
|
||||
public void setUnknown07(int value) {
|
||||
this.unknown07 = value;
|
||||
}
|
||||
|
||||
public byte getUnknownByte01() {
|
||||
return this.unknownByte01;
|
||||
}
|
||||
|
||||
public void setUnknownByte01(byte value) {
|
||||
this.unknownByte01 = value;
|
||||
}
|
||||
|
||||
public String getCompType() {
|
||||
return this.compType;
|
||||
}
|
||||
|
||||
public void setCompType(String value) {
|
||||
this.compType = value;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return this.language;
|
||||
}
|
||||
|
||||
public void setLanguage(String value) {
|
||||
this.language = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,593 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.*;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Zone;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PlaceAssetMsg extends ClientNetMsg {
|
||||
|
||||
/*
|
||||
Client -> Server
|
||||
//Type 1
|
||||
//940962DF 00000001 00000000 0A400000 03903DC1 00000000 00000000 00000000 3F800000 00000000 00000000 00000000 00
|
||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00
|
||||
//00000000
|
||||
//00000000
|
||||
//00000000
|
||||
//Type3
|
||||
//940962DF 00000003 00000000 00000000 00000000 00000000 00000000 00000000 3F800000 00000000 00000000 00000000 00
|
||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 01
|
||||
//00000000
|
||||
//00000001
|
||||
// 00000000 0013FF24 475765FD 417BD060 C794FF75 B33BBD2E 00000000 3F800000 00000000 <-placement info
|
||||
//00000000
|
||||
|
||||
|
||||
Server -> Client
|
||||
//Type 2 (Asset list / walls)
|
||||
//940962DF 00000002 00000000 00000000 00000000 00000000 00000000 00000000 3F800000 00000000 00000000 00000000 01
|
||||
//475725EC 412BD080 C794DF86 44600000 44600000 44600000 43000000 43000000 43000000 445AC000 445AC000 01
|
||||
//00000000
|
||||
//00000000
|
||||
//00000006 <-building list for walls
|
||||
// 00000000 0013FA74 00061A80 <-wall ID and cost
|
||||
// 00000000 0013FBA0 000249F0
|
||||
// 00000000 0013FCCC 000186A0
|
||||
// 00000000 0013FDF8 0007A120
|
||||
// 00000000 0013FF24 0007A120
|
||||
// 00000000 004D5FD0 0007A120
|
||||
//Type 2 (Single asset)
|
||||
//940962DF 00000002 00000000 00000000 00000000 00000000 00000000 00000000 3F800000 00000000 00000000 00000000 01
|
||||
//475725EC 412BD080 C794DF86 44600000 44600000 44600000 43000000 43000000 43000000 445AC000 445AC000 00
|
||||
//00000001
|
||||
// 00000000 00063060 00000001 <-blueprintUUID, 1 Building
|
||||
//00000000
|
||||
//00000000
|
||||
//Type 0 (Response Error)
|
||||
//940962DF 00000000 00000006 0000001b
|
||||
//430061006e006e006f007400200070006c00610063006500200061007300730065007400200069006e00200077006100740065007200
|
||||
//00000000 00000000 00000000 00000000 00000000 3F800000 00000000 00000000 00000000 00
|
||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00
|
||||
//00000000
|
||||
//00000000
|
||||
//00000000
|
||||
//Type 4 (Response Success (place asset))
|
||||
//940962DF 00000000 00000002 0000000D 00460065007500640061006C0020004300680075007200630068
|
||||
//00000000 00000000 00000000 00000000 00000000 3F800000 00000000 00000000 00000000 00
|
||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00
|
||||
//00000000
|
||||
//00000000
|
||||
//00000000
|
||||
*/
|
||||
|
||||
//UseItem(C->S)->Type 2(S->C)->Type 1(C->S) <-close placement window, no response
|
||||
//UseItem(C->S)->Type 2(S->C)->Type 3(C->S)->Type 0(S->C) <-Attempt place asset, with error response
|
||||
//UseItem(C->S)->Type 2(S->C)->Type 3(C->S)->Type 4(S->C) <-Attempt place asset, with success response
|
||||
|
||||
/* Error msg codes
|
||||
//1 "msg append here" <- what's in msg string.
|
||||
//2 Conflict with "msg append here"
|
||||
//3 Conflict between proposed assets
|
||||
//4 Asset "msg append here" Cannot be isolated.
|
||||
//5 Asset "msg append here" is outside the fortress zone.
|
||||
//6 Cannot place the asset in water.
|
||||
//7 Cannot place asset on land.
|
||||
//8 NULL template for asset
|
||||
//9 You must be a guild member to place this asset
|
||||
//10 You must be a guild leader to place this asset
|
||||
//11 No city asset template
|
||||
//12 Only leaders of your guild can place fortresses
|
||||
//13 Your guild cannot place fortress placements here
|
||||
//14 This city architechture cannot be placed in this zone
|
||||
//15 Cannot place assets in peace zone
|
||||
//16 You do not belong to a guild
|
||||
//17 Yours is not an errant or swarn guild
|
||||
//18 There are no guild trees to be found
|
||||
//19 NULL tree city asset
|
||||
//20 You cannot place a bane circle on a tree your affiliated with
|
||||
//21 This tree cannot be affected by bane circles
|
||||
//22 Bane circles cannot effect dead trees
|
||||
//23 A bane circle is already attached to nearest tree
|
||||
//24 Banecircle is too far from guild
|
||||
//25 Banecircle is too close to guild tree
|
||||
//26 Cannot find deed in inventory
|
||||
//27 Target object is not a deed
|
||||
//28 You do not have enough gold to complete this request
|
||||
//29 You apparently do not have access to some of these assets
|
||||
//30 Insufficient deeds
|
||||
//31 Unable to locate deed to this asset
|
||||
//32 Unknown error occurred: 32
|
||||
//33 Unknown error occurred: 33
|
||||
//34 Unknown error occurred: 34
|
||||
//35 Unknown error occurred: 35
|
||||
//36 Unknown error occurred: 36
|
||||
//37 Unknown error occurred: 37
|
||||
//38 Unknown error occurred: 38
|
||||
//39 Too close to another tree
|
||||
//40 Cannot place into occupied guild zone
|
||||
//41 Cannot place outisde a guild zone
|
||||
//42 Tree cannot support anymore shrines
|
||||
//43 The city already has a shrine of that type
|
||||
//44 You must be in a player guild to place a bane circle
|
||||
//45 Tree cannot support anymore spires
|
||||
//46 A spire of that type already exists
|
||||
//47 Tree cannot support anymore barracks
|
||||
//48 Assets (except walls) must be placed one at a time
|
||||
//49 The city cannot support a warehouse at its current rank
|
||||
//50 You can only have one warehouse
|
||||
//51 This asset cannot be placed on city grid
|
||||
//52 No city to associate asset with
|
||||
//53 Buildings of war cannot be placed around a city grid unless there is an active bane
|
||||
//54 You must belong to the nation of the Bane Circle or the Tree to place buildings of war.
|
||||
//55 You must belong to a nation to place a bane circle
|
||||
//56 The building of war must be placed closer to the city
|
||||
//57 No building may be placed within this territory
|
||||
//58 This territory is full, it can support no more then "msg append here" trees.
|
||||
//59 No city to siege at this location.
|
||||
//60 This scroll's rank is too low to bane this city
|
||||
//61 The bane circle cannot support any more buildings of war
|
||||
//62 The tree cannot support any more buildings of war
|
||||
//63 Failure in guild tree claiming phase
|
||||
//64 Your nation is already at war and your limit has been reached
|
||||
//65 Unable to find a tree to target
|
||||
//66 There is no bane circle to support this building of war
|
||||
//67 There is no tree to support this building of war
|
||||
//68 There is not tree or bane circle to support this building of war
|
||||
//69 Trees must be placed within a territory
|
||||
//70 Unknown error occurred: 38
|
||||
//71 This building of war may not be placed on a city grid by attackers
|
||||
//72 You cannot place a bane circle while you are in a non player nation
|
||||
//73 Only the guild leader or inner council may place a bane circle
|
||||
//74 Only buildings of war may be placed during a bane
|
||||
//75 This current vigor of the tree withstands your attempt to place a bane circle. Minutes remaining: "msg appended here"
|
||||
//76 This tree cannot support towers or gatehouses
|
||||
//77 This tree cannot support more towers or gatehouses
|
||||
//78 This tree cannot support walls.
|
||||
//79 This tree cannot support more walls.
|
||||
*/
|
||||
|
||||
private static final Map<Integer,Integer> wallToCost;
|
||||
static {
|
||||
Map<Integer,Integer> map = new HashMap<>();
|
||||
map.put(454700, 100000); //Straight Outer Wall
|
||||
map.put(1309900, 100000); //Irekei Outer Straight Wall
|
||||
map.put(1348900, 100000); //Invorri Outer Straight Wall
|
||||
map.put(454650, 150000); //Outer Wall with Stairs
|
||||
map.put(455000, 150000); //Outer Wall with Tower
|
||||
map.put(454550, 150000); //Outer Wall Gate
|
||||
map.put(455700, 150000); //Small Gate House
|
||||
map.put(1309600, 150000); //Irekei Outer Wall with Stairs
|
||||
map.put(1309300, 150000); //Irekei Outer Wall Gate
|
||||
map.put(1331200, 150000); //Elven Straight Outer Wall
|
||||
map.put(1330900, 150000); //Elven Outer Wall with Stairs
|
||||
map.put(1332100, 150000); //Elven Outer Wall with Tower
|
||||
map.put(1330300, 150000); //Elven Outer Wall Gate
|
||||
map.put(1348600, 150000); //Invorri Outer Wall with Stairs
|
||||
map.put(1348300, 150000); //Invorri Outer Wall Gate
|
||||
map.put(454750, 300000); //Concave Tower
|
||||
map.put(458100, 300000); //Artillery Tower
|
||||
map.put(455300, 300000); //Tower Junction
|
||||
map.put(454800, 300000); //Convex Tower (inside corner)
|
||||
map.put(1310200, 300000); //Irekei Concave Tower
|
||||
map.put(5070800, 300000); //Irekei Artillery Tower
|
||||
map.put(1310500, 300000); //Irekei Convex Tower
|
||||
map.put(1330600, 300000); //Elven Gate House
|
||||
map.put(1331500, 300000); //Elven Concave Tower
|
||||
map.put(5070200, 300000); //Elven Artillery Tower
|
||||
map.put(1332400, 300000); //Elven Tower Junction
|
||||
map.put(1331800, 300000); //Elven Convex Tower
|
||||
map.put(1349200, 300000); //Invorri Concave Tower
|
||||
map.put(5071400, 300000); //Invorri Artillery Tower
|
||||
map.put(1349500, 300000); //Invorri Convex Tower
|
||||
wallToCost = Collections.unmodifiableMap(map);
|
||||
}
|
||||
private static final Map<Integer,Integer> wallToUseId;
|
||||
static {
|
||||
Map<Integer,Integer> map = new HashMap<>();
|
||||
///Feudal Outer Walls
|
||||
map.put(454700, 1); //Straight Outer Wall
|
||||
map.put(454650, 1); //Outer Wall with Stairs
|
||||
map.put(455000, 1); //Outer Wall with Tower
|
||||
map.put(454550, 1); //Outer Wall Gate
|
||||
map.put(455700, 1); //Small Gate House
|
||||
map.put(454750, 1); //Concave Tower
|
||||
map.put(458100, 1); //Artillery Tower
|
||||
map.put(455300, 1); //Tower Junction
|
||||
map.put(454800, 1); //Convex Tower (inside corner)
|
||||
//map.put(1, 454000, 1); //Gate House (giant gatehouse) NOT USE IN GAME
|
||||
//Feudal Inner Walls
|
||||
/*
|
||||
map.put(454100, 2); //Inner Archway
|
||||
map.put(454200, 2); //Inner Wall Corner
|
||||
map.put(454250, 2); //Inner Wall Gate
|
||||
map.put(454300, 2); //Inner Straight Wall
|
||||
map.put(454350, 2); //Inner Wall T-Junction
|
||||
map.put(454400, 2); //Inner Wall Cross Junction
|
||||
map.put(454850, 2); //Tower-Inner Wall Junction (T-East) Stuck inside left
|
||||
map.put(454900, 2); //Tower-Inner Wall Junction (T-South) stuck inside right
|
||||
map.put(454950, 2); //Tower-Inner Wall Junction (4-way) stuck inside
|
||||
*/
|
||||
//Irekei Outer Walls
|
||||
map.put(1309900, 3); //Irekei Outer Straight Wall
|
||||
map.put(1309600, 3); //Irekei Outer Wall with Stairs
|
||||
map.put(1309300, 3); //Irekei Outer Wall Gate
|
||||
map.put(1310200, 3); //Irekei Concave Tower
|
||||
map.put(5070800, 3); //Irekei Artillery Tower
|
||||
map.put(1310500, 3); //Irekei Convex Tower
|
||||
//Elven Outer Walls
|
||||
map.put(1331200, 4); //Elven Straight Outer Wall
|
||||
map.put(1330900, 4); //Elven Outer Wall with Stairs
|
||||
map.put(1332100, 4); //Elven Outer Wall with Tower
|
||||
map.put(1330300, 4); //Elven Outer Wall Gate
|
||||
map.put(1330600, 4); //Elven Gate House
|
||||
map.put(1331500, 4); //Elven Concave Tower
|
||||
map.put(5070200, 4); //Elven Artillery Tower
|
||||
map.put(1332400, 4); //Elven Tower Junction
|
||||
map.put(1331800, 4); //Elven Convex Tower
|
||||
//Invorri Outer Walls
|
||||
map.put(1348900, 5); //Invorri Outer Straight Wall
|
||||
map.put(1348600, 5); //Invorri Outer Wall with Stairs
|
||||
map.put(1348300, 5); //Invorri Outer Wall Gate
|
||||
map.put(1349200, 5); //Invorri Concave Tower
|
||||
map.put(5071400, 5); //Invorri Artillery Tower
|
||||
map.put(1349500, 5); //Invorri Convex Tower
|
||||
wallToUseId = Collections.unmodifiableMap(map);
|
||||
}
|
||||
private static final Map<Integer, Map<Integer,Integer>> useIdToWallCostMaps;
|
||||
static {
|
||||
//autoloaded based on wallToUseId and wallToCost
|
||||
Map<Integer, Map<Integer,Integer>> map = new HashMap<>();
|
||||
for (Map.Entry<Integer,Integer> entry : wallToUseId.entrySet()) {
|
||||
int wallId = entry.getKey();
|
||||
int useId = entry.getValue();
|
||||
int cost = 0;
|
||||
Integer costCheck = wallToCost.get(wallId);
|
||||
if (costCheck != null) {
|
||||
cost = costCheck;
|
||||
} else {
|
||||
throw new Error("PlaceAssetMsg: WallId '" + wallId + "' has no cost in 'wallToCost' but exists in 'useIdToWall'.");
|
||||
}
|
||||
if (!map.containsKey(useId)) {
|
||||
map.put(useId, new HashMap<>());
|
||||
}
|
||||
map.get(useId).put(wallId, cost);
|
||||
}
|
||||
for (Map.Entry<Integer,Map<Integer,Integer>> entry : map.entrySet()) {
|
||||
map.put(entry.getKey(), Collections.unmodifiableMap(entry.getValue()));
|
||||
}
|
||||
useIdToWallCostMaps = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
private int actionType; //1,3 (recv), 0,2 (send)
|
||||
private int msgID; //used on type 0, 0 on all other types
|
||||
private String msg; //used on type 0
|
||||
private int contractType; //used on type 1
|
||||
private int contractID; //used on type 1
|
||||
private byte unknown01; //0x01 on type 2 (send city data). 0x00 otherwise
|
||||
private float x;
|
||||
private float y;
|
||||
private float z;
|
||||
private byte unknown02; //0x01 if data follow, 0x00 otherwise. Best guess
|
||||
private ArrayList<PlacementInfo> placementInfo;
|
||||
|
||||
private static final int NONE = 0;
|
||||
private static final int CLIENTREQ_UNKNOWN = 1;
|
||||
private static final int SERVER_OPENWINDOW = 2;
|
||||
private static final int CLIENTREQ_NEWBUILDING = 3; // Request to place asset
|
||||
private static final int SERVER_CLOSEWINDOW = 4;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PlaceAssetMsg() {
|
||||
super(Protocol.PLACEASSET);
|
||||
this.placementInfo = new ArrayList<>();
|
||||
this.actionType = SERVER_OPENWINDOW;
|
||||
this.msgID = 0;
|
||||
this.msg = "";
|
||||
this.contractType = 0;
|
||||
this.contractID = 0;
|
||||
this.unknown01 = (byte)0x00;
|
||||
this.x = 0f;
|
||||
this.y = 0f;
|
||||
this.z = 0f;
|
||||
this.unknown02 = (byte)0x01;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PlaceAssetMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.PLACEASSET, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
|
||||
writer.putInt(this.actionType);
|
||||
|
||||
if (this.actionType == NONE) {
|
||||
writer.putInt(this.msgID);
|
||||
if (this.msgID != 0)
|
||||
writer.putString(this.msg);
|
||||
} else if (this.actionType == SERVER_CLOSEWINDOW) {
|
||||
//writer.putInt(1); //Qty of assets placed?? A 0 will crash the client. Any value >0 seems to do the same thing.
|
||||
writer.putInt(0);
|
||||
} else {
|
||||
writer.putInt(0);
|
||||
}
|
||||
|
||||
writer.putInt(this.contractType);
|
||||
writer.putInt(this.contractID);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putFloat(1f);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
|
||||
if (this.actionType == SERVER_OPENWINDOW || (this.actionType == NONE && this.msgID == 0) ) {
|
||||
//send Place Asset Msg
|
||||
writer.put((byte)0x01);
|
||||
writer.putFloat(x);
|
||||
writer.putFloat(y);
|
||||
writer.putFloat(z);
|
||||
for (int i=0;i<3;i++)
|
||||
writer.putFloat(896); // city Bounds full extent.
|
||||
for (int i=0;i<3;i++)
|
||||
writer.putFloat(128); //grid dimensions
|
||||
PlacementInfo pi = (this.placementInfo.size() > 0) ? this.placementInfo.get(0) : null;
|
||||
int buildingID = (pi != null) ? pi.getBlueprintUUID() : 0;
|
||||
if (buildingID == 24200){
|
||||
writer.putFloat(875);
|
||||
writer.putFloat(875);
|
||||
}else{
|
||||
writer.putFloat(576);
|
||||
writer.putFloat(576);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (buildingID < 6) {
|
||||
//place wall lists
|
||||
writer.put((byte)0x01);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
Map<Integer, Integer> buildings = getBuildingList(buildingID);
|
||||
writer.putInt(buildings.size());
|
||||
for (int bID : buildings.keySet()) {
|
||||
writer.putInt(0);
|
||||
writer.putInt(bID);
|
||||
writer.putInt(buildings.get(bID));
|
||||
}
|
||||
} else {
|
||||
//send individual building
|
||||
writer.put((byte)0x00);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(buildingID);
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
} else {
|
||||
//Send Server response to client placing asset
|
||||
writer.put((byte)0x00);
|
||||
for (int i=0;i<11;i++)
|
||||
writer.putFloat(0f);
|
||||
writer.put((byte)0x00);
|
||||
writer.putInt(0);
|
||||
if (this.placementInfo == null)
|
||||
writer.putInt(0);
|
||||
else{
|
||||
writer.putInt(this.placementInfo.size());
|
||||
for (PlacementInfo placementInfo : this.placementInfo){
|
||||
writer.putInt(0);
|
||||
writer.putInt(placementInfo.blueprintUUID);
|
||||
writer.putVector3f(placementInfo.loc);
|
||||
writer.putFloat(placementInfo.w);
|
||||
writer.putVector3f(placementInfo.rot);
|
||||
}
|
||||
}
|
||||
|
||||
writer.putInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<Integer, Integer> getBuildingList(int buildingID) {
|
||||
if (useIdToWallCostMaps.containsKey(buildingID)) {
|
||||
return useIdToWallCostMaps.get(buildingID);
|
||||
}
|
||||
return new HashMap<>(0);
|
||||
}
|
||||
|
||||
public static int getWallCost(int blueprintUUID) {
|
||||
if (wallToCost.containsKey(blueprintUUID)) {
|
||||
return wallToCost.get(blueprintUUID);
|
||||
}
|
||||
Logger.warn("Cost of Wall '" + blueprintUUID + "' was requested but no cost is configured for that wallId.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void sendPlaceAssetError(ClientConnection origin, int errorID, String stringData) {
|
||||
|
||||
PlaceAssetMsg outMsg;
|
||||
|
||||
outMsg = new PlaceAssetMsg();
|
||||
outMsg.actionType = 0;
|
||||
outMsg.msgID = errorID;
|
||||
outMsg.msg = stringData;
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
public static void sendPlaceAssetConfirmWall(ClientConnection origin, Zone zone) {
|
||||
|
||||
PlaceAssetMsg outMsg = new PlaceAssetMsg();
|
||||
outMsg.actionType = 0;
|
||||
outMsg.msgID = 0;
|
||||
outMsg.msg = "";
|
||||
outMsg.x = zone.getLoc().x + 64;
|
||||
outMsg.y = zone.getLoc().y;
|
||||
outMsg.z = zone.getLoc().z + 64;
|
||||
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.placementInfo = new ArrayList<>();
|
||||
this.actionType = reader.getInt();
|
||||
reader.getInt();
|
||||
this.contractType = reader.getInt();
|
||||
this.contractID = reader.getInt();
|
||||
for (int i=0; i<7; i++)
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
for (int i=0; i<11; i++)
|
||||
reader.getInt();
|
||||
reader.get();
|
||||
reader.getInt();
|
||||
int placementInfo = reader.getInt();
|
||||
for (int i=0;i<placementInfo;i++) {
|
||||
reader.getInt();
|
||||
PlacementInfo pi = new PlacementInfo(reader.getInt(), reader.getFloat(), reader.getFloat(),
|
||||
reader.getFloat(), reader.getFloat(), reader.getFloat(), reader.getFloat(), reader.getFloat());
|
||||
this.placementInfo.add(pi);
|
||||
}
|
||||
reader.getInt();
|
||||
}
|
||||
|
||||
public int getActionType() {
|
||||
return this.actionType;
|
||||
}
|
||||
public int getID() {
|
||||
return this.msgID;
|
||||
}
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
public int getContractType() {
|
||||
return this.contractType;
|
||||
}
|
||||
public int getContractID() {
|
||||
return this.contractID;
|
||||
}
|
||||
public byte getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
public float getX() {
|
||||
return this.x;
|
||||
}
|
||||
public float getY() {
|
||||
return this.y;
|
||||
}
|
||||
public float getZ() {
|
||||
return this.z;
|
||||
}
|
||||
public byte getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
public ArrayList<PlacementInfo> getPlacementInfo() {
|
||||
return this.placementInfo;
|
||||
}
|
||||
public PlacementInfo getFirstPlacementInfo() {
|
||||
if (this.placementInfo.size() > 0)
|
||||
return this.placementInfo.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setActionType(int value) {
|
||||
this.actionType = value;
|
||||
}
|
||||
public void setMsgID(int value) {
|
||||
this.msgID = value;
|
||||
}
|
||||
public void setMsg(String value) {
|
||||
this.msg = value;
|
||||
}
|
||||
public void setContractType(int value) {
|
||||
this.contractType = value;
|
||||
}
|
||||
public void setContractID(int value) {
|
||||
this.contractID = value;
|
||||
}
|
||||
public void setUnknown01(byte value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
public void setX(float value) {
|
||||
this.x = value;
|
||||
}
|
||||
public void setY(float value) {
|
||||
this.y = value;
|
||||
}
|
||||
public void setZ(float value) {
|
||||
this.z = value;
|
||||
}
|
||||
public void setUnknown02(byte value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
public void addPlacementInfo(int ID) {
|
||||
PlacementInfo pi = new PlacementInfo(ID, 0f, 0f, 0f, 0f, 0f, 0f, 0f);
|
||||
this.placementInfo.add(pi);
|
||||
}
|
||||
|
||||
public static class PlacementInfo {
|
||||
int blueprintUUID;
|
||||
Vector3fImmutable loc;
|
||||
float w;
|
||||
Vector3fImmutable rot;
|
||||
public PlacementInfo(int blueprintUUID, float locX, float locY, float locZ, float w, float rotX, float rotY, float rotZ) {
|
||||
this.blueprintUUID = blueprintUUID;
|
||||
this.loc = new Vector3fImmutable(locX, locY, locZ);
|
||||
this.w = w;
|
||||
this.rot = new Vector3fImmutable(rotX, rotY, rotZ);
|
||||
}
|
||||
public int getBlueprintUUID() {
|
||||
return this.blueprintUUID;
|
||||
}
|
||||
public Vector3fImmutable getLoc() {
|
||||
return this.loc;
|
||||
}
|
||||
public float getW() {
|
||||
return this.w;
|
||||
}
|
||||
public Vector3fImmutable getRot() {
|
||||
return this.rot;
|
||||
}
|
||||
public void setLoc(Vector3fImmutable loc) {
|
||||
this.loc = loc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractWorldObject;
|
||||
|
||||
|
||||
public class PowerProjectileMsg extends ClientNetMsg {
|
||||
private AbstractWorldObject source;
|
||||
private AbstractWorldObject target;
|
||||
private float range = 10;
|
||||
|
||||
/**
|
||||
* 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 PowerProjectileMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCPOWERPROJECTILE, origin, reader);
|
||||
}
|
||||
|
||||
public PowerProjectileMsg() {
|
||||
super(Protocol.ARCPOWERPROJECTILE);
|
||||
}
|
||||
|
||||
public PowerProjectileMsg(AbstractWorldObject source,AbstractWorldObject target) {
|
||||
super(Protocol.ARCPOWERPROJECTILE);
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
}
|
||||
|
||||
// Pre-cache and configure values so they are available when we serialize
|
||||
|
||||
public void configure() {
|
||||
|
||||
if (this.source == null)
|
||||
return;
|
||||
|
||||
if (this.target == null)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
engine.math.Vector3fImmutable faceDir = this.source.getLoc().subtract2D(target.getLoc()).normalize();
|
||||
engine.math.Vector3fImmutable newLoc =faceDir.scaleAdd(range, target.getLoc());
|
||||
|
||||
newLoc = newLoc.setY(newLoc.getY() + range);
|
||||
|
||||
writer.putInt(this.source.getObjectType().ordinal());
|
||||
writer.putInt(this.source.getObjectUUID());
|
||||
writer.putVector3f(newLoc);
|
||||
|
||||
}
|
||||
|
||||
public float getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
public void setRange(float range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class PromptRecallMsg extends ClientNetMsg {
|
||||
|
||||
private byte confirmation;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public PromptRecallMsg() {
|
||||
super(Protocol.ARCPROMPTRECALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 PromptRecallMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCPROMPTRECALL, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.put((byte)0x01); // tried 0 and 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.confirmation = reader.get();
|
||||
}
|
||||
|
||||
public boolean getConfirmed() {
|
||||
|
||||
return confirmation == 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class RandomMsg extends ClientNetMsg {
|
||||
|
||||
private int max;
|
||||
private int roll;
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
|
||||
public RandomMsg() {
|
||||
super(Protocol.RANDOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 RandomMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.RANDOM, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.max);
|
||||
writer.putInt(this.roll);
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.max = reader.getInt();
|
||||
this.roll = reader.getInt();
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return this.max;
|
||||
}
|
||||
|
||||
public int getRoll() {
|
||||
return this.roll;
|
||||
}
|
||||
|
||||
public int getSourceType() {
|
||||
return this.sourceType;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return this.sourceID;
|
||||
}
|
||||
|
||||
public void setMax(int value) {
|
||||
this.max = value;
|
||||
}
|
||||
|
||||
public void setRoll(int value) {
|
||||
this.roll = value;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
|
||||
|
||||
public class RecommendNationMsg extends ClientNetMsg {
|
||||
|
||||
|
||||
private int guildID;
|
||||
private byte ally;
|
||||
private byte enemy;
|
||||
|
||||
|
||||
|
||||
|
||||
public RecommendNationMsg(PlayerCharacter player) {
|
||||
super(Protocol.RECOMMENDNATION);
|
||||
|
||||
}
|
||||
|
||||
public RecommendNationMsg() {
|
||||
super(Protocol.RECOMMENDNATION);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 RecommendNationMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.RECOMMENDNATION, origin, reader);
|
||||
}
|
||||
//CALL THIS AFTER SANITY CHECKS AND BEFORE UPDATING HEALTH/GOLD.
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
reader.getInt();
|
||||
this.guildID = reader.getInt();
|
||||
this.ally = reader.get();
|
||||
this.enemy = reader.get();
|
||||
}
|
||||
|
||||
|
||||
// Precache and configure this message before we serialize it
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(GameObjectType.Guild.ordinal());
|
||||
writer.putInt(guildID);
|
||||
writer.put(this.ally);
|
||||
writer.put(this.enemy);
|
||||
}
|
||||
|
||||
public int getGuildID() {
|
||||
return guildID;
|
||||
}
|
||||
|
||||
public byte getAlly() {
|
||||
return ally;
|
||||
}
|
||||
|
||||
public byte getEnemy() {
|
||||
return enemy;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class RecvSummonsRequestMsg extends ClientNetMsg {
|
||||
|
||||
private int sourceType;
|
||||
private int sourceID;
|
||||
private String sourceName;
|
||||
private String locationName; //where being summoned to
|
||||
private boolean accepted;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public RecvSummonsRequestMsg(int sourceType, int sourceID, String sourceName, String locationName, boolean accepted) {
|
||||
super(Protocol.ARCSUMMON);
|
||||
this.sourceType = sourceType;
|
||||
this.sourceID = sourceID;
|
||||
this.sourceName = sourceName;
|
||||
this.locationName = locationName;
|
||||
this.accepted = accepted;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 RecvSummonsRequestMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCSUMMON, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.sourceType);
|
||||
writer.putInt(this.sourceID);
|
||||
writer.putString(this.sourceName);
|
||||
writer.putString(this.locationName);
|
||||
writer.put(this.accepted ? (byte)1 : (byte)0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.sourceType = reader.getInt();
|
||||
this.sourceID = reader.getInt();
|
||||
this.sourceName = reader.getString();
|
||||
this.locationName = reader.getString();
|
||||
this.accepted = (reader.get() == 1) ? true : false;
|
||||
}
|
||||
|
||||
public int getSourceType() {
|
||||
return this.sourceType;
|
||||
}
|
||||
|
||||
public int getSourceID() {
|
||||
return this.sourceID;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return this.sourceName;
|
||||
}
|
||||
|
||||
public String getLocationName() {
|
||||
return this.locationName;
|
||||
}
|
||||
|
||||
public boolean accepted() {
|
||||
return this.accepted;
|
||||
}
|
||||
|
||||
public void setSourceType(int value) {
|
||||
this.sourceType = value;
|
||||
}
|
||||
|
||||
public void setSourceID(int value) {
|
||||
this.sourceID = value;
|
||||
}
|
||||
|
||||
public void setSourceName(String value) {
|
||||
this.sourceName = value;
|
||||
}
|
||||
|
||||
public void setLocationName(String value) {
|
||||
this.locationName = value;
|
||||
}
|
||||
|
||||
public void setAccepted(boolean value) {
|
||||
this.accepted = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class RecyclePowerMsg extends ClientNetMsg {
|
||||
|
||||
protected int token;
|
||||
|
||||
public RecyclePowerMsg(int token) {
|
||||
super(Protocol.RECYCLEPOWER);
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 RecyclePowerMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.RECYCLEPOWER, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.token = reader.getInt();
|
||||
}
|
||||
|
||||
public int getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public void setToken(int value) {
|
||||
this.token = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.*;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class RefineMsg extends ClientNetMsg {
|
||||
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
private int unknown01;
|
||||
private int type;
|
||||
private int token;
|
||||
private int unknown02;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public RefineMsg() {
|
||||
super(Protocol.ARCUNTRAINABILITY);
|
||||
}
|
||||
|
||||
public RefineMsg(int npcType, int npcID, int type, int token) {
|
||||
super(Protocol.ARCUNTRAINABILITY);
|
||||
this.npcType = npcType;
|
||||
this.npcID = npcID;
|
||||
this.unknown01 = 1;
|
||||
this.type = type;
|
||||
this.token = token;
|
||||
this.unknown02 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 RefineMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCUNTRAINABILITY, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.npcType);
|
||||
writer.putInt(this.npcID);
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.type);
|
||||
writer.putInt(this.token);
|
||||
writer.putInt(this.unknown02);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
this.unknown01 = reader.getInt();
|
||||
this.type = reader.getInt();
|
||||
this.token = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
}
|
||||
|
||||
public int getNpcType() {
|
||||
return this.npcType;
|
||||
}
|
||||
|
||||
public int getNpcID() {
|
||||
return this.npcID;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public int getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public int getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public void setType(int value) {
|
||||
this.type = value;
|
||||
}
|
||||
|
||||
public void setToken(int value) {
|
||||
this.token = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public static void refine(RefineMsg msg, ClientConnection origin) {
|
||||
if (origin == null)
|
||||
return;
|
||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||
if (pc == null)
|
||||
return;
|
||||
NPC npc = NPC.getFromCache(msg.npcID);
|
||||
if (npc == null)
|
||||
return;
|
||||
int type = msg.type;
|
||||
int token = msg.token;
|
||||
boolean worked = false;
|
||||
boolean skillPower = true;
|
||||
if (type == 0) { //refine skill
|
||||
worked = refineSkill(origin, pc, token, msg);
|
||||
} else if (type == 1) { //refine power
|
||||
worked = refinePower(origin, pc, token, msg);
|
||||
} else if (type == 2) { //refine stat
|
||||
worked = refineStat(origin, pc, token, msg);
|
||||
skillPower = false;
|
||||
}
|
||||
|
||||
if (worked) {
|
||||
|
||||
//update player
|
||||
pc.applyBonuses();
|
||||
pc.getCharItemManager().RemoveEquipmentFromLackOfSkill(pc, true);
|
||||
|
||||
//echo refine message back
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(pc, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
// if (type == 0 && token == 1488335491){
|
||||
// dispatch = Dispatch.borrow(pc, msg);
|
||||
// DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
// }
|
||||
|
||||
//resend refine screen
|
||||
|
||||
RefinerScreenMsg refinerScreenMsg = new RefinerScreenMsg(skillPower, npc.getSellPercent(pc)); //TODO set npc cost
|
||||
dispatch = Dispatch.borrow(pc, refinerScreenMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean refineSkill(ClientConnection origin, PlayerCharacter pc, int token, RefineMsg msg) {
|
||||
CharacterSkill skill = null;
|
||||
ConcurrentHashMap<String, CharacterSkill> skills = pc.getSkills();
|
||||
for (CharacterSkill sk : skills.values()) {
|
||||
if (sk == null)
|
||||
continue;
|
||||
SkillsBase sb = sk.getSkillsBase();
|
||||
if (sb == null)
|
||||
continue;
|
||||
if (sb.getToken() == token)
|
||||
skill = sk;
|
||||
}
|
||||
//check if player has skill to refine
|
||||
if (skill == null)
|
||||
return false;
|
||||
//check there's a train to refine
|
||||
if (skill.getNumTrains() < 1)
|
||||
return false;
|
||||
|
||||
//TODO verify if any skills have this as prereq
|
||||
|
||||
//TODO verify if any powers have this as a prereq
|
||||
|
||||
//refine skill
|
||||
return skill.refine(pc);
|
||||
}
|
||||
|
||||
private static boolean refinePower(ClientConnection origin, PlayerCharacter pc, int token, RefineMsg msg) {
|
||||
CharacterPower power = null;
|
||||
ConcurrentHashMap<Integer, CharacterPower> powers = pc.getPowers();
|
||||
if (!powers.containsKey(token))
|
||||
return false;
|
||||
power = powers.get(token);
|
||||
if (power == null)
|
||||
return false;
|
||||
if (power.getTrains() < 1)
|
||||
return false;
|
||||
|
||||
//TODO verify if any powers have this as a prereq
|
||||
|
||||
return power.refine(pc);
|
||||
}
|
||||
|
||||
private static boolean refineStat(ClientConnection origin, PlayerCharacter pc, int token, RefineMsg msg) {
|
||||
if (token == MBServerStatics.STAT_STR_ID)
|
||||
return pc.refineStr();
|
||||
if (token == MBServerStatics.STAT_DEX_ID)
|
||||
return pc.refineDex();
|
||||
if (token == MBServerStatics.STAT_CON_ID)
|
||||
return pc.refineCon();
|
||||
if (token == MBServerStatics.STAT_INT_ID)
|
||||
return pc.refineInt(msg);
|
||||
if (token == MBServerStatics.STAT_SPI_ID)
|
||||
return pc.refineSpi();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
public class RefinerScreenMsg extends ClientNetMsg {
|
||||
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
private int unknown01; //might be - 0: skills/powers, 2: stats
|
||||
private float unknown02; //cost to refine
|
||||
private int unknown03;
|
||||
private int unknown04;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public RefinerScreenMsg(boolean skillPower, float cost) {
|
||||
super(Protocol.ARCUNTRAINLIST);
|
||||
if (skillPower)
|
||||
this.unknown01 = 0; //skill/power screen
|
||||
else
|
||||
this.unknown01 = 2; //stat screen
|
||||
this.unknown02 = cost;
|
||||
this.unknown03 = 0;
|
||||
this.unknown04 = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 RefinerScreenMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCUNTRAINLIST, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(this.npcType);
|
||||
writer.putInt(this.npcID);
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putFloat(this.unknown02);
|
||||
writer.putInt(this.unknown03);
|
||||
writer.putInt(this.unknown04);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
this.unknown01 = reader.getInt();
|
||||
this.unknown02 = reader.getInt();
|
||||
this.unknown03 = reader.getInt();
|
||||
this.unknown04 = reader.getInt();
|
||||
}
|
||||
|
||||
public int getNpcType() {
|
||||
return this.npcType;
|
||||
}
|
||||
|
||||
public int getNpcID() {
|
||||
return this.npcID;
|
||||
}
|
||||
|
||||
public int getUnknown01() {
|
||||
return this.unknown01;
|
||||
}
|
||||
|
||||
public float getUnknown02() {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public int getUnknown03() {
|
||||
return this.unknown03;
|
||||
}
|
||||
|
||||
public int getUnknown04() {
|
||||
return this.unknown04;
|
||||
}
|
||||
|
||||
public void setUnknown01(int value) {
|
||||
this.unknown01 = value;
|
||||
}
|
||||
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
public void setUnknown03(int value) {
|
||||
this.unknown03 = value;
|
||||
}
|
||||
|
||||
public void setUnknown04(int value) {
|
||||
this.unknown04 = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
/**
|
||||
* Reject trade request
|
||||
*
|
||||
* @author Eighty
|
||||
*/
|
||||
public class RejectTradeRequestMsg extends ClientNetMsg {
|
||||
|
||||
private int unknown01; //pad?
|
||||
private long playerCompID;
|
||||
private long targetCompID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public RejectTradeRequestMsg(int unknown01, long playerCompID, long targetCompID) {
|
||||
super(Protocol.REQUESTTRADECANCEL);
|
||||
this.unknown01 = unknown01;
|
||||
this.playerCompID = playerCompID;
|
||||
this.targetCompID = targetCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 RejectTradeRequestMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.REQUESTTRADECANCEL, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
unknown01 = reader.getInt();
|
||||
playerCompID = reader.getLong();
|
||||
targetCompID = reader.getLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(unknown01);
|
||||
writer.putLong(playerCompID);
|
||||
writer.putLong(targetCompID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unknown01
|
||||
*/
|
||||
public int getUnknown01() {
|
||||
return unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unknown01 the unknown01 to set
|
||||
*/
|
||||
public void setUnknown01(int unknown01) {
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the playerCompID
|
||||
*/
|
||||
public long getPlayerCompID() {
|
||||
return playerCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param playerCompID the playerCompID to set
|
||||
*/
|
||||
public void setPlayerCompID(long playerCompID) {
|
||||
this.playerCompID = playerCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetCompID
|
||||
*/
|
||||
public long getTargetCompID() {
|
||||
return targetCompID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetCompID the targetCompID to set
|
||||
*/
|
||||
public void setTargetCompID(long targetCompID) {
|
||||
this.targetCompID = targetCompID;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
HashSet<Integer> playerFriendSet = PlayerFriendsMap.get(playerUID);
|
||||
playerFriendSet.add(friendUID); * Copyright 2013 MagicBane Emulator Project
|
||||
* All Rights Reserved
|
||||
*/
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class RemoveFriendMessage extends ClientNetMsg {
|
||||
|
||||
public int friendID;
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public RemoveFriendMessage(int friendID) {
|
||||
super(Protocol.REMOVEFRIEND);
|
||||
this.friendID = friendID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 RemoveFriendMessage(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.REMOVEFRIEND, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
public RemoveFriendMessage(RemoveFriendMessage msg) {
|
||||
super(Protocol.REMOVEFRIEND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied ByteBufferReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
//Do we even want to try this?
|
||||
reader.getInt();
|
||||
this.friendID = reader.getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied ByteBufferWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) {
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
writer.putInt(this.friendID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
|
||||
|
||||
public class RepairBuildingMsg extends ClientNetMsg {
|
||||
|
||||
private int type;
|
||||
private int buildingID;
|
||||
private int maxHP;
|
||||
private int missingHealth;
|
||||
private int strongBox;
|
||||
private int repairCost;
|
||||
|
||||
|
||||
|
||||
public RepairBuildingMsg(int buildingID, int maxHP, int missingHealth,int repairCost,int strongBox) {
|
||||
super(Protocol.REPAIRBUILDING);
|
||||
this.buildingID = buildingID;
|
||||
this.maxHP = maxHP;
|
||||
this.missingHealth = missingHealth;
|
||||
this.repairCost = repairCost;
|
||||
this.strongBox = strongBox;
|
||||
}
|
||||
|
||||
public RepairBuildingMsg() {
|
||||
super(Protocol.REPAIRBUILDING);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 RepairBuildingMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.REPAIRBUILDING, origin, reader);
|
||||
}
|
||||
//CALL THIS AFTER SANITY CHECKS AND BEFORE UPDATING HEALTH/GOLD.
|
||||
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
this.type = reader.getInt();
|
||||
reader.getInt(); //Building Type
|
||||
this.buildingID = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Precache and configure this message before we serialize it
|
||||
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(0);
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(this.buildingID);
|
||||
writer.putInt(this.maxHP);
|
||||
writer.putInt(this.strongBox);
|
||||
writer.putInt(0); //?
|
||||
writer.putInt(this.repairCost);
|
||||
writer.putInt(this.missingHealth);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getBuildingID() {
|
||||
return buildingID;
|
||||
}
|
||||
|
||||
public void setBuildingID(int buildingID) {
|
||||
this.buildingID = buildingID;
|
||||
}
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.Contract;
|
||||
import engine.objects.NPC;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Sell to NPC window msg
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public class RepairMsg extends ClientNetMsg {
|
||||
|
||||
//Item Types:
|
||||
//1: weapon
|
||||
//2: armor/cloth/shield
|
||||
//5: scrolls
|
||||
//8: potions
|
||||
//10: charters
|
||||
//13: Jewelry
|
||||
|
||||
private int msgType;
|
||||
//static 0
|
||||
private int unknown01; //0 or 10
|
||||
private int npcType;
|
||||
private int npcID;
|
||||
private NPC npc = null;
|
||||
private int itemType;
|
||||
private int itemID;
|
||||
private int amountRepaired;
|
||||
//static 0
|
||||
//static 0 //end repair req/ack here
|
||||
//01 inc, 00 out
|
||||
//item list
|
||||
//skill list
|
||||
//unk list
|
||||
//static 0 //out
|
||||
//static 0 //out
|
||||
//static 10000 out?
|
||||
//static 0
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor
|
||||
*/
|
||||
public RepairMsg() {
|
||||
super(Protocol.REPAIROBJECT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 RepairMsg(AbstractConnection origin, ByteBufferReader reader)
|
||||
{
|
||||
super(Protocol.REPAIROBJECT, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader)
|
||||
{
|
||||
|
||||
this.msgType = reader.getInt();
|
||||
reader.getInt();
|
||||
this.unknown01 = reader.getInt();
|
||||
this.npcType = reader.getInt();
|
||||
this.npcID = reader.getInt();
|
||||
this.itemType = reader.getInt();
|
||||
this.itemID = reader.getInt();
|
||||
this.amountRepaired = reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
|
||||
if (this.msgType == 1) {
|
||||
reader.get(); //0x00 inc
|
||||
int size = reader.getInt();
|
||||
for (int i=0;i<size;i++)
|
||||
reader.getInt();
|
||||
size = reader.getInt();
|
||||
for (int i=0;i<size;i++)
|
||||
reader.getInt();
|
||||
size = reader.getInt();
|
||||
for (int i=0;i<size;i++)
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
reader.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer)
|
||||
throws SerializationException {
|
||||
writer.putInt(this.msgType);
|
||||
writer.putInt(0);
|
||||
writer.putInt(this.unknown01);
|
||||
writer.putInt(this.npcType);
|
||||
writer.putInt(this.npcID);
|
||||
writer.putInt(this.itemType);
|
||||
writer.putInt(this.itemID);
|
||||
writer.putInt(this.amountRepaired);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
if (this.msgType == 1) {
|
||||
writer.put((byte)0x00);
|
||||
Contract c = (npc != null) ? npc.getContract() : null;
|
||||
if (c != null) {
|
||||
ArrayList<Integer> list = c.getBuyItemType();
|
||||
writer.putInt(list.size());
|
||||
for (int l : list)
|
||||
writer.putInt(l);
|
||||
list = c.getBuySkillToken();
|
||||
writer.putInt(list.size());
|
||||
for (int l : list)
|
||||
writer.putInt(l);
|
||||
list = c.getBuyUnknownToken();
|
||||
writer.putInt(list.size());
|
||||
for (int l : list)
|
||||
writer.putInt(l);
|
||||
} else {
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
writer.putInt(10000);
|
||||
writer.putInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return this.msgType;
|
||||
}
|
||||
|
||||
public int getNPCType() {
|
||||
return this.npcType;
|
||||
}
|
||||
|
||||
public int getNPCID() {
|
||||
return this.npcID;
|
||||
}
|
||||
|
||||
public int getItemType() {
|
||||
return this.itemType;
|
||||
}
|
||||
|
||||
public int getItemID() {
|
||||
return this.itemID;
|
||||
}
|
||||
|
||||
public int getAmountRepaired() {
|
||||
return this.amountRepaired;
|
||||
}
|
||||
|
||||
public NPC getNPC() {
|
||||
return this.npc;
|
||||
}
|
||||
|
||||
public void setMsgType(int value) {
|
||||
this.msgType = value;
|
||||
}
|
||||
|
||||
public void setNPCType(int value) {
|
||||
this.npcType = value;
|
||||
}
|
||||
|
||||
public void setNPCID(int value) {
|
||||
this.npcID = value;
|
||||
}
|
||||
|
||||
public void setItemType(int value) {
|
||||
this.itemType = value;
|
||||
}
|
||||
|
||||
public void setItemID(int value) {
|
||||
this.itemID = value;
|
||||
}
|
||||
|
||||
public void setAmountRrepaired(int value) {
|
||||
this.amountRepaired = value;
|
||||
}
|
||||
|
||||
public void setNPC(NPC value) {
|
||||
this.npc = value;
|
||||
}
|
||||
|
||||
public void setupRepairAck(int amountRepaired) {
|
||||
this.unknown01 = 10;
|
||||
this.amountRepaired = amountRepaired;
|
||||
}
|
||||
|
||||
public void setRepairWindowAck(NPC npc) {
|
||||
this.unknown01 = 10;
|
||||
this.npc = npc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.exception.SerializationException;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.AbstractGameObject;
|
||||
|
||||
/**
|
||||
* Bank inventory requested
|
||||
*
|
||||
* @author Burfo
|
||||
*/
|
||||
public class ReqBankInventoryMsg extends ClientNetMsg {
|
||||
|
||||
private int playerType;
|
||||
private int playerID;
|
||||
private long unknown01; // possibly NPC ID?
|
||||
|
||||
/**
|
||||
* This is the general purpose constructor.
|
||||
*/
|
||||
public ReqBankInventoryMsg(AbstractGameObject ago, long unknown01) {
|
||||
super(Protocol.OKCOSTTOOPENBANK);
|
||||
this.playerType = ago.getObjectType().ordinal();
|
||||
this.playerID = ago.getObjectUUID();
|
||||
this.unknown01 = unknown01;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ReqBankInventoryMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.OKCOSTTOOPENBANK, origin, reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
playerType = reader.getInt();
|
||||
playerID = reader.getInt();
|
||||
unknown01 = reader.getLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
writer.putInt(playerType);
|
||||
writer.putInt(playerID);
|
||||
writer.putLong(unknown01);
|
||||
}
|
||||
|
||||
public int getPlayerType() {
|
||||
return playerType;
|
||||
}
|
||||
|
||||
public void setPlayerType(int playerType) {
|
||||
this.playerType = playerType;
|
||||
}
|
||||
|
||||
public int getPlayerID() {
|
||||
return playerID;
|
||||
}
|
||||
|
||||
public void setPlayerID(int playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user