[Quest API] Add secondstotime(duration) to Perl and Lua. (#1281)

- Add quest::converttime(duration) to Perl.
- Add eq.convert_time(duration) to Lua.
This commit is contained in:
Alex
2021-03-11 21:38:47 -05:00
committed by GitHub
parent ac4a993259
commit cd08c96fa4
4 changed files with 53 additions and 0 deletions
+18
View File
@@ -6404,6 +6404,23 @@ XS(XS__createitem) {
XSRETURN(1);
}
XS(XS__secondstotime);
XS(XS__secondstotime) {
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: quest::secondstotime(int duration)");
}
dXSTARG;
std::string time_string;
int duration = (int) SvIV(ST(0));
time_string = quest_manager.secondstotime(duration);
sv_setpv(TARG, time_string.c_str());
XSprePUSH;
PUSHTARG;
XSRETURN(1);
}
/*
This is the callback perl will look for to setup the
quest package's XSUBs
@@ -6696,6 +6713,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "say"), XS__say, file);
newXS(strcpy(buf, "saylink"), XS__saylink, file);
newXS(strcpy(buf, "scribespells"), XS__scribespells, file);
newXS(strcpy(buf, "secondstotime"), XS__secondstotime, file);
newXS(strcpy(buf, "selfcast"), XS__selfcast, file);
newXS(strcpy(buf, "set_proximity"), XS__set_proximity, file);
newXS(strcpy(buf, "set_zone_flag"), XS__set_zone_flag, file);