From 329b39bb60ca9abc4a0a4244516d0a8967ba7555 Mon Sep 17 00:00:00 2001 From: ceikry Date: Mon, 12 Jul 2021 09:40:45 -0500 Subject: [PATCH] Spawned in all NPCs for the GFI and ensured they fought with eachother. --- Server/data/configs/npc_spawns.json | 32 +++++++++++++++ Server/src/main/kotlin/api/ContentAPI.kt | 2 +- .../game/node/entity/npc/other/IceTrollGFI.kt | 39 +++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 Server/src/main/kotlin/rs09/game/node/entity/npc/other/IceTrollGFI.kt diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index e36f69155..f40e0c9bb 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -10686,5 +10686,37 @@ { "npc_id": "5463", "loc_data": "{2324,3809,0,1,0}-{2317,3802,0,1,0}" + }, + { + "npc_id": "5521", + "loc_data": "{2324,3832,0,1,0}-{2350,3859,0,1,0}-{2375,3892,0,1,0}-{2388,3867,0,1,0}-{2384,3863,0,1,0}-{2387,3859,0,1,0}-{2350,3862,0,1,0}-{2352,3857,0,1,0}" + }, + { + "npc_id": "5523", + "loc_data": "{2367,3832,0,1,0}-{2319,3854,0,1,0}-{2324,3891,0,1,0}-{2406,3854,0,1,0}-{2405,3863,0,1,0}-{2400,3856,0,1,0}" + }, + { + "npc_id": "5522", + "loc_data": "{2362,3893,0,1,0}-{2390,3861,0,1,0}-{2395,3859,0,1,0}-{2323,3857,0,1,0}-{2331,3860,0,1,0}" + }, + { + "npc_id": "5524", + "loc_data": "{2340,3830,0,1,0}-{2338,3860,0,1,0}-{2339,3895,0,1,0}-{2411,3886,0,1,0}-{2396,3854,0,1,0}" + }, + { + "npc_id": "5514", + "loc_data": "{2337,3831,0,1,0}-{2399,3852,0,1,0}-{2321,3833,0,1,0}" + }, + { + "npc_id": "5515", + "loc_data": "{2327,3858,0,1,0}-{2321,3860,0,1,0}-{2343,3862,0,1,0}" + }, + { + "npc_id": "5516", + "loc_data": "{2393,3861,0,1,0}-{2347,3890,0,1,0}-{2347,3890,0,1,0}" + }, + { + "npc_id": "5517", + "loc_data": "{2403,3853,0,1,0}-{2328,3830,0,1,0}-{2405,3860,0,1,0}-{2335,3894,0,1,0}" } ] \ No newline at end of file diff --git a/Server/src/main/kotlin/api/ContentAPI.kt b/Server/src/main/kotlin/api/ContentAPI.kt index 994f9b745..c46e21ecc 100644 --- a/Server/src/main/kotlin/api/ContentAPI.kt +++ b/Server/src/main/kotlin/api/ContentAPI.kt @@ -600,7 +600,7 @@ object ContentAPI { */ @JvmStatic fun findLocalNPCs(entity: Entity, ids: IntArray): List{ - return RegionManager.getSurroundingNPCs(entity).filter { it.id in ids }.toList() + return RegionManager.getLocalNpcs(entity).filter { it.id in ids }.toList() } /** diff --git a/Server/src/main/kotlin/rs09/game/node/entity/npc/other/IceTrollGFI.kt b/Server/src/main/kotlin/rs09/game/node/entity/npc/other/IceTrollGFI.kt new file mode 100644 index 000000000..0ad75fb22 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/node/entity/npc/other/IceTrollGFI.kt @@ -0,0 +1,39 @@ +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 IceTrollGFI : AbstractNPC { + //Constructor spaghetti because Arios I guess + constructor() : super(NPCs.ICE_TROLL_MALE_5522, null, true) {} + private constructor(id: Int, location: Location) : super(id, location) {} + + override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC { + return IceTrollGFI(id, location) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.ICE_TROLL_FEMALE_5523, NPCs.ICE_TROLL_MALE_5522, NPCs.ICE_TROLL_RUNT_5521, NPCs.ICE_TROLL_GRUNT_5524) + } + + override fun tick() { + if(!inCombat() && RandomFunction.roll(20)){ + val localGuards = ContentAPI.findLocalNPCs(this, intArrayOf(NPCs.HONOUR_GUARD_5514,NPCs.HONOUR_GUARD_5515,NPCs.HONOUR_GUARD_5516,NPCs.HONOUR_GUARD_5517)) + localGuards.forEach{guard -> + SystemLogger.logInfo("Looping guards...") + if(guard.location.withinDistance(location,6)) { + attack(guard) + return super.tick() + } + } + } + return super.tick() + } + +} \ No newline at end of file