mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-27 12:12:51 -04:00
More work on RE
This commit is contained in:
@@ -13,8 +13,6 @@ def addPlanetSpawns(core, planet):
|
||||
stcSvc = core.staticService
|
||||
objSvc = core.objectService
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
building = core.objectService.getObject(long(-466404038086555772))
|
||||
|
||||
# Shinn Mugger outisde
|
||||
@@ -63,7 +61,6 @@ def addPlanetSpawns(core, planet):
|
||||
|
||||
# Vaigonn Shinn
|
||||
vaigonn_shinn = stcSvc.spawnObject('vaigon_shinn', 'tatooine', building.getCellByCellNumber(long(10)), float(1.7), float(-20.8), float(29.7), float(-1), float(0), float(0), float(0), 30)
|
||||
>>>>>>> origin/master
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FactoryCrateMessageBuilder extends TangibleMessageBuilder{
|
||||
buffer.putFloat(1.0f); //op0
|
||||
buffer.put(getAsciiString("factory_n"));
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString("food_crate"));
|
||||
buffer.put(getAsciiString(factoryCrateObject.getFactoryCrateType()));
|
||||
|
||||
if (factoryCrateObject.getCustomName().length()>0)
|
||||
buffer.put(getUnicodeString(factoryCrateObject.getCustomName()));
|
||||
|
||||
@@ -53,7 +53,9 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
private byte capacity;
|
||||
private byte contentObjectQuantity;
|
||||
private int contentCRC;
|
||||
private TangibleObject contentObjectType;
|
||||
//private TangibleObject contentObjectType;
|
||||
private String contentObjectTypeTemplate;
|
||||
private String factoryCrateType;
|
||||
|
||||
@NotPersistent
|
||||
private transient FactoryCrateMessageBuilder messageBuilder;
|
||||
@@ -75,20 +77,13 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
this.contents = new Vector<TangibleObject>();
|
||||
this.contentObjectQuantity = 0;
|
||||
this.capacity = 25;
|
||||
this.getAttributes().put("@obj_attr_n:condition", "100/100");
|
||||
this.getAttributes().put("@obj_attr_n:volume", "1");
|
||||
this.getAttributes().put("@obj_attr_n:quantity", "1");
|
||||
this.getAttributes().put("@obj_attr_n:factory_count", "1");
|
||||
this.getAttributes().put("@obj_attr_n:factory_attribs", "------------");
|
||||
this.getAttributes().put("@obj_attr_n:type", "@got_n:component");
|
||||
this.getAttributes().put("@obj_attr_n:serial_number", "123");
|
||||
|
||||
|
||||
this.factoryCrateType = "factory_crate";
|
||||
this.setStackable(true);
|
||||
}
|
||||
|
||||
public boolean setContentType(TangibleObject contentObject) {
|
||||
synchronized(objectMutex) {
|
||||
this.contentObjectType = contentObject;
|
||||
this.contentObjectTypeTemplate = contentObject.getTemplate();
|
||||
if (contentObject.getTemplate().length()>0)
|
||||
this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate());
|
||||
else
|
||||
@@ -105,13 +100,13 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public TangibleObject getContentType() {
|
||||
return this.contentObjectType;
|
||||
public String getContentType() {
|
||||
return this.contentObjectTypeTemplate;
|
||||
}
|
||||
|
||||
public boolean setContentTypeAndQuantity(TangibleObject contentObject, int quantity) {
|
||||
synchronized(objectMutex) {
|
||||
this.contentObjectType = contentObject;
|
||||
this.contentObjectTypeTemplate = contentObject.getTemplate();
|
||||
if (contentObject.getTemplate().length()>0)
|
||||
this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate());
|
||||
else{
|
||||
@@ -119,6 +114,8 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
return false; // Does it make sense to continue anyway?
|
||||
}
|
||||
|
||||
this.setCustomName(contentObject.getCustomName());
|
||||
|
||||
Map<String,String> contentAttributes = contentObject.getAttributes();
|
||||
for (Map.Entry<String, String> entry : contentAttributes.entrySet())
|
||||
{
|
||||
@@ -126,12 +123,60 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
this.getAttributes().put(entry.getKey(), entry.getValue());
|
||||
System.out.println(entry.getKey() + " " + entry.getValue());
|
||||
}
|
||||
if (quantity<capacity) {
|
||||
if (quantity<=capacity) {
|
||||
contentObject.setSerialNumber(contentObject.getSerialNumber());
|
||||
for (int i=0;i<quantity;i++){
|
||||
contents.add(contentObject);
|
||||
this.setUses(this.getUses()+1);
|
||||
this.sendAddItem(this.getClient());
|
||||
System.out.println("i " + i);
|
||||
}
|
||||
contentObjectQuantity = (byte) quantity;
|
||||
contentObjectQuantity = (byte) quantity;
|
||||
this.sendSetQuantity(this.getClient(),quantity);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setContentTypeAndQuantity(TangibleObject contentObject, int quantity, String crateType, String contentType, Client client) {
|
||||
synchronized(objectMutex) {
|
||||
this.setClient(client);
|
||||
if (crateType!=null)
|
||||
if (crateType.length()>0)
|
||||
this.factoryCrateType = crateType;
|
||||
this.contentObjectTypeTemplate = contentObject.getTemplate();
|
||||
if (contentObject.getTemplate().length()>0)
|
||||
this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate());
|
||||
else{
|
||||
this.contentCRC = 0;
|
||||
return false; // Does it make sense to continue anyway?
|
||||
}
|
||||
|
||||
this.setCustomName(contentObject.getCustomName());
|
||||
this.getAttributes().put("@obj_attr_n:condition", "100/100");
|
||||
this.getAttributes().put("@obj_attr_n:volume", "1");
|
||||
this.getAttributes().put("@obj_attr_n:quantity", "1");
|
||||
this.getAttributes().put("@obj_attr_n:factory_count", "1");
|
||||
this.getAttributes().put("@obj_attr_n:factory_attribs", "------------");
|
||||
this.getAttributes().put("@obj_attr_n:type", "@got_n:"+contentType);
|
||||
this.getAttributes().put("@obj_attr_n:serial_number", "123");
|
||||
|
||||
Map<String,String> contentAttributes = contentObject.getAttributes();
|
||||
for (Map.Entry<String, String> entry : contentAttributes.entrySet())
|
||||
{
|
||||
//if (!entry.getKey().equals(@obj_attr_n:condition))
|
||||
this.getAttributes().put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
if (quantity<=capacity) {
|
||||
contentObject.setSerialNumber(contentObject.getSerialNumber());
|
||||
for (int i=0;i<quantity;i++){
|
||||
contents.add(contentObject);
|
||||
//this.setUses(this.getUses()+1);
|
||||
this.sendAddItem(this.getClient());
|
||||
}
|
||||
contentObjectQuantity = (byte) quantity;
|
||||
this.sendSetQuantity(this.getClient(),quantity);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -166,10 +211,8 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
public void getObjectOutOfCrate(CreatureObject player,NGECore core) {
|
||||
synchronized(objectMutex) {
|
||||
if (this.getQuantity()>0){
|
||||
TangibleObject contentType = this.getContentType();
|
||||
if (contentType==null)
|
||||
return; // Bad, crate had no content type set
|
||||
TangibleObject contentItem = (TangibleObject) core.objectService.createObject(contentType.getTemplate(), player.getPlanet());
|
||||
|
||||
TangibleObject contentItem = (TangibleObject) core.objectService.createObject(contentObjectTypeTemplate, player.getPlanet());
|
||||
contentItem.setOptions(resources.datatables.Options.SERIAL, true);
|
||||
int crc = this.getContentCRC();//CRC.StringtoCRC("object/tangible/food/crafted/shared_drink_alcohol.iff");
|
||||
SceneCreateObjectByCrc createObjectMsg = new SceneCreateObjectByCrc(contentItem.getObjectID(), player.getOrientation().x, player.getOrientation().y, player.getOrientation().z, player.getOrientation().w, player.getPosition().x, player.getPosition().y, player.getPosition().z, crc, (byte) 0);
|
||||
@@ -231,6 +274,8 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
}
|
||||
|
||||
public void sendAddItem(Client destination) {
|
||||
if (destination==null)
|
||||
return;
|
||||
destination.getSession().write(messageBuilder.buildDelta3());
|
||||
this.getAttributes().put("@obj_attr_n:factory_count", ""+this.getQuantity());
|
||||
this.getAttributes().put("@obj_attr_n:quantity", ""+this.getQuantity());
|
||||
@@ -238,6 +283,8 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
}
|
||||
|
||||
public void sendSetQuantity(Client destination,int quantity) {
|
||||
if (destination==null)
|
||||
return;
|
||||
contentObjectQuantity = (byte) quantity;
|
||||
destination.getSession().write(messageBuilder.buildDelta3());
|
||||
this.getAttributes().put("@obj_attr_n:factory_count", ""+quantity);
|
||||
@@ -276,4 +323,8 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
|
||||
return messageBuilder;
|
||||
}
|
||||
|
||||
public String getFactoryCrateType(){
|
||||
return factoryCrateType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,6 +47,7 @@ import resources.datatables.DisplayType;
|
||||
import resources.loot.LootGroup;
|
||||
import resources.loot.LootRollSession;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.factorycrate.FactoryCrateObject;
|
||||
import resources.objects.group.GroupObject;
|
||||
import resources.objects.intangible.IntangibleObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
@@ -2722,10 +2723,27 @@ public class LootService implements INetworkDispatch {
|
||||
playerInventory.add(item11a);
|
||||
|
||||
|
||||
TangibleObject item12aa = (TangibleObject)core.objectService.createObject("object/tangible/wearables/shirt/shared_shirt_s07.iff", player.getPlanet());
|
||||
item12aa.setCustomName("Socketed Shirt");
|
||||
item12aa.setIntAttribute("@obj_attr_n:sockets", 1);
|
||||
playerInventory.add(item12aa);
|
||||
|
||||
TangibleObject item12 = (TangibleObject)core.objectService.createObject("object/tangible/wearables/shirt/shared_shirt_s07.iff", player.getPlanet());
|
||||
|
||||
item12.setStfFilename("wearables_name");
|
||||
item12.setStfName("shirt_s01");
|
||||
item12.setDetailFilename("wearables_detail");
|
||||
item12.setDetailName("shirt_s01");
|
||||
item12.setCustomName("Socketed Shirt");
|
||||
item12.setIntAttribute("@obj_attr_n:sockets", 1);
|
||||
playerInventory.add(item12);
|
||||
|
||||
item12.setIntAttribute("@obj_attr_n:sockets", 1);
|
||||
|
||||
String crateTemplate = "object/factory/shared_factory_crate_clothing.iff";
|
||||
FactoryCrateObject crate1 = (FactoryCrateObject) core.objectService.createObject(crateTemplate, player.getPlanet());
|
||||
crate1.setContentTypeAndQuantity(item12,25, "clothing_factory_crate", "clothing", player.getClient());
|
||||
playerInventory.add(crate1);
|
||||
|
||||
|
||||
|
||||
TangibleObject item12a = (TangibleObject)core.objectService.createObject("object/tangible/wearables/shirt/shared_shirt_s07.iff", player.getPlanet());
|
||||
item12a.setCustomName("Socketed Shirt");
|
||||
@@ -2762,6 +2780,19 @@ public class LootService implements INetworkDispatch {
|
||||
item24.setCustomName("Droid Motor (Red)");
|
||||
playerInventory.add(item24);
|
||||
|
||||
TangibleObject item24a = (TangibleObject)core.objectService.createObject("object/tangible/loot/npc_loot/shared_medical_console_generic.iff", player.getPlanet());
|
||||
item24a.setCustomName("Medical Console");
|
||||
item24a.setStackable(true);
|
||||
item24a.setUses(299);
|
||||
core.objectService.addStackableItem(item24a,playerInventory);
|
||||
|
||||
TangibleObject item24b = (TangibleObject)core.objectService.createObject("object/tangible/loot/npc_loot/shared_medical_device_generic.iff", player.getPlanet());
|
||||
item24b.setCustomName("Medical Device");
|
||||
item24b.setStackable(true);
|
||||
item24b.setUses(399);
|
||||
core.objectService.addStackableItem(item24b,playerInventory);
|
||||
|
||||
|
||||
|
||||
String modifierBitTemplate = "object/tangible/component/reverse_engineering/shared_modifier_bit.iff";
|
||||
TangibleObject modifierBit = (TangibleObject) core.objectService.createObject(modifierBitTemplate, player.getPlanet());
|
||||
|
||||
@@ -3084,8 +3084,17 @@ public class ReverseEngineeringService implements INetworkDispatch {
|
||||
System.err.println("Junkloot combination wrong/not registered yet or Junkloot names don't conform to http://www.nova-inside.com naming convention");
|
||||
return;
|
||||
}
|
||||
core.objectService.destroyObject(piece1.getObjectID());
|
||||
core.objectService.destroyObject(piece2.getObjectID());
|
||||
// core.objectService.destroyObject(piece1.getObjectID());
|
||||
// core.objectService.destroyObject(piece2.getObjectID());
|
||||
int piece1Uses = piece1.getUses()-1;
|
||||
int piece2Uses = piece2.getUses()-1;
|
||||
piece1.setUses(piece1Uses);
|
||||
piece2.setUses(piece2Uses);
|
||||
if (piece1Uses==0)
|
||||
core.objectService.destroyObject(piece1.getObjectID());
|
||||
if (piece2Uses==0)
|
||||
core.objectService.destroyObject(piece2.getObjectID());
|
||||
|
||||
int pcrIntValue = Integer.parseInt(pcr);
|
||||
String modifierBitTemplate = "object/tangible/component/reverse_engineering/shared_modifier_bit.iff";
|
||||
TangibleObject modifierBit = (TangibleObject) core.objectService.createObject(modifierBitTemplate, engineer.getPlanet());
|
||||
|
||||
Reference in New Issue
Block a user