[API] Add wwmarquee <type> <message> (#4919)

* [API] Implement Console "wwmarquee"

* Fin
This commit is contained in:
Chris Miles 2025-06-23 04:25:50 -05:00 committed by GitHub
parent 4005b68383
commit bac892b582
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 42 additions and 1 deletions

View File

@ -1330,6 +1330,42 @@ void ConsoleWorldWideMove(
);
}
void ConsoleWWMarquee(
EQ::Net::ConsoleServerConnection* connection,
const std::string& command,
const std::vector<std::string>& args
)
{
if (args.size() < 2) {
connection->SendLine("Usage: wwmarquee <type> <message>");
return;
}
const uint32 type = Strings::IsNumber(args[0]) ? Strings::ToUnsignedInt(args[0]) : 0;
std::string message = Strings::Join(std::vector<std::string>(args.begin() + 1, args.end()), " ");
if (message.empty()) {
connection->SendLine("Message cannot be empty.");
return;
}
auto pack = new ServerPacket(ServerOP_WWMarquee, sizeof(WWMarquee_Struct));
auto* wwm = (WWMarquee_Struct*)pack->pBuffer;
wwm->type = type;
wwm->priority = 510;
wwm->fade_in = 0;
wwm->fade_out = 0;
wwm->duration = 5000;
wwm->min_status = AccountStatus::Player;
wwm->max_status = AccountStatus::Player;
strn0cpy(wwm->message, message.c_str(), sizeof(wwm->message));
zoneserver_list.SendPacket(pack);
safe_delete(pack);
connection->SendLine(fmt::format("Sent world marquee type {}: {}", type, message));
}
/**
* @param console
@ -1367,6 +1403,12 @@ void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer>& console)
console->RegisterCall("whoami", 50, "whoami", std::bind(ConsoleWhoami, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("worldshutdown", 200, "worldshutdown", std::bind(ConsoleWorldShutdown, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("wwcast", 50, "wwcast [spell_id] [min_status] [max_status] - min_status and max_status are optional", std::bind(ConsoleWorldWideCastSpell, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"wwmarquee",
50,
"wwmarquee <type> <message>",
std::bind(ConsoleWWMarquee, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
);
console->RegisterCall("wwmove", 50, "wwmove [instance_id|zone_short_name] [min_status] [max_status] - min_status and max_status are optional, instance_id and zone_short_name are interchangeable", std::bind(ConsoleWorldWideMove, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("zonebootup", 150, "zonebootup [zone_server_id] [zone_short_name]", std::bind(ConsoleZoneBootup, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("zonelock", 150, "zonelock [list|lock|unlock] [zone_short_name]", std::bind(ConsoleZoneLock, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));

View File

@ -3140,7 +3140,6 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
case ServerOP_WWMarquee:
{
auto s = (WWMarquee_Struct*) pack->pBuffer;
for (const auto& c : entity_list.GetClientList()) {
if (
c.second->Admin() >= s->min_status &&