Ice trolls can now attack the miner NPCs.
Removed debug code from the packet write queue
This commit is contained in:
@@ -593,6 +593,16 @@ object ContentAPI {
|
|||||||
return RegionManager.getLocalNpcs(entity).firstOrNull { it.id == id }
|
return RegionManager.getLocalNpcs(entity).firstOrNull { it.id == id }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of nearby NPCs that match the given IDs.
|
||||||
|
* @param entity the entity to check around
|
||||||
|
* @param ids the IDs of the NPCs to look for
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun findLocalNPCs(entity: Entity, ids: IntArray): List<NPC>{
|
||||||
|
return RegionManager.getSurroundingNPCs(entity).filter { it.id in ids }.toList()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of an attribute key from the Entity's attributes store
|
* Gets the value of an attribute key from the Entity's attributes store
|
||||||
* @param entity the entity to get the attribute from
|
* @param entity the entity to get the attribute from
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package rs09.game.node.entity.npc.other
|
||||||
|
|
||||||
|
import api.ContentAPI
|
||||||
|
import core.game.node.entity.npc.AbstractNPC
|
||||||
|
import core.game.world.map.Location
|
||||||
|
import core.plugin.Initializable
|
||||||
|
import core.tools.RandomFunction
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
import rs09.game.system.SystemLogger
|
||||||
|
|
||||||
|
@Initializable
|
||||||
|
class IceTrollJatizsoCaves : AbstractNPC {
|
||||||
|
//Constructor spaghetti because Arios I guess
|
||||||
|
constructor() : super(NPCs.ICE_TROLL_MALE_5474, null, true) {}
|
||||||
|
private constructor(id: Int, location: Location) : super(id, location) {}
|
||||||
|
|
||||||
|
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {
|
||||||
|
return IceTrollJatizsoCaves(id, location)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getIds(): IntArray {
|
||||||
|
return intArrayOf(NPCs.ICE_TROLL_MALE_5474,NPCs.ICE_TROLL_RUNT_5473,NPCs.ICE_TROLL_FEMALE_5475)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun tick() {
|
||||||
|
val nearbyMiner = ContentAPI.findLocalNPC(this, NPCs.MINER_5497) ?: return super.tick()
|
||||||
|
if(!inCombat() && nearbyMiner.location.withinDistance(location, 8)){
|
||||||
|
attack(nearbyMiner)
|
||||||
|
}
|
||||||
|
super.tick()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,7 +23,6 @@ object PacketWriteQueue {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun <T> queue(packet: OutgoingPacket<T>, context: T){
|
fun <T> queue(packet: OutgoingPacket<T>, context: T){
|
||||||
SystemLogger.logInfo("Queueing ${packet.javaClass.simpleName}")
|
|
||||||
PacketsToWrite.add(QueuedPacket(packet,context))
|
PacketsToWrite.add(QueuedPacket(packet,context))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user