// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // 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.NPC; public class TrainMsg extends ClientNetMsg { public int npcType; public int npcID; private int unknown01 = 1; private int trainCost01; //why two trainer costs? private int trainCost02; //why two trainer costs? public boolean isSkill; //true: skill; false: power public int token; private boolean unknown02 = true; private String ok = ""; private int unknown03 = 0; /** * This is the general purpose constructor. */ public TrainMsg() { super(Protocol.TRAINSKILL); } /** * 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 TrainMsg(AbstractConnection origin, ByteBufferReader reader) { super(Protocol.TRAINSKILL, origin, reader); } public static float getTrainPercent(NPC npc) { return 0f; } /** * 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(trainCost01); writer.putInt(trainCost02); writer.put((this.isSkill == true) ? (byte) 0x01 : (byte) 0x00); writer.putInt(this.token); writer.put((this.unknown02 == true) ? (byte) 0x01 : (byte) 0x00); writer.putString(this.ok); writer.putInt(this.unknown03); } /** * 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.trainCost01 = reader.getInt(); this.trainCost02 = reader.getInt(); this.isSkill = (reader.get() == (byte) 0x01) ? true : false; this.token = reader.getInt(); this.unknown02 = (reader.get() == (byte) 0x01) ? true : false; this.ok = reader.getString(); this.unknown03 = reader.getInt(); } public int getToken() { return this.token; } public boolean isSkill() { return this.isSkill; } public int getNpcType() { return this.npcType; } public int getNpcID() { return this.npcID; } }