Skip to content

Commit

Permalink
reportQuestStep (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
trixie909 authored Apr 22, 2024
1 parent 00568fb commit b4ac2f9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
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

0 comments on commit b4ac2f9

Please sign in to comment.