Added support for varying log levels configurable in the server config (see log_level in default.conf)

Error logs now properly print to stderr when possible
Colour-coded logs
Addressed a scenario in which outgoing packet writes could get hung up
Fixed interface incorrect definition message on server startup
This commit is contained in:
Ceikry
2023-03-01 08:01:14 +00:00
committed by Ryan
parent e1faa64af7
commit 88a2f354b4
171 changed files with 723 additions and 475 deletions
@@ -74,7 +74,7 @@ class LarryHandler(player: Player? = null) : core.game.dialogue.DialoguePlugin(p
}
val level = getStatLevel(player, skill)
System.out.println("Level: $level")
val expGained = points?.toDouble()?.times((level * 25))
System.out.print("exp: $expGained")
player.skills.addExperience(skill,expGained!!)
@@ -3,10 +3,12 @@ package content.global.activity.penguinhns
import org.json.simple.JSONObject
import core.ServerStore
import core.api.StartupListener
import core.api.log
import core.game.worldevents.PluginSet
import core.game.worldevents.WorldEvent
import core.game.world.GameWorld
import core.plugin.ClassScanner
import core.tools.Log
import core.tools.SystemLogger
class PenguinHNSEvent : StartupListener {
@@ -15,7 +17,7 @@ class PenguinHNSEvent : StartupListener {
override fun startup() {
manager.rebuildVars()
ClassScanner.definePlugins(LarryHandler(), NotebookHandler())
SystemLogger.logInfo(this::class.java, "Penguin HNS initialized.")
log(this::class.java, Log.FINE, "Penguin HNS initialized.")
}
companion object {
@@ -7,6 +7,8 @@ import core.game.world.map.Location
import org.json.simple.JSONArray
import org.json.simple.JSONObject
import core.ServerStore.Companion.toJSONArray
import core.api.log
import core.tools.Log
import java.util.*
class PenguinManager{
@@ -31,7 +33,7 @@ class PenguinManager{
private fun updateStoreFile(){
val jsonTags = JSONArray()
tagMapping.filter { it.value.isNotEmpty() }.forEach { (ordinal,taggers) ->
SystemLogger.logInfo(this::class.java, "$ordinal - ${taggers.first()}")
log(this::class.java, Log.FINE, "$ordinal - ${taggers.first()}")
val tag = JSONObject()
tag["ordinal"] = ordinal
tag["taggers"] = taggers
@@ -64,8 +66,4 @@ class PenguinManager{
penguins = spawnedOrdinals.toMutableList()
}
}
fun log(message: String){
SystemLogger.logInfo(this::class.java, "[Penguins] $message")
}
}
@@ -15,6 +15,7 @@ import core.game.interaction.IntType
import core.tools.SystemLogger
import core.game.system.command.Privilege
import core.game.world.GameWorld
import core.tools.Log
import core.tools.secondsToTicks
class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Commands, StartupListener {
@@ -112,7 +113,7 @@ class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Com
}
override fun startup() {
SystemLogger.logInfo(this::class.java, "Shooting Stars initialized.")
log(this::class.java, Log.FINE, "Shooting Stars initialized.")
}
private data class ScoreboardEntry(val player: String, val time: Int)
@@ -3,6 +3,7 @@ package content.global.activity.ttrail;
import core.game.component.Component;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.tools.Log;
import core.tools.SystemLogger;
import core.game.world.map.zone.MapZone;
import core.game.world.map.zone.ZoneBorders;
@@ -15,6 +16,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static core.api.ContentAPIKt.log;
/**
* Represents a clue scroll plugin.
* @author Vexia
@@ -138,7 +141,7 @@ public abstract class ClueScrollPlugin extends MapZone implements Plugin<Object>
if(clue.getClueId() == 2681)
return;
if (CLUE_SCROLLS.containsKey(clue.getClueId())) {
SystemLogger.logErr(this.getClass(), "Error! Plugin already registered with clue id - " + clue.getClueId() + ", trying to register " + clue.getClass().getCanonicalName() + " the real plugin using the id is " + CLUE_SCROLLS.get(clue.getClueId()).getClass().getCanonicalName() + "!");
log(this.getClass(), Log.ERR, "Error! Plugin already registered with clue id - " + clue.getClueId() + ", trying to register " + clue.getClass().getCanonicalName() + " the real plugin using the id is " + CLUE_SCROLLS.get(clue.getClueId()).getClass().getCanonicalName() + "!");
return;
}
List<ClueScrollPlugin> organized = (List<ClueScrollPlugin>) ORGANIZED.get(clue.getLevel());
@@ -169,7 +172,7 @@ public abstract class ClueScrollPlugin extends MapZone implements Plugin<Object>
public static Item getClue(ClueLevel clueLevel) {
List<ClueScrollPlugin> clues = ORGANIZED.get(clueLevel);
if (clues == null) {
SystemLogger.logErr(ClueScrollPlugin.class, "Error! There are no clues for level " + clueLevel + "!");
log(ClueScrollPlugin.class, Log.ERR, "Error! There are no clues for level " + clueLevel + "!");
return null;
}
ClueScrollPlugin clue = clues.get(RandomFunction.random(clues.size()));
@@ -1,20 +1,17 @@
package content.global.ame
import core.api.Commands
import core.api.LoginListener
import core.api.*
import core.game.event.EventHook
import core.game.event.TickEvent
import core.api.getAttribute
import core.api.setAttribute
import core.game.node.entity.Entity
import core.game.node.entity.player.Player
import core.game.world.map.zone.ZoneRestriction
import core.tools.RandomFunction
import core.api.Event
import core.tools.SystemLogger
import core.game.system.command.Privilege
import core.game.world.GameWorld
import core.game.world.repository.Repository
import core.tools.Log
import kotlin.random.Random
class RandomEventManager(val player: Player? = null) : LoginListener, EventHook<TickEvent>, Commands {
@@ -30,7 +27,6 @@ class RandomEventManager(val player: Player? = null) : LoginListener, EventHook<
setAttribute(player, "random-manager", instance)
instance.rollNextSpawn()
instance.enabled = true
SystemLogger.logRE("Initialized REManager for ${player.username}.")
}
override fun process(entity: Entity, event: TickEvent) {
@@ -62,12 +58,12 @@ class RandomEventManager(val player: Player? = null) : LoginListener, EventHook<
event = ame.npc.create(player,ame.loot,ame.type)
if (event!!.spawnLocation == null) {
nextSpawn = GameWorld.ticks + 3000
SystemLogger.logWarn(this::class.java, "Tried to spawn random event for ${player.username} but spawn location was null!")
log(this::class.java, Log.WARN, "Tried to spawn random event for ${player.username} but spawn location was null!")
return
}
event!!.init()
rollNextSpawn()
SystemLogger.logRE("Fired ${event!!.name} for ${player.username}")
log(this::class.java, Log.FINE, "Fired ${event!!.name} for ${player.username}")
}
private fun rollNextSpawn() {
@@ -9,6 +9,7 @@ import core.game.node.entity.player.link.audio.Audio
import core.game.node.entity.skill.Skills
import core.plugin.Initializable
import core.plugin.Plugin
import core.tools.Log
import core.tools.SystemLogger
/**
@@ -70,7 +71,7 @@ class ExperienceInterface() : ComponentPlugin() {
46 -> Skills.WOODCUTTING
40 -> Skills.FLETCHING
51 -> Skills.CONSTRUCTION
else -> Skills.SLAYER.also { SystemLogger.logWarn(this::class.java, "EXP_INTERFACE: Invalid SKILL CHOICE BUTTON: $button") }
else -> Skills.SLAYER.also { log(this::class.java, Log.WARN, "EXP_INTERFACE: Invalid SKILL CHOICE BUTTON: $button") }
}
player.setAttribute("exp_interface:skill",skill)
}
@@ -41,7 +41,7 @@ public class QuestTabInterface extends ComponentPlugin {
break;
default:
// if (GameWorld.isEconomyWorld()) {
//System.out.println("Quest button: " + button);
Quest quest = p.getQuestRepository().forButtonId(button);
if (quest != null) {
p.getInterfaceManager().open(new Component(275));
@@ -51,7 +51,7 @@ public final class ShoppingPlugin extends ComponentPlugin {
return true;
}
if (viewer == null) {
System.out.println("shop is null");
return true;
}
final Container container = button == 0 ? player.getInventory() : viewer.getShop().getContainer(viewer.getTabIndex());
@@ -31,7 +31,7 @@ public final class WorldMapInterface extends ComponentPlugin {
player.updateSceneGraph(true);
return true;
default:
//SystemLogger.logErr(this.getClass(), "World map: buttonid: " + button + ", opcode: " + opcode + ", slot: " + slot);
//log(this.getClass(), Log.ERR, "World map: buttonid: " + button + ", opcode: " + opcode + ", slot: " + slot);
return true;
}
}
@@ -17,6 +17,7 @@ import core.game.ge.GrandExchangeOffer
import core.game.ge.GrandExchangeRecords
import core.game.ge.PriceIndex
import core.game.interaction.InterfaceListener
import core.tools.Log
import core.tools.SystemLogger
/**
@@ -199,7 +200,7 @@ class StockMarket : InterfaceListener {
{
if(offer == null)
{
SystemLogger.logWarn(this::class.java, "Opened offer was null and was attempted to be aborted!")
log(this::class.java, Log.WARN, "Opened offer was null and was attempted to be aborted!")
return
}
sendMessage(player, "Abort request acknowledged. Please be aware that your offer may")
@@ -207,7 +208,7 @@ class StockMarket : InterfaceListener {
if(!offer.isActive)
{
SystemLogger.logWarn(this::class.java, "Offer ${offer.uid}[${offer.index}]: ${if(offer.sell) "s" else "b"} ${offer.itemID}x ${offer.amount} was NO LONGER active when abort attempted")
log(this::class.java, Log.WARN, "Offer ${offer.uid}[${offer.index}]: ${if(offer.sell) "s" else "b"} ${offer.itemID}x ${offer.amount} was NO LONGER active when abort attempted")
return
}
offer.offerState = OfferState.ABORTED
@@ -341,7 +342,7 @@ class StockMarket : InterfaceListener {
val item = offer.withdraw[index]
if(item == null)
{
SystemLogger.logWarn(this::class.java, "Offer withdraw[$index] is null!")
log(this::class.java, Log.WARN, "Offer withdraw[$index] is null!")
return
}
@@ -1,5 +1,6 @@
package content.global.handlers.item
import core.api.log
import core.cache.def.impl.ItemDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
@@ -8,6 +9,7 @@ import core.game.node.item.Item
import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
import core.tools.Log
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.rs09.consts.Items
@@ -63,7 +65,7 @@ class EnchantJewelleryTabOption : OptionHandler(){
}
if(items == null){
SystemLogger.logWarn(this::class.java, "UNHANDLED ENCHANT ITEM TABLET [ID: ${node?.id}")
log(this::class.java, Log.WARN, "UNHANDLED ENCHANT ITEM TABLET [ID: ${node?.id}")
return true
}
@@ -14,7 +14,7 @@ import content.global.skill.agility.AgilityHandler;
public class RopeSwing extends UseWithHandler {
@Override
public boolean handle(NodeUsageEvent event) {
System.out.println("Trying to handle.");
if(event.getUsedWith() instanceof Scenery){
Scenery object = event.getUsedWith().asScenery();
int objId = object.getId();
@@ -11,9 +11,12 @@ import core.game.node.entity.player.Player;
import core.game.node.scenery.Scenery;
import core.plugin.Initializable;
import core.plugin.Plugin;
import core.tools.Log;
import core.tools.SystemLogger;
import core.plugin.ClassScanner;
import static core.api.ContentAPIKt.log;
/**
* The build option handling plugin.
* @author Emperor
@@ -63,8 +66,8 @@ public final class BuildOptionPlugin extends OptionHandler {
}
Hotspot hotspot = player.getHouseManager().getHotspot(object);
if (hotspot == null || !isBuildable(player, object, hotspot)) {
System.out.println(hotspot == null);
SystemLogger.logErr(this.getClass(), "Construction (building): " + hotspot + " : " + object + " chunkX = " + object.getLocation().getChunkX() + ", chunkY = " + object.getLocation().getChunkY());
log(this.getClass(), Log.ERR, "Construction (building): " + hotspot + " : " + object + " chunkX = " + object.getLocation().getChunkX() + ", chunkY = " + object.getLocation().getChunkY());
return true;
}
@@ -16,12 +16,15 @@ import core.game.world.update.flag.context.Animation;
import core.net.packet.PacketRepository;
import core.net.packet.context.ContainerContext;
import core.net.packet.out.ContainerPacket;
import core.tools.Log;
import org.jetbrains.annotations.NotNull;
import core.tools.SystemLogger;
import java.util.ArrayList;
import java.util.Arrays;
import static core.api.ContentAPIKt.log;
/**
* Utility class for building.
* @author Emperor
@@ -135,7 +138,7 @@ public final class BuildingUtils {
player.getPacketDispatch().sendString("Level " + decoration.getLevel(), 396, 140 + menuIndex);
//player.getPacketDispatch().sendItemZoomOnInterface(items[i].protocol(), 50000, 396, 49 + i);
}
System.out.println(c261Value);
player.getConfigManager().set(261, c261Value);
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, 396, 132, 8, items, false));
}
@@ -287,7 +290,7 @@ public final class BuildingUtils {
}
}
} else {
SystemLogger.logErr(BuildingUtils.class, "Couldn't find stairs! " + plane);
log(BuildingUtils.class, Log.ERR, "Couldn't find stairs! " + plane);
}
}
}
@@ -407,7 +410,7 @@ public final class BuildingUtils {
}
}
} else {
SystemLogger.logErr(BuildingUtils.class, "Couldn't find stairs! " + plane);
log(BuildingUtils.class, Log.ERR, "Couldn't find stairs! " + plane);
}
}
}
@@ -549,7 +552,7 @@ public final class BuildingUtils {
}
}
//(0=east, 1=south, 2=west, 3=north).
// System.out.println("Roof information: index=" + index + ", exit count=" + count + "; array=" + Arrays.toString(exits));
if (count == 4) {
room = Room.create(player, RoomProperties.ROOF_4_EXIT);
}
@@ -10,8 +10,11 @@ import core.game.node.entity.skill.Skills;
import core.game.node.scenery.Scenery;
import core.plugin.Initializable;
import core.plugin.Plugin;
import core.tools.Log;
import core.tools.SystemLogger;
import static core.api.ContentAPIKt.log;
/**
* Handles the creating of a decoration object.
* @author Emperor
@@ -38,12 +41,12 @@ public final class ConstructionInterface extends ComponentPlugin {
Hotspot hotspot = player.getAttribute("con:hotspot");
Scenery object = player.getAttribute("con:hsobject");
if (hotspot == null || object == null) {
SystemLogger.logErr(this.getClass(), "Failed building decoration " + hotspot + " : " + object);
log(this.getClass(), Log.ERR, "Failed building decoration " + hotspot + " : " + object);
break;
}
slot = ((slot % 2 != 0) ? 4 : 0) + (slot >> 1);
if (slot >= hotspot.getHotspot().getDecorations().length) {
SystemLogger.logErr(this.getClass(), "Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
log(this.getClass(), Log.ERR, "Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
break;
}
boolean debug = player.isStaff();
@@ -104,7 +107,7 @@ public final class ConstructionInterface extends ComponentPlugin {
break;
case 402:
int index = button - 160;
SystemLogger.logErr(this.getClass(), "BuildRoom Interface Index: " + index);
log(this.getClass(), Log.FINE, "BuildRoom Interface Index: " + index);
if (index > -1 && index < RoomProperties.values().length) {
player.getDialogueInterpreter().open("con:room", RoomProperties.values()[index]);
return true;
@@ -17,6 +17,7 @@ import core.game.world.map.build.DynamicRegion;
import core.game.world.map.zone.ZoneBorders;
import core.game.world.map.zone.ZoneBuilder;
import core.game.world.update.flag.context.Animation;
import core.tools.Log;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.simple.JSONArray;
@@ -27,6 +28,7 @@ import core.game.world.GameWorld;
import java.awt.*;
import java.nio.ByteBuffer;
import static core.api.ContentAPIKt.log;
import static core.api.regionspec.RegionSpecificationKt.fillWith;
import static core.api.regionspec.RegionSpecificationKt.using;
@@ -323,7 +325,7 @@ public final class HouseManager {
*/
public Location getEnterLocation() {
if (houseRegion == null) {
SystemLogger.logErr(this.getClass(), "House wasn't constructed yet!");
log(this.getClass(), Log.ERR, "House wasn't constructed yet!");
return null;
}
for (int x = 0; x < 8; x++) {
@@ -1,5 +1,6 @@
package content.global.skill.crafting.lightsources
import core.api.log
import core.cache.def.impl.ItemDefinition
import core.game.container.Container
import core.game.interaction.OptionHandler
@@ -9,6 +10,7 @@ import core.game.node.item.Item
import core.tools.SystemLogger
import core.plugin.Initializable
import core.plugin.Plugin
import core.tools.Log
/**
@@ -28,7 +30,7 @@ class LightSourceExtinguisher : OptionHandler(){
val lightSource = LightSources.forId(node.id)
lightSource ?: return false.also { SystemLogger.logWarn(this::class.java, "UNHANDLED EXTINGUISH OPTION: ID = ${node.id}") }
lightSource ?: return false.also { log(this::class.java, Log.WARN, "UNHANDLED EXTINGUISH OPTION: ID = ${node.id}") }
player.inventory.replace(node.asItem(), Item(lightSource.fullID))
return true
@@ -73,7 +73,6 @@ class FarmingState(player: Player? = null) : State(player) {
val cBin = CompostBins.values()[binOrdinal]
val b = cBin.getBinForPlayer(player)
b.parse(bin["binData"] as JSONObject)
SystemLogger.logErr(this::class.java, "bin size " + binMap.size)
}
}
if(_data.containsKey("farming-patches")){
@@ -1,5 +1,6 @@
package content.global.skill.farming
import core.api.log
import core.cache.def.impl.SceneryDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
@@ -8,6 +9,7 @@ import core.game.node.entity.skill.Skills
import core.tools.SystemLogger
import core.plugin.Initializable
import core.plugin.Plugin
import core.tools.Log
import java.util.concurrent.TimeUnit
@Initializable
@@ -39,7 +41,7 @@ class HealthChecker : OptionHandler(){
PatchType.FRUIT_TREE -> patch.setCurrentState(patch.getCurrentState() - 14)
PatchType.BUSH -> patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 4)
PatchType.CACTUS -> patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 3)
else -> SystemLogger.logErr(this::class.java,"Unreachable patch type from when(type) switch in HealthChecker.kt line 36")
else -> log(this::class.java, Log.ERR, "Unreachable patch type from when(type) switch in HealthChecker.kt line 36")
}
if(type == PatchType.FRUIT_TREE){
@@ -1,6 +1,8 @@
package content.global.skill.farming
import core.api.log
import core.game.node.entity.player.Player
import core.tools.Log
import core.tools.RandomFunction
import org.rs09.consts.Items
import core.tools.SystemLogger
@@ -110,7 +112,7 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
PatchType.FRUIT_TREE -> player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,plantable!!.value + plantable!!.stages + 20)
PatchType.BUSH -> player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,250 + (plantable!!.ordinal - Plantable.REDBERRY_SEED.ordinal))
PatchType.CACTUS -> player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset, 31)
else -> SystemLogger.logWarn(this::class.java, "Invalid setting of isCheckHealth for patch type: " + patch.type.name)
else -> log(this::class.java, Log.WARN, "Invalid setting of isCheckHealth for patch type: " + patch.type.name)
}
} else {
when(patch.type){
@@ -59,7 +59,7 @@ public enum FishingSpot {
for(FishingOption o : this.options){
if(o.getName().equals(name)){return o;}
}
System.out.println("Unhandled fishing spot option, spot id: " + this.ids[0] + " desired fishing option: " + name);
return FishingOption.SMALL_NET; //safe, default return.
}
@@ -645,7 +645,6 @@ public enum SkillingResource {
static {
for (SkillingResource resource : SkillingResource.values()) {
if (RESOURCES.containsKey(resource.id)) {
SystemLogger.logErr(SkillingResource.class, "Already contained resource " + resource.getId() + " - " + resource.name());
}
RESOURCES.put(resource.id, resource);
}
@@ -54,7 +54,7 @@ class FishingPulse(player: Player?, npc: NPC, private val option: FishingOption?
}
player.debug(player.inventory.containsItem(option.tool).toString())
if (!player.inventory.containsItem(option.tool) && !hasBarbTail()) {
//System.out.println(isBareHanded(player));
player.dialogueInterpreter.sendDialogue("You need a " + option.tool.name.toLowerCase() + " to catch these fish.")
stop()
return false
@@ -5,6 +5,7 @@ import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.node.scenery.Scenery;
import core.tools.Log;
import core.tools.SystemLogger;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
@@ -12,6 +13,8 @@ import core.game.world.update.flag.context.Animation;
import java.util.ArrayList;
import java.util.List;
import static core.api.ContentAPIKt.log;
/**
* Represents a trap type.
* @author Vexia
@@ -101,7 +104,7 @@ public enum Traps {
return;
}
if (instance.getWrapper(object) == null) {
SystemLogger.logErr(this.getClass(), "NO WRAPPER (HUNTER DISMANTLE)");
log(this.getClass(), Log.ERR, "NO WRAPPER (HUNTER DISMANTLE)");
return;
}
player.faceLocation(object.getLocation());
@@ -1,5 +1,6 @@
package content.global.skill.hunter.tracking
import core.api.log
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.scenery.Scenery
@@ -14,6 +15,7 @@ import core.tools.RandomFunction
import org.rs09.consts.Items
import core.tools.SystemLogger
import core.game.world.GameWorld
import core.tools.Log
import java.util.*
/**
@@ -50,7 +52,7 @@ abstract class HunterTracking : OptionHandler(){
val trail = player.getAttribute(attribute, ArrayList<TrailDefinition>())
val initialTrail = getInitialTrail(startobj)
if(initialTrail == null) {
SystemLogger.logWarn(this::class.java, "UNHANDLED STARTING OBJECT FOR HUNTER TRACKING $startobj")
log(this::class.java, Log.WARN, "UNHANDLED STARTING OBJECT FOR HUNTER TRACKING $startobj")
return
}
trail.add(initialTrail)
@@ -1,7 +1,9 @@
package content.global.skill.magic
import core.api.log
import core.game.node.Node
import core.game.node.entity.player.Player
import core.tools.Log
import core.tools.SystemLogger
object SpellListeners {
@@ -18,12 +20,12 @@ object SpellListeners {
}
fun get(spellID: Int, type: Int, book: String): ((Player,Node?) -> Unit)?{
SystemLogger.logInfo(this::class.java, "Getting $book:$spellID:$type")
log(this::class.java, Log.FINE, "Getting $book:$spellID:$type")
return castMap["$book:$spellID:$type"]
}
fun get(spellID: Int, type: Int, id: Int, book: String): ((Player,Node?) -> Unit)?{
SystemLogger.logInfo(this::class.java, "Getting $book:$spellID:$type:$id")
log(this::class.java, Log.FINE, "Getting $book:$spellID:$type:$id")
return castMap["$book:$spellID:$type:$id"]
}
@@ -105,7 +105,7 @@ public final class ChargeOrbSpells extends MagicSpell {
&& objectId == 2151
&& p.getInventory().containsItems(Runes.COSMIC_RUNE.getItem(15), Runes.WATER_RUNE.getItem(150), new Item(UNPOWERED_ORB.getId(), 5))) {
p.setAttribute("/save:diary:seers:water-orb-can-earn", true);
System.out.println("can_earn_true");
p.setAttribute("/save:diary:seers:water-orb", 1);
}
if (!meetsRequirements(entity, true, true)) {
@@ -4,7 +4,6 @@ import core.api.*
import core.game.node.Node
import core.plugin.ClassScanner.definePlugin
import core.tools.colorize
import core.tools.SystemLogger.logInfo
import core.game.node.scenery.Scenery
import core.game.node.entity.impl.Animator
import core.game.node.entity.npc.NPC
@@ -28,6 +27,7 @@ import org.rs09.consts.Scenery as Sceneries
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import core.game.world.GameWorld
import core.tools.Log
import kotlin.math.cos
import kotlin.math.sin
import kotlin.random.Random
@@ -255,7 +255,7 @@ class AbyssPlugin : InteractionListener {
const val BURN_PROGRESS = 16
const val DISTRACT_PROGRESS = 18
fun handleObstacle(obstacle: Node, player: Player, skill: Int, varbitVal: Int?, animation: Animation, messages: Array<String>): Boolean {
logInfo(this::class.java, "handled abyss ${obstacle.name}")
log(this::class.java, Log.FINE, "handled abyss ${obstacle.name}")
player.lock()
player.animate(animation)
GameWorld.Pulser.submit(object : Pulse(1, player) {
@@ -23,6 +23,7 @@ import core.game.world.map.zone.ZoneRestriction;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import core.tools.Log;
import core.tools.RandomFunction;
import core.game.node.entity.combat.CombatPulse;
import core.game.node.entity.combat.CombatSwingHandler;
@@ -33,6 +34,8 @@ import content.global.skill.summoning.SummoningPouch;
import java.util.ArrayList;
import java.util.List;
import static core.api.ContentAPIKt.log;
/**
* Represents a familiar.
* @author Emperor
@@ -579,7 +582,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
face(owner);
}
if (!isRenderable() && owner.isActive()) {
// SystemLogger.logErr(this.getClass(), "Familiar in inactive region!");
// log(this.getClass(), Log.ERR, "Familiar in inactive region!");
getWalkingQueue().update();
getUpdateMasks().prepare(this);
}
@@ -628,7 +631,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (int id : getIds()) {
if (FamiliarManager.getFamiliars().containsKey(id)) {
SystemLogger.logErr(this.getClass(), "Familiar " + id + " was already registered!");
log(this.getClass(), Log.ERR, "Familiar " + id + " was already registered!");
return null;
}
FamiliarManager.getFamiliars().put(id, this);
@@ -75,7 +75,7 @@ public class PickableDoorHandler extends OptionHandler {
door.pickLock(player, (Scenery) node);
return true;
}
System.out.println("Unhandled door: " + node.getId());
return false;
}