mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 11:48:37 +00:00
[Quest API] Add convert_money_to_string() to Perl/Lua (#3418)
* [Quest API] Add convert_money_to_string() to Perl/Lua
# Perl
- Add `quest::convert_money_to_string(money_hash)`.
# Lua
- Add `eq.convert_money_to_string(money_table)`.
# Notes
- Allows operators to convert money in to a readable string using `Strings::Money`.
# Examples
## Perl
```pl
sub EVENT_SAY {
if ($text=~/#a/i) {
my %money_data = (
"platinum" => 3123,
"gold" => 5692,
"copper" => 9
);
quest::message(315, quest::convert_money_to_string(%money_data));
}
}
```
## Lua
```lua
function event_say(e)
if e.message:find("#a") then
local money_data = {
gold = 12,
silver = 523904,
copper = 3
}
eq.message(315, "Lua: " .. eq.convert_money_to_string(money_data))
end
end```
* Update lua_general.cpp
This commit is contained in:
+2
-1
@@ -370,7 +370,8 @@ std::string Strings::NumberToWords(unsigned long long int n)
|
||||
|
||||
return res;
|
||||
}
|
||||
std::string Strings::Money(uint32 platinum, uint32 gold, uint32 silver, uint32 copper)
|
||||
|
||||
std::string Strings::Money(uint64 platinum, uint64 gold, uint64 silver, uint64 copper)
|
||||
{
|
||||
std::string money_string = "Unknown";
|
||||
if (copper && silver && gold && platinum) { // CSGP
|
||||
|
||||
Reference in New Issue
Block a user