mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[Bug Fix] Fix possible crash in #givemoney. (#1828)
This commit is contained in:
parent
1a5f48521d
commit
d38b8a4867
@ -1205,11 +1205,6 @@ std::string ConvertMoneyToString(uint32 platinum, uint32 gold, uint32 silver, ui
|
||||
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",
|
||||
@ -1223,11 +1218,6 @@ std::string ConvertMoneyToString(uint32 platinum, uint32 gold, uint32 silver, ui
|
||||
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",
|
||||
@ -1247,11 +1237,26 @@ std::string ConvertMoneyToString(uint32 platinum, uint32 gold, uint32 silver, ui
|
||||
platinum,
|
||||
gold
|
||||
);
|
||||
} else if (!copper && !silver && !gold && platinum) { // P
|
||||
money_string = fmt::format(
|
||||
"{} Platinum",
|
||||
platinum
|
||||
);
|
||||
} else if (!copper && !silver && gold && !platinum) { // G
|
||||
money_string = fmt::format(
|
||||
"{} Gold",
|
||||
gold
|
||||
);
|
||||
} else if (!copper && silver && !gold && !platinum) { // S
|
||||
money_string = fmt::format(
|
||||
"{} Silver",
|
||||
silver
|
||||
);
|
||||
} else if (copper && !silver && !gold && !platinum) { // C
|
||||
money_string = fmt::format(
|
||||
"{} Copper",
|
||||
copper
|
||||
);
|
||||
}
|
||||
return money_string;
|
||||
}
|
||||
@ -14,10 +14,10 @@ void command_givemoney(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
uint32 platinum = std::stoi(sep->arg[1]);
|
||||
uint32 gold = std::stoi(sep->arg[2]);
|
||||
uint32 silver = std::stoi(sep->arg[3]);
|
||||
uint32 copper = std::stoi(sep->arg[4]);
|
||||
uint32 platinum = std::stoul(sep->arg[1]);
|
||||
uint32 gold = sep->IsNumber(2) ? std::stoul(sep->arg[2]) : 0;
|
||||
uint32 silver = sep->IsNumber(3) ? std::stoul(sep->arg[3]) : 0;
|
||||
uint32 copper = sep->IsNumber(4) ? std::stoul(sep->arg[4]) : 0;
|
||||
if (!platinum && !gold && !silver && !copper) {
|
||||
c->Message(Chat::Red, "Usage: #Usage: #givemoney [Platinum] [Gold] [Silver] [Copper]");
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user