mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-07 11:14:11 +00:00
feat: barfight (#1839)
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
};
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user