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

Implement support for Champion and Warrior medals #50

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Nsgr
Copy link

@Nsgr Nsgr commented Oct 10, 2024

See title

Copy link

@jsj1027 jsj1027 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know a lot about programming, but basically nothing about AngelScript or Trackmania plugins, so take what i say with a grain of salt.


if (champion.time < 0 && ShowChampionMedals) {
champion.time = GetChampionMedalsTime();
haveAllTimes = haveAllTimes && champion.time >= 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (champion.time == 0) {
 champion.hidden = true;
}

You should add in this check for champion medals because they can also not exist at times like warrior medals.
According to https://openplanet.dev/plugin/championmedals

New Champion medals are added 7 days after the release of a new seasonal campaign, and 1 hour after the release of a new TOTD

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this comes up a bit on my test version of this plugin+PR

auto myNonce = ++additionalMedalCoroNonce;
while (myNonce == additionalMedalCoroNonce && mapUid == currentMapUid) {
// set this to false if any time is < 0
bool haveAllTimes = true;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you be checking if you have all times? Or should you have separate checks for if you have the Champion time and the warrior time? It feels to have it be the same check when one could not be there.

#endif

#if TMNEXT
array<Record@> times = {champion, warrior, author, gold, silver, bronze, pbest};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure of how these if statements for these extensions work, but I would assume based on the logic here that you would some editing of this array.

Because how will this work if someone doesn't want Champion or Warrior medal support? What if they actually want neither. Will this time show up anyway and does that effect the UI when they dont show up because champion.hidden != true?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can turn of showing them individually, but ultimate medals uses indexes in an array for a few things, and there needs to be a single global array with everything.
Yes, it's not idea.

@@ -694,3 +720,10 @@ uint CalcMedal() {
else return 0;
}
#endif

#if TMNEXT
void UpdatePBMedalLabel() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine this method with CalcMedal line 707.

#if TURBO||MP4||TMNEXT
uint CalcMedal() {
#if TURBO
	if(pbest <= stmaster) return 8;
	else if(pbest <= sgold) return 7;
	else if(pbest <= ssilver) return 6;
	else if(pbest <= sbronze) return 5;
	else if(pbest <= tmaster) return 4;
#elif TMEXT
        if (pbest <= champion && ShowChampionMedals) = 5;
        else if (pbest <= warrior && ShowWarriorMedals) = 6;
#elif MP4
	if(pbest <= author) return 4;
#endif
	else if(pbest <= gold) return 3;
	else if(pbest <= silver) return 2;
	else if(pbest <= bronze) return 1;
	else return 0;
}
#endif

@@ -500,35 +515,35 @@ void OnSettingsChanged() {
UpdateText();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closest line i could write this but in Update() you should add support for renaming the champion and warrior medals like the other medals.

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.

3 participants