Advanced

GetBadgeGenDataV4

GetBadgeGenDataV4
July 11, 2023 03:29PM
Hello all,

I was not able to find data structure returned by GetBadgeGenDataV4(), so I spent small amount of time to "reverse" it.
In case it will be handy for someone else. I believe did not so much mistakes.

GetBadgeGenDataV4()
 +--belt{
 |   +-- url   {string}  -> "//cdn2.project-gc.com/images/badgegen/bgv2/belts/belt27.png" - url to belt image
 |   +--points {number}  -> 306.68 - current belt points
 |   +--info table {
 |   |    +-- 1 {
 |   |    |    +-- cnt {string} "2117"
 |   |    |    +-- text {string} "One point per 100 caches found."
 |   |    |    +-- points {number} 21
 |   |    |    }
 |   |    +-- 2 .. "2 points per event hosted; maximum of 30 points."
 |   |    + ...
 |   |    +-- 18  {table}     -> Belt information table
 |   |    }
 |   +-- next {number}        -> 316 - points for next belt
 |   }
 +--countryBadges {
 |   +-- 1 {
 |   |    +-- badge {string}  -> "The Croatia cacher" - badge name
 |   |    +-- country {string} -> "Croatia" - country name
 |   |    +-- tooltip {string} -> "The Croatia cacher: Awarded for finding caches in a percentage of states in Croatia MiaFu has 100% (2 of 2 states) and has the best badge available" - badge tool tip
 |   |    +-- left {boolean/number} -> 'false' / 75 - for Diamond (100%) contain 'false' for others contain percentage for next level
 |   |    +-- addons {table} { 
 |   |    |    +-- 1 {string}  -> "ftf" - list of extra addons - ftf in this case can be empty
 |   |    |    +-- 2 {string}  -> "leapday" - list of extra addons - leapday in this case
 |   |    |    }
 |   |    +-- quality {string} -> "D" - badge quality "B" "S" "G" "P" "R" "Sa" "E" "D"
 |   |    +-- url {string} -> "/dimages/badgegen-v4-countrybadge.php?country=HR&quality=D" - badge url
 |   |    +-- numRegions {number} -> 2 - total number of regions
 |   |    +-- percent {number} -> 100 - country coverage
 |   |    +-- logged {string} -> "2" - number of logged regions. do not know why string
 |   |    }
 |   +-- 2 {next country, same as before} - repeats for all country
 |   }
 +--badges {
     +-- The Long-Distance Cacher {
     |    +-- badge {string} -> "The Long-Distance Cacher" - badge name
     |    +-- current {number} -> 9549 / 'nil'  - current badge value, 'nil' if not exist - for example home coordinates not defined
     |    +-- awarded {string} -> "Awarded for finding a cache 6400 km or further away from home" - description
     |    +-- next {boolean/number} -> "10000" - next available badge / false if not available
     |    +-- tooltip {string} -> "The Long-Distance Cacher - Emerald Awarded for finding a cache 6400 km or further away from home MiaFu has 9549 km and needs 10000 to go up a level" - tooltip
     |    +-- addons {table} { 
     |    |    +-- 1 {string}  -> "ftf" - list of extra addons - ftf in this case can be empty
     |    |    +-- 2 {string}  -> "leapday" - list of extra addons - leapday in this case
     |    |    }
     |    +-- url {string} -> "//cdn2.project-gc.com/dimages/badgegen-v4-badge.php?icon=TheLongDistanceCacher&quality=E" - badge url
     |    +-- diamond {number} -> "10000" - amount for diamond
     |    +-- quality {string} -> "E" - badge quality "X" "B" "S" "G" "P" "R" "Sa" "E" "D" "D2" "D3" (Diamond 2x) X=none
     |    +-- this* {number} -> "6000" - actual level Note*: not populated for Emerald and Diamond
     |    }
     +-- The Large Cacher {
     |    {same structure for next badges}
     |    }



Edited 1 time(s). Last edit at 07/11/2023 03:46PM by MiaFu. (view changes)
Re: GetBadgeGenDataV4
July 19, 2023 02:52PM
I created small script, that walk through all badges of selected user and evaluate them. It can be configured to give any point value for any badge color (like Bronze = 1, Gold = 2, etc.) and summarize points. Then you can configure minimum threshold to pass criteria.
As not all badges fit requirements for challenges, we (with local reviewer) filtered out those not fitting. But in tags you can enforce to run for all (not recommended).
Script can be configured as "optimistic" (include all), otherwise it exclude antipod caches etc.
Available tag config:
"Proper": true, -- only badges matching https://www.geocaching.com/help/index.php?pg=kb.chapter&id=127&pgid=206
"Optimistic": true, -- allow antipods
"CountryDiamond": 1, -- add 1 point for any country in Diamond level (same for CountryEmerald, CountrySapphire, CountryRuby, CountryPlatinum, CountryGold, CountrySilver, CountryBronze)
"Diamond":1, -- add 1 point for any Diamond badge (same for Emerald, Sapphire, Ruby, Platinum, Gold, Silver, Bronze, None)
"Minimum":29 -- minimum 29 points to pass criteria

You can test it here: https://project-gc.com/Challenges//79506
Re: GetBadgeGenDataV4
July 20, 2023 04:10PM
I hate to disappoint you but geocaching.com HQ does not allow badge challenge criteria .

Challenge cache criteria must come from information broadly available on Geocaching.com and must be verifiable through information on Geocaching.com.

Badges are a PGC feature
Re: GetBadgeGenDataV4
July 20, 2023 04:25PM
Hi vogelbird,

you are right. That is why tag "Proper" exist. Once is set to true (default), then it evaluate only badges, they are in accordance with challenge criteria. It mean 29 out of 43 badges only.
It is up to your reviewer, (s)he will allow you to define it in listing as badge color, or will enforce you to list levels manually.
Sorry, you do not have permission to post/reply in this forum.