Badgify
Badgify
An API for adding badges to profiles and comments easily.
The API
It is extremely simple, here's an example on how to register and modify badge:
$execute {
alpha::badgify::registerBadge(
// A unique ID for your badge.
"your-badge-id"_spr,
// The name shown when clicking the badge.
"Badge Name",
// The description shown when clicking the badge.
"This is a description that goes along with the badge.",
// Show the badge when a Location::Profile, Location::Comment, or Location::InfoPopup is loaded.
// alpha::badgify::showBadge can be called at any time and requires the Badge object and the node for the badge.
[] (const alpha::badgify::Badge& badge) {
if (badge.modStatus == ModStatus::Regular) {
alpha::badgify::showBadge(badge, CCSprite::createWithSpriteFrameName("modBadge_01_001.png"));
}
}
);
// Unregistering.
alpha::badgify::unregisterBadge("your-badge-id"_spr);
// Setting name.
alpha::badgify::setName("your-badge-id"_spr, "New Badge Name");
// Setting description.
alpha::badgify::setDescription("your-badge-id"_spr, "New Description");
// Setting the callback for showing the badge when a Location::Profile, Location::Comment, or Location::InfoPopup is loaded.
alpha::badgify::setProfileCallback("your-badge-id"_spr, [] (const alpha::badgify::Badge& badge) {
if (badge.user->m_userName == "Alphalaneous" && badge.location == alpha::badgify::Location::Comment) {
alpha::badgify::showBadge(badge, CCSprite::createWithSpriteFrameName("modBadge_01_001.png"));
}
});
// Getting the name.
log::info("Name: {}", alpha::badgify::getName("your-badge-id"_spr).unwrapOrDefault());
// Getting the description.
log::info("Description: {}", alpha::badgify::getDescription("your-badge-id"_spr).unwrapOrDefault());
}
Mod badge descriptions from https://www.robtopgames.com/faq/en/answers/moderator/
1.0.6
- Fix a bug causing badges to not load if a profile's info is cached
- Fix some edge cases where a badge should be able to be added but wouldn't
1.0.5
- Fix a crash
1.0.4
- Add check if target is in active nodes list to mitigate invalid node crashes maybe?
- Fix touch for buttons added as badges
- Fix position of badges shifting when refreshing profiles when using the old badge design
1.0.3
- Add safety checks to CommentCell
- Force Mod badges to front
- Make badge order based on order of registration
- Fix unregistering badges causing undefined behavior, now unregistering will remove the badge live if on a profile, looking at comments, and in the info popup
- Make Badges render within a RenderNode in the info popup, to fix cascading color issues
- Fix badges not fading in properly in the info popup
- Fix a memory leak
1.0.2
- Fix some positioning issues with Badges API alongside this mod
1.0.1
- Fix invisible line under username if not using the alt design
- Fix a crash
1.0.0
- Initial Release
.geode files you get from this page. Some mods also require other mods as dependencies; you will need to find and install them yourself.