-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(skymp5-server): add Quest.GetStage stub & disable some bad scrip…
…ts (#2256)
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
skymp5-server/cpp/server_guest_lib/script_classes/PapyrusQuest.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "PapyrusQuest.h" | ||
#include "script_objects/EspmGameObject.h" | ||
|
||
VarValue PapyrusQuest::GetStage(VarValue self, | ||
const std::vector<VarValue>& arguments) | ||
{ | ||
return GetCurrentStageID(self, arguments); | ||
} | ||
|
||
VarValue PapyrusQuest::GetCurrentStageID( | ||
VarValue self, const std::vector<VarValue>& arguments) | ||
{ | ||
static std::once_flag g_flag; | ||
|
||
std::call_once(g_flag, [&] { | ||
espm::CompressedFieldsCache cache; | ||
|
||
const auto& quest = GetRecordPtr(self); | ||
const char* editorId = | ||
quest.rec ? quest.rec->GetEditorId(cache) : "<null>"; | ||
|
||
spdlog::warn( | ||
"GetCurrentStageID - Not implemented, returning 0 (quest was {})", | ||
editorId ? editorId : "<null>"); | ||
spdlog::warn("GetCurrentStageID - Won't output further warnings due to " | ||
"performance reasons"); | ||
}); | ||
|
||
return VarValue(0); | ||
} | ||
|
||
void PapyrusQuest::Register( | ||
VirtualMachine& vm, std::shared_ptr<IPapyrusCompatibilityPolicy> policy) | ||
{ | ||
AddMethod(vm, "GetStage", &PapyrusQuest::GetStage); | ||
AddMethod(vm, "GetCurrentStageID", &PapyrusQuest::GetCurrentStageID); | ||
} |
20 changes: 20 additions & 0 deletions
20
skymp5-server/cpp/server_guest_lib/script_classes/PapyrusQuest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
#include "IPapyrusClass.h" | ||
#include "SpSnippetFunctionGen.h" | ||
|
||
class PapyrusQuest final : public IPapyrusClass<PapyrusQuest> | ||
{ | ||
public: | ||
const char* GetName() override { return "Quest"; } | ||
|
||
// Non-native in original Papyrus, just a wrapper around GetCurrentStageID | ||
VarValue GetStage(VarValue self, const std::vector<VarValue>& arguments); | ||
|
||
VarValue GetCurrentStageID(VarValue self, | ||
const std::vector<VarValue>& arguments); | ||
|
||
void Register(VirtualMachine& vm, | ||
std::shared_ptr<IPapyrusCompatibilityPolicy> policy) override; | ||
|
||
std::shared_ptr<IPapyrusCompatibilityPolicy> compatibilityPolicy; | ||
}; |