first commit of addidtions

This commit is contained in:
CharonInferar
2014-04-13 22:29:02 +02:00
parent 161a0a8859
commit 1decfaa081
4 changed files with 220 additions and 21 deletions
@@ -53,7 +53,7 @@ import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=6)
@Persistent(version=7)
public class TangibleObject extends SWGObject {
// TODO: Thread safety
@@ -83,6 +83,8 @@ public class TangibleObject extends SWGObject {
private boolean looted = false;
private boolean lootLock = false;
private String serialNumber;
@NotPersistent
private TangibleObject killer = null;
@@ -484,13 +486,29 @@ public class TangibleObject extends SWGObject {
}
public String getSerialNumber() {
return getStringAttribute("serial_number");
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
setStringAttribute("serial_number", serialNumber);
this.serialNumber = serialNumber;
}
public void sendDelta3(Client destination) {
destination.getSession().write(messageBuilder.buildDelta3());
//tools.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"TANO3 Delta");
}
public void sendAssemblyDelta3(Client destination) {
destination.getSession().write(messageBuilder.buildAssemblyDelta3());
//tools.CharonPacketUtils.printAnalysis(messageBuilder.buildAssemblyDelta3(),"TANO3 Assembly Delta");
}
public void sendCustomizationDelta3(Client destination, String enteredName){
destination.getSession().write(messageBuilder.buildCustomNameDelta(enteredName));
//tools.CharonPacketUtils.printAnalysis(messageBuilder.buildCustomNameDelta(enteredName),"TANO3 Customization Delta");
}
@Override
public void sendBaselines(Client destination) {
+6 -2
View File
@@ -89,8 +89,9 @@ public class DevService implements INetworkDispatch {
suiOptions.put((long) 26, "Installations");
suiOptions.put((long) 110, "Survey Devices");
if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds");
if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools");
if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds");
//suiOptions.put((long) 120, "House Deeds");
break;
case 3: // [Items] Weapons
suiOptions.put((long) 30, "Jedi Weapons");
@@ -1203,7 +1204,10 @@ public class DevService implements INetworkDispatch {
deed.setBMR(15);
deed.setAttributes();
inventory.add(deed);
case 125:
TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet);
genericCraftingTool.setCustomName("Generic Crafting Tool");
inventory.add(genericCraftingTool);
return;
case 130:
TangibleObject swoopDeed = (TangibleObject) core.objectService.createObject("object/tangible/deed/vehicle_deed/shared_speederbike_swoop_deed.iff", planet);
+176
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package services.command;
import java.io.UnsupportedEncodingException;
import java.nio.ByteOrder;
import java.util.Map;
import java.util.Vector;
@@ -584,6 +585,181 @@ public class CommandService implements INetworkDispatch {
});
objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_FILLSLOT, new INetworkRemoteEvent() {
@Override
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
data.order(ByteOrder.LITTLE_ENDIAN);
Client client = core.getClient(session);
if(client == null) {
System.out.println("NULL Client");
return;
}
CommandEnqueue commandEnqueue = new CommandEnqueue();
CreatureObject actor = (CreatureObject) client.getParent();
SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID());
// StringBuilder sb = new StringBuilder();
// for (byte b : data.array()) {
// sb.append(String.format("%02X ", b));
// }
// System.out.println(sb.toString());
// 05 00 46 5E CE 80 83 00 00 00 07 01 00 00 72 14
// 09 00 00 00 00 00 00 00 00 00 04 2A 09 00 00 00
// 00 00 01 00 00 00 00 00 00 00 04 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00
long playerId = data.getLong();
data.getInt(); // 00 00 00 00
long ingredientId = data.getLong();
int slotNumber = data.getInt();
int option = data.getInt();
byte sequence = data.get();
core.craftingService.handleCraftFillSlot(playerId, ingredientId, slotNumber, option, sequence);
}
});
/*
NGE break by cAble
05 00 #Operand
46 5E CE 80 #ObjCon
83 00 00 00
07 01 00 00 #CraftFillSlot
00 2E E9 E9 31 00 00 00
00 00 00 00 #unknown
16 A5 C8 50 32 00 00 00 #ObjectID for Ingredient
01 00 00 00 #Slot01
00 00 00 00 #Option
85 #sequence
05 00 #Operand
46 5E CE 80 #ObjCon
83 00 00 00
07 01 00 00 #CraftFillSlot
00 2E E9 E9 31 00 00 00 #CharacterID
00 00 00 00 #Unknown
9D 3F EB F9 3A 00 00 00 #ObjectID for Ingredient
02 00 00 00 #Slot02
00 00 00 00 #Option
86 #Sequence
*/
objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_EMPTYSLOT, new INetworkRemoteEvent() {
@Override
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
data.order(ByteOrder.LITTLE_ENDIAN);
Client client = core.getClient(session);
if(client == null) {
System.out.println("NULL Client");
return;
}
CommandEnqueue commandEnqueue = new CommandEnqueue();
CreatureObject actor = (CreatureObject) client.getParent();
SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID());
// System.out.println("CRAFTEMPTY");
// StringBuilder sb = new StringBuilder();
// for (byte b : data.array()) {
// sb.append(String.format("%02X ", b));
// }
// System.out.println(sb.toString());
// 05 00 46 5E CE 80 83 00 00 00 08 01 00 00 B4 A1
// 0B 00 00 00 00 00 00 00 00 00 01 00 00 00 B7 A1
// 0B 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00
long playerId = data.getLong();
data.getInt(); // 00 00 00 00
int slotNumber = data.getInt();
long ingredientId = data.getLong();
byte sequence = data.get();
core.craftingService.handleCraftEmptySlot(playerId, ingredientId, slotNumber, sequence);
}
});
objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_CUSTOMIZATION, new INetworkRemoteEvent() {
@Override
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
data.order(ByteOrder.LITTLE_ENDIAN);
Client client = core.getClient(session);
if(client == null) {
System.out.println("NULL Client");
return;
}
// StringBuilder sb = new StringBuilder();
// for (byte b : data.array()) {
// sb.append(String.format("%02X ", b));
// }
// System.out.println(sb.toString());
long playerId = data.getLong();
data.getInt(); // 00 00 00 00 UTF-16LE
String enteredName = "";
int length = 2*data.order(ByteOrder.LITTLE_ENDIAN).getInt();
int bufferPosition = data.position();
try
{
enteredName = new String(data.array(), bufferPosition, length, "UTF-16LE");
}
catch (UnsupportedEncodingException e)
{
System.err.println("UnsupportedEncodingException while reading crafting customization name ");
}
System.err.println("enteredName " + enteredName);
data.position(bufferPosition + length);
byte modelNumber = data.get();
int schematicQuantity = data.getInt();
byte customizationList = data.get();
for (int i=0;i<(int)customizationList;i++){
int customizationSlot = data.getInt();
int customizationValue = data.getInt();
}
core.craftingService.handleCraftCustomization(playerId,enteredName,modelNumber,schematicQuantity,customizationList);
}
});
// 05 00 46 5E CE 80 83 00 00 00 5A 01 00 00 75 59
// 0F 00 00 00 00 00 00 00 00 00 1D 00 00 00 63 00
// 72 00 61 00 66 00 74 00 69 00 6E 00 67 00 3A 00
// 5B 00 65 00 78 00 6F 00 5F 00 70 00 72 00 6F 00
// 74 00 65 00 69 00 6E 00 5F 00 77 00 61 00 66 00
// 65 00 72 00 73 00 5D 00 FF E8 03 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
// 00 00 00 00 00 00 00 00 00 00 00 00
// USTRING: CustomName
// BYTE: ModelNumber
// INT: SchematicQuantity
// BYTE: CustomizationList
// {
// INT: CustomizationSlot
// INT: CustomizationValue
// }
}
public void shutdown() {
+17 -16
View File
@@ -98,14 +98,17 @@ import main.NGECore;
import resources.objects.Delta;
import resources.objects.building.BuildingObject;
import resources.objects.cell.CellObject;
import resources.objects.craft.DraftSchematic;
import resources.objects.creature.CreatureObject;
import resources.objects.deed.Harvester_Deed;
import resources.objects.deed.Player_House_Deed;
import resources.objects.factorycrate.FactoryCrateObject;
import resources.objects.group.GroupObject;
import resources.objects.guild.GuildObject;
import resources.objects.harvester.HarvesterObject;
import resources.objects.installation.InstallationObject;
import resources.objects.intangible.IntangibleObject;
import resources.objects.manufacture.ManufactureSchematicObject;
import resources.objects.mission.MissionObject;
import resources.objects.player.PlayerObject;
import resources.objects.resource.GalacticResource;
@@ -385,6 +388,18 @@ public class ObjectService implements INetworkDispatch {
object = new ResourceContainerObject(objectID, planet, Template, position, orientation);
} else if(Template.startsWith("object/factory/shared_factory_crate")) {
object = new FactoryCrateObject(objectID, planet, Template, position, orientation);
} else if(Template.startsWith("object/draft_schematic")) {
object = new DraftSchematic(objectID, planet, Template, position, orientation);
} else if(Template.startsWith("object/manufacture_schematic")) {
object = new ManufactureSchematicObject(objectID, planet, Template, position, orientation);
} else if(Template.startsWith("object/installation/mining_ore/construction")) {
float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f;
@@ -655,24 +670,10 @@ public class ObjectService implements INetworkDispatch {
}
public CreatureObject getCreatureFromDB(long objectId) {
CreatureObject object = core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class);
if (object != null && getObject(object.getObjectID()) == null) {
loadServerTemplate(object);
object.viewChildren(object, true, true, new Traverser() {
public void process(SWGObject child) {
loadServerTemplate(child);
}
});
}
return object;
return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class);
}
public long generateObjectID() {
private long generateObjectID() {
/*Random random = new Random();
long objectID = random.nextInt();