Ceikry Fancy Shit
- Ceikry did a bunch of fancy shit with digging and easter eggs n shit.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package core.game.content.global.action;
|
package core.game.content.global.action;
|
||||||
|
|
||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
|
import rs09.game.interaction.SpadeDigListener;
|
||||||
import rs09.game.system.SystemLogger;
|
import rs09.game.system.SystemLogger;
|
||||||
import core.game.system.task.Pulse;
|
import core.game.system.task.Pulse;
|
||||||
import rs09.game.world.GameWorld;
|
import rs09.game.world.GameWorld;
|
||||||
@@ -35,6 +36,11 @@ public final class DigSpadeHandler {
|
|||||||
final DigAction action = ACTIONS.get(player.getLocation());
|
final DigAction action = ACTIONS.get(player.getLocation());
|
||||||
player.animate(ANIMATION);
|
player.animate(ANIMATION);
|
||||||
player.lock(1);
|
player.lock(1);
|
||||||
|
|
||||||
|
if(SpadeDigListener.runListener(player.getLocation(), player)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+20
-79
@@ -1,90 +1,31 @@
|
|||||||
package rs09.game.content.activity.communityevents
|
package rs09.game.content.activity.communityevents
|
||||||
|
|
||||||
import core.cache.def.impl.ItemDefinition
|
|
||||||
import core.game.node.entity.Entity
|
|
||||||
import core.game.node.entity.player.Player
|
|
||||||
import core.game.system.task.Pulse
|
|
||||||
import core.game.world.map.zone.ZoneBorders
|
|
||||||
import core.game.world.map.*
|
|
||||||
import core.game.world.map.zone.ZoneBuilder
|
|
||||||
import core.game.world.map.zone.MapZone
|
|
||||||
import core.plugin.Initializable
|
|
||||||
import core.plugin.Plugin
|
|
||||||
import rs09.game.world.GameWorld.Pulser
|
|
||||||
import java.util.ArrayList
|
|
||||||
import core.game.content.global.action.DigAction
|
import core.game.content.global.action.DigAction
|
||||||
import core.game.content.global.action.DigSpadeHandler
|
import core.game.content.global.action.DigSpadeHandler
|
||||||
import core.game.content.global.action.DigSpadeHandler.dig
|
import core.game.content.ttrail.MapClueScroll
|
||||||
import core.game.content.global.action.DigSpadeHandler.register
|
import core.game.node.entity.Entity
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
|
import core.game.world.map.*
|
||||||
|
import core.game.world.map.zone.MapZone
|
||||||
|
import core.game.world.map.zone.ZoneBorders
|
||||||
|
import core.game.world.map.zone.ZoneBuilder
|
||||||
|
import core.plugin.Initializable
|
||||||
|
import core.plugin.Plugin
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import rs09.game.ai.general.scriptrepository.PlayerScripts
|
import rs09.game.interaction.InteractionListener
|
||||||
import java.util.HashMap
|
|
||||||
|
|
||||||
|
class SuperEggEaster2020 : InteractionListener() {
|
||||||
@Initializable
|
override fun defineListeners() {
|
||||||
class SuperEggEaster2020
|
onDig(Location.create(2188, 3281, 0)){player ->
|
||||||
|
val hasKey = player.getAttribute("easter2020:key",false)
|
||||||
: MapZone("Clue Zone", true), Plugin<Any?> {
|
if(!hasKey){
|
||||||
@Throws(Throwable::class)
|
player.inventory.add(Item(Items.KEY_11039))
|
||||||
|
player.dialogueInterpreter.sendDialogue("You dig and find an ancient key!")
|
||||||
override fun newInstance(arg: Any?): Plugin<Any?>? {
|
player.setAttribute("/save:easter2020:key",true)
|
||||||
ZoneBuilder.configure(this)
|
} else {
|
||||||
return this
|
player.sendMessage("You dig and find nothing.")
|
||||||
}
|
|
||||||
|
|
||||||
override fun fireEvent(identifier: String?, vararg args: Any?): Any? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun configure() {
|
|
||||||
val borders = ZoneBorders(2188, 3281, 2188, 3281)
|
|
||||||
//borders.addException(ZoneBorders(2328, 3496, 2328, 3496))
|
|
||||||
register(borders)
|
|
||||||
//pulse.stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun enter(e: Entity?): Boolean {
|
|
||||||
val clue_loc = Location.create(2188, 3281, 0)
|
|
||||||
val key = Item(Items.KEY_11039)
|
|
||||||
|
|
||||||
if (e is Player) {
|
|
||||||
val p = e
|
|
||||||
PLAYERS.add(p)
|
|
||||||
//if (p.getAttribute("step_1",true)){
|
|
||||||
//register(clue_loc) { p.inventory.add(key) }
|
|
||||||
//p.setAttribute("step_1",false)
|
|
||||||
//}
|
|
||||||
clues()
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun leave(e: Entity, logout: Boolean): Boolean {
|
|
||||||
if (e is Player) {
|
|
||||||
PLAYERS.remove(e)
|
|
||||||
}
|
|
||||||
return super.leave(e, logout)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
private val PLAYERS: MutableList<Player> = ArrayList(10)
|
|
||||||
|
|
||||||
fun clues(){
|
|
||||||
|
|
||||||
for (player in PLAYERS) {
|
|
||||||
val clue_loc = Location.create(2188, 3281, 0)
|
|
||||||
val gear_check: Boolean = player.equipment.containsAll(1355)
|
|
||||||
val stat_check: Boolean = player.skills.totalLevel >= 720
|
|
||||||
|
|
||||||
//Super Egg!!!
|
|
||||||
if (player.location.equals(clue_loc) && player.getAttribute("string_1",true)) {
|
|
||||||
//player.setAttribute("step_1",true)
|
|
||||||
//player.dialogueInterpreter.sendDialogue("Your spade hits metal, you reach into the hole and find a strange key.")
|
|
||||||
} else player.dialogueInterpreter.sendDialogue("A magical force prevents you from digging.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,4 +47,8 @@ abstract class InteractionListener : Listener{
|
|||||||
fun setDest(type: Int, ids: IntArray, vararg options: String, handler: (Node) -> Location){
|
fun setDest(type: Int, ids: IntArray, vararg options: String, handler: (Node) -> Location){
|
||||||
InteractionListeners.addDestOverrides(type,ids,options,handler)
|
InteractionListeners.addDestOverrides(type,ids,options,handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onDig(location: Location,method: (player: Player) -> Unit){
|
||||||
|
SpadeDigListener.registerListener(location,method)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package rs09.game.interaction
|
||||||
|
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
|
import core.game.world.map.Location
|
||||||
|
|
||||||
|
object SpadeDigListener {
|
||||||
|
val listeners = HashMap<Location,(Player) -> Unit>()
|
||||||
|
|
||||||
|
fun registerListener(location: Location, method: (Player) -> Unit){
|
||||||
|
listeners.putIfAbsent(location,method);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun runListener(location: Location,player: Player): Boolean {
|
||||||
|
if(listeners.containsKey(location)){
|
||||||
|
listeners[location]?.invoke(player)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ import rs09.ServerConstants
|
|||||||
import rs09.game.content.activity.fishingtrawler.TrawlerLoot
|
import rs09.game.content.activity.fishingtrawler.TrawlerLoot
|
||||||
import rs09.game.content.ame.RandomEvents
|
import rs09.game.content.ame.RandomEvents
|
||||||
import rs09.game.ge.OfferManager
|
import rs09.game.ge.OfferManager
|
||||||
|
import rs09.game.interaction.SpadeDigListener
|
||||||
import rs09.game.node.entity.state.newsys.states.FarmingState
|
import rs09.game.node.entity.state.newsys.states.FarmingState
|
||||||
import rs09.game.system.SystemLogger
|
import rs09.game.system.SystemLogger
|
||||||
import rs09.game.system.command.Command
|
import rs09.game.system.command.Command
|
||||||
@@ -490,5 +491,27 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
|||||||
notify(player,"No parent NPC found.")
|
notify(player,"No parent NPC found.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define("bury"){player,args ->
|
||||||
|
if(args.size < 2){
|
||||||
|
reject(player,"Usage: ::bury itemid")
|
||||||
|
}
|
||||||
|
|
||||||
|
val itemId = args[1].toInt()
|
||||||
|
val def = ItemDefinition.forId(itemId)
|
||||||
|
|
||||||
|
SpadeDigListener.registerListener(player.location){pl ->
|
||||||
|
if(player.getAttribute("${player.location.toString()}:$itemId",false)){
|
||||||
|
pl.sendMessage("You dig and find nothing.")
|
||||||
|
return@registerListener
|
||||||
|
}
|
||||||
|
pl.sendMessage("You dig and find a ${def.name}!")
|
||||||
|
player.inventory.add(Item(itemId))
|
||||||
|
player.setAttribute("/save:${player.location.toString()}:$itemId",true)
|
||||||
|
}
|
||||||
|
|
||||||
|
notify(player,"You buried a ${def.name} at ${player.location}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user