Added BuildABuff Packet

This commit is contained in:
Waverunner
2013-11-10 16:33:41 -05:00
parent 87d4bb0829
commit cc24adeea6
8 changed files with 267 additions and 6 deletions
+13
View File
@@ -0,0 +1,13 @@
from protocol.swg.objectControllerObjects import BuffBuilderStartMessage
from protocol.swg import ObjControllerMessage
import sys
def setup():
return
def run(core, actor, target, commandString):
print ('Buffing Player: ' + str(target.getObjectId()))
openBuffWindow = BuffBuilderStartMessage(actor.getObjectId(), target.getObjectId())
objController = ObjControllerMessage(11, openBuffWindow)
actor.getClient().getSession().write(objController.serialize())
return
+1
View File
@@ -226,6 +226,7 @@ public class NGECore {
zoneDispatch.addService(mapService);
zoneDispatch.addService(travelService);
zoneDispatch.addService(playerService);
zoneDispatch.addService(buffService);
zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT"));
zoneServer.start();
+3 -1
View File
@@ -53,6 +53,8 @@ public class ObjControllerMessage extends SWGMessage {
public static final int SHOW_FLY_TEXT = 0x01BD;
public static final int START_TASK = 0x448;
public static final int ANIMATION = 0x00F2;
public static final int BUFF_BUILDER_START = 0x025C;
public static final int BUFF_BUILDER_CHANGE = 0x025A;
public ObjControllerMessage() {
@@ -76,7 +78,7 @@ public class ObjControllerMessage extends SWGMessage {
buffer.putInt(0x80CE5E46);
buffer.putInt(update);
buffer.put(objControllerObject.serialize());
//System.out.println("OBJMSG: " + buffer.flip().getHexDump());
int size = buffer.position();
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
}
@@ -0,0 +1,147 @@
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
public class BuffBuilderChange extends ObjControllerObject {
private long bufferId;
private long recipientId;
private int buffCost;
private int accepted;
private long unk1;
private long unk2;
private long unk3;
private int unkI1;
private int unkI2;
private byte unkByte;
public BuffBuilderChange() {
}
public BuffBuilderChange(long bufferId, long recipientId, int accepted, int cost) {
this.bufferId = bufferId;
this.recipientId = recipientId;
this.accepted = accepted;
this.buffCost = cost;
}
@Override
public void deserialize(IoBuffer data) {
unk1 = data.getLong();
unkI1 = data.getInt();
unk2 = data.getLong();
unk3 = data.getLong();
unkI2 = data.getInt();
buffCost = data.getInt();
accepted = data.getInt();
unkByte = data.get();
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE);
result.putLong(unk1);
result.putInt(unkI1); // tickCount
result.putLong(unk2);
result.putLong(unk3);
result.putInt(unkI2); // starting time
result.putInt(buffCost);
result.putInt(accepted);
result.put(unkByte); // unk
//return result.flip();
return result.flip();
}
public long getBufferId() {
return bufferId;
}
public void setBufferId(long bufferId) {
this.bufferId = bufferId;
}
public long getRecipientId() {
return recipientId;
}
public void setRecipientId(long recipientId) {
this.recipientId = recipientId;
}
public int getBuffCost() {
return buffCost;
}
public void setBuffCost(int buffCost) {
this.buffCost = buffCost;
}
public int getAccepted() {
return accepted;
}
public void setAccepted(int accepted) {
this.accepted = accepted;
}
public long getUnk1() {
return unk1;
}
public void setUnk1(long unk1) {
this.unk1 = unk1;
}
public long getUnk2() {
return unk2;
}
public void setUnk2(long unk2) {
this.unk2 = unk2;
}
public long getUnk3() {
return unk3;
}
public void setUnk3(long unk3) {
this.unk3 = unk3;
}
public int getUnkI1() {
return unkI1;
}
public void setUnkI1(int unkI1) {
this.unkI1 = unkI1;
}
public int getUnkI2() {
return unkI2;
}
public void setUnkI2(int unkI2) {
this.unkI2 = unkI2;
}
public byte getUnkByte() {
return this.unkByte;
}
public void setUnkByte(byte unkByte) {
this.unkByte = unkByte;
}
}
@@ -0,0 +1,57 @@
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
public class BuffBuilderStartMessage extends ObjControllerObject {
private long objectId;
private long recieverId;
public BuffBuilderStartMessage(long objectId, long recieverId) {
this.objectId = objectId;
this.recieverId = recieverId;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(37).order(ByteOrder.LITTLE_ENDIAN);
//0B 00 00-00 # flag (11)
result.putInt(ObjControllerMessage.BUFF_BUILDER_START);
result.putLong(objectId);
result.putInt(0); // tick count
result.putLong(objectId);
result.putLong(recieverId);
//System.out.println("BBMSG: " + result.flip().getHexDump());
return result.flip();
}
public long getObjectId() {
return objectId;
}
public void setObjectId(long objectId) {
this.objectId = objectId;
}
public long getRecieverId() {
return recieverId;
}
public void setRecieverId(long recieverId) {
this.recieverId = recieverId;
}
}
@@ -30,5 +30,5 @@ public class ObjControllerOpcodes {
public static final int OBJECT_MENU_REQUEST = 0x46010000;
public static final int SECURE_TRADE = 0x15010000;
public static final int USE_STATIC_OBJECT = 0x26010000;
public static final int BUFF_BUILDER_CHANGE = 0x5A020000;
}
+44 -4
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package services;
import java.nio.ByteOrder;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -28,14 +29,25 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import protocol.swg.objectControllerObjects.BuffBuilderChange;
import protocol.swg.objectControllerObjects.BuffBuilderStartMessage;
import resources.common.Console;
import resources.common.FileUtilities;
import resources.common.ObjControllerOpcodes;
import resources.objects.Buff;
import resources.objects.DamageOverTime;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import main.NGECore;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
@@ -49,8 +61,36 @@ public class BuffService implements INetworkDispatch {
}
@Override
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> arg0, Map<Integer, INetworkRemoteEvent> arg1) {
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> swgOpcodes, Map<Integer, INetworkRemoteEvent> objControllerOpcodes) {
// BUFF_BUILDER_CHANGE sent every time something is clicked on in the Buff Builder. It's also sent when the buff session is started.
objControllerOpcodes.put(ObjControllerOpcodes.BUFF_BUILDER_CHANGE, new INetworkRemoteEvent() {
@Override
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
Console.println("BUFF_BUILDER_CHANGE RECIEVED");
data.order(ByteOrder.LITTLE_ENDIAN);
BuffBuilderChange changeMessage = new BuffBuilderChange();
changeMessage.deserialize(data);
//Console.println("Unknown Long 1 (objId?): " + changeMessage.getUnk1());
//Console.println("Unknown Int 1 (tickCount?): " + changeMessage.getUnkI1());
//Console.println("Unknown Long 2 (objId?): " + changeMessage.getUnk2());
//Console.println("Unknown Long 3 (buff or buffer?): " + changeMessage.getUnk3());
//Console.println("Unknown Int 2 (???): " + changeMessage.getUnkI2());
//Console.println("Unknown Int 3 (buffCost?): " + changeMessage.getBuffCost());
//Console.println("Unknown Int 4 (accepted?): " + changeMessage.getAccepted());
//Console.println("Unknown Byte: " + changeMessage.getUnkByte());
//CreatureObject player = (CreatureObject) core.objectService.getObject(changeMessage.getUnk1());
//if (player == null)
//return;
//BuffBuilderStartMessage startMsg = new BuffBuilderStartMessage(changeMessage.getBufferId(), changeMessage.getUnknown());
//player.getClient().getSession().write(startMsg.serialize());
}
});
}
@Override
+1
View File
@@ -141,6 +141,7 @@ public class SimulationService implements INetworkDispatch {
core.commandService.registerCommand("purchaseticket");
core.commandService.registerCommand("boardshuttle");
core.commandService.registerCommand("getplayerid");
core.commandService.registerCommand("inspire");
}