Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions client/app/uniformbuilder/modules/AwardClasses.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import {
AwardAttachmentType,
MosGroup,
AwardNameFragment,
hasValorDevice,
stripValorDevice,
} from "./constants";

export class Award {
awardTitle = null;
//awardDetail = null;
Expand All @@ -19,7 +27,7 @@ export class Ribbon extends Award {

const registryDetails = AwardRegistry.getAwardDetails(data.awardName);

if (!(registryDetails.awardAttachmentType == undefined)) {
if (registryDetails.awardAttachmentType != undefined) {
this.ribbonAttachmentType = registryDetails.awardAttachmentType;
}
this.awardPriority = registryDetails.awardPriority;
Expand Down Expand Up @@ -57,16 +65,16 @@ export class MedalWithValor extends Medal {
constructor(data, AwardRegistry) {
super(data, AwardRegistry);

if (this.awardTitle.includes("with Valor Device")) {
if (hasValorDevice(this.awardTitle)) {
this.overrideAwardTitle(data.awardName);
}
}

overrideAwardTitle(awardName) {
const baseAwardName = awardName.replace(" with Valor Device", "");
const baseAwardName = stripValorDevice(awardName);
this.awardTitle = baseAwardName;
this.hasValorDevice = true;
this.ribbonAttachmentType = "oakClustersValor";
this.ribbonAttachmentType = AwardAttachmentType.OAK_CLUSTERS_VALOR;
this.maxAwardcount = 14;
}
}
Expand Down Expand Up @@ -130,7 +138,7 @@ export class MedalTiered extends Medal {

updateTieredMedal(detail) {
//Stackup logic
if (this.ribbonAttachmentType == "gcNotches") {
if (this.ribbonAttachmentType == AwardAttachmentType.GC_NOTCHES) {
switch (detail) {
case "Gold Knot":
this.highestTierAchieved = 3;
Expand All @@ -157,7 +165,7 @@ export class MedalTiered extends Medal {
}

//Server upgrade ribbon logic
if (this.ribbonAttachmentType == "stars") {
if (this.ribbonAttachmentType == AwardAttachmentType.STARS) {
switch (detail) {
case "Gold Star":
this.highestTierAchieved = 2;
Expand Down Expand Up @@ -197,17 +205,11 @@ export class BadgeCombat extends Badge {
this.awardPriority = registryDetails.awardPriority;

this.userMos = userMos;
if (
this.userMos == "153A" ||
this.userMos == "155A" ||
this.userMos == "15A" ||
this.userMos == "15T" ||
this.userMos == "155F"
) {
if (MosGroup.AVIATION.includes(this.userMos)) {
this.isAviation = true;
}

if (this.userMos == "68W" || this.userMos == "67A") {
if (MosGroup.MEDICAL.includes(this.userMos)) {
this.isMedical = true;
}

Expand All @@ -224,7 +226,7 @@ export class BadgeCombat extends Badge {
//we need to give 15T an exception so that they stop at aircrew badges.

if (this.isAviation) {
if (this.userMos == "15T") {
if (MosGroup.AIRCREW.includes(this.userMos)) {
this.maxAllowed = 8;
} else {
this.maxAllowed = 11;
Expand All @@ -233,7 +235,6 @@ export class BadgeCombat extends Badge {
}

this.maxAllowed = 5;
return;
}

getImageNum(num) {
Expand Down Expand Up @@ -278,24 +279,22 @@ export class BadgeCombat extends Badge {
newAwardPriority <= this.maxAllowed
) {
if (
newAwardData.awardName == "Flight Medic Badge" &&
this.isMedical == false
newAwardData.awardName == AwardNameFragment.FLIGHT_MEDIC_BADGE &&
!this.isMedical
) {
return;
}

if (
newAwardData.awardName.includes("Aviator") &&
this.isAviation == false
newAwardData.awardName.includes(AwardNameFragment.AVIATOR) &&
!this.isAviation
) {
return;
}

this.awardTitle = newAwardData.awardName;
this.awardPriority = newAwardPriority;
this.imageNum = this.getImageNum(newAwardPriority);
} else {
return;
}
}
}
Expand All @@ -313,7 +312,7 @@ export class UnitCitation extends Award {

const registryDetails = AwardRegistry.getAwardDetails(data.awardName);

if (!(registryDetails.awardAttachmentType == undefined)) {
if (registryDetails.awardAttachmentType != undefined) {
this.ribbonAttachmentType = registryDetails.awardAttachmentType;
}
this.awardPriority = registryDetails.awardPriority;
Expand Down
174 changes: 16 additions & 158 deletions client/app/uniformbuilder/modules/AwardRegistry.jsx
Original file line number Diff line number Diff line change
@@ -1,179 +1,37 @@
import {
MAX_AWARD_COUNT,
hasValorDevice,
stripValorDevice,
AWARD_CATALOG,
} from "./constants";

export class AwardRegistry {
constructor() {
this.awards = new Map();
this.initalizeAwards();
}

// prettier-ignore
initalizeAwards() {

//____MAINLINE MEDALS AND RIBBONS____

this.awards.set(`7th Cavalry Lifetime Dedication Award`, {awardPriority: 0, medalPriority: 0, awardType: "Medal"});
this.awards.set(`James "Krazee" Foster Lifetime Achievement Medal`, {awardPriority: 1, medalPriority: 1, awardType: "Medal"});
this.awards.set(`Ronnie "Coldblud" Bussey Lifetime Achievement Medal`, {awardPriority: 2, medalPriority: 2, awardType: "Medal"});
this.awards.set("Army Distinguished Service Cross", {awardPriority: 3, medalPriority: 3, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Defense Distinguished Service Medal", {awardPriority: 4, medalPriority: 4, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Army Distinguished Service Medal", {awardPriority: 5, medalPriority: 5, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Silver Star", {awardPriority: 6, medalPriority: 6, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Defense Superior Service Medal", {awardPriority: 7, medalPriority: 7, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Legion of Merit", {awardPriority: 8, medalPriority: 8, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Distinguished Flying Cross", {awardPriority: 9, medalPriority: 9, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Soldiers Medal", {awardPriority: 10, medalPriority: 10, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Bronze Star", {awardPriority: 11, medalPriority: 11, awardAttachmentType: "oakClusters", awardType: "MedalWithValor"});
this.awards.set("Purple Heart", {awardPriority: 12, medalPriority: 12, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Defense Meritorious Service Medal", {awardPriority: 13, medalPriority: 13, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Meritorious Service Medal", {awardPriority: 14, medalPriority: 14, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Air Medal", {awardPriority: 15, medalPriority: 15, awardAttachmentType: "ncoNums", awardType: "Medal"});
this.awards.set("Joint Service Commendation Medal", {awardPriority: 16, medalPriority: 16, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Army Commendation Medal", {awardPriority: 17, medalPriority: 17, awardAttachmentType: "oakClusters", awardType: "MedalWithValor"});
this.awards.set("Joint Service Achievement Medal", {awardPriority: 18, medalPriority: 18, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Army Achievement Medal",{awardPriority: 19, medalPriority: 19, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Prisoner of War Medal", {awardPriority: 20, medalPriority: 20, awardAttachmentType: "oakClusters", awardType: "Medal"});
this.awards.set("Army Good Conduct Medal", {awardPriority: 21, medalPriority: 21, awardAttachmentType: "gcNotches", awardType: "Medal"});
this.awards.set("Armed Forces Expeditionary Medal", {awardPriority: 22, medalPriority: 22, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("Afghanistan Campaign Medal", {awardPriority: 23, medalPriority: 23, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("Iraq Campaign Medal", {awardPriority: 24, medalPriority: 24, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("Global War on Terrorism Expeditionary Medal", {awardPriority: 25, medalPriority: 25, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("National Defense Service Medal", {awardPriority: 26, medalPriority: 26, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("Armed Forces Service Medal", {awardPriority: 27, medalPriority: 27, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("Humanitarian Service Medal", {awardPriority: 28, medalPriority: 28, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("Donation Ribbon", {awardPriority: 29, awardAttachmentType: "starsDonation", awardType: "RibbonDonationLogic"}); // Requires Special Case
this.awards.set("7th Cavalry Server Upgrade Award", {awardPriority: 30, medalPriority: 29, awardAttachmentType: "stars", awardType: "MedalTiered"}); // Fuck you, whoever put this into SOP
this.awards.set("StackUp Donation Medal", {awardPriority: 31, medalPriority: 30, awardAttachmentType: "gcNotches", awardType: "MedalTiered"}); // and again
this.awards.set("Outstanding Volunteer Service Medal", {awardPriority: 32, medalPriority: 31, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("NCO Professional Development Ribbon", {awardPriority: 33, awardAttachmentType: "ncoNums", awardType: "Ribbon"});
this.awards.set("Honor Graduate Ribbon", {awardPriority: 34, awardType: "Ribbon"});
this.awards.set("Army Service Ribbon", {awardPriority: 35, awardType: "Ribbon"});
this.awards.set("Cavalry Centurion Medal", {awardPriority: 36, medalPriority: 32, awardAttachmentType: "silverStars", awardType: "Medal"});
this.awards.set("United Nations Service Medal", {awardPriority: 37, medalPriority: 33, awardAttachmentType: "stars", awardType: "Medal"});
this.awards.set("Overseas Service Ribbon", {awardPriority: 38, medalPriority: 34, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("Ready or Not Service Ribbon",{awardPriority: 39, medalPriority: 35, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("DCS World Service Ribbon", {awardPriority: 40, medalPriority: 36, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("Squad Service Ribbon", {awardPriority: 41, medalPriority: 37, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("WWII Service Ribbon", {awardPriority: 42, medalPriority: 38, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("Hell Let Loose Service Ribbon", {awardPriority: 43, medalPriority: 39, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("Hell Let Loose Console Service Ribbon", {awardPriority: 44, medalPriority: 40, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("Battlefield 6 Service Ribbon", {awardPriority: 45, medalPriority: 41, awardAttachmentType: "oakClustersService", awardType: "Medal"});
this.awards.set("Recruiting Ribbon", {awardPriority: 46, awardAttachmentType: "starsDonation", awardType: "RibbonDonationLogic"}); // May Also require Special Case
this.awards.set("D-Day Commemorative Medal", {awardPriority: 47, medalPriority: 42, awardType: "Medal"});
this.awards.set("Ranger Selection Ribbon", {awardPriority: 48, awardType: "Ribbon"});
this.awards.set("Sniper Ribbon", {awardPriority: 49, medalPriority: 43, awardType: "Medal"});
this.awards.set("Basic Assault Course Ribbon", {awardPriority: 50, awardType: "Ribbon"});

// ___ DISCONTINUED RIBBONS/MEDALS WITHOUT PRECIDENCE ___
// These ones are a bit of an unknown precidence wise. Indeed we have some discon awards above, however precidence is known
// Anything here is shown as is, and there is no inherent precicence for these.

this.awards.set("Cadre Course Ribbon", {awardPriority: 51, awardType: "Ribbon"});
this.awards.set("Womens Army Corp Service Medal", {awardPriority: 52, medalPriority:44, awardType: "Medal"})
this.awards.set("D Day Participation Ribbon", {awardPriority: 53, awardType: "Ribbon"})
this.awards.set("European/African/Middle Eastern Campaign Medal", {awardPriority: 54, medalPriority:45, awardAttachmentType: "oakClusters", awardType: "Medal"})


//____ UNIT CITATIONS ____

this.awards.set("Army & Air Force Presidential Unit Citation", {awardPriority: 0, awardAttachmentType: "unitCitationClusters", awardType: "UnitCitation"});
this.awards.set("Army Valorous Unit Citation", {awardPriority: 1, awardAttachmentType: "unitCitationClusters", awardType: "UnitCitation"});
this.awards.set("Joint Meritorious Unit Citation", {awardPriority: 2, awardAttachmentType: "unitCitationClusters", awardType: "UnitCitation"});
this.awards.set("Army Meritorious Unit Citation", {awardPriority: 3, awardAttachmentType: "unitCitationClusters", awardType: "UnitCitation"});
this.awards.set("Army Superior Unit Citation", {awardPriority: 4, awardAttachmentType: "unitCitationClusters", awardType: "UnitCitation"});
this.awards.set("7th Cavalry Black Ops Unit Citation", {awardPriority: 5, awardAttachmentType: "unitCitationSStars", awardType: "UnitCitation"});

// ____ COMBAT BADGES ____

this.awards.set("Flight Medic Badge", {awardPriority: 6, awardType: "BadgeCombat"}); // (3/1/b/1-7) (4/1/b/1-7)
this.awards.set("Master Army Aviator Badge", {awardPriority: 11, awardType: "BadgeCombat"}); // (A/1-7) (A/ACD)
this.awards.set("Senior Army Aviator Badge", {awardPriority: 10, awardType: "BadgeCombat"})
this.awards.set("Army Aviator Badge", {awardPriority: 9, awardType: "BadgeCombat"})
this.awards.set("Aircraft Master Crewman Badge", {awardPriority: 8, awardType: "BadgeCombat"}); // (A/1-7) (A/ACD)
this.awards.set("Aircraft Senior Crewman Badge", {awardPriority: 7, awardType: "BadgeCombat"})
this.awards.set("Aircraft Crewman Badge", {awardPriority: 6, awardType: "BadgeCombat"})
this.awards.set("Combat Infantry Badge 4th Award", {awardPriority: 5, awardType: "BadgeCombat"})
this.awards.set("Combat Infantry Badge 2nd Award", {awardPriority: 3, awardType: "BadgeCombat"})
this.awards.set("Combat Infantry Badge 3rd Award", {awardPriority: 4, awardType: "BadgeCombat"})
this.awards.set("Combat Infantry Badge", {awardPriority: 2, awardType: "BadgeCombat"})
this.awards.set("Expert Infantry Badge", {awardPriority: 1, awardType: "BadgeCombat"}) // et. al.

//____ WEAPON QUALS ____

this.awards.set("Rifle Expert", {awardTag: "rifle", awardType: "WeaponQual"});
this.awards.set("Rifle Sharpshooter", {awardTag: "rifle", awardType: "WeaponQual"});
this.awards.set("Rifle Marksman", {awardTag: "rifle", awardType: "WeaponQual"});
this.awards.set("Grenade Expert", {awardTag: "grenade", awardType: "WeaponQual"});
this.awards.set("Grenade Sharpshooter", {awardTag: "grenade", awardType: "WeaponQual"});
this.awards.set("Grenade Marksman", {awardTag: "grenade", awardType: "WeaponQual"});
this.awards.set("Pistol Expert", {awardTag: "pistol", awardType: "WeaponQual"});
this.awards.set("Pistol Sharpshooter", {awardTag: "pistol", awardType: "WeaponQual"});
this.awards.set("Pistol Marksman", {awardTag: "pistol", awardType: "WeaponQual"});
this.awards.set("M-203 Expert", {awardTag: "m203", awardType: "WeaponQual"});
this.awards.set("M-203 Sharpshooter", {awardTag: "m203", awardType: "WeaponQual"});
this.awards.set("M-203 Marksman", {awardTag: "m203", awardType: "WeaponQual"});
this.awards.set("Machine Gun Expert", {awardTag: "machineGun", awardType: "WeaponQual"});
this.awards.set("Machine Gun Sharpshooter", {awardTag: "machineGun", awardType: "WeaponQual"});
this.awards.set("Machine Gun Marksman", {awardTag: "machineGun", awardType: "WeaponQual"});
this.awards.set("Recoilless Rifle Expert", {awardTag: "recoilless", awardType: "WeaponQual"});
this.awards.set("Recoilless Rifle Sharpshooter", {awardTag: "recoilless", awardType: "WeaponQual"});
this.awards.set("Recoilless Rifle Marksman", {awardTag: "recoilless", awardType: "WeaponQual"});
this.awards.set("Aeroweapons Expert", {awardTag: "aeroweapons", awardType: "WeaponQual"});
this.awards.set("Aeroweapons Sharpshooter", {awardTag: "aeroweapons", awardType: "WeaponQual"});
this.awards.set("Aeroweapons Marksman", {awardTag: "aeroweapons", awardType: "WeaponQual"});
this.awards.set("Hydra-70 Expert", {awardTag: "hydra70", awardType: "WeaponQual"});
this.awards.set("Hydra-70 Sharpshooter", {awardTag: "hydra70", awardType: "WeaponQual"});
this.awards.set("Hydra-70 Marksman", {awardTag: "hydra70", awardType: "WeaponQual"});
this.awards.set("Tank Weapons Expert", {awardTag: "tankWeapons", awardType: "WeaponQual"});
this.awards.set("Tank Weapons Sharpshooter", {awardTag: "tankWeapons", awardType: "WeaponQual"});
this.awards.set("Tank Weapons Marksman", {awardTag: "tankWeapons", awardType: "WeaponQual"});

//____ TABS ____

this.awards.set("Special Forces Tab", {awardPriority: 0, awardType: "Tab"});
this.awards.set("Ranger Tab", {awardPriority: 1, awardType: "Tab"});
this.awards.set("Sapper Tab", {awardPriority: 2, awardType: "Tab"});
this.awards.set("Long-Range Reconnaissance Patrol Tab", {awardPriority: 3, awardType: "Tab"});

for (const { name, ...details } of AWARD_CATALOG) {
this.awards.set(name, details);
}
}

isInRegistry(awardName) {
return this.awards.has(awardName);
}

getAwardDetails(awardName) {
if (awardName.includes("with Valor Device")) {
awardName = awardName.replace(" with Valor Device", "");
}

if (this.awards.get(awardName) == undefined) {
return 0;
if (hasValorDevice(awardName)) {
awardName = stripValorDevice(awardName);
}

return this.awards.get(awardName);
return this.awards.get(awardName) ?? 0;
}

getMaxAwardCount(awardName) {
switch (this.getAwardDetails(awardName).awardAttachmentType) {
case "oakClusters":
return 19;
case "unitCitationClusters":
return 10;
case "unitCitationSStars":
return 5;
case "oakClustersService":
return 6;
case "oakClustersValor":
return 14;
case "silverStars":
return 5;
case "stars":
return 10;
case "starsDonation": //Requires advanced logic
return 12;
case "gcNotches":
return 9;
case "ncoNums":
return 6;
default:
return 1;
}
return (
MAX_AWARD_COUNT[this.getAwardDetails(awardName).awardAttachmentType] ?? 1
);
}
}
Loading