Skip to content

Commit fd4c162

Browse files
authored
Merge pull request #7 from CubicCommunity/beta
Beta
2 parents bd1baed + 92a1200 commit fd4c162

13 files changed

Lines changed: 522 additions & 112 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else()
99
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
1010
endif()
1111

12-
project(AvalancheIndex VERSION 1.1.2)
12+
project(AvalancheIndex VERSION 1.2.0)
1313

1414
file(GLOB_RECURSE SOURCES
1515
src/*.cpp

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ When viewing level cells or pages, you may notice the changes in the background
5454

5555
Level cells with a glow emerging from the side represent levels in Avalanche's hall of fame. These levels stand out the most among the team's creations. By default, unrated or unlisted levels will not be highlighted.
5656

57-
If a level is featured on Avalanche's servers, you may see a button with the Avalanche logo appear on the left-hand side menu on the level's information page, or the right-hand side menu on the pause menu while playing the level. Pressing this will create a pop-up showing its showcase video thumbnail as the background, and gives more information about the level as a project by the team or its members, the type of project it is, its host, etc. You will also see a button to watch its full showcase video.
57+
If a level is featured on Cubic's servers for Avalanche, you may see a button with the Avalanche logo appear on the left-hand side menu on the level's information page, or the right-hand side menu on the pause menu while playing the level. Pressing this will create a pop-up showing its level thumbnail as the background, and gives more information about the level as a project by the team or its members, the type of project it is, its host, etc. You will also see a button to watch its full showcase video.
5858

5959
---
6060

SECURITY.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
List of versions of this mod that are currently being supported with security updates.
55

66
| Version | Supported |
7-
| ------- | --------- |
8-
| 1.0.x ||
7+
| ------- | :-------: |
8+
| 1.2.x ||
9+
| 1.1.x ||
10+
| 1.0.x ||
911

1012
## Reporting a Vulnerability
1113
If you discover a security vulnerability, please follow the steps below:

about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ When viewing level cells or pages, you may notice the changes in the background
4343

4444
Level cells with a glow emerging from the side represent levels in Avalanche's hall of fame. These levels stand out the most among the team's creations. By default, unrated or unlisted levels will not be highlighted.
4545

46-
If a level is featured on Avalanche's servers, you may see a button with the Avalanche logo appear on the left-hand side menu on the level's information page, or the right-hand side menu on the pause menu while playing the level. Pressing this will create a pop-up showing its showcase video thumbnail as the background, and gives more information about the level as a project by the team or its members, the type of project it is, its host, etc. You will also see a button to watch its full showcase video.
46+
If a level is featured on Cubic's servers for Avalanche, you may see a button with the Avalanche logo appear on the left-hand side menu on the level's information page, or the right-hand side menu on the pause menu while playing the level. Pressing this will create a pop-up showing its level thumbnail as the background, and gives more information about the level as a project by the team or its members, the type of project it is, its host, etc. You will also see a button to watch its full showcase video.
4747

4848
---
4949

changelog.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## v1.2.0
2+
#### Team Project pop-up
3+
4+
#### Changes
5+
- **Updated** Geode compatibility to version `4.6.3`
6+
- **Added** level thumbnail background to Team Project information pop-up
7+
- **Added** promotional container for parent Team Project, if any, in information pop-up for independent levels
8+
- **Reworked** level showcase menu in Team Project information pop-up
9+
10+
#### Developers
11+
- **Updated** URLs to use Cubic Studios API endpoints for all web requests
12+
13+
###### Latest
14+
---
15+
###### Older
16+
117
### v1.1.2
218
##### Patches
319

@@ -7,10 +23,6 @@
723
- **Added** toggle setting `Collaboration Level Pages`
824
- Minor tweaks
925

10-
###### Latest
11-
---
12-
###### Older
13-
1426
### v1.1.1
1527
##### Patches
1628

incl/Avalanche.hpp

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,53 +20,76 @@ namespace avalanche { // Avalanche Index mod namespace
2020

2121
extern int ACC_PUBLISHER; // Account ID of Avalanche's level publisher account
2222

23-
constexpr const char* URL_CUBIC = "https://www.cubicstudios.xyz/"; // URL to Cubic Studios's official website
23+
constexpr const char* URL_CUBIC = "https://www.cubicstudios.xyz/"; // URL to Cubic Studios's official website
2424
constexpr const char* URL_AVALANCHE = "https://avalanche.cubicstudios.xyz/"; // URL to Avalanche's official website
2525

26-
constexpr const char* URL_API_BADGES = "https://gh.cubicstudios.xyz/WebLPS/data/avalProfiles.json"; // URL to remote JSON file containing all data on profiles
27-
constexpr const char* URL_API_LEVELS = "https://gh.cubicstudios.xyz/WebLPS/data/avalProjects.json"; // URL to remote JSON file containing all data on projects
26+
constexpr const char* URL_API_BADGES = "https://api.cubicstudios.xyz/avalanche/v1/profiles"; // URL to remote JSON file containing all data on profiles
27+
constexpr const char* URL_API_LEVELS = "https://api.cubicstudios.xyz/avalanche/v1/projects"; // URL to remote JSON file containing all data on projects
2828

2929
constexpr const char* und = "undefined";
3030
constexpr const char* err = "404: Not Found";
3131

32+
// Profile class
3233
class Profile {
3334
public:
3435
enum class Badge {
35-
NONE, // No badge
36-
CUBIC, // Staff of Cubic Studios
37-
DIRECTOR, // Leads the whole team
38-
MANAGER, // Helps keep things in check
39-
MEMBER, // Participates in projects
36+
NONE, // No badge
37+
CUBIC, // Staff of Cubic Studios
38+
DIRECTOR, // Leads the whole team
39+
MANAGER, // Helps keep things in check
40+
MEMBER, // Participates in projects
4041
COLLABORATOR, // Non-members of the team who also worked on a project
4142
};
4243

4344
static std::map<std::string, Badge> profileBadgeEnum; // Convert a string to a Badge enum
4445

4546
std::string name; // Official pseudonym of the member
46-
Badge badge; // ID of the member's badge
47+
Badge badge; // ID of the member's badge
4748

48-
Profile(std::string n = "Name", Badge b = Badge::NONE) : name(n), badge(b) {};
49+
Profile(
50+
std::string n = "Name",
51+
Badge b = Badge::NONE
52+
) : name(n), badge(b) {};
4953
};
5054

55+
// Avalanche project class
5156
class Project {
5257
public:
5358
enum class Type {
54-
NONE, // Not a project
55-
SOLO, // A project that a member worked on by themself
56-
TEAM, // A project that members of the team worked on
59+
NONE, // Not a project
60+
SOLO, // A project that a member worked on by themself
61+
TEAM, // A project that members of the team worked on
5762
COLLAB, // A project that involves the work of Collaborators
58-
EVENT, // A project that resulted from a public or private event hosted by Avalanche
63+
EVENT, // A project that resulted from a public or private event hosted by Avalanche
5964
};
6065

61-
static std::map<std::string, Type> projectTypeEnum; // Convert a string to a Type enum
66+
// Link to the main team project
67+
class LinkToMain {
68+
public:
69+
bool enabled; // If the link is enabled
70+
int level_id; // ID of the in-game level for the linked project
71+
};
6272

63-
std::string name; // Official name of the level
64-
std::string host; // Team member that hosted the level
65-
std::string showcase_url; // Tiny YouTube video URL of the full showcase of the level
66-
Type type; // Type of project the level is featured as
67-
bool fame; // If the level will be highlighted on lists
73+
static std::map<std::string, Type> projectTypeEnum; // Convert a string to a Type enum
6874

69-
Project(std::string n = "Name", std::string h = "Host", std::string su = URL_AVALANCHE, Type t = Type::NONE, bool f = false) : name(n), host(h), showcase_url(su), type(t), fame(f) {};
75+
std::string name; // Official name of the level
76+
std::string host; // Team member that hosted the level
77+
std::string showcase; // Tiny YouTube video URL of the full showcase of the level
78+
std::string thumbnail; // Imgur URL for a custom thumbnail for the level
79+
Type type; // Type of project the level is featured as
80+
bool fame; // If the level will be highlighted on lists
81+
82+
LinkToMain link_to_main; // Optional link to the main team project
83+
84+
Project(
85+
std::string n = "Name",
86+
std::string h = "Host",
87+
std::string su = URL_AVALANCHE,
88+
std::string ct = "",
89+
Type t = Type::NONE,
90+
bool f = false,
91+
LinkToMain ltm = LinkToMain()
92+
) : name(n), host(h), showcase(su), thumbnail(ct), type(t), fame(f), link_to_main(ltm) {};
7093
};
7194

7295
class Handler {
@@ -81,10 +104,10 @@ namespace avalanche { // Avalanche Index mod namespace
81104
void scanAll();
82105

83106
static std::map<Profile::Badge, std::string> badgeStringID; // Convert a Badge enum to a string ID
84-
static std::map<std::string, std::string> badgeSpriteName; // Get the sprite from the string badge ID
85-
static std::map<std::string, ccColor3B> badgeColor; // Get the color from the string badge ID
86-
static std::map<std::string, std::string> badgeToAPI; // Convert badge node ID to API ID
87-
static std::map<std::string, std::string> apiToString; // Convert API-provided string to string ID
107+
static std::map<std::string, std::string> badgeSpriteName; // Get the sprite from the string badge ID
108+
static std::map<std::string, ccColor3B> badgeColor; // Get the color from the string badge ID
109+
static std::map<std::string, std::string> badgeToAPI; // Convert badge node ID to API ID
110+
static std::map<std::string, std::string> apiToString; // Convert API-provided string to string ID
88111

89112
// Get profile data on a player
90113
Profile GetProfile(int id);
@@ -103,7 +126,7 @@ namespace avalanche { // Avalanche Index mod namespace
103126
log::debug("Creating badge for {}...", profile.name);
104127

105128
std::string idString = avalanche::Handler::badgeStringID[profile.badge]; // gets the string equivalent
106-
bool idFailTest = idString.empty(); // checks the map for this value to see if its invalid
129+
bool idFailTest = idString.empty(); // checks the map for this value to see if its invalid
107130

108131
if (idFailTest) {
109132
log::error("Badge is invalid.");

incl/src/Avalanche.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,27 @@ namespace avalanche {
187187
auto c_name = cacheStd["name"].asString().unwrapOr(und);
188188
auto c_host = cacheStd["host"].asString().unwrapOr(und);
189189
auto c_showcase = cacheStd["showcase"].asString().unwrapOr(und);
190+
auto c_thumbnail = cacheStd["thumbnail"].asString().unwrapOr("");
190191
auto c_type = (lType != avalanche::Project::projectTypeEnum.end()) ? lType->second : avalanche::Project::Type::NONE;
191192
auto c_fame = cacheStd["fame"].asBool().unwrapOr(false);
192193

193-
avalanche::Project res(c_name, c_host, c_showcase, c_type, c_fame);
194+
auto c_linked = cacheStd["project"];
195+
avalanche::Project::LinkToMain ltm;
196+
197+
if (c_linked.isObject()) {
198+
ltm.enabled = c_linked["enabled"].asBool().unwrapOr(false);
199+
ltm.level_id = c_linked["id"].asInt().unwrapOr(0);
200+
} else {
201+
ltm.enabled = false;
202+
ltm.level_id = 0;
203+
};
204+
205+
avalanche::Project res(c_name, c_host, c_showcase, c_thumbnail, c_type, c_fame, ltm);
194206
return res;
195207
} else {
196208
log::error("Project ID is invalid");
197209

198-
avalanche::Project res("Name", "Host", URL_AVALANCHE, avalanche::Project::Type::NONE, false);
210+
avalanche::Project res("Name", "Host", URL_AVALANCHE, "", avalanche::Project::Type::NONE, false, avalanche::Project::LinkToMain());
199211
return res;
200212
};
201213
};

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "4.6.2",
2+
"geode": "4.6.3",
33
"gd": {
44
"win": "2.2074",
55
"android": "2.2074",
@@ -8,7 +8,7 @@
88
},
99
"id": "cubicstudios.avalancheindex",
1010
"name": "Avalanche Index",
11-
"version": "1.1.2",
11+
"version": "1.2.0",
1212
"developers": [
1313
"Cheeseworks"
1414
],
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef PARTICLEHELPER_H
22
#define PARTICLEHELPER_H
33

4-
#include "../Debugger.hpp"
4+
#include "./Debugger.hpp"
55

66
#include <Geode/Geode.hpp>
77

src/headers/ProjectInfoPopup.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,32 @@ class ProjectInfoPopup : public geode::Popup<> {
1515
ProjectInfoPopup* setProject(GJGameLevel* level);
1616

1717
void show() override;
18-
1918
protected:
2019
std::string m_avalPublisher = "Avalanche";
20+
std::string m_linkedPublisher = "Avalanche";
2121
std::string m_cornerArtType = "rewardCorner_001.png";
2222

2323
Project m_avalProject;
24+
Project m_linkedProject;
2425

2526
GJGameLevel* m_level;
2627

2728
CCMenu* m_overlayMenu;
2829

2930
CCClippingNode* m_clippingNode;
3031

32+
void doInfo(Project proj, std::string publisher);
33+
void doShowcase(Project proj, std::string publisher);
34+
3135
void infoPopup(CCObject*);
3236
void settingsPopup(CCObject*);
3337

3438
void onFameInfo(CCObject*);
3539

3640
void onPlayShowcase(CCObject*);
3741

42+
void infoPopupLinked(CCObject*);
43+
void onPlayShowcaseLinked(CCObject*);
44+
3845
bool setup() override;
3946
};

0 commit comments

Comments
 (0)