Global news announcements no longer overrun the chatbox

Global news announcements are now locked behind the enable_global_chat server config setting
PvP and brawler drops from the Chaos Elemental now refer to it as "the Chaos Elemental", rather than "a Chaos Elemental"
PvP and brawler drops from revenants now lowercase the revenant's name
This commit is contained in:
Player Name 2025-11-27 12:18:26 +00:00 committed by Ryan
parent 96c42c18d9
commit a38d3734bd
2 changed files with 8 additions and 17 deletions

View file

@ -108,7 +108,8 @@ public final class WildernessZone extends MapZone {
byte glove = (byte) RandomFunction.random(1, 14); byte glove = (byte) RandomFunction.random(1, 14);
Item reward = new Item(BrawlingGloves.forIndicator(glove).getId()); Item reward = new Item(BrawlingGloves.forIndicator(glove).getId());
GroundItemManager.create(reward, e.asNpc().getDropLocation(), killer.asPlayer()); GroundItemManager.create(reward, e.asNpc().getDropLocation(), killer.asPlayer());
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!"); String npcString = e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? "the Chaos Elemental" : ("a " + e.asNpc().getName().toLowerCase());
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from " + npcString + "!");
} }
for (int j : PVP_GEAR) { for (int j : PVP_GEAR) {
boolean chance = RandomFunction.roll(pvpGearRate); boolean chance = RandomFunction.roll(pvpGearRate);
@ -120,7 +121,8 @@ public final class WildernessZone extends MapZone {
reward = new Item(j); reward = new Item(j);
} }
GroundItemManager.create(reward, ((NPC) e).getDropLocation(), killer.asPlayer()); GroundItemManager.create(reward, ((NPC) e).getDropLocation(), killer.asPlayer());
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from a " + e.asNpc().getName() + "!"); String npcString = e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? "the Chaos Elemental" : ("a " + e.asNpc().getName().toLowerCase());
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from " + npcString + "!");
} }
} }
} }

View file

@ -6,6 +6,7 @@ import core.game.node.entity.player.Player
import core.game.world.map.Location import core.game.world.map.Location
import core.game.world.map.RegionManager import core.game.world.map.RegionManager
import core.ServerConstants import core.ServerConstants
import core.api.sendMessage
import core.game.world.update.UpdateSequence import core.game.world.update.UpdateSequence
import java.util.* import java.util.*
import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.CopyOnWriteArrayList
@ -55,20 +56,7 @@ object Repository {
*/ */
@JvmStatic @JvmStatic
val disconnectionQueue = DisconnectionQueue() val disconnectionQueue = DisconnectionQueue()
/**
* Sends a market update message to all players.
* @param string The string.
* @param color The color.
*/
@JvmOverloads
fun sendMarketUpdate(string: String, icon: Int = 12, color: String = "<col=CC6600>") {
val players: Array<Any> = playerNames.values.toTypedArray()
val size = players.size
for (i in 0 until size) {
val player = players[i] as Player ?: continue
player.sendMessage("<img=" + icon + ">" + color + "Market Update: " + string)
}
}
/** /**
* Send a news message to all players. * Send a news message to all players.
* @param string The string. * @param string The string.
@ -76,11 +64,12 @@ object Repository {
*/ */
@JvmStatic @JvmStatic
fun sendNews(string: String, icon: Int = 12, color: String = "CC6600") { fun sendNews(string: String, icon: Int = 12, color: String = "CC6600") {
if (!ServerConstants.ENABLE_GLOBAL_CHAT) return
val players: Array<Any> = playerNames.values.toTypedArray() val players: Array<Any> = playerNames.values.toTypedArray()
val size = players.size val size = players.size
for (i in 0 until size) { for (i in 0 until size) {
val player = players[i] as Player ?: continue val player = players[i] as Player ?: continue
player.sendMessage("<img=$icon><col=$color>News: $string") sendMessage(player, "<img=$icon><col=$color>News: $string")
} }
} }