Fixed many non-critical exceptions
Fixed an issue that could result in server hang Added a new command ::npcsearch for searching for NPC IDs
This commit is contained in:
@@ -194,6 +194,8 @@ public abstract class MovementPulse extends Pulse {
|
||||
Location ml = mover.getLocation();
|
||||
// Allow being within 1 square of moving entities to interact with them.
|
||||
int radius = destination instanceof Entity && ((Entity)destination).getWalkingQueue().hasPath() ? 1 : 0;
|
||||
if (interactLocation == null)
|
||||
return false;
|
||||
if (Math.max(Math.abs(ml.getX() - interactLocation.getX()), Math.abs(ml.getY() - interactLocation.getY())) <= radius) {
|
||||
try {
|
||||
if (near || pulse()) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import core.game.world.map.Direction;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.Point;
|
||||
import core.game.world.map.RegionManager;
|
||||
import core.tools.SystemLogger;
|
||||
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
@@ -374,7 +375,7 @@ public final class WalkingQueue {
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
if (loc == null) {
|
||||
throw new IllegalStateException(
|
||||
SystemLogger.logErr(this.getClass(),
|
||||
"The entity location provided was null."
|
||||
+ "Are you sure anything down the stack trace isn't providing an NPC with a null location?"
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package core.game.system.command.sets
|
||||
|
||||
import content.global.activity.jobs.JobManager
|
||||
import core.api.removeAttribute
|
||||
import content.global.skill.slayer.Master
|
||||
import core.api.sendMessage
|
||||
import core.cache.Cache
|
||||
import core.cache.def.impl.DataMap
|
||||
@@ -179,5 +179,23 @@ class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) {
|
||||
define("testpacket") { player, _ ->
|
||||
PacketWriteQueue.write(ResetInterface(), PlayerContext(player))
|
||||
}
|
||||
|
||||
define("npcsearch", Privilege.STANDARD, "npcsearch name", "Searches for NPCs that match the name either in main or children.") {player, strings ->
|
||||
val name = strings.slice(1 until strings.size).joinToString(" ").lowercase()
|
||||
for (id in 0 until 9000) {
|
||||
val def = NPCDefinition.forId(id)
|
||||
if (def.name.isNotBlank() && (def.name.lowercase().contains(name) || name.contains(def.name.lowercase()))) {
|
||||
notify(player, "$id - ${def.name}")
|
||||
}
|
||||
else {
|
||||
for ((childId,index) in def.childNPCIds?.withIndex() ?: continue) {
|
||||
val childDef = NPCDefinition.forId(childId)
|
||||
if (childDef.name.lowercase().contains(name) || name.contains(childDef.name.lowercase())) {
|
||||
notify(player, "$childId child($id) index $index - ${childDef.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user