Skip to content

Commit

Permalink
Node IDs and more
Browse files Browse the repository at this point in the history
  • Loading branch information
hiimjasmine00 committed Feb 20, 2025
1 parent 6312a15 commit 02ae333
Show file tree
Hide file tree
Showing 29 changed files with 1,160 additions and 907 deletions.
17 changes: 3 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ jobs:
- uses: actions/checkout@v4

- name: Build the mod
uses: geode-sdk/build-geode-mod@main
uses: hiimjasmine00/build-geode-mod@main
with:
build-config: ${{ matrix.config.build-config || 'Release' }}
export-pdb: true
export-symbols: true
combine: true
target: ${{ matrix.config.target }}

Expand All @@ -47,22 +48,10 @@ jobs:
needs: ['build']

steps:
- uses: geode-sdk/build-geode-mod/combine@main
- uses: hiimjasmine00/build-geode-mod/combine@main
id: build

- uses: actions/upload-artifact@v4
with:
name: Build Output
path: ${{ steps.build.outputs.build-output }}

release:
name: Release the mod
runs-on: ubuntu-latest
needs: ['package']

steps:
- uses: actions/checkout@v4

- uses: hiimjustin000/release-geode-mod@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Geode Mod

on:
workflow_dispatch:

jobs:
release:
name: Release mod
runs-on: ubuntu-latest
environment:
name: release
url: ${{ steps.mod-release.outputs.url }}

steps:
- uses: actions/checkout@v4

- uses: hiimjasmine00/release-geode-mod@main
id: mod-release
with:
token: ${{ secrets.GITHUB_TOKEN }}

publish:
name: Publish mod
runs-on: ubuntu-latest
needs: ['release']
environment:
name: publish
url: ${{ steps.mod-publish.outputs.url }}

steps:
- uses: actions/checkout@v4

- uses: hiimjasmine00/release-geode-mod/publish@main
id: mod-publish
with:
token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(GEODE_DISABLE_PRECOMPILED_HEADERS ON)

project(FakeRate VERSION 1.4.10)
project(FakeRate VERSION 1.4.11)

add_library(${PROJECT_NAME} SHARED
src/classes/FRDIBPopup.cpp
src/classes/FREditPopup.cpp
src/classes/FREffects.cpp
src/classes/FRGDDPPopup.cpp
src/classes/FRGRDPopup.cpp
src/classes/FRSetDifficultyPopup.cpp
src/classes/FRSetFeaturePopup.cpp
src/classes/FRSetStarsPopup.cpp
src/classes/TableNode.cpp
src/hooks/LevelCell.cpp
src/hooks/LevelInfoLayer.cpp
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 hiimjustin000
Copyright (c) 2024-2025 hiimjasmine00

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A mod that allows you to assign a fake rating to online levels.
- [Uproxide](https://gdbrowser.com/u/25397826) - Creator of the More Difficulties mod
- [ItzKiba](https://gdbrowser.com/u/4569963) - Creator of the Grandpa Demon mod
- [Minemaker0430](https://gdbrowser.com/u/6635071) - Creator of the GDDP Integration mod
- [hiimjustin000](https://gdbrowser.com/u/7466002) - Creator of the Demons In Between mod and this mod
- [hiimjasmine00](https://gdbrowser.com/u/7466002) - Creator of the Demons In Between mod and this mod

## Gallery
![Fake Rate Popup](./resources/fake-rate-popup.png)\
Expand Down
2 changes: 1 addition & 1 deletion about.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A mod that allows you to assign a fake rating to online levels.
- [Uproxide](user:25397826) - Creator of the More Difficulties mod
- [ItzKiba](user:4569963) - Creator of the Grandpa Demon mod
- [Minemaker0430](user:6635071) - Creator of the GDDP Integration mod
- [hiimjustin000](user:7466002) - Creator of the Demons In Between mod and this mod
- [hiimjasmine00](user:7466002) - Creator of the Demons In Between mod and this mod

## Gallery
![Fake Rate Popup](hiimjustin000.fake_rate/fake-rate-popup.png?scale=0.9375)\
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Fake Rate Changelog
## v1.4.11 (2025-02-20)
- Added node IDs to the fake rate popup and its many sub-elements
- Fixed a few minor bugs

## v1.4.10 (2024-11-15)
- Ported to Geode v4.0.0-beta.1

Expand Down
18 changes: 7 additions & 11 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"geode": "4.0.0-beta.1",
"geode": "4.2.0",
"gd": {
"android": "2.2074",
"win": "2.2074",
"mac": "2.2074"
},
"version": "v1.4.10",
"version": "v1.4.11",
"id": "hiimjustin000.fake_rate",
"name": "Fake Rate",
"developer": "hiimjustin000",
"developer": "hiimjasmine00",
"description": "A mod that allows you to assign a fake rating to online levels.",
"dependencies": [
{
"id": "geode.node-ids",
"version": ">=v1.12.0",
"importance": "required"
}
],
"dependencies": {
"geode.node-ids": ">=v1.12.0"
},
"resources": {
"sprites": [
"resources/*.png"
Expand All @@ -27,7 +23,7 @@
},
"links": {
"community": "https://discord.gg/QVKmbvBXA7",
"source": "https://github.com/hiimjustin000/FakeRate",
"source": "https://github.com/hiimjasmine00/FakeRate",
"homepage": "https://www.hiimjustin000.com"
},
"tags": [
Expand Down
104 changes: 59 additions & 45 deletions src/FakeRate.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#include "FakeRate.hpp"
#include <Geode/binding/GJGameLevel.hpp>
#include <Geode/utils/cocos.hpp>
#include <Geode/utils/ranges.hpp>

using namespace geode::prelude;

Expand Down Expand Up @@ -48,52 +51,29 @@ void FakeRate::toggle(CCNode* node, bool enabled) {
}

CCPoint FakeRate::getDIBOffset(int difficulty, GJDifficultyName name) {
if (name == GJDifficultyName::Long) switch (difficulty) {
case 1: return { 0.0f, -5.0f };
case 2: return { 0.125f, -5.0f };
case 3: return { 0.0f, -5.0f };
case 4: return { 0.0f, -5.125f };
case 5: return { 0.25f, -5.0f };
case 6: return { 0.125f, -4.75f };
case 7: return { 0.0f, -5.0f };
case 8: return { 0.0f, -4.125f };
case 9: return { -0.125f, -4.125f };
case 10: return { 0.0f, -4.0f };
case 11: return { -0.125f, -4.125f };
case 12: return { 0.0f, -4.125f };
case 13: return { 0.125f, -4.125f };
case 14: return { 0.0f, -4.125f };
case 15: return { 0.0f, -4.125f };
case 16: return { 0.0f, -3.625f };
case 17: return { 0.0f, -3.625f };
case 18: return { 0.0f, -3.5f };
case 19: return { 0.0f, -3.5f };
case 20: return { 0.0f, -3.5f };
}
else if (name == GJDifficultyName::Short) switch (difficulty) {
case 1: return { -0.125f, -0.25f };
case 2: return { -0.125f, -0.25f };
case 3: return { -0.125f, -0.25f };
case 4: return { -0.125f, -0.375f };
case 5: return { -0.125f, -0.25f };
case 6: return { -0.125f, -0.25f };
case 7: return { -0.125f, -0.375f };
case 8: return { -0.125f, 0.5f };
case 9: return { -0.125f, 0.5f };
case 10: return { -0.125f, 0.25f };
case 11: return { -0.125f, 0.5f };
case 12: return { 0.125f, 0.5f };
case 13: return { 0.125f, 0.5f };
case 14: return { 0.125f, 0.5f };
case 15: return { 0.0f, 0.5f };
case 16: return { 0.0f, 1.25f };
case 17: return { 0.0f, 1.25f };
case 18: return { 0.0f, 1.125f };
case 19: return { 0.0f, 1.125f };
case 20: return { 0.0f, 1.125f };
switch (difficulty) {
case 1: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -5.0f } : CCPoint { -0.125f, -0.25f };
case 2: return name == GJDifficultyName::Long ? CCPoint { 0.125f, -5.0f } : CCPoint { -0.125f, -0.25f };
case 3: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -5.0f } : CCPoint { -0.125f, -0.25f };
case 4: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -5.125f } : CCPoint { -0.125f, -0.375f };
case 5: return name == GJDifficultyName::Long ? CCPoint { 0.25f, -5.0f } : CCPoint { -0.125f, -0.25f };
case 6: return name == GJDifficultyName::Long ? CCPoint { 0.125f, -4.75f } : CCPoint { -0.125f, -0.25f };
case 7: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -5.0f } : CCPoint { -0.125f, -0.375f };
case 8: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -4.125f } : CCPoint { -0.125f, 0.5f };
case 9: return name == GJDifficultyName::Long ? CCPoint { -0.125f, -4.125f } : CCPoint { -0.125f, 0.5f };
case 10: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -4.0f } : CCPoint { -0.125f, 0.25f };
case 11: return name == GJDifficultyName::Long ? CCPoint { -0.125f, -4.125f } : CCPoint { -0.125f, 0.5f };
case 12: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -4.125f } : CCPoint { 0.125f, 0.5f };
case 13: return name == GJDifficultyName::Long ? CCPoint { 0.125f, -4.125f } : CCPoint { 0.125f, 0.5f };
case 14: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -4.125f } : CCPoint { 0.125f, 0.5f };
case 15: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -4.125f } : CCPoint { 0.0f, 0.5f };
case 16: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -3.625f } : CCPoint { 0.0f, 1.25f };
case 17: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -3.625f } : CCPoint { 0.0f, 1.25f };
case 18: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -3.5f } : CCPoint { 0.0f, 1.125f };
case 19: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -3.5f } : CCPoint { 0.0f, 1.125f };
case 20: return name == GJDifficultyName::Long ? CCPoint { 0.0f, -3.5f } : CCPoint { 0.0f, 1.125f };
default: return CCPoint { 0.0f, 0.0f };
}

return { 0.0f, 0.0f };
}

int FakeRate::getGRDOverride(CCSprite* sprite) {
Expand Down Expand Up @@ -147,3 +127,37 @@ std::string FakeRate::getGDDPFrame(int difficulty, GJDifficultyName name) {

return fmt::format("minemaker0430.gddp_integration/DP_{}{}Text.png", diff, name == GJDifficultyName::Short ? "Small" : "");
}

Result<std::vector<FakeRateSaveData>> matjson::Serialize<std::vector<FakeRateSaveData>>::fromJson(const matjson::Value& value) {
if (!value.isArray()) return Err("Expected array");

return Ok(ranges::map<std::vector<FakeRateSaveData>>(value.asArray().unwrap(), [](const matjson::Value& item) {
return FakeRateSaveData {
.id = (int)item["id"].asInt().unwrapOr(0),
.stars = (int)item["stars"].asInt().unwrapOr(0),
.feature = (int)item["feature"].asInt().unwrapOr(0),
.difficulty = (int)item["difficulty"].asInt().unwrapOr(0),
.moreDifficultiesOverride = (int)item["more-difficulties-override"].asInt().unwrapOr(0),
.grandpaDemonOverride = (int)item["grandpa-demon-override"].asInt().unwrapOr(0),
.demonsInBetweenOverride = (int)item["demons-in-between-override"].asInt().unwrapOr(0),
.gddpIntegrationOverride = (int)item["gddp-integration-override"].asInt().unwrapOr(0),
.coins = item["coins"].asBool().unwrapOr(true)
};
}));
}

matjson::Value matjson::Serialize<std::vector<FakeRateSaveData>>::toJson(const std::vector<FakeRateSaveData>& vec) {
return ranges::map<std::vector<matjson::Value>>(vec, [](const FakeRateSaveData& item) {
return matjson::makeObject({
{ "id", item.id },
{ "stars", item.stars },
{ "feature", item.feature },
{ "difficulty", item.difficulty },
{ "more-difficulties-override", item.moreDifficultiesOverride },
{ "grandpa-demon-override", item.grandpaDemonOverride },
{ "demons-in-between-override", item.demonsInBetweenOverride },
{ "gddp-integration-override", item.gddpIntegrationOverride },
{ "coins", item.coins }
});
});
}
45 changes: 7 additions & 38 deletions src/FakeRate.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#pragma once
#include <cocos2d.h>
#include <Geode/Enums.hpp>
#include <Geode/GeneratedPredeclare.hpp>

struct FakeRateSaveData {
int id;
int stars;
Expand Down Expand Up @@ -43,42 +48,6 @@ class FakeRate {

template<>
struct matjson::Serialize<std::vector<FakeRateSaveData>> {
static geode::Result<std::vector<FakeRateSaveData>> fromJson(matjson::Value const& value) {
if (!value.isArray()) return geode::Err("Expected array");

std::vector<FakeRateSaveData> vec;
for (auto const& item : value.asArray().unwrap()) {
vec.push_back({
.id = (int)item["id"].asInt().unwrapOr(0),
.stars = (int)item["stars"].asInt().unwrapOr(0),
.feature = (int)item["feature"].asInt().unwrapOr(0),
.difficulty = (int)item["difficulty"].asInt().unwrapOr(0),
.moreDifficultiesOverride = (int)item["more-difficulties-override"].asInt().unwrapOr(0),
.grandpaDemonOverride = (int)item["grandpa-demon-override"].asInt().unwrapOr(0),
.demonsInBetweenOverride = (int)item["demons-in-between-override"].asInt().unwrapOr(0),
.gddpIntegrationOverride = (int)item["gddp-integration-override"].asInt().unwrapOr(0),
.coins = item["coins"].asBool().unwrapOr(true)
});
}

return geode::Ok(vec);
}

static matjson::Value toJson(std::vector<FakeRateSaveData> const& vec) {
std::vector<matjson::Value> arr;
for (auto const& item : vec) {
arr.push_back(matjson::makeObject({
{ "id", item.id },
{ "stars", item.stars },
{ "feature", item.feature },
{ "difficulty", item.difficulty },
{ "more-difficulties-override", item.moreDifficultiesOverride },
{ "grandpa-demon-override", item.grandpaDemonOverride },
{ "demons-in-between-override", item.demonsInBetweenOverride },
{ "gddp-integration-override", item.gddpIntegrationOverride },
{ "coins", item.coins }
}));
}
return arr;
}
static geode::Result<std::vector<FakeRateSaveData>> fromJson(const matjson::Value& value);
static matjson::Value toJson(const std::vector<FakeRateSaveData>& vec);
};
Loading

0 comments on commit 02ae333

Please sign in to comment.