eqemu-server/zone/gm_commands/worldwide.cpp
Knightly 7ab909ee47 Standardize Licensing
- License was intended to be GPLv3 per earlier commit of GPLv3 LICENSE FILE
- This is confirmed by the inclusion of libraries that are incompatible with GPLv2
- This is also confirmed by KLS and the agreement of KLS's predecessors
- Added GPLv3 license headers to the compilable source files
- Removed Folly licensing in strings.h since the string functions do not match the Folly functions and are standard functions - this must have been left over from previous implementations
- Removed individual contributor license headers since the project has been under the "developer" mantle for many years
- Removed comments on files that were previously automatically generated since they've been manually modified multiple times and there are no automatic scripts referencing them (removed in 2023)
2026-04-01 17:09:57 -07:00

193 lines
5.6 KiB
C++
Executable File

/* EQEmu: EQEmulator
Copyright (C) 2001-2026 EQEmu Development Team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zone/client.h"
void command_worldwide(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
if (!arguments) {
c->Message(Chat::White, "Usage: #worldwide cast [Spell ID] [Disable Message] - Cast a spell worldwide, use 1 for Disable Message to not send a global message");
c->Message(Chat::White, "Usage: #worldwide message [Message] - Send a message worldwide");
c->Message(Chat::White, "Usage: #worldwide move [Zone ID|Zone Short Name] - Move all players worldwide to specified zone");
c->Message(Chat::White, "Usage: #worldwide moveinstance [Instance ID] - Move all players worldwide to specified instance");
c->Message(Chat::White, "Usage: #worldwide remove [Spell ID] - Remove a spell worldwide");
return;
}
bool is_cast = !strcasecmp(sep->arg[1], "cast");
bool is_remove = !strcasecmp(sep->arg[1], "remove");
bool is_message = !strcasecmp(sep->arg[1], "message");
bool is_move = !strcasecmp(sep->arg[1], "move");
bool is_moveinstance = !strcasecmp(sep->arg[1], "moveinstance");
if (
!is_cast &&
!is_message &&
!is_move &&
!is_moveinstance &&
!is_remove
) {
c->Message(Chat::White, "Usage: #worldwide cast [Spell ID] [Disable Message] - Cast a spell worldwide, use 1 for Disable Message to not send a global message");
c->Message(Chat::White, "Usage: #worldwide message [Message] - Send a message worldwide");
c->Message(Chat::White, "Usage: #worldwide move [Zone ID|Zone Short Name] - Move all players worldwide to specified zone");
c->Message(Chat::White, "Usage: #worldwide moveinstance [Instance ID] - Move all players worldwide to specified instance");
c->Message(Chat::White, "Usage: #worldwide remove [Spell ID] - Remove a spell worldwide");
return;
}
if (is_cast) {
if (sep->IsNumber(2)) {
uint8 update_type = WWSpellUpdateType_Cast;
auto spell_id = Strings::ToUnsignedInt(sep->arg[2]);
bool disable_message = false;
if (sep->IsNumber(3)) {
disable_message = Strings::ToInt(sep->arg[3]) ? true : false;
}
if (!IsValidSpell(spell_id)) {
c->Message(
Chat::White,
fmt::format(
"Spell ID {} could not be found.",
spell_id
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"World Wide Cast Spell | Spell: {} ({})",
GetSpellName(spell_id),
spell_id
).c_str()
);
quest_manager.WorldWideSpell(update_type, spell_id);
if (!disable_message) {
quest_manager.WorldWideMessage(
Chat::Yellow,
fmt::format(
"[SYSTEM] A GM has cast [{}] world-wide!",
GetSpellName(spell_id)
).c_str()
);
}
} else {
c->Message(Chat::White, "Usage: #worldwide cast [Spell ID] [Disable Message] - Cast a spell worldwide, use 1 for Disable Message to not send a global message");
}
} else if (is_message) {
std::string message = sep->argplus[2];
if (!message.empty()) {
quest_manager.WorldWideMessage(
Chat::White,
fmt::format(
"{}",
message
).c_str()
);
} else {
c->Message(Chat::White, "Usage: #worldwide message [Message] - Send a message worldwide");
}
} else if (is_move) {
uint8 update_type = WWMoveUpdateType_MoveZone;
auto zone_id = (
sep->IsNumber(2) ?
static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2])) :
static_cast<uint16>(ZoneID(sep->arg[2]))
);
auto zone_short_name = ZoneName(zone_id);
if (!zone_id || !zone_short_name) {
c->Message(
Chat::White,
fmt::format(
"Zone ID {} could not be found.",
zone_id
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"World Wide Zone | Zone: {} ({}) ID: {}",
ZoneLongName(
zone_id
),
zone_short_name,
zone_id
).c_str()
);
quest_manager.WorldWideMove(update_type, zone_short_name);
}
else if (is_moveinstance) {
if (sep->IsNumber(2)) {
uint8 update_type = WWMoveUpdateType_MoveZoneInstance;
const char *zone_short_name = "";
auto instance_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
c->Message(
Chat::White,
fmt::format(
"World Wide Zone Instance | Instance ID: {}",
instance_id
).c_str()
);
quest_manager.WorldWideMove(update_type, zone_short_name, instance_id);
} else {
c->Message(Chat::White, "Usage: #worldwide moveinstance [Instance ID] - Move all players worldwide to specified instance");
}
} else if (is_remove) {
if (sep->IsNumber(2)) {
uint8 update_type = WWSpellUpdateType_Remove;
auto spell_id = Strings::ToUnsignedInt(sep->arg[2]);
if (!IsValidSpell(spell_id)) {
c->Message(
Chat::White,
fmt::format(
"Spell ID {} could not be found.",
spell_id
).c_str()
);
return;
}
c->Message(
Chat::White,
fmt::format(
"World Wide Remove Spell | Spell: {} ({})",
GetSpellName(spell_id),
spell_id
).c_str()
);
quest_manager.WorldWideSpell(update_type, spell_id);
} else {
c->Message(Chat::White, "Usage: #worldwide remove [Spell ID] - Remove a spell worldwide");
}
}
}