RE Factory Crates, PUP procs, Multi-color junk

- Factory crate correctly implemented for REing
- PUPs proc initial steps, needs to be further developed
- Multi-colored junk items name handling added
This commit is contained in:
CharonInferar
2014-06-10 02:53:49 +02:00
parent 7c60f7a0b5
commit 08e2ac69a3
18 changed files with 390 additions and 89 deletions
+8
View File
@@ -0,0 +1,8 @@
import sys
def setup():
return
def run(core, actor, target, commandString):
target.splitFactoryCrate(actor,target,commandString)
return
@@ -4,5 +4,6 @@ def setup():
return
def run(core, actor, target, commandString):
owner.sendSystemMessage('option ', 0)
target.splitContainer(actor,target,commandString)
return
@@ -0,0 +1,36 @@
def itemTemplate():
return ['object/tangible/loot/npc_loot/shared_wiring_generic.iff']
def customItemName():
return 'Wiring'
def lootDescriptor():
return 'customattributes'
def customizationAttributes():
return ['/private/index_color_1']
def customizationValues():
return [1]
def reverse_engineering_name():
return 'White'
def stackable():
return 1
def junkDealerPrice():
return 12
def junkType():
return 0
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'item/factory_crate')
return
+19
View File
@@ -0,0 +1,19 @@
from resources.common import RadialOptions
import sys
def createRadial(core, owner, target, radials):
radials.clear()
radials.add(RadialOptions(0, 44, 0, 'Get Item From Crate'))
radials.add(RadialOptions(0, 49, 0, 'Split'))
radials.add(RadialOptions(0, 7, 0, 'Examine'))
radials.add(RadialOptions(0, 15, 0, 'Destroy'))
return
def handleSelection(core, owner, target, option):
if option == 44 and target:
target.getObjectOutOfCrate(owner)
if option == 15 and target:
core.objectService.destroyObject(target)
#if option == 49 and target:
#target.splitFactoryCrate(owner, target, option)
return
@@ -42,6 +42,7 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.ObjectMessageBuilder;
import resources.objects.creature.CreatureObject;
import resources.objects.resource.ResourceContainerObject;
import resources.objects.tangible.TangibleObject;
@Persistent(version=0)
@@ -55,7 +56,11 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
private int contentCRC;
//private TangibleObject contentObjectType;
private String contentObjectTypeTemplate;
private String contentObjectType;
private String factoryCrateType;
private Map<String,String> contentAttributes;
private String contentFilename;
private String crateSerialNumber;
@NotPersistent
private transient FactoryCrateMessageBuilder messageBuilder;
@@ -74,11 +79,11 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
public FactoryCrateObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) {
super(objectID, planet, position, orientation, template);
this.messageBuilder = new FactoryCrateMessageBuilder(this);
this.contents = new Vector<TangibleObject>();
this.contentObjectQuantity = 0;
this.capacity = 25;
this.factoryCrateType = "factory_crate";
this.setStackable(true);
this.contentObjectType = "";
//this.setStackable(true);
}
public boolean setContentType(TangibleObject contentObject) {
@@ -88,8 +93,8 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate());
else
this.contentCRC = 0;
Map<String,String> contentAttributes = contentObject.getAttributes();
contentAttributes = contentObject.getAttributes();
for (Map.Entry<String, String> entry : contentAttributes.entrySet())
{
//if (!entry.getKey().equals(@obj_attr_n:condition))
@@ -101,7 +106,7 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
}
public String getContentType() {
return this.contentObjectTypeTemplate;
return this.contentObjectType;
}
public boolean setContentTypeAndQuantity(TangibleObject contentObject, int quantity) {
@@ -116,7 +121,7 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
this.setCustomName(contentObject.getCustomName());
Map<String,String> contentAttributes = contentObject.getAttributes();
contentAttributes = contentObject.getAttributes();
for (Map.Entry<String, String> entry : contentAttributes.entrySet())
{
//if (!entry.getKey().equals(@obj_attr_n:condition))
@@ -124,9 +129,9 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
System.out.println(entry.getKey() + " " + entry.getValue());
}
if (quantity<=capacity) {
contentObject.setSerialNumber(contentObject.getSerialNumber());
this.setSerialNumber(contentObject.getSerialNumber());
for (int i=0;i<quantity;i++){
contents.add(contentObject);
//contents.add(contentObject);
this.setUses(this.getUses()+1);
this.sendAddItem(this.getClient());
System.out.println("i " + i);
@@ -139,13 +144,18 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
}
}
public boolean setContentTypeAndQuantity(TangibleObject contentObject, int quantity, String crateType, String contentType, Client client) {
public boolean setContentTypeAndQuantity(TangibleObject contentObject, int quantity, String crateType, String contentType, Client client, boolean destroyContentObject) {
synchronized(objectMutex) {
this.setClient(client);
if (crateType!=null)
if (crateType.length()>0)
this.factoryCrateType = crateType;
if (contentType!=null)
if (contentType.length()>0)
this.contentObjectType = contentType;
this.contentObjectTypeTemplate = contentObject.getTemplate();
contentFilename = contentObject.getStfFilename();
if (contentObject.getTemplate().length()>0)
this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate());
else{
@@ -153,6 +163,12 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
return false; // Does it make sense to continue anyway?
}
if (contentObject.getSerialNumber()==null){
crateSerialNumber = main.NGECore.getInstance().reverseEngineeringService.createSerialNumber();
} else {
crateSerialNumber = contentObject.getSerialNumber();
}
this.setCustomName(contentObject.getCustomName());
this.getAttributes().put("@obj_attr_n:condition", "100/100");
this.getAttributes().put("@obj_attr_n:volume", "1");
@@ -160,25 +176,32 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
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");
if (contentObject.getStringAttribute("@obj_attr_n:original_name")!=null)
this.getAttributes().put("@obj_attr_n:original_name", contentObject.getStringAttribute("@obj_attr_n:original_name"));
if (contentObject.getStringAttribute("@obj_attr_n:crafter")!=null)
this.getAttributes().put("@obj_attr_n:crafter", contentObject.getStringAttribute("@obj_attr_n:crafter"));
this.getAttributes().put("@obj_attr_n:serial_number", crateSerialNumber);
Map<String,String> contentAttributes = contentObject.getAttributes();
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 (entry.getKey()!=null && entry.getValue()!=null)
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;
}
if (quantity<=capacity) {
//this.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);
if (destroyContentObject)
main.NGECore.getInstance().objectService.destroyObject(contentObject.getObjectID());
return true;
}
return false;
}
}
@@ -186,11 +209,11 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
public boolean addToCrate(TangibleObject contentObject) {
synchronized(objectMutex) {
if (contentObjectQuantity<capacity) {
if (! contents.isEmpty()) {
TangibleObject serialProvider = contents.firstElement();
contentObject.setSerialNumber(serialProvider.getSerialNumber());
}
contents.add(contentObject);
// if (! contents.isEmpty()) {
// TangibleObject serialProvider = contents.firstElement();
// contentObject.setSerialNumber(serialProvider.getSerialNumber());
// }
//contents.add(contentObject);
contentObjectQuantity ++;
return true;
@@ -201,32 +224,46 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
public String getContentFilename() {
if (!contents.isEmpty()) {
return contents.firstElement().getStfFilename();
// return contents.firstElement().getStfFilename();
return contentFilename;
} else {
System.err.println("Crate is empty");
}
return null;
}
public void getObjectOutOfCrate(CreatureObject player,NGECore core) {
public void getObjectOutOfCrate(CreatureObject player) {
synchronized(objectMutex) {
if (this.getQuantity()>0){
NGECore core = main.NGECore.getInstance();
if (this.getQuantity()>0){
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);
player.getClient().getSession().write(createObjectMsg.serialize());
contentItem.sendBaselines(player.getClient()); // TANO 3,6,8,9 Baselines
SceneEndBaselines sceneEndBaselinesMsg = new SceneEndBaselines(contentItem.getObjectID());
player.getClient().getSession().write(sceneEndBaselinesMsg.serialize());
contentItem.setSerialNumber(this.getSerialNumber());
// 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);
// player.getClient().getSession().write(createObjectMsg.serialize());
// contentItem.sendBaselines(player.getClient()); // TANO 3,6,8,9 Baselines
// SceneEndBaselines sceneEndBaselinesMsg = new SceneEndBaselines(contentItem.getObjectID());
// player.getClient().getSession().write(sceneEndBaselinesMsg.serialize());
for (Map.Entry<String, String> entry : contentAttributes.entrySet()){
//contentItem.getAttributes().put(entry.getKey(),entry.getValue());
System.out.println("entry.getKey()"+entry.getKey());
System.out.println("entry.getValue()"+entry.getValue());
if (entry.getKey()!=null && entry.getValue()!=null)
contentItem.setStringAttribute(entry.getKey(),entry.getValue());
}
contentItem.setCustomName(this.getCustomName());
long parentId = this.getParentId();
SWGObject parentContainer = core.objectService.getObject(parentId);
if (parentContainer==null)
return; // crate has no parent, error
UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(contentItem.getObjectID(), parentContainer.getObjectID(), -1);
player.getClient().getSession().write(updateContainmentMessage.serialize());
// UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(contentItem.getObjectID(), parentContainer.getObjectID(), -1);
// player.getClient().getSession().write(updateContainmentMessage.serialize());
parentContainer.add(contentItem);
this.sendSetQuantity(player.getClient(),this.getQuantity()-1);
if (this.getQuantity()==0){ // Crate is empty now, delete it
@@ -253,10 +290,11 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
}
public String getSerialNumber() {
if (!contents.isEmpty()) {
return contents.firstElement().getSerialNumber();
}
return "";
// if (!contents.isEmpty()) {
// return contents.firstElement().getSerialNumber();
// }
return crateSerialNumber;
//return "";
}
public int getContentCRC() {
@@ -269,9 +307,45 @@ public class FactoryCrateObject extends TangibleObject implements Serializable {
}
}
public void handleSplit(){
}
public void splitFactoryCrate(CreatureObject owner, FactoryCrateObject originalObject, String commandString){
String[] splitArray = commandString.split(" ");
if (splitArray.length<3)
return;
int cloneStackQuantity= Integer.parseInt(splitArray[0]);
int parentcontainerID= Integer.parseInt(splitArray[1]);
SWGObject objectParentContainer = (SWGObject) NGECore.getInstance().objectService.getObject(parentcontainerID);
if (objectParentContainer==null || originalObject==null)
return;
FactoryCrateObject newCrateObject = (FactoryCrateObject) NGECore.getInstance().objectService.createObject(originalObject.getTemplate(), owner.getPlanet());
//newCrateObject.cloneStats(originalObject);
TangibleObject contentItem = (TangibleObject) NGECore.getInstance().objectService.createObject(contentObjectTypeTemplate, owner.getPlanet());
contentItem.setOptions(resources.datatables.Options.SERIAL, true);
//contentItem.setSerialNumber(this.getSerialNumber());
for (Map.Entry<String, String> entry : contentAttributes.entrySet()){
//contentItem.getAttributes().put(entry.getKey(),entry.getValue());
System.out.println("entry.getKey()"+entry.getKey());
System.out.println("entry.getValue()"+entry.getValue());
if (entry.getKey()!=null && entry.getValue()!=null)
contentItem.setStringAttribute(entry.getKey(),entry.getValue());
}
contentItem.setCustomName(this.getCustomName());
newCrateObject.setContentTypeAndQuantity(contentItem,cloneStackQuantity, originalObject.getFactoryCrateType(), originalObject.getContentType(), owner.getClient(),true);
newCrateObject.getAttributes().put("@obj_attr_n:factory_count", ""+cloneStackQuantity);
newCrateObject.getAttributes().put("@obj_attr_n:quantity", ""+cloneStackQuantity);
//newCrateObject.sendSetQuantity(owner.getClient(), cloneStackQuantity);
originalObject.sendSetQuantity(owner.getClient(), originalObject.getQuantity()-cloneStackQuantity);
objectParentContainer.add(newCrateObject);
}
public void sendAddItem(Client destination) {
if (destination==null)
+11 -30
View File
@@ -617,6 +617,7 @@ public class LootService implements INetworkDispatch {
String requiredFaction = "";
Vector<String> customizationAttributes = null;
Vector<Integer> customizationValues = null;
Vector<String> reverse_engineering_name = null;
int customColor1 = 0;
String lootDescriptor = "";
Vector<String> itemStats = null;
@@ -650,6 +651,9 @@ public class LootService implements INetworkDispatch {
if(core.scriptService.getMethod(itemPath,"","customizationValues")!=null)
customizationValues = (Vector<Integer>)core.scriptService.fetchIntegerVector(itemPath,"customizationValues");
if(core.scriptService.getMethod(itemPath,"","reverse_engineering_name")!=null)
reverse_engineering_name = (Vector<String>)core.scriptService.fetchStringVector(itemPath,"reverse_engineering_name");
if(core.scriptService.getMethod(itemPath,"","customColor1")!=null)
customColor1 = (Integer)core.scriptService.fetchInteger(itemPath,"customColor1");
@@ -699,6 +703,7 @@ public class LootService implements INetworkDispatch {
droppedItem.setAttachment("LootItemName", itemName);
droppedItem.setAttachment("customColor1", customColor1);
droppedItem.setAttachment("lootDescriptor", lootDescriptor);
droppedItem.setAttachment("reverse_engineering_name", reverse_engineering_name);
droppedItem.setAttachment("customName", customName);
@@ -1321,7 +1326,7 @@ public class LootService implements INetworkDispatch {
droppedItem.setCustomizationVariable(customizationAttributes.get(i), value);
}
}
}
public void handleSpecialItems(TangibleObject droppedItem,String itemName) {
@@ -2735,12 +2740,13 @@ public class LootService implements INetworkDispatch {
item12.setDetailFilename("wearables_detail");
item12.setDetailName("shirt_s01");
item12.setCustomName("Socketed Shirt");
item12.getAttributes().put("@obj_attr_n:crafter", "Charon");
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());
crate1.setContentTypeAndQuantity(item12,25, "clothing_factory_crate", "clothing", player.getClient(),true);
playerInventory.add(crate1);
@@ -2764,21 +2770,11 @@ public class LootService implements INetworkDispatch {
powerBit2.setAttachment("PowerBitOrder", 3);
playerInventory.add(powerBit2);
TangibleObject powerBit3 = (TangibleObject) core.objectService.createObject(powerBitTemplate, player.getPlanet());
powerBit3.setCustomName("+25 1st Order Power Bit");
powerBit3.setAttachment("PowerBitValue", 25);
powerBit3.setAttachment("PowerBitOrder", 1);
playerInventory.add(powerBit3);
TangibleObject item23 = (TangibleObject)core.objectService.createObject("object/tangible/component/reverse_engineering/shared_modifier_bit.iff", player.getPlanet());
item23.setCustomName("Mark X Vocab Module");
playerInventory.add(item23);
TangibleObject item24 = (TangibleObject)core.objectService.createObject("object/tangible/component/reverse_engineering/shared_modifier_bit.iff", player.getPlanet());
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");
@@ -2797,40 +2793,25 @@ public class LootService implements INetworkDispatch {
String modifierBitTemplate = "object/tangible/component/reverse_engineering/shared_modifier_bit.iff";
TangibleObject modifierBit = (TangibleObject) core.objectService.createObject(modifierBitTemplate, player.getPlanet());
modifierBit.setCustomName("Droid Experimentation");
modifierBit.setStringAttribute("serial_number", "(WHATEVER)");
modifierBit.setStringAttribute("serial_number", core.reverseEngineeringService.createSerialNumber());
modifierBit.setStringAttribute("@crafting:mod_bit_type", "@stat_n:droid_experimentation");
modifierBit.setIntAttribute("@crafting:mod_bit_ratio", 4);
playerInventory.add(modifierBit);
modifierBit = (TangibleObject) core.objectService.createObject(modifierBitTemplate, player.getPlanet());
modifierBit.setCustomName("Droid Experimentation");
modifierBit.setStringAttribute("serial_number", "(WHATEVER)");
modifierBit.setStringAttribute("serial_number", core.reverseEngineeringService.createSerialNumber());
modifierBit.setStringAttribute("@crafting:mod_bit_type", "@stat_n:droid_experimentation");
modifierBit.setIntAttribute("@crafting:mod_bit_ratio", 4);
playerInventory.add(modifierBit);
modifierBit = (TangibleObject) core.objectService.createObject(modifierBitTemplate, player.getPlanet());
modifierBit.setCustomName("Droid Experimentation");
modifierBit.setStringAttribute("serial_number", "(WHATEVER)");
modifierBit.setStringAttribute("serial_number", core.reverseEngineeringService.createSerialNumber());
modifierBit.setStringAttribute("@crafting:mod_bit_type", "@stat_n:droid_experimentation");
modifierBit.setIntAttribute("@crafting:mod_bit_ratio", 4);
playerInventory.add(modifierBit);
// TangibleObject stacker1 = (TangibleObject)core.objectService.createObject("object/tangible/loot/misc/shared_damaged_datapad.iff", player.getPlanet());
// stacker1.setCustomName("Damaged Datapad stacker1");
// stacker1.setStackable(true);
// stacker1.setUses(5);
// playerInventory.add(stacker1);
TangibleObject stacker2 = (TangibleObject)core.objectService.createObject("object/tangible/loot/misc/shared_damaged_datapad.iff", player.getPlanet());
stacker2.setCustomName("Damaged Datapad stacker1");
stacker2.setStackable(true);
stacker2.setUses(99);
core.objectService.addStackableItem(stacker2,playerInventory);
String SEALabel = "socket_gem_armor";
String SEADescription = "socket_gem";
String SEATemplate = "object/tangible/gem/shared_clothing.iff";
+57 -2
View File
@@ -48,6 +48,7 @@ import engine.resources.service.INetworkRemoteEvent;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import resources.objects.weapon.WeaponObject;
import resources.skills.SkillMod;
public class EquipmentService implements INetworkDispatch {
@@ -196,7 +197,49 @@ public class EquipmentService implements INetworkDispatch {
if(equipping)
{
if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null) core.skillModService.addSkillMod(creature, "display_only_critical", getWeaponCriticalChance(creature, item));
if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null) {
core.skillModService.addSkillMod(creature, "display_only_critical", getWeaponCriticalChance(creature, item));
creature.setAttachment("EquippedWeapon", item.getObjectID());
// Check if weapon has power up active
if (item.getAttachment("PUPEndTime")!=null){
long pupEndTime = (long)item.getAttachment("PUPEndTime");
if (pupEndTime>System.currentTimeMillis()){
// do nothing let the rest add the mods
} else {
// Make sure pup buff icons are cleared
}
}
}
if(item.getTemplate().contains("shirt")) {
creature.setAttachment("EquippedShirt", item.getObjectID());
// Check if shirt has power up active
if (item.getAttachment("PUPEndTime")!=null){
long pupEndTime = (long)item.getAttachment("PUPEndTime");
if (pupEndTime>System.currentTimeMillis()){
// do nothing let the rest add the mods
} else {
// Make sure pup buff icons are cleared
}
}
}
if(item.getTemplate().contains("chest")) {
creature.setAttachment("EquippedChest", item.getObjectID());
// Check if chest has power up active
if (item.getAttachment("PUPEndTime")!=null){
long pupEndTime = (long)item.getAttachment("PUPEndTime");
if (pupEndTime>System.currentTimeMillis()){
// do nothing let the rest add the mods
} else {
// Make sure pup buff icons are cleared
}
}
}
if(item.getStringAttribute("proc_name") != null) core.buffService.addBuffToCreature(creature, item.getStringAttribute("proc_name").replace("@ui_buff:", ""), creature);
for(Entry<String, Object> e : attributes.entrySet())
@@ -224,7 +267,19 @@ public class EquipmentService implements INetworkDispatch {
}
else
{
if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null) core.skillModService.deductSkillMod(creature, "display_only_critical", getWeaponCriticalChance(creature, item));
if(item.getStringAttribute("cat_wpn_damage.wpn_category") != null){
core.skillModService.deductSkillMod(creature, "display_only_critical", getWeaponCriticalChance(creature, item));
creature.setAttachment("EquippedWeapon", null);
}
if(item.getTemplate().contains("shirt")) {
creature.setAttachment("EquippedShirt", null);
}
if(item.getTemplate().contains("chest")) {
creature.setAttachment("EquippedChest", null);
}
if(item.getStringAttribute("proc_name") != null) core.buffService.removeBuffFromCreatureByName(creature, item.getStringAttribute("proc_name").replace("@ui_buff:", ""));
for(Entry<String, Object> e : attributes.entrySet())
+77 -1
View File
@@ -726,6 +726,83 @@ public class ObjectService implements INetworkDispatch {
}
}
// Check if used item was a PUP
String powerUpTemplate1 = "object/tangible/powerup/base/shared_armor_base.iff";
String powerUpTemplate2 = "object/tangible/powerup/base/shared_base.iff";
String powerUpTemplate3 = "object/tangible/powerup/base/shared_weapon_base.iff";
if (object.getTemplate().equals(powerUpTemplate1)){
// chestplate
String effectName = (String) object.getAttachment("effectName");
int powerValue = (int) object.getAttachment("powerValue");
Long chestID = (Long) creature.getAttachment("EquippedChest");
if (chestID==null)
return;
TangibleObject chest = (TangibleObject) core.objectService.getObject(chestID);
//chest.setIntAttribute(effectName, powerValue);
chest.setAttachment("PUPEffectName", effectName);
chest.setAttachment("PUPEffectValue", powerValue);
}
if (object.getTemplate().equals(powerUpTemplate2)){
// Shirt
String effectName = (String) object.getAttachment("effectName");
int powerValue = (int) object.getAttachment("powerValue");
Long shirtID = (Long) creature.getAttachment("EquippedShirt");
if (shirtID==null)
return;
TangibleObject shirt = (TangibleObject) core.objectService.getObject(shirtID);
//shirt.setIntAttribute(effectName, powerValue);
shirt.setAttachment("PUPEffectName", effectName);
shirt.setAttachment("PUPEffectValue", powerValue);
}
if (object.getTemplate().equals(powerUpTemplate3)){
// weapon
String effectName = (String) object.getAttachment("effectName");
int powerValue = (int) object.getAttachment("powerValue");
Long weaponID = (Long) creature.getAttachment("EquippedWeapon");
if (weaponID==null)
return;
WeaponObject weapon = (WeaponObject) core.objectService.getObject(weaponID);
//weapon.setIntAttribute(effectName, powerValue);
weapon.setAttachment("PUPEffectName", effectName);
weapon.setAttachment("PUPEffectValue", powerValue);
List<String> statList = new ArrayList<String>();
statList.add("constitution_modified");
statList.add("agility_modified");
statList.add("precision_modified");
statList.add("strength_modified");
statList.add("stamina_modified");
statList.add("luck_modified");
if (statList.contains(effectName)){
// Probably this has to be done preferably via the buff service or a new power up service
// Problem : Some of the effect names do NOT occur in buff.iff
// So Light or Treeku better look into this
weapon.setIntAttribute("cat_stat_mod_bonus."+effectName, powerValue);
core.skillModService.addSkillMod(creature, "cat_stat_mod_bonus."+effectName, powerValue);
} else {
// assume skillmod then
weapon.setIntAttribute("cat_skill_mod_bonus."+effectName, powerValue);
core.skillModService.addSkillMod(creature, "cat_skill_mod_bonus."+effectName, powerValue);
}
int amount = object.getIntAttribute("num_in_stack");
if (amount==1)
destroyObject(object.getObjectID());
else
object.setIntAttribute("num_in_stack",amount-1);
}
creature.setUseTarget(object);
int reuse_time;
@@ -1337,5 +1414,4 @@ public class ObjectService implements INetworkDispatch {
alikeItem.setUses(newUses);
core.objectService.destroyObject(item.getObjectID());
}
}
@@ -3063,9 +3063,11 @@ public class ReverseEngineeringService implements INetworkDispatch {
// }
String modifierBitName = null;
String piece1Name = getCorrectJunkName(piece1);
String piece2Name = getCorrectJunkName(piece2);
for (RE_Combination comb : re_Combinations){
if (comb.getIngredient1().contains(piece1.getCustomName()) && comb.getIngredient2().contains(piece2.getCustomName())
|| comb.getIngredient1().contains(piece2.getCustomName()) && comb.getIngredient2().contains(piece1.getCustomName())){
if (comb.getIngredient1().contains(piece1Name) && comb.getIngredient2().contains(piece2Name)
|| comb.getIngredient1().contains(piece2Name) && comb.getIngredient2().contains(piece1Name)){
modifierBitNameResult = comb.getResult(); // "Rifle Critical Chance (10)"
String[] modNameArr = modifierBitNameResult.split("\\(");
modifierBitName = modNameArr[0].replace("\\(", "").trim();
@@ -3107,7 +3109,22 @@ public class ReverseEngineeringService implements INetworkDispatch {
}
public String createSerialNumber(){
String serialNumber = "(123456)";
String serialNumber = "(";
char ascii;
int numberOfSerialDigits=8;
int numbersStart=48;
int lettersStart=97;
for (int k=0;k<numberOfSerialDigits;k++){
ascii = (char) new Random().nextInt(34);
if (ascii < 9)
ascii = (char)(ascii+numbersStart);
else {
ascii -= 9;
ascii =(char)(ascii+lettersStart);
}
serialNumber += ascii;
}
serialNumber += ")";
return serialNumber;
}
@@ -3136,9 +3153,11 @@ public class ReverseEngineeringService implements INetworkDispatch {
if (bit1.getTemplate().contains("modifier_bit") && bit2.getTemplate().contains("power_bit")
|| bit1.getTemplate().contains("power_bit") && bit2.getTemplate().contains("modifier_bit")){
int amount = 200 + new Random().nextInt()*50; // Needs to be randomized and skillmod-related
int amount = 200 + new Random().nextInt(50); // Needs to be randomized and skillmod-related
int luck = engineer.getLuck();
amount = luck/700 * amount; // around 1200 luck was top
float factor = luck/700;
float multiplier = Math.max(1.0F, factor);
amount = (int) (multiplier * amount); // around 1200 luck was top
int powerValue = 1;
@@ -3194,7 +3213,10 @@ public class ReverseEngineeringService implements INetworkDispatch {
powerUp.setDetailFilename("static_item_d");
powerUp.setDetailName(powerUpDescription);
powerUp.setIntAttribute(effectName, powerValue);
powerUp.setIntAttribute("num_in_stack", amount);
powerUp.setAttachment("effectName",effectName);
powerUp.setAttachment("powerValue",powerValue);
powerUp.setIntAttribute("num_in_stack", amount);
powerUp.setAttachment("radial_filename", "item/item");
engineerInventory.add(powerUp);
}
}
@@ -3255,8 +3277,7 @@ public class ReverseEngineeringService implements INetworkDispatch {
String SEALabel = "socket_gem_armor";
String SEADescription = "socket_gem";
String SEATemplate = "object/tangible/gem/shared_clothing.iff";
if (profession.equals("trader_0a")){
SEALabel = "socket_gem_clothing";
SEADescription = "socket_gem";
@@ -3284,6 +3305,7 @@ public class ReverseEngineeringService implements INetworkDispatch {
effectValueList.add(modifierValue);
skillEnhancingAttachment.setAttachment("SEAeffectNameList", effectNameList);
skillEnhancingAttachment.setAttachment("SEAmodifierValueList", effectValueList);
skillEnhancingAttachment.setAttachment("radial_filename", "item/item");
engineerInventory.add(skillEnhancingAttachment);
}
}
@@ -3420,7 +3442,7 @@ public class ReverseEngineeringService implements INetworkDispatch {
skillEnhancingAttachment.setAttachment("SEAeffectNameList", effectNameList);
skillEnhancingAttachment.setAttachment("SEAmodifierValueList", effectValueList);
skillEnhancingAttachment.setAttachment("radial_filename", "item/item");
engineerInventory.add(skillEnhancingAttachment);
}
}
@@ -3452,6 +3474,26 @@ public class ReverseEngineeringService implements INetworkDispatch {
return numberOfStats;
}
private String getCorrectJunkName(TangibleObject piece){
String junkName = piece.getCustomName();
if (piece.getTemplate().contains("shared_wiring_generic.iff")){
String colorCombo = (String)piece.getAttachment("reverse_engineering_name");
if (colorCombo!=null)
junkName = "Wiring (" + colorCombo + ")";
}
if (piece.getTemplate().contains("Droid Motor Template")){
String colorCombo = (String)piece.getAttachment("reverse_engineering_name");
if (colorCombo!=null)
junkName = "Droid Motor (" + colorCombo + ")";
}
if (piece.getTemplate().contains("Droid Battery Template")){
String colorCombo = (String)piece.getAttachment("reverse_engineering_name");
if (colorCombo!=null)
junkName = "Droid Battery (" + colorCombo + ")";
}
return junkName;
}
@Override
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> arg0,
Map<Integer, INetworkRemoteEvent> arg1) {