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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 2 deletions

View File

@ -1445,12 +1445,20 @@ void SlashCommandHandler::Startup() {
}; };
RegisterCommand(removeIgnoreCommand); RegisterCommand(removeIgnoreCommand);
Command shutdownCommand{ Command command{
.help = "Shuts this world down", .help = "Shuts this world down",
.info = "Shuts this world down", .info = "Shuts this world down",
.aliases = {"shutdown"}, .aliases = {"shutdown"},
.handle = DEVGMCommands::Shutdown, .handle = DEVGMCommands::Shutdown,
.requiredLevel = eGameMasterLevel::DEVELOPER .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()); if (character) LOG("Mythran (%s) has shutdown the world", character->GetName().c_str());
Game::OnSignal(-1); 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 CastSkill(Entity* entity, const SystemAddress& sysAddr, const std::string args);
void DeleteInven(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 Shutdown(Entity* entity, const SystemAddress& sysAddr, const std::string args);
void Barfight(Entity* entity, const SystemAddress& sysAddr, const std::string args);
} }
#endif //!DEVGMCOMMANDS_H #endif //!DEVGMCOMMANDS_H

View File

@ -114,6 +114,7 @@ These commands are primarily for development and testing. The usage of many of t
|addfaction|`/addfaction <faction id>`|Add the faction to the users list of factions|8| |addfaction|`/addfaction <faction id>`|Add the faction to the users list of factions|8|
|getfactions|`/getfactions`|Shows the player's factions|8| |getfactions|`/getfactions`|Shows the player's factions|8|
|setrewardcode|`/setrewardcode <code>`|Sets the rewardcode for the account you are logged into if it's a valid rewardcode, See cdclient table `RewardCodes`|8| |setrewardcode|`/setrewardcode <code>`|Sets the rewardcode for the account you are logged into if it's a valid rewardcode, See cdclient table `RewardCodes`|8|
|barfight|`/barfight start`|Starts a barfight (turns everyones pvp on)|8|
|crash|`/crash`|Crashes the server.|9| |crash|`/crash`|Crashes the server.|9|
|rollloot|`/rollloot <loot matrix index> <item id> <amount>`|Given a `loot matrix index`, look for `item id` in that matrix `amount` times and print to the chat box statistics of rolling that loot matrix.|9| |rollloot|`/rollloot <loot matrix index> <item id> <amount>`|Given a `loot matrix index`, look for `item id` in that matrix `amount` times and print to the chat box statistics of rolling that loot matrix.|9|
|castskill|`/castskill <skill id>`|Casts the skill as the player|9| |castskill|`/castskill <skill id>`|Casts the skill as the player|9|