Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quest API] Add convert_money_to_string() to Perl/Lua #3418

Merged
merged 2 commits into from
Jun 18, 2023

Conversation

Kinglykrab
Copy link
Contributor

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

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

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

# 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```
zone/lua_general.cpp Outdated Show resolved Hide resolved
zone/lua_general.cpp Outdated Show resolved Hide resolved
@Kinglykrab Kinglykrab merged commit 6efb9ec into master Jun 18, 2023
@Kinglykrab Kinglykrab deleted the quest_api/convert_money_to_string branch June 18, 2023 19:29
@Akkadius Akkadius mentioned this pull request Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants