feat: barfight (#1839)

This commit is contained in:
David Markowitz
2025-06-29 14:18:59 -07:00
committed by GitHub
parent a1ba5b8f12
commit a5d0788488
4 changed files with 25 additions and 2 deletions

View File

@@ -1445,12 +1445,20 @@ void SlashCommandHandler::Startup() {
};
RegisterCommand(removeIgnoreCommand);
Command shutdownCommand{
Command command{
.help = "Shuts this world down",
.info = "Shuts this world down",
.aliases = {"shutdown"},
.handle = DEVGMCommands::Shutdown,
.requiredLevel = eGameMasterLevel::DEVELOPER
};
RegisterCommand(shutdownCommand);
RegisterCommand(command);
RegisterCommand({
.help = "Turns all players' pvp mode on",
.info = "Turns all players' pvp mode on",
.aliases = {"barfight"},
.handle = DEVGMCommands::Barfight,
.requiredLevel = eGameMasterLevel::DEVELOPER
});
}

View File

@@ -1633,4 +1633,17 @@ namespace DEVGMCommands {
if (character) LOG("Mythran (%s) has shutdown the world", character->GetName().c_str());
Game::OnSignal(-1);
}
void Barfight(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
auto* const characterComponent = entity->GetComponent<CharacterComponent>();
if (!characterComponent) return;
for (auto* const player : PlayerManager::GetAllPlayers()) {
auto* const pCharacterComponent = player->GetComponent<CharacterComponent>();
if (pCharacterComponent) pCharacterComponent->SetPvpEnabled(args == "start");
Game::entityManager->SerializeEntity(player);
}
const auto msg = u"Pvp has been turned on for all players by " + GeneralUtils::ASCIIToUTF16(characterComponent->GetName());
ChatPackets::SendSystemMessage(UNASSIGNED_SYSTEM_ADDRESS, msg, true);
}
};

View File

@@ -74,6 +74,7 @@ namespace DEVGMCommands {
void CastSkill(Entity* entity, const SystemAddress& sysAddr, const std::string args);
void DeleteInven(Entity* entity, const SystemAddress& sysAddr, const std::string args);
void Shutdown(Entity* entity, const SystemAddress& sysAddr, const std::string args);
void Barfight(Entity* entity, const SystemAddress& sysAddr, const std::string args);
}
#endif //!DEVGMCOMMANDS_H