[Quest API] Add Time String to Seconds Method to Perl/Lua. (#2580)

* [Quest API] Add Time String to Seconds Method to Perl/Lua.

# Perl
- Add `quest::timetoseconds(time_string)`.

# Lua
- Add `eq.time_to_seconds(time_string)`.

# Notes
- Allows operators to use this method in place of hardcoded values like `3600`.

* Remove unused method.
This commit is contained in:
Alex King
2022-11-26 19:28:21 -05:00
committed by GitHub
parent ea9a02bec4
commit f7ae5850f0
8 changed files with 53 additions and 42 deletions
+6 -1
View File
@@ -1923,7 +1923,11 @@ void lua_remove_all_expedition_lockouts_by_char_id(uint32 char_id, std::string e
}
std::string lua_seconds_to_time(int duration) {
return quest_manager.secondstotime(duration);
return Strings::SecondsToTime(duration);
}
uint32 lua_time_to_seconds(std::string time_string) {
return Strings::TimeToSeconds(time_string);
}
std::string lua_get_hex_color_code(std::string color_name) {
@@ -4061,6 +4065,7 @@ luabind::scope lua_register_general() {
luabind::def("debug", (void(*)(std::string, int))&lua_debug),
luabind::def("log_combat", (void(*)(std::string))&lua_log_combat),
luabind::def("seconds_to_time", &lua_seconds_to_time),
luabind::def("time_to_seconds", &lua_time_to_seconds),
luabind::def("get_hex_color_code", &lua_get_hex_color_code),
luabind::def("get_aa_exp_modifier_by_char_id", (double(*)(uint32,uint32))&lua_get_aa_exp_modifier_by_char_id),
luabind::def("get_aa_exp_modifier_by_char_id", (double(*)(uint32,uint32,int16))&lua_get_aa_exp_modifier_by_char_id),