mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 00:38:46 +00:00
Add implementation of runecrafting skill
This commit is contained in:
committed by
Gary Tierney
parent
397d9b2d6a
commit
97896a34a4
@@ -0,0 +1,81 @@
|
||||
import org.apollo.game.message.impl.*
|
||||
import org.apollo.game.model.entity.EquipmentConstants
|
||||
import org.apollo.game.model.event.impl.LoginEvent
|
||||
|
||||
private val changeAltarObjectConfigId = 491
|
||||
|
||||
on_player_event { LoginEvent::class }
|
||||
.then {
|
||||
val equippedHat = player.equipment.get(EquipmentConstants.HAT)
|
||||
val equippedTiaraConfig = equippedHat?.let { item -> Tiara.findById(item.id)?.configId } ?: 0
|
||||
val configValue = 1 shl equippedTiaraConfig
|
||||
|
||||
player.send(ConfigMessage(changeAltarObjectConfigId, configValue))
|
||||
}
|
||||
|
||||
on { ObjectActionMessage::class }
|
||||
.where { option == 2 }
|
||||
.then {
|
||||
val tiara = Tiara.findByAltarId(id) ?: return@then
|
||||
val hat = it.equipment.get(EquipmentConstants.HAT) ?: return@then
|
||||
|
||||
if (hat.id == tiara.id && tiara.altar.entranceId == id) {
|
||||
it.startAction(TeleportAction(it, position, 2, tiara.altar.entrance))
|
||||
terminate()
|
||||
}
|
||||
}
|
||||
|
||||
on { ItemActionMessage::class }
|
||||
.where { option == 1 }
|
||||
.then { player ->
|
||||
Tiara.findById(id)?.let {
|
||||
player.send(ConfigMessage(changeAltarObjectConfigId, 0))
|
||||
terminate()
|
||||
}
|
||||
}
|
||||
|
||||
on { ItemOnObjectMessage::class }
|
||||
.then {
|
||||
val tiara = Tiara.findByTalismanId(id) ?: return@then
|
||||
val altar = Altar.findByCraftingId(objectId) ?: return@then
|
||||
|
||||
it.startAction(CreateTiaraAction(it, position, tiara, altar))
|
||||
terminate()
|
||||
}
|
||||
|
||||
on { ItemOptionMessage::class }
|
||||
.where { option == 4 }
|
||||
.then {
|
||||
val talisman = Talisman.findById(id) ?: return@then
|
||||
|
||||
talisman.sendProximityMessageTo(it)
|
||||
terminate()
|
||||
}
|
||||
|
||||
on { ItemOnObjectMessage::class }
|
||||
.then {
|
||||
val talisman = Talisman.findById(id) ?: return@then
|
||||
val altar = Altar.findByEntranceId(objectId) ?: return@then
|
||||
|
||||
it.startAction(TeleportAction(it, position, 2, altar.entrance))
|
||||
terminate()
|
||||
}
|
||||
|
||||
on { ObjectActionMessage::class }
|
||||
.where { option == 1 }
|
||||
.then {
|
||||
val altar = Altar.findByPortalId(id) ?: return@then
|
||||
|
||||
it.startAction(TeleportAction(it, altar.entrance, 1, altar.exit))
|
||||
terminate()
|
||||
}
|
||||
|
||||
on { ObjectActionMessage::class }
|
||||
.where { option == 1 }
|
||||
.then {
|
||||
val rune = Rune.findByAltarId(id) ?: return@then
|
||||
val craftingAltar = Altar.findByCraftingId(id) ?: return@then
|
||||
|
||||
it.startAction(RunecraftingAction(it, rune, craftingAltar))
|
||||
terminate()
|
||||
}
|
||||
Reference in New Issue
Block a user