fixed Family Crest bug where Dimintheis would not replace gauntlets if you lost them (fixes #312)
fixed Family Crest bug where Dimintheis would give you infinite gauntlets (fixes #257) fixed Family Crest bug where Dimintheis didn't check equipped gloves or second bank fixed Family Crest bug where Dimintheis didn't remember which gauntlets you had changing gauntlet enchantment now authentically costs 25k GP (and free the first time) added content API function for checking if a player possesses any particular items anywhere added content API functions for starting and finishing quests
This commit is contained in:
@@ -56,7 +56,6 @@ import rs09.game.world.repository.Repository
|
|||||||
* @param pickaxe whether or not we are trying to get a pickaxe.
|
* @param pickaxe whether or not we are trying to get a pickaxe.
|
||||||
* @return the tool which meets the requirements or null if none.
|
* @return the tool which meets the requirements or null if none.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getTool(player: Player, pickaxe: Boolean): SkillingTool? {
|
fun getTool(player: Player, pickaxe: Boolean): SkillingTool? {
|
||||||
return if(pickaxe) SkillingTool.getPickaxe(player) else SkillingTool.getHatchet(player)
|
return if(pickaxe) SkillingTool.getPickaxe(player) else SkillingTool.getHatchet(player)
|
||||||
}
|
}
|
||||||
@@ -68,7 +67,6 @@ fun getTool(player: Player, pickaxe: Boolean): SkillingTool? {
|
|||||||
* @param level the level to check against
|
* @param level the level to check against
|
||||||
* @return true if the check succeeds, false otherwise
|
* @return true if the check succeeds, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun hasLevelDyn(player: Player, skill: Int, level: Int): Boolean {
|
fun hasLevelDyn(player: Player, skill: Int, level: Int): Boolean {
|
||||||
return player.skills.getLevel(skill) >= level
|
return player.skills.getLevel(skill) >= level
|
||||||
}
|
}
|
||||||
@@ -80,7 +78,6 @@ fun hasLevelDyn(player: Player, skill: Int, level: Int): Boolean {
|
|||||||
* @param level the level to check against
|
* @param level the level to check against
|
||||||
* @return true if the check succeeds, false otherwise
|
* @return true if the check succeeds, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun hasLevelStat(player: Player, skill: Int, level: Int): Boolean {
|
fun hasLevelStat(player: Player, skill: Int, level: Int): Boolean {
|
||||||
return player.skills.getStaticLevel(skill) >= level
|
return player.skills.getStaticLevel(skill) >= level
|
||||||
}
|
}
|
||||||
@@ -92,7 +89,6 @@ fun hasLevelStat(player: Player, skill: Int, level: Int): Boolean {
|
|||||||
* @param amount the amount to check for
|
* @param amount the amount to check for
|
||||||
* @return true if the player has >= the given item in the given amount, false otherwise.
|
* @return true if the player has >= the given item in the given amount, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun inInventory(player: Player, item: Int, amount: Int = 1): Boolean {
|
fun inInventory(player: Player, item: Int, amount: Int = 1): Boolean {
|
||||||
return player.inventory.contains(item, amount)
|
return player.inventory.contains(item, amount)
|
||||||
}
|
}
|
||||||
@@ -103,7 +99,6 @@ fun inInventory(player: Player, item: Int, amount: Int = 1): Boolean {
|
|||||||
* @param id the ID of the item to check for the amount of
|
* @param id the ID of the item to check for the amount of
|
||||||
* @return the amount of the given ID in the player's inventory
|
* @return the amount of the given ID in the player's inventory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun amountInInventory(player: Player, id: Int): Int{
|
fun amountInInventory(player: Player, id: Int): Int{
|
||||||
return player.inventory.getAmount(id)
|
return player.inventory.getAmount(id)
|
||||||
}
|
}
|
||||||
@@ -114,7 +109,6 @@ fun amountInInventory(player: Player, id: Int): Int{
|
|||||||
* @param id the ID of the item to check for
|
* @param id the ID of the item to check for
|
||||||
* @return the amount of the ID in the player's bank.
|
* @return the amount of the ID in the player's bank.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun amountInBank(player: Player, id: Int): Int{
|
fun amountInBank(player: Player, id: Int): Int{
|
||||||
return player.bank.getAmount(id)
|
return player.bank.getAmount(id)
|
||||||
}
|
}
|
||||||
@@ -125,7 +119,6 @@ fun amountInBank(player: Player, id: Int): Int{
|
|||||||
* @param id the ID of the item to check for
|
* @param id the ID of the item to check for
|
||||||
* @return the amount of the ID in the player's equipment.
|
* @return the amount of the ID in the player's equipment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun amountInEquipment(player: Player, id: Int): Int{
|
fun amountInEquipment(player: Player, id: Int): Int{
|
||||||
return player.equipment.getAmount(id)
|
return player.equipment.getAmount(id)
|
||||||
}
|
}
|
||||||
@@ -137,6 +130,23 @@ fun isEquipped(player: Player, id: Int): Boolean {
|
|||||||
return amountInEquipment(player, id) > 0
|
return amountInEquipment(player, id) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class ContainerisedItem(val container: core.game.container.Container?, val itemId: Int)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if player has any of the specified item IDs equipped, in inventory, or in banks
|
||||||
|
* Returns a ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found
|
||||||
|
*/
|
||||||
|
fun hasAnItem(player: Player, vararg ids: Int): ContainerisedItem {
|
||||||
|
for (searchSpace in arrayOf(player.inventory, player.equipment, player.bankPrimary, player.bankSecondary)) {
|
||||||
|
for (id in ids) {
|
||||||
|
if (searchSpace.containItems(id)) {
|
||||||
|
return ContainerisedItem(searchSpace, id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ContainerisedItem(null, -1)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a player has an item equipped which corresponds to the given God
|
* Check if a player has an item equipped which corresponds to the given God
|
||||||
* @param player the player to check
|
* @param player the player to check
|
||||||
@@ -155,7 +165,6 @@ fun hasGodItem(player: Player, god: God): Boolean
|
|||||||
* @param item the ID or Item object to remove from the player's inventory
|
* @param item the ID or Item object to remove from the player's inventory
|
||||||
* @param container the Container to remove the items from. An enum exists for this in the api package called Container. Ex: api.Container.BANK
|
* @param container the Container to remove the items from. An enum exists for this in the api package called Container. Ex: api.Container.BANK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun <T> removeItem(player: Player, item: T, container: Container = Container.INVENTORY): Boolean {
|
fun <T> removeItem(player: Player, item: T, container: Container = Container.INVENTORY): Boolean {
|
||||||
item ?: return false
|
item ?: return false
|
||||||
val it = when (item) {
|
val it = when (item) {
|
||||||
@@ -213,7 +222,6 @@ fun replaceSlot(player: Player, slot: Int, item: Item, container: Container = Co
|
|||||||
* @param id the ID of the item to add to the player's inventory
|
* @param id the ID of the item to add to the player's inventory
|
||||||
* @param amount the amount of the ID to add to the player's inventory, defaults to 1
|
* @param amount the amount of the ID to add to the player's inventory, defaults to 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun addItemOrDrop(player: Player, id: Int, amount: Int = 1){
|
fun addItemOrDrop(player: Player, id: Int, amount: Int = 1){
|
||||||
val item = Item(id, amount)
|
val item = Item(id, amount)
|
||||||
if(!player.inventory.add(item)) GroundItemManager.create(item,player)
|
if(!player.inventory.add(item)) GroundItemManager.create(item,player)
|
||||||
@@ -223,7 +231,6 @@ fun addItemOrDrop(player: Player, id: Int, amount: Int = 1){
|
|||||||
* Clears an NPC with the "poof" smoke graphics commonly seen with random event NPCs.
|
* Clears an NPC with the "poof" smoke graphics commonly seen with random event NPCs.
|
||||||
* @param npc the NPC object to initialize
|
* @param npc the NPC object to initialize
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun poofClear(npc: NPC){
|
fun poofClear(npc: NPC){
|
||||||
submitWorldPulse(object : Pulse(){
|
submitWorldPulse(object : Pulse(){
|
||||||
var counter = 0
|
var counter = 0
|
||||||
@@ -246,7 +253,6 @@ fun poofClear(npc: NPC){
|
|||||||
* @param amount the amount to check for, defaults to 1
|
* @param amount the amount to check for, defaults to 1
|
||||||
* @return true if the item exists in the given amount in the player's bank
|
* @return true if the item exists in the given amount in the player's bank
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun inBank(player: Player, item: Int, amount: Int = 1): Boolean {
|
fun inBank(player: Player, item: Int, amount: Int = 1): Boolean {
|
||||||
return player.bank.contains(item, amount)
|
return player.bank.contains(item, amount)
|
||||||
}
|
}
|
||||||
@@ -258,7 +264,6 @@ fun inBank(player: Player, item: Int, amount: Int = 1): Boolean {
|
|||||||
* @param amount the amount to check for, defaults to 1
|
* @param amount the amount to check for, defaults to 1
|
||||||
* @return true if the item exists in the given amount in the player's equipment
|
* @return true if the item exists in the given amount in the player's equipment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun inEquipment(player: Player, item: Int, amount: Int = 1): Boolean {
|
fun inEquipment(player: Player, item: Int, amount: Int = 1): Boolean {
|
||||||
return player.equipment.contains(item, amount)
|
return player.equipment.contains(item, amount)
|
||||||
}
|
}
|
||||||
@@ -268,7 +273,6 @@ fun inEquipment(player: Player, item: Int, amount: Int = 1): Boolean {
|
|||||||
* @param player the player to check
|
* @param player the player to check
|
||||||
* @return the number of free slots in the player's inventory
|
* @return the number of free slots in the player's inventory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun freeSlots(player: Player): Int {
|
fun freeSlots(player: Player): Int {
|
||||||
return player.inventory.freeSlots()
|
return player.inventory.freeSlots()
|
||||||
}
|
}
|
||||||
@@ -278,7 +282,6 @@ fun freeSlots(player: Player): Int {
|
|||||||
* @param id the ID of the animation to use
|
* @param id the ID of the animation to use
|
||||||
* @return an Animation object with the given ID.
|
* @return an Animation object with the given ID.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getAnimation(id: Int): Animation {
|
fun getAnimation(id: Int): Animation {
|
||||||
return Animation(id)
|
return Animation(id)
|
||||||
}
|
}
|
||||||
@@ -289,7 +292,6 @@ fun getAnimation(id: Int): Animation {
|
|||||||
* @param priority the Animator.Priority enum instance to represent the desired priority
|
* @param priority the Animator.Priority enum instance to represent the desired priority
|
||||||
* @return an Animation object with the given ID and priority
|
* @return an Animation object with the given ID and priority
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getAnimationWithPriority(id: Int, priority: Animator.Priority): Animation {
|
fun getAnimationWithPriority(id: Int, priority: Animator.Priority): Animation {
|
||||||
return Animation(id, Animator.Priority.values()[priority.ordinal])
|
return Animation(id, Animator.Priority.values()[priority.ordinal])
|
||||||
}
|
}
|
||||||
@@ -298,7 +300,6 @@ fun getAnimationWithPriority(id: Int, priority: Animator.Priority): Animation {
|
|||||||
* Reset a player's animator
|
* Reset a player's animator
|
||||||
* @param player the player whose animator to reset
|
* @param player the player whose animator to reset
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun resetAnimator(player: Player) {
|
fun resetAnimator(player: Player) {
|
||||||
player.animator.animate(Animation(-1, Animator.Priority.VERY_HIGH))
|
player.animator.animate(Animation(-1, Animator.Priority.VERY_HIGH))
|
||||||
}
|
}
|
||||||
@@ -308,7 +309,6 @@ fun resetAnimator(player: Player) {
|
|||||||
* @param animation the Animation object to check the duration of
|
* @param animation the Animation object to check the duration of
|
||||||
* @return the number of ticks the given animation lasts for
|
* @return the number of ticks the given animation lasts for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun animationDuration(animation: Animation): Int {
|
fun animationDuration(animation: Animation): Int {
|
||||||
return animation.definition.durationTicks
|
return animation.definition.durationTicks
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,6 @@ fun animationDuration(animation: Animation): Int {
|
|||||||
* @param skill the Skill ID to reward XP for. There is a Skills enum you can use for this. Example: Skills.STRENGTH
|
* @param skill the Skill ID to reward XP for. There is a Skills enum you can use for this. Example: Skills.STRENGTH
|
||||||
* @param amount the amount, including decimal place, of experience to award
|
* @param amount the amount, including decimal place, of experience to award
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun rewardXP(player: Player, skill: Int, amount: Double) {
|
fun rewardXP(player: Player, skill: Int, amount: Double) {
|
||||||
player.skills.addExperience(skill, amount)
|
player.skills.addExperience(skill, amount)
|
||||||
}
|
}
|
||||||
@@ -331,7 +330,6 @@ fun rewardXP(player: Player, skill: Int, amount: Double) {
|
|||||||
* @param for_ticks the number of ticks the object should be replaced for. Use -1 for permanent.
|
* @param for_ticks the number of ticks the object should be replaced for. Use -1 for permanent.
|
||||||
* @param loc the location to move the new object to if necessary. Defaults to null.
|
* @param loc the location to move the new object to if necessary. Defaults to null.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun replaceScenery(toReplace: Scenery, with: Int, for_ticks: Int, loc: Location? = null) {
|
fun replaceScenery(toReplace: Scenery, with: Int, for_ticks: Int, loc: Location? = null) {
|
||||||
val newLoc = when(loc){
|
val newLoc = when(loc){
|
||||||
null -> toReplace.location
|
null -> toReplace.location
|
||||||
@@ -353,7 +351,6 @@ fun replaceScenery(toReplace: Scenery, with: Int, for_ticks: Int, loc: Location?
|
|||||||
* @Param rotation the Direction of the rotation it should use. Direction.NORTH, Direction.SOUTH, etc
|
* @Param rotation the Direction of the rotation it should use. Direction.NORTH, Direction.SOUTH, etc
|
||||||
* @param loc the location to move the new object to if necessary. Defaults to null.
|
* @param loc the location to move the new object to if necessary. Defaults to null.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun replaceScenery(toReplace: Scenery, with: Int, for_ticks: Int, rotation: Direction, loc: Location? = null){
|
fun replaceScenery(toReplace: Scenery, with: Int, for_ticks: Int, rotation: Direction, loc: Location? = null){
|
||||||
val newLoc = when(loc){
|
val newLoc = when(loc){
|
||||||
null -> toReplace.location
|
null -> toReplace.location
|
||||||
@@ -382,7 +379,6 @@ fun replaceScenery(toReplace: Scenery, with: Int, for_ticks: Int, rotation: Dire
|
|||||||
* @param id the ID of the item to get the name of
|
* @param id the ID of the item to get the name of
|
||||||
* @return the name of the item
|
* @return the name of the item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getItemName(id: Int): String {
|
fun getItemName(id: Int): String {
|
||||||
return ItemDefinition.forId(id).name
|
return ItemDefinition.forId(id).name
|
||||||
}
|
}
|
||||||
@@ -391,7 +387,6 @@ fun getItemName(id: Int): String {
|
|||||||
* Removes a ground item
|
* Removes a ground item
|
||||||
* @param node the GroundItem object to remove
|
* @param node the GroundItem object to remove
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun removeGroundItem(node: GroundItem) {
|
fun removeGroundItem(node: GroundItem) {
|
||||||
GroundItemManager.destroy(node)
|
GroundItemManager.destroy(node)
|
||||||
}
|
}
|
||||||
@@ -401,7 +396,6 @@ fun removeGroundItem(node: GroundItem) {
|
|||||||
* @param node the GroundItem object to check the validity of
|
* @param node the GroundItem object to check the validity of
|
||||||
* @return true if the node is valid, false otherwise
|
* @return true if the node is valid, false otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun isValidGroundItem(node: GroundItem): Boolean {
|
fun isValidGroundItem(node: GroundItem): Boolean {
|
||||||
return GroundItemManager.getItems().contains(node)
|
return GroundItemManager.getItems().contains(node)
|
||||||
}
|
}
|
||||||
@@ -412,7 +406,6 @@ fun isValidGroundItem(node: GroundItem): Boolean {
|
|||||||
* @param item the Item to check against
|
* @param item the Item to check against
|
||||||
* @return true if the player's inventory has space for the item
|
* @return true if the player's inventory has space for the item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun hasSpaceFor(player: Player, item: Item): Boolean {
|
fun hasSpaceFor(player: Player, item: Item): Boolean {
|
||||||
return player.inventory.hasSpaceFor(item)
|
return player.inventory.hasSpaceFor(item)
|
||||||
}
|
}
|
||||||
@@ -420,7 +413,6 @@ fun hasSpaceFor(player: Player, item: Item): Boolean {
|
|||||||
/**
|
/**
|
||||||
* Get the number of ticks passed since server startup
|
* Get the number of ticks passed since server startup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getWorldTicks(): Int {
|
fun getWorldTicks(): Int {
|
||||||
return GameWorld.ticks
|
return GameWorld.ticks
|
||||||
}
|
}
|
||||||
@@ -428,7 +420,6 @@ fun getWorldTicks(): Int {
|
|||||||
/**
|
/**
|
||||||
* Gets an Audio object with specified id, volume, etc
|
* Gets an Audio object with specified id, volume, etc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getAudio(id: Int, volume: Int = 10, delay: Int = 1): Audio {
|
fun getAudio(id: Int, volume: Int = 10, delay: Int = 1): Audio {
|
||||||
return Audio(id, volume, delay)
|
return Audio(id, volume, delay)
|
||||||
}
|
}
|
||||||
@@ -439,7 +430,6 @@ fun getAudio(id: Int, volume: Int = 10, delay: Int = 1): Audio {
|
|||||||
* @param amount the amount of damage to deal
|
* @param amount the amount of damage to deal
|
||||||
* @param type the type of hit splat to use, ImpactHandler.HitsplatType is an enum containing these options.
|
* @param type the type of hit splat to use, ImpactHandler.HitsplatType is an enum containing these options.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun impact(entity: Entity, amount: Int, type: ImpactHandler.HitsplatType = ImpactHandler.HitsplatType.NORMAL) {
|
fun impact(entity: Entity, amount: Int, type: ImpactHandler.HitsplatType = ImpactHandler.HitsplatType.NORMAL) {
|
||||||
entity.impactHandler.manualHit(entity, amount, type)
|
entity.impactHandler.manualHit(entity, amount, type)
|
||||||
}
|
}
|
||||||
@@ -449,7 +439,6 @@ fun impact(entity: Entity, amount: Int, type: ImpactHandler.HitsplatType = Impac
|
|||||||
* @param id the ID of the item to get the definition of
|
* @param id the ID of the item to get the definition of
|
||||||
* @return the ItemDefinition for the given ID.
|
* @return the ItemDefinition for the given ID.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun itemDefinition(id: Int): ItemDefinition {
|
fun itemDefinition(id: Int): ItemDefinition {
|
||||||
return ItemDefinition.forId(id)
|
return ItemDefinition.forId(id)
|
||||||
}
|
}
|
||||||
@@ -457,7 +446,6 @@ fun itemDefinition(id: Int): ItemDefinition {
|
|||||||
/**
|
/**
|
||||||
* Send an object animation
|
* Send an object animation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun animateScenery(player: Player, obj: Scenery, animationId: Int, global: Boolean = false) {
|
fun animateScenery(player: Player, obj: Scenery, animationId: Int, global: Boolean = false) {
|
||||||
player.packetDispatch.sendSceneryAnimation(obj, getAnimation(animationId), global)
|
player.packetDispatch.sendSceneryAnimation(obj, getAnimation(animationId), global)
|
||||||
}
|
}
|
||||||
@@ -465,7 +453,6 @@ fun animateScenery(player: Player, obj: Scenery, animationId: Int, global: Boole
|
|||||||
/**
|
/**
|
||||||
* Send an object animation independent of a player
|
* Send an object animation independent of a player
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun animateScenery(obj: Scenery, animationId: Int){
|
fun animateScenery(obj: Scenery, animationId: Int){
|
||||||
val animation = Animation(animationId)
|
val animation = Animation(animationId)
|
||||||
animation.setObject(obj)
|
animation.setObject(obj)
|
||||||
@@ -475,7 +462,6 @@ fun animateScenery(obj: Scenery, animationId: Int){
|
|||||||
/**
|
/**
|
||||||
* Produce a ground item owned by the player
|
* Produce a ground item owned by the player
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun produceGroundItem(player: Player, item: Int) {
|
fun produceGroundItem(player: Player, item: Int) {
|
||||||
GroundItemManager.create(Item(item), player)
|
GroundItemManager.create(Item(item), player)
|
||||||
}
|
}
|
||||||
@@ -483,7 +469,6 @@ fun produceGroundItem(player: Player, item: Int) {
|
|||||||
/**
|
/**
|
||||||
* Spawns a projectile
|
* Spawns a projectile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun spawnProjectile(source: Entity, dest: Entity, projectileId: Int) {
|
fun spawnProjectile(source: Entity, dest: Entity, projectileId: Int) {
|
||||||
Projectile.create(source, dest, projectileId).send()
|
Projectile.create(source, dest, projectileId).send()
|
||||||
}
|
}
|
||||||
@@ -499,7 +484,6 @@ fun spawnProjectile(source: Entity, dest: Entity, projectileId: Int) {
|
|||||||
* @param speed the speed the projectile travels at
|
* @param speed the speed the projectile travels at
|
||||||
* @param angle the angle the projectile travels at
|
* @param angle the angle the projectile travels at
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun spawnProjectile(source: Location, dest: Location, projectile: Int, startHeight: Int, endHeight: Int, delay: Int, speed: Int, angle: Int){
|
fun spawnProjectile(source: Location, dest: Location, projectile: Int, startHeight: Int, endHeight: Int, delay: Int, speed: Int, angle: Int){
|
||||||
Projectile.create(source, dest, projectile, startHeight, endHeight, delay, speed, angle, source.getDistance(dest).toInt()).send()
|
Projectile.create(source, dest, projectile, startHeight, endHeight, delay, speed, angle, source.getDistance(dest).toInt()).send()
|
||||||
}
|
}
|
||||||
@@ -510,7 +494,6 @@ fun spawnProjectile(source: Location, dest: Location, projectile: Int, startHeig
|
|||||||
* @param toFace the thing to face
|
* @param toFace the thing to face
|
||||||
* @param duration how long you wish to face the thing for
|
* @param duration how long you wish to face the thing for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun face(entity: Entity, toFace: Node, duration: Int = -1) {
|
fun face(entity: Entity, toFace: Node, duration: Int = -1) {
|
||||||
if (duration == -1) {
|
if (duration == -1) {
|
||||||
when (toFace) {
|
when (toFace) {
|
||||||
@@ -530,7 +513,6 @@ fun face(entity: Entity, toFace: Node, duration: Int = -1) {
|
|||||||
* @param player the player to open the interface for
|
* @param player the player to open the interface for
|
||||||
* @param id the ID of the interface to open
|
* @param id the ID of the interface to open
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun openInterface(player: Player, id: Int) {
|
fun openInterface(player: Player, id: Int) {
|
||||||
player.interfaceManager.open(Component(id))
|
player.interfaceManager.open(Component(id))
|
||||||
}
|
}
|
||||||
@@ -540,7 +522,6 @@ fun openInterface(player: Player, id: Int) {
|
|||||||
* @param player the player to open the interface for
|
* @param player the player to open the interface for
|
||||||
* @param id the ID of the interface to open
|
* @param id the ID of the interface to open
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun openOverlay(player: Player, id: Int){
|
fun openOverlay(player: Player, id: Int){
|
||||||
player.interfaceManager.openOverlay(Component(id))
|
player.interfaceManager.openOverlay(Component(id))
|
||||||
}
|
}
|
||||||
@@ -549,7 +530,6 @@ fun openOverlay(player: Player, id: Int){
|
|||||||
* Closes any open overlays for the given player
|
* Closes any open overlays for the given player
|
||||||
* @param player the player to close for
|
* @param player the player to close for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun closeOverlay(player: Player){
|
fun closeOverlay(player: Player){
|
||||||
player.interfaceManager.closeOverlay()
|
player.interfaceManager.closeOverlay()
|
||||||
}
|
}
|
||||||
@@ -559,7 +539,6 @@ fun closeOverlay(player: Player){
|
|||||||
* @param entity the entity to run the emote on
|
* @param entity the entity to run the emote on
|
||||||
* @param emote the Emotes enum entry to run
|
* @param emote the Emotes enum entry to run
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun emote(entity: Entity, emote: Emotes) {
|
fun emote(entity: Entity, emote: Emotes) {
|
||||||
entity.animate(emote.animation)
|
entity.animate(emote.animation)
|
||||||
}
|
}
|
||||||
@@ -568,7 +547,6 @@ fun emote(entity: Entity, emote: Emotes) {
|
|||||||
* Sends a message to the given player.
|
* Sends a message to the given player.
|
||||||
* @param player the player to send the message to.
|
* @param player the player to send the message to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendMessage(player: Player, message: String) {
|
fun sendMessage(player: Player, message: String) {
|
||||||
player.sendMessage(message)
|
player.sendMessage(message)
|
||||||
}
|
}
|
||||||
@@ -578,7 +556,6 @@ fun sendMessage(player: Player, message: String) {
|
|||||||
* @param entity the entity to send the chat for
|
* @param entity the entity to send the chat for
|
||||||
* @param message the message to display
|
* @param message the message to display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendChat(entity: Entity, message: String) {
|
fun sendChat(entity: Entity, message: String) {
|
||||||
entity.sendChat(message)
|
entity.sendChat(message)
|
||||||
}
|
}
|
||||||
@@ -588,7 +565,6 @@ fun sendChat(entity: Entity, message: String) {
|
|||||||
* @param player the player to send the dialogue to
|
* @param player the player to send the dialogue to
|
||||||
* @param message the message to send, lines are split automatically.
|
* @param message the message to send, lines are split automatically.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendDialogue(player: Player, message: String) {
|
fun sendDialogue(player: Player, message: String) {
|
||||||
player.dialogueInterpreter.sendDialogue(*splitLines(message))
|
player.dialogueInterpreter.sendDialogue(*splitLines(message))
|
||||||
}
|
}
|
||||||
@@ -599,7 +575,6 @@ fun sendDialogue(player: Player, message: String) {
|
|||||||
* @param anim the animation to play, can be an ID or an Animation object.
|
* @param anim the animation to play, can be an ID or an Animation object.
|
||||||
* @param forced whether or not to force the animation (usually not necessary)
|
* @param forced whether or not to force the animation (usually not necessary)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun <T> animate(entity: Entity, anim: T, forced: Boolean = false) {
|
fun <T> animate(entity: Entity, anim: T, forced: Boolean = false) {
|
||||||
val animation = when(anim){
|
val animation = when(anim){
|
||||||
is Int -> Animation(anim)
|
is Int -> Animation(anim)
|
||||||
@@ -620,7 +595,6 @@ fun <T> animate(entity: Entity, anim: T, forced: Boolean = false) {
|
|||||||
* @param audio the Audio to play
|
* @param audio the Audio to play
|
||||||
* @param global if other nearby entities should be able to hear it
|
* @param global if other nearby entities should be able to hear it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun playAudio(player: Player, audio: Audio, global: Boolean = false) {
|
fun playAudio(player: Player, audio: Audio, global: Boolean = false) {
|
||||||
player.audioManager.send(audio, global)
|
player.audioManager.send(audio, global)
|
||||||
}
|
}
|
||||||
@@ -631,7 +605,6 @@ fun playAudio(player: Player, audio: Audio, global: Boolean = false) {
|
|||||||
* @param dialogue either the dialogue key or an instance of a DialogueFile
|
* @param dialogue either the dialogue key or an instance of a DialogueFile
|
||||||
* @param args various args to pass to the opened dialogue
|
* @param args various args to pass to the opened dialogue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun openDialogue(player: Player, dialogue: Any, vararg args: Any) {
|
fun openDialogue(player: Player, dialogue: Any, vararg args: Any) {
|
||||||
player.dialogueInterpreter.close()
|
player.dialogueInterpreter.close()
|
||||||
when (dialogue) {
|
when (dialogue) {
|
||||||
@@ -647,7 +620,6 @@ fun openDialogue(player: Player, dialogue: Any, vararg args: Any) {
|
|||||||
* @param id the ID of the NPC to locate
|
* @param id the ID of the NPC to locate
|
||||||
* @returns an NPC instance matching the ID if it finds one, null otherwise
|
* @returns an NPC instance matching the ID if it finds one, null otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun findNPC(id: Int): NPC? {
|
fun findNPC(id: Int): NPC? {
|
||||||
return Repository.findNPC(id)
|
return Repository.findNPC(id)
|
||||||
}
|
}
|
||||||
@@ -658,7 +630,6 @@ fun findNPC(id: Int): NPC? {
|
|||||||
* @param y the Y coordinate to use
|
* @param y the Y coordinate to use
|
||||||
* @param z the Z coordinate to use
|
* @param z the Z coordinate to use
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getScenery(x: Int, y: Int, z: Int): Scenery?{
|
fun getScenery(x: Int, y: Int, z: Int): Scenery?{
|
||||||
return RegionManager.getObject(z,x,y)
|
return RegionManager.getObject(z,x,y)
|
||||||
}
|
}
|
||||||
@@ -667,7 +638,6 @@ fun getScenery(x: Int, y: Int, z: Int): Scenery?{
|
|||||||
* Gets the spawned scenery from the world map using the given Location object.
|
* Gets the spawned scenery from the world map using the given Location object.
|
||||||
* @param loc the Location object to use.
|
* @param loc the Location object to use.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getScenery(loc: Location): Scenery?{
|
fun getScenery(loc: Location): Scenery?{
|
||||||
return RegionManager.getObject(loc)
|
return RegionManager.getObject(loc)
|
||||||
}
|
}
|
||||||
@@ -678,7 +648,6 @@ fun getScenery(loc: Location): Scenery?{
|
|||||||
* @param id the ID of the NPC to locate
|
* @param id the ID of the NPC to locate
|
||||||
* @returns an NPC instance matching the ID if it finds one, null otherwise
|
* @returns an NPC instance matching the ID if it finds one, null otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun findNPC(refLoc: Location, id: Int): NPC? {
|
fun findNPC(refLoc: Location, id: Int): NPC? {
|
||||||
return Repository.npcs.firstOrNull { it.id == id && it.location.withinDistance(refLoc) }
|
return Repository.npcs.firstOrNull { it.id == id && it.location.withinDistance(refLoc) }
|
||||||
}
|
}
|
||||||
@@ -689,7 +658,6 @@ fun findNPC(refLoc: Location, id: Int): NPC? {
|
|||||||
* @param id the ID of the NPC to locate
|
* @param id the ID of the NPC to locate
|
||||||
* @returns an NPC matching the given ID or null if none is found
|
* @returns an NPC matching the given ID or null if none is found
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun findLocalNPC(entity: Entity, id: Int): NPC? {
|
fun findLocalNPC(entity: Entity, id: Int): NPC? {
|
||||||
return RegionManager.getLocalNpcs(entity).firstOrNull { it.id == id }
|
return RegionManager.getLocalNpcs(entity).firstOrNull { it.id == id }
|
||||||
}
|
}
|
||||||
@@ -699,7 +667,6 @@ fun findLocalNPC(entity: Entity, id: Int): NPC? {
|
|||||||
* @param entity the entity to check around
|
* @param entity the entity to check around
|
||||||
* @param ids the IDs of the NPCs to look for
|
* @param ids the IDs of the NPCs to look for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun findLocalNPCs(entity: Entity, ids: IntArray): List<NPC>{
|
fun findLocalNPCs(entity: Entity, ids: IntArray): List<NPC>{
|
||||||
return RegionManager.getLocalNpcs(entity).filter { it.id in ids }.toList()
|
return RegionManager.getLocalNpcs(entity).filter { it.id in ids }.toList()
|
||||||
}
|
}
|
||||||
@@ -710,7 +677,6 @@ fun findLocalNPCs(entity: Entity, ids: IntArray): List<NPC>{
|
|||||||
* @param ids the IDs of the NPCs to look for
|
* @param ids the IDs of the NPCs to look for
|
||||||
* @param distance The maximum distance to the entity.
|
* @param distance The maximum distance to the entity.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun findLocalNPCs(entity: Entity, ids: IntArray, distance: Int): List<NPC>{
|
fun findLocalNPCs(entity: Entity, ids: IntArray, distance: Int): List<NPC>{
|
||||||
return RegionManager.getLocalNpcs(entity, distance).filter { it.id in ids }.toList()
|
return RegionManager.getLocalNpcs(entity, distance).filter { it.id in ids }.toList()
|
||||||
}
|
}
|
||||||
@@ -730,7 +696,6 @@ fun getRegionBorders(regionId: Int) : ZoneBorders
|
|||||||
* @param attribute the attribute key to use
|
* @param attribute the attribute key to use
|
||||||
* @param default the default value to return if the attribute does not exist
|
* @param default the default value to return if the attribute does not exist
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun <T> getAttribute(entity: Entity, attribute: String, default: T): T {
|
fun <T> getAttribute(entity: Entity, attribute: String, default: T): T {
|
||||||
return entity.getAttribute(attribute, default)
|
return entity.getAttribute(attribute, default)
|
||||||
}
|
}
|
||||||
@@ -741,7 +706,6 @@ fun <T> getAttribute(entity: Entity, attribute: String, default: T): T {
|
|||||||
* @param attribute the attribute key to use
|
* @param attribute the attribute key to use
|
||||||
* @param value the value to set the attribute to
|
* @param value the value to set the attribute to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun <T> setAttribute(entity: Entity, attribute: String, value: T) {
|
fun <T> setAttribute(entity: Entity, attribute: String, value: T) {
|
||||||
entity.setAttribute(attribute, value)
|
entity.setAttribute(attribute, value)
|
||||||
}
|
}
|
||||||
@@ -751,7 +715,6 @@ fun <T> setAttribute(entity: Entity, attribute: String, value: T) {
|
|||||||
* @param entity the entity to lock
|
* @param entity the entity to lock
|
||||||
* @param duration the number of ticks to lock for
|
* @param duration the number of ticks to lock for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun lock(entity: Entity, duration: Int) {
|
fun lock(entity: Entity, duration: Int) {
|
||||||
entity.lock(duration)
|
entity.lock(duration)
|
||||||
}
|
}
|
||||||
@@ -761,7 +724,6 @@ fun lock(entity: Entity, duration: Int) {
|
|||||||
* @param entity the entity to lock
|
* @param entity the entity to lock
|
||||||
* @param duration the duration in ticks to lock for
|
* @param duration the duration in ticks to lock for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun lockInteractions(entity: Entity, duration: Int) {
|
fun lockInteractions(entity: Entity, duration: Int) {
|
||||||
entity.locks.lockInteractions(duration)
|
entity.locks.lockInteractions(duration)
|
||||||
}
|
}
|
||||||
@@ -770,7 +732,6 @@ fun lockInteractions(entity: Entity, duration: Int) {
|
|||||||
* Unlocks the given entity
|
* Unlocks the given entity
|
||||||
* @param entity the entity to unlock
|
* @param entity the entity to unlock
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun unlock(entity: Entity) {
|
fun unlock(entity: Entity) {
|
||||||
entity.unlock()
|
entity.unlock()
|
||||||
}
|
}
|
||||||
@@ -781,7 +742,6 @@ fun unlock(entity: Entity) {
|
|||||||
* @param transformTo the ID of the NPC to turn into
|
* @param transformTo the ID of the NPC to turn into
|
||||||
* @param restoreTicks the number of ticks until the NPC returns to normal
|
* @param restoreTicks the number of ticks until the NPC returns to normal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun transformNpc(npc: NPC, transformTo: Int, restoreTicks: Int){
|
fun transformNpc(npc: NPC, transformTo: Int, restoreTicks: Int){
|
||||||
npc.transform(transformTo)
|
npc.transform(transformTo)
|
||||||
Pulser.submit(object : Pulse(restoreTicks){
|
Pulser.submit(object : Pulse(restoreTicks){
|
||||||
@@ -795,7 +755,6 @@ fun transformNpc(npc: NPC, transformTo: Int, restoreTicks: Int){
|
|||||||
/**
|
/**
|
||||||
* Produces a Location object using the given x,y,z values
|
* Produces a Location object using the given x,y,z values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun location(x: Int, y: Int, z: Int): Location{
|
fun location(x: Int, y: Int, z: Int): Location{
|
||||||
return Location.create(x,y,z)
|
return Location.create(x,y,z)
|
||||||
}
|
}
|
||||||
@@ -817,7 +776,6 @@ fun inBorders(entity: Entity, swX: Int, swY: Int, neX: Int, neY: Int): Boolean {
|
|||||||
/**
|
/**
|
||||||
* AHeals the given entity for the given number of hitpoints
|
* AHeals the given entity for the given number of hitpoints
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun heal(entity: Entity, amount: Int){
|
fun heal(entity: Entity, amount: Int){
|
||||||
entity.skills.heal(amount)
|
entity.skills.heal(amount)
|
||||||
}
|
}
|
||||||
@@ -829,7 +787,6 @@ fun heal(entity: Entity, amount: Int){
|
|||||||
* @param offset the offset of the desired varbit inside the varp.
|
* @param offset the offset of the desired varbit inside the varp.
|
||||||
* @param value the value to set the varbit to
|
* @param value the value to set the varbit to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun setVarbit(player: Player, varpIndex: Int, offset: Int, value: Int, save: Boolean = false){
|
fun setVarbit(player: Player, varpIndex: Int, offset: Int, value: Int, save: Boolean = false){
|
||||||
player.varpManager.get(varpIndex).setVarbit(offset,value).send(player)
|
player.varpManager.get(varpIndex).setVarbit(offset,value).send(player)
|
||||||
if(save) player.varpManager.flagSave(varpIndex)
|
if(save) player.varpManager.flagSave(varpIndex)
|
||||||
@@ -840,7 +797,6 @@ fun setVarbit(player: Player, varpIndex: Int, offset: Int, value: Int, save: Boo
|
|||||||
* @param player the player to clear for
|
* @param player the player to clear for
|
||||||
* @param varpIndex the index of the varp to clear
|
* @param varpIndex the index of the varp to clear
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun clearVarp(player: Player, varpIndex: Int){
|
fun clearVarp(player: Player, varpIndex: Int){
|
||||||
player.varpManager.get(varpIndex).clear()
|
player.varpManager.get(varpIndex).clear()
|
||||||
}
|
}
|
||||||
@@ -851,7 +807,6 @@ fun clearVarp(player: Player, varpIndex: Int){
|
|||||||
* @param varpIndex the index of the varp to calculate the value of
|
* @param varpIndex the index of the varp to calculate the value of
|
||||||
* @return the value of the varp
|
* @return the value of the varp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getVarpValue(player: Player, varpIndex: Int): Int{
|
fun getVarpValue(player: Player, varpIndex: Int): Int{
|
||||||
return player.varpManager.get(varpIndex).getValue()
|
return player.varpManager.get(varpIndex).getValue()
|
||||||
}
|
}
|
||||||
@@ -863,7 +818,6 @@ fun getVarpValue(player: Player, varpIndex: Int): Int{
|
|||||||
* @param offset the offset of the varbit inside the varp
|
* @param offset the offset of the varbit inside the varp
|
||||||
* @return the value of the given varbit
|
* @return the value of the given varbit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getVarbitValue(player: Player, varpIndex: Int, offset: Int): Int {
|
fun getVarbitValue(player: Player, varpIndex: Int, offset: Int): Int {
|
||||||
return player.varpManager.get(varpIndex).getVarbitValue(offset) ?: 0
|
return player.varpManager.get(varpIndex).getVarbitValue(offset) ?: 0
|
||||||
}
|
}
|
||||||
@@ -874,7 +828,6 @@ fun getVarbitValue(player: Player, varpIndex: Int, offset: Int): Int {
|
|||||||
* @param dest the Location object to walk to
|
* @param dest the Location object to walk to
|
||||||
* @param type the type of pathfinder to use. "smart" for the SMART pathfinder, "clip" for the noclip pathfinder, anything else for DUMB.
|
* @param type the type of pathfinder to use. "smart" for the SMART pathfinder, "clip" for the noclip pathfinder, anything else for DUMB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun forceWalk(entity: Entity, dest: Location, type: String){
|
fun forceWalk(entity: Entity, dest: Location, type: String){
|
||||||
if(type == "clip"){
|
if(type == "clip"){
|
||||||
ForceMovement(entity, dest, 10, 10).run()
|
ForceMovement(entity, dest, 10, 10).run()
|
||||||
@@ -892,7 +845,6 @@ fun forceWalk(entity: Entity, dest: Location, type: String){
|
|||||||
* Interrupts a given entity's walking queue
|
* Interrupts a given entity's walking queue
|
||||||
* @param entity the entity to interrupt
|
* @param entity the entity to interrupt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun stopWalk(entity: Entity){
|
fun stopWalk(entity: Entity){
|
||||||
entity.walkingQueue.reset()
|
entity.walkingQueue.reset()
|
||||||
}
|
}
|
||||||
@@ -903,7 +855,6 @@ fun stopWalk(entity: Entity){
|
|||||||
* @param slot the Equipment slot to use, EquipmentSlot enum contains the options.
|
* @param slot the Equipment slot to use, EquipmentSlot enum contains the options.
|
||||||
* @return the Item in the given slot, or null if none.
|
* @return the Item in the given slot, or null if none.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getItemFromEquipment(player: Player, slot: EquipmentSlot): Item? {
|
fun getItemFromEquipment(player: Player, slot: EquipmentSlot): Item? {
|
||||||
return player.equipment.get(slot.ordinal)
|
return player.equipment.get(slot.ordinal)
|
||||||
}
|
}
|
||||||
@@ -920,7 +871,6 @@ fun getChildren(scenery: Int): IntArray {
|
|||||||
* @param node the node to adjust the charge of
|
* @param node the node to adjust the charge of
|
||||||
* @param amount the amount to adjust by
|
* @param amount the amount to adjust by
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun adjustCharge(node: Node, amount: Int){
|
fun adjustCharge(node: Node, amount: Int){
|
||||||
when(node){
|
when(node){
|
||||||
is Item -> node.charge += amount
|
is Item -> node.charge += amount
|
||||||
@@ -934,7 +884,6 @@ fun adjustCharge(node: Node, amount: Int){
|
|||||||
* @param node the node whose charge to check
|
* @param node the node whose charge to check
|
||||||
* @return amount of charges the node has, or -1 if the node does not accept charges.
|
* @return amount of charges the node has, or -1 if the node does not accept charges.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getCharge(node: Node): Int{
|
fun getCharge(node: Node): Int{
|
||||||
when(node){
|
when(node){
|
||||||
is Item -> return node.charge
|
is Item -> return node.charge
|
||||||
@@ -948,7 +897,6 @@ fun getCharge(node: Node): Int{
|
|||||||
* @param node the node to set the charge for
|
* @param node the node to set the charge for
|
||||||
* @param charge the amount to set the node's charge to (default is 1000)
|
* @param charge the amount to set the node's charge to (default is 1000)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun setCharge(node: Node, charge: Int){
|
fun setCharge(node: Node, charge: Int){
|
||||||
when(node){
|
when(node){
|
||||||
is Item -> node.charge = charge
|
is Item -> node.charge = charge
|
||||||
@@ -962,7 +910,6 @@ fun setCharge(node: Node, charge: Int){
|
|||||||
* @param player the player to get the used option for.
|
* @param player the player to get the used option for.
|
||||||
* @return the option the player used
|
* @return the option the player used
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getUsedOption(player: Player): String {
|
fun getUsedOption(player: Player): String {
|
||||||
return player.getAttribute("interact:option","INVALID")
|
return player.getAttribute("interact:option","INVALID")
|
||||||
}
|
}
|
||||||
@@ -973,7 +920,6 @@ fun getUsedOption(player: Player): String {
|
|||||||
* @param anim the Animation object to use, can also be an ID.
|
* @param anim the Animation object to use, can also be an ID.
|
||||||
* @param gfx the Graphics object to use, can also be an ID.
|
* @param gfx the Graphics object to use, can also be an ID.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun <A,G> visualize(entity: Entity, anim: A, gfx: G){
|
fun <A,G> visualize(entity: Entity, anim: A, gfx: G){
|
||||||
val animation = when(anim){
|
val animation = when(anim){
|
||||||
is Int -> Animation(anim)
|
is Int -> Animation(anim)
|
||||||
@@ -994,7 +940,6 @@ fun <A,G> visualize(entity: Entity, anim: A, gfx: G){
|
|||||||
* Used to submit a pulse to the GameWorld's Pulser.
|
* Used to submit a pulse to the GameWorld's Pulser.
|
||||||
* @param pulse the Pulse object to submit
|
* @param pulse the Pulse object to submit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun submitWorldPulse(pulse: Pulse){
|
fun submitWorldPulse(pulse: Pulse){
|
||||||
GameWorld.Pulser.submit(pulse)
|
GameWorld.Pulser.submit(pulse)
|
||||||
}
|
}
|
||||||
@@ -1005,7 +950,6 @@ fun submitWorldPulse(pulse: Pulse){
|
|||||||
* @param loc the Location object to move them to
|
* @param loc the Location object to move them to
|
||||||
* @param type the teleport type to use (defaults to instant). An enum exists as TeleportManager.TeleportType.
|
* @param type the teleport type to use (defaults to instant). An enum exists as TeleportManager.TeleportType.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun teleport(entity: Entity, loc: Location, type: TeleportManager.TeleportType = TeleportManager.TeleportType.INSTANT){
|
fun teleport(entity: Entity, loc: Location, type: TeleportManager.TeleportType = TeleportManager.TeleportType.INSTANT){
|
||||||
if(type == TeleportManager.TeleportType.INSTANT) entity.properties.teleportLocation = loc
|
if(type == TeleportManager.TeleportType.INSTANT) entity.properties.teleportLocation = loc
|
||||||
else entity.teleporter.send(loc,type)
|
else entity.teleporter.send(loc,type)
|
||||||
@@ -1017,7 +961,6 @@ fun teleport(entity: Entity, loc: Location, type: TeleportManager.TeleportType =
|
|||||||
* @param skill the Skill to set. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
* @param skill the Skill to set. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
||||||
* @param level the level to set the skill to
|
* @param level the level to set the skill to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun setTempLevel(entity: Entity, skill: Int, level: Int){
|
fun setTempLevel(entity: Entity, skill: Int, level: Int){
|
||||||
entity.skills.setLevel(skill, level)
|
entity.skills.setLevel(skill, level)
|
||||||
}
|
}
|
||||||
@@ -1028,7 +971,6 @@ fun setTempLevel(entity: Entity, skill: Int, level: Int){
|
|||||||
* @param skill the Skill to get the level of. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
* @param skill the Skill to get the level of. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
||||||
* @return the static level of the skill
|
* @return the static level of the skill
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getStatLevel(entity: Entity, skill: Int): Int {
|
fun getStatLevel(entity: Entity, skill: Int): Int {
|
||||||
return entity.skills.getStaticLevel(skill)
|
return entity.skills.getStaticLevel(skill)
|
||||||
}
|
}
|
||||||
@@ -1039,7 +981,6 @@ fun getStatLevel(entity: Entity, skill: Int): Int {
|
|||||||
* @param skill the Skill to get the level of. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
* @param skill the Skill to get the level of. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
||||||
* @return the dynamic level of the skill
|
* @return the dynamic level of the skill
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getDynLevel(entity: Entity, skill: Int): Int {
|
fun getDynLevel(entity: Entity, skill: Int): Int {
|
||||||
return entity.skills.getLevel(skill)
|
return entity.skills.getLevel(skill)
|
||||||
}
|
}
|
||||||
@@ -1050,7 +991,6 @@ fun getDynLevel(entity: Entity, skill: Int): Int {
|
|||||||
* @param skill the Skill to adjust. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
* @param skill the Skill to adjust. A Skills enum exists that can be used. Ex: Skills.STRENGTH
|
||||||
* @param amount the amount to adjust the skill by. Ex-Buff: 5, Ex-Debuff: -5
|
* @param amount the amount to adjust the skill by. Ex-Buff: 5, Ex-Debuff: -5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun adjustLevel(entity: Entity, skill: Int, amount: Int){
|
fun adjustLevel(entity: Entity, skill: Int, amount: Int){
|
||||||
entity.skills.setLevel(skill, entity.skills.getStaticLevel(skill) + amount)
|
entity.skills.setLevel(skill, entity.skills.getStaticLevel(skill) + amount)
|
||||||
}
|
}
|
||||||
@@ -1061,7 +1001,6 @@ fun adjustLevel(entity: Entity, skill: Int, amount: Int){
|
|||||||
* @param item the item to remove. Can be an Item object or an ID.
|
* @param item the item to remove. Can be an Item object or an ID.
|
||||||
* @param container the Container to remove the item from. An enum exists for this called Container. Ex: Container.BANK
|
* @param container the Container to remove the item from. An enum exists for this called Container. Ex: Container.BANK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun <T> removeAll(player: Player, item: T, container: Container){
|
fun <T> removeAll(player: Player, item: T, container: Container){
|
||||||
val it = when(item){
|
val it = when(item){
|
||||||
is Item -> item.id
|
is Item -> item.id
|
||||||
@@ -1083,7 +1022,6 @@ fun <T> removeAll(player: Player, item: T, container: Container){
|
|||||||
* @param iface the ID of the interface to use
|
* @param iface the ID of the interface to use
|
||||||
* @param child the index of the child to send the string to
|
* @param child the index of the child to send the string to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun setInterfaceText(player: Player, string: String, iface: Int, child: Int){
|
fun setInterfaceText(player: Player, string: String, iface: Int, child: Int){
|
||||||
player.packetDispatch.sendString(string,iface,child)
|
player.packetDispatch.sendString(string,iface,child)
|
||||||
}
|
}
|
||||||
@@ -1092,7 +1030,6 @@ fun setInterfaceText(player: Player, string: String, iface: Int, child: Int){
|
|||||||
* Closes any open (non-chat) interfaces for the player
|
* Closes any open (non-chat) interfaces for the player
|
||||||
* @param player the player to close the interface for
|
* @param player the player to close the interface for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun closeInterface(player: Player){
|
fun closeInterface(player: Player){
|
||||||
player.interfaceManager.close()
|
player.interfaceManager.close()
|
||||||
}
|
}
|
||||||
@@ -1101,7 +1038,6 @@ fun closeInterface(player: Player){
|
|||||||
* Closes any opened tab interfaces for the player
|
* Closes any opened tab interfaces for the player
|
||||||
* @param player the player to close the tab for
|
* @param player the player to close the tab for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun closeTabInterface(player: Player){
|
fun closeTabInterface(player: Player){
|
||||||
player.interfaceManager.closeSingleTab()
|
player.interfaceManager.closeSingleTab()
|
||||||
}
|
}
|
||||||
@@ -1112,7 +1048,6 @@ fun closeTabInterface(player: Player){
|
|||||||
* @param msg the message to send.
|
* @param msg the message to send.
|
||||||
* @param expr the FacialExpression to use. An enum exists for these called FacialExpression. Defaults to FacialExpression.FRIENDLY
|
* @param expr the FacialExpression to use. An enum exists for these called FacialExpression. Defaults to FacialExpression.FRIENDLY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendPlayerDialogue(player: Player, msg: String, expr: FacialExpression = FacialExpression.FRIENDLY){
|
fun sendPlayerDialogue(player: Player, msg: String, expr: FacialExpression = FacialExpression.FRIENDLY){
|
||||||
player.dialogueInterpreter.sendDialogues(player, expr, *splitLines(msg))
|
player.dialogueInterpreter.sendDialogues(player, expr, *splitLines(msg))
|
||||||
}
|
}
|
||||||
@@ -1123,7 +1058,6 @@ fun sendPlayerDialogue(player: Player, msg: String, expr: FacialExpression = Fac
|
|||||||
* @param iface the ID of the interface to send it to
|
* @param iface the ID of the interface to send it to
|
||||||
* @param child the index of the child on the interface to send the model to
|
* @param child the index of the child on the interface to send the model to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendPlayerOnInterface(player: Player, iface: Int, child: Int){
|
fun sendPlayerOnInterface(player: Player, iface: Int, child: Int){
|
||||||
player.packetDispatch.sendPlayerOnInterface(iface,child)
|
player.packetDispatch.sendPlayerOnInterface(iface,child)
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1069,6 @@ fun sendPlayerOnInterface(player: Player, iface: Int, child: Int){
|
|||||||
* @param msg the message to send.
|
* @param msg the message to send.
|
||||||
* @param expr the FacialExpression to use. An enum exists for these called FacialExpression. Defaults to FacialExpression.FRIENDLY
|
* @param expr the FacialExpression to use. An enum exists for these called FacialExpression. Defaults to FacialExpression.FRIENDLY
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendNPCDialogue(player: Player, npc: Int, msg: String, expr: FacialExpression = FacialExpression.FRIENDLY){
|
fun sendNPCDialogue(player: Player, npc: Int, msg: String, expr: FacialExpression = FacialExpression.FRIENDLY){
|
||||||
player.dialogueInterpreter.sendDialogues(npc, expr, *splitLines(msg))
|
player.dialogueInterpreter.sendDialogues(npc, expr, *splitLines(msg))
|
||||||
}
|
}
|
||||||
@@ -1147,7 +1080,6 @@ fun sendNPCDialogue(player: Player, npc: Int, msg: String, expr: FacialExpressio
|
|||||||
* @param iface the ID of the interface to send the animation to
|
* @param iface the ID of the interface to send the animation to
|
||||||
* @param child the index of the child on the interface to send the model to
|
* @param child the index of the child on the interface to send the model to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendAnimationOnInterface(player: Player, anim: Int, iface: Int, child: Int){
|
fun sendAnimationOnInterface(player: Player, anim: Int, iface: Int, child: Int){
|
||||||
player.packetDispatch.sendAnimationInterface(anim,iface,child)
|
player.packetDispatch.sendAnimationInterface(anim,iface,child)
|
||||||
}
|
}
|
||||||
@@ -1157,7 +1089,6 @@ fun sendAnimationOnInterface(player: Player, anim: Int, iface: Int, child: Int){
|
|||||||
* @param player the player to register the listener for
|
* @param player the player to register the listener for
|
||||||
* @param handler the method to run when the listener is invoked (when the player logs out)
|
* @param handler the method to run when the listener is invoked (when the player logs out)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun registerLogoutListener(player: Player, key: String, handler: (p: Player) -> Unit){
|
fun registerLogoutListener(player: Player, key: String, handler: (p: Player) -> Unit){
|
||||||
player.logoutListeners[key] = handler
|
player.logoutListeners[key] = handler
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1098,6 @@ fun registerLogoutListener(player: Player, key: String, handler: (p: Player) ->
|
|||||||
* @param player the player to remove the logout listner from
|
* @param player the player to remove the logout listner from
|
||||||
* @param key the key of the logout listener to remove.
|
* @param key the key of the logout listener to remove.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun clearLogoutListener(player: Player, key: String){
|
fun clearLogoutListener(player: Player, key: String){
|
||||||
player.logoutListeners.remove(key)
|
player.logoutListeners.remove(key)
|
||||||
}
|
}
|
||||||
@@ -1180,7 +1110,6 @@ fun clearLogoutListener(player: Player, key: String){
|
|||||||
* @param item the ID of the item to send
|
* @param item the ID of the item to send
|
||||||
* @param amount the amount of the item to send - defaults to 1
|
* @param amount the amount of the item to send - defaults to 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendItemOnInterface(player: Player, iface: Int, child: Int, item: Int, amount: Int = 1){
|
fun sendItemOnInterface(player: Player, iface: Int, child: Int, item: Int, amount: Int = 1){
|
||||||
player.packetDispatch.sendItemOnInterface(item,amount,iface,child)
|
player.packetDispatch.sendItemOnInterface(item,amount,iface,child)
|
||||||
}
|
}
|
||||||
@@ -1191,7 +1120,6 @@ fun sendItemOnInterface(player: Player, iface: Int, child: Int, item: Int, amoun
|
|||||||
* @param item the ID of the item to show
|
* @param item the ID of the item to show
|
||||||
* @param message the text to display
|
* @param message the text to display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendItemDialogue(player: Player, item: Int, message: String){
|
fun sendItemDialogue(player: Player, item: Int, message: String){
|
||||||
player.dialogueInterpreter.sendItemMessage(item, *splitLines(message))
|
player.dialogueInterpreter.sendItemMessage(item, *splitLines(message))
|
||||||
}
|
}
|
||||||
@@ -1203,7 +1131,6 @@ fun sendItemDialogue(player: Player, item: Int, message: String){
|
|||||||
* @param item2 the ID of the second item to show
|
* @param item2 the ID of the second item to show
|
||||||
* @param message the text to display
|
* @param message the text to display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendDoubleItemDialogue(player: Player, item1: Int, item2: Int, message: String){
|
fun sendDoubleItemDialogue(player: Player, item1: Int, item2: Int, message: String){
|
||||||
player.dialogueInterpreter.sendDoubleItemMessage(item1, item2, message)
|
player.dialogueInterpreter.sendDoubleItemMessage(item1, item2, message)
|
||||||
}
|
}
|
||||||
@@ -1215,7 +1142,6 @@ fun sendDoubleItemDialogue(player: Player, item1: Int, item2: Int, message: Stri
|
|||||||
* @param prompt what to prompt the player
|
* @param prompt what to prompt the player
|
||||||
* @param handler the method that handles the value gained from the input dialogue
|
* @param handler the method that handles the value gained from the input dialogue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendInputDialogue(player: Player, numeric: Boolean, prompt: String, handler: (value: Any) -> Unit){
|
fun sendInputDialogue(player: Player, numeric: Boolean, prompt: String, handler: (value: Any) -> Unit){
|
||||||
if(numeric) sendInputDialogue(player, InputType.NUMERIC, prompt, handler)
|
if(numeric) sendInputDialogue(player, InputType.NUMERIC, prompt, handler)
|
||||||
else sendInputDialogue(player, InputType.STRING_SHORT, prompt, handler)
|
else sendInputDialogue(player, InputType.STRING_SHORT, prompt, handler)
|
||||||
@@ -1228,7 +1154,6 @@ fun sendInputDialogue(player: Player, numeric: Boolean, prompt: String, handler:
|
|||||||
* @param prompt what to prompt the player
|
* @param prompt what to prompt the player
|
||||||
* @param handler the method that handles the value from the input dialogue
|
* @param handler the method that handles the value from the input dialogue
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendInputDialogue(player: Player, type: InputType, prompt: String, handler: (value: Any) -> Unit){
|
fun sendInputDialogue(player: Player, type: InputType, prompt: String, handler: (value: Any) -> Unit){
|
||||||
when(type){
|
when(type){
|
||||||
InputType.NUMERIC, InputType.STRING_SHORT -> player.dialogueInterpreter.sendInput(type != InputType.NUMERIC, prompt)
|
InputType.NUMERIC, InputType.STRING_SHORT -> player.dialogueInterpreter.sendInput(type != InputType.NUMERIC, prompt)
|
||||||
@@ -1243,7 +1168,6 @@ fun sendInputDialogue(player: Player, type: InputType, prompt: String, handler:
|
|||||||
* @param entity the entity to make flee
|
* @param entity the entity to make flee
|
||||||
* @param from the entity to flee from
|
* @param from the entity to flee from
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun flee(entity: Entity, from: Entity){
|
fun flee(entity: Entity, from: Entity){
|
||||||
lock(entity, 5)
|
lock(entity, 5)
|
||||||
face(entity, from, 5)
|
face(entity, from, 5)
|
||||||
@@ -1259,7 +1183,6 @@ fun flee(entity: Entity, from: Entity){
|
|||||||
* @param entity the entity to submit the pulse to
|
* @param entity the entity to submit the pulse to
|
||||||
* @param pulse the pulse to submit
|
* @param pulse the pulse to submit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun submitIndividualPulse(entity: Entity, pulse: Pulse){
|
fun submitIndividualPulse(entity: Entity, pulse: Pulse){
|
||||||
entity.pulseManager.run(pulse)
|
entity.pulseManager.run(pulse)
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1190,6 @@ fun submitIndividualPulse(entity: Entity, pulse: Pulse){
|
|||||||
/**
|
/**
|
||||||
* Similar to submitIndividualPulse, but for non-repeating tasks, with a cleaner syntax.
|
* Similar to submitIndividualPulse, but for non-repeating tasks, with a cleaner syntax.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun runTask(entity: Entity, delay: Int = 0, task: () -> Unit){
|
fun runTask(entity: Entity, delay: Int = 0, task: () -> Unit){
|
||||||
entity.pulseManager.run(object : Pulse(delay) {
|
entity.pulseManager.run(object : Pulse(delay) {
|
||||||
override fun pulse(): Boolean {
|
override fun pulse(): Boolean {
|
||||||
@@ -1282,23 +1204,20 @@ fun runTask(entity: Entity, delay: Int = 0, task: () -> Unit){
|
|||||||
* @param player the player to get the QP for
|
* @param player the player to get the QP for
|
||||||
* @return the number of QP the player has
|
* @return the number of QP the player has
|
||||||
*/
|
*/
|
||||||
|
fun getQP(player: Player): Int {
|
||||||
fun getQP(player: Player): Int{
|
|
||||||
return player.questRepository.points
|
return player.questRepository.points
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the stage for the given quest for the given player
|
* Gets the stage for the given quest for the given player
|
||||||
*/
|
*/
|
||||||
|
fun questStage(player: Player, quest: String): Int {
|
||||||
fun questStage(player: Player, quest: String): Int{
|
|
||||||
return player.questRepository.getStage(quest)
|
return player.questRepository.getStage(quest)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the stage for the given quest for the given player
|
* Sets the stage for the given quest for the given player
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun setQuestStage(player: Player, quest: String, stage: Int) {
|
fun setQuestStage(player: Player, quest: String, stage: Int) {
|
||||||
player.questRepository.setStage(QuestRepository.getQuests()[quest]!!, stage)
|
player.questRepository.setStage(QuestRepository.getQuests()[quest]!!, stage)
|
||||||
player.questRepository.syncronizeTab(player)
|
player.questRepository.syncronizeTab(player)
|
||||||
@@ -1307,17 +1226,34 @@ fun setQuestStage(player: Player, quest: String, stage: Int) {
|
|||||||
/**
|
/**
|
||||||
* Check if a quest is complete
|
* Check if a quest is complete
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun isQuestComplete(player: Player, quest: String): Boolean {
|
fun isQuestComplete(player: Player, quest: String): Boolean {
|
||||||
return player.questRepository.getStage(quest) == 100
|
return player.questRepository.getStage(quest) == 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a player meets the requirements to start a quest, and then starts it if they do. Returns success bool
|
||||||
|
*/
|
||||||
|
fun startQuest(player: Player, quest: String): Boolean {
|
||||||
|
val quest = player.questRepository.getQuest(quest)
|
||||||
|
val canStart = quest.hasRequirements(player)
|
||||||
|
if (!canStart) return false
|
||||||
|
quest.start(player)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finishes a quest, gives rewards, marks as completed, etc
|
||||||
|
*/
|
||||||
|
fun finishQuest(player: Player, quest: String) {
|
||||||
|
player.questRepository.getQuest(quest).finish(player)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a scenery definition from the given ID
|
* Gets a scenery definition from the given ID
|
||||||
* @param id the ID of the scenery to get the definition for.
|
* @param id the ID of the scenery to get the definition for.
|
||||||
* @return the scenery definition
|
* @return the scenery definition
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sceneryDefinition(id: Int): SceneryDefinition{
|
fun sceneryDefinition(id: Int): SceneryDefinition{
|
||||||
return SceneryDefinition.forId(id)
|
return SceneryDefinition.forId(id)
|
||||||
}
|
}
|
||||||
@@ -1327,7 +1263,6 @@ fun sceneryDefinition(id: Int): SceneryDefinition{
|
|||||||
* @param zone the zone to register
|
* @param zone the zone to register
|
||||||
* @param borders the ZoneBorders that compose the zone
|
* @param borders the ZoneBorders that compose the zone
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun registerMapZone(zone: MapZone, borders: ZoneBorders){
|
fun registerMapZone(zone: MapZone, borders: ZoneBorders){
|
||||||
ZoneBuilder.configure(zone)
|
ZoneBuilder.configure(zone)
|
||||||
zone.register(borders)
|
zone.register(borders)
|
||||||
@@ -1340,7 +1275,6 @@ fun registerMapZone(zone: MapZone, borders: ZoneBorders){
|
|||||||
* @param child the child on the interface to animate.
|
* @param child the child on the interface to animate.
|
||||||
* @param anim the ID of the animation to use.
|
* @param anim the ID of the animation to use.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun animateInterface(player: Player, iface: Int, child: Int, anim: Int){
|
fun animateInterface(player: Player, iface: Int, child: Int, anim: Int){
|
||||||
player.packetDispatch.sendAnimationInterface(anim,iface,child)
|
player.packetDispatch.sendAnimationInterface(anim,iface,child)
|
||||||
}
|
}
|
||||||
@@ -1350,7 +1284,6 @@ fun animateInterface(player: Player, iface: Int, child: Int, anim: Int){
|
|||||||
* @param ladderLoc the location of the ladder/stairs object you want to climb.
|
* @param ladderLoc the location of the ladder/stairs object you want to climb.
|
||||||
* @param dest the destination for the climb.
|
* @param dest the destination for the climb.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun addClimbDest(ladderLoc: Location, dest: Location){
|
fun addClimbDest(ladderLoc: Location, dest: Location){
|
||||||
SpecialLadders.add(ladderLoc,dest)
|
SpecialLadders.add(ladderLoc,dest)
|
||||||
}
|
}
|
||||||
@@ -1359,7 +1292,6 @@ fun addClimbDest(ladderLoc: Location, dest: Location){
|
|||||||
* Sends a news announcement in game chat.
|
* Sends a news announcement in game chat.
|
||||||
* @param message the message to announce
|
* @param message the message to announce
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun sendNews(message: String){
|
fun sendNews(message: String){
|
||||||
Repository.sendNews(message, 12, "CC6600")
|
Repository.sendNews(message, 12, "CC6600")
|
||||||
}
|
}
|
||||||
@@ -1369,7 +1301,6 @@ fun sendNews(message: String){
|
|||||||
* @param gfx the Graphics object, or the Integer ID of the graphics, to send. Either works.
|
* @param gfx the Graphics object, or the Integer ID of the graphics, to send. Either works.
|
||||||
* @param location the location to send it to
|
* @param location the location to send it to
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun <G> sendGraphics(gfx: G, location: Location){
|
fun <G> sendGraphics(gfx: G, location: Location){
|
||||||
when(gfx){
|
when(gfx){
|
||||||
is Int -> Graphics.send(Graphics(gfx),location)
|
is Int -> Graphics.send(Graphics(gfx),location)
|
||||||
@@ -1390,7 +1321,6 @@ fun announceIfRare(player: Player, item: Item) {
|
|||||||
* @param player the player
|
* @param player the player
|
||||||
* @return a List<String> of skill names
|
* @return a List<String> of skill names
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun getMasteredSkillNames(player: Player): List<String> {
|
fun getMasteredSkillNames(player: Player): List<String> {
|
||||||
val hasMastered = player.getSkills().masteredSkills > 0
|
val hasMastered = player.getSkills().masteredSkills > 0
|
||||||
val masteredSkills = ArrayList<String>()
|
val masteredSkills = ArrayList<String>()
|
||||||
@@ -1415,7 +1345,6 @@ fun getMasteredSkillNames(player: Player): List<String> {
|
|||||||
* @author ceik
|
* @author ceik
|
||||||
* @author James Triantafylos
|
* @author James Triantafylos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun dumpContainer(player: Player, container: core.game.container.Container) {
|
fun dumpContainer(player: Player, container: core.game.container.Container) {
|
||||||
val bank = player.bank
|
val bank = player.bank
|
||||||
container.toArray().filterNotNull().forEach { item ->
|
container.toArray().filterNotNull().forEach { item ->
|
||||||
@@ -1446,7 +1375,6 @@ fun dumpContainer(player: Player, container: core.game.container.Container) {
|
|||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @return boolean indicating presence of house.
|
* @return boolean indicating presence of house.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun hasHouse(player: Player): Boolean {
|
fun hasHouse(player: Player): Boolean {
|
||||||
return player.houseManager.hasHouse()
|
return player.houseManager.hasHouse()
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-32
@@ -1,10 +1,12 @@
|
|||||||
package core.game.content.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
|
import api.*
|
||||||
import core.game.content.dialogue.DialoguePlugin
|
import core.game.content.dialogue.DialoguePlugin
|
||||||
import core.game.node.entity.npc.NPC
|
import core.game.node.entity.npc.NPC
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
@Initializable
|
@Initializable
|
||||||
class AvanDialogue (player: Player? = null): DialoguePlugin(player) {
|
class AvanDialogue (player: Player? = null): DialoguePlugin(player) {
|
||||||
@@ -19,8 +21,8 @@ class AvanDialogue (player: Player? = null): DialoguePlugin(player) {
|
|||||||
npc = (args[0] as NPC).getShownNPC(player)
|
npc = (args[0] as NPC).getShownNPC(player)
|
||||||
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
|
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
|
||||||
|
|
||||||
if(qstage == 100){
|
if (qstage == 100) {
|
||||||
options("Can you enchant these gauntlets for me?", "Nevermind")
|
options("Can you change my gauntlets for me?", "Nevermind")
|
||||||
stage = 6000
|
stage = 6000
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -173,42 +175,35 @@ class AvanDialogue (player: Player? = null): DialoguePlugin(player) {
|
|||||||
"it is a priceless family heirloom.").also{stage = 1000
|
"it is a priceless family heirloom.").also{stage = 1000
|
||||||
player.inventory.add(CREST_PIECE_AVAN)}
|
player.inventory.add(CREST_PIECE_AVAN)}
|
||||||
|
|
||||||
6000 -> when(buttonId){
|
6000 -> when (buttonId) {
|
||||||
1-> if(DoMissingGuantletCheck() != -1){
|
1 -> {
|
||||||
var gauntletID = DoMissingGuantletCheck()
|
var freeThisTime = getAttribute(player, "family-crest:gauntlets", Items.FAMILY_GAUNTLETS_778) == Items.FAMILY_GAUNTLETS_778
|
||||||
|
npc("Yes certainly, though it will cost you 25,000 coins" + if (freeThisTime) " next time." else ".").also { stage = 6001 }
|
||||||
if(gauntletID == 776){
|
|
||||||
npc("You already have the Goldsmith guantlets.")
|
|
||||||
stage = 1000
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
npc("Here you go")
|
|
||||||
player.inventory.remove(Item(gauntletID))
|
|
||||||
player.inventory.add(Item(776))
|
|
||||||
stage = 1000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
2 -> player("Never mind").also{ stage = 1000 }
|
||||||
npc("You do not have the guantlets with you in your inventory")
|
|
||||||
stage = 1000
|
|
||||||
}
|
|
||||||
2-> player("Never mind").also{stage = 1000}
|
|
||||||
}
|
}
|
||||||
|
6001 -> options("Great thanks!", "No that's okay thanks.").also{ stage++ }
|
||||||
|
6002 -> when (buttonId) {
|
||||||
|
1 -> {
|
||||||
|
stage = 1000
|
||||||
|
val givingGauntletsId = Items.GOLDSMITH_GAUNTLETS_776
|
||||||
|
val npcString = SwapGauntletsHelper.swapGauntlets(player, givingGauntletsId)
|
||||||
|
if (npcString == "")
|
||||||
|
{
|
||||||
|
end()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
npc(npcString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
2 -> end()
|
||||||
|
}
|
||||||
|
|
||||||
1000 -> end()
|
1000 -> end()
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun DoMissingGuantletCheck(): Int{
|
|
||||||
var itemsToCheck = listOf(775, 776, 777, 778)
|
|
||||||
for(item in itemsToCheck){
|
|
||||||
if(player.inventory.containItems(item))
|
|
||||||
return item
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getIds(): IntArray {
|
override fun getIds(): IntArray {
|
||||||
return intArrayOf(663)
|
return intArrayOf(663)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package core.game.content.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
import core.game.content.dialogue.DialoguePlugin
|
import core.game.content.dialogue.DialoguePlugin
|
||||||
import core.game.content.dialogue.FacialExpression
|
import core.game.content.dialogue.FacialExpression
|
||||||
|
|||||||
+25
-35
@@ -1,10 +1,12 @@
|
|||||||
package core.game.content.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
|
import api.*
|
||||||
import core.game.content.dialogue.DialoguePlugin
|
import core.game.content.dialogue.DialoguePlugin
|
||||||
import core.game.node.entity.npc.NPC
|
import core.game.node.entity.npc.NPC
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
|
|
||||||
@Initializable
|
@Initializable
|
||||||
@@ -20,8 +22,8 @@ class CalebDialogue (player: Player? = null): DialoguePlugin(player) {
|
|||||||
npc = (args[0] as NPC).getShownNPC(player)
|
npc = (args[0] as NPC).getShownNPC(player)
|
||||||
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
|
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
|
||||||
|
|
||||||
if(qstage == 100){
|
if (qstage == 100) {
|
||||||
options("Can you enchant these gauntlets for me?", "Nevermind")
|
options("Can you change my gauntlets for me?", "Nevermind")
|
||||||
stage = 6000
|
stage = 6000
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -201,51 +203,39 @@ class CalebDialogue (player: Player? = null): DialoguePlugin(player) {
|
|||||||
player.inventory.add(CREST_PIECE)
|
player.inventory.add(CREST_PIECE)
|
||||||
}
|
}
|
||||||
406 -> npc("I suggest you be less careless in the future. ",
|
406 -> npc("I suggest you be less careless in the future. ",
|
||||||
"The crest is extremely valuable, and utterly irreplacable.").also{stage = 1000}
|
"The crest is extremely valuable, and utterly irreplaceable.").also{stage = 1000}
|
||||||
|
|
||||||
6000 -> when(buttonId){
|
6000 -> when (buttonId) {
|
||||||
1-> if(DoMissingGuantletCheck() != -1){
|
1 -> {
|
||||||
var gauntletID = DoMissingGuantletCheck()
|
var freeThisTime = getAttribute(player, "family-crest:gauntlets", Items.FAMILY_GAUNTLETS_778) == Items.FAMILY_GAUNTLETS_778
|
||||||
|
npc("Yes certainly, though it will cost you 25,000 coins" + if (freeThisTime) " next time." else ".").also { stage = 6001 }
|
||||||
if(gauntletID == 775){
|
|
||||||
npc("You already have the Cooking Guantlets.")
|
|
||||||
stage = 1000
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
npc("Here you go")
|
|
||||||
player.inventory.remove(Item(gauntletID))
|
|
||||||
player.inventory.add(Item(775))
|
|
||||||
stage = 1000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
2 -> player("Never mind").also{ stage = 1000 }
|
||||||
npc("You do not have the guantlets with you in your inventory")
|
}
|
||||||
|
6001 -> options("Great thanks!", "No that's okay thanks.").also{ stage++ }
|
||||||
|
6002 -> when (buttonId) {
|
||||||
|
1 -> {
|
||||||
stage = 1000
|
stage = 1000
|
||||||
|
val givingGauntletsId = Items.COOKING_GAUNTLETS_775
|
||||||
|
val npcString = SwapGauntletsHelper.swapGauntlets(player, givingGauntletsId)
|
||||||
|
if (npcString == "")
|
||||||
|
{
|
||||||
|
end()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
npc(npcString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
2-> player("Never mind").also{stage = 1000}
|
2 -> end()
|
||||||
}
|
}
|
||||||
|
|
||||||
1000 -> end()
|
1000 -> end()
|
||||||
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun DoMissingGuantletCheck(): Int{
|
|
||||||
var itemsToCheck = listOf(775, 776, 777, 778)
|
|
||||||
for(item in itemsToCheck){
|
|
||||||
if(player.inventory.containItems(item))
|
|
||||||
return item
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun getIds(): IntArray {
|
override fun getIds(): IntArray {
|
||||||
return intArrayOf(666)
|
return intArrayOf(666)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
@@ -10,6 +10,7 @@ import core.game.world.map.zone.ZoneBorders
|
|||||||
import core.game.world.map.zone.ZoneBuilder
|
import core.game.world.map.zone.ZoneBuilder
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
import core.plugin.Plugin
|
import core.plugin.Plugin
|
||||||
|
import rs09.game.content.quest.members.familycrest.ChronozonNPC
|
||||||
|
|
||||||
|
|
||||||
@Initializable
|
@Initializable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
import core.game.node.entity.Entity
|
import core.game.node.entity.Entity
|
||||||
import core.game.node.entity.combat.BattleState
|
import core.game.node.entity.combat.BattleState
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
import core.game.interaction.NodeUsageEvent
|
import core.game.interaction.NodeUsageEvent
|
||||||
import core.game.interaction.UseWithHandler
|
import core.game.interaction.UseWithHandler
|
||||||
|
|||||||
+56
-67
@@ -1,14 +1,12 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
|
|
||||||
|
import api.*
|
||||||
import core.game.content.dialogue.DialoguePlugin
|
import core.game.content.dialogue.DialoguePlugin
|
||||||
import core.game.node.entity.npc.NPC
|
import core.game.node.entity.npc.NPC
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.entity.skill.Skills
|
|
||||||
import core.game.node.item.Item
|
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Initializable
|
@Initializable
|
||||||
@@ -21,41 +19,46 @@ class DimintheisDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
return DimintheisDialogue(player)
|
return DimintheisDialogue(player)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val questName = "Family Crest"
|
||||||
|
|
||||||
override fun open(vararg args: Any?): Boolean {
|
override fun open(vararg args: Any?): Boolean {
|
||||||
npc = (args[0] as NPC).getShownNPC(player)
|
npc = (args[0] as NPC).getShownNPC(player)
|
||||||
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
|
val questStage = questStage(player, questName)
|
||||||
|
val questComplete = isQuestComplete(player, questName)
|
||||||
|
|
||||||
if(qstage == 100 && !DoMissingGuantletCheck()){
|
if (questStage == 20 && inInventory(player, Items.FAMILY_CREST_782)) {
|
||||||
|
player("I have retrieved your crest.").also{ stage = 5000 }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
val hasGauntlets = hasAnItem(player, Items.COOKING_GAUNTLETS_775, Items.GOLDSMITH_GAUNTLETS_776, Items.CHAOS_GAUNTLETS_777, Items.FAMILY_GAUNTLETS_778).container != null
|
||||||
|
|
||||||
|
if (questComplete && hasGauntlets) {
|
||||||
npc("Thank you for saving our family honour, ",
|
npc("Thank you for saving our family honour, ",
|
||||||
"We will never forget you")
|
"We will never forget you")
|
||||||
stage = 1000
|
stage = 1000
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(qstage == 100 && DoMissingGuantletCheck()){
|
if (questComplete && !hasGauntlets) {
|
||||||
player("I've lost the guantlets you gave me")
|
player("I've lost the gauntlets you gave me")
|
||||||
stage = 6000
|
stage = 6000
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(qstage == 20 && player.inventory.containItems(782)){
|
when(questStage) {
|
||||||
player("I have retrieved your crest.").also{stage = 5000}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
when(qstage) {
|
|
||||||
0 -> npc("Hello. My name is Dimintheis, ",
|
0 -> npc("Hello. My name is Dimintheis, ",
|
||||||
"of the noble family Fitzharmon.").also { stage = 1 }
|
"of the noble family Fitzharmon.").also { stage = 1 }
|
||||||
10 -> player("Where did you say I could find your son Caleb again?").also { stage = 3000 }
|
10 -> player("Where did you say I could find your son Caleb again?").also { stage = 3000 }
|
||||||
11 -> player("Where did you say I could find your son Caleb again?").also { stage = 3000 }
|
11 -> player("Where did you say I could find your son Caleb again?").also { stage = 3000 }
|
||||||
12 -> npc("Have you found my crest yet?").also{stage = 4000}
|
12 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
13 -> npc("Have you found my crest yet?").also{stage = 4000}
|
13 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
14 -> npc("Have you found my crest yet?").also{stage = 4000}
|
14 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
15 -> npc("Have you found my crest yet?").also{stage = 4000}
|
15 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
16 -> npc("Have you found my crest yet?").also{stage = 4000}
|
16 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
17 -> npc("Have you found my crest yet?").also{stage = 4000}
|
17 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
18 -> npc("Have you found my crest yet?").also{stage = 4000}
|
18 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
19 -> npc("Have you found my crest yet?").also{stage = 4000}
|
19 -> npc("Have you found my crest yet?").also{ stage = 4000 }
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -65,10 +68,10 @@ class DimintheisDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
1 -> options(
|
1 -> options(
|
||||||
"Why would a nobleman live in a dump like this?",
|
"Why would a nobleman live in a dump like this?",
|
||||||
"You're rich then? Can i have some money?",
|
"You're rich then? Can i have some money?",
|
||||||
"Hi, i am a bold adventurer.").also {stage++}
|
"Hi, i am a bold adventurer.").also { stage++ }
|
||||||
2 -> when(buttonId){
|
2 -> when(buttonId){
|
||||||
1 -> npc("The King has taken my estate from me ",
|
1 -> npc("The King has taken my estate from me ",
|
||||||
"until such time as I can show my family crest to him.").also { stage = 3}
|
"until such time as I can show my family crest to him.").also { stage = 3 }
|
||||||
2 -> npc("Gah! Lousy beggar! " ,
|
2 -> npc("Gah! Lousy beggar! " ,
|
||||||
"Your sort is what's ruining this great land! ",
|
"Your sort is what's ruining this great land! ",
|
||||||
"Why don't you just go and get a " ,
|
"Why don't you just go and get a " ,
|
||||||
@@ -78,20 +81,20 @@ class DimintheisDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
"It is of utmost importance.").also { stage = 4 }
|
"It is of utmost importance.").also { stage = 4 }
|
||||||
}
|
}
|
||||||
3 -> options("Why would he do that?",
|
3 -> options("Why would he do that?",
|
||||||
"So where is this crest?").also {stage = 5}
|
"So where is this crest?").also { stage = 5 }
|
||||||
|
|
||||||
4 -> options("Why are you so desperate for it?",
|
4 -> options("Why are you so desperate for it?",
|
||||||
"So where is this crest?",
|
"So where is this crest?",
|
||||||
"I'm not interested in that adventure right now").also { stage = 6}
|
"I'm not interested in that adventure right now").also { stage = 6 }
|
||||||
5 -> when(buttonId){
|
5 -> when(buttonId){
|
||||||
1-> npc("Well, there is a long standing rule of chivalry " ,
|
1-> npc("Well, there is a long standing rule of chivalry " ,
|
||||||
"amongst the Varrockian aristocracy,").also{stage = 2000}
|
"amongst the Varrockian aristocracy,").also{ stage = 2000 }
|
||||||
2-> npc("Well, my three sons took it with them " ,
|
2-> npc("Well, my three sons took it with them " ,
|
||||||
"many years ago when they rode ").also { stage = 2007 }
|
"many years ago when they rode ").also { stage = 2007 }
|
||||||
}
|
}
|
||||||
6 -> when(buttonId){
|
6 -> when(buttonId){
|
||||||
1 -> npc("Well, there is a long standing rule of chivalry " ,
|
1 -> npc("Well, there is a long standing rule of chivalry " ,
|
||||||
"amongst the Varrockian aristocracy,").also{stage = 2000}
|
"amongst the Varrockian aristocracy,").also{ stage = 2000 }
|
||||||
2 -> npc("Well, my three sons took it with them " ,
|
2 -> npc("Well, my three sons took it with them " ,
|
||||||
"many years ago when they rode ").also { stage = 2007 }
|
"many years ago when they rode ").also { stage = 2007 }
|
||||||
3 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000}
|
3 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000}
|
||||||
@@ -105,7 +108,7 @@ class DimintheisDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
"their wealth and lands. If the family crest is lost,").also { stage++ }
|
"their wealth and lands. If the family crest is lost,").also { stage++ }
|
||||||
|
|
||||||
2002 -> npc( "then the family's estate is handed over to the ",
|
2002 -> npc( "then the family's estate is handed over to the ",
|
||||||
"current monarch until the crest is restored.").also{stage++}
|
"current monarch until the crest is restored.").also{ stage++ }
|
||||||
2003 -> npc("This dates back to the times when there was much in-fighting " ,
|
2003 -> npc("This dates back to the times when there was much in-fighting " ,
|
||||||
"amongst the noble families and their clans, and ",
|
"amongst the noble families and their clans, and ",
|
||||||
"was introduced as a way of reducing the bloodshed that was ",
|
"was introduced as a way of reducing the bloodshed that was ",
|
||||||
@@ -118,83 +121,69 @@ class DimintheisDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
2006 -> when(buttonId){
|
2006 -> when(buttonId){
|
||||||
1-> npc("Well, my three sons took it ",
|
1-> npc("Well, my three sons took it ",
|
||||||
"with them many years ago when they rode out ").also { stage++ }
|
"with them many years ago when they rode out ").also { stage++ }
|
||||||
|
2 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000 }
|
||||||
2 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
2007 -> npc("to fight in the war against the undead necromancer " ,
|
2007 -> npc("to fight in the war against the undead necromancer " ,
|
||||||
"and his army in the battle to save Varrock.").also { stage++}
|
"and his army in the battle to save Varrock.").also { stage++ }
|
||||||
2008 -> npc("For many years I had assumed them all dead, " ,
|
2008 -> npc("For many years I had assumed them all dead, " ,
|
||||||
"as I had heard no word from them.").also { stage++}
|
"as I had heard no word from them.").also { stage++ }
|
||||||
2009 -> npc("Recently I heard that my son Caleb is alive and well, " ,
|
2009 -> npc("Recently I heard that my son Caleb is alive and well, " ,
|
||||||
"trying to earn his fortune as a great fish chef in Catherby.").also { stage++ }
|
"trying to earn his fortune as a great fish chef in Catherby.").also { stage++ }
|
||||||
2010 -> options("Ok, I will help you", "I'm not interested in an adventure right now").also { stage++ }
|
2010 -> options("Ok, I will help you", "I'm not interested in an adventure right now").also { stage++ }
|
||||||
2011 -> when(buttonId){
|
2011 -> when(buttonId){
|
||||||
1 -> npc("I thank you greatly adventurer!").also { stage++}
|
1 -> npc("I thank you greatly adventurer!").also { stage++ }
|
||||||
2 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000 }
|
2 -> npc("I realise it was a lot to ask of a stranger.").also { stage = 1000 }
|
||||||
}
|
}
|
||||||
2012 -> if(player.questRepository.getQuest("Family Crest").hasRequirements(player)) {
|
2012 -> if(startQuest(player, questName)) {
|
||||||
npc("If you find Caleb, or my other sons... please... ",
|
npc("If you find Caleb, or my other sons... please... ",
|
||||||
"let them know their father still loves them...").also { stage = 1000 }.also { player.questRepository.getQuest("Family Crest").start(player) }.also { player.questRepository.syncronizeTab(player) }
|
"let them know their father still loves them...").also { stage = 1000 }
|
||||||
}else{
|
} else {
|
||||||
npc("But im sorry, but you cannot help me right now").also{stage = 1000}
|
npc("But im sorry, but you cannot help me right now").also{ stage = 1000 }
|
||||||
}
|
}
|
||||||
|
|
||||||
3000 ->npc("The only thing I have heard of my son Caleb ",
|
3000 ->npc("The only thing I have heard of my son Caleb ",
|
||||||
"is that he is trying to earn his fortune as a great fish chef.").also{stage++}
|
"is that he is trying to earn his fortune as a great fish chef.").also{ stage++ }
|
||||||
3001 ->npc("I believe he is staying with a friend ",
|
3001 ->npc("I believe he is staying with a friend ",
|
||||||
"who lives just outside the west gates of Varrock.").also{stage = 1000}
|
"who lives just outside the west gates of Varrock.").also{ stage = 1000 }
|
||||||
|
|
||||||
4000 -> player("I'm still looking for it").also{stage = 1000}
|
|
||||||
|
|
||||||
|
4000 -> player("I'm still looking for it").also{ stage = 1000 }
|
||||||
|
|
||||||
5000 -> npc("Adventurer... I can only thank you for your kindness, " ,
|
5000 -> npc("Adventurer... I can only thank you for your kindness, " ,
|
||||||
"although the words are insufficient " ,
|
"although the words are insufficient " ,
|
||||||
"to express the gratitude I feel!").also{stage++}
|
"to express the gratitude I feel!").also{ stage++ }
|
||||||
5001 -> npc("You are truly a hero in every sense, " ,
|
5001 -> npc("You are truly a hero in every sense, " ,
|
||||||
"and perhaps your efforts can begin to " ,
|
"and perhaps your efforts can begin to " ,
|
||||||
"patch the wounds that have torn this family apart...").also{stage++}
|
"patch the wounds that have torn this family apart...").also{ stage++ }
|
||||||
5002 -> npc("I know not how I can adequately reward you for your efforts... " ,
|
5002 -> npc("I know not how I can adequately reward you for your efforts... " ,
|
||||||
"although I do have these mystical gauntlets, " ,
|
"although I do have these mystical gauntlets, " ,
|
||||||
"a family heirloom that through some power unknown to me, " ,
|
"a family heirloom that through some power unknown to me, " ,
|
||||||
"have always returned to the head of the family whenever lost,").also{stage++}
|
"have always returned to the head of the family whenever lost,").also{ stage++ }
|
||||||
|
|
||||||
5003 -> npc(" or if the owner has died. " ,
|
5003 -> npc(" or if the owner has died. " ,
|
||||||
"I will pledge these to you, " ,
|
"I will pledge these to you, " ,
|
||||||
"and if you should lose them return to me, " ,
|
"and if you should lose them return to me, " ,
|
||||||
"and they will be here.").also{stage++
|
"and they will be here.").also{ stage++ }
|
||||||
}
|
|
||||||
5004 -> npc("They can also be granted extra powers. " ,
|
5004 -> npc("They can also be granted extra powers. " ,
|
||||||
"Take them to one of my sons, " ,
|
"Take them to one of my sons, " ,
|
||||||
"they should be able to imbue them with a skill for you.").also{stage = 1000
|
"they should be able to imbue them with a skill for you.").also {
|
||||||
player.questRepository.getQuest("Family Crest").finish(player)
|
stage = 1000
|
||||||
player.questRepository.getQuest("Family Crest").setStage(player, 100)
|
if (removeItem(player, Items.FAMILY_CREST_782)) {
|
||||||
|
finishQuest(player, questName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
6000 -> npc("Not to worry, here they are").also{
|
6000 -> npc("Not to worry, here they are").also {
|
||||||
stage = 1000
|
stage = 1000
|
||||||
player.inventory.add(Item(778))
|
addItem(player, getAttribute(player, "family-crest:gauntlets", Items.FAMILY_GAUNTLETS_778))
|
||||||
}
|
}
|
||||||
|
|
||||||
1000 -> end()
|
1000 -> end()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun DoMissingGuantletCheck(): Boolean{
|
|
||||||
var itemsToCheck = listOf(775, 776, 777, 778)
|
|
||||||
for(item in itemsToCheck){
|
|
||||||
if(player.inventory.containItems(item))
|
|
||||||
return true
|
|
||||||
if(player.bank.containItems(item))
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
override fun getIds(): IntArray {
|
override fun getIds(): IntArray {
|
||||||
return intArrayOf(8171)
|
return intArrayOf(8171)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
|
|
||||||
|
import api.addItem
|
||||||
|
import api.setAttribute
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.entity.player.link.quest.Quest
|
import core.game.node.entity.player.link.quest.Quest
|
||||||
import core.game.node.entity.skill.Skills
|
import core.game.node.entity.skill.Skills
|
||||||
@@ -8,6 +10,7 @@ import core.game.node.item.GroundItemManager
|
|||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
|
import rs09.game.system.SystemLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the "Family Crest" quest.
|
* Represents the "Family Crest" quest.
|
||||||
@@ -116,10 +119,10 @@ class FamilyCrest: Quest("Family Crest", 59, 58, 1, 148, 0, 1, 11) {
|
|||||||
drawReward(player,"A choice of special abilities for the gauntlets",ln++)
|
drawReward(player,"A choice of special abilities for the gauntlets",ln++)
|
||||||
drawReward(player,"for the gauntlets",ln++)
|
drawReward(player,"for the gauntlets",ln++)
|
||||||
|
|
||||||
if(!player.inventory.add(Item(Items.FAMILY_GAUNTLETS_778))){
|
if (!addItem(player, Items.FAMILY_GAUNTLETS_778)) {
|
||||||
GroundItemManager.create(Item(Items.FAMILY_GAUNTLETS_778),player)
|
SystemLogger.logErr("Failed to give gauntlets to ${player.username} at end of quest, this should not occur due to crest item removal needed to finish quest.")
|
||||||
}
|
}
|
||||||
|
setAttribute(player, "/save:family-crest:gauntlets", Items.FAMILY_GAUNTLETS_778)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*override fun getConfig(player: Player?, stage: Int): IntArray {
|
/*override fun getConfig(player: Player?, stage: Int): IntArray {
|
||||||
|
|||||||
+30
-36
@@ -1,11 +1,13 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
|
|
||||||
|
import api.*
|
||||||
import core.game.content.dialogue.DialoguePlugin
|
import core.game.content.dialogue.DialoguePlugin
|
||||||
import core.game.node.entity.npc.NPC
|
import core.game.node.entity.npc.NPC
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
@Initializable
|
@Initializable
|
||||||
class JohnathonDialogue(player: Player? = null): DialoguePlugin(player) {
|
class JohnathonDialogue(player: Player? = null): DialoguePlugin(player) {
|
||||||
@@ -18,14 +20,14 @@ class JohnathonDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
npc = (args[0] as NPC).getShownNPC(player)
|
npc = (args[0] as NPC).getShownNPC(player)
|
||||||
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
|
val qstage = player?.questRepository?.getStage("Family Crest") ?: -1
|
||||||
|
|
||||||
if(qstage == 100){
|
if (qstage == 100) {
|
||||||
options("Can you enchant these gauntlets for me?", "Nevermind")
|
options("Can you change my gauntlets for me?", "Nevermind")
|
||||||
stage = 6000
|
stage = 6000
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(qstage < 16){
|
if(qstage < 16){
|
||||||
npc("I dont feel so well... maybe we can talk later")
|
npc("I don't feel so well... maybe we can talk later")
|
||||||
stage = 1000;
|
stage = 1000;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -42,7 +44,7 @@ class JohnathonDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||||
when(stage){
|
when(stage) {
|
||||||
|
|
||||||
1 -> npc("That... I am...").also { stage++ }
|
1 -> npc("That... I am...").also { stage++ }
|
||||||
2 -> player("I am here to retrieve your fragment " ,
|
2 -> player("I am here to retrieve your fragment " ,
|
||||||
@@ -50,7 +52,7 @@ class JohnathonDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
3 -> npc("The... poison... it is all... " ,
|
3 -> npc("The... poison... it is all... " ,
|
||||||
"too much... My head... " ,
|
"too much... My head... " ,
|
||||||
"will not... stop spinning...").also { stage++ }
|
"will not... stop spinning...").also { stage++ }
|
||||||
4 -> sendDialogue("Sweat is pouring down Jonathons'face.").also { stage = 1000
|
4 -> sendDialogue("Sweat is pouring down Jonathons' face.").also { stage = 1000
|
||||||
player.questRepository.getQuest("Family Crest").setStage(player, 17);
|
player.questRepository.getQuest("Family Crest").setStage(player, 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,41 +91,33 @@ class JohnathonDialogue(player: Player? = null): DialoguePlugin(player) {
|
|||||||
4 -> npc("My thanks for the assistance adventure").also{stage = 1000}
|
4 -> npc("My thanks for the assistance adventure").also{stage = 1000}
|
||||||
|
|
||||||
}
|
}
|
||||||
6000 -> when(buttonId){
|
6000 -> when (buttonId) {
|
||||||
1-> if(DoMissingGuantletCheck() != -1){
|
1 -> {
|
||||||
var gauntletID = DoMissingGuantletCheck()
|
var freeThisTime = getAttribute(player, "family-crest:gauntlets", Items.FAMILY_GAUNTLETS_778) == Items.FAMILY_GAUNTLETS_778
|
||||||
|
npc("Yes certainly, though it will cost you 25,000 coins" + if (freeThisTime) " next time." else ".").also { stage = 6001 }
|
||||||
if(gauntletID == 777){
|
|
||||||
npc("You already have the Chaos Guantlets.")
|
|
||||||
stage = 1000
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
npc("Here you go")
|
|
||||||
player.inventory.remove(Item(gauntletID))
|
|
||||||
player.inventory.add(Item(777))
|
|
||||||
stage = 1000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
2 -> player("Never mind").also{ stage = 1000 }
|
||||||
npc("You do not have the guantlets with you in your inventory")
|
}
|
||||||
stage = 1000
|
6001 -> options("Great thanks!", "No that's okay thanks.").also{ stage++ }
|
||||||
}
|
6002 -> when (buttonId) {
|
||||||
2-> player("Never mind").also{stage = 1000}
|
1 -> {
|
||||||
|
stage = 1000
|
||||||
|
val givingGauntletsId = Items.CHAOS_GAUNTLETS_777
|
||||||
|
val npcString = SwapGauntletsHelper.swapGauntlets(player, givingGauntletsId)
|
||||||
|
if (npcString == "")
|
||||||
|
{
|
||||||
|
end()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
npc(npcString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
2 -> end()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
1000 -> end()
|
1000 -> end()
|
||||||
}
|
}
|
||||||
return true;
|
return true
|
||||||
}
|
|
||||||
|
|
||||||
private fun DoMissingGuantletCheck(): Int{
|
|
||||||
var itemsToCheck = listOf(775, 776, 777, 778)
|
|
||||||
for(item in itemsToCheck){
|
|
||||||
if(player.inventory.containItems(item))
|
|
||||||
return item
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getIds(): IntArray {
|
override fun getIds(): IntArray {
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
|
|
||||||
import api.addItem
|
import api.addItem
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
import core.game.content.dialogue.DialogueInterpreter
|
import core.game.content.dialogue.DialogueInterpreter
|
||||||
import core.game.content.dialogue.DialoguePlugin
|
import core.game.content.dialogue.DialoguePlugin
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package plugin.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
|
import api.*
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
|
import core.game.node.item.Item
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
|
class SwapGauntletsHelper {
|
||||||
|
companion object {
|
||||||
|
private val legalGauntlets = setOf(Items.COOKING_GAUNTLETS_775, Items.GOLDSMITH_GAUNTLETS_776, Items.CHAOS_GAUNTLETS_777, Items.FAMILY_GAUNTLETS_778)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun swapGauntlets(player: Player, givingGauntletsId: Int): String {
|
||||||
|
if (givingGauntletsId !in legalGauntlets) {
|
||||||
|
throw IllegalArgumentException("givingGauntletsId not in list of legal gauntlets.")
|
||||||
|
}
|
||||||
|
if (inInventory(player, givingGauntletsId)) {
|
||||||
|
val gauntletString = Item(givingGauntletsId).name
|
||||||
|
return "You already have the $gauntletString."
|
||||||
|
}
|
||||||
|
var otherGauntlets = -1
|
||||||
|
val otherPossibleGauntlets = legalGauntlets.toMutableSet()
|
||||||
|
otherPossibleGauntlets.remove(givingGauntletsId)
|
||||||
|
for (gauntletId in otherPossibleGauntlets) {
|
||||||
|
if (inInventory(player, gauntletId))
|
||||||
|
{
|
||||||
|
otherGauntlets = gauntletId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (otherGauntlets == -1) {
|
||||||
|
return "You do not have the gauntlets with you in your inventory."
|
||||||
|
}
|
||||||
|
val fee = 25000
|
||||||
|
val shouldBeFree = getAttribute(player, "family-crest:gauntlets", Items.FAMILY_GAUNTLETS_778) == Items.FAMILY_GAUNTLETS_778
|
||||||
|
if (!shouldBeFree && !inInventory(player, Items.COINS_995, fee)) {
|
||||||
|
return "You do not have enough coins."
|
||||||
|
}
|
||||||
|
if ((shouldBeFree || removeItem(player, Item(Items.COINS_995, fee))) && removeItem(player, otherGauntlets)) {
|
||||||
|
addItem(player, givingGauntletsId)
|
||||||
|
setAttribute(player, "/save:family-crest:gauntlets", givingGauntletsId)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package core.game.content.quest.members.familycrest
|
package rs09.game.content.quest.members.familycrest
|
||||||
|
|
||||||
import core.game.node.entity.impl.ForceMovement
|
import core.game.node.entity.impl.ForceMovement
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
|
|||||||
+8
-5
@@ -1,6 +1,8 @@
|
|||||||
package rs09.game.content.quest.members.monksfriend
|
package rs09.game.content.quest.members.monksfriend
|
||||||
|
|
||||||
|
import api.questStage
|
||||||
import api.sendItemDialogue
|
import api.sendItemDialogue
|
||||||
|
import api.setQuestStage
|
||||||
import core.game.content.dialogue.FacialExpression
|
import core.game.content.dialogue.FacialExpression
|
||||||
import core.game.node.entity.npc.NPC
|
import core.game.node.entity.npc.NPC
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
@@ -16,7 +18,8 @@ import rs09.tools.END_DIALOGUE
|
|||||||
*/
|
*/
|
||||||
class BrotherCedricDialogue : DialogueFile() {
|
class BrotherCedricDialogue : DialogueFile() {
|
||||||
override fun handle(componentID: Int, buttonID: Int) {
|
override fun handle(componentID: Int, buttonID: Int) {
|
||||||
val questStage = player!!.questRepository.getStage("Monk's Friend")
|
val questName = "Monk's Friend"
|
||||||
|
val questStage = questStage(player!!, questName)
|
||||||
when {
|
when {
|
||||||
questStage < 30 -> {
|
questStage < 30 -> {
|
||||||
when(stage) {
|
when(stage) {
|
||||||
@@ -33,7 +36,7 @@ class BrotherCedricDialogue : DialogueFile() {
|
|||||||
0 -> playerl(FacialExpression.HAPPY, "Brother Cedric are you okay?").also{stage++}
|
0 -> playerl(FacialExpression.HAPPY, "Brother Cedric are you okay?").also{stage++}
|
||||||
1 -> npcl(FacialExpression.DRUNK, "Yeesshhh, I'm very, very drunk..hic..up..").also{stage++}
|
1 -> npcl(FacialExpression.DRUNK, "Yeesshhh, I'm very, very drunk..hic..up..").also{stage++}
|
||||||
2 -> playerl(FacialExpression.NEUTRAL, "Brother Omad needs the wine for the party.").also{stage++}
|
2 -> playerl(FacialExpression.NEUTRAL, "Brother Omad needs the wine for the party.").also{stage++}
|
||||||
3 -> npcl(FacialExpression.SAD, "Oh dear, oh dear, I knew I had to do something!").also{stage = END_DIALOGUE}.also{setQuest(player!!, 40)}
|
3 -> npcl(FacialExpression.SAD, "Oh dear, oh dear, I knew I had to do something!").also{stage = END_DIALOGUE}.also{ setQuestStage(player!!, questName, 40) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
questStage == 40 -> {
|
questStage == 40 -> {
|
||||||
@@ -51,7 +54,7 @@ class BrotherCedricDialogue : DialogueFile() {
|
|||||||
sendItemDialogue(player!!, Items.JUG_OF_WATER_1937, "You hand the monk a jug of water.")
|
sendItemDialogue(player!!, Items.JUG_OF_WATER_1937, "You hand the monk a jug of water.")
|
||||||
stage=0
|
stage=0
|
||||||
player!!.inventory.remove(Item(Items.JUG_OF_WATER_1937))
|
player!!.inventory.remove(Item(Items.JUG_OF_WATER_1937))
|
||||||
setQuest(player!!, 41)
|
setQuestStage(player!!, questName, 41)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +72,7 @@ class BrotherCedricDialogue : DialogueFile() {
|
|||||||
}
|
}
|
||||||
5 -> npcl(FacialExpression.HAPPY, "In that case I'd better drink more wine! It helps me think.").also {stage=END_DIALOGUE}
|
5 -> npcl(FacialExpression.HAPPY, "In that case I'd better drink more wine! It helps me think.").also {stage=END_DIALOGUE}
|
||||||
10 -> npcl(FacialExpression.HAPPY, "Excellent, I just need some wood.").also{stage++}
|
10 -> npcl(FacialExpression.HAPPY, "Excellent, I just need some wood.").also{stage++}
|
||||||
11 -> playerl(FacialExpression.NEUTRAL, "Ok, I'll see what I can find.").also{stage = END_DIALOGUE}.also{setQuest(player!!, 42)}
|
11 -> playerl(FacialExpression.NEUTRAL, "Ok, I'll see what I can find.").also{stage = END_DIALOGUE}.also{setQuestStage(player!!, questName, 42)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
questStage == 42 -> {
|
questStage == 42 -> {
|
||||||
@@ -86,7 +89,7 @@ class BrotherCedricDialogue : DialogueFile() {
|
|||||||
4 -> playerl(FacialExpression.HAPPY, "Ok! I'll see you later!").also{
|
4 -> playerl(FacialExpression.HAPPY, "Ok! I'll see you later!").also{
|
||||||
stage=END_DIALOGUE
|
stage=END_DIALOGUE
|
||||||
player!!.inventory.remove(Item(Items.LOGS_1511))
|
player!!.inventory.remove(Item(Items.LOGS_1511))
|
||||||
setQuest(player!!, 50)
|
setQuestStage(player!!, questName, 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -22,7 +22,8 @@ import rs09.tools.END_DIALOGUE
|
|||||||
*/
|
*/
|
||||||
class BrotherOmadDialogue : DialogueFile() {
|
class BrotherOmadDialogue : DialogueFile() {
|
||||||
override fun handle(componentID: Int, buttonID: Int) {
|
override fun handle(componentID: Int, buttonID: Int) {
|
||||||
val questStage = player!!.questRepository.getStage("Monk's Friend")
|
val questName = "Monk's Friend"
|
||||||
|
val questStage = questStage(player!!, questName)
|
||||||
when (questStage) {
|
when (questStage) {
|
||||||
0 -> {
|
0 -> {
|
||||||
when(stage) {
|
when(stage) {
|
||||||
@@ -69,7 +70,7 @@ class BrotherOmadDialogue : DialogueFile() {
|
|||||||
}
|
}
|
||||||
31 -> npcl(FacialExpression.HAPPY, "Really, that's excellent, well done! Maybe now I will be able to get some rest.").also{stage++}
|
31 -> npcl(FacialExpression.HAPPY, "Really, that's excellent, well done! Maybe now I will be able to get some rest.").also{stage++}
|
||||||
32 -> npcl(FacialExpression.SAD, "*yawn*..I'm off to bed! Farewell brave traveller!").also{player!!.inventory.remove(Item(Items.CHILDS_BLANKET_90))
|
32 -> npcl(FacialExpression.SAD, "*yawn*..I'm off to bed! Farewell brave traveller!").also{player!!.inventory.remove(Item(Items.CHILDS_BLANKET_90))
|
||||||
setQuest(player!!, 20); stage = END_DIALOGUE}
|
setQuestStage(player!!, questName, 20); stage = END_DIALOGUE}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
20 -> {
|
20 -> {
|
||||||
@@ -103,7 +104,7 @@ class BrotherOmadDialogue : DialogueFile() {
|
|||||||
996 -> npcl(FacialExpression.NEUTRAL, "Okay traveller, take care.").also{stage = END_DIALOGUE}
|
996 -> npcl(FacialExpression.NEUTRAL, "Okay traveller, take care.").also{stage = END_DIALOGUE}
|
||||||
997 -> npcl(FacialExpression.NEUTRAL, "Of course, but we need the wine first.").also{stage = END_DIALOGUE}
|
997 -> npcl(FacialExpression.NEUTRAL, "Of course, but we need the wine first.").also{stage = END_DIALOGUE}
|
||||||
42 -> npcl(FacialExpression.FRIENDLY, "Oh, he won't be far. Probably out in the forest.").also{stage++}
|
42 -> npcl(FacialExpression.FRIENDLY, "Oh, he won't be far. Probably out in the forest.").also{stage++}
|
||||||
43 -> playerl(FacialExpression.FRIENDLY, "Ok, I'll go and find him.").also { stage = END_DIALOGUE}.also{ setQuest(player!!, 30);}
|
43 -> playerl(FacialExpression.FRIENDLY, "Ok, I'll go and find him.").also { stage = END_DIALOGUE}.also{ setQuestStage(player!!, questName, 30)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
30 -> {
|
30 -> {
|
||||||
@@ -191,7 +192,6 @@ class BrotherOmadDialogue : DialogueFile() {
|
|||||||
}
|
}
|
||||||
25 -> if (questComplete) {
|
25 -> if (questComplete) {
|
||||||
player!!.questRepository.getQuest("Monk's Friend").finish(player)
|
player!!.questRepository.getQuest("Monk's Friend").finish(player)
|
||||||
player!!.questRepository.getQuest("Monk's Friend").setStage(player, 100)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count++
|
count++
|
||||||
|
|||||||
@@ -64,8 +64,3 @@ class MonksFriend: Quest("Monk's Friend", 89, 88, 1, 30, 0, 1, 80) {
|
|||||||
player.inventory.add(Item(563, 8))
|
player.inventory.add(Item(563, 8))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setQuest(player: Player, stage: Int){
|
|
||||||
player.questRepository.getQuest("Monk's Friend").setStage(player, stage)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user