Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reportQuestStep #126

Merged
merged 7 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/uking_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -61183,7 +61183,7 @@ Address,Quality,Size,Name
0x0000007100a86ec8,O,000360,_ZN5uking10PlayReportC1ERKN4sead15FixedSafeStringILi32EEEiPNS1_4HeapE
0x0000007100a87030,O,001116,_ZN5uking10PlayReport10addMapTypeEv
0x0000007100a8748c,O,000908,_ZN5uking13reportDungeonERKN4sead14SafeStringBaseIcEES4_
0x0000007100a87818,U,001256,uking::reportQuestEvent
0x0000007100a87818,O,001256,_ZN5uking15reportQuestStepEPKN4ksys3qst5QuestEi
0x0000007100a87d00,U,002908,getQuestId
0x0000007100a8885c,U,000528,uking::reportGanonQuestFinished
0x0000007100a88a6c,U,001740,uking::reportGameOver
Expand Down
30 changes: 28 additions & 2 deletions src/Game/gamePlayReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
#include "KingSystem/GameData/gdtCommonFlagsUtils.h"
#include "KingSystem/GameData/gdtManager.h"
#include "KingSystem/GameData/gdtTriggerParam.h"
#include "KingSystem/Quest/qstQuest.h"
#include "KingSystem/System/ProductReporter.h"
#include "KingSystem/System/StageInfo.h"

namespace uking {

unsigned int getQuestId(const sead::SafeString& quest_name);
void reportKorok(const sead::Vector3f& position) {
ksys::ProductReporter::getSomeBool();
s32 id = ksys::gdt::getFlag_HiddenKorok_Number();
Expand All @@ -30,7 +31,6 @@ void reportKorok(const sead::Vector3f& position) {

void reportDungeon(const sead::SafeString& name, const sead::SafeString& event) {
ksys::ProductReporter::getSomeBool();

if (name.findIndex("Remains") == -1 && name.findIndex("Dungeon") == -1 &&
name.findIndex("FinalTrial") == -1)
return;
Expand All @@ -52,6 +52,32 @@ void reportDungeon(const sead::SafeString& name, const sead::SafeString& event)
}
}

void reportQuestStep(const ksys::qst::Quest* quest, int step_index) {
if (quest && step_index >= 0 && step_index < quest->mSteps.size()) {
const sead::SafeString& name = quest->mName;
const sead::SafeString step_name = quest->mSteps[step_index]->name;

ksys::ProductReporter::getSomeBool();

const unsigned int quest_id = getQuestId(name);

PlayReport report(sead::SafeString("challenge"), 7,
ksys::PlayReportMgr::instance()->getReporter()->getHeap());

report.addMapType();
report.add(sead::SafeString("Id"), quest_id);
report.add(sead::SafeString("Name"), name);
report.add(sead::SafeString("Step"), step_index);
report.add(sead::SafeString("StepName"), step_name);
report.addPlayTimes();

if (ksys::PlayReportMgr::instance()) {
auto* reporter = ksys::PlayReportMgr::instance()->getReporter();
if (reporter && reporter->isEnabled())
reporter->saveReport(&report);
}
}
}
PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, sead::Heap* heap)
: ksys::PlayReport(event_id, num_entries, heap) {}

Expand Down
5 changes: 4 additions & 1 deletion src/Game/gamePlayReport.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
#include <math/seadVectorFwd.h>
#include "KingSystem/System/PlayReportMgr.h"

namespace ksys::qst {
struct Quest;
}
namespace uking {

void reportKorok(const sead::Vector3f& position);
void reportDungeon(const sead::SafeString& name, const sead::SafeString& event);

void reportQuestStep(const ksys::qst::Quest* quest, int step_index);
// TODO: More functions

class PlayReport : public ksys::PlayReport {
Expand Down
Loading