Skip to content

Commit

Permalink
FIX: Fixes energy names being the PTCGL tokens
Browse files Browse the repository at this point in the history
this commit also adds PAL support the latest set
  • Loading branch information
Bratah123 committed Jul 8, 2023
1 parent 25f4973 commit 243e2f9
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion packages/deck_string_parser/lib/src/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const Set<String> setAbbreviations = {
"FUT20",
"MCD21",
"MCD22",
"PAL",
};

/// Checks if a given string is numeric
Expand Down Expand Up @@ -317,10 +318,35 @@ List<Energy> parseEnergyCards(List<List<String>> crudeDeckList) {
words.removeAt(indexOfSetAbbreviation);
}

var name = words.sublist(1, words.length - 1).join(" ");
name = ptcglEnergyFormatToEnglish(name);

buffer.add(Energy(
quantity: words[0],
name: words.sublist(1, words.length - 1).join(" "),
name: name,
));
}
return buffer;
}

/// PTCGL Deck list formats typically show energy names as:
/// {W} Energy Energy, {P} Energy Energy, etc..
///
/// This converts any energy Name:
/// "{W} Energy Energy" -> "Water Energy" and so on.
String ptcglEnergyFormatToEnglish(String energyName) {
final Map<String, String> energySymbols = {
"{D} Energy" : "Dark",
"{F} Energy" : "Fighting",
"{G} Energy" : "Grass",
"{L} Energy" : "Lightning",
"{M} Energy" : "Metal",
"{W} Energy" : "Water",
"{R} Energy" : "Fire",
"{P} Energy" : "Psychic",
};
energySymbols.forEach((key, value) {
energyName = energyName.replaceFirst(key, value);
});
return energyName;
}

12 comments on commit 243e2f9

@Bratah123
Copy link
Member Author

Choose a reason for hiding this comment

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

image

@KOOKIIEStudios
Copy link
Contributor

Choose a reason for hiding this comment

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

Do unit tests need updating?

@KOOKIIEStudios
Copy link
Contributor

Choose a reason for hiding this comment

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

List of missing set abbreviations:
OBF, MEW, SVE, POP1-POP9, PPS1-PPS2, SVE, WP, NP, DPP, HSP, SPP

So we need to support these?

@Bratah123
Copy link
Member Author

Choose a reason for hiding this comment

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

List of missing set abbreviations: OBF, MEW, SVE, POP1-POP9, PPS1-PPS2, SVE, WP, NP, DPP, HSP, SPP

So we need to support these?

We likely won't need to support these

@Bratah123
Copy link
Member Author

Choose a reason for hiding this comment

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

Do unit tests need updating?

We could assign these to an intern?

@KOOKIIEStudios
Copy link
Contributor

Choose a reason for hiding this comment

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

we dont have interns

OBF and MEW are upcoming scarlet and violet expansion sets after PAL tho?

@Bratah123
Copy link
Member Author

Choose a reason for hiding this comment

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

we dont have interns

OBF and MEW are upcoming scarlet and violet expansion sets after PAL tho?

oooh good catch, no wonder I didn't recognize these.. (I'm in NA)
Yes then, we would need to add those for future support

@KOOKIIEStudios
Copy link
Contributor

Choose a reason for hiding this comment

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

These are all things that are in bulbapedia's currently list of english expansion sets
i don't know why there are some that i missed cuz i literally used the same bulbapedia page page in april

so we don't need: SVE, POP1-POP9, PPS1-PPS2, SVE, WP, NP, DPP, HSP, SPP?

@Bratah123
Copy link
Member Author

Choose a reason for hiding this comment

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

These are all things that are in bulbapedia's currently list of english expansion sets i don't know why there are some that i missed cuz i literally used the same bulbapedia page page in april

so we don't need: SVE, POP1-POP9, PPS1-PPS2, SVE, WP, NP, DPP, HSP, SPP?

I'd say we only need anything after SVI, I don't recognize any of those set abbreviations, so I'm assuming they aren't new?

@KOOKIIEStudios
Copy link
Contributor

Choose a reason for hiding this comment

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

POP/PPS are POP / Play! Pokemon Prize Packs
SVE is scarlet/violet basic energy set from march this year
The rest are black star promos

wondering if support is needed since we rely on that set list to filter out set names and remove them

@Bratah123
Copy link
Member Author

Choose a reason for hiding this comment

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

POP/PPS are POP / Play! Pokemon Prize Packs SVE is scarlet/violet basic energy set from march this year The rest are black star promos

wondering if support is needed since we rely on that set list to filter out set names and remove them

oooh, in that case we should add it all then.

@KOOKIIEStudios
Copy link
Contributor

Choose a reason for hiding this comment

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

get your intern to do that and the unit tests i guess

Please sign in to comment.