[Commands] Cleanup #givemoney Command. (#1804)

- Cleanup money message to use new helper method.
This commit is contained in:
Kinglykrab 2021-11-22 21:18:04 -05:00 committed by GitHub
parent 9240497cbc
commit 8c7e1be344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,82 +30,12 @@ void command_givemoney(Client *c, const Seperator *sep)
platinum,
true
);
std::string money_string;
if (copper && silver && gold && platinum) { // CSGP
money_string = fmt::format(
"{} Platinum, {} Gold, {} Silver, and {} Copper",
platinum,
gold,
silver,
copper
);
} else if (copper && silver && gold && !platinum) { // CSG
money_string = fmt::format(
"{} Gold, {} Silver, and {} Copper",
gold,
silver,
copper
);
} else if (copper && silver && !gold && !platinum) { // CS
money_string = fmt::format(
"{} Silver and {} Copper",
silver,
copper
);
} else if (copper && !silver && !gold && !platinum) { // C
money_string = fmt::format(
"{} Copper",
copper
);
} else if (!copper && silver && gold && platinum) { // SGP
money_string = fmt::format(
"{} Platinum, {} Gold, and {} Silver",
platinum,
gold,
silver
);
} else if (!copper && silver && gold && !platinum) { // SG
money_string = fmt::format(
"{} Gold and {} Silver",
gold,
silver
);
} else if (!copper && silver && !gold && !platinum) { // S
money_string = fmt::format(
"{} Silver",
silver
);
} else if (copper && !silver && gold && platinum) { // CGP
money_string = fmt::format(
"{} Platinum, {} Gold, and {} Copper",
platinum,
gold,
copper
);
} else if (copper && !silver && gold && !platinum) { // CG
money_string = fmt::format(
"{} Gold and {} Copper",
gold,
copper
);
} else if (!copper && !silver && gold && platinum) { // GP
money_string = fmt::format(
"{} Platinum and {} Gold",
platinum,
gold
);
} else if (!copper && !silver && gold && !platinum) { // G
money_string = fmt::format(
"{} Gold",
gold
);
}
c->Message(
Chat::White,
fmt::format(
"Added {} to {}.",
money_string,
ConvertMoneyToString(platinum, gold, silver, copper),
c == target ? "yourself" : target->GetCleanName()
).c_str()
);