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:
Ceikry
2023-02-18 01:37:30 +00:00
committed by Ryan
parent d75e40b98c
commit cecd6f1947
11 changed files with 60 additions and 25 deletions
@@ -24,7 +24,7 @@ class DecantListener : InteractionListener {
val potcounts = HashMap<Potion, Int>()
val results: List<Item>
for (i in 0..27) {
val pot = (Consumables.getConsumableById(p.inventory.getId(i)) ?: continue) as Potion
val pot = (Consumables.getConsumableById(p.inventory.getId(i)) ?: continue) as? Potion ?: continue
if (pot != null) {
val dosage = p.inventory[i].name.replace("[^\\d.]".toRegex(), "").toInt()
if (potcounts[pot] != null) {
@@ -19,6 +19,8 @@ import core.tools.RandomFunction;
import java.util.ArrayList;
import java.util.List;
import static core.api.ContentAPIKt.sendMessage;
/**
* Represents a pickable door.
* @author Vexia
@@ -66,6 +68,10 @@ public class PickableDoorHandler extends OptionHandler {
return true;
}
if (option.equals("pick-lock")) {
if (door == null) {
sendMessage(player, "This door cannot be unlocked.");
return true;
}
door.pickLock(player, (Scenery) node);
return true;
}
@@ -294,9 +294,8 @@ public final class PCPortalNPC extends AbstractNPC {
}
}
session.sendString("<col=FF0000>0", 13 + getPortalIndex());
updateLifepoints = false;
session.getSquire().getSkills().heal(50);
session.getSquire().onImpact(this, null);
((PCSquireNPC) session.getSquire()).FlagInterfaceUpdate();
}
}
@@ -84,10 +84,14 @@ public final class PCSquireNPC extends AbstractNPC {
@Override
public void onImpact(final Entity entity, BattleState state) {
updateLifepoints = true;
FlagInterfaceUpdate();
super.onImpact(entity, state);
}
public void FlagInterfaceUpdate() {
updateLifepoints = true;
}
@Override
public int[] getIds() {
return new int[] { 3782, 3785 };
@@ -240,7 +240,7 @@ object PlunderUtils {
fun getDoorXp(player: Player, lockpick: Boolean) : Double
{
val room = getRoom(player)!!.room
val room = getRoom(player)?.room ?: return 0.0
var reward = when(room)
{
1 -> 60.0
@@ -408,7 +408,7 @@ public final class DBRCutscenePlugin extends CutscenePlugin {
getWiseOldMan().graphics(TELEKENTIC_GRAPHIC);
getWiseOldMan().getSkills().setStaticLevel(Skills.MAGIC, 99);
getWiseOldMan().getSkills().setLevel(Skills.MAGIC, 99);
SpellBookManager.SpellBook.MODERN.getSpell(65535).cast(getWiseOldMan(), GroundItemManager.get(PARTY_HAT.getId(), base.transform(20, 44, 0), player));
SpellBookManager.SpellBook.MODERN.getSpell(19).cast(getWiseOldMan(), GroundItemManager.get(PARTY_HAT.getId(), base.transform(20, 44, 0), player));
}
/**