[Money Messages] Cleanup quest::givecash(), split, and task reward messages. (#2205)

* [Money Messages] Cleanup quest::givecash(), split, and task reward messages.
- Cleans up all the money messages using ConvertMoneyToString().
- Allows quest::givecash() to have optional parameters other than copper.

* Commification.

* Corpse messages.

* String IDs and cleanup.
This commit is contained in:
Kinglykrab
2022-05-29 14:33:18 -04:00
committed by GitHub
parent 9e9ef6809b
commit bcf7ccefcd
11 changed files with 243 additions and 271 deletions
+29 -43
View File
@@ -1170,52 +1170,38 @@ void QuestManager::untraindiscs() {
initiator->UntrainDiscAll();
}
void QuestManager::givecash(int copper, int silver, int gold, int platinum) {
void QuestManager::givecash(uint32 copper, uint32 silver, uint32 gold, uint32 platinum) {
QuestManagerCurrentQuestVars();
if (initiator && initiator->IsClient() && ((copper + silver + gold + platinum) > 0))
{
initiator->AddMoneyToPP(copper, silver, gold, platinum, true);
if (
initiator &&
initiator->IsClient() &&
(
copper ||
silver ||
gold ||
platinum
)
) {
initiator->AddMoneyToPP(
copper,
silver,
gold,
platinum,
true
);
std::string tmp;
if (platinum > 0)
{
tmp = "You receive ";
tmp += itoa(platinum);
tmp += " platinum";
if (initiator) {
initiator->MessageString(
Chat::MoneySplit,
YOU_RECEIVE,
ConvertMoneyToString(
platinum,
gold,
silver,
copper
).c_str()
);
}
if (gold > 0)
{
if (tmp.length() == 0)
tmp = "You receive ";
else
tmp += ",";
tmp += itoa(gold);
tmp += " gold";
}
if(silver > 0)
{
if (tmp.length() == 0)
tmp = "You receive ";
else
tmp += ",";
tmp += itoa(silver);
tmp += " silver";
}
if(copper > 0)
{
if (tmp.length() == 0)
tmp = "You receive ";
else
tmp += ",";
tmp += itoa(copper);
tmp += " copper";
}
tmp += " pieces.";
if (initiator)
initiator->Message(Chat::OOC, tmp.c_str());
}
}