diff --git a/scripts/commands/factorycratesplit.py b/scripts/commands/factorycratesplit.py new file mode 100644 index 00000000..1c2b6a51 --- /dev/null +++ b/scripts/commands/factorycratesplit.py @@ -0,0 +1,8 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + target.splitFactoryCrate(actor,target,commandString) + return \ No newline at end of file diff --git a/scripts/commands/resourcecontainersplit.py b/scripts/commands/resourcecontainersplit.py index ae3869c5..31e3cae8 100644 --- a/scripts/commands/resourcecontainersplit.py +++ b/scripts/commands/resourcecontainersplit.py @@ -4,5 +4,6 @@ def setup(): return def run(core, actor, target, commandString): + owner.sendSystemMessage('option ', 0) target.splitContainer(actor,target,commandString) return \ No newline at end of file diff --git a/scripts/loot/lootItems/junk/wiring_white.py b/scripts/loot/lootItems/junk/wiring_white.py new file mode 100644 index 00000000..64b57002 --- /dev/null +++ b/scripts/loot/lootItems/junk/wiring_white.py @@ -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 diff --git a/scripts/object/factory/factory_crate_armor.py b/scripts/object/factory/factory_crate_armor.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_armor.py +++ b/scripts/object/factory/factory_crate_armor.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_chemicals.py b/scripts/object/factory/factory_crate_chemicals.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_chemicals.py +++ b/scripts/object/factory/factory_crate_chemicals.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_clothing.py b/scripts/object/factory/factory_crate_clothing.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_clothing.py +++ b/scripts/object/factory/factory_crate_clothing.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_electronics.py b/scripts/object/factory/factory_crate_electronics.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_electronics.py +++ b/scripts/object/factory/factory_crate_electronics.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_food.py b/scripts/object/factory/factory_crate_food.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_food.py +++ b/scripts/object/factory/factory_crate_food.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_furniture.py b/scripts/object/factory/factory_crate_furniture.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_furniture.py +++ b/scripts/object/factory/factory_crate_furniture.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_generic_items.py b/scripts/object/factory/factory_crate_generic_items.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_generic_items.py +++ b/scripts/object/factory/factory_crate_generic_items.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_installation.py b/scripts/object/factory/factory_crate_installation.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_installation.py +++ b/scripts/object/factory/factory_crate_installation.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/object/factory/factory_crate_weapon.py b/scripts/object/factory/factory_crate_weapon.py index ccad8904..a4cabbc7 100644 --- a/scripts/object/factory/factory_crate_weapon.py +++ b/scripts/object/factory/factory_crate_weapon.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'item/factory_crate') return \ No newline at end of file diff --git a/scripts/radial/item/factory_crate.py b/scripts/radial/item/factory_crate.py new file mode 100644 index 00000000..a2af6122 --- /dev/null +++ b/scripts/radial/item/factory_crate.py @@ -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 \ No newline at end of file diff --git a/src/resources/objects/factorycrate/FactoryCrateObject.java b/src/resources/objects/factorycrate/FactoryCrateObject.java index 54230a73..54f0a715 100644 --- a/src/resources/objects/factorycrate/FactoryCrateObject.java +++ b/src/resources/objects/factorycrate/FactoryCrateObject.java @@ -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 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(); 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 contentAttributes = contentObject.getAttributes(); + + contentAttributes = contentObject.getAttributes(); for (Map.Entry 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 contentAttributes = contentObject.getAttributes(); + contentAttributes = contentObject.getAttributes(); for (Map.Entry 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;i0) 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 contentAttributes = contentObject.getAttributes(); + contentAttributes = contentObject.getAttributes(); for (Map.Entry 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;i0){ - + 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 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 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) diff --git a/src/services/LootService.java b/src/services/LootService.java index e88c6617..dc57d098 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -617,6 +617,7 @@ public class LootService implements INetworkDispatch { String requiredFaction = ""; Vector customizationAttributes = null; Vector customizationValues = null; + Vector reverse_engineering_name = null; int customColor1 = 0; String lootDescriptor = ""; Vector itemStats = null; @@ -650,6 +651,9 @@ public class LootService implements INetworkDispatch { if(core.scriptService.getMethod(itemPath,"","customizationValues")!=null) customizationValues = (Vector)core.scriptService.fetchIntegerVector(itemPath,"customizationValues"); + if(core.scriptService.getMethod(itemPath,"","reverse_engineering_name")!=null) + reverse_engineering_name = (Vector)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"; diff --git a/src/services/equipment/EquipmentService.java b/src/services/equipment/EquipmentService.java index b519f773..2c2afb04 100644 --- a/src/services/equipment/EquipmentService.java +++ b/src/services/equipment/EquipmentService.java @@ -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 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 e : attributes.entrySet()) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 98bb3739..57c044e6 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -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 statList = new ArrayList(); + 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()); } - } diff --git a/src/services/reverseengineering/ReverseEngineeringService.java b/src/services/reverseengineering/ReverseEngineeringService.java index adfa66e6..e4df6d80 100644 --- a/src/services/reverseengineering/ReverseEngineeringService.java +++ b/src/services/reverseengineering/ReverseEngineeringService.java @@ -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 arg0, Map arg1) {