mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 17:46:36 +00:00
[Quest API] Port DiaWind Plugin to Native Quest API (#1521)
* Port DiaWind plugin to native Quest API * Add no logging aliases
This commit is contained in:
@@ -124,6 +124,7 @@ namespace Logs {
|
||||
Scheduler,
|
||||
Cheat,
|
||||
ClientList,
|
||||
DiaWind,
|
||||
MaxCategoryID /* Don't Remove this */
|
||||
};
|
||||
|
||||
@@ -206,6 +207,7 @@ namespace Logs {
|
||||
"Scheduler",
|
||||
"Cheat",
|
||||
"ClientList",
|
||||
"DialogueWindow",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -666,6 +666,16 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::ClientList, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogDiaWind(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::DiaWind].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::DiaWind, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogDiaWindDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::DiaWind].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::DiaWind, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -1050,6 +1060,12 @@
|
||||
#define LogClientListDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDiaWind(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDiaWindDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -116,6 +116,42 @@ std::vector<std::string> SplitString(const std::string &str, const char delim) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// this one takes delimiter length into consideration
|
||||
std::vector<std::string> split_string(std::string s, std::string delimiter)
|
||||
{
|
||||
size_t pos_start = 0, pos_end, delim_len = delimiter.length();
|
||||
std::string token;
|
||||
std::vector<std::string> res;
|
||||
|
||||
while ((pos_end = s.find(delimiter, pos_start)) != std::string::npos) {
|
||||
token = s.substr(pos_start, pos_end - pos_start);
|
||||
pos_start = pos_end + delim_len;
|
||||
res.push_back(token);
|
||||
}
|
||||
|
||||
res.push_back(s.substr(pos_start));
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string get_between(const std::string &s, std::string start_delim, std::string stop_delim)
|
||||
{
|
||||
if (s.find(start_delim) == std::string::npos && s.find(stop_delim) == std::string::npos) {
|
||||
return "";
|
||||
}
|
||||
|
||||
auto first_split = split_string(s, start_delim);
|
||||
if (!first_split.empty()) {
|
||||
std::string remaining_block = first_split[1];
|
||||
auto second_split = split_string(remaining_block, stop_delim);
|
||||
if (!second_split.empty()) {
|
||||
std::string between = second_split[0];
|
||||
return between;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string::size_type search_deliminated_string(const std::string &haystack, const std::string &needle, const char deliminator)
|
||||
{
|
||||
// this shouldn't go out of bounds, even without obvious bounds checks
|
||||
@@ -280,7 +316,16 @@ void find_replace(std::string &string_subject, const std::string &search_string,
|
||||
string_subject.replace(start_pos, search_string.length(), replace_string);
|
||||
start_pos += replace_string.length();
|
||||
}
|
||||
}
|
||||
|
||||
std::string replace_string(std::string subject, const std::string &search, const std::string &replace)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while ((pos = subject.find(search, pos)) != std::string::npos) {
|
||||
subject.replace(pos, search.length(), replace);
|
||||
pos += replace.length();
|
||||
}
|
||||
return subject;
|
||||
}
|
||||
|
||||
void ParseAccountString(const std::string &s, std::string &account, std::string &loginserver)
|
||||
|
||||
@@ -177,6 +177,8 @@ std::vector<std::string> join_tuple(const std::string &glue, const std::pair<cha
|
||||
}
|
||||
|
||||
std::vector<std::string> SplitString(const std::string &s, const char delim = ',');
|
||||
std::vector<std::string> split_string(std::string s, std::string delimiter);
|
||||
std::string get_between(const std::string &s, std::string start_delim, std::string stop_delim);
|
||||
std::string::size_type search_deliminated_string(const std::string &haystack, const std::string &needle, const char deliminator = ',');
|
||||
std::string EscapeString(const char *src, size_t sz);
|
||||
std::string EscapeString(const std::string &s);
|
||||
@@ -185,6 +187,7 @@ void ToLowerString(std::string &s);
|
||||
void ToUpperString(std::string &s);
|
||||
std::string JoinString(const std::vector<std::string>& ar, const std::string &delim);
|
||||
void find_replace(std::string& string_subject, const std::string& search_string, const std::string& replace_string);
|
||||
std::string replace_string(std::string subject, const std::string &search, const std::string &replace);
|
||||
void ParseAccountString(const std::string &s, std::string &account, std::string &loginserver);
|
||||
|
||||
//const char based
|
||||
|
||||
Reference in New Issue
Block a user