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

Getitem #128

Merged
merged 8 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 @@ -61188,7 +61188,7 @@ Address,Quality,Size,Name
0x0000007100a8885c,U,000528,uking::reportGanonQuestFinished
0x0000007100a88a6c,U,001740,uking::reportGameOver
0x0000007100a89138,U,001384,uking::reportBloodMoon
0x0000007100a896a0,U,000852,uking::reportGetItem
0x0000007100a896a0,O,000852,_ZN5uking13reportGetItemERKN4sead7Vector3IfEERKNS0_14SafeStringBaseIcEE
0x0000007100a899f4,U,008496,uking::reportOptionsFromTitleStage
0x0000007100a8bb24,U,000176,PosTrackerUploader::dtor
0x0000007100a8bbd4,U,000184,PosTrackerUploader::dtorDelete
Expand Down
27 changes: 27 additions & 0 deletions src/Game/gamePlayReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace uking {

int convertPositionToInt(const sead::Vector2i& pos);

void reportKorok(const sead::Vector3f& position) {
ksys::ProductReporter::getSomeBool();
s32 id = ksys::gdt::getFlag_HiddenKorok_Number();
Expand Down Expand Up @@ -236,6 +238,30 @@ unsigned int getQuestId(const sead::SafeString& quest_name) {
return 0;
}

void reportGetItem(const sead::Vector3f& pos, const sead::SafeString& item_name) {
ksys::ProductReporter::getSomeBool();
PlayReport report(sead::SafeString("getitem"), 7,
ksys::PlayReportMgr::instance()->getReporter()->getHeap());
report.addMapType();

auto name = static_cast<int>(sead::HashCRC32::calcStringHash(item_name));

ksys::ProductReporter::getSomeBool();

report.add(sead::SafeString("name"), name);

int position = convertPositionToInt({int(pos.x), int(pos.y)});

report.add(sead::SafeString("Position"), position);
report.addPlayTimes();

if (ksys::PlayReportMgr::instance()) {
auto* reporter = ksys::PlayReportMgr::instance()->getReporter();
if (reporter && reporter->isEnabled())
reporter->saveReport(&report);
}
}

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;
Expand All @@ -262,6 +288,7 @@ void reportQuestStep(const ksys::qst::Quest* quest, int step_index) {
}
}
}

PlayReport::PlayReport(const sead::FixedSafeString<32>& event_id, s32 num_entries, sead::Heap* heap)
: ksys::PlayReport(event_id, num_entries, heap) {}

Expand Down
3 changes: 3 additions & 0 deletions src/Game/gamePlayReport.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
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);
void reportGetItem(const sead::Vector3f& pos, const sead::SafeString& item_name);

// TODO: More functions

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