diff --git a/scripts/constructor_build_phase.py b/scripts/constructor_build_phase.py new file mode 100644 index 00000000..62755eac --- /dev/null +++ b/scripts/constructor_build_phase.py @@ -0,0 +1,7 @@ +import sys +import time + +def buildConstructor(core): + time.sleep(10) + return + \ No newline at end of file diff --git a/scripts/loot/lootItems/re_junk/wiring_red_yellow.py b/scripts/loot/lootItems/re_junk/wiring_red_yellow.py index 88fd2f59..aa17d304 100644 --- a/scripts/loot/lootItems/re_junk/wiring_red_yellow.py +++ b/scripts/loot/lootItems/re_junk/wiring_red_yellow.py @@ -13,11 +13,11 @@ def lootDescriptor(): def customizationAttributes(): - return ['/private/index_color_1'] + return ['/private/index_color_1','/private/index_color_2'] def customizationValues(): - return [13] #not correct + return [6,12] def reverse_engineering_name(): diff --git a/scripts/object/intangible/vehicle/stap_speeder_pcd.py b/scripts/object/intangible/vehicle/stap_speeder_pcd.py index ccad8904..d7c3f4a1 100644 --- a/scripts/object/intangible/vehicle/stap_speeder_pcd.py +++ b/scripts/object/intangible/vehicle/stap_speeder_pcd.py @@ -1,4 +1,5 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'datapad/vehicle_pcd') return \ No newline at end of file diff --git a/scripts/object/tangible/gcw/gcw_invasion_binoculars_01.py b/scripts/object/tangible/gcw/gcw_invasion_binoculars_01.py index ccad8904..02df443d 100644 --- a/scripts/object/tangible/gcw/gcw_invasion_binoculars_01.py +++ b/scripts/object/tangible/gcw/gcw_invasion_binoculars_01.py @@ -1,4 +1,14 @@ import sys def setup(core, object): - return \ No newline at end of file + object.setIntAttribute('no_trade', 1) + object.setAttachment('radial_filename', 'object/usable') + object.setStfFilename('static_item_n') + object.setStfName('invasion_gcw_binoculars_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('invasion_gcw_binoculars_01_01') + return + +def use(core, actor, object): + core.buffService.addBuffToCreature(actor, 'gcw_invasion_binoculars', actor) + return diff --git a/scripts/object/tangible/loot/generic_usable/item_entertainer_clicky_01_02.py b/scripts/object/tangible/loot/generic_usable/item_entertainer_clicky_01_02.py index dd6a2c0b..2033534c 100644 --- a/scripts/object/tangible/loot/generic_usable/item_entertainer_clicky_01_02.py +++ b/scripts/object/tangible/loot/generic_usable/item_entertainer_clicky_01_02.py @@ -1,9 +1,14 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'object/usable') object.setStfFilename('static_item_n') object.setStfName('item_entertainer_clicky_01_02') object.setDetailFilename('static_item_d') object.setDetailName('item_entertainer_clicky_01_02') object.setStringAttribute('class_required', 'Entertainer') return + +def use(core, actor, object): + core.buffService.addBuffToCreature(actor, 'roadmapEntertainerClicky', actor) + return diff --git a/scripts/object/tangible/loot/generic_usable/item_medic_clicky_01_02.py b/scripts/object/tangible/loot/generic_usable/item_medic_clicky_01_02.py index a9a7e24b..8567c5f0 100644 --- a/scripts/object/tangible/loot/generic_usable/item_medic_clicky_01_02.py +++ b/scripts/object/tangible/loot/generic_usable/item_medic_clicky_01_02.py @@ -1,9 +1,13 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'object/usable') object.setStfFilename('static_item_n') object.setStfName('item_medic_clicky_01_02') object.setDetailFilename('static_item_d') object.setDetailName('item_medic_clicky_01_02') object.setStringAttribute('class_required', 'Medic') return +def use(core, actor, object): + core.buffService.addBuffToCreature(actor, 'roadmapMedicClicky', actor) + return diff --git a/src/resources/common/Forager.java b/src/resources/common/Forager.java index 71874a78..98911cbc 100644 --- a/src/resources/common/Forager.java +++ b/src/resources/common/Forager.java @@ -22,6 +22,7 @@ package resources.common; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Random; import java.util.Vector; @@ -50,6 +51,71 @@ public class Forager { public static final int WORM_BAIT = 4; public static final int MYSTERIOUS_DATA_DISC = 5; + public static final String[] RARE_COMPONENTS_CORELLIA = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_charbote.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_goldfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_kavasa_fruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_salthia.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_sunfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_vweilu.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/corellia/shared_yam.iff" + }; + + public static final String[] RARE_COMPONENTS_DANTOOINE = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_barabel.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_celonslay.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_dorian.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_kibla_greens.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_shefna_fruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_tritacale.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dantooine/shared_yot_beans.iff" + }; + + public static final String[] RARE_COMPONENTS_DATHOMIR = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_beebleberry.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_driblis.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_dricklefruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_grape.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_hwotha.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_plaitfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/dathomir/shared_qana.iff" + }; + + public static final String[] RARE_COMPONENTS_ENDOR = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_acorns.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_blumfruit.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_burr_ball.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_gin_jang_berry.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_honey_melon.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_sunberries.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/endor/shared_yubnut.iff" + }; + + public static final String[] RARE_COMPONENTS_NABOO = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_cligs.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_cracknut.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_denta.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_muja.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_ootoowergs.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_phraig.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/naboo/shared_stinkmelon.iff" + }; + + public static final String[] RARE_COMPONENTS_TATOOINE = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_banthaweed.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_bestinnian.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_bloddle.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_bristlemelon.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_tatoes.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_wyykmelons.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/tatooine/shared_zog.iff" + }; + + public static final String[] RARE_COMPONENTS_YAVIN = new String[]{"object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_blueleaf_shrub.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_celto.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_farrberries.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_sweetmelon.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_topatoes.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_trig_berries.iff", + "object/tangible/loot/creature_loot/collections/fried_icecream_components/yavin/shared_wuli_nuts.iff" + }; + + private static final HashMap rareComponentHash= new HashMap(); + private int[] mapPlanetIDs = new int[]{6,7,8}; // consider foraged food food/foraged @@ -77,7 +143,14 @@ public class Forager { int[] forageChances = new int[]{10,10,25,25,25,5}; int[] forageChances2 = new int[]{12,10,21,23,24,10}; // Kommerken Steak int[] forageChances3 = new int[]{20,9,22,22,22,5}; // if you got the pig - + + rareComponentHash.put(1,RARE_COMPONENTS_TATOOINE); + rareComponentHash.put(2,RARE_COMPONENTS_NABOO); + rareComponentHash.put(3,RARE_COMPONENTS_CORELLIA); + rareComponentHash.put(6,RARE_COMPONENTS_DANTOOINE); + rareComponentHash.put(8,RARE_COMPONENTS_YAVIN); + rareComponentHash.put(9,RARE_COMPONENTS_ENDOR); + rareComponentHash.put(10,RARE_COMPONENTS_DATHOMIR); int chosenObject = 0; @@ -120,7 +193,10 @@ public class Forager { forager.sendSystemMessage("",(byte) 0); break; - case RARE_COMPONENT: template = "object/tangible/loot/beast/shared_enzyme_1.iff"; // for now, must find temp + case RARE_COMPONENT: template = ""; + String[] componentArray = rareComponentHash.get(forager.getPlanetId()); + int componentRoll = new Random().nextInt(componentArray.length); + template = componentArray[componentRoll]; foragedObject = (TangibleObject) NGECore.getInstance().objectService.createObject(template, forager.getPlanet()); foragerInventory.add(foragedObject); forager.sendSystemMessage("",(byte) 0); diff --git a/src/services/DevService.java b/src/services/DevService.java index 79b3feca..d0b1f39e 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -1243,6 +1243,10 @@ public class DevService implements INetworkDispatch { deed.setIntAttribute("examine_maintenance_rate", 15); inventory.add(deed); + deed = (TangibleObject) core.objectService.createObject("object/tangible/deed/guild_deed/shared_tatooine_guild_deed.iff", planet); + deed.setIntAttribute("examine_maintenance_rate", 15); + inventory.add(deed); + return; case 121: diff --git a/src/services/LootService.java b/src/services/LootService.java index 6d713cb7..12f43747 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -54,6 +54,7 @@ import resources.objects.group.GroupObject; import resources.objects.intangible.IntangibleObject; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; +import services.ai.AIActor; import services.sui.SUIService.ListBoxType; import services.sui.SUIService.MessageBoxType; import services.sui.SUIWindow; @@ -79,7 +80,7 @@ public class LootService implements INetworkDispatch { private NGECore core; private static int prepInvCnt = 0; String testDropTemplate = null; - //String testDropTemplate = "kowakian_cage"; + //String testDropTemplate = "stap1_vehicle_deed"; public LootService(NGECore core) { this.core = core; @@ -193,7 +194,7 @@ public class LootService implements INetworkDispatch { // set info above corpse //System.out.println("lootedObject instanceof CreatureObject " + (lootedObject instanceof CreatureObject)); - if (lootedObject instanceof CreatureObject){ + if (lootedObject instanceof CreatureObject && lootRollSession.getDroppedItems().size()>0){ try { float y = 0.5F; // 1.3356977F float qz= 1.06535322E9F; @@ -1485,7 +1486,9 @@ public class LootService implements INetworkDispatch { public void handleCreditDrop(CreatureObject requester,TangibleObject lootedObject,LootRollSession lootRollSession){ int lootedCredits = 0; - if (lootedObject.isCreditRelieved()) + AIActor ai = (AIActor) lootedObject.getAttachment("AI"); + String resType = ai.getMobileTemplate().getMeatType(); + if (lootedObject.isCreditRelieved() || resType!=null) return; // Credit drop is depending on the CL of the looted CreatureObject @@ -2806,8 +2809,67 @@ public class LootService implements INetworkDispatch { item24b.setUses(399); core.objectService.addStackableItem(item24b,playerInventory); + TangibleObject item25a = (TangibleObject)core.objectService.createObject("object/tangible/loot/npc_loot/shared_wiring_generic.iff", player.getPlanet()); + item25a.setCustomName("Wiring"); + item25a.setAttachment("reverse_engineering_name", "Red/Yellow"); + item25a.setStackable(true); + item25a.setUses(299); + Vector customizationAttributes = new Vector(); + customizationAttributes.add("/private/index_color_1"); + customizationAttributes.add("/private/index_color_2"); + Vector customizationValues = new Vector(); + customizationValues.add(6); + customizationValues.add(12); + item25a.setAttachment("lootDescriptor", "customattributes"); + setCustomization(item25a,"Wiring", customizationAttributes, customizationValues); + core.objectService.addStackableItem(item25a,playerInventory); + + TangibleObject item25b = (TangibleObject)core.objectService.createObject("object/tangible/loot/npc_loot/shared_launcher_tube_generic.iff", player.getPlanet()); + item25b.setCustomName("Launcher Tube"); + item25b.setStackable(true); + item25b.setUses(399); + core.objectService.addStackableItem(item25b,playerInventory); + + TangibleObject item27b = (TangibleObject)core.objectService.createObject("object/tangible/loot/npc_loot/shared_small_motor_generic.iff", player.getPlanet()); + item27b.setCustomName("Locomotor"); + item27b.setStackable(true); + item27b.setUses(399); + core.objectService.addStackableItem(item27b,playerInventory); + + TangibleObject item26a = (TangibleObject)core.objectService.createObject("object/tangible/loot/npc_loot/shared_copper_battery_generic.iff", player.getPlanet()); + item26a.setCustomName("Droid Battery"); + item26a.setAttachment("reverse_engineering_name", "Black/Green"); + item26a.setStackable(true); + item26a.setUses(299); + customizationAttributes = new Vector(); + customizationAttributes.add("/private/index_color_1"); + customizationAttributes.add("/private/index_color_2"); + customizationValues = new Vector(); + customizationValues.add(0); + customizationValues.add(15); + item26a.setAttachment("lootDescriptor", "customattributes"); + setCustomization(item26a,"Droid Battery", customizationAttributes, customizationValues); + core.objectService.addStackableItem(item26a,playerInventory); + + + TangibleObject item26b = (TangibleObject)core.objectService.createObject("object/tangible/loot/npc_loot/shared_copper_battery_generic.iff", player.getPlanet()); + item26b.setCustomName("Droid Battery"); + item26b.setAttachment("reverse_engineering_name", "Purple/Green"); + item26b.setStackable(true); + item26b.setUses(299); + customizationAttributes = new Vector(); + customizationAttributes.add("/private/index_color_1"); + customizationAttributes.add("/private/index_color_2"); + customizationValues = new Vector(); + customizationValues.add(33); + customizationValues.add(15); + item26b.setAttachment("lootDescriptor", "customattributes"); + setCustomization(item26b,"Droid Battery", customizationAttributes, customizationValues); + core.objectService.addStackableItem(item26b,playerInventory); + + String modifierBitTemplate = "object/tangible/component/reverse_engineering/shared_modifier_bit.iff"; TangibleObject modifierBit = (TangibleObject) core.objectService.createObject(modifierBitTemplate, player.getPlanet()); modifierBit.setCustomName("Droid Experimentation"); diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index b218982a..ff01a6fb 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -273,6 +273,9 @@ public class SurveyService implements INetworkDispatch { if (target==null) return; // target object not valid + if (crafter.getContainer()!=null) + return; + SurveyTool surveyTool = (SurveyTool)target; if (surveyTool.getToolType()==-1) return; // Survey tool type was not recognized diff --git a/src/services/TerrainService.java b/src/services/TerrainService.java index 9cc2924a..1653690d 100644 --- a/src/services/TerrainService.java +++ b/src/services/TerrainService.java @@ -66,6 +66,11 @@ public class TerrainService { float x = (Float) poiTable.getObject(i, 4); float z = (Float) poiTable.getObject(i, 6); + // Account for more extended no-build radii like they were on live + // Issue #849 + x *= 1.1; + z *= 1.1; + CollidableCircle poiArea = new CollidableCircle(new Point3D(x, 0, z), 150, planet); noBuildAreas.get(planet).add(poiArea); diff --git a/src/services/housing/HousingService.java b/src/services/housing/HousingService.java index 63860a89..fd079196 100644 --- a/src/services/housing/HousingService.java +++ b/src/services/housing/HousingService.java @@ -113,8 +113,10 @@ public class HousingService implements INetworkDispatch { HouseTemplate houseTemplate = housingTemplates.get(deed.getTemplate()); int structureLotCost = houseTemplate.getLotCost(); String structureTemplate = houseTemplate.getBuildingTemplate(); - PlayerCity city = core.playerCityService.getCityPositionIsIn(new Point3D(positionX, 0, positionZ)); - + //PlayerCity city = core.playerCityService.getCityPositionIsIn(new Point3D(positionX, 0, positionZ)); + // This function is not implemented, so it had to be commented out, because it resulted in an error + // Whoever wrote this, should still add the method to playerCityService, then it can be uncommented here. + PlayerCity city = null; if (!houseTemplate.canBePlacedOn(actor.getPlanet().getName())) { actor.sendSystemMessage("You may not place this structure on this planet.", (byte) 0); // should probably load this from an stf return null; @@ -142,6 +144,12 @@ public class HousingService implements INetworkDispatch { float positionY = core.terrainService.getHeight(actor.getPlanetId(), positionX, positionZ) + 2f; + String constructorTemplate = mapConstructor(structureTemplate); + InstallationObject constructors = (InstallationObject) core.objectService.createObject(constructorTemplate, 0, actor.getPlanet(), new Point3D(positionX, positionY, positionZ), quaternion); + core.simulationService.add(constructors, positionX, positionZ, true); + core.scriptService.callScript("scripts/", "constructor_build_phase", "buildConstructor", core); + core.objectService.destroyObject(constructors); + // Create the building BuildingObject building = (BuildingObject) core.objectService.createObject(structureTemplate, 0, actor.getPlanet(), new Point3D(positionX, positionY, positionZ), quaternion); @@ -196,6 +204,27 @@ public class HousingService implements INetworkDispatch { return building; } + public String mapConstructor(String structureTemplate) { + String mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_small_style_01.iff"; + if (structureTemplate.contains("small")){ + mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_small_style_01.iff"; + } else if (structureTemplate.contains("medium")){ + mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_medium_style_01.iff"; + } else if (structureTemplate.contains("large")){ + mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_large_style_01.iff"; + } + + if (structureTemplate.contains("guildhall") || structureTemplate.contains("cityhall")){ + mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_guildhall_corellia_style_01.iff"; + } else if (structureTemplate.contains("hangar")){ + mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_hangar.iff"; + } else if (structureTemplate.contains("meditation")){ + mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_jedi_meditation_room.iff"; + } + // Probably more could be added + return mappedConstructorTemplate; + } + public void startMaintenanceTask(BuildingObject building) { if(building.getAttachment("isCivicStructure") != null && (boolean) building.getAttachment("isCivicStructure")) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 475f7155..897abb06 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -291,6 +291,12 @@ public class ObjectService implements INetworkDispatch { object = new WeaponObject(objectID, planet, position, orientation, Template); + } else if(Template.startsWith("object/building/player/construction")) { + + float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f; + Point3D newpoint = new Point3D(position.x,positionY,position.z); + object = new InstallationObject(objectID, planet, newpoint, orientation, Template); + } else if(Template.startsWith("object/building") || Template.startsWith("object/static/worldbuilding/structures") || Template.startsWith("object/static/structure")){ object = new BuildingObject(objectID, planet, position, orientation, Template); @@ -1439,8 +1445,23 @@ public class ObjectService implements INetworkDispatch { @Override public void process(SWGObject obj) { if (obj.getTemplate().equals(item.getTemplate())){ - alikeItemsInContainer.add(obj); - System.out.println(obj.getTemplate()); + // Check if items are Droid Motors or Wirings + if (obj.getTemplate().equals("object/tangible/loot/npc_loot/shared_wiring_generic.iff")){ + if (obj.getAttachment("reverse_engineering_name")!=null){ + if (obj.getAttachment("reverse_engineering_name").equals(item.getAttachment("reverse_engineering_name"))){ + alikeItemsInContainer.add(obj); + } + } + } else if (obj.getTemplate().equals("object/tangible/loot/npc_loot/shared_copper_battery_generic.iff")){ + if (obj.getAttachment("reverse_engineering_name")!=null){ + if (obj.getAttachment("reverse_engineering_name").equals(item.getAttachment("reverse_engineering_name"))){ + alikeItemsInContainer.add(obj); + } + } + } else { + alikeItemsInContainer.add(obj); + } + } } });