From b8187b7b5f3bb3b16dd672074c241287df70ca00 Mon Sep 17 00:00:00 2001 From: Cekis Date: Fri, 3 Feb 2017 21:01:43 +0000 Subject: [PATCH] Fixed issue with determining a valid location. --- sku.0/sys.server/compiled/game/script/ai/beast.java | 2 +- sku.0/sys.server/compiled/game/script/base_class.java | 5 +++++ sku.0/sys.server/compiled/game/script/library/ai_lib.java | 2 +- sku.0/sys.server/compiled/game/script/library/utils.java | 2 +- .../compiled/game/script/systems/combat/combat_base.java | 8 ++++---- .../script/systems/missions/dynamic/mission_bounty.java | 2 +- .../game/script/systems/npc_lair/npc_lair_ai.java | 2 +- .../compiled/game/script/systems/tcg/target_creature.java | 2 +- .../script/systems/treasure_map/base/treasure_map.java | 2 +- 9 files changed, 16 insertions(+), 11 deletions(-) mode change 100644 => 100755 sku.0/sys.server/compiled/game/script/systems/treasure_map/base/treasure_map.java diff --git a/sku.0/sys.server/compiled/game/script/ai/beast.java b/sku.0/sys.server/compiled/game/script/ai/beast.java index 3ff3a23be..2bee4447b 100755 --- a/sku.0/sys.server/compiled/game/script/ai/beast.java +++ b/sku.0/sys.server/compiled/game/script/ai/beast.java @@ -449,7 +449,7 @@ public class beast extends script.base_script if (isIdValid(master)) { location masterLoc = getLocation(master); - if(isValidLocation(masterLoc, 1.0f)) + if(isValidLocation(masterLoc)) setHomeLocation(self, masterLoc); } return SCRIPT_CONTINUE; diff --git a/sku.0/sys.server/compiled/game/script/base_class.java b/sku.0/sys.server/compiled/game/script/base_class.java index 20ce7467d..3a9406464 100755 --- a/sku.0/sys.server/compiled/game/script/base_class.java +++ b/sku.0/sys.server/compiled/game/script/base_class.java @@ -17653,6 +17653,11 @@ public class base_class * @return True if there's nothing within radius of the position */ public static native boolean isValidLocation(location loc, float radius); + public static boolean isValidLocation(location loc){ + if(loc != null && isValidLocation(getValidLocation(loc, 0f, loc, 0f))) + return isValidLocation(loc, 0f); + return false; + } /** * Find a valid point inside the corral that's near the given point * @param corralCenter The center of the 'corral' that we'd like the object to be inside diff --git a/sku.0/sys.server/compiled/game/script/library/ai_lib.java b/sku.0/sys.server/compiled/game/script/library/ai_lib.java index c644aaacf..8df932e6b 100755 --- a/sku.0/sys.server/compiled/game/script/library/ai_lib.java +++ b/sku.0/sys.server/compiled/game/script/library/ai_lib.java @@ -918,7 +918,7 @@ public class ai_lib extends script.base_script } location myLoc = getLocation(npc); location targetLoc = getLocation(target); - if(isValidLocation(myLoc, 0f) && isValidLocation(targetLoc, 0f)) { + if(isValidLocation(myLoc) && isValidLocation(targetLoc)) { if (myLoc.x < targetLoc.x) { myLoc.x -= rand(20f, 40f); } else { diff --git a/sku.0/sys.server/compiled/game/script/library/utils.java b/sku.0/sys.server/compiled/game/script/library/utils.java index 009f90d02..b92d3a401 100755 --- a/sku.0/sys.server/compiled/game/script/library/utils.java +++ b/sku.0/sys.server/compiled/game/script/library/utils.java @@ -6686,7 +6686,7 @@ public class utils extends script.base_script location testLoc; for (obj_id obj : allObjects) { testLoc = getLocation(trial.getTop(obj)); - if(testLoc == null || !isValidLocation(testLoc, 1f)){ + if(testLoc == null || !isValidLocation(testLoc)){ continue; } if (testLoc.x < x1 || testLoc.x > x2 || testLoc.z < z1 || testLoc.z > z2) { diff --git a/sku.0/sys.server/compiled/game/script/systems/combat/combat_base.java b/sku.0/sys.server/compiled/game/script/systems/combat/combat_base.java index cb90d1685..5b70f3368 100755 --- a/sku.0/sys.server/compiled/game/script/systems/combat/combat_base.java +++ b/sku.0/sys.server/compiled/game/script/systems/combat/combat_base.java @@ -254,14 +254,14 @@ public class combat_base extends script.base_script atkRslt.weapon = weaponData.id; atkRslt.actionName = getStringCrc(toLower(actionName)); atkRslt.useLocation = true; - if(isValidLocation(targetLoc,1f)) { + if(targetLoc != null && isValidLocation(targetLoc)) { atkRslt.targetLocation = new vector(targetLoc.x, targetLoc.y, targetLoc.z); atkRslt.targetCell = targetLoc.cell; } else { location tl = getLocation(target); - if(!isValidLocation(tl, 1f)){ - LOG("heroics","IG-88 could not identify the target's (" + target + ":" + getPlayerFullName(target) + ") location (" + targetLoc.toString() + ") to attack it."); + if(!isValidLocation(tl)){ + LOG("combat","Could not identify the target's (" + target + ":" + getPlayerFullName(target) + ") location (" + targetLoc + ") to attack it."); } atkRslt.targetLocation = new vector(tl.x, tl.y, tl.z); atkRslt.targetCell = tl.cell; @@ -896,7 +896,7 @@ public class combat_base extends script.base_script { if (weaponData.weaponType == WEAPON_TYPE_DIRECTIONAL) { - if(actionData != null && isValidLocation(actionData.targetLoc, 1f)) { + if(actionData != null && isValidLocation(actionData.targetLoc)) { defenders = pvpGetTargetsInCone(self, self, actionData.targetLoc, length, width); } else{ diff --git a/sku.0/sys.server/compiled/game/script/systems/missions/dynamic/mission_bounty.java b/sku.0/sys.server/compiled/game/script/systems/missions/dynamic/mission_bounty.java index 4bdf1c071..01b862474 100755 --- a/sku.0/sys.server/compiled/game/script/systems/missions/dynamic/mission_bounty.java +++ b/sku.0/sys.server/compiled/game/script/systems/missions/dynamic/mission_bounty.java @@ -620,7 +620,7 @@ public class mission_bounty extends script.systems.missions.base.mission_dynamic } else { - if(isValidLocation(locSpawnLocation, 1f)) { + if(isValidLocation(locSpawnLocation)) { location locDestination = locations.getBountyLocation(locSpawnLocation.area); setObjVar(self, "locDestination", locDestination); fltDelay = rand(100, 300); diff --git a/sku.0/sys.server/compiled/game/script/systems/npc_lair/npc_lair_ai.java b/sku.0/sys.server/compiled/game/script/systems/npc_lair/npc_lair_ai.java index 6086f89bb..507f6176a 100755 --- a/sku.0/sys.server/compiled/game/script/systems/npc_lair/npc_lair_ai.java +++ b/sku.0/sys.server/compiled/game/script/systems/npc_lair/npc_lair_ai.java @@ -744,7 +744,7 @@ public class npc_lair_ai extends script.theme_park.poi.base utils.setScriptVar(self, "npc_lair.pathingToConverse", true); location destLoc = new location(getLocation(partner)); location myLoc = getLocation(self); - if(myLoc == null || !isValidLocation(myLoc, 1f)){ + if(myLoc == null || !isValidLocation(myLoc)){ return SCRIPT_CONTINUE; } if (myLoc.x < destLoc.x) diff --git a/sku.0/sys.server/compiled/game/script/systems/tcg/target_creature.java b/sku.0/sys.server/compiled/game/script/systems/tcg/target_creature.java index 7dc05ddad..9d997ff67 100755 --- a/sku.0/sys.server/compiled/game/script/systems/tcg/target_creature.java +++ b/sku.0/sys.server/compiled/game/script/systems/tcg/target_creature.java @@ -445,7 +445,7 @@ public class target_creature extends script.base_script { location there = getLocation(enemy); location here = getLocation(self); - if (!isValidLocation(there, 0f) || !isValidLocation(here, 0f) || there.cell != here.cell || utils.getDistance2D(here, there) > 60) + if (!isValidLocation(there) || !isValidLocation(here) || there.cell != here.cell || utils.getDistance2D(here, there) > 60) { target_dummy.removeAttackerFromCombat(self, enemy); } diff --git a/sku.0/sys.server/compiled/game/script/systems/treasure_map/base/treasure_map.java b/sku.0/sys.server/compiled/game/script/systems/treasure_map/base/treasure_map.java old mode 100644 new mode 100755 index d8019ab01..42504892c --- a/sku.0/sys.server/compiled/game/script/systems/treasure_map/base/treasure_map.java +++ b/sku.0/sys.server/compiled/game/script/systems/treasure_map/base/treasure_map.java @@ -830,7 +830,7 @@ public class treasure_map extends script.base_script for (int i = 0; (i < 30) && !goodLoc; i++) { treasureLoc = locations.getGoodLocationOutsideOfRegion(closestCity, 1, 1, 8000); - if (!isValidLocation(treasureLoc, 10.f) || treasureLoc == null || locations.isInCity(treasureLoc)) + if (!isValidLocation(treasureLoc) || treasureLoc == null || locations.isInCity(treasureLoc)) { continue; }