mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-24 22:47:25 +00:00
fix crash
Update SlashCommandHandler.cpp
This commit is contained in:
parent
2804dc3ec2
commit
fcd7e8d299
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user