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

fix: Return all obtained levels for badges #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cetteup
Copy link

@cetteup cetteup commented Nov 22, 2024

I was wondering why I kept getting basic badges (level 1) in game even though I already had the corresponding badge with a higher level. Turns out the current implementation only returns the highest awarded level for badges due to the GROUP BY award_id + COUNT. The game server is thus told that I don't have the lower level badges yet, leading it to award the level 1 badge again.

The endpoint needs to always return all awarded levels of a badge. The query exploded in size a bit, but I didn't really see any alternatives. Medals require the GROUP BY to merge the individual rows into one containing the COUNT. But badges must not be grouped and ribbons don't really care (single row anyway). Hence the UNION of two different queries. I also moved setting first to zero from the write loop to the query and sorted the query results by award id and level to make the response easier to read.

Note: Performance does not seem to be impacted by the change.

@cetteup
Copy link
Author

cetteup commented Nov 22, 2024

Partially fixes #78

If you have already received Tier 2, for example Anit-Tank Silver. Do you keep getting Tier 1 (Bronze) again

@Harpyie02
Copy link

Harpyie02 commented Dec 10, 2024

I couldn't test the fix because I immediately found another serious error that made it impossible to check.

My bf2 account has all medals and badges.

When I spawn on the map I immediately get the Combat Infantry Medal and in loop, every second I always get the same medal until the end of the round.

Here my round bf2 server logs
bf2game_20241210.log

My bf2 Playername: TEST

BF2_Hui6Eovojn

my medal_data.py (default, I didn't make any changes)

		#Combat Infantry Medal
		('2020903',	'Cim', 2, 
			f_and(
				global_stat ('time', 720000),
				has_medal ('1031406_1'),
				has_medal ('1031619_1'),
				has_medal ('1031119_1'),
				has_medal ('1031120_1'),
				has_medal ('1031109_1'),
				has_medal ('1031115_1'),
				has_medal ('1031121_1'),
				has_medal ('1031105_1'),
				has_medal ('1031113_1')
			)
		),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants