diff --git a/Server/src/main/core/ServerConstants.kt b/Server/src/main/core/ServerConstants.kt index 2959ccb0c..4e40457f4 100644 --- a/Server/src/main/core/ServerConstants.kt +++ b/Server/src/main/core/ServerConstants.kt @@ -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 diff --git a/Server/src/main/core/game/system/config/ServerConfigParser.kt b/Server/src/main/core/game/system/config/ServerConfigParser.kt index 273b36531..ebacf36a1 100644 --- a/Server/src/main/core/game/system/config/ServerConfigParser.kt +++ b/Server/src/main/core/game/system/config/ServerConfigParser.kt @@ -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) diff --git a/Server/src/main/core/game/worldevents/holiday/HolidayRandoms.kt b/Server/src/main/core/game/worldevents/holiday/HolidayRandoms.kt index cf63a2e6d..e1108a473 100644 --- a/Server/src/main/core/game/worldevents/holiday/HolidayRandoms.kt +++ b/Server/src/main/core/game/worldevents/holiday/HolidayRandoms.kt @@ -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!") } } diff --git a/Server/src/main/core/game/worldevents/holiday/aprilfools/AprilFoolsEvent.kt b/Server/src/main/core/game/worldevents/holiday/aprilfools/AprilFoolsEvent.kt new file mode 100644 index 000000000..4a4f11a72 --- /dev/null +++ b/Server/src/main/core/game/worldevents/holiday/aprilfools/AprilFoolsEvent.kt @@ -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) + } + } +} \ No newline at end of file diff --git a/Server/worldprops/default.conf b/Server/worldprops/default.conf index fcb90f72b..ecf6da0bf 100644 --- a/Server/worldprops/default.conf +++ b/Server/worldprops/default.conf @@ -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