Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository

This commit is contained in:
Akkadius
2020-06-29 00:40:27 -05:00
34 changed files with 1366 additions and 509 deletions
+420 -427
View File
File diff suppressed because it is too large Load Diff
+32
View File
@@ -207,6 +207,10 @@
#define ServerOP_CZSetEntityVariableByGroupID 0x4022
#define ServerOP_CZSetEntityVariableByRaidID 0x4023
#define ServerOP_CZSetEntityVariableByGuildID 0x4024
#define ServerOP_CZTaskAssign 0x4025
#define ServerOP_CZTaskAssignGroup 0x4026
#define ServerOP_CZTaskAssignRaid 0x4027
#define ServerOP_CZTaskAssignGuild 0x4028
/**
* QueryServer
@@ -1171,6 +1175,34 @@ struct Server_Speech_Struct {
char message[0];
};
struct CZTaskAssign_Struct {
uint16 npc_entity_id;
int character_id;
uint32 task_id;
bool enforce_level_requirement;
};
struct CZTaskAssignGroup_Struct {
uint16 npc_entity_id;
int group_id;
uint32 task_id;
bool enforce_level_requirement;
};
struct CZTaskAssignRaid_Struct {
uint16 npc_entity_id;
int raid_id;
uint32 task_id;
bool enforce_level_requirement;
};
struct CZTaskAssignGuild_Struct {
uint16 npc_entity_id;
int guild_id;
uint32 task_id;
bool enforce_level_requirement;
};
struct CZClientSignal_Struct {
int charid;
uint32 data;
+48
View File
@@ -527,3 +527,51 @@ bool isAlphaNumeric(const char *text)
return true;
}
// Function to convert single digit or two digit number into words
std::string convert2digit(int n, std::string suffix)
{
// if n is zero
if (n == 0) {
return "";
}
// split n if it is more than 19
if (n > 19) {
return NUM_TO_ENGLISH_Y[n / 10] + NUM_TO_ENGLISH_X[n % 10] + suffix;
}
else {
return NUM_TO_ENGLISH_X[n] + suffix;
}
}
// Function to convert a given number (max 9-digits) into words
std::string numberToWords(unsigned long long int n)
{
// string to store word representation of given number
std::string res;
// this handles digits at ones & tens place
res = convert2digit((n % 100), "");
if (n > 100 && n % 100) {
res = "and " + res;
}
// this handles digit at hundreds place
res = convert2digit(((n / 100) % 10), "Hundred ") + res;
// this handles digits at thousands & tens thousands place
res = convert2digit(((n / 1000) % 100), "Thousand ") + res;
// this handles digits at hundred thousands & one millions place
res = convert2digit(((n / 100000) % 100), "Lakh, ") + res;
// this handles digits at ten millions & hundred millions place
res = convert2digit((n / 10000000) % 100, "Crore, ") + res;
// this handles digits at ten millions & hundred millions place
res = convert2digit((n / 1000000000) % 100, "Billion, ") + res;
return res;
}
+17
View File
@@ -43,6 +43,20 @@ std::vector<std::string> split(std::string str_to_split, char delimiter);
const std::string StringFormat(const char* format, ...);
const std::string vStringFormat(const char* format, va_list args);
std::string implode(std::string glue, std::vector<std::string> src);
std::string convert2digit(int n, std::string suffix);
std::string numberToWords(unsigned long long int n);
// For converstion of numerics into English
// Used for grid nodes, as NPC names remove numerals.
// But general purpose
const std::string NUM_TO_ENGLISH_X[] = { "", "One ", "Two ", "Three ", "Four ",
"Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
"Twelve ", "Thirteen ", "Fourteen ", "Fifteen ",
"Sixteen ", "Seventeen ", "Eighteen ", "Nineteen " };
const std::string NUM_TO_ENGLISH_Y[] = { "", "", "Twenty ", "Thirty ", "Forty ",
"Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " };
/**
* @param str
@@ -189,5 +203,8 @@ uint32 hextoi(const char* num);
uint64 hextoi64(const char* num);
void MakeLowerString(const char *source, char *target);
void RemoveApostrophes(std::string &s);
std::string convert2digit(int n, std::string suffix);
std::string numberToWords(unsigned long long int n);
#endif