Merge branch 'master' of https://github.com/EQEmu/Server into op_charinventory_update

This commit is contained in:
Uleat 2019-10-08 22:06:39 -04:00
commit 451d791336
2 changed files with 50 additions and 1 deletions

View File

@ -3580,6 +3580,25 @@ XS(XS__worldwidemarquee) {
XSRETURN_EMPTY;
}
XS(XS__log);
XS(XS__log) {
dXSARGS;
if (items != 1 && items != 2) {
Perl_croak(aTHX_ "Usage: quest::log(uint8 log_category, string message)");
}
else {
uint8 log_category = (uint8)SvIV(ST(0));
std::string log_message = (std::string) SvPV_nolen(ST(1));
if (log_category >= Logs::MaxCategoryID) {
return;
}
Log(Logs::General, log_category, log_message.c_str());
}
XSRETURN_EMPTY;
}
XS(XS__debug);
XS(XS__debug) {
dXSARGS;
@ -3606,6 +3625,21 @@ XS(XS__debug) {
XSRETURN_EMPTY;
}
XS(XS__log_combat);
XS(XS__log_combat) {
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: quest::log_combat(string message)");
}
else {
std::string log_message = (std::string) SvPV_nolen(ST(0));
Log(Logs::General, Logs::Combat, log_message.c_str());
}
XSRETURN_EMPTY;
}
XS(XS__UpdateZoneHeader);
XS(XS__UpdateZoneHeader) {
dXSARGS;
@ -3862,6 +3896,8 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "itemlink"), XS__itemlink, file);
newXS(strcpy(buf, "lasttaskinset"), XS__lasttaskinset, file);
newXS(strcpy(buf, "level"), XS__level, file);
newXS(strcpy(buf, "log"), XS__log, file);
newXS(strcpy(buf, "log_combat"), XS__log_combat, file);
newXS(strcpy(buf, "me"), XS__me, file);
newXS(strcpy(buf, "modifynpcstat"), XS__ModifyNPCStat, file);
newXS(strcpy(buf, "movegrp"), XS__movegrp, file);

View File

@ -1367,6 +1367,13 @@ double lua_clock() {
return static_cast<double>(t) / 1000.0;
}
void lua_log(int category, std::string message) {
if (category < Logs::None || category >= Logs::MaxCategoryID)
return;
Log(Logs::General, static_cast<Logs::LogCategory>(category), message.c_str());
}
void lua_debug(std::string message) {
Log(Logs::General, Logs::QuestDebug, message.c_str());
}
@ -1378,6 +1385,10 @@ void lua_debug(std::string message, int level) {
Log(static_cast<Logs::DebugLevel>(level), Logs::QuestDebug, message.c_str());
}
void lua_log_combat(std::string message) {
Log(Logs::General, Logs::Combat, message.c_str());
}
void lua_update_zone_header(std::string type, std::string value) {
quest_manager.UpdateZoneHeader(type, value);
}
@ -1772,8 +1783,10 @@ luabind::scope lua_register_general() {
luabind::def("reloadzonestaticdata", &lua_reloadzonestaticdata),
luabind::def("clock", &lua_clock),
luabind::def("create_npc", &lua_create_npc),
luabind::def("log", (void(*)(int, std::string))&lua_log),
luabind::def("debug", (void(*)(std::string))&lua_debug),
luabind::def("debug", (void(*)(std::string, int))&lua_debug)
luabind::def("debug", (void(*)(std::string, int))&lua_debug),
luabind::def("log_combat", (void(*)(std::string))&lua_log_combat)
];
}