[Strings] Add more number formatters (#2873)

* [Strings] Add more number formatters

# Notes
- Adds `Strings::ToUnsignedInt` for `uint32` support.
- Adds `Strings::ToBigInt` for `int64` support.
- Adds `Strings::ToUnsignedBigInt` for `uint64` support.
- Adds `Strings::ToFloat` for `float` support.
- Replaces all `std::stoi` references with `Strings::ToInt`.
- Replaces all `atoi` references with `Strings::ToInt`.
- Replaces all `std::stoul` references with `Strings::ToUnsignedInt`.
- Replaces all `atoul` references with `Strings::ToUnsignedInt`.
- Replaces all `std::stoll` references with `Strings::ToBigInt`.
- Replaces all `atoll` references with `Strings::ToBigInt`.
- Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `atoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `std::stof` references with `Strings::ToFloat`.

* [Strings] Add more number formatters

- Adds `Strings::ToUnsignedInt` for `uint32` support.
- Adds `Strings::ToBigInt` for `int64` support.
- Adds `Strings::ToUnsignedBigInt` for `uint64` support.
- Adds `Strings::ToFloat` for `float` support.
- Replaces all `std::stoi` references with `Strings::ToInt`.
- Replaces all `atoi` references with `Strings::ToInt`.
- Replaces all `std::stoul` references with `Strings::ToUnsignedInt`.
- Replaces all `atoul` references with `Strings::ToUnsignedInt`.
- Replaces all `std::stoll` references with `Strings::ToBigInt`.
- Replaces all `atoll` references with `Strings::ToBigInt`.
- Replaces all `std::stoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `atoull` references with `Strings::ToUnsignedBigInt`.
- Replaces all `std::stof` references with `Strings::ToFloat`.

* Rebase cleanup

* Changes/benchmarks/tests

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King
2023-03-04 18:01:19 -05:00
committed by GitHub
parent be567af70d
commit 2a6cf8c8e7
261 changed files with 3178 additions and 3012 deletions
+2 -2
View File
@@ -383,8 +383,8 @@ void Adventure::MoveCorpsesToGraveyard()
if(!results.Success())
for(auto row = results.begin(); row != results.end(); ++row) {
dbid_list.push_back(atoi(row[0]));
charid_list.push_back(atoi(row[1]));
dbid_list.push_back(Strings::ToInt(row[0]));
charid_list.push_back(Strings::ToInt(row[1]));
}
for (auto &elem : dbid_list) {
+52 -52
View File
@@ -679,41 +679,41 @@ bool AdventureManager::LoadAdventureTemplates()
for (auto row = results.begin(); row != results.end(); ++row) {
auto adventure_template = new AdventureTemplate;
adventure_template->id = atoi(row[0]);
adventure_template->id = Strings::ToInt(row[0]);
strcpy(adventure_template->zone, row[1]);
adventure_template->zone_version = atoi(row[2]);
adventure_template->is_hard = atoi(row[3]);
adventure_template->min_level = atoi(row[4]);
adventure_template->max_level = atoi(row[5]);
adventure_template->type = atoi(row[6]);
adventure_template->type_data = atoi(row[7]);
adventure_template->type_count = atoi(row[8]);
adventure_template->assa_x = atof(row[9]);
adventure_template->assa_y = atof(row[10]);
adventure_template->assa_z = atof(row[11]);
adventure_template->assa_h = atof(row[12]);
adventure_template->zone_version = Strings::ToInt(row[2]);
adventure_template->is_hard = Strings::ToInt(row[3]);
adventure_template->min_level = Strings::ToInt(row[4]);
adventure_template->max_level = Strings::ToInt(row[5]);
adventure_template->type = Strings::ToInt(row[6]);
adventure_template->type_data = Strings::ToInt(row[7]);
adventure_template->type_count = Strings::ToInt(row[8]);
adventure_template->assa_x = Strings::ToFloat(row[9]);
adventure_template->assa_y = Strings::ToFloat(row[10]);
adventure_template->assa_z = Strings::ToFloat(row[11]);
adventure_template->assa_h = Strings::ToFloat(row[12]);
strn0cpy(adventure_template->text, row[13], sizeof(adventure_template->text));
adventure_template->duration = atoi(row[14]);
adventure_template->zone_in_time = atoi(row[15]);
adventure_template->win_points = atoi(row[16]);
adventure_template->lose_points = atoi(row[17]);
adventure_template->theme = atoi(row[18]);
adventure_template->zone_in_zone_id = atoi(row[19]);
adventure_template->zone_in_x = atof(row[20]);
adventure_template->zone_in_y = atof(row[21]);
adventure_template->zone_in_object_id = atoi(row[22]);
adventure_template->dest_x = atof(row[23]);
adventure_template->dest_y = atof(row[24]);
adventure_template->dest_z = atof(row[25]);
adventure_template->dest_h = atof(row[26]);
adventure_template->graveyard_zone_id = atoi(row[27]);
adventure_template->graveyard_x = atof(row[28]);
adventure_template->graveyard_y = atof(row[29]);
adventure_template->graveyard_z = atof(row[30]);
adventure_template->graveyard_radius = atof(row[31]);
adventure_template->duration = Strings::ToInt(row[14]);
adventure_template->zone_in_time = Strings::ToInt(row[15]);
adventure_template->win_points = Strings::ToInt(row[16]);
adventure_template->lose_points = Strings::ToInt(row[17]);
adventure_template->theme = Strings::ToInt(row[18]);
adventure_template->zone_in_zone_id = Strings::ToInt(row[19]);
adventure_template->zone_in_x = Strings::ToFloat(row[20]);
adventure_template->zone_in_y = Strings::ToFloat(row[21]);
adventure_template->zone_in_object_id = Strings::ToInt(row[22]);
adventure_template->dest_x = Strings::ToFloat(row[23]);
adventure_template->dest_y = Strings::ToFloat(row[24]);
adventure_template->dest_z = Strings::ToFloat(row[25]);
adventure_template->dest_h = Strings::ToFloat(row[26]);
adventure_template->graveyard_zone_id = Strings::ToInt(row[27]);
adventure_template->graveyard_x = Strings::ToFloat(row[28]);
adventure_template->graveyard_y = Strings::ToFloat(row[29]);
adventure_template->graveyard_z = Strings::ToFloat(row[30]);
adventure_template->graveyard_radius = Strings::ToFloat(row[31]);
adventure_templates[adventure_template->id] = adventure_template;
}
@@ -732,8 +732,8 @@ bool AdventureManager::LoadAdventureEntries()
for (auto row = results.begin(); row != results.end(); ++row)
{
int id = atoi(row[0]);
int template_id = atoi(row[1]);
int id = Strings::ToInt(row[0]);
int template_id = Strings::ToInt(row[1]);
AdventureTemplate* tid = nullptr;
auto t_iter = adventure_templates.find(template_id);
@@ -1108,26 +1108,26 @@ void AdventureManager::LoadLeaderboardInfo()
LeaderboardInfo lbi;
lbi.name = row[0];
lbi.wins = atoi(row[3]);
lbi.guk_wins = atoi(row[3]);
lbi.wins += atoi(row[4]);
lbi.mir_wins = atoi(row[4]);
lbi.wins += atoi(row[5]);
lbi.mmc_wins = atoi(row[5]);
lbi.wins += atoi(row[6]);
lbi.ruj_wins = atoi(row[6]);
lbi.wins += atoi(row[7]);
lbi.tak_wins = atoi(row[7]);
lbi.losses = atoi(row[8]);
lbi.guk_losses = atoi(row[8]);
lbi.losses += atoi(row[9]);
lbi.mir_losses = atoi(row[9]);
lbi.losses += atoi(row[10]);
lbi.mmc_losses = atoi(row[10]);
lbi.losses += atoi(row[11]);
lbi.ruj_losses = atoi(row[11]);
lbi.losses += atoi(row[12]);
lbi.tak_losses = atoi(row[12]);
lbi.wins = Strings::ToInt(row[3]);
lbi.guk_wins = Strings::ToInt(row[3]);
lbi.wins += Strings::ToInt(row[4]);
lbi.mir_wins = Strings::ToInt(row[4]);
lbi.wins += Strings::ToInt(row[5]);
lbi.mmc_wins = Strings::ToInt(row[5]);
lbi.wins += Strings::ToInt(row[6]);
lbi.ruj_wins = Strings::ToInt(row[6]);
lbi.wins += Strings::ToInt(row[7]);
lbi.tak_wins = Strings::ToInt(row[7]);
lbi.losses = Strings::ToInt(row[8]);
lbi.guk_losses = Strings::ToInt(row[8]);
lbi.losses += Strings::ToInt(row[9]);
lbi.mir_losses = Strings::ToInt(row[9]);
lbi.losses += Strings::ToInt(row[10]);
lbi.mmc_losses = Strings::ToInt(row[10]);
lbi.losses += Strings::ToInt(row[11]);
lbi.ruj_losses = Strings::ToInt(row[11]);
lbi.losses += Strings::ToInt(row[12]);
lbi.tak_losses = Strings::ToInt(row[12]);
leaderboard_info_wins.push_back(lbi);
leaderboard_info_percentage.push_back(lbi);
+1 -1
View File
@@ -19,6 +19,6 @@ void WorldserverCLI::DatabaseSetAccountStatus(int argc, char **argv, argh::parse
database.SetAccountStatus(
cmd(2).str(),
std::stoi(cmd(3).str())
Strings::ToInt(cmd(3).str())
);
}
+114
View File
@@ -0,0 +1,114 @@
#include <cereal/archives/json.hpp>
#include <cereal/types/vector.hpp>
#include "../../common/events/player_events.h"
#include "../../common/timer.h"
void WorldserverCLI::TestStringBenchmarkCommand(int argc, char **argv, argh::parser &cmd, std::string &description)
{
description = "Test command";
if (cmd[{"-h", "--help"}]) {
return;
}
enum Type {
StringsToInt = 0,
StringsToBigInt,
StringsToUnsignedInt,
StringsToUnsignedBigInt,
StringsToFloat,
StringsIsNumber,
StringsIsFloat,
StdStoi,
StdAtoi,
StdStoll,
StdAtoll,
StdStoul,
StdStoull,
StdStof,
};
struct Benchmark {
std::string name;
Type type;
};
std::vector<Benchmark> benches = {
Benchmark{.name = "Strings::ToInt", .type = StringsToInt},
Benchmark{.name = "std::stoi", .type = StdStoi},
Benchmark{.name = "std::atoi", .type = StdAtoi},
Benchmark{.name = "Strings::ToBigInt", .type = StringsToBigInt},
Benchmark{.name = "std::stoll", .type = StdStoll},
Benchmark{.name = "std::atoll", .type = StdAtoll},
Benchmark{.name = "Strings::ToUnsignedInt", .type = StringsToUnsignedInt},
Benchmark{.name = "std::stoul", .type = StdStoul},
Benchmark{.name = "Strings::ToUnsignedBigInt", .type = StringsToUnsignedBigInt},
Benchmark{.name = "std::stoull", .type = StdStoull},
Benchmark{.name = "Strings::ToFloat", .type = StringsToFloat},
Benchmark{.name = "std::stof", .type = StdStof},
Benchmark{.name = "Strings::IsNumber", .type = StringsIsNumber},
Benchmark{.name = "Strings::IsFloat", .type = StringsIsFloat},
};
BenchTimer benchmark;
for (auto &b: benches) {
int iterations = 10000000;
std::string number = "1111753784";
std::string float_number = "1111753784.2345623456345";
int64 convert = 0;
uint64_t uconvert = 0;
float fconvert = 0;
bool check = false;
for (int i = 0; i < iterations; i++) {
switch (b.type) {
case StringsToInt:
convert = Strings::ToInt(number, 0);
break;
case StdStoi:
convert = std::stoi(number);
break;
case StdAtoi:
convert = std::atoi(number.c_str());
break;
case StringsToBigInt:
convert = Strings::ToBigInt(number, 0);
break;
case StdStoll:
convert = std::stoll(number);
break;
case StdAtoll:
convert = std::atoll(number.c_str());
break;
case StringsToUnsignedInt:
uconvert = Strings::ToUnsignedInt(number, 0);
break;
case StringsToUnsignedBigInt:
uconvert = Strings::ToUnsignedBigInt(number, 0);
break;
case StringsToFloat:
fconvert = Strings::ToFloat(number, 0);
break;
case StringsIsNumber:
check = Strings::IsNumber(number);
break;
case StringsIsFloat:
check = Strings::IsFloat(float_number);
break;
case StdStoul:
uconvert = std::stoul(number);
break;
case StdStoull:
uconvert = std::stoull(number);
break;
case StdStof:
fconvert = std::stof(number);
break;
}
}
LogInfo("{:<30} | [{}] time [{}]", b.name, Strings::Commify(iterations), benchmark.elapsed());
benchmark.reset();
}
}
+6 -6
View File
@@ -453,7 +453,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
is_player_zoning = (login_info->zoning == 1);
uint32 id = std::stoi(name);
uint32 id = Strings::ToInt(name);
if (id == 0) {
LogWarning("Receiving Login Info Packet from Client | account_id is 0 - disconnecting");
return false;
@@ -808,7 +808,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if (!strcasecmp(row[1], char_name)) {
if (RuleB(World, EnableReturnHomeButton)) {
int now = time(nullptr);
if ((now - atoi(row[3])) >= RuleI(World, MinOfflineTimeToReturnHome)) {
if ((now - Strings::ToInt(row[3])) >= RuleI(World, MinOfflineTimeToReturnHome)) {
home_enabled = true;
break;
}
@@ -834,7 +834,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
if (!strcasecmp(row[1], char_name)) {
if (
RuleB(World, EnableTutorialButton) &&
std::stoi(row[2]) <= RuleI(World, MaxLevelForTutorial)
Strings::ToInt(row[2]) <= RuleI(World, MaxLevelForTutorial)
) {
tutorial_enabled = true;
break;
@@ -1258,7 +1258,7 @@ bool Client::ChecksumVerificationCRCEQGame(uint64 checksum)
std::string checksumvar;
uint64_t checksumint;
if (database.GetVariable("crc_eqgame", checksumvar)) {
checksumint = atoll(checksumvar.c_str());
checksumint = Strings::ToBigInt(checksumvar.c_str());
}
else {
LogChecksumVerification("variable not set in variables table.");
@@ -1281,7 +1281,7 @@ bool Client::ChecksumVerificationCRCSkillCaps(uint64 checksum)
std::string checksumvar;
uint64_t checksumint;
if (database.GetVariable("crc_skillcaps", checksumvar)) {
checksumint = atoll(checksumvar.c_str());
checksumint = Strings::ToBigInt(checksumvar.c_str());
}
else {
LogChecksumVerification("[checksum_crc2_skillcaps] variable not set in variables table.");
@@ -1304,7 +1304,7 @@ bool Client::ChecksumVerificationCRCBaseData(uint64 checksum)
std::string checksumvar;
uint64_t checksumint;
if (database.GetVariable("crc_basedata", checksumvar)) {
checksumint = atoll(checksumvar.c_str());
checksumint = Strings::ToBigInt(checksumvar.c_str());
}
else {
LogChecksumVerification("variable not set in variables table.");
+1 -1
View File
@@ -365,7 +365,7 @@ bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_p
}
std::string lsworldadmin;
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
if (atoi(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
if (Strings::ToInt(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
padmin = pworldadmin;
}
}
+19 -19
View File
@@ -166,14 +166,14 @@ void ConsoleWho(
}
else if (Strings::IsNumber(arg)) {
if (whom.lvllow == 0xFFFF) {
whom.lvllow = atoi(arg.c_str());
whom.lvllow = Strings::ToInt(arg.c_str());
whom.lvlhigh = whom.lvllow;
}
else if (atoi(arg.c_str()) > int(whom.lvllow)) {
whom.lvlhigh = atoi(arg.c_str());
else if (Strings::ToInt(arg.c_str()) > int(whom.lvllow)) {
whom.lvlhigh = Strings::ToInt(arg.c_str());
}
else {
whom.lvllow = atoi(arg.c_str());
whom.lvllow = Strings::ToInt(arg.c_str());
}
}
else {
@@ -200,11 +200,11 @@ void ConsoleUptime(
return;
}
if (Strings::IsNumber(args[0]) && atoi(args[0].c_str()) > 0) {
if (Strings::IsNumber(args[0]) && Strings::ToInt(args[0].c_str()) > 0) {
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
ServerUptime_Struct *sus = (ServerUptime_Struct *) pack->pBuffer;
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", connection->UserName().c_str());
sus->zoneserverid = atoi(args[0].c_str());
sus->zoneserverid = Strings::ToInt(args[0].c_str());
ZoneServer *zs = zoneserver_list.FindByID(sus->zoneserverid);
if (zs) {
zs->SendPacket(pack);
@@ -284,7 +284,7 @@ void ConsoleEmote(
0,
0,
AccountStatus::Player,
atoi(args[1].c_str()),
Strings::ToInt(args[1].c_str()),
Strings::Join(join_args, " ").c_str()
);
}
@@ -295,7 +295,7 @@ void ConsoleEmote(
0,
0,
AccountStatus::Player,
atoi(args[1].c_str()),
Strings::ToInt(args[1].c_str()),
Strings::Join(join_args, " ").c_str()
);
}
@@ -304,7 +304,7 @@ void ConsoleEmote(
args[0].c_str(),
0,
AccountStatus::Player,
atoi(args[1].c_str()),
Strings::ToInt(args[1].c_str()),
Strings::Join(join_args, " ").c_str()
);
}
@@ -422,7 +422,7 @@ void ConsoleGuildSay(
}
auto from = args[0];
auto guild_id = Strings::IsNumber(args[1]) ? std::stoul(args[1]) : 0;
auto guild_id = Strings::IsNumber(args[1]) ? Strings::ToUnsignedInt(args[1]) : 0;
if (!guild_id) {
return;
}
@@ -585,7 +585,7 @@ void ConsoleZoneShutdown(
pack->opcode = ServerOP_ZoneShutdown;
strcpy(s->adminname, tmpname);
if (Strings::IsNumber(args[0])) {
s->ZoneServerID = atoi(args[0].c_str());
s->ZoneServerID = Strings::ToInt(args[0].c_str());
}
else {
s->zoneid = ZoneID(args[0].c_str());
@@ -639,12 +639,12 @@ void ConsoleZoneBootup(
if (args.size() > 2) {
zoneserver_list.SOPZoneBootup(
tmpname,
atoi(args[0].c_str()),
Strings::ToInt(args[0].c_str()),
args[1].c_str(),
(bool) (strcasecmp(args[1].c_str(), "static") == 0));
}
else {
zoneserver_list.SOPZoneBootup(tmpname, atoi(args[0].c_str()), args[1].c_str(), false);
zoneserver_list.SOPZoneBootup(tmpname, Strings::ToInt(args[0].c_str()), args[1].c_str(), false);
}
}
}
@@ -751,10 +751,10 @@ void ConsoleFlag(
connection->SendLine("Usage: flag [status] [accountname]");
}
else {
if (atoi(args[0].c_str()) > connection->Admin()) {
if (Strings::ToInt(args[0].c_str()) > connection->Admin()) {
connection->SendLine("You cannot set people's status to higher than your own");
}
else if (!database.SetAccountStatus(args[1].c_str(), atoi(args[0].c_str()))) {
else if (!database.SetAccountStatus(args[1].c_str(), Strings::ToInt(args[0].c_str()))) {
connection->SendLine("Unable to flag account!");
}
else {
@@ -821,8 +821,8 @@ void ConsoleWorldShutdown(
{
if (args.size() == 2) {
int32 time, interval;
if (Strings::IsNumber(args[0]) && Strings::IsNumber(args[1]) && ((time = atoi(args[0].c_str())) > 0) &&
((interval = atoi(args[1].c_str())) > 0)) {
if (Strings::IsNumber(args[0]) && Strings::IsNumber(args[1]) && ((time = Strings::ToInt(args[0].c_str())) > 0) &&
((interval = Strings::ToInt(args[1].c_str())) > 0)) {
zoneserver_list.WorldShutDown(time, interval);
}
else {
@@ -886,7 +886,7 @@ void ConsoleSignalCharByName(
return;
}
connection->SendLine(StringFormat("Signal Sent to %s with ID %i", (char *) args[0].c_str(), atoi(args[1].c_str())));
connection->SendLine(StringFormat("Signal Sent to %s with ID %i", (char *) args[0].c_str(), Strings::ToInt(args[1].c_str())));
uint32 message_len = strlen((char *) args[0].c_str()) + 1;
auto pack = new ServerPacket(ServerOP_CZSignal, sizeof(CZSignal_Struct) + message_len);
CZSignal_Struct* CZS = (CZSignal_Struct*) pack->pBuffer;
@@ -894,7 +894,7 @@ void ConsoleSignalCharByName(
int update_identifier = 0;
CZS->update_type = update_type;
CZS->update_identifier = update_identifier;
CZS->signal_id = atoi(args[1].c_str());
CZS->signal_id = Strings::ToInt(args[1].c_str());
strn0cpy(CZS->client_name, (char *) args[0].c_str(), 64);
zoneserver_list.SendPacket(pack);
safe_delete(pack);
+17 -17
View File
@@ -494,13 +494,13 @@ void Console::ProcessCommand(const char* command) {
// do nothing
}
else if (strcasecmp(sep.arg[0], "signalcharbyname") == 0) {
SendMessage(1, "Signal Sent to %s with ID %i", (char*) sep.arg[1], atoi(sep.arg[2]));
SendMessage(1, "Signal Sent to %s with ID %i", (char*) sep.arg[1], Strings::ToInt(sep.arg[2]));
uint32 message_len = strlen((char*) sep.arg[1]) + 1;
auto pack = new ServerPacket(ServerOP_CZSignalClientByName,
sizeof(CZClientSignalByName_Struct) + message_len);
CZClientSignalByName_Struct* CZSC = (CZClientSignalByName_Struct*) pack->pBuffer;
strn0cpy(CZSC->Name, (char*) sep.arg[1], 64);
CZSC->data = atoi(sep.arg[2]);
CZSC->data = Strings::ToInt(sep.arg[2]);
zoneserver_list.SendPacket(pack);
safe_delete(pack);
}
@@ -522,11 +522,11 @@ void Console::ProcessCommand(const char* command) {
}
}
else if (strcasecmp(sep.arg[0], "uptime") == 0) {
if (sep.IsNumber(1) && atoi(sep.arg[1]) > 0) {
if (sep.IsNumber(1) && Strings::ToInt(sep.arg[1]) > 0) {
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
ServerUptime_Struct* sus = (ServerUptime_Struct*) pack->pBuffer;
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", GetName());
sus->zoneserverid = atoi(sep.arg[1]);
sus->zoneserverid = Strings::ToInt(sep.arg[1]);
ZoneServer* zs = zoneserver_list.FindByID(sus->zoneserverid);
if (zs)
zs->SendPacket(pack);
@@ -603,13 +603,13 @@ void Console::ProcessCommand(const char* command) {
}
else if (strcasecmp(sep.arg[0], "emote") == 0) {
if (strcasecmp(sep.arg[1], "world") == 0)
zoneserver_list.SendEmoteMessageRaw(0, 0, 0, atoi(sep.arg[2]), sep.argplus[3]);
zoneserver_list.SendEmoteMessageRaw(0, 0, 0, Strings::ToInt(sep.arg[2]), sep.argplus[3]);
else {
ZoneServer* zs = zoneserver_list.FindByName(sep.arg[1]);
if (zs != 0)
zs->SendEmoteMessageRaw(0, 0, 0, atoi(sep.arg[2]), sep.argplus[3]);
zs->SendEmoteMessageRaw(0, 0, 0, Strings::ToInt(sep.arg[2]), sep.argplus[3]);
else
zoneserver_list.SendEmoteMessageRaw(sep.arg[1], 0, 0, atoi(sep.arg[2]), sep.argplus[3]);
zoneserver_list.SendEmoteMessageRaw(sep.arg[1], 0, 0, Strings::ToInt(sep.arg[2]), sep.argplus[3]);
}
}
else if (strcasecmp(sep.arg[0], "movechar") == 0) {
@@ -634,11 +634,11 @@ void Console::ProcessCommand(const char* command) {
SendMessage(1, "Usage: flag [status] [accountname]");
else
{
if (atoi(sep.arg[1]) > Admin())
if (Strings::ToInt(sep.arg[1]) > Admin())
SendMessage(1, "You cannot set people's status to higher than your own");
else if (atoi(sep.arg[1]) < 0 && Admin() < consoleFlagStatus)
else if (Strings::ToInt(sep.arg[1]) < 0 && Admin() < consoleFlagStatus)
SendMessage(1, "You have too low of status to change flags");
else if (!database.SetAccountStatus(sep.arg[2], atoi(sep.arg[1])))
else if (!database.SetAccountStatus(sep.arg[2], Strings::ToInt(sep.arg[1])))
SendMessage(1, "Unable to flag account!");
else
SendMessage(1, "Account Flaged");
@@ -672,13 +672,13 @@ void Console::ProcessCommand(const char* command) {
whom->gmlookup = 1;
else if (sep.IsNumber(i)) {
if (whom->lvllow == 0xFFFF) {
whom->lvllow = atoi(sep.arg[i]);
whom->lvllow = Strings::ToInt(sep.arg[i]);
whom->lvlhigh = whom->lvllow;
}
else if (atoi(sep.arg[i]) > int(whom->lvllow))
whom->lvlhigh = atoi(sep.arg[i]);
else if (Strings::ToInt(sep.arg[i]) > int(whom->lvllow))
whom->lvlhigh = Strings::ToInt(sep.arg[i]);
else
whom->lvllow = atoi(sep.arg[i]);
whom->lvllow = Strings::ToInt(sep.arg[i]);
}
else
strn0cpy(whom->whom, sep.arg[i], sizeof(whom->whom));
@@ -709,7 +709,7 @@ void Console::ProcessCommand(const char* command) {
pack->opcode = ServerOP_ZoneShutdown;
strcpy(s->adminname, tmpname);
if (sep.arg[1][0] >= '0' && sep.arg[1][0] <= '9')
s->ZoneServerID = atoi(sep.arg[1]);
s->ZoneServerID = Strings::ToInt(sep.arg[1]);
else
s->zoneid = ZoneID(sep.arg[1]);
@@ -738,12 +738,12 @@ void Console::ProcessCommand(const char* command) {
strcpy(&tmpname[1], paccountname);
LogInfo("Console ZoneBootup: [{}], [{}], [{}]",tmpname,sep.arg[2],sep.arg[1]);
zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0));
zoneserver_list.SOPZoneBootup(tmpname, Strings::ToInt(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0));
}
}
else if (strcasecmp(sep.arg[0], "worldshutdown") == 0 && admin >= consoleWorldStatus) {
int32 time, interval;
if(sep.IsNumber(1) && sep.IsNumber(2) && ((time=atoi(sep.arg[1]))>0) && ((interval=atoi(sep.arg[2]))>0)) {
if(sep.IsNumber(1) && sep.IsNumber(2) && ((time=Strings::ToInt(sep.arg[1]))>0) && ((interval=Strings::ToInt(sep.arg[2]))>0)) {
zoneserver_list.WorldShutDown(time, interval);
}
else if(strcasecmp(sep.arg[1], "now") == 0) {
+1 -1
View File
@@ -194,7 +194,7 @@ void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::str
uint8 global_repop = ReloadWorld::NoRepop;
if (Strings::IsNumber(args[2])) {
global_repop = static_cast<uint8>(std::stoul(args[2]));
global_repop = static_cast<uint8>(Strings::ToUnsignedInt(args[2]));
if (global_repop > ReloadWorld::ForceRepop) {
global_repop = ReloadWorld::ForceRepop;
+2 -2
View File
@@ -47,7 +47,7 @@ void EQLConfig::LoadSettings() {
}
else {
auto row = results.begin();
m_dynamics = atoi(row[0]);
m_dynamics = Strings::ToInt(row[0]);
}
query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf);
@@ -60,7 +60,7 @@ void EQLConfig::LoadSettings() {
LauncherZone zs;
for (auto row = results.begin(); row != results.end(); ++row) {
zs.name = row[0];
zs.port = atoi(row[1]);
zs.port = Strings::ToInt(row[1]);
m_zones[zs.name] = zs;
}
+2 -2
View File
@@ -131,7 +131,7 @@ std::vector<std::string> EQW::ListBootedZones() {
std::map<std::string,std::string> EQW::GetZoneDetails(Const_char *zone_ref) {
std::map<std::string,std::string> res;
ZoneServer *zs = zoneserver_list.FindByID(atoi(zone_ref));
ZoneServer *zs = zoneserver_list.FindByID(Strings::ToInt(zone_ref));
if(zs == nullptr) {
res["error"] = "Invalid zone.";
return(res);
@@ -316,7 +316,7 @@ int EQW::CountBugs() {
return 0;
auto row = results.begin();
return atoi(row[0]);
return Strings::ToInt(row[0]);
}
std::vector<std::string> EQW::ListBugs(uint32 offset) {
+2 -2
View File
@@ -54,7 +54,7 @@ int HTTPRequest::getInt(const char *name, int default_value) const {
res = m_values.find(name);
if(res == m_values.end())
return(default_value);
return(atoi(res->second.c_str()));
return(Strings::ToInt(res->second.c_str()));
}
float HTTPRequest::getFloat(const char *name, float default_value) const {
@@ -62,7 +62,7 @@ float HTTPRequest::getFloat(const char *name, float default_value) const {
res = m_values.find(name);
if(res == m_values.end())
return(default_value);
return(atof(res->second.c_str()));
return(Strings::ToFloat(res->second.c_str()));
}
void HTTPRequest::header(Const_char *name, Const_char *value) {
+2
View File
@@ -32,6 +32,7 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
function_map["test:repository"] = &WorldserverCLI::TestRepository;
function_map["test:repository2"] = &WorldserverCLI::TestRepository2;
function_map["test:db-concurrency"] = &WorldserverCLI::TestDatabaseConcurrency;
function_map["test:string-benchmark"] = &WorldserverCLI::TestStringBenchmarkCommand;
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
}
@@ -47,4 +48,5 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
#include "cli/test_expansion.cpp"
#include "cli/test_repository.cpp"
#include "cli/test_repository_2.cpp"
#include "cli/test_string_benchmark.cpp"
#include "cli/version.cpp"
+1
View File
@@ -19,6 +19,7 @@ public:
static void TestRepository(int argc, char **argv, argh::parser &cmd, std::string &description);
static void TestRepository2(int argc, char **argv, argh::parser &cmd, std::string &description);
static void TestDatabaseConcurrency(int argc, char **argv, argh::parser &cmd, std::string &description);
static void TestStringBenchmarkCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
};
+92 -92
View File
@@ -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) atoi(row[0]);
uint32 character_id = (uint32) Strings::ToInt(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) atoi(row[4]);
p_character_select_entry_struct->Race = (uint32) atoi(row[3]);
p_character_select_entry_struct->Level = (uint8) atoi(row[5]);
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->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) atoi(row[19]);
p_character_select_entry_struct->Zone = (uint16) Strings::ToInt(row[19]);
p_character_select_entry_struct->Instance = 0;
p_character_select_entry_struct->Gender = (uint8) atoi(row[2]);
p_character_select_entry_struct->Face = (uint8) atoi(row[15]);
p_character_select_entry_struct->Gender = (uint8) Strings::ToInt(row[2]);
p_character_select_entry_struct->Face = (uint8) Strings::ToInt(row[15]);
for (uint32 material_slot = 0; material_slot < EQ::textures::materialCount; material_slot++) {
p_character_select_entry_struct->Equip[material_slot].Material = 0;
@@ -148,28 +148,28 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
p_character_select_entry_struct->Unknown15 = 0xFF;
p_character_select_entry_struct->Unknown19 = 0xFF;
p_character_select_entry_struct->DrakkinTattoo = (uint32) atoi(row[17]);
p_character_select_entry_struct->DrakkinDetails = (uint32) atoi(row[18]);
p_character_select_entry_struct->Deity = (uint32) atoi(row[6]);
p_character_select_entry_struct->DrakkinTattoo = (uint32) Strings::ToInt(row[17]);
p_character_select_entry_struct->DrakkinDetails = (uint32) Strings::ToInt(row[18]);
p_character_select_entry_struct->Deity = (uint32) Strings::ToInt(row[6]);
p_character_select_entry_struct->PrimaryIDFile = 0; // Processed Below
p_character_select_entry_struct->SecondaryIDFile = 0; // Processed Below
p_character_select_entry_struct->HairColor = (uint8) atoi(row[9]);
p_character_select_entry_struct->BeardColor = (uint8) atoi(row[10]);
p_character_select_entry_struct->EyeColor1 = (uint8) atoi(row[11]);
p_character_select_entry_struct->EyeColor2 = (uint8) atoi(row[12]);
p_character_select_entry_struct->HairStyle = (uint8) atoi(row[13]);
p_character_select_entry_struct->Beard = (uint8) atoi(row[14]);
p_character_select_entry_struct->HairColor = (uint8) Strings::ToInt(row[9]);
p_character_select_entry_struct->BeardColor = (uint8) Strings::ToInt(row[10]);
p_character_select_entry_struct->EyeColor1 = (uint8) Strings::ToInt(row[11]);
p_character_select_entry_struct->EyeColor2 = (uint8) Strings::ToInt(row[12]);
p_character_select_entry_struct->HairStyle = (uint8) Strings::ToInt(row[13]);
p_character_select_entry_struct->Beard = (uint8) Strings::ToInt(row[14]);
p_character_select_entry_struct->GoHome = 0; // Processed Below
p_character_select_entry_struct->Tutorial = 0; // Processed Below
p_character_select_entry_struct->DrakkinHeritage = (uint32) atoi(row[16]);
p_character_select_entry_struct->DrakkinHeritage = (uint32) Strings::ToInt(row[16]);
p_character_select_entry_struct->Unknown1 = 0;
p_character_select_entry_struct->Enabled = 1;
p_character_select_entry_struct->LastLogin = (uint32) atoi(row[7]); // RoF2 value: 1212696584
p_character_select_entry_struct->LastLogin = (uint32) Strings::ToInt(row[7]); // RoF2 value: 1212696584
p_character_select_entry_struct->Unknown2 = 0;
if (RuleB(World, EnableReturnHomeButton)) {
int now = time(nullptr);
if ((now - atoi(row[7])) >= RuleI(World, MinOfflineTimeToReturnHome))
if ((now - Strings::ToInt(row[7])) >= RuleI(World, MinOfflineTimeToReturnHome))
p_character_select_entry_struct->GoHome = 1;
}
@@ -194,20 +194,20 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
auto results_bind = database.QueryDatabase(character_list_query);
auto bind_count = results_bind.RowCount();
for (auto row_b = results_bind.begin(); row_b != results_bind.end(); ++row_b) {
if (row_b[6] && atoi(row_b[6]) == 4) {
if (row_b[6] && Strings::ToInt(row_b[6]) == 4) {
has_home = 1;
// If our bind count is less than 5, we need to actually make use of this data so lets parse it
if (bind_count < 5) {
pp.binds[4].zone_id = atoi(row_b[0]);
pp.binds[4].instance_id = atoi(row_b[1]);
pp.binds[4].x = atof(row_b[2]);
pp.binds[4].y = atof(row_b[3]);
pp.binds[4].z = atof(row_b[4]);
pp.binds[4].heading = atof(row_b[5]);
pp.binds[4].zone_id = Strings::ToInt(row_b[0]);
pp.binds[4].instance_id = Strings::ToInt(row_b[1]);
pp.binds[4].x = Strings::ToFloat(row_b[2]);
pp.binds[4].y = Strings::ToFloat(row_b[3]);
pp.binds[4].z = Strings::ToFloat(row_b[4]);
pp.binds[4].heading = Strings::ToFloat(row_b[5]);
}
}
if (row_b[6] && atoi(row_b[6]) == 0)
if (row_b[6] && Strings::ToInt(row_b[6]) == 0)
has_bind = 1;
}
@@ -233,8 +233,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
auto results_bind = content_db.QueryDatabase(character_list_query);
for (auto row_d = results_bind.begin(); row_d != results_bind.end(); ++row_d) {
/* If a bind_id is specified, make them start there */
if (atoi(row_d[1]) != 0) {
pp.binds[4].zone_id = (uint32) atoi(row_d[1]);
if (Strings::ToInt(row_d[1]) != 0) {
pp.binds[4].zone_id = (uint32) Strings::ToInt(row_d[1]);
auto z = GetZone(pp.binds[4].zone_id);
if (z) {
@@ -246,11 +246,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
}
/* Otherwise, use the zone and coordinates given */
else {
pp.binds[4].zone_id = (uint32) atoi(row_d[0]);
float x = atof(row_d[2]);
float y = atof(row_d[3]);
float z = atof(row_d[4]);
float heading = atof(row_d[5]);
pp.binds[4].zone_id = (uint32) Strings::ToInt(row_d[0]);
float x = Strings::ToFloat(row_d[2]);
float y = Strings::ToFloat(row_d[3]);
float z = Strings::ToFloat(row_d[4]);
float heading = Strings::ToFloat(row_d[5]);
if (x == 0 && y == 0 && z == 0 && heading == 0) {
auto zone = GetZone(pp.binds[4].zone_id);
if (zone) {
@@ -350,11 +350,11 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
auto results_b = database.QueryDatabase(character_list_query);
uint8 slot = 0;
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) {
slot = atoi(row_b[0]);
pp.item_tint.Slot[slot].Red = atoi(row_b[1]);
pp.item_tint.Slot[slot].Green = atoi(row_b[2]);
pp.item_tint.Slot[slot].Blue = atoi(row_b[3]);
pp.item_tint.Slot[slot].UseTint = atoi(row_b[4]);
slot = Strings::ToInt(row_b[0]);
pp.item_tint.Slot[slot].Red = Strings::ToInt(row_b[1]);
pp.item_tint.Slot[slot].Green = Strings::ToInt(row_b[2]);
pp.item_tint.Slot[slot].Blue = Strings::ToInt(row_b[3]);
pp.item_tint.Slot[slot].UseTint = Strings::ToInt(row_b[4]);
}
if (GetCharSelInventory(account_id, p_character_select_entry_struct->Name, &inventory_profile)) {
@@ -380,7 +380,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
p_character_select_entry_struct->Equip[matslot].Material = item_id_file;
} else {
if (strlen(item->IDFile) > 2) {
item_id_file = atoi(&item->IDFile[2]);
item_id_file = Strings::ToInt(&item->IDFile[2]);
p_character_select_entry_struct->Equip[matslot].Material = item_id_file;
}
}
@@ -439,12 +439,12 @@ int WorldDatabase::MoveCharacterToBind(int character_id, uint8 bind_number)
int zone_id, instance_id;
double x, y, z, heading;
for (auto row = results.begin(); row != results.end(); ++row) {
zone_id = atoi(row[0]);
instance_id = atoi(row[1]);
x = atof(row[2]);
y = atof(row[3]);
z = atof(row[4]);
heading = atof(row[5]);
zone_id = Strings::ToInt(row[0]);
instance_id = Strings::ToInt(row[1]);
x = Strings::ToFloat(row[2]);
y = Strings::ToFloat(row[3]);
z = Strings::ToFloat(row[4]);
heading = Strings::ToFloat(row[5]);
}
query = fmt::format(
@@ -596,16 +596,16 @@ bool WorldDatabase::GetStartZone(
else {
LogInfo("Found starting location in start_zones");
auto row = results.begin();
pp->x = atof(row[0]);
pp->y = atof(row[1]);
pp->z = atof(row[2]);
pp->heading = atof(row[3]);
pp->zone_id = atoi(row[4]);
pp->binds[0].zone_id = atoi(row[5]);
pp->binds[0].x = atof(row[6]);
pp->binds[0].y = atof(row[7]);
pp->binds[0].z = atof(row[8]);
pp->binds[0].heading = atof(row[3]);
pp->x = Strings::ToFloat(row[0]);
pp->y = Strings::ToFloat(row[1]);
pp->z = Strings::ToFloat(row[2]);
pp->heading = Strings::ToFloat(row[3]);
pp->zone_id = Strings::ToInt(row[4]);
pp->binds[0].zone_id = Strings::ToInt(row[5]);
pp->binds[0].x = Strings::ToFloat(row[6]);
pp->binds[0].y = Strings::ToFloat(row[7]);
pp->binds[0].z = Strings::ToFloat(row[8]);
pp->binds[0].heading = Strings::ToFloat(row[3]);
}
if (
@@ -792,7 +792,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
return false;
auto row = results.begin();
level = atoi(row[0]);
level = Strings::ToInt(row[0]);
return true;
}
@@ -808,21 +808,21 @@ bool WorldDatabase::LoadCharacterCreateAllocations()
for (auto row = results.begin(); row != results.end(); ++row) {
RaceClassAllocation allocate;
allocate.Index = atoi(row[0]);
allocate.BaseStats[0] = atoi(row[1]);
allocate.BaseStats[3] = atoi(row[2]);
allocate.BaseStats[1] = atoi(row[3]);
allocate.BaseStats[2] = atoi(row[4]);
allocate.BaseStats[4] = atoi(row[5]);
allocate.BaseStats[5] = atoi(row[6]);
allocate.BaseStats[6] = atoi(row[7]);
allocate.DefaultPointAllocation[0] = atoi(row[8]);
allocate.DefaultPointAllocation[3] = atoi(row[9]);
allocate.DefaultPointAllocation[1] = atoi(row[10]);
allocate.DefaultPointAllocation[2] = atoi(row[11]);
allocate.DefaultPointAllocation[4] = atoi(row[12]);
allocate.DefaultPointAllocation[5] = atoi(row[13]);
allocate.DefaultPointAllocation[6] = atoi(row[14]);
allocate.Index = Strings::ToInt(row[0]);
allocate.BaseStats[0] = Strings::ToInt(row[1]);
allocate.BaseStats[3] = Strings::ToInt(row[2]);
allocate.BaseStats[1] = Strings::ToInt(row[3]);
allocate.BaseStats[2] = Strings::ToInt(row[4]);
allocate.BaseStats[4] = Strings::ToInt(row[5]);
allocate.BaseStats[5] = Strings::ToInt(row[6]);
allocate.BaseStats[6] = Strings::ToInt(row[7]);
allocate.DefaultPointAllocation[0] = Strings::ToInt(row[8]);
allocate.DefaultPointAllocation[3] = Strings::ToInt(row[9]);
allocate.DefaultPointAllocation[1] = Strings::ToInt(row[10]);
allocate.DefaultPointAllocation[2] = Strings::ToInt(row[11]);
allocate.DefaultPointAllocation[4] = Strings::ToInt(row[12]);
allocate.DefaultPointAllocation[5] = Strings::ToInt(row[13]);
allocate.DefaultPointAllocation[6] = Strings::ToInt(row[14]);
character_create_allocations.push_back(allocate);
}
@@ -841,12 +841,12 @@ bool WorldDatabase::LoadCharacterCreateCombos()
for (auto row = results.begin(); row != results.end(); ++row) {
RaceClassCombos combo;
combo.AllocationIndex = atoi(row[0]);
combo.Race = atoi(row[1]);
combo.Class = atoi(row[2]);
combo.Deity = atoi(row[3]);
combo.Zone = atoi(row[4]);
combo.ExpansionRequired = atoi(row[5]);
combo.AllocationIndex = Strings::ToInt(row[0]);
combo.Race = Strings::ToInt(row[1]);
combo.Class = Strings::ToInt(row[2]);
combo.Deity = Strings::ToInt(row[3]);
combo.Zone = Strings::ToInt(row[4]);
combo.ExpansionRequired = Strings::ToInt(row[5]);
character_create_race_class_combos.push_back(combo);
}
@@ -901,7 +901,7 @@ bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQ::Inven
return false;
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
int16 slot_id = Strings::ToInt(row[0]);
switch (slot_id) {
case EQ::invslot::slotFace:
@@ -916,22 +916,22 @@ bool WorldDatabase::GetCharSelInventory(uint32 account_id, char *name, EQ::Inven
break;
}
uint32 item_id = atoi(row[1]);
int8 charges = atoi(row[2]);
uint32 color = atoul(row[3]);
uint32 item_id = Strings::ToInt(row[1]);
int8 charges = Strings::ToInt(row[2]);
uint32 color = Strings::ToUnsignedInt(row[3]);
uint32 aug[EQ::invaug::SOCKET_COUNT];
aug[0] = (uint32)atoi(row[4]);
aug[1] = (uint32)atoi(row[5]);
aug[2] = (uint32)atoi(row[6]);
aug[3] = (uint32)atoi(row[7]);
aug[4] = (uint32)atoi(row[8]);
aug[5] = (uint32)atoi(row[9]);
aug[0] = (uint32)Strings::ToInt(row[4]);
aug[1] = (uint32)Strings::ToInt(row[5]);
aug[2] = (uint32)Strings::ToInt(row[6]);
aug[3] = (uint32)Strings::ToInt(row[7]);
aug[4] = (uint32)Strings::ToInt(row[8]);
aug[5] = (uint32)Strings::ToInt(row[9]);
bool instnodrop = ((row[10] && (uint16)atoi(row[10])) ? true : false);
uint32 ornament_icon = (uint32)atoul(row[12]);
uint32 ornament_idfile = (uint32)atoul(row[13]);
uint32 ornament_hero_model = (uint32)atoul(row[14]);
bool instnodrop = ((row[10] && (uint16)Strings::ToInt(row[10])) ? true : false);
uint32 ornament_icon = (uint32)Strings::ToUnsignedInt(row[12]);
uint32 ornament_idfile = (uint32)Strings::ToUnsignedInt(row[13]);
uint32 ornament_hero_model = (uint32)Strings::ToUnsignedInt(row[14]);
const EQ::ItemData *item = content_db.GetItem(item_id);
if (!item)