mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-11 21:45:43 -04:00
Added "New Items" reward packet (ShowLootBox)
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import sys
|
||||
from engine.resources.scene import Point3D
|
||||
from protocol.swg import CommPlayerMessage
|
||||
from protocol.swg.objectControllerObjects import ShowLootBox
|
||||
from protocol.swg import ObjControllerMessage
|
||||
|
||||
def setup():
|
||||
return
|
||||
@@ -11,6 +14,9 @@ def run(core, actor, target, commandString):
|
||||
if not playerObject:
|
||||
return
|
||||
|
||||
if target is not None:
|
||||
print ('has target!')
|
||||
|
||||
commandArgs = commandString.split(' ')
|
||||
command = commandArgs[0]
|
||||
if len(commandArgs) > 1:
|
||||
@@ -51,5 +57,20 @@ def run(core, actor, target, commandString):
|
||||
|
||||
elif command == 'changeBio' and arg1:
|
||||
actor.getSlottedObject('ghost').setBiography(arg1)
|
||||
|
||||
|
||||
elif command == 'rewardMe':
|
||||
testObject = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_t21.iff', actor.getPlanet())
|
||||
testObject.setCustomName('Crush4r')
|
||||
testObject.setStringAttribute('crafter', 'Wavescrub')
|
||||
actor.getSlottedObject('inventory').add(testObject)
|
||||
listedRewards = [testObject]
|
||||
rewards = ShowLootBox(actor.getObjectId(), listedRewards)
|
||||
objMessage = ObjControllerMessage(11, rewards)
|
||||
actor.getClient().getSession().write(objMessage.serialize())
|
||||
|
||||
return
|
||||
|
||||
elif command == 'comm':
|
||||
comm = CommPlayerMessage(actor.getObjectId())
|
||||
actor.getClient().getSession().write(comm.serialize())
|
||||
return
|
||||
|
||||
@@ -31,9 +31,12 @@ import engine.resources.common.CRC;
|
||||
|
||||
public class CommPlayerMessage extends SWGMessage {
|
||||
|
||||
public CommPlayerMessage() {
|
||||
|
||||
private long objectId;
|
||||
|
||||
public CommPlayerMessage(long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
@@ -48,20 +51,26 @@ public class CommPlayerMessage extends SWGMessage {
|
||||
|
||||
buffer.put((byte) 0); // aurebesh borders on comm, space version? Can cause crashes
|
||||
|
||||
//buffer.putInt(0x3E46EED5);
|
||||
buffer.putInt(0); // some random number, can be 0, doesn't seem to affect anything
|
||||
buffer.putLong(objectId);
|
||||
|
||||
buffer.putInt(51); // unknown, seems to always be 51
|
||||
buffer.putInt(54); // unknown, changes for each comm message (counter?)
|
||||
/*Seen numbers:
|
||||
* 52 (Starting Station Comms)
|
||||
* 54 (Tansarii Comms)
|
||||
* 57 (Supply Drops)
|
||||
* 58 (Faction Covert->Overt)
|
||||
* 68 (Imperial stop)
|
||||
*
|
||||
*/
|
||||
buffer.putInt(57); // unknown, changes for each comm message (counter?)
|
||||
|
||||
buffer.putShort((short) 0); // unknonw flag, seems to do nothing
|
||||
buffer.put((byte) 1); // unknown, always 0
|
||||
buffer.put((byte) 0); // unknown, always 0 except for imperial stop message
|
||||
|
||||
buffer.putInt(0xFFFFFFFF);
|
||||
|
||||
buffer.put(getAsciiString("npe_hangar_1")); // StfFile
|
||||
buffer.put(getAsciiString("stormtrooper")); // StfFile
|
||||
buffer.putInt(0); // stf spacer
|
||||
buffer.put(getAsciiString("droid_xp_bar")); // StfName
|
||||
buffer.put(getAsciiString("u11")); // StfName
|
||||
|
||||
buffer.putInt(0); // stf spacer
|
||||
buffer.putLong(0);
|
||||
@@ -75,12 +84,13 @@ public class CommPlayerMessage extends SWGMessage {
|
||||
buffer.put((byte) 0);
|
||||
|
||||
// Officer Supply Drop: 0x3E894347
|
||||
buffer.putInt(0xF19429F0); // model crc
|
||||
// Rebel Faction Dude: 0x528CB3D7
|
||||
buffer.putInt(0x528CB3D7); // model crc, can be anything w/o crashing
|
||||
|
||||
buffer.put(getAsciiString("sound/vo_c3po_9a.snd")); // does not cause crash when changing to anything
|
||||
buffer.putInt(0); // sound
|
||||
|
||||
buffer.putShort((short) 0); // unk
|
||||
buffer.putShort((short) 16544); // comm display time, unsure on how it's calculated
|
||||
buffer.putShort((short) 16576); // comm display time, unsure on how it's calculated
|
||||
buffer.flip();
|
||||
Console.println("CPM: " + StringUtilities.bytesToHex(buffer.array()));
|
||||
return buffer;
|
||||
|
||||
@@ -26,11 +26,13 @@ import java.nio.ByteOrder;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
|
||||
|
||||
import protocol.swg.objectControllerObjects.CommandEnqueue;
|
||||
import protocol.swg.objectControllerObjects.DataTransform;
|
||||
import protocol.swg.objectControllerObjects.DataTransformWithParent;
|
||||
import protocol.swg.objectControllerObjects.ObjControllerObject;
|
||||
import protocol.swg.objectControllerObjects.UnknownObjController;
|
||||
import resources.common.StringUtilities;
|
||||
|
||||
public class ObjControllerMessage extends SWGMessage {
|
||||
|
||||
@@ -55,6 +57,7 @@ public class ObjControllerMessage extends SWGMessage {
|
||||
public static final int ANIMATION = 0x00F2;
|
||||
public static final int BUFF_BUILDER_START = 0x025C;
|
||||
public static final int BUFF_BUILDER_CHANGE = 0x025A;
|
||||
public static final int SHOW_LOOT_BOX = 0x04BC;
|
||||
|
||||
public ObjControllerMessage() {
|
||||
|
||||
@@ -78,7 +81,7 @@ public class ObjControllerMessage extends SWGMessage {
|
||||
buffer.putInt(0x80CE5E46);
|
||||
buffer.putInt(update);
|
||||
buffer.put(objControllerObject.serialize());
|
||||
//System.out.println("OBJMSG: " + buffer.flip().getHexDump());
|
||||
//System.out.println("OBJMSG: " + StringUtilities.bytesToHex(buffer.flip().array()));
|
||||
int size = buffer.position();
|
||||
return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013 <Project SWG>
|
||||
*
|
||||
* This File is part of NGECore2.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
|
||||
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
|
||||
******************************************************************************/
|
||||
package protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.objects.SWGObject;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import resources.common.StringUtilities;
|
||||
|
||||
public class ShowLootBox extends ObjControllerObject {
|
||||
|
||||
private long playerId;
|
||||
private List<SWGObject> rewards;
|
||||
|
||||
public ShowLootBox(long playerId, List<SWGObject> rewards) {
|
||||
this.playerId = playerId;
|
||||
this.rewards = rewards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
// Controller Type = 11
|
||||
IoBuffer buffer = IoBuffer.allocate(20 + (rewards.size() * 8)).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putInt(ObjControllerMessage.SHOW_LOOT_BOX);
|
||||
buffer.putLong(playerId);
|
||||
|
||||
buffer.putInt(1); // 0 for a black background on icon, 1 for transparent (default)
|
||||
|
||||
buffer.putInt(rewards.size());
|
||||
for(SWGObject obj : rewards) {
|
||||
buffer.putLong(obj.getObjectID());
|
||||
}
|
||||
|
||||
return buffer.flip();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user