Added an April Fools event

This commit is contained in:
Bishop
2026-06-20 13:35:24 +00:00
committed by Ryan
parent dcaf28755d
commit 6508383fe8
5 changed files with 58 additions and 1 deletions
+6
View File
@@ -336,6 +336,12 @@ class ServerConstants {
@JvmField
var FORCE_EASTER_EVENTS = false
@JvmField
var APRIL_FOOLS_EVENT = false
@JvmField
var FORCE_APRIL_FOOLS = false
@JvmField
var RUNECRAFTING_FORMULA_REVISION = 530
@@ -164,6 +164,8 @@ object ServerConfigParser {
ServerConstants.FORCE_HALLOWEEN_EVENTS = data.getBoolean("world.force_halloween_randoms", false)
ServerConstants.FORCE_CHRISTMAS_EVENTS = data.getBoolean("world.force_christmas_randoms", false)
ServerConstants.FORCE_EASTER_EVENTS = data.getBoolean("world.force_easter_randoms", false)
ServerConstants.APRIL_FOOLS_EVENT = data.getBoolean("world.april_fools_event", false)
ServerConstants.FORCE_APRIL_FOOLS = data.getBoolean("world.force_april_fools", false)
ServerConstants.RUNECRAFTING_FORMULA_REVISION = data.getLong("world.runecrafting_formula_revision", 530).toInt()
ServerConstants.ENHANCED_DEEP_WILDERNESS = data.getBoolean("world.enhanced_deep_wilderness", false)
ServerConstants.WILDERNESS_EXCLUSIVE_LOOT = data.getBoolean("world.wilderness_exclusive_loot", false)
@@ -155,7 +155,7 @@ class HolidayRandoms() : PersistTimer(0, "holiday", isAuto = true), Commands {
define("forcehrevents", Privilege.ADMIN, "::forcehrevents [eventname]", "Force enable holiday random events.") { player, args ->
if (args.size == 1) {
notify(player, "Holidays: halloween, christmas")
notify(player, "Holidays: halloween, christmas, aprilfools")
return@define
}
val event = args[1]
@@ -183,6 +183,12 @@ class HolidayRandoms() : PersistTimer(0, "holiday", isAuto = true), Commands {
registerTimer(p, HolidayRandoms())
}
}
"aprilfools" -> {
ServerConstants.FORCE_APRIL_FOOLS = true
for (p in Repository.players) {
notify(p, colorize("%GApril Fools is now active!"))
}
}
else -> reject(player, "Invalid event!")
}
}
@@ -0,0 +1,40 @@
package core.game.worldevents.holiday.aprilfools
import core.ServerConstants
import core.api.*
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.emote.Emotes
import core.game.system.command.Privilege
import core.tools.colorize
import java.util.Calendar
class AprilFoolsEvent : Commands, LoginListener {
private fun isActive(): Boolean {
if (ServerConstants.FORCE_APRIL_FOOLS) return true
if (!ServerConstants.APRIL_FOOLS_EVENT) return false
val cal = Calendar.getInstance()
return cal.get(Calendar.MONTH) == Calendar.APRIL && cal.get(Calendar.DAY_OF_MONTH) == 1
}
override fun login(player: Player) {
if (!isActive()) return
sendMessage(player, colorize("Use command ::wheel to spin the new prize wheel!", "00ffff"))
}
override fun defineCommands() {
define("wheel", Privilege.STANDARD) { player, args ->
if (!isActive()) {
sendMessage(player, colorize("-->%R${args[0]}: command not found"))
return@define
}
if (getAttribute(player, "aprilfools:wheelspun", false)) {
sendMessage(player, "I'm not falling for that again.")
return@define
}
sendNews("${player.username} just tried to spin the wheel!")
sendChat(player, "I'm spinning!")
emote(player, Emotes.SPIN)
setAttribute(player, "aprilfools:wheelspun", true)
}
}
}
+3
View File
@@ -105,6 +105,9 @@ holiday_event_randoms = false
#force holiday randoms (can only force one at a time)
force_halloween_randoms = false
force_christmas_randoms = false
#enables inauthentic april fools event
april_fools_event = false
force_april_fools = false
#runecrafting formula revision (573 introduced probabilistic multiple runes, 581 extrapolated probabilistic runes past 99)
runecrafting_formula_revision = 530
#enables the enhanced deep wilderness, where the area past the members' fence applies a red skull that boosts brawler/pvp drop rates