mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
[Cleanup] Cleanup uses of Strings::ToInt to match correct type. (#3054)
* [Cleanup] Cleanup uses of Strings::ToInt to match correct type. * cleanup
This commit is contained in:
parent
c5add503ab
commit
2e2c4d64fe
@ -387,7 +387,7 @@ bool Database::DeleteCharacter(char *character_name)
|
||||
std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", character_name);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
character_id = Strings::ToInt(row[0]);
|
||||
character_id = Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
if (character_id <= 0) {
|
||||
@ -787,7 +787,7 @@ uint32 Database::GetCharacterID(const char *name) {
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1)
|
||||
{
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -815,7 +815,7 @@ uint32 Database::GetAccountIDByChar(const char* charname, uint32* oCharID) {
|
||||
uint32 accountId = Strings::ToInt(row[0]);
|
||||
|
||||
if (oCharID)
|
||||
*oCharID = Strings::ToInt(row[1]);
|
||||
*oCharID = Strings::ToUnsignedInt(row[1]);
|
||||
|
||||
return accountId;
|
||||
}
|
||||
@ -832,7 +832,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) {
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::GetAccountIDByName(std::string account_name, std::string loginserver, int16* status, uint32* lsid) {
|
||||
@ -880,7 +880,7 @@ void Database::GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID
|
||||
|
||||
strcpy(name, row[0]);
|
||||
if (row[1] && oLSAccountID) {
|
||||
*oLSAccountID = Strings::ToInt(row[1]);
|
||||
*oLSAccountID = Strings::ToUnsignedInt(row[1]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -968,7 +968,7 @@ bool Database::LoadVariables() {
|
||||
|
||||
std::string key, value;
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
varcache.last_update = Strings::ToInt(row[2]); // ahh should we be comparing if this is newer?
|
||||
varcache.last_update = Strings::ToUnsignedInt(row[2]); // ahh should we be comparing if this is newer?
|
||||
key = row[0];
|
||||
value = row[1];
|
||||
std::transform(std::begin(key), std::end(key), std::begin(key), ::tolower); // keys are lower case, DB doesn't have to be
|
||||
@ -1052,7 +1052,7 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
|
||||
auto row = results.begin();
|
||||
|
||||
if(graveyard_zoneid != nullptr)
|
||||
*graveyard_zoneid = Strings::ToInt(row[0]);
|
||||
*graveyard_zoneid = Strings::ToUnsignedInt(row[0]);
|
||||
if(graveyard_x != nullptr)
|
||||
*graveyard_x = Strings::ToFloat(row[1]);
|
||||
if(graveyard_y != nullptr)
|
||||
@ -1168,7 +1168,7 @@ uint32 Database::GetAccountIDFromLSID(
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
account_id = Strings::ToInt(row[0]);
|
||||
account_id = Strings::ToUnsignedInt(row[0]);
|
||||
|
||||
if (in_account_name) {
|
||||
strcpy(in_account_name, row[1]);
|
||||
@ -1244,7 +1244,7 @@ uint8 Database::GetServerType() {
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
|
||||
@ -1296,7 +1296,7 @@ uint8 Database::GetRaceSkill(uint8 skillid, uint8 in_race)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level)
|
||||
@ -1312,12 +1312,12 @@ uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16
|
||||
if (results.Success() && results.RowsAffected() != 0)
|
||||
{
|
||||
auto row = results.begin();
|
||||
skill_level = Strings::ToInt(row[0]);
|
||||
skill_formula = Strings::ToInt(row[1]);
|
||||
skill_cap = Strings::ToInt(row[2]);
|
||||
if (Strings::ToInt(row[3]) > skill_cap)
|
||||
skill_cap2 = (Strings::ToInt(row[3])-skill_cap)/10; //Split the post-50 skill cap into difference between pre-50 cap and post-50 cap / 10 to determine amount of points per level.
|
||||
skill_cap3 = Strings::ToInt(row[4]);
|
||||
skill_level = Strings::ToUnsignedInt(row[0]);
|
||||
skill_formula = Strings::ToUnsignedInt(row[1]);
|
||||
skill_cap = Strings::ToUnsignedInt(row[2]);
|
||||
if (Strings::ToUnsignedInt(row[3]) > skill_cap)
|
||||
skill_cap2 = (Strings::ToUnsignedInt(row[3])-skill_cap)/10; //Split the post-50 skill cap into difference between pre-50 cap and post-50 cap / 10 to determine amount of points per level.
|
||||
skill_cap3 = Strings::ToUnsignedInt(row[4]);
|
||||
}
|
||||
|
||||
int race_skill = GetRaceSkill(skillid,in_race);
|
||||
@ -1488,7 +1488,7 @@ uint32 Database::GetGroupID(const char* name){
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
std::string Database::GetGroupLeaderForLogin(std::string character_name) {
|
||||
@ -1638,7 +1638,7 @@ uint8 Database::GetAgreementFlag(uint32 acctid) {
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
void Database::SetAgreementFlag(uint32 acctid) {
|
||||
@ -1724,7 +1724,7 @@ uint32 Database::GetRaidID(const char* name)
|
||||
}
|
||||
|
||||
if (row[0]) // would it ever be possible to have a null here?
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1980,16 +1980,16 @@ bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
as->success.guk = Strings::ToInt(row[0]);
|
||||
as->success.mir = Strings::ToInt(row[1]);
|
||||
as->success.mmc = Strings::ToInt(row[2]);
|
||||
as->success.ruj = Strings::ToInt(row[3]);
|
||||
as->success.tak = Strings::ToInt(row[4]);
|
||||
as->failure.guk = Strings::ToInt(row[5]);
|
||||
as->failure.mir = Strings::ToInt(row[6]);
|
||||
as->failure.mmc = Strings::ToInt(row[7]);
|
||||
as->failure.ruj = Strings::ToInt(row[8]);
|
||||
as->failure.tak = Strings::ToInt(row[9]);
|
||||
as->success.guk = Strings::ToUnsignedInt(row[0]);
|
||||
as->success.mir = Strings::ToUnsignedInt(row[1]);
|
||||
as->success.mmc = Strings::ToUnsignedInt(row[2]);
|
||||
as->success.ruj = Strings::ToUnsignedInt(row[3]);
|
||||
as->success.tak = Strings::ToUnsignedInt(row[4]);
|
||||
as->failure.guk = Strings::ToUnsignedInt(row[5]);
|
||||
as->failure.mir = Strings::ToUnsignedInt(row[6]);
|
||||
as->failure.mmc = Strings::ToUnsignedInt(row[7]);
|
||||
as->failure.ruj = Strings::ToUnsignedInt(row[8]);
|
||||
as->failure.tak = Strings::ToUnsignedInt(row[9]);
|
||||
as->failure.total = as->failure.guk + as->failure.mir + as->failure.mmc + as->failure.ruj + as->failure.tak;
|
||||
as->success.total = as->success.guk + as->success.mir + as->success.mmc + as->success.ruj + as->success.tak;
|
||||
|
||||
@ -2008,7 +2008,7 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::GetGroupIDByCharID(uint32 character_id)
|
||||
@ -2030,7 +2030,7 @@ uint32 Database::GetGroupIDByCharID(uint32 character_id)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::GetRaidIDByCharID(uint32 character_id) {
|
||||
@ -2044,7 +2044,7 @@ uint32 Database::GetRaidIDByCharID(uint32 character_id) {
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2089,17 +2089,17 @@ struct TimeOfDay_Struct Database::LoadTime(time_t &realtime)
|
||||
eqTime.day = 1;
|
||||
eqTime.month = 1;
|
||||
eqTime.year = 3100;
|
||||
realtime = time(0);
|
||||
realtime = time(nullptr);
|
||||
}
|
||||
else{
|
||||
auto row = results.begin();
|
||||
|
||||
eqTime.minute = Strings::ToInt(row[0]);
|
||||
eqTime.hour = Strings::ToInt(row[1]);
|
||||
eqTime.day = Strings::ToInt(row[2]);
|
||||
eqTime.month = Strings::ToInt(row[3]);
|
||||
eqTime.year = Strings::ToInt(row[4]);
|
||||
realtime = Strings::ToInt(row[5]);
|
||||
eqTime.minute = Strings::ToUnsignedInt(row[0]);
|
||||
eqTime.hour = Strings::ToUnsignedInt(row[1]);
|
||||
eqTime.day = Strings::ToUnsignedInt(row[2]);
|
||||
eqTime.month = Strings::ToUnsignedInt(row[3]);
|
||||
eqTime.year = Strings::ToUnsignedInt(row[4]);
|
||||
realtime = Strings::ToBigInt(row[5]);
|
||||
}
|
||||
|
||||
return eqTime;
|
||||
|
||||
@ -937,11 +937,11 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
||||
character_id = Strings::ToInt(row[0]);
|
||||
account_id = Strings::ToInt(row2[4]);
|
||||
/* Convert some data from the character_ table that is still relevant */
|
||||
firstlogon = Strings::ToInt(row2[5]);
|
||||
lfg = Strings::ToInt(row2[6]);
|
||||
lfp = Strings::ToInt(row2[7]);
|
||||
firstlogon = Strings::ToUnsignedInt(row2[5]);
|
||||
lfg = Strings::ToUnsignedInt(row2[6]);
|
||||
lfp = Strings::ToUnsignedInt(row2[7]);
|
||||
mailkey = row2[8];
|
||||
xtargets = Strings::ToInt(row2[9]);
|
||||
xtargets = Strings::ToUnsignedInt(row2[9]);
|
||||
inspectmessage = row2[10];
|
||||
|
||||
/* Verify PP Integrity */
|
||||
@ -1567,7 +1567,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
rquery = StringFormat("SELECT DISTINCT charid FROM character_corpses");
|
||||
results = QueryDatabase(rquery);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string squery = StringFormat("SELECT id, charname, data, time_of_death, is_rezzed FROM character_corpses WHERE `charid` = %i", Strings::ToInt(row[0]));
|
||||
std::string squery = StringFormat("SELECT id, charname, data, time_of_death, is_rezzed FROM character_corpses WHERE `charid` = %i", Strings::ToUnsignedInt(row[0]));
|
||||
auto results2 = QueryDatabase(squery);
|
||||
for (auto row2 = results2.begin(); row2 != results2.end(); ++row2) {
|
||||
in_datasize = results2.LengthOfColumn(2);
|
||||
@ -1599,7 +1599,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
c_type = "NULL";
|
||||
continue;
|
||||
}
|
||||
std::cout << "Converting Corpse: [OK] [" << c_type << "]: " << "ID: " << Strings::ToInt(row2[0]) << std::endl;
|
||||
std::cout << "Converting Corpse: [OK] [" << c_type << "]: " << "ID: " << Strings::ToUnsignedInt(row2[0]) << std::endl;
|
||||
|
||||
if (is_sof){
|
||||
scquery = StringFormat("UPDATE `character_corpses` SET \n"
|
||||
@ -1670,7 +1670,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
dbpc->item_tint[6].color,
|
||||
dbpc->item_tint[7].color,
|
||||
dbpc->item_tint[8].color,
|
||||
Strings::ToInt(row2[0])
|
||||
Strings::ToUnsignedInt(row2[0])
|
||||
);
|
||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||
|
||||
@ -1682,7 +1682,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
|
||||
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
|
||||
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||
Strings::ToInt(row2[0]),
|
||||
Strings::ToUnsignedInt(row2[0]),
|
||||
dbpc->items[i].equipSlot,
|
||||
dbpc->items[i].item_id,
|
||||
dbpc->items[i].charges,
|
||||
@ -1698,7 +1698,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
}
|
||||
else{
|
||||
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||
Strings::ToInt(row2[0]),
|
||||
Strings::ToUnsignedInt(row2[0]),
|
||||
dbpc->items[i].equipSlot,
|
||||
dbpc->items[i].item_id,
|
||||
dbpc->items[i].charges,
|
||||
@ -1778,7 +1778,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
dbpc_c->item_tint[6].color,
|
||||
dbpc_c->item_tint[7].color,
|
||||
dbpc_c->item_tint[8].color,
|
||||
Strings::ToInt(row2[0])
|
||||
Strings::ToUnsignedInt(row2[0])
|
||||
);
|
||||
if (scquery != ""){ auto sc_results = QueryDatabase(scquery); }
|
||||
|
||||
@ -1791,7 +1791,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
scquery = StringFormat("REPLACE INTO `character_corpse_items` \n"
|
||||
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, aug_6, attuned) \n"
|
||||
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||
Strings::ToInt(row2[0]),
|
||||
Strings::ToUnsignedInt(row2[0]),
|
||||
dbpc_c->items[i].equipSlot,
|
||||
dbpc_c->items[i].item_id,
|
||||
dbpc_c->items[i].charges,
|
||||
@ -1807,7 +1807,7 @@ bool Database::CheckDatabaseConvertCorpseDeblob(){
|
||||
}
|
||||
else{
|
||||
scquery = scquery + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u) \n",
|
||||
Strings::ToInt(row2[0]),
|
||||
Strings::ToUnsignedInt(row2[0]),
|
||||
dbpc_c->items[i].equipSlot,
|
||||
dbpc_c->items[i].item_id,
|
||||
dbpc_c->items[i].charges,
|
||||
|
||||
@ -40,7 +40,7 @@ void EQEmuConfig::parse_config()
|
||||
|
||||
if (_root["server"]["world"]["loginserver"].isObject()) {
|
||||
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
|
||||
LoginPort = Strings::ToInt(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
|
||||
LoginPort = Strings::ToUnsignedInt(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
|
||||
LoginLegacy = false;
|
||||
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") { LoginLegacy = true; }
|
||||
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
|
||||
@ -63,7 +63,7 @@ void EQEmuConfig::parse_config()
|
||||
|
||||
auto loginconfig = new LoginConfig;
|
||||
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
|
||||
loginconfig->LoginPort = Strings::ToInt(_root["server"]["world"][str].get("port", "5998").asString().c_str());
|
||||
loginconfig->LoginPort = Strings::ToUnsignedInt(_root["server"]["world"][str].get("port", "5998").asString().c_str());
|
||||
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
|
||||
loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString();
|
||||
|
||||
@ -86,15 +86,15 @@ void EQEmuConfig::parse_config()
|
||||
Locked = false;
|
||||
if (_root["server"]["world"].get("locked", "false").asString() == "true") { Locked = true; }
|
||||
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
|
||||
WorldTCPPort = Strings::ToInt(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str());
|
||||
WorldTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str());
|
||||
|
||||
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
||||
TelnetTCPPort = Strings::ToInt(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
|
||||
TelnetTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
|
||||
TelnetEnabled = false;
|
||||
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") { TelnetEnabled = true; }
|
||||
|
||||
WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString();
|
||||
WorldHTTPPort = Strings::ToInt(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
|
||||
WorldHTTPPort = Strings::ToUnsignedInt(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
|
||||
WorldHTTPEnabled = false;
|
||||
|
||||
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") {
|
||||
@ -109,9 +109,9 @@ void EQEmuConfig::parse_config()
|
||||
* UCS
|
||||
*/
|
||||
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
|
||||
ChatPort = Strings::ToInt(_root["server"]["chatserver"].get("port", "7778").asString().c_str());
|
||||
ChatPort = Strings::ToUnsignedInt(_root["server"]["chatserver"].get("port", "7778").asString().c_str());
|
||||
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
|
||||
MailPort = Strings::ToInt(_root["server"]["mailserver"].get("port", "7778").asString().c_str());
|
||||
MailPort = Strings::ToUnsignedInt(_root["server"]["mailserver"].get("port", "7778").asString().c_str());
|
||||
|
||||
/**
|
||||
* Database
|
||||
@ -119,7 +119,7 @@ void EQEmuConfig::parse_config()
|
||||
DatabaseUsername = _root["server"]["database"].get("username", "eq").asString();
|
||||
DatabasePassword = _root["server"]["database"].get("password", "eq").asString();
|
||||
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
|
||||
DatabasePort = Strings::ToInt(_root["server"]["database"].get("port", "3306").asString().c_str());
|
||||
DatabasePort = Strings::ToUnsignedInt(_root["server"]["database"].get("port", "3306").asString().c_str());
|
||||
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
|
||||
|
||||
/**
|
||||
@ -128,14 +128,14 @@ void EQEmuConfig::parse_config()
|
||||
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
|
||||
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
|
||||
ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
|
||||
ContentDbPort = Strings::ToInt(_root["server"]["content_database"].get("port", 0).asString().c_str());
|
||||
ContentDbPort = Strings::ToUnsignedInt(_root["server"]["content_database"].get("port", 0).asString().c_str());
|
||||
ContentDbName = _root["server"]["content_database"].get("db", "").asString();
|
||||
|
||||
/**
|
||||
* QS
|
||||
*/
|
||||
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
|
||||
QSDatabasePort = Strings::ToInt(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
|
||||
QSDatabasePort = Strings::ToUnsignedInt(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
|
||||
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
||||
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
||||
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
||||
@ -143,9 +143,9 @@ void EQEmuConfig::parse_config()
|
||||
/**
|
||||
* Zones
|
||||
*/
|
||||
DefaultStatus = Strings::ToInt(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str());
|
||||
ZonePortLow = Strings::ToInt(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
|
||||
ZonePortHigh = Strings::ToInt(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
|
||||
DefaultStatus = Strings::ToUnsignedInt(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str());
|
||||
ZonePortLow = Strings::ToUnsignedInt(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
|
||||
ZonePortHigh = Strings::ToUnsignedInt(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
|
||||
|
||||
/**
|
||||
* Files
|
||||
|
||||
@ -61,7 +61,7 @@ bool BaseGuildManager::LoadGuilds() {
|
||||
}
|
||||
|
||||
for (auto row=results.begin();row!=results.end();++row)
|
||||
_CreateGuild(Strings::ToInt(row[0]), row[1], Strings::ToInt(row[2]), Strings::ToInt(row[3]), row[4], row[5], row[6], row[7]);
|
||||
_CreateGuild(Strings::ToUnsignedInt(row[0]), row[1], Strings::ToUnsignedInt(row[2]), Strings::ToUnsignedInt(row[3]), row[4], row[5], row[6], row[7]);
|
||||
|
||||
LogInfo("Loaded [{}] Guilds", Strings::Commify(std::to_string(results.RowCount())));
|
||||
|
||||
@ -75,8 +75,8 @@ bool BaseGuildManager::LoadGuilds() {
|
||||
|
||||
for (auto row=results.begin();row!=results.end();++row)
|
||||
{
|
||||
uint32 guild_id = Strings::ToInt(row[0]);
|
||||
uint8 rankn = Strings::ToInt(row[1]);
|
||||
uint32 guild_id = Strings::ToUnsignedInt(row[0]);
|
||||
uint8 rankn = Strings::ToUnsignedInt(row[1]);
|
||||
|
||||
if(rankn > GUILD_MAX_RANK) {
|
||||
LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
|
||||
@ -131,7 +131,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
info = _CreateGuild(guild_id, row[0], Strings::ToInt(row[1]), Strings::ToInt(row[2]), row[3], row[4], row[5], row[6]);
|
||||
info = _CreateGuild(guild_id, row[0], Strings::ToUnsignedInt(row[1]), Strings::ToUnsignedInt(row[2]), row[3], row[4], row[5], row[6]);
|
||||
|
||||
query = StringFormat("SELECT guild_id, `rank`, title, can_hear, can_speak, can_invite, can_remove, can_promote, can_demote, can_motd, can_warpeace "
|
||||
"FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id);
|
||||
@ -144,7 +144,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
|
||||
|
||||
for (auto row=results.begin();row!=results.end();++row)
|
||||
{
|
||||
uint8 rankn = Strings::ToInt(row[1]);
|
||||
uint8 rankn = Strings::ToUnsignedInt(row[1]);
|
||||
|
||||
if(rankn > GUILD_MAX_RANK) {
|
||||
LogGuilds("Found invalid (too high) rank [{}] for guild [{}], skipping", rankn, guild_id);
|
||||
@ -787,9 +787,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID)
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
bool IsBanker = Strings::ToInt(row[0]);
|
||||
|
||||
return IsBanker;
|
||||
return Strings::ToBool(row[0]);
|
||||
}
|
||||
|
||||
bool BaseGuildManager::DBSetAltFlag(uint32 charid, bool is_alt)
|
||||
@ -817,9 +815,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID)
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
bool IsAlt = Strings::ToInt(row[0]);
|
||||
|
||||
return IsAlt;
|
||||
return Strings::ToBool(row[0]);
|
||||
}
|
||||
|
||||
bool BaseGuildManager::DBSetTributeFlag(uint32 charid, bool enabled) {
|
||||
@ -873,18 +869,18 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) {
|
||||
" FROM `character_data` AS c LEFT JOIN `guild_members` AS g ON c.`id` = g.`char_id` "
|
||||
static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into) {
|
||||
//fields from `characer_`
|
||||
into.char_id = Strings::ToInt(row[0]);
|
||||
into.char_id = Strings::ToUnsignedInt(row[0]);
|
||||
into.char_name = row[1];
|
||||
into.class_ = Strings::ToInt(row[2]);
|
||||
into.level = Strings::ToInt(row[3]);
|
||||
into.class_ = Strings::ToUnsignedInt(row[2]);
|
||||
into.level = Strings::ToUnsignedInt(row[3]);
|
||||
into.time_last_on = Strings::ToUnsignedInt(row[4]);
|
||||
into.zone_id = Strings::ToInt(row[5]);
|
||||
into.zone_id = Strings::ToUnsignedInt(row[5]);
|
||||
|
||||
//fields from `guild_members`, leave at defaults if missing
|
||||
into.guild_id = row[6] ? Strings::ToInt(row[6]) : GUILD_NONE;
|
||||
into.rank = row[7] ? Strings::ToInt(row[7]) : (GUILD_MAX_RANK+1);
|
||||
into.guild_id = row[6] ? Strings::ToUnsignedInt(row[6]) : GUILD_NONE;
|
||||
into.rank = row[7] ? Strings::ToUnsignedInt(row[7]) : (GUILD_MAX_RANK+1);
|
||||
into.tribute_enable = row[8] ? (row[8][0] == '0'?false:true) : false;
|
||||
into.total_tribute = row[9] ? Strings::ToInt(row[9]) : 0;
|
||||
into.total_tribute = row[9] ? Strings::ToUnsignedInt(row[9]) : 0;
|
||||
into.last_tribute = row[10]? Strings::ToUnsignedInt(row[10]) : 0; //timestamp
|
||||
into.banker = row[11]? (row[11][0] == '0'?false:true) : false;
|
||||
into.public_note = row[12]? row[12] : "";
|
||||
|
||||
@ -610,7 +610,7 @@ bool EQ::ItemInstance::UpdateOrnamentationInfo() {
|
||||
SetOrnamentHeroModel(ornamentItem->HerosForgeModel);
|
||||
if (strlen(ornamentItem->IDFile) > 2)
|
||||
{
|
||||
SetOrnamentationIDFile(Strings::ToInt(&ornamentItem->IDFile[2]));
|
||||
SetOrnamentationIDFile(Strings::ToUnsignedInt(&ornamentItem->IDFile[2]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -151,7 +151,7 @@ static char *temp=nullptr;
|
||||
return false;
|
||||
}
|
||||
ptr++;
|
||||
uint32 id = Strings::ToInt(field[id_pos].c_str());
|
||||
uint32 id = Strings::ToUnsignedInt(field[id_pos].c_str());
|
||||
items[id]=field;
|
||||
|
||||
for(i=0;i<10;i++) {
|
||||
|
||||
@ -131,7 +131,7 @@ bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf
|
||||
if (*oIP == 0)
|
||||
return false;
|
||||
if (oPort)
|
||||
*oPort = Strings::ToInt(sep.arg[1]);
|
||||
*oPort = Strings::ToUnsignedInt(sep.arg[1]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -288,9 +288,9 @@ bool PTimerList::Load(Database *db) {
|
||||
PersistentTimer *cur;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
type = Strings::ToInt(row[0]);
|
||||
start_time = strtoul(row[1], nullptr, 10);
|
||||
timer_time = strtoul(row[2], nullptr, 10);
|
||||
type = Strings::ToUnsignedInt(row[0]);
|
||||
start_time = Strings::ToUnsignedInt(row[1]);
|
||||
timer_time = Strings::ToUnsignedInt(row[2]);
|
||||
enabled = (row[3][0] == '1');
|
||||
|
||||
//if it expired allready, dont bother.
|
||||
|
||||
@ -126,7 +126,7 @@ uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) {
|
||||
const std::string query = StringFormat("SELECT `time_played` FROM `character_data` WHERE `account_id` = %u", AccountID);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
EntitledTime += Strings::ToInt(row[0]);
|
||||
EntitledTime += Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
return EntitledTime;
|
||||
}
|
||||
@ -228,8 +228,8 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const EQ:
|
||||
|
||||
auto& row = results.begin();
|
||||
|
||||
const uint32 id = Strings::ToInt(row[0]);
|
||||
const uint16 charges = Strings::ToInt(row[1]);
|
||||
const uint32 id = Strings::ToUnsignedInt(row[0]);
|
||||
const uint16 charges = Strings::ToUnsignedInt(row[1]);
|
||||
|
||||
uint16 expect_charges;
|
||||
|
||||
@ -519,16 +519,16 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is
|
||||
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
int16 slot_id = static_cast<int16>(Strings::ToInt(row[0]));
|
||||
uint32 item_id = static_cast<uint32>(Strings::ToInt(row[1]));
|
||||
uint32 item_id = Strings::ToUnsignedInt(row[1]);
|
||||
const int16 charges = static_cast<int16>(Strings::ToInt(row[2]));
|
||||
|
||||
uint32 aug[EQ::invaug::SOCKET_COUNT];
|
||||
aug[0] = static_cast<uint32>(Strings::ToInt(row[3]));
|
||||
aug[1] = static_cast<uint32>(Strings::ToInt(row[4]));
|
||||
aug[2] = static_cast<uint32>(Strings::ToInt(row[5]));
|
||||
aug[3] = static_cast<uint32>(Strings::ToInt(row[6]));
|
||||
aug[4] = static_cast<uint32>(Strings::ToInt(row[7]));
|
||||
aug[5] = static_cast<uint32>(Strings::ToInt(row[8]));
|
||||
aug[0] = Strings::ToUnsignedInt(row[3]);
|
||||
aug[1] = Strings::ToUnsignedInt(row[4]);
|
||||
aug[2] = Strings::ToUnsignedInt(row[5]);
|
||||
aug[3] = Strings::ToUnsignedInt(row[6]);
|
||||
aug[4] = Strings::ToUnsignedInt(row[7]);
|
||||
aug[5] = Strings::ToUnsignedInt(row[8]);
|
||||
|
||||
const EQ::ItemData *item = GetItem(item_id);
|
||||
|
||||
@ -645,8 +645,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 item_id = Strings::ToInt(row[1]);
|
||||
const uint16 charges = Strings::ToInt(row[2]);
|
||||
uint32 item_id = Strings::ToUnsignedInt(row[1]);
|
||||
const uint16 charges = Strings::ToUnsignedInt(row[2]);
|
||||
const uint32 color = Strings::ToUnsignedInt(row[3]);
|
||||
|
||||
uint32 aug[EQ::invaug::SOCKET_COUNT];
|
||||
@ -658,7 +658,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
aug[4] = Strings::ToUnsignedInt(row[8]);
|
||||
aug[5] = Strings::ToUnsignedInt(row[9]);
|
||||
|
||||
const bool instnodrop = (row[10] && static_cast<uint16>(Strings::ToInt(row[10]))) ? true : false;
|
||||
const bool instnodrop = (row[10] && static_cast<uint16>(Strings::ToUnsignedInt(row[10])));
|
||||
|
||||
const uint32 ornament_icon = Strings::ToUnsignedInt(row[12]);
|
||||
const uint32 ornament_idfile = Strings::ToUnsignedInt(row[13]);
|
||||
@ -795,19 +795,19 @@ bool SharedDatabase::GetInventory(uint32 account_id, char *name, EQ::InventoryPr
|
||||
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
int16 slot_id = Strings::ToInt(row[0]);
|
||||
uint32 item_id = Strings::ToInt(row[1]);
|
||||
uint32 item_id = Strings::ToUnsignedInt(row[1]);
|
||||
const int8 charges = Strings::ToInt(row[2]);
|
||||
const uint32 color = Strings::ToUnsignedInt(row[3]);
|
||||
|
||||
uint32 aug[EQ::invaug::SOCKET_COUNT];
|
||||
aug[0] = static_cast<uint32>(Strings::ToInt(row[4]));
|
||||
aug[1] = static_cast<uint32>(Strings::ToInt(row[5]));
|
||||
aug[2] = static_cast<uint32>(Strings::ToInt(row[6]));
|
||||
aug[3] = static_cast<uint32>(Strings::ToInt(row[7]));
|
||||
aug[4] = static_cast<uint32>(Strings::ToInt(row[8]));
|
||||
aug[5] = static_cast<uint32>(Strings::ToInt(row[9]));
|
||||
aug[0] = Strings::ToUnsignedInt(row[4]);
|
||||
aug[1] = Strings::ToUnsignedInt(row[5]);
|
||||
aug[2] = Strings::ToUnsignedInt(row[6]);
|
||||
aug[3] = Strings::ToUnsignedInt(row[7]);
|
||||
aug[4] = Strings::ToUnsignedInt(row[8]);
|
||||
aug[5] = Strings::ToUnsignedInt(row[9]);
|
||||
|
||||
const bool instnodrop = (row[10] && static_cast<uint16>(Strings::ToInt(row[10]))) ? true : false;
|
||||
const bool instnodrop = (row[10] && static_cast<uint16>(Strings::ToUnsignedInt(row[10])));
|
||||
const uint32 ornament_icon = Strings::ToUnsignedInt(row[12]);
|
||||
const uint32 ornament_idfile = Strings::ToUnsignedInt(row[13]);
|
||||
uint32 ornament_hero_model = Strings::ToUnsignedInt(row[14]);
|
||||
@ -905,7 +905,7 @@ uint32 SharedDatabase::GetItemRecastTimestamp(uint32 char_id, uint32 recast_type
|
||||
return 0;
|
||||
|
||||
auto& row = results.begin();
|
||||
return static_cast<uint32>(Strings::ToUnsignedInt(row[0]));
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
void SharedDatabase::ClearOldRecastTimestamps(uint32 char_id)
|
||||
@ -933,10 +933,10 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id)
|
||||
auto& row = results.begin();
|
||||
|
||||
if (row[0])
|
||||
max_id = Strings::ToInt(row[0]);
|
||||
max_id = Strings::ToUnsignedInt(row[0]);
|
||||
|
||||
if (row[1])
|
||||
item_count = Strings::ToInt(row[1]);
|
||||
item_count = Strings::ToUnsignedInt(row[1]);
|
||||
}
|
||||
|
||||
bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
@ -1025,24 +1025,24 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
strn0cpy(item.Lore, row[ItemField::lore], sizeof(item.Lore));
|
||||
|
||||
// Flags
|
||||
item.ArtifactFlag = Strings::ToInt(row[ItemField::artifactflag]) ? true : false;
|
||||
item.Attuneable = disable_attuneable ? false : Strings::ToInt(row[ItemField::attuneable]) ? true : false;
|
||||
item.BenefitFlag = Strings::ToInt(row[ItemField::benefitflag]) ? true : false;
|
||||
item.FVNoDrop = Strings::ToInt(row[ItemField::fvnodrop]) ? true : false;
|
||||
item.Magic = Strings::ToInt(row[ItemField::magic]) ? true : false;
|
||||
item.ArtifactFlag = Strings::ToBool(row[ItemField::artifactflag]);
|
||||
item.Attuneable = !disable_attuneable && Strings::ToInt(row[ItemField::attuneable]) != 0;
|
||||
item.BenefitFlag = Strings::ToBool(row[ItemField::benefitflag]) != 0;
|
||||
item.FVNoDrop = Strings::ToInt(row[ItemField::fvnodrop]) != 0;
|
||||
item.Magic = Strings::ToBool(row[ItemField::magic]) != 0;
|
||||
item.NoDrop = disable_no_drop ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::nodrop]));
|
||||
item.NoPet = disable_no_pet ? false : Strings::ToInt(row[ItemField::nopet]) ? true : false;
|
||||
item.NoPet = !disable_no_pet && Strings::ToBool(row[ItemField::nopet]);
|
||||
item.NoRent = disable_no_rent ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::norent]));
|
||||
item.NoTransfer = disable_no_transfer ? false : Strings::ToInt(row[ItemField::notransfer]) ? true : false;
|
||||
item.PendingLoreFlag = Strings::ToInt(row[ItemField::pendingloreflag]) ? true : false;
|
||||
item.QuestItemFlag = Strings::ToInt(row[ItemField::questitemflag]) ? true : false;
|
||||
item.Stackable = Strings::ToInt(row[ItemField::stackable]) ? true : false;
|
||||
item.Tradeskills = Strings::ToInt(row[ItemField::tradeskills]) ? true : false;
|
||||
item.SummonedFlag = Strings::ToInt(row[ItemField::summonedflag]) ? true : false;
|
||||
item.NoTransfer = !disable_no_transfer && Strings::ToBool(row[ItemField::notransfer]);
|
||||
item.PendingLoreFlag = Strings::ToBool(row[ItemField::pendingloreflag]);
|
||||
item.QuestItemFlag = Strings::ToBool(row[ItemField::questitemflag]);
|
||||
item.Stackable = Strings::ToBool(row[ItemField::stackable]);
|
||||
item.Tradeskills = Strings::ToBool(row[ItemField::tradeskills]);
|
||||
item.SummonedFlag = Strings::ToBool(row[ItemField::summonedflag]);
|
||||
|
||||
// Lore
|
||||
item.LoreGroup = disable_lore ? 0 : Strings::ToInt(row[ItemField::loregroup]);
|
||||
item.LoreFlag = disable_lore ? false : item.LoreGroup != 0;
|
||||
item.LoreFlag = !disable_lore && item.LoreGroup != 0;
|
||||
|
||||
// Type
|
||||
item.AugType = Strings::ToUnsignedInt(row[ItemField::augtype]);
|
||||
@ -1058,7 +1058,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
item.Weight = Strings::ToInt(row[ItemField::weight]);
|
||||
|
||||
// Potion Belt
|
||||
item.PotionBelt = disable_potion_belt ? false : Strings::ToInt(row[ItemField::potionbelt]) ? true : false;
|
||||
item.PotionBelt = !disable_potion_belt && Strings::ToBool(row[ItemField::potionbelt]);
|
||||
item.PotionBeltSlots = disable_potion_belt ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::potionbeltslots]));
|
||||
|
||||
// Merchant
|
||||
@ -1369,8 +1369,8 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) {
|
||||
|
||||
auto& row = results.begin();
|
||||
|
||||
list_count = static_cast<uint32>(Strings::ToUnsignedInt(row[0]));
|
||||
max_lists = static_cast<uint32>(Strings::ToUnsignedInt(row[1] ? row[1] : "0"));
|
||||
list_count = Strings::ToUnsignedInt(row[0]);
|
||||
max_lists = Strings::ToUnsignedInt(row[1] ? row[1] : "0");
|
||||
}
|
||||
|
||||
const NPCFactionList* SharedDatabase::GetNPCFactionEntry(uint32 id) const
|
||||
@ -1403,7 +1403,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co
|
||||
uint32 current_entry = 0;
|
||||
|
||||
for(auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const uint32 id = static_cast<uint32>(Strings::ToUnsignedInt(row[0]));
|
||||
const uint32 id = Strings::ToUnsignedInt(row[0]);
|
||||
if(id != current_id) {
|
||||
if(current_id != 0) {
|
||||
hash.insert(current_id, faction);
|
||||
@ -1413,7 +1413,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co
|
||||
current_entry = 0;
|
||||
current_id = id;
|
||||
faction.id = id;
|
||||
faction.primaryfaction = static_cast<uint32>(Strings::ToUnsignedInt(row[1]));
|
||||
faction.primaryfaction = Strings::ToUnsignedInt(row[1]);
|
||||
faction.assistprimaryfaction = (Strings::ToInt(row[2]) == 0);
|
||||
}
|
||||
|
||||
@ -1423,10 +1423,10 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co
|
||||
if(current_entry >= MAX_NPC_FACTIONS)
|
||||
continue;
|
||||
|
||||
faction.factionid[current_entry] = static_cast<uint32>(Strings::ToUnsignedInt(row[3]));
|
||||
faction.factionvalue[current_entry] = static_cast<int32>(Strings::ToInt(row[4]));
|
||||
faction.factionid[current_entry] = Strings::ToUnsignedInt(row[3]);
|
||||
faction.factionvalue[current_entry] = Strings::ToInt(row[4]);
|
||||
faction.factionnpcvalue[current_entry] = static_cast<int8>(Strings::ToInt(row[5]));
|
||||
faction.factiontemp[current_entry] = static_cast<uint8>(Strings::ToInt(row[6]));
|
||||
faction.factiontemp[current_entry] = static_cast<uint8>(Strings::ToUnsignedInt(row[6]));
|
||||
++current_entry;
|
||||
}
|
||||
|
||||
@ -1664,7 +1664,7 @@ bool SharedDatabase::GetCommandSettings(std::map<std::string, std::pair<uint8, s
|
||||
return false;
|
||||
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
command_settings[row[0]].first = Strings::ToInt(row[1]);
|
||||
command_settings[row[0]].first = Strings::ToUnsignedInt(row[1]);
|
||||
if (row[2][0] == 0)
|
||||
continue;
|
||||
|
||||
@ -1762,10 +1762,10 @@ void SharedDatabase::LoadSkillCaps(void *data) {
|
||||
}
|
||||
|
||||
for(auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const uint8 skillID = Strings::ToInt(row[0]);
|
||||
const uint8 class_ = Strings::ToInt(row[1]) - 1;
|
||||
const uint8 level = Strings::ToInt(row[2]);
|
||||
const uint16 cap = Strings::ToInt(row[3]);
|
||||
const uint8 skillID = Strings::ToUnsignedInt(row[0]);
|
||||
const uint8 class_ = Strings::ToUnsignedInt(row[1]) - 1;
|
||||
const uint8 level = Strings::ToUnsignedInt(row[2]);
|
||||
const uint16 cap = Strings::ToUnsignedInt(row[3]);
|
||||
|
||||
if(skillID >= skill_count || class_ >= class_count || level >= level_count)
|
||||
continue;
|
||||
@ -1866,7 +1866,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe
|
||||
for(auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const int spellID = Strings::ToInt(row[0]);
|
||||
if((spellID > 0) && (spellID <= iMaxSpellID))
|
||||
sp[spellID].damage_shield_type = Strings::ToInt(row[1]);
|
||||
sp[spellID].damage_shield_type = Strings::ToUnsignedInt(row[1]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1947,16 +1947,16 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
strn0cpy(sp[tempid].cast_on_other, row[7], sizeof(sp[tempid].cast_on_other));
|
||||
strn0cpy(sp[tempid].spell_fades, row[8], sizeof(sp[tempid].spell_fades));
|
||||
|
||||
sp[tempid].range=static_cast<float>(Strings::ToFloat(row[9]));
|
||||
sp[tempid].aoe_range=static_cast<float>(Strings::ToFloat(row[10]));
|
||||
sp[tempid].push_back=static_cast<float>(Strings::ToFloat(row[11]));
|
||||
sp[tempid].push_up=static_cast<float>(Strings::ToFloat(row[12]));
|
||||
sp[tempid].cast_time=Strings::ToInt(row[13]);
|
||||
sp[tempid].recovery_time=Strings::ToInt(row[14]);
|
||||
sp[tempid].recast_time=Strings::ToInt(row[15]);
|
||||
sp[tempid].buff_duration_formula=Strings::ToInt(row[16]);
|
||||
sp[tempid].buff_duration=Strings::ToInt(row[17]);
|
||||
sp[tempid].aoe_duration=Strings::ToInt(row[18]);
|
||||
sp[tempid].range = Strings::ToFloat(row[9]);
|
||||
sp[tempid].aoe_range = Strings::ToFloat(row[10]);
|
||||
sp[tempid].push_back = Strings::ToFloat(row[11]);
|
||||
sp[tempid].push_up = Strings::ToFloat(row[12]);
|
||||
sp[tempid].cast_time=Strings::ToUnsignedInt(row[13]);
|
||||
sp[tempid].recovery_time=Strings::ToUnsignedInt(row[14]);
|
||||
sp[tempid].recast_time=Strings::ToUnsignedInt(row[15]);
|
||||
sp[tempid].buff_duration_formula=Strings::ToUnsignedInt(row[16]);
|
||||
sp[tempid].buff_duration=Strings::ToUnsignedInt(row[17]);
|
||||
sp[tempid].aoe_duration=Strings::ToUnsignedInt(row[18]);
|
||||
sp[tempid].mana=Strings::ToInt(row[19]);
|
||||
|
||||
int y=0;
|
||||
@ -1979,7 +1979,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
sp[tempid].no_expend_reagent[y]=Strings::ToInt(row[66+y]);
|
||||
|
||||
for(y=0; y< EFFECT_COUNT;y++)
|
||||
sp[tempid].formula[y]=Strings::ToInt(row[70+y]);
|
||||
sp[tempid].formula[y]=Strings::ToUnsignedInt(row[70+y]);
|
||||
|
||||
sp[tempid].good_effect=Strings::ToInt(row[83]);
|
||||
sp[tempid].activated=Strings::ToInt(row[84]);
|
||||
@ -2014,51 +2014,51 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
sp[tempid].deities[y]=Strings::ToInt(row[126+y]);
|
||||
|
||||
sp[tempid].new_icon=Strings::ToInt(row[144]);
|
||||
sp[tempid].uninterruptable=Strings::ToInt(row[146]) != 0;
|
||||
sp[tempid].uninterruptable=Strings::ToBool(row[146]);
|
||||
sp[tempid].resist_difficulty=Strings::ToInt(row[147]);
|
||||
sp[tempid].unstackable_dot = Strings::ToInt(row[148]) != 0;
|
||||
sp[tempid].recourse_link = Strings::ToInt(row[150]);
|
||||
sp[tempid].no_partial_resist = Strings::ToInt(row[151]) != 0;
|
||||
sp[tempid].unstackable_dot = Strings::ToBool(row[148]);
|
||||
sp[tempid].recourse_link = Strings::ToUnsignedInt(row[150]);
|
||||
sp[tempid].no_partial_resist = Strings::ToBool(row[151]);
|
||||
|
||||
sp[tempid].short_buff_box = Strings::ToInt(row[154]);
|
||||
sp[tempid].description_id = Strings::ToInt(row[155]);
|
||||
sp[tempid].type_description_id = Strings::ToInt(row[156]);
|
||||
sp[tempid].effect_description_id = Strings::ToInt(row[157]);
|
||||
|
||||
sp[tempid].npc_no_los = Strings::ToInt(row[159]) != 0;
|
||||
sp[tempid].feedbackable = Strings::ToInt(row[160]) != 0;
|
||||
sp[tempid].reflectable = Strings::ToInt(row[161]) != 0;
|
||||
sp[tempid].npc_no_los = Strings::ToBool(row[159]);
|
||||
sp[tempid].feedbackable = Strings::ToBool(row[160]);
|
||||
sp[tempid].reflectable = Strings::ToBool(row[161]);
|
||||
sp[tempid].bonus_hate=Strings::ToInt(row[162]);
|
||||
|
||||
sp[tempid].ldon_trap = Strings::ToInt(row[165]) != 0;
|
||||
sp[tempid].endurance_cost=Strings::ToInt(row[166]);
|
||||
sp[tempid].timer_id=Strings::ToInt(row[167]);
|
||||
sp[tempid].is_discipline = Strings::ToInt(row[168]) != 0;
|
||||
sp[tempid].hate_added=Strings::ToInt(row[173]);
|
||||
sp[tempid].ldon_trap = Strings::ToBool(row[165]);
|
||||
sp[tempid].endurance_cost= Strings::ToInt(row[166]);
|
||||
sp[tempid].timer_id= Strings::ToInt(row[167]);
|
||||
sp[tempid].is_discipline = Strings::ToBool(row[168]);
|
||||
sp[tempid].hate_added= Strings::ToInt(row[173]);
|
||||
sp[tempid].endurance_upkeep=Strings::ToInt(row[174]);
|
||||
sp[tempid].hit_number_type = Strings::ToInt(row[175]);
|
||||
sp[tempid].hit_number = Strings::ToInt(row[176]);
|
||||
sp[tempid].pvp_resist_base=Strings::ToInt(row[177]);
|
||||
sp[tempid].pvp_resist_per_level=Strings::ToInt(row[178]);
|
||||
sp[tempid].pvp_resist_cap=Strings::ToInt(row[179]);
|
||||
sp[tempid].spell_category=Strings::ToInt(row[180]);
|
||||
sp[tempid].pvp_resist_base= Strings::ToInt(row[177]);
|
||||
sp[tempid].pvp_resist_per_level= Strings::ToInt(row[178]);
|
||||
sp[tempid].pvp_resist_cap= Strings::ToInt(row[179]);
|
||||
sp[tempid].spell_category= Strings::ToInt(row[180]);
|
||||
sp[tempid].pvp_duration = Strings::ToInt(row[181]);
|
||||
sp[tempid].pvp_duration_cap = Strings::ToInt(row[182]);
|
||||
sp[tempid].pcnpc_only_flag=Strings::ToInt(row[183]);
|
||||
sp[tempid].pcnpc_only_flag= Strings::ToInt(row[183]);
|
||||
sp[tempid].cast_not_standing = Strings::ToInt(row[184]) != 0;
|
||||
sp[tempid].can_mgb=Strings::ToInt(row[185]);
|
||||
sp[tempid].can_mgb= Strings::ToBool(row[185]);
|
||||
sp[tempid].dispel_flag = Strings::ToInt(row[186]);
|
||||
sp[tempid].min_resist = Strings::ToInt(row[189]);
|
||||
sp[tempid].max_resist = Strings::ToInt(row[190]);
|
||||
sp[tempid].viral_targets = Strings::ToInt(row[191]);
|
||||
sp[tempid].viral_timer = Strings::ToInt(row[192]);
|
||||
sp[tempid].nimbus_effect = Strings::ToInt(row[193]);
|
||||
sp[tempid].directional_start = static_cast<float>(Strings::ToInt(row[194]));
|
||||
sp[tempid].directional_end = static_cast<float>(Strings::ToInt(row[195]));
|
||||
sp[tempid].sneak = Strings::ToInt(row[196]) != 0;
|
||||
sp[tempid].not_focusable = Strings::ToInt(row[197]) != 0;
|
||||
sp[tempid].no_detrimental_spell_aggro = Strings::ToInt(row[198]) != 0;
|
||||
sp[tempid].suspendable = Strings::ToInt(row[200]) != 0;
|
||||
sp[tempid].directional_start = Strings::ToFloat(row[194]);
|
||||
sp[tempid].directional_end = Strings::ToFloat(row[195]);
|
||||
sp[tempid].sneak = Strings::ToBool(row[196]);
|
||||
sp[tempid].not_focusable = Strings::ToBool(row[197]);
|
||||
sp[tempid].no_detrimental_spell_aggro = Strings::ToBool(row[198]);
|
||||
sp[tempid].suspendable = Strings::ToBool(row[200]);
|
||||
sp[tempid].viral_range = Strings::ToInt(row[201]);
|
||||
sp[tempid].song_cap = Strings::ToInt(row[202]);
|
||||
sp[tempid].no_block = Strings::ToInt(row[205]);
|
||||
@ -2066,22 +2066,22 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
sp[tempid].rank = Strings::ToInt(row[208]);
|
||||
sp[tempid].no_resist=Strings::ToInt(row[209]);
|
||||
sp[tempid].cast_restriction = Strings::ToInt(row[211]);
|
||||
sp[tempid].allow_rest = Strings::ToInt(row[212]) != 0;
|
||||
sp[tempid].can_cast_in_combat = Strings::ToInt(row[213]) != 0;
|
||||
sp[tempid].can_cast_out_of_combat = Strings::ToInt(row[214]) != 0;
|
||||
sp[tempid].allow_rest = Strings::ToBool(row[212]);
|
||||
sp[tempid].can_cast_in_combat = Strings::ToBool(row[213]);
|
||||
sp[tempid].can_cast_out_of_combat = Strings::ToBool(row[214]);
|
||||
sp[tempid].override_crit_chance = Strings::ToInt(row[217]);
|
||||
sp[tempid].aoe_max_targets = Strings::ToInt(row[218]);
|
||||
sp[tempid].no_heal_damage_item_mod = Strings::ToInt(row[219]);
|
||||
sp[tempid].caster_requirement_id = Strings::ToInt(row[220]);
|
||||
sp[tempid].spell_class = Strings::ToInt(row[221]);
|
||||
sp[tempid].spell_subclass = Strings::ToInt(row[222]);
|
||||
sp[tempid].persist_death = Strings::ToInt(row[224]) != 0;
|
||||
sp[tempid].min_distance = static_cast<float>(Strings::ToFloat(row[227]));
|
||||
sp[tempid].min_distance_mod = static_cast<float>(Strings::ToFloat(row[228]));
|
||||
sp[tempid].max_distance = static_cast<float>(Strings::ToFloat(row[229]));
|
||||
sp[tempid].max_distance_mod = static_cast<float>(Strings::ToFloat(row[230]));
|
||||
sp[tempid].min_range = static_cast<float>(Strings::ToInt(row[231]));
|
||||
sp[tempid].no_remove = Strings::ToInt(row[232]) != 0;
|
||||
sp[tempid].persist_death = Strings::ToBool(row[224]);
|
||||
sp[tempid].min_distance = Strings::ToFloat(row[227]);
|
||||
sp[tempid].min_distance_mod = Strings::ToFloat(row[228]);
|
||||
sp[tempid].max_distance = Strings::ToFloat(row[229]);
|
||||
sp[tempid].max_distance_mod = Strings::ToFloat(row[230]);
|
||||
sp[tempid].min_range = Strings::ToFloat(row[231]);
|
||||
sp[tempid].no_remove = Strings::ToBool(row[232]);
|
||||
sp[tempid].damage_shield_type = 0;
|
||||
}
|
||||
|
||||
@ -2218,9 +2218,9 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot
|
||||
|
||||
auto& row = results.begin();
|
||||
|
||||
loot_table_count = static_cast<uint32>(Strings::ToUnsignedInt(row[0]));
|
||||
max_loot_table = static_cast<uint32>(Strings::ToUnsignedInt(row[1] ? row[1] : "0"));
|
||||
loot_table_entries = static_cast<uint32>(Strings::ToUnsignedInt(row[2]));
|
||||
loot_table_count = Strings::ToUnsignedInt(row[0]);
|
||||
max_loot_table = Strings::ToUnsignedInt(row[1] ? row[1] : "0");
|
||||
loot_table_entries = Strings::ToUnsignedInt(row[2]);
|
||||
}
|
||||
|
||||
void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_drop, uint32 &loot_drop_entries) {
|
||||
@ -2243,9 +2243,9 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d
|
||||
|
||||
auto& row =results.begin();
|
||||
|
||||
loot_drop_count = static_cast<uint32>(Strings::ToUnsignedInt(row[0]));
|
||||
max_loot_drop = static_cast<uint32>(Strings::ToUnsignedInt(row[1] ? row[1] : "0"));
|
||||
loot_drop_entries = static_cast<uint32>(Strings::ToUnsignedInt(row[2]));
|
||||
loot_drop_count = Strings::ToUnsignedInt(row[0]);
|
||||
max_loot_drop = Strings::ToUnsignedInt(row[1] ? row[1] : "0");
|
||||
loot_drop_entries = Strings::ToUnsignedInt(row[2]);
|
||||
}
|
||||
|
||||
void SharedDatabase::LoadLootTables(void *data, uint32 size) {
|
||||
@ -2289,7 +2289,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) {
|
||||
uint32 current_entry = 0;
|
||||
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const uint32 id = static_cast<uint32>(Strings::ToUnsignedInt(row[0]));
|
||||
const uint32 id = Strings::ToUnsignedInt(row[0]);
|
||||
if (id != current_id) {
|
||||
if (current_id != 0) {
|
||||
hash.insert(
|
||||
@ -2301,9 +2301,9 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) {
|
||||
memset(loot_table, 0, sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * 128));
|
||||
current_entry = 0;
|
||||
current_id = id;
|
||||
lt->mincash = static_cast<uint32>(Strings::ToUnsignedInt(row[1]));
|
||||
lt->maxcash = static_cast<uint32>(Strings::ToUnsignedInt(row[2]));
|
||||
lt->avgcoin = static_cast<uint32>(Strings::ToUnsignedInt(row[3]));
|
||||
lt->mincash = Strings::ToUnsignedInt(row[1]);
|
||||
lt->maxcash = Strings::ToUnsignedInt(row[2]);
|
||||
lt->avgcoin = Strings::ToUnsignedInt(row[3]);
|
||||
|
||||
lt->content_flags.min_expansion = static_cast<int16>(Strings::ToInt(row[9]));
|
||||
lt->content_flags.max_expansion = static_cast<int16>(Strings::ToInt(row[10]));
|
||||
@ -2320,11 +2320,11 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lt->Entries[current_entry].lootdrop_id = static_cast<uint32>(Strings::ToUnsignedInt(row[4]));
|
||||
lt->Entries[current_entry].multiplier = static_cast<uint8>(Strings::ToInt(row[5]));
|
||||
lt->Entries[current_entry].droplimit = static_cast<uint8>(Strings::ToInt(row[6]));
|
||||
lt->Entries[current_entry].mindrop = static_cast<uint8>(Strings::ToInt(row[7]));
|
||||
lt->Entries[current_entry].probability = static_cast<float>(Strings::ToFloat(row[8]));
|
||||
lt->Entries[current_entry].lootdrop_id = Strings::ToUnsignedInt(row[4]);
|
||||
lt->Entries[current_entry].multiplier = static_cast<uint8>(Strings::ToUnsignedInt(row[5]));
|
||||
lt->Entries[current_entry].droplimit = static_cast<uint8>(Strings::ToUnsignedInt(row[6]));
|
||||
lt->Entries[current_entry].mindrop = static_cast<uint8>(Strings::ToUnsignedInt(row[7]));
|
||||
lt->Entries[current_entry].probability = Strings::ToFloat(row[8]);
|
||||
|
||||
++(lt->NumEntries);
|
||||
++current_entry;
|
||||
@ -2383,7 +2383,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) {
|
||||
uint32 current_entry = 0;
|
||||
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const auto id = static_cast<uint32>(Strings::ToUnsignedInt(row[0]));
|
||||
const auto id = Strings::ToUnsignedInt(row[0]);
|
||||
if (id != current_id) {
|
||||
if (current_id != 0) {
|
||||
hash.insert(
|
||||
@ -2397,7 +2397,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) {
|
||||
current_id = id;
|
||||
|
||||
p_loot_drop_struct->content_flags.min_expansion = static_cast<int16>(Strings::ToInt(row[10]));
|
||||
p_loot_drop_struct->content_flags.max_expansion = static_cast<int16>(Strings::ToInt(row[11]));
|
||||
p_loot_drop_struct->content_flags.max_expansion = static_cast<int16>(Strings::ToUnsignedInt(row[11]));
|
||||
|
||||
strn0cpy(p_loot_drop_struct->content_flags.content_flags, row[12], sizeof(p_loot_drop_struct->content_flags.content_flags));
|
||||
strn0cpy(p_loot_drop_struct->content_flags.content_flags_disabled, row[13], sizeof(p_loot_drop_struct->content_flags.content_flags_disabled));
|
||||
@ -2407,15 +2407,15 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) {
|
||||
continue;
|
||||
}
|
||||
|
||||
p_loot_drop_struct->Entries[current_entry].item_id = static_cast<uint32>(Strings::ToUnsignedInt(row[1]));
|
||||
p_loot_drop_struct->Entries[current_entry].item_charges = static_cast<int8>(Strings::ToInt(row[2]));
|
||||
p_loot_drop_struct->Entries[current_entry].equip_item = static_cast<uint8>(Strings::ToInt(row[3]));
|
||||
p_loot_drop_struct->Entries[current_entry].chance = static_cast<float>(Strings::ToFloat(row[4]));
|
||||
p_loot_drop_struct->Entries[current_entry].trivial_min_level = static_cast<uint16>(Strings::ToInt(row[5]));
|
||||
p_loot_drop_struct->Entries[current_entry].trivial_max_level = static_cast<uint16>(Strings::ToInt(row[6]));
|
||||
p_loot_drop_struct->Entries[current_entry].npc_min_level = static_cast<uint16>(Strings::ToInt(row[7]));
|
||||
p_loot_drop_struct->Entries[current_entry].npc_max_level = static_cast<uint16>(Strings::ToInt(row[8]));
|
||||
p_loot_drop_struct->Entries[current_entry].multiplier = static_cast<uint8>(Strings::ToInt(row[9]));
|
||||
p_loot_drop_struct->Entries[current_entry].item_id = Strings::ToUnsignedInt(row[1]);
|
||||
p_loot_drop_struct->Entries[current_entry].item_charges = static_cast<int8>(Strings::ToUnsignedInt(row[2]));
|
||||
p_loot_drop_struct->Entries[current_entry].equip_item = static_cast<uint8>(Strings::ToUnsignedInt(row[3]));
|
||||
p_loot_drop_struct->Entries[current_entry].chance = Strings::ToFloat(row[4]);
|
||||
p_loot_drop_struct->Entries[current_entry].trivial_min_level = static_cast<uint16>(Strings::ToUnsignedInt(row[5]));
|
||||
p_loot_drop_struct->Entries[current_entry].trivial_max_level = static_cast<uint16>(Strings::ToUnsignedInt(row[6]));
|
||||
p_loot_drop_struct->Entries[current_entry].npc_min_level = static_cast<uint16>(Strings::ToUnsignedInt(row[7]));
|
||||
p_loot_drop_struct->Entries[current_entry].npc_max_level = static_cast<uint16>(Strings::ToUnsignedInt(row[8]));
|
||||
p_loot_drop_struct->Entries[current_entry].multiplier = static_cast<uint8>(Strings::ToUnsignedInt(row[9]));
|
||||
|
||||
++(p_loot_drop_struct->NumEntries);
|
||||
++current_entry;
|
||||
|
||||
@ -115,7 +115,7 @@ Strings::SearchDelim(const std::string &haystack, const std::string &needle, con
|
||||
}
|
||||
|
||||
|
||||
std::string Strings::Implode(std::string glue, std::vector<std::string> src)
|
||||
std::string Strings::Implode(const std::string& glue, std::vector<std::string> src)
|
||||
{
|
||||
if (src.empty()) {
|
||||
return {};
|
||||
@ -272,7 +272,7 @@ std::string Strings::Repeat(std::string s, int n)
|
||||
return s;
|
||||
}
|
||||
|
||||
bool Strings::Contains(std::vector<std::string> container, std::string element)
|
||||
bool Strings::Contains(std::vector<std::string> container, const std::string& element)
|
||||
{
|
||||
return std::find(container.begin(), container.end(), element) != container.end();
|
||||
}
|
||||
@ -316,7 +316,7 @@ const std::string Strings::ToUpper(std::string s)
|
||||
);
|
||||
return s;
|
||||
}
|
||||
const std::string Strings::UcFirst(std::string s)
|
||||
const std::string Strings::UcFirst(const std::string& s)
|
||||
{
|
||||
std::string output = s;
|
||||
if (!s.empty()) {
|
||||
@ -327,7 +327,7 @@ const std::string Strings::UcFirst(std::string s)
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> Strings::Wrap(std::vector<std::string> &src, std::string character)
|
||||
std::vector<std::string> Strings::Wrap(std::vector<std::string> &src, const std::string& character)
|
||||
{
|
||||
std::vector<std::string> new_vector;
|
||||
new_vector.reserve(src.size());
|
||||
@ -659,7 +659,7 @@ std::string Strings::SecondsToTime(int duration, bool is_milliseconds)
|
||||
return time_string;
|
||||
}
|
||||
|
||||
std::string &Strings::LTrim(std::string &str, const std::string &chars)
|
||||
std::string &Strings::LTrim(std::string &str, std::string_view chars)
|
||||
{
|
||||
str.erase(0, str.find_first_not_of(chars));
|
||||
return str;
|
||||
@ -670,7 +670,7 @@ std::string Strings::MillisecondsToTime(int duration)
|
||||
return SecondsToTime(duration, true);
|
||||
}
|
||||
|
||||
std::string &Strings::RTrim(std::string &str, const std::string &chars)
|
||||
std::string &Strings::RTrim(std::string &str, std::string_view chars)
|
||||
{
|
||||
str.erase(str.find_last_not_of(chars) + 1);
|
||||
return str;
|
||||
@ -682,7 +682,7 @@ std::string &Strings::Trim(std::string &str, const std::string &chars)
|
||||
}
|
||||
|
||||
// Function to convert single digit or two digit number into words
|
||||
std::string Strings::ConvertToDigit(int n, std::string suffix)
|
||||
std::string Strings::ConvertToDigit(int n, const std::string& suffix)
|
||||
{
|
||||
// if n is zero
|
||||
if (n == 0) {
|
||||
@ -745,7 +745,7 @@ uint32 Strings::TimeToSeconds(std::string time_string)
|
||||
return duration;
|
||||
}
|
||||
|
||||
bool Strings::ToBool(std::string bool_string)
|
||||
bool Strings::ToBool(const std::string& bool_string)
|
||||
{
|
||||
if (
|
||||
Strings::Contains(bool_string, "true") ||
|
||||
|
||||
@ -84,7 +84,7 @@ namespace EQ {
|
||||
|
||||
class Strings {
|
||||
public:
|
||||
static bool Contains(std::vector<std::string> container, std::string element);
|
||||
static bool Contains(std::vector<std::string> container, const std::string& element);
|
||||
static bool Contains(const std::string& subject, const std::string& search);
|
||||
static int ToInt(const std::string &s, int fallback = 0);
|
||||
static int64 ToBigInt(const std::string &s, int64 fallback = 0);
|
||||
@ -96,9 +96,9 @@ public:
|
||||
static bool IsFloat(const std::string &s);
|
||||
static const std::string ToLower(std::string s);
|
||||
static const std::string ToUpper(std::string s);
|
||||
static const std::string UcFirst(std::string s);
|
||||
static std::string <rim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
|
||||
static std::string &RTrim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
|
||||
static const std::string UcFirst(const std::string& s);
|
||||
static std::string <rim(std::string &str, std::string_view chars = "\t\n\v\f\r ");
|
||||
static std::string &RTrim(std::string &str, std::string_view chars = "\t\n\v\f\r ");
|
||||
static std::string &Trim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
|
||||
static std::string Commify(const std::string &number);
|
||||
static std::string Commify(uint16 number) { return Strings::Commify(std::to_string(number)); };
|
||||
@ -107,10 +107,10 @@ public:
|
||||
static std::string Commify(int16 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string Commify(int32 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string Commify(int64 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string ConvertToDigit(int n, std::string suffix);
|
||||
static std::string ConvertToDigit(int n, const std::string& suffix);
|
||||
static std::string Escape(const std::string &s);
|
||||
static std::string GetBetween(const std::string &s, std::string start_delim, std::string stop_delim);
|
||||
static std::string Implode(std::string glue, std::vector<std::string> src);
|
||||
static std::string Implode(const std::string& glue, std::vector<std::string> src);
|
||||
static std::string Join(const std::vector<std::string> &ar, const std::string &delim);
|
||||
static std::string Join(const std::vector<uint32_t> &ar, const std::string &delim);
|
||||
static std::string MillisecondsToTime(int duration);
|
||||
@ -122,10 +122,10 @@ public:
|
||||
static std::string::size_type SearchDelim(const std::string &haystack, const std::string &needle, const char deliminator = ',');
|
||||
static std::vector<std::string> Split(const std::string &s, const char delim = ',');
|
||||
static std::vector<std::string> Split(const std::string& s, const std::string& delimiter);
|
||||
static std::vector<std::string> Wrap(std::vector<std::string> &src, std::string character);
|
||||
static std::vector<std::string> Wrap(std::vector<std::string> &src, const std::string& character);
|
||||
static void FindReplace(std::string &string_subject, const std::string &search_string, const std::string &replace_string);
|
||||
static uint32 TimeToSeconds(std::string time_string);
|
||||
static bool ToBool(std::string bool_string);
|
||||
static bool ToBool(const std::string& bool_string);
|
||||
static inline bool EqualFold(const std::string &string_one, const std::string &string_two) { return strcasecmp(string_one.c_str(), string_two.c_str()) == 0; }
|
||||
static std::string Random(size_t length);
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ unsigned int Database::GetFreeID(const std::string &loginserver)
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return Strings::ToInt(row[0]);
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -647,7 +647,7 @@ Database::DbLoginServerAdmin Database::GetLoginServerAdmin(const std::string &ac
|
||||
if (results.RowCount() == 1) {
|
||||
auto row = results.begin();
|
||||
r.loaded = true;
|
||||
r.id = Strings::ToInt(row[0]);
|
||||
r.id = Strings::ToUnsignedInt(row[0]);
|
||||
r.account_name = row[1];
|
||||
r.account_password = row[2];
|
||||
r.first_name = row[3];
|
||||
@ -683,7 +683,7 @@ Database::DbLoginServerAccount Database::GetLoginServerAccountByAccountName(
|
||||
if (results.RowCount() == 1) {
|
||||
auto row = results.begin();
|
||||
r.loaded = true;
|
||||
r.id = Strings::ToInt(row[0]);
|
||||
r.id = Strings::ToUnsignedInt(row[0]);
|
||||
r.account_name = row[1];
|
||||
r.account_password = row[2];
|
||||
r.account_email = row[3];
|
||||
|
||||
@ -120,22 +120,22 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
inventory_profile.SetInventoryVersion(client_version);
|
||||
inventory_profile.SetGMInventory(true); // charsel can not interact with items..but, no harm in setting to full expansion support
|
||||
|
||||
uint32 character_id = (uint32) Strings::ToInt(row[0]);
|
||||
uint32 character_id = Strings::ToUnsignedInt(row[0]);
|
||||
uint8 has_home = 0;
|
||||
uint8 has_bind = 0;
|
||||
|
||||
memset(&pp, 0, sizeof(PlayerProfile_Struct));
|
||||
memset(p_character_select_entry_struct->Name, 0, sizeof(p_character_select_entry_struct->Name));
|
||||
strcpy(p_character_select_entry_struct->Name, row[1]);
|
||||
p_character_select_entry_struct->Class = (uint8) Strings::ToInt(row[4]);
|
||||
p_character_select_entry_struct->Race = (uint32) Strings::ToInt(row[3]);
|
||||
p_character_select_entry_struct->Level = (uint8) Strings::ToInt(row[5]);
|
||||
p_character_select_entry_struct->Class = (uint8) Strings::ToUnsignedInt(row[4]);
|
||||
p_character_select_entry_struct->Race = (uint32) Strings::ToUnsignedInt(row[3]);
|
||||
p_character_select_entry_struct->Level = (uint8) Strings::ToUnsignedInt(row[5]);
|
||||
p_character_select_entry_struct->ShroudClass = p_character_select_entry_struct->Class;
|
||||
p_character_select_entry_struct->ShroudRace = p_character_select_entry_struct->Race;
|
||||
p_character_select_entry_struct->Zone = (uint16) Strings::ToInt(row[19]);
|
||||
p_character_select_entry_struct->Zone = (uint16) Strings::ToUnsignedInt(row[19]);
|
||||
p_character_select_entry_struct->Instance = 0;
|
||||
p_character_select_entry_struct->Gender = (uint8) Strings::ToInt(row[2]);
|
||||
p_character_select_entry_struct->Face = (uint8) Strings::ToInt(row[15]);
|
||||
p_character_select_entry_struct->Gender = (uint8) Strings::ToUnsignedInt(row[2]);
|
||||
p_character_select_entry_struct->Face = (uint8) Strings::ToUnsignedInt(row[15]);
|
||||
|
||||
for (uint32 material_slot = 0; material_slot < EQ::textures::materialCount; material_slot++) {
|
||||
p_character_select_entry_struct->Equip[material_slot].Material = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user