Update SlashCommandHandler.cpp
This commit is contained in:
David Markowitz 2024-01-05 16:49:21 -08:00 committed by GitHub
parent 2804dc3ec2
commit 15a461d857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,17 +347,6 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
}); });
} }
if (chatCommand == "resetmission") {
uint32_t missionId;
if (!GeneralUtils::TryParse(args[0], missionId)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission ID.");
return;
}
auto* missionComponent = entity->GetComponent<MissionComponent>();
if (!missionComponent) return;
missionComponent->ResetMission(missionId);
}
if (user->GetMaxGMLevel() == eGameMasterLevel::CIVILIAN || entity->GetGMLevel() >= eGameMasterLevel::CIVILIAN) { if (user->GetMaxGMLevel() == eGameMasterLevel::CIVILIAN || entity->GetGMLevel() >= eGameMasterLevel::CIVILIAN) {
if (chatCommand == "die") { if (chatCommand == "die") {
entity->Smash(entity->GetObjectID()); entity->Smash(entity->GetObjectID());
@ -387,6 +376,18 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) return; if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) return;
} }
if (chatCommand == "resetmission" && args.size() >= 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
uint32_t missionId;
if (!GeneralUtils::TryParse(args[0], missionId)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission ID.");
return;
}
auto* missionComponent = entity->GetComponent<MissionComponent>();
if (!missionComponent) return;
missionComponent->ResetMission(missionId);
}
// Log command to database // Log command to database
Database::Get()->InsertSlashCommandUsage(entity->GetObjectID(), chatCommand); Database::Get()->InsertSlashCommandUsage(entity->GetObjectID(), chatCommand);
@ -703,33 +704,6 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
entity->GetCharacter()->SetPlayerFlag(flagId, false); entity->GetCharacter()->SetPlayerFlag(flagId, false);
} }
if (chatCommand == "resetmission" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
if (args.size() == 0) return;
uint32_t missionID;
if (!GeneralUtils::TryParse(args[0], missionID)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid mission id.");
return;
}
auto* comp = static_cast<MissionComponent*>(entity->GetComponent(eReplicaComponentType::MISSION));
if (comp == nullptr) {
return;
}
auto* mission = comp->GetMission(missionID);
if (mission == nullptr) {
return;
}
mission->SetMissionState(eMissionState::ACTIVE);
return;
}
if (chatCommand == "playeffect" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 3) { if (chatCommand == "playeffect" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 3) {
int32_t effectID = 0; int32_t effectID = 0;