diff --git a/scripts/commands/setgodmode.py b/scripts/commands/setgodmode.py index 7f397525..1dbe2c3e 100644 --- a/scripts/commands/setgodmode.py +++ b/scripts/commands/setgodmode.py @@ -23,6 +23,8 @@ def run(core, actor, target, commandString): arg3 = commandArgs[3] if len(commandArgs) > 4: arg4 = commandArgs[4] + if len(commandArgs) > 5: + arg5 = commandArgs[5] if not command: return @@ -41,7 +43,14 @@ def run(core, actor, target, commandString): elif command == 'teleport' and arg2 and arg3 and arg4: position = Point3D(float(arg2), float(arg3), float(arg4)) core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(arg1), position, actor.getOrientation(), None) - + + elif command == 'teleportplayer' and arg1 and arg2 and arg3 and arg4 and arg5: + player = core.chatService.getObjectByFirstName(arg1) + if player: + 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) diff --git a/scripts/commands/watch.py b/scripts/commands/watch.py index 07ca268d..98627f98 100644 --- a/scripts/commands/watch.py +++ b/scripts/commands/watch.py @@ -9,11 +9,11 @@ def run(core, actor, target, commandString): if not target and commandString is not None: target = core.chatService.getObjectByFirstName(commandString) - if target is None: + if target is None or actor.getPerformanceWatchee(): return - if target.getPosition().getDistance2D(actor.getWorldPosition()) > float(20): + if target.getWorldPosition().getDistance2D(actor.getWorldPosition()) > float(20): actor.sendSystemMessage(target.getCustomName() + ' is too far away to watch.', 0) return diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index de703925..fb8db748 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -1225,9 +1225,9 @@ public class CreatureObject extends TangibleObject implements IPersistent { setHamListCounter(getHamListCounter() + 1); delta = messageBuilder.buildHealthDelta(health); - notifyObservers(delta, true); this.health = health; } + notifyObservers(delta, true); } @@ -1249,9 +1249,10 @@ public class CreatureObject extends TangibleObject implements IPersistent { } setHamListCounter(getHamListCounter() + 1); delta = messageBuilder.buildActionDelta(action); - notifyObservers(delta, true); this.action = action; - } + } + notifyObservers(delta, true); + } public int getHamListCounter() { diff --git a/src/services/DevService.java b/src/services/DevService.java index e236decd..c058b7df 100644 --- a/src/services/DevService.java +++ b/src/services/DevService.java @@ -277,7 +277,7 @@ public class DevService implements INetworkDispatch { case 32: // Ranged Weapons SWGObject rifle1 = 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", 0.8); + 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"); @@ -286,7 +286,7 @@ public class DevService implements INetworkDispatch { SWGObject pistol = 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", 0.4); + 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"); @@ -299,12 +299,12 @@ public class DevService implements INetworkDispatch { inventory.add(ring); case 41: TangibleObject backpack = (TangibleObject) core.objectService.createObject("object/tangible/wearables/backpack/shared_backpack_krayt_skull.iff", planet); - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:agility_modified", 25) - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:constitution_modified", 30) - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:luck_modified", 25) - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:precision_modified", 35) - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:stamina_modified", 30) - backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:strength_modified", 35) + backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:agility_modified", 25); + backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:constitution_modified", 30); + backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:luck_modified", 25); + backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:precision_modified", 35); + backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:stamina_modified", 30); + backpack.setIntAttribute("cat_stat_mod_bonus.@stat_n:strength_modified", 35); inventory.add(backpack); return; diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 764e4c7e..2d106485 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -123,21 +123,17 @@ public class PlayerService implements INetworkDispatch { }, 30, 30, TimeUnit.SECONDS); scheduler.scheduleAtFixedRate(() -> { - synchronized(creature.getMutex()) { - if(creature.getAction() < creature.getMaxAction() && creature.getPosture() != 14) { - if(creature.getCombatFlag() == 0) - creature.setAction(creature.getAction() + (15 + creature.getLevel() * 5)); - else - creature.setAction(creature.getAction() + ((15 + creature.getLevel() * 5) / 2)); - } + if(creature.getAction() < creature.getMaxAction() && creature.getPosture() != 14) { + if(creature.getCombatFlag() == 0) + creature.setAction(creature.getAction() + (15 + creature.getLevel() * 5)); + else + creature.setAction(creature.getAction() + ((15 + creature.getLevel() * 5) / 2)); } }, 0, 1000, TimeUnit.MILLISECONDS); scheduler.scheduleAtFixedRate(() -> { - synchronized(creature.getMutex()) { - if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14) - creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4)); - } + if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14) + creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4)); }, 0, 1000, TimeUnit.MILLISECONDS); /*final PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost"); @@ -503,12 +499,13 @@ public class PlayerService implements INetworkDispatch { if(cell == null) return; + creature.setPosture((byte) 0); + core.simulationService.transferToPlanet(creature, cloner.getPlanet(), spawnPoint.getPosition(), spawnPoint.getOrientation(), cell); creature.setHealth(creature.getMaxHealth()); creature.setAction(creature.getMaxAction()); - creature.setPosture((byte) 0); creature.setSpeedMultiplierBase(1); creature.setTurnRadius(1); diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 30e09d54..a7814884 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -174,7 +174,7 @@ public class SimulationService implements INetworkDispatch { public void insertSnapShotObjects() { List objectList = new ArrayList(core.objectService.getObjectList().values()); for(SWGObject obj : objectList) { - if(obj.getParentId() == 0 && (obj.isInSnapshot() || obj.getAttachment("isBuildout") != null)) + if(obj.getParentId() == 0 && /*(*/obj.isInSnapshot() /*|| obj.getAttachment("isBuildout") != null)*/) add(obj, obj.getPosition().x, obj.getPosition().z); } } diff --git a/src/services/ai/states/AIState.java b/src/services/ai/states/AIState.java index 203a3d3f..e36a8c3a 100644 --- a/src/services/ai/states/AIState.java +++ b/src/services/ai/states/AIState.java @@ -187,7 +187,7 @@ public abstract class AIState { Point3D newPosition = new Point3D(); boolean foundNewPos = findNewPosition(actor, speed, maxDistance, newPosition); - if(!foundNewPos) + if(!foundNewPos || (newPosition.x == 0 && newPosition.z == 0)) return; Point3D newWorldPos = newPosition.getWorldPosition(); diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index b49e0fe7..19c2941d 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -176,9 +176,7 @@ public class ObjectService implements INetworkDispatch { public void loadServerTemplates() { System.out.println("Loading server templates..."); - for(Runnable r : loadServerTemplateTasks) { - r.run(); - } + loadServerTemplateTasks.forEach(Runnable::run); loadServerTemplateTasks.clear(); System.out.println("Finished loading server templates..."); } @@ -882,8 +880,8 @@ public class ObjectService implements INetworkDispatch { if (duplicate.containsKey(containerId)) { containerId = duplicate.get(containerId); } - - if (objectId != 0 && getObject(objectId) != null) { + String planetName = planet.getName(); + if (objectId != 0 && getObject(objectId) != null && (planetName.contains("dungeon") || planetName.contains("adventure"))) { SWGObject container = getObject(containerId); int x = ((int) (px + ((container == null) ? x1 : container.getPosition().x))); int z = ((int) (pz + ((container == null) ? z1 : container.getPosition().z))); @@ -907,6 +905,8 @@ public class ObjectService implements INetworkDispatch { SWGObject object; if(objectId != 0 && containerId == 0) { if(portalCRC != 0) { + if (core.getBuildingODB().contains(objectId, Long.class, BuildingObject.class) && !duplicate.containsValue(objectId)) + continue; containers.add(objectId); object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz), null, true, false); object.setAttachment("childObjects", null); @@ -960,6 +960,7 @@ public class ObjectService implements INetworkDispatch { building.createTransaction(core.getBuildingODB().getEnvironment()); core.getBuildingODB().put(building, Long.class, BuildingObject.class, building.getTransaction()); building.getTransaction().commitSync(); + destroyObject(building); } }