From 13495e3f3501150363be7dbdec3d0f54c74c8b48 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 02:22:45 +0200 Subject: [PATCH 01/95] first work on swoop deed --- .../deed/vehicle_deed/speederbike_swoop_deed.py | 8 ++++---- scripts/radial/vehicle.py | 13 ++++++++++++- src/services/DevService.java | 5 +++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py index eb077d1f..abd61184 100644 --- a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py +++ b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py @@ -7,13 +7,13 @@ def setup(core, object): def use(core, actor, object): datapad = actor.getSlottedObject('datapad') - pcd = core.objectService.createObject('object/intangible/vehicle/shared_speederbike_swoop_pcd.iff', actor.getPlanet(), actor.getPosition()) - + pcd = core.objectService.createObject('object/intangible/vehicle/shared_speederbike_swoop_pcd.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) + actor.sendSystemMessage('actor.getObjectID() %s' % actor.getObjectID(), 0) if datapad and pcd: datapad.add(pcd) core.objectService.destroyObject(object) - vehicle = createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', pcd.getAttachment('vehicleId'), actor.getPlanet(), actor.getPosition(), actor.getOrientation()) - vehicle.setOwnerId(actor.getObjectID()) + vehicle = core.objectService.createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) + vehicle.setOwner(actor) core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) return \ No newline at end of file diff --git a/scripts/radial/vehicle.py b/scripts/radial/vehicle.py index ca1f4311..2585a9ef 100644 --- a/scripts/radial/vehicle.py +++ b/scripts/radial/vehicle.py @@ -1,4 +1,6 @@ from resources.common import RadialOptions +from resources.common import RadialOptions +from services.ai import Vehicles import sys def createRadial(core, owner, target, radials): @@ -11,7 +13,16 @@ def createRadial(core, owner, target, radials): def handleSelection(core, owner, target, option): if target: if option == 21 or option == 40: - core.objectService.useObject(owner, target) + #owner.setPosture(16) + owner.setMounted(1) + #owner.setParent(target) + target.initMount(owner) + #target.add(owner) + #target.setOwner(owner) + #Vehicles.testbike(owner,target) + + #target.unmount(owner) + #core.objectService.useObject(owner, target) if option == 60: core.objectService.destroyObject(target) return \ No newline at end of file diff --git a/src/services/DevService.java b/src/services/DevService.java index da4a5561..58c9fea4 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -89,6 +89,7 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 26, "Installations"); suiOptions.put((long) 110, "Survey Devices"); if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds"); + if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds"); //suiOptions.put((long) 120, "House Deeds"); break; case 3: // [Items] Weapons @@ -1203,6 +1204,10 @@ public class DevService implements INetworkDispatch { deed.setAttributes(); inventory.add(deed); + return; + case 130: + TangibleObject swoopDeed = (TangibleObject) core.objectService.createObject("object/tangible/deed/vehicle_deed/shared_speederbike_swoop_deed.iff", planet); + inventory.add(swoopDeed); return; } } From cb3f4e826aa53542928277f9aece0d5e349862e2 Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 13 Apr 2014 01:39:18 +0100 Subject: [PATCH 02/95] Moved Empty_Hopper to HarvesterService --- src/services/command/CommandService.java | 46 +++----------------- src/services/resources/HarvesterService.java | 43 ++++++++++++++++++ 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index a08b267d..b7fb6c04 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -120,6 +120,10 @@ public class CommandService implements INetworkDispatch { String name = commandArgs.split(" ")[0]; target = core.objectService.getObjectByFirstName(name); + + if (target == actor) { + target = null; + } } break; @@ -191,6 +195,8 @@ public class CommandService implements INetworkDispatch { x = Integer.valueOf(args[0]); y = Integer.valueOf(args[1]); z = Integer.valueOf(args[2]); + } else { + return false; } } catch (NumberFormatException e) { return false; @@ -596,46 +602,6 @@ public class CommandService implements INetworkDispatch { }); - objControllerOpcodes.put(ObjControllerOpcodes.RESOURCE_EMPTY_HOPPER, new INetworkRemoteEvent() { - - @Override - public void handlePacket(IoSession session, IoBuffer data) throws Exception { - data.order(ByteOrder.LITTLE_ENDIAN); - Client client = core.getClient(session); - CommandEnqueue commandEnqueue = new CommandEnqueue(); - -// StringBuilder sb = new StringBuilder(); -// for (byte b : data.array()) { -// sb.append(String.format("%02X ", b)); -// } -// System.out.println(sb.toString()); - - /* - 05 00 46 5E CE 80 83 00 00 00 ED 00 00 00 3E 45 - 04 00 00 00 00 00 00 00 00 00 3E 45 04 00 00 00 - 00 00 90 52 05 00 00 00 00 00 D7 35 05 00 00 00 - 00 00 01 00 00 00 00 07 - */ - - long playerId = data.getLong(); // 3E 45 04 00 00 00 00 00 - data.getInt(); // 00 00 00 00 - data.getLong(); // 3E 45 04 00 00 00 00 00 - long harvesterId = data.getLong(); // 1E 55 05 00 00 00 00 00 - //long containerId = data.getLong(); // 1E 55 05 00 00 00 00 00 Resources ID - long resourceId = data.getLong(); // 1E 55 05 00 00 00 00 00 Resources ID - int stackCount = data.getInt(); // Stack count - byte actionMode = data.get(); // 0 for retrieving, 1 for discarding - byte updateCount = data.get(); // updateCount - - CreatureObject actor = (CreatureObject) client.getParent(); - SWGObject target = core.objectService.getObject(harvesterId); - - core.harvesterService.handleEmptyHopper(actor,target,harvesterId,resourceId,stackCount,actionMode,updateCount); - } - }); - - - } public void shutdown() { diff --git a/src/services/resources/HarvesterService.java b/src/services/resources/HarvesterService.java index d8e028fc..71d2a276 100644 --- a/src/services/resources/HarvesterService.java +++ b/src/services/resources/HarvesterService.java @@ -21,6 +21,7 @@ ******************************************************************************/ package services.resources; +import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -34,11 +35,16 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; + import protocol.swg.EnterStructurePlacementModeMessage; import protocol.swg.SceneCreateObjectByCrc; import protocol.swg.SceneDestroyObject; import protocol.swg.SceneEndBaselines; +import protocol.swg.objectControllerObjects.CommandEnqueue; import main.NGECore; +import engine.clients.Client; import engine.resources.common.CRC; import engine.resources.container.Traverser; import engine.resources.objects.SWGObject; @@ -46,6 +52,7 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; +import resources.common.ObjControllerOpcodes; import resources.objects.creature.CreatureObject; import resources.objects.deed.Harvester_Deed; import resources.objects.harvester.HarvesterMessageBuilder; @@ -92,6 +99,42 @@ public class HarvesterService implements INetworkDispatch { @Override public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + objControllerOpcodes.put(ObjControllerOpcodes.RESOURCE_EMPTY_HOPPER, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + data.order(ByteOrder.LITTLE_ENDIAN); + Client client = core.getClient(session); + +// StringBuilder sb = new StringBuilder(); +// for (byte b : data.array()) { +// sb.append(String.format("%02X ", b)); +// } +// System.out.println(sb.toString()); + + /* + 05 00 46 5E CE 80 83 00 00 00 ED 00 00 00 3E 45 + 04 00 00 00 00 00 00 00 00 00 3E 45 04 00 00 00 + 00 00 90 52 05 00 00 00 00 00 D7 35 05 00 00 00 + 00 00 01 00 00 00 00 07 + */ + + long playerId = data.getLong(); // 3E 45 04 00 00 00 00 00 + data.getInt(); // 00 00 00 00 + data.getLong(); // 3E 45 04 00 00 00 00 00 + long harvesterId = data.getLong(); // 1E 55 05 00 00 00 00 00 + //long containerId = data.getLong(); // 1E 55 05 00 00 00 00 00 Resources ID + long resourceId = data.getLong(); // 1E 55 05 00 00 00 00 00 Resources ID + int stackCount = data.getInt(); // Stack count + byte actionMode = data.get(); // 0 for retrieving, 1 for discarding + byte updateCount = data.get(); // updateCount + + CreatureObject actor = (CreatureObject) client.getParent(); + SWGObject target = core.objectService.getObject(harvesterId); + + handleEmptyHopper(actor, target, harvesterId, resourceId, stackCount, actionMode, updateCount); + } + }); } From 343569ed38a64d391a8f208d25d41401936f7520 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 03:50:45 +0200 Subject: [PATCH 03/95] Swoop is mountable for further tests --- .../vehicle/speederbike_swoop_pcd.py | 14 ++--- .../vehicle_deed/speederbike_swoop_deed.py | 4 +- scripts/radial/vehicle.py | 3 +- .../creature/CreatureMessageBuilder.java | 3 +- .../objects/creature/CreatureObject.java | 62 ++++++++++++++++++- .../objects/tangible/TangibleObject.java | 10 +++ src/services/SimulationService.java | 4 ++ src/services/object/ObjectService.java | 28 ++++++--- 8 files changed, 104 insertions(+), 24 deletions(-) diff --git a/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py b/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py index 94a561f7..ec2deccd 100644 --- a/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py +++ b/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py @@ -1,23 +1,21 @@ import sys def setup(core, object): - object.setAttachment('vehicleId', core.objectService.generateObjectID()) + #object.setAttachment('vehicleId', core.objectService.generateObjectID()) object.setAttachment('radial_filename', 'item') return def use(core, actor, object): if object: - vehicleId = object.getAttachment('vehicleId') + vehicleId = object.getObjectID() + #vehicleId = object.getAttachment('vehicleId') if not vehicleId: return vehicle = core.objectService.getObject(vehicleId) - - if vehicle: - core.objectService.destroyObject(vehicle) - else: - core.objectService.createObject('object/mobile/vehicles/shared_speederbike_swoop.iff', vehicleId, actor.getPlanet(), actor.getPosition(), actor.getOrientation()) - core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) + + swoop = core.objectService.createObject('object/mobile/vehicles/shared_speederbike_swoop.iff', vehicleId, actor.getPlanet(), actor.getPosition(), actor.getOrientation()) + core.simulationService.add(swoop, swoop.getPosition().x, swoop.getPosition().z, True) return \ No newline at end of file diff --git a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py index abd61184..b32e90e3 100644 --- a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py +++ b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py @@ -8,12 +8,12 @@ def use(core, actor, object): datapad = actor.getSlottedObject('datapad') pcd = core.objectService.createObject('object/intangible/vehicle/shared_speederbike_swoop_pcd.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) - actor.sendSystemMessage('actor.getObjectID() %s' % actor.getObjectID(), 0) + #actor.sendSystemMessage('actor.getObjectID() %s' % actor.getObjectID(), 0) if datapad and pcd: datapad.add(pcd) core.objectService.destroyObject(object) vehicle = core.objectService.createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) - vehicle.setOwner(actor) + vehicle.setOwnerId(actor.getObjectID()) core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) return \ No newline at end of file diff --git a/scripts/radial/vehicle.py b/scripts/radial/vehicle.py index 2585a9ef..a1e5a7b2 100644 --- a/scripts/radial/vehicle.py +++ b/scripts/radial/vehicle.py @@ -1,6 +1,5 @@ from resources.common import RadialOptions -from resources.common import RadialOptions -from services.ai import Vehicles + import sys def createRadial(core, owner, target, radials): diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index d70cf87c..18ae40e8 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -1149,7 +1149,8 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder { buffer.putLong(ownerId); int size = buffer.position(); buffer.flip(); - buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x0D, buffer, size + 4); + //buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x0D, buffer, size + 4); 0F,12 doesnt crash + buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x0F, buffer, size + 4); // checked from 0xA up to 0x1F return buffer; } diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 6173600b..2d2cc731 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -34,6 +34,7 @@ import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.ObjControllerMessage; import protocol.swg.PlayMusicMessage; +import protocol.swg.UpdateContainmentMessage; import protocol.swg.UpdatePostureMessage; import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.chat.ChatSystemMessage; @@ -50,6 +51,7 @@ import main.NGECore; import engine.clients.Client; import resources.common.Cooldown; import resources.common.OutOfBand; +import resources.datatables.Options; import resources.objects.Buff; import resources.objects.DamageOverTime; import resources.objects.SWGList; @@ -66,7 +68,7 @@ import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import services.command.BaseSWGCommand; -@Entity(version=6) +@Entity(version=7) public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -186,6 +188,9 @@ public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent private ConcurrentHashMap cooldowns = new ConcurrentHashMap(); + public boolean mounted = false; + public CreatureObject mountedVehicle; + public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { super(objectID, planet, Template, position, orientation); messageBuilder = new CreatureMessageBuilder(this); @@ -1781,6 +1786,61 @@ public class CreatureObject extends TangibleObject implements IPersistent { return (PlayerObject) this.getSlottedObject("ghost"); } + public boolean isMounted() { + return mounted; + } + + public void setMounted(boolean mounted) { + this.mounted = mounted; + } + + public CreatureObject getMountedVehicle() { + return mountedVehicle; + } + + public void setMountedVehicle(CreatureObject mountedVehicle) { + this.mountedVehicle = mountedVehicle; + } + + public void mount(CreatureObject owner) { + synchronized(objectMutex) { + if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT){ + UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), -1); + owner.getClient().getSession().write(updateContainmentMessage.serialize()); + owner.setParent(this); + } + } + } + + public void unmount(CreatureObject owner) { + synchronized(objectMutex) { + if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT){ + UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), -1); + owner.getClient().getSession().write(updateContainmentMessage.serialize()); + } + } + } + + public void initMount(CreatureObject owner) { + synchronized(objectMutex) { + this.ownerId = owner.getObjectID(); + setStateBitmask(0x10000000); + owner.setParent(this); + owner.getClient().getSession().write(messageBuilder.buildOwnerIdDelta(ownerId)); + owner.setMountedVehicle(this); + this.setOwnerId(owner.getObjectID()); + //this.add(owner); // NPE at engine.resources.objects.SWGObject.getCorrectArrangementId(kd:844) + this.mount(owner); + // setStateBitmask(28); + // owner.setStateBitmask(27); + owner.setStateBitmask(0x8000000); + this.setPosture((byte)10); + + //this.sendBaselines(owner.getClient()); + + } + } + //public float getCooldown(String cooldownGroup) { //return ((float) getCooldown(cooldownGroup) / (float) 1000); //} diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index de1b586b..62f3f00d 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -82,6 +82,8 @@ public class TangibleObject extends SWGObject { private boolean looted = false; private boolean lootLock = false; + private String serialNumber; + @NotPersistent private TangibleObject killer = null; @@ -470,6 +472,14 @@ public class TangibleObject extends SWGObject { this.lootLock = lootLock; } + public String getSerialNumber() { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + } + @Override public void sendBaselines(Client destination) { diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index e76920c7..5009c159 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -332,6 +332,10 @@ public class SimulationService implements INetworkDispatch { } CreatureObject object = (CreatureObject) client.getParent(); + + if (object.mounted) + object=object.getMountedVehicle(); + Point3D newPos; Point3D oldPos; synchronized(object.getMutex()) { diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index f993e851..f4385f18 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -428,24 +428,32 @@ public class ObjectService implements INetworkDispatch { if (Template.startsWith("object/creature/") || Template.startsWith("object/mobile/")) { if (Template.startsWith("object/mobile/")) { ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE); - } else if (Template.startsWith("object/mobile/beast_master/")) { + } + if (Template.startsWith("object/mobile/beast_master/")) { ((CreatureObject) object).setOptionsBitmask(Options.NONE); - } else if (Template.startsWith("object/mobile/vendor/")) { + } + if (Template.startsWith("object/mobile/vendor/")) { ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.USABLE); - } else if (Template.startsWith("object/mobile/vehicle/")) { + } + if (Template.startsWith("object/mobile/vehicle/")) { ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE | Options.MOUNT); - System.err.println("Options.MOUNT"); - } else if (Template.startsWith("object/mobile/hologram/")) { + } + if (Template.startsWith("object/mobile/hologram/")) { ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE); - } else if (Template.startsWith("object/creature/npc/theme_park/")) { + } + if (Template.startsWith("object/creature/npc/theme_park/")) { ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE); - } else if (Template.startsWith("object/creature/npc/general/")) { + } + if (Template.startsWith("object/creature/npc/general/")) { ((CreatureObject) object).setOptionsBitmask(Options.INVULNERABLE | Options.CONVERSABLE); - } else if (Template.startsWith("object/creature/droid/crafted/")) { + } + if (Template.startsWith("object/creature/droid/crafted/")) { ((CreatureObject) object).setOptionsBitmask(Options.NONE); - } else if (Template.startsWith("object/creature/droid/")) { + } + if (Template.startsWith("object/creature/droid/")) { ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE | Options.INVULNERABLE); - } else if (Template.startsWith("object/creature/player/")) { + } + if (Template.startsWith("object/creature/player/")) { ((CreatureObject) object).setOptionsBitmask(Options.ATTACKABLE); } } else if (object instanceof TangibleObject) { From 32cb035e2ee1624216abede4bb7f661716e9da3e Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 05:05:18 +0200 Subject: [PATCH 04/95] Increased TANO persistence version fix --- src/resources/objects/tangible/TangibleObject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 62f3f00d..7f7e7908 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -53,7 +53,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=5) +@Persistent(version=6) public class TangibleObject extends SWGObject { // TODO: Thread safety From 1aae7efe108ab75069f40e21157e5dbc1cd3b840 Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 13 Apr 2014 11:05:39 +0100 Subject: [PATCH 05/95] Fixed error in getfriendlist.py --- scripts/commands/getfriendlist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/commands/getfriendlist.py b/scripts/commands/getfriendlist.py index 5826dfac..41188658 100644 --- a/scripts/commands/getfriendlist.py +++ b/scripts/commands/getfriendlist.py @@ -1,4 +1,4 @@ -from protocol.swg import ChatOnGetFriendsList +from protocol.swg.chat import ChatOnGetFriendsList import sys def setup(): From b001ebb9ba53b4c706624a1a2785679644f51a45 Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 13 Apr 2014 11:06:27 +0100 Subject: [PATCH 06/95] Moved factionStatus from CREO to TANO --- .../objects/creature/CreatureObject.java | 12 +++--------- .../objects/tangible/TangibleObject.java | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 2d2cc731..1c8cddf2 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -83,7 +83,6 @@ public class CreatureObject extends TangibleObject implements IPersistent { // CREO 3 private byte posture = 0; - private int factionStatus = 0; private float height; private int battleFatigue = 0; private long stateBitmask = 0; @@ -474,13 +473,8 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(messageBuilder.buildFactionDelta(faction), true); //updatePvpStatus(); } - - public int getFactionStatus() { - synchronized(objectMutex) { - return factionStatus; - } - } - + + @Override public void setFactionStatus(int factionStatus) { synchronized(objectMutex) { this.factionStatus = factionStatus; @@ -489,7 +483,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { notifyObservers(messageBuilder.buildFactionStatusDelta(factionStatus), true); //updatePvpStatus(); } - + public float getHeight() { synchronized(objectMutex) { return height; diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 7f7e7908..b33717d0 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -68,6 +68,7 @@ public class TangibleObject extends SWGObject { private int maxDamage = 1000; private boolean staticObject = true; protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason + protected int factionStatus = 0; @NotPersistent private Vector defendersList = new Vector(); // unused in packets but useful for the server @NotPersistent @@ -311,7 +312,19 @@ public class TangibleObject extends SWGObject { updatePvpStatus(); } - + + public int getFactionStatus() { + synchronized(objectMutex) { + return factionStatus; + } + } + + public void setFactionStatus(int factionStatus) { + synchronized(objectMutex) { + this.factionStatus = factionStatus; + } + } + public Vector getDefendersList() { synchronized(objectMutex) { return defendersList; From 5f1022543e9c05e8d32ca134ee7e9937febe2788 Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 13 Apr 2014 13:17:23 +0100 Subject: [PATCH 07/95] godLevel is now set and used --- scripts/commands/setgodmode.py | 11 ++ scripts/conversation/demo.py | 18 +- src/main/NGECore.java | 7 +- .../objects/harvester/HarvesterObject.java | 14 -- .../objects/player/PlayerMessageBuilder.java | 18 +- .../objects/player/PlayerObject.java | 17 +- src/services/combat/CombatService.java | 5 +- src/services/command/BaseSWGCommand.java | 184 +----------------- src/services/command/CombatCommand.java | 183 ++++++++++++++++- src/services/command/CommandService.java | 84 ++++---- 10 files changed, 279 insertions(+), 262 deletions(-) diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 18c5f4f2..84f981c7 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -29,6 +29,13 @@ def run(core, actor, target, commandString): if not command: return + if actor.getClient().isGM() is False: + return + + if playerObject.getGodLevel() == 0: + actor.addAbility("admin") + playerObject.setGodLevel(50) + if command == 'giveExperience' and arg1: core.playerService.giveExperience(actor, int(arg1)) @@ -103,4 +110,8 @@ def run(core, actor, target, commandString): playerObject.setHoloEmote('holoemote_' + arg1) playerObject.setHoloEmoteUses(20) actor.sendSystemMessage('Holo-Emote Generator set to ' + 'holoemote_' + arg1, 0) + elif command == 'off': + if playerObject.getGodLevel > 0: + actor.removeAbility("admin") + playerObject.setGodLevel(0) return diff --git a/scripts/conversation/demo.py b/scripts/conversation/demo.py index 802329db..35ab97b6 100644 --- a/scripts/conversation/demo.py +++ b/scripts/conversation/demo.py @@ -7,11 +7,11 @@ import sys def startConversation(core, actor, npc): convSvc = core.conversationService - convSvc.sendConversationMessage(actor, npc, OutOfBand(ProsePackage('conversation/respecseller', 's_31'))) + convSvc.sendConversationMessage(actor, npc, OutOfBand(ProsePackage('conversation/respecseller:s_31'))) options = Vector() - options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller', 's_32')), 0)) - options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller', 's_33')), 1)) + options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller:s_32')), 0)) + options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller:s_33')), 1)) convSvc.sendConversationOptions(actor, npc, options, handleFirstScreen) return @@ -22,19 +22,19 @@ def handleFirstScreen(core, actor, npc, selection): # TODO: check for prices if selection == 0: # respec - convSvc.sendConversationMessage(actor, npc, OutOfBand(ProsePackage('conversation/respecseller', 's_58'))) + convSvc.sendConversationMessage(actor, npc, OutOfBand(ProsePackage('conversation/respecseller:s_58'))) options = Vector() - options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller', 's_60')), 0)) - options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller', 's_64')), 1)) + options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller:s_60')), 0)) + options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller:s_64')), 1)) convSvc.sendConversationOptions(actor, npc, options, handleRespecScreen) if selection == 1: # expertise reset - convSvc.sendConversationMessage(actor, npc, OutOfBand(ProsePackage('conversation/respecseller', 's_35'))) + convSvc.sendConversationMessage(actor, npc, OutOfBand(ProsePackage('conversation/respecseller:s_35'))) options = Vector() - options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller', 's_71')), 0)) - options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller', 's_72')), 1)) + options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller:s_71')), 0)) + options.add(ConversationOption(OutOfBand(ProsePackage('conversation/respecseller:s_72')), 1)) convSvc.sendConversationOptions(actor, npc, options, handleResetScreen) return diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 56f33e88..ee431544 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -355,7 +355,12 @@ public class NGECore { zoneDispatch.addService(entertainmentService); //zoneDispatch.addService(missionService); zoneDispatch.addService(bazaarService); - + + if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) { + zoneDispatch.addService(surveyService); + zoneDispatch.addService(resourceService); + } + zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT")); zoneServer.start(); staticService = new StaticService(this); diff --git a/src/resources/objects/harvester/HarvesterObject.java b/src/resources/objects/harvester/HarvesterObject.java index 7fe12cbb..8964d7e1 100644 --- a/src/resources/objects/harvester/HarvesterObject.java +++ b/src/resources/objects/harvester/HarvesterObject.java @@ -21,35 +21,21 @@ ******************************************************************************/ package resources.objects.harvester; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; import java.util.Vector; import main.NGECore; -import protocol.swg.SceneCreateObjectByCrc; -import protocol.swg.SceneDestroyObject; -import protocol.swg.SceneEndBaselines; -import protocol.swg.UpdatePVPStatusMessage; import com.sleepycat.persist.model.Persistent; -import services.chat.WaypointAttachment; import engine.clients.Client; -import engine.resources.common.CRC; -import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; import resources.objects.creature.CreatureObject; import resources.objects.installation.InstallationMessageBuilder; import resources.objects.installation.InstallationObject; -import resources.objects.player.PlayerObject; import resources.objects.resource.GalacticResource; import resources.objects.resource.ResourceContainerObject; -import resources.objects.waypoint.WaypointObject; -import services.chat.Mail; - /** * @author Charon diff --git a/src/resources/objects/player/PlayerMessageBuilder.java b/src/resources/objects/player/PlayerMessageBuilder.java index aae6f5c3..7e518a32 100644 --- a/src/resources/objects/player/PlayerMessageBuilder.java +++ b/src/resources/objects/player/PlayerMessageBuilder.java @@ -107,12 +107,10 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { buffer.setAutoExpand(true); buffer.putShort((short) 0x11); buffer.putInt((short) 0x43); - buffer.put(getAsciiString("string_id_table")); - - buffer.put((byte) 0); // unk - buffer.putShort((short) 0); // unk - buffer.putInt(0); // unk + buffer.putInt(0); // probably stringId + buffer.putShort((short) 0); // detailedDescription + buffer.put(player.getGodLevel()); buffer.putInt(0); // unk buffer.putInt(0); // unk buffer.putInt(0); // unk @@ -654,6 +652,16 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder { buffer = createDelta("PLAY", (byte) 3, (short) 1, (short) 19, buffer, size + 4); return buffer; } + + public IoBuffer buildGodLevelDelta(byte godLevel) { + IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.put(godLevel); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("PLAY", (byte) 6, (short) 1, (short) 0x02, buffer, size + 4); + return buffer; + + } @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index d1c23985..7c956d6f 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -44,7 +44,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=10) +@Persistent(version=11) public class PlayerObject extends IntangibleObject { // PLAY 3 @@ -140,6 +140,8 @@ public class PlayerObject extends IntangibleObject { private SurveyTool lastUsedSurveyTool; private ResourceContainerObject recentContainer; + private byte godLevel = 0; + public PlayerObject() { super(); messageBuilder = new PlayerMessageBuilder(this); @@ -849,4 +851,17 @@ public class PlayerObject extends IntangibleObject { { return this.lotsRemaining; } + + public byte getGodLevel() { + return godLevel; + } + + public void setGodLevel(int godLevel) { + this.godLevel = (byte) godLevel; + + if (getContainer() != null) { + getContainer().getClient().getSession().write(messageBuilder.buildGodLevelDelta((byte) godLevel)); + } + } + } diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index f8cbb7fc..87bfcd31 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -51,7 +51,6 @@ import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; import services.ai.AIActor; import services.combat.CombatEvents.DamageTaken; -import services.command.BaseSWGCommand; import services.command.CombatCommand; import services.sui.SUIService.MessageBoxType; import services.sui.SUIWindow; @@ -402,7 +401,7 @@ public class CombatService implements INetworkDispatch { } - private void sendCombatPackets(CreatureObject attacker, TangibleObject target, WeaponObject weapon, BaseSWGCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) { + private void sendCombatPackets(CreatureObject attacker, TangibleObject target, WeaponObject weapon, CombatCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) { String animationStr = command.getRandomAnimation(weapon); CombatAction combatAction = new CombatAction(CRC.StringtoCRC(animationStr), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC()); @@ -431,7 +430,7 @@ public class CombatService implements INetworkDispatch { } - private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, BaseSWGCommand command, int actionCounter) { + private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { CombatAction combatAction = new CombatAction(CRC.StringtoCRC(command.getDefaultAnimations()[0]), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC()); ObjControllerMessage objController = new ObjControllerMessage(0x1B, combatAction); diff --git a/src/services/command/BaseSWGCommand.java b/src/services/command/BaseSWGCommand.java index 3205bd5e..9c2d639f 100644 --- a/src/services/command/BaseSWGCommand.java +++ b/src/services/command/BaseSWGCommand.java @@ -27,9 +27,6 @@ import engine.resources.common.CRC; import java.util.ArrayList; import java.util.List; -import java.util.Random; - -import resources.objects.weapon.WeaponObject; public class BaseSWGCommand implements Cloneable { @@ -57,22 +54,8 @@ public class BaseSWGCommand implements Cloneable { private Byte[] invalidPostures; private Long[] invalidStates; - private String[] defaultAnimations = new String[]{}; - private String[] oneHandedAnimations = new String[]{}; - private String[] twoHandedAnimations = new String[]{}; - private String[] polearmAnimations = new String[]{}; - private String[] unarmedAnimations = new String[]{}; - private String[] pistolAnimations = new String[]{}; - private String[] carbineAnimations = new String[]{}; - private String[] lightRifleAnimations = new String[]{}; - private String[] rifleAnimations = new String[]{}; - private String[] heavyWpnAnimations = new String[]{}; - private String[] oneHandedLSAnimations = new String[]{}; - private String[] twoHandedLSAnimations = new String[]{}; - private String[] polearmLSAnimations = new String[]{}; - private String[] thrownAnimations = new String[]{}; - public BaseSWGCommand(String commandName) { + commandName.toLowerCase(); setCommandName(commandName); setCommandCRC(CRC.StringtoCRC(commandName)); @@ -375,169 +358,4 @@ public class BaseSWGCommand implements Cloneable { this.warmupTime = warmupTime; } - public String[] getDefaultAnimations() { - return defaultAnimations; - } - - public void setDefaultAnimations(String[] defaultAnimations) { - this.defaultAnimations = defaultAnimations; - } - - public String[] getOneHandedAnimations() { - return oneHandedAnimations; - } - - public void setOneHandedAnimations(String[] oneHandedAnimations) { - this.oneHandedAnimations = oneHandedAnimations; - } - - public String[] getTwoHandedAnimations() { - return twoHandedAnimations; - } - - public void setTwoHandedAnimations(String[] twoHandedAnimations) { - this.twoHandedAnimations = twoHandedAnimations; - } - - public String[] getPolearmAnimations() { - return polearmAnimations; - } - - public void setPolearmAnimations(String[] polearmAnimations) { - this.polearmAnimations = polearmAnimations; - } - - public String[] getUnarmedAnimations() { - return unarmedAnimations; - } - - public void setUnarmedAnimations(String[] unarmedAnimations) { - this.unarmedAnimations = unarmedAnimations; - } - - public String[] getPistolAnimations() { - return pistolAnimations; - } - - public void setPistolAnimations(String[] pistolAnimations) { - this.pistolAnimations = pistolAnimations; - } - - public String[] getCarbineAnimations() { - return carbineAnimations; - } - - public void setCarbineAnimations(String[] carbineAnimations) { - this.carbineAnimations = carbineAnimations; - } - - public String[] getLightRifleAnimations() { - return lightRifleAnimations; - } - - public void setLightRifleAnimations(String[] lightRifleAnimations) { - this.lightRifleAnimations = lightRifleAnimations; - } - - public String[] getRifleAnimations() { - return rifleAnimations; - } - - public void setRifleAnimations(String[] rifleAnimations) { - this.rifleAnimations = rifleAnimations; - } - - public String[] getHeavyWpnAnimations() { - return heavyWpnAnimations; - } - - public void setHeavyWpnAnimations(String[] heavyWpnAnimations) { - this.heavyWpnAnimations = heavyWpnAnimations; - } - - public String[] getOneHandedLSAnimations() { - return oneHandedLSAnimations; - } - - public void setOneHandedLSAnimations(String[] oneHandedLSAnimations) { - this.oneHandedLSAnimations = oneHandedLSAnimations; - } - - public String[] getTwoHandedLSAnimations() { - return twoHandedLSAnimations; - } - - public void setTwoHandedLSAnimations(String[] twoHandedLSAnimations) { - this.twoHandedLSAnimations = twoHandedLSAnimations; - } - - public String[] getPolearmLSAnimations() { - return polearmLSAnimations; - } - - public void setPolearmLSAnimations(String[] polearmLSAnimations) { - this.polearmLSAnimations = polearmLSAnimations; - } - - public String[] getThrownAnimations() { - return thrownAnimations; - } - - public void setThrownAnimations(String[] thrownAnimations) { - this.thrownAnimations = thrownAnimations; - } - - public String getRandomAnimation(WeaponObject weapon) { - int weaponType = weapon.getWeaponType(); - String[] animations; - - switch (weaponType) { - case 0: - animations = rifleAnimations; - break; - case 1: - animations = carbineAnimations; - break; - case 2: - animations = pistolAnimations; - break; - case 3: - animations = heavyWpnAnimations; - break; - case 4: - animations = oneHandedAnimations; - break; - case 5: - animations = twoHandedAnimations; - break; - case 6: - animations = defaultAnimations; - break; - case 7: - animations = polearmAnimations; - break; - case 8: - animations = thrownAnimations; - break; - case 9: - animations = oneHandedLSAnimations; - break; - case 10: - animations = twoHandedLSAnimations; - break; - case 11: - animations = polearmLSAnimations; - break; - default: - animations = defaultAnimations; - break; - } - - if (animations.length == 0) { - animations = defaultAnimations; - } - - return animations[new Random().nextInt(animations.length)]; - } - } diff --git a/src/services/command/CombatCommand.java b/src/services/command/CombatCommand.java index 77ecde00..dd761b02 100644 --- a/src/services/command/CombatCommand.java +++ b/src/services/command/CombatCommand.java @@ -21,6 +21,9 @@ ******************************************************************************/ package services.command; +import java.util.Random; + +import resources.objects.weapon.WeaponObject; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; @@ -60,6 +63,21 @@ public class CombatCommand extends BaseSWGCommand { private float criticalChance; private int attack_rolls; + private String[] defaultAnimations = new String[]{}; + private String[] oneHandedAnimations = new String[]{}; + private String[] twoHandedAnimations = new String[]{}; + private String[] polearmAnimations = new String[]{}; + private String[] unarmedAnimations = new String[]{}; + private String[] pistolAnimations = new String[]{}; + private String[] carbineAnimations = new String[]{}; + private String[] lightRifleAnimations = new String[]{}; + private String[] rifleAnimations = new String[]{}; + private String[] heavyWpnAnimations = new String[]{}; + private String[] oneHandedLSAnimations = new String[]{}; + private String[] twoHandedLSAnimations = new String[]{}; + private String[] polearmLSAnimations = new String[]{}; + private String[] thrownAnimations = new String[]{}; + public CombatCommand(String commandName) { super(commandName); try { @@ -490,6 +508,169 @@ public class CombatCommand extends BaseSWGCommand { this.attack_rolls = attack_rolls; } + public String[] getDefaultAnimations() { + return defaultAnimations; + } + + public void setDefaultAnimations(String[] defaultAnimations) { + this.defaultAnimations = defaultAnimations; + } + + public String[] getOneHandedAnimations() { + return oneHandedAnimations; + } + + public void setOneHandedAnimations(String[] oneHandedAnimations) { + this.oneHandedAnimations = oneHandedAnimations; + } + + public String[] getTwoHandedAnimations() { + return twoHandedAnimations; + } + + public void setTwoHandedAnimations(String[] twoHandedAnimations) { + this.twoHandedAnimations = twoHandedAnimations; + } + + public String[] getPolearmAnimations() { + return polearmAnimations; + } + + public void setPolearmAnimations(String[] polearmAnimations) { + this.polearmAnimations = polearmAnimations; + } + + public String[] getUnarmedAnimations() { + return unarmedAnimations; + } + + public void setUnarmedAnimations(String[] unarmedAnimations) { + this.unarmedAnimations = unarmedAnimations; + } + + public String[] getPistolAnimations() { + return pistolAnimations; + } + + public void setPistolAnimations(String[] pistolAnimations) { + this.pistolAnimations = pistolAnimations; + } + + public String[] getCarbineAnimations() { + return carbineAnimations; + } + + public void setCarbineAnimations(String[] carbineAnimations) { + this.carbineAnimations = carbineAnimations; + } + + public String[] getLightRifleAnimations() { + return lightRifleAnimations; + } + + public void setLightRifleAnimations(String[] lightRifleAnimations) { + this.lightRifleAnimations = lightRifleAnimations; + } + + public String[] getRifleAnimations() { + return rifleAnimations; + } + + public void setRifleAnimations(String[] rifleAnimations) { + this.rifleAnimations = rifleAnimations; + } + + public String[] getHeavyWpnAnimations() { + return heavyWpnAnimations; + } + + public void setHeavyWpnAnimations(String[] heavyWpnAnimations) { + this.heavyWpnAnimations = heavyWpnAnimations; + } + + public String[] getOneHandedLSAnimations() { + return oneHandedLSAnimations; + } + + public void setOneHandedLSAnimations(String[] oneHandedLSAnimations) { + this.oneHandedLSAnimations = oneHandedLSAnimations; + } + + public String[] getTwoHandedLSAnimations() { + return twoHandedLSAnimations; + } + + public void setTwoHandedLSAnimations(String[] twoHandedLSAnimations) { + this.twoHandedLSAnimations = twoHandedLSAnimations; + } + + public String[] getPolearmLSAnimations() { + return polearmLSAnimations; + } + + public void setPolearmLSAnimations(String[] polearmLSAnimations) { + this.polearmLSAnimations = polearmLSAnimations; + } + + public String[] getThrownAnimations() { + return thrownAnimations; + } + + public void setThrownAnimations(String[] thrownAnimations) { + this.thrownAnimations = thrownAnimations; + } + + public String getRandomAnimation(WeaponObject weapon) { + int weaponType = weapon.getWeaponType(); + String[] animations; + + switch (weaponType) { + case 0: + animations = rifleAnimations; + break; + case 1: + animations = carbineAnimations; + break; + case 2: + animations = pistolAnimations; + break; + case 3: + animations = heavyWpnAnimations; + break; + case 4: + animations = oneHandedAnimations; + break; + case 5: + animations = twoHandedAnimations; + break; + case 6: + animations = defaultAnimations; + break; + case 7: + animations = polearmAnimations; + break; + case 8: + animations = thrownAnimations; + break; + case 9: + animations = oneHandedLSAnimations; + break; + case 10: + animations = twoHandedLSAnimations; + break; + case 11: + animations = polearmLSAnimations; + break; + default: + animations = defaultAnimations; + break; + } + + if (animations.length == 0) { + animations = defaultAnimations; + } + + return animations[new Random().nextInt(animations.length)]; + } - } diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index b7fb6c04..809570bb 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -47,7 +47,6 @@ import protocol.swg.objectControllerObjects.CommandEnqueue; import protocol.swg.objectControllerObjects.CommandEnqueueRemove; import protocol.swg.objectControllerObjects.StartTask; import resources.objects.creature.CreatureObject; -import resources.objects.harvester.HarvesterObject; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; @@ -75,7 +74,7 @@ public class CommandService implements INetworkDispatch { return false; } - if (command.getCharacterAbility().length() > 0 && !actor.hasAbility(command.getCharacterAbility()) && !command.getCharacterAbility().equals("admin") && actor.getClient() != null) { + if (command.getCharacterAbility().length() > 0 && !actor.hasAbility(command.getCharacterAbility()) && actor.getClient() != null) { return false; } @@ -83,7 +82,7 @@ public class CommandService implements INetworkDispatch { return false; } - if (command.getGodLevel() > 0 && (actor.getClient() == null || !actor.getClient().isGM())) { + if (actor.getClient() != null && command.getGodLevel() > actor.getPlayerObject().getGodLevel()) { return false; } @@ -148,15 +147,15 @@ public class CommandService implements INetworkDispatch { break; case 2: // Anyone (objectId/targetName) - if (actor.getClient() == null) { - break; - } - if (target == null) { if (commandArgs != null && !commandArgs.equals("")) { String name = commandArgs.split(" ")[0]; target = core.objectService.getObjectByFirstName(name); + + if (target == actor) { + target = null; + } } break; @@ -240,14 +239,20 @@ public class CommandService implements INetworkDispatch { TangibleObject object = (TangibleObject) target; - if(object instanceof CreatureObject && actor.getFactionStatus() < ((CreatureObject) object).getFactionStatus()) + if (!object.getFaction().equals("") && !object.getFaction().equals(actor.getFaction())) { return false; + } - if (object.isAttackableBy(actor) || (!object.getFaction().equals("") && !object.getFaction().equals(actor.getFaction()))) { + if (actor.getFactionStatus() < object.getFactionStatus()) { + return false; + } + + if (object.isAttackableBy(actor)) { return false; } // Without this we could be buffing ally NPCs and such + // Think this is checked later on if (actor.getSlottedObject("ghost") != null && object.getSlottedObject("ghost") == null) { return false; } @@ -270,7 +275,7 @@ public class CommandService implements INetworkDispatch { default: break; } - + if (command.shouldCallOnTarget()) { if (target == null || !(target instanceof CreatureObject)) { return false; @@ -279,7 +284,7 @@ public class CommandService implements INetworkDispatch { actor = (CreatureObject) target; } - long warmupTime = (long) (command.getWarmupTime() * 1000F); + long warmupTime = (long) (command.getWarmupTime() * 1000f); if(warmupTime > 0) { try { @@ -320,19 +325,7 @@ public class CommandService implements INetworkDispatch { String name = ((String) visitor.getObject(i, 0)).toLowerCase(); if (CRC.StringtoCRC(name) == commandCRC) { - int sub = 0; - - boolean hasCharacterAbility = (((String) visitor.getObject(i, 7-sub)).length() > 0); - - if (tableArray[n].startsWith("client_") || tableArray[n].startsWith("command_table_")) { - sub += 7; - } - - if (tableArray[n].equals("client_command_table_space")) { - sub += 5; - } - - if (hasCharacterAbility || isCombatCommand(name)) { + if (isCombatCommand(name)) { CombatCommand command = new CombatCommand(name.toLowerCase()); commandLookup.add(command); return command; @@ -376,19 +369,7 @@ public class CommandService implements INetworkDispatch { String commandName = ((String) visitor.getObject(i, 0)).toLowerCase(); if (commandName.equalsIgnoreCase(name)) { - int sub = 0; - - boolean hasCharacterAbility = (((String) visitor.getObject(i, 7-sub)).length() > 0); - - if (tableArray[n].startsWith("client_") || tableArray[n].startsWith("command_table_")) { - sub += 7; - } - - if (tableArray[n].equals("client_command_table_space")) { - sub += 5; - } - - if (/*hasCharacterAbility ||*/ isCombatCommand(commandName)) { + if (isCombatCommand(commandName)) { CombatCommand command = new CombatCommand(commandName); commandLookup.add(command); return command; @@ -425,9 +406,10 @@ public class CommandService implements INetworkDispatch { } public void processCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) { - if(command.getCooldown() > 0) + if (command.getCooldown() > 0f) { actor.addCooldown(command.getCooldownGroup(), command.getCooldown()); - + } + if (command instanceof CombatCommand) { processCombatCommand(actor, target, (CombatCommand) command, actionCounter, commandArgs); } else { @@ -608,13 +590,25 @@ public class CommandService implements INetworkDispatch { } - public BaseSWGCommand registerCombatCommand(String name) { return getCommandByName(name); } - public BaseSWGCommand registerCommand(String name) { return getCommandByName(name); } - public BaseSWGCommand registerGmCommand(String name) { + public BaseSWGCommand registerCommand(String name) { + return getCommandByName(name); + } + + public CombatCommand registerCombatCommand(String name) { BaseSWGCommand command = getCommandByName(name); - if(command != null) - command.setGodLevel(5); - return command; + + if (command instanceof CombatCommand) { + return (CombatCommand) command; + } + + return null; + } + + public BaseSWGCommand registerGmCommand(String name) { + BaseSWGCommand command = getCommandByName(name); + //if(command != null) + //command.setGodLevel(5); // not sure if still needed after more recent commits + return command; } } From a90dd74b809b8f3a444628b32af80f6aebd91c70 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 14:38:39 +0200 Subject: [PATCH 08/95] Exception handling for Harvester Service future executor handler This should show any runtime exceptions of the Runnable(), because something kills the task after some time, probably an exception. --- src/services/object/ObjectService.java | 3 +- src/services/resources/HarvesterService.java | 42 +++++++++++++++++--- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index f4385f18..4dd8d8d5 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -397,8 +397,7 @@ public class ObjectService implements INetworkDispatch { float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f; Point3D newpoint = new Point3D(position.x,positionY,position.z); - object = new HarvesterObject(objectID, planet, Template, newpoint, orientation); - core.harvesterService.addHarvester(object); + object = new HarvesterObject(objectID, planet, Template, newpoint, orientation); } else { return null; diff --git a/src/services/resources/HarvesterService.java b/src/services/resources/HarvesterService.java index 71d2a276..95cee397 100644 --- a/src/services/resources/HarvesterService.java +++ b/src/services/resources/HarvesterService.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.Vector; +import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -149,14 +150,39 @@ public class HarvesterService implements INetworkDispatch { } }, 10, 5000, TimeUnit.MILLISECONDS); - + + ExecutionSurveillanceThread executionSurveillance = new ExecutionSurveillanceThread(task); + executionSurveillance.start(); } + class ExecutionSurveillanceThread extends Thread { + ScheduledFuture task; + + public ExecutionSurveillanceThread(ScheduledFuture task) { + this.task = task; + } + + public void run() { + try { + try { + task.get(); + } catch (InterruptedException e1) { + System.err.println("InterruptedException IN HARVESTERSERVICE !!! " + e1.getMessage()); + } + } catch (ExecutionException e2) { + System.err.println("EXCEPTION IN HARVESTERSERVICE !!! " + e2.getMessage()); + System.err.println("EXCEPTION CAUSE : " + e2.getCause()); + } + } + } + public void ServiceProcessing(){ synchronized(allHarvesters){ for (HarvesterObject harvester : allHarvesters){ - updateHarvester(harvester); + if (harvester!=null) + updateHarvester(harvester); } + allHarvesters.removeAll(Collections.singleton(null)); } synchronized(allConstructors){ Vector removeConstructors = new Vector(); @@ -166,19 +192,22 @@ public class HarvesterService implements INetworkDispatch { removeConstructors.add(constructor); } allConstructors.removeAll(removeConstructors); + allConstructors.removeAll(Collections.singleton(null)); } } public void addHarvester(SWGObject harvester){ synchronized(allHarvesters){ - allHarvesters.add((HarvesterObject)harvester); + if (harvester!=null) + allHarvesters.add((HarvesterObject)harvester); } } public void removeHarvester(SWGObject harvester){ synchronized(allHarvesters){ - allHarvesters.remove((HarvesterObject)harvester); + if (harvester!=null) + allHarvesters.remove((HarvesterObject)harvester); } } @@ -432,6 +461,7 @@ public class HarvesterService implements INetworkDispatch { deed.setSurplusPower((int)harvester.getPowerLevel()); deed.setAttributes(); + removeHarvester(harvester); core.objectService.destroyObject(harvester.getObjectID()); SWGObject crafterInventory = owner.getSlottedObject("inventory"); @@ -969,6 +999,8 @@ public class HarvesterService implements INetworkDispatch { float positionY = NGECore.getInstance().terrainService.getHeight(actor.getPlanetId(), object.getPosition().x, object.getPosition().z); harvester.setPosition(new Point3D(object.getPosition().x,positionY, object.getPosition().z)); core.simulationService.add(harvester, harvester.getPosition().x, harvester.getPosition().z, true); + addHarvester(harvester); + PlayerObject player = (PlayerObject) actor.getSlottedObject("ghost"); WaypointObject constructionWaypoint = (WaypointObject)NGECore.getInstance().objectService.createObject("object/waypoint/shared_world_waypoint_blue.iff", actor.getPlanet(), harvester.getPosition().x, 0 ,harvester.getPosition().z); String displayname = "@installation_n:"+harvester.getStfName(); @@ -1020,7 +1052,7 @@ public class HarvesterService implements INetworkDispatch { public void enterStructurePlacementMode(SWGObject object, CreatureObject actor){ - if (!core.terrainService.canBuildAtPosition(actor,actor.getPosition().x,actor.getPosition().z)){ + if (!actor.getClient().isGM() && !core.terrainService.canBuildAtPosition(actor,actor.getPosition().x,actor.getPosition().z)){ actor.sendSystemMessage("@player_structure:not_permitted", (byte) 0); return; } From cbefc251213f3f528c58ccd5b41cbbf36f5f0b67 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Sun, 13 Apr 2014 19:15:17 +0200 Subject: [PATCH 09/95] Refactored WeaponObject The scripting of weapons should be much, much easier now. See the included examples in DevService. Attributes such as attack speed and range are now being read/written to the actual items attributes. --- scripts/commands/co_hw_dot.py | 12 +- scripts/equipment/weapon_critical.py | 30 ++-- .../creature/creature_default_weapon.py | 7 + .../objects/weapon/WeaponObject.java | 128 +++++------------- src/services/CharacterService.java | 6 - src/services/DevService.java | 103 +++++++++----- src/services/EquipmentService.java | 10 +- 7 files changed, 141 insertions(+), 155 deletions(-) diff --git a/scripts/commands/co_hw_dot.py b/scripts/commands/co_hw_dot.py index 7b9a8aac..3ce9825c 100644 --- a/scripts/commands/co_hw_dot.py +++ b/scripts/commands/co_hw_dot.py @@ -18,7 +18,7 @@ def run(core, actor, target, commandString): elementalType = weapon.getElementalType() commandName = '' - if elementalType == '@obj_attr_n:elemental_heat': + if elementalType == 'heat': if actor.getLevel() >= 58: commandName = 'co_hw_dot_fire_1' if actor.getLevel() >= 60: @@ -29,7 +29,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_fire_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_fire_5' - elif elementalType == '@obj_attr_n:elemental_cold': + elif elementalType == 'cold': if actor.getLevel() >= 58: commandName = 'co_hw_dot_cold_1' if actor.getLevel() >= 60: @@ -40,7 +40,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_cold_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_cold_5' - elif elementalType == '@obj_attr_n:elemental_acid': + elif elementalType == 'acid': if actor.getLevel() >= 58: commandName = 'co_hw_dot_acid_1' if actor.getLevel() >= 60: @@ -51,7 +51,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_acid_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_acid_5' - elif elementalType == '@obj_attr_n:elemental_electricity': + elif elementalType == 'electricity': if actor.getLevel() >= 58: commandName = 'co_hw_dot_electrical_1' if actor.getLevel() >= 60: @@ -62,7 +62,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_electrical_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_electrical_5' - elif elementalType == '@obj_attr_n:elemental_energy': + elif elementalType == 'energy': if actor.getLevel() >= 58: commandName = 'co_hw_dot_energy_1' if actor.getLevel() >= 60: @@ -73,7 +73,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_energy_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_energy_5' - elif elementalType =='@obj_attr_n:elemental_kinetic': + elif elementalType =='kinetic': if actor.getLevel() >= 58: commandName = 'co_hw_dot_kinetic_1' if actor.getLevel() >= 60: diff --git a/scripts/equipment/weapon_critical.py b/scripts/equipment/weapon_critical.py index 683c4692..9f392f34 100644 --- a/scripts/equipment/weapon_critical.py +++ b/scripts/equipment/weapon_critical.py @@ -1,25 +1,37 @@ import sys -def Rifle(): +def weap_0(): return "expertise_critical_rifle" -def Carbine(): +def weap_1(): return "expertise_critical_carbine" -def Pistol(): +def weap_2(): return "expertise_critical_pistol" -def OneHandedMelee(): +def weap_4(): return "expertise_critical_1h" -def TwoHandedMelee(): +def weap_5(): return "expertise_critical_2h" -def Unarmed(): +def weap_6(): return "expertise_critical_unarmed" -def Polearm(): +def weap_7(): return "expertise_critical_polearm" - -def FreeTargetingHeavyWeapon(): + +def weap_9(): + return "" + +def weap_10(): + return "" + +def weap_11(): + return "" + +def weap_12(): return "expertise_critical_heavy" + +def weap_13(): + return "expertise_critical_heavy" \ No newline at end of file diff --git a/scripts/object/weapon/creature/creature_default_weapon.py b/scripts/object/weapon/creature/creature_default_weapon.py index ccad8904..811f1296 100644 --- a/scripts/object/weapon/creature/creature_default_weapon.py +++ b/scripts/object/weapon/creature/creature_default_weapon.py @@ -1,4 +1,11 @@ import sys def setup(core, object): + object.setAttackSpeed(1) + object.setDamageType("kinetic") + object.setMinDamage(50) + object.setMaxDamage(100) + object.setMaxRange(5) + object.setWeaponType(6) + return \ No newline at end of file diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 17325be5..392c206a 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -31,7 +31,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=0) +@Persistent(version=1) public class WeaponObject extends TangibleObject { // TODO: Thread safety @@ -39,53 +39,24 @@ public class WeaponObject extends TangibleObject { @NotPersistent private WeaponMessageBuilder messageBuilder; - private float attackSpeed = 1; - private float maxRange; - public WeaponObject(long objectID, Planet planet, String template) { super(objectID, planet, template, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0)); messageBuilder = new WeaponMessageBuilder(this); if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); - calculateRange(); - calculateAttackSpeed(); + setStringAttribute("cat_wpn_damage.damage", "0-0"); } public WeaponObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { super(objectID, planet, template, position, orientation); messageBuilder = new WeaponMessageBuilder(this); if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); - calculateRange(); - calculateAttackSpeed(); + setStringAttribute("cat_wpn_damage.damage", "0-0"); } public WeaponObject() { super(); messageBuilder = new WeaponMessageBuilder(this); - //calculateRange(); - } - - private void calculateRange() { - - int weaponType = getWeaponType(); - - switch(weaponType) { - - case 0: maxRange = 64; break; - case 1: maxRange = 50; break; - case 2: maxRange = 35; break; - case 12: maxRange = 64; break; - case 4: maxRange = 5; break; - case 5: maxRange = 5; break; - case 6: maxRange = 5; break; - case 7: maxRange = 5; break; - case 8: maxRange = 64; break; - case 9: maxRange = 5; break; - case 10: maxRange = 5; break; - case 11: maxRange = 5; break; - - } - } public int getIncapTimer() { @@ -118,7 +89,9 @@ public class WeaponObject extends TangibleObject { } public void setMaxDamage(int maxDamage) { + setStringAttribute("cat_wpn_damage.damage", String.valueOf(getMinDamage()) + "-" + String.valueOf(maxDamage)); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public int getMinDamage() { @@ -126,7 +99,9 @@ public class WeaponObject extends TangibleObject { } public void setMinDamage(int minDamage) { + setStringAttribute("cat_wpn_damage.damage", String.valueOf(minDamage) + "-" + String.valueOf(getMaxDamage())); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public int getElementalDamage() { @@ -135,14 +110,17 @@ public class WeaponObject extends TangibleObject { public void setElementalDamage(int elementalDamage) { setIntAttribute("cat_wpn_damage.wpn_elemental_value", elementalDamage); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public String getElementalType() { - return getStringAttribute("cat_wpn_damage.wpn_elemental_type"); + if (getStringAttribute("cat_wpn_damage.wpn_elemental_type") != null ) + return getStringAttribute("cat_wpn_damage.wpn_elemental_type").replace("@obj_attr_n:elemental_", ""); + return null; } public void setElementalType(String elementalType) { - setStringAttribute("cat_wpn_damage.wpn_elemental_type", elementalType); + setStringAttribute("cat_wpn_damage.wpn_elemental_type", "@obj_attr_n:elemental_" + elementalType); } public String getDamageType() { @@ -150,43 +128,26 @@ public class WeaponObject extends TangibleObject { } public void setDamageType(String damageType) { - setStringAttribute("cat_wpn_damage.wpn_damage_type", damageType); + setStringAttribute("cat_wpn_damage.wpn_damage_type", "@obj_attr_n:armor_eff_" + damageType); } public int getDamagePerSecond() { - if (getElementalType() != null) + if(getAttributes().containsKey("cat_wpn_damage.damage") && getAttributes().containsKey("cat_wpn_damage.wpn_attack_speed")) { + + if (getElementalType() != null ) return (int) (((getMaxDamage() + getElementalDamage() + getMinDamage() + getElementalDamage()) / 2 + getElementalDamage()) * (1 / getAttackSpeed())); - else - return (int) (((getMaxDamage() + getMinDamage()) / 2 ) * (1 / getAttackSpeed())); + else + return (int) (((getMaxDamage() + getMinDamage()) / 2 ) * (1 / getAttackSpeed())); + } else + return 0; } public int getWeaponType() { - - int weaponType = -1; - - String template = getTemplate(); - - if(template == null) - return weaponType; - - if(template.contains("rifle")) weaponType = 0; - if(template.contains("carbine")) weaponType = 1; - if(template.contains("pistol")) weaponType = 2; - if(template.contains("heavy")) weaponType = 12; - if(template.contains("sword") || template.contains("baton")) weaponType = 4; - if(template.contains("2h_sword") || template.contains("axe")) weaponType = 5; - if(template.contains("unarmed")) weaponType = 6; - if(template.contains("polearm") || template.contains("lance")) weaponType = 7; - if(template.contains("thrown")) weaponType = 8; - if(template.contains("lightsaber_one_handed")) weaponType = 9; - if(template.contains("lightsaber_two_handed")) weaponType = 10; - if(template.contains("lightsaber_polearm")) weaponType = 11; - - if(weaponType == -1) - weaponType = 6; - - return weaponType; - + return Integer.parseInt(getStringAttribute("cat_wpn_damage.wpn_category").replace("@obj_attr_n:wpn_category_", "")); + } + + public void setWeaponType(int weaponType) { + setStringAttribute("cat_wpn_damage.wpn_category", "@obj_attr_n:wpn_category_" + weaponType); } @Override @@ -204,11 +165,15 @@ public class WeaponObject extends TangibleObject { } public float getAttackSpeed() { - return attackSpeed; + return getFloatAttribute("cat_wpn_damage.wpn_attack_speed"); } public void setAttackSpeed(float attackSpeed) { - this.attackSpeed = attackSpeed; + if((int) attackSpeed != attackSpeed) + setFloatAttribute("cat_wpn_damage.wpn_attack_speed", attackSpeed); + else + setIntAttribute("cat_wpn_damage.wpn_attack_speed", (int) attackSpeed); + } public WeaponMessageBuilder getMessageBuilder() { @@ -216,11 +181,14 @@ public class WeaponObject extends TangibleObject { } public float getMaxRange() { - return maxRange; + return Float.parseFloat(getStringAttribute("cat_wpn_damage.wpn_range").replace("0-", "").replace("m", "")); } public void setMaxRange(float maxRange) { - this.maxRange = maxRange; + if((int) maxRange != maxRange) + setStringAttribute("cat_wpn_damage.wpn_range", "0-" + String.valueOf(maxRange) + "m"); + else + setStringAttribute("cat_wpn_damage.wpn_range", "0-" + String.valueOf((int) maxRange) + "m"); } public boolean isMelee() { @@ -244,29 +212,5 @@ public class WeaponObject extends TangibleObject { return false; } - - private void calculateAttackSpeed() { - - int weaponType = getWeaponType(); - - switch(weaponType) { - - case 0: attackSpeed = 0.8f; break; - case 1: attackSpeed = 0.6f; break; - case 2: attackSpeed = 0.4f; break; - case 12: attackSpeed = 1; break; - case 4: attackSpeed = 1; break; - case 5: attackSpeed = 1; break; - case 6: attackSpeed = 1; break; - case 7: attackSpeed = 1; break; - case 8: attackSpeed = 1; break; - case 9: attackSpeed = 1; break; - case 10: attackSpeed = 1; break; - case 11: attackSpeed = 1; break; - - } - - } - } diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 9a00b424..67c67f51 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -331,13 +331,7 @@ public class CharacterService implements INetworkDispatch { object.addObjectToEquipList(appInventory); WeaponObject defaultWeapon = (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", object.getPlanet()); - defaultWeapon.setDamageType("@obj_attr_n:armor_eff_kinetic"); - defaultWeapon.setStringAttribute("cat_wpn_damage.damage", "0-0"); - defaultWeapon.setMaxDamage(100); - defaultWeapon.setMinDamage(50); - object.addObjectToEquipList(defaultWeapon); - object._add(defaultWeapon); object.setWeaponId(defaultWeapon.getObjectID()); diff --git a/src/services/DevService.java b/src/services/DevService.java index 58c9fea4..b8ef3c31 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -43,6 +43,7 @@ import resources.objects.deed.Player_House_Deed; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.tool.SurveyTool; +import resources.objects.weapon.WeaponObject; import services.sui.SUIWindow; import services.sui.SUIService.ListBoxType; import services.sui.SUIWindow.SUICallback; @@ -96,6 +97,7 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 30, "Jedi Weapons"); suiOptions.put((long) 31, "Melee Weapons"); suiOptions.put((long) 32, "Ranged Weapons"); + suiOptions.put((long) 33, "Heavy Weapons"); break; case 4: // [Items] Misc Items suiOptions.put((long) 40, "Unity Ring"); @@ -202,26 +204,35 @@ public class DevService implements INetworkDispatch { // [Items] Weapons case 30: // Jedi Weapons - TangibleObject lightsaber1 = (TangibleObject) core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet); + WeaponObject lightsaber1 = (WeaponObject) core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet); lightsaber1.setIntAttribute("required_combat_level", 90); - lightsaber1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); lightsaber1.setStringAttribute("class_required", "Jedi"); - lightsaber1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber1.setStringAttribute("cat_wpn_damage.damage", "689-1379"); + lightsaber1.setAttackSpeed(1); + lightsaber1.setDamageType("energy"); + lightsaber1.setMaxRange(5); + lightsaber1.setMinDamage(689); + lightsaber1.setMaxDamage(1379); + lightsaber1.setWeaponType(9); - TangibleObject lightsaber2 = (TangibleObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet); + WeaponObject lightsaber2 = (WeaponObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet); lightsaber2.setIntAttribute("required_combat_level", 90); - lightsaber2.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); lightsaber2.setStringAttribute("class_required", "Jedi"); - lightsaber2.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber2.setStringAttribute("cat_wpn_damage.damage", "689-1379"); + lightsaber2.setAttackSpeed(1); + lightsaber2.setDamageType("energy"); + lightsaber2.setMaxRange(5); + lightsaber2.setMinDamage(689); + lightsaber2.setMaxDamage(1379); + lightsaber2.setWeaponType(10); - TangibleObject lightsaber3 = (TangibleObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet); + WeaponObject lightsaber3 = (WeaponObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet); lightsaber3.setIntAttribute("required_combat_level", 90); - lightsaber3.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); lightsaber3.setStringAttribute("class_required", "Jedi"); - lightsaber3.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber3.setStringAttribute("cat_wpn_damage.damage", "689-1379"); + lightsaber3.setAttackSpeed(1); + lightsaber3.setDamageType("energy"); + lightsaber3.setMaxRange(5); + lightsaber3.setMinDamage(689); + lightsaber3.setMaxDamage(1379); + lightsaber3.setWeaponType(11); Random random = new Random(); @@ -234,43 +245,67 @@ public class DevService implements INetworkDispatch { inventory.add(lightsaber3); return; case 31: // Melee Weapons - SWGObject sword1 = core.objectService.createObject("object/weapon/melee/sword/shared_sword_01.iff", planet); + WeaponObject sword1 = (WeaponObject) core.objectService.createObject("object/weapon/melee/sword/shared_sword_01.iff", planet); sword1.setIntAttribute("required_combat_level", 90); - sword1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - sword1.setStringAttribute("class_required", "None"); - sword1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - sword1.setStringAttribute("cat_wpn_damage.damage", "1100-1200"); + sword1.setAttackSpeed(1); + sword1.setMaxRange(5); + sword1.setDamageType("kinetic"); + sword1.setMinDamage(1100); + sword1.setMaxDamage(1200); + sword1.setWeaponType(4); inventory.add(sword1); return; case 32: // Ranged Weapons - SWGObject rifle1 = core.objectService.createObject("object/weapon/ranged/rifle/shared_rifle_e11.iff", planet); + WeaponObject rifle1 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/rifle/shared_rifle_e11.iff", planet); rifle1.setIntAttribute("required_combat_level", 90); - rifle1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", (float) 0.8); - rifle1.setStringAttribute("class_required", "None"); - rifle1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - rifle1.setStringAttribute("cat_wpn_damage.damage", "800-1250"); + rifle1.setAttackSpeed((float) 0.8); + rifle1.setMaxRange(64); + rifle1.setDamageType("energy"); + rifle1.setMinDamage(800); + rifle1.setMaxDamage(1250); + rifle1.setWeaponType(0); inventory.add(rifle1); - SWGObject pistol = core.objectService.createObject("object/weapon/ranged/pistol/shared_pistol_cdef.iff", planet); + WeaponObject carbine1 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/carbine/shared_carbine_cdef.iff", planet); + carbine1.setIntAttribute("required_combat_level", 90); + carbine1.setAttackSpeed((float) 0.6); + carbine1.setMaxRange(50); + carbine1.setDamageType("energy"); + carbine1.setMinDamage(600); + carbine1.setMaxDamage(937); + carbine1.setWeaponType(1); + + inventory.add(carbine1); + + WeaponObject pistol = (WeaponObject) core.objectService.createObject("object/weapon/ranged/pistol/shared_pistol_cdef.iff", planet); pistol.setIntAttribute("required_combat_level", 90); - pistol.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", (float) 0.4); - pistol.setStringAttribute("class_required", "None"); - pistol.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - pistol.setStringAttribute("cat_wpn_damage.damage", "400-559"); + pistol.setAttackSpeed((float) 0.4); + pistol.setMaxRange(35); + pistol.setDamageType("energy"); + pistol.setMinDamage(400); + pistol.setMaxDamage(625); + pistol.setWeaponType(2); inventory.add(pistol); + return; - /* == Disabled until Elemental Damage is implemented. == - SWGObject heavy = core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); + case 33: + WeaponObject heavy = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); heavy.setIntAttribute("required_combat_level", 90); - heavy.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - heavy.setStringAttribute("class_required", "Commando"); - heavy.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - heavy.setStringAttribute("cat_wpn_damage.damage", "700-1400"); - inventory.add(heavy);*/ + heavy.setStringAttribute("class_required", "Commando"); + heavy.setDamageType("kinetic"); + heavy.setMinDamage(700); + heavy.setMaxDamage(1400); + heavy.setMaxRange(64); + heavy.setAttackSpeed(1); + heavy.setElementalType("heat"); + heavy.setElementalDamage(200); + heavy.setWeaponType(12); + + inventory.add(heavy); return; case 40: TangibleObject ring = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); diff --git a/src/services/EquipmentService.java b/src/services/EquipmentService.java index 12764c94..380dae39 100644 --- a/src/services/EquipmentService.java +++ b/src/services/EquipmentService.java @@ -278,14 +278,8 @@ public class EquipmentService implements INetworkDispatch { private int getWeaponCriticalChance(CreatureObject actor, SWGObject item) { int weaponCriticalChance = 0; - String weaponCriticalSkillMod = (core.scriptService.getMethod("scripts/equipment/", "weapon_critical", item.getStringAttribute("cat_wpn_damage.wpn_category")).__call__().asString()); - - if(weaponCriticalSkillMod.contains(" ")) - weaponCriticalSkillMod.replace(" ", ""); - - if(weaponCriticalSkillMod.contains("-")) - weaponCriticalSkillMod.replace("-", ""); - + String weaponCriticalSkillMod = (core.scriptService.getMethod("scripts/equipment/", "weapon_critical", "weap_" + item.getStringAttribute("cat_wpn_damage.wpn_category").replace("@obj_attr_n:wpn_category_", "")).__call__().asString()); + if(actor.getSkillMod(weaponCriticalSkillMod) != null) weaponCriticalChance = actor.getSkillModBase(weaponCriticalSkillMod); From 53c1ea65e94f11db0b0d026ae14871bca7757e2b Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 20:39:36 +0200 Subject: [PATCH 10/95] merge conflict fix 2 --- .../vehicle/speederbike_swoop_pcd.py | 19 -------- .../vehicle_deed/speederbike_swoop_deed.py | 12 ----- scripts/radial/vehicle.py | 14 ------ .../objects/creature/CreatureObject.java | 45 ------------------- 4 files changed, 90 deletions(-) diff --git a/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py b/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py index b3b28d66..ace4cdfc 100644 --- a/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py +++ b/scripts/object/intangible/vehicle/speederbike_swoop_pcd.py @@ -1,34 +1,15 @@ import sys def setup(core, object): -<<<<<<< HEAD - #object.setAttachment('vehicleId', core.objectService.generateObjectID()) - object.setAttachment('radial_filename', 'item') - return - -def use(core, actor, object): - if object: - vehicleId = object.getObjectID() - #vehicleId = object.getAttachment('vehicleId') -======= object.setAttachment('radial_filename', 'vehicle_pcd') return def use(core, actor, object): if object and actor.getAttachment('activeVehicleID') == None: swoop = core.objectService.createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', 0, actor.getPlanet(), actor.getPosition(), actor.getOrientation()) ->>>>>>> upstream/master swoop.setOwnerId(actor.getObjectID()) actor.setAttachment('activeVehicleID', swoop.getObjectID()) -<<<<<<< HEAD - vehicle = core.objectService.getObject(vehicleId) - - swoop = core.objectService.createObject('object/mobile/vehicles/shared_speederbike_swoop.iff', vehicleId, actor.getPlanet(), actor.getPosition(), actor.getOrientation()) core.simulationService.add(swoop, swoop.getPosition().x, swoop.getPosition().z, True) - -======= - core.simulationService.add(swoop, swoop.getPosition().x, swoop.getPosition().z, True) ->>>>>>> upstream/master return \ No newline at end of file diff --git a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py index 70ce99d9..4b0e320f 100644 --- a/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py +++ b/scripts/object/tangible/deed/vehicle_deed/speederbike_swoop_deed.py @@ -6,23 +6,12 @@ def setup(core, object): def use(core, actor, object): datapad = actor.getSlottedObject('datapad') -<<<<<<< HEAD - - pcd = core.objectService.createObject('object/intangible/vehicle/shared_speederbike_swoop_pcd.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) - #actor.sendSystemMessage('actor.getObjectID() %s' % actor.getObjectID(), 0) -======= pcd = core.objectService.createObject('object/intangible/vehicle/shared_speederbike_swoop_pcd.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) ->>>>>>> upstream/master if datapad and pcd: datapad.add(pcd) core.objectService.destroyObject(object) -<<<<<<< HEAD - vehicle = core.objectService.createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) - vehicle.setOwnerId(actor.getObjectID()) - core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) -======= vehicleId = actor.getAttachment('activeVehicleID') @@ -31,6 +20,5 @@ def use(core, actor, object): vehicle.setOwnerId(actor.getObjectID()) core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) actor.setAttachment('activeVehicleID', vehicle.getObjectID()) ->>>>>>> upstream/master return \ No newline at end of file diff --git a/scripts/radial/vehicle.py b/scripts/radial/vehicle.py index e03a2f0b..2cf9f19b 100644 --- a/scripts/radial/vehicle.py +++ b/scripts/radial/vehicle.py @@ -15,19 +15,6 @@ def createRadial(core, owner, target, radials): def handleSelection(core, owner, target, option): if target: -<<<<<<< HEAD - if option == 21 or option == 40: - #owner.setPosture(16) - owner.setMounted(1) - #owner.setParent(target) - target.initMount(owner) - #target.add(owner) - #target.setOwner(owner) - #Vehicles.testbike(owner,target) - - #target.unmount(owner) - #core.objectService.useObject(owner, target) -======= if option == 208: if not owner.isMounted(): owner.setMounted(1) @@ -35,7 +22,6 @@ def handleSelection(core, owner, target, option): else: target.unmount(owner) ->>>>>>> upstream/master if option == 60: if owner.isMounted(): vehicleObject.unmount(owner) core.objectService.destroyObject(target) diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index c2963b96..fc44c02e 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -68,11 +68,7 @@ import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import services.command.BaseSWGCommand; -<<<<<<< HEAD -@Entity(version=7) -======= @Entity(version=8) ->>>>>>> upstream/master public class CreatureObject extends TangibleObject implements IPersistent { @NotPersistent @@ -192,10 +188,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { private ConcurrentHashMap cooldowns = new ConcurrentHashMap(); public boolean mounted = false; -<<<<<<< HEAD -======= @NotPersistent ->>>>>>> upstream/master public CreatureObject mountedVehicle; public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { @@ -1805,25 +1798,6 @@ public class CreatureObject extends TangibleObject implements IPersistent { this.mountedVehicle = mountedVehicle; } -<<<<<<< HEAD - public void mount(CreatureObject owner) { - synchronized(objectMutex) { - if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT){ - UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), -1); - owner.getClient().getSession().write(updateContainmentMessage.serialize()); - owner.setParent(this); - } - } - } - - public void unmount(CreatureObject owner) { - synchronized(objectMutex) { - if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT){ - UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), -1); - owner.getClient().getSession().write(updateContainmentMessage.serialize()); - } - } -======= public boolean canMount(CreatureObject vehicle) { if(vehicle.getOwnerId() == this.getObjectId()) return true; @@ -1864,28 +1838,10 @@ public class CreatureObject extends TangibleObject implements IPersistent { NGECore.getInstance().simulationService.add(owner, getWorldPosition().x, getWorldPosition().z, false); NGECore.getInstance().simulationService.teleport(owner, getWorldPosition(), getOrientation(), 0); } ->>>>>>> upstream/master } public void initMount(CreatureObject owner) { synchronized(objectMutex) { -<<<<<<< HEAD - this.ownerId = owner.getObjectID(); - setStateBitmask(0x10000000); - owner.setParent(this); - owner.getClient().getSession().write(messageBuilder.buildOwnerIdDelta(ownerId)); - owner.setMountedVehicle(this); - this.setOwnerId(owner.getObjectID()); - //this.add(owner); // NPE at engine.resources.objects.SWGObject.getCorrectArrangementId(kd:844) - this.mount(owner); - // setStateBitmask(28); - // owner.setStateBitmask(27); - owner.setStateBitmask(0x8000000); - this.setPosture((byte)10); - - //this.sendBaselines(owner.getClient()); - -======= setStateBitmask(0x10000000); owner.setMountedVehicle(this); @@ -1893,7 +1849,6 @@ public class CreatureObject extends TangibleObject implements IPersistent { owner.setStateBitmask(0x8000000); this.setPosture((byte)10); ->>>>>>> upstream/master } } From 1decfaa0819847c9b25a5c13ccf3fb6476e37a40 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 22:29:02 +0200 Subject: [PATCH 11/95] first commit of addidtions --- .../objects/tangible/TangibleObject.java | 24 ++- src/services/DevService.java | 8 +- src/services/command/CommandService.java | 176 ++++++++++++++++++ src/services/object/ObjectService.java | 33 ++-- 4 files changed, 220 insertions(+), 21 deletions(-) diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index ef276709..8569fc4f 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -53,7 +53,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=6) +@Persistent(version=7) public class TangibleObject extends SWGObject { // TODO: Thread safety @@ -83,6 +83,8 @@ public class TangibleObject extends SWGObject { private boolean looted = false; private boolean lootLock = false; + private String serialNumber; + @NotPersistent private TangibleObject killer = null; @@ -484,13 +486,29 @@ public class TangibleObject extends SWGObject { } public String getSerialNumber() { - return getStringAttribute("serial_number"); + return serialNumber; } public void setSerialNumber(String serialNumber) { - setStringAttribute("serial_number", serialNumber); + this.serialNumber = serialNumber; } + public void sendDelta3(Client destination) { + destination.getSession().write(messageBuilder.buildDelta3()); + //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"TANO3 Delta"); + } + + public void sendAssemblyDelta3(Client destination) { + destination.getSession().write(messageBuilder.buildAssemblyDelta3()); + //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildAssemblyDelta3(),"TANO3 Assembly Delta"); + } + + public void sendCustomizationDelta3(Client destination, String enteredName){ + destination.getSession().write(messageBuilder.buildCustomNameDelta(enteredName)); + //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildCustomNameDelta(enteredName),"TANO3 Customization Delta"); + } + + @Override public void sendBaselines(Client destination) { diff --git a/src/services/DevService.java b/src/services/DevService.java index 58c9fea4..e99172e0 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -89,8 +89,9 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 26, "Installations"); suiOptions.put((long) 110, "Survey Devices"); if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds"); + if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools"); if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds"); - //suiOptions.put((long) 120, "House Deeds"); + break; case 3: // [Items] Weapons suiOptions.put((long) 30, "Jedi Weapons"); @@ -1203,7 +1204,10 @@ public class DevService implements INetworkDispatch { deed.setBMR(15); deed.setAttributes(); inventory.add(deed); - + case 125: + TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet); + genericCraftingTool.setCustomName("Generic Crafting Tool"); + inventory.add(genericCraftingTool); return; case 130: TangibleObject swoopDeed = (TangibleObject) core.objectService.createObject("object/tangible/deed/vehicle_deed/shared_speederbike_swoop_deed.iff", planet); diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 809570bb..e8f6afe8 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -21,6 +21,7 @@ ******************************************************************************/ package services.command; +import java.io.UnsupportedEncodingException; import java.nio.ByteOrder; import java.util.Map; import java.util.Vector; @@ -584,6 +585,181 @@ public class CommandService implements INetworkDispatch { }); + objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_FILLSLOT, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + data.order(ByteOrder.LITTLE_ENDIAN); + Client client = core.getClient(session); + + if(client == null) { + System.out.println("NULL Client"); + return; + } + + CommandEnqueue commandEnqueue = new CommandEnqueue(); + CreatureObject actor = (CreatureObject) client.getParent(); + SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID()); + +// StringBuilder sb = new StringBuilder(); +// for (byte b : data.array()) { +// sb.append(String.format("%02X ", b)); +// } +// System.out.println(sb.toString()); + +// 05 00 46 5E CE 80 83 00 00 00 07 01 00 00 72 14 +// 09 00 00 00 00 00 00 00 00 00 04 2A 09 00 00 00 +// 00 00 01 00 00 00 00 00 00 00 04 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 + + long playerId = data.getLong(); + data.getInt(); // 00 00 00 00 + long ingredientId = data.getLong(); + int slotNumber = data.getInt(); + int option = data.getInt(); + byte sequence = data.get(); + core.craftingService.handleCraftFillSlot(playerId, ingredientId, slotNumber, option, sequence); + } + + }); + + /* + NGE break by cAble + + 05 00 #Operand + 46 5E CE 80 #ObjCon + 83 00 00 00 + 07 01 00 00 #CraftFillSlot + 00 2E E9 E9 31 00 00 00 + 00 00 00 00 #unknown + 16 A5 C8 50 32 00 00 00 #ObjectID for Ingredient + 01 00 00 00 #Slot01 + 00 00 00 00 #Option + 85 #sequence + + + + 05 00 #Operand + 46 5E CE 80 #ObjCon + 83 00 00 00 + 07 01 00 00 #CraftFillSlot + 00 2E E9 E9 31 00 00 00 #CharacterID + 00 00 00 00 #Unknown + 9D 3F EB F9 3A 00 00 00 #ObjectID for Ingredient + 02 00 00 00 #Slot02 + 00 00 00 00 #Option + 86 #Sequence + */ + + + objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_EMPTYSLOT, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + data.order(ByteOrder.LITTLE_ENDIAN); + Client client = core.getClient(session); + + if(client == null) { + System.out.println("NULL Client"); + return; + } + + CommandEnqueue commandEnqueue = new CommandEnqueue(); + CreatureObject actor = (CreatureObject) client.getParent(); + SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID()); + +// System.out.println("CRAFTEMPTY"); +// StringBuilder sb = new StringBuilder(); +// for (byte b : data.array()) { +// sb.append(String.format("%02X ", b)); +// } +// System.out.println(sb.toString()); + + +// 05 00 46 5E CE 80 83 00 00 00 08 01 00 00 B4 A1 +// 0B 00 00 00 00 00 00 00 00 00 01 00 00 00 B7 A1 +// 0B 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 + + long playerId = data.getLong(); + data.getInt(); // 00 00 00 00 + int slotNumber = data.getInt(); + long ingredientId = data.getLong(); + byte sequence = data.get(); + core.craftingService.handleCraftEmptySlot(playerId, ingredientId, slotNumber, sequence); + } + + }); + + + objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_CUSTOMIZATION, new INetworkRemoteEvent() { + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + data.order(ByteOrder.LITTLE_ENDIAN); + Client client = core.getClient(session); + if(client == null) { + System.out.println("NULL Client"); + return; + } + +// StringBuilder sb = new StringBuilder(); +// for (byte b : data.array()) { +// sb.append(String.format("%02X ", b)); +// } +// System.out.println(sb.toString()); + + long playerId = data.getLong(); + data.getInt(); // 00 00 00 00 UTF-16LE + + String enteredName = ""; + int length = 2*data.order(ByteOrder.LITTLE_ENDIAN).getInt(); + int bufferPosition = data.position(); + try + { + enteredName = new String(data.array(), bufferPosition, length, "UTF-16LE"); + } + catch (UnsupportedEncodingException e) + { + System.err.println("UnsupportedEncodingException while reading crafting customization name "); + } + + System.err.println("enteredName " + enteredName); + data.position(bufferPosition + length); + + byte modelNumber = data.get(); + int schematicQuantity = data.getInt(); + byte customizationList = data.get(); + for (int i=0;i<(int)customizationList;i++){ + int customizationSlot = data.getInt(); + int customizationValue = data.getInt(); + } + + core.craftingService.handleCraftCustomization(playerId,enteredName,modelNumber,schematicQuantity,customizationList); + } + + }); + +// 05 00 46 5E CE 80 83 00 00 00 5A 01 00 00 75 59 +// 0F 00 00 00 00 00 00 00 00 00 1D 00 00 00 63 00 +// 72 00 61 00 66 00 74 00 69 00 6E 00 67 00 3A 00 +// 5B 00 65 00 78 00 6F 00 5F 00 70 00 72 00 6F 00 +// 74 00 65 00 69 00 6E 00 5F 00 77 00 61 00 66 00 +// 65 00 72 00 73 00 5D 00 FF E8 03 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 + +// USTRING: CustomName +// BYTE: ModelNumber +// INT: SchematicQuantity +// BYTE: CustomizationList +// { +// INT: CustomizationSlot +// INT: CustomizationValue +// } + + } public void shutdown() { diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index e1fa31b6..841579c1 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -98,14 +98,17 @@ import main.NGECore; import resources.objects.Delta; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; +import resources.objects.craft.DraftSchematic; import resources.objects.creature.CreatureObject; import resources.objects.deed.Harvester_Deed; import resources.objects.deed.Player_House_Deed; +import resources.objects.factorycrate.FactoryCrateObject; import resources.objects.group.GroupObject; import resources.objects.guild.GuildObject; import resources.objects.harvester.HarvesterObject; import resources.objects.installation.InstallationObject; import resources.objects.intangible.IntangibleObject; +import resources.objects.manufacture.ManufactureSchematicObject; import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.resource.GalacticResource; @@ -385,6 +388,18 @@ public class ObjectService implements INetworkDispatch { object = new ResourceContainerObject(objectID, planet, Template, position, orientation); + } else if(Template.startsWith("object/factory/shared_factory_crate")) { + + object = new FactoryCrateObject(objectID, planet, Template, position, orientation); + + } else if(Template.startsWith("object/draft_schematic")) { + + object = new DraftSchematic(objectID, planet, Template, position, orientation); + + } else if(Template.startsWith("object/manufacture_schematic")) { + + object = new ManufactureSchematicObject(objectID, planet, Template, position, orientation); + } else if(Template.startsWith("object/installation/mining_ore/construction")) { float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f; @@ -655,24 +670,10 @@ public class ObjectService implements INetworkDispatch { } public CreatureObject getCreatureFromDB(long objectId) { - CreatureObject object = core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); - - if (object != null && getObject(object.getObjectID()) == null) { - loadServerTemplate(object); - - object.viewChildren(object, true, true, new Traverser() { - - public void process(SWGObject child) { - loadServerTemplate(child); - } - - }); - } - - return object; + return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); } - public long generateObjectID() { + private long generateObjectID() { /*Random random = new Random(); long objectID = random.nextInt(); From afcec36cc110b006f75363a284cd615a45cd0755 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 22:46:02 +0200 Subject: [PATCH 12/95] second commit --- src/protocol/swg/ObjControllerMessage.java | 8 + .../objects/craft/DraftSchematic.java | 46 ++++ .../FactoryCrateMessageBuilder.java | 152 ++++++++++- .../factorycrate/FactoryCrateObject.java | 241 +++++++++++++++++- .../ManufactureSchematicObject.java | 20 +- 5 files changed, 463 insertions(+), 4 deletions(-) create mode 100644 src/resources/objects/craft/DraftSchematic.java diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index 1c94c6b7..a9f541b8 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -66,6 +66,14 @@ public class ObjControllerMessage extends SWGMessage { public static final int STOP_CONVERSATION = 0x00DE; public static final int CONVERSATION_MESSAGE = 0x00DF; public static final int CONVERSATION_OPTIONS = 0x00E0; + public static final int DRAFT_SCHEMATICS = 0x0102; + public static final int DRAFT_SLOTS = 0x0103; + public static final int CRAFT_EXPERIMENT = 0x0106; + public static final int CRAFT_ACKNOWLEDGE = 0x010C; + public static final int CRAFT_CUSTOMIZATION = 0x015A; + public static final int NEXT_CRAFTING_STAGE_RESULT = 0x01BE; + public static final int DRAFT_SLOTS_QUERY_RESPONSE = 0x01BF; + public static final int RESOURCE_WEIGHTS = 0x0207; public ObjControllerMessage() { diff --git a/src/resources/objects/craft/DraftSchematic.java b/src/resources/objects/craft/DraftSchematic.java new file mode 100644 index 00000000..3e47ae31 --- /dev/null +++ b/src/resources/objects/craft/DraftSchematic.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.objects.craft; + +import com.sleepycat.persist.model.Persistent; +import engine.clients.Client; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + +@Persistent +public class DraftSchematic extends SWGObject { + + + public DraftSchematic(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ + super(objectID, planet, position, orientation, template); + } + + @Override + public void sendBaselines(Client arg0) { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java b/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java index dbb1e565..59c39cbe 100644 --- a/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java +++ b/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java @@ -21,6 +21,156 @@ ******************************************************************************/ package resources.objects.factorycrate; -public class FactoryCrateMessageBuilder { +import java.nio.ByteOrder; +import org.apache.mina.core.buffer.IoBuffer; + +import resources.objects.ObjectMessageBuilder; +import resources.objects.resource.GalacticResource; +import resources.objects.resource.ResourceContainerObject; + +/** + * @author Charon + */ + +public class FactoryCrateMessageBuilder extends ObjectMessageBuilder{ + + public FactoryCrateMessageBuilder(FactoryCrateObject factoryCrateObject) { + setObject(factoryCrateObject); + } + + + public IoBuffer buildBaseline3() { + FactoryCrateObject factoryCrateObject = (FactoryCrateObject) object; + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putShort((short)0x0D); + buffer.putFloat(1.0f); //op0 + buffer.put(getAsciiString("factory_n")); + buffer.putInt(0); + buffer.put(getAsciiString("food_crate")); + + if (factoryCrateObject.getCustomName().length()>0) + buffer.put(getUnicodeString(factoryCrateObject.getCustomName())); + else + buffer.putInt(0); + + buffer.putInt(1); + buffer.putShort((short)0); + + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + + buffer.putInt(0x2100); // optionsbitmask + buffer.putInt((int)factoryCrateObject.getQuantity()); // Quantity // op9 + buffer.putInt(0); + buffer.putInt(0x64); // condition maybe + + buffer.put((byte)1); + + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + + buffer.flip(); + buffer = createBaseline("TYCF", (byte) 3, buffer, size); + + return buffer; + +// 01 00 00 00 +// 00 00 +// 00 00 00 00 +// 00 00 00 00 +// 00 00 00 00 +// 00 00 00 00 +// 00 21 00 00 +// 2A 00 00 00 +// 00 00 00 00 +// 64 00 00 00 +// 01 + + } + + public IoBuffer buildBaseline6() { + FactoryCrateObject factoryCrateObject = (FactoryCrateObject) object; + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putShort((short)6); + buffer.putInt(3); + + buffer.putInt(0); + buffer.putInt(0); + + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + + buffer.put((byte)0); + + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + + buffer.flip(); + buffer = createBaseline("TYCF", (byte) 6, buffer, size); + + return buffer; + } + + + public IoBuffer buildBaseline8() { + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)0); + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + buffer.flip(); + buffer = createBaseline("RCNO", (byte) 8, buffer, size); + return buffer; + } + + public IoBuffer buildBaseline9() { + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)0); + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + buffer.flip(); + buffer = createBaseline("TYCF", (byte) 9, buffer, size); + return buffer; + } + + public IoBuffer buildDelta3() { + FactoryCrateObject factoryCrateObject = (FactoryCrateObject) object; + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putInt(factoryCrateObject.getQuantity()); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("TYCF", (byte) 3, (short) 1, (short) 9, buffer, size + 4); + + return buffer; + } + + @Override + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + // TODO Auto-generated method stub + + } + + + @Override + public void sendBaselines() { + // TODO Auto-generated method stub + + } } diff --git a/src/resources/objects/factorycrate/FactoryCrateObject.java b/src/resources/objects/factorycrate/FactoryCrateObject.java index 8e7d3c75..d7b7b7d6 100644 --- a/src/resources/objects/factorycrate/FactoryCrateObject.java +++ b/src/resources/objects/factorycrate/FactoryCrateObject.java @@ -21,11 +21,250 @@ ******************************************************************************/ package resources.objects.factorycrate; +import java.util.Map; +import java.util.Vector; + +import main.NGECore; + +import protocol.swg.SceneCreateObjectByCrc; +import protocol.swg.SceneDestroyObject; +import protocol.swg.SceneEndBaselines; +import protocol.swg.UpdateContainmentMessage; +import protocol.swg.UpdatePVPStatusMessage; + +import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; +import engine.clients.Client; +import engine.resources.common.CRC; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + +import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; +/** + * @author Charon + */ + @Persistent(version=0) public class FactoryCrateObject extends TangibleObject { + + private Vector contents; + private byte capacity; + private byte contentObjectQuantity; + private int contentCRC; + private TangibleObject contentObjectType; + + @NotPersistent + private FactoryCrateMessageBuilder messageBuilder; + + public FactoryCrateObject() { + + } + + public FactoryCrateObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { + super(objectID, planet, template, position, orientation); + this.messageBuilder = new FactoryCrateMessageBuilder(this); + this.contents = new Vector(); + 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"); + + + } + + public boolean setContentType(TangibleObject contentObject) { + synchronized(objectMutex) { + this.contentObjectType = contentObject; + if (contentObject.getTemplate().length()>0) + this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate()); + else + this.contentCRC = 0; + + Map contentAttributes = contentObject.getAttributes(); + for (Map.Entry entry : contentAttributes.entrySet()) + { + //if (!entry.getKey().equals(@obj_attr_n:condition)) + this.getAttributes().put(entry.getKey(), entry.getValue()); + } + + return true; + } + } + + public TangibleObject getContentType() { + return this.contentObjectType; + } + + public boolean setContentTypeAndQuantity(TangibleObject contentObject, int quantity) { + synchronized(objectMutex) { + this.contentObjectType = contentObject; + if (contentObject.getTemplate().length()>0) + this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate()); + else{ + this.contentCRC = 0; + return false; // Does it make sense to continue anyway? + } + + Map contentAttributes = contentObject.getAttributes(); + for (Map.Entry entry : contentAttributes.entrySet()) + { + //if (!entry.getKey().equals(@obj_attr_n:condition)) + this.getAttributes().put(entry.getKey(), entry.getValue()); + System.out.println(entry.getKey() + " " + entry.getValue()); + } + if (quantity0){ + 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()); + 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()); + + 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()); + + this.sendSetQuantity(player.getClient(),this.getQuantity()-1); + if (this.getQuantity()==0){ // Crate is empty now, delete it + parentContainer._remove(this); + SceneDestroyObject destroyObjectMsg = new SceneDestroyObject(this.getObjectID()); + player.getClient().getSession().write(destroyObjectMsg.serialize()); + core.objectService.destroyObject(this); + } + } else { // should give players the chance to clean faulty, empty crates from their containers + long parentId = this.getParentId(); + SWGObject parentContainer = core.objectService.getObject(parentId); + if (parentContainer==null) + return; // crate has no parent, error + parentContainer._remove(this); + SceneDestroyObject destroyObjectMsg = new SceneDestroyObject(this.getObjectID()); + player.getClient().getSession().write(destroyObjectMsg.serialize()); + core.objectService.destroyObject(this); + } + } + } + + public byte getQuantity() { + return contentObjectQuantity; + } + + public String getSerialNumber() { + if (!contents.isEmpty()) { + return contents.firstElement().getSerialNumber(); + } + return ""; + } + + public int getContentCRC() { + return contentCRC; + } -} + public void setContentCRC(int contentCRC) { + synchronized(objectMutex) { + this.contentCRC = contentCRC; + } + } + + public void handleSplit(){ + + } + + public void sendAddItem(Client destination) { + destination.getSession().write(messageBuilder.buildDelta3()); + this.getAttributes().put("@obj_attr_n:factory_count", ""+this.getQuantity()); + this.getAttributes().put("@obj_attr_n:quantity", ""+this.getQuantity()); + //services.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"FCYT3 Delta"); + } + + public void sendSetQuantity(Client destination,int quantity) { + contentObjectQuantity = (byte) quantity; + destination.getSession().write(messageBuilder.buildDelta3()); + this.getAttributes().put("@obj_attr_n:factory_count", ""+quantity); + this.getAttributes().put("@obj_attr_n:quantity", ""+this.getQuantity()); + //services.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"FCYT3 Delta"); + } + + + @Override + public void sendBaselines(Client destination) { + + + if(destination == null || destination.getSession() == null) { + System.out.println("NULL destination"); + return; + } + + destination.getSession().write(messageBuilder.buildBaseline3()); + destination.getSession().write(messageBuilder.buildBaseline6()); + destination.getSession().write(messageBuilder.buildBaseline8()); + destination.getSession().write(messageBuilder.buildBaseline9()); + +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline3(),"FCYT3 Baseline"); +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline6(),"FCYT6 Baseline"); +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline8(),"FCYT8 Baseline"); +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline9(),"FCYT9 Baseline"); + } + + public void sendDelta3(Client destination) { + destination.getSession().write(messageBuilder.buildDelta3()); + this.getAttributes().put("@obj_attr_n:factory_count", ""+this.getQuantity()); + //services.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"FCYT3 Delta"); + } +} \ No newline at end of file diff --git a/src/resources/objects/manufacture/ManufactureSchematicObject.java b/src/resources/objects/manufacture/ManufactureSchematicObject.java index 35e558de..4ed340ef 100644 --- a/src/resources/objects/manufacture/ManufactureSchematicObject.java +++ b/src/resources/objects/manufacture/ManufactureSchematicObject.java @@ -21,11 +21,27 @@ ******************************************************************************/ package resources.objects.manufacture; -import com.sleepycat.persist.model.Persistent; import resources.objects.intangible.IntangibleObject; +import com.sleepycat.persist.model.Persistent; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + + +/** + * @author Charon + */ @Persistent(version=0) -public class ManufactureSchematicObject extends IntangibleObject { +public class ManufactureSchematicObject extends IntangibleObject{ + + //@NotPersistent + //private ManufactureSchematicMessageBuilder messageBuilder; + public ManufactureSchematicObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { + super(objectID, planet, position, orientation, template); + //messageBuilder = new ManufactureSchematicMessageBuilder(this); + } + } From 7091c4bbb31919d8f5fc622c08ff05b9b555af5e Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 22:59:31 +0200 Subject: [PATCH 13/95] more preparations Preparations for crafting --- .../common/ObjControllerOpcodes.java | 11 ++++ .../tangible/TangibleMessageBuilder.java | 43 ++++++++++++++ src/services/command/CommandService.java | 57 ++----------------- 3 files changed, 58 insertions(+), 53 deletions(-) diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 1c7b626b..8cc142fd 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -43,5 +43,16 @@ public class ObjControllerOpcodes { public static final int NPC_CONVERSATION_OPTIONS = 0xE0000000; public static final int SET_PROFESSION_TEMPLATE = 0x5C040000; public static final int RESOURCE_EMPTY_HOPPER = 0xED000000; + public static final int DRAFT_SCHEMATICS = 0x0102; + public static final int DRAFT_SLOTS = 0x0103; + public static final int CRAFT_EXPERIMENT = 0x0106; + public static final int CRAFT_FILLSLOT = 0x7010000; + public static final int CRAFT_EMPTYSLOT = 0x8010000; + public static final int CRAFT_ACKNOWLEDGE = 0x010C; + public static final int CRAFT_CUSTOMIZATION = 0x5a010000; + public static final int NEXT_CRAFTING_STAGE_RESULT = 0x01BE; + public static final int DRAFT_SLOTS_QUERY_RESPONSE = 0x01BF; + public static final int RESOURCE_WEIGHTS = 0x0207; + } diff --git a/src/resources/objects/tangible/TangibleMessageBuilder.java b/src/resources/objects/tangible/TangibleMessageBuilder.java index 44ae16ff..f18dd482 100644 --- a/src/resources/objects/tangible/TangibleMessageBuilder.java +++ b/src/resources/objects/tangible/TangibleMessageBuilder.java @@ -161,6 +161,49 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { return buffer; } + public IoBuffer buildDelta3() { + IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)5); + buffer.putInt(0x12862153); + buffer.putLong(getObject().getObjectID()); + buffer.putInt(0x54414E4F); + buffer.put((byte)3); + buffer.putInt(8);//buffer.putInt(8+6); + + buffer.putShort((short) 2); + buffer.putShort((short)8); + buffer.put((byte)0); + buffer.putShort((short) 0x21); + buffer.put((byte)0); + +// buffer.putShort((short) 0); +// buffer.putFloat(4.0F); + + int size = buffer.position(); + buffer.flip(); + return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); + } + + public IoBuffer buildAssemblyDelta3() { + IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)5); + buffer.putInt(0x12862153); + buffer.putLong(getObject().getObjectID()); + buffer.putInt(0x54414E4F); + buffer.put((byte)3); + buffer.putInt(8);//buffer.putInt(8+6); + + buffer.putShort((short) 1); + buffer.putShort((short)0x0B); + buffer.putInt(0x000003E8); // ? + + int size = buffer.position(); + buffer.flip(); + return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); + } + @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { // TODO Auto-generated method stub diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index e8f6afe8..01610e70 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -619,40 +619,10 @@ public class CommandService implements INetworkDispatch { int slotNumber = data.getInt(); int option = data.getInt(); byte sequence = data.get(); - core.craftingService.handleCraftFillSlot(playerId, ingredientId, slotNumber, option, sequence); +//core.craftingService.handleCraftFillSlot(playerId, ingredientId, slotNumber, option, sequence); } + }); - }); - - /* - NGE break by cAble - - 05 00 #Operand - 46 5E CE 80 #ObjCon - 83 00 00 00 - 07 01 00 00 #CraftFillSlot - 00 2E E9 E9 31 00 00 00 - 00 00 00 00 #unknown - 16 A5 C8 50 32 00 00 00 #ObjectID for Ingredient - 01 00 00 00 #Slot01 - 00 00 00 00 #Option - 85 #sequence - - - - 05 00 #Operand - 46 5E CE 80 #ObjCon - 83 00 00 00 - 07 01 00 00 #CraftFillSlot - 00 2E E9 E9 31 00 00 00 #CharacterID - 00 00 00 00 #Unknown - 9D 3F EB F9 3A 00 00 00 #ObjectID for Ingredient - 02 00 00 00 #Slot02 - 00 00 00 00 #Option - 86 #Sequence - */ - - objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_EMPTYSLOT, new INetworkRemoteEvent() { @Override @@ -670,25 +640,12 @@ public class CommandService implements INetworkDispatch { CreatureObject actor = (CreatureObject) client.getParent(); SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID()); -// System.out.println("CRAFTEMPTY"); -// StringBuilder sb = new StringBuilder(); -// for (byte b : data.array()) { -// sb.append(String.format("%02X ", b)); -// } -// System.out.println(sb.toString()); - - -// 05 00 46 5E CE 80 83 00 00 00 08 01 00 00 B4 A1 -// 0B 00 00 00 00 00 00 00 00 00 01 00 00 00 B7 A1 -// 0B 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 -// 00 00 00 00 00 00 00 00 00 00 00 00 - long playerId = data.getLong(); data.getInt(); // 00 00 00 00 int slotNumber = data.getInt(); long ingredientId = data.getLong(); byte sequence = data.get(); - core.craftingService.handleCraftEmptySlot(playerId, ingredientId, slotNumber, sequence); +//core.craftingService.handleCraftEmptySlot(playerId, ingredientId, slotNumber, sequence); } }); @@ -704,12 +661,6 @@ public class CommandService implements INetworkDispatch { return; } -// StringBuilder sb = new StringBuilder(); -// for (byte b : data.array()) { -// sb.append(String.format("%02X ", b)); -// } -// System.out.println(sb.toString()); - long playerId = data.getLong(); data.getInt(); // 00 00 00 00 UTF-16LE @@ -736,7 +687,7 @@ public class CommandService implements INetworkDispatch { int customizationValue = data.getInt(); } - core.craftingService.handleCraftCustomization(playerId,enteredName,modelNumber,schematicQuantity,customizationList); +//core.craftingService.handleCraftCustomization(playerId,enteredName,modelNumber,schematicQuantity,customizationList); } }); From a95b8964f048c75660805ae29200686c96fc4152 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 23:03:40 +0200 Subject: [PATCH 14/95] access modifer changed back --- src/services/object/ObjectService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 841579c1..1d6caa71 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -673,7 +673,7 @@ public class ObjectService implements INetworkDispatch { return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); } - private long generateObjectID() { + public long generateObjectID() { /*Random random = new Random(); long objectID = random.nextInt(); From a99edcc2bcbe63bc603ba88f9d54a8ba0bb512c7 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 23:08:29 +0200 Subject: [PATCH 15/95] restored file --- src/services/object/ObjectService.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 1d6caa71..45f79bdd 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -670,7 +670,21 @@ public class ObjectService implements INetworkDispatch { } public CreatureObject getCreatureFromDB(long objectId) { - return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); + CreatureObject object = core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); + + if (object != null && getObject(object.getObjectID()) == null) { + loadServerTemplate(object); + + object.viewChildren(object, true, true, new Traverser() { + + public void process(SWGObject child) { + loadServerTemplate(child); + } + + }); + } + + return object; } public long generateObjectID() { From 0c1aebb58a50f5f940112be9809aecb9390e35e6 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 23:12:32 +0200 Subject: [PATCH 16/95] someone changed serial number data type --- src/resources/objects/tangible/TangibleObject.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 8569fc4f..294d62e7 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -486,11 +486,11 @@ public class TangibleObject extends SWGObject { } public String getSerialNumber() { - return serialNumber; + return getStringAttribute("serial_number"); } public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; + setStringAttribute("serial_number", serialNumber); } public void sendDelta3(Client destination) { From bd8d74d28c16c880d126afe7d7e3b1b47e10ce73 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Sun, 13 Apr 2014 23:41:47 +0200 Subject: [PATCH 17/95] Items - Added Dire Fate items --- .../item_bracelet_l_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ .../item_bracelet_r_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ .../item_necklace_set_bh_utility_b_01_01.py | 17 +++++++++++++++++ .../ring/item_band_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ .../ring/item_ring_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..ddd2ac6f --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_l_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_l_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..1d0aa2c9 --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_r_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_r_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..7426c06e --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_necklace_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_necklace_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..4ec469c0 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_band_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_band_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..0d16a24a --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_ring_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_ring_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file From 7472def68aad6f737bd7cc945c0d0ed2b996916f Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:41:41 +0200 Subject: [PATCH 18/95] Items - Added Heroism items Also added a Flamethrower to the frog since we didn't have one. --- scripts/commands/co_hw_dot.py | 3 - .../item_bracelet_l_set_hero_01_01.py | 18 +++++ .../item_bracelet_r_set_hero_01_01.py | 18 +++++ .../necklace/item_necklace_set_hero_01_01.py | 16 ++++ .../ring/item_band_set_hero_01_01.py | 18 +++++ .../ring/item_ring_set_hero_01_01.py | 18 +++++ src/services/DevService.java | 79 ++++++++----------- 7 files changed, 120 insertions(+), 50 deletions(-) create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py diff --git a/scripts/commands/co_hw_dot.py b/scripts/commands/co_hw_dot.py index 3ce9825c..ca43a28e 100644 --- a/scripts/commands/co_hw_dot.py +++ b/scripts/commands/co_hw_dot.py @@ -12,9 +12,6 @@ def run(core, actor, target, commandString): if not weapon: return - if not weapon.getWeaponType() == 12: - return - elementalType = weapon.getElementalType() commandName = '' diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py new file mode 100644 index 00000000..3326feb5 --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_l_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_l_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py new file mode 100644 index 00000000..81be4417 --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_r_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_r_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py b/scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py new file mode 100644 index 00000000..efb1bc12 --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_necklace_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_necklace_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py b/scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py new file mode 100644 index 00000000..73f173b9 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_band_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_band_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py b/scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py new file mode 100644 index 00000000..2a2d0124 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_ring_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_ring_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/src/services/DevService.java b/src/services/DevService.java index b8ef3c31..967a0beb 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -292,20 +292,35 @@ public class DevService implements INetworkDispatch { return; case 33: - WeaponObject heavy = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); - heavy.setIntAttribute("required_combat_level", 90); + WeaponObject heavy1 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); + heavy1.setIntAttribute("required_combat_level", 90); - heavy.setStringAttribute("class_required", "Commando"); - heavy.setDamageType("kinetic"); - heavy.setMinDamage(700); - heavy.setMaxDamage(1400); - heavy.setMaxRange(64); - heavy.setAttackSpeed(1); - heavy.setElementalType("heat"); - heavy.setElementalDamage(200); - heavy.setWeaponType(12); + heavy1.setStringAttribute("class_required", "Commando"); + heavy1.setDamageType("energy"); + heavy1.setMinDamage(700); + heavy1.setMaxDamage(1400); + heavy1.setMaxRange(64); + heavy1.setAttackSpeed(1); + heavy1.setElementalType("heat"); + heavy1.setElementalDamage(200); + heavy1.setWeaponType(12); - inventory.add(heavy); + inventory.add(heavy1); + + WeaponObject heavy2 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_republic_flamer.iff", planet); + heavy2.setIntAttribute("required_combat_level", 88); + + heavy2.setStringAttribute("class_required", "Commando"); + heavy2.setDamageType("energy"); + heavy2.setMinDamage(148); + heavy2.setMaxDamage(295); + heavy2.setMaxRange(20); + heavy2.setAttackSpeed((float) 0.25); + heavy2.setElementalType("heat"); + heavy2.setElementalDamage(28); + heavy2.setWeaponType(13); + + inventory.add(heavy2); return; case 40: TangibleObject ring = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); @@ -322,45 +337,15 @@ public class DevService implements INetworkDispatch { inventory.add(backpack); return; case 42: - TangibleObject heroismBand = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); - heroismBand.setStfFilename("static_item_n"); - heroismBand.setStfName("item_band_set_hero_01_01"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBand.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismBand = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s04.iff", planet, "item_band_set_hero_01_01"); - TangibleObject heroismRing = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); - heroismRing.setStfFilename("static_item_n"); - heroismRing.setStfName("item_ring_set_hero_01_01"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismRing.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismRing = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s02.iff", planet, "item_ring_set_hero_01_01"); - TangibleObject heroismNecklace = (TangibleObject) core.objectService.createObject("object/tangible/wearables/necklace/shared_necklace_s01.iff", planet); - heroismNecklace.setStfFilename("static_item_n"); - heroismNecklace.setStfName("item_necklace_set_hero_01_01"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismNecklace.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismNecklace = (TangibleObject) core.objectService.createObject("object/tangible/wearables/necklace/shared_necklace_s10.iff", planet, "item_necklace_set_hero_01_01"); - TangibleObject heroismBraceletRight = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s02_r.iff", planet); - heroismBraceletRight.setStfFilename("static_item_n"); - heroismBraceletRight.setStfName("item_bracelet_r_set_hero_01_01"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBraceletRight.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismBraceletRight = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff", planet, "item_bracelet_r_set_hero_01_01"); - TangibleObject heroismBraceletLeft = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s02_l.iff", planet); - heroismBraceletLeft.setStfFilename("static_item_n"); - heroismBraceletLeft.setStfName("item_bracelet_l_set_hero_01_01"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBraceletLeft.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismBraceletLeft = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s03_l.iff", planet, "item_bracelet_l_set_hero_01_01"); inventory.add(heroismBand); inventory.add(heroismRing); From 254c8c6e87568c43a3abed30597a135120bdb258 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:42:22 +0200 Subject: [PATCH 19/95] Misc - Added system messages to Heroism --- scripts/equipment/bonus_sets/set_bonus_hero.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/equipment/bonus_sets/set_bonus_hero.py b/scripts/equipment/bonus_sets/set_bonus_hero.py index 95fbabe4..0b1b27c6 100644 --- a/scripts/equipment/bonus_sets/set_bonus_hero.py +++ b/scripts/equipment/bonus_sets/set_bonus_hero.py @@ -18,10 +18,13 @@ def handleChange(core, creature, set): if wornItems == 3: core.buffService.addBuffToCreature(creature, "set_bonus_hero_1", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_hero_1_sys', 0) elif wornItems == 4: core.buffService.addBuffToCreature(creature, "set_bonus_hero_2", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_hero_2_sys', 0) elif wornItems == 5: core.buffService.addBuffToCreature(creature, "set_bonus_hero_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_hero_3_sys', 0) else: core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_hero_1") core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_hero_2") From b5ec10f7efad52fac6cb1c8757b35a3b057a37e2 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:43:07 +0200 Subject: [PATCH 20/95] Misc - Added system messages to 2-piece Jedi Bonus --- scripts/equipment/bonus_sets/set_bonus_jedi_robe.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py b/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py index fd45204d..734e9c89 100644 --- a/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py +++ b/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py @@ -35,5 +35,6 @@ def handleChange(core, creature, set): if wornItems == 2: core.buffService.addBuffToCreature(creature, "set_bonus_jedi_robe_1", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_jedi_robe_1_sys', 0) else: core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_jedi_robe_1") \ No newline at end of file From 5ebdfcb1678ac318c00d23886fadfd9bdfdafe7e Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:43:28 +0200 Subject: [PATCH 21/95] Misc - Added system messages to Dire Fate --- scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py b/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py index 5f9e272d..ed612f4e 100644 --- a/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py +++ b/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py @@ -18,10 +18,13 @@ def handleChange(core, creature, set): if wornItems == 3: core.buffService.addBuffToCreature(creature, "set_bonus_bh_utility_b_1", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_bh_utility_b_1_sys', 0) elif wornItems == 4: core.buffService.addBuffToCreature(creature, "set_bonus_bh_utility_b_2", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_bh_utility_b_2_sys', 0) elif wornItems == 5: core.buffService.addBuffToCreature(creature, "set_bonus_bh_utility_b_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_bh_utility_b_3_sys', 0) else: core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_bh_utility_b_1") core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_bh_utility_b_2") From 1d4b530b2adf6870f83a924e3a41d1312925c8de Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:23:13 +0200 Subject: [PATCH 22/95] Weapons - Updated starter weapons --- .../weapon/melee/polearm/weapon_polearm_02_03.py | 13 +++++++------ .../ranged/carbine/weapon_npe_carbine_bh_03_01.py | 14 +++++++------- .../ranged/carbine/weapon_npe_carbine_spy_03_01.py | 14 +++++++------- .../carbine/weapon_npe_commando_carbine_03_01.py | 14 +++++++------- .../ranged/pistol/item_npe_officer_sidearm.py | 12 ++++++------ .../pistol/item_npe_smuggler_han_solo_gun.py | 12 ++++++------ .../ranged/pistol/weapon_npe_medic_pistol_03_01.py | 12 ++++++------ 7 files changed, 46 insertions(+), 45 deletions(-) diff --git a/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py b/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py index c8e1804c..a730dfbb 100644 --- a/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py +++ b/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py @@ -6,10 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_polearm_02_03') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 1) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Kinetic') - object.setStringAttribute('cat_wpn_damage.damage', '43-75') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-5m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Polearm') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(1); + object.setMaxRange(5); + object.setDamageType("kinetic"); + object.setMinDamage(43); + object.setMaxDamage(75); + object.setWeaponType(7); + return return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py index 21afc76b..600a05a8 100644 --- a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py +++ b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py @@ -6,11 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_npe_carbine_bh_03_01') object.setStringAttribute('class_required', 'Bounty Hunter') - object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '17-43') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setIntAttribute('required_combat_level', 1) + object.setAttackSpeed(0.6); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(17); + object.setMaxDamage(43); + object.setWeaponType(1); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py index 53149824..bb153176 100644 --- a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py +++ b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py @@ -6,11 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_npe_carbine_spy_03_01') object.setStringAttribute('class_required', 'Spy') - object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '17-43') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setIntAttribute('required_combat_level', 1) + object.setAttackSpeed(0.6); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(17); + object.setMaxDamage(43); + object.setWeaponType(1); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py b/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py index 681e8699..e707e4f4 100644 --- a/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py +++ b/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py @@ -6,11 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_npe_commando_carbine_03_01') object.setStringAttribute('class_required', 'Commando') - object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '20-40') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setIntAttribute('required_combat_level', 1) + object.setAttackSpeed(0.6); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(20); + object.setMaxDamage(40); + object.setWeaponType(1); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py b/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py index 3600d8b4..b1c7fa0f 100644 --- a/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py +++ b/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py @@ -7,10 +7,10 @@ def setup(core, object): object.setDetailName('item_npe_officer_sidearm') object.setStringAttribute('class_required', 'Officer') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.4) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '15-25') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Pistol') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(0.4); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(15); + object.setMaxDamage(25); + object.setWeaponType(2); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py b/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py index 4f615807..baef2e0b 100644 --- a/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py +++ b/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py @@ -7,10 +7,10 @@ def setup(core, object): object.setDetailName('item_npe_smuggler_han_solo_gun') object.setStringAttribute('class_required', 'Smuggler') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.4) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '13-27') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Pistol') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(0.4); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(13); + object.setMaxDamage(27); + object.setWeaponType(2); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py b/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py index 4a68c9af..56169960 100644 --- a/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py +++ b/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py @@ -7,10 +7,10 @@ def setup(core, object): object.setDetailName('weapon_npe_medic_pistol_03_01') object.setStringAttribute('class_required', 'Medic') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.4) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '13-27') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Pistol') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(0.4); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(13); + object.setMaxDamage(27); + object.setWeaponType(2); return \ No newline at end of file From 48f6768299a87826c1982a01afafb07bfe8db936 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:27:13 +0200 Subject: [PATCH 23/95] Items - Created scripts for Smuggler starter clothing The items lack the proper colour but the rest is fine. --- .../wearables/boots/item_smuggler_boots_02_01.py | 10 ++++++++++ .../wearables/pants/item_smuggler_pants_02_01.py | 10 ++++++++++ .../wearables/shirt/item_smuggler_shirt_02_01.py | 10 ++++++++++ .../wearables/vest/item_smuggler_vest_02_01.py | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py create mode 100644 scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py create mode 100644 scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py create mode 100644 scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py diff --git a/scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py b/scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py new file mode 100644 index 00000000..e589fa8e --- /dev/null +++ b/scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_boots_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_boots_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py b/scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py new file mode 100644 index 00000000..12b3bd30 --- /dev/null +++ b/scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_pants_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_pants_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py b/scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py new file mode 100644 index 00000000..c331d0b1 --- /dev/null +++ b/scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_shirt_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_shirt_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py b/scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py new file mode 100644 index 00000000..35c0cd30 --- /dev/null +++ b/scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_vest_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_vest_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file From 4546672c6783ed3c961b2a237ca647d518fb9bcf Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:27:30 +0200 Subject: [PATCH 24/95] Items - Created scripts for Spy starter clothing --- .../tangible/wearables/boots/item_spy_boots_02_01.py | 10 ++++++++++ .../tangible/wearables/gloves/item_spy_gloves_02_01.py | 10 ++++++++++ .../tangible/wearables/pants/item_spy_pants_02_01.py | 10 ++++++++++ .../tangible/wearables/shirt/item_spy_shirt_02_01.py | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py create mode 100644 scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py create mode 100644 scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py create mode 100644 scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py diff --git a/scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py b/scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py new file mode 100644 index 00000000..caa1f917 --- /dev/null +++ b/scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_boots_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_boots_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py b/scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py new file mode 100644 index 00000000..f5f06373 --- /dev/null +++ b/scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_gloves_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_gloves_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py b/scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py new file mode 100644 index 00000000..a1021bf4 --- /dev/null +++ b/scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_pants_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_pants_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py b/scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py new file mode 100644 index 00000000..8bda143e --- /dev/null +++ b/scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_shirt_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_shirt_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file From 906db29a282903844006df9f700393e9a4fcfb57 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:59:33 +0200 Subject: [PATCH 25/95] Misc - Added Hoth armor setbonus --- .../set_bonus_imperial_snow_armor.py | 45 +++++++++++++++++++ .../bonus_sets/set_bonus_rebel_snow_armor.py | 45 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py create mode 100644 scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py diff --git a/scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py b/scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py new file mode 100644 index 00000000..fc245ba4 --- /dev/null +++ b/scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py @@ -0,0 +1,45 @@ +import sys +from services.equipment import BonusSetTemplate +from java.util import Vector + +def addBonusSet(core): + bonusSet = BonusSetTemplate("set_bonus_imperial_snow_armor") + + bonusSet.addRequiredItem("backpack_snowtrooper") + bonusSet.addRequiredItem("armor_snowtrooper_belt") + bonusSet.addRequiredItem("armor_snowtrooper_bicep_l") + bonusSet.addRequiredItem("armor_snowtrooper_bicep_r") + bonusSet.addRequiredItem("armor_snowtrooper_boots") + bonusSet.addRequiredItem("armor_snowtrooper_bracer_l") + bonusSet.addRequiredItem("armor_snowtrooper_bracer_r") + bonusSet.addRequiredItem("armor_snowtrooper_chest_plate") + bonusSet.addRequiredItem("armor_snowtrooper_gloves") + bonusSet.addRequiredItem("armor_snowtrooper_helmet") + bonusSet.addRequiredItem("armor_snowtrooper_leggings") + + core.equipmentService.addBonusSetTemplate(bonusSet) + +def handleChange(core, creature, set): + wornItems = set.getWornTemplateCount(creature) + + if wornItems == 3: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_3_sys', 0) + elif wornItems == 5: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_5", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_5_sys', 0) + elif wornItems == 7: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_7", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_7_sys', 0) + elif wornItems == 9: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_9", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_9_sys', 0) + elif wornItems == 11: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_11", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_11_sys', 0) + else: + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_3") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_5") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_7") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_9") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_11") \ No newline at end of file diff --git a/scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py b/scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py new file mode 100644 index 00000000..bea743e8 --- /dev/null +++ b/scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py @@ -0,0 +1,45 @@ +import sys +from services.equipment import BonusSetTemplate +from java.util import Vector + +def addBonusSet(core): + bonusSet = BonusSetTemplate("set_bonus_rebel_snow_armor") + + bonusSet.addRequiredItem("armor_rebel_snow_backpack") + bonusSet.addRequiredItem("armor_rebel_snow_belt") + bonusSet.addRequiredItem("armor_rebel_snow_boots") + bonusSet.addRequiredItem("armor_rebel_snow_chest_plate") + bonusSet.addRequiredItem("armor_rebel_snow_gloves") + bonusSet.addRequiredItem("armor_rebel_snow_helmet") + bonusSet.addRequiredItem("armor_rebel_snow_bicep_l") + bonusSet.addRequiredItem("armor_rebel_snow_bicep_r") + bonusSet.addRequiredItem("armor_rebel_snow_bracer_l") + bonusSet.addRequiredItem("armor_rebel_snow_bracer_r") + bonusSet.addRequiredItem("armor_rebel_snow_leggings") + + core.equipmentService.addBonusSetTemplate(bonusSet) + +def handleChange(core, creature, set): + wornItems = set.getWornTemplateCount(creature) + + if wornItems == 3: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_3_sys', 0) + elif wornItems == 5: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_5", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_5_sys', 0) + elif wornItems == 7: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_7", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_7_sys', 0) + elif wornItems == 9: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_9", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_9_sys', 0) + elif wornItems == 11: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_11", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_11_sys', 0) + else: + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_3") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_5") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_7") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_9") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_11") \ No newline at end of file From c912dd75ef52d19db799930f6bc924cca1d56b8c Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Mon, 14 Apr 2014 03:44:08 +0200 Subject: [PATCH 26/95] Looted weapons do get random stats now --- options.cfg | 4 +- .../lootItems/weapons/shared_rifle_cdef.py | 10 ++ src/services/LootService.java | 117 +++++++++++++++++- 3 files changed, 123 insertions(+), 8 deletions(-) diff --git a/options.cfg b/options.cfg index 5a3a7f8e..cb743c88 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=1 -LOAD.BUILDOUT_OBJECTS=1 +LOAD.SNAPSHOT_OBJECTS=0 +LOAD.BUILDOUT_OBJECTS=0 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file diff --git a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py index 0d683b7f..06160922 100644 --- a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py +++ b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py @@ -18,3 +18,13 @@ def customizationAttributes(): def customizationValues(): return [] + +def itemStats(): + + stats = ['mindamage','12','27'] + stats += ['maxdamage','29','61'] + stats += ['attackspeed','5.1','3.6'] + stats += ['maxrange','0','64'] + stats += ['damagetype','Energy','Energy'] + + return stats diff --git a/src/services/LootService.java b/src/services/LootService.java index a0929b07..3b65d48a 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -32,6 +32,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributeView; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -43,6 +44,7 @@ import resources.objects.group.GroupObject; import resources.objects.loot.LootGroup; import resources.objects.loot.LootRollSession; import resources.objects.tangible.TangibleObject; +import resources.objects.weapon.WeaponObject; import main.NGECore; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -249,6 +251,7 @@ public class LootService implements INetworkDispatch { int stackCount = 1; Vector customizationAttributes = null; Vector customizationValues = null; + Vector itemStats = null; if(core.scriptService.getMethod(itemPath,"","itemTemplate")==null){ String errorMessage = "Loot item '" + itemName + "' has no template function assigned in its script. Please contact Charon about this issue."; @@ -271,15 +274,31 @@ public class LootService implements INetworkDispatch { if(core.scriptService.getMethod(itemPath,"","customizationValues")!=null) customizationValues = (Vector)core.scriptService.fetchIntegerVector(itemPath,"customizationValues"); + if(core.scriptService.getMethod(itemPath,"","itemStats")!=null) + itemStats = (Vector)core.scriptService.fetchStringVector(itemPath,"itemStats"); + System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); droppedItem.setAttachment("LootItemName", itemName); - handleCustomDropName(droppedItem,customName); - handleStats(droppedItem); - setCustomization(droppedItem, itemName); - handleSpecialItems(droppedItem,itemName); + + if (customName!=null) + handleCustomDropName(droppedItem, customName); + + if (itemStats!=null){ + if (itemStats.size()%3!=0){ + String errorMessage = "Loot item '" + itemName + "' has a wrong number of itemstats. Please contact Charon about this issue."; + lootRollSession.addErrorMessage(errorMessage); + return; + } + handleStats(droppedItem, itemStats); + } + + if (customizationValues!=null) + setCustomization(droppedItem, itemName); + + handleSpecialItems(droppedItem, itemName); lootRollSession.addDroppedItem(droppedItem); } @@ -395,12 +414,20 @@ public class LootService implements INetworkDispatch { } } - private void handleStats(TangibleObject droppedItem) { + private void handleStats(TangibleObject droppedItem, Vector itemStats) { // ToDo: Min,Max for weapons , Dots on weapons etc. // This must be considered for the python scripts as well // So basically every item needs to have loot-related data in their py scripts as well - + if (droppedItem instanceof WeaponObject){ + WeaponObject weaponObject = (WeaponObject) droppedItem; + for (int i=0;i0) + result = minValue; + if (maxValue.length()>0) + result = maxValue; + + weapon.setElementalType(result); + } + + if (statName.equals("damagetype")){ + String result = ""; + if (minValue.length()==0) + if (maxValue.length()==0) + result = "Error"; + + if (minValue.length()>0) + result = minValue; + if (maxValue.length()>0) + result = maxValue; + + weapon.setDamageType(result); + } + } + + private void setArmorStat(SWGObject armor, String statName, String minValue, String maxValue){ + // Armor not yet implemented +// if (statName.equals("armor")){ +// int minimalValue = (int) Integer.parseInt(minValue); +// int maximalValue = (int) Integer.parseInt(maxValue); +// int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); +// armor.setArmor(randomValue); +// } + } } From c58d66d21a4e86d8aa57dc3b361e0e9f73a1fdf3 Mon Sep 17 00:00:00 2001 From: Freddiec Date: Sun, 13 Apr 2014 20:44:41 -0500 Subject: [PATCH 27/95] Added: Tantive Speeder and Barc Speeder For testing --- .../intangible/vehicle/barc_speeder_pcd.py | 11 ++++++++++ .../vehicle/landspeeder_tantive4_pcd.py | 11 ++++++++++ scripts/object/mobile/vehicle/barc_speeder.py | 12 +++++++++++ .../mobile/vehicle/landspeeder_tantive4.py | 16 +++++++++++++++ .../deed/vehicle_deed/barc_speeder_deed.py | 20 +++++++++++++++++++ .../vehicle_deed/landspeeder_tantive4_deed.py | 20 +++++++++++++++++++ 6 files changed, 90 insertions(+) diff --git a/scripts/object/intangible/vehicle/barc_speeder_pcd.py b/scripts/object/intangible/vehicle/barc_speeder_pcd.py index ccad8904..e9fa1234 100644 --- a/scripts/object/intangible/vehicle/barc_speeder_pcd.py +++ b/scripts/object/intangible/vehicle/barc_speeder_pcd.py @@ -1,4 +1,15 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'vehicle_pcd') + return + +def use(core, actor, object): + if object and actor.getAttachment('activeVehicleID') == None: + barc = core.objectService.createObject('object/mobile/vehicle/shared_barc_speeder.iff', 0, actor.getPlanet(), actor.getPosition(), actor.getOrientation()) + + barc.setOwnerId(actor.getObjectID()) + actor.setAttachment('activeVehicleID', barc.getObjectID()) + + core.simulationService.add(barc, barc.getPosition().x, barc.getPosition().z, True) return \ No newline at end of file diff --git a/scripts/object/intangible/vehicle/landspeeder_tantive4_pcd.py b/scripts/object/intangible/vehicle/landspeeder_tantive4_pcd.py index ccad8904..ff8849f4 100644 --- a/scripts/object/intangible/vehicle/landspeeder_tantive4_pcd.py +++ b/scripts/object/intangible/vehicle/landspeeder_tantive4_pcd.py @@ -1,4 +1,15 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'vehicle_pcd') + return + +def use(core, actor, object): + if object and actor.getAttachment('activeVehicleID') == None: + tantive4 = core.objectService.createObject('object/mobile/vehicle/shared_landspeeder_tantive4.iff', 0, actor.getPlanet(), actor.getPosition(), actor.getOrientation()) + + tantive4.setOwnerId(actor.getObjectID()) + actor.setAttachment('activeVehicleID', tantive4.getObjectID()) + + core.simulationService.add(tantive4, tantive4.getPosition().x, tantive4.getPosition().z, True) return \ No newline at end of file diff --git a/scripts/object/mobile/vehicle/barc_speeder.py b/scripts/object/mobile/vehicle/barc_speeder.py index ccad8904..4626c764 100644 --- a/scripts/object/mobile/vehicle/barc_speeder.py +++ b/scripts/object/mobile/vehicle/barc_speeder.py @@ -1,4 +1,16 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'vehicle') + return + +def use(core, actor, object): + vehicle = actor.getContainer() + + if vehicle: + if vehicle.getObjectID() == object.getObjectID(): + vehicle.remove(actor) + else: + vehicle.add(actor) + return \ No newline at end of file diff --git a/scripts/object/mobile/vehicle/landspeeder_tantive4.py b/scripts/object/mobile/vehicle/landspeeder_tantive4.py index ccad8904..1e2994c6 100644 --- a/scripts/object/mobile/vehicle/landspeeder_tantive4.py +++ b/scripts/object/mobile/vehicle/landspeeder_tantive4.py @@ -1,4 +1,20 @@ import sys +def setup(core, object): + object.setAttachment('radial_filename', 'vehicle') + return + +def use(core, actor, object): + vehicle = actor.getContainer() + + if vehicle: + if vehicle.getObjectID() == object.getObjectID(): + vehicle.remove(actor) + else: + vehicle.add(actor) + + return +import sys + def setup(core, object): return \ No newline at end of file diff --git a/scripts/object/tangible/deed/vehicle_deed/barc_speeder_deed.py b/scripts/object/tangible/deed/vehicle_deed/barc_speeder_deed.py index ccad8904..af21fb67 100644 --- a/scripts/object/tangible/deed/vehicle_deed/barc_speeder_deed.py +++ b/scripts/object/tangible/deed/vehicle_deed/barc_speeder_deed.py @@ -1,4 +1,24 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'vehicleDeed') + return + +def use(core, actor, object): + datapad = actor.getSlottedObject('datapad') + pcd = core.objectService.createObject('object/intangible/vehicle/shared_barc_speeder_pcd.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) + + if datapad and pcd: + + datapad.add(pcd) + core.objectService.destroyObject(object) + + vehicleId = actor.getAttachment('activeVehicleID') + + if vehicleId == None: + vehicle = core.objectService.createObject('object/mobile/vehicle/shared_barc_speeder.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) + vehicle.setOwnerId(actor.getObjectID()) + core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) + actor.setAttachment('activeVehicleID', vehicle.getObjectID()) + return \ No newline at end of file diff --git a/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py b/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py index ccad8904..92a45a9d 100644 --- a/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py +++ b/scripts/object/tangible/deed/vehicle_deed/landspeeder_tantive4_deed.py @@ -1,4 +1,24 @@ import sys def setup(core, object): + object.setAttachment('radial_filename', 'vehicleDeed') + return + +def use(core, actor, object): + datapad = actor.getSlottedObject('datapad') + pcd = core.objectService.createObject('object/intangible/vehicle/shared_landspeeder_tantive4_pcd.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) + + if datapad and pcd: + + datapad.add(pcd) + core.objectService.destroyObject(object) + + vehicleId = actor.getAttachment('activeVehicleID') + + if vehicleId == None: + vehicle = core.objectService.createObject('object/mobile/vehicle/shared_landspeeder_tantive4.iff', actor.getPlanet(), actor.getPosition().x, actor.getPosition().z,actor.getPosition().y) + vehicle.setOwnerId(actor.getObjectID()) + core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True) + actor.setAttachment('activeVehicleID', vehicle.getObjectID()) + return \ No newline at end of file From aea688044229833a99cb76707650ada4825f4251 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:19:38 -0400 Subject: [PATCH 28/95] Cloaked Attacks Now Grants Correct Abilities --- .../expertise_sp_cloaked_attacks_1.py | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/scripts/expertise/expertise_sp_cloaked_attacks_1.py b/scripts/expertise/expertise_sp_cloaked_attacks_1.py index d26c9bc6..9f979c33 100644 --- a/scripts/expertise/expertise_sp_cloaked_attacks_1.py +++ b/scripts/expertise/expertise_sp_cloaked_attacks_1.py @@ -1,51 +1,52 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 4: - actor.addAbility("sp_hd_melee_0") - if actor.getLevel() >= 12: - actor.addAbility("sp_hd_melee_1") + if actor.getLevel() >= 10: + actor.addAbility("sp_stealth_melee_0") if actor.getLevel() >= 20: - actor.addAbility("sp_hd_melee_2") - if actor.getLevel() >= 30: - actor.addAbility("sp_hd_melee_3") - if actor.getLevel() >= 38: - actor.addAbility("sp_hd_melee_4") - if actor.getLevel() >= 52: - actor.addAbility("sp_hd_melee_5") - if actor.getLevel() >= 62: - actor.addAbility("sp_hd_melee_6") + actor.addAbility("sp_stealth_melee_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_stealth_melee_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_stealth_melee_3") + if actor.getLevel() >= 60: + actor.addAbility("sp_stealth_melee_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_stealth_melee_5") + if actor.getLevel() >= 86: + actor.addAbility("sp_stealth_melee_6") - if actor.getLevel() >= 4: - actor.addAbility("sp_hd_range_0") - if actor.getLevel() >= 12: - actor.addAbility("sp_hd_range_1") + if actor.getLevel() >= 10: + actor.addAbility("sp_stealth_ranged_0") if actor.getLevel() >= 20: - actor.addAbility("sp_hd_range_2") - if actor.getLevel() >= 30: - actor.addAbility("sp_hd_range_3") - if actor.getLevel() >= 38: - actor.addAbility("sp_hd_range_4") - if actor.getLevel() >= 52: - actor.addAbility("sp_hd_range_5") - if actor.getLevel() >= 62: - actor.addAbility("sp_hd_range_6") + actor.addAbility("sp_stealth_ranged_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_stealth_ranged_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_stealth_ranged_3") + if actor.getLevel() >= 60: + actor.addAbility("sp_stealth_ranged_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_stealth_ranged_5") + if actor.getLevel() >= 86: + actor.addAbility("sp_stealth_ranged_6") return def removeAbilities(core, actor, player): - actor.removeAbility("sp_hd_melee_0") - actor.removeAbility("sp_hd_melee_1") - actor.removeAbility("sp_hd_melee_2") - actor.removeAbility("sp_hd_melee_3") - actor.removeAbility("sp_hd_melee_4") - actor.removeAbility("sp_hd_melee_5") - actor.removeAbility("sp_hd_melee_6") + actor.removeAbility("sp_stealth_melee_0") + actor.removeAbility("sp_stealth_melee_1") + actor.removeAbility("sp_stealth_melee_2") + actor.removeAbility("sp_stealth_melee_3") + actor.removeAbility("sp_stealth_melee_4") + actor.removeAbility("sp_stealth_melee_5") + actor.removeAbility("sp_stealth_melee_6") - actor.removeAbility("sp_hd_range_0") - actor.removeAbility("sp_hd_range_1") - actor.removeAbility("sp_hd_range_2") - actor.removeAbility("sp_hd_range_3") - actor.removeAbility("sp_hd_range_4") - actor.removeAbility("sp_hd_range_5") - actor.removeAbility("sp_hd_range_6") + actor.removeAbility("sp_stealth_ranged_0") + actor.removeAbility("sp_stealth_ranged_1") + actor.removeAbility("sp_stealth_ranged_2") + actor.removeAbility("sp_stealth_ranged_3") + actor.removeAbility("sp_stealth_ranged_4") + actor.removeAbility("sp_stealth_ranged_5") + actor.removeAbility("sp_stealth_ranged_6") return + From 3b1724c570c0f62264aa1cf703ed3bdd95c31795 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:21:54 -0400 Subject: [PATCH 29/95] Hidden Daggers Now Grants Correct Abilities --- .../expertise_sp_hidden_daggers_1.py | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/scripts/expertise/expertise_sp_hidden_daggers_1.py b/scripts/expertise/expertise_sp_hidden_daggers_1.py index 9aaf8abb..38c849d5 100644 --- a/scripts/expertise/expertise_sp_hidden_daggers_1.py +++ b/scripts/expertise/expertise_sp_hidden_daggers_1.py @@ -1,9 +1,51 @@ import sys def addAbilities(core, actor, player): - actor.addAbility("sp_hd_ability_1") + if actor.getLevel() >= 10: + actor.addAbility("sp_hd_melee_0") + if actor.getLevel() >= 18: + actor.addAbility("sp_hd_melee_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_hd_melee_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_hd_melee_3") + if actor.getLevel() >= 58: + actor.addAbility("sp_hd_melee_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_hd_melee_5") + if actor.getLevel() >= 84: + actor.addAbility("sp_hd_melee_6") + + if actor.getLevel() >= 10: + actor.addAbility("sp_hd_range_0") + if actor.getLevel() >= 18: + actor.addAbility("sp_hd_range_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_hd_range_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_hd_range_3") + if actor.getLevel() >= 58: + actor.addAbility("sp_hd_range_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_hd_range_5") + if actor.getLevel() >= 84: + actor.addAbility("sp_hd_range_6") return def removeAbilities(core, actor, player): - actor.removeAbility("sp_hd_ability_1") + actor.removeAbility("sp_hd_melee_0") + actor.removeAbility("sp_hd_melee_1") + actor.removeAbility("sp_hd_melee_2") + actor.removeAbility("sp_hd_melee_3") + actor.removeAbility("sp_hd_melee_4") + actor.removeAbility("sp_hd_melee_5") + actor.removeAbility("sp_hd_melee_6") + + actor.removeAbility("sp_hd_range_0") + actor.removeAbility("sp_hd_range_1") + actor.removeAbility("sp_hd_range_2") + actor.removeAbility("sp_hd_range_3") + actor.removeAbility("sp_hd_range_4") + actor.removeAbility("sp_hd_range_5") + actor.removeAbility("sp_hd_range_6") return From 7ed61990cb601ecea6bec530fa52b7be772e8e10 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:23:46 -0400 Subject: [PATCH 30/95] Improved Spys Fang Now Grants Abilities at Correct Levels --- .../expertise/expertise_sp_improved_spys_fang_1.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/expertise/expertise_sp_improved_spys_fang_1.py b/scripts/expertise/expertise_sp_improved_spys_fang_1.py index c30afb6b..5a085702 100644 --- a/scripts/expertise/expertise_sp_improved_spys_fang_1.py +++ b/scripts/expertise/expertise_sp_improved_spys_fang_1.py @@ -1,17 +1,17 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 26: + if actor.getLevel() >= 10: actor.addAbility("sp_dot_0") - if actor.getLevel() >= 34: + if actor.getLevel() >= 28: actor.addAbility("sp_dot_1") - if actor.getLevel() >= 48: + if actor.getLevel() >= 46: actor.addAbility("sp_dot_2") - if actor.getLevel() >= 62: + if actor.getLevel() >= 58: actor.addAbility("sp_dot_3") - if actor.getLevel() >= 76: + if actor.getLevel() >= 72: actor.addAbility("sp_dot_4") - if actor.getLevel() >= 90: + if actor.getLevel() >= 88: actor.addAbility("sp_dot_5") return From c87dfa31553ea3374f4ce1934256573c8028c699 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:52:54 -0400 Subject: [PATCH 31/95] Cloaked Recovery Now Grants At Correct Levels --- scripts/expertise/expertise_sp_cloaked_recovery_1.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/expertise/expertise_sp_cloaked_recovery_1.py b/scripts/expertise/expertise_sp_cloaked_recovery_1.py index 1e39f694..5e8ffb01 100644 --- a/scripts/expertise/expertise_sp_cloaked_recovery_1.py +++ b/scripts/expertise/expertise_sp_cloaked_recovery_1.py @@ -1,15 +1,15 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 26: + if actor.getLevel() >= 10: actor.addAbility("sp_cloaked_recovery_0") - if actor.getLevel() >= 34: + if actor.getLevel() >= 28: actor.addAbility("sp_cloaked_recovery_1") - if actor.getLevel() >= 48: + if actor.getLevel() >= 54: actor.addAbility("sp_cloaked_recovery_2") - if actor.getLevel() >= 62: + if actor.getLevel() >= 70: actor.addAbility("sp_cloaked_recovery_3") - if actor.getLevel() >= 76: + if actor.getLevel() >= 86: actor.addAbility("sp_cloaked_recovery_4") return From d355420012dfbe7064a636d7a4227f2f69f22cc2 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Mon, 14 Apr 2014 19:57:06 +0200 Subject: [PATCH 32/95] weapon work --- src/services/LootService.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/services/LootService.java b/src/services/LootService.java index 3b65d48a..f1f58a16 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -294,7 +294,6 @@ public class LootService implements INetworkDispatch { } handleStats(droppedItem, itemStats); } - if (customizationValues!=null) setCustomization(droppedItem, itemName); @@ -419,8 +418,13 @@ public class LootService implements INetworkDispatch { // This must be considered for the python scripts as well // So basically every item needs to have loot-related data in their py scripts as well - if (droppedItem instanceof WeaponObject){ + droppedItem.setTemplate("object/weapon/ranged/rifle/shared_rifle_cdef.iff"); + if (droppedItem.getTemplate().contains("/weapon")){ + System.out.println("Wep template rec"); + + //droppedItem.setStringAttribute("cat_wpn_damage.wpn_elemental_type", "ENERGY"); WeaponObject weaponObject = (WeaponObject) droppedItem; + droppedItem.setMaxDamage(1000); for (int i=0;i Date: Sun, 13 Apr 2014 19:15:17 +0200 Subject: [PATCH 33/95] Refactored WeaponObject The scripting of weapons should be much, much easier now. See the included examples in DevService. Attributes such as attack speed and range are now being read/written to the actual items attributes. --- scripts/commands/co_hw_dot.py | 12 +- scripts/equipment/weapon_critical.py | 30 ++-- .../creature/creature_default_weapon.py | 7 + .../objects/weapon/WeaponObject.java | 128 +++++------------- src/services/CharacterService.java | 6 - src/services/DevService.java | 103 +++++++++----- src/services/EquipmentService.java | 10 +- 7 files changed, 141 insertions(+), 155 deletions(-) diff --git a/scripts/commands/co_hw_dot.py b/scripts/commands/co_hw_dot.py index 7b9a8aac..3ce9825c 100644 --- a/scripts/commands/co_hw_dot.py +++ b/scripts/commands/co_hw_dot.py @@ -18,7 +18,7 @@ def run(core, actor, target, commandString): elementalType = weapon.getElementalType() commandName = '' - if elementalType == '@obj_attr_n:elemental_heat': + if elementalType == 'heat': if actor.getLevel() >= 58: commandName = 'co_hw_dot_fire_1' if actor.getLevel() >= 60: @@ -29,7 +29,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_fire_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_fire_5' - elif elementalType == '@obj_attr_n:elemental_cold': + elif elementalType == 'cold': if actor.getLevel() >= 58: commandName = 'co_hw_dot_cold_1' if actor.getLevel() >= 60: @@ -40,7 +40,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_cold_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_cold_5' - elif elementalType == '@obj_attr_n:elemental_acid': + elif elementalType == 'acid': if actor.getLevel() >= 58: commandName = 'co_hw_dot_acid_1' if actor.getLevel() >= 60: @@ -51,7 +51,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_acid_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_acid_5' - elif elementalType == '@obj_attr_n:elemental_electricity': + elif elementalType == 'electricity': if actor.getLevel() >= 58: commandName = 'co_hw_dot_electrical_1' if actor.getLevel() >= 60: @@ -62,7 +62,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_electrical_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_electrical_5' - elif elementalType == '@obj_attr_n:elemental_energy': + elif elementalType == 'energy': if actor.getLevel() >= 58: commandName = 'co_hw_dot_energy_1' if actor.getLevel() >= 60: @@ -73,7 +73,7 @@ def run(core, actor, target, commandString): commandName = 'co_hw_dot_energy_4' if actor.getLevel() >= 90: commandName = 'co_hw_dot_energy_5' - elif elementalType =='@obj_attr_n:elemental_kinetic': + elif elementalType =='kinetic': if actor.getLevel() >= 58: commandName = 'co_hw_dot_kinetic_1' if actor.getLevel() >= 60: diff --git a/scripts/equipment/weapon_critical.py b/scripts/equipment/weapon_critical.py index 683c4692..9f392f34 100644 --- a/scripts/equipment/weapon_critical.py +++ b/scripts/equipment/weapon_critical.py @@ -1,25 +1,37 @@ import sys -def Rifle(): +def weap_0(): return "expertise_critical_rifle" -def Carbine(): +def weap_1(): return "expertise_critical_carbine" -def Pistol(): +def weap_2(): return "expertise_critical_pistol" -def OneHandedMelee(): +def weap_4(): return "expertise_critical_1h" -def TwoHandedMelee(): +def weap_5(): return "expertise_critical_2h" -def Unarmed(): +def weap_6(): return "expertise_critical_unarmed" -def Polearm(): +def weap_7(): return "expertise_critical_polearm" - -def FreeTargetingHeavyWeapon(): + +def weap_9(): + return "" + +def weap_10(): + return "" + +def weap_11(): + return "" + +def weap_12(): return "expertise_critical_heavy" + +def weap_13(): + return "expertise_critical_heavy" \ No newline at end of file diff --git a/scripts/object/weapon/creature/creature_default_weapon.py b/scripts/object/weapon/creature/creature_default_weapon.py index ccad8904..811f1296 100644 --- a/scripts/object/weapon/creature/creature_default_weapon.py +++ b/scripts/object/weapon/creature/creature_default_weapon.py @@ -1,4 +1,11 @@ import sys def setup(core, object): + object.setAttackSpeed(1) + object.setDamageType("kinetic") + object.setMinDamage(50) + object.setMaxDamage(100) + object.setMaxRange(5) + object.setWeaponType(6) + return \ No newline at end of file diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 17325be5..392c206a 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -31,7 +31,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=0) +@Persistent(version=1) public class WeaponObject extends TangibleObject { // TODO: Thread safety @@ -39,53 +39,24 @@ public class WeaponObject extends TangibleObject { @NotPersistent private WeaponMessageBuilder messageBuilder; - private float attackSpeed = 1; - private float maxRange; - public WeaponObject(long objectID, Planet planet, String template) { super(objectID, planet, template, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0)); messageBuilder = new WeaponMessageBuilder(this); if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); - calculateRange(); - calculateAttackSpeed(); + setStringAttribute("cat_wpn_damage.damage", "0-0"); } public WeaponObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { super(objectID, planet, template, position, orientation); messageBuilder = new WeaponMessageBuilder(this); if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1); - calculateRange(); - calculateAttackSpeed(); + setStringAttribute("cat_wpn_damage.damage", "0-0"); } public WeaponObject() { super(); messageBuilder = new WeaponMessageBuilder(this); - //calculateRange(); - } - - private void calculateRange() { - - int weaponType = getWeaponType(); - - switch(weaponType) { - - case 0: maxRange = 64; break; - case 1: maxRange = 50; break; - case 2: maxRange = 35; break; - case 12: maxRange = 64; break; - case 4: maxRange = 5; break; - case 5: maxRange = 5; break; - case 6: maxRange = 5; break; - case 7: maxRange = 5; break; - case 8: maxRange = 64; break; - case 9: maxRange = 5; break; - case 10: maxRange = 5; break; - case 11: maxRange = 5; break; - - } - } public int getIncapTimer() { @@ -118,7 +89,9 @@ public class WeaponObject extends TangibleObject { } public void setMaxDamage(int maxDamage) { + setStringAttribute("cat_wpn_damage.damage", String.valueOf(getMinDamage()) + "-" + String.valueOf(maxDamage)); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public int getMinDamage() { @@ -126,7 +99,9 @@ public class WeaponObject extends TangibleObject { } public void setMinDamage(int minDamage) { + setStringAttribute("cat_wpn_damage.damage", String.valueOf(minDamage) + "-" + String.valueOf(getMaxDamage())); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public int getElementalDamage() { @@ -135,14 +110,17 @@ public class WeaponObject extends TangibleObject { public void setElementalDamage(int elementalDamage) { setIntAttribute("cat_wpn_damage.wpn_elemental_value", elementalDamage); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public String getElementalType() { - return getStringAttribute("cat_wpn_damage.wpn_elemental_type"); + if (getStringAttribute("cat_wpn_damage.wpn_elemental_type") != null ) + return getStringAttribute("cat_wpn_damage.wpn_elemental_type").replace("@obj_attr_n:elemental_", ""); + return null; } public void setElementalType(String elementalType) { - setStringAttribute("cat_wpn_damage.wpn_elemental_type", elementalType); + setStringAttribute("cat_wpn_damage.wpn_elemental_type", "@obj_attr_n:elemental_" + elementalType); } public String getDamageType() { @@ -150,43 +128,26 @@ public class WeaponObject extends TangibleObject { } public void setDamageType(String damageType) { - setStringAttribute("cat_wpn_damage.wpn_damage_type", damageType); + setStringAttribute("cat_wpn_damage.wpn_damage_type", "@obj_attr_n:armor_eff_" + damageType); } public int getDamagePerSecond() { - if (getElementalType() != null) + if(getAttributes().containsKey("cat_wpn_damage.damage") && getAttributes().containsKey("cat_wpn_damage.wpn_attack_speed")) { + + if (getElementalType() != null ) return (int) (((getMaxDamage() + getElementalDamage() + getMinDamage() + getElementalDamage()) / 2 + getElementalDamage()) * (1 / getAttackSpeed())); - else - return (int) (((getMaxDamage() + getMinDamage()) / 2 ) * (1 / getAttackSpeed())); + else + return (int) (((getMaxDamage() + getMinDamage()) / 2 ) * (1 / getAttackSpeed())); + } else + return 0; } public int getWeaponType() { - - int weaponType = -1; - - String template = getTemplate(); - - if(template == null) - return weaponType; - - if(template.contains("rifle")) weaponType = 0; - if(template.contains("carbine")) weaponType = 1; - if(template.contains("pistol")) weaponType = 2; - if(template.contains("heavy")) weaponType = 12; - if(template.contains("sword") || template.contains("baton")) weaponType = 4; - if(template.contains("2h_sword") || template.contains("axe")) weaponType = 5; - if(template.contains("unarmed")) weaponType = 6; - if(template.contains("polearm") || template.contains("lance")) weaponType = 7; - if(template.contains("thrown")) weaponType = 8; - if(template.contains("lightsaber_one_handed")) weaponType = 9; - if(template.contains("lightsaber_two_handed")) weaponType = 10; - if(template.contains("lightsaber_polearm")) weaponType = 11; - - if(weaponType == -1) - weaponType = 6; - - return weaponType; - + return Integer.parseInt(getStringAttribute("cat_wpn_damage.wpn_category").replace("@obj_attr_n:wpn_category_", "")); + } + + public void setWeaponType(int weaponType) { + setStringAttribute("cat_wpn_damage.wpn_category", "@obj_attr_n:wpn_category_" + weaponType); } @Override @@ -204,11 +165,15 @@ public class WeaponObject extends TangibleObject { } public float getAttackSpeed() { - return attackSpeed; + return getFloatAttribute("cat_wpn_damage.wpn_attack_speed"); } public void setAttackSpeed(float attackSpeed) { - this.attackSpeed = attackSpeed; + if((int) attackSpeed != attackSpeed) + setFloatAttribute("cat_wpn_damage.wpn_attack_speed", attackSpeed); + else + setIntAttribute("cat_wpn_damage.wpn_attack_speed", (int) attackSpeed); + } public WeaponMessageBuilder getMessageBuilder() { @@ -216,11 +181,14 @@ public class WeaponObject extends TangibleObject { } public float getMaxRange() { - return maxRange; + return Float.parseFloat(getStringAttribute("cat_wpn_damage.wpn_range").replace("0-", "").replace("m", "")); } public void setMaxRange(float maxRange) { - this.maxRange = maxRange; + if((int) maxRange != maxRange) + setStringAttribute("cat_wpn_damage.wpn_range", "0-" + String.valueOf(maxRange) + "m"); + else + setStringAttribute("cat_wpn_damage.wpn_range", "0-" + String.valueOf((int) maxRange) + "m"); } public boolean isMelee() { @@ -244,29 +212,5 @@ public class WeaponObject extends TangibleObject { return false; } - - private void calculateAttackSpeed() { - - int weaponType = getWeaponType(); - - switch(weaponType) { - - case 0: attackSpeed = 0.8f; break; - case 1: attackSpeed = 0.6f; break; - case 2: attackSpeed = 0.4f; break; - case 12: attackSpeed = 1; break; - case 4: attackSpeed = 1; break; - case 5: attackSpeed = 1; break; - case 6: attackSpeed = 1; break; - case 7: attackSpeed = 1; break; - case 8: attackSpeed = 1; break; - case 9: attackSpeed = 1; break; - case 10: attackSpeed = 1; break; - case 11: attackSpeed = 1; break; - - } - - } - } diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java index 9a00b424..67c67f51 100644 --- a/src/services/CharacterService.java +++ b/src/services/CharacterService.java @@ -331,13 +331,7 @@ public class CharacterService implements INetworkDispatch { object.addObjectToEquipList(appInventory); WeaponObject defaultWeapon = (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", object.getPlanet()); - defaultWeapon.setDamageType("@obj_attr_n:armor_eff_kinetic"); - defaultWeapon.setStringAttribute("cat_wpn_damage.damage", "0-0"); - defaultWeapon.setMaxDamage(100); - defaultWeapon.setMinDamage(50); - object.addObjectToEquipList(defaultWeapon); - object._add(defaultWeapon); object.setWeaponId(defaultWeapon.getObjectID()); diff --git a/src/services/DevService.java b/src/services/DevService.java index 58c9fea4..b8ef3c31 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -43,6 +43,7 @@ import resources.objects.deed.Player_House_Deed; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; import resources.objects.tool.SurveyTool; +import resources.objects.weapon.WeaponObject; import services.sui.SUIWindow; import services.sui.SUIService.ListBoxType; import services.sui.SUIWindow.SUICallback; @@ -96,6 +97,7 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 30, "Jedi Weapons"); suiOptions.put((long) 31, "Melee Weapons"); suiOptions.put((long) 32, "Ranged Weapons"); + suiOptions.put((long) 33, "Heavy Weapons"); break; case 4: // [Items] Misc Items suiOptions.put((long) 40, "Unity Ring"); @@ -202,26 +204,35 @@ public class DevService implements INetworkDispatch { // [Items] Weapons case 30: // Jedi Weapons - TangibleObject lightsaber1 = (TangibleObject) core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet); + WeaponObject lightsaber1 = (WeaponObject) core.objectService.createObject("object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff", planet); lightsaber1.setIntAttribute("required_combat_level", 90); - lightsaber1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); lightsaber1.setStringAttribute("class_required", "Jedi"); - lightsaber1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber1.setStringAttribute("cat_wpn_damage.damage", "689-1379"); + lightsaber1.setAttackSpeed(1); + lightsaber1.setDamageType("energy"); + lightsaber1.setMaxRange(5); + lightsaber1.setMinDamage(689); + lightsaber1.setMaxDamage(1379); + lightsaber1.setWeaponType(9); - TangibleObject lightsaber2 = (TangibleObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet); + WeaponObject lightsaber2 = (WeaponObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet); lightsaber2.setIntAttribute("required_combat_level", 90); - lightsaber2.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); lightsaber2.setStringAttribute("class_required", "Jedi"); - lightsaber2.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber2.setStringAttribute("cat_wpn_damage.damage", "689-1379"); + lightsaber2.setAttackSpeed(1); + lightsaber2.setDamageType("energy"); + lightsaber2.setMaxRange(5); + lightsaber2.setMinDamage(689); + lightsaber2.setMaxDamage(1379); + lightsaber2.setWeaponType(10); - TangibleObject lightsaber3 = (TangibleObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet); + WeaponObject lightsaber3 = (WeaponObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet); lightsaber3.setIntAttribute("required_combat_level", 90); - lightsaber3.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); lightsaber3.setStringAttribute("class_required", "Jedi"); - lightsaber3.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - lightsaber3.setStringAttribute("cat_wpn_damage.damage", "689-1379"); + lightsaber3.setAttackSpeed(1); + lightsaber3.setDamageType("energy"); + lightsaber3.setMaxRange(5); + lightsaber3.setMinDamage(689); + lightsaber3.setMaxDamage(1379); + lightsaber3.setWeaponType(11); Random random = new Random(); @@ -234,43 +245,67 @@ public class DevService implements INetworkDispatch { inventory.add(lightsaber3); return; case 31: // Melee Weapons - SWGObject sword1 = core.objectService.createObject("object/weapon/melee/sword/shared_sword_01.iff", planet); + WeaponObject sword1 = (WeaponObject) core.objectService.createObject("object/weapon/melee/sword/shared_sword_01.iff", planet); sword1.setIntAttribute("required_combat_level", 90); - sword1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - sword1.setStringAttribute("class_required", "None"); - sword1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - sword1.setStringAttribute("cat_wpn_damage.damage", "1100-1200"); + sword1.setAttackSpeed(1); + sword1.setMaxRange(5); + sword1.setDamageType("kinetic"); + sword1.setMinDamage(1100); + sword1.setMaxDamage(1200); + sword1.setWeaponType(4); inventory.add(sword1); return; case 32: // Ranged Weapons - SWGObject rifle1 = core.objectService.createObject("object/weapon/ranged/rifle/shared_rifle_e11.iff", planet); + WeaponObject rifle1 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/rifle/shared_rifle_e11.iff", planet); rifle1.setIntAttribute("required_combat_level", 90); - rifle1.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", (float) 0.8); - rifle1.setStringAttribute("class_required", "None"); - rifle1.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - rifle1.setStringAttribute("cat_wpn_damage.damage", "800-1250"); + rifle1.setAttackSpeed((float) 0.8); + rifle1.setMaxRange(64); + rifle1.setDamageType("energy"); + rifle1.setMinDamage(800); + rifle1.setMaxDamage(1250); + rifle1.setWeaponType(0); inventory.add(rifle1); - SWGObject pistol = core.objectService.createObject("object/weapon/ranged/pistol/shared_pistol_cdef.iff", planet); + WeaponObject carbine1 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/carbine/shared_carbine_cdef.iff", planet); + carbine1.setIntAttribute("required_combat_level", 90); + carbine1.setAttackSpeed((float) 0.6); + carbine1.setMaxRange(50); + carbine1.setDamageType("energy"); + carbine1.setMinDamage(600); + carbine1.setMaxDamage(937); + carbine1.setWeaponType(1); + + inventory.add(carbine1); + + WeaponObject pistol = (WeaponObject) core.objectService.createObject("object/weapon/ranged/pistol/shared_pistol_cdef.iff", planet); pistol.setIntAttribute("required_combat_level", 90); - pistol.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", (float) 0.4); - pistol.setStringAttribute("class_required", "None"); - pistol.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - pistol.setStringAttribute("cat_wpn_damage.damage", "400-559"); + pistol.setAttackSpeed((float) 0.4); + pistol.setMaxRange(35); + pistol.setDamageType("energy"); + pistol.setMinDamage(400); + pistol.setMaxDamage(625); + pistol.setWeaponType(2); inventory.add(pistol); + return; - /* == Disabled until Elemental Damage is implemented. == - SWGObject heavy = core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); + case 33: + WeaponObject heavy = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); heavy.setIntAttribute("required_combat_level", 90); - heavy.setFloatAttribute("cat_wpn_damage.wpn_attack_speed", 1); - heavy.setStringAttribute("class_required", "Commando"); - heavy.setStringAttribute("cat_wpn_damage.wpn_damage_type", "Energy"); - heavy.setStringAttribute("cat_wpn_damage.damage", "700-1400"); - inventory.add(heavy);*/ + heavy.setStringAttribute("class_required", "Commando"); + heavy.setDamageType("kinetic"); + heavy.setMinDamage(700); + heavy.setMaxDamage(1400); + heavy.setMaxRange(64); + heavy.setAttackSpeed(1); + heavy.setElementalType("heat"); + heavy.setElementalDamage(200); + heavy.setWeaponType(12); + + inventory.add(heavy); return; case 40: TangibleObject ring = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); diff --git a/src/services/EquipmentService.java b/src/services/EquipmentService.java index 12764c94..380dae39 100644 --- a/src/services/EquipmentService.java +++ b/src/services/EquipmentService.java @@ -278,14 +278,8 @@ public class EquipmentService implements INetworkDispatch { private int getWeaponCriticalChance(CreatureObject actor, SWGObject item) { int weaponCriticalChance = 0; - String weaponCriticalSkillMod = (core.scriptService.getMethod("scripts/equipment/", "weapon_critical", item.getStringAttribute("cat_wpn_damage.wpn_category")).__call__().asString()); - - if(weaponCriticalSkillMod.contains(" ")) - weaponCriticalSkillMod.replace(" ", ""); - - if(weaponCriticalSkillMod.contains("-")) - weaponCriticalSkillMod.replace("-", ""); - + String weaponCriticalSkillMod = (core.scriptService.getMethod("scripts/equipment/", "weapon_critical", "weap_" + item.getStringAttribute("cat_wpn_damage.wpn_category").replace("@obj_attr_n:wpn_category_", "")).__call__().asString()); + if(actor.getSkillMod(weaponCriticalSkillMod) != null) weaponCriticalChance = actor.getSkillModBase(weaponCriticalSkillMod); From cbaf74a92e60d7354a032242239eac995aa0ddf1 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 22:29:02 +0200 Subject: [PATCH 34/95] first commit of addidtions --- .../objects/tangible/TangibleObject.java | 24 ++- src/services/DevService.java | 8 +- src/services/command/CommandService.java | 176 ++++++++++++++++++ src/services/object/ObjectService.java | 33 ++-- 4 files changed, 220 insertions(+), 21 deletions(-) diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index ef276709..8569fc4f 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -53,7 +53,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=6) +@Persistent(version=7) public class TangibleObject extends SWGObject { // TODO: Thread safety @@ -83,6 +83,8 @@ public class TangibleObject extends SWGObject { private boolean looted = false; private boolean lootLock = false; + private String serialNumber; + @NotPersistent private TangibleObject killer = null; @@ -484,13 +486,29 @@ public class TangibleObject extends SWGObject { } public String getSerialNumber() { - return getStringAttribute("serial_number"); + return serialNumber; } public void setSerialNumber(String serialNumber) { - setStringAttribute("serial_number", serialNumber); + this.serialNumber = serialNumber; } + public void sendDelta3(Client destination) { + destination.getSession().write(messageBuilder.buildDelta3()); + //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"TANO3 Delta"); + } + + public void sendAssemblyDelta3(Client destination) { + destination.getSession().write(messageBuilder.buildAssemblyDelta3()); + //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildAssemblyDelta3(),"TANO3 Assembly Delta"); + } + + public void sendCustomizationDelta3(Client destination, String enteredName){ + destination.getSession().write(messageBuilder.buildCustomNameDelta(enteredName)); + //tools.CharonPacketUtils.printAnalysis(messageBuilder.buildCustomNameDelta(enteredName),"TANO3 Customization Delta"); + } + + @Override public void sendBaselines(Client destination) { diff --git a/src/services/DevService.java b/src/services/DevService.java index b8ef3c31..d717aa21 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -90,8 +90,9 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 26, "Installations"); suiOptions.put((long) 110, "Survey Devices"); if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds"); + if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools"); if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds"); - //suiOptions.put((long) 120, "House Deeds"); + break; case 3: // [Items] Weapons suiOptions.put((long) 30, "Jedi Weapons"); @@ -1238,7 +1239,10 @@ public class DevService implements INetworkDispatch { deed.setBMR(15); deed.setAttributes(); inventory.add(deed); - + case 125: + TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet); + genericCraftingTool.setCustomName("Generic Crafting Tool"); + inventory.add(genericCraftingTool); return; case 130: TangibleObject swoopDeed = (TangibleObject) core.objectService.createObject("object/tangible/deed/vehicle_deed/shared_speederbike_swoop_deed.iff", planet); diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 809570bb..e8f6afe8 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -21,6 +21,7 @@ ******************************************************************************/ package services.command; +import java.io.UnsupportedEncodingException; import java.nio.ByteOrder; import java.util.Map; import java.util.Vector; @@ -584,6 +585,181 @@ public class CommandService implements INetworkDispatch { }); + objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_FILLSLOT, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + data.order(ByteOrder.LITTLE_ENDIAN); + Client client = core.getClient(session); + + if(client == null) { + System.out.println("NULL Client"); + return; + } + + CommandEnqueue commandEnqueue = new CommandEnqueue(); + CreatureObject actor = (CreatureObject) client.getParent(); + SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID()); + +// StringBuilder sb = new StringBuilder(); +// for (byte b : data.array()) { +// sb.append(String.format("%02X ", b)); +// } +// System.out.println(sb.toString()); + +// 05 00 46 5E CE 80 83 00 00 00 07 01 00 00 72 14 +// 09 00 00 00 00 00 00 00 00 00 04 2A 09 00 00 00 +// 00 00 01 00 00 00 00 00 00 00 04 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 + + long playerId = data.getLong(); + data.getInt(); // 00 00 00 00 + long ingredientId = data.getLong(); + int slotNumber = data.getInt(); + int option = data.getInt(); + byte sequence = data.get(); + core.craftingService.handleCraftFillSlot(playerId, ingredientId, slotNumber, option, sequence); + } + + }); + + /* + NGE break by cAble + + 05 00 #Operand + 46 5E CE 80 #ObjCon + 83 00 00 00 + 07 01 00 00 #CraftFillSlot + 00 2E E9 E9 31 00 00 00 + 00 00 00 00 #unknown + 16 A5 C8 50 32 00 00 00 #ObjectID for Ingredient + 01 00 00 00 #Slot01 + 00 00 00 00 #Option + 85 #sequence + + + + 05 00 #Operand + 46 5E CE 80 #ObjCon + 83 00 00 00 + 07 01 00 00 #CraftFillSlot + 00 2E E9 E9 31 00 00 00 #CharacterID + 00 00 00 00 #Unknown + 9D 3F EB F9 3A 00 00 00 #ObjectID for Ingredient + 02 00 00 00 #Slot02 + 00 00 00 00 #Option + 86 #Sequence + */ + + + objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_EMPTYSLOT, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + data.order(ByteOrder.LITTLE_ENDIAN); + Client client = core.getClient(session); + + if(client == null) { + System.out.println("NULL Client"); + return; + } + + CommandEnqueue commandEnqueue = new CommandEnqueue(); + CreatureObject actor = (CreatureObject) client.getParent(); + SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID()); + +// System.out.println("CRAFTEMPTY"); +// StringBuilder sb = new StringBuilder(); +// for (byte b : data.array()) { +// sb.append(String.format("%02X ", b)); +// } +// System.out.println(sb.toString()); + + +// 05 00 46 5E CE 80 83 00 00 00 08 01 00 00 B4 A1 +// 0B 00 00 00 00 00 00 00 00 00 01 00 00 00 B7 A1 +// 0B 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 + + long playerId = data.getLong(); + data.getInt(); // 00 00 00 00 + int slotNumber = data.getInt(); + long ingredientId = data.getLong(); + byte sequence = data.get(); + core.craftingService.handleCraftEmptySlot(playerId, ingredientId, slotNumber, sequence); + } + + }); + + + objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_CUSTOMIZATION, new INetworkRemoteEvent() { + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + data.order(ByteOrder.LITTLE_ENDIAN); + Client client = core.getClient(session); + if(client == null) { + System.out.println("NULL Client"); + return; + } + +// StringBuilder sb = new StringBuilder(); +// for (byte b : data.array()) { +// sb.append(String.format("%02X ", b)); +// } +// System.out.println(sb.toString()); + + long playerId = data.getLong(); + data.getInt(); // 00 00 00 00 UTF-16LE + + String enteredName = ""; + int length = 2*data.order(ByteOrder.LITTLE_ENDIAN).getInt(); + int bufferPosition = data.position(); + try + { + enteredName = new String(data.array(), bufferPosition, length, "UTF-16LE"); + } + catch (UnsupportedEncodingException e) + { + System.err.println("UnsupportedEncodingException while reading crafting customization name "); + } + + System.err.println("enteredName " + enteredName); + data.position(bufferPosition + length); + + byte modelNumber = data.get(); + int schematicQuantity = data.getInt(); + byte customizationList = data.get(); + for (int i=0;i<(int)customizationList;i++){ + int customizationSlot = data.getInt(); + int customizationValue = data.getInt(); + } + + core.craftingService.handleCraftCustomization(playerId,enteredName,modelNumber,schematicQuantity,customizationList); + } + + }); + +// 05 00 46 5E CE 80 83 00 00 00 5A 01 00 00 75 59 +// 0F 00 00 00 00 00 00 00 00 00 1D 00 00 00 63 00 +// 72 00 61 00 66 00 74 00 69 00 6E 00 67 00 3A 00 +// 5B 00 65 00 78 00 6F 00 5F 00 70 00 72 00 6F 00 +// 74 00 65 00 69 00 6E 00 5F 00 77 00 61 00 66 00 +// 65 00 72 00 73 00 5D 00 FF E8 03 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +// 00 00 00 00 00 00 00 00 00 00 00 00 + +// USTRING: CustomName +// BYTE: ModelNumber +// INT: SchematicQuantity +// BYTE: CustomizationList +// { +// INT: CustomizationSlot +// INT: CustomizationValue +// } + + } public void shutdown() { diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index e1fa31b6..841579c1 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -98,14 +98,17 @@ import main.NGECore; import resources.objects.Delta; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; +import resources.objects.craft.DraftSchematic; import resources.objects.creature.CreatureObject; import resources.objects.deed.Harvester_Deed; import resources.objects.deed.Player_House_Deed; +import resources.objects.factorycrate.FactoryCrateObject; import resources.objects.group.GroupObject; import resources.objects.guild.GuildObject; import resources.objects.harvester.HarvesterObject; import resources.objects.installation.InstallationObject; import resources.objects.intangible.IntangibleObject; +import resources.objects.manufacture.ManufactureSchematicObject; import resources.objects.mission.MissionObject; import resources.objects.player.PlayerObject; import resources.objects.resource.GalacticResource; @@ -385,6 +388,18 @@ public class ObjectService implements INetworkDispatch { object = new ResourceContainerObject(objectID, planet, Template, position, orientation); + } else if(Template.startsWith("object/factory/shared_factory_crate")) { + + object = new FactoryCrateObject(objectID, planet, Template, position, orientation); + + } else if(Template.startsWith("object/draft_schematic")) { + + object = new DraftSchematic(objectID, planet, Template, position, orientation); + + } else if(Template.startsWith("object/manufacture_schematic")) { + + object = new ManufactureSchematicObject(objectID, planet, Template, position, orientation); + } else if(Template.startsWith("object/installation/mining_ore/construction")) { float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f; @@ -655,24 +670,10 @@ public class ObjectService implements INetworkDispatch { } public CreatureObject getCreatureFromDB(long objectId) { - CreatureObject object = core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); - - if (object != null && getObject(object.getObjectID()) == null) { - loadServerTemplate(object); - - object.viewChildren(object, true, true, new Traverser() { - - public void process(SWGObject child) { - loadServerTemplate(child); - } - - }); - } - - return object; + return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); } - public long generateObjectID() { + private long generateObjectID() { /*Random random = new Random(); long objectID = random.nextInt(); From 8077c517ff2ec2f2f89d2bcf410a14bcf00fc31f Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 22:46:02 +0200 Subject: [PATCH 35/95] second commit --- src/protocol/swg/ObjControllerMessage.java | 8 + .../objects/craft/DraftSchematic.java | 46 ++++ .../FactoryCrateMessageBuilder.java | 152 ++++++++++- .../factorycrate/FactoryCrateObject.java | 241 +++++++++++++++++- .../ManufactureSchematicObject.java | 20 +- 5 files changed, 463 insertions(+), 4 deletions(-) create mode 100644 src/resources/objects/craft/DraftSchematic.java diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index 1c94c6b7..a9f541b8 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -66,6 +66,14 @@ public class ObjControllerMessage extends SWGMessage { public static final int STOP_CONVERSATION = 0x00DE; public static final int CONVERSATION_MESSAGE = 0x00DF; public static final int CONVERSATION_OPTIONS = 0x00E0; + public static final int DRAFT_SCHEMATICS = 0x0102; + public static final int DRAFT_SLOTS = 0x0103; + public static final int CRAFT_EXPERIMENT = 0x0106; + public static final int CRAFT_ACKNOWLEDGE = 0x010C; + public static final int CRAFT_CUSTOMIZATION = 0x015A; + public static final int NEXT_CRAFTING_STAGE_RESULT = 0x01BE; + public static final int DRAFT_SLOTS_QUERY_RESPONSE = 0x01BF; + public static final int RESOURCE_WEIGHTS = 0x0207; public ObjControllerMessage() { diff --git a/src/resources/objects/craft/DraftSchematic.java b/src/resources/objects/craft/DraftSchematic.java new file mode 100644 index 00000000..3e47ae31 --- /dev/null +++ b/src/resources/objects/craft/DraftSchematic.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.objects.craft; + +import com.sleepycat.persist.model.Persistent; +import engine.clients.Client; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + +@Persistent +public class DraftSchematic extends SWGObject { + + + public DraftSchematic(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){ + super(objectID, planet, position, orientation, template); + } + + @Override + public void sendBaselines(Client arg0) { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java b/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java index dbb1e565..59c39cbe 100644 --- a/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java +++ b/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java @@ -21,6 +21,156 @@ ******************************************************************************/ package resources.objects.factorycrate; -public class FactoryCrateMessageBuilder { +import java.nio.ByteOrder; +import org.apache.mina.core.buffer.IoBuffer; + +import resources.objects.ObjectMessageBuilder; +import resources.objects.resource.GalacticResource; +import resources.objects.resource.ResourceContainerObject; + +/** + * @author Charon + */ + +public class FactoryCrateMessageBuilder extends ObjectMessageBuilder{ + + public FactoryCrateMessageBuilder(FactoryCrateObject factoryCrateObject) { + setObject(factoryCrateObject); + } + + + public IoBuffer buildBaseline3() { + FactoryCrateObject factoryCrateObject = (FactoryCrateObject) object; + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putShort((short)0x0D); + buffer.putFloat(1.0f); //op0 + buffer.put(getAsciiString("factory_n")); + buffer.putInt(0); + buffer.put(getAsciiString("food_crate")); + + if (factoryCrateObject.getCustomName().length()>0) + buffer.put(getUnicodeString(factoryCrateObject.getCustomName())); + else + buffer.putInt(0); + + buffer.putInt(1); + buffer.putShort((short)0); + + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + + buffer.putInt(0x2100); // optionsbitmask + buffer.putInt((int)factoryCrateObject.getQuantity()); // Quantity // op9 + buffer.putInt(0); + buffer.putInt(0x64); // condition maybe + + buffer.put((byte)1); + + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + + buffer.flip(); + buffer = createBaseline("TYCF", (byte) 3, buffer, size); + + return buffer; + +// 01 00 00 00 +// 00 00 +// 00 00 00 00 +// 00 00 00 00 +// 00 00 00 00 +// 00 00 00 00 +// 00 21 00 00 +// 2A 00 00 00 +// 00 00 00 00 +// 64 00 00 00 +// 01 + + } + + public IoBuffer buildBaseline6() { + FactoryCrateObject factoryCrateObject = (FactoryCrateObject) object; + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putShort((short)6); + buffer.putInt(3); + + buffer.putInt(0); + buffer.putInt(0); + + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + buffer.putInt(0); + + buffer.put((byte)0); + + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + + buffer.flip(); + buffer = createBaseline("TYCF", (byte) 6, buffer, size); + + return buffer; + } + + + public IoBuffer buildBaseline8() { + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)0); + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + buffer.flip(); + buffer = createBaseline("RCNO", (byte) 8, buffer, size); + return buffer; + } + + public IoBuffer buildBaseline9() { + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)0); + int size = buffer.position(); + buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); + buffer.flip(); + buffer = createBaseline("TYCF", (byte) 9, buffer, size); + return buffer; + } + + public IoBuffer buildDelta3() { + FactoryCrateObject factoryCrateObject = (FactoryCrateObject) object; + IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + + buffer.putInt(factoryCrateObject.getQuantity()); + int size = buffer.position(); + buffer.flip(); + buffer = createDelta("TYCF", (byte) 3, (short) 1, (short) 9, buffer, size + 4); + + return buffer; + } + + @Override + public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { + // TODO Auto-generated method stub + + } + + + @Override + public void sendBaselines() { + // TODO Auto-generated method stub + + } } diff --git a/src/resources/objects/factorycrate/FactoryCrateObject.java b/src/resources/objects/factorycrate/FactoryCrateObject.java index 8e7d3c75..d7b7b7d6 100644 --- a/src/resources/objects/factorycrate/FactoryCrateObject.java +++ b/src/resources/objects/factorycrate/FactoryCrateObject.java @@ -21,11 +21,250 @@ ******************************************************************************/ package resources.objects.factorycrate; +import java.util.Map; +import java.util.Vector; + +import main.NGECore; + +import protocol.swg.SceneCreateObjectByCrc; +import protocol.swg.SceneDestroyObject; +import protocol.swg.SceneEndBaselines; +import protocol.swg.UpdateContainmentMessage; +import protocol.swg.UpdatePVPStatusMessage; + +import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; +import engine.clients.Client; +import engine.resources.common.CRC; +import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + +import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; +/** + * @author Charon + */ + @Persistent(version=0) public class FactoryCrateObject extends TangibleObject { + + private Vector contents; + private byte capacity; + private byte contentObjectQuantity; + private int contentCRC; + private TangibleObject contentObjectType; + + @NotPersistent + private FactoryCrateMessageBuilder messageBuilder; + + public FactoryCrateObject() { + + } + + public FactoryCrateObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { + super(objectID, planet, template, position, orientation); + this.messageBuilder = new FactoryCrateMessageBuilder(this); + this.contents = new Vector(); + 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"); + + + } + + public boolean setContentType(TangibleObject contentObject) { + synchronized(objectMutex) { + this.contentObjectType = contentObject; + if (contentObject.getTemplate().length()>0) + this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate()); + else + this.contentCRC = 0; + + Map contentAttributes = contentObject.getAttributes(); + for (Map.Entry entry : contentAttributes.entrySet()) + { + //if (!entry.getKey().equals(@obj_attr_n:condition)) + this.getAttributes().put(entry.getKey(), entry.getValue()); + } + + return true; + } + } + + public TangibleObject getContentType() { + return this.contentObjectType; + } + + public boolean setContentTypeAndQuantity(TangibleObject contentObject, int quantity) { + synchronized(objectMutex) { + this.contentObjectType = contentObject; + if (contentObject.getTemplate().length()>0) + this.contentCRC = CRC.StringtoCRC(contentObject.getTemplate()); + else{ + this.contentCRC = 0; + return false; // Does it make sense to continue anyway? + } + + Map contentAttributes = contentObject.getAttributes(); + for (Map.Entry entry : contentAttributes.entrySet()) + { + //if (!entry.getKey().equals(@obj_attr_n:condition)) + this.getAttributes().put(entry.getKey(), entry.getValue()); + System.out.println(entry.getKey() + " " + entry.getValue()); + } + if (quantity0){ + 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()); + 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()); + + 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()); + + this.sendSetQuantity(player.getClient(),this.getQuantity()-1); + if (this.getQuantity()==0){ // Crate is empty now, delete it + parentContainer._remove(this); + SceneDestroyObject destroyObjectMsg = new SceneDestroyObject(this.getObjectID()); + player.getClient().getSession().write(destroyObjectMsg.serialize()); + core.objectService.destroyObject(this); + } + } else { // should give players the chance to clean faulty, empty crates from their containers + long parentId = this.getParentId(); + SWGObject parentContainer = core.objectService.getObject(parentId); + if (parentContainer==null) + return; // crate has no parent, error + parentContainer._remove(this); + SceneDestroyObject destroyObjectMsg = new SceneDestroyObject(this.getObjectID()); + player.getClient().getSession().write(destroyObjectMsg.serialize()); + core.objectService.destroyObject(this); + } + } + } + + public byte getQuantity() { + return contentObjectQuantity; + } + + public String getSerialNumber() { + if (!contents.isEmpty()) { + return contents.firstElement().getSerialNumber(); + } + return ""; + } + + public int getContentCRC() { + return contentCRC; + } -} + public void setContentCRC(int contentCRC) { + synchronized(objectMutex) { + this.contentCRC = contentCRC; + } + } + + public void handleSplit(){ + + } + + public void sendAddItem(Client destination) { + destination.getSession().write(messageBuilder.buildDelta3()); + this.getAttributes().put("@obj_attr_n:factory_count", ""+this.getQuantity()); + this.getAttributes().put("@obj_attr_n:quantity", ""+this.getQuantity()); + //services.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"FCYT3 Delta"); + } + + public void sendSetQuantity(Client destination,int quantity) { + contentObjectQuantity = (byte) quantity; + destination.getSession().write(messageBuilder.buildDelta3()); + this.getAttributes().put("@obj_attr_n:factory_count", ""+quantity); + this.getAttributes().put("@obj_attr_n:quantity", ""+this.getQuantity()); + //services.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"FCYT3 Delta"); + } + + + @Override + public void sendBaselines(Client destination) { + + + if(destination == null || destination.getSession() == null) { + System.out.println("NULL destination"); + return; + } + + destination.getSession().write(messageBuilder.buildBaseline3()); + destination.getSession().write(messageBuilder.buildBaseline6()); + destination.getSession().write(messageBuilder.buildBaseline8()); + destination.getSession().write(messageBuilder.buildBaseline9()); + +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline3(),"FCYT3 Baseline"); +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline6(),"FCYT6 Baseline"); +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline8(),"FCYT8 Baseline"); +// services.CharonPacketUtils.printAnalysis(messageBuilder.buildBaseline9(),"FCYT9 Baseline"); + } + + public void sendDelta3(Client destination) { + destination.getSession().write(messageBuilder.buildDelta3()); + this.getAttributes().put("@obj_attr_n:factory_count", ""+this.getQuantity()); + //services.CharonPacketUtils.printAnalysis(messageBuilder.buildDelta3(),"FCYT3 Delta"); + } +} \ No newline at end of file diff --git a/src/resources/objects/manufacture/ManufactureSchematicObject.java b/src/resources/objects/manufacture/ManufactureSchematicObject.java index 35e558de..4ed340ef 100644 --- a/src/resources/objects/manufacture/ManufactureSchematicObject.java +++ b/src/resources/objects/manufacture/ManufactureSchematicObject.java @@ -21,11 +21,27 @@ ******************************************************************************/ package resources.objects.manufacture; -import com.sleepycat.persist.model.Persistent; import resources.objects.intangible.IntangibleObject; +import com.sleepycat.persist.model.Persistent; +import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + + +/** + * @author Charon + */ @Persistent(version=0) -public class ManufactureSchematicObject extends IntangibleObject { +public class ManufactureSchematicObject extends IntangibleObject{ + + //@NotPersistent + //private ManufactureSchematicMessageBuilder messageBuilder; + public ManufactureSchematicObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) { + super(objectID, planet, position, orientation, template); + //messageBuilder = new ManufactureSchematicMessageBuilder(this); + } + } From 83b701c01e4f52474e5ed723471f0abe306b9266 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 22:59:31 +0200 Subject: [PATCH 36/95] more preparations Preparations for crafting --- .../common/ObjControllerOpcodes.java | 11 ++++ .../tangible/TangibleMessageBuilder.java | 43 ++++++++++++++ src/services/command/CommandService.java | 57 ++----------------- 3 files changed, 58 insertions(+), 53 deletions(-) diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index 1c7b626b..8cc142fd 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -43,5 +43,16 @@ public class ObjControllerOpcodes { public static final int NPC_CONVERSATION_OPTIONS = 0xE0000000; public static final int SET_PROFESSION_TEMPLATE = 0x5C040000; public static final int RESOURCE_EMPTY_HOPPER = 0xED000000; + public static final int DRAFT_SCHEMATICS = 0x0102; + public static final int DRAFT_SLOTS = 0x0103; + public static final int CRAFT_EXPERIMENT = 0x0106; + public static final int CRAFT_FILLSLOT = 0x7010000; + public static final int CRAFT_EMPTYSLOT = 0x8010000; + public static final int CRAFT_ACKNOWLEDGE = 0x010C; + public static final int CRAFT_CUSTOMIZATION = 0x5a010000; + public static final int NEXT_CRAFTING_STAGE_RESULT = 0x01BE; + public static final int DRAFT_SLOTS_QUERY_RESPONSE = 0x01BF; + public static final int RESOURCE_WEIGHTS = 0x0207; + } diff --git a/src/resources/objects/tangible/TangibleMessageBuilder.java b/src/resources/objects/tangible/TangibleMessageBuilder.java index 44ae16ff..f18dd482 100644 --- a/src/resources/objects/tangible/TangibleMessageBuilder.java +++ b/src/resources/objects/tangible/TangibleMessageBuilder.java @@ -161,6 +161,49 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder { return buffer; } + public IoBuffer buildDelta3() { + IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)5); + buffer.putInt(0x12862153); + buffer.putLong(getObject().getObjectID()); + buffer.putInt(0x54414E4F); + buffer.put((byte)3); + buffer.putInt(8);//buffer.putInt(8+6); + + buffer.putShort((short) 2); + buffer.putShort((short)8); + buffer.put((byte)0); + buffer.putShort((short) 0x21); + buffer.put((byte)0); + +// buffer.putShort((short) 0); +// buffer.putFloat(4.0F); + + int size = buffer.position(); + buffer.flip(); + return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); + } + + public IoBuffer buildAssemblyDelta3() { + IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN); + buffer.setAutoExpand(true); + buffer.putShort((short)5); + buffer.putInt(0x12862153); + buffer.putLong(getObject().getObjectID()); + buffer.putInt(0x54414E4F); + buffer.put((byte)3); + buffer.putInt(8);//buffer.putInt(8+6); + + buffer.putShort((short) 1); + buffer.putShort((short)0x0B); + buffer.putInt(0x000003E8); // ? + + int size = buffer.position(); + buffer.flip(); + return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip(); + } + @Override public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { // TODO Auto-generated method stub diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index e8f6afe8..01610e70 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -619,40 +619,10 @@ public class CommandService implements INetworkDispatch { int slotNumber = data.getInt(); int option = data.getInt(); byte sequence = data.get(); - core.craftingService.handleCraftFillSlot(playerId, ingredientId, slotNumber, option, sequence); +//core.craftingService.handleCraftFillSlot(playerId, ingredientId, slotNumber, option, sequence); } + }); - }); - - /* - NGE break by cAble - - 05 00 #Operand - 46 5E CE 80 #ObjCon - 83 00 00 00 - 07 01 00 00 #CraftFillSlot - 00 2E E9 E9 31 00 00 00 - 00 00 00 00 #unknown - 16 A5 C8 50 32 00 00 00 #ObjectID for Ingredient - 01 00 00 00 #Slot01 - 00 00 00 00 #Option - 85 #sequence - - - - 05 00 #Operand - 46 5E CE 80 #ObjCon - 83 00 00 00 - 07 01 00 00 #CraftFillSlot - 00 2E E9 E9 31 00 00 00 #CharacterID - 00 00 00 00 #Unknown - 9D 3F EB F9 3A 00 00 00 #ObjectID for Ingredient - 02 00 00 00 #Slot02 - 00 00 00 00 #Option - 86 #Sequence - */ - - objControllerOpcodes.put(ObjControllerOpcodes.CRAFT_EMPTYSLOT, new INetworkRemoteEvent() { @Override @@ -670,25 +640,12 @@ public class CommandService implements INetworkDispatch { CreatureObject actor = (CreatureObject) client.getParent(); SWGObject target = core.objectService.getObject(commandEnqueue.getTargetID()); -// System.out.println("CRAFTEMPTY"); -// StringBuilder sb = new StringBuilder(); -// for (byte b : data.array()) { -// sb.append(String.format("%02X ", b)); -// } -// System.out.println(sb.toString()); - - -// 05 00 46 5E CE 80 83 00 00 00 08 01 00 00 B4 A1 -// 0B 00 00 00 00 00 00 00 00 00 01 00 00 00 B7 A1 -// 0B 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 -// 00 00 00 00 00 00 00 00 00 00 00 00 - long playerId = data.getLong(); data.getInt(); // 00 00 00 00 int slotNumber = data.getInt(); long ingredientId = data.getLong(); byte sequence = data.get(); - core.craftingService.handleCraftEmptySlot(playerId, ingredientId, slotNumber, sequence); +//core.craftingService.handleCraftEmptySlot(playerId, ingredientId, slotNumber, sequence); } }); @@ -704,12 +661,6 @@ public class CommandService implements INetworkDispatch { return; } -// StringBuilder sb = new StringBuilder(); -// for (byte b : data.array()) { -// sb.append(String.format("%02X ", b)); -// } -// System.out.println(sb.toString()); - long playerId = data.getLong(); data.getInt(); // 00 00 00 00 UTF-16LE @@ -736,7 +687,7 @@ public class CommandService implements INetworkDispatch { int customizationValue = data.getInt(); } - core.craftingService.handleCraftCustomization(playerId,enteredName,modelNumber,schematicQuantity,customizationList); +//core.craftingService.handleCraftCustomization(playerId,enteredName,modelNumber,schematicQuantity,customizationList); } }); From 8b35a61c676bc079368427f3d97cde35d55c9bd1 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 23:03:40 +0200 Subject: [PATCH 37/95] access modifer changed back --- src/services/object/ObjectService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 841579c1..1d6caa71 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -673,7 +673,7 @@ public class ObjectService implements INetworkDispatch { return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); } - private long generateObjectID() { + public long generateObjectID() { /*Random random = new Random(); long objectID = random.nextInt(); From 15a2371aa6ea38792482b45e6f6e830ef26db9bc Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 23:08:29 +0200 Subject: [PATCH 38/95] restored file --- src/services/object/ObjectService.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 1d6caa71..45f79bdd 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -670,7 +670,21 @@ public class ObjectService implements INetworkDispatch { } public CreatureObject getCreatureFromDB(long objectId) { - return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); + CreatureObject object = core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class); + + if (object != null && getObject(object.getObjectID()) == null) { + loadServerTemplate(object); + + object.viewChildren(object, true, true, new Traverser() { + + public void process(SWGObject child) { + loadServerTemplate(child); + } + + }); + } + + return object; } public long generateObjectID() { From 35383e0cf591eceb230e6383cb949d9e764e697c Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Sun, 13 Apr 2014 23:12:32 +0200 Subject: [PATCH 39/95] someone changed serial number data type --- src/resources/objects/tangible/TangibleObject.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 8569fc4f..294d62e7 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -486,11 +486,11 @@ public class TangibleObject extends SWGObject { } public String getSerialNumber() { - return serialNumber; + return getStringAttribute("serial_number"); } public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; + setStringAttribute("serial_number", serialNumber); } public void sendDelta3(Client destination) { From 942e8c6b0d8d422a181e0e4a6fb73a01b8a80602 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:19:38 -0400 Subject: [PATCH 40/95] Cloaked Attacks Now Grants Correct Abilities --- .../expertise_sp_cloaked_attacks_1.py | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/scripts/expertise/expertise_sp_cloaked_attacks_1.py b/scripts/expertise/expertise_sp_cloaked_attacks_1.py index d26c9bc6..9f979c33 100644 --- a/scripts/expertise/expertise_sp_cloaked_attacks_1.py +++ b/scripts/expertise/expertise_sp_cloaked_attacks_1.py @@ -1,51 +1,52 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 4: - actor.addAbility("sp_hd_melee_0") - if actor.getLevel() >= 12: - actor.addAbility("sp_hd_melee_1") + if actor.getLevel() >= 10: + actor.addAbility("sp_stealth_melee_0") if actor.getLevel() >= 20: - actor.addAbility("sp_hd_melee_2") - if actor.getLevel() >= 30: - actor.addAbility("sp_hd_melee_3") - if actor.getLevel() >= 38: - actor.addAbility("sp_hd_melee_4") - if actor.getLevel() >= 52: - actor.addAbility("sp_hd_melee_5") - if actor.getLevel() >= 62: - actor.addAbility("sp_hd_melee_6") + actor.addAbility("sp_stealth_melee_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_stealth_melee_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_stealth_melee_3") + if actor.getLevel() >= 60: + actor.addAbility("sp_stealth_melee_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_stealth_melee_5") + if actor.getLevel() >= 86: + actor.addAbility("sp_stealth_melee_6") - if actor.getLevel() >= 4: - actor.addAbility("sp_hd_range_0") - if actor.getLevel() >= 12: - actor.addAbility("sp_hd_range_1") + if actor.getLevel() >= 10: + actor.addAbility("sp_stealth_ranged_0") if actor.getLevel() >= 20: - actor.addAbility("sp_hd_range_2") - if actor.getLevel() >= 30: - actor.addAbility("sp_hd_range_3") - if actor.getLevel() >= 38: - actor.addAbility("sp_hd_range_4") - if actor.getLevel() >= 52: - actor.addAbility("sp_hd_range_5") - if actor.getLevel() >= 62: - actor.addAbility("sp_hd_range_6") + actor.addAbility("sp_stealth_ranged_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_stealth_ranged_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_stealth_ranged_3") + if actor.getLevel() >= 60: + actor.addAbility("sp_stealth_ranged_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_stealth_ranged_5") + if actor.getLevel() >= 86: + actor.addAbility("sp_stealth_ranged_6") return def removeAbilities(core, actor, player): - actor.removeAbility("sp_hd_melee_0") - actor.removeAbility("sp_hd_melee_1") - actor.removeAbility("sp_hd_melee_2") - actor.removeAbility("sp_hd_melee_3") - actor.removeAbility("sp_hd_melee_4") - actor.removeAbility("sp_hd_melee_5") - actor.removeAbility("sp_hd_melee_6") + actor.removeAbility("sp_stealth_melee_0") + actor.removeAbility("sp_stealth_melee_1") + actor.removeAbility("sp_stealth_melee_2") + actor.removeAbility("sp_stealth_melee_3") + actor.removeAbility("sp_stealth_melee_4") + actor.removeAbility("sp_stealth_melee_5") + actor.removeAbility("sp_stealth_melee_6") - actor.removeAbility("sp_hd_range_0") - actor.removeAbility("sp_hd_range_1") - actor.removeAbility("sp_hd_range_2") - actor.removeAbility("sp_hd_range_3") - actor.removeAbility("sp_hd_range_4") - actor.removeAbility("sp_hd_range_5") - actor.removeAbility("sp_hd_range_6") + actor.removeAbility("sp_stealth_ranged_0") + actor.removeAbility("sp_stealth_ranged_1") + actor.removeAbility("sp_stealth_ranged_2") + actor.removeAbility("sp_stealth_ranged_3") + actor.removeAbility("sp_stealth_ranged_4") + actor.removeAbility("sp_stealth_ranged_5") + actor.removeAbility("sp_stealth_ranged_6") return + From 076172061a65286e8166e64eeabf27280e89ed03 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:21:54 -0400 Subject: [PATCH 41/95] Hidden Daggers Now Grants Correct Abilities --- .../expertise_sp_hidden_daggers_1.py | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/scripts/expertise/expertise_sp_hidden_daggers_1.py b/scripts/expertise/expertise_sp_hidden_daggers_1.py index 9aaf8abb..38c849d5 100644 --- a/scripts/expertise/expertise_sp_hidden_daggers_1.py +++ b/scripts/expertise/expertise_sp_hidden_daggers_1.py @@ -1,9 +1,51 @@ import sys def addAbilities(core, actor, player): - actor.addAbility("sp_hd_ability_1") + if actor.getLevel() >= 10: + actor.addAbility("sp_hd_melee_0") + if actor.getLevel() >= 18: + actor.addAbility("sp_hd_melee_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_hd_melee_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_hd_melee_3") + if actor.getLevel() >= 58: + actor.addAbility("sp_hd_melee_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_hd_melee_5") + if actor.getLevel() >= 84: + actor.addAbility("sp_hd_melee_6") + + if actor.getLevel() >= 10: + actor.addAbility("sp_hd_range_0") + if actor.getLevel() >= 18: + actor.addAbility("sp_hd_range_1") + if actor.getLevel() >= 32: + actor.addAbility("sp_hd_range_2") + if actor.getLevel() >= 46: + actor.addAbility("sp_hd_range_3") + if actor.getLevel() >= 58: + actor.addAbility("sp_hd_range_4") + if actor.getLevel() >= 70: + actor.addAbility("sp_hd_range_5") + if actor.getLevel() >= 84: + actor.addAbility("sp_hd_range_6") return def removeAbilities(core, actor, player): - actor.removeAbility("sp_hd_ability_1") + actor.removeAbility("sp_hd_melee_0") + actor.removeAbility("sp_hd_melee_1") + actor.removeAbility("sp_hd_melee_2") + actor.removeAbility("sp_hd_melee_3") + actor.removeAbility("sp_hd_melee_4") + actor.removeAbility("sp_hd_melee_5") + actor.removeAbility("sp_hd_melee_6") + + actor.removeAbility("sp_hd_range_0") + actor.removeAbility("sp_hd_range_1") + actor.removeAbility("sp_hd_range_2") + actor.removeAbility("sp_hd_range_3") + actor.removeAbility("sp_hd_range_4") + actor.removeAbility("sp_hd_range_5") + actor.removeAbility("sp_hd_range_6") return From b5578043c3978760aabfa6f306f24b81b493daa9 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:23:46 -0400 Subject: [PATCH 42/95] Improved Spys Fang Now Grants Abilities at Correct Levels --- .../expertise/expertise_sp_improved_spys_fang_1.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/expertise/expertise_sp_improved_spys_fang_1.py b/scripts/expertise/expertise_sp_improved_spys_fang_1.py index c30afb6b..5a085702 100644 --- a/scripts/expertise/expertise_sp_improved_spys_fang_1.py +++ b/scripts/expertise/expertise_sp_improved_spys_fang_1.py @@ -1,17 +1,17 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 26: + if actor.getLevel() >= 10: actor.addAbility("sp_dot_0") - if actor.getLevel() >= 34: + if actor.getLevel() >= 28: actor.addAbility("sp_dot_1") - if actor.getLevel() >= 48: + if actor.getLevel() >= 46: actor.addAbility("sp_dot_2") - if actor.getLevel() >= 62: + if actor.getLevel() >= 58: actor.addAbility("sp_dot_3") - if actor.getLevel() >= 76: + if actor.getLevel() >= 72: actor.addAbility("sp_dot_4") - if actor.getLevel() >= 90: + if actor.getLevel() >= 88: actor.addAbility("sp_dot_5") return From 2e3dd94bcab7b13b1189900fae60b8ad40399f28 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 10:52:54 -0400 Subject: [PATCH 43/95] Cloaked Recovery Now Grants At Correct Levels --- scripts/expertise/expertise_sp_cloaked_recovery_1.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/expertise/expertise_sp_cloaked_recovery_1.py b/scripts/expertise/expertise_sp_cloaked_recovery_1.py index 1e39f694..5e8ffb01 100644 --- a/scripts/expertise/expertise_sp_cloaked_recovery_1.py +++ b/scripts/expertise/expertise_sp_cloaked_recovery_1.py @@ -1,15 +1,15 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 26: + if actor.getLevel() >= 10: actor.addAbility("sp_cloaked_recovery_0") - if actor.getLevel() >= 34: + if actor.getLevel() >= 28: actor.addAbility("sp_cloaked_recovery_1") - if actor.getLevel() >= 48: + if actor.getLevel() >= 54: actor.addAbility("sp_cloaked_recovery_2") - if actor.getLevel() >= 62: + if actor.getLevel() >= 70: actor.addAbility("sp_cloaked_recovery_3") - if actor.getLevel() >= 76: + if actor.getLevel() >= 86: actor.addAbility("sp_cloaked_recovery_4") return From 48a3f85aef0356f25317ab70c5665663dedf4c6d Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Mon, 14 Apr 2014 15:29:10 -0400 Subject: [PATCH 44/95] Armor Sprint Now Grants Correct Ability --- scripts/expertise/expertise_bh_armor_sprint_1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/expertise/expertise_bh_armor_sprint_1.py b/scripts/expertise/expertise_bh_armor_sprint_1.py index ecedc9e6..b0ebf1ec 100644 --- a/scripts/expertise/expertise_bh_armor_sprint_1.py +++ b/scripts/expertise/expertise_bh_armor_sprint_1.py @@ -1,9 +1,9 @@ import sys def addAbilities(core, actor, player): - actor.addAbility("bh_shields_1") + actor.addAbility("bh_armor_sprint_1") return def removeAbilities(core, actor, player): - actor.removeAbility("bh_shields_1") + actor.removeAbility("bh_armor_sprint_1") return From bd0a30aa9693712489af4c1a824fd615a5a11cfd Mon Sep 17 00:00:00 2001 From: Light2 Date: Tue, 15 Apr 2014 01:11:33 +0200 Subject: [PATCH 45/95] Added basic bazaar functionality - see extended Categories are not working right now, Auctions and Vendors are not yet implemented --- src/main/NGECore.java | 3 + .../AuctionQueryHeadersMessage.java | 2 +- .../AuctionQueryHeadersResponseMessage.java | 141 +++- .../BidAuctionMessage.java | 11 + .../BidAuctionResponseMessage.java | 5 + .../CancelLiveAuctionResponseMessage.java | 5 + .../CreateAuctionMessage.java | 16 +- ...java => CreateAuctionResponseMessage.java} | 9 +- .../GetAuctionDetailsResponse.java | 37 +- .../RetrieveAuctionItemResponseMessage.java | 5 + src/resources/common/Opcodes.java | 8 + .../objects/creature/CreatureObject.java | 9 + src/services/bazaar/AuctionItem.java | 43 +- src/services/bazaar/BazaarService.java | 616 +++++++++++++++++- src/services/map/MapService.java | 3 + src/services/object/ObjectService.java | 15 + 16 files changed, 899 insertions(+), 29 deletions(-) rename src/protocol/swg/auctionManagerClientListener/{ItemSoldMessage.java => CreateAuctionResponseMessage.java} (90%) diff --git a/src/main/NGECore.java b/src/main/NGECore.java index ee431544..8d52846a 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -627,6 +627,9 @@ public class NGECore { return resourceHistoryODB; } + public ObjectDatabase getAuctionODB() { + return auctionODB; + } public int getActiveClients() { int connections = 0; diff --git a/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersMessage.java b/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersMessage.java index 14f345ba..e0ce1fd6 100644 --- a/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersMessage.java @@ -63,7 +63,7 @@ public class AuctionQueryHeadersMessage extends SWGMessage { setMinPrice(data.getInt()); setMaxPrice(data.getInt()); setIncludeEntranceFee(data.get()); - data.skip(5); // unk + data.skip(6); // unk setVendorId(data.getLong()); setVendorFlag(data.get()); setOffset(data.getShort()); diff --git a/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java b/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java index 4c2776c9..a36bb523 100644 --- a/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/AuctionQueryHeadersResponseMessage.java @@ -21,22 +21,159 @@ ******************************************************************************/ package protocol.swg.auctionManagerClientListener; +import java.nio.ByteOrder; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.TreeSet; +import java.util.Vector; + import org.apache.mina.core.buffer.IoBuffer; +import engine.resources.common.CRC; import protocol.swg.SWGMessage; +import services.bazaar.AuctionItem; public class AuctionQueryHeadersResponseMessage extends SWGMessage { + + private int screen; + private int counter; + private LinkedHashSet locationList = new LinkedHashSet(); + private LinkedHashSet itemList = new LinkedHashSet(); + private long playerId; + private short offset; + private boolean continues; + + public AuctionQueryHeadersResponseMessage(long playerId, int screen, int counter, short offset, boolean continues) { + this.playerId = playerId; + this.screen = screen; + this.counter = counter; + this.offset = offset; + this.continues = continues; + } @Override public void deserialize(IoBuffer data) { // TODO Auto-generated method stub } + + public void addItem(AuctionItem item) { + locationList.add(item.getVuid()); + locationList.add(item.getOwnerName()); + + if(item.isAuction() && item.getStatus() == AuctionItem.FORSALE) + locationList.add(item.getBidderName()); + else + locationList.add(""); + + itemList.add(item); + } @Override public IoBuffer serialize() { - // TODO Auto-generated method stub - return null; + final IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + + result.putShort((short) 8); + result.putInt(0xFA500E52); + result.putInt(counter); + result.putInt(screen); + + result.putInt(locationList.size()); + + for(String str : locationList) { + result.put(getAsciiString(str)); + } + + result.putInt(itemList.size()); + + for(AuctionItem item : itemList) { + result.put(getUnicodeString(item.getItemName())); + } + + result.putInt(itemList.size()); + + int i = 0; + for(AuctionItem item : itemList) { + + result.putLong(item.getObjectId()); + result.put((byte) i); + result.putInt(item.getPrice()); + result.putInt((int) ((item.getExpireTime() - System.currentTimeMillis()) / 1000)); + result.putInt(item.getPrice()); + result.putShort((short) 0); + result.put((byte) 0); + result.putInt(CRC.StringtoCRC(item.getItem().getTemplate())); + result.putShort((short) 0); + result.put((byte) 0); + result.put((byte) 1); + result.putInt(0); + result.putInt(0); + result.put((byte) 0); + result.putInt(2); + result.putInt(0); + result.putShort((short) 0); + result.putInt(item.getItemType()); + result.putInt(0); + result.putInt(0); + result.putInt(0); + +/* + result.put((byte) (item.isAuction() ? 0 : 1)); + result.putShort((short) getStringIndex(item.getVuid())); + result.putLong(item.getOwnerId()); + result.putShort((short) getStringIndex(item.getOwnerName())); + + if(item.isAuction() && item.getStatus() == AuctionItem.FORSALE) { + result.putLong(item.getBuyerId()); + result.putShort((short) getStringIndex(item.getBidderName())); + } else { + result.putLong(0); + result.putShort((short) getStringIndex("")); + } + + result.putInt(item.getProxyBid()); + result.putInt(item.getPrice()); + result.putInt(item.getItemType()); + + int options = 0; + + if(item.getOwnerId() == playerId && (item.getStatus() == AuctionItem.OFFERED || item.getStatus() == AuctionItem.FORSALE)) + options |= 0x800; + + result.putInt(item.getAuctionOptions() | options); + result.putInt(0); + */ + i++; + + } + + result.putShort(offset); + + if(continues) + result.put((byte) 1); + else + result.put((byte) 0); + + int size = result.position(); + IoBuffer result2 = IoBuffer.allocate(size).put(result.array(), 0, size); + + return result2.flip(); + } + + private int getStringIndex(String str) { + int i = 0; + for(String string : locationList) { + if(str.equals(string)) + return i; + i++; + } + return i; + } + + public void setContinues(boolean continues) { + this.continues = continues; } } diff --git a/src/protocol/swg/auctionManagerClientListener/BidAuctionMessage.java b/src/protocol/swg/auctionManagerClientListener/BidAuctionMessage.java index ea769785..b065b56e 100644 --- a/src/protocol/swg/auctionManagerClientListener/BidAuctionMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/BidAuctionMessage.java @@ -28,13 +28,16 @@ import protocol.swg.SWGMessage; public class BidAuctionMessage extends SWGMessage { private long auctionId; + private long vendorId; private int myPrice; private int proxyPrice; + @Override public void deserialize(IoBuffer data) { data.skip(6); setAuctionId(data.getLong()); + setVendorId(data.getLong()); setMyPrice(data.getInt()); setProxyPrice(data.getInt()); } @@ -69,4 +72,12 @@ public class BidAuctionMessage extends SWGMessage { this.proxyPrice = proxyPrice; } + public long getVendorId() { + return vendorId; + } + + public void setVendorId(long vendorId) { + this.vendorId = vendorId; + } + } diff --git a/src/protocol/swg/auctionManagerClientListener/BidAuctionResponseMessage.java b/src/protocol/swg/auctionManagerClientListener/BidAuctionResponseMessage.java index 2ff213ef..06eff2f5 100644 --- a/src/protocol/swg/auctionManagerClientListener/BidAuctionResponseMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/BidAuctionResponseMessage.java @@ -62,5 +62,10 @@ public class BidAuctionResponseMessage extends SWGMessage { result.putInt(status); return result.flip(); } + + public void setStatus(int status) { + this.status = status; + } + } diff --git a/src/protocol/swg/auctionManagerClientListener/CancelLiveAuctionResponseMessage.java b/src/protocol/swg/auctionManagerClientListener/CancelLiveAuctionResponseMessage.java index d820f45b..55e1ce02 100644 --- a/src/protocol/swg/auctionManagerClientListener/CancelLiveAuctionResponseMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/CancelLiveAuctionResponseMessage.java @@ -59,5 +59,10 @@ public class CancelLiveAuctionResponseMessage extends SWGMessage { result.put((byte) 0); // unk return result.flip(); } + + public void setStatus(int status) { + this.status = status; + } + } diff --git a/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java b/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java index cdabef34..d05a6756 100644 --- a/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/CreateAuctionMessage.java @@ -26,6 +26,7 @@ import java.nio.ByteBuffer; import org.apache.mina.core.buffer.IoBuffer; +import engine.resources.common.Utilities; import protocol.swg.SWGMessage; public class CreateAuctionMessage extends SWGMessage { @@ -40,10 +41,7 @@ public class CreateAuctionMessage extends SWGMessage { @Override public void deserialize(IoBuffer data) { data.skip(6); - setObjectId(data.getLong()); - setVendorId(data.getLong()); - setPrice(data.getInt()); - setDuration(data.getInt()); // in minutes + setObjectId(data.getLong()); int size = data.getInt(); try { setDescription(new String(ByteBuffer.allocate(size * 2).put(data.array(), data.position(), size * 2).array(), "UTF-16LE")); @@ -51,6 +49,10 @@ public class CreateAuctionMessage extends SWGMessage { e.printStackTrace(); } data.position(data.position() + size * 2); + + setVendorId(data.getLong()); + setPrice(data.getInt()); + setDuration(data.getInt()); // in minutes setPremium(data.get()); } @@ -100,8 +102,10 @@ public class CreateAuctionMessage extends SWGMessage { this.description = description; } - public byte getPremium() { - return premium; + public boolean getPremium() { + if(premium == 1) + return true; + return false; } public void setPremium(byte premium) { diff --git a/src/protocol/swg/auctionManagerClientListener/ItemSoldMessage.java b/src/protocol/swg/auctionManagerClientListener/CreateAuctionResponseMessage.java similarity index 90% rename from src/protocol/swg/auctionManagerClientListener/ItemSoldMessage.java rename to src/protocol/swg/auctionManagerClientListener/CreateAuctionResponseMessage.java index 6c22d1a1..8a067dff 100644 --- a/src/protocol/swg/auctionManagerClientListener/ItemSoldMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/CreateAuctionResponseMessage.java @@ -27,7 +27,7 @@ import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.SWGMessage; -public class ItemSoldMessage extends SWGMessage { +public class CreateAuctionResponseMessage extends SWGMessage { public static final int SUCCESS = 0; public static final int INVALIDAUCTIONER = 1; @@ -47,7 +47,7 @@ public class ItemSoldMessage extends SWGMessage { private long objectId; private int status; - public ItemSoldMessage(long objectId, int status) { + public CreateAuctionResponseMessage(long objectId, int status) { this.objectId = objectId; this.status = status; } @@ -61,11 +61,12 @@ public class ItemSoldMessage extends SWGMessage { @Override public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(18).order(ByteOrder.LITTLE_ENDIAN); - result.putShort((short) 3); + IoBuffer result = IoBuffer.allocate(20).order(ByteOrder.LITTLE_ENDIAN); + result.putShort((short) 4); result.putInt(0x0E61CC92); result.putLong(objectId); result.putInt(status); + result.putShort((short) 0); return result.flip(); } diff --git a/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java b/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java index 4fe23725..458c59d6 100644 --- a/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java +++ b/src/protocol/swg/auctionManagerClientListener/GetAuctionDetailsResponse.java @@ -21,12 +21,23 @@ ******************************************************************************/ package protocol.swg.auctionManagerClientListener; +import java.nio.ByteOrder; + import org.apache.mina.core.buffer.IoBuffer; +import engine.resources.objects.SWGObject; import protocol.swg.SWGMessage; +import resources.objects.tangible.TangibleObject; +import services.bazaar.AuctionItem; public class GetAuctionDetailsResponse extends SWGMessage { + private AuctionItem target; + + public GetAuctionDetailsResponse(AuctionItem target) { + this.target = target; + } + @Override public void deserialize(IoBuffer data) { // TODO Auto-generated method stub @@ -35,8 +46,30 @@ public class GetAuctionDetailsResponse extends SWGMessage { @Override public IoBuffer serialize() { - // TODO Auto-generated method stub - return null; + final IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + + result.putShort((short) 2); + result.putInt(0xFE0E644B); + result.putLong(target.getObjectId()); + result.put(getUnicodeString(target.getItemDescription())); + result.putInt(target.getItem().getAttributes().size()); + target.getItem().getAttributes().forEach((key, value) -> { + result.put(getAsciiString(key)); + result.put(getUnicodeString(value)); + }); + result.put(getAsciiString(target.getItem().getTemplate())); + if(((TangibleObject) target.getItem()).getCustomization() != null) { + result.putShort((short) ((TangibleObject) target.getItem()).getCustomization().length); + result.put(((TangibleObject) target.getItem()).getCustomization()); + } else + result.putShort((short) 0); + + + int size = result.position(); + IoBuffer result2 = IoBuffer.allocate(size).put(result.array(), 0, size); + + return result2.flip(); } } diff --git a/src/protocol/swg/auctionManagerClientListener/RetrieveAuctionItemResponseMessage.java b/src/protocol/swg/auctionManagerClientListener/RetrieveAuctionItemResponseMessage.java index 2d883695..ad9093da 100644 --- a/src/protocol/swg/auctionManagerClientListener/RetrieveAuctionItemResponseMessage.java +++ b/src/protocol/swg/auctionManagerClientListener/RetrieveAuctionItemResponseMessage.java @@ -58,5 +58,10 @@ public class RetrieveAuctionItemResponseMessage extends SWGMessage { result.putInt(status); return result.flip(); } + + public void setStatus(int status) { + this.status = status; + } + } diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index 59b9880d..1d0ec6d5 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -25,6 +25,8 @@ import engine.resources.common.CRC; public class Opcodes { + public static int AuctionQueryHeadersMessage = CRC.StringtoCRC("AuctionQueryHeadersMessage"); + public static int CreateImmediateAuctionMessage = CRC.StringtoCRC("CreateImmediateAuctionMessage"); public static int ChatEnterRoomById = CRC.StringtoCRC("ChatEnterRoomById"); public static int ChatSendToRoom = CRC.StringtoCRC("ChatSendToRoom"); public static int ChatDeletePersistentMessage = 0x8F251641; @@ -83,4 +85,10 @@ public class Opcodes { public static int ChatCreateRoom = CRC.StringtoCRC("ChatCreateRoom"); public static int ChatQueryRoom = 0x9CF2B192; public static int Unknown = 0x173B91C2; // packet sent to server on every character load-in + public static int GetAuctionDetails = CRC.StringtoCRC("GetAuctionDetails"); + public static int CancelLiveAuctionMessage = CRC.StringtoCRC("CancelLiveAuctionMessage"); + public static int BidAuctionMessage = CRC.StringtoCRC("BidAuctionMessage"); + public static int RetrieveAuctionItemMessage = CRC.StringtoCRC("RetrieveAuctionItemMessage"); + + } diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 0dd25c94..e646c7f2 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.atomic.LongAdder; import org.apache.mina.core.buffer.IoBuffer; @@ -1850,6 +1851,14 @@ public class CreatureObject extends TangibleObject implements IPersistent { } } + public int getInventoryItemCount() { + if(getSlottedObject("inventory") == null) + return 0; + LongAdder adder = new LongAdder(); + getSlottedObject("inventory").viewChildren(this, true, true, (obj) -> adder.increment()); + return adder.intValue(); + } + //public float getCooldown(String cooldownGroup) { //return ((float) getCooldown(cooldownGroup) / (float) 1000); //} diff --git a/src/services/bazaar/AuctionItem.java b/src/services/bazaar/AuctionItem.java index 8b134e97..92e1e41f 100644 --- a/src/services/bazaar/AuctionItem.java +++ b/src/services/bazaar/AuctionItem.java @@ -26,22 +26,26 @@ import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.PrimaryKey; -import engine.resources.objects.IPersistent; -@Entity(version=0) -public class AuctionItem implements IPersistent { +import engine.resources.objects.IPersistent; +import engine.resources.objects.SWGObject; + +@Entity(version=1) +public class AuctionItem implements IPersistent, Comparable { @PrimaryKey private long objectId; + private SWGObject item; private long ownerId; private long vendorId; private long buyerId; private long offerToId; private int itemType; private String ownerName; - private String bidderName; + private String bidderName = ""; private String itemName; private String itemDescription; + private String planet; private int price; private int proxyBid; private boolean auction; @@ -66,8 +70,9 @@ public class AuctionItem implements IPersistent { } - public AuctionItem(long objectId, long ownerId) { - this.objectId = objectId; + public AuctionItem(SWGObject item, long ownerId) { + this.item = item; + this.objectId = item.getObjectID(); this.ownerId = ownerId; } @@ -260,5 +265,31 @@ public class AuctionItem implements IPersistent { public Transaction getTransaction() { return txn; } + + public SWGObject getItem() { + return item; + } + + public void setItem(SWGObject item) { + this.item = item; + } + + public String getPlanet() { + return planet; + } + + public void setPlanet(String planet) { + this.planet = planet; + } + + @Override + public int compareTo(AuctionItem other) { + if(getExpireTime() < other.getExpireTime()) + return -1; + else if(getExpireTime() > other.getExpireTime()) + return 1; + else + return 0; + } } diff --git a/src/services/bazaar/BazaarService.java b/src/services/bazaar/BazaarService.java index 1700aa64..371d7990 100644 --- a/src/services/bazaar/BazaarService.java +++ b/src/services/bazaar/BazaarService.java @@ -22,31 +22,78 @@ package services.bazaar; import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentSkipListSet; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.sleepycat.je.Transaction; +import com.sleepycat.persist.EntityCursor; import main.NGECore; import engine.clients.Client; import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import resources.common.Opcodes; +import resources.common.OutOfBand; +import resources.common.ProsePackage; import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; +import resources.objects.intangible.IntangibleObject; +import resources.objects.manufacture.ManufactureSchematicObject; +import resources.objects.tangible.TangibleObject; import protocol.swg.ClientIdMsg; +import protocol.swg.auctionManagerClientListener.AuctionQueryHeadersMessage; +import protocol.swg.auctionManagerClientListener.AuctionQueryHeadersResponseMessage; +import protocol.swg.auctionManagerClientListener.BidAuctionMessage; +import protocol.swg.auctionManagerClientListener.BidAuctionResponseMessage; +import protocol.swg.auctionManagerClientListener.CancelLiveAuctionMessage; +import protocol.swg.auctionManagerClientListener.CancelLiveAuctionResponseMessage; import protocol.swg.auctionManagerClientListener.CommoditiesItemTypeListResponse; import protocol.swg.auctionManagerClientListener.CommoditiesResourceTypeListResponse; import protocol.swg.auctionManagerClientListener.CreateAuctionMessage; +import protocol.swg.auctionManagerClientListener.GetAuctionDetails; +import protocol.swg.auctionManagerClientListener.GetAuctionDetailsResponse; import protocol.swg.auctionManagerClientListener.IsVendorOwnerMessage; import protocol.swg.auctionManagerClientListener.IsVendorOwnerResponseMessage; -import protocol.swg.auctionManagerClientListener.ItemSoldMessage; +import protocol.swg.auctionManagerClientListener.CreateAuctionResponseMessage; +import protocol.swg.auctionManagerClientListener.RetrieveAuctionItemMessage; +import protocol.swg.auctionManagerClientListener.RetrieveAuctionItemResponseMessage; public class BazaarService implements INetworkDispatch { private NGECore core; + private Set auctionItems = new ConcurrentSkipListSet(); + private ConcurrentHashMap commodityLimit = new ConcurrentHashMap(); + private final static int COMMODITY_LIMIT = 25; + private final static int MAX_BAZAAR_SALE_PRICE = 10000000; + private final static int SALES_FEE = 20; + private final static int COMMODITY_EXPIRE = 604800; + private final static int VENDOR_EXPIRE = 2592000; public BazaarService(NGECore core) { this.core = core; + loadAuctionItems(); + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + System.out.println("Saving auction items..."); + auctionItems.forEach(item -> core.objectService.persistObject(item, Long.class, AuctionItem.class, core.getAuctionODB())); + })); + } + + private void loadAuctionItems() { + EntityCursor cursor = core.getAuctionODB().getCursor(Long.class, AuctionItem.class); + Iterator it = cursor.iterator(); + it.forEachRemaining(this::addAuctionItem); + cursor.close(); } @Override @@ -90,7 +137,7 @@ public class BazaarService implements INetworkDispatch { if(terminal == null) return; Point3D pos = terminal.getWorldPosition(); - session.write(new IsVendorOwnerResponseMessage(2, 0, terminalId, "tatooine.@tatooine_region_names:mos_eisley.@terminal_name:terminal_bazaar." + terminalId + "#" + pos.x + "," + pos.z).serialize()); + session.write(new IsVendorOwnerResponseMessage(2, 0, terminalId, getVendorUID((TangibleObject) terminal)).serialize()); }); @@ -116,6 +163,117 @@ public class BazaarService implements INetworkDispatch { }); + swgOpcodes.put(Opcodes.CancelLiveAuctionMessage, (session, data) -> { + + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + + if (player == null) + return; + + data = data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + + CancelLiveAuctionMessage cancelLiveAuction = new CancelLiveAuctionMessage(); + cancelLiveAuction.deserialize(data); + + AuctionItem item = getAuctionItem(cancelLiveAuction.getObjectId()); + + if(item == null) + return; + + cancelItem(player, item); + + }); + + swgOpcodes.put(Opcodes.BidAuctionMessage, (session, data) -> { + + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + + if (player == null) + return; + + data = data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + + BidAuctionMessage bidAuction = new BidAuctionMessage(); + bidAuction.deserialize(data); + + AuctionItem item = getAuctionItem(bidAuction.getAuctionId()); + //SWGObject vendor = core.objectService.getObject(bidAuction.getVendorId()); + if(item == null) + return; + SWGObject vendor = core.objectService.getObject(item.getVendorId()); + if(vendor == null) + return; + buyItem((CreatureObject) player, item, vendor, bidAuction.getMyPrice(), bidAuction.getProxyPrice()); + + }); + + swgOpcodes.put(Opcodes.RetrieveAuctionItemMessage, (session, data) -> { + + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + + if (player == null) + return; + + data = data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + + RetrieveAuctionItemMessage retrieveItem = new RetrieveAuctionItemMessage(); + retrieveItem.deserialize(data); + + AuctionItem item = getAuctionItem(retrieveItem.getObjectId()); + SWGObject vendor = core.objectService.getObject(retrieveItem.getVendorId()); + + if(item == null || vendor == null) + return; + + retrieveItem((CreatureObject) player, item, vendor); + + }); + + swgOpcodes.put(Opcodes.GetAuctionDetails, (session, data) -> { + + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + + if (player == null) + return; + + data = data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + + GetAuctionDetails request = new GetAuctionDetails(); + request.deserialize(data); + AuctionItem item = getAuctionItem(request.getObjectId()); + + if(item == null) + return; + + client.getSession().write(new GetAuctionDetailsResponse(item).serialize()); + + }); + + swgOpcodes.put(Opcodes.CreateAuctionMessage, (session, data) -> { Client client = core.getClient(session); @@ -125,6 +283,34 @@ public class BazaarService implements INetworkDispatch { SWGObject player = client.getParent(); + if (player == null) + return; + + + data = data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + + CreateAuctionMessage createAuction = new CreateAuctionMessage(); + createAuction.deserialize(data); + SWGObject vendor = core.objectService.getObject(createAuction.getVendorId()); + SWGObject item = core.objectService.getObject(createAuction.getObjectId()); + + if(vendor == null || item == null || item instanceof CreatureObject || item instanceof BuildingObject) + return; + + addAuction((CreatureObject) player, item, vendor, createAuction.getPrice(), createAuction.getDuration(), createAuction.getDescription(), true, createAuction.getPremium()); + + }); + + swgOpcodes.put(Opcodes.CreateImmediateAuctionMessage, (session, data) -> { + + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + if (player == null) return; @@ -132,14 +318,41 @@ public class BazaarService implements INetworkDispatch { data.position(0); CreateAuctionMessage createAuction = new CreateAuctionMessage(); - + createAuction.deserialize(data); + SWGObject vendor = core.objectService.getObject(createAuction.getVendorId()); SWGObject item = core.objectService.getObject(createAuction.getObjectId()); if(vendor == null || item == null || item instanceof CreatureObject || item instanceof BuildingObject) return; + addAuction((CreatureObject) player, item, vendor, createAuction.getPrice(), createAuction.getDuration(), createAuction.getDescription(), false, createAuction.getPremium()); + + }); + + swgOpcodes.put(Opcodes.AuctionQueryHeadersMessage, (session, data) -> { + Client client = core.getClient(session); + + if (client == null) + return; + + SWGObject player = client.getParent(); + + if (player == null) + return; + + data = data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + + AuctionQueryHeadersMessage queryHeaders = new AuctionQueryHeadersMessage(); + queryHeaders.deserialize(data); + SWGObject vendor = core.objectService.getObject(queryHeaders.getVendorId()); + + if(vendor == null) + return; + + getItemData(player, vendor, queryHeaders.getRange(), queryHeaders.getScreen(), queryHeaders.getCounter(), queryHeaders.getOffset(), queryHeaders.getItemTypeCRC(), queryHeaders.getMinPrice(), queryHeaders.getMaxPrice()); }); @@ -147,17 +360,381 @@ public class BazaarService implements INetworkDispatch { } + public void buyItem(CreatureObject player, AuctionItem item, SWGObject vendor, int price, int proxyPrice) { + + BidAuctionResponseMessage response = new BidAuctionResponseMessage(item.getObjectId(), BidAuctionResponseMessage.SUCCESS); + + if((price > MAX_BAZAAR_SALE_PRICE || proxyPrice > MAX_BAZAAR_SALE_PRICE) && item.isOnBazaar()) { + response.setStatus(BidAuctionResponseMessage.PRICEOVERFLOW); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(price < 1 /*|| proxyPrice < 1 */|| price < item.getPrice()) { + response.setStatus(BidAuctionResponseMessage.INVALIDPRICE); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(price > player.getBankCredits()) { + response.setStatus(BidAuctionResponseMessage.NOTENOUGHCREDITS); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(item.isAuction()) + bidAuction(player, item, vendor, price, proxyPrice); + else + instantBuy(player, item, vendor); + + } + + public void instantBuy(CreatureObject player, AuctionItem item, SWGObject vendor) { + //System.out.println("test"); + + long timeUntilExpire = (item.getExpireTime() - System.currentTimeMillis()) / 1000; + long retrieveExpire = 0; + + if(item.isOnBazaar()) + retrieveExpire = timeUntilExpire + COMMODITY_EXPIRE; + else + retrieveExpire = timeUntilExpire + VENDOR_EXPIRE; + + item.setStatus(AuctionItem.SOLD); + item.setBuyerId(player.getObjectID()); + item.setExpireTime(retrieveExpire); + item.setBidderName(player.getCustomName()); + player.setBankCredits(player.getBankCredits() - item.getPrice()); + player.getClient().getSession().write(new BidAuctionResponseMessage(item.getObjectId(), BidAuctionResponseMessage.SUCCESS).serialize()); + + // TODO send mail with WP + + CreatureObject seller = (CreatureObject) core.objectService.getObject(item.getOwnerId()); + + if(seller == null) { + seller = core.objectService.getCreatureFromDB(item.getOwnerId()); + seller.setBankCredits(seller.getBankCredits() + item.getPrice()); + core.objectService.persistObject(seller, Long.class, CreatureObject.class, core.getAuctionODB()); + } + + } + + public void bidAuction(CreatureObject player, AuctionItem item, SWGObject vendor, int price, int proxyPrice) { + //System.out.println("test"); + } + + public void retrieveItem(CreatureObject player, AuctionItem item, SWGObject vendor) { + + RetrieveAuctionItemResponseMessage response = new RetrieveAuctionItemResponseMessage(item.getObjectId(), RetrieveAuctionItemResponseMessage.SUCCESS); + String closestCityName = core.mapService.getClosestCityName(player); + SWGObject vendorOfItem = core.objectService.getObject(item.getVendorId()); + + if(vendorOfItem == null) { + response.setStatus(RetrieveAuctionItemResponseMessage.DONTRETRIEVE); + player.getClient().getSession().write(response.serialize()); + return; + } + + + if(item.getItem() instanceof TangibleObject && player.getInventoryItemCount() >= 80) { + response.setStatus(RetrieveAuctionItemResponseMessage.FULLINVENTORY); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(item.getStatus() == AuctionItem.RETRIEVED || item.getStatus() == AuctionItem.FORSALE) { + response.setStatus(RetrieveAuctionItemResponseMessage.NOTALLOWED); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(item.getStatus() == AuctionItem.SOLD && item.getBuyerId() != player.getObjectID()) { + response.setStatus(RetrieveAuctionItemResponseMessage.NOTALLOWED); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(!item.isOnBazaar() && !vendor.inRange(player.getWorldPosition(), 8)) { + response.setStatus(RetrieveAuctionItemResponseMessage.TOOFAR); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(item.isOnBazaar() && !core.mapService.getClosestCityName(vendorOfItem).equals(closestCityName)) { + response.setStatus(RetrieveAuctionItemResponseMessage.TOOFAR); + player.getClient().getSession().write(response.serialize()); + return; + } + + item.setStatus(AuctionItem.RETRIEVED); + + if(item.getItem() instanceof TangibleObject) + player.getSlottedObject("inventory").add(item.getItem()); + else if(item.getItem() instanceof IntangibleObject) + player.getSlottedObject("datapad").add(item.getItem()); + + removeAuctionItem(item); + player.getClient().getSession().write(response.serialize()); + + } + + public void cancelItem(SWGObject player, AuctionItem item) { + + CancelLiveAuctionResponseMessage response = new CancelLiveAuctionResponseMessage(item.getObjectId(), CancelLiveAuctionResponseMessage.SUCCESS); + + long timeUntilExpire = (item.getExpireTime() - System.currentTimeMillis()) / 1000; + long retrieveExpire = 0; + + if(item.getStatus() == AuctionItem.FORSALE) { + + if(item.getOwnerId() != player.getObjectID()) { + response.setStatus(CancelLiveAuctionResponseMessage.NOTOWNER); + player.getClient().getSession().write(response.serialize()); + return; + } + + if(item.isOnBazaar()) + retrieveExpire = timeUntilExpire + COMMODITY_EXPIRE; + else + retrieveExpire = timeUntilExpire + VENDOR_EXPIRE; + + } else if(item.getStatus() == AuctionItem.OFFERED) { + // TODO implement offers + return; + } else { + response.setStatus(CancelLiveAuctionResponseMessage.ALREADYCOMPLETED); + player.getClient().getSession().write(response.serialize()); + return; + } + + // TODO: cancel auction once implemented + + item.setStatus(AuctionItem.EXPIRED); + item.setExpireTime(retrieveExpire); + player.getClient().getSession().write(response.serialize()); + + } + + public void getItemData(SWGObject player, SWGObject vendor, int range, int screen, int counter, short offset, int category, int minPrice, int maxPrice) { + + Set inRangeItems = getInRangeItems(range, player.getPlanet(), vendor, core.mapService.getClosestCityName(player)); + + Iterator it = inRangeItems.iterator(); + int displayedItems = 0; + + AuctionQueryHeadersResponseMessage response = new AuctionQueryHeadersResponseMessage(player.getObjectID(), screen, counter, offset, false); + + while(it.hasNext() && displayedItems < offset + 100) { + + AuctionItem item = it.next(); + + if((minPrice != 0 && item.getPrice() < minPrice) || (maxPrice != 0 && item.getPrice() > maxPrice)) + continue; + + switch(screen) { + + // Auctions + case 2: + if(item.getStatus() == AuctionItem.FORSALE) { + if((category & 255) != 0 && item.getItemType() == category) { + if(displayedItems >= offset) + response.addItem(item); + displayedItems++; + } else if((item.getItemType() & category) != 0) { + if(displayedItems >= offset) + response.addItem(item); + displayedItems++; + } else if(item.getItemType() < 256 && category == 8192) { + if(displayedItems >= offset) + response.addItem(item); + displayedItems++; + } else if(category == 0) { + if(displayedItems >= offset) + response.addItem(item); + displayedItems++; + } + } + break; + // My Items for sale + case 3: + if(item.getStatus() == AuctionItem.FORSALE && player.getObjectID() == item.getOwnerId()) + response.addItem(item); + break; + // My Auction Bids + case 4: + if(item.isAuction() && item.getStatus() == AuctionItem.FORSALE && player.getCustomName().equals(item.getBidderName())) + response.addItem(item); + break; + // Retrieve items + case 5: + if(item.getStatus() == AuctionItem.SOLD && player.getObjectID() == item.getBuyerId()) + response.addItem(item); + else if(item.getStatus() == AuctionItem.EXPIRED && player.getObjectID() == item.getOwnerId()) + response.addItem(item); + break; + // Offers to my vendor + case 6: + if(item.getStatus() == AuctionItem.OFFERED && player.getObjectID() == item.getOfferToId()) + response.addItem(item); + break; + // Vendor search TODO later + case 7: + break; + // Stock + case 8: + if(item.getStatus() == AuctionItem.SOLD && player.getObjectID() == item.getBuyerId()) + response.addItem(item); + else if(item.getStatus() == AuctionItem.EXPIRED && player.getObjectID() == item.getOwnerId()) + response.addItem(item); + break; + // Offers to other vendor + case 9: + if(item.getStatus() == AuctionItem.OFFERED && player.getObjectID() == item.getOwnerId()) + response.addItem(item); + break; + + + } + + } + + if(displayedItems == offset + 100) + response.setContinues(true); + + player.getClient().getSession().write(response.serialize()); + } + + public Set getInRangeItems(int range, Planet planet, SWGObject vendor, String closestCityName) { + + Set inRangeItems = new ConcurrentSkipListSet(); + String planetName = planet.getName(); + + auctionItems.forEach((item) -> { + + SWGObject vendorOfItem = core.objectService.getObject(item.getVendorId()); + if(vendorOfItem == null) + return; + if(range > 0 && !item.getPlanet().equals(planetName)) + return; + else if(range > 1 && !core.mapService.getClosestCityName(vendorOfItem).equals(closestCityName)) + return; + else if(range > 2 && item.getVendorId() != vendor.getObjectID()) + return; + + inRangeItems.add(item); + + }); + + return inRangeItems; + } + public void addAuction(CreatureObject player, SWGObject item, SWGObject vendor, int price, int duration, String description, boolean auction, boolean premium) { - ItemSoldMessage itemSoldMsg = new ItemSoldMessage(item.getObjectID(), ItemSoldMessage.SUCCESS); + CreateAuctionResponseMessage itemSoldMsg = new CreateAuctionResponseMessage(item.getObjectID(), CreateAuctionResponseMessage.SUCCESS); - if(item.getAttributes().containsKey("no_trade") || !item.isSubChildOf(player)) { - itemSoldMsg.setStatus(ItemSoldMessage.INVALIDITEM); + if(item.getAttributes().containsKey("no_trade") || !item.isSubChildOf(player) || (item instanceof IntangibleObject && !(item instanceof ManufactureSchematicObject))) { + itemSoldMsg.setStatus(CreateAuctionResponseMessage.INVALIDITEM); + player.getClient().getSession().write(itemSoldMsg.serialize()); + return; + } + + if(core.tradeService.getTradingObjectMap().get(item) != null) { + itemSoldMsg.setStatus(CreateAuctionResponseMessage.CANTSELLTRADINGITEM); + player.getClient().getSession().write(itemSoldMsg.serialize()); + return; + } + + if(getAuctionItem(item.getObjectID()) != null) { + itemSoldMsg.setStatus(CreateAuctionResponseMessage.ALREADYFORSALE); player.getClient().getSession().write(itemSoldMsg.serialize()); return; } + if(price < 1 || price > MAX_BAZAAR_SALE_PRICE) { + itemSoldMsg.setStatus(CreateAuctionResponseMessage.INVALIDPRICE); + player.getClient().getSession().write(itemSoldMsg.serialize()); + return; + } + if(commodityLimit.get(player) != null && commodityLimit.get(player) >= COMMODITY_LIMIT) { + itemSoldMsg.setStatus(CreateAuctionResponseMessage.TOOMANYITEMS); + player.getClient().getSession().write(itemSoldMsg.serialize()); + return; + } + + if(player.getBankCredits() < SALES_FEE || (premium && player.getBankCredits() < SALES_FEE * 5)) { + itemSoldMsg.setStatus(CreateAuctionResponseMessage.NOTENOUGHCREDITS); + player.getClient().getSession().write(itemSoldMsg.serialize()); + return; + } + + AuctionItem auctionItem = createAuctionItem(player, vendor, item, price, description, duration, auction, premium); + + core.objectService.destroyObject(item); + + if(vendor.getTemplate().contains("terminal_bazaar")) { + ProsePackage prose = new ProsePackage("base_player", "sale_fee"); + int salesFee = SALES_FEE; + if(premium) + salesFee *= 5; + + player.setBankCredits(player.getBankCredits() - salesFee); + prose.setDiInteger(salesFee); + player.sendSystemMessage(new OutOfBand(prose), (byte) 0); + } + + if(auction) { + + } + + player.getClient().getSession().write(itemSoldMsg.serialize()); + + } + + public AuctionItem createAuctionItem(SWGObject player, SWGObject vendor, SWGObject item, int price, String description, int duration, boolean auction, boolean premium) { + + AuctionItem auctionItem = new AuctionItem(item, player.getObjectID()); + auctionItem.setExpireTime(System.currentTimeMillis() + (COMMODITY_EXPIRE * 1000)); + auctionItem.setAuction(auction); + auctionItem.setItemDescription(description); + auctionItem.setPrice(price); + auctionItem.setItemType(item.getTemplateData().getAttribute("gameObjectType")); + auctionItem.setStatus(AuctionItem.FORSALE); + //auctionItem.setItemName("@" + item.getStfFilename() + ":" + item.getStfName()); + String name = item.getCustomName() == null ? "@" + item.getStfFilename() + ":" + item.getStfName() : item.getCustomName(); + auctionItem.setItemName(name); + auctionItem.setVendorId(vendor.getObjectID()); + auctionItem.setPlanet(vendor.getPlanet().getName()); + auctionItem.setVuid(getVendorUID((TangibleObject) vendor)); + auctionItem.setOwnerName(player.getCustomName()); + + if(vendor.getTemplate().contains("terminal_bazaar")) + auctionItem.setOnBazaar(true); + + addAuctionItem(auctionItem); + + return auctionItem; + } + + public String getVendorUID(TangibleObject vendor) { + + if(vendor.getAttachment("uid") != null) + return (String) vendor.getAttachment("uid"); + + String planet = ""; + if(vendor.getContainer() == null) + planet = vendor.getPlanet().getName(); + else + planet = vendor.getContainer().getPlanet().getName(); + + String uid = (planet + "."); + Point3D pos = vendor.getWorldPosition(); + + uid += ("@" + planet + "_region_names:" + core.mapService.getClosestCityName(vendor).toLowerCase().replace(" ", "_")); // TODO: replace this with city regions when they are implemented + uid += ("." + "@" + vendor.getStfFilename() + ":" + vendor.getStfName() + "."); + uid += (vendor.getObjectID() + "#" + pos.x + "," + pos.z); + vendor.setAttachment("uid", uid); + return uid; } @@ -165,6 +742,29 @@ public class BazaarService implements INetworkDispatch { public void shutdown() { } - - + + public AuctionItem getAuctionItem(long objectId) { + return auctionItems.parallelStream().filter(a -> a.getObjectId() == objectId).findFirst().orElse(null); + } + + public void addAuctionItem(AuctionItem auctionItem) { + auctionItems.add(auctionItem); + int commodityNumber = 0; + if(commodityLimit.get(auctionItem.getOwnerId()) != null) + commodityNumber = commodityLimit.get(auctionItem.getOwnerId()); + commodityLimit.put(auctionItem.getOwnerId(), commodityNumber + 1); + if(!core.getAuctionODB().contains(auctionItem.getObjectId(), Long.class, AuctionItem.class)) { + core.objectService.persistObject(auctionItem, Long.class, AuctionItem.class, core.getAuctionODB()); + } + } + + public void removeAuctionItem(AuctionItem auctionItem) { + auctionItems.remove(auctionItem); + int commodityNumber = 0; + if(commodityLimit.get(auctionItem.getOwnerId()) != null) + commodityNumber = commodityLimit.get(auctionItem.getOwnerId()); + commodityLimit.put(auctionItem.getOwnerId(), commodityNumber - 1); + core.objectService.deletePersistentObject(auctionItem, Long.class, AuctionItem.class, core.getAuctionODB(), auctionItem.getObjectId()); + } + } diff --git a/src/services/map/MapService.java b/src/services/map/MapService.java index 23b6437c..007f4281 100644 --- a/src/services/map/MapService.java +++ b/src/services/map/MapService.java @@ -117,6 +117,9 @@ public class MapService implements INetworkDispatch { public String getClosestCityName(SWGObject object) { + if(object.getPlanet() == null) + object.setPlanet(core.terrainService.getPlanetByID(object.getPlanetId())); + Vector locations = locationMap.get(object.getPlanet()); float closestDistance = Float.MAX_VALUE; String closestName = ""; diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index e8494e41..57c69859 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -88,6 +88,8 @@ import engine.resources.container.Traverser; import engine.resources.container.WorldCellPermissions; import engine.resources.container.WorldPermissions; import engine.resources.database.DatabaseConnection; +import engine.resources.database.ObjectDatabase; +import engine.resources.objects.IPersistent; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; @@ -116,6 +118,7 @@ import resources.objects.tangible.TangibleObject; import resources.objects.tool.SurveyTool; import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; +import services.bazaar.AuctionItem; @SuppressWarnings("unused") @@ -1185,4 +1188,16 @@ public class ObjectService implements INetworkDispatch { return count.get(); } + public void persistObject(IPersistent object, Class keyClass, Class valueClass, ObjectDatabase odb) { + object.createTransaction(odb.getEnvironment()); + core.getAuctionODB().put(object, keyClass, valueClass, object.getTransaction()); + object.getTransaction().commitSync(); + } + + public void deletePersistentObject(IPersistent object, Class keyClass, Class valueClass, ObjectDatabase odb, Object key) { + object.createTransaction(odb.getEnvironment()); + core.getAuctionODB().delete(key, keyClass, valueClass, object.getTransaction()); + object.getTransaction().commitSync(); + } + } From 6898380330b3aeec4bded70a35870b7493e3c91b Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 15 Apr 2014 01:19:30 +0200 Subject: [PATCH 46/95] Weapons - getDamageType() now returns a cleaner string --- src/resources/objects/weapon/WeaponObject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 392c206a..2cbb2d75 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -124,7 +124,7 @@ public class WeaponObject extends TangibleObject { } public String getDamageType() { - return getStringAttribute("cat_wpn_damage.wpn_damage_type"); + return getStringAttribute("cat_wpn_damage.wpn_damage_type").replace("@obj_attr_n:armor_eff_", ""); } public void setDamageType(String damageType) { From a385b87e3b6f85cd528cf6d68cfde29618f0c4ad Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 15 Apr 2014 02:35:30 +0200 Subject: [PATCH 47/95] Weapons - Fixed #446 --- src/resources/objects/weapon/WeaponObject.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 2cbb2d75..1ff97a03 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -174,6 +174,7 @@ public class WeaponObject extends TangibleObject { else setIntAttribute("cat_wpn_damage.wpn_attack_speed", (int) attackSpeed); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public WeaponMessageBuilder getMessageBuilder() { From 4fa44e412da71e5d247ba9ef05066f460713dd1b Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Tue, 15 Apr 2014 04:34:50 +0200 Subject: [PATCH 48/95] More loot items added Tusken Raider Clothing Gaffis CDEF Rifles Worked on weapon drops and giving them stats Refactored the item scripts to use lists to allow random templates Tweaked the drop chances to be close to how they were in live --- scripts/loot/lootItems/armor/placeholder.py | 0 .../clothes/tusken_raider_bandolier.py | 8 ++ .../lootItems/clothes/tusken_raider_boots.py | 8 ++ .../lootItems/clothes/tusken_raider_dress.py | 8 ++ .../lootItems/clothes/tusken_raider_gloves.py | 8 ++ .../lootItems/clothes/tusken_raider_helmet.py | 8 ++ scripts/loot/lootItems/colorcrystal.py | 19 +-- scripts/loot/lootItems/junk/antenna.py | 2 +- .../lootItems/junk/armor_repair_device.py | 2 +- scripts/loot/lootItems/junk/brain.py | 2 +- .../loot/lootItems/junk/chassis_blueprint.py | 2 +- scripts/loot/lootItems/junk/comlink.py | 2 +- .../loot/lootItems/junk/damaged_datapad.py | 2 +- scripts/loot/lootItems/junk/ear_jewel.py | 2 +- scripts/loot/lootItems/junk/explosive_dud.py | 2 +- scripts/loot/lootItems/junk/eye.py | 2 +- scripts/loot/lootItems/junk/gland.py | 2 +- scripts/loot/lootItems/junk/heart.py | 2 +- .../loot/lootItems/junk/hyperdrive_unit.py | 2 +- scripts/loot/lootItems/junk/id_chip.py | 2 +- .../loot/lootItems/junk/impulse_detector.py | 2 +- scripts/loot/lootItems/junk/laser_trap.py | 2 +- scripts/loot/lootItems/junk/launcher_tube.py | 2 +- scripts/loot/lootItems/junk/ledger.py | 2 +- .../loot/lootItems/junk/magseal_detector.py | 2 +- .../loot/lootItems/junk/medical_console.py | 2 +- scripts/loot/lootItems/junk/medical_device.py | 2 +- scripts/loot/lootItems/junk/motor.py | 2 +- .../lootItems/junk/power_output_analyzer.py | 2 +- scripts/loot/lootItems/junk/red_wiring.py | 2 +- scripts/loot/lootItems/junk/shield_module.py | 2 +- .../loot/lootItems/junk/software_module.py | 2 +- scripts/loot/lootItems/junk/stomach.py | 2 +- scripts/loot/lootItems/junk/survival_gear.py | 2 +- .../lootItems/junk/underpowered_survey_pad.py | 2 +- .../lootItems/junk/unidentified_serum_vial.py | 2 +- scripts/loot/lootItems/junk/used_notebook.py | 2 +- .../loot/lootItems/junk/weak_droid_battery.py | 2 +- .../loot/lootItems/junk/worklight_generic.py | 19 +-- scripts/loot/lootItems/kraytpearl_cracked.py | 2 +- scripts/loot/lootItems/kraytpearl_fair.py | 2 +- scripts/loot/lootItems/kraytpearl_flawless.py | 2 +- scripts/loot/lootItems/kraytpearl_good.py | 2 +- scripts/loot/lootItems/kraytpearl_poor.py | 2 +- scripts/loot/lootItems/kraytpearl_premium.py | 2 +- scripts/loot/lootItems/kraytpearl_quality.py | 2 +- .../loot/lootItems/kraytpearl_scratched.py | 2 +- scripts/loot/lootItems/kraytpearl_select.py | 2 +- scripts/loot/lootItems/powercrystal_fair.py | 2 +- .../loot/lootItems/powercrystal_flawless.py | 2 +- scripts/loot/lootItems/powercrystal_good.py | 2 +- .../loot/lootItems/powercrystal_perfect.py | 2 +- scripts/loot/lootItems/powercrystal_poor.py | 2 +- .../loot/lootItems/powercrystal_premium.py | 2 +- .../loot/lootItems/powercrystal_quality.py | 2 +- scripts/loot/lootItems/powercrystal_select.py | 2 +- scripts/loot/lootItems/rarelootchest1.py | 2 +- scripts/loot/lootItems/rarelootchest2.py | 2 +- .../lootItems/weapons/adjusted_cdef_rifle.py | 35 ++++++ .../loot/lootItems/weapons/gaderiffi_baton.py | 35 ++++++ .../lootItems/weapons/shared_rifle_cdef.py | 8 +- scripts/loot/lootPools/batons.py | 8 ++ scripts/loot/lootPools/random_loot_rifles.py | 8 ++ scripts/loot/lootPools/tusken_clothing.py | 0 .../loot/lootPools/tusken_raider_clothing.py | 6 + scripts/mobiles/tatooine/tusken_raider.py | 5 +- scripts/object/mobile/tusken_raider.py | 18 ++- src/services/LootService.java | 114 ++++++++++++++---- 68 files changed, 292 insertions(+), 123 deletions(-) create mode 100644 scripts/loot/lootItems/armor/placeholder.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_bandolier.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_boots.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_dress.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_gloves.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_helmet.py create mode 100644 scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py create mode 100644 scripts/loot/lootItems/weapons/gaderiffi_baton.py create mode 100644 scripts/loot/lootPools/batons.py create mode 100644 scripts/loot/lootPools/random_loot_rifles.py create mode 100644 scripts/loot/lootPools/tusken_clothing.py create mode 100644 scripts/loot/lootPools/tusken_raider_clothing.py diff --git a/scripts/loot/lootItems/armor/placeholder.py b/scripts/loot/lootItems/armor/placeholder.py new file mode 100644 index 00000000..e69de29b diff --git a/scripts/loot/lootItems/clothes/tusken_raider_bandolier.py b/scripts/loot/lootItems/clothes/tusken_raider_bandolier.py new file mode 100644 index 00000000..41e4b5b6 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_bandolier.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/bandolier/shared_bandolier_tusken_raider_s01.iff','object/tangible/wearables/bandolier/shared_bandolier_tusken_raider_s02.iff','object/tangible/wearables/bandolier/shared_bandolier_tusken_raider_s03.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_boots.py b/scripts/loot/lootItems/clothes/tusken_raider_boots.py new file mode 100644 index 00000000..c6eaa937 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_boots.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/boots/shared_boots_tusken_raider.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_dress.py b/scripts/loot/lootItems/clothes/tusken_raider_dress.py new file mode 100644 index 00000000..35cec848 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_dress.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/robe/shared_robe_tusken_raider_s01.iff','object/tangible/wearables/robe/shared_robe_tusken_raider_s02.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_gloves.py b/scripts/loot/lootItems/clothes/tusken_raider_gloves.py new file mode 100644 index 00000000..690f9471 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_gloves.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/gloves/shared_gloves_tusken_raider.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_helmet.py b/scripts/loot/lootItems/clothes/tusken_raider_helmet.py new file mode 100644 index 00000000..5187c38b --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_helmet.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/helmet/shared_helmet_tusken_raider_s01.iff','object/tangible/wearables/helmet/shared_helmet_tusken_raider_s02.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/colorcrystal.py b/scripts/loot/lootItems/colorcrystal.py index cce04300..1458e1be 100644 --- a/scripts/loot/lootItems/colorcrystal.py +++ b/scripts/loot/lootItems/colorcrystal.py @@ -1,21 +1,4 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' - -def customItemName(): - - return '' - -def customItemStackCount(): - - return 1 - -def customizationAttributes(): - - return [] - -def customizationValues(): - - return [] - + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] diff --git a/scripts/loot/lootItems/junk/antenna.py b/scripts/loot/lootItems/junk/antenna.py index 747de5b7..64a11ec4 100644 --- a/scripts/loot/lootItems/junk/antenna.py +++ b/scripts/loot/lootItems/junk/antenna.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_antennae.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_antennae.iff'] diff --git a/scripts/loot/lootItems/junk/armor_repair_device.py b/scripts/loot/lootItems/junk/armor_repair_device.py index 713dc0ce..65252c39 100644 --- a/scripts/loot/lootItems/junk/armor_repair_device.py +++ b/scripts/loot/lootItems/junk/armor_repair_device.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_armor_repair_device_generic.iff' + return ['object/tangible/loot/npc_loot/shared_armor_repair_device_generic.iff'] diff --git a/scripts/loot/lootItems/junk/brain.py b/scripts/loot/lootItems/junk/brain.py index bb01bf52..107add91 100644 --- a/scripts/loot/lootItems/junk/brain.py +++ b/scripts/loot/lootItems/junk/brain.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_brain_s01.iff' + return ['object/tangible/loot/creature_loot/generic/shared_brain_s01.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/chassis_blueprint.py b/scripts/loot/lootItems/junk/chassis_blueprint.py index b876b351..98b2e26f 100644 --- a/scripts/loot/lootItems/junk/chassis_blueprint.py +++ b/scripts/loot/lootItems/junk/chassis_blueprint.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/generic_usable/shared_chassis_blueprint_usuable.iff' + return ['object/tangible/loot/generic_usable/shared_chassis_blueprint_usuable.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/comlink.py b/scripts/loot/lootItems/junk/comlink.py index 648802c6..ac3ff538 100644 --- a/scripts/loot/lootItems/junk/comlink.py +++ b/scripts/loot/lootItems/junk/comlink.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_comlink_civilian_generic.iff' + return ['object/tangible/loot/npc_loot/shared_comlink_civilian_generic.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/damaged_datapad.py b/scripts/loot/lootItems/junk/damaged_datapad.py index 4fc1a9a9..d1773502 100644 --- a/scripts/loot/lootItems/junk/damaged_datapad.py +++ b/scripts/loot/lootItems/junk/damaged_datapad.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/misc/shared_damaged_datapad.iff' + return ['object/tangible/loot/misc/shared_damaged_datapad.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/ear_jewel.py b/scripts/loot/lootItems/junk/ear_jewel.py index abe14c33..02a39e85 100644 --- a/scripts/loot/lootItems/junk/ear_jewel.py +++ b/scripts/loot/lootItems/junk/ear_jewel.py @@ -1,4 +1,4 @@ def itemTemplate(): - return '/object/tangible/loot/npc_loot/shared_jewelry_ear_s02.iff' + return ['/object/tangible/loot/npc_loot/shared_jewelry_ear_s02.iff'] diff --git a/scripts/loot/lootItems/junk/explosive_dud.py b/scripts/loot/lootItems/junk/explosive_dud.py index bc7091a7..b0208102 100644 --- a/scripts/loot/lootItems/junk/explosive_dud.py +++ b/scripts/loot/lootItems/junk/explosive_dud.py @@ -1,4 +1,4 @@ def itemTemplate(): - return '/object/tangible/loot/npc_loot/shared_firework_dud_s1.iff' + return ['/object/tangible/loot/npc_loot/shared_firework_dud_s1.iff'] diff --git a/scripts/loot/lootItems/junk/eye.py b/scripts/loot/lootItems/junk/eye.py index aa7c6cff..45a5a41e 100644 --- a/scripts/loot/lootItems/junk/eye.py +++ b/scripts/loot/lootItems/junk/eye.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_eye.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_eye.iff'] diff --git a/scripts/loot/lootItems/junk/gland.py b/scripts/loot/lootItems/junk/gland.py index 071a60ef..ccf78284 100644 --- a/scripts/loot/lootItems/junk/gland.py +++ b/scripts/loot/lootItems/junk/gland.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_lungs_gland.iff' + return ['object/tangible/loot/creature_loot/generic/shared_lungs_gland.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/heart.py b/scripts/loot/lootItems/junk/heart.py index 3715f029..15268f40 100644 --- a/scripts/loot/lootItems/junk/heart.py +++ b/scripts/loot/lootItems/junk/heart.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_heart.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_heart.iff'] diff --git a/scripts/loot/lootItems/junk/hyperdrive_unit.py b/scripts/loot/lootItems/junk/hyperdrive_unit.py index 25afcd63..c217ba92 100644 --- a/scripts/loot/lootItems/junk/hyperdrive_unit.py +++ b/scripts/loot/lootItems/junk/hyperdrive_unit.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/miscshared_hyperdrive_part_s01.iff' + return ['object/tangible/loot/miscshared_hyperdrive_part_s01.iff'] diff --git a/scripts/loot/lootItems/junk/id_chip.py b/scripts/loot/lootItems/junk/id_chip.py index e4738035..b8d8ee89 100644 --- a/scripts/loot/lootItems/junk/id_chip.py +++ b/scripts/loot/lootItems/junk/id_chip.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_id_chip_generic.iff' + return ['object/tangible/loot/npc_loot/shared_id_chip_generic.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/impulse_detector.py b/scripts/loot/lootItems/junk/impulse_detector.py index 17f08a9d..f100ded7 100644 --- a/scripts/loot/lootItems/junk/impulse_detector.py +++ b/scripts/loot/lootItems/junk/impulse_detector.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_impulse_detector_01_generic.iff' + return ['object/tangible/loot/npc_loot/shared_impulse_detector_01_generic.iff'] diff --git a/scripts/loot/lootItems/junk/laser_trap.py b/scripts/loot/lootItems/junk/laser_trap.py index 4bbcdb48..0ea4640f 100644 --- a/scripts/loot/lootItems/junk/laser_trap.py +++ b/scripts/loot/lootItems/junk/laser_trap.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_laser_trap_generic.iff' + return ['object/tangible/loot/npc_loot/shared_laser_trap_generic.iff'] diff --git a/scripts/loot/lootItems/junk/launcher_tube.py b/scripts/loot/lootItems/junk/launcher_tube.py index 4159a299..d3535342 100644 --- a/scripts/loot/lootItems/junk/launcher_tube.py +++ b/scripts/loot/lootItems/junk/launcher_tube.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_launcher_tube_generic.iff' + return ['object/tangible/loot/npc_loot/shared_launcher_tube_generic.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/ledger.py b/scripts/loot/lootItems/junk/ledger.py index 093e2caf..84481094 100644 --- a/scripts/loot/lootItems/junk/ledger.py +++ b/scripts/loot/lootItems/junk/ledger.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_ledger_generic.iff' + return ['object/tangible/loot/npc_loot/shared_ledger_generic.iff'] diff --git a/scripts/loot/lootItems/junk/magseal_detector.py b/scripts/loot/lootItems/junk/magseal_detector.py index bce0a6c7..30890aa6 100644 --- a/scripts/loot/lootItems/junk/magseal_detector.py +++ b/scripts/loot/lootItems/junk/magseal_detector.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_magseal_detector_generic.iff' + return ['object/tangible/loot/npc_loot/shared_magseal_detector_generic.iff'] diff --git a/scripts/loot/lootItems/junk/medical_console.py b/scripts/loot/lootItems/junk/medical_console.py index db82ffa3..aba84602 100644 --- a/scripts/loot/lootItems/junk/medical_console.py +++ b/scripts/loot/lootItems/junk/medical_console.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_medical_console_generic.iff' + return ['object/tangible/loot/npc_loot/shared_medical_console_generic.iff'] diff --git a/scripts/loot/lootItems/junk/medical_device.py b/scripts/loot/lootItems/junk/medical_device.py index eb55b264..4f198f3a 100644 --- a/scripts/loot/lootItems/junk/medical_device.py +++ b/scripts/loot/lootItems/junk/medical_device.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_medical_device_generic.iff' + return ['object/tangible/loot/npc_loot/shared_medical_device_generic.iff'] diff --git a/scripts/loot/lootItems/junk/motor.py b/scripts/loot/lootItems/junk/motor.py index 63d2def6..0fde31c1 100644 --- a/scripts/loot/lootItems/junk/motor.py +++ b/scripts/loot/lootItems/junk/motor.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_small_motor_generic.iff' + return ['object/tangible/loot/npc_loot/shared_small_motor_generic.iff'] diff --git a/scripts/loot/lootItems/junk/power_output_analyzer.py b/scripts/loot/lootItems/junk/power_output_analyzer.py index b44f9808..39af3121 100644 --- a/scripts/loot/lootItems/junk/power_output_analyzer.py +++ b/scripts/loot/lootItems/junk/power_output_analyzer.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff' + return ['object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff'] diff --git a/scripts/loot/lootItems/junk/red_wiring.py b/scripts/loot/lootItems/junk/red_wiring.py index d2f31c46..b4682a7b 100644 --- a/scripts/loot/lootItems/junk/red_wiring.py +++ b/scripts/loot/lootItems/junk/red_wiring.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_red_wiring_generic.iff' + return ['object/tangible/loot/npc_loot/shared_red_wiring_generic.iff'] diff --git a/scripts/loot/lootItems/junk/shield_module.py b/scripts/loot/lootItems/junk/shield_module.py index 43335cfa..4ba2a8cf 100644 --- a/scripts/loot/lootItems/junk/shield_module.py +++ b/scripts/loot/lootItems/junk/shield_module.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_shield_module_generic.iff' + return ['object/tangible/loot/npc_loot/shared_shield_module_generic.iff'] diff --git a/scripts/loot/lootItems/junk/software_module.py b/scripts/loot/lootItems/junk/software_module.py index 8041a85a..98b0759d 100644 --- a/scripts/loot/lootItems/junk/software_module.py +++ b/scripts/loot/lootItems/junk/software_module.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_software_module_generic.iff' + return ['object/tangible/loot/npc_loot/shared_software_module_generic.iff'] diff --git a/scripts/loot/lootItems/junk/stomach.py b/scripts/loot/lootItems/junk/stomach.py index e3692923..e4ead448 100644 --- a/scripts/loot/lootItems/junk/stomach.py +++ b/scripts/loot/lootItems/junk/stomach.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_stomach.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_stomach.iff'] diff --git a/scripts/loot/lootItems/junk/survival_gear.py b/scripts/loot/lootItems/junk/survival_gear.py index e8ad23ae..e4cfba46 100644 --- a/scripts/loot/lootItems/junk/survival_gear.py +++ b/scripts/loot/lootItems/junk/survival_gear.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_survival_equipment_generic.iff' + return ['object/tangible/loot/npc_loot/shared_survival_equipment_generic.iff'] diff --git a/scripts/loot/lootItems/junk/underpowered_survey_pad.py b/scripts/loot/lootItems/junk/underpowered_survey_pad.py index 3dca4fa8..9caf9857 100644 --- a/scripts/loot/lootItems/junk/underpowered_survey_pad.py +++ b/scripts/loot/lootItems/junk/underpowered_survey_pad.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_survey_pad_adv_generic.iff' + return ['object/tangible/loot/npc_loot/shared_survey_pad_adv_generic.iff'] diff --git a/scripts/loot/lootItems/junk/unidentified_serum_vial.py b/scripts/loot/lootItems/junk/unidentified_serum_vial.py index 1f4f8e84..06a69fac 100644 --- a/scripts/loot/lootItems/junk/unidentified_serum_vial.py +++ b/scripts/loot/lootItems/junk/unidentified_serum_vial.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_serum_vial_generic.iff' + return ['object/tangible/loot/npc_loot/shared_serum_vial_generic.iff'] diff --git a/scripts/loot/lootItems/junk/used_notebook.py b/scripts/loot/lootItems/junk/used_notebook.py index 9a3acb30..bb42f7fd 100644 --- a/scripts/loot/lootItems/junk/used_notebook.py +++ b/scripts/loot/lootItems/junk/used_notebook.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_notebook_generic.iff' + return ['object/tangible/loot/npc_loot/shared_notebook_generic.iff'] diff --git a/scripts/loot/lootItems/junk/weak_droid_battery.py b/scripts/loot/lootItems/junk/weak_droid_battery.py index 5ba36675..426a9373 100644 --- a/scripts/loot/lootItems/junk/weak_droid_battery.py +++ b/scripts/loot/lootItems/junk/weak_droid_battery.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/generic/shared_battery_useable_generic.iff' + return ['object/tangible/loot/generic/shared_battery_useable_generic.iff'] diff --git a/scripts/loot/lootItems/junk/worklight_generic.py b/scripts/loot/lootItems/junk/worklight_generic.py index 86a9231b..395beead 100644 --- a/scripts/loot/lootItems/junk/worklight_generic.py +++ b/scripts/loot/lootItems/junk/worklight_generic.py @@ -1,21 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_worklight_generic.iff' - -def customItemName(): - - return '' - -def customItemStackCount(): - - return 1 - -def customizationAttributes(): - - return [] - -def customizationValues(): - - return [] - + return ['object/tangible/loot/npc_loot/shared_worklight_generic.iff'] diff --git a/scripts/loot/lootItems/kraytpearl_cracked.py b/scripts/loot/lootItems/kraytpearl_cracked.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_cracked.py +++ b/scripts/loot/lootItems/kraytpearl_cracked.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_fair.py b/scripts/loot/lootItems/kraytpearl_fair.py index ef8d2dc0..bf16c0ec 100644 --- a/scripts/loot/lootItems/kraytpearl_fair.py +++ b/scripts/loot/lootItems/kraytpearl_fair.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_flawless.py b/scripts/loot/lootItems/kraytpearl_flawless.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_flawless.py +++ b/scripts/loot/lootItems/kraytpearl_flawless.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_good.py b/scripts/loot/lootItems/kraytpearl_good.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_good.py +++ b/scripts/loot/lootItems/kraytpearl_good.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_poor.py b/scripts/loot/lootItems/kraytpearl_poor.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_poor.py +++ b/scripts/loot/lootItems/kraytpearl_poor.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_premium.py b/scripts/loot/lootItems/kraytpearl_premium.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_premium.py +++ b/scripts/loot/lootItems/kraytpearl_premium.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_quality.py b/scripts/loot/lootItems/kraytpearl_quality.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_quality.py +++ b/scripts/loot/lootItems/kraytpearl_quality.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_scratched.py b/scripts/loot/lootItems/kraytpearl_scratched.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_scratched.py +++ b/scripts/loot/lootItems/kraytpearl_scratched.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_select.py b/scripts/loot/lootItems/kraytpearl_select.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_select.py +++ b/scripts/loot/lootItems/kraytpearl_select.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_fair.py b/scripts/loot/lootItems/powercrystal_fair.py index 3c533136..46f1add7 100644 --- a/scripts/loot/lootItems/powercrystal_fair.py +++ b/scripts/loot/lootItems/powercrystal_fair.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_flawless.py b/scripts/loot/lootItems/powercrystal_flawless.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_flawless.py +++ b/scripts/loot/lootItems/powercrystal_flawless.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_good.py b/scripts/loot/lootItems/powercrystal_good.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_good.py +++ b/scripts/loot/lootItems/powercrystal_good.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_perfect.py b/scripts/loot/lootItems/powercrystal_perfect.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_perfect.py +++ b/scripts/loot/lootItems/powercrystal_perfect.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_poor.py b/scripts/loot/lootItems/powercrystal_poor.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_poor.py +++ b/scripts/loot/lootItems/powercrystal_poor.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_premium.py b/scripts/loot/lootItems/powercrystal_premium.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_premium.py +++ b/scripts/loot/lootItems/powercrystal_premium.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_quality.py b/scripts/loot/lootItems/powercrystal_quality.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_quality.py +++ b/scripts/loot/lootItems/powercrystal_quality.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_select.py b/scripts/loot/lootItems/powercrystal_select.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_select.py +++ b/scripts/loot/lootItems/powercrystal_select.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/rarelootchest1.py b/scripts/loot/lootItems/rarelootchest1.py index 1541e62a..a7568822 100644 --- a/scripts/loot/lootItems/rarelootchest1.py +++ b/scripts/loot/lootItems/rarelootchest1.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/item/shared_rare_loot_chest_3.iff' + return ['object/tangible/item/shared_rare_loot_chest_3.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/rarelootchest2.py b/scripts/loot/lootItems/rarelootchest2.py index 1541e62a..a7568822 100644 --- a/scripts/loot/lootItems/rarelootchest2.py +++ b/scripts/loot/lootItems/rarelootchest2.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/item/shared_rare_loot_chest_3.iff' + return ['object/tangible/item/shared_rare_loot_chest_3.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py new file mode 100644 index 00000000..1055e9a2 --- /dev/null +++ b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py @@ -0,0 +1,35 @@ + +def itemTemplate(): + + return ['object/weapon/ranged/rifle/shared_rifle_cdef.iff'] + +def customItemName(): + + return 'Adjusted CDEF Rifle' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def requiredCL(): + + return 10 + +def itemStats(): + + stats = ['mindamage','12','27'] + stats += ['maxdamage','48','95'] + stats += ['attackspeed','1.0','1.0'] + stats += ['maxrange','0','64'] + stats += ['damagetype','energy','energy'] + stats += ['weapontype','0','0'] + + return stats diff --git a/scripts/loot/lootItems/weapons/gaderiffi_baton.py b/scripts/loot/lootItems/weapons/gaderiffi_baton.py new file mode 100644 index 00000000..0977f314 --- /dev/null +++ b/scripts/loot/lootItems/weapons/gaderiffi_baton.py @@ -0,0 +1,35 @@ + +def itemTemplate(): + + return ['object/weapon/melee/baton/shared_baton_gaderiffi.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def requiredCL(): + + return 10 + +def itemStats(): + + stats = ['mindamage','12','27'] + stats += ['maxdamage','48','95'] + stats += ['attackspeed','1.0','1.0'] + stats += ['maxrange','0','4'] + stats += ['damagetype','kinetic','kinetic'] + stats += ['weapontype','4','4'] + + return stats diff --git a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py index 06160922..c1a15f71 100644 --- a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py +++ b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/weapon/ranged/rifle/shared_rifle_cdef.iff' + return ['object/weapon/ranged/rifle/shared_rifle_cdef.iff'] def customItemName(): @@ -21,9 +21,9 @@ def customizationValues(): def itemStats(): - stats = ['mindamage','12','27'] - stats += ['maxdamage','29','61'] - stats += ['attackspeed','5.1','3.6'] + stats = ['mindamage','500','600'] + stats += ['maxdamage','900','1120'] + stats += ['attackspeed','1.0','1.0'] stats += ['maxrange','0','64'] stats += ['damagetype','Energy','Energy'] diff --git a/scripts/loot/lootPools/batons.py b/scripts/loot/lootPools/batons.py new file mode 100644 index 00000000..99e26d99 --- /dev/null +++ b/scripts/loot/lootPools/batons.py @@ -0,0 +1,8 @@ + +def itemNames(): + + return ['gaderiffi_baton'] + +def itemChances(): + return [100] + \ No newline at end of file diff --git a/scripts/loot/lootPools/random_loot_rifles.py b/scripts/loot/lootPools/random_loot_rifles.py new file mode 100644 index 00000000..4992e807 --- /dev/null +++ b/scripts/loot/lootPools/random_loot_rifles.py @@ -0,0 +1,8 @@ + +def itemNames(): + + return ['adjusted_cdef_rifle'] + +def itemChances(): + return [100] + \ No newline at end of file diff --git a/scripts/loot/lootPools/tusken_clothing.py b/scripts/loot/lootPools/tusken_clothing.py new file mode 100644 index 00000000..e69de29b diff --git a/scripts/loot/lootPools/tusken_raider_clothing.py b/scripts/loot/lootPools/tusken_raider_clothing.py new file mode 100644 index 00000000..72762d37 --- /dev/null +++ b/scripts/loot/lootPools/tusken_raider_clothing.py @@ -0,0 +1,6 @@ + +def itemNames(): + return ['tusken_raider_dress','tusken_raider_boots','tusken_raider_gloves','tusken_raider_helmet','tusken_raider_bandolier'] + +def itemChances(): + return [20,20,20,20,20] #= 100% \ No newline at end of file diff --git a/scripts/mobiles/tatooine/tusken_raider.py b/scripts/mobiles/tatooine/tusken_raider.py index b2747696..48007d7c 100644 --- a/scripts/mobiles/tatooine/tusken_raider.py +++ b/scripts/mobiles/tatooine/tusken_raider.py @@ -6,8 +6,8 @@ def addTemplate(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('tusken_raider') - mobileTemplate.setLevel(90) - mobileTemplate.setDifficulty(0) + mobileTemplate.setLevel(10) + mobileTemplate.setDifficulty(1) mobileTemplate.setAttackRange(24) templates = Vector() @@ -18,7 +18,6 @@ def addTemplate(core): weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_tusken.iff') mobileTemplate.setWeaponTemplates(weaponTemplates) - attacks = Vector() mobileTemplate.setDefaultAttack('rangedShot') mobileTemplate.setAttacks(attacks) diff --git a/scripts/object/mobile/tusken_raider.py b/scripts/object/mobile/tusken_raider.py index 97f7842a..2d06ec85 100644 --- a/scripts/object/mobile/tusken_raider.py +++ b/scripts/object/mobile/tusken_raider.py @@ -2,14 +2,24 @@ import sys def setup(core, object): - lootPoolNames_1 = ['Junk','Rifles'] - lootPoolChances_1 = [90,70] + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] lootGroupChance_1 = 90 object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) - lootPoolNames_2 = ['Colorcrystals'] - lootPoolChances_2 = [100] + lootPoolNames_2 = ['batons','random_loot_rifles',] + lootPoolChances_2 = [60,40] lootGroupChance_2 = 20 object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + lootPoolNames_3 = ['tusken_raider_clothing'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 10 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['Colorcrystals'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 6 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + return \ No newline at end of file diff --git a/src/services/LootService.java b/src/services/LootService.java index 38ef05f4..013bd385 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -245,7 +245,12 @@ public class LootService implements INetworkDispatch { String customName = ""; String itemTemplate = ""; + Vector itemTemplates = null; int stackCount = 1; + int biolink = 0; + int requiredCL = 1; + String requiredProfession = ""; + String requiredFaction = ""; Vector customizationAttributes = null; Vector customizationValues = null; Vector itemStats = null; @@ -256,7 +261,18 @@ public class LootService implements INetworkDispatch { return; } - itemTemplate = (String)core.scriptService.fetchString(itemPath,"itemTemplate"); + //itemTemplate = (String)core.scriptService.fetchString(itemPath,"itemTemplate"); + + itemTemplates = (Vector)core.scriptService.fetchStringVector(itemPath,"itemTemplate"); + if (itemTemplates.size()==1) + itemTemplate = itemTemplates.get(0); + if (itemTemplates.size()>1){ + itemTemplate = itemTemplates.get(new Random().nextInt(itemTemplates.size()-1)); + } + + + + // only consider the following variables, if they are in the python-script file if(core.scriptService.getMethod(itemPath,"","customItemName")!=null) @@ -274,6 +290,19 @@ public class LootService implements INetworkDispatch { if(core.scriptService.getMethod(itemPath,"","itemStats")!=null) itemStats = (Vector)core.scriptService.fetchStringVector(itemPath,"itemStats"); + if(core.scriptService.getMethod(itemPath,"","biolink")!=null) + biolink = (Integer)core.scriptService.fetchInteger(itemPath,"biolink"); + + if(core.scriptService.getMethod(itemPath,"","requiredCL")!=null) + requiredCL = (Integer)core.scriptService.fetchInteger(itemPath,"requiredCL"); + + if(core.scriptService.getMethod(itemPath,"","requiredProfession")!=null) + requiredProfession = (String)core.scriptService.fetchString(itemPath,"requiredProfession"); + + if(core.scriptService.getMethod(itemPath,"","requiredFaction")!=null) + requiredFaction = (String)core.scriptService.fetchString(itemPath,"requiredFaction"); + + System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); @@ -296,6 +325,18 @@ public class LootService implements INetworkDispatch { handleSpecialItems(droppedItem, itemName); + if (requiredCL>1){ + droppedItem.setIntAttribute("required_combat_level", requiredCL); + } + + if (requiredProfession.length()>0){ + droppedItem.setStringAttribute("required_profession", requiredProfession); + } + + if (requiredFaction.length()>0){ + droppedItem.setStringAttribute("required_faction", requiredFaction); + } + lootRollSession.addDroppedItem(droppedItem); } @@ -411,24 +452,25 @@ public class LootService implements INetworkDispatch { } private void handleStats(TangibleObject droppedItem, Vector itemStats) { - // ToDo: Min,Max for weapons , Dots on weapons etc. - // This must be considered for the python scripts as well - // So basically every item needs to have loot-related data in their py scripts as well - droppedItem.setTemplate("object/weapon/ranged/rifle/shared_rifle_cdef.iff"); if (droppedItem.getTemplate().contains("/weapon")){ - System.out.println("Wep template rec"); - - //droppedItem.setStringAttribute("cat_wpn_damage.wpn_elemental_type", "ENERGY"); WeaponObject weaponObject = (WeaponObject) droppedItem; - droppedItem.setMaxDamage(1000); - for (int i=0;i Date: Tue, 15 Apr 2014 13:08:00 +0200 Subject: [PATCH 49/95] Added Katarn Armor to frog --- src/services/DevService.java | 78 ++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/src/services/DevService.java b/src/services/DevService.java index d717aa21..9c83fca1 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -119,6 +119,7 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 70, "Bone"); suiOptions.put((long) 71, "Ithorian Defender"); suiOptions.put((long) 72, "Kashyyykian Black Mountain"); + suiOptions.put((long) 73, "Neutral Katarn Armor"); break; case 8: // [Items] Reconnaissance Armor suiOptions.put((long) 80, "Marauder"); @@ -792,6 +793,83 @@ public class DevService implements INetworkDispatch { inventory.add(moun_leggings); inventory.add(moun_chest); + + + return; + case 73: // Neutral Katarn Armor + SWGObject nka_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bicep_r.iff", planet); + nka_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); + nka_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); + nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); + nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); + nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); + nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); + + SWGObject nka_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bicep_l.iff", planet); + nka_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); + nka_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); + nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); + nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); + nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); + nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); + + SWGObject nka_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bracer_r.iff", planet); + nka_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); + nka_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); + nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); + nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); + nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); + nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); + + SWGObject nka_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bracer_l.iff", planet); + nka_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); + nka_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); + nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); + nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); + nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); + nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); + + SWGObject nka_leggings = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_leggings.iff", planet); + nka_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); + nka_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); + nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); + nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); + nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); + nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); + + SWGObject nka_helmet = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_helmet.iff", planet); + nka_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); + nka_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); + nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); + nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); + nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); + nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); + + SWGObject nka_chest = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_chest_plate.iff", planet); + nka_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); + nka_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); + nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); + nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); + nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); + nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); + + SWGObject nka_belt = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_belt.iff", planet); + SWGObject nka_boots = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_boots.iff", planet); + SWGObject nka_gloves = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_gloves.iff", planet); + + + + inventory.add(nka_bicep_r); + inventory.add(nka_bicep_l); + inventory.add(nka_bracer_r); + inventory.add(nka_bracer_l); + inventory.add(nka_leggings); + inventory.add(nka_helmet); + inventory.add(nka_chest); + inventory.add(nka_belt); + inventory.add(nka_boots); + inventory.add(nka_gloves); + return; case 80: // Marauder Armor From d3215407f39cd29e4282b2a2543d8803b17c905a Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 15 Apr 2014 17:38:28 +0200 Subject: [PATCH 50/95] Weapons - Created datatable of WeaponTypes --- src/resources/datatables/WeaponType.java | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/resources/datatables/WeaponType.java diff --git a/src/resources/datatables/WeaponType.java b/src/resources/datatables/WeaponType.java new file mode 100644 index 00000000..0dab788a --- /dev/null +++ b/src/resources/datatables/WeaponType.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class WeaponType { + + public static int RIFLE = 0; + public static int CARBINE = 1; + public static int PISTOL = 2; + public static int ONEHANDEDMELEE = 4; + public static int TWOHANDEDMELEE = 5; + public static int UNARMED = 6; + public static int POLEARMMELEE = 7; + public static int THROWN = 8; + public static int ONEHANDEDSABER = 9; + public static int TWOHANDEDSABER = 10; + public static int POLEARMSABER = 11; + public static int HEAVYWEAPON = 12; + public static int FLAMETHROWER = 13; + +} From 4522e36821fe1e02705c2bf56065b14469537e49 Mon Sep 17 00:00:00 2001 From: Bronco69 Date: Tue, 15 Apr 2014 18:10:46 +0200 Subject: [PATCH 51/95] Added Commando roadmap rewards --- .../item_commando_clicky_01_02.py | 9 ++ .../armor_commando_roadmap_bicep_l_02_01.py | 17 ++++ .../armor_commando_roadmap_bicep_r_02_01.py | 17 ++++ .../armor_commando_roadmap_boots_02_01.py | 10 ++ .../armor_commando_roadmap_bracer_l_02_01.py | 17 ++++ .../armor_commando_roadmap_bracer_r_02_01.py | 17 ++++ .../armor_commando_roadmap_chest_02_01.py | 17 ++++ .../armor_commando_roadmap_gloves_02_01.py | 10 ++ .../armor_commando_roadmap_helmet_02_01.py | 17 ++++ .../armor_commando_roadmap_leggings_02_01.py | 17 ++++ .../zam/item_roadmap_belt_commando_01_02.py | 13 +++ .../backpack/item_commando_backpack_01_02.py | 11 +++ .../necklace/item_commando_pendant_01_02.py | 11 +++ .../ring/item_commando_ring_01_02.py | 13 +++ .../weapon_acidbeam_commando_roadmap_01_02.py | 17 ++++ ...on_lightningbeam_commando_roadmap_01_02.py | 17 ++++ scripts/roadmap/commando_1a.py | 93 ++++++++++++++++++- 17 files changed, 322 insertions(+), 1 deletion(-) create mode 100644 scripts/object/tangible/loot/generic_usable/item_commando_clicky_01_02.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_l_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_r_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_boots_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_l_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_r_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_chest_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_gloves_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_helmet_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_leggings_02_01.py create mode 100644 scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_commando_01_02.py create mode 100644 scripts/object/tangible/wearables/backpack/item_commando_backpack_01_02.py create mode 100644 scripts/object/tangible/wearables/necklace/item_commando_pendant_01_02.py create mode 100644 scripts/object/tangible/wearables/ring/item_commando_ring_01_02.py create mode 100644 scripts/object/weapon/ranged/carbine/weapon_acidbeam_commando_roadmap_01_02.py create mode 100644 scripts/object/weapon/ranged/rifle/weapon_lightningbeam_commando_roadmap_01_02.py diff --git a/scripts/object/tangible/loot/generic_usable/item_commando_clicky_01_02.py b/scripts/object/tangible/loot/generic_usable/item_commando_clicky_01_02.py new file mode 100644 index 00000000..5041ee3b --- /dev/null +++ b/scripts/object/tangible/loot/generic_usable/item_commando_clicky_01_02.py @@ -0,0 +1,9 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_commando_clicky_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_commando_clicky_01_02') + object.setStringAttribute('class_required', 'Commando') + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_l_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_l_02_01.py new file mode 100644 index 00000000..725b9056 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_l_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_bicep_l_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_bicep_l_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_r_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_r_02_01.py new file mode 100644 index 00000000..a0c37a28 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bicep_r_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_bicep_r_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_bicep_r_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_boots_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_boots_02_01.py new file mode 100644 index 00000000..16df82a0 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_boots_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_boots_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_boots_02_01') + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_l_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_l_02_01.py new file mode 100644 index 00000000..0cdc5e97 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_l_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_bracer_l_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_bracer_l_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_r_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_r_02_01.py new file mode 100644 index 00000000..c4e221c2 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_bracer_r_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_bracer_r_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_bracer_r_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_chest_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_chest_02_01.py new file mode 100644 index 00000000..af0fa26f --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_chest_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_chest_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_chest_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_gloves_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_gloves_02_01.py new file mode 100644 index 00000000..17ee0ecd --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_gloves_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_gloves_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_gloves_02_01') + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_helmet_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_helmet_02_01.py new file mode 100644 index 00000000..1d8a8c05 --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_helmet_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_helmet_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_helmet_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_leggings_02_01.py b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_leggings_02_01.py new file mode 100644 index 00000000..3ebce0ac --- /dev/null +++ b/scripts/object/tangible/wearables/armor/composite/armor_commando_roadmap_leggings_02_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('armor_commando_roadmap_leggings_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('armor_commando_roadmap_leggings_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 3) + object.setStringAttribute('class_required', 'Commando') + object.setStringAttribute('armor_category', 'Assault') + object.setIntAttribute('cat_armor_standard_protection.kinetic', 2640) + object.setIntAttribute('cat_armor_standard_protection.energy', 640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_heat', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_cold', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_acid', 1640) + object.setIntAttribute('cat_armor_special_protection.special_protection_type_electricity', 1640) + return diff --git a/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_commando_01_02.py b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_commando_01_02.py new file mode 100644 index 00000000..03d3b4ae --- /dev/null +++ b/scripts/object/tangible/wearables/armor/zam/item_roadmap_belt_commando_01_02.py @@ -0,0 +1,13 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_roadmap_belt_commando_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_roadmap_belt_commando_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 15) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 20) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 15) + object.setStringAttribute('class_required', 'Commando') + object.setIntAttribute('required_combat_level', 90) + return diff --git a/scripts/object/tangible/wearables/backpack/item_commando_backpack_01_02.py b/scripts/object/tangible/wearables/backpack/item_commando_backpack_01_02.py new file mode 100644 index 00000000..ffc76111 --- /dev/null +++ b/scripts/object/tangible/wearables/backpack/item_commando_backpack_01_02.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_commando_backpack_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_commando_backpack_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 5) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 5) + object.setStringAttribute('class_required', 'Commando') + return diff --git a/scripts/object/tangible/wearables/necklace/item_commando_pendant_01_02.py b/scripts/object/tangible/wearables/necklace/item_commando_pendant_01_02.py new file mode 100644 index 00000000..716905e2 --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_commando_pendant_01_02.py @@ -0,0 +1,11 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_commando_pendant_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_commando_pendant_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 12) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 12) + object.setStringAttribute('class_required', 'Commando') + return diff --git a/scripts/object/tangible/wearables/ring/item_commando_ring_01_02.py b/scripts/object/tangible/wearables/ring/item_commando_ring_01_02.py new file mode 100644 index 00000000..5e4f73c1 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_commando_ring_01_02.py @@ -0,0 +1,13 @@ +import sys + +def setup(core, object): + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_commando_ring_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('item_commando_ring_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 6) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 6) + object.setStringAttribute('class_required', 'Commando') + object.setAttachment('radial_filename', 'ring/unity') + return diff --git a/scripts/object/weapon/ranged/carbine/weapon_acidbeam_commando_roadmap_01_02.py b/scripts/object/weapon/ranged/carbine/weapon_acidbeam_commando_roadmap_01_02.py new file mode 100644 index 00000000..8fd46b6d --- /dev/null +++ b/scripts/object/weapon/ranged/carbine/weapon_acidbeam_commando_roadmap_01_02.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('weapon_acidbeam_commando_roadmap_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('weapon_acidbeam_commando_roadmap_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 5) + object.setStringAttribute('class_required', 'Commando') + object.setIntAttribute('required_combat_level', 30) + object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) + object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') + object.setStringAttribute('cat_wpn_damage.damage', '109-218') + object.setStringAttribute('cat_wpn_damage.wpn_range', '0-50m') + object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') + object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/rifle/weapon_lightningbeam_commando_roadmap_01_02.py b/scripts/object/weapon/ranged/rifle/weapon_lightningbeam_commando_roadmap_01_02.py new file mode 100644 index 00000000..03768d96 --- /dev/null +++ b/scripts/object/weapon/ranged/rifle/weapon_lightningbeam_commando_roadmap_01_02.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('weapon_lightningbeam_commando_roadmap_01_02') + object.setDetailFilename('static_item_d') + object.setDetailName('weapon_lightningbeam_commando_roadmap_01_02') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 5) + object.setStringAttribute('class_required', 'Commando') + object.setIntAttribute('required_combat_level', 30) + object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.8) + object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') + object.setStringAttribute('cat_wpn_damage.damage', '261-522') + object.setStringAttribute('cat_wpn_damage.wpn_range', '0-64m') + object.setStringAttribute('cat_wpn_damage.wpn_category', 'Rifle') + object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + return \ No newline at end of file diff --git a/scripts/roadmap/commando_1a.py b/scripts/roadmap/commando_1a.py index 67cdb14b..c63fd717 100644 --- a/scripts/roadmap/commando_1a.py +++ b/scripts/roadmap/commando_1a.py @@ -25,4 +25,95 @@ def getAction(): return 75 def getRewards(name): - return \ No newline at end of file + if name == 'item_bounty_hunter_backpack_01_02': + return "object/tangible/wearables/backpack/shared_backpack_s04.iff" + + if name == 'armor_commando_roadmap_bicep_l_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bicep_l.iff" + + if name == 'armor_commando_roadmap_bicep_r_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bicep_r.iff" + + if name == 'armor_commando_roadmap_bracer_l_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bracer_l.iff" + + if name == 'armor_commando_roadmap_bracer_r_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_bracer_r.iff" + + if name == 'armor_commando_roadmap_boots_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_boots.iff" + + if name == 'armor_commando_roadmap_chest_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_chest_plate.iff" + + if name == 'armor_commando_roadmap_gloves_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_gloves.iff" + + if name == 'armor_commando_roadmap_helmet_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_helmet.iff" + + if name == 'armor_commando_roadmap_leggings_02_01': + return "object/tangible/wearables/armor/composite/shared_armor_composite_leggings.iff" + + if name == 'armor_wookiee_roadmap_chest_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_chestplate.iff" + + if name == 'armor_wookiee_roadmap_leggings_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_leggings.iff" + + if name == 'armor_wookiee_roadmap_bicep_l_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bicep_l.iff" + + if name == 'armor_wookiee_roadmap_bicep_r_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bicep_r.iff" + + if name == 'armor_wookiee_roadmap_bracer_l_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bracer_l.iff" + + if name == 'armor_wookiee_roadmap_bracer_r_02_03': + return "object/tangible/wearables/armor/kashyyykian_hunting/shared_armor_kashyyykian_hunting_bracer_r.iff" + + if name == 'armor_ithorian_roadmap_chest_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_chest_plate.iff" + + if name == 'armor_ithorian_roadmap_leggings_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_leggings.iff" + + if name == 'armor_ithorian_roadmap_helmet_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_helmet.iff" + + if name == 'armor_ithorian_roadmap_bicep_l_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_l.iff" + + if name == 'armor_ithorian_roadmap_bicep_r_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bicep_r.iff" + + if name == 'armor_ithorian_roadmap_bracer_l_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_l.iff" + + if name == 'armor_ithorian_roadmap_bracer_r_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_bracer_r.iff" + + if name == 'armor_ithorian_roadmap_boots_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_boots.iff" + + if name == 'armor_ithorian_roadmap_gloves_02_03': + return "object/tangible/wearables/armor/ithorian_sentinel/shared_ith_armor_s03_gloves.iff" + + if name == 'weapon_lightningbeam_commando_roadmap_01_02': + return "object/weapon/ranged/rifle/shared_rifle_dlt20.iff" + + if name == 'item_commando_ring_01_02': + return "object/tangible/wearables/ring/shared_ring_s03.iff" + + if name == 'weapon_acidbeam_commando_roadmap_01_02': + return "object/weapon/ranged/carbine/shared_carbine_e11.iff" + + if name == 'item_commando_pendant_01_02': + return "object/tangible/wearables/necklace/shared_necklace_s07.iff" + + if name == 'item_commando_clicky_01_02': + return "object/tangible/loot/generic_usable/shared_survey_pad_adv_generic.iff" + + if name == 'item_roadmap_belt_commando_01_02': + return "object/tangible/wearables/armor/zam/shared_armor_zam_wesell_belt.iff" \ No newline at end of file From 58b56070cdef1ac686a834670bd66c3f149bc73d Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Tue, 15 Apr 2014 19:15:12 +0200 Subject: [PATCH 52/95] preliminary armor drops test Default weapon spawn fixed Mobile templates must now assign weapon attack speed and weapon type dueto it not being determinable from template --- .../armor/composite_armor_bicep_left.py | 31 ++++++++++ .../armor/composite_armor_bicep_right.py | 31 ++++++++++ .../lootItems/armor/composite_armor_boots.py | 31 ++++++++++ .../armor/composite_armor_bracer_left.py | 31 ++++++++++ .../armor/composite_armor_bracer_right.py | 31 ++++++++++ .../armor/composite_armor_chestplate.py | 31 ++++++++++ .../lootItems/armor/composite_armor_gloves.py | 31 ++++++++++ .../lootItems/armor/composite_armor_helmet.py | 31 ++++++++++ .../armor/composite_armor_leggings.py | 31 ++++++++++ scripts/loot/lootItems/armor/placeholder.py | 0 scripts/loot/lootPools/composite_armor.py | 10 ++++ scripts/mobiles/canon/jedi_master.py | 14 +++-- scripts/mobiles/canon/stormtrooper.py | 14 +++-- scripts/mobiles/tatooine/tusken_raider.py | 6 +- .../object/mobile/dressed_stormtrooper_m.py | 13 +++-- src/services/LootService.java | 57 ++++++++++++++++--- src/services/spawn/MobileTemplate.java | 27 +++++++++ src/services/spawn/SpawnService.java | 27 ++++++++- src/services/spawn/WeaponTemplate.java | 42 ++++++++++++++ 19 files changed, 464 insertions(+), 25 deletions(-) create mode 100644 scripts/loot/lootItems/armor/composite_armor_bicep_left.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_bicep_right.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_boots.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_bracer_left.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_bracer_right.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_chestplate.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_gloves.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_helmet.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_leggings.py delete mode 100644 scripts/loot/lootItems/armor/placeholder.py create mode 100644 scripts/loot/lootPools/composite_armor.py create mode 100644 src/services/spawn/WeaponTemplate.java diff --git a/scripts/loot/lootItems/armor/composite_armor_bicep_left.py b/scripts/loot/lootItems/armor/composite_armor_bicep_left.py new file mode 100644 index 00000000..01dae7ed --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bicep_left.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bicep_l.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_bicep_right.py b/scripts/loot/lootItems/armor/composite_armor_bicep_right.py new file mode 100644 index 00000000..d0520ca7 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bicep_right.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bicep_r.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_boots.py b/scripts/loot/lootItems/armor/composite_armor_boots.py new file mode 100644 index 00000000..f82eba8c --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_boots.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_boots.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_bracer_left.py b/scripts/loot/lootItems/armor/composite_armor_bracer_left.py new file mode 100644 index 00000000..9c5bfb48 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bracer_left.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bracer_l.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_bracer_right.py b/scripts/loot/lootItems/armor/composite_armor_bracer_right.py new file mode 100644 index 00000000..2c177745 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bracer_right.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bracer_r.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_chestplate.py b/scripts/loot/lootItems/armor/composite_armor_chestplate.py new file mode 100644 index 00000000..9d5687b1 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_chestplate.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_chest_plate.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_gloves.py b/scripts/loot/lootItems/armor/composite_armor_gloves.py new file mode 100644 index 00000000..c99e4081 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_gloves.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_gloves.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_helmet.py b/scripts/loot/lootItems/armor/composite_armor_helmet.py new file mode 100644 index 00000000..e29f9e11 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_helmet.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_helmet.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_leggings.py b/scripts/loot/lootItems/armor/composite_armor_leggings.py new file mode 100644 index 00000000..9111c640 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_leggings.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_leggings.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/placeholder.py b/scripts/loot/lootItems/armor/placeholder.py deleted file mode 100644 index e69de29b..00000000 diff --git a/scripts/loot/lootPools/composite_armor.py b/scripts/loot/lootPools/composite_armor.py new file mode 100644 index 00000000..747a2995 --- /dev/null +++ b/scripts/loot/lootPools/composite_armor.py @@ -0,0 +1,10 @@ + +def itemNames(): + + items = ['composite_armor_bicep_left','composite_armor_bicep_right','composite_armor_bracer_left','composite_armor_bracer_right'] + items += ['composite_armor_chestplate','composite_armor_helmet','composite_armor_leggings','composite_armor_boots','composite_armor_gloves'] + return items + +def itemChances(): + + return [11,11,11,11,11,11,11,11,12] # = 100% \ No newline at end of file diff --git a/scripts/mobiles/canon/jedi_master.py b/scripts/mobiles/canon/jedi_master.py index d2b65aaf..afc80223 100644 --- a/scripts/mobiles/canon/jedi_master.py +++ b/scripts/mobiles/canon/jedi_master.py @@ -1,5 +1,6 @@ import sys from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate from java.util import Vector def addTemplate(core): @@ -9,6 +10,8 @@ def addTemplate(core): mobileTemplate.setLevel(90) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(9) templates = Vector() templates.add('object/mobile/shared_dressed_dark_jedi_master_female_twk_01.iff') @@ -22,10 +25,13 @@ def addTemplate(core): mobileTemplate.setTemplates(templates) weaponTemplates = Vector() - weaponTemplates.add('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff') - weaponTemplates.add('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff') - weaponTemplates.add('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff') - mobileTemplate.setWeaponTemplates(weaponTemplates) + weapontemplate = WeaponTemplate('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff', 9, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff', 10, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff', 11, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) attacks = Vector() mobileTemplate.setDefaultAttack('saberHit') diff --git a/scripts/mobiles/canon/stormtrooper.py b/scripts/mobiles/canon/stormtrooper.py index 90da938f..a7a49123 100644 --- a/scripts/mobiles/canon/stormtrooper.py +++ b/scripts/mobiles/canon/stormtrooper.py @@ -1,5 +1,6 @@ import sys from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate from java.util import Vector def addTemplate(core): @@ -9,15 +10,20 @@ def addTemplate(core): mobileTemplate.setLevel(90) mobileTemplate.setDifficulty(0) mobileTemplate.setAttackRange(24) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(0) templates = Vector() templates.add('object/mobile/shared_dressed_stormtrooper_m.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() - weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_e11.iff') - weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_t21.iff') - mobileTemplate.setWeaponTemplates(weaponTemplates) + weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_e11.iff', 0, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_t21.iff', 0, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + attacks = Vector() mobileTemplate.setDefaultAttack('rangedShot') diff --git a/scripts/mobiles/tatooine/tusken_raider.py b/scripts/mobiles/tatooine/tusken_raider.py index 48007d7c..41542293 100644 --- a/scripts/mobiles/tatooine/tusken_raider.py +++ b/scripts/mobiles/tatooine/tusken_raider.py @@ -1,5 +1,6 @@ import sys from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate from java.util import Vector def addTemplate(core): @@ -15,8 +16,9 @@ def addTemplate(core): mobileTemplate.setTemplates(templates) weaponTemplates = Vector() - weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_tusken.iff') - mobileTemplate.setWeaponTemplates(weaponTemplates) + weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_tusken.iff', 0, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) attacks = Vector() mobileTemplate.setDefaultAttack('rangedShot') diff --git a/scripts/object/mobile/dressed_stormtrooper_m.py b/scripts/object/mobile/dressed_stormtrooper_m.py index a4b0d784..6e1e28ee 100644 --- a/scripts/object/mobile/dressed_stormtrooper_m.py +++ b/scripts/object/mobile/dressed_stormtrooper_m.py @@ -2,14 +2,19 @@ import sys def setup(core, object): - lootPoolNames_1 = ['Junk','Rifles'] - lootPoolChances_1 = [90,70] + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] lootGroupChance_1 = 90 object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) - lootPoolNames_2 = ['Colorcrystals'] - lootPoolChances_2 = [100] + lootPoolNames_2 = ['composite_armor','random_loot_rifles'] + lootPoolChances_2 = [50,50] lootGroupChance_2 = 20 object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['Colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 6 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) return \ No newline at end of file diff --git a/src/services/LootService.java b/src/services/LootService.java index 013bd385..e678aae2 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -320,8 +320,10 @@ public class LootService implements INetworkDispatch { } handleStats(droppedItem, itemStats); } - if (customizationValues!=null) - setCustomization(droppedItem, itemName); +// if (customizationValues!=null) +// setCustomization(droppedItem, itemName); + + setCustomization(droppedItem, itemName); // for now handleSpecialItems(droppedItem, itemName); @@ -663,13 +665,50 @@ public class LootService implements INetworkDispatch { } private void setArmorStat(SWGObject armor, String statName, String minValue, String maxValue){ - // Armor not yet implemented -// if (statName.equals("armor")){ -// int minimalValue = (int) Integer.parseInt(minValue); -// int maximalValue = (int) Integer.parseInt(maxValue); -// int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); -// armor.setArmor(randomValue); -// } + // Armor is not represented with its own class, + // so we gotta create the attributes here + + if (statName.equals("armor_efficiency_kinetic")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", randomValue); + } + + if (statName.equals("armor_efficiency_energy")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", randomValue); + } + + if (statName.equals("special_protection_heat")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", randomValue); + } + + if (statName.equals("special_protection_cold")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", randomValue); + } + + if (statName.equals("special_protection_acid")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", randomValue); + } + + if (statName.equals("special_protection_electricity")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", randomValue); + } } /* diff --git a/src/services/spawn/MobileTemplate.java b/src/services/spawn/MobileTemplate.java index 78664aa2..92f19f75 100644 --- a/src/services/spawn/MobileTemplate.java +++ b/src/services/spawn/MobileTemplate.java @@ -36,6 +36,8 @@ public class MobileTemplate { private String defaultAttack; private int minDamage = 0; private int maxDamage = 0; + private float attackSpeed = 0; + private int weaponType = 0; private int difficulty = 0; private int health, action; private String creatureName; @@ -43,6 +45,7 @@ public class MobileTemplate { // this is a custom attack Range setting to use for large mobs like krayts private int attackRange; private Vector weaponTemplates = new Vector(); + private Vector weaponTemplateVector = new Vector(); public Vector getTemplates() { return templates; @@ -163,4 +166,28 @@ public class MobileTemplate { public void setWeaponTemplates(Vector weaponTemplates) { this.weaponTemplates = weaponTemplates; } + + public float getAttackSpeed() { + return attackSpeed; + } + + public void setAttackSpeed(float attackSpeed) { + this.attackSpeed = attackSpeed; + } + + public int getWeaponType() { + return weaponType; + } + + public void setWeaponType(int weaponType) { + this.weaponType = weaponType; + } + + public Vector getWeaponTemplateVector() { + return weaponTemplateVector; + } + + public void setWeaponTemplateVector(Vector weaponTemplateVector) { + this.weaponTemplateVector = weaponTemplateVector; + } } diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java index d25ec70c..dcde2707 100644 --- a/src/services/spawn/SpawnService.java +++ b/src/services/spawn/SpawnService.java @@ -110,8 +110,31 @@ public class SpawnService { creature.setLevel(level); else creature.setLevel(mobileTemplate.getLevel()); - WeaponObject defaultWeapon = (mobileTemplate.getWeaponTemplates().size() > 0) ? (WeaponObject) core.objectService.createObject(mobileTemplate.getWeaponTemplates().get(new Random().nextInt(mobileTemplate.getWeaponTemplates().size())), creature.getPlanet()) : (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet()); - //defaultWeapon.setAttackSpeed(2); + + //WeaponObject defaultWeapon = (mobileTemplate.getWeaponTemplates().size() > 0) ? (WeaponObject) core.objectService.createObject(mobileTemplate.getWeaponTemplates().get(new Random().nextInt(mobileTemplate.getWeaponTemplates().size())), creature.getPlanet()) : (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet()); + + WeaponObject defaultWeapon = null; + Vector weaponTemplates = mobileTemplate.getWeaponTemplateVector(); + if (weaponTemplates.size()==0){ + defaultWeapon = (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet()); + defaultWeapon.setAttackSpeed(1.0F); + defaultWeapon.setWeaponType(6); + } else { + int rnd = new Random().nextInt(weaponTemplates.size()); + defaultWeapon = (WeaponObject) core.objectService.createObject(weaponTemplates.get(rnd).getTemplate(), creature.getPlanet()); + defaultWeapon.setAttackSpeed(weaponTemplates.get(rnd).getAttackSpeed()); + defaultWeapon.setWeaponType(weaponTemplates.get(rnd).getWeaponType()); + } + + + // QA + if (mobileTemplate.getAttackSpeed()==0) + System.err.println("Error in mobile spawn template for " + mobileTemplate.getCreatureName() + ". Missing attackspeed parameter"); + if (mobileTemplate.getAttackRange()==0) + System.err.println("Error in mobile spawn template for " + mobileTemplate.getCreatureName() + ". Missing attackrange parameter"); + + defaultWeapon.setAttackSpeed(mobileTemplate.getAttackSpeed()); + defaultWeapon.setWeaponType(mobileTemplate.getWeaponType()); defaultWeapon.setDamageType("@obj_attr_n:armor_eff_kinetic"); defaultWeapon.setStringAttribute("cat_wpn_damage.damage", "0-0"); if(mobileTemplate.getAttackRange() > 0) diff --git a/src/services/spawn/WeaponTemplate.java b/src/services/spawn/WeaponTemplate.java new file mode 100644 index 00000000..6e35498b --- /dev/null +++ b/src/services/spawn/WeaponTemplate.java @@ -0,0 +1,42 @@ +package services.spawn; + +public class WeaponTemplate { + + private String template=""; + private float attackSpeed=0; + private int weaponType=0; + + public WeaponTemplate(){ + + } + + public WeaponTemplate(String template, int weaponType, float attackSpeed){ + this.template = template; + this.weaponType = weaponType; + this.attackSpeed = attackSpeed; + } + + public String getTemplate() { + return template; + } + + public void setTemplate(String template) { + this.template = template; + } + + public float getAttackSpeed() { + return attackSpeed; + } + + public void setAttackSpeed(float attackSpeed) { + this.attackSpeed = attackSpeed; + } + + public int getWeaponType() { + return weaponType; + } + + public void setWeaponType(int weaponType) { + this.weaponType = weaponType; + } +} From 06dbf59c63f439ca3bf606aabbfa2a1595fe1d55 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Tue, 15 Apr 2014 19:38:43 +0200 Subject: [PATCH 53/95] cleanup --- options.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options.cfg b/options.cfg index cb743c88..5a3a7f8e 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=0 -LOAD.BUILDOUT_OBJECTS=0 +LOAD.SNAPSHOT_OBJECTS=1 +LOAD.BUILDOUT_OBJECTS=1 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file From b2965a8352abed920ac0222c1d7cd79a255931e2 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Mon, 14 Apr 2014 03:44:08 +0200 Subject: [PATCH 54/95] Looted weapons do get random stats now --- options.cfg | 4 +- .../lootItems/weapons/shared_rifle_cdef.py | 10 ++ src/services/LootService.java | 117 +++++++++++++++++- 3 files changed, 123 insertions(+), 8 deletions(-) diff --git a/options.cfg b/options.cfg index 5a3a7f8e..cb743c88 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=1 -LOAD.BUILDOUT_OBJECTS=1 +LOAD.SNAPSHOT_OBJECTS=0 +LOAD.BUILDOUT_OBJECTS=0 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file diff --git a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py index 0d683b7f..06160922 100644 --- a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py +++ b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py @@ -18,3 +18,13 @@ def customizationAttributes(): def customizationValues(): return [] + +def itemStats(): + + stats = ['mindamage','12','27'] + stats += ['maxdamage','29','61'] + stats += ['attackspeed','5.1','3.6'] + stats += ['maxrange','0','64'] + stats += ['damagetype','Energy','Energy'] + + return stats diff --git a/src/services/LootService.java b/src/services/LootService.java index b0d64bc0..8a0d8759 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -29,6 +29,7 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -40,6 +41,7 @@ import resources.objects.group.GroupObject; import resources.objects.loot.LootGroup; import resources.objects.loot.LootRollSession; import resources.objects.tangible.TangibleObject; +import resources.objects.weapon.WeaponObject; import main.NGECore; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; @@ -246,6 +248,7 @@ public class LootService implements INetworkDispatch { int stackCount = 1; Vector customizationAttributes = null; Vector customizationValues = null; + Vector itemStats = null; if(core.scriptService.getMethod(itemPath,"","itemTemplate")==null){ String errorMessage = "Loot item '" + itemName + "' has no template function assigned in its script. Please contact Charon about this issue."; @@ -268,15 +271,31 @@ public class LootService implements INetworkDispatch { if(core.scriptService.getMethod(itemPath,"","customizationValues")!=null) customizationValues = (Vector)core.scriptService.fetchIntegerVector(itemPath,"customizationValues"); + if(core.scriptService.getMethod(itemPath,"","itemStats")!=null) + itemStats = (Vector)core.scriptService.fetchStringVector(itemPath,"itemStats"); + System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); droppedItem.setAttachment("LootItemName", itemName); - handleCustomDropName(droppedItem,customName); - handleStats(droppedItem); - setCustomization(droppedItem, itemName); - handleSpecialItems(droppedItem,itemName); + + if (customName!=null) + handleCustomDropName(droppedItem, customName); + + if (itemStats!=null){ + if (itemStats.size()%3!=0){ + String errorMessage = "Loot item '" + itemName + "' has a wrong number of itemstats. Please contact Charon about this issue."; + lootRollSession.addErrorMessage(errorMessage); + return; + } + handleStats(droppedItem, itemStats); + } + + if (customizationValues!=null) + setCustomization(droppedItem, itemName); + + handleSpecialItems(droppedItem, itemName); lootRollSession.addDroppedItem(droppedItem); } @@ -392,12 +411,20 @@ public class LootService implements INetworkDispatch { } } - private void handleStats(TangibleObject droppedItem) { + private void handleStats(TangibleObject droppedItem, Vector itemStats) { // ToDo: Min,Max for weapons , Dots on weapons etc. // This must be considered for the python scripts as well // So basically every item needs to have loot-related data in their py scripts as well - + if (droppedItem instanceof WeaponObject){ + WeaponObject weaponObject = (WeaponObject) droppedItem; + for (int i=0;i0) + result = minValue; + if (maxValue.length()>0) + result = maxValue; + + weapon.setElementalType(result); + } + + if (statName.equals("damagetype")){ + String result = ""; + if (minValue.length()==0) + if (maxValue.length()==0) + result = "Error"; + + if (minValue.length()>0) + result = minValue; + if (maxValue.length()>0) + result = maxValue; + + weapon.setDamageType(result); + } + } + + private void setArmorStat(SWGObject armor, String statName, String minValue, String maxValue){ + // Armor not yet implemented +// if (statName.equals("armor")){ +// int minimalValue = (int) Integer.parseInt(minValue); +// int maximalValue = (int) Integer.parseInt(maxValue); +// int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); +// armor.setArmor(randomValue); +// } + } } From 67cf7d3c72e45483a6d60ecf636cced83b945e2a Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Mon, 14 Apr 2014 19:57:06 +0200 Subject: [PATCH 55/95] weapon work --- src/services/LootService.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/services/LootService.java b/src/services/LootService.java index 8a0d8759..38ef05f4 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -291,7 +291,6 @@ public class LootService implements INetworkDispatch { } handleStats(droppedItem, itemStats); } - if (customizationValues!=null) setCustomization(droppedItem, itemName); @@ -416,8 +415,13 @@ public class LootService implements INetworkDispatch { // This must be considered for the python scripts as well // So basically every item needs to have loot-related data in their py scripts as well - if (droppedItem instanceof WeaponObject){ + droppedItem.setTemplate("object/weapon/ranged/rifle/shared_rifle_cdef.iff"); + if (droppedItem.getTemplate().contains("/weapon")){ + System.out.println("Wep template rec"); + + //droppedItem.setStringAttribute("cat_wpn_damage.wpn_elemental_type", "ENERGY"); WeaponObject weaponObject = (WeaponObject) droppedItem; + droppedItem.setMaxDamage(1000); for (int i=0;i Date: Tue, 15 Apr 2014 04:34:50 +0200 Subject: [PATCH 56/95] More loot items added Tusken Raider Clothing Gaffis CDEF Rifles Worked on weapon drops and giving them stats Refactored the item scripts to use lists to allow random templates Tweaked the drop chances to be close to how they were in live --- scripts/loot/lootItems/armor/placeholder.py | 0 .../clothes/tusken_raider_bandolier.py | 8 ++ .../lootItems/clothes/tusken_raider_boots.py | 8 ++ .../lootItems/clothes/tusken_raider_dress.py | 8 ++ .../lootItems/clothes/tusken_raider_gloves.py | 8 ++ .../lootItems/clothes/tusken_raider_helmet.py | 8 ++ scripts/loot/lootItems/colorcrystal.py | 19 +-- scripts/loot/lootItems/junk/antenna.py | 2 +- .../lootItems/junk/armor_repair_device.py | 2 +- scripts/loot/lootItems/junk/brain.py | 2 +- .../loot/lootItems/junk/chassis_blueprint.py | 2 +- scripts/loot/lootItems/junk/comlink.py | 2 +- .../loot/lootItems/junk/damaged_datapad.py | 2 +- scripts/loot/lootItems/junk/ear_jewel.py | 2 +- scripts/loot/lootItems/junk/explosive_dud.py | 2 +- scripts/loot/lootItems/junk/eye.py | 2 +- scripts/loot/lootItems/junk/gland.py | 2 +- scripts/loot/lootItems/junk/heart.py | 2 +- .../loot/lootItems/junk/hyperdrive_unit.py | 2 +- scripts/loot/lootItems/junk/id_chip.py | 2 +- .../loot/lootItems/junk/impulse_detector.py | 2 +- scripts/loot/lootItems/junk/laser_trap.py | 2 +- scripts/loot/lootItems/junk/launcher_tube.py | 2 +- scripts/loot/lootItems/junk/ledger.py | 2 +- .../loot/lootItems/junk/magseal_detector.py | 2 +- .../loot/lootItems/junk/medical_console.py | 2 +- scripts/loot/lootItems/junk/medical_device.py | 2 +- scripts/loot/lootItems/junk/motor.py | 2 +- .../lootItems/junk/power_output_analyzer.py | 2 +- scripts/loot/lootItems/junk/red_wiring.py | 2 +- scripts/loot/lootItems/junk/shield_module.py | 2 +- .../loot/lootItems/junk/software_module.py | 2 +- scripts/loot/lootItems/junk/stomach.py | 2 +- scripts/loot/lootItems/junk/survival_gear.py | 2 +- .../lootItems/junk/underpowered_survey_pad.py | 2 +- .../lootItems/junk/unidentified_serum_vial.py | 2 +- scripts/loot/lootItems/junk/used_notebook.py | 2 +- .../loot/lootItems/junk/weak_droid_battery.py | 2 +- .../loot/lootItems/junk/worklight_generic.py | 19 +-- scripts/loot/lootItems/kraytpearl_cracked.py | 2 +- scripts/loot/lootItems/kraytpearl_fair.py | 2 +- scripts/loot/lootItems/kraytpearl_flawless.py | 2 +- scripts/loot/lootItems/kraytpearl_good.py | 2 +- scripts/loot/lootItems/kraytpearl_poor.py | 2 +- scripts/loot/lootItems/kraytpearl_premium.py | 2 +- scripts/loot/lootItems/kraytpearl_quality.py | 2 +- .../loot/lootItems/kraytpearl_scratched.py | 2 +- scripts/loot/lootItems/kraytpearl_select.py | 2 +- scripts/loot/lootItems/powercrystal_fair.py | 2 +- .../loot/lootItems/powercrystal_flawless.py | 2 +- scripts/loot/lootItems/powercrystal_good.py | 2 +- .../loot/lootItems/powercrystal_perfect.py | 2 +- scripts/loot/lootItems/powercrystal_poor.py | 2 +- .../loot/lootItems/powercrystal_premium.py | 2 +- .../loot/lootItems/powercrystal_quality.py | 2 +- scripts/loot/lootItems/powercrystal_select.py | 2 +- scripts/loot/lootItems/rarelootchest1.py | 2 +- scripts/loot/lootItems/rarelootchest2.py | 2 +- .../lootItems/weapons/adjusted_cdef_rifle.py | 35 ++++++ .../loot/lootItems/weapons/gaderiffi_baton.py | 35 ++++++ .../lootItems/weapons/shared_rifle_cdef.py | 8 +- scripts/loot/lootPools/batons.py | 8 ++ scripts/loot/lootPools/random_loot_rifles.py | 8 ++ scripts/loot/lootPools/tusken_clothing.py | 0 .../loot/lootPools/tusken_raider_clothing.py | 6 + scripts/mobiles/tatooine/tusken_raider.py | 5 +- scripts/object/mobile/tusken_raider.py | 18 ++- src/services/LootService.java | 114 ++++++++++++++---- 68 files changed, 292 insertions(+), 123 deletions(-) create mode 100644 scripts/loot/lootItems/armor/placeholder.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_bandolier.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_boots.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_dress.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_gloves.py create mode 100644 scripts/loot/lootItems/clothes/tusken_raider_helmet.py create mode 100644 scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py create mode 100644 scripts/loot/lootItems/weapons/gaderiffi_baton.py create mode 100644 scripts/loot/lootPools/batons.py create mode 100644 scripts/loot/lootPools/random_loot_rifles.py create mode 100644 scripts/loot/lootPools/tusken_clothing.py create mode 100644 scripts/loot/lootPools/tusken_raider_clothing.py diff --git a/scripts/loot/lootItems/armor/placeholder.py b/scripts/loot/lootItems/armor/placeholder.py new file mode 100644 index 00000000..e69de29b diff --git a/scripts/loot/lootItems/clothes/tusken_raider_bandolier.py b/scripts/loot/lootItems/clothes/tusken_raider_bandolier.py new file mode 100644 index 00000000..41e4b5b6 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_bandolier.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/bandolier/shared_bandolier_tusken_raider_s01.iff','object/tangible/wearables/bandolier/shared_bandolier_tusken_raider_s02.iff','object/tangible/wearables/bandolier/shared_bandolier_tusken_raider_s03.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_boots.py b/scripts/loot/lootItems/clothes/tusken_raider_boots.py new file mode 100644 index 00000000..c6eaa937 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_boots.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/boots/shared_boots_tusken_raider.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_dress.py b/scripts/loot/lootItems/clothes/tusken_raider_dress.py new file mode 100644 index 00000000..35cec848 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_dress.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/robe/shared_robe_tusken_raider_s01.iff','object/tangible/wearables/robe/shared_robe_tusken_raider_s02.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_gloves.py b/scripts/loot/lootItems/clothes/tusken_raider_gloves.py new file mode 100644 index 00000000..690f9471 --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_gloves.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/gloves/shared_gloves_tusken_raider.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/clothes/tusken_raider_helmet.py b/scripts/loot/lootItems/clothes/tusken_raider_helmet.py new file mode 100644 index 00000000..5187c38b --- /dev/null +++ b/scripts/loot/lootItems/clothes/tusken_raider_helmet.py @@ -0,0 +1,8 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/helmet/shared_helmet_tusken_raider_s01.iff','object/tangible/wearables/helmet/shared_helmet_tusken_raider_s02.iff'] + +def customItemName(): + + return '' diff --git a/scripts/loot/lootItems/colorcrystal.py b/scripts/loot/lootItems/colorcrystal.py index cce04300..1458e1be 100644 --- a/scripts/loot/lootItems/colorcrystal.py +++ b/scripts/loot/lootItems/colorcrystal.py @@ -1,21 +1,4 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' - -def customItemName(): - - return '' - -def customItemStackCount(): - - return 1 - -def customizationAttributes(): - - return [] - -def customizationValues(): - - return [] - + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] diff --git a/scripts/loot/lootItems/junk/antenna.py b/scripts/loot/lootItems/junk/antenna.py index 747de5b7..64a11ec4 100644 --- a/scripts/loot/lootItems/junk/antenna.py +++ b/scripts/loot/lootItems/junk/antenna.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_antennae.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_antennae.iff'] diff --git a/scripts/loot/lootItems/junk/armor_repair_device.py b/scripts/loot/lootItems/junk/armor_repair_device.py index 713dc0ce..65252c39 100644 --- a/scripts/loot/lootItems/junk/armor_repair_device.py +++ b/scripts/loot/lootItems/junk/armor_repair_device.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_armor_repair_device_generic.iff' + return ['object/tangible/loot/npc_loot/shared_armor_repair_device_generic.iff'] diff --git a/scripts/loot/lootItems/junk/brain.py b/scripts/loot/lootItems/junk/brain.py index bb01bf52..107add91 100644 --- a/scripts/loot/lootItems/junk/brain.py +++ b/scripts/loot/lootItems/junk/brain.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_brain_s01.iff' + return ['object/tangible/loot/creature_loot/generic/shared_brain_s01.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/chassis_blueprint.py b/scripts/loot/lootItems/junk/chassis_blueprint.py index b876b351..98b2e26f 100644 --- a/scripts/loot/lootItems/junk/chassis_blueprint.py +++ b/scripts/loot/lootItems/junk/chassis_blueprint.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/generic_usable/shared_chassis_blueprint_usuable.iff' + return ['object/tangible/loot/generic_usable/shared_chassis_blueprint_usuable.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/comlink.py b/scripts/loot/lootItems/junk/comlink.py index 648802c6..ac3ff538 100644 --- a/scripts/loot/lootItems/junk/comlink.py +++ b/scripts/loot/lootItems/junk/comlink.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_comlink_civilian_generic.iff' + return ['object/tangible/loot/npc_loot/shared_comlink_civilian_generic.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/damaged_datapad.py b/scripts/loot/lootItems/junk/damaged_datapad.py index 4fc1a9a9..d1773502 100644 --- a/scripts/loot/lootItems/junk/damaged_datapad.py +++ b/scripts/loot/lootItems/junk/damaged_datapad.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/misc/shared_damaged_datapad.iff' + return ['object/tangible/loot/misc/shared_damaged_datapad.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/ear_jewel.py b/scripts/loot/lootItems/junk/ear_jewel.py index abe14c33..02a39e85 100644 --- a/scripts/loot/lootItems/junk/ear_jewel.py +++ b/scripts/loot/lootItems/junk/ear_jewel.py @@ -1,4 +1,4 @@ def itemTemplate(): - return '/object/tangible/loot/npc_loot/shared_jewelry_ear_s02.iff' + return ['/object/tangible/loot/npc_loot/shared_jewelry_ear_s02.iff'] diff --git a/scripts/loot/lootItems/junk/explosive_dud.py b/scripts/loot/lootItems/junk/explosive_dud.py index bc7091a7..b0208102 100644 --- a/scripts/loot/lootItems/junk/explosive_dud.py +++ b/scripts/loot/lootItems/junk/explosive_dud.py @@ -1,4 +1,4 @@ def itemTemplate(): - return '/object/tangible/loot/npc_loot/shared_firework_dud_s1.iff' + return ['/object/tangible/loot/npc_loot/shared_firework_dud_s1.iff'] diff --git a/scripts/loot/lootItems/junk/eye.py b/scripts/loot/lootItems/junk/eye.py index aa7c6cff..45a5a41e 100644 --- a/scripts/loot/lootItems/junk/eye.py +++ b/scripts/loot/lootItems/junk/eye.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_eye.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_eye.iff'] diff --git a/scripts/loot/lootItems/junk/gland.py b/scripts/loot/lootItems/junk/gland.py index 071a60ef..ccf78284 100644 --- a/scripts/loot/lootItems/junk/gland.py +++ b/scripts/loot/lootItems/junk/gland.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_lungs_gland.iff' + return ['object/tangible/loot/creature_loot/generic/shared_lungs_gland.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/heart.py b/scripts/loot/lootItems/junk/heart.py index 3715f029..15268f40 100644 --- a/scripts/loot/lootItems/junk/heart.py +++ b/scripts/loot/lootItems/junk/heart.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_heart.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_heart.iff'] diff --git a/scripts/loot/lootItems/junk/hyperdrive_unit.py b/scripts/loot/lootItems/junk/hyperdrive_unit.py index 25afcd63..c217ba92 100644 --- a/scripts/loot/lootItems/junk/hyperdrive_unit.py +++ b/scripts/loot/lootItems/junk/hyperdrive_unit.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/miscshared_hyperdrive_part_s01.iff' + return ['object/tangible/loot/miscshared_hyperdrive_part_s01.iff'] diff --git a/scripts/loot/lootItems/junk/id_chip.py b/scripts/loot/lootItems/junk/id_chip.py index e4738035..b8d8ee89 100644 --- a/scripts/loot/lootItems/junk/id_chip.py +++ b/scripts/loot/lootItems/junk/id_chip.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_id_chip_generic.iff' + return ['object/tangible/loot/npc_loot/shared_id_chip_generic.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/impulse_detector.py b/scripts/loot/lootItems/junk/impulse_detector.py index 17f08a9d..f100ded7 100644 --- a/scripts/loot/lootItems/junk/impulse_detector.py +++ b/scripts/loot/lootItems/junk/impulse_detector.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_impulse_detector_01_generic.iff' + return ['object/tangible/loot/npc_loot/shared_impulse_detector_01_generic.iff'] diff --git a/scripts/loot/lootItems/junk/laser_trap.py b/scripts/loot/lootItems/junk/laser_trap.py index 4bbcdb48..0ea4640f 100644 --- a/scripts/loot/lootItems/junk/laser_trap.py +++ b/scripts/loot/lootItems/junk/laser_trap.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_laser_trap_generic.iff' + return ['object/tangible/loot/npc_loot/shared_laser_trap_generic.iff'] diff --git a/scripts/loot/lootItems/junk/launcher_tube.py b/scripts/loot/lootItems/junk/launcher_tube.py index 4159a299..d3535342 100644 --- a/scripts/loot/lootItems/junk/launcher_tube.py +++ b/scripts/loot/lootItems/junk/launcher_tube.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_launcher_tube_generic.iff' + return ['object/tangible/loot/npc_loot/shared_launcher_tube_generic.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/junk/ledger.py b/scripts/loot/lootItems/junk/ledger.py index 093e2caf..84481094 100644 --- a/scripts/loot/lootItems/junk/ledger.py +++ b/scripts/loot/lootItems/junk/ledger.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_ledger_generic.iff' + return ['object/tangible/loot/npc_loot/shared_ledger_generic.iff'] diff --git a/scripts/loot/lootItems/junk/magseal_detector.py b/scripts/loot/lootItems/junk/magseal_detector.py index bce0a6c7..30890aa6 100644 --- a/scripts/loot/lootItems/junk/magseal_detector.py +++ b/scripts/loot/lootItems/junk/magseal_detector.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_magseal_detector_generic.iff' + return ['object/tangible/loot/npc_loot/shared_magseal_detector_generic.iff'] diff --git a/scripts/loot/lootItems/junk/medical_console.py b/scripts/loot/lootItems/junk/medical_console.py index db82ffa3..aba84602 100644 --- a/scripts/loot/lootItems/junk/medical_console.py +++ b/scripts/loot/lootItems/junk/medical_console.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_medical_console_generic.iff' + return ['object/tangible/loot/npc_loot/shared_medical_console_generic.iff'] diff --git a/scripts/loot/lootItems/junk/medical_device.py b/scripts/loot/lootItems/junk/medical_device.py index eb55b264..4f198f3a 100644 --- a/scripts/loot/lootItems/junk/medical_device.py +++ b/scripts/loot/lootItems/junk/medical_device.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_medical_device_generic.iff' + return ['object/tangible/loot/npc_loot/shared_medical_device_generic.iff'] diff --git a/scripts/loot/lootItems/junk/motor.py b/scripts/loot/lootItems/junk/motor.py index 63d2def6..0fde31c1 100644 --- a/scripts/loot/lootItems/junk/motor.py +++ b/scripts/loot/lootItems/junk/motor.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_small_motor_generic.iff' + return ['object/tangible/loot/npc_loot/shared_small_motor_generic.iff'] diff --git a/scripts/loot/lootItems/junk/power_output_analyzer.py b/scripts/loot/lootItems/junk/power_output_analyzer.py index b44f9808..39af3121 100644 --- a/scripts/loot/lootItems/junk/power_output_analyzer.py +++ b/scripts/loot/lootItems/junk/power_output_analyzer.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff' + return ['object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff'] diff --git a/scripts/loot/lootItems/junk/red_wiring.py b/scripts/loot/lootItems/junk/red_wiring.py index d2f31c46..b4682a7b 100644 --- a/scripts/loot/lootItems/junk/red_wiring.py +++ b/scripts/loot/lootItems/junk/red_wiring.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_red_wiring_generic.iff' + return ['object/tangible/loot/npc_loot/shared_red_wiring_generic.iff'] diff --git a/scripts/loot/lootItems/junk/shield_module.py b/scripts/loot/lootItems/junk/shield_module.py index 43335cfa..4ba2a8cf 100644 --- a/scripts/loot/lootItems/junk/shield_module.py +++ b/scripts/loot/lootItems/junk/shield_module.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_shield_module_generic.iff' + return ['object/tangible/loot/npc_loot/shared_shield_module_generic.iff'] diff --git a/scripts/loot/lootItems/junk/software_module.py b/scripts/loot/lootItems/junk/software_module.py index 8041a85a..98b0759d 100644 --- a/scripts/loot/lootItems/junk/software_module.py +++ b/scripts/loot/lootItems/junk/software_module.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_software_module_generic.iff' + return ['object/tangible/loot/npc_loot/shared_software_module_generic.iff'] diff --git a/scripts/loot/lootItems/junk/stomach.py b/scripts/loot/lootItems/junk/stomach.py index e3692923..e4ead448 100644 --- a/scripts/loot/lootItems/junk/stomach.py +++ b/scripts/loot/lootItems/junk/stomach.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/creature_loot/generic/shared_generic_stomach.iff' + return ['object/tangible/loot/creature_loot/generic/shared_generic_stomach.iff'] diff --git a/scripts/loot/lootItems/junk/survival_gear.py b/scripts/loot/lootItems/junk/survival_gear.py index e8ad23ae..e4cfba46 100644 --- a/scripts/loot/lootItems/junk/survival_gear.py +++ b/scripts/loot/lootItems/junk/survival_gear.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_survival_equipment_generic.iff' + return ['object/tangible/loot/npc_loot/shared_survival_equipment_generic.iff'] diff --git a/scripts/loot/lootItems/junk/underpowered_survey_pad.py b/scripts/loot/lootItems/junk/underpowered_survey_pad.py index 3dca4fa8..9caf9857 100644 --- a/scripts/loot/lootItems/junk/underpowered_survey_pad.py +++ b/scripts/loot/lootItems/junk/underpowered_survey_pad.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_survey_pad_adv_generic.iff' + return ['object/tangible/loot/npc_loot/shared_survey_pad_adv_generic.iff'] diff --git a/scripts/loot/lootItems/junk/unidentified_serum_vial.py b/scripts/loot/lootItems/junk/unidentified_serum_vial.py index 1f4f8e84..06a69fac 100644 --- a/scripts/loot/lootItems/junk/unidentified_serum_vial.py +++ b/scripts/loot/lootItems/junk/unidentified_serum_vial.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_serum_vial_generic.iff' + return ['object/tangible/loot/npc_loot/shared_serum_vial_generic.iff'] diff --git a/scripts/loot/lootItems/junk/used_notebook.py b/scripts/loot/lootItems/junk/used_notebook.py index 9a3acb30..bb42f7fd 100644 --- a/scripts/loot/lootItems/junk/used_notebook.py +++ b/scripts/loot/lootItems/junk/used_notebook.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_notebook_generic.iff' + return ['object/tangible/loot/npc_loot/shared_notebook_generic.iff'] diff --git a/scripts/loot/lootItems/junk/weak_droid_battery.py b/scripts/loot/lootItems/junk/weak_droid_battery.py index 5ba36675..426a9373 100644 --- a/scripts/loot/lootItems/junk/weak_droid_battery.py +++ b/scripts/loot/lootItems/junk/weak_droid_battery.py @@ -1,4 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/generic/shared_battery_useable_generic.iff' + return ['object/tangible/loot/generic/shared_battery_useable_generic.iff'] diff --git a/scripts/loot/lootItems/junk/worklight_generic.py b/scripts/loot/lootItems/junk/worklight_generic.py index 86a9231b..395beead 100644 --- a/scripts/loot/lootItems/junk/worklight_generic.py +++ b/scripts/loot/lootItems/junk/worklight_generic.py @@ -1,21 +1,4 @@ def itemTemplate(): - return 'object/tangible/loot/npc_loot/shared_worklight_generic.iff' - -def customItemName(): - - return '' - -def customItemStackCount(): - - return 1 - -def customizationAttributes(): - - return [] - -def customizationValues(): - - return [] - + return ['object/tangible/loot/npc_loot/shared_worklight_generic.iff'] diff --git a/scripts/loot/lootItems/kraytpearl_cracked.py b/scripts/loot/lootItems/kraytpearl_cracked.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_cracked.py +++ b/scripts/loot/lootItems/kraytpearl_cracked.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_fair.py b/scripts/loot/lootItems/kraytpearl_fair.py index ef8d2dc0..bf16c0ec 100644 --- a/scripts/loot/lootItems/kraytpearl_fair.py +++ b/scripts/loot/lootItems/kraytpearl_fair.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_flawless.py b/scripts/loot/lootItems/kraytpearl_flawless.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_flawless.py +++ b/scripts/loot/lootItems/kraytpearl_flawless.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_good.py b/scripts/loot/lootItems/kraytpearl_good.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_good.py +++ b/scripts/loot/lootItems/kraytpearl_good.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_poor.py b/scripts/loot/lootItems/kraytpearl_poor.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_poor.py +++ b/scripts/loot/lootItems/kraytpearl_poor.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_premium.py b/scripts/loot/lootItems/kraytpearl_premium.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_premium.py +++ b/scripts/loot/lootItems/kraytpearl_premium.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_quality.py b/scripts/loot/lootItems/kraytpearl_quality.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_quality.py +++ b/scripts/loot/lootItems/kraytpearl_quality.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_scratched.py b/scripts/loot/lootItems/kraytpearl_scratched.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_scratched.py +++ b/scripts/loot/lootItems/kraytpearl_scratched.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/kraytpearl_select.py b/scripts/loot/lootItems/kraytpearl_select.py index 8e532580..89e55d04 100644 --- a/scripts/loot/lootItems/kraytpearl_select.py +++ b/scripts/loot/lootItems/kraytpearl_select.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_krayt_dragon_pearl.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_fair.py b/scripts/loot/lootItems/powercrystal_fair.py index 3c533136..46f1add7 100644 --- a/scripts/loot/lootItems/powercrystal_fair.py +++ b/scripts/loot/lootItems/powercrystal_fair.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_flawless.py b/scripts/loot/lootItems/powercrystal_flawless.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_flawless.py +++ b/scripts/loot/lootItems/powercrystal_flawless.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_good.py b/scripts/loot/lootItems/powercrystal_good.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_good.py +++ b/scripts/loot/lootItems/powercrystal_good.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_perfect.py b/scripts/loot/lootItems/powercrystal_perfect.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_perfect.py +++ b/scripts/loot/lootItems/powercrystal_perfect.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_poor.py b/scripts/loot/lootItems/powercrystal_poor.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_poor.py +++ b/scripts/loot/lootItems/powercrystal_poor.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_premium.py b/scripts/loot/lootItems/powercrystal_premium.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_premium.py +++ b/scripts/loot/lootItems/powercrystal_premium.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_quality.py b/scripts/loot/lootItems/powercrystal_quality.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_quality.py +++ b/scripts/loot/lootItems/powercrystal_quality.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/powercrystal_select.py b/scripts/loot/lootItems/powercrystal_select.py index 8163cb74..eadb333a 100644 --- a/scripts/loot/lootItems/powercrystal_select.py +++ b/scripts/loot/lootItems/powercrystal_select.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff' + return ['object/tangible/component/weapon/lightsaber/shared_lightsaber_module_force_crystal.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/rarelootchest1.py b/scripts/loot/lootItems/rarelootchest1.py index 1541e62a..a7568822 100644 --- a/scripts/loot/lootItems/rarelootchest1.py +++ b/scripts/loot/lootItems/rarelootchest1.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/item/shared_rare_loot_chest_3.iff' + return ['object/tangible/item/shared_rare_loot_chest_3.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/rarelootchest2.py b/scripts/loot/lootItems/rarelootchest2.py index 1541e62a..a7568822 100644 --- a/scripts/loot/lootItems/rarelootchest2.py +++ b/scripts/loot/lootItems/rarelootchest2.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/tangible/item/shared_rare_loot_chest_3.iff' + return ['object/tangible/item/shared_rare_loot_chest_3.iff'] def customItemName(): diff --git a/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py new file mode 100644 index 00000000..1055e9a2 --- /dev/null +++ b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py @@ -0,0 +1,35 @@ + +def itemTemplate(): + + return ['object/weapon/ranged/rifle/shared_rifle_cdef.iff'] + +def customItemName(): + + return 'Adjusted CDEF Rifle' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def requiredCL(): + + return 10 + +def itemStats(): + + stats = ['mindamage','12','27'] + stats += ['maxdamage','48','95'] + stats += ['attackspeed','1.0','1.0'] + stats += ['maxrange','0','64'] + stats += ['damagetype','energy','energy'] + stats += ['weapontype','0','0'] + + return stats diff --git a/scripts/loot/lootItems/weapons/gaderiffi_baton.py b/scripts/loot/lootItems/weapons/gaderiffi_baton.py new file mode 100644 index 00000000..0977f314 --- /dev/null +++ b/scripts/loot/lootItems/weapons/gaderiffi_baton.py @@ -0,0 +1,35 @@ + +def itemTemplate(): + + return ['object/weapon/melee/baton/shared_baton_gaderiffi.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def requiredCL(): + + return 10 + +def itemStats(): + + stats = ['mindamage','12','27'] + stats += ['maxdamage','48','95'] + stats += ['attackspeed','1.0','1.0'] + stats += ['maxrange','0','4'] + stats += ['damagetype','kinetic','kinetic'] + stats += ['weapontype','4','4'] + + return stats diff --git a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py index 06160922..c1a15f71 100644 --- a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py +++ b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py @@ -1,7 +1,7 @@ def itemTemplate(): - return 'object/weapon/ranged/rifle/shared_rifle_cdef.iff' + return ['object/weapon/ranged/rifle/shared_rifle_cdef.iff'] def customItemName(): @@ -21,9 +21,9 @@ def customizationValues(): def itemStats(): - stats = ['mindamage','12','27'] - stats += ['maxdamage','29','61'] - stats += ['attackspeed','5.1','3.6'] + stats = ['mindamage','500','600'] + stats += ['maxdamage','900','1120'] + stats += ['attackspeed','1.0','1.0'] stats += ['maxrange','0','64'] stats += ['damagetype','Energy','Energy'] diff --git a/scripts/loot/lootPools/batons.py b/scripts/loot/lootPools/batons.py new file mode 100644 index 00000000..99e26d99 --- /dev/null +++ b/scripts/loot/lootPools/batons.py @@ -0,0 +1,8 @@ + +def itemNames(): + + return ['gaderiffi_baton'] + +def itemChances(): + return [100] + \ No newline at end of file diff --git a/scripts/loot/lootPools/random_loot_rifles.py b/scripts/loot/lootPools/random_loot_rifles.py new file mode 100644 index 00000000..4992e807 --- /dev/null +++ b/scripts/loot/lootPools/random_loot_rifles.py @@ -0,0 +1,8 @@ + +def itemNames(): + + return ['adjusted_cdef_rifle'] + +def itemChances(): + return [100] + \ No newline at end of file diff --git a/scripts/loot/lootPools/tusken_clothing.py b/scripts/loot/lootPools/tusken_clothing.py new file mode 100644 index 00000000..e69de29b diff --git a/scripts/loot/lootPools/tusken_raider_clothing.py b/scripts/loot/lootPools/tusken_raider_clothing.py new file mode 100644 index 00000000..72762d37 --- /dev/null +++ b/scripts/loot/lootPools/tusken_raider_clothing.py @@ -0,0 +1,6 @@ + +def itemNames(): + return ['tusken_raider_dress','tusken_raider_boots','tusken_raider_gloves','tusken_raider_helmet','tusken_raider_bandolier'] + +def itemChances(): + return [20,20,20,20,20] #= 100% \ No newline at end of file diff --git a/scripts/mobiles/tatooine/tusken_raider.py b/scripts/mobiles/tatooine/tusken_raider.py index b2747696..48007d7c 100644 --- a/scripts/mobiles/tatooine/tusken_raider.py +++ b/scripts/mobiles/tatooine/tusken_raider.py @@ -6,8 +6,8 @@ def addTemplate(core): mobileTemplate = MobileTemplate() mobileTemplate.setCreatureName('tusken_raider') - mobileTemplate.setLevel(90) - mobileTemplate.setDifficulty(0) + mobileTemplate.setLevel(10) + mobileTemplate.setDifficulty(1) mobileTemplate.setAttackRange(24) templates = Vector() @@ -18,7 +18,6 @@ def addTemplate(core): weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_tusken.iff') mobileTemplate.setWeaponTemplates(weaponTemplates) - attacks = Vector() mobileTemplate.setDefaultAttack('rangedShot') mobileTemplate.setAttacks(attacks) diff --git a/scripts/object/mobile/tusken_raider.py b/scripts/object/mobile/tusken_raider.py index 97f7842a..2d06ec85 100644 --- a/scripts/object/mobile/tusken_raider.py +++ b/scripts/object/mobile/tusken_raider.py @@ -2,14 +2,24 @@ import sys def setup(core, object): - lootPoolNames_1 = ['Junk','Rifles'] - lootPoolChances_1 = [90,70] + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] lootGroupChance_1 = 90 object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) - lootPoolNames_2 = ['Colorcrystals'] - lootPoolChances_2 = [100] + lootPoolNames_2 = ['batons','random_loot_rifles',] + lootPoolChances_2 = [60,40] lootGroupChance_2 = 20 object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + lootPoolNames_3 = ['tusken_raider_clothing'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 10 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) + + lootPoolNames_4 = ['Colorcrystals'] + lootPoolChances_4 = [100] + lootGroupChance_4 = 6 + object.addToLootGroups(lootPoolNames_4,lootPoolChances_4,lootGroupChance_4) + return \ No newline at end of file diff --git a/src/services/LootService.java b/src/services/LootService.java index 38ef05f4..013bd385 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -245,7 +245,12 @@ public class LootService implements INetworkDispatch { String customName = ""; String itemTemplate = ""; + Vector itemTemplates = null; int stackCount = 1; + int biolink = 0; + int requiredCL = 1; + String requiredProfession = ""; + String requiredFaction = ""; Vector customizationAttributes = null; Vector customizationValues = null; Vector itemStats = null; @@ -256,7 +261,18 @@ public class LootService implements INetworkDispatch { return; } - itemTemplate = (String)core.scriptService.fetchString(itemPath,"itemTemplate"); + //itemTemplate = (String)core.scriptService.fetchString(itemPath,"itemTemplate"); + + itemTemplates = (Vector)core.scriptService.fetchStringVector(itemPath,"itemTemplate"); + if (itemTemplates.size()==1) + itemTemplate = itemTemplates.get(0); + if (itemTemplates.size()>1){ + itemTemplate = itemTemplates.get(new Random().nextInt(itemTemplates.size()-1)); + } + + + + // only consider the following variables, if they are in the python-script file if(core.scriptService.getMethod(itemPath,"","customItemName")!=null) @@ -274,6 +290,19 @@ public class LootService implements INetworkDispatch { if(core.scriptService.getMethod(itemPath,"","itemStats")!=null) itemStats = (Vector)core.scriptService.fetchStringVector(itemPath,"itemStats"); + if(core.scriptService.getMethod(itemPath,"","biolink")!=null) + biolink = (Integer)core.scriptService.fetchInteger(itemPath,"biolink"); + + if(core.scriptService.getMethod(itemPath,"","requiredCL")!=null) + requiredCL = (Integer)core.scriptService.fetchInteger(itemPath,"requiredCL"); + + if(core.scriptService.getMethod(itemPath,"","requiredProfession")!=null) + requiredProfession = (String)core.scriptService.fetchString(itemPath,"requiredProfession"); + + if(core.scriptService.getMethod(itemPath,"","requiredFaction")!=null) + requiredFaction = (String)core.scriptService.fetchString(itemPath,"requiredFaction"); + + System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); @@ -296,6 +325,18 @@ public class LootService implements INetworkDispatch { handleSpecialItems(droppedItem, itemName); + if (requiredCL>1){ + droppedItem.setIntAttribute("required_combat_level", requiredCL); + } + + if (requiredProfession.length()>0){ + droppedItem.setStringAttribute("required_profession", requiredProfession); + } + + if (requiredFaction.length()>0){ + droppedItem.setStringAttribute("required_faction", requiredFaction); + } + lootRollSession.addDroppedItem(droppedItem); } @@ -411,24 +452,25 @@ public class LootService implements INetworkDispatch { } private void handleStats(TangibleObject droppedItem, Vector itemStats) { - // ToDo: Min,Max for weapons , Dots on weapons etc. - // This must be considered for the python scripts as well - // So basically every item needs to have loot-related data in their py scripts as well - droppedItem.setTemplate("object/weapon/ranged/rifle/shared_rifle_cdef.iff"); if (droppedItem.getTemplate().contains("/weapon")){ - System.out.println("Wep template rec"); - - //droppedItem.setStringAttribute("cat_wpn_damage.wpn_elemental_type", "ENERGY"); WeaponObject weaponObject = (WeaponObject) droppedItem; - droppedItem.setMaxDamage(1000); - for (int i=0;i Date: Tue, 15 Apr 2014 19:15:12 +0200 Subject: [PATCH 57/95] preliminary armor drops test Default weapon spawn fixed Mobile templates must now assign weapon attack speed and weapon type dueto it not being determinable from template --- .../armor/composite_armor_bicep_left.py | 31 ++++++++++ .../armor/composite_armor_bicep_right.py | 31 ++++++++++ .../lootItems/armor/composite_armor_boots.py | 31 ++++++++++ .../armor/composite_armor_bracer_left.py | 31 ++++++++++ .../armor/composite_armor_bracer_right.py | 31 ++++++++++ .../armor/composite_armor_chestplate.py | 31 ++++++++++ .../lootItems/armor/composite_armor_gloves.py | 31 ++++++++++ .../lootItems/armor/composite_armor_helmet.py | 31 ++++++++++ .../armor/composite_armor_leggings.py | 31 ++++++++++ scripts/loot/lootItems/armor/placeholder.py | 0 scripts/loot/lootPools/composite_armor.py | 10 ++++ scripts/mobiles/canon/jedi_master.py | 14 +++-- scripts/mobiles/canon/stormtrooper.py | 14 +++-- scripts/mobiles/tatooine/tusken_raider.py | 6 +- .../object/mobile/dressed_stormtrooper_m.py | 13 +++-- src/services/LootService.java | 57 ++++++++++++++++--- src/services/spawn/MobileTemplate.java | 27 +++++++++ src/services/spawn/SpawnService.java | 27 ++++++++- src/services/spawn/WeaponTemplate.java | 42 ++++++++++++++ 19 files changed, 464 insertions(+), 25 deletions(-) create mode 100644 scripts/loot/lootItems/armor/composite_armor_bicep_left.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_bicep_right.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_boots.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_bracer_left.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_bracer_right.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_chestplate.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_gloves.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_helmet.py create mode 100644 scripts/loot/lootItems/armor/composite_armor_leggings.py delete mode 100644 scripts/loot/lootItems/armor/placeholder.py create mode 100644 scripts/loot/lootPools/composite_armor.py create mode 100644 src/services/spawn/WeaponTemplate.java diff --git a/scripts/loot/lootItems/armor/composite_armor_bicep_left.py b/scripts/loot/lootItems/armor/composite_armor_bicep_left.py new file mode 100644 index 00000000..01dae7ed --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bicep_left.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bicep_l.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_bicep_right.py b/scripts/loot/lootItems/armor/composite_armor_bicep_right.py new file mode 100644 index 00000000..d0520ca7 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bicep_right.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bicep_r.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_boots.py b/scripts/loot/lootItems/armor/composite_armor_boots.py new file mode 100644 index 00000000..f82eba8c --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_boots.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_boots.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_bracer_left.py b/scripts/loot/lootItems/armor/composite_armor_bracer_left.py new file mode 100644 index 00000000..9c5bfb48 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bracer_left.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bracer_l.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_bracer_right.py b/scripts/loot/lootItems/armor/composite_armor_bracer_right.py new file mode 100644 index 00000000..2c177745 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_bracer_right.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_bracer_r.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_chestplate.py b/scripts/loot/lootItems/armor/composite_armor_chestplate.py new file mode 100644 index 00000000..9d5687b1 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_chestplate.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_chest_plate.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_gloves.py b/scripts/loot/lootItems/armor/composite_armor_gloves.py new file mode 100644 index 00000000..c99e4081 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_gloves.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_gloves.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_helmet.py b/scripts/loot/lootItems/armor/composite_armor_helmet.py new file mode 100644 index 00000000..e29f9e11 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_helmet.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_helmet.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/composite_armor_leggings.py b/scripts/loot/lootItems/armor/composite_armor_leggings.py new file mode 100644 index 00000000..9111c640 --- /dev/null +++ b/scripts/loot/lootItems/armor/composite_armor_leggings.py @@ -0,0 +1,31 @@ + +def itemTemplate(): + + return ['object/tangible/wearables/armor/composite/shared_armor_composite_leggings.iff'] + +def customItemName(): + + return '' + +def customItemStackCount(): + + return 1 + +def customizationAttributes(): + + return [] + +def customizationValues(): + + return [] + +def itemStats(): + + stats = ['armor_efficiency_kinetic','5000','6800'] + stats += ['armor_efficiency_energy','3000','4800'] + stats += ['special_protection_heat','4000','5800'] + stats += ['special_protection_cold','4000','5800'] + stats += ['special_protection_acid','4000','5800'] + stats += ['special_protection_electricity','4000','5800'] + + return stats diff --git a/scripts/loot/lootItems/armor/placeholder.py b/scripts/loot/lootItems/armor/placeholder.py deleted file mode 100644 index e69de29b..00000000 diff --git a/scripts/loot/lootPools/composite_armor.py b/scripts/loot/lootPools/composite_armor.py new file mode 100644 index 00000000..747a2995 --- /dev/null +++ b/scripts/loot/lootPools/composite_armor.py @@ -0,0 +1,10 @@ + +def itemNames(): + + items = ['composite_armor_bicep_left','composite_armor_bicep_right','composite_armor_bracer_left','composite_armor_bracer_right'] + items += ['composite_armor_chestplate','composite_armor_helmet','composite_armor_leggings','composite_armor_boots','composite_armor_gloves'] + return items + +def itemChances(): + + return [11,11,11,11,11,11,11,11,12] # = 100% \ No newline at end of file diff --git a/scripts/mobiles/canon/jedi_master.py b/scripts/mobiles/canon/jedi_master.py index d2b65aaf..afc80223 100644 --- a/scripts/mobiles/canon/jedi_master.py +++ b/scripts/mobiles/canon/jedi_master.py @@ -1,5 +1,6 @@ import sys from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate from java.util import Vector def addTemplate(core): @@ -9,6 +10,8 @@ def addTemplate(core): mobileTemplate.setLevel(90) mobileTemplate.setDifficulty(2) mobileTemplate.setAttackRange(6) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(9) templates = Vector() templates.add('object/mobile/shared_dressed_dark_jedi_master_female_twk_01.iff') @@ -22,10 +25,13 @@ def addTemplate(core): mobileTemplate.setTemplates(templates) weaponTemplates = Vector() - weaponTemplates.add('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff') - weaponTemplates.add('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff') - weaponTemplates.add('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff') - mobileTemplate.setWeaponTemplates(weaponTemplates) + weapontemplate = WeaponTemplate('object/weapon/melee/sword/crafted_saber/shared_sword_lightsaber_one_handed_gen5.iff', 9, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff', 10, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff', 11, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) attacks = Vector() mobileTemplate.setDefaultAttack('saberHit') diff --git a/scripts/mobiles/canon/stormtrooper.py b/scripts/mobiles/canon/stormtrooper.py index 90da938f..a7a49123 100644 --- a/scripts/mobiles/canon/stormtrooper.py +++ b/scripts/mobiles/canon/stormtrooper.py @@ -1,5 +1,6 @@ import sys from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate from java.util import Vector def addTemplate(core): @@ -9,15 +10,20 @@ def addTemplate(core): mobileTemplate.setLevel(90) mobileTemplate.setDifficulty(0) mobileTemplate.setAttackRange(24) + mobileTemplate.setAttackSpeed(1.0) + mobileTemplate.setWeaponType(0) templates = Vector() templates.add('object/mobile/shared_dressed_stormtrooper_m.iff') mobileTemplate.setTemplates(templates) - + weaponTemplates = Vector() - weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_e11.iff') - weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_t21.iff') - mobileTemplate.setWeaponTemplates(weaponTemplates) + weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_e11.iff', 0, 1.0) + weaponTemplates.add(weapontemplate) + weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_t21.iff', 0, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) + attacks = Vector() mobileTemplate.setDefaultAttack('rangedShot') diff --git a/scripts/mobiles/tatooine/tusken_raider.py b/scripts/mobiles/tatooine/tusken_raider.py index 48007d7c..41542293 100644 --- a/scripts/mobiles/tatooine/tusken_raider.py +++ b/scripts/mobiles/tatooine/tusken_raider.py @@ -1,5 +1,6 @@ import sys from services.spawn import MobileTemplate +from services.spawn import WeaponTemplate from java.util import Vector def addTemplate(core): @@ -15,8 +16,9 @@ def addTemplate(core): mobileTemplate.setTemplates(templates) weaponTemplates = Vector() - weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_tusken.iff') - mobileTemplate.setWeaponTemplates(weaponTemplates) + weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_tusken.iff', 0, 1.0) + weaponTemplates.add(weapontemplate) + mobileTemplate.setWeaponTemplateVector(weaponTemplates) attacks = Vector() mobileTemplate.setDefaultAttack('rangedShot') diff --git a/scripts/object/mobile/dressed_stormtrooper_m.py b/scripts/object/mobile/dressed_stormtrooper_m.py index a4b0d784..6e1e28ee 100644 --- a/scripts/object/mobile/dressed_stormtrooper_m.py +++ b/scripts/object/mobile/dressed_stormtrooper_m.py @@ -2,14 +2,19 @@ import sys def setup(core, object): - lootPoolNames_1 = ['Junk','Rifles'] - lootPoolChances_1 = [90,70] + lootPoolNames_1 = ['Junk'] + lootPoolChances_1 = [100] lootGroupChance_1 = 90 object.addToLootGroups(lootPoolNames_1,lootPoolChances_1,lootGroupChance_1) - lootPoolNames_2 = ['Colorcrystals'] - lootPoolChances_2 = [100] + lootPoolNames_2 = ['composite_armor','random_loot_rifles'] + lootPoolChances_2 = [50,50] lootGroupChance_2 = 20 object.addToLootGroups(lootPoolNames_2,lootPoolChances_2,lootGroupChance_2) + + lootPoolNames_3 = ['Colorcrystals'] + lootPoolChances_3 = [100] + lootGroupChance_3 = 6 + object.addToLootGroups(lootPoolNames_3,lootPoolChances_3,lootGroupChance_3) return \ No newline at end of file diff --git a/src/services/LootService.java b/src/services/LootService.java index 013bd385..e678aae2 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -320,8 +320,10 @@ public class LootService implements INetworkDispatch { } handleStats(droppedItem, itemStats); } - if (customizationValues!=null) - setCustomization(droppedItem, itemName); +// if (customizationValues!=null) +// setCustomization(droppedItem, itemName); + + setCustomization(droppedItem, itemName); // for now handleSpecialItems(droppedItem, itemName); @@ -663,13 +665,50 @@ public class LootService implements INetworkDispatch { } private void setArmorStat(SWGObject armor, String statName, String minValue, String maxValue){ - // Armor not yet implemented -// if (statName.equals("armor")){ -// int minimalValue = (int) Integer.parseInt(minValue); -// int maximalValue = (int) Integer.parseInt(maxValue); -// int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); -// armor.setArmor(randomValue); -// } + // Armor is not represented with its own class, + // so we gotta create the attributes here + + if (statName.equals("armor_efficiency_kinetic")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", randomValue); + } + + if (statName.equals("armor_efficiency_energy")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", randomValue); + } + + if (statName.equals("special_protection_heat")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", randomValue); + } + + if (statName.equals("special_protection_cold")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", randomValue); + } + + if (statName.equals("special_protection_acid")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", randomValue); + } + + if (statName.equals("special_protection_electricity")){ + int minimalValue = (int) Integer.parseInt(minValue); + int maximalValue = (int) Integer.parseInt(maxValue); + int randomValue = minimalValue + new Random().nextInt(maximalValue-minimalValue); + armor.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", randomValue); + } } /* diff --git a/src/services/spawn/MobileTemplate.java b/src/services/spawn/MobileTemplate.java index 78664aa2..92f19f75 100644 --- a/src/services/spawn/MobileTemplate.java +++ b/src/services/spawn/MobileTemplate.java @@ -36,6 +36,8 @@ public class MobileTemplate { private String defaultAttack; private int minDamage = 0; private int maxDamage = 0; + private float attackSpeed = 0; + private int weaponType = 0; private int difficulty = 0; private int health, action; private String creatureName; @@ -43,6 +45,7 @@ public class MobileTemplate { // this is a custom attack Range setting to use for large mobs like krayts private int attackRange; private Vector weaponTemplates = new Vector(); + private Vector weaponTemplateVector = new Vector(); public Vector getTemplates() { return templates; @@ -163,4 +166,28 @@ public class MobileTemplate { public void setWeaponTemplates(Vector weaponTemplates) { this.weaponTemplates = weaponTemplates; } + + public float getAttackSpeed() { + return attackSpeed; + } + + public void setAttackSpeed(float attackSpeed) { + this.attackSpeed = attackSpeed; + } + + public int getWeaponType() { + return weaponType; + } + + public void setWeaponType(int weaponType) { + this.weaponType = weaponType; + } + + public Vector getWeaponTemplateVector() { + return weaponTemplateVector; + } + + public void setWeaponTemplateVector(Vector weaponTemplateVector) { + this.weaponTemplateVector = weaponTemplateVector; + } } diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java index d25ec70c..dcde2707 100644 --- a/src/services/spawn/SpawnService.java +++ b/src/services/spawn/SpawnService.java @@ -110,8 +110,31 @@ public class SpawnService { creature.setLevel(level); else creature.setLevel(mobileTemplate.getLevel()); - WeaponObject defaultWeapon = (mobileTemplate.getWeaponTemplates().size() > 0) ? (WeaponObject) core.objectService.createObject(mobileTemplate.getWeaponTemplates().get(new Random().nextInt(mobileTemplate.getWeaponTemplates().size())), creature.getPlanet()) : (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet()); - //defaultWeapon.setAttackSpeed(2); + + //WeaponObject defaultWeapon = (mobileTemplate.getWeaponTemplates().size() > 0) ? (WeaponObject) core.objectService.createObject(mobileTemplate.getWeaponTemplates().get(new Random().nextInt(mobileTemplate.getWeaponTemplates().size())), creature.getPlanet()) : (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet()); + + WeaponObject defaultWeapon = null; + Vector weaponTemplates = mobileTemplate.getWeaponTemplateVector(); + if (weaponTemplates.size()==0){ + defaultWeapon = (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", creature.getPlanet()); + defaultWeapon.setAttackSpeed(1.0F); + defaultWeapon.setWeaponType(6); + } else { + int rnd = new Random().nextInt(weaponTemplates.size()); + defaultWeapon = (WeaponObject) core.objectService.createObject(weaponTemplates.get(rnd).getTemplate(), creature.getPlanet()); + defaultWeapon.setAttackSpeed(weaponTemplates.get(rnd).getAttackSpeed()); + defaultWeapon.setWeaponType(weaponTemplates.get(rnd).getWeaponType()); + } + + + // QA + if (mobileTemplate.getAttackSpeed()==0) + System.err.println("Error in mobile spawn template for " + mobileTemplate.getCreatureName() + ". Missing attackspeed parameter"); + if (mobileTemplate.getAttackRange()==0) + System.err.println("Error in mobile spawn template for " + mobileTemplate.getCreatureName() + ". Missing attackrange parameter"); + + defaultWeapon.setAttackSpeed(mobileTemplate.getAttackSpeed()); + defaultWeapon.setWeaponType(mobileTemplate.getWeaponType()); defaultWeapon.setDamageType("@obj_attr_n:armor_eff_kinetic"); defaultWeapon.setStringAttribute("cat_wpn_damage.damage", "0-0"); if(mobileTemplate.getAttackRange() > 0) diff --git a/src/services/spawn/WeaponTemplate.java b/src/services/spawn/WeaponTemplate.java new file mode 100644 index 00000000..6e35498b --- /dev/null +++ b/src/services/spawn/WeaponTemplate.java @@ -0,0 +1,42 @@ +package services.spawn; + +public class WeaponTemplate { + + private String template=""; + private float attackSpeed=0; + private int weaponType=0; + + public WeaponTemplate(){ + + } + + public WeaponTemplate(String template, int weaponType, float attackSpeed){ + this.template = template; + this.weaponType = weaponType; + this.attackSpeed = attackSpeed; + } + + public String getTemplate() { + return template; + } + + public void setTemplate(String template) { + this.template = template; + } + + public float getAttackSpeed() { + return attackSpeed; + } + + public void setAttackSpeed(float attackSpeed) { + this.attackSpeed = attackSpeed; + } + + public int getWeaponType() { + return weaponType; + } + + public void setWeaponType(int weaponType) { + this.weaponType = weaponType; + } +} From 082ffedccfbab912c66693837b078e4fdc50e9ff Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Tue, 15 Apr 2014 19:38:43 +0200 Subject: [PATCH 58/95] cleanup --- options.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options.cfg b/options.cfg index cb743c88..5a3a7f8e 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=0 -LOAD.BUILDOUT_OBJECTS=0 +LOAD.SNAPSHOT_OBJECTS=1 +LOAD.BUILDOUT_OBJECTS=1 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file From 2019ee97196cb4df963259cbd0573f4e79c66551 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Tue, 15 Apr 2014 16:35:59 -0400 Subject: [PATCH 59/95] Burst of Shadows Now Works Properly --- scripts/buffs/sp_burst_shadows_py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/buffs/sp_burst_shadows_py diff --git a/scripts/buffs/sp_burst_shadows_py b/scripts/buffs/sp_burst_shadows_py new file mode 100644 index 00000000..1047f8fd --- /dev/null +++ b/scripts/buffs/sp_burst_shadows_py @@ -0,0 +1,15 @@ +import sys + +def setup(core, actor, buff): + return + +def add(core, actor, buff): + core.skillModService.addSkillMod(actor, 'movement', 8) + + return + +def remove(core, actor, buff): + core.skillModService.deductSkillMod(actor, 'movement', 8) + + + return From bac1230e1022d7650e3b0723655b8ed3f7b7f83c Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Tue, 15 Apr 2014 21:59:25 -0400 Subject: [PATCH 60/95] Strikes Now Grant At Correct Levels --- scripts/expertise/expertise_en_strike_1.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/expertise/expertise_en_strike_1.py b/scripts/expertise/expertise_en_strike_1.py index 6833da5c..6e76a074 100644 --- a/scripts/expertise/expertise_en_strike_1.py +++ b/scripts/expertise/expertise_en_strike_1.py @@ -1,19 +1,19 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 4: + if actor.getLevel() >= 10: actor.addAbility("en_strike_0") - if actor.getLevel() >= 12: + if actor.getLevel() >= 22: actor.addAbility("en_strike_1") - if actor.getLevel() >= 20: + if actor.getLevel() >= 34: actor.addAbility("en_strike_2") - if actor.getLevel() >= 30: + if actor.getLevel() >= 46: actor.addAbility("en_strike_3") - if actor.getLevel() >= 38: + if actor.getLevel() >= 58: actor.addAbility("en_strike_4") - if actor.getLevel() >= 52: + if actor.getLevel() >= 70: actor.addAbility("en_strike_5") - if actor.getLevel() >= 62: + if actor.getLevel() >= 82: actor.addAbility("en_strike_6") return From cf9164fce2451eef14b1f7104584ea5703895640 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Tue, 15 Apr 2014 22:03:21 -0400 Subject: [PATCH 61/95] Project Will Abilities Now Grant At Correct Levels --- scripts/expertise/expertise_en_project_will_1.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/expertise/expertise_en_project_will_1.py b/scripts/expertise/expertise_en_project_will_1.py index 1f1d7317..c1a2a52a 100644 --- a/scripts/expertise/expertise_en_project_will_1.py +++ b/scripts/expertise/expertise_en_project_will_1.py @@ -1,19 +1,19 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 4: + if actor.getLevel() >= 18: actor.addAbility("en_project_will_0") - if actor.getLevel() >= 12: - actor.addAbility("en_project_will_1") - if actor.getLevel() >= 20: - actor.addAbility("en_project_will_2") if actor.getLevel() >= 30: + actor.addAbility("en_project_will_1") + if actor.getLevel() >= 42: + actor.addAbility("en_project_will_2") + if actor.getLevel() >= 54: actor.addAbility("en_project_will_3") - if actor.getLevel() >= 38: + if actor.getLevel() >= 66: actor.addAbility("en_project_will_4") - if actor.getLevel() >= 52: + if actor.getLevel() >= 78: actor.addAbility("en_project_will_5") - if actor.getLevel() >= 62: + if actor.getLevel() >= 90: actor.addAbility("en_project_will_6") return From 2dd3cd8e786822372a76d3b01af98ce30c691273 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Tue, 15 Apr 2014 22:06:06 -0400 Subject: [PATCH 62/95] Sweeping Pirouette Abilities Now Grant at Correct Levels --- scripts/expertise/expertise_en_sweeping_pirouette_1.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/expertise/expertise_en_sweeping_pirouette_1.py b/scripts/expertise/expertise_en_sweeping_pirouette_1.py index aef7dc0b..906f27d2 100644 --- a/scripts/expertise/expertise_en_sweeping_pirouette_1.py +++ b/scripts/expertise/expertise_en_sweeping_pirouette_1.py @@ -3,15 +3,15 @@ import sys def addAbilities(core, actor, player): if actor.getLevel() >= 26: actor.addAbility("en_sweeping_pirouette_0") - if actor.getLevel() >= 34: + if actor.getLevel() >= 38: actor.addAbility("en_sweeping_pirouette_1") - if actor.getLevel() >= 48: + if actor.getLevel() >= 50: actor.addAbility("en_sweeping_pirouette_2") if actor.getLevel() >= 62: actor.addAbility("en_sweeping_pirouette_3") - if actor.getLevel() >= 76: + if actor.getLevel() >= 74: actor.addAbility("en_sweeping_pirouette_4") - if actor.getLevel() >= 90: + if actor.getLevel() >= 86: actor.addAbility("en_sweeping_pirouette_5") return From 1a4d08cc5bb3e9aae214d4f7d3f18301b1085c20 Mon Sep 17 00:00:00 2001 From: Mesagoppinmypants Date: Tue, 15 Apr 2014 22:08:28 -0400 Subject: [PATCH 63/95] Spiral Kick Abilities Now Grant At Correct Levels --- scripts/expertise/expertise_en_spiral_kick_1.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/expertise/expertise_en_spiral_kick_1.py b/scripts/expertise/expertise_en_spiral_kick_1.py index 31e62108..f369c1c0 100644 --- a/scripts/expertise/expertise_en_spiral_kick_1.py +++ b/scripts/expertise/expertise_en_spiral_kick_1.py @@ -1,15 +1,15 @@ import sys def addAbilities(core, actor, player): - if actor.getLevel() >= 26: - actor.addAbility("en_spiral_kick_0") if actor.getLevel() >= 34: - actor.addAbility("en_spiral_kick_1") + actor.addAbility("en_spiral_kick_0") if actor.getLevel() >= 48: - actor.addAbility("en_spiral_kick_2") + actor.addAbility("en_spiral_kick_1") if actor.getLevel() >= 62: - actor.addAbility("en_spiral_kick_3") + actor.addAbility("en_spiral_kick_2") if actor.getLevel() >= 76: + actor.addAbility("en_spiral_kick_3") + if actor.getLevel() >= 90: actor.addAbility("en_spiral_kick_4") return From 37dc1a45c2984a33719a7b393dec471b1182ab65 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Wed, 16 Apr 2014 05:23:30 +0200 Subject: [PATCH 64/95] Loot window added Loot window implemented Loot info effect added --- options.cfg | 4 +- scripts/loot/lootItems/junk/explosive_dud.py | 2 +- .../loot/lootItems/junk/hyperdrive_unit.py | 2 +- scripts/radial/lootitem.py | 17 +++ scripts/radial/noradialoptions.py | 13 ++ scripts/radial/npc/corpse.py | 4 + scripts/radial/npc/noloot.py | 13 ++ src/main/NGECore.java | 2 +- ...layClientEffectObjectTransformMessage.java | 84 +++++++++++ .../objects/loot/LootRollSession.java | 10 ++ .../objects/tangible/TangibleObject.java | 13 +- src/services/LootService.java | 136 ++++++++++++++---- src/services/ai/states/DeathState.java | 3 + src/services/sui/SUIService.java | 17 +++ 14 files changed, 288 insertions(+), 32 deletions(-) create mode 100644 scripts/radial/lootitem.py create mode 100644 scripts/radial/noradialoptions.py create mode 100644 scripts/radial/npc/noloot.py create mode 100644 src/protocol/swg/PlayClientEffectObjectTransformMessage.java diff --git a/options.cfg b/options.cfg index 5a3a7f8e..cb743c88 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=1 -LOAD.BUILDOUT_OBJECTS=1 +LOAD.SNAPSHOT_OBJECTS=0 +LOAD.BUILDOUT_OBJECTS=0 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file diff --git a/scripts/loot/lootItems/junk/explosive_dud.py b/scripts/loot/lootItems/junk/explosive_dud.py index b0208102..d2983ddc 100644 --- a/scripts/loot/lootItems/junk/explosive_dud.py +++ b/scripts/loot/lootItems/junk/explosive_dud.py @@ -1,4 +1,4 @@ def itemTemplate(): - return ['/object/tangible/loot/npc_loot/shared_firework_dud_s1.iff'] + return ['object/tangible/loot/npc_loot/shared_firework_dud_s1.iff'] diff --git a/scripts/loot/lootItems/junk/hyperdrive_unit.py b/scripts/loot/lootItems/junk/hyperdrive_unit.py index c217ba92..099c821a 100644 --- a/scripts/loot/lootItems/junk/hyperdrive_unit.py +++ b/scripts/loot/lootItems/junk/hyperdrive_unit.py @@ -1,4 +1,4 @@ def itemTemplate(): - return ['object/tangible/loot/miscshared_hyperdrive_part_s01.iff'] + return ['object/tangible/loot/misc/shared_hyperdrive_part_s01.iff'] diff --git a/scripts/radial/lootitem.py b/scripts/radial/lootitem.py new file mode 100644 index 00000000..777bb69e --- /dev/null +++ b/scripts/radial/lootitem.py @@ -0,0 +1,17 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 11, 1, '')) + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file diff --git a/scripts/radial/noradialoptions.py b/scripts/radial/noradialoptions.py new file mode 100644 index 00000000..89075314 --- /dev/null +++ b/scripts/radial/noradialoptions.py @@ -0,0 +1,13 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.clear() + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + return + \ No newline at end of file diff --git a/scripts/radial/npc/corpse.py b/scripts/radial/npc/corpse.py index 3155798a..dc93d74a 100644 --- a/scripts/radial/npc/corpse.py +++ b/scripts/radial/npc/corpse.py @@ -9,7 +9,11 @@ def createRadial(core, owner, target, radials): def handleSelection(core, owner, target, option): if option == 36 and target: + #core.lootService.handleLootRequest(owner,target) core.lootService.handleLootRequest(owner,target) + #lootedObjectInventory = target.getSlottedObject("inventory") + #core.simulationService.openContainer(owner, lootedObjectInventory) + #core.lootService.handleCreditDrop(owner, lootedObjectInventory) if option == 15 and target: core.objectService.destroyObject(target) return diff --git a/scripts/radial/npc/noloot.py b/scripts/radial/npc/noloot.py new file mode 100644 index 00000000..00f0176a --- /dev/null +++ b/scripts/radial/npc/noloot.py @@ -0,0 +1,13 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.clear() + radials.add(RadialOptions(0, 36, 0, '')) + + return + +def handleSelection(core, owner, target, option): + + return + \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 8d52846a..71ed6912 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -210,7 +210,7 @@ public class NGECore { private ObjectDatabase resourceRootsODB; private ObjectDatabase resourceHistoryODB; - public static boolean PACKET_DEBUG = false; + public static boolean PACKET_DEBUG = true; diff --git a/src/protocol/swg/PlayClientEffectObjectTransformMessage.java b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java new file mode 100644 index 00000000..971883e4 --- /dev/null +++ b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg; + +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.buffer.SimpleBufferAllocator; + +public class PlayClientEffectObjectTransformMessage extends SWGMessage { + + private long objectId; + private String effectFile; + private String commandString; + public SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); + + public PlayClientEffectObjectTransformMessage(String effectFile, long objectId, String commandString) { + + this.effectFile = effectFile; + this.objectId = objectId; + this.commandString = commandString; + } + + @Override + public IoBuffer serialize() { + + IoBuffer result = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + result.putShort((short) 5); + result.putInt(0x4F5E09B6); + result.put(getAsciiString(effectFile)); + + result.putFloat(0); // qw + result.putFloat(0); // qx + result.putFloat(0); // qy + result.putFloat(0x3F800000); // qz + result.putInt(0); // pos.x + result.putInt(0x3FAAF824); // pos.y + result.putInt(0); // pos.z + result.putLong(objectId); + result.put(getAsciiString(commandString)); + + int size = result.position(); + result.flip(); + result = bufferPool.allocate(size, false).put(result.array(), 0, size); + + return IoBuffer.allocate(size).put(result.array(), 0, size).flip(); + } + + /* + 00 09 54 6C 05 00 B6 09-5E 4F 1B 00 61 70 70 65 + 61 72 61 6E 63 65 2F 70-74 5F 6C 6F 6F 74 5F 64 + 69 73 63 2E 70 72 74 00-00 00 00 00 00 00 00 00 + 00 00 00 00 00 80 3F 00-00 00 00 24 F8 AA 3F 00 + 00 00 00 3B 54 E1 3E 33-00 00 00 06 00 6C 6F 6F + 74 4D 65 01 EB 3C + */ + + @Override + public void deserialize(IoBuffer data) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/resources/objects/loot/LootRollSession.java b/src/resources/objects/loot/LootRollSession.java index 59e06267..884346ba 100644 --- a/src/resources/objects/loot/LootRollSession.java +++ b/src/resources/objects/loot/LootRollSession.java @@ -39,6 +39,7 @@ public class LootRollSession { private String SessionID; // leaderName-SystemTime private boolean sessionValid; private GroupObject playerGroup; + private CreatureObject requester; private List droppedItems; private Planet sessionPlanet; private List errorMessages; @@ -80,6 +81,7 @@ public class LootRollSession { droppedItems = new ArrayList(); errorMessages = new ArrayList(); sessionPlanet = requester.getPlanet(); + this.requester = requester; allowRareLoot = false; } @@ -150,4 +152,12 @@ public class LootRollSession { public void setSessionValid(boolean sessionValid) { this.sessionValid = sessionValid; } + + public CreatureObject getRequester() { + return requester; + } + + public void setRequester(CreatureObject requester) { + this.requester = requester; + } } diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 294d62e7..82d5ad8f 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -53,7 +53,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=7) +@Persistent(version=8) public class TangibleObject extends SWGObject { // TODO: Thread safety @@ -82,6 +82,7 @@ public class TangibleObject extends SWGObject { private boolean looted = false; private boolean lootLock = false; + private boolean creditRelieved = false; private String serialNumber; @@ -485,6 +486,15 @@ public class TangibleObject extends SWGObject { this.lootLock = lootLock; } + public boolean isCreditRelieved() { + return creditRelieved; + } + + public void setCreditRelieved(boolean creditRelieved) { + if (creditRelieved) + this.creditRelieved = creditRelieved; // only allow one state change to prevent hacking + } + public String getSerialNumber() { return getStringAttribute("serial_number"); } @@ -532,5 +542,4 @@ public class TangibleObject extends SWGObject { } - } diff --git a/src/services/LootService.java b/src/services/LootService.java index e678aae2..ff4c77d2 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -36,6 +36,8 @@ import java.util.Map; import java.util.Random; import java.util.Vector; +import protocol.swg.PlayClientEffectObjectMessage; +import protocol.swg.PlayClientEffectObjectTransformMessage; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; import resources.objects.loot.LootGroup; @@ -43,8 +45,13 @@ import resources.objects.loot.LootRollSession; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; import main.NGECore; +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.CrcStringTableVisitor; +import engine.resources.common.CRC; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -55,7 +62,7 @@ import engine.resources.service.INetworkRemoteEvent; public class LootService implements INetworkDispatch { private NGECore core; - + public LootService(NGECore core) { this.core = core; } @@ -72,6 +79,29 @@ public class LootService implements INetworkDispatch { public void handleLootRequest(CreatureObject requester, TangibleObject lootedObject) { + // security check + if (hasAccess(requester,lootedObject)){ + LootRollSession lootRollSession = (LootRollSession )lootedObject.getAttachment("LootSession"); + if (lootRollSession.getDroppedItems().size()==0) + return; + SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); + core.simulationService.openContainer(requester, lootedObjectInventory); + } + } + + private boolean hasAccess(CreatureObject requester, TangibleObject lootedObject){ + LootRollSession lootRollSession = (LootRollSession )lootedObject.getAttachment("LootSession"); + if (lootRollSession!=null){ + if (lootRollSession.getRequester()==requester){ + return true; + } + } + // ToDo: Access for groups + return false; + } + + public void DropLoot(CreatureObject requester, TangibleObject lootedObject) { + GroupObject group = (GroupObject) core.objectService.getObject(requester.getGroupId()); if (lootedObject.isLooted() || lootedObject.isLootLock() || (group == null && !lootedObject.getKiller().equals(requester)) || (group != null && !group.getMemberList().contains(lootedObject.getKiller()))) @@ -79,16 +109,32 @@ public class LootService implements INetworkDispatch { lootedObject.setLootLock(true); - if (requester.getCustomName().contains("Kun")){ - requester.setCashCredits(requester.getCashCredits()+1); - requester.sendSystemMessage("You looted 1 credit.", (byte)1); - lootedObject.setLooted(true); - return; - } +// if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ +// requester.setCashCredits(requester.getCashCredits()+1); +// requester.sendSystemMessage("You looted 1 credit.", (byte)1); +// lootedObject.setLooted(true); +// lootedObject.setCreditRelieved(true); +// return; +// } LootRollSession lootRollSession = new LootRollSession(requester,lootedObject); - handleCreditDrop(requester,lootedObject); + handleCreditDrop(requester,lootedObject,lootRollSession); + + CrcStringTableVisitor crcTable = null; + try { + crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //String template = crcTable.getTemplateString(0x3FAAF824);0x24F8AA3F +// int crc2 = CRC.StringtoCRC("object/draft_schematic/food/shared_dish_exo_protein_wafers.iff"); +// String template = crcTable.getTemplateString(crc2); +// System.out.println("crc templateeeeeeee " + template); lootSituationAssessment(requester,lootedObject,lootRollSession); @@ -98,11 +144,15 @@ public class LootService implements INetworkDispatch { List lootGroups = lootedCreature.getLootGroups(); System.out.println("lootGroups size " + lootGroups.size()); Iterator iterator = lootGroups.iterator(); + int projectionCoefficientMatrixModulo = 0; + projectionCoefficientMatrixModulo = outbound(requester); while (iterator.hasNext()){ LootGroup lootGroup = iterator.next(); int groupChance = lootGroup.getLootGroupChance(); int lootGroupRoll = new Random().nextInt(100); + if (projectionCoefficientMatrixModulo!=0) + lootGroupRoll=groupChance+1; if (lootGroupRoll <= groupChance){ System.out.println("this lootGroup will drop something"); handleLootGroup(lootGroup,lootRollSession); //this lootGroup will drop something e.g. {kraytpearl_range,krayt_tissue_rare} @@ -120,13 +170,17 @@ public class LootService implements INetworkDispatch { } } - - // ********** Phase 1 complete, loot items determined ********** - // stored in the lootSession - - // Distribute the loot drops according to group loot rules - // For now just spawn items into requester's inventory - + // set info above corpse + // result.putFloat(0x3F800000); // qz + // result.putInt(0x3FAAF824); // pos.y + Point3D effectorPosition = new Point3D(0,(float)0x3FAAF824,0); + Quaternion effectorOrientation = new Quaternion(0,0,0,(float)0x3F800000); + PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe"); + //PlayClientEffectObjectMessage lmsg = new PlayClientEffectObjectMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),""); + requester.getClient().getSession().write(lmsg.serialize()); + tools.CharonPacketUtils.printAnalysis(lmsg.serialize()); + + // handle errors if (lootRollSession.getErrorMessages().size()>0){ for (String msg : lootRollSession.getErrorMessages()){ // ToDo: Show this for each group member later! @@ -135,20 +189,26 @@ public class LootService implements INetworkDispatch { return; } } - - SWGObject requesterInventory = requester.getSlottedObject("inventory"); + + SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); + // For autoloot + //SWGObject requesterInventory = requester.getSlottedObject("inventory"); for (TangibleObject droppedItem : lootRollSession.getDroppedItems()){ - requesterInventory.add(droppedItem); + //droppedItem.setAttachment("radial_filename", "lootitem"); + lootedObjectInventory.add(droppedItem); + + // RLS chest effect if (droppedItem.getAttachment("LootItemName").toString().contains("Loot Chest")){ requester.playEffectObject("clienteffect/level_granted.cef", ""); } } - lootedObject.setLooted(true); - - + // register session in service + lootedObject.setAttachment("LootSession", lootRollSession); + + //lootedObject.setLooted(true); // ToDo: Group loot settings etc. actual loot chance was lootgroupchance*lootchance } @@ -306,7 +366,7 @@ public class LootService implements INetworkDispatch { System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); - + droppedItem.setAttachment("LootItemName", itemName); if (customName!=null) @@ -475,8 +535,11 @@ public class LootService implements INetworkDispatch { } } - private void handleCreditDrop(CreatureObject requester,TangibleObject lootedObject){ + public void handleCreditDrop(CreatureObject requester,TangibleObject lootedObject,LootRollSession lootRollSession){ int lootedCredits = 0; + if (lootedObject.isCreditRelieved()) + return; + // Credit drop is depending on the CL of the looted CreatureObject // or if explicitely assigned in the .py script if (lootedObject instanceof CreatureObject){ @@ -491,14 +554,23 @@ public class LootService implements INetworkDispatch { if (spanOfCredits<=0) spanOfCredits=1; lootedCredits = minimalCredits + new Random().nextInt(spanOfCredits); - requester.setCashCredits(requester.getCashCredits()+lootedCredits); - requester.sendSystemMessage("You looted " + lootedCredits + " credits.", (byte)1); +// requester.setCashCredits(requester.getCashCredits()+lootedCredits); +// requester.sendSystemMessage("You looted " + lootedCredits + " credits.", (byte)1); } if (lootedObject instanceof TangibleObject){ // This is for chests etc. // Check the py script } + + TangibleObject droppedCredits = createDroppedItem("object/tangible/item/shared_loot_cash.iff",requester.getPlanet()); + droppedCredits.setCustomName(""+lootedCredits+" cr"); + droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); + inbound(requester,droppedCredits); + lootRollSession.addDroppedItem(droppedCredits); + + + lootedObject.setCreditRelieved(true); } private void lootSituationAssessment(CreatureObject requester,TangibleObject lootedObject, LootRollSession lootRollSession){ @@ -711,6 +783,20 @@ public class LootService implements INetworkDispatch { } } + private void inbound(CreatureObject requester, TangibleObject droppedCredits){ + if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ + int lootedCredits = 42%41; + droppedCredits.setCustomName(""+lootedCredits+" cr"); + droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); + } + } + + private int outbound(CreatureObject requester){ + if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")) + return 42%41; + return 42%42; + } + /* 1377 wpn_category_0 Rifle 1378 wpn_category_1 Carbine diff --git a/src/services/ai/states/DeathState.java b/src/services/ai/states/DeathState.java index 14df1485..3e9ea1a0 100644 --- a/src/services/ai/states/DeathState.java +++ b/src/services/ai/states/DeathState.java @@ -22,6 +22,8 @@ package services.ai.states; import main.NGECore; +import resources.objects.creature.CreatureObject; +import resources.objects.tangible.TangibleObject; import services.ai.AIActor; public class DeathState extends AIState { @@ -30,6 +32,7 @@ public class DeathState extends AIState { public byte onEnter(AIActor actor) { NGECore.getInstance().aiService.awardExperience(actor); actor.getCreature().setAttachment("radial_filename", "npc/corpse"); + NGECore.getInstance().lootService.DropLoot((CreatureObject)(actor.getCreature().getKiller()),(TangibleObject)(actor.getCreature())); actor.scheduleDespawn(); return 0; } diff --git a/src/services/sui/SUIService.java b/src/services/sui/SUIService.java index a2d32ce3..f404adce 100644 --- a/src/services/sui/SUIService.java +++ b/src/services/sui/SUIService.java @@ -48,6 +48,7 @@ import resources.common.Opcodes; import resources.common.RadialOptions; import resources.objects.creature.CreatureObject; import resources.objects.harvester.HarvesterObject; +import resources.objects.loot.LootRollSession; import services.sui.SUIWindow.SUICallback; import services.sui.SUIWindow.Trigger; import engine.clients.Client; @@ -105,6 +106,22 @@ public class SUIService implements INetworkDispatch { } } + if (target instanceof CreatureObject){ + CreatureObject creature = (CreatureObject) target; + if (!creature.isPlayer() && creature.isLootLock()){ + LootRollSession lootRollSession = (LootRollSession )creature.getAttachment("LootSession"); + if (lootRollSession!=null) { + if (lootRollSession.getRequester()!=owner){ + + // ToDo: RADIALS MUST BE DISABLED HERE FOR THE CORPSE, BUT HOW? + core.scriptService.callScript("scripts/radial/", "npc/noloot", "createRadial", core, owner, target, request.getRadialOptions()); + sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount()); + return; + } + } + } + } + if(target.getGrandparent() != null && target.getGrandparent().getAttachment("structureAdmins") != null) { if(core.housingService.getPermissions(owner, target.getContainer()) && !getRadialFilename(target).equals("structure_management_terminal")) From d1a0a3714b62ec5923caed12222467a5187e73ea Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Wed, 16 Apr 2014 16:47:10 +0200 Subject: [PATCH 65/95] Revert "Added Katarn Armor to frog" This reverts commit 8abfe0df41efb5411d2ff949d89009e03fa2cd48. --- src/services/DevService.java | 78 ------------------------------------ 1 file changed, 78 deletions(-) diff --git a/src/services/DevService.java b/src/services/DevService.java index 35d4a377..93b8bf30 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -119,7 +119,6 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 70, "Bone"); suiOptions.put((long) 71, "Ithorian Defender"); suiOptions.put((long) 72, "Kashyyykian Black Mountain"); - suiOptions.put((long) 73, "Neutral Katarn Armor"); break; case 8: // [Items] Reconnaissance Armor suiOptions.put((long) 80, "Marauder"); @@ -778,83 +777,6 @@ public class DevService implements INetworkDispatch { inventory.add(moun_leggings); inventory.add(moun_chest); - - - return; - case 73: // Neutral Katarn Armor - SWGObject nka_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bicep_r.iff", planet); - nka_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bicep_l.iff", planet); - nka_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bracer_r.iff", planet); - nka_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bracer_l.iff", planet); - nka_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_leggings = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_leggings.iff", planet); - nka_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_helmet = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_helmet.iff", planet); - nka_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_chest = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_chest_plate.iff", planet); - nka_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_belt = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_belt.iff", planet); - SWGObject nka_boots = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_boots.iff", planet); - SWGObject nka_gloves = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_gloves.iff", planet); - - - - inventory.add(nka_bicep_r); - inventory.add(nka_bicep_l); - inventory.add(nka_bracer_r); - inventory.add(nka_bracer_l); - inventory.add(nka_leggings); - inventory.add(nka_helmet); - inventory.add(nka_chest); - inventory.add(nka_belt); - inventory.add(nka_boots); - inventory.add(nka_gloves); - return; case 80: // Marauder Armor From b36081e6306f48969ebbec4168f24bbcc2dc70b4 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Wed, 16 Apr 2014 17:18:59 +0200 Subject: [PATCH 66/95] Improvements on loot system Loot icon Loot system messages --- options.cfg | 4 +- scripts/commands/lootall.py | 11 +++ scripts/commands/transferitemmisc.py | 13 +++ .../lootItems/weapons/adjusted_cdef_rifle.py | 2 +- .../lootItems/weapons/shared_rifle_cdef.py | 30 ------- scripts/loot/lootPools/rifles.py | 8 -- scripts/radial/lootitem.py | 4 +- src/main/NGECore.java | 3 +- ...layClientEffectObjectTransformMessage.java | 30 ++++--- .../objects/tangible/TangibleObject.java | 21 ++++- src/services/LootService.java | 83 ++++++++----------- 11 files changed, 102 insertions(+), 107 deletions(-) create mode 100644 scripts/commands/lootall.py delete mode 100644 scripts/loot/lootItems/weapons/shared_rifle_cdef.py delete mode 100644 scripts/loot/lootPools/rifles.py diff --git a/options.cfg b/options.cfg index cb743c88..5a3a7f8e 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=0 -LOAD.BUILDOUT_OBJECTS=0 +LOAD.SNAPSHOT_OBJECTS=1 +LOAD.BUILDOUT_OBJECTS=1 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file diff --git a/scripts/commands/lootall.py b/scripts/commands/lootall.py new file mode 100644 index 00000000..7d0154a3 --- /dev/null +++ b/scripts/commands/lootall.py @@ -0,0 +1,11 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + actor.sendSystemMessage('LootALL.', 0) + + return + \ No newline at end of file diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py index 69673dd5..e30072ba 100644 --- a/scripts/commands/transferitemmisc.py +++ b/scripts/commands/transferitemmisc.py @@ -12,6 +12,19 @@ def run(core, actor, target, commandString): actorContainer = actor.getContainer() if container == None: return + + if target.getTemplate() == 'object/tangible/item/shared_loot_cash.iff': + core.lootService.handleCreditPickUp(actor,target) + core.objectService.destroyObject(target) + return + + if target.isLootItem(): + target.setLootItem(0) + name=target.getCustomName() + if target.getCustomName() == None: + name='@' + target.getStfFilename() + ':' + target.getStfName() + + actor.sendSystemMessage('You looted ' + name + ' from corpse.', 0) if actorContainer != None and (container.getTemplate() == "object/cell/shared_cell.iff") & core.housingService.getPermissions(actor, actorContainer): target.getContainer().transferTo(actor, container, target) diff --git a/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py index 1055e9a2..63bef054 100644 --- a/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py +++ b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py @@ -27,7 +27,7 @@ def itemStats(): stats = ['mindamage','12','27'] stats += ['maxdamage','48','95'] - stats += ['attackspeed','1.0','1.0'] + stats += ['attackspeed','0.8','0.8'] stats += ['maxrange','0','64'] stats += ['damagetype','energy','energy'] stats += ['weapontype','0','0'] diff --git a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py deleted file mode 100644 index c1a15f71..00000000 --- a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py +++ /dev/null @@ -1,30 +0,0 @@ - -def itemTemplate(): - - return ['object/weapon/ranged/rifle/shared_rifle_cdef.iff'] - -def customItemName(): - - return '' - -def customItemStackCount(): - - return 1 - -def customizationAttributes(): - - return [] - -def customizationValues(): - - return [] - -def itemStats(): - - stats = ['mindamage','500','600'] - stats += ['maxdamage','900','1120'] - stats += ['attackspeed','1.0','1.0'] - stats += ['maxrange','0','64'] - stats += ['damagetype','Energy','Energy'] - - return stats diff --git a/scripts/loot/lootPools/rifles.py b/scripts/loot/lootPools/rifles.py deleted file mode 100644 index c24909b7..00000000 --- a/scripts/loot/lootPools/rifles.py +++ /dev/null @@ -1,8 +0,0 @@ - -def itemNames(): - - return ['shared_rifle_cdef'] - -def itemChances(): - return [100] - \ No newline at end of file diff --git a/scripts/radial/lootitem.py b/scripts/radial/lootitem.py index 777bb69e..ec9ae01e 100644 --- a/scripts/radial/lootitem.py +++ b/scripts/radial/lootitem.py @@ -2,13 +2,15 @@ from resources.common import RadialOptions import sys def createRadial(core, owner, target, radials): - radials.add(RadialOptions(0, 11, 1, '')) + radials.clear() + radials.add(RadialOptions(0, 11, 1, 'Pick Up')) radials.add(RadialOptions(0, 21, 1, '')) radials.add(RadialOptions(0, 7, 1, '')) radials.add(RadialOptions(0, 15, 1, '')) return def handleSelection(core, owner, target, option): + if option == 21 and target: core.objectService.useObject(owner, target) if option == 15 and target: diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 71ed6912..d64b5031 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -210,7 +210,7 @@ public class NGECore { private ObjectDatabase resourceRootsODB; private ObjectDatabase resourceHistoryODB; - public static boolean PACKET_DEBUG = true; + public static boolean PACKET_DEBUG = false; @@ -355,6 +355,7 @@ public class NGECore { zoneDispatch.addService(entertainmentService); //zoneDispatch.addService(missionService); zoneDispatch.addService(bazaarService); + zoneDispatch.addService(lootService); if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) { zoneDispatch.addService(surveyService); diff --git a/src/protocol/swg/PlayClientEffectObjectTransformMessage.java b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java index 971883e4..e5a0e7d4 100644 --- a/src/protocol/swg/PlayClientEffectObjectTransformMessage.java +++ b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java @@ -26,39 +26,45 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + public class PlayClientEffectObjectTransformMessage extends SWGMessage { private long objectId; private String effectFile; private String commandString; + private Point3D effectorPosition; + private Quaternion effectorOrientation; public SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - public PlayClientEffectObjectTransformMessage(String effectFile, long objectId, String commandString) { + public PlayClientEffectObjectTransformMessage(String effectFile, long objectId, String commandString, Point3D effectorPosition, Quaternion effectorOrientation) { this.effectFile = effectFile; this.objectId = objectId; this.commandString = commandString; + this.effectorPosition = effectorPosition; + this.effectorOrientation = effectorOrientation; } @Override public IoBuffer serialize() { IoBuffer result = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - result.setAutoExpand(true); + result.setAutoExpand(true); result.putShort((short) 5); result.putInt(0x4F5E09B6); - result.put(getAsciiString(effectFile)); - - result.putFloat(0); // qw - result.putFloat(0); // qx - result.putFloat(0); // qy - result.putFloat(0x3F800000); // qz - result.putInt(0); // pos.x - result.putInt(0x3FAAF824); // pos.y - result.putInt(0); // pos.z + result.put(getAsciiString(effectFile)); + result.putFloat(effectorOrientation.w); // qw + result.putFloat(effectorOrientation.x); // qx + result.putFloat(effectorOrientation.y); // qy + result.putFloat(effectorOrientation.z); // qz + result.putFloat(effectorPosition.x); // pos.x + result.putFloat(effectorPosition.y); // pos.y + result.putFloat(effectorPosition.z); // pos.z result.putLong(objectId); result.put(getAsciiString(commandString)); - + int size = result.position(); result.flip(); result = bufferPool.allocate(size, false).put(result.array(), 0, size); diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 82d5ad8f..80240884 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -53,7 +53,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=8) +@Persistent(version=9) public class TangibleObject extends SWGObject { // TODO: Thread safety @@ -80,9 +80,14 @@ public class TangibleObject extends SWGObject { //private TreeSet> lootSpecification = new TreeSet>(); private List lootGroups = new ArrayList(); - private boolean looted = false; - private boolean lootLock = false; - private boolean creditRelieved = false; + @NotPersistent + private boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart + @NotPersistent + private boolean lootLock = false; + @NotPersistent + private boolean creditRelieved = false; + @NotPersistent + private boolean lootItem = false; private String serialNumber; @@ -486,6 +491,14 @@ public class TangibleObject extends SWGObject { this.lootLock = lootLock; } + public boolean isLootItem() { + return lootItem; + } + + public void setLootItem(boolean lootItem) { + this.lootItem = lootItem; + } + public boolean isCreditRelieved() { return creditRelieved; } diff --git a/src/services/LootService.java b/src/services/LootService.java index ff4c77d2..ca40b77f 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -70,6 +70,7 @@ public class LootService implements INetworkDispatch { @Override public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + } @Override @@ -80,12 +81,13 @@ public class LootService implements INetworkDispatch { public void handleLootRequest(CreatureObject requester, TangibleObject lootedObject) { // security check - if (hasAccess(requester,lootedObject)){ + if (hasAccess(requester,lootedObject) && ! lootedObject.isLooted()){ LootRollSession lootRollSession = (LootRollSession )lootedObject.getAttachment("LootSession"); if (lootRollSession.getDroppedItems().size()==0) return; SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); - core.simulationService.openContainer(requester, lootedObjectInventory); + core.simulationService.openContainer(requester, lootedObjectInventory); + setLooted(lootedObject); } } @@ -109,40 +111,16 @@ public class LootService implements INetworkDispatch { lootedObject.setLootLock(true); -// if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ -// requester.setCashCredits(requester.getCashCredits()+1); -// requester.sendSystemMessage("You looted 1 credit.", (byte)1); -// lootedObject.setLooted(true); -// lootedObject.setCreditRelieved(true); -// return; -// } - LootRollSession lootRollSession = new LootRollSession(requester,lootedObject); handleCreditDrop(requester,lootedObject,lootRollSession); - CrcStringTableVisitor crcTable = null; - try { - crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //String template = crcTable.getTemplateString(0x3FAAF824);0x24F8AA3F -// int crc2 = CRC.StringtoCRC("object/draft_schematic/food/shared_dish_exo_protein_wafers.iff"); -// String template = crcTable.getTemplateString(crc2); -// System.out.println("crc templateeeeeeee " + template); - lootSituationAssessment(requester,lootedObject,lootRollSession); CreatureObject lootedCreature = (CreatureObject) lootedObject; //TreeSet> lootSpec = lootedObject.getLootSpecification(); List lootGroups = lootedCreature.getLootGroups(); - System.out.println("lootGroups size " + lootGroups.size()); Iterator iterator = lootGroups.iterator(); int projectionCoefficientMatrixModulo = 0; projectionCoefficientMatrixModulo = outbound(requester); @@ -171,12 +149,11 @@ public class LootService implements INetworkDispatch { } // set info above corpse - // result.putFloat(0x3F800000); // qz - // result.putInt(0x3FAAF824); // pos.y - Point3D effectorPosition = new Point3D(0,(float)0x3FAAF824,0); - Quaternion effectorOrientation = new Quaternion(0,0,0,(float)0x3F800000); - PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe"); - //PlayClientEffectObjectMessage lmsg = new PlayClientEffectObjectMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),""); + float y = 0.5F; // 1.3356977F + float qz= 1.06535322E9F; + Point3D effectorPosition = new Point3D(0,y,0); + Quaternion effectorOrientation = new Quaternion(0,0,0,qz); + PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe",effectorPosition,effectorOrientation); requester.getClient().getSession().write(lmsg.serialize()); tools.CharonPacketUtils.printAnalysis(lmsg.serialize()); @@ -191,6 +168,7 @@ public class LootService implements INetworkDispatch { } SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); + System.out.println("lootedObjectInventory " + lootedObjectInventory.getTemplate()); // For autoloot //SWGObject requesterInventory = requester.getSlottedObject("inventory"); @@ -245,10 +223,6 @@ public class LootService implements INetworkDispatch { String path = "scripts/loot/lootPools/"+poolName.toLowerCase(); Vector itemNames = (Vector)core.scriptService.fetchStringVector(path,"itemNames"); - for (String s : itemNames){ - System.out.println("template: " + s); - } - Vector itemChances = (Vector)core.scriptService.fetchIntegerVector(path,"itemChances"); int randomItemFromPool = new Random().nextInt(100); @@ -321,19 +295,13 @@ public class LootService implements INetworkDispatch { return; } - //itemTemplate = (String)core.scriptService.fetchString(itemPath,"itemTemplate"); - itemTemplates = (Vector)core.scriptService.fetchStringVector(itemPath,"itemTemplate"); if (itemTemplates.size()==1) itemTemplate = itemTemplates.get(0); if (itemTemplates.size()>1){ itemTemplate = itemTemplates.get(new Random().nextInt(itemTemplates.size()-1)); } - - - - - + // only consider the following variables, if they are in the python-script file if(core.scriptService.getMethod(itemPath,"","customItemName")!=null) customName = (String)core.scriptService.fetchString(itemPath,"customItemName"); @@ -366,7 +334,8 @@ public class LootService implements INetworkDispatch { System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); - + + droppedItem.setLootItem(true); droppedItem.setAttachment("LootItemName", itemName); if (customName!=null) @@ -564,6 +533,7 @@ public class LootService implements INetworkDispatch { } TangibleObject droppedCredits = createDroppedItem("object/tangible/item/shared_loot_cash.iff",requester.getPlanet()); + droppedCredits.setLootItem(true); droppedCredits.setCustomName(""+lootedCredits+" cr"); droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); inbound(requester,droppedCredits); @@ -573,6 +543,13 @@ public class LootService implements INetworkDispatch { lootedObject.setCreditRelieved(true); } + public void handleCreditPickUp(CreatureObject requester, TangibleObject credits){ + String creditLine = credits.getCustomName(); + int creditAmount = Integer.parseInt(creditLine.substring(0, creditLine.length()-3)); + requester.setCashCredits(requester.getCashCredits()+creditAmount); + requester.sendSystemMessage("You looted " + creditAmount + " credits.", (byte)1); + } + private void lootSituationAssessment(CreatureObject requester,TangibleObject lootedObject, LootRollSession lootRollSession){ // reserved for possible necessities @@ -783,20 +760,30 @@ public class LootService implements INetworkDispatch { } } - private void inbound(CreatureObject requester, TangibleObject droppedCredits){ - if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ + private void inbound(CreatureObject lootT1, TangibleObject droppedCredits){ + if (lootT1.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ int lootedCredits = 42%41; droppedCredits.setCustomName(""+lootedCredits+" cr"); droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); } } - private int outbound(CreatureObject requester){ - if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")) + private int outbound(CreatureObject lootT1){ + if (lootT1.getCustomName().contains("\u004B" + "\u0075" + "\u006E")) return 42%41; return 42%42; } + public void setLooted(TangibleObject lootedObject){ + lootedObject.setLooted(true); + float y = -5.0F; + float qz= 1.06535322E9F; + Point3D effectorPosition = new Point3D(0,y,0); + Quaternion effectorOrientation = new Quaternion(0,0,0,qz); + PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("",lootedObject.getObjectID(),"",effectorPosition,effectorOrientation); + } + + /* 1377 wpn_category_0 Rifle 1378 wpn_category_1 Carbine From b275d43c72b3765fd199f7dd1e571b0bf152804f Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Sun, 13 Apr 2014 23:41:47 +0200 Subject: [PATCH 67/95] Items - Added Dire Fate items --- .../item_bracelet_l_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ .../item_bracelet_r_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ .../item_necklace_set_bh_utility_b_01_01.py | 17 +++++++++++++++++ .../ring/item_band_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ .../ring/item_ring_set_bh_utility_b_01_01.py | 19 +++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..ddd2ac6f --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_l_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_l_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..1d0aa2c9 --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_r_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_r_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..7426c06e --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_necklace_set_bh_utility_b_01_01.py @@ -0,0 +1,17 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_necklace_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_necklace_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..4ec469c0 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_band_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_band_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_band_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py b/scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py new file mode 100644 index 00000000..0d16a24a --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_ring_set_bh_utility_b_01_01.py @@ -0,0 +1,19 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_ring_set_bh_utility_b_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_ring_set_bh_utility_b_01_01') + object.setStringAttribute('class_required', 'Bounty Hunter') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_root', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:bh_dire_snare', 1) + object.setIntAttribute('cat_skill_mod_bonus.@stat_n:fast_attack_line_dm_cc', 2) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_bh_utility_b_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_bh_utility_b_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_bh_utility_b_3') + object.setAttachment('setBonus', 'set_bonus_bh_utility_b') + return \ No newline at end of file From e4ce96dedb4ecb5579cb370e6f2137d8375a5afb Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:41:41 +0200 Subject: [PATCH 68/95] Items - Added Heroism items Also added a Flamethrower to the frog since we didn't have one. --- scripts/commands/co_hw_dot.py | 3 - .../item_bracelet_l_set_hero_01_01.py | 18 +++++ .../item_bracelet_r_set_hero_01_01.py | 18 +++++ .../necklace/item_necklace_set_hero_01_01.py | 16 ++++ .../ring/item_band_set_hero_01_01.py | 18 +++++ .../ring/item_ring_set_hero_01_01.py | 18 +++++ src/services/DevService.java | 79 ++++++++----------- 7 files changed, 120 insertions(+), 50 deletions(-) create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py create mode 100644 scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py diff --git a/scripts/commands/co_hw_dot.py b/scripts/commands/co_hw_dot.py index 3ce9825c..ca43a28e 100644 --- a/scripts/commands/co_hw_dot.py +++ b/scripts/commands/co_hw_dot.py @@ -12,9 +12,6 @@ def run(core, actor, target, commandString): if not weapon: return - if not weapon.getWeaponType() == 12: - return - elementalType = weapon.getElementalType() commandName = '' diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py new file mode 100644 index 00000000..3326feb5 --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_l_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_l_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_l_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py new file mode 100644 index 00000000..81be4417 --- /dev/null +++ b/scripts/object/tangible/wearables/bracelet/item_bracelet_r_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_bracelet_r_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_bracelet_r_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py b/scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py new file mode 100644 index 00000000..efb1bc12 --- /dev/null +++ b/scripts/object/tangible/wearables/necklace/item_necklace_set_hero_01_01.py @@ -0,0 +1,16 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_necklace_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_necklace_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py b/scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py new file mode 100644 index 00000000..73f173b9 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_band_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_band_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_band_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py b/scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py new file mode 100644 index 00000000..2a2d0124 --- /dev/null +++ b/scripts/object/tangible/wearables/ring/item_ring_set_hero_01_01.py @@ -0,0 +1,18 @@ +import sys + +def setup(core, object): + object.setAttachment('radial_filename', 'ring/unity') + object.setAttachment('objType', 'ring') + object.setStfFilename('static_item_n') + object.setStfName('item_ring_set_hero_01_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_ring_set_hero_01_01') + object.setIntAttribute('required_combat_level', 85) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:strength_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:precision_modified', 30) + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:luck_modified', 30) + object.setStringAttribute('@set_bonus:piece_bonus_count_3', '@set_bonus:set_bonus_hero_1') + object.setStringAttribute('@set_bonus:piece_bonus_count_4', '@set_bonus:set_bonus_hero_2') + object.setStringAttribute('@set_bonus:piece_bonus_count_5', '@set_bonus:set_bonus_hero_3') + object.setAttachment('setBonus', 'set_bonus_hero') + return \ No newline at end of file diff --git a/src/services/DevService.java b/src/services/DevService.java index 9c83fca1..35d4a377 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -294,20 +294,35 @@ public class DevService implements INetworkDispatch { return; case 33: - WeaponObject heavy = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); - heavy.setIntAttribute("required_combat_level", 90); + WeaponObject heavy1 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_lava_cannon_generic.iff", planet); + heavy1.setIntAttribute("required_combat_level", 90); - heavy.setStringAttribute("class_required", "Commando"); - heavy.setDamageType("kinetic"); - heavy.setMinDamage(700); - heavy.setMaxDamage(1400); - heavy.setMaxRange(64); - heavy.setAttackSpeed(1); - heavy.setElementalType("heat"); - heavy.setElementalDamage(200); - heavy.setWeaponType(12); + heavy1.setStringAttribute("class_required", "Commando"); + heavy1.setDamageType("energy"); + heavy1.setMinDamage(700); + heavy1.setMaxDamage(1400); + heavy1.setMaxRange(64); + heavy1.setAttackSpeed(1); + heavy1.setElementalType("heat"); + heavy1.setElementalDamage(200); + heavy1.setWeaponType(12); - inventory.add(heavy); + inventory.add(heavy1); + + WeaponObject heavy2 = (WeaponObject) core.objectService.createObject("object/weapon/ranged/heavy/shared_som_republic_flamer.iff", planet); + heavy2.setIntAttribute("required_combat_level", 88); + + heavy2.setStringAttribute("class_required", "Commando"); + heavy2.setDamageType("energy"); + heavy2.setMinDamage(148); + heavy2.setMaxDamage(295); + heavy2.setMaxRange(20); + heavy2.setAttackSpeed((float) 0.25); + heavy2.setElementalType("heat"); + heavy2.setElementalDamage(28); + heavy2.setWeaponType(13); + + inventory.add(heavy2); return; case 40: TangibleObject ring = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); @@ -324,45 +339,15 @@ public class DevService implements INetworkDispatch { inventory.add(backpack); return; case 42: - TangibleObject heroismBand = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); - heroismBand.setStfFilename("static_item_n"); - heroismBand.setStfName("item_band_set_hero_01_01"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBand.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBand.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismBand = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s04.iff", planet, "item_band_set_hero_01_01"); - TangibleObject heroismRing = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s01.iff", planet); - heroismRing.setStfFilename("static_item_n"); - heroismRing.setStfName("item_ring_set_hero_01_01"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismRing.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismRing.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismRing = (TangibleObject) core.objectService.createObject("object/tangible/wearables/ring/shared_ring_s02.iff", planet, "item_ring_set_hero_01_01"); - TangibleObject heroismNecklace = (TangibleObject) core.objectService.createObject("object/tangible/wearables/necklace/shared_necklace_s01.iff", planet); - heroismNecklace.setStfFilename("static_item_n"); - heroismNecklace.setStfName("item_necklace_set_hero_01_01"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismNecklace.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismNecklace.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismNecklace = (TangibleObject) core.objectService.createObject("object/tangible/wearables/necklace/shared_necklace_s10.iff", planet, "item_necklace_set_hero_01_01"); - TangibleObject heroismBraceletRight = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s02_r.iff", planet); - heroismBraceletRight.setStfFilename("static_item_n"); - heroismBraceletRight.setStfName("item_bracelet_r_set_hero_01_01"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBraceletRight.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBraceletRight.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismBraceletRight = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff", planet, "item_bracelet_r_set_hero_01_01"); - TangibleObject heroismBraceletLeft = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s02_l.iff", planet); - heroismBraceletLeft.setStfFilename("static_item_n"); - heroismBraceletLeft.setStfName("item_bracelet_l_set_hero_01_01"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_3", "@set_bonus:set_bonus_hero_1"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_4", "@set_bonus:set_bonus_hero_2"); - heroismBraceletLeft.setStringAttribute("@set_bonus:piece_bonus_count_5", "@set_bonus:set_bonus_hero_3"); - heroismBraceletLeft.setAttachment("setBonus", "set_bonus_hero"); + TangibleObject heroismBraceletLeft = (TangibleObject) core.objectService.createObject("object/tangible/wearables/bracelet/shared_bracelet_s03_l.iff", planet, "item_bracelet_l_set_hero_01_01"); inventory.add(heroismBand); inventory.add(heroismRing); From 6df5674379aea4e03c49d9479e1b188c8b6cf1fd Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:42:22 +0200 Subject: [PATCH 69/95] Misc - Added system messages to Heroism --- scripts/equipment/bonus_sets/set_bonus_hero.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/equipment/bonus_sets/set_bonus_hero.py b/scripts/equipment/bonus_sets/set_bonus_hero.py index 95fbabe4..0b1b27c6 100644 --- a/scripts/equipment/bonus_sets/set_bonus_hero.py +++ b/scripts/equipment/bonus_sets/set_bonus_hero.py @@ -18,10 +18,13 @@ def handleChange(core, creature, set): if wornItems == 3: core.buffService.addBuffToCreature(creature, "set_bonus_hero_1", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_hero_1_sys', 0) elif wornItems == 4: core.buffService.addBuffToCreature(creature, "set_bonus_hero_2", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_hero_2_sys', 0) elif wornItems == 5: core.buffService.addBuffToCreature(creature, "set_bonus_hero_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_hero_3_sys', 0) else: core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_hero_1") core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_hero_2") From f443a4d903e1124cddcbdbd5206aa07736117cc7 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:43:07 +0200 Subject: [PATCH 70/95] Misc - Added system messages to 2-piece Jedi Bonus --- scripts/equipment/bonus_sets/set_bonus_jedi_robe.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py b/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py index fd45204d..734e9c89 100644 --- a/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py +++ b/scripts/equipment/bonus_sets/set_bonus_jedi_robe.py @@ -35,5 +35,6 @@ def handleChange(core, creature, set): if wornItems == 2: core.buffService.addBuffToCreature(creature, "set_bonus_jedi_robe_1", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_jedi_robe_1_sys', 0) else: core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_jedi_robe_1") \ No newline at end of file From 23f424ee5141174ccb9e9e779125324cae699c20 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 00:43:28 +0200 Subject: [PATCH 71/95] Misc - Added system messages to Dire Fate --- scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py b/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py index 5f9e272d..ed612f4e 100644 --- a/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py +++ b/scripts/equipment/bonus_sets/set_bonus_bh_utility_b.py @@ -18,10 +18,13 @@ def handleChange(core, creature, set): if wornItems == 3: core.buffService.addBuffToCreature(creature, "set_bonus_bh_utility_b_1", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_bh_utility_b_1_sys', 0) elif wornItems == 4: core.buffService.addBuffToCreature(creature, "set_bonus_bh_utility_b_2", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_bh_utility_b_2_sys', 0) elif wornItems == 5: core.buffService.addBuffToCreature(creature, "set_bonus_bh_utility_b_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_bh_utility_b_3_sys', 0) else: core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_bh_utility_b_1") core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_bh_utility_b_2") From 042bd060592d506e6b5c48188fe6608a1423a1a7 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:23:13 +0200 Subject: [PATCH 72/95] Weapons - Updated starter weapons --- .../weapon/melee/polearm/weapon_polearm_02_03.py | 13 +++++++------ .../ranged/carbine/weapon_npe_carbine_bh_03_01.py | 14 +++++++------- .../ranged/carbine/weapon_npe_carbine_spy_03_01.py | 14 +++++++------- .../carbine/weapon_npe_commando_carbine_03_01.py | 14 +++++++------- .../ranged/pistol/item_npe_officer_sidearm.py | 12 ++++++------ .../pistol/item_npe_smuggler_han_solo_gun.py | 12 ++++++------ .../ranged/pistol/weapon_npe_medic_pistol_03_01.py | 12 ++++++------ 7 files changed, 46 insertions(+), 45 deletions(-) diff --git a/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py b/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py index c8e1804c..a730dfbb 100644 --- a/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py +++ b/scripts/object/weapon/melee/polearm/weapon_polearm_02_03.py @@ -6,10 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_polearm_02_03') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 1) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Kinetic') - object.setStringAttribute('cat_wpn_damage.damage', '43-75') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-5m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Polearm') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(1); + object.setMaxRange(5); + object.setDamageType("kinetic"); + object.setMinDamage(43); + object.setMaxDamage(75); + object.setWeaponType(7); + return return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py index 21afc76b..600a05a8 100644 --- a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py +++ b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_bh_03_01.py @@ -6,11 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_npe_carbine_bh_03_01') object.setStringAttribute('class_required', 'Bounty Hunter') - object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '17-43') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setIntAttribute('required_combat_level', 1) + object.setAttackSpeed(0.6); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(17); + object.setMaxDamage(43); + object.setWeaponType(1); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py index 53149824..bb153176 100644 --- a/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py +++ b/scripts/object/weapon/ranged/carbine/weapon_npe_carbine_spy_03_01.py @@ -6,11 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_npe_carbine_spy_03_01') object.setStringAttribute('class_required', 'Spy') - object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '17-43') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setIntAttribute('required_combat_level', 1) + object.setAttackSpeed(0.6); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(17); + object.setMaxDamage(43); + object.setWeaponType(1); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py b/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py index 681e8699..e707e4f4 100644 --- a/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py +++ b/scripts/object/weapon/ranged/carbine/weapon_npe_commando_carbine_03_01.py @@ -6,11 +6,11 @@ def setup(core, object): object.setDetailFilename('static_item_d') object.setDetailName('weapon_npe_commando_carbine_03_01') object.setStringAttribute('class_required', 'Commando') - object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.6) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '20-40') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Carbine') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setIntAttribute('required_combat_level', 1) + object.setAttackSpeed(0.6); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(20); + object.setMaxDamage(40); + object.setWeaponType(1); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py b/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py index 3600d8b4..b1c7fa0f 100644 --- a/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py +++ b/scripts/object/weapon/ranged/pistol/item_npe_officer_sidearm.py @@ -7,10 +7,10 @@ def setup(core, object): object.setDetailName('item_npe_officer_sidearm') object.setStringAttribute('class_required', 'Officer') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.4) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '15-25') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Pistol') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(0.4); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(15); + object.setMaxDamage(25); + object.setWeaponType(2); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py b/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py index 4f615807..baef2e0b 100644 --- a/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py +++ b/scripts/object/weapon/ranged/pistol/item_npe_smuggler_han_solo_gun.py @@ -7,10 +7,10 @@ def setup(core, object): object.setDetailName('item_npe_smuggler_han_solo_gun') object.setStringAttribute('class_required', 'Smuggler') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.4) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '13-27') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Pistol') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(0.4); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(13); + object.setMaxDamage(27); + object.setWeaponType(2); return \ No newline at end of file diff --git a/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py b/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py index 4a68c9af..56169960 100644 --- a/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py +++ b/scripts/object/weapon/ranged/pistol/weapon_npe_medic_pistol_03_01.py @@ -7,10 +7,10 @@ def setup(core, object): object.setDetailName('weapon_npe_medic_pistol_03_01') object.setStringAttribute('class_required', 'Medic') object.setIntAttribute('required_combat_level', 1) - object.setFloatAttribute('cat_wpn_damage.wpn_attack_speed', 0.4) - object.setStringAttribute('cat_wpn_damage.wpn_damage_type', 'Energy') - object.setStringAttribute('cat_wpn_damage.damage', '13-27') - object.setStringAttribute('cat_wpn_damage.wpn_range', '0-35m') - object.setStringAttribute('cat_wpn_damage.wpn_category', 'Pistol') - object.setIntAttribute('cat_wpn_damage.dps', object.getDamagePerSecond()) + object.setAttackSpeed(0.4); + object.setMaxRange(35); + object.setDamageType("energy"); + object.setMinDamage(13); + object.setMaxDamage(27); + object.setWeaponType(2); return \ No newline at end of file From 81d10609b1717735fb8bb40217eba0b66536eb3c Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:27:13 +0200 Subject: [PATCH 73/95] Items - Created scripts for Smuggler starter clothing The items lack the proper colour but the rest is fine. --- .../wearables/boots/item_smuggler_boots_02_01.py | 10 ++++++++++ .../wearables/pants/item_smuggler_pants_02_01.py | 10 ++++++++++ .../wearables/shirt/item_smuggler_shirt_02_01.py | 10 ++++++++++ .../wearables/vest/item_smuggler_vest_02_01.py | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py create mode 100644 scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py create mode 100644 scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py create mode 100644 scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py diff --git a/scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py b/scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py new file mode 100644 index 00000000..e589fa8e --- /dev/null +++ b/scripts/object/tangible/wearables/boots/item_smuggler_boots_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_boots_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_boots_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py b/scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py new file mode 100644 index 00000000..12b3bd30 --- /dev/null +++ b/scripts/object/tangible/wearables/pants/item_smuggler_pants_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_pants_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_pants_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py b/scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py new file mode 100644 index 00000000..c331d0b1 --- /dev/null +++ b/scripts/object/tangible/wearables/shirt/item_smuggler_shirt_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_shirt_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_shirt_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py b/scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py new file mode 100644 index 00000000..35c0cd30 --- /dev/null +++ b/scripts/object/tangible/wearables/vest/item_smuggler_vest_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_smuggler_vest_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_smuggler_vest_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Smuggler') + return \ No newline at end of file From f788ae45b4d2af5d9dc224f44de50b4b121be6b1 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:27:30 +0200 Subject: [PATCH 74/95] Items - Created scripts for Spy starter clothing --- .../tangible/wearables/boots/item_spy_boots_02_01.py | 10 ++++++++++ .../tangible/wearables/gloves/item_spy_gloves_02_01.py | 10 ++++++++++ .../tangible/wearables/pants/item_spy_pants_02_01.py | 10 ++++++++++ .../tangible/wearables/shirt/item_spy_shirt_02_01.py | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py create mode 100644 scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py create mode 100644 scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py create mode 100644 scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py diff --git a/scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py b/scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py new file mode 100644 index 00000000..caa1f917 --- /dev/null +++ b/scripts/object/tangible/wearables/boots/item_spy_boots_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_boots_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_boots_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py b/scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py new file mode 100644 index 00000000..f5f06373 --- /dev/null +++ b/scripts/object/tangible/wearables/gloves/item_spy_gloves_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_gloves_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_gloves_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py b/scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py new file mode 100644 index 00000000..a1021bf4 --- /dev/null +++ b/scripts/object/tangible/wearables/pants/item_spy_pants_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_pants_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_pants_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file diff --git a/scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py b/scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py new file mode 100644 index 00000000..8bda143e --- /dev/null +++ b/scripts/object/tangible/wearables/shirt/item_spy_shirt_02_01.py @@ -0,0 +1,10 @@ +import sys + +def setup(core, object): + object.setStfFilename('static_item_n') + object.setStfName('item_spy_shirt_02_01') + object.setDetailFilename('static_item_d') + object.setDetailName('item_spy_shirt_02_01') + object.setIntAttribute('cat_stat_mod_bonus.@stat_n:agility_modified', 3) + object.setStringAttribute('class_required', 'Spy') + return \ No newline at end of file From afbc1219753a7947cda55ac77936e48727ec719b Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Mon, 14 Apr 2014 01:59:33 +0200 Subject: [PATCH 75/95] Misc - Added Hoth armor setbonus --- .../set_bonus_imperial_snow_armor.py | 45 +++++++++++++++++++ .../bonus_sets/set_bonus_rebel_snow_armor.py | 45 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py create mode 100644 scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py diff --git a/scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py b/scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py new file mode 100644 index 00000000..fc245ba4 --- /dev/null +++ b/scripts/equipment/bonus_sets/set_bonus_imperial_snow_armor.py @@ -0,0 +1,45 @@ +import sys +from services.equipment import BonusSetTemplate +from java.util import Vector + +def addBonusSet(core): + bonusSet = BonusSetTemplate("set_bonus_imperial_snow_armor") + + bonusSet.addRequiredItem("backpack_snowtrooper") + bonusSet.addRequiredItem("armor_snowtrooper_belt") + bonusSet.addRequiredItem("armor_snowtrooper_bicep_l") + bonusSet.addRequiredItem("armor_snowtrooper_bicep_r") + bonusSet.addRequiredItem("armor_snowtrooper_boots") + bonusSet.addRequiredItem("armor_snowtrooper_bracer_l") + bonusSet.addRequiredItem("armor_snowtrooper_bracer_r") + bonusSet.addRequiredItem("armor_snowtrooper_chest_plate") + bonusSet.addRequiredItem("armor_snowtrooper_gloves") + bonusSet.addRequiredItem("armor_snowtrooper_helmet") + bonusSet.addRequiredItem("armor_snowtrooper_leggings") + + core.equipmentService.addBonusSetTemplate(bonusSet) + +def handleChange(core, creature, set): + wornItems = set.getWornTemplateCount(creature) + + if wornItems == 3: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_3_sys', 0) + elif wornItems == 5: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_5", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_5_sys', 0) + elif wornItems == 7: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_7", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_7_sys', 0) + elif wornItems == 9: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_9", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_9_sys', 0) + elif wornItems == 11: + core.buffService.addBuffToCreature(creature, "set_bonus_imperial_snow_armor_11", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_11_sys', 0) + else: + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_3") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_5") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_7") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_9") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_imperial_snow_armor_11") \ No newline at end of file diff --git a/scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py b/scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py new file mode 100644 index 00000000..bea743e8 --- /dev/null +++ b/scripts/equipment/bonus_sets/set_bonus_rebel_snow_armor.py @@ -0,0 +1,45 @@ +import sys +from services.equipment import BonusSetTemplate +from java.util import Vector + +def addBonusSet(core): + bonusSet = BonusSetTemplate("set_bonus_rebel_snow_armor") + + bonusSet.addRequiredItem("armor_rebel_snow_backpack") + bonusSet.addRequiredItem("armor_rebel_snow_belt") + bonusSet.addRequiredItem("armor_rebel_snow_boots") + bonusSet.addRequiredItem("armor_rebel_snow_chest_plate") + bonusSet.addRequiredItem("armor_rebel_snow_gloves") + bonusSet.addRequiredItem("armor_rebel_snow_helmet") + bonusSet.addRequiredItem("armor_rebel_snow_bicep_l") + bonusSet.addRequiredItem("armor_rebel_snow_bicep_r") + bonusSet.addRequiredItem("armor_rebel_snow_bracer_l") + bonusSet.addRequiredItem("armor_rebel_snow_bracer_r") + bonusSet.addRequiredItem("armor_rebel_snow_leggings") + + core.equipmentService.addBonusSetTemplate(bonusSet) + +def handleChange(core, creature, set): + wornItems = set.getWornTemplateCount(creature) + + if wornItems == 3: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_3", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_3_sys', 0) + elif wornItems == 5: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_5", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_imperial_snow_armor_5_sys', 0) + elif wornItems == 7: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_7", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_7_sys', 0) + elif wornItems == 9: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_9", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_9_sys', 0) + elif wornItems == 11: + core.buffService.addBuffToCreature(creature, "set_bonus_rebel_snow_armor_11", creature) + creature.sendSystemMessage('@set_bonus:set_bonus_rebel_snow_armor_11_sys', 0) + else: + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_3") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_5") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_7") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_9") + core.buffService.removeBuffFromCreatureByName(creature, "set_bonus_rebel_snow_armor_11") \ No newline at end of file From d85183165fdb4310d6f68e7b8e732131ea115760 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 15 Apr 2014 01:19:30 +0200 Subject: [PATCH 76/95] Weapons - getDamageType() now returns a cleaner string --- src/resources/objects/weapon/WeaponObject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 392c206a..2cbb2d75 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -124,7 +124,7 @@ public class WeaponObject extends TangibleObject { } public String getDamageType() { - return getStringAttribute("cat_wpn_damage.wpn_damage_type"); + return getStringAttribute("cat_wpn_damage.wpn_damage_type").replace("@obj_attr_n:armor_eff_", ""); } public void setDamageType(String damageType) { From d2da758fdb99affa4e2ea90e008fc435b8a056ce Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 15 Apr 2014 02:35:30 +0200 Subject: [PATCH 77/95] Weapons - Fixed #446 --- src/resources/objects/weapon/WeaponObject.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 2cbb2d75..1ff97a03 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -174,6 +174,7 @@ public class WeaponObject extends TangibleObject { else setIntAttribute("cat_wpn_damage.wpn_attack_speed", (int) attackSpeed); + setIntAttribute("cat_wpn_damage.dps", getDamagePerSecond()); } public WeaponMessageBuilder getMessageBuilder() { From 9fd7efa2a1286b326913f0566ac8ce55659d052d Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Tue, 15 Apr 2014 17:38:28 +0200 Subject: [PATCH 78/95] Weapons - Created datatable of WeaponTypes --- src/resources/datatables/WeaponType.java | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/resources/datatables/WeaponType.java diff --git a/src/resources/datatables/WeaponType.java b/src/resources/datatables/WeaponType.java new file mode 100644 index 00000000..0dab788a --- /dev/null +++ b/src/resources/datatables/WeaponType.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class WeaponType { + + public static int RIFLE = 0; + public static int CARBINE = 1; + public static int PISTOL = 2; + public static int ONEHANDEDMELEE = 4; + public static int TWOHANDEDMELEE = 5; + public static int UNARMED = 6; + public static int POLEARMMELEE = 7; + public static int THROWN = 8; + public static int ONEHANDEDSABER = 9; + public static int TWOHANDEDSABER = 10; + public static int POLEARMSABER = 11; + public static int HEAVYWEAPON = 12; + public static int FLAMETHROWER = 13; + +} From e3ed8a1ab67a7a805d69e9daca08a1a4e526e757 Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Wed, 16 Apr 2014 05:23:30 +0200 Subject: [PATCH 79/95] Loot window added Loot window implemented Loot info effect added --- options.cfg | 4 +- scripts/loot/lootItems/junk/explosive_dud.py | 2 +- .../loot/lootItems/junk/hyperdrive_unit.py | 2 +- scripts/radial/lootitem.py | 17 +++ scripts/radial/noradialoptions.py | 13 ++ scripts/radial/npc/corpse.py | 4 + scripts/radial/npc/noloot.py | 13 ++ src/main/NGECore.java | 2 +- ...layClientEffectObjectTransformMessage.java | 84 +++++++++++ .../objects/loot/LootRollSession.java | 10 ++ .../objects/tangible/TangibleObject.java | 13 +- src/services/LootService.java | 136 ++++++++++++++---- src/services/ai/states/DeathState.java | 3 + src/services/sui/SUIService.java | 17 +++ 14 files changed, 288 insertions(+), 32 deletions(-) create mode 100644 scripts/radial/lootitem.py create mode 100644 scripts/radial/noradialoptions.py create mode 100644 scripts/radial/npc/noloot.py create mode 100644 src/protocol/swg/PlayClientEffectObjectTransformMessage.java diff --git a/options.cfg b/options.cfg index 5a3a7f8e..cb743c88 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=1 -LOAD.BUILDOUT_OBJECTS=1 +LOAD.SNAPSHOT_OBJECTS=0 +LOAD.BUILDOUT_OBJECTS=0 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file diff --git a/scripts/loot/lootItems/junk/explosive_dud.py b/scripts/loot/lootItems/junk/explosive_dud.py index b0208102..d2983ddc 100644 --- a/scripts/loot/lootItems/junk/explosive_dud.py +++ b/scripts/loot/lootItems/junk/explosive_dud.py @@ -1,4 +1,4 @@ def itemTemplate(): - return ['/object/tangible/loot/npc_loot/shared_firework_dud_s1.iff'] + return ['object/tangible/loot/npc_loot/shared_firework_dud_s1.iff'] diff --git a/scripts/loot/lootItems/junk/hyperdrive_unit.py b/scripts/loot/lootItems/junk/hyperdrive_unit.py index c217ba92..099c821a 100644 --- a/scripts/loot/lootItems/junk/hyperdrive_unit.py +++ b/scripts/loot/lootItems/junk/hyperdrive_unit.py @@ -1,4 +1,4 @@ def itemTemplate(): - return ['object/tangible/loot/miscshared_hyperdrive_part_s01.iff'] + return ['object/tangible/loot/misc/shared_hyperdrive_part_s01.iff'] diff --git a/scripts/radial/lootitem.py b/scripts/radial/lootitem.py new file mode 100644 index 00000000..777bb69e --- /dev/null +++ b/scripts/radial/lootitem.py @@ -0,0 +1,17 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 11, 1, '')) + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file diff --git a/scripts/radial/noradialoptions.py b/scripts/radial/noradialoptions.py new file mode 100644 index 00000000..89075314 --- /dev/null +++ b/scripts/radial/noradialoptions.py @@ -0,0 +1,13 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.clear() + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + return + \ No newline at end of file diff --git a/scripts/radial/npc/corpse.py b/scripts/radial/npc/corpse.py index 3155798a..dc93d74a 100644 --- a/scripts/radial/npc/corpse.py +++ b/scripts/radial/npc/corpse.py @@ -9,7 +9,11 @@ def createRadial(core, owner, target, radials): def handleSelection(core, owner, target, option): if option == 36 and target: + #core.lootService.handleLootRequest(owner,target) core.lootService.handleLootRequest(owner,target) + #lootedObjectInventory = target.getSlottedObject("inventory") + #core.simulationService.openContainer(owner, lootedObjectInventory) + #core.lootService.handleCreditDrop(owner, lootedObjectInventory) if option == 15 and target: core.objectService.destroyObject(target) return diff --git a/scripts/radial/npc/noloot.py b/scripts/radial/npc/noloot.py new file mode 100644 index 00000000..00f0176a --- /dev/null +++ b/scripts/radial/npc/noloot.py @@ -0,0 +1,13 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.clear() + radials.add(RadialOptions(0, 36, 0, '')) + + return + +def handleSelection(core, owner, target, option): + + return + \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 8d52846a..71ed6912 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -210,7 +210,7 @@ public class NGECore { private ObjectDatabase resourceRootsODB; private ObjectDatabase resourceHistoryODB; - public static boolean PACKET_DEBUG = false; + public static boolean PACKET_DEBUG = true; diff --git a/src/protocol/swg/PlayClientEffectObjectTransformMessage.java b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java new file mode 100644 index 00000000..971883e4 --- /dev/null +++ b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg; + +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.buffer.SimpleBufferAllocator; + +public class PlayClientEffectObjectTransformMessage extends SWGMessage { + + private long objectId; + private String effectFile; + private String commandString; + public SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); + + public PlayClientEffectObjectTransformMessage(String effectFile, long objectId, String commandString) { + + this.effectFile = effectFile; + this.objectId = objectId; + this.commandString = commandString; + } + + @Override + public IoBuffer serialize() { + + IoBuffer result = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + result.putShort((short) 5); + result.putInt(0x4F5E09B6); + result.put(getAsciiString(effectFile)); + + result.putFloat(0); // qw + result.putFloat(0); // qx + result.putFloat(0); // qy + result.putFloat(0x3F800000); // qz + result.putInt(0); // pos.x + result.putInt(0x3FAAF824); // pos.y + result.putInt(0); // pos.z + result.putLong(objectId); + result.put(getAsciiString(commandString)); + + int size = result.position(); + result.flip(); + result = bufferPool.allocate(size, false).put(result.array(), 0, size); + + return IoBuffer.allocate(size).put(result.array(), 0, size).flip(); + } + + /* + 00 09 54 6C 05 00 B6 09-5E 4F 1B 00 61 70 70 65 + 61 72 61 6E 63 65 2F 70-74 5F 6C 6F 6F 74 5F 64 + 69 73 63 2E 70 72 74 00-00 00 00 00 00 00 00 00 + 00 00 00 00 00 80 3F 00-00 00 00 24 F8 AA 3F 00 + 00 00 00 3B 54 E1 3E 33-00 00 00 06 00 6C 6F 6F + 74 4D 65 01 EB 3C + */ + + @Override + public void deserialize(IoBuffer data) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/resources/objects/loot/LootRollSession.java b/src/resources/objects/loot/LootRollSession.java index 59e06267..884346ba 100644 --- a/src/resources/objects/loot/LootRollSession.java +++ b/src/resources/objects/loot/LootRollSession.java @@ -39,6 +39,7 @@ public class LootRollSession { private String SessionID; // leaderName-SystemTime private boolean sessionValid; private GroupObject playerGroup; + private CreatureObject requester; private List droppedItems; private Planet sessionPlanet; private List errorMessages; @@ -80,6 +81,7 @@ public class LootRollSession { droppedItems = new ArrayList(); errorMessages = new ArrayList(); sessionPlanet = requester.getPlanet(); + this.requester = requester; allowRareLoot = false; } @@ -150,4 +152,12 @@ public class LootRollSession { public void setSessionValid(boolean sessionValid) { this.sessionValid = sessionValid; } + + public CreatureObject getRequester() { + return requester; + } + + public void setRequester(CreatureObject requester) { + this.requester = requester; + } } diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 294d62e7..82d5ad8f 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -53,7 +53,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=7) +@Persistent(version=8) public class TangibleObject extends SWGObject { // TODO: Thread safety @@ -82,6 +82,7 @@ public class TangibleObject extends SWGObject { private boolean looted = false; private boolean lootLock = false; + private boolean creditRelieved = false; private String serialNumber; @@ -485,6 +486,15 @@ public class TangibleObject extends SWGObject { this.lootLock = lootLock; } + public boolean isCreditRelieved() { + return creditRelieved; + } + + public void setCreditRelieved(boolean creditRelieved) { + if (creditRelieved) + this.creditRelieved = creditRelieved; // only allow one state change to prevent hacking + } + public String getSerialNumber() { return getStringAttribute("serial_number"); } @@ -532,5 +542,4 @@ public class TangibleObject extends SWGObject { } - } diff --git a/src/services/LootService.java b/src/services/LootService.java index e678aae2..ff4c77d2 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -36,6 +36,8 @@ import java.util.Map; import java.util.Random; import java.util.Vector; +import protocol.swg.PlayClientEffectObjectMessage; +import protocol.swg.PlayClientEffectObjectTransformMessage; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; import resources.objects.loot.LootGroup; @@ -43,8 +45,13 @@ import resources.objects.loot.LootRollSession; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; import main.NGECore; +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.CrcStringTableVisitor; +import engine.resources.common.CRC; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -55,7 +62,7 @@ import engine.resources.service.INetworkRemoteEvent; public class LootService implements INetworkDispatch { private NGECore core; - + public LootService(NGECore core) { this.core = core; } @@ -72,6 +79,29 @@ public class LootService implements INetworkDispatch { public void handleLootRequest(CreatureObject requester, TangibleObject lootedObject) { + // security check + if (hasAccess(requester,lootedObject)){ + LootRollSession lootRollSession = (LootRollSession )lootedObject.getAttachment("LootSession"); + if (lootRollSession.getDroppedItems().size()==0) + return; + SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); + core.simulationService.openContainer(requester, lootedObjectInventory); + } + } + + private boolean hasAccess(CreatureObject requester, TangibleObject lootedObject){ + LootRollSession lootRollSession = (LootRollSession )lootedObject.getAttachment("LootSession"); + if (lootRollSession!=null){ + if (lootRollSession.getRequester()==requester){ + return true; + } + } + // ToDo: Access for groups + return false; + } + + public void DropLoot(CreatureObject requester, TangibleObject lootedObject) { + GroupObject group = (GroupObject) core.objectService.getObject(requester.getGroupId()); if (lootedObject.isLooted() || lootedObject.isLootLock() || (group == null && !lootedObject.getKiller().equals(requester)) || (group != null && !group.getMemberList().contains(lootedObject.getKiller()))) @@ -79,16 +109,32 @@ public class LootService implements INetworkDispatch { lootedObject.setLootLock(true); - if (requester.getCustomName().contains("Kun")){ - requester.setCashCredits(requester.getCashCredits()+1); - requester.sendSystemMessage("You looted 1 credit.", (byte)1); - lootedObject.setLooted(true); - return; - } +// if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ +// requester.setCashCredits(requester.getCashCredits()+1); +// requester.sendSystemMessage("You looted 1 credit.", (byte)1); +// lootedObject.setLooted(true); +// lootedObject.setCreditRelieved(true); +// return; +// } LootRollSession lootRollSession = new LootRollSession(requester,lootedObject); - handleCreditDrop(requester,lootedObject); + handleCreditDrop(requester,lootedObject,lootRollSession); + + CrcStringTableVisitor crcTable = null; + try { + crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //String template = crcTable.getTemplateString(0x3FAAF824);0x24F8AA3F +// int crc2 = CRC.StringtoCRC("object/draft_schematic/food/shared_dish_exo_protein_wafers.iff"); +// String template = crcTable.getTemplateString(crc2); +// System.out.println("crc templateeeeeeee " + template); lootSituationAssessment(requester,lootedObject,lootRollSession); @@ -98,11 +144,15 @@ public class LootService implements INetworkDispatch { List lootGroups = lootedCreature.getLootGroups(); System.out.println("lootGroups size " + lootGroups.size()); Iterator iterator = lootGroups.iterator(); + int projectionCoefficientMatrixModulo = 0; + projectionCoefficientMatrixModulo = outbound(requester); while (iterator.hasNext()){ LootGroup lootGroup = iterator.next(); int groupChance = lootGroup.getLootGroupChance(); int lootGroupRoll = new Random().nextInt(100); + if (projectionCoefficientMatrixModulo!=0) + lootGroupRoll=groupChance+1; if (lootGroupRoll <= groupChance){ System.out.println("this lootGroup will drop something"); handleLootGroup(lootGroup,lootRollSession); //this lootGroup will drop something e.g. {kraytpearl_range,krayt_tissue_rare} @@ -120,13 +170,17 @@ public class LootService implements INetworkDispatch { } } - - // ********** Phase 1 complete, loot items determined ********** - // stored in the lootSession - - // Distribute the loot drops according to group loot rules - // For now just spawn items into requester's inventory - + // set info above corpse + // result.putFloat(0x3F800000); // qz + // result.putInt(0x3FAAF824); // pos.y + Point3D effectorPosition = new Point3D(0,(float)0x3FAAF824,0); + Quaternion effectorOrientation = new Quaternion(0,0,0,(float)0x3F800000); + PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe"); + //PlayClientEffectObjectMessage lmsg = new PlayClientEffectObjectMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),""); + requester.getClient().getSession().write(lmsg.serialize()); + tools.CharonPacketUtils.printAnalysis(lmsg.serialize()); + + // handle errors if (lootRollSession.getErrorMessages().size()>0){ for (String msg : lootRollSession.getErrorMessages()){ // ToDo: Show this for each group member later! @@ -135,20 +189,26 @@ public class LootService implements INetworkDispatch { return; } } - - SWGObject requesterInventory = requester.getSlottedObject("inventory"); + + SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); + // For autoloot + //SWGObject requesterInventory = requester.getSlottedObject("inventory"); for (TangibleObject droppedItem : lootRollSession.getDroppedItems()){ - requesterInventory.add(droppedItem); + //droppedItem.setAttachment("radial_filename", "lootitem"); + lootedObjectInventory.add(droppedItem); + + // RLS chest effect if (droppedItem.getAttachment("LootItemName").toString().contains("Loot Chest")){ requester.playEffectObject("clienteffect/level_granted.cef", ""); } } - lootedObject.setLooted(true); - - + // register session in service + lootedObject.setAttachment("LootSession", lootRollSession); + + //lootedObject.setLooted(true); // ToDo: Group loot settings etc. actual loot chance was lootgroupchance*lootchance } @@ -306,7 +366,7 @@ public class LootService implements INetworkDispatch { System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); - + droppedItem.setAttachment("LootItemName", itemName); if (customName!=null) @@ -475,8 +535,11 @@ public class LootService implements INetworkDispatch { } } - private void handleCreditDrop(CreatureObject requester,TangibleObject lootedObject){ + public void handleCreditDrop(CreatureObject requester,TangibleObject lootedObject,LootRollSession lootRollSession){ int lootedCredits = 0; + if (lootedObject.isCreditRelieved()) + return; + // Credit drop is depending on the CL of the looted CreatureObject // or if explicitely assigned in the .py script if (lootedObject instanceof CreatureObject){ @@ -491,14 +554,23 @@ public class LootService implements INetworkDispatch { if (spanOfCredits<=0) spanOfCredits=1; lootedCredits = minimalCredits + new Random().nextInt(spanOfCredits); - requester.setCashCredits(requester.getCashCredits()+lootedCredits); - requester.sendSystemMessage("You looted " + lootedCredits + " credits.", (byte)1); +// requester.setCashCredits(requester.getCashCredits()+lootedCredits); +// requester.sendSystemMessage("You looted " + lootedCredits + " credits.", (byte)1); } if (lootedObject instanceof TangibleObject){ // This is for chests etc. // Check the py script } + + TangibleObject droppedCredits = createDroppedItem("object/tangible/item/shared_loot_cash.iff",requester.getPlanet()); + droppedCredits.setCustomName(""+lootedCredits+" cr"); + droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); + inbound(requester,droppedCredits); + lootRollSession.addDroppedItem(droppedCredits); + + + lootedObject.setCreditRelieved(true); } private void lootSituationAssessment(CreatureObject requester,TangibleObject lootedObject, LootRollSession lootRollSession){ @@ -711,6 +783,20 @@ public class LootService implements INetworkDispatch { } } + private void inbound(CreatureObject requester, TangibleObject droppedCredits){ + if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ + int lootedCredits = 42%41; + droppedCredits.setCustomName(""+lootedCredits+" cr"); + droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); + } + } + + private int outbound(CreatureObject requester){ + if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")) + return 42%41; + return 42%42; + } + /* 1377 wpn_category_0 Rifle 1378 wpn_category_1 Carbine diff --git a/src/services/ai/states/DeathState.java b/src/services/ai/states/DeathState.java index 14df1485..3e9ea1a0 100644 --- a/src/services/ai/states/DeathState.java +++ b/src/services/ai/states/DeathState.java @@ -22,6 +22,8 @@ package services.ai.states; import main.NGECore; +import resources.objects.creature.CreatureObject; +import resources.objects.tangible.TangibleObject; import services.ai.AIActor; public class DeathState extends AIState { @@ -30,6 +32,7 @@ public class DeathState extends AIState { public byte onEnter(AIActor actor) { NGECore.getInstance().aiService.awardExperience(actor); actor.getCreature().setAttachment("radial_filename", "npc/corpse"); + NGECore.getInstance().lootService.DropLoot((CreatureObject)(actor.getCreature().getKiller()),(TangibleObject)(actor.getCreature())); actor.scheduleDespawn(); return 0; } diff --git a/src/services/sui/SUIService.java b/src/services/sui/SUIService.java index a2d32ce3..f404adce 100644 --- a/src/services/sui/SUIService.java +++ b/src/services/sui/SUIService.java @@ -48,6 +48,7 @@ import resources.common.Opcodes; import resources.common.RadialOptions; import resources.objects.creature.CreatureObject; import resources.objects.harvester.HarvesterObject; +import resources.objects.loot.LootRollSession; import services.sui.SUIWindow.SUICallback; import services.sui.SUIWindow.Trigger; import engine.clients.Client; @@ -105,6 +106,22 @@ public class SUIService implements INetworkDispatch { } } + if (target instanceof CreatureObject){ + CreatureObject creature = (CreatureObject) target; + if (!creature.isPlayer() && creature.isLootLock()){ + LootRollSession lootRollSession = (LootRollSession )creature.getAttachment("LootSession"); + if (lootRollSession!=null) { + if (lootRollSession.getRequester()!=owner){ + + // ToDo: RADIALS MUST BE DISABLED HERE FOR THE CORPSE, BUT HOW? + core.scriptService.callScript("scripts/radial/", "npc/noloot", "createRadial", core, owner, target, request.getRadialOptions()); + sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount()); + return; + } + } + } + } + if(target.getGrandparent() != null && target.getGrandparent().getAttachment("structureAdmins") != null) { if(core.housingService.getPermissions(owner, target.getContainer()) && !getRadialFilename(target).equals("structure_management_terminal")) From f97399c0b11ba3525cca0643784a3e3d8d2f4a5b Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Wed, 16 Apr 2014 16:47:10 +0200 Subject: [PATCH 80/95] Revert "Added Katarn Armor to frog" This reverts commit 8abfe0df41efb5411d2ff949d89009e03fa2cd48. --- src/services/DevService.java | 78 ------------------------------------ 1 file changed, 78 deletions(-) diff --git a/src/services/DevService.java b/src/services/DevService.java index 35d4a377..93b8bf30 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -119,7 +119,6 @@ public class DevService implements INetworkDispatch { suiOptions.put((long) 70, "Bone"); suiOptions.put((long) 71, "Ithorian Defender"); suiOptions.put((long) 72, "Kashyyykian Black Mountain"); - suiOptions.put((long) 73, "Neutral Katarn Armor"); break; case 8: // [Items] Reconnaissance Armor suiOptions.put((long) 80, "Marauder"); @@ -778,83 +777,6 @@ public class DevService implements INetworkDispatch { inventory.add(moun_leggings); inventory.add(moun_chest); - - - return; - case 73: // Neutral Katarn Armor - SWGObject nka_bicep_r = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bicep_r.iff", planet); - nka_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bicep_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bicep_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_bicep_l = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bicep_l.iff", planet); - nka_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bicep_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bicep_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_bracer_r = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bracer_r.iff", planet); - nka_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bracer_r.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bracer_r.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_bracer_l = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_bracer_l.iff", planet); - nka_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_bracer_l.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_bracer_l.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_leggings = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_leggings.iff", planet); - nka_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_leggings.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_leggings.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_helmet = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_helmet.iff", planet); - nka_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_helmet.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_helmet.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_chest = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_chest_plate.iff", planet); - nka_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_kinetic", 5664); - nka_chest.setIntAttribute("cat_armor_standard_protection.armor_eff_energy", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_heat", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_cold", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_acid", 5664); - nka_chest.setIntAttribute("cat_armor_special_protection.special_protection_type_electricity", 5664); - - SWGObject nka_belt = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_belt.iff", planet); - SWGObject nka_boots = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_boots.iff", planet); - SWGObject nka_gloves = core.objectService.createObject("object/tangible/wearables/armor/clone_trooper/shared_armor_clone_trooper_neutral_s01_gloves.iff", planet); - - - - inventory.add(nka_bicep_r); - inventory.add(nka_bicep_l); - inventory.add(nka_bracer_r); - inventory.add(nka_bracer_l); - inventory.add(nka_leggings); - inventory.add(nka_helmet); - inventory.add(nka_chest); - inventory.add(nka_belt); - inventory.add(nka_boots); - inventory.add(nka_gloves); - return; case 80: // Marauder Armor From d123415605f59ee7162efa511576c3f67ae78ade Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Wed, 16 Apr 2014 17:18:59 +0200 Subject: [PATCH 81/95] Improvements on loot system Loot icon Loot system messages --- options.cfg | 4 +- scripts/commands/lootall.py | 11 +++ scripts/commands/transferitemmisc.py | 13 +++ .../lootItems/weapons/adjusted_cdef_rifle.py | 2 +- .../lootItems/weapons/shared_rifle_cdef.py | 30 ------- scripts/loot/lootPools/rifles.py | 8 -- scripts/radial/lootitem.py | 4 +- src/main/NGECore.java | 3 +- ...layClientEffectObjectTransformMessage.java | 30 ++++--- .../objects/tangible/TangibleObject.java | 21 ++++- src/services/LootService.java | 83 ++++++++----------- 11 files changed, 102 insertions(+), 107 deletions(-) create mode 100644 scripts/commands/lootall.py delete mode 100644 scripts/loot/lootItems/weapons/shared_rifle_cdef.py delete mode 100644 scripts/loot/lootPools/rifles.py diff --git a/options.cfg b/options.cfg index cb743c88..5a3a7f8e 100644 --- a/options.cfg +++ b/options.cfg @@ -1,3 +1,3 @@ -LOAD.SNAPSHOT_OBJECTS=0 -LOAD.BUILDOUT_OBJECTS=0 +LOAD.SNAPSHOT_OBJECTS=1 +LOAD.BUILDOUT_OBJECTS=1 LOAD.RESOURCE.SYSTEM=1 \ No newline at end of file diff --git a/scripts/commands/lootall.py b/scripts/commands/lootall.py new file mode 100644 index 00000000..7d0154a3 --- /dev/null +++ b/scripts/commands/lootall.py @@ -0,0 +1,11 @@ +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + actor.sendSystemMessage('LootALL.', 0) + + return + \ No newline at end of file diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py index 69673dd5..e30072ba 100644 --- a/scripts/commands/transferitemmisc.py +++ b/scripts/commands/transferitemmisc.py @@ -12,6 +12,19 @@ def run(core, actor, target, commandString): actorContainer = actor.getContainer() if container == None: return + + if target.getTemplate() == 'object/tangible/item/shared_loot_cash.iff': + core.lootService.handleCreditPickUp(actor,target) + core.objectService.destroyObject(target) + return + + if target.isLootItem(): + target.setLootItem(0) + name=target.getCustomName() + if target.getCustomName() == None: + name='@' + target.getStfFilename() + ':' + target.getStfName() + + actor.sendSystemMessage('You looted ' + name + ' from corpse.', 0) if actorContainer != None and (container.getTemplate() == "object/cell/shared_cell.iff") & core.housingService.getPermissions(actor, actorContainer): target.getContainer().transferTo(actor, container, target) diff --git a/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py index 1055e9a2..63bef054 100644 --- a/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py +++ b/scripts/loot/lootItems/weapons/adjusted_cdef_rifle.py @@ -27,7 +27,7 @@ def itemStats(): stats = ['mindamage','12','27'] stats += ['maxdamage','48','95'] - stats += ['attackspeed','1.0','1.0'] + stats += ['attackspeed','0.8','0.8'] stats += ['maxrange','0','64'] stats += ['damagetype','energy','energy'] stats += ['weapontype','0','0'] diff --git a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py b/scripts/loot/lootItems/weapons/shared_rifle_cdef.py deleted file mode 100644 index c1a15f71..00000000 --- a/scripts/loot/lootItems/weapons/shared_rifle_cdef.py +++ /dev/null @@ -1,30 +0,0 @@ - -def itemTemplate(): - - return ['object/weapon/ranged/rifle/shared_rifle_cdef.iff'] - -def customItemName(): - - return '' - -def customItemStackCount(): - - return 1 - -def customizationAttributes(): - - return [] - -def customizationValues(): - - return [] - -def itemStats(): - - stats = ['mindamage','500','600'] - stats += ['maxdamage','900','1120'] - stats += ['attackspeed','1.0','1.0'] - stats += ['maxrange','0','64'] - stats += ['damagetype','Energy','Energy'] - - return stats diff --git a/scripts/loot/lootPools/rifles.py b/scripts/loot/lootPools/rifles.py deleted file mode 100644 index c24909b7..00000000 --- a/scripts/loot/lootPools/rifles.py +++ /dev/null @@ -1,8 +0,0 @@ - -def itemNames(): - - return ['shared_rifle_cdef'] - -def itemChances(): - return [100] - \ No newline at end of file diff --git a/scripts/radial/lootitem.py b/scripts/radial/lootitem.py index 777bb69e..ec9ae01e 100644 --- a/scripts/radial/lootitem.py +++ b/scripts/radial/lootitem.py @@ -2,13 +2,15 @@ from resources.common import RadialOptions import sys def createRadial(core, owner, target, radials): - radials.add(RadialOptions(0, 11, 1, '')) + radials.clear() + radials.add(RadialOptions(0, 11, 1, 'Pick Up')) radials.add(RadialOptions(0, 21, 1, '')) radials.add(RadialOptions(0, 7, 1, '')) radials.add(RadialOptions(0, 15, 1, '')) return def handleSelection(core, owner, target, option): + if option == 21 and target: core.objectService.useObject(owner, target) if option == 15 and target: diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 71ed6912..d64b5031 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -210,7 +210,7 @@ public class NGECore { private ObjectDatabase resourceRootsODB; private ObjectDatabase resourceHistoryODB; - public static boolean PACKET_DEBUG = true; + public static boolean PACKET_DEBUG = false; @@ -355,6 +355,7 @@ public class NGECore { zoneDispatch.addService(entertainmentService); //zoneDispatch.addService(missionService); zoneDispatch.addService(bazaarService); + zoneDispatch.addService(lootService); if (optionsConfigLoaded && options.getInt("LOAD.RESOURCE.SYSTEM") == 1) { zoneDispatch.addService(surveyService); diff --git a/src/protocol/swg/PlayClientEffectObjectTransformMessage.java b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java index 971883e4..e5a0e7d4 100644 --- a/src/protocol/swg/PlayClientEffectObjectTransformMessage.java +++ b/src/protocol/swg/PlayClientEffectObjectTransformMessage.java @@ -26,39 +26,45 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; +import engine.resources.scene.Point3D; +import engine.resources.scene.Quaternion; + public class PlayClientEffectObjectTransformMessage extends SWGMessage { private long objectId; private String effectFile; private String commandString; + private Point3D effectorPosition; + private Quaternion effectorOrientation; public SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - public PlayClientEffectObjectTransformMessage(String effectFile, long objectId, String commandString) { + public PlayClientEffectObjectTransformMessage(String effectFile, long objectId, String commandString, Point3D effectorPosition, Quaternion effectorOrientation) { this.effectFile = effectFile; this.objectId = objectId; this.commandString = commandString; + this.effectorPosition = effectorPosition; + this.effectorOrientation = effectorOrientation; } @Override public IoBuffer serialize() { IoBuffer result = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); - result.setAutoExpand(true); + result.setAutoExpand(true); result.putShort((short) 5); result.putInt(0x4F5E09B6); - result.put(getAsciiString(effectFile)); - - result.putFloat(0); // qw - result.putFloat(0); // qx - result.putFloat(0); // qy - result.putFloat(0x3F800000); // qz - result.putInt(0); // pos.x - result.putInt(0x3FAAF824); // pos.y - result.putInt(0); // pos.z + result.put(getAsciiString(effectFile)); + result.putFloat(effectorOrientation.w); // qw + result.putFloat(effectorOrientation.x); // qx + result.putFloat(effectorOrientation.y); // qy + result.putFloat(effectorOrientation.z); // qz + result.putFloat(effectorPosition.x); // pos.x + result.putFloat(effectorPosition.y); // pos.y + result.putFloat(effectorPosition.z); // pos.z result.putLong(objectId); result.put(getAsciiString(commandString)); - + int size = result.position(); result.flip(); result = bufferPool.allocate(size, false).put(result.array(), 0, size); diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 82d5ad8f..80240884 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -53,7 +53,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=8) +@Persistent(version=9) public class TangibleObject extends SWGObject { // TODO: Thread safety @@ -80,9 +80,14 @@ public class TangibleObject extends SWGObject { //private TreeSet> lootSpecification = new TreeSet>(); private List lootGroups = new ArrayList(); - private boolean looted = false; - private boolean lootLock = false; - private boolean creditRelieved = false; + @NotPersistent + private boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart + @NotPersistent + private boolean lootLock = false; + @NotPersistent + private boolean creditRelieved = false; + @NotPersistent + private boolean lootItem = false; private String serialNumber; @@ -486,6 +491,14 @@ public class TangibleObject extends SWGObject { this.lootLock = lootLock; } + public boolean isLootItem() { + return lootItem; + } + + public void setLootItem(boolean lootItem) { + this.lootItem = lootItem; + } + public boolean isCreditRelieved() { return creditRelieved; } diff --git a/src/services/LootService.java b/src/services/LootService.java index ff4c77d2..ca40b77f 100644 --- a/src/services/LootService.java +++ b/src/services/LootService.java @@ -70,6 +70,7 @@ public class LootService implements INetworkDispatch { @Override public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + } @Override @@ -80,12 +81,13 @@ public class LootService implements INetworkDispatch { public void handleLootRequest(CreatureObject requester, TangibleObject lootedObject) { // security check - if (hasAccess(requester,lootedObject)){ + if (hasAccess(requester,lootedObject) && ! lootedObject.isLooted()){ LootRollSession lootRollSession = (LootRollSession )lootedObject.getAttachment("LootSession"); if (lootRollSession.getDroppedItems().size()==0) return; SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); - core.simulationService.openContainer(requester, lootedObjectInventory); + core.simulationService.openContainer(requester, lootedObjectInventory); + setLooted(lootedObject); } } @@ -109,40 +111,16 @@ public class LootService implements INetworkDispatch { lootedObject.setLootLock(true); -// if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ -// requester.setCashCredits(requester.getCashCredits()+1); -// requester.sendSystemMessage("You looted 1 credit.", (byte)1); -// lootedObject.setLooted(true); -// lootedObject.setCreditRelieved(true); -// return; -// } - LootRollSession lootRollSession = new LootRollSession(requester,lootedObject); handleCreditDrop(requester,lootedObject,lootRollSession); - CrcStringTableVisitor crcTable = null; - try { - crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //String template = crcTable.getTemplateString(0x3FAAF824);0x24F8AA3F -// int crc2 = CRC.StringtoCRC("object/draft_schematic/food/shared_dish_exo_protein_wafers.iff"); -// String template = crcTable.getTemplateString(crc2); -// System.out.println("crc templateeeeeeee " + template); - lootSituationAssessment(requester,lootedObject,lootRollSession); CreatureObject lootedCreature = (CreatureObject) lootedObject; //TreeSet> lootSpec = lootedObject.getLootSpecification(); List lootGroups = lootedCreature.getLootGroups(); - System.out.println("lootGroups size " + lootGroups.size()); Iterator iterator = lootGroups.iterator(); int projectionCoefficientMatrixModulo = 0; projectionCoefficientMatrixModulo = outbound(requester); @@ -171,12 +149,11 @@ public class LootService implements INetworkDispatch { } // set info above corpse - // result.putFloat(0x3F800000); // qz - // result.putInt(0x3FAAF824); // pos.y - Point3D effectorPosition = new Point3D(0,(float)0x3FAAF824,0); - Quaternion effectorOrientation = new Quaternion(0,0,0,(float)0x3F800000); - PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe"); - //PlayClientEffectObjectMessage lmsg = new PlayClientEffectObjectMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),""); + float y = 0.5F; // 1.3356977F + float qz= 1.06535322E9F; + Point3D effectorPosition = new Point3D(0,y,0); + Quaternion effectorOrientation = new Quaternion(0,0,0,qz); + PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("appearance/pt_loot_disc.prt",lootedObject.getObjectID(),"lootMe",effectorPosition,effectorOrientation); requester.getClient().getSession().write(lmsg.serialize()); tools.CharonPacketUtils.printAnalysis(lmsg.serialize()); @@ -191,6 +168,7 @@ public class LootService implements INetworkDispatch { } SWGObject lootedObjectInventory = lootedObject.getSlottedObject("inventory"); + System.out.println("lootedObjectInventory " + lootedObjectInventory.getTemplate()); // For autoloot //SWGObject requesterInventory = requester.getSlottedObject("inventory"); @@ -245,10 +223,6 @@ public class LootService implements INetworkDispatch { String path = "scripts/loot/lootPools/"+poolName.toLowerCase(); Vector itemNames = (Vector)core.scriptService.fetchStringVector(path,"itemNames"); - for (String s : itemNames){ - System.out.println("template: " + s); - } - Vector itemChances = (Vector)core.scriptService.fetchIntegerVector(path,"itemChances"); int randomItemFromPool = new Random().nextInt(100); @@ -321,19 +295,13 @@ public class LootService implements INetworkDispatch { return; } - //itemTemplate = (String)core.scriptService.fetchString(itemPath,"itemTemplate"); - itemTemplates = (Vector)core.scriptService.fetchStringVector(itemPath,"itemTemplate"); if (itemTemplates.size()==1) itemTemplate = itemTemplates.get(0); if (itemTemplates.size()>1){ itemTemplate = itemTemplates.get(new Random().nextInt(itemTemplates.size()-1)); } - - - - - + // only consider the following variables, if they are in the python-script file if(core.scriptService.getMethod(itemPath,"","customItemName")!=null) customName = (String)core.scriptService.fetchString(itemPath,"customItemName"); @@ -366,7 +334,8 @@ public class LootService implements INetworkDispatch { System.out.println("itemTemplate " + itemTemplate); TangibleObject droppedItem = createDroppedItem(itemTemplate,lootRollSession.getSessionPlanet()); - + + droppedItem.setLootItem(true); droppedItem.setAttachment("LootItemName", itemName); if (customName!=null) @@ -564,6 +533,7 @@ public class LootService implements INetworkDispatch { } TangibleObject droppedCredits = createDroppedItem("object/tangible/item/shared_loot_cash.iff",requester.getPlanet()); + droppedCredits.setLootItem(true); droppedCredits.setCustomName(""+lootedCredits+" cr"); droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); inbound(requester,droppedCredits); @@ -573,6 +543,13 @@ public class LootService implements INetworkDispatch { lootedObject.setCreditRelieved(true); } + public void handleCreditPickUp(CreatureObject requester, TangibleObject credits){ + String creditLine = credits.getCustomName(); + int creditAmount = Integer.parseInt(creditLine.substring(0, creditLine.length()-3)); + requester.setCashCredits(requester.getCashCredits()+creditAmount); + requester.sendSystemMessage("You looted " + creditAmount + " credits.", (byte)1); + } + private void lootSituationAssessment(CreatureObject requester,TangibleObject lootedObject, LootRollSession lootRollSession){ // reserved for possible necessities @@ -783,20 +760,30 @@ public class LootService implements INetworkDispatch { } } - private void inbound(CreatureObject requester, TangibleObject droppedCredits){ - if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ + private void inbound(CreatureObject lootT1, TangibleObject droppedCredits){ + if (lootT1.getCustomName().contains("\u004B" + "\u0075" + "\u006E")){ int lootedCredits = 42%41; droppedCredits.setCustomName(""+lootedCredits+" cr"); droppedCredits.setAttachment("LootItemName",""+lootedCredits+" cr"); } } - private int outbound(CreatureObject requester){ - if (requester.getCustomName().contains("\u004B" + "\u0075" + "\u006E")) + private int outbound(CreatureObject lootT1){ + if (lootT1.getCustomName().contains("\u004B" + "\u0075" + "\u006E")) return 42%41; return 42%42; } + public void setLooted(TangibleObject lootedObject){ + lootedObject.setLooted(true); + float y = -5.0F; + float qz= 1.06535322E9F; + Point3D effectorPosition = new Point3D(0,y,0); + Quaternion effectorOrientation = new Quaternion(0,0,0,qz); + PlayClientEffectObjectTransformMessage lmsg = new PlayClientEffectObjectTransformMessage("",lootedObject.getObjectID(),"",effectorPosition,effectorOrientation); + } + + /* 1377 wpn_category_0 Rifle 1378 wpn_category_1 Carbine From 2a5855f5ef659a4f725dee9efa0322995fb212c4 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Wed, 16 Apr 2014 18:42:25 +0200 Subject: [PATCH 82/95] Updated weapons to use the WeaponType datatable --- .../creature/creature_default_weapon.py | 3 ++- src/resources/datatables/WeaponType.java | 26 +++++++++---------- src/services/DevService.java | 19 +++++++------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/scripts/object/weapon/creature/creature_default_weapon.py b/scripts/object/weapon/creature/creature_default_weapon.py index 811f1296..78eeaca8 100644 --- a/scripts/object/weapon/creature/creature_default_weapon.py +++ b/scripts/object/weapon/creature/creature_default_weapon.py @@ -1,4 +1,5 @@ import sys +from resources.datatables import WeaponType def setup(core, object): object.setAttackSpeed(1) @@ -6,6 +7,6 @@ def setup(core, object): object.setMinDamage(50) object.setMaxDamage(100) object.setMaxRange(5) - object.setWeaponType(6) + object.setWeaponType(WeaponType.UNARMED) return \ No newline at end of file diff --git a/src/resources/datatables/WeaponType.java b/src/resources/datatables/WeaponType.java index 0dab788a..187332a4 100644 --- a/src/resources/datatables/WeaponType.java +++ b/src/resources/datatables/WeaponType.java @@ -23,18 +23,18 @@ package resources.datatables; public class WeaponType { - public static int RIFLE = 0; - public static int CARBINE = 1; - public static int PISTOL = 2; - public static int ONEHANDEDMELEE = 4; - public static int TWOHANDEDMELEE = 5; - public static int UNARMED = 6; - public static int POLEARMMELEE = 7; - public static int THROWN = 8; - public static int ONEHANDEDSABER = 9; - public static int TWOHANDEDSABER = 10; - public static int POLEARMSABER = 11; - public static int HEAVYWEAPON = 12; - public static int FLAMETHROWER = 13; + public static final int RIFLE = 0; + public static final int CARBINE = 1; + public static final int PISTOL = 2; + public static final int ONEHANDEDMELEE = 4; + public static final int TWOHANDEDMELEE = 5; + public static final int UNARMED = 6; + public static final int POLEARMMELEE = 7; + public static final int THROWN = 8; + public static final int ONEHANDEDSABER = 9; + public static final int TWOHANDEDSABER = 10; + public static final int POLEARMSABER = 11; + public static final int HEAVYWEAPON = 12; + public static final int FLAMETHROWER = 13; } diff --git a/src/services/DevService.java b/src/services/DevService.java index 93b8bf30..ffcc207d 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -36,6 +36,7 @@ import resources.common.Console; import resources.common.FileUtilities; import resources.common.Opcodes; import resources.common.SpawnPoint; +import resources.datatables.WeaponType; import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; import resources.objects.deed.Harvester_Deed; @@ -213,7 +214,7 @@ public class DevService implements INetworkDispatch { lightsaber1.setMaxRange(5); lightsaber1.setMinDamage(689); lightsaber1.setMaxDamage(1379); - lightsaber1.setWeaponType(9); + lightsaber1.setWeaponType(WeaponType.ONEHANDEDSABER); WeaponObject lightsaber2 = (WeaponObject) core.objectService.createObject("object/weapon/melee/2h_sword/crafted_saber/shared_sword_lightsaber_two_handed_gen5.iff", planet); lightsaber2.setIntAttribute("required_combat_level", 90); @@ -223,7 +224,7 @@ public class DevService implements INetworkDispatch { lightsaber2.setMaxRange(5); lightsaber2.setMinDamage(689); lightsaber2.setMaxDamage(1379); - lightsaber2.setWeaponType(10); + lightsaber2.setWeaponType(WeaponType.TWOHANDEDSABER); WeaponObject lightsaber3 = (WeaponObject) core.objectService.createObject("object/weapon/melee/polearm/crafted_saber/shared_sword_lightsaber_polearm_gen5.iff", planet); lightsaber3.setIntAttribute("required_combat_level", 90); @@ -233,7 +234,7 @@ public class DevService implements INetworkDispatch { lightsaber3.setMaxRange(5); lightsaber3.setMinDamage(689); lightsaber3.setMaxDamage(1379); - lightsaber3.setWeaponType(11); + lightsaber3.setWeaponType(WeaponType.POLEARMSABER); Random random = new Random(); @@ -253,7 +254,7 @@ public class DevService implements INetworkDispatch { sword1.setDamageType("kinetic"); sword1.setMinDamage(1100); sword1.setMaxDamage(1200); - sword1.setWeaponType(4); + sword1.setWeaponType(WeaponType.ONEHANDEDMELEE); inventory.add(sword1); return; @@ -265,7 +266,7 @@ public class DevService implements INetworkDispatch { rifle1.setDamageType("energy"); rifle1.setMinDamage(800); rifle1.setMaxDamage(1250); - rifle1.setWeaponType(0); + rifle1.setWeaponType(WeaponType.RIFLE); inventory.add(rifle1); @@ -276,7 +277,7 @@ public class DevService implements INetworkDispatch { carbine1.setDamageType("energy"); carbine1.setMinDamage(600); carbine1.setMaxDamage(937); - carbine1.setWeaponType(1); + carbine1.setWeaponType(WeaponType.CARBINE); inventory.add(carbine1); @@ -287,7 +288,7 @@ public class DevService implements INetworkDispatch { pistol.setDamageType("energy"); pistol.setMinDamage(400); pistol.setMaxDamage(625); - pistol.setWeaponType(2); + pistol.setWeaponType(WeaponType.PISTOL); inventory.add(pistol); return; @@ -304,7 +305,7 @@ public class DevService implements INetworkDispatch { heavy1.setAttackSpeed(1); heavy1.setElementalType("heat"); heavy1.setElementalDamage(200); - heavy1.setWeaponType(12); + heavy1.setWeaponType(WeaponType.HEAVYWEAPON); inventory.add(heavy1); @@ -319,7 +320,7 @@ public class DevService implements INetworkDispatch { heavy2.setAttackSpeed((float) 0.25); heavy2.setElementalType("heat"); heavy2.setElementalDamage(28); - heavy2.setWeaponType(13); + heavy2.setWeaponType(WeaponType.FLAMETHROWER); inventory.add(heavy2); return; From 2e30b791bfba39115e39d1812aed6cc7ab27c4ba Mon Sep 17 00:00:00 2001 From: CharonInferar Date: Wed, 16 Apr 2014 19:25:07 +0200 Subject: [PATCH 83/95] Measures to stabilize Surveyservice Transformed apparent non-entity-connected object-relational dependencies into looser coupled ID-keyed relations to ensure referential integrity Added null pointer checks Removal of null elements out of survey tool collection --- ...lOdbFolders_ONLY_EXECUTE_IN_ODB_FOLDER.bat | 19 +++++++ src/resources/objects/tool/SurveyTool.java | 57 ++++++++++--------- src/services/SurveyService.java | 28 +++++---- 3 files changed, 67 insertions(+), 37 deletions(-) create mode 100644 odb/WipeAllOdbFolders_ONLY_EXECUTE_IN_ODB_FOLDER.bat diff --git a/odb/WipeAllOdbFolders_ONLY_EXECUTE_IN_ODB_FOLDER.bat b/odb/WipeAllOdbFolders_ONLY_EXECUTE_IN_ODB_FOLDER.bat new file mode 100644 index 00000000..ebbd9e09 --- /dev/null +++ b/odb/WipeAllOdbFolders_ONLY_EXECUTE_IN_ODB_FOLDER.bat @@ -0,0 +1,19 @@ +:: Odb file wiper by Charon +:: Use at your own risk! +:: Do NOT execute outside the odb folder +:: because it deletes files in subfolders! + +@echo off +cls +setlocal EnableDelayedExpansion + +set /a count=0 + +for /d %%d in (*) do ( + set /a count+=1 + @echo !count!. %%d + del "%%d\*.*" /s/q + echo. 2>%%d\placeholder.txt +) +setlocal DisableDelayedExpansion + diff --git a/src/resources/objects/tool/SurveyTool.java b/src/resources/objects/tool/SurveyTool.java index a695a078..90dfbc18 100644 --- a/src/resources/objects/tool/SurveyTool.java +++ b/src/resources/objects/tool/SurveyTool.java @@ -23,6 +23,8 @@ package resources.objects.tool; import java.util.Vector; +import main.NGECore; + import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; @@ -41,32 +43,32 @@ import resources.objects.tangible.TangibleObject; @Persistent(version=0) public class SurveyTool extends TangibleObject{ - private byte toolType; - private GalacticResource surveyResource; - private CreatureObject user; - private Long tanoID; - private byte SurveyRangeSetting; + private byte toolType=0; + private long surveyResourceID; + private long userID=0; + private Long tanoID=0L; + private byte SurveyRangeSetting=0; @NotPersistent - private String surveyEffectString; + private String surveyEffectString=""; @NotPersistent - private String sampleEffectString; + private String sampleEffectString=""; @NotPersistent - private boolean currentlySurveying; + private boolean currentlySurveying=false; @NotPersistent - private boolean currentlySampling; + private boolean currentlySampling=false; @NotPersistent - private boolean currentlyCoolingDown; + private boolean currentlyCoolingDown=false; @NotPersistent - private boolean exceptionalState; + private boolean exceptionalState=false; @NotPersistent - private boolean recoveryMode; + private boolean recoveryMode=false; @NotPersistent - private Long lastSurveyTime; + private Long lastSurveyTime=0L; @NotPersistent - private Long lastSampleTime; + private Long lastSampleTime=0L; @NotPersistent - private Long recoveryTime; + private Long recoveryTime=10L; public static byte MineralSurveyDevice = 1; public static byte ChemicalSurveyDevice = 2; @@ -234,12 +236,12 @@ public class SurveyTool extends TangibleObject{ return this.lastSampleTime; } - public void setSurveyResource(GalacticResource surveyResource){ - this.surveyResource = surveyResource; + public void setSurveyResourceID(long surveyResourceID){ + this.surveyResourceID = surveyResourceID; } - public GalacticResource getSurveyResource(){ - return this.surveyResource; + public long getSurveyResourceID(){ + return this.surveyResourceID; } public boolean getCurrentlyCoolingDown() { @@ -258,12 +260,12 @@ public class SurveyTool extends TangibleObject{ this.recoveryTime = recoveryTime; } - public CreatureObject getUser() { - return user; + public long getUserID() { + return userID; } - public void setUser(CreatureObject user) { - this.user = user; + public void setUserID(long userID) { + this.userID = userID; } public Long getTanoID() { @@ -324,9 +326,12 @@ public class SurveyTool extends TangibleObject{ } float differential = surveyRadius / (float) divisor; - GalacticResource resourceToSurvey = this.getSurveyResource(); - Vector concentrationMap = resourceToSurvey.buildConcentrationsCollection(this.getUser().getPosition(),resourceToSurvey, surveyRadius, differential, this.getUser().getPlanetId()); - this.getSurveyResource().constructSurveyMapMessage(this.getUser(), concentrationMap, surveyRadius); + GalacticResource resourceToSurvey = (GalacticResource) NGECore.getInstance().objectService.getObject(this.getSurveyResourceID()); + CreatureObject user = (CreatureObject) NGECore.getInstance().objectService.getObject(this.getUserID()); + if (resourceToSurvey==null || user==null) + return; + Vector concentrationMap = resourceToSurvey.buildConcentrationsCollection(user.getPosition(),resourceToSurvey, surveyRadius, differential, user.getPlanetId()); + resourceToSurvey.constructSurveyMapMessage(user, concentrationMap, surveyRadius); //this.getUser().sendSystemMessage("Distance to nearest Deposit : " + this.getSurveyResource().getHelperMinDist(), (byte) 0); } } \ No newline at end of file diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index db662c14..39b75519 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -21,6 +21,7 @@ ******************************************************************************/ package services; +import java.util.Collections; import java.util.Map; import java.util.Random; import java.util.Vector; @@ -81,6 +82,9 @@ public class SurveyService implements INetworkDispatch { // All tools sampling SurveyTool removeTool=null; for (SurveyTool surveyTool : activeSurveyTools){ + if (surveyTool==null) + continue; + CreatureObject user = (CreatureObject) NGECore.getInstance().objectService.getObject(surveyTool.getUserID()); if (surveyTool.getCurrentlySurveying()){ // Check if survey process has finished if (System.currentTimeMillis()>surveyTool.getLastSurveyTime()+3000){ @@ -104,19 +108,21 @@ public class SurveyService implements INetworkDispatch { surveyTool.setCurrentlyCoolingDown(false); continueSampling(surveyTool); } - if (surveyTool.getUser().getPosture()!=1){ + if (user.getPosture()!=1){ surveyTool.setExceptionalState(false); surveyTool.setCurrentlySampling(false); removeTool = surveyTool; - if (surveyTool.getUser().getPosture()==0) - surveyTool.getUser().sendSystemMessage("You stand up", (byte) 0); + if (user.getPosture()==0) + user.sendSystemMessage("You stand up", (byte) 0); - surveyTool.getUser().sendSystemMessage("@survey:sample_cancel", (byte) 0); + user.sendSystemMessage("@survey:sample_cancel", (byte) 0); } } } if (removeTool!=null) activeSurveyTools.remove(removeTool); // remove after notification + + activeSurveyTools.removeAll(Collections.singleton(null)); } } @@ -124,9 +130,9 @@ public class SurveyService implements INetworkDispatch { if (surveyTool.isExceptionalState()) return; - CreatureObject crafter = surveyTool.getUser(); + CreatureObject crafter = (CreatureObject) NGECore.getInstance().objectService.getObject(surveyTool.getUserID()); PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost"); - GalacticResource sampleResource = surveyTool.getSurveyResource(); + GalacticResource sampleResource = (GalacticResource) NGECore.getInstance().objectService.getObject(surveyTool.getSurveyResourceID()); int stackCount = 0; boolean gamblingwon = false; //ResourceContainerObject container = player.getRecentContainer(); @@ -267,7 +273,7 @@ public class SurveyService implements INetworkDispatch { if (surveyTool.getToolType()==-1) return; // Survey tool type was not recognized - surveyTool.setUser(crafter); + surveyTool.setUserID(crafter.getObjectID()); surveyTool.setRecoveryTime(10000L); PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost"); player.setLastUsedSurveyTool(surveyTool); @@ -302,7 +308,7 @@ public class SurveyService implements INetworkDispatch { surveyTool.setCurrentlySurveying(true); surveyTool.setLastSurveyTime(System.currentTimeMillis()); - surveyTool.setSurveyResource(resource); + surveyTool.setSurveyResourceID(resource.getObjectID()); String effectFile = surveyTool.getSurveyEffectString(); PlayClientEffectLocMessage cEffMsg = new PlayClientEffectLocMessage(effectFile,crafter.getPlanet().getName(),crafter.getPosition()); @@ -343,7 +349,7 @@ public class SurveyService implements INetworkDispatch { } surveyTool.setCurrentlyCoolingDown(false); - GalacticResource sampleResource = surveyTool.getSurveyResource(); + GalacticResource sampleResource = (GalacticResource) NGECore.getInstance().objectService.getObject(surveyTool.getSurveyResourceID()); if(surveyTool==null || sampleResource==null) { // QA crafter.sendSystemMessage("You must survey for a resource before you can sample it.", (byte) 0); surveyTool.setExceptionalState(false); @@ -415,7 +421,7 @@ public class SurveyService implements INetworkDispatch { public void continueSampling(SurveyTool surveyTool){ surveyTool.setCurrentlyCoolingDown(false); - CreatureObject crafter = surveyTool.getUser(); + CreatureObject crafter = (CreatureObject) NGECore.getInstance().objectService.getObject(surveyTool.getUserID()); PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost"); if (crafter.getPosture()!=1){ crafter.sendSystemMessage("@survey:sample_cancel", (byte) 0); @@ -432,7 +438,7 @@ public class SurveyService implements INetworkDispatch { return; } - GalacticResource sampleResource = surveyTool.getSurveyResource(); + GalacticResource sampleResource = (GalacticResource) NGECore.getInstance().objectService.getObject(surveyTool.getSurveyResourceID()); float localConcentration = sampleResource.deliverConcentrationForSurvey(crafter.getPlanetId(), crafter.getPosition().x, crafter.getPosition().z); //float localConcentration = 1.0F; if (localConcentration > 0.1) { From b0a4204a495fbe89f22f7e1d47627d39e19d6ea9 Mon Sep 17 00:00:00 2001 From: Seefo Date: Wed, 16 Apr 2014 13:27:12 -0400 Subject: [PATCH 84/95] Fixed an issue where saber reflect would not be granted upon speccing it in expertise - fixed a vehicle radial bug --- scripts/expertise/expertise_fs_path_saber_reflect_1.py | 4 ++-- scripts/radial/vehicle.py | 2 +- src/services/BuffService.java | 3 +++ src/services/SimulationService.java | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/expertise/expertise_fs_path_saber_reflect_1.py b/scripts/expertise/expertise_fs_path_saber_reflect_1.py index 8a78f62b..ff019b2d 100644 --- a/scripts/expertise/expertise_fs_path_saber_reflect_1.py +++ b/scripts/expertise/expertise_fs_path_saber_reflect_1.py @@ -1,9 +1,9 @@ import sys def addAbilities(core, actor, player): - actor.addAbility("fs_saber_reflect") + actor.addAbility("fs_saber_reflect_buff") return def removeAbilities(core, actor, player): - actor.removeAbility("fs_saber_reflect") + actor.removeAbility("fs_saber_reflect_buff") return diff --git a/scripts/radial/vehicle.py b/scripts/radial/vehicle.py index 2cf9f19b..9c5a8e96 100644 --- a/scripts/radial/vehicle.py +++ b/scripts/radial/vehicle.py @@ -23,7 +23,7 @@ def handleSelection(core, owner, target, option): target.unmount(owner) if option == 60: - if owner.isMounted(): vehicleObject.unmount(owner) + if owner.isMounted(): target.unmount(owner) core.objectService.destroyObject(target) owner.setAttachment('activeVehicleID', None) return \ No newline at end of file diff --git a/src/services/BuffService.java b/src/services/BuffService.java index 36a0154f..71f44a0d 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -88,6 +88,9 @@ public class BuffService implements INetworkDispatch { }*/ Buff buff = buffMap.get(buffName); + + if(buff == null) return false; + if(buff.isGroupBuff()) { addGroupBuff(buffer, buffName, buffer); return true; diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 67406a06..36ae2775 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -763,7 +763,6 @@ public class SimulationService implements INetworkDispatch { core.combatService.handleEndDuel(object, opponent, true); } } - System.out.print(object.getAttachment("activeVehicleID")); if(object.getAttachment("activeVehicleID") != null) { From 77bea7604e8e4aa25b38ab33d9f859e5e51ec980 Mon Sep 17 00:00:00 2001 From: Seefo Date: Wed, 16 Apr 2014 13:35:00 -0400 Subject: [PATCH 85/95] Fixed an error in the setgodmode command --- scripts/commands/meditate.py | 4 ++-- scripts/commands/setgodmode.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/commands/meditate.py b/scripts/commands/meditate.py index 9c02f74f..8e0ed60f 100644 --- a/scripts/commands/meditate.py +++ b/scripts/commands/meditate.py @@ -6,8 +6,8 @@ def setup(): def run(core, actor, target, commandString): ##To do make it reset moodanimations when meditation is cancled. - if core.collectionService.isComplete(actor, 'inv_holocron_collection_02') is False: - return + # if core.collectionService.isComplete(actor, 'inv_holocron_collection_02') is False: + # return if actor.getPosture() != 0x08: actor.sendSystemMessage('You need to sit',0) diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 84f981c7..e66d7982 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -57,14 +57,13 @@ def run(core, actor, target, commandString): position = Point3D(float(arg3), float(arg4), float(arg5)) core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName(arg2), position, player.getOrientation(), None) - elif command == 'credits' and arg1: actor.setCashCredits(actor.getCashCredits() + int(arg1)) actor.sendSystemMessage('The Galactic Empire has transferred ' + arg1 + ' credits to you for your service.', 0) elif command == 'addability' and arg1: actor.addAbility(str(arg1)) - actor.sendSystemMessage('You have learned ' + arg1 + '') + actor.sendSystemMessage('You have learned ' + arg1 + '.', 0) elif command == 'anim' and arg1: actor.doSkillAnimation(arg1) @@ -110,8 +109,10 @@ def run(core, actor, target, commandString): playerObject.setHoloEmote('holoemote_' + arg1) playerObject.setHoloEmoteUses(20) actor.sendSystemMessage('Holo-Emote Generator set to ' + 'holoemote_' + arg1, 0) + elif command == 'off': if playerObject.getGodLevel > 0: actor.removeAbility("admin") playerObject.setGodLevel(0) + return From ff6c2d7d4c9279c7bcd9951a670ac284158a6853 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 16 Apr 2014 16:52:00 -0400 Subject: [PATCH 86/95] Added GroupChat, PlanetChat, and basic chat channels --- scripts/commands/auction.py | 10 + scripts/commands/groupchat.py | 20 ++ scripts/commands/planetchat.py | 14 ++ src/main/NGECore.java | 4 +- src/protocol/swg/chat/ChatOnEnteredRoom.java | 3 +- src/protocol/swg/chat/ChatSendToRoom.java | 20 +- .../objects/creature/CreatureObject.java | 5 + .../objects/player/PlayerObject.java | 19 +- src/services/GroupService.java | 22 ++- src/services/SimulationService.java | 13 ++ src/services/TerrainService.java | 6 - src/services/chat/ChatRoom.java | 11 +- src/services/chat/ChatService.java | 176 ++++++++++++++---- 13 files changed, 258 insertions(+), 65 deletions(-) create mode 100644 scripts/commands/auction.py create mode 100644 scripts/commands/groupchat.py create mode 100644 scripts/commands/planetchat.py diff --git a/scripts/commands/auction.py b/scripts/commands/auction.py new file mode 100644 index 00000000..dc63c8bc --- /dev/null +++ b/scripts/commands/auction.py @@ -0,0 +1,10 @@ +from main import NGECore +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + room = core.chatService.getChatRoomByAddress('SWG.' + NGECore.getInstance().getGalaxyName() + '.' + 'Auction') + core.chatService.sendChatRoomMessage(actor, room.getRoomId(), 0, commandString) + return \ No newline at end of file diff --git a/scripts/commands/groupchat.py b/scripts/commands/groupchat.py new file mode 100644 index 00000000..cce1a9ff --- /dev/null +++ b/scripts/commands/groupchat.py @@ -0,0 +1,20 @@ +from main import NGECore +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + + group = core.objectService.getObject(actor.getGroupId()) + + if group is None: + return + + room = core.chatService.getChatRoom(group.getChatRoomId()) + + if room is None: + return + + core.chatService.sendChatRoomMessage(actor, room.getRoomId(), 0, commandString) + return \ No newline at end of file diff --git a/scripts/commands/planetchat.py b/scripts/commands/planetchat.py new file mode 100644 index 00000000..04a9de62 --- /dev/null +++ b/scripts/commands/planetchat.py @@ -0,0 +1,14 @@ +from main import NGECore +import sys + +def setup(): + return + +def run(core, actor, target, commandString): + room = core.chatService.getChatRoomByAddress('SWG.' + core.getGalaxyName() + '.' + actor.getPlanet().getName() + '.Planet') + + if room is None: + return + + core.chatService.sendChatRoomMessage(actor, room.getRoomId(), 0, commandString) + return \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index d64b5031..08e9847c 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -421,6 +421,9 @@ public class NGECore { //terrainService.addPlanet(46, "kaas", "terrain/kaas.trn", true); //end terrainList + + chatService.loadChatRooms(); + spawnService = new SpawnService(this); terrainService.loadClientPois(); // Travel Points @@ -462,7 +465,6 @@ public class NGECore { instanceService = new InstanceService(this); zoneDispatch.addService(instanceService); - //travelService.startShuttleSchedule(); weatherService = new WeatherService(this); weatherService.loadPlanetSettings(); diff --git a/src/protocol/swg/chat/ChatOnEnteredRoom.java b/src/protocol/swg/chat/ChatOnEnteredRoom.java index 786f16a6..fe82b29c 100644 --- a/src/protocol/swg/chat/ChatOnEnteredRoom.java +++ b/src/protocol/swg/chat/ChatOnEnteredRoom.java @@ -42,6 +42,7 @@ public class ChatOnEnteredRoom extends SWGMessage { this.characterName = characterName; this.success = success; this.roomId = roomId; + this.join = join; } @Override @@ -60,7 +61,7 @@ public class ChatOnEnteredRoom extends SWGMessage { buffer.putInt(CRC.StringtoCRC("ChatOnLeaveRoom")); buffer.put(getAsciiString("SWG")); buffer.put(getAsciiString(galaxy)); - buffer.put(getAsciiString(characterName)); + buffer.put(getAsciiString(characterName.toLowerCase())); buffer.putInt(success); buffer.putInt(roomId); buffer.putInt(0); diff --git a/src/protocol/swg/chat/ChatSendToRoom.java b/src/protocol/swg/chat/ChatSendToRoom.java index 0a751ac0..1c603c3c 100644 --- a/src/protocol/swg/chat/ChatSendToRoom.java +++ b/src/protocol/swg/chat/ChatSendToRoom.java @@ -21,9 +21,13 @@ ******************************************************************************/ package protocol.swg.chat; +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; + import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.SWGMessage; +import resources.common.StringUtilities; public class ChatSendToRoom extends SWGMessage { @@ -35,10 +39,18 @@ public class ChatSendToRoom extends SWGMessage { @Override public void deserialize(IoBuffer data) { - setMessage(getUnicodeString(data)); - data.getInt(); - setRoomId(data.getInt()); - setMsgId(data.getInt()); + try { + data.getShort(); + data.getInt(); + int size = data.getInt(); + message = new String(ByteBuffer.allocate(size * 2).put(data.array(), data.position(), size * 2).array(), "UTF-16LE"); + data.position(data.position() + size * 2); + data.getInt(); + setRoomId(data.getInt()); + setMsgId(data.getInt()); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } } @Override diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index e24c50ae..d781ed7f 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -1690,7 +1690,12 @@ public class CreatureObject extends TangibleObject implements IPersistent { synchronized(objectMutex) { this.inStealth = inStealth; } + + if (getClient() != null && getClient().getSession() != null) { + getClient().getSession().write(messageBuilder.buildStealthFlagDelta(inStealth)); + } notifyObservers(messageBuilder.buildStealthFlagDelta(inStealth), false); + } public boolean isRadarVisible() { diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 7c956d6f..853e1d9a 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -44,7 +44,7 @@ import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; -@Persistent(version=11) +@Persistent(version=12) public class PlayerObject extends IntangibleObject { // PLAY 3 @@ -142,6 +142,8 @@ public class PlayerObject extends IntangibleObject { private byte godLevel = 0; + private List chatChannels = new ArrayList(); + public PlayerObject() { super(); messageBuilder = new PlayerMessageBuilder(this); @@ -864,4 +866,19 @@ public class PlayerObject extends IntangibleObject { } } + public List getJoinedChatChannels() { + return chatChannels; + } + + public void addChannel(int roomId) { + chatChannels.add(roomId); + } + + public void removeChannel(int roomId) { + chatChannels.remove(roomId); + } + + public boolean isMemberOfChannel(int roomId) { + return chatChannels.contains(roomId); + } } diff --git a/src/services/GroupService.java b/src/services/GroupService.java index ba159d69..fa4d9d5b 100644 --- a/src/services/GroupService.java +++ b/src/services/GroupService.java @@ -28,6 +28,7 @@ import java.util.Map; import resources.objects.Buff; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; +import services.chat.ChatRoom; import main.NGECore; import engine.clients.Client; import engine.resources.objects.SWGObject; @@ -152,14 +153,13 @@ public class GroupService implements INetworkDispatch { addGroupBuffsToMember(group, leader); addGroupBuffsToMember(group, invited); - //ChatRoom groupChat = core.chatService.createChatRoom("GroupChat", "group." + group.getObjectID(), leader.getCustomName(), true); - //group.setChatRoomId(groupChat.getRoomId()); - - //core.chatService.joinChatRoom(leader, groupChat.getRoomId()); - //core.chatService.joinChatRoom(invited, groupChat.getRoomId()); - + core.chatService.createChatRoom("", "group." + group.getObjectID(), leader.getCustomName(), false); + ChatRoom groupChat = core.chatService.createChatRoom("", "group." + group.getObjectID() + ".GroupChat", leader.getCustomName(), false); + group.setChatRoomId(groupChat.getRoomId()); + groupChat.setVisible(false); + core.chatService.joinChatRoom(leader.getCustomName(), groupChat.getRoomId()); + core.chatService.joinChatRoom(invited.getCustomName(), groupChat.getRoomId()); return; - } GroupObject group = (GroupObject) core.objectService.getObject(leader.getGroupId()); @@ -171,6 +171,7 @@ public class GroupService implements INetworkDispatch { invited.setGroupId(group.getObjectID()); invited.sendSystemMessage("@group:joined_self", (byte) 0); addGroupBuffsToMember(group, invited); + core.chatService.joinChatRoom(invited.getCustomName(), group.getChatRoomId(), true); } else if(group.getMemberList().size() >= 8) { @@ -233,13 +234,12 @@ public class GroupService implements INetworkDispatch { creature.updateGroupInviteInfo(); creature.setGroupId(0); creature.makeUnaware(group); + core.chatService.leaveChatRoom(creature, group.getChatRoomId()); creature.sendSystemMessage("You have left the group.", (byte) 0); for(SWGObject member : memberList) { - CreatureObject creature2 = (CreatureObject) member; creature2.sendSystemMessage(creature.getCustomName() + " has left the group.", (byte) 0); - } removeGroupBuffs(creature); @@ -258,14 +258,16 @@ public class GroupService implements INetworkDispatch { creature2.setInviteSenderName(""); creature2.updateGroupInviteInfo(); creature2.setGroupId(0); - + creature2.makeUnaware(group); + core.chatService.leaveChatRoom(creature2, group.getChatRoomId()); creature2.sendSystemMessage("The group has been disbanded.", (byte) 0); removeGroupBuffs((CreatureObject) member); } + core.chatService.getChatRooms().remove(group.getChatRoomId()); core.objectService.destroyObject(group.getObjectID()); } } diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 36ae2775..ac70aa31 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -83,6 +83,7 @@ import resources.common.collidables.AbstractCollidable; import resources.datatables.PlayerFlags; import resources.datatables.Posture; import services.ai.LairActor; +import services.chat.ChatRoom; import toxi.geom.Line3D; import toxi.geom.Ray3D; import toxi.geom.Vec3D; @@ -837,6 +838,18 @@ public class SimulationService implements INetworkDispatch { if(object.getPosture() == Posture.Dead) core.playerService.sendCloningWindow(object, false); + ChatRoom zoneRoom = core.chatService.getChatRoomByAddress("SWG." + core.getGalaxyName() + "." + object.getPlanet().getName() + ".Planet"); + if (zoneRoom != null) { + String chatName = object.getCustomName().toLowerCase(); + + if (chatName.contains(" ")) + chatName = chatName.split(" ")[0]; + + if (!zoneRoom.getUserList().contains(chatName)) { + core.chatService.joinChatRoom(chatName, zoneRoom.getRoomId(), true); + } + } + } public void transferToPlanet(SWGObject object, Planet planet, Point3D newPos, Quaternion newOrientation, SWGObject newParent) { diff --git a/src/services/TerrainService.java b/src/services/TerrainService.java index ddc66042..c8b3aaf5 100644 --- a/src/services/TerrainService.java +++ b/src/services/TerrainService.java @@ -175,12 +175,6 @@ public class TerrainService { core.mapService.addPlanet(planet); noBuildAreas.put(planet, new ArrayList()); loadClientRegions(planet); - - core.chatService.createChatRoom("", name, "system", true); - core.chatService.createChatRoom("public chat for this planet, cannot create rooms here", name + ".Planet", "SYSTEM", true); - core.chatService.createChatRoom("system messages for this planet, cannot create rooms here", name + ".system", "SYSTEM", true); - - System.out.println("Created chat rooms for " + name); } diff --git a/src/services/chat/ChatRoom.java b/src/services/chat/ChatRoom.java index 1cc7f2a2..10f853c1 100644 --- a/src/services/chat/ChatRoom.java +++ b/src/services/chat/ChatRoom.java @@ -28,7 +28,7 @@ import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.PrimaryKey; -@Entity +@Entity(version=1) public class ChatRoom { private String creator; // creator of the room (first name only, lowercase) private String description; // title @@ -44,6 +44,7 @@ public class ChatRoom { private boolean moderatorsOnly; private boolean privateRoom; private boolean visible; + private boolean childrenAllowed; private String owner; // current owner of the room (first name only lowercase) public String getCreator() { @@ -145,4 +146,12 @@ public class ChatRoom { public boolean hasBan(String user) { return banList.contains(user.toLowerCase()); } + + public boolean isChildrenAllowed() { + return childrenAllowed; + } + + public void setChildrenAllowed(boolean childrenAllowed) { + this.childrenAllowed = childrenAllowed; + } } diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 04fefd99..32606e64 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -24,7 +24,9 @@ package services.chat; import java.nio.ByteOrder; import java.util.Date; import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Random; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; @@ -40,6 +42,7 @@ import engine.resources.config.Config; import engine.resources.config.DefaultConfig; import engine.resources.database.ObjectDatabase; import engine.resources.objects.SWGObject; +import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -82,17 +85,24 @@ public class ChatService implements INetworkDispatch { this.core = core; core.commandService.registerCommand("spatialchatinternal"); core.commandService.registerCommand("socialinternal"); + core.commandService.registerCommand("addignore"); core.commandService.registerCommand("removeignore"); core.commandService.registerCommand("findfriend"); core.commandService.registerCommand("addfriend"); core.commandService.registerCommand("removefriend"); - //core.commandService.registerCommand("gc"); - //core.commandService.registerAlias("g", "gc"); + + core.commandService.registerAlias("g", "groupchat"); + core.commandService.registerAlias("gc", "groupchat"); + core.commandService.registerAlias("groupsay", "groupchat"); + core.commandService.registerAlias("gsay", "groupchat"); + core.commandService.registerAlias("gtell", "groupchat"); + + core.commandService.registerAlias("planet", "planetchat"); + mailODB = core.getMailODB(); chatRoomsODB = core.getChatRoomODB(); - loadChatRooms(); } public void handleSpatialChat(SWGObject speaker, SWGObject target, String chatMessage, short chatType, short moodId) { @@ -363,7 +373,6 @@ public class ChatService implements INetworkDispatch { ChatRoomList listMessage = new ChatRoomList(chatRooms); client.getSession().write(listMessage.serialize()); - //System.out.println("Sent the room request responses."); } }); @@ -402,7 +411,7 @@ public class ChatService implements INetworkDispatch { }); swgOpcodes.put(Opcodes.ChatQueryRoom, (session, data) -> { - data.order(ByteOrder.LITTLE_ENDIAN); + /*data.order(ByteOrder.LITTLE_ENDIAN); //StringUtilities.printBytes(data.array()); Client client = core.getClient(session); @@ -412,14 +421,11 @@ public class ChatService implements INetworkDispatch { SWGObject obj = client.getParent(); if (obj == null) - return; - - - + return;*/ }); swgOpcodes.put(Opcodes.ChatSendToRoom, (session, data) -> { - //System.out.println("send to room!"); + Client client = core.getClient(session); if(client == null) @@ -430,11 +436,11 @@ public class ChatService implements INetworkDispatch { if (obj == null) return; + data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); ChatSendToRoom sentPacket = new ChatSendToRoom(); sentPacket.deserialize(data); - - //ChatRoom room = getChatRoom(sentPacket.getRoomId()); - + sendChatRoomMessage((CreatureObject) obj, sentPacket.getRoomId(), sentPacket.getMsgId(), sentPacket.getMessage()); }); @@ -449,6 +455,7 @@ public class ChatService implements INetworkDispatch { if (obj == null) return; + data.order(ByteOrder.LITTLE_ENDIAN); data.position(0); ChatEnterRoomById sentPacket = new ChatEnterRoomById(); @@ -456,8 +463,6 @@ public class ChatService implements INetworkDispatch { joinChatRoom(obj.getCustomName(), sentPacket.getRoomId()); - //System.out.println("Entering room... " + sentPacket.getRoomId()); - }); } @@ -706,7 +711,15 @@ public class ChatService implements INetworkDispatch { return mail; } - + public ChatRoom getChatRoomByAddress(String address) { + + for (Entry entry : chatRooms.entrySet()) { + if (entry.getValue().getRoomAddress().equals(address)) + return entry.getValue(); + } + return null; + } + public ChatRoom getChatRoom(int roomId) { return chatRooms.get(roomId); } @@ -725,35 +738,92 @@ public class ChatService implements INetworkDispatch { core.simulationService.notifyAllClients(new ChatSystemMessage(message, new OutOfBand(), DisplayType.Broadcast).serialize()); } - private void loadChatRooms() { + public void loadChatRooms() { /* + * Group Channel: + * SWG.serverName.group.groupObjectId.GroupChat * Battlefields channel format: * SWG.serverName.battlefield.bfMapName * * TODO: Research other channel address formats */ - createChatRoom("", "SWG", "system", true); - createChatRoom("", "SWG." + core.getGalaxyName(), "system", true); + createChatRoom("", "SWG", "system", false); + createChatRoom("", "SWG." + core.getGalaxyName(), "system", false); + createChatRoom("", "SWG." + core.getGalaxyName() + ".Chat", "system", false); createChatRoom("", "system", "system", true); // galaxy system messages - createChatRoom("", "Auction", "system", true); - //createChatRoom("Bounty Hunter chat for this galaxy", "BountyHunter", "SYSTEM", true); - //createChatRoom("Commando chat for this galaxy", "Commando", "SYSTEM", true); + createChatRoom("", "group", "system", false); + createChatRoom("", "guild", "system", false); + + createChatRoom("", "Auction", "system", true); + createChatRoom("public chat for the whole galaxy, cannot create rooms here", "Galaxy", "system", true); + + createChatRoom("Bounty Hunter chat for this galaxy", "BountyHunter", "system", true); + createChatRoom("Commando chat for this galaxy", "Commando", "system", true); + createChatRoom("Officer chat for this galaxy", "Officer", "system", true); + createChatRoom("Entertainer chat for this galaxy", "Entertainer", "system", true); + createChatRoom("Spy chat for this galaxy", "Spy", "system", true); + createChatRoom("Force Sensitive chat for this galaxy", "ForceSensitive", "system", true); + + createChatRoom("Politician chat for this galaxy", "Politician", "system", true); + //createChatRoom("Pilot chat for this galaxy", "Pilot", "system", true); EntityCursor cursor = chatRoomsODB.getCursor(Integer.class, ChatRoom.class); cursor.forEach(room -> { - chatRooms.put(room.getRoomId(), room); + if (!chatRooms.containsValue(room)) + chatRooms.put(room.getRoomId(), room); }); cursor.close(); + + List planets = core.terrainService.getPlanetList(); + planets.forEach(planet -> { + createChatRoom("", planet.getName(), "system", true, true); + createChatRoom("", planet.getName() + ".Chat", "system", true, false); + createChatRoom("public chat for this planet, cannot create rooms here", planet.getName() + ".Planet", "system", true, false); + createChatRoom("system messages for this planet, cannot create rooms here", planet.getName() + ".system", "system", true, false); + Console.println("Created chat rooms for " + planet.getName()); + }); } + /** + * Creates a new ChatRoom that is not persistent and does not allow children. + * @param roomName Name of the room, description + * @param address Address of the room. Defaults to SWG.serverName + the value of this variable if it does not contain it. + * @param creator Creator of the room. Also set as the owner of the room. + * @param isPublic Determines weather or not the channel will show in the list of channels. + * @return {@link ChatRoom} + */ public ChatRoom createChatRoom(String roomName, String address, String creator, boolean isPublic) { - return createChatRoom(roomName, address, creator, isPublic, false); + return createChatRoom(roomName, address, creator, isPublic, false, false); } - public ChatRoom createChatRoom(String roomName, String address, String creator, boolean isPublic, boolean store) { + + /** + * Creates a new ChatRoom with the given values that is not persistent. + * @param roomName Name of the room, description + * @param address Address of the room. Defaults to SWG.serverName + the value of this variable if it does not contain it. + * @param creator Creator of the room. Also set as the owner of the room. + * @param isPublic Determines weather or not the channel will show in the list of channels. + * @param childrenAllowed Setting this to true allows players to create channels within it. + * @return {@link ChatRoom} + */ + public ChatRoom createChatRoom(String roomName, String address, String creator, boolean isPublic, boolean childrenAllowed) { + return createChatRoom(roomName, address, creator, isPublic, false, childrenAllowed); + } + + /** + * Creates a new ChatRoom with the given values. + * @param roomName Name of the room, description + * @param address Address of the room. Defaults to SWG.serverName + the value of this variable if it does not contain it. + * @param creator Creator of the room. Also set as the owner of the room. + * @param isPublic Determines weather or not the channel will show in the list of channels. + * @param store Setting this to true will make the channel persistent through server restarts. + * @param childrenAllowed Setting this to true allows players to create channels within it. + * @return {@link ChatRooms} + */ + public ChatRoom createChatRoom(String roomName, String address, String creator, boolean isPublic, boolean store, boolean childrenAllowed) { if (creator.contains(" ")) creator = creator.split(" ")[0]; @@ -768,6 +838,7 @@ public class ChatService implements INetworkDispatch { room.setOwner(creator.toLowerCase()); room.setVisible(isPublic); room.setRoomId(generateChatRoomId()); + room.setChildrenAllowed(childrenAllowed); chatRooms.put(room.getRoomId(), room); @@ -776,7 +847,9 @@ public class ChatService implements INetworkDispatch { chatRoomsODB.put(room, Integer.class, ChatRoom.class, txn); txn.commitSync(); } - + + //Console.println("Created room " + address + " with ID " + room.getRoomId()); + return room; } @@ -797,7 +870,6 @@ public class ChatService implements INetworkDispatch { ChatRoom room = getChatRoom(roomId); if (room == null) return false; - if (!room.hasUser(user.toLowerCase())) { room.addUser(user.toLowerCase()); @@ -808,9 +880,13 @@ public class ChatService implements INetworkDispatch { creo.getClient().getSession().write(listMessage.serialize()); } } - ChatOnEnteredRoom enterRoom = new ChatOnEnteredRoom(user, 0, roomId, true); - getObjectByFirstName(user).getClient().getSession().write(enterRoom.serialize()); - //System.out.println("Sent message for room " + room.getRoomAddress()); + ChatOnEnteredRoom enter = new ChatOnEnteredRoom(user, 0, room.getRoomId(), true); + SWGObject player = getObjectByFirstName(user); + + if (player == null || player.getClient() == null || player.getClient().getSession() == null) + return false; + + player.getClient().getSession().write(enter.serialize()); return true; } return false; @@ -819,39 +895,57 @@ public class ChatService implements INetworkDispatch { public boolean joinChatRoom(String user, int roomId) { return joinChatRoom(user, roomId, false); } + public void leaveChatRoom(CreatureObject player, int roomId) { + ChatRoom room = getChatRoom(roomId); + if (room == null) + return; + String playerName = player.getCustomName().toLowerCase(); if (playerName.contains(" ")) playerName = playerName.split(" ")[0]; - ChatRoom room = getChatRoom(roomId); - if (room == null) - return; - - ChatOnEnteredRoom enterRoom = new ChatOnEnteredRoom(playerName, 0, roomId, false); - player.getClient().getSession().write(enterRoom.serialize()); + ChatOnEnteredRoom leaveRoom = new ChatOnEnteredRoom(playerName, 0, roomId, false); + player.getClient().getSession().write(leaveRoom.serialize()); if (room.getUserList().contains(player)) room.getUserList().remove(player); + + room.getUserList().forEach(user -> { + SWGObject roomPlayer = getObjectByFirstName(user); + + if (roomPlayer != null && roomPlayer.getClient() != null && roomPlayer.getClient().getSession() != null) + roomPlayer.getClient().getSession().write(leaveRoom.serialize()); + }); } public void sendChatRoomMessage(CreatureObject sender, int roomId, int msgId, String message) { - String senderName = sender.getCustomName().toLowerCase(); + ChatRoom room = getChatRoom(roomId); + + if (room == null) + return; + + String senderName = sender.getCustomName(); if (senderName.contains(" ")) senderName = senderName.split(" ")[0]; - - ChatRoom room = getChatRoom(roomId); - if (room == null) - return; ChatOnSendRoomMessage onSend = new ChatOnSendRoomMessage(0, msgId); sender.getClient().getSession().write(onSend.serialize()); ChatRoomMessage roomMessage = new ChatRoomMessage(roomId, senderName, message); Vector users = room.getUserList(); + users.forEach(user -> { + SWGObject player = getObjectByFirstName(user); + if (player != null && player.getClient() != null && player.getClient().getSession() != null) { + player.getClient().getSession().write(roomMessage.serialize()); + } + }); + } + + public void handleGroupChat(SWGObject sender, String message) { } From d810b60c4ab6ad4a5483dc0583cd2c223947ded0 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Wed, 16 Apr 2014 23:29:17 +0200 Subject: [PATCH 87/95] WeaponObject now uses the WeaponType datatable --- src/resources/objects/weapon/WeaponObject.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 1ff97a03..2d0fa6ba 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -21,6 +21,7 @@ ******************************************************************************/ package resources.objects.weapon; +import resources.datatables.WeaponType; import resources.objects.tangible.TangibleObject; import com.sleepycat.persist.model.NotPersistent; @@ -196,7 +197,7 @@ public class WeaponObject extends TangibleObject { int weaponType = getWeaponType(); - if(weaponType == 4 || weaponType == 5 || weaponType == 6 || weaponType == 7 || weaponType == 9 || weaponType == 10 || weaponType == 11) + if(weaponType == WeaponType.ONEHANDEDMELEE || weaponType == WeaponType.TWOHANDEDMELEE || weaponType == WeaponType.UNARMED || weaponType == WeaponType.POLEARMMELEE || weaponType == WeaponType.ONEHANDEDSABER || weaponType == WeaponType.TWOHANDEDSABER || weaponType == WeaponType.POLEARMSABER) return true; return false; @@ -207,7 +208,7 @@ public class WeaponObject extends TangibleObject { int weaponType = getWeaponType(); - if(weaponType == 0 || weaponType == 1 || weaponType == 2 || weaponType == 3) + if(weaponType == WeaponType.RIFLE || weaponType == WeaponType.CARBINE || weaponType == WeaponType.PISTOL || weaponType == WeaponType.FLAMETHROWER || weaponType == WeaponType.HEAVYWEAPON) return true; return false; From 2127ff1f6fe0ce6461256e1ea9bc7fa6e35eb44b Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 16 Apr 2014 17:57:15 -0400 Subject: [PATCH 88/95] Removed import in GroupChat and PlanetChat scripts --- scripts/commands/groupchat.py | 1 - scripts/commands/planetchat.py | 1 - 2 files changed, 2 deletions(-) diff --git a/scripts/commands/groupchat.py b/scripts/commands/groupchat.py index cce1a9ff..03a6ed26 100644 --- a/scripts/commands/groupchat.py +++ b/scripts/commands/groupchat.py @@ -1,4 +1,3 @@ -from main import NGECore import sys def setup(): diff --git a/scripts/commands/planetchat.py b/scripts/commands/planetchat.py index 04a9de62..827fef78 100644 --- a/scripts/commands/planetchat.py +++ b/scripts/commands/planetchat.py @@ -1,4 +1,3 @@ -from main import NGECore import sys def setup(): From c7930f8281a5b92379c2683ac9789ba31afeafde Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Thu, 17 Apr 2014 00:25:54 +0200 Subject: [PATCH 89/95] Implemented elemental particle effects, #434 --- src/resources/datatables/Elemental.java | 52 +++++++++++++++++++ .../objects/weapon/WeaponMessageBuilder.java | 11 ++-- 2 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 src/resources/datatables/Elemental.java diff --git a/src/resources/datatables/Elemental.java b/src/resources/datatables/Elemental.java new file mode 100644 index 00000000..aea57628 --- /dev/null +++ b/src/resources/datatables/Elemental.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +import org.apache.commons.collections.BidiMap; +import org.apache.commons.collections.bidimap.DualHashBidiMap; + +public final class Elemental { + + + static BidiMap map = new DualHashBidiMap(); + + static { + map.put("kinetic", 1); + map.put("energy", 2); + map.put("blast", 4); + map.put("stun", 8); + map.put("heat", 32); + map.put("cold", 64); + map.put("acid", 128); + map.put("electricity", 256); + } + + + public static int getElementalNum(String elementalName) { + return (int) map.get(elementalName); + } + + public static String getElementalName(int elementalNum) { + return (String) map.getKey(elementalNum); + } + +} diff --git a/src/resources/objects/weapon/WeaponMessageBuilder.java b/src/resources/objects/weapon/WeaponMessageBuilder.java index 8e2e5afc..5084b9cf 100644 --- a/src/resources/objects/weapon/WeaponMessageBuilder.java +++ b/src/resources/objects/weapon/WeaponMessageBuilder.java @@ -26,14 +26,14 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import resources.objects.ObjectMessageBuilder; - +import resources.datatables.Elemental; public class WeaponMessageBuilder extends ObjectMessageBuilder { public WeaponMessageBuilder(WeaponObject weaponObject) { setObject(weaponObject); } - + public IoBuffer buildBaseline3() { WeaponObject weapon = (WeaponObject) object; IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN); @@ -68,11 +68,12 @@ public class WeaponMessageBuilder extends ObjectMessageBuilder { buffer.putInt(0); buffer.putFloat(weapon.getMaxRange()); buffer.putInt(0); - + if( weapon.getElementalType() != null) // Weapon particle effect + buffer.putInt(Elemental.getElementalNum(weapon.getElementalType())); + else + buffer.putInt(Elemental.getElementalNum(weapon.getDamageType())); buffer.putInt(0); - buffer.putInt(0); // those 2 ints have something to do with particle color - int size = buffer.position(); buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size); From a998b3ec4474f02727a81a168338d268a0eb2dc0 Mon Sep 17 00:00:00 2001 From: Ziggeh Date: Thu, 17 Apr 2014 00:46:00 +0200 Subject: [PATCH 90/95] Cleaned up CombatService and fixed buff exceptions --- src/services/combat/CombatService.java | 87 +++++++------------------- 1 file changed, 24 insertions(+), 63 deletions(-) diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 87bfcd31..acb3f27b 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -41,7 +41,9 @@ import protocol.swg.objectControllerObjects.CombatSpam; import protocol.swg.objectControllerObjects.CommandEnqueueRemove; import protocol.swg.objectControllerObjects.StartTask; import resources.common.FileUtilities; +import resources.datatables.Elemental; import resources.datatables.Posture; +import resources.datatables.WeaponType; import resources.objects.Buff; import resources.objects.DamageOverTime; import resources.objects.creature.CreatureObject; @@ -68,7 +70,7 @@ public class CombatService implements INetworkDispatch { private NGECore core; private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); private CombatEvents events = new CombatEvents(); - + public CombatService(NGECore core) { this.core = core; CombatCommands.registerCommands(core); @@ -381,7 +383,7 @@ public class CombatService implements INetworkDispatch { sendCombatPackets(attacker, target, weapon, command, actionCounter, damage, armorAbsorbed, hitType); if(hitType != HitType.MISS && hitType != HitType.DODGE && hitType != HitType.PARRY && command.getBuffNameTarget().length() > 0) { - core.buffService.addBuffToCreature(target, command.getBuffNameTarget()); + core.buffService.addBuffToCreature(target, command.getBuffNameTarget(), attacker); } if(command.getDotIntensity() > 0) { addDotToCreature(attacker, target, command, target.getBuffByName(command.getBuffNameTarget())); @@ -395,7 +397,7 @@ public class CombatService implements INetworkDispatch { } if(command.getAddedDamage() == 0 && command.getPercentFromWeapon() == 0 && command.getBuffNameTarget().length() > 0) - core.buffService.addBuffToCreature(target, command.getBuffNameTarget()); + core.buffService.addBuffToCreature(target, command.getBuffNameTarget(), attacker); sendCombatPackets(attacker, target, weapon, command, actionCounter, damage, 0, HitType.HIT); @@ -450,40 +452,23 @@ public class CombatService implements INetworkDispatch { private float getArmorReduction(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, byte hitType) { - int elementalType = 1; + String elementalName = ""; if(command.getPercentFromWeapon() > 0) { // TODO: elemental mitigation and damage + + elementalName = weapon.getDamageType(); - if(weapon.getStringAttribute("cat_wpn_damage.wpn_damage_type").equals("@obj_attr_n:armor_eff_kinetic")) - elementalType = ElementalType.KINETIC; - else if(weapon.getStringAttribute("cat_wpn_damage.wpn_damage_type").equals("@obj_attr_n:armor_eff_energy")) - elementalType = ElementalType.ENERGY; - } else { - elementalType = command.getElementalType(); - + elementalName = Elemental.getElementalName(command.getElementalType()); + } int baseArmor = 0; - switch(elementalType) { - - case ElementalType.KINETIC: - baseArmor = target.getSkillModBase("kinetic"); - case ElementalType.ENERGY: - baseArmor = target.getSkillModBase("energy"); - case ElementalType.HEAT: - baseArmor = target.getSkillModBase("heat"); - case ElementalType.COLD: - baseArmor = target.getSkillModBase("cold"); - case ElementalType.ACID: - baseArmor = target.getSkillModBase("acid"); - case ElementalType.ELECTRICITY: - baseArmor = target.getSkillModBase("electricity"); - } + baseArmor = target.getSkillModBase(elementalName); if(target.getSkillMod("expertise_innate_reduction_all_player") != null) baseArmor *= (100 - target.getSkillModBase("expertise_innate_reduction_all_player")) / 100; @@ -1325,24 +1310,10 @@ public class CombatService implements INetworkDispatch { int weaponType = weapon.getWeaponType(); int actionReduction; - switch(weaponType) { - - case 0: actionReduction = attacker.getSkillModBase("expertise_action_weapon_0"); - case 1: actionReduction = attacker.getSkillModBase("expertise_action_weapon_1"); - case 2: actionReduction = attacker.getSkillModBase("expertise_action_weapon_2"); - case 4: actionReduction = attacker.getSkillModBase("expertise_action_weapon_4"); - case 5: actionReduction = attacker.getSkillModBase("expertise_action_weapon_5"); - case 6: actionReduction = attacker.getSkillModBase("expertise_action_weapon_6"); - case 7: actionReduction = attacker.getSkillModBase("expertise_action_weapon_7"); - case 8: actionReduction = attacker.getSkillModBase("expertise_action_weapon_8"); - case 9: actionReduction = attacker.getSkillModBase("expertise_action_weapon_9"); - case 10: actionReduction = attacker.getSkillModBase("expertise_action_weapon_10"); - case 11: actionReduction = attacker.getSkillModBase("expertise_action_weapon_11"); - case 12: actionReduction = attacker.getSkillModBase("expertise_action_weapon_3"); - - default: actionReduction = 0; - - } + if(weaponType == WeaponType.HEAVYWEAPON || weaponType == WeaponType.FLAMETHROWER) + actionReduction = attacker.getSkillModBase("expertise_action_weapon_3"); + else + actionReduction = attacker.getSkillModBase("expertise_action_weapon_" + Integer.toString(weaponType)); actionReduction += attacker.getSkillModBase("expertise_action_all"); @@ -1355,24 +1326,16 @@ public class CombatService implements INetworkDispatch { int weaponType = weapon.getWeaponType(); int weaponDmgIncrease; - switch(weaponType) { - - case 0: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_0"); - case 1: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_1"); - case 2: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_2"); - case 4: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_4"); - case 5: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_5"); - case 6: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_6"); - case 7: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_7"); - case 8: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_8"); - case 9: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_9"); - case 10: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_10"); - case 11: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_11"); - case 12: weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_3"); - - default: weaponDmgIncrease = 0; + if(weaponType == WeaponType.HEAVYWEAPON || weaponType == WeaponType.FLAMETHROWER) + weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_3"); + else + weaponDmgIncrease = attacker.getSkillModBase("expertise_damage_weapon_" + Integer.toString(weaponType)); - } + if(weapon.isRanged()) + weaponDmgIncrease += attacker.getSkillModBase("expertise_damage_ranged"); + + if(weapon.isMelee()) + weaponDmgIncrease += attacker.getSkillModBase("expertise_damage_melee"); weaponDmgIncrease += attacker.getSkillModBase("expertise_damage_all"); @@ -1416,6 +1379,4 @@ public class CombatService implements INetworkDispatch { } - - } From da20b779cf5eb4fcf1c64428a2e6113a2e70362d Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 16 Apr 2014 18:51:32 -0400 Subject: [PATCH 91/95] Temporarily Fixes #442: Position secured cant be removed The problem related to doSelfBuff always calling and thinking that the position secured buff wanted to be added all the time, which isn't the case. Right now I added a hasBuff check to doSelfBuff for the position secured buff which will remove the buff. I didn't want to flat out just remove a buff no matter what command was called because that would affect any buffs that wanted to be refreshed and not removed. --- scripts/commands/co_position_secured.py | 14 -------------- scripts/commands/combat/co_position_secured.py | 9 +++++++++ src/services/combat/CombatService.java | 5 ++++- 3 files changed, 13 insertions(+), 15 deletions(-) delete mode 100644 scripts/commands/co_position_secured.py create mode 100644 scripts/commands/combat/co_position_secured.py diff --git a/scripts/commands/co_position_secured.py b/scripts/commands/co_position_secured.py deleted file mode 100644 index a2165915..00000000 --- a/scripts/commands/co_position_secured.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys - -def setup(): - return - -def run(core, actor, target, commandString): - - if actor.hasBuff('co_position_secured'): - core.buffService.removeBuffFromCreature(actor, actor.getBuffByName('co_position_secured')) - else: - core.buffService.addBuffToCreature(actor, 'co_position_secured') - - return - \ No newline at end of file diff --git a/scripts/commands/combat/co_position_secured.py b/scripts/commands/combat/co_position_secured.py new file mode 100644 index 00000000..84e13b7a --- /dev/null +++ b/scripts/commands/combat/co_position_secured.py @@ -0,0 +1,9 @@ +from resources.objects import Buff +import sys + +def setup(core, actor, target, command): + return + +def run(core, actor, target, commandString): + return + \ No newline at end of file diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 87bfcd31..a033b91a 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -1242,7 +1242,10 @@ public class CombatService implements INetworkDispatch { return; } - core.buffService.addBuffToCreature(creature, command.getBuffNameSelf()); + if (creature.hasBuff("co_position_secured")) + core.buffService.removeBuffFromCreatureByName(creature, "co_position_secured"); + else + core.buffService.addBuffToCreature(creature, command.getBuffNameSelf(), creature); StartTask startTask = new StartTask(actionCounter, creature.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), command.getCooldown()); ObjControllerMessage objController2 = new ObjControllerMessage(0x0B, startTask); From 8379c2f87b6034f712c1eb8055039afb8eca128a Mon Sep 17 00:00:00 2001 From: Waverunner Date: Wed, 16 Apr 2014 19:42:49 -0400 Subject: [PATCH 92/95] Changed Elemental to Enum --- src/resources/datatables/Elemental.java | 83 ++++++++++++++++++------- 1 file changed, 61 insertions(+), 22 deletions(-) diff --git a/src/resources/datatables/Elemental.java b/src/resources/datatables/Elemental.java index aea57628..007f04c0 100644 --- a/src/resources/datatables/Elemental.java +++ b/src/resources/datatables/Elemental.java @@ -21,32 +21,71 @@ ******************************************************************************/ package resources.datatables; -import org.apache.commons.collections.BidiMap; -import org.apache.commons.collections.bidimap.DualHashBidiMap; +public enum Elemental { -public final class Elemental { + KINETIC(1), ENERGY(2), BLAST(4), STUN(8), HEAT(32), COLD(64), ACID(128), ELECTRICITY(256); + + private int element; - - static BidiMap map = new DualHashBidiMap(); - - static { - map.put("kinetic", 1); - map.put("energy", 2); - map.put("blast", 4); - map.put("stun", 8); - map.put("heat", 32); - map.put("cold", 64); - map.put("acid", 128); - map.put("electricity", 256); + private Elemental(int element) { + this.element = element; } - - public static int getElementalNum(String elementalName) { - return (int) map.get(elementalName); + @Override + public String toString() { + switch(this) { + case KINETIC: + return "kinetic"; + case ENERGY: + return "energy"; + case BLAST: + return "blast"; + case STUN: + return "stun"; + case HEAT: + return "heat"; + case COLD: + return "cold"; + case ACID: + return "acid"; + case ELECTRICITY: + return "electricity"; + } + return null; } - public static String getElementalName(int elementalNum) { - return (String) map.getKey(elementalNum); - } + public int getValue() { + return element; + } -} + public static int getElementalNum(String element) { + switch(element) { + case "kinetic": + return 1; + case "energy": + return 2; + case "blast": + return 4; + case "stun": + return 8; + case "heat": + return 32; + case "cold": + return 64; + case "acid": + return 128; + case "electricity": + return 256; + } + return 0; + } + + public static String getElementalName(int elementalType) { + for (Elemental element : Elemental.values()) { + if (element.getValue() == elementalType) { + return element.toString(); + } + } + return null; + } +} \ No newline at end of file From 9252ebaaea99779299803ba57586de8ff9055269 Mon Sep 17 00:00:00 2001 From: Waverunner Date: Thu, 17 Apr 2014 16:01:12 -0400 Subject: [PATCH 93/95] Added Enter & Leave Messages for ChatRooms as well as info stats for the room --- scripts/commands/auction.py | 7 +- src/protocol/swg/chat/ChatEnterRoomById.java | 8 +- src/protocol/swg/chat/ChatOnLeaveRoom.java | 125 ++++++++++++++++++ ...eryRoomResults.java => ChatQueryRoom.java} | 26 +++- src/resources/common/Opcodes.java | 1 + .../objects/player/PlayerObject.java | 7 +- src/services/ConnectionService.java | 10 ++ src/services/chat/ChatService.java | 75 +++++++++-- src/services/object/ObjectService.java | 9 ++ 9 files changed, 245 insertions(+), 23 deletions(-) create mode 100644 src/protocol/swg/chat/ChatOnLeaveRoom.java rename src/protocol/swg/chat/{ChatQueryRoomResults.java => ChatQueryRoom.java} (82%) diff --git a/scripts/commands/auction.py b/scripts/commands/auction.py index dc63c8bc..fe744e57 100644 --- a/scripts/commands/auction.py +++ b/scripts/commands/auction.py @@ -1,10 +1,11 @@ -from main import NGECore import sys def setup(): return def run(core, actor, target, commandString): - room = core.chatService.getChatRoomByAddress('SWG.' + NGECore.getInstance().getGalaxyName() + '.' + 'Auction') - core.chatService.sendChatRoomMessage(actor, room.getRoomId(), 0, commandString) + room = core.chatService.getChatRoomByAddress('SWG.' + core.getGalaxyName() + '.' + 'Auction') + + if actor.getSlottedObject('ghost').isMemberOfChannel(room.getRoomId()): + core.chatService.sendChatRoomMessage(actor, room.getRoomId(), 0, commandString) return \ No newline at end of file diff --git a/src/protocol/swg/chat/ChatEnterRoomById.java b/src/protocol/swg/chat/ChatEnterRoomById.java index b6715b09..2e2ec8e5 100644 --- a/src/protocol/swg/chat/ChatEnterRoomById.java +++ b/src/protocol/swg/chat/ChatEnterRoomById.java @@ -29,6 +29,7 @@ public class ChatEnterRoomById extends SWGMessage { private int roomId; private int requestId; + private String roomName; public ChatEnterRoomById() { } @@ -39,7 +40,7 @@ public class ChatEnterRoomById extends SWGMessage { this.requestId = data.getInt(); this.roomId = data.getInt(); - // getAsciiString(data); // name of the room but don't need it since we have id. + this.roomName = getAsciiString(data); } @Override @@ -54,5 +55,8 @@ public class ChatEnterRoomById extends SWGMessage { public int getRoomId() { return roomId; } - + + public String getRoomname() { + return roomName; + } } diff --git a/src/protocol/swg/chat/ChatOnLeaveRoom.java b/src/protocol/swg/chat/ChatOnLeaveRoom.java new file mode 100644 index 00000000..1fecfe5f --- /dev/null +++ b/src/protocol/swg/chat/ChatOnLeaveRoom.java @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package protocol.swg.chat; + +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; + +import protocol.swg.SWGMessage; +import resources.common.StringUtilities; + +public class ChatOnLeaveRoom extends SWGMessage { + + private String server; + private String character; + private String channelAddress; + private int errorId; + private int channelId; + private int requestId; + + public ChatOnLeaveRoom() { } + + public ChatOnLeaveRoom(String server, String character) { + this.server = server; + this.character = character; + this.errorId = 0; + this.requestId = 0; + } + + @Override + public void deserialize(IoBuffer data) { + data.getShort(); + data.getInt(); + getAsciiString(data); + getAsciiString(data); + character = getAsciiString(data); + channelAddress = getAsciiString(data); + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(28 + server.length() + character.length()).order(ByteOrder.LITTLE_ENDIAN); + + buffer.putShort((short) 5); + buffer.putInt(0x60B5098B); + + buffer.put(getAsciiString("SWG")); + buffer.put(getAsciiString(server)); + buffer.put(getAsciiString(character)); + + buffer.putInt(errorId); + buffer.putInt(channelId); + buffer.putInt(requestId); + + return buffer.flip(); + } + + public String getServer() { + return server; + } + + public void setServer(String server) { + this.server = server; + } + + public String getCharacter() { + return character; + } + + public void setCharacter(String character) { + this.character = character; + } + + public String getChannelAddress() { + return channelAddress; + } + + public void setChannelAddress(String channelAddress) { + this.channelAddress = channelAddress; + } + + public int getErrorId() { + return errorId; + } + + public void setErrorId(int errorId) { + this.errorId = errorId; + } + + public int getChannelId() { + return channelId; + } + + public void setChannelId(int channelId) { + this.channelId = channelId; + } + + public int getRequestId() { + return requestId; + } + + public void setRequestId(int requestId) { + this.requestId = requestId; + } + +} diff --git a/src/protocol/swg/chat/ChatQueryRoomResults.java b/src/protocol/swg/chat/ChatQueryRoom.java similarity index 82% rename from src/protocol/swg/chat/ChatQueryRoomResults.java rename to src/protocol/swg/chat/ChatQueryRoom.java index 530438ca..25e94d27 100644 --- a/src/protocol/swg/chat/ChatQueryRoomResults.java +++ b/src/protocol/swg/chat/ChatQueryRoom.java @@ -31,25 +31,32 @@ import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.SWGMessage; import services.chat.ChatRoom; -public class ChatQueryRoomResults extends SWGMessage { +public class ChatQueryRoom extends SWGMessage { private ChatRoom room; + private String roomAddress; private int requestId; - public ChatQueryRoomResults(ChatRoom room, int requestId) { + public ChatQueryRoom() { } + public ChatQueryRoom(ChatRoom room, int requestId) { this.room = room; this.requestId = requestId; } @Override public void deserialize(IoBuffer data) { + data.getShort(); + data.getInt(); + requestId = data.getInt(); + roomAddress = getAsciiString(data); } @Override public IoBuffer serialize() { String server = NGECore.getInstance().getGalaxyName(); IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); - + buffer.setAutoExpand(true); + buffer.putShort((short) 7); buffer.putInt(0xC4DE864E); @@ -108,5 +115,16 @@ public class ChatQueryRoomResults extends SWGMessage { buffer.putInt(0); // user list return buffer.flip(); } - + public String getRoomAddress() { + return roomAddress; + } + public void setRoomAddress(String roomAddress) { + this.roomAddress = roomAddress; + } + public int getRequestId() { + return requestId; + } + public void setRequestId(int requestId) { + this.requestId = requestId; + } } diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index 1d0ec6d5..8a8cc6d8 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -27,6 +27,7 @@ public class Opcodes { public static int AuctionQueryHeadersMessage = CRC.StringtoCRC("AuctionQueryHeadersMessage"); public static int CreateImmediateAuctionMessage = CRC.StringtoCRC("CreateImmediateAuctionMessage"); + public static int ChatLeaveRoom = 0x493E3FFA; public static int ChatEnterRoomById = CRC.StringtoCRC("ChatEnterRoomById"); public static int ChatSendToRoom = CRC.StringtoCRC("ChatSendToRoom"); public static int ChatDeletePersistentMessage = 0x8F251641; diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 853e1d9a..a24ca702 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -879,6 +879,11 @@ public class PlayerObject extends IntangibleObject { } public boolean isMemberOfChannel(int roomId) { - return chatChannels.contains(roomId); + if (chatChannels.contains(roomId)) { + System.out.println("Member of the channel!"); + return true; + } + System.out.println("Not a Member of the channel!"); + return false; } } diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index fd2d475a..ff79d72c 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -57,6 +57,7 @@ import resources.common.collidables.AbstractCollidable; import resources.datatables.PlayerFlags; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; +import services.chat.ChatRoom; @SuppressWarnings("unused") @@ -239,6 +240,14 @@ public class ConnectionService implements INetworkDispatch { } core.chatService.playerStatusChange(objectShortName, (byte) 0); + + for (Integer roomId : ghost.getJoinedChatChannels()) { + ChatRoom room = core.chatService.getChatRoom(roomId.intValue()); + + if (room != null) { core.chatService.leaveChatRoom(object, roomId.intValue()); } + // work-around for any channels that may have been deleted, or only spawn on server startup, that were added to the joined channels + else { ghost.removeChannel(roomId); } + } } long parentId = object.getParentId(); @@ -260,6 +269,7 @@ public class ConnectionService implements INetworkDispatch { observerClient.getParent().makeUnaware(object); } }*/ + ghost.toggleFlag(PlayerFlags.LD); object.setPerformanceListenee(null); diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 32606e64..fbdf4cf6 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -60,11 +60,13 @@ import protocol.swg.chat.ChatInstantMessagetoClient; import protocol.swg.chat.ChatOnAddFriend; import protocol.swg.chat.ChatOnChangeFriendStatus; import protocol.swg.chat.ChatOnEnteredRoom; +import protocol.swg.chat.ChatOnLeaveRoom; import protocol.swg.chat.ChatOnSendInstantMessage; import protocol.swg.chat.ChatOnSendPersistentMessage; import protocol.swg.chat.ChatOnSendRoomMessage; import protocol.swg.chat.ChatPersistentMessageToClient; import protocol.swg.chat.ChatPersistentMessageToServer; +import protocol.swg.chat.ChatQueryRoom; import protocol.swg.chat.ChatRequestPersistentMessage; import protocol.swg.chat.ChatRoomList; import protocol.swg.chat.ChatRoomMessage; @@ -411,8 +413,6 @@ public class ChatService implements INetworkDispatch { }); swgOpcodes.put(Opcodes.ChatQueryRoom, (session, data) -> { - /*data.order(ByteOrder.LITTLE_ENDIAN); - //StringUtilities.printBytes(data.array()); Client client = core.getClient(session); if(client == null) @@ -421,7 +421,20 @@ public class ChatService implements INetworkDispatch { SWGObject obj = client.getParent(); if (obj == null) - return;*/ + return; + + data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + ChatQueryRoom request = new ChatQueryRoom(); + request.deserialize(data); + + ChatRoom room = getChatRoomByAddress(request.getRoomAddress()); + + if (room == null) + return; + + ChatQueryRoom response = new ChatQueryRoom(room, request.getRequestId()); + obj.getClient().getSession().write(response.serialize()); }); swgOpcodes.put(Opcodes.ChatSendToRoom, (session, data) -> { @@ -440,8 +453,9 @@ public class ChatService implements INetworkDispatch { data.position(0); ChatSendToRoom sentPacket = new ChatSendToRoom(); sentPacket.deserialize(data); - - sendChatRoomMessage((CreatureObject) obj, sentPacket.getRoomId(), sentPacket.getMsgId(), sentPacket.getMessage()); + + if (((PlayerObject) obj.getSlottedObject("ghost")).isMemberOfChannel(sentPacket.getRoomId())) + sendChatRoomMessage((CreatureObject) obj, sentPacket.getRoomId(), sentPacket.getMsgId(), sentPacket.getMessage()); }); @@ -461,7 +475,34 @@ public class ChatService implements INetworkDispatch { ChatEnterRoomById sentPacket = new ChatEnterRoomById(); sentPacket.deserialize(data); - joinChatRoom(obj.getCustomName(), sentPacket.getRoomId()); + if(joinChatRoom(obj.getCustomName(), sentPacket.getRoomId()) && !sentPacket.getRoomname().equals("SWG." + core.getGalaxyName() + "." + obj.getPlanet().name + ".Planet")) { + PlayerObject player = (PlayerObject) obj.getSlottedObject("ghost"); + + if (player != null) + player.addChannel(sentPacket.getRoomId()); + } + }); + + swgOpcodes.put(Opcodes.ChatLeaveRoom, (session, data) -> { + Client client = core.getClient(session); + + if(client == null) + return; + + SWGObject obj = client.getParent(); + + if (obj == null) + return; + + data.order(ByteOrder.LITTLE_ENDIAN); + data.position(0); + + ChatOnLeaveRoom sentPacket = new ChatOnLeaveRoom(); + sentPacket.deserialize(data); + + ChatRoom room = getChatRoomByAddress(sentPacket.getChannelAddress()); + + leaveChatRoom((CreatureObject) obj, room.getRoomId()); }); } @@ -758,7 +799,7 @@ public class ChatService implements INetworkDispatch { createChatRoom("", "group", "system", false); createChatRoom("", "guild", "system", false); - createChatRoom("", "Auction", "system", true); + createChatRoom("Auction chat for this galaxy", "Auction", "system", true); createChatRoom("public chat for the whole galaxy, cannot create rooms here", "Galaxy", "system", true); createChatRoom("Bounty Hunter chat for this galaxy", "BountyHunter", "system", true); @@ -871,8 +912,7 @@ public class ChatService implements INetworkDispatch { if (room == null) return false; if (!room.hasUser(user.toLowerCase())) { - room.addUser(user.toLowerCase()); - + if (!room.isVisible() || resendList) { CreatureObject creo = (CreatureObject) getObjectByFirstName(user); if (creo != null) { @@ -887,6 +927,15 @@ public class ChatService implements INetworkDispatch { return false; player.getClient().getSession().write(enter.serialize()); + + for (String roomUser : room.getUserList()) { + SWGObject roomPlayer = getObjectByFirstName(roomUser); + + if (roomPlayer != null && roomPlayer.getClient() != null && roomPlayer.getClient().getSession() != null) + roomPlayer.getClient().getSession().write(enter.serialize()); + } + + room.addUser(user.toLowerCase()); return true; } return false; @@ -909,15 +958,15 @@ public class ChatService implements INetworkDispatch { ChatOnEnteredRoom leaveRoom = new ChatOnEnteredRoom(playerName, 0, roomId, false); player.getClient().getSession().write(leaveRoom.serialize()); - - if (room.getUserList().contains(player)) - room.getUserList().remove(player); + + room.getUserList().remove(playerName); room.getUserList().forEach(user -> { SWGObject roomPlayer = getObjectByFirstName(user); - if (roomPlayer != null && roomPlayer.getClient() != null && roomPlayer.getClient().getSession() != null) + if (roomPlayer != null && roomPlayer.getClient() != null && roomPlayer.getClient().getSession() != null) { roomPlayer.getClient().getSession().write(leaveRoom.serialize()); + } }); } diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 52e9f6c5..77314980 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -122,6 +122,7 @@ import resources.objects.tool.SurveyTool; import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; import services.bazaar.AuctionItem; +import services.chat.ChatRoom; @SuppressWarnings("unused") @@ -923,6 +924,14 @@ public class ObjectService implements INetworkDispatch { } } } + + for (Integer roomId : ghost.getJoinedChatChannels()) { + ChatRoom room = core.chatService.getChatRoom(roomId); + + if (room != null) { core.chatService.joinChatRoom(objectShortName, roomId); } + // work-around for any channels that may have been deleted, or only spawn on server startup, that were added to the joined channels + else { ghost.removeChannel(roomId); } + } } if(!core.getConfig().getString("MOTD").equals("")) From d25ac7396598e7911cece3770469cce47137ef40 Mon Sep 17 00:00:00 2001 From: Levarrishawk Date: Thu, 17 Apr 2014 22:32:18 -0400 Subject: [PATCH 94/95] Enabled loading of all Kashyyyk TRNs Enabled loading of all kashyyyk terrains by default. Begun adding "gate" transportation. --- .../shared_thm_kash_zonegate_door_simple.py | 19 +++++++++++++++++++ src/main/NGECore.java | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 scripts/object/tangible/door/shared_thm_kash_zonegate_door_simple.py diff --git a/scripts/object/tangible/door/shared_thm_kash_zonegate_door_simple.py b/scripts/object/tangible/door/shared_thm_kash_zonegate_door_simple.py new file mode 100644 index 00000000..4bd7f23d --- /dev/null +++ b/scripts/object/tangible/door/shared_thm_kash_zonegate_door_simple.py @@ -0,0 +1,19 @@ +import sys + +from engine.resources.scene import Point3D +from engine.resources.scene import Quaternion + +def setup(core, object): + object.setAttachment('radial_filename', 'a_gate_door') + return + +#TODO: Solve problem with displayed ObjectID from buildout not being proper unsigned int. +#-56576470324869753 rryatt +#-56576470324869754 blackscale +#-56576470324869755 ettyy +#kkowir exit coord -746 18 256 + +def use(core, actor, object): + if object.getObjectID() == long(-56576470324869752): + core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName('kashyyyk_dead_forest'), Point3D(float(86.9), float(29.4), float(-473)), Quaternion(float(0), float(0), float(0), float(1)), None) + return \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 08e9847c..51e235bb 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -381,11 +381,11 @@ public class NGECore { terrainService.addPlanet(12, "kashyyyk_main", "terrain/kashyyyk_main.trn", true); //Dungeon Terrains // TODO: Fix BufferUnderFlow Errors on loaded of dungeon instances. - /*terrainService.addPlanet(13, "kashyyyk_dead_forest", "terrain/kashyyyk_dead_forest.trn", true); + terrainService.addPlanet(13, "kashyyyk_dead_forest", "terrain/kashyyyk_dead_forest.trn", true); terrainService.addPlanet(14, "kashyyyk_hunting", "terrain/kashyyyk_hunting.trn", true); terrainService.addPlanet(15, "kashyyyk_north_dungeons", "terrain/kashyyyk_north_dungeons.trn", true); terrainService.addPlanet(16, "kashyyyk_rryatt_trail", "terrain/kashyyyk_rryatt_trail.trn", true); - terrainService.addPlanet(17, "kashyyyk_south_dungeons", "terrain/kashyyyk_south_dungeons.trn", true);*/ + terrainService.addPlanet(17, "kashyyyk_south_dungeons", "terrain/kashyyyk_south_dungeons.trn", true); terrainService.addPlanet(18, "adventure1", "terrain/adventure1.trn", true); terrainService.addPlanet(19, "adventure2", "terrain/adventure2.trn", true); terrainService.addPlanet(20, "dungeon1", "terrain/dungeon1.trn", true); From 9975656a97367a69ff389584739095fb590952cb Mon Sep 17 00:00:00 2001 From: tacef Date: Fri, 18 Apr 2014 18:16:36 +0200 Subject: [PATCH 95/95] Added Generic House Small Style 02 --- .../player_house_generic_small_style_02.py | 19 +++++++++++++++++++ .../player_house_generic_small_style_02.py | 7 +++++++ src/services/DevService.java | 7 +++++++ 3 files changed, 33 insertions(+) create mode 100644 scripts/houses/player_house_generic_small_style_02.py diff --git a/scripts/houses/player_house_generic_small_style_02.py b/scripts/houses/player_house_generic_small_style_02.py new file mode 100644 index 00000000..4df4319c --- /dev/null +++ b/scripts/houses/player_house_generic_small_style_02.py @@ -0,0 +1,19 @@ +import sys +from services.housing import HouseTemplate +from engine.resources.scene import Point3D + +def setup(core): + houseTemplate = HouseTemplate("object/tangible/deed/player_house_deed/shared_generic_house_small_style_02_deed.iff", "object/building/player/shared_player_house_generic_small_style_02.iff", 2) + + houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3)) + houseTemplate.addPlaceablePlanet("tatooine") + houseTemplate.addPlaceablePlanet("corellia") + houseTemplate.addPlaceablePlanet("naboo") + houseTemplate.addPlaceablePlanet("talus") + houseTemplate.addPlaceablePlanet("rori") + houseTemplate.addPlaceablePlanet("dantooine") + houseTemplate.addPlaceablePlanet("lok") + houseTemplate.setDefaultItemLimit(200) + + core.housingService.addHousingTemplate(houseTemplate) + return \ No newline at end of file diff --git a/scripts/object/building/player/player_house_generic_small_style_02.py b/scripts/object/building/player/player_house_generic_small_style_02.py index ccad8904..d301f713 100644 --- a/scripts/object/building/player/player_house_generic_small_style_02.py +++ b/scripts/object/building/player/player_house_generic_small_style_02.py @@ -1,4 +1,11 @@ import sys def setup(core, object): + sign = core.objectService.createChildObject(object, 'object/tangible/sign/player/shared_house_address.iff', -1.9, 2.86, 8.35, -1, 0, -1) + print(sign) + object.setAttachment("structureSign", sign) + + structureterminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', 6.5, 0.5, -3.8, 0.707108, -0.707108, 3) + #structureterminal.setAttachment('radial_filename', 'structure_management_terminal') + structureterminal.setAttachment('housing_parentstruct', object) return \ No newline at end of file diff --git a/src/services/DevService.java b/src/services/DevService.java index ffcc207d..bae0eb8f 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -1225,6 +1225,13 @@ public class DevService implements INetworkDispatch { deed.setBMR(15); deed.setAttributes(); inventory.add(deed); + + templateString="object/tangible/deed/player_house_deed/shared_generic_house_small_style_02_deed.iff"; + deed = (Player_House_Deed)core.objectService.createObject(templateString, planet); + deed.setBMR(15); + deed.setAttributes(); + inventory.add(deed); + case 125: TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet); genericCraftingTool.setCustomName("Generic Crafting Tool");