added champion challenge

This commit is contained in:
szumaster
2023-06-13 12:17:48 +00:00
committed by Ceikry
parent 7997fbb0b0
commit 51ab17e3aa
17 changed files with 1800 additions and 152 deletions
+14 -12
View File
@@ -12180,12 +12180,6 @@
"id": "12070",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "6808",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
@@ -28629,12 +28623,6 @@
"id": "5733",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
"id": "6808",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "5.0",
@@ -60209,5 +60197,19 @@
"maxAmount": "1"
}
]
},
{
"default": [
{
"minAmount": "1",
"weight": "1.0",
"id": "526",
"maxAmount": "1"
}
],
"charm": [],
"ids": "3057,3059,3058,3060,3061,3062,3063,3064,3065,3066",
"description": "champion's challenge bosses",
"main": []
}
]
+65 -41
View File
@@ -28624,18 +28624,19 @@
"magic_animation": "0",
"death_animation": "2946",
"name": "Earth Warrior Champion",
"defence_level": "51",
"defence_level": "84",
"safespot": null,
"lifepoints": "72",
"strength_level": "51",
"lifepoints": "108",
"strength_level": "84",
"id": "3057",
"aggressive": "true",
"range_level": "1",
"attack_level": "51"
"attack_level": "84"
},
{
"examine": "Champion of the giants.",
"melee_animation": "6368",
"attack_speed": "4",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
@@ -28644,14 +28645,14 @@
"magic_animation": "0",
"death_animation": "6369",
"name": "Giant Champion",
"defence_level": "28",
"defence_level": "52",
"safespot": null,
"lifepoints": "40",
"strength_level": "28",
"lifepoints": "70",
"strength_level": "44",
"id": "3058",
"aggressive": "true",
"range_level": "1",
"attack_level": "28"
"attack_level": "36"
},
{
"examine": "Champion of the ghouls.",
@@ -28680,88 +28681,91 @@
{
"examine": "Champion of the goblins.",
"melee_animation": "6188",
"attack_speed": "4",
"range_animation": "0",
"combat_audio": "469,472,471",
"magic_level": "12",
"magic_level": "26",
"defence_animation": "0",
"weakness": "10",
"magic_animation": "0",
"death_animation": "6190",
"name": "Goblin Champion",
"defence_level": "12",
"defence_level": "14",
"safespot": null,
"lifepoints": "17",
"strength_level": "6",
"lifepoints": "32",
"strength_level": "1",
"id": "3060",
"range_level": "1",
"attack_level": "6"
"attack_level": "1"
},
{
"examine": "Champion of the hobgoblins.",
"combat_style": "1",
"range_animation": "0",
"attack_speed": "4",
"melee_animation": "164",
"range_animation": "164",
"combat_audio": "469,472,471",
"respawn_delay": "60",
"defence_animation": "0",
"defence_animation": "165",
"weakness": "0",
"magic_animation": "0",
"death_animation": "2958",
"magic_animation": "164",
"death_animation": "167",
"name": "Hobgoblin Champion",
"defence_level": "28",
"defence_level": "48",
"safespot": null,
"lifepoints": "40",
"strength_level": "14",
"lifepoints": "58",
"strength_level": "48",
"id": "3061",
"aggressive": "true",
"range_level": "28",
"attack_level": "14"
"range_level": "44",
"attack_level": "44"
},
{
"examine": "Champion of the imps.",
"melee_animation": "5285",
"range_animation": "0",
"attack_speed": "5",
"attack_speed": "4",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "172",
"name": "Imp Champion",
"defence_level": "7",
"defence_level": "5",
"safespot": null,
"lifepoints": "10",
"strength_level": "7",
"lifepoints": "40",
"strength_level": "5",
"id": "3062",
"aggressive": "true",
"range_level": "7",
"attack_level": "7"
"range_level": "5",
"attack_level": "5"
},
{
"examine": "Champion of the jogres.",
"melee_animation": "2100",
"range_animation": "0",
"melee_animation": "2936",
"range_animation": "2936",
"poisonous": "true",
"respawn_delay": "60",
"defence_animation": "0",
"defence_animation": "2937",
"weakness": "9",
"magic_animation": "0",
"death_animation": "8576",
"magic_animation": "2936",
"death_animation": "2938",
"name": "Jogre Champion",
"defence_level": "54",
"defence_level": "86",
"safespot": null,
"lifepoints": "77",
"strength_level": "54",
"lifepoints": "120",
"strength_level": "86",
"id": "3063",
"aggressive": "true",
"range_level": "1",
"attack_level": "54"
"attack_level": "86"
},
{
"examine": "Champion of the lesser demons.",
"melee_animation": "64",
"range_animation": "0",
"combat_audio": "396,402,401",
"magic_level": "81",
"magic_level": "136",
"respawn_delay": "60",
"defence_animation": "65",
"weakness": "5",
@@ -28769,13 +28773,33 @@
"magic_animation": "0",
"death_animation": "67",
"name": "Lesser Demon Champion",
"defence_level": "81",
"defence_level": "142",
"safespot": null,
"lifepoints": "115",
"strength_level": "1",
"lifepoints": "148",
"strength_level": "140",
"id": "3064",
"aggressive": "true",
"range_level": "1",
"attack_level": "136"
},
{
"examine": "Champion of the jogres.",
"melee_animation": "5485",
"range_animation": "5493",
"poisonous": "true",
"respawn_delay": "60",
"defence_animation": "5493",
"weakness": "9",
"magic_animation": "0",
"death_animation": "1444",
"name": "Skeleton Champion",
"defence_level": "54",
"safespot": null,
"lifepoints": "58",
"strength_level": "1",
"id": "3065",
"aggressive": "true",
"range_level": "36",
"attack_level": "1"
},
{
@@ -0,0 +1,234 @@
package content.global.activity.cchallange
import content.global.activity.cchallange.npc.EarthWarriorChampionNPC.Companion.spawnEarthWarriorChampion
import content.global.activity.cchallange.npc.GhoulChampionNPC.Companion.spawnGhoulChampion
import content.global.activity.cchallange.npc.GiantChampionNPC.Companion.spawnGiantChampion
import content.global.activity.cchallange.npc.GoblinChampionNPC.Companion.spawnGoblinChampion
import content.global.activity.cchallange.npc.HobgoblinChampionNPC.Companion.spawnHobgoblinChampion
import content.global.activity.cchallange.npc.ImpChampionNPC.Companion.spawnImpChampion
import content.global.activity.cchallange.npc.JogreChampionNPC.Companion.spawnJogreChampion
import content.global.activity.cchallange.npc.LesserDemonChampionNPC.Companion.spawnLesserDemonChampion
import content.global.activity.cchallange.npc.SkeletonChampionNPC.Companion.spawnSkeletonChampion
import content.global.activity.cchallange.npc.ZombieChampionNPC.Companion.spawnZombieChampion
import core.api.*
import core.game.global.action.DoorActionHandler
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import core.game.node.entity.state.EntityState
import core.game.node.item.Item
import core.game.system.task.Pulse
import core.game.world.map.Location
import core.game.world.map.zone.ZoneBorders
import core.game.world.map.zone.ZoneRestriction
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import org.rs09.consts.Scenery
/**
* Represents the Champion challenge.
*/
class ChampionChallengeListener : InteractionListener, MapArea {
val EARTH_WARRIOR_SCROLL = Items.CHAMPION_SCROLL_6798
val GHOUL_SCROLL = Items.CHAMPION_SCROLL_6799
val GIANT_SCROLL = Items.CHAMPION_SCROLL_6800
val GOBLIN_SCROLL = Items.CHAMPION_SCROLL_6801
val HOBGOBLIN_SCROLL = Items.CHAMPION_SCROLL_6802
val IMP_SCROLL = Items.CHAMPION_SCROLL_6803
val JOGRE_SCROLL = Items.CHAMPION_SCROLL_6804
val LESSER_DEMON_SCROLL = Items.CHAMPION_SCROLL_6805
val SKELETON_SCROLL = Items.CHAMPION_SCROLL_6806
val ZOMBIE_SCROLL = Items.CHAMPION_SCROLL_6807
val MESSAGE_SCROLL = 222
private val IMP_SCROLL_TEXT = arrayOf(
"How about picking on someone your own size? I'll",
"see you at the Champion's Guild.",
"",
"Champion of Imps"
)
private val GOBLIN_SCROLL_TEXT = arrayOf(
"Fight me if you think you can human, I'll wait",
"for you in the Champion's Guild.",
"",
"Champion of Goblins"
)
private val SKELETON_SCROLL_TEXT = arrayOf(
"I'll be waiting at the Champions' Guild to",
"collect your bones.",
"",
"Champion of Skeletons"
)
private val ZOMBIE_SCROLL_TEXT = arrayOf(
"You come to Champions' Guild, you fight me,",
"I squish you, I get brains!",
"",
"Champion of Zombies"
)
private val GIANT_SCROLL_TEXT = arrayOf(
"Get yourself to the Champions' Guild, if you",
"dare to face me puny human.",
"",
"Champion of Giants"
)
private val HOBGOBLIN_SCROLL_TEXT = arrayOf(
"You won't defeat me, though you're welcome to",
"try at the Champions' Guild.",
"",
"Champion of Hobgoblins"
)
private val GHOUL_SCROLL_TEXT = arrayOf(
"Come and duel me at the Champions' Guild, I'll",
"make sure nothing goes to waste.",
"",
"Champion of Ghouls"
)
private val EARTH_WARRIOR_TEXT = arrayOf(
"I challenge you to a duel, come to the arena beneath",
"the Champion's Guild and fight me if you dare.",
"",
"Champion of Earth Warriors"
)
private val JOGRE_SCROLL_TEXT = arrayOf(
"You think you can defeat me? Come to the",
"Champion's Guild and prove it!",
"",
"Champion of Jogres"
)
private val LESSER_DEMON_SCROLL_TEXT = arrayOf(
"Come to the Champion's Guild so I can banish",
"you mortal!",
"",
"Champion of Lesser Demons"
)
private val PORTCULLIS = Scenery.PORTCULLIS_10553
private val LADDER = Scenery.LADDER_10554
private val CHAMPION_STATUE_CLOSED = Scenery.CHAMPION_STATUE_10556
private val CHAMPION_STATUE_OPEN = Scenery.CHAMPION_STATUE_10557
private val TRAPDOOR_CLOSED = Scenery.TRAPDOOR_10558
private val TRAPDOOR_OPEN = Scenery.TRAPDOOR_10559
private val LARXUS = NPCs.LARXUS_3050
private val ARENA_ZONE = 12696
override fun defineListeners() {
on(LARXUS, IntType.NPC, "talk-to") { player, _ ->
openDialogue(player, LarxusDialogue(false))
return@on true
}
on(ChampionScrollsDropHandler.SCROLLS, IntType.ITEM, "read") { player, node ->
updateAndReadScroll(player, node.asItem())
return@on true
}
on(TRAPDOOR_CLOSED, IntType.SCENERY, "open") { _, node ->
replaceScenery(node.asScenery(), TRAPDOOR_OPEN, 100, node.location)
return@on true
}
onUseWith(IntType.NPC, ChampionScrollsDropHandler.SCROLLS, NPCs.LARXUS_3050) { player, _, _ ->
openDialogue(player, LarxusDialogue(true))
return@onUseWith true
}
on(TRAPDOOR_OPEN, IntType.SCENERY, "close") { _, node ->
replaceScenery(node.asScenery(), TRAPDOOR_CLOSED, 100, node.location)
return@on true
}
on(CHAMPION_STATUE_CLOSED, IntType.SCENERY, "open") { _, node ->
replaceScenery(node.asScenery(), CHAMPION_STATUE_OPEN, 100, node.location)
return@on true
}
on(LADDER, IntType.SCENERY, "climb-up") { player, _ ->
teleport(player, Location.create(3185, 9758, 0))
return@on true
}
on(CHAMPION_STATUE_OPEN, IntType.SCENERY, "climb-down") { player, _ ->
teleport(player, Location.create(3182, 9758, 0))
return@on true
}
on(PORTCULLIS, IntType.SCENERY, "open") { player, node ->
if (player.getAttribute("championsarena:start", false) == false) {
sendNPCDialogue(player, NPCs.LARXUS_3050, "You need to arrange a challenge with me before you enter the arena.")
} else {
lock(player, 3)
submitWorldPulse(object : Pulse() {
var counter = 0
override fun pulse(): Boolean {
when (counter++) {
1 -> {
player.stateManager.get(EntityState.TELEBLOCK)
player.familiarManager.dismiss()
}
2 -> DoorActionHandler.handleDoor(player, node.asScenery())
3 -> when{
removeItem(player, IMP_SCROLL) -> spawnImpChampion(player)
removeItem(player, GOBLIN_SCROLL) -> spawnGoblinChampion(player)
removeItem(player, SKELETON_SCROLL) -> spawnSkeletonChampion(player)
removeItem(player, ZOMBIE_SCROLL) -> spawnZombieChampion(player)
removeItem(player, GIANT_SCROLL) -> spawnGiantChampion(player)
removeItem(player, HOBGOBLIN_SCROLL) -> spawnHobgoblinChampion(player)
removeItem(player, GHOUL_SCROLL) -> spawnGhoulChampion(player)
removeItem(player, EARTH_WARRIOR_SCROLL) -> {
spawnEarthWarriorChampion(player)
player.prayer.reset()
}
removeItem(player, JOGRE_SCROLL) -> spawnJogreChampion(player)
removeItem(player, LESSER_DEMON_SCROLL) -> spawnLesserDemonChampion(player)
}
}
return false
}
})
}
return@on true
}
}
private fun updateAndReadScroll(player: Player, item: Item) {
val id = item.id
openInterface(player, MESSAGE_SCROLL).also {
when (id) {
IMP_SCROLL -> setInterfaceText(player, IMP_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
GOBLIN_SCROLL -> setInterfaceText(player, GOBLIN_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
SKELETON_SCROLL -> setInterfaceText(player, SKELETON_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
ZOMBIE_SCROLL -> setInterfaceText(player, ZOMBIE_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
GIANT_SCROLL -> setInterfaceText(player, GIANT_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
HOBGOBLIN_SCROLL -> setInterfaceText(player, HOBGOBLIN_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
GHOUL_SCROLL -> setInterfaceText(player, GHOUL_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
EARTH_WARRIOR_SCROLL -> setInterfaceText(player, EARTH_WARRIOR_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
JOGRE_SCROLL -> setInterfaceText(player, JOGRE_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
LESSER_DEMON_SCROLL -> setInterfaceText(player, LESSER_DEMON_SCROLL_TEXT.joinToString("<br>"), MESSAGE_SCROLL, 4)
}
}
}
override fun defineAreaBorders(): Array<ZoneBorders> {
return arrayOf(getRegionBorders(ARENA_ZONE))
}
override fun getRestrictions(): Array<ZoneRestriction> {
return arrayOf(
ZoneRestriction.CANNON,
ZoneRestriction.FIRES,
ZoneRestriction.RANDOM_EVENTS
)
}
}
@@ -0,0 +1,337 @@
package content.global.activity.cchallange
import core.api.sendMessage
import core.api.sendNews
import core.game.event.NPCKillEvent
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.item.GroundItemManager
import core.game.node.item.Item
import core.tools.colorize
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Handles the drop for champion challenge.
* @authors Phil, Skelsoft
*/
class ChampionScrollsDropHandler : ChampionScrollsEventHookBase() {
companion object {
private val IMPS = intArrayOf(
NPCs.IMP_708, NPCs.IMP_709, NPCs.IMP_1531, NPCs.IMP_6211
)
private val GOBLINS = intArrayOf(
NPCs.GOBLIN_100, NPCs.GOBLIN_101, NPCs.GOBLIN_102, NPCs.GOBLIN_444, NPCs.GOBLIN_445,
NPCs.GOBLIN_1769, NPCs.GOBLIN_1770, NPCs.GOBLIN_1771, NPCs.GOBLIN_1772, NPCs.GOBLIN_1773,
NPCs.GOBLIN_1774, NPCs.GOBLIN_1775, NPCs.GOBLIN_1776, NPCs.GOBLIN_2274, NPCs.GOBLIN_2275,
NPCs.GOBLIN_2276, NPCs.GOBLIN_2277, NPCs.GOBLIN_2278, NPCs.GOBLIN_2279, NPCs.GOBLIN_2280,
NPCs.GOBLIN_2281, NPCs.GOBLIN_2678, NPCs.GOBLIN_2679, NPCs.GOBLIN_2680, NPCs.GOBLIN_2681,
NPCs.GOBLIN_3264, NPCs.GOBLIN_3265, NPCs.GOBLIN_3266, NPCs.GOBLIN_3267, NPCs.GOBLIN_3726,
NPCs.GOBLIN_4261, NPCs.GOBLIN_4262, NPCs.GOBLIN_4263, NPCs.GOBLIN_4264, NPCs.GOBLIN_4265,
NPCs.GOBLIN_4266, NPCs.GOBLIN_4267, NPCs.GOBLIN_4268, NPCs.GOBLIN_4269, NPCs.GOBLIN_4270,
NPCs.GOBLIN_4271, NPCs.GOBLIN_4272, NPCs.GOBLIN_4273, NPCs.GOBLIN_4274, NPCs.GOBLIN_4275,
NPCs.GOBLIN_4276, NPCs.GOBLIN_4407, NPCs.GOBLIN_4408, NPCs.GOBLIN_4409, NPCs.GOBLIN_4410,
NPCs.GOBLIN_4411, NPCs.GOBLIN_4412, NPCs.GOBLIN_4479, NPCs.GOBLIN_4480, NPCs.GOBLIN_4481,
NPCs.GOBLIN_4482, NPCs.GOBLIN_4483, NPCs.GOBLIN_4484, NPCs.GOBLIN_4485, NPCs.GOBLIN_4486,
NPCs.GOBLIN_4487, NPCs.GOBLIN_4488, NPCs.GOBLIN_4489, NPCs.GOBLIN_4490, NPCs.GOBLIN_4491,
NPCs.GOBLIN_4492, NPCs.GOBLIN_4499, NPCs.GOBLIN_4633, NPCs.GOBLIN_4634, NPCs.GOBLIN_4635,
NPCs.GOBLIN_4636, NPCs.GOBLIN_4637, NPCs.GOBLIN_5855, NPCs.GOBLIN_5856, NPCs.GOBLIN_6125,
NPCs.GOBLIN_6126, NPCs.GOBLIN_6132, NPCs.GOBLIN_6133, NPCs.GOBLIN_6279, NPCs.GOBLIN_6280,
NPCs.GOBLIN_6281, NPCs.GOBLIN_6282, NPCs.GOBLIN_6283, NPCs.GOBLIN_6284, NPCs.GOBLIN_6402,
NPCs.GOBLIN_6403, NPCs.GOBLIN_6404, NPCs.GOBLIN_6405, NPCs.GOBLIN_6406, NPCs.GOBLIN_6407,
NPCs.GOBLIN_6408, NPCs.GOBLIN_6409, NPCs.GOBLIN_6410, NPCs.GOBLIN_6411, NPCs.GOBLIN_6412,
NPCs.GOBLIN_6413, NPCs.GOBLIN_6414, NPCs.GOBLIN_6415, NPCs.GOBLIN_6416, NPCs.GOBLIN_6417,
NPCs.GOBLIN_6418, NPCs.GOBLIN_6419, NPCs.GOBLIN_6420, NPCs.GOBLIN_6421, NPCs.GOBLIN_6422,
NPCs.GOBLIN_6423, NPCs.GOBLIN_6424, NPCs.GOBLIN_6425, NPCs.GOBLIN_6426, NPCs.GOBLIN_6427,
NPCs.GOBLIN_6428, NPCs.GOBLIN_6429, NPCs.GOBLIN_6430, NPCs.GOBLIN_6431, NPCs.GOBLIN_6432,
NPCs.GOBLIN_6433, NPCs.GOBLIN_6434, NPCs.GOBLIN_6435, NPCs.GOBLIN_6436, NPCs.GOBLIN_6437,
NPCs.GOBLIN_6438, NPCs.GOBLIN_6439, NPCs.GOBLIN_6440, NPCs.GOBLIN_6441, NPCs.GOBLIN_6442,
NPCs.GOBLIN_6443, NPCs.GOBLIN_6444, NPCs.GOBLIN_6445, NPCs.GOBLIN_6446, NPCs.GOBLIN_6447,
NPCs.GOBLIN_6448, NPCs.GOBLIN_6449, NPCs.GOBLIN_6450, NPCs.GOBLIN_6451, NPCs.GOBLIN_6452,
NPCs.GOBLIN_6453, NPCs.GOBLIN_6454, NPCs.GOBLIN_6455, NPCs.GOBLIN_6456, NPCs.GOBLIN_6457,
NPCs.GOBLIN_6458, NPCs.GOBLIN_6459, NPCs.GOBLIN_6460, NPCs.GOBLIN_6461, NPCs.GOBLIN_6462,
NPCs.GOBLIN_6463, NPCs.GOBLIN_6464, NPCs.GOBLIN_6465, NPCs.GOBLIN_6466, NPCs.GOBLIN_6467,
NPCs.GOBLIN_6490, NPCs.GOBLIN_6491, NPCs.GOBLIN_6492, NPCs.GOBLIN_6493, NPCs.GOBLIN_6494,
NPCs.GOBLIN_6495, NPCs.GOBLIN_7964, NPCs.GOBLIN_7965,
NPCs.CAVE_GOBLIN_1822, NPCs.CAVE_GOBLIN_1823, NPCs.CAVE_GOBLIN_1824, NPCs.CAVE_GOBLIN_1825,
NPCs.CAVE_GOBLIN_5752, NPCs.CAVE_GOBLIN_5753, NPCs.CAVE_GOBLIN_5754, NPCs.CAVE_GOBLIN_5755,
NPCs.CAVE_GOBLIN_5756, NPCs.CAVE_GOBLIN_5757, NPCs.CAVE_GOBLIN_5758, NPCs.CAVE_GOBLIN_5759,
NPCs.CAVE_GOBLIN_5760, NPCs.CAVE_GOBLIN_5761, NPCs.CAVE_GOBLIN_5762, NPCs.CAVE_GOBLIN_5763,
NPCs.CAVE_GOBLIN_5764, NPCs.CAVE_GOBLIN_5765, NPCs.CAVE_GOBLIN_5766, NPCs.CAVE_GOBLIN_5767,
NPCs.CAVE_GOBLIN_5768, NPCs.CAVE_GOBLIN_5769, NPCs.CAVE_GOBLIN_5783, NPCs.CAVE_GOBLIN_5785,
NPCs.CAVE_GOBLIN_5873, NPCs.CAVE_GOBLIN_5874, NPCs.CAVE_GOBLIN_5875, NPCs.CAVE_GOBLIN_5876,
NPCs.CAVE_GOBLIN_5877, NPCs.CAVE_GOBLIN_5878, NPCs.CAVE_GOBLIN_8451,
NPCs.CAVE_GOBLIN_GUARD_2073, NPCs.CAVE_GOBLIN_GUARD_2074,
NPCs.GOBLIN_GUARD_489, NPCs.GOBLIN_GUARD_6496, NPCs.GOBLIN_GUARD_6497,
)
private val UNIQUE_GOBLINS = intArrayOf(
NPCs.SERGEANT_GRIMSPIKE_6265,
NPCs.SERGEANT_STEELWILL_6263,
NPCs.SERGEANT_STRONGSTACK_6261
)
private val SKELETONS = intArrayOf(
NPCs.SKELETON_90, NPCs.SKELETON_91, NPCs.SKELETON_92, NPCs.SKELETON_93,
NPCs.SKELETON_459,
NPCs.SKELETON_1471, NPCs.SKELETON_2036, NPCs.SKELETON_2037, NPCs.SKELETON_2715,
NPCs.SKELETON_3151, NPCs.SKELETON_3152, NPCs.SKELETON_3291, NPCs.SKELETON_3581,
NPCs.SKELETON_4384, NPCs.SKELETON_4385, NPCs.SKELETON_4386, NPCs.SKELETON_5332,
NPCs.SKELETON_5333, NPCs.SKELETON_5334, NPCs.SKELETON_5335, NPCs.SKELETON_5336,
NPCs.SKELETON_5337, NPCs.SKELETON_5338, NPCs.SKELETON_5339, NPCs.SKELETON_5340,
NPCs.SKELETON_5341, NPCs.SKELETON_5365, NPCs.SKELETON_5366, NPCs.SKELETON_5367,
NPCs.SKELETON_5368, NPCs.SKELETON_5381, NPCs.SKELETON_5385, NPCs.SKELETON_5386,
NPCs.SKELETON_5387, NPCs.SKELETON_5388, NPCs.SKELETON_5389, NPCs.SKELETON_5390,
NPCs.SKELETON_5391, NPCs.SKELETON_5392, NPCs.SKELETON_5411, NPCs.SKELETON_5412,
NPCs.SKELETON_5422, NPCs.SKELETON_5423, NPCs.SKELETON_6091, NPCs.SKELETON_6092,
NPCs.SKELETON_6093, NPCs.SKELETON_6764, NPCs.SKELETON_6765, NPCs.SKELETON_6766,
NPCs.SKELETON_6767, NPCs.SKELETON_6768, NPCs.SKELETON_7774, NPCs.SKELETON_7775,
NPCs.SKELETON_7776, NPCs.SKELETON_7777, NPCs.SKELETON_7778, NPCs.SKELETON_7779,
NPCs.SKELETON_7788, NPCs.SKELETON_7815, NPCs.GIANT_SKELETON_1973,
NPCs.GIANT_SKELETON_5359, NPCs.GIANT_SKELETON_5384, NPCs.SKELETON_HELLHOUND_1575,
NPCs.SKELETON_MAGE_94, NPCs.SKELETON_MAGE_2717, NPCs.SKELETON_MAGE_3844,
NPCs.SKELETON_MAGE_3850, NPCs.SKELETON_MAGE_3851,
NPCs.SKELETON_HERO_6103, NPCs.SKELETON_BRUTE_6104, NPCs.SKELETON_WARLORD_6105,
NPCs.SKELETON_HEAVY_6106, NPCs.SKELETON_THUG_6107,
)
private val UNIQUE_SKELETONS = intArrayOf(
NPCs.NAZASTAROOL_508,
NPCs.UNDEAD_ONE_5353, NPCs.UNDEAD_ONE_5354, NPCs.UNDEAD_ONE_5355,
NPCs.UNDEAD_ONE_5356, NPCs.UNDEAD_ONE_5357, NPCs.UNDEAD_ONE_5358,
)
private val ZOMBIES = intArrayOf(
NPCs.ZOMBIE_73, NPCs.ZOMBIE_74, NPCs.ZOMBIE_75, NPCs.ZOMBIE_76, NPCs.ZOMBIE_419,
NPCs.ZOMBIE_420, NPCs.ZOMBIE_421, NPCs.ZOMBIE_422, NPCs.ZOMBIE_423, NPCs.ZOMBIE_424,
NPCs.ZOMBIE_1826, NPCs.ZOMBIE_2714, NPCs.ZOMBIE_2863, NPCs.ZOMBIE_2866, NPCs.ZOMBIE_2869,
NPCs.ZOMBIE_2878, NPCs.ZOMBIE_3622, NPCs.ZOMBIE_3623, NPCs.ZOMBIE_4392, NPCs.ZOMBIE_4393,
NPCs.ZOMBIE_4394, NPCs.ZOMBIE_5293, NPCs.ZOMBIE_5294, NPCs.ZOMBIE_5295, NPCs.ZOMBIE_5296,
NPCs.ZOMBIE_5297, NPCs.ZOMBIE_5298, NPCs.ZOMBIE_5299, NPCs.ZOMBIE_5300, NPCs.ZOMBIE_5301,
NPCs.ZOMBIE_5302, NPCs.ZOMBIE_5303, NPCs.ZOMBIE_5304, NPCs.ZOMBIE_5305, NPCs.ZOMBIE_5306,
NPCs.ZOMBIE_5307, NPCs.ZOMBIE_5308, NPCs.ZOMBIE_5309, NPCs.ZOMBIE_5310, NPCs.ZOMBIE_5311,
NPCs.ZOMBIE_5312, NPCs.ZOMBIE_5313, NPCs.ZOMBIE_5314, NPCs.ZOMBIE_5315, NPCs.ZOMBIE_5316,
NPCs.ZOMBIE_5317, NPCs.ZOMBIE_5318, NPCs.ZOMBIE_5319, NPCs.ZOMBIE_5320, NPCs.ZOMBIE_5321,
NPCs.ZOMBIE_5322, NPCs.ZOMBIE_5323, NPCs.ZOMBIE_5324, NPCs.ZOMBIE_5325, NPCs.ZOMBIE_5326,
NPCs.ZOMBIE_5327, NPCs.ZOMBIE_5328, NPCs.ZOMBIE_5329, NPCs.ZOMBIE_5330, NPCs.ZOMBIE_5331,
NPCs.ZOMBIE_5375, NPCs.ZOMBIE_5376, NPCs.ZOMBIE_5377, NPCs.ZOMBIE_5378, NPCs.ZOMBIE_5379,
NPCs.ZOMBIE_5380, NPCs.ZOMBIE_5393, NPCs.ZOMBIE_5394, NPCs.ZOMBIE_5395, NPCs.ZOMBIE_5396,
NPCs.ZOMBIE_5397, NPCs.ZOMBIE_5398, NPCs.ZOMBIE_5399, NPCs.ZOMBIE_5400, NPCs.ZOMBIE_5401,
NPCs.ZOMBIE_5402, NPCs.ZOMBIE_5403, NPCs.ZOMBIE_5404, NPCs.ZOMBIE_5405, NPCs.ZOMBIE_5406,
NPCs.ZOMBIE_5407, NPCs.ZOMBIE_5408, NPCs.ZOMBIE_5409, NPCs.ZOMBIE_5410, NPCs.ZOMBIE_6099,
NPCs.ZOMBIE_6100, NPCs.ZOMBIE_6131, NPCs.ZOMBIE_7789, NPCs.ZOMBIE_7790, NPCs.ZOMBIE_7791,
NPCs.ZOMBIE_7792, NPCs.ZOMBIE_7817, NPCs.ZOMBIE_7818, NPCs.ZOMBIE_7819, NPCs.ZOMBIE_7820,
NPCs.ZOMBIE_8142, NPCs.ZOMBIE_8143, NPCs.ZOMBIE_8144, NPCs.ZOMBIE_8145,
NPCs.ZOMBIE_PIRATE_2837, NPCs.ZOMBIE_PIRATE_2838, NPCs.ZOMBIE_PIRATE_2839,
NPCs.ZOMBIE_PIRATE_2840, NPCs.ZOMBIE_PIRATE_2841, NPCs.ZOMBIE_PIRATE_2842,
NPCs.ZOMBIE_PIRATE_5629, NPCs.ZOMBIE_PIRATE_5630, NPCs.ZOMBIE_PIRATE_5631,
NPCs.ZOMBIE_PIRATE_5632, NPCs.ZOMBIE_PIRATE_5633, NPCs.ZOMBIE_PIRATE_5634,
NPCs.ZOMBIE_PIRATE_5635, NPCs.ZOMBIE_PIRATE_5636, NPCs.ZOMBIE_PIRATE_5637,
NPCs.ZOMBIE_PIRATE_5638, NPCs.ZOMBIE_PIRATE_5639, NPCs.ZOMBIE_PIRATE_5640,
NPCs.ZOMBIE_PIRATE_5641, NPCs.ZOMBIE_PIRATE_5642, NPCs.ZOMBIE_PIRATE_5643,
NPCs.ZOMBIE_PIRATE_5644, NPCs.ZOMBIE_PIRATE_5645, NPCs.ZOMBIE_PIRATE_5646,
NPCs.ZOMBIE_PIRATE_5647, NPCs.ZOMBIE_PIRATE_5648, NPCs.ZOMBIE_PIRATE_5649,
NPCs.ZOMBIE_PIRATE_5650, NPCs.ZOMBIE_PIRATE_5651, NPCs.ZOMBIE_PIRATE_5652,
NPCs.ZOMBIE_PIRATE_5653, NPCs.ZOMBIE_PIRATE_5654, NPCs.ZOMBIE_PIRATE_5655,
NPCs.ZOMBIE_PIRATE_5656, NPCs.ZOMBIE_PIRATE_5657, NPCs.ZOMBIE_PIRATE_5658,
NPCs.ZOMBIE_PIRATE_5659, NPCs.ZOMBIE_PIRATE_5660, NPCs.ZOMBIE_PIRATE_5661,
NPCs.ZOMBIE_PIRATE_5662, NPCs.ZOMBIE_PIRATE_5663, NPCs.ZOMBIE_PIRATE_5664,
NPCs.ZOMBIE_PIRATE_5665,
NPCs.ZOMBIE_SWAB_2843, NPCs.ZOMBIE_SWAB_2845,
NPCs.ZOMBIE_SWAB_2846, NPCs.ZOMBIE_SWAB_2847,
NPCs.ZOMBIE_SWAB_2848,
)
private val UNIQUE_ZOMBIES = intArrayOf(
NPCs.NAZASTAROOL_507,
NPCs.SLASH_BASH_2060, NPCs.SOREBONES_5627, NPCs.SOREBONES_5628,
NPCs.UNDEAD_LUMBERJACK_1524,
NPCs.UNDEAD_ONE_502, NPCs.UNDEAD_ONE_503, NPCs.UNDEAD_ONE_504, NPCs.UNDEAD_ONE_505,
NPCs.ZOGRE_2044, NPCs.ZOGRE_2045, NPCs.ZOGRE_2046, NPCs.ZOGRE_2047, NPCs.ZOGRE_2048,
NPCs.ZOGRE_2049, NPCs.ZOGRE_2051, NPCs.ZOGRE_2052, NPCs.ZOGRE_2053, NPCs.ZOGRE_2054,
NPCs.ZOGRE_2055,
)
private val UNDEAD_LUMBERJACKS = intArrayOf(
NPCs.UNDEAD_LUMBERJACK_1524, NPCs.UNDEAD_LUMBERJACK_1525, NPCs.UNDEAD_LUMBERJACK_5678,
NPCs.UNDEAD_LUMBERJACK_5679, NPCs.UNDEAD_LUMBERJACK_5680, NPCs.UNDEAD_LUMBERJACK_5681,
NPCs.UNDEAD_LUMBERJACK_5682, NPCs.UNDEAD_LUMBERJACK_5683, NPCs.UNDEAD_LUMBERJACK_5684,
NPCs.UNDEAD_LUMBERJACK_5685, NPCs.UNDEAD_LUMBERJACK_5686, NPCs.UNDEAD_LUMBERJACK_5687,
NPCs.UNDEAD_LUMBERJACK_5688, NPCs.UNDEAD_LUMBERJACK_5689, NPCs.UNDEAD_LUMBERJACK_5690,
NPCs.UNDEAD_LUMBERJACK_5691, NPCs.UNDEAD_LUMBERJACK_5692, NPCs.UNDEAD_LUMBERJACK_5693,
NPCs.UNDEAD_LUMBERJACK_5694, NPCs.UNDEAD_LUMBERJACK_5695, NPCs.UNDEAD_LUMBERJACK_5696,
NPCs.UNDEAD_LUMBERJACK_5697, NPCs.UNDEAD_LUMBERJACK_5698, NPCs.UNDEAD_LUMBERJACK_5699,
NPCs.UNDEAD_LUMBERJACK_5700, NPCs.UNDEAD_LUMBERJACK_5701, NPCs.UNDEAD_LUMBERJACK_5702,
NPCs.UNDEAD_LUMBERJACK_5703, NPCs.UNDEAD_LUMBERJACK_5704, NPCs.UNDEAD_LUMBERJACK_5705,
NPCs.UNDEAD_LUMBERJACK_5706, NPCs.UNDEAD_LUMBERJACK_5707, NPCs.UNDEAD_LUMBERJACK_5708,
NPCs.UNDEAD_LUMBERJACK_5709, NPCs.UNDEAD_LUMBERJACK_5710, NPCs.UNDEAD_LUMBERJACK_5711,
NPCs.UNDEAD_LUMBERJACK_5712, NPCs.UNDEAD_LUMBERJACK_5713, NPCs.UNDEAD_LUMBERJACK_5714,
NPCs.UNDEAD_LUMBERJACK_5715, NPCs.UNDEAD_LUMBERJACK_5716, NPCs.UNDEAD_LUMBERJACK_5717,
NPCs.UNDEAD_LUMBERJACK_5718, NPCs.UNDEAD_LUMBERJACK_5719, NPCs.UNDEAD_LUMBERJACK_5720,
NPCs.UNDEAD_LUMBERJACK_5721, NPCs.UNDEAD_LUMBERJACK_5722, NPCs.UNDEAD_LUMBERJACK_5723,
NPCs.UNDEAD_LUMBERJACK_5724, NPCs.UNDEAD_LUMBERJACK_5725, NPCs.UNDEAD_LUMBERJACK_5726,
NPCs.UNDEAD_LUMBERJACK_5727, NPCs.UNDEAD_LUMBERJACK_5728, NPCs.UNDEAD_LUMBERJACK_5729,
NPCs.UNDEAD_LUMBERJACK_5730, NPCs.UNDEAD_LUMBERJACK_5731, NPCs.UNDEAD_LUMBERJACK_5732,
NPCs.UNDEAD_LUMBERJACK_5733, NPCs.UNDEAD_LUMBERJACK_5734, NPCs.UNDEAD_LUMBERJACK_5735,
NPCs.UNDEAD_LUMBERJACK_5736, NPCs.UNDEAD_LUMBERJACK_5737, NPCs.UNDEAD_LUMBERJACK_5738,
NPCs.UNDEAD_LUMBERJACK_5739, NPCs.UNDEAD_LUMBERJACK_5740, NPCs.UNDEAD_LUMBERJACK_5741,
NPCs.UNDEAD_LUMBERJACK_5742, NPCs.UNDEAD_LUMBERJACK_5743, NPCs.UNDEAD_LUMBERJACK_5744,
NPCs.UNDEAD_LUMBERJACK_5745, NPCs.UNDEAD_LUMBERJACK_5746, NPCs.UNDEAD_LUMBERJACK_5747,
)
private val GIANTS = intArrayOf(
NPCs.HILL_GIANT_117, NPCs.HILL_GIANT_4689, NPCs.HILL_GIANT_4690, NPCs.HILL_GIANT_4691,
NPCs.HILL_GIANT_4692, NPCs.HILL_GIANT_4693,
NPCs.FIRE_GIANT_110, NPCs.FIRE_GIANT_1582, NPCs.FIRE_GIANT_1583, NPCs.FIRE_GIANT_1584,
NPCs.FIRE_GIANT_1585, NPCs.FIRE_GIANT_1586, NPCs.FIRE_GIANT_7003, NPCs.FIRE_GIANT_7004,
NPCs.MOSS_GIANT_112, NPCs.MOSS_GIANT_1587, NPCs.MOSS_GIANT_1588, NPCs.MOSS_GIANT_1681,
NPCs.MOSS_GIANT_4534, NPCs.MOSS_GIANT_4688, NPCs.MOSS_GIANT_4706,
NPCs.ICE_GIANT_111, NPCs.ICE_GIANT_3072, NPCs.ICE_GIANT_4685, NPCs.ICE_GIANT_4686,
NPCs.ICE_GIANT_4687,
)
private val UNIQUE_GIANTS = intArrayOf(
NPCs.BLACK_KNIGHT_TITAN_221,
NPCs.CYCLOPS_116, NPCs.CYCLOPS_4291, NPCs.CYCLOPS_4292, NPCs.CYCLOPS_6078,
NPCs.CYCLOPS_6079, NPCs.CYCLOPS_6080, NPCs.CYCLOPS_6081, NPCs.CYCLOPS_6082,
NPCs.CYCLOPS_6083, NPCs.CYCLOPS_6269, NPCs.CYCLOPS_6270,
)
private val HOBGOBLINS = intArrayOf(
NPCs.HOBGOBLIN_122, NPCs.HOBGOBLIN_123, NPCs.HOBGOBLIN_2685, NPCs.HOBGOBLIN_2686,
NPCs.HOBGOBLIN_2687, NPCs.HOBGOBLIN_2688, NPCs.HOBGOBLIN_3583, NPCs.HOBGOBLIN_4898,
NPCs.HOBGOBLIN_6275,
)
private val GHOUL = NPCs.GHOUL_1218
private val EARTH_WARRIOR = NPCs.EARTH_WARRIOR_124
private val JOGRES = intArrayOf(NPCs.JOGRE_113, NPCs.JOGRE_6268)
private val LESSER_DEMONS = intArrayOf(
NPCs.LESSER_DEMON_82, NPCs.LESSER_DEMON_4694, NPCs.LESSER_DEMON_4695,
NPCs.LESSER_DEMON_4696, NPCs.LESSER_DEMON_4697, NPCs.LESSER_DEMON_6101,
)
private val ZAKLN = NPCs.ZAKLN_GRITCH_6206
val SCROLLS = intArrayOf(
Items.CHAMPION_SCROLL_6803, Items.CHAMPION_SCROLL_6801, Items.CHAMPION_SCROLL_6806,
Items.CHAMPION_SCROLL_6807, Items.CHAMPION_SCROLL_6800, Items.CHAMPION_SCROLL_6802,
Items.CHAMPION_SCROLL_6799, Items.CHAMPION_SCROLL_6798, Items.CHAMPION_SCROLL_6804,
Items.CHAMPION_SCROLL_6805
)
}
override fun onNpcKilled(player: Player, event: NPCKillEvent) {
if (player.questRepository.points >= 32) {
val npc = event.npc
val npcName = npc.name
with(npcName) {
when {
contains("imp", true) -> {
if (IMPS.contains(npc.id)) {
rollForScroll(player, 0, npc)
}
}
!contains("hob", true) && contains("goblin", true) || UNIQUE_GOBLINS.contains(npc.id) -> {
if (GOBLINS.contains(npc.id) || UNIQUE_GOBLINS.contains(npc.id)) {
rollForScroll(player, 1, npc)
}
}
contains("skeleton", true) || UNIQUE_SKELETONS.contains(npc.id) -> {
println("Monster killed contains the name Skeleton")
if (SKELETONS.contains(npc.id) || UNIQUE_SKELETONS.contains(npc.id)) {
rollForScroll(player, 2, npc)
}
}
contains("zombie", true) || contains("lumberjack") || UNIQUE_ZOMBIES.contains(npc.id) -> {
if (ZOMBIES.contains(npc.id) || UNDEAD_LUMBERJACKS.contains(npc.id) || UNIQUE_ZOMBIES.contains(npc.id)) {
rollForScroll(player, 3, npc)
}
}
contains("giant", true) || UNIQUE_GIANTS.contains(npc.id) -> {
if (GIANTS.contains(npc.id) || UNIQUE_GIANTS.contains(npc.id)) {
rollForScroll(player, 4, npc)
}
}
contains("hobgoblin", true) -> {
if (HOBGOBLINS.contains(npc.id)) {
rollForScroll(player, 5, npc)
}
}
contains("ghoul", true) -> {
if (npc.id == GHOUL) {
rollForScroll(player, 6, npc)
}
}
contains("earth warrior", true) -> {
if (npc.id == EARTH_WARRIOR) {
rollForScroll(player, 7, npc)
}
}
contains("jogre", true) -> {
if (JOGRES.contains(npc.id)) {
rollForScroll(player, 8, npc)
}
}
contains("lesser demon", true) || npc.id == ZAKLN -> {
if (LESSER_DEMONS.contains(npc.id) || npc.id == ZAKLN) {
rollForScroll(player, 9, npc)
}
}
contains("champion", true) -> {
return
}
}
}
}
}
private fun rollForScroll(player: Player, scroll: Int, npc: NPC) {
val scrollID = SCROLLS[scroll]
val roll = (1..5000).random()
if (roll <= 1) {
GroundItemManager.create(Item(scrollID), npc.location, player)
sendMessage(player, colorize("%RA Champion's scroll falls to the ground as you slay your opponent."))
sendNews("${player.username} has received a Champion's scroll as a drop!")
}
}
}
@@ -0,0 +1,39 @@
package content.global.activity.cchallange
import core.api.LoginListener
import core.game.event.Event
import core.game.event.EventHook
import core.game.event.NPCKillEvent
import core.game.node.entity.Entity
import core.game.node.entity.player.Player
/**
* Manages the champion scrolls drop.
* @authors Phil, Skelsoft.
*/
abstract class ChampionScrollsEventHookBase : LoginListener {
protected companion object {
private fun <T> forEligibleEntityDo(entity: Entity, event: T, handler: (Player, T) -> Unit) {
if (entity !is Player) return
if (entity.isArtificial) return
handler(entity, event)
}
}
class EventHandler<T : Event>(
private val owner: ChampionScrollsEventHookBase,
private val handler: (Player, T) -> Unit) : EventHook<T> {
override fun process(entity: Entity, event: T) {
forEligibleEntityDo(entity, event, handler)
}
}
final override fun login(player: Player) {
player.hook(core.api.Event.NPCKilled, EventHandler(this, ::onNpcKilled))
}
protected open fun onNpcKilled(player: Player, event: NPCKillEvent) {}
}
@@ -0,0 +1,72 @@
package content.global.activity.cchallange
import core.api.*
import core.game.dialogue.DialogueFile
import core.game.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the dialogue plugin used for the larxus npc.
* @author 'Vexia
* @version 1.1
*/
@Initializable
class LarxusDialogue(val ChallengeStart: Boolean = false) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
val scrolls = intArrayOf(Items.CHAMPION_SCROLL_6798, Items.CHAMPION_SCROLL_6799, Items.CHAMPION_SCROLL_6800, Items.CHAMPION_SCROLL_6801, Items.CHAMPION_SCROLL_6802, Items.CHAMPION_SCROLL_6803, Items.CHAMPION_SCROLL_6804, Items.CHAMPION_SCROLL_6805, Items.CHAMPION_SCROLL_6806, Items.CHAMPION_SCROLL_6807,)
npc = NPC(NPCs.LARXUS_3050)
if (ChallengeStart) {
when (stage) {
0 -> {
face(findNPC(NPCs.LARXUS_3050)!!, player!!, 1)
for (i in scrolls)when{
inInventory(player!!,Items.CHAMPION_SCROLL_6798) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're not allowed to use prayer's. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6799) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're allowed to use only weapons. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6800) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're allowed to use only melee combat skill. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6801) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're allowed to use only magic skill. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6802) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're not allowed to use melee combat skills. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6803) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're not allowed to use weapons with special attack. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6804) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're not allowed to use ranged skill. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6805) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're allowed to use only equipment. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6806) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're allowed to use only ranged skill. Do you still want to proceed?").also { stage = 1 }
inInventory(player!!,Items.CHAMPION_SCROLL_6807) -> npcl("So you want to accept the challenge huh? Well there are some specific rules for these Champion fights. For this fight you're not allowed to use magic skill. Do you still want to proceed?").also { stage = 1 }
else -> {
sendMessage(player!!, "Nothing interesting happens.").also { stage = END_DIALOGUE } }
}
}
1 -> options("Yes, let me at him!", "No, thanks I'll pass.").also { stage = 2 }
2 -> when (buttonID) {
1 -> playerl("Yes, let me at him!").also { stage = 3 }
2 -> playerl("No, thanks I'll pass.").also { stage = END_DIALOGUE }
}
3 -> npcl("Your challenger is ready, please go down through the trapdoor when you're ready.").also { stage = 4 }
4 -> {
end()
setAttribute(player!!, "championsarena:start", true)
}
}
} else {
when (stage) {
START_DIALOGUE -> {
face(findNPC(NPCs.LARXUS_3050)!!, player!!, 1)
npcl(FacialExpression.NEUTRAL, "Is there something I can help you with?").also { stage = 1 }
}
1 -> options("I was given a challenge, what now?", "What is this place?", "Nothing thanks.").also { stage = 2 }
2 -> when (buttonID) {
1 -> playerl("I was given a challenge, what now?").also { stage = 3 }
2 -> playerl("What is this place?").also { stage = 4 }
3 -> playerl("Nothing thanks.").also { stage = END_DIALOGUE }
}
3 -> npcl("Well pass it here and we'll get you started.").also { stage = END_DIALOGUE }
4 -> npcl("This is the champions' arena, the champions of various, races use it to duel those they deem worthy of the, honour.").also { stage = END_DIALOGUE }
}
}
}
}
@@ -0,0 +1,114 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Earth warrior champion NPC for Champions challenge.
*/
@Initializable
class EarthWarriorChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return EarthWarriorChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.EARTH_WARRIOR_CHAMPION_3057)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnEarthWarriorChampion(player: Player) {
val champion = EarthWarriorChampionNPC(NPCs.EARTH_WARRIOR_CHAMPION_3057)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
val prayerItems = intArrayOf(
Items.PRAYER_POTION1_143, Items.PRAYER_POTION1_144,
Items.PRAYER_POTION2_141, Items.PRAYER_POTION2_142,
Items.PRAYER_POTION3_139, Items.PRAYER_POTION3_140,
Items.PRAYER_POTION4_2434, Items.PRAYER_POTION4_2435,
Items.SUPER_RESTORE1_3030, Items.SUPER_RESTORE1_3031,
Items.SUPER_RESTORE2_3028, Items.SUPER_RESTORE2_3029,
Items.SUPER_RESTORE3_3026, Items.SUPER_RESTORE3_3027,
Items.SUPER_RESTORE4_3024, Items.SUPER_RESTORE4_3025,
Items.PRAYER_CAPE_9759, Items.PRAYER_CAPET_9760,
Items.PRAYER_HOOD_9761, Items.PRAYER_CAPE_10643,
Items.PRAYER_POTION4_14209, Items.PRAYER_POTION4_14210,
Items.PRAYER_POTION3_14211, Items.PRAYER_POTION3_14212,
Items.PRAYER_POTION2_14213, Items.PRAYER_POTION2_14214,
Items.PRAYER_POTION1_14215, Items.PRAYER_POTION1_14216,
Items.FALADOR_SHIELD_1_14577, Items.FALADOR_SHIELD_2_14578,
Items.FALADOR_SHIELD_3_14579,
Items.PRAYER_MIX1_11467, Items.PRAYER_MIX1_11468,
Items.PRAYER_MIX2_11465, Items.PRAYER_MIX2_11466,
Items.SUP_RESTORE_MIX1_11495, Items.SUP_RESTORE_MIX1_11496,
Items.SUP_RESTORE_MIX2_11493, Items.SUP_RESTORE_MIX2_11494,
)
if (player.inventory.containsAtLeastOneItem(prayerItems) || player.equipment.containsAtLeastOneItem(
prayerItems
)
) {
sendNPCDialogue(player, NPCs.LARXUS_3050, "For this fight you're not allowed to use prayers!")
teleport(player, Location.create(3182, 9758, 0)) // Behind Doors.
} else {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
}
return true
}
})
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Earth Warrior Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6798, 260, 63, 3)
setInterfaceText(killer, "432 Slayer Xp", 63, 6)
setInterfaceText(killer, "432 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1452, 1, true)
rewardXP(killer, Skills.HITPOINTS, 432.0)
rewardXP(killer, Skills.SLAYER, 432.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,105 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.container.impl.EquipmentContainer
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import core.game.system.config.ItemConfigParser
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Ghoul champion NPC for Champions challenge.
*/
@Initializable
class GhoulChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return GhoulChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.GHOUL_CHAMPION_3059)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnGhoulChampion(player: Player) {
val champion = GhoulChampionNPC(NPCs.GHOUL_CHAMPION_3059)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
val i: Item = player.equipment[EquipmentContainer.SLOT_WEAPON].id.asItem()
if (i.definition.getConfiguration(ItemConfigParser.TWO_HANDED, false) == true && state.style == CombatStyle.MELEE) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
}
if (state.style == CombatStyle.MAGIC) {
sendMessage(player, "You can use only weapons in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Ghoul Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6799, 260, 63, 3)
setInterfaceText(killer, "400 Slayer Xp", 63, 6)
setInterfaceText(killer, "400 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1453, 1, true)
rewardXP(killer, Skills.HITPOINTS, 400.0)
rewardXP(killer, Skills.SLAYER, 400.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,103 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Giant champion NPC for Champions challenge.
*/
@Initializable
class GiantChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return GiantChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.GIANT_CHAMPION_3058)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnGiantChampion(player: Player) {
val champion = GiantChampionNPC(NPCs.GIANT_CHAMPION_3058)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (state.style == CombatStyle.MELEE) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
}
if (state.style == CombatStyle.RANGE || state.style == CombatStyle.MAGIC) {
sendMessage(player, "You can use only melee in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Giant Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6800, 260, 63, 3)
setInterfaceText(killer, "280 Slayer Xp", 63, 6)
setInterfaceText(killer, "280 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1454, 1, true)
rewardXP(killer, Skills.HITPOINTS, 280.0)
rewardXP(killer, Skills.SLAYER, 280.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,101 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Goblin champion NPC for Champions challenge.
*/
@Initializable
class GoblinChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return GoblinChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.GOBLIN_CHAMPION_3060)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnGoblinChampion(player: Player) {
val champion = GoblinChampionNPC(NPCs.GOBLIN_CHAMPION_3060)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (state.style == CombatStyle.MAGIC) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
}
if (state.style == CombatStyle.MELEE || state.style == CombatStyle.RANGE) {
sendMessage(player, "You can use only spells in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Goblin Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6801, 260, 63, 3)
setInterfaceText(killer, "128 Slayer Xp", 63, 6)
setInterfaceText(killer, "128 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1455, 1, true)
rewardXP(killer, Skills.HITPOINTS, 128.0)
rewardXP(killer, Skills.SLAYER, 128.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,103 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Hobgoblin champion NPC for Champions challenge.
*/
@Initializable
class HobgoblinChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return HobgoblinChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.HOBGOBLIN_CHAMPION_3061)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnHobgoblinChampion(player: Player) {
val champion = HobgoblinChampionNPC(NPCs.HOBGOBLIN_CHAMPION_3061)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (state.style == CombatStyle.MAGIC || state.style == CombatStyle.RANGE) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
}
if (state.style == CombatStyle.MELEE) {
sendMessage(player, "You cannot use melee in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Hobgoblin Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6802, 260, 63, 3)
setInterfaceText(killer, "232 Slayer Xp", 63, 6)
setInterfaceText(killer, "232 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1456, 1, true)
rewardXP(killer, Skills.HITPOINTS, 232.0)
rewardXP(killer, Skills.SLAYER, 232.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,104 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.combat.equipment.WeaponInterface
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Imp champion NPC for Champions challenge.
*/
@Initializable
class ImpChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return ImpChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.IMP_CHAMPION_3062)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnImpChampion(player: Player) {
val champion = ImpChampionNPC(NPCs.IMP_CHAMPION_3062)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
val w = player.getExtension<WeaponInterface>(WeaponInterface::class.java)
if (state.style == CombatStyle.MELEE || state.style == CombatStyle.MAGIC || state.style == CombatStyle.RANGE) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
}
if (w.weaponInterface.interfaceId == 10) {
sendMessage(player, "You cannot use special attack in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Imp Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6803, 260, 63, 3)
setInterfaceText(killer, "160 Slayer Xp", 63, 6)
setInterfaceText(killer, "160 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1457, 1, true)
rewardXP(killer, Skills.HITPOINTS, 160.0)
rewardXP(killer, Skills.SLAYER, 160.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,102 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.combat.equipment.Weapon
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Jogre champion NPC for Champions challenge.
*/
@Initializable
class JogreChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return JogreChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.JOGRE_CHAMPION_3063)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnJogreChampion(player: Player) {
val champion = JogreChampionNPC(NPCs.JOGRE_CHAMPION_3063)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (state.style == CombatStyle.MAGIC || state.style == CombatStyle.MELEE) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
}
if (state.weapon.type == Weapon.WeaponType.DEGRADING || state.style == CombatStyle.RANGE) {
sendMessage(player, "You cannot use ranged weapons.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Jogre Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6804, 260, 63, 3)
setInterfaceText(killer, "480 Slayer Xp", 63, 6)
setInterfaceText(killer, "480 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1458, 1, true)
rewardXP(killer, Skills.HITPOINTS, 480.0)
rewardXP(killer, Skills.SLAYER, 480.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,102 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.container.impl.EquipmentContainer
import core.game.global.action.EquipHandler
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Lesser demon champion NPC for Champions challenge.
*/
@Initializable
class LesserDemonChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return LesserDemonChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.LESSER_DEMON_CHAMPION_3064)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnLesserDemonChampion(player: Player) {
val champion = LesserDemonChampionNPC(NPCs.LESSER_DEMON_CHAMPION_3064)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (!player.equipment[3].hasItemPlugin()) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
} else {
EquipHandler.unequip(player, EquipmentContainer.SLOT_WEAPON, id)
sendMessage(player, "You cannot use weapons in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Lesser Demon Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6805, 260, 63, 3)
setInterfaceText(killer, "592 Slayer Xp", 63, 6)
setInterfaceText(killer, "592 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1459, 1, true)
rewardXP(killer, Skills.HITPOINTS, 592.0)
rewardXP(killer, Skills.SLAYER, 592.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,103 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.combat.equipment.Weapon
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Skeleton champion NPC for Champions challenge.
*/
@Initializable
class SkeletonChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return SkeletonChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.SKELETON_CHAMPION_3065)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnSkeletonChampion(player: Player) {
val champion = SkeletonChampionNPC(NPCs.SKELETON_CHAMPION_3065)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
animate(champion, 259, true)
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (state.style == CombatStyle.RANGE && state.weapon.type == Weapon.WeaponType.DEGRADING && state.weapon.type == Weapon.WeaponType.DOUBLE_SHOT) {
state.neutralizeHits()
state.estimatedHit = state.maximumHit
}
if (state.style == CombatStyle.MAGIC || state.style == CombatStyle.MELEE) {
sendMessage(player, "You can use only ranged weapons in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Skeleton Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6806, 260, 63, 3)
setInterfaceText(killer, "232 Slayer Xp", 63, 6)
setInterfaceText(killer, "232 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1460, 1, true)
rewardXP(killer, Skills.HITPOINTS, 232.0)
rewardXP(killer, Skills.SLAYER, 232.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,102 @@
package content.global.activity.cchallange.npc
import core.api.*
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
/**
* Represents the Zombie champion NPC for Champions challenge.
*/
@Initializable
class ZombieChampionNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
var clearTime = 0
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return ZombieChampionNPC(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.ZOMBIES_CHAMPION_3066)
}
override fun handleTickActions() {
super.handleTickActions()
if (clearTime++ > 288) poofClear(this)
}
companion object {
fun spawnZombieChampion(player: Player) {
val champion = ZombieChampionNPC(NPCs.ZOMBIES_CHAMPION_3066)
champion.location = location(3170, 9758, 0)
champion.isWalks = true
champion.isAggressive = true
champion.isActive = false
if (champion.asNpc() != null && champion.isActive) {
champion.properties.teleportLocation = champion.properties.spawnLocation
}
champion.isActive = true
GameWorld.Pulser.submit(object : Pulse(0, champion) {
override fun pulse(): Boolean {
champion.init()
registerHintIcon(player, champion)
champion.attack(player)
return true
}
})
}
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
if (player is Player) {
if (state.style == CombatStyle.MELEE || state.style == CombatStyle.RANGE) {
state.estimatedHit = state.maximumHit
state.neutralizeHits()
}
if (state.style == CombatStyle.MAGIC) {
sendMessage(player, "You cannot use spells in this challenge.")
if (state.estimatedHit > -1) {
state.estimatedHit = 0
return
}
if (state.secondaryHit > -1) {
state.secondaryHit = 0
return
}
}
}
}
override fun finalizeDeath(killer: Entity?) {
if (killer is Player) {
lock(killer, 2)
runTask(killer, 1) {
openInterface(killer, 63)
setInterfaceText(killer, "Well done, you defeated the Zombie Champion!", 63, 2)
killer.packetDispatch.sendItemZoomOnInterface(Items.CHAMPION_SCROLL_6807, 260, 63, 3)
setInterfaceText(killer, "240 Slayer Xp", 63, 6)
setInterfaceText(killer, "240 Hitpoint Xp", 63, 7)
}
setVarbit(killer, 1461, 1, true)
rewardXP(killer, Skills.HITPOINTS, 240.0)
rewardXP(killer, Skills.SLAYER, 240.0)
removeAttribute("championsarena:start")
clearHintIcon(killer)
}
clear()
super.finalizeDeath(killer)
}
}
@@ -1,99 +0,0 @@
package content.region.misthalin.varrock.dialogue;
import core.game.dialogue.DialoguePlugin;
import core.game.node.entity.npc.NPC;
import core.plugin.Initializable;
import core.game.node.entity.player.Player;
/**
* Represents the dialogue plugin used for the larxus npc.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class LarxusDialogue extends DialoguePlugin {
/**
* Constructs a new {@code LarxusDialogue} {@code Object}.
*/
public LarxusDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code LarxusDialogue} {@code Object}.
* @param player the player.
*/
public LarxusDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new LarxusDialogue(player);
}
@Override
public boolean open(Object... args) {
if (args.length == 2) {
npc("You need to arrange a challenge with me before you", "enter the arena.");
stage = 30;
return true;
}
npc = (NPC) args[0];
npc("Is there something I can help you with?");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
options("I was given a challenge, what now?", "What is this place?", "Nothing thanks.");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
player("I was given a challenge, what now?");
stage = 10;
break;
case 2:
player("What is this place?");
stage = 20;
break;
case 3:
player("Nothing thanks.");
stage = 30;
break;
}
break;
case 10:
npc("Well pass it here and we'll get you started.");
stage = 11;
break;
case 11:
end();
break;
case 20:
npc("This is the champions' arena, the champions of various", "races use it to duel those they deem worthy of the", "honour.");
stage = 21;
break;
case 21:
end();
break;
case 30:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 3050 };
}
}