mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
[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:
@@ -91,9 +91,9 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto spawngroup_id = std::stoul(sep->arg[2]);
|
||||
auto npc_id = std::stoul(sep->arg[3]);
|
||||
auto spawn_chance = std::stoul(sep->arg[4]);
|
||||
auto spawngroup_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto npc_id = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
auto spawn_chance = Strings::ToUnsignedInt(sep->arg[4]);
|
||||
|
||||
auto query = fmt::format(
|
||||
SQL(
|
||||
@@ -129,14 +129,14 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
zone->GetInstanceVersion(),
|
||||
c,
|
||||
0,
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
)
|
||||
) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Spawn Added | Added spawn from Spawngroup ID {}.",
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
|
||||
auto query = fmt::format(
|
||||
"UPDATE spawngroup SET dist = 0, min_x = 0, max_x = 0, min_y = 0, max_y = 0, delay = 0 WHERE id = {}",
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
);
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
@@ -161,7 +161,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Spawngroup {} Roambox Cleared | Delay: 0 Distance: 0.00",
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
).c_str()
|
||||
);
|
||||
|
||||
@@ -169,7 +169,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Spawngroup {} Roambox Cleared | Minimum X: 0.00 Maximum X: 0.00",
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
).c_str()
|
||||
);
|
||||
|
||||
@@ -177,7 +177,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Spawngroup {} Roambox Cleared | Minimum Y: 0.00 Maximum Y: 0.00",
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
@@ -231,13 +231,13 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
);
|
||||
return;
|
||||
}
|
||||
auto spawngroup_id = std::stoul(sep->arg[2]);
|
||||
auto distance = std::stof(sep->arg[3]);
|
||||
auto minimum_x = std::stof(sep->arg[4]);
|
||||
auto maximum_x = std::stof(sep->arg[5]);
|
||||
auto minimum_y = std::stof(sep->arg[6]);
|
||||
auto maximum_y = std::stof(sep->arg[7]);
|
||||
auto delay = std::stoi(sep->arg[8]);
|
||||
auto spawngroup_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto distance = Strings::ToFloat(sep->arg[3]);
|
||||
auto minimum_x = Strings::ToFloat(sep->arg[4]);
|
||||
auto maximum_x = Strings::ToFloat(sep->arg[5]);
|
||||
auto minimum_y = Strings::ToFloat(sep->arg[6]);
|
||||
auto maximum_y = Strings::ToFloat(sep->arg[7]);
|
||||
auto delay = Strings::ToInt(sep->arg[8]);
|
||||
|
||||
auto query = fmt::format(
|
||||
"UPDATE spawngroup SET dist = {:.2f}, min_x = {:.2f}, max_x = {:.2f}, max_y = {:.2f}, min_y = {:.2f}, delay = {} WHERE id = {}",
|
||||
@@ -304,8 +304,8 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
auto spawn2_id = spawn2->GetID();
|
||||
auto respawn_timer = std::stoul(sep->arg[2]);
|
||||
auto variance = sep->IsNumber(3) ? std::stoul(sep->arg[3]) : spawn2->GetVariance();
|
||||
auto respawn_timer = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto variance = sep->IsNumber(3) ? Strings::ToUnsignedInt(sep->arg[3]) : spawn2->GetVariance();
|
||||
|
||||
auto query = fmt::format(
|
||||
"UPDATE spawn2 SET respawntime = {}, variance = {} WHERE id = {}",
|
||||
@@ -343,13 +343,13 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::string spawngroup_name = sep->arg[2];
|
||||
auto spawn_limit = sep->IsNumber(3) ? std::stoi(sep->arg[3]) : 0;
|
||||
auto distance = sep->IsNumber(4) ? std::stof(sep->arg[4]) : 0.0f;
|
||||
auto minimum_x = sep->IsNumber(5) ? std::stof(sep->arg[5]) : 0.0f;
|
||||
auto maximum_x = sep->IsNumber(6) ? std::stof(sep->arg[6]) : 0.0f;
|
||||
auto minimum_y = sep->IsNumber(7) ? std::stof(sep->arg[7]) : 0.0f;
|
||||
auto maximum_y = sep->IsNumber(8) ? std::stof(sep->arg[8]) : 0.0f;
|
||||
auto delay = sep->IsNumber(9) ? std::stoi(sep->arg[9]) : 0;
|
||||
auto spawn_limit = sep->IsNumber(3) ? Strings::ToInt(sep->arg[3]) : 0;
|
||||
auto distance = sep->IsNumber(4) ? Strings::ToFloat(sep->arg[4]) : 0.0f;
|
||||
auto minimum_x = sep->IsNumber(5) ? Strings::ToFloat(sep->arg[5]) : 0.0f;
|
||||
auto maximum_x = sep->IsNumber(6) ? Strings::ToFloat(sep->arg[6]) : 0.0f;
|
||||
auto minimum_y = sep->IsNumber(7) ? Strings::ToFloat(sep->arg[7]) : 0.0f;
|
||||
auto maximum_y = sep->IsNumber(8) ? Strings::ToFloat(sep->arg[8]) : 0.0f;
|
||||
auto delay = sep->IsNumber(9) ? Strings::ToInt(sep->arg[9]) : 0;
|
||||
|
||||
auto query = fmt::format(
|
||||
"INSERT INTO spawngroup"
|
||||
@@ -497,7 +497,7 @@ void command_advnpcspawn(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
auto target = c->GetTarget()->CastToNPC();
|
||||
auto version = std::stoul(sep->arg[2]);
|
||||
auto version = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
auto query = fmt::format(
|
||||
"UPDATE spawn2 SET version = {} WHERE spawngroupID = {}",
|
||||
|
||||
@@ -21,7 +21,7 @@ void command_aggro(Client *c, const Seperator *sep)
|
||||
|
||||
NPC* target = c->GetTarget()->CastToNPC();
|
||||
|
||||
float distance = std::stof(sep->arg[1]);
|
||||
float distance = Strings::ToFloat(sep->arg[1]);
|
||||
bool verbose = !strcasecmp("-v", sep->arg[2]);
|
||||
entity_list.DescribeAggro(c, target, distance, verbose);
|
||||
}
|
||||
|
||||
+13
-13
@@ -64,7 +64,7 @@ void command_ai(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (is_faction) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto faction_id = std::stoi(sep->arg[2]);
|
||||
auto faction_id = Strings::ToInt(sep->arg[2]);
|
||||
auto faction_name = content_db.GetFactionName(faction_id);
|
||||
target->SetNPCFactionID(faction_id);
|
||||
c->Message(
|
||||
@@ -113,21 +113,21 @@ void command_ai(Client *c, const Seperator *sep)
|
||||
sep->IsNumber(5) &&
|
||||
sep->IsNumber(6)
|
||||
) {
|
||||
auto distance = std::stof(sep->arg[2]);
|
||||
auto min_x = std::stof(sep->arg[3]);
|
||||
auto max_x = std::stof(sep->arg[4]);
|
||||
auto min_y = std::stof(sep->arg[5]);
|
||||
auto max_y = std::stof(sep->arg[6]);
|
||||
auto distance = Strings::ToFloat(sep->arg[2]);
|
||||
auto min_x = Strings::ToFloat(sep->arg[3]);
|
||||
auto max_x = Strings::ToFloat(sep->arg[4]);
|
||||
auto min_y = Strings::ToFloat(sep->arg[5]);
|
||||
auto max_y = Strings::ToFloat(sep->arg[6]);
|
||||
|
||||
uint32 delay = 2500;
|
||||
uint32 minimum_delay = 2500;
|
||||
|
||||
if (sep->IsNumber(7)) {
|
||||
delay = std::stoul(sep->arg[7]);
|
||||
delay = Strings::ToUnsignedInt(sep->arg[7]);
|
||||
}
|
||||
|
||||
if (sep->IsNumber(8)) {
|
||||
minimum_delay = std::stoul(sep->arg[8]);
|
||||
minimum_delay = Strings::ToUnsignedInt(sep->arg[8]);
|
||||
}
|
||||
|
||||
target->CastToNPC()->AI_SetRoambox(
|
||||
@@ -176,18 +176,18 @@ void command_ai(Client *c, const Seperator *sep)
|
||||
sep->IsNumber(2) &&
|
||||
sep->IsNumber(3)
|
||||
) {
|
||||
auto max_distance = std::stof(sep->arg[2]);
|
||||
auto roam_distance_variance = std::stof(sep->arg[3]);
|
||||
auto max_distance = Strings::ToFloat(sep->arg[2]);
|
||||
auto roam_distance_variance = Strings::ToFloat(sep->arg[3]);
|
||||
|
||||
uint32 delay = 2500;
|
||||
uint32 minimum_delay = 2500;
|
||||
|
||||
if (sep->IsNumber(4)) {
|
||||
delay = std::stoul(sep->arg[4]);
|
||||
delay = Strings::ToUnsignedInt(sep->arg[4]);
|
||||
}
|
||||
|
||||
if (sep->IsNumber(5)) {
|
||||
minimum_delay = std::stoul(sep->arg[5]);
|
||||
minimum_delay = Strings::ToUnsignedInt(sep->arg[5]);
|
||||
}
|
||||
|
||||
target->CastToNPC()->AI_SetRoambox(
|
||||
@@ -233,7 +233,7 @@ void command_ai(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (is_spells) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto spell_list_id = std::stoul(sep->arg[2]);
|
||||
auto spell_list_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (spell_list_id >= 0) {
|
||||
target->CastToNPC()->AI_AddNPCSpells(spell_list_id);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ void command_appearance(Client *c, const Seperator *sep)
|
||||
if ((c->GetTarget())) {
|
||||
t = c->GetTarget();
|
||||
}
|
||||
t->SendAppearancePacket(atoi(sep->arg[1]), atoi(sep->arg[2]));
|
||||
t->SendAppearancePacket(Strings::ToInt(sep->arg[1]), Strings::ToInt(sep->arg[2]));
|
||||
c->Message(
|
||||
Chat::White,
|
||||
"Sending appearance packet: target=%s, type=%s, value=%s",
|
||||
|
||||
@@ -35,8 +35,8 @@ void command_appearanceeffects(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
const auto effect_id = std::stoul(sep->arg[2]);
|
||||
const auto slot_id = std::stoul(sep->arg[3]);
|
||||
const auto effect_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
const auto slot_id = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
|
||||
t->SendAppearanceEffect(
|
||||
effect_id,
|
||||
|
||||
@@ -39,7 +39,7 @@ void command_bugs(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto bug_id = std::stoul(sep->arg[2]);
|
||||
auto bug_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
auto r = BugReportsRepository::FindOne(content_db, bug_id);
|
||||
if (!r.id) {
|
||||
@@ -80,7 +80,7 @@ void command_bugs(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto bug_id = std::stoul(sep->arg[2]);
|
||||
auto bug_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto deleted_count = BugReportsRepository::DeleteOne(content_db, bug_id);
|
||||
if (!deleted_count) {
|
||||
c->Message(
|
||||
@@ -109,7 +109,7 @@ void command_bugs(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto bug_id = std::stoul(sep->arg[2]);
|
||||
auto bug_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto bug_review = sep->argplus[3];
|
||||
|
||||
auto r = BugReportsRepository::FindOne(content_db, bug_id);
|
||||
@@ -203,7 +203,7 @@ void command_bugs(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto bug_id = std::stoul(sep->arg[2]);
|
||||
auto bug_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
auto r = BugReportsRepository::FindOne(content_db, bug_id);
|
||||
if (!r.id) {
|
||||
|
||||
@@ -11,8 +11,8 @@ void command_camerashake(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto duration = std::stoi(sep->arg[1]);
|
||||
auto intensity = std::stoi(sep->arg[2]);
|
||||
auto duration = Strings::ToInt(sep->arg[1]);
|
||||
auto intensity = Strings::ToInt(sep->arg[2]);
|
||||
|
||||
auto pack = new ServerPacket(ServerOP_CameraShake, sizeof(ServerCameraShake_Struct));
|
||||
ServerCameraShake_Struct *camera_shake = (ServerCameraShake_Struct *) pack->pBuffer;
|
||||
|
||||
@@ -19,7 +19,7 @@ void command_castspell(Client *c, const Seperator *sep)
|
||||
);
|
||||
}
|
||||
else {
|
||||
uint16 spell_id = std::stoul(sep->arg[1]);
|
||||
uint16 spell_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
|
||||
if (CastRestrictedSpell(spell_id) && c->Admin() < commandCastSpecials) {
|
||||
c->Message(Chat::Red, "Unable to cast spell.");
|
||||
@@ -30,8 +30,8 @@ void command_castspell(Client *c, const Seperator *sep)
|
||||
else {
|
||||
bool instant_cast = (c->Admin() >= commandInstacast ? true : false);
|
||||
if (instant_cast && sep->IsNumber(2)) {
|
||||
instant_cast = std::stoi(sep->arg[2]) ? true : false;
|
||||
c->Message(Chat::White, fmt::format("{}", std::stoi(sep->arg[2])).c_str());
|
||||
instant_cast = Strings::ToInt(sep->arg[2]) ? true : false;
|
||||
c->Message(Chat::White, fmt::format("{}", Strings::ToInt(sep->arg[2])).c_str());
|
||||
}
|
||||
|
||||
if (c->Admin() >= commandInstacast && instant_cast) {
|
||||
|
||||
@@ -11,7 +11,7 @@ void command_chat(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto channel_id = static_cast<uint8>(std::stoul(sep->arg[1]));
|
||||
auto channel_id = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
std::string message = sep->argplus[2];
|
||||
if (!worldserver.SendChannelMessage(0, 0, channel_id, 0, 0, 100, message.c_str())) {
|
||||
c->Message(Chat::White, "World server is disconnected.");
|
||||
|
||||
@@ -81,7 +81,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
auto deleted_string = (
|
||||
corpses_deleted ?
|
||||
fmt::format(
|
||||
"{} Player corpse{} deleted.",
|
||||
"{} Player corpse{} deleted.",
|
||||
corpses_deleted,
|
||||
corpses_deleted != 1 ? "s" : ""
|
||||
) :
|
||||
@@ -104,7 +104,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (
|
||||
target->IsNPCCorpse() ||
|
||||
target->IsNPCCorpse() ||
|
||||
c->Admin() >= commandEditPlayerCorpses
|
||||
) {
|
||||
c->Message(
|
||||
@@ -116,7 +116,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
).c_str()
|
||||
);
|
||||
target->CastToCorpse()->Delete();
|
||||
}
|
||||
}
|
||||
} else if (is_list_npc) {
|
||||
entity_list.ListNPCCorpses(c);
|
||||
} else if (is_list_player) {
|
||||
@@ -150,7 +150,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto character_id = std::stoi(sep->arg[2]);
|
||||
auto character_id = Strings::ToInt(sep->arg[2]);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
@@ -174,7 +174,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
c->Message(Chat::White, "Your status is not high enough to reset looter on a player corpse.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
target->CastToCorpse()->ResetLooter();
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -196,7 +196,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (
|
||||
target->IsNPCCorpse() ||
|
||||
target->IsNPCCorpse() ||
|
||||
c->Admin() >= commandEditPlayerCorpses
|
||||
) {
|
||||
target->CastToCorpse()->RemoveCash();
|
||||
@@ -219,7 +219,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
c->Message(Chat::White, "Your status is not high enough to inspect the loot of a player corpse.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
target->CastToCorpse()->QueryLoot(c);
|
||||
} else if (is_lock) {
|
||||
if (!target || !target->IsCorpse()) {
|
||||
@@ -271,7 +271,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
bool bury_corpse = (
|
||||
sep->IsNumber(2) ?
|
||||
(
|
||||
std::stoi(sep->arg[2]) != 0 ?
|
||||
Strings::ToInt(sep->arg[2]) != 0 ?
|
||||
true :
|
||||
false
|
||||
) :
|
||||
@@ -302,7 +302,7 @@ void command_corpse(Client *c, const Seperator *sep)
|
||||
bool bury_corpse = (
|
||||
sep->IsNumber(2) ?
|
||||
(
|
||||
std::stoi(sep->arg[2]) != 0 ?
|
||||
Strings::ToInt(sep->arg[2]) != 0 ?
|
||||
true :
|
||||
false
|
||||
) :
|
||||
|
||||
@@ -18,8 +18,8 @@ void command_countitem(Client *c, const Seperator *sep)
|
||||
) {
|
||||
target = c->GetTarget();
|
||||
}
|
||||
|
||||
auto item_id = std::stoul(sep->arg[1]);
|
||||
|
||||
auto item_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
if (!database.GetItem(item_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@@ -14,6 +14,6 @@ void command_damage(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
int64 damage = std::stoll(sep->arg[1], nullptr, 10);
|
||||
const auto damage = Strings::ToBigInt(sep->arg[1]);
|
||||
target->Damage(c, damage, SPELL_UNKNOWN, EQ::skills::SkillHandtoHand, false);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ void command_databuckets(Client *c, const Seperator *sep)
|
||||
break;
|
||||
}
|
||||
if (strcasecmp(sep->arg[i], "limit") == 0) {
|
||||
limit = (uint8) atoi(sep->arg[i + 1]);
|
||||
limit = (uint8) Strings::ToInt(sep->arg[i + 1]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ void command_databuckets(Client *c, const Seperator *sep)
|
||||
"<td>Value</td>"
|
||||
"</tr>";
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
auto id = static_cast<uint32>(atoi(row[0]));
|
||||
auto id = static_cast<uint32>(Strings::ToInt(row[0]));
|
||||
std::string key = row[1];
|
||||
std::string value = row[2];
|
||||
std::string expires = row[3];
|
||||
|
||||
@@ -16,12 +16,12 @@ void command_date(Client *c, const Seperator *sep)
|
||||
TimeOfDay_Struct eq_time;
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(time(0), &eq_time);
|
||||
|
||||
auto year = static_cast<uint16>(std::stoul(sep->arg[1]));
|
||||
auto month = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
auto day = static_cast<uint8>(std::stoul(sep->arg[3]));
|
||||
auto year = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
auto month = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
auto day = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[3]));
|
||||
|
||||
auto hour = !sep->IsNumber(4) ? eq_time.hour : static_cast<uint8>(std::stoul(sep->arg[4]) + 1);
|
||||
auto minute = !sep->IsNumber(5) ? eq_time.minute : static_cast<uint8>(std::stoul(sep->arg[5]));
|
||||
auto hour = !sep->IsNumber(4) ? eq_time.hour : static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[4]) + 1);
|
||||
auto minute = !sep->IsNumber(5) ? eq_time.minute : static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[5]));
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@@ -16,12 +16,12 @@ void command_dbspawn2(Client *c, const Seperator *sep)
|
||||
|
||||
auto position = c->GetPosition();
|
||||
|
||||
auto spawngroup_id = std::stoul(sep->arg[1]);
|
||||
auto respawn = std::stoul(sep->arg[2]);
|
||||
auto variance = std::stoul(sep->arg[3]);
|
||||
auto spawngroup_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
auto respawn = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto variance = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
|
||||
auto condition_id = sep->IsNumber(4) ? static_cast<uint16>(std::stoul(sep->arg[4])) : static_cast<uint16>(0);
|
||||
auto condition_minimum = sep->IsNumber(5) ? static_cast<int16>(std::stoul(sep->arg[5])) : static_cast<int16>(0);
|
||||
auto condition_id = sep->IsNumber(4) ? static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[4])) : static_cast<uint16>(0);
|
||||
auto condition_minimum = sep->IsNumber(5) ? static_cast<int16>(Strings::ToUnsignedInt(sep->arg[5])) : static_cast<int16>(0);
|
||||
|
||||
if (!database.CreateSpawn2(
|
||||
c,
|
||||
|
||||
@@ -13,7 +13,7 @@ void command_delacct(Client *c, const Seperator *sep)
|
||||
std::string account_name;
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
account_id = std::stoul(sep->arg[1]);
|
||||
account_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
auto a = AccountRepository::FindOne(content_db, account_id);
|
||||
if (!a.id) {
|
||||
c->Message(
|
||||
|
||||
@@ -7,14 +7,14 @@ void command_delpetition(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(Chat::Red, "Attempting to delete petition number: %i", atoi(sep->argplus[1]));
|
||||
std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", atoi(sep->argplus[1]));
|
||||
c->Message(Chat::Red, "Attempting to delete petition number: %i", Strings::ToInt(sep->argplus[1]));
|
||||
std::string query = StringFormat("DELETE FROM petitions WHERE petid = %i", Strings::ToInt(sep->argplus[1]));
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LogInfo("Delete petition request from [{}], petition number:", c->GetName(), atoi(sep->argplus[1]));
|
||||
LogInfo("Delete petition request from [{}], petition number:", c->GetName(), Strings::ToInt(sep->argplus[1]));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ void command_depop(Client *c, const Seperator *sep)
|
||||
auto start_spawn_timer = false;
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
start_spawn_timer = std::stoi(sep->arg[1]) ? true : false;
|
||||
start_spawn_timer = Strings::ToInt(sep->arg[1]) ? true : false;
|
||||
}
|
||||
|
||||
c->Message(
|
||||
|
||||
@@ -5,7 +5,7 @@ void command_depopzone(Client *c, const Seperator *sep)
|
||||
auto start_spawn_timers = false;
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
start_spawn_timers = std::stoi(sep->arg[1]) ? true : false;
|
||||
start_spawn_timers = Strings::ToInt(sep->arg[1]) ? true : false;
|
||||
}
|
||||
|
||||
zone->Depop(start_spawn_timers);
|
||||
|
||||
@@ -8,8 +8,8 @@ void command_disablerecipe(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto recipe_id = std::stoul(sep->arg[1]);
|
||||
if (!recipe_id) {
|
||||
auto recipe_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
if (!recipe_id) {
|
||||
c->Message(Chat::White, "Usage: #disablerecipe [Recipe ID]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ void command_doanim(Client *c, const Seperator *sep)
|
||||
auto animation_speed = 0;
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
animation_id = std::stoi(sep->arg[1]);
|
||||
animation_id = Strings::ToInt(sep->arg[1]);
|
||||
|
||||
const auto& a = animation_names_map.find(animation_id);
|
||||
if (a != animation_names_map.end()) {
|
||||
@@ -69,7 +69,7 @@ void command_doanim(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(2)) {
|
||||
animation_speed = std::stoi(sep->arg[2]);
|
||||
animation_speed = Strings::ToInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
const auto speed_message = (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "door_manipulation.h"
|
||||
#include "../doors.h"
|
||||
#include "../../common/misc_functions.h"
|
||||
#include "../../common/strings.h"
|
||||
|
||||
#define MAX_CLIENT_MESSAGE_LENGTH 2000
|
||||
|
||||
@@ -54,23 +55,23 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
float set_size = 0.0f;
|
||||
|
||||
if (arg2 == move_x_action) {
|
||||
x_move = std::atof(arg3.c_str());
|
||||
x_move = Strings::ToFloat(arg3.c_str());
|
||||
}
|
||||
|
||||
if (arg2 == move_y_action) {
|
||||
y_move = std::atof(arg3.c_str());
|
||||
y_move = Strings::ToFloat(arg3.c_str());
|
||||
}
|
||||
|
||||
if (arg2 == move_z_action) {
|
||||
z_move = std::atof(arg3.c_str());
|
||||
z_move = Strings::ToFloat(arg3.c_str());
|
||||
}
|
||||
|
||||
if (arg2 == move_h_action) {
|
||||
h_move = std::atof(arg3.c_str());
|
||||
h_move = Strings::ToFloat(arg3.c_str());
|
||||
}
|
||||
|
||||
if (arg2 == set_size_action) {
|
||||
set_size = std::atof(arg3.c_str());
|
||||
set_size = Strings::ToFloat(arg3.c_str());
|
||||
}
|
||||
|
||||
door->SetLocation(
|
||||
@@ -369,7 +370,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "opentype" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetOpenType(std::atoi(arg2.c_str()));
|
||||
door->SetOpenType(Strings::ToInt(arg2.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +378,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "setincline" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetIncline(std::atoi(arg2.c_str()));
|
||||
door->SetIncline(Strings::ToInt(arg2.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +386,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "setinvertstate" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetInvertState(std::atoi(arg2.c_str()));
|
||||
door->SetInvertState(Strings::ToInt(arg2.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +403,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
||||
if (arg1 == "setinclineinc" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||
if (door) {
|
||||
door->SetIncline(door->GetIncline() + std::atoi(arg2.c_str()));
|
||||
door->SetIncline(door->GetIncline() + Strings::ToInt(arg2.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,23 +48,23 @@ void command_dye(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (arguments >= 1 && sep->IsNumber(1)) {
|
||||
slot = atoi(sep->arg[1]);
|
||||
slot = Strings::ToInt(sep->arg[1]);
|
||||
}
|
||||
|
||||
if (arguments >= 2 && sep->IsNumber(2)) {
|
||||
red = atoi(sep->arg[2]);
|
||||
red = Strings::ToInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
if (arguments >= 3 && sep->IsNumber(3)) {
|
||||
green = atoi(sep->arg[3]);
|
||||
green = Strings::ToInt(sep->arg[3]);
|
||||
}
|
||||
|
||||
if (arguments >= 4 && sep->IsNumber(4)) {
|
||||
blue = atoi(sep->arg[4]);
|
||||
blue = Strings::ToInt(sep->arg[4]);
|
||||
}
|
||||
|
||||
if (arguments >= 5 && sep->IsNumber(5)) {
|
||||
use_tint = atoi(sep->arg[5]);
|
||||
use_tint = Strings::ToInt(sep->arg[5]);
|
||||
}
|
||||
|
||||
if (RuleB(Command, DyeCommandRequiresDyes)) {
|
||||
|
||||
@@ -14,7 +14,7 @@ void command_editmassrespawn(Client *c, const Seperator *sep)
|
||||
|
||||
int change_respawn_seconds = 0;
|
||||
if (sep->arg[2] && sep->IsNumber(2)) {
|
||||
change_respawn_seconds = atoi(sep->arg[2]);
|
||||
change_respawn_seconds = Strings::ToInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
bool change_apply = false;
|
||||
|
||||
@@ -22,7 +22,7 @@ void command_emote(Client *c, const Seperator *sep)
|
||||
bool is_zone = !strcasecmp(sep->arg[1], "zone");
|
||||
|
||||
const std::string emote_message = sep->argplus[3];
|
||||
const auto emote_type = std::stoul(sep->arg[2]);
|
||||
const auto emote_type = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
if (is_zone) {
|
||||
if (!Strings::Contains(emote_message, "^")) {
|
||||
|
||||
@@ -21,7 +21,7 @@ void command_emotesearch(Client *c, const Seperator *sep)
|
||||
while (iterator.MoreElements()) {
|
||||
auto &e = iterator.GetData();
|
||||
auto current_text = Strings::ToLower(e->text);
|
||||
|
||||
|
||||
if (Strings::Contains(current_text, Strings::ToLower(search_criteria))) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -64,8 +64,8 @@ void command_emotesearch(Client *c, const Seperator *sep)
|
||||
iterator.Advance();
|
||||
}
|
||||
} else {
|
||||
auto emote_id = std::stoul(search_criteria);
|
||||
|
||||
auto emote_id = Strings::ToUnsignedInt(search_criteria);
|
||||
|
||||
LinkedListIterator<NPC_Emote_Struct *> iterator(zone->NPCEmoteList);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
|
||||
@@ -8,8 +8,8 @@ void command_enablerecipe(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto recipe_id = std::stoul(sep->arg[1]);
|
||||
if (!recipe_id) {
|
||||
auto recipe_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
if (!recipe_id) {
|
||||
c->Message(Chat::White, "Usage: #enablerecipe [Recipe ID]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
void command_equipitem(Client *c, const Seperator *sep)
|
||||
{
|
||||
uint32 slot_id = atoi(sep->arg[1]);
|
||||
uint32 slot_id = Strings::ToInt(sep->arg[1]);
|
||||
if (sep->IsNumber(1) && (slot_id >= EQ::invslot::EQUIPMENT_BEGIN && slot_id <= EQ::invslot::EQUIPMENT_END)) {
|
||||
const EQ::ItemInstance *from_inst = c->GetInv().GetItem(EQ::invslot::slotCursor);
|
||||
const EQ::ItemInstance *to_inst = c->GetInv().GetItem(slot_id); // added (desync issue when forcing stack to stack)
|
||||
|
||||
@@ -53,7 +53,7 @@ void command_faction(Client *c, const Seperator *sep)
|
||||
uint32 found_count = 0;
|
||||
for (auto row : results) {
|
||||
uint32 faction_number = (found_count + 1);
|
||||
auto faction_id = std::stoul(row[0]);
|
||||
auto faction_id = Strings::ToUnsignedInt(row[0]);
|
||||
std::string faction_name = row[1];
|
||||
std::string faction_value = row[2];
|
||||
std::string reset_link = Saylink::Silent(
|
||||
@@ -107,7 +107,7 @@ void command_faction(Client *c, const Seperator *sep)
|
||||
)
|
||||
) {
|
||||
uint32 character_id = target->CharacterID();
|
||||
uint32 faction_id = std::stoul(faction_filter.c_str());
|
||||
uint32 faction_id = Strings::ToUnsignedInt(faction_filter.c_str());
|
||||
if (target->ReloadCharacterFaction(target, faction_id, character_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@@ -14,5 +14,5 @@ void command_faction_association(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
target->RewardFaction(atoi(sep->arg[1]), atoi(sep->arg[2]));
|
||||
target->RewardFaction(Strings::ToInt(sep->arg[1]), Strings::ToInt(sep->arg[2]));
|
||||
}
|
||||
|
||||
@@ -116,11 +116,11 @@ void command_feature(Client *c, const Seperator *sep)
|
||||
float value_changed = 0.0f;
|
||||
|
||||
if (is_beard) {
|
||||
face.beard = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.beard = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Beard";
|
||||
value_changed = face.beard;
|
||||
} else if (is_beard_color) {
|
||||
face.beardcolor = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.beardcolor = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Beard Color";
|
||||
value_changed = face.beardcolor;
|
||||
} else if (is_details) {
|
||||
@@ -129,31 +129,31 @@ void command_feature(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
face.drakkin_details = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.drakkin_details = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Drakkin Details";
|
||||
value_changed = static_cast<float>(face.drakkin_details);
|
||||
} else if (is_eyes) {
|
||||
face.eyecolor1 = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.eyecolor1 = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Eyes";
|
||||
value_changed = face.eyecolor1; // eyecolor2 isn't used
|
||||
} else if (is_face) {
|
||||
face.face = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.face = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Face";
|
||||
value_changed = face.face;
|
||||
} else if (is_gender) {
|
||||
gender = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
gender = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Gender";
|
||||
value_changed = gender;
|
||||
} else if (is_hair) {
|
||||
face.hairstyle = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.hairstyle = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Hair";
|
||||
value_changed = face.hairstyle;
|
||||
} else if (is_hair_color) {
|
||||
face.haircolor = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.haircolor = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Hair Color";
|
||||
value_changed = face.haircolor;
|
||||
} else if (is_helm) {
|
||||
helm_texture = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
helm_texture = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Helmet Texture";
|
||||
value_changed = helm_texture;
|
||||
} else if (is_heritage) {
|
||||
@@ -162,11 +162,11 @@ void command_feature(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
face.drakkin_heritage = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.drakkin_heritage = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Drakkin Heritage";
|
||||
value_changed = static_cast<float>(face.drakkin_heritage);
|
||||
} else if (is_race) {
|
||||
race = static_cast<uint16>(std::stoul(sep->arg[2]));
|
||||
race = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Race";
|
||||
value_changed = race;
|
||||
} else if (is_size) {
|
||||
@@ -174,11 +174,11 @@ void command_feature(Client *c, const Seperator *sep)
|
||||
if (is_size_alias) {
|
||||
c->Message(Chat::White, "Usage: #feature size [Size] - Change your or your target's Size temporarily (Valid values are 0 to 255, decimal increments are allowed.)");
|
||||
if (sep->arg[1] && Strings::IsFloat(sep->arg[1])) {
|
||||
size = std::stof(sep->arg[1]);
|
||||
size = Strings::ToFloat(sep->arg[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
size = std::stof(sep->arg[2]);
|
||||
size = Strings::ToFloat(sep->arg[2]);
|
||||
}
|
||||
|
||||
if (size < 0 || size > 255) {
|
||||
@@ -194,11 +194,11 @@ void command_feature(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
face.drakkin_tattoo = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
face.drakkin_tattoo = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Drakkin Tattoos";
|
||||
value_changed = static_cast<float>(face.drakkin_tattoo);
|
||||
} else if (is_texture) {
|
||||
texture = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
texture = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
feature_changed = "Texture";
|
||||
value_changed = texture;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ void command_findaa(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
int aa_id = std::stoi(sep->arg[1]);
|
||||
int aa_id = Strings::ToInt(sep->arg[1]);
|
||||
auto aa_name = zone->GetAAName(aa_id);
|
||||
if (!aa_name.empty()) {
|
||||
c->Message(
|
||||
|
||||
@@ -10,7 +10,7 @@ void command_findcharacter(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
const auto character_id = std::stoul(sep->arg[1]);
|
||||
const auto character_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
|
||||
const auto& e = CharacterDataRepository::FindOne(content_db, character_id);
|
||||
if (!e.id) {
|
||||
|
||||
@@ -9,7 +9,7 @@ void command_findclass(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
int class_id = std::stoi(sep->arg[1]);
|
||||
int class_id = Strings::ToInt(sep->arg[1]);
|
||||
if (class_id >= WARRIOR && class_id <= MERCENARY_MASTER) {
|
||||
std::string class_name = GetClassIDName(class_id);
|
||||
c->Message(
|
||||
|
||||
@@ -10,7 +10,7 @@ void command_findfaction(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
int faction_id = std::stoi(sep->arg[1]);
|
||||
int faction_id = Strings::ToInt(sep->arg[1]);
|
||||
auto faction_name = content_db.GetFactionName(faction_id);
|
||||
if (!faction_name.empty()) {
|
||||
c->Message(
|
||||
|
||||
@@ -9,7 +9,7 @@ void command_findrace(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
auto race_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
||||
auto race_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
std::string race_name = GetRaceIDName(race_id);
|
||||
if (
|
||||
race_id >= RACE_HUMAN_1 &&
|
||||
|
||||
@@ -11,7 +11,7 @@ void command_findrecipe(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
auto recipe_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
||||
auto recipe_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
auto r = TradeskillRecipeRepository::GetWhere(
|
||||
database,
|
||||
fmt::format("id = {}", recipe_id)
|
||||
@@ -42,7 +42,7 @@ void command_findrecipe(Client *c, const Seperator *sep)
|
||||
} else {
|
||||
auto search_criteria = Strings::ToLower(sep->argplus[1]);
|
||||
int found_count = 0;
|
||||
|
||||
|
||||
auto rl = TradeskillRecipeRepository::GetWhere(
|
||||
database,
|
||||
fmt::format("`name` LIKE '%{}%' ORDER BY `id` ASC", search_criteria)
|
||||
|
||||
@@ -11,7 +11,7 @@ void command_findskill(Client *c, const Seperator *sep)
|
||||
|
||||
std::map<EQ::skills::SkillType, std::string> skills = EQ::skills::GetSkillTypeMap();
|
||||
if (sep->IsNumber(1)) {
|
||||
int skill_id = std::stoi(sep->arg[1]);
|
||||
int skill_id = Strings::ToInt(sep->arg[1]);
|
||||
if (skill_id >= EQ::skills::Skill1HBlunt && skill_id < EQ::skills::SkillCount) {
|
||||
for (auto skill : skills) {
|
||||
if (skill_id == skill.first) {
|
||||
|
||||
@@ -15,7 +15,7 @@ void command_findspell(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
int spell_id = std::stoi(sep->arg[1]);
|
||||
int spell_id = Strings::ToInt(sep->arg[1]);
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@@ -11,7 +11,7 @@ void command_findtask(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
auto task_id = std::stoul(sep->arg[1]);
|
||||
auto task_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
auto task_name = task_manager->GetTaskName(task_id);
|
||||
|
||||
std::string task_message = (
|
||||
|
||||
@@ -9,7 +9,7 @@ void command_findzone(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::string query;
|
||||
int id = atoi((const char *) sep->arg[1]);
|
||||
int id = Strings::ToInt((const char *) sep->arg[1]);
|
||||
|
||||
std::string arg1 = sep->arg[1];
|
||||
|
||||
@@ -53,7 +53,7 @@ void command_findzone(Client *c, const Seperator *sep)
|
||||
std::string zone_id = row[0];
|
||||
std::string short_name = row[1];
|
||||
std::string long_name = row[2];
|
||||
int version = atoi(row[3]);
|
||||
int version = Strings::ToInt(row[3]);
|
||||
|
||||
if (++count > maxrows) {
|
||||
c->Message(Chat::White, "%i zones shown. Too many results.", maxrows);
|
||||
|
||||
@@ -30,8 +30,8 @@ void command_flag(Client *c, const Seperator *sep)
|
||||
target->UpdateAdmin();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (
|
||||
!sep->IsNumber(1) ||
|
||||
strlen(sep->arg[2]) == 0
|
||||
@@ -40,7 +40,7 @@ void command_flag(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto status = std::stoi(sep->arg[1]);
|
||||
auto status = Strings::ToInt(sep->arg[1]);
|
||||
if (status < -2 || status > 255) {
|
||||
c->Message(Chat::White, "The lowest a status level can go is -2 and the highest a status level can go is 255.");
|
||||
return;
|
||||
@@ -48,7 +48,7 @@ void command_flag(Client *c, const Seperator *sep)
|
||||
|
||||
std::string account_name = sep->argplus[2];
|
||||
auto account_id = database.GetAccountIDByChar(account_name.c_str());
|
||||
|
||||
|
||||
if (c->Admin() < commandChangeFlags) { //this check makes banning players by less than this level impossible, but i'll leave it in anyways
|
||||
c->Message(Chat::White, "You may only refresh your own flag, doing so now.");
|
||||
c->UpdateAdmin();
|
||||
|
||||
@@ -82,7 +82,7 @@ void command_flagedit(Client *c, const Seperator *sep)
|
||||
if (is_give) {
|
||||
uint32 zone_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
ZoneID(sep->arg[2])
|
||||
);
|
||||
std::string zone_short_name = Strings::ToLower(ZoneName(zone_id, true));
|
||||
@@ -129,7 +129,7 @@ void command_flagedit(Client *c, const Seperator *sep)
|
||||
row[0],
|
||||
row[1],
|
||||
(
|
||||
std::stoi(row[2]) != 0 ?
|
||||
Strings::ToInt(row[2]) != 0 ?
|
||||
fmt::format(
|
||||
"[Version {}]",
|
||||
row[2]
|
||||
@@ -151,7 +151,7 @@ void command_flagedit(Client *c, const Seperator *sep)
|
||||
} else if (is_lock) {
|
||||
uint32 zone_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
ZoneID(sep->arg[2])
|
||||
);
|
||||
std::string zone_short_name = Strings::ToLower(ZoneName(zone_id, true));
|
||||
@@ -206,7 +206,7 @@ void command_flagedit(Client *c, const Seperator *sep)
|
||||
} else if (is_take) {
|
||||
uint32 zone_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
ZoneID(sep->arg[2])
|
||||
);
|
||||
std::string zone_short_name = Strings::ToLower(ZoneName(zone_id, true));
|
||||
@@ -234,7 +234,7 @@ void command_flagedit(Client *c, const Seperator *sep)
|
||||
} else if (is_unlock) {
|
||||
uint32 zone_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
ZoneID(sep->arg[2])
|
||||
);
|
||||
std::string zone_short_name = Strings::ToLower(ZoneName(zone_id, true));
|
||||
|
||||
@@ -13,7 +13,7 @@ void command_flymode(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget();
|
||||
}
|
||||
|
||||
auto flymode_id = std::stoul(sep->arg[1]);
|
||||
auto flymode_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
if (!EQ::ValueWithin(flymode_id, EQ::constants::GravityBehavior::Ground, EQ::constants::GravityBehavior::LevitateWhileRunning)) {
|
||||
c->Message(Chat::White, "Usage:: #flymode [Flymode ID]");
|
||||
c->Message(Chat::White, "0 = Ground, 1 = Flying, 2 = Levitating, 3 = Water, 4 = Floating, 5 = Levitating While Running");
|
||||
|
||||
@@ -13,7 +13,7 @@ void command_gassign(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto grid_id = std::stoul(sep->arg[1]);
|
||||
auto grid_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
|
||||
auto target = c->GetTarget()->CastToNPC();
|
||||
if (target->GetSpawnPointID() > 0) {
|
||||
|
||||
@@ -97,8 +97,8 @@ void command_gearup(Client *c, const Seperator *sep)
|
||||
std::set<int> equipped;
|
||||
|
||||
for (auto row : results) {
|
||||
auto item_id = std::stoul(row[0]);
|
||||
auto slot_id = static_cast<uint16>(std::stoul(row[1]));
|
||||
auto item_id = Strings::ToUnsignedInt(row[0]);
|
||||
auto slot_id = static_cast<uint16>(Strings::ToUnsignedInt(row[1]));
|
||||
|
||||
if (equipped.find(slot_id) != equipped.end()) {
|
||||
if (slot_id == EQ::invslot::slotEar1) {
|
||||
@@ -178,7 +178,7 @@ void command_gearup(Client *c, const Seperator *sep)
|
||||
c->Message(Chat::White, "Choose Armor by Expansion:");
|
||||
std::string message;
|
||||
for (auto row : results) {
|
||||
const auto expansion = std::stoi(row[0]);
|
||||
const auto expansion = Strings::ToInt(row[0]);
|
||||
message += fmt::format(
|
||||
"[{}] ",
|
||||
Saylink::Silent(
|
||||
|
||||
@@ -14,7 +14,7 @@ void command_gender(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget();
|
||||
}
|
||||
|
||||
auto gender_id = std::stoi(sep->arg[1]);
|
||||
auto gender_id = Strings::ToInt(sep->arg[1]);
|
||||
if (gender_id < 0 || gender_id > 2) {
|
||||
c->Message(Chat::White, "Usage: #gender [Gender ID]");
|
||||
c->Message(Chat::White, "Genders: 0 = Male, 1 = Female, 2 = Neuter");
|
||||
|
||||
@@ -34,7 +34,7 @@ void command_giveitem(Client *c, const Seperator *sep)
|
||||
augment_six = link_body.augment_6;
|
||||
}
|
||||
else if (sep->IsNumber(1)) {
|
||||
item_id = atoi(sep->arg[1]);
|
||||
item_id = Strings::ToInt(sep->arg[1]);
|
||||
}
|
||||
else if (!sep->IsNumber(1)) {
|
||||
c->Message(
|
||||
@@ -65,31 +65,31 @@ void command_giveitem(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (arguments >= 2 && sep->IsNumber(2)) {
|
||||
charges = atoi(sep->arg[2]);
|
||||
charges = Strings::ToInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
if (arguments >= 3 && sep->IsNumber(3)) {
|
||||
augment_one = atoi(sep->arg[3]);
|
||||
augment_one = Strings::ToInt(sep->arg[3]);
|
||||
}
|
||||
|
||||
if (arguments >= 4 && sep->IsNumber(4)) {
|
||||
augment_two = atoi(sep->arg[4]);
|
||||
augment_two = Strings::ToInt(sep->arg[4]);
|
||||
}
|
||||
|
||||
if (arguments >= 5 && sep->IsNumber(5)) {
|
||||
augment_three = atoi(sep->arg[5]);
|
||||
augment_three = Strings::ToInt(sep->arg[5]);
|
||||
}
|
||||
|
||||
if (arguments >= 6 && sep->IsNumber(6)) {
|
||||
augment_four = atoi(sep->arg[6]);
|
||||
augment_four = Strings::ToInt(sep->arg[6]);
|
||||
}
|
||||
|
||||
if (arguments >= 7 && sep->IsNumber(7)) {
|
||||
augment_five = atoi(sep->arg[7]);
|
||||
augment_five = Strings::ToInt(sep->arg[7]);
|
||||
}
|
||||
|
||||
if (arguments == 8 && sep->IsNumber(8)) {
|
||||
augment_six = atoi(sep->arg[8]);
|
||||
augment_six = Strings::ToInt(sep->arg[8]);
|
||||
}
|
||||
|
||||
client_target->SummonItem(
|
||||
|
||||
@@ -14,10 +14,10 @@ void command_givemoney(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
uint32 platinum = std::stoul(sep->arg[1]);
|
||||
uint32 gold = sep->IsNumber(2) ? std::stoul(sep->arg[2]) : 0;
|
||||
uint32 silver = sep->IsNumber(3) ? std::stoul(sep->arg[3]) : 0;
|
||||
uint32 copper = sep->IsNumber(4) ? std::stoul(sep->arg[4]) : 0;
|
||||
uint32 platinum = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
uint32 gold = sep->IsNumber(2) ? Strings::ToUnsignedInt(sep->arg[2]) : 0;
|
||||
uint32 silver = sep->IsNumber(3) ? Strings::ToUnsignedInt(sep->arg[3]) : 0;
|
||||
uint32 copper = sep->IsNumber(4) ? Strings::ToUnsignedInt(sep->arg[4]) : 0;
|
||||
if (!platinum && !gold && !silver && !copper) {
|
||||
c->Message(Chat::Red, "Usage: #Usage: #givemoney [Platinum] [Gold] [Silver] [Copper]");
|
||||
return;
|
||||
|
||||
@@ -11,7 +11,7 @@ void command_gmzone(Client *c, const Seperator *sep)
|
||||
|
||||
std::string zone_short_name = Strings::ToLower(
|
||||
sep->IsNumber(1) ?
|
||||
ZoneName(std::stoul(sep->arg[1]), true) :
|
||||
ZoneName(Strings::ToUnsignedInt(sep->arg[1]), true) :
|
||||
sep->arg[1]
|
||||
);
|
||||
bool is_unknown_zone = zone_short_name.find("unknown") != std::string::npos;
|
||||
@@ -41,7 +41,7 @@ void command_gmzone(Client *c, const Seperator *sep)
|
||||
|
||||
auto zone_version = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
0
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ void command_gmzone(Client *c, const Seperator *sep)
|
||||
uint32 duration = 100000000;
|
||||
|
||||
if (!existing_zone_instance.empty()) {
|
||||
instance_id = std::stoi(existing_zone_instance);
|
||||
instance_id = Strings::ToInt(existing_zone_instance);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
|
||||
@@ -49,10 +49,10 @@ void command_goto(Client *c, const Seperator *sep)
|
||||
c->MovePC(
|
||||
zone->GetZoneID(),
|
||||
zone->GetInstanceID(),
|
||||
atof(sep->arg[1]),
|
||||
atof(sep->arg[2]),
|
||||
atof(sep->arg[3]),
|
||||
(sep->arg[4] ? atof(sep->arg[4]) : c->GetHeading())
|
||||
Strings::ToFloat(sep->arg[1]),
|
||||
Strings::ToFloat(sep->arg[2]),
|
||||
Strings::ToFloat(sep->arg[3]),
|
||||
(sep->arg[4] ? Strings::ToFloat(sep->arg[4]) : c->GetHeading())
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -14,9 +14,9 @@ void command_grid(Client *c, const Seperator *sep)
|
||||
);
|
||||
}
|
||||
else if (strcasecmp("add", command_type) == 0) {
|
||||
auto grid_id = atoi(sep->arg[2]);
|
||||
auto wander_type = atoi(sep->arg[3]);
|
||||
auto pause_type = atoi(sep->arg[4]);
|
||||
auto grid_id = Strings::ToInt(sep->arg[2]);
|
||||
auto wander_type = Strings::ToInt(sep->arg[3]);
|
||||
auto pause_type = Strings::ToInt(sep->arg[4]);
|
||||
if (!content_db.GridExistsInZone(zone_id, grid_id)) {
|
||||
content_db.ModifyGrid(c, false, grid_id, wander_type, pause_type, zone_id);
|
||||
c->Message(
|
||||
@@ -76,7 +76,7 @@ void command_grid(Client *c, const Seperator *sep)
|
||||
// Spawn grid nodes
|
||||
std::map<std::vector<float>, int32> zoffset;
|
||||
for (auto row : results) {
|
||||
glm::vec4 node_position = glm::vec4(atof(row[0]), atof(row[1]), atof(row[2]), atof(row[3]));
|
||||
glm::vec4 node_position = glm::vec4(Strings::ToFloat(row[0]), Strings::ToFloat(row[1]), Strings::ToFloat(row[2]), Strings::ToFloat(row[3]));
|
||||
std::vector<float> node_loc{
|
||||
node_position.x,
|
||||
node_position.y,
|
||||
@@ -95,7 +95,7 @@ void command_grid(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
node_position.z += zoffset[node_loc];
|
||||
NPC::SpawnGridNodeNPC(node_position, grid_id, atoi(row[4]), zoffset[node_loc]);
|
||||
NPC::SpawnGridNodeNPC(node_position, grid_id, Strings::ToInt(row[4]), zoffset[node_loc]);
|
||||
}
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -123,7 +123,7 @@ void command_grid(Client *c, const Seperator *sep)
|
||||
);
|
||||
}
|
||||
else if (strcasecmp("delete", command_type) == 0) {
|
||||
auto grid_id = atoi(sep->arg[2]);
|
||||
auto grid_id = Strings::ToInt(sep->arg[2]);
|
||||
content_db.ModifyGrid(c, true, grid_id, 0, 0, zone_id);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
+11
-11
@@ -53,7 +53,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
} else {
|
||||
auto leader_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
database.GetCharacterID(sep->arg[2])
|
||||
);
|
||||
auto leader_name = database.GetCharNameByID(leader_id);
|
||||
@@ -132,7 +132,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
if (!sep->IsNumber(2)) {
|
||||
c->Message(Chat::White, "Usage: #guild delete [Guild ID]");
|
||||
} else {
|
||||
auto guild_id = std::stoul(sep->arg[2]);
|
||||
auto guild_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (!guild_mgr.GuildExists(guild_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -185,7 +185,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
if (arguments != 2 || !sep->IsNumber(2)) {
|
||||
guild_id = c->GuildID();
|
||||
} else if (c->Admin() >= minStatusToEditOtherGuilds) {
|
||||
guild_id = std::stoul(sep->arg[2]);
|
||||
guild_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
if (guild_id != GUILD_NONE) {
|
||||
@@ -203,7 +203,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
if (!sep->IsNumber(2)) {
|
||||
c->Message(Chat::White, "Usage: #guild rename [Guild ID] [New Guild Name]");
|
||||
} else {
|
||||
auto guild_id = std::stoul(sep->arg[2]);
|
||||
auto guild_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (!guild_mgr.GuildExists(guild_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -246,7 +246,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (is_search) {
|
||||
if (Strings::IsNumber(sep->arg[2])) {
|
||||
const auto guild_id = std::stoul(sep->arg[2]);
|
||||
const auto guild_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
guild_mgr.ListGuilds(c, guild_id);
|
||||
} else {
|
||||
@@ -262,7 +262,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
c->Message(Chat::White, "#guild set [Character ID|Character Name] [Guild ID] (Guild ID 0 is Guildless)");
|
||||
return;
|
||||
} else {
|
||||
auto guild_id = std::stoul(sep->arg[3]);
|
||||
auto guild_id = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
if (!guild_id) {
|
||||
guild_id = GUILD_NONE;
|
||||
} else if (!guild_mgr.GuildExists(guild_id)) {
|
||||
@@ -278,7 +278,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
|
||||
auto character_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
database.GetCharacterID(sep->arg[2])
|
||||
);
|
||||
auto character_name = database.GetCharNameByID(character_id);
|
||||
@@ -348,7 +348,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
} else {
|
||||
auto leader_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
database.GetCharacterID(sep->arg[2])
|
||||
);
|
||||
auto leader_name = database.GetCharNameByID(leader_id);
|
||||
@@ -377,7 +377,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
);
|
||||
}
|
||||
else {
|
||||
auto guild_id = std::stoul(sep->arg[2]);
|
||||
auto guild_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (!guild_mgr.GuildExists(guild_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -419,7 +419,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
}
|
||||
}
|
||||
} else if (is_set_rank) {
|
||||
auto rank = static_cast<uint8>(std::stoul(sep->arg[3]));
|
||||
auto rank = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[3]));
|
||||
if (!sep->IsNumber(3)) {
|
||||
c->Message(Chat::White, "#guild setrank [Character ID|Character Name] [Rank]");
|
||||
} else if (rank < 0 || rank > GUILD_MAX_RANK) {
|
||||
@@ -433,7 +433,7 @@ void command_guild(Client *c, const Seperator *sep)
|
||||
} else {
|
||||
auto character_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
database.GetCharacterID(sep->arg[2])
|
||||
);
|
||||
auto character_name = database.GetCharNameByID(character_id);
|
||||
|
||||
@@ -4,7 +4,7 @@ void command_haste(Client *c, const Seperator *sep)
|
||||
{
|
||||
// #haste command to set client attack speed. Takes a percentage (100 = twice normal attack speed)
|
||||
if (sep->arg[1][0] != 0) {
|
||||
uint16 Haste = atoi(sep->arg[1]);
|
||||
uint16 Haste = Strings::ToInt(sep->arg[1]);
|
||||
if (Haste > 85) {
|
||||
Haste = 85;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ void command_heromodel(Client *c, const Seperator *sep)
|
||||
t = c->GetTarget();
|
||||
}
|
||||
|
||||
auto hero_forge_model = Strings::IsNumber(sep->arg[1]) ? std::stoul(sep->arg[1]) : 0;
|
||||
auto hero_forge_model = Strings::IsNumber(sep->arg[1]) ? Strings::ToUnsignedInt(sep->arg[1]) : 0;
|
||||
|
||||
if (arguments > 1) {
|
||||
auto slot = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
auto slot = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
c->GetTarget()->SendTextureWC(slot, 0, hero_forge_model, 0, 0, 0);
|
||||
} else {
|
||||
if (hero_forge_model) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
void command_incstat(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (sep->arg[1][0] && sep->arg[2][0] && c->GetTarget() != 0 && c->GetTarget()->IsClient()) {
|
||||
c->GetTarget()->CastToClient()->IncStats(atoi(sep->arg[1]), atoi(sep->arg[2]));
|
||||
c->GetTarget()->CastToClient()->IncStats(Strings::ToInt(sep->arg[1]), Strings::ToInt(sep->arg[2]));
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "This command is used to permanently increase or decrease a players stats.");
|
||||
|
||||
@@ -79,7 +79,7 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::string character_name = sep->arg[3];
|
||||
uint16 instance_id = static_cast<uint16>(std::stoul(sep->arg[2]));
|
||||
uint16 instance_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
uint32 character_id = database.GetCharacterID(character_name.c_str());
|
||||
if (instance_id <= 0 || character_id <= 0) {
|
||||
c->Message(Chat::White, "You must enter a valid Instance ID and player name.");
|
||||
@@ -146,11 +146,11 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
|
||||
uint32 zone_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
ZoneID(sep->arg[2])
|
||||
);
|
||||
uint32 version = std::stoul(sep->arg[3]);
|
||||
uint32 duration = std::stoul(sep->arg[4]);
|
||||
uint32 version = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
uint32 duration = Strings::ToUnsignedInt(sep->arg[4]);
|
||||
std::string zone_short_name = ZoneName(zone_id);
|
||||
if (zone_short_name.empty()) {
|
||||
c->Message(
|
||||
@@ -210,7 +210,7 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
uint16 instance_id = std::stoul(sep->arg[2]);
|
||||
uint16 instance_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (!database.CheckInstanceExists(instance_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -269,7 +269,7 @@ void command_instance(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
std::string character_name = sep->arg[3];
|
||||
uint16 instance_id = static_cast<uint16>(std::stoul(sep->arg[2]));
|
||||
uint16 instance_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
uint32 character_id = database.GetCharacterID(character_name.c_str());
|
||||
if (instance_id <= 0 || character_id <= 0) {
|
||||
c->Message(Chat::White, "You must enter a valid Instance ID and player name.");
|
||||
|
||||
@@ -5,10 +5,10 @@ void command_interrupt(Client *c, const Seperator *sep)
|
||||
uint16 ci_message = 0x01b7, ci_color = 0x0121;
|
||||
|
||||
if (sep->arg[1][0]) {
|
||||
ci_message = atoi(sep->arg[1]);
|
||||
ci_message = Strings::ToInt(sep->arg[1]);
|
||||
}
|
||||
if (sep->arg[2][0]) {
|
||||
ci_color = atoi(sep->arg[2]);
|
||||
ci_color = Strings::ToInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
c->InterruptSpell(ci_message, ci_color);
|
||||
|
||||
@@ -189,7 +189,7 @@ void command_invsnapshot(Client *c, const Seperator *sep)
|
||||
|
||||
auto list_count = 0;
|
||||
if (sep->IsNumber(2)) {
|
||||
list_count = atoi(sep->arg[2]);
|
||||
list_count = Strings::ToInt(sep->arg[2]);
|
||||
}
|
||||
if (list_count < 1 || list_count > is_list.size()) {
|
||||
list_count = is_list.size();
|
||||
@@ -237,7 +237,7 @@ void command_invsnapshot(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 timestamp = atoul(sep->arg[2]);
|
||||
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
|
||||
c->Message(
|
||||
@@ -285,7 +285,7 @@ void command_invsnapshot(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 timestamp = atoul(sep->arg[2]);
|
||||
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
|
||||
c->Message(
|
||||
@@ -374,7 +374,7 @@ void command_invsnapshot(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 timestamp = atoul(sep->arg[2]);
|
||||
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
|
||||
c->Message(
|
||||
|
||||
@@ -13,7 +13,7 @@ void command_itemsearch(Client *c, const Seperator *sep)
|
||||
linker.SetLinkType(EQ::saylink::SayLinkItemData);
|
||||
|
||||
if (Seperator::IsNumber(search_criteria)) {
|
||||
item = database.GetItem(atoi(search_criteria));
|
||||
item = database.GetItem(Strings::ToInt(search_criteria));
|
||||
if (item) {
|
||||
linker.SetItemData(item);
|
||||
std::string item_id = std::to_string(item->ID);
|
||||
|
||||
@@ -14,7 +14,7 @@ void command_level(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto level = static_cast<uint8>(std::stoul(sep->arg[1]));
|
||||
auto level = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
auto max_level = static_cast<uint8>(RuleI(Character, MaxLevel));
|
||||
|
||||
if (c->Admin() < RuleI(GM, MinStatusToLevelTarget)) {
|
||||
|
||||
@@ -53,7 +53,7 @@ void command_logs(Client *c, const Seperator *sep)
|
||||
if (is_list || (is_set && !sep->IsNumber(3))) {
|
||||
uint32 start_category_id = 1;
|
||||
if (sep->IsNumber(2)) {
|
||||
start_category_id = std::stoul(sep->arg[2]);
|
||||
start_category_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
uint32 max_category_id = (start_category_id + 49);
|
||||
@@ -204,8 +204,8 @@ void command_logs(Client *c, const Seperator *sep)
|
||||
|
||||
logs_set = true;
|
||||
|
||||
auto category_id = std::stoul(sep->arg[3]);
|
||||
auto setting = std::stoul(sep->arg[4]);
|
||||
auto category_id = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
auto setting = Strings::ToUnsignedInt(sep->arg[4]);
|
||||
|
||||
if (is_console) {
|
||||
LogSys.log_settings[category_id].log_to_console = setting;
|
||||
|
||||
@@ -8,10 +8,10 @@ void command_lootsim(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto npc_id = std::stoul(sep->arg[1]);
|
||||
auto loottable_id = std::stoul(sep->arg[2]);
|
||||
auto iterations = std::stoul(sep->arg[3]) > 1000 ? 1000 : std::stoul(sep->arg[3]);
|
||||
auto log_enabled = arguments > 3 ? std::stoul(sep->arg[4]) : false;
|
||||
auto npc_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
auto loottable_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto iterations = Strings::ToUnsignedInt(sep->arg[3]) > 1000 ? 1000 : Strings::ToUnsignedInt(sep->arg[3]);
|
||||
auto log_enabled = arguments > 3 ? Strings::ToUnsignedInt(sep->arg[4]) : false;
|
||||
|
||||
// temporarily disable loot logging unless set explicitly
|
||||
LogSys.log_settings[Logs::Loot].log_to_console = log_enabled ? LogSys.log_settings[Logs::Loot].log_to_console : 0;
|
||||
|
||||
@@ -16,7 +16,7 @@ void command_memspell(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
||||
auto spell_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -43,7 +43,7 @@ void command_memspell(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto spell_gem = sep->IsNumber(2) ? std::stoul(sep->arg[2]) : empty_slot;
|
||||
auto spell_gem = sep->IsNumber(2) ? Strings::ToUnsignedInt(sep->arg[2]) : empty_slot;
|
||||
if (spell_gem > EQ::spells::SPELL_GEM_COUNT) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@@ -10,7 +10,7 @@ void command_movechar(Client *c, const Seperator *sep)
|
||||
|
||||
std::string character_name = (
|
||||
sep->IsNumber(1) ?
|
||||
database.GetCharNameByID(std::stoul(sep->arg[1])) :
|
||||
database.GetCharNameByID(Strings::ToUnsignedInt(sep->arg[1])) :
|
||||
sep->arg[1]
|
||||
);
|
||||
auto character_id = database.GetCharacterID(character_name.c_str());
|
||||
@@ -29,7 +29,7 @@ void command_movechar(Client *c, const Seperator *sep)
|
||||
|
||||
std::string zone_short_name = Strings::ToLower(
|
||||
sep->IsNumber(2) ?
|
||||
ZoneName(std::stoul(sep->arg[2]), true) :
|
||||
ZoneName(Strings::ToUnsignedInt(sep->arg[2]), true) :
|
||||
sep->arg[2]
|
||||
);
|
||||
|
||||
@@ -39,7 +39,7 @@ void command_movechar(Client *c, const Seperator *sep)
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Zone ID {} could not be found.",
|
||||
std::stoul(sep->arg[2])
|
||||
Strings::ToUnsignedInt(sep->arg[2])
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -61,11 +61,11 @@ void command_movement(Client *c, const Seperator *sep)
|
||||
|
||||
mgr.SendCommandToClients(
|
||||
target,
|
||||
atof(sep->arg[2]),
|
||||
atof(sep->arg[3]),
|
||||
atof(sep->arg[4]),
|
||||
atof(sep->arg[5]),
|
||||
atoi(sep->arg[6]),
|
||||
Strings::ToFloat(sep->arg[2]),
|
||||
Strings::ToFloat(sep->arg[3]),
|
||||
Strings::ToFloat(sep->arg[4]),
|
||||
Strings::ToFloat(sep->arg[5]),
|
||||
Strings::ToInt(sep->arg[6]),
|
||||
ClientRangeAny
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,11 +86,11 @@ void command_network(Client *c, const Seperator *sep)
|
||||
|
||||
std::string value = sep->arg[3];
|
||||
if (!strcasecmp(sep->arg[2], "max_connection_count")) {
|
||||
opts.daybreak_options.max_connection_count = std::stoull(value);
|
||||
opts.daybreak_options.max_connection_count = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "keepalive_delay_ms")) {
|
||||
opts.daybreak_options.keepalive_delay_ms = std::stoull(value);
|
||||
opts.daybreak_options.keepalive_delay_ms = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "resend_delay_factor")) {
|
||||
@@ -98,51 +98,51 @@ void command_network(Client *c, const Seperator *sep)
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "resend_delay_ms")) {
|
||||
opts.daybreak_options.resend_delay_ms = std::stoull(value);
|
||||
opts.daybreak_options.resend_delay_ms = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "resend_delay_min")) {
|
||||
opts.daybreak_options.resend_delay_min = std::stoull(value);
|
||||
opts.daybreak_options.resend_delay_min = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "resend_delay_max")) {
|
||||
opts.daybreak_options.resend_delay_max = std::stoull(value);
|
||||
opts.daybreak_options.resend_delay_max = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "connect_delay_ms")) {
|
||||
opts.daybreak_options.connect_delay_ms = std::stoull(value);
|
||||
opts.daybreak_options.connect_delay_ms = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "connect_stale_ms")) {
|
||||
opts.daybreak_options.connect_stale_ms = std::stoull(value);
|
||||
opts.daybreak_options.connect_stale_ms = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "stale_connection_ms")) {
|
||||
opts.daybreak_options.stale_connection_ms = std::stoull(value);
|
||||
opts.daybreak_options.stale_connection_ms = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "hold_size")) {
|
||||
opts.daybreak_options.hold_size = std::stoull(value);
|
||||
opts.daybreak_options.hold_size = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "hold_length_ms")) {
|
||||
opts.daybreak_options.hold_length_ms = std::stoull(value);
|
||||
opts.daybreak_options.hold_length_ms = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "simulated_in_packet_loss")) {
|
||||
opts.daybreak_options.simulated_in_packet_loss = std::stoull(value);
|
||||
opts.daybreak_options.simulated_in_packet_loss = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "simulated_out_packet_loss")) {
|
||||
opts.daybreak_options.simulated_out_packet_loss = std::stoull(value);
|
||||
opts.daybreak_options.simulated_out_packet_loss = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "resend_timeout")) {
|
||||
opts.daybreak_options.resend_timeout = std::stoull(value);
|
||||
opts.daybreak_options.resend_timeout = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else if (!strcasecmp(sep->arg[2], "connection_close_time")) {
|
||||
opts.daybreak_options.connection_close_time = std::stoull(value);
|
||||
opts.daybreak_options.connection_close_time = Strings::ToUnsignedBigInt(value);
|
||||
manager->SetOptions(opts);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -10,7 +10,7 @@ void command_npccast(Client *c, const Seperator *sep)
|
||||
auto target = c->GetTarget()->CastToNPC();
|
||||
if (!sep->IsNumber(1) && sep->arg[1] && sep->IsNumber(2)) {
|
||||
std::string entity_name = sep->arg[1] ? sep->arg[1] : 0;
|
||||
auto spell_id = sep->arg[2] ? std::stoul(sep->arg[2]) : 0;
|
||||
auto spell_id = sep->arg[2] ? Strings::ToUnsignedInt(sep->arg[2]) : 0;
|
||||
auto spell_target = entity_list.GetMob(entity_name.c_str());
|
||||
if (spell_target && IsValidSpell(spell_id) && spell_id < SPDAT_RECORDS) {
|
||||
c->Message(
|
||||
@@ -45,8 +45,8 @@ void command_npccast(Client *c, const Seperator *sep)
|
||||
}
|
||||
}
|
||||
} else if (sep->IsNumber(1) && sep->IsNumber(2)) {
|
||||
uint16 entity_id = static_cast<uint16>(std::stoul(sep->arg[1]));
|
||||
auto spell_id = std::stoul(sep->arg[2]);
|
||||
uint16 entity_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
auto spell_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto spell_target = entity_list.GetMob(entity_id);
|
||||
if (spell_target && IsValidSpell(spell_id) && spell_id < SPDAT_RECORDS) {
|
||||
c->Message(
|
||||
|
||||
@@ -59,7 +59,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
);
|
||||
} else if (!strcasecmp(sep->arg[1], "level")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto level = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto level = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.level = level;
|
||||
d = fmt::format(
|
||||
"{} is now level {}.",
|
||||
@@ -72,7 +72,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "race")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto race_id = static_cast<uint16_t>(std::stoul(sep->arg[2]));
|
||||
auto race_id = static_cast<uint16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.race = race_id;
|
||||
d = fmt::format(
|
||||
"{} is now a(n) {} ({}).",
|
||||
@@ -86,7 +86,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "class")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto class_id = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto class_id = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.class_ = class_id;
|
||||
d = fmt::format(
|
||||
"{} is now a(n) {} ({}).",
|
||||
@@ -100,7 +100,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "bodytype")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto body_type_id = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto body_type_id = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
auto body_type_name = EQ::constants::GetBodyTypeName(static_cast<bodyType>(body_type_id));
|
||||
n.bodytype = body_type_id;
|
||||
d = fmt::format(
|
||||
@@ -122,7 +122,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "hp")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto hp = std::stoll(sep->arg[2]);
|
||||
auto hp = Strings::ToBigInt(sep->arg[2]);
|
||||
n.hp = hp;
|
||||
d = fmt::format(
|
||||
"{} now has {} Health.",
|
||||
@@ -135,7 +135,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "mana")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto mana = std::stoll(sep->arg[2]);
|
||||
auto mana = Strings::ToBigInt(sep->arg[2]);
|
||||
n.mana = mana;
|
||||
d = fmt::format(
|
||||
"{} now has {} Mana.",
|
||||
@@ -148,7 +148,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "gender")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto gender_id = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto gender_id = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.gender = gender_id;
|
||||
d = fmt::format(
|
||||
"{} is now a {} ({}).",
|
||||
@@ -162,7 +162,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "texture")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto texture = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto texture = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.texture = texture;
|
||||
d = fmt::format(
|
||||
"{} is now using Texture {}.",
|
||||
@@ -175,7 +175,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "helmtexture")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto helmet_texture = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto helmet_texture = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.helmtexture = helmet_texture;
|
||||
d = fmt::format(
|
||||
"{} is now using Helmet Texture {}.",
|
||||
@@ -188,7 +188,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "herosforgemodel")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto heros_forge_model = std::stoi(sep->arg[2]);
|
||||
auto heros_forge_model = Strings::ToInt(sep->arg[2]);
|
||||
n.herosforgemodel = heros_forge_model;
|
||||
d = fmt::format(
|
||||
"{} is now using Hero's Forge Model {}.",
|
||||
@@ -204,7 +204,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "size")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto size = std::stof(sep->arg[2]);
|
||||
auto size = Strings::ToFloat(sep->arg[2]);
|
||||
n.size = size;
|
||||
d = fmt::format(
|
||||
"{} is now Size {:.2f}.",
|
||||
@@ -217,7 +217,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "hpregen")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto hp_regen = std::stoll(sep->arg[2]);
|
||||
auto hp_regen = Strings::ToBigInt(sep->arg[2]);
|
||||
n.hp_regen_rate = hp_regen;
|
||||
d = fmt::format(
|
||||
"{} now regenerates {} Health per Tick.",
|
||||
@@ -230,7 +230,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "hp_regen_per_second")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto hp_regen_per_second = std::stoll(sep->arg[2]);
|
||||
auto hp_regen_per_second = Strings::ToBigInt(sep->arg[2]);
|
||||
n.hp_regen_per_second = hp_regen_per_second;
|
||||
d = fmt::format(
|
||||
"{} now regenerates {} HP per Second.",
|
||||
@@ -246,7 +246,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "manaregen")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto mana_regen = std::stoll(sep->arg[2]);
|
||||
auto mana_regen = Strings::ToBigInt(sep->arg[2]);
|
||||
n.mana_regen_rate = mana_regen;
|
||||
d = fmt::format(
|
||||
"{} now regenerates {} Mana per Tick.",
|
||||
@@ -259,7 +259,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "loottable")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto loottable_id = std::stoul(sep->arg[2]);
|
||||
auto loottable_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.loottable_id = loottable_id;
|
||||
d = fmt::format(
|
||||
"{} is now using Loottable ID {}.",
|
||||
@@ -272,7 +272,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "merchantid")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto merchant_id = std::stoul(sep->arg[2]);
|
||||
auto merchant_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.merchant_id = merchant_id;
|
||||
d = fmt::format(
|
||||
"{} is now using Merchant ID {}.",
|
||||
@@ -285,7 +285,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "alt_currency_id")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto alternate_currency_id = std::stoul(sep->arg[2]);
|
||||
auto alternate_currency_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto alternate_currency_item_id = zone->GetCurrencyItemID(alternate_currency_id);
|
||||
n.alt_currency_id = alternate_currency_id;
|
||||
d = fmt::format(
|
||||
@@ -310,7 +310,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "spell")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto spell_list_id = std::stoul(sep->arg[2]);
|
||||
auto spell_list_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.npc_spells_id = spell_list_id;
|
||||
d = fmt::format(
|
||||
"{} is now using Spell List ID {}.",
|
||||
@@ -323,7 +323,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "npc_spells_effects_id")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto spell_effects_id = std::stoul(sep->arg[2]);
|
||||
auto spell_effects_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.npc_spells_effects_id = spell_effects_id;
|
||||
d = fmt::format(
|
||||
"{} is now using Spells Effects ID {}.",
|
||||
@@ -339,7 +339,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "faction")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto faction_id = std::stoi(sep->arg[2]);
|
||||
auto faction_id = Strings::ToInt(sep->arg[2]);
|
||||
auto faction_name = content_db.GetFactionName(faction_id);
|
||||
n.npc_faction_id = faction_id;
|
||||
d = fmt::format(
|
||||
@@ -361,7 +361,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "adventure_template_id")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto adventure_template_id = std::stoul(sep->arg[2]);
|
||||
auto adventure_template_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.adventure_template_id = adventure_template_id;
|
||||
d = fmt::format(
|
||||
"{} is now using Adventure Template ID {}.",
|
||||
@@ -377,7 +377,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "trap_template")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto trap_template = std::stoul(sep->arg[2]);
|
||||
auto trap_template = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.trap_template = trap_template;
|
||||
d = fmt::format(
|
||||
"{} is now using Trap Template ID {}.",
|
||||
@@ -390,8 +390,8 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "damage")) {
|
||||
if (sep->IsNumber(2) && sep->IsNumber(3)) {
|
||||
auto minimum_damage = std::stoul(sep->arg[2]);
|
||||
auto maximum_damage = std::stoul(sep->arg[3]);
|
||||
auto minimum_damage = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto maximum_damage = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
n.mindmg = minimum_damage;
|
||||
n.maxdmg = maximum_damage;
|
||||
d = fmt::format(
|
||||
@@ -406,7 +406,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "attackcount")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto attack_count = static_cast<int16>(std::stoi(sep->arg[2]));
|
||||
auto attack_count = static_cast<int16>(Strings::ToInt(sep->arg[2]));
|
||||
n.attack_count = attack_count;
|
||||
d = fmt::format(
|
||||
"{} now has an Attack Count of {}.",
|
||||
@@ -441,7 +441,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
);
|
||||
} else if (!strcasecmp(sep->arg[1], "aggroradius")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto aggro_radius = std::stoul(sep->arg[2]);
|
||||
auto aggro_radius = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.aggroradius = aggro_radius;
|
||||
d = fmt::format(
|
||||
"{} now has an Aggro Radius of {}.",
|
||||
@@ -454,7 +454,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "assistradius")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto assist_radius = std::stoul(sep->arg[2]);
|
||||
auto assist_radius = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.assistradius = assist_radius;
|
||||
d = fmt::format(
|
||||
"{} now has an Assist Radius of {}",
|
||||
@@ -487,7 +487,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
n.drakkin_details = t->GetDrakkinDetails();
|
||||
} else if (!strcasecmp(sep->arg[1], "armortint_id")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto armor_tint_id = std::stoul(sep->arg[2]);
|
||||
auto armor_tint_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.armortint_id = armor_tint_id;
|
||||
d = fmt::format(
|
||||
"{} is now using Armor Tint ID {}.",
|
||||
@@ -500,9 +500,9 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "color")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto red = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
uint8_t green = sep->IsNumber(3) ? static_cast<uint8_t>(std::stoul(sep->arg[3])) : 0;
|
||||
uint8_t blue = sep->IsNumber(4) ? static_cast<uint8_t>(std::stoul(sep->arg[4])) : 0;
|
||||
auto red = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
uint8_t green = sep->IsNumber(3) ? static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[3])) : 0;
|
||||
uint8_t blue = sep->IsNumber(4) ? static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[4])) : 0;
|
||||
n.armortint_red = red;
|
||||
n.armortint_green = green;
|
||||
n.armortint_blue = blue;
|
||||
@@ -522,7 +522,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "ammoidfile")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto ammo_id_file = std::stoul(sep->arg[2]);
|
||||
auto ammo_id_file = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.ammo_idfile = ammo_id_file;
|
||||
d = fmt::format(
|
||||
"{} is now using Ammo ID File {}.",
|
||||
@@ -535,8 +535,8 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "weapon")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto primary_model = std::stoul(sep->arg[2]);
|
||||
uint32_t secondary_model = sep->arg[3] && sep->IsNumber(3) ? std::stoul(sep->arg[3]) : 0;
|
||||
auto primary_model = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
uint32_t secondary_model = sep->arg[3] && sep->IsNumber(3) ? Strings::ToUnsignedInt(sep->arg[3]) : 0;
|
||||
n.d_melee_texture1 = primary_model;
|
||||
n.d_melee_texture2 = secondary_model;
|
||||
d = fmt::format(
|
||||
@@ -554,8 +554,8 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "meleetype")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto primary_type = std::stoul(sep->arg[2]);
|
||||
uint32_t secondary_type = sep->IsNumber(3) ? std::stoul(sep->arg[3]) : 0;
|
||||
auto primary_type = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
uint32_t secondary_type = sep->IsNumber(3) ? Strings::ToUnsignedInt(sep->arg[3]) : 0;
|
||||
|
||||
auto primary_skill = EQ::skills::GetSkillName(static_cast<EQ::skills::SkillType>(primary_type));
|
||||
auto secondary_skill = EQ::skills::GetSkillName(static_cast<EQ::skills::SkillType>(secondary_type));
|
||||
@@ -594,7 +594,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "rangedtype")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto ranged_type = std::stoul(sep->arg[2]);
|
||||
auto ranged_type = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
auto ranged_skill = EQ::skills::GetSkillName(static_cast<EQ::skills::SkillType>(ranged_type));
|
||||
|
||||
@@ -619,7 +619,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "runspeed")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto run_speed = std::stof(sep->arg[2]);
|
||||
auto run_speed = Strings::ToFloat(sep->arg[2]);
|
||||
n.runspeed = run_speed;
|
||||
d = fmt::format(
|
||||
"{} now runs at a Run Speed of {:.2f}.",
|
||||
@@ -632,7 +632,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "mr")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto magic_resist = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto magic_resist = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.MR = magic_resist;
|
||||
d = fmt::format(
|
||||
"{} now has a Magic Resistance of {}.",
|
||||
@@ -645,7 +645,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "pr")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto poison_resist = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto poison_resist = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.PR = poison_resist;
|
||||
d = fmt::format(
|
||||
"{} now has a Poison Resistance of {}.",
|
||||
@@ -658,7 +658,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "dr")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto disease_resist = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto disease_resist = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.DR = disease_resist;
|
||||
d = fmt::format(
|
||||
"{} now has a Disease Resistance of {}.",
|
||||
@@ -671,7 +671,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "fr")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto fire_resist = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto fire_resist = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.FR = fire_resist;
|
||||
d = fmt::format(
|
||||
"{} now has a Fire Resistance of {}.",
|
||||
@@ -684,7 +684,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "cr")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto cold_resist = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto cold_resist = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.CR = cold_resist;
|
||||
d = fmt::format(
|
||||
"{} now has a Cold Resistance of {}.",
|
||||
@@ -697,7 +697,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "corrup")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto corruption_resist = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto corruption_resist = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.Corrup = corruption_resist;
|
||||
d = fmt::format(
|
||||
"{} now has a Corruption Resistance of {}.",
|
||||
@@ -710,7 +710,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "phr")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto physical_resist = static_cast<uint16_t>(std::stoul(sep->arg[2]));
|
||||
auto physical_resist = static_cast<uint16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.PhR = physical_resist;
|
||||
d = fmt::format(
|
||||
"{} now has a Physical Resistance of {}.",
|
||||
@@ -723,7 +723,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "seeinvis")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto see_invisible = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto see_invisible = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.see_invis = see_invisible;
|
||||
d = fmt::format(
|
||||
"{} can {} See Invisible.",
|
||||
@@ -739,7 +739,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "seeinvisundead")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto see_invisible_undead = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto see_invisible_undead = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.see_invis_undead = see_invisible_undead;
|
||||
d = fmt::format(
|
||||
"{} can {} See Invisible vs. Undead.",
|
||||
@@ -755,7 +755,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "qglobal")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto use_qglobals = std::stoul(sep->arg[2]);
|
||||
auto use_qglobals = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.qglobal = use_qglobals;
|
||||
d = fmt::format(
|
||||
"{} can {} use Quest Globals.",
|
||||
@@ -771,7 +771,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "ac")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto armor_class = static_cast<int16_t>(std::stoul(sep->arg[2]));
|
||||
auto armor_class = static_cast<int16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.AC = armor_class;
|
||||
d = fmt::format(
|
||||
"{} now has {} Armor Class.",
|
||||
@@ -784,7 +784,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "npcaggro")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto aggro_npcs = static_cast<int8_t>(std::stoul(sep->arg[2]));
|
||||
auto aggro_npcs = static_cast<int8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.npc_aggro = aggro_npcs;
|
||||
d = fmt::format(
|
||||
"{} will {} aggro other NPCs that have a hostile faction.",
|
||||
@@ -800,7 +800,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "spawn_limit")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto spawn_limit = static_cast<int8_t>(std::stoul(sep->arg[2]));
|
||||
auto spawn_limit = static_cast<int8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.spawn_limit = spawn_limit;
|
||||
d = fmt::format(
|
||||
"{} now has a Spawn Limit of {}.",
|
||||
@@ -813,7 +813,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "attackspeed")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto attack_speed = std::stof(sep->arg[2]);
|
||||
auto attack_speed = Strings::ToFloat(sep->arg[2]);
|
||||
n.attack_speed = attack_speed;
|
||||
d = fmt::format(
|
||||
"{} now has an Attack Speed of {:.2f}.",
|
||||
@@ -826,7 +826,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "attackdelay")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto attack_delay = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto attack_delay = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.attack_delay = attack_delay;
|
||||
d = fmt::format(
|
||||
"{} now has an Attack Delay of {}.",
|
||||
@@ -839,7 +839,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "findable")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto is_findable = static_cast<int8_t>(std::stoul(sep->arg[2]));
|
||||
auto is_findable = static_cast<int8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.findable = is_findable;
|
||||
d = fmt::format(
|
||||
"{} is {} Findable.",
|
||||
@@ -855,7 +855,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "str")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto strength = std::stoul(sep->arg[2]);
|
||||
auto strength = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.STR = strength;
|
||||
d = fmt::format(
|
||||
"{} now has {} Strength.",
|
||||
@@ -868,7 +868,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "sta")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto stamina = std::stoul(sep->arg[2]);
|
||||
auto stamina = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.STA = stamina;
|
||||
d = fmt::format(
|
||||
"{} now has {} Stamina.",
|
||||
@@ -881,7 +881,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "agi")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto agility = std::stoul(sep->arg[2]);
|
||||
auto agility = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.AGI = agility;
|
||||
d = fmt::format(
|
||||
"{} now has {} Agility.",
|
||||
@@ -894,7 +894,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "dex")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto dexterity = std::stoul(sep->arg[2]);
|
||||
auto dexterity = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.DEX = dexterity;
|
||||
d = fmt::format(
|
||||
"{} now has {} Dexterity.",
|
||||
@@ -907,7 +907,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "int")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto intelligence = std::stoul(sep->arg[2]);
|
||||
auto intelligence = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n._INT = intelligence;
|
||||
d = fmt::format(
|
||||
"{} now has {} Intelligence.",
|
||||
@@ -920,7 +920,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "wis")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto wisdom = std::stoul(sep->arg[2]);
|
||||
auto wisdom = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.WIS = wisdom;
|
||||
d = fmt::format(
|
||||
"{} now has {} Wisdom.",
|
||||
@@ -933,7 +933,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "cha")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charisma = std::stoul(sep->arg[2]);
|
||||
auto charisma = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.CHA = charisma;
|
||||
d = fmt::format(
|
||||
"{} now has {} Charisma.",
|
||||
@@ -946,7 +946,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "seehide")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto see_hide = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto see_hide = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.see_hide = see_hide;
|
||||
d = fmt::format(
|
||||
"{} can {} See Hide.",
|
||||
@@ -962,7 +962,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "seeimprovedhide")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto see_improved_hide = static_cast<int8>(std::stoi(sep->arg[2]));
|
||||
auto see_improved_hide = static_cast<int8>(Strings::ToInt(sep->arg[2]));
|
||||
n.see_improved_hide = see_improved_hide;
|
||||
d = fmt::format(
|
||||
"{} can {} See Improved Hide.",
|
||||
@@ -978,7 +978,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "trackable")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto is_trackable = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto is_trackable = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.trackable = is_trackable;
|
||||
d = fmt::format(
|
||||
"{} is {} Trackable.",
|
||||
@@ -994,7 +994,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "atk")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto attack = std::stoi(sep->arg[2]);
|
||||
auto attack = Strings::ToInt(sep->arg[2]);
|
||||
n.ATK = attack;
|
||||
d = fmt::format(
|
||||
"{} now has {} Attack.",
|
||||
@@ -1007,7 +1007,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "accuracy")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto accuracy = std::stoi(sep->arg[2]);
|
||||
auto accuracy = Strings::ToInt(sep->arg[2]);
|
||||
n.Accuracy = accuracy;
|
||||
d = fmt::format(
|
||||
"{} now has {} Accuracy.",
|
||||
@@ -1020,7 +1020,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "avoidance")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto avoidance = std::stoul(sep->arg[2]);
|
||||
auto avoidance = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.Avoidance = avoidance;
|
||||
d = fmt::format(
|
||||
"{} now has {} Avoidance.",
|
||||
@@ -1033,7 +1033,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "slow_mitigation")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto slow_mitigation = static_cast<int16_t>(std::stoi(sep->arg[2]));
|
||||
auto slow_mitigation = static_cast<int16_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.slow_mitigation = slow_mitigation;
|
||||
d = fmt::format(
|
||||
"{} now has {} Slow Mitigation.",
|
||||
@@ -1049,7 +1049,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "version")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto version = static_cast<uint16_t>(std::stoul(sep->arg[2]));
|
||||
auto version = static_cast<uint16_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.version = version;
|
||||
d = fmt::format(
|
||||
"{} is now using Version {}.",
|
||||
@@ -1062,7 +1062,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "maxlevel")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto max_level = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto max_level = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.maxlevel = max_level;
|
||||
d = fmt::format(
|
||||
"{} now has a Maximum Level of {}.",
|
||||
@@ -1075,7 +1075,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "scalerate")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto scale_rate = std::stoi(sep->arg[2]);
|
||||
auto scale_rate = Strings::ToInt(sep->arg[2]);
|
||||
n.scalerate = scale_rate;
|
||||
d = fmt::format(
|
||||
"{} now has a Scaling Rate of {}%%.",
|
||||
@@ -1091,7 +1091,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "spellscale")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto spell_scale = std::stoul(sep->arg[2]);
|
||||
auto spell_scale = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.spellscale = static_cast<float>(spell_scale);
|
||||
d = fmt::format(
|
||||
"{} now has a Spell Scaling Rate of {}%%.",
|
||||
@@ -1107,7 +1107,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "healscale")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto heal_scale = std::stoul(sep->arg[2]);
|
||||
auto heal_scale = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
n.healscale = static_cast<float>(heal_scale);
|
||||
d = fmt::format(
|
||||
"{} now has a Heal Scaling Rate of {}%%.",
|
||||
@@ -1123,7 +1123,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "no_target")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto is_no_target = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto is_no_target = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.no_target_hotkey = is_no_target;
|
||||
d = fmt::format(
|
||||
"{} is {} Targetable with Target Hotkey.",
|
||||
@@ -1139,7 +1139,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "raidtarget")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto is_raid_target = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto is_raid_target = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.raid_target = is_raid_target;
|
||||
d = fmt::format(
|
||||
"{} is {} designated as a Raid Target.",
|
||||
@@ -1155,7 +1155,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
return;
|
||||
} else if (!strcasecmp(sep->arg[1], "armtexture")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto arm_texture = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto arm_texture = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.armtexture = arm_texture;
|
||||
d = fmt::format(
|
||||
"{} is now using Arm Texture {}.",
|
||||
@@ -1168,7 +1168,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "bracertexture")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto bracer_texture = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto bracer_texture = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.bracertexture = bracer_texture;
|
||||
d = fmt::format(
|
||||
"{} is now using Bracer Texture {}.",
|
||||
@@ -1181,7 +1181,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "handtexture")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto hand_texture = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto hand_texture = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.handtexture = hand_texture;
|
||||
d = fmt::format(
|
||||
"{} is now using Hand Texture {}.",
|
||||
@@ -1194,7 +1194,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "legtexture")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto leg_texture = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto leg_texture = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.legtexture = leg_texture;
|
||||
d = fmt::format(
|
||||
"{} is now using Leg Texture {}.",
|
||||
@@ -1207,7 +1207,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "feettexture")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto feet_texture = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto feet_texture = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.feettexture = feet_texture;
|
||||
d = fmt::format(
|
||||
"{} is now using Feet Texture {}.",
|
||||
@@ -1220,7 +1220,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "walkspeed")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto walk_speed = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto walk_speed = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.walkspeed = walk_speed;
|
||||
d = fmt::format(
|
||||
"{} now walks at a Walk Speed of {}.",
|
||||
@@ -1233,7 +1233,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "show_name")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto show_name = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto show_name = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.show_name = show_name;
|
||||
d = fmt::format(
|
||||
"{} will {} show their name.",
|
||||
@@ -1249,7 +1249,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "untargetable")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto is_untargetable = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto is_untargetable = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.untargetable = is_untargetable;
|
||||
d = fmt::format(
|
||||
"{} will {} be untargetable.",
|
||||
@@ -1265,7 +1265,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "charm_ac")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charm_armor_class = static_cast<int16_t>(std::stoi(sep->arg[2]));
|
||||
auto charm_armor_class = static_cast<int16_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.charm_ac = charm_armor_class;
|
||||
d = fmt::format(
|
||||
"{} now has {} Armor Class while Charmed.",
|
||||
@@ -1278,7 +1278,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "charm_min_dmg")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charm_minimum_damage = std::stoi(sep->arg[2]);
|
||||
auto charm_minimum_damage = Strings::ToInt(sep->arg[2]);
|
||||
n.charm_min_dmg = charm_minimum_damage;
|
||||
d = fmt::format(
|
||||
"{} now does {} Minimum Damage while Charmed.",
|
||||
@@ -1294,7 +1294,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "charm_max_dmg")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charm_maximum_damage = std::stoi(sep->arg[2]);
|
||||
auto charm_maximum_damage = Strings::ToInt(sep->arg[2]);
|
||||
n.charm_max_dmg = charm_maximum_damage;
|
||||
d = fmt::format(
|
||||
"{} now does {} Maximum Damage while Charmed.",
|
||||
@@ -1310,7 +1310,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "charm_attack_delay")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charm_attack_delay = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto charm_attack_delay = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.charm_attack_delay = charm_attack_delay;
|
||||
d = fmt::format(
|
||||
"{} now has {} Attack Delay while Charmed.",
|
||||
@@ -1326,7 +1326,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "charm_accuracy_rating")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charm_accuracy_rating = std::stoi(sep->arg[2]);
|
||||
auto charm_accuracy_rating = Strings::ToInt(sep->arg[2]);
|
||||
n.charm_accuracy_rating = charm_accuracy_rating;
|
||||
d = fmt::format(
|
||||
"{} now has {} Accuracy Rating while Charmed.",
|
||||
@@ -1342,7 +1342,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "charm_avoidance_rating")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charm_avoidance_rating = std::stoi(sep->arg[2]);
|
||||
auto charm_avoidance_rating = Strings::ToInt(sep->arg[2]);
|
||||
n.charm_avoidance_rating = charm_avoidance_rating;
|
||||
d = fmt::format(
|
||||
"{} now has {} Avoidance Rating while Charmed.",
|
||||
@@ -1358,7 +1358,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "charm_atk")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto charm_attack = std::stoi(sep->arg[2]);
|
||||
auto charm_attack = Strings::ToInt(sep->arg[2]);
|
||||
n.charm_atk = charm_attack;
|
||||
d = fmt::format(
|
||||
"{} now has {} Attack while Charmed.",
|
||||
@@ -1371,7 +1371,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "skip_global_loot")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto skip_global_loot = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto skip_global_loot = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.skip_global_loot = skip_global_loot;
|
||||
d = fmt::format(
|
||||
"{} will {} skip Global Loot.",
|
||||
@@ -1387,7 +1387,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "rarespawn")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto is_rare_spawn = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto is_rare_spawn = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.rare_spawn = is_rare_spawn;
|
||||
d = fmt::format(
|
||||
"{} is {} designated as a Rare Spawn.",
|
||||
@@ -1403,7 +1403,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "stuck_behavior")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto behavior_id = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto behavior_id = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
if (behavior_id > EQ::constants::StuckBehavior::EvadeCombat) {
|
||||
behavior_id = EQ::constants::StuckBehavior::EvadeCombat;
|
||||
}
|
||||
@@ -1432,7 +1432,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "flymode")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto flymode_id = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto flymode_id = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
if (flymode_id > GravityBehavior::LevitateWhileRunning) {
|
||||
flymode_id = GravityBehavior::LevitateWhileRunning;
|
||||
}
|
||||
@@ -1461,7 +1461,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "always_aggro")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto always_aggro = static_cast<int8_t>(std::stoi(sep->arg[2]));
|
||||
auto always_aggro = static_cast<int8_t>(Strings::ToInt(sep->arg[2]));
|
||||
n.always_aggro = always_aggro;
|
||||
d = fmt::format(
|
||||
"{} will {} Always Aggro.",
|
||||
@@ -1477,7 +1477,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "exp_mod")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto experience_modifier = std::stoi(sep->arg[2]);
|
||||
auto experience_modifier = Strings::ToInt(sep->arg[2]);
|
||||
n.exp_mod = experience_modifier;
|
||||
d = fmt::format(
|
||||
"{} now has an Experience Modifier of {}%%.",
|
||||
@@ -1493,7 +1493,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "keeps_sold_items")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto keeps_sold_items = static_cast<uint8_t>(std::stoul(sep->arg[2]));
|
||||
auto keeps_sold_items = static_cast<uint8_t>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
n.keeps_sold_items = keeps_sold_items;
|
||||
d = fmt::format(
|
||||
"{} will {} Keep Sold Items.",
|
||||
@@ -1509,7 +1509,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "setanimation")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto animation_id = std::stoul(sep->arg[2]);
|
||||
auto animation_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (animation_id > EQ::constants::SpawnAnimations::Looting) {
|
||||
animation_id = EQ::constants::SpawnAnimations::Looting;
|
||||
}
|
||||
@@ -1546,7 +1546,7 @@ void command_npcedit(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else if (!strcasecmp(sep->arg[1], "respawntime")) {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto respawn_time = std::stoul(sep->arg[2]);
|
||||
auto respawn_time = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
if (respawn_time) {
|
||||
d = fmt::format(
|
||||
"{} now has a Respawn Timer of {} ({}) on Spawn Group ID {}.",
|
||||
|
||||
@@ -42,15 +42,15 @@ void command_npcloot(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto item_id = std::stoul(sep->arg[2]);
|
||||
auto item_charges = sep->IsNumber(3) ? static_cast<uint16>(std::stoul(sep->arg[3])) : 1;
|
||||
auto item_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto item_charges = sep->IsNumber(3) ? static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[3])) : 1;
|
||||
bool equip_item = arguments >= 4 ? atobool(sep->arg[4]) : false;
|
||||
auto augment_one_id = sep->IsNumber(5) ? std::stoul(sep->arg[5]) : 0;
|
||||
auto augment_two_id = sep->IsNumber(6) ? std::stoul(sep->arg[6]) : 0;
|
||||
auto augment_three_id = sep->IsNumber(7) ? std::stoul(sep->arg[7]) : 0;
|
||||
auto augment_four_id = sep->IsNumber(8) ? std::stoul(sep->arg[8]) : 0;
|
||||
auto augment_five_id = sep->IsNumber(9) ? std::stoul(sep->arg[9]) : 0;
|
||||
auto augment_six_id = sep->IsNumber(10) ? std::stoul(sep->arg[10]) : 0;
|
||||
auto augment_one_id = sep->IsNumber(5) ? Strings::ToUnsignedInt(sep->arg[5]) : 0;
|
||||
auto augment_two_id = sep->IsNumber(6) ? Strings::ToUnsignedInt(sep->arg[6]) : 0;
|
||||
auto augment_three_id = sep->IsNumber(7) ? Strings::ToUnsignedInt(sep->arg[7]) : 0;
|
||||
auto augment_four_id = sep->IsNumber(8) ? Strings::ToUnsignedInt(sep->arg[8]) : 0;
|
||||
auto augment_five_id = sep->IsNumber(9) ? Strings::ToUnsignedInt(sep->arg[9]) : 0;
|
||||
auto augment_six_id = sep->IsNumber(10) ? Strings::ToUnsignedInt(sep->arg[10]) : 0;
|
||||
|
||||
auto item_data = database.GetItem(item_id);
|
||||
|
||||
@@ -114,10 +114,10 @@ void command_npcloot(Client *c, const Seperator *sep)
|
||||
auto target = c->GetTarget()->CastToNPC();
|
||||
|
||||
if (sep->IsNumber(2)) {
|
||||
uint16 platinum = EQ::Clamp(std::stoi(sep->arg[2]), 0, 65535);
|
||||
uint16 gold = sep->IsNumber(3) ? EQ::Clamp(std::stoi(sep->arg[3]), 0, 65535) : 0;
|
||||
uint16 silver = sep->IsNumber(4) ? EQ::Clamp(std::stoi(sep->arg[4]), 0, 65535) : 0;
|
||||
uint16 copper = sep->IsNumber(5) ? EQ::Clamp(std::stoi(sep->arg[5]), 0, 65535) : 0;
|
||||
uint16 platinum = EQ::Clamp(Strings::ToInt(sep->arg[2]), 0, 65535);
|
||||
uint16 gold = sep->IsNumber(3) ? EQ::Clamp(Strings::ToInt(sep->arg[3]), 0, 65535) : 0;
|
||||
uint16 silver = sep->IsNumber(4) ? EQ::Clamp(Strings::ToInt(sep->arg[4]), 0, 65535) : 0;
|
||||
uint16 copper = sep->IsNumber(5) ? EQ::Clamp(Strings::ToInt(sep->arg[5]), 0, 65535) : 0;
|
||||
target->AddCash(
|
||||
copper,
|
||||
silver,
|
||||
@@ -204,7 +204,7 @@ void command_npcloot(Client *c, const Seperator *sep)
|
||||
}
|
||||
} else {
|
||||
if (sep->IsNumber(2)) {
|
||||
auto item_id = std::stoul(sep->arg[2]);
|
||||
auto item_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
auto item_count = target->CountItem(item_id);
|
||||
if (item_count) {
|
||||
target->RemoveItem(item_id);
|
||||
|
||||
@@ -36,7 +36,7 @@ void command_npcspawn(Client *c, const Seperator *sep)
|
||||
sep->IsNumber(2) ?
|
||||
(
|
||||
is_add ?
|
||||
std::stoi(sep->arg[2]) :
|
||||
Strings::ToInt(sep->arg[2]) :
|
||||
1
|
||||
) : (
|
||||
is_add ?
|
||||
|
||||
@@ -8,7 +8,7 @@ void command_npctypespawn(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto npc_id = std::stoul(sep->arg[1]);
|
||||
auto npc_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
int faction_id = 0;
|
||||
|
||||
auto npc_type = content_db.LoadNPCTypesData(npc_id);
|
||||
@@ -16,7 +16,7 @@ void command_npctypespawn(Client *c, const Seperator *sep)
|
||||
auto npc = new NPC(npc_type, 0, c->GetPosition(), GravityBehavior::Water);
|
||||
if (npc) {
|
||||
if (sep->IsNumber(2)) {
|
||||
faction_id = std::stoi(sep->arg[2]);
|
||||
faction_id = Strings::ToInt(sep->arg[2]);
|
||||
npc->SetNPCFactionID(faction_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,16 +39,16 @@ void command_nudge(Client *c, const Seperator *sep)
|
||||
|
||||
switch (argsep.arg[0][0]) {
|
||||
case 'x':
|
||||
position_offset.x = std::stof(argsep.arg[1]);
|
||||
position_offset.x = Strings::ToFloat(argsep.arg[1]);
|
||||
break;
|
||||
case 'y':
|
||||
position_offset.y = std::stof(argsep.arg[1]);
|
||||
position_offset.y = Strings::ToFloat(argsep.arg[1]);
|
||||
break;
|
||||
case 'z':
|
||||
position_offset.z = std::stof(argsep.arg[1]);
|
||||
position_offset.z = Strings::ToFloat(argsep.arg[1]);
|
||||
break;
|
||||
case 'h':
|
||||
position_offset.w = std::stof(argsep.arg[1]);
|
||||
position_offset.w = Strings::ToFloat(argsep.arg[1]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -12,8 +12,8 @@ void command_nukeitem(Client *c, const Seperator *sep)
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto item_id = std::stoi(sep->arg[1]);
|
||||
|
||||
auto item_id = Strings::ToInt(sep->arg[1]);
|
||||
auto deleted_count = target->NukeItem(item_id);
|
||||
if (deleted_count) {
|
||||
c->Message(
|
||||
|
||||
+61
-61
@@ -50,7 +50,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
if ((sep->arg[2][0] & 0xDF) == 'A') {
|
||||
radius = 0; // List All
|
||||
}
|
||||
else if ((radius = atoi(sep->arg[2])) <= 0) {
|
||||
else if ((radius = Strings::ToInt(sep->arg[2])) <= 0) {
|
||||
radius = 500;
|
||||
} // Invalid radius. Default to 500 units.
|
||||
|
||||
@@ -89,21 +89,21 @@ void command_object(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
id = atoi(row[0]);
|
||||
od.x = atof(row[1]);
|
||||
od.y = atof(row[2]);
|
||||
od.z = atof(row[3]);
|
||||
od.heading = atof(row[4]);
|
||||
itemid = atoi(row[5]);
|
||||
id = Strings::ToInt(row[0]);
|
||||
od.x = Strings::ToFloat(row[1]);
|
||||
od.y = Strings::ToFloat(row[2]);
|
||||
od.z = Strings::ToFloat(row[3]);
|
||||
od.heading = Strings::ToFloat(row[4]);
|
||||
itemid = Strings::ToInt(row[5]);
|
||||
strn0cpy(od.object_name, row[6], sizeof(od.object_name));
|
||||
od.object_name[sizeof(od.object_name) - 1] =
|
||||
'\0'; // Required if strlen(row[col++]) exactly == sizeof(object_name)
|
||||
|
||||
od.object_type = atoi(row[7]);
|
||||
icon = atoi(row[8]);
|
||||
od.size = atoi(row[9]);
|
||||
od.solidtype = atoi(row[10]);
|
||||
od.unknown020 = atoi(row[11]);
|
||||
od.object_type = Strings::ToInt(row[7]);
|
||||
icon = Strings::ToInt(row[8]);
|
||||
od.size = Strings::ToInt(row[9]);
|
||||
od.solidtype = Strings::ToInt(row[10]);
|
||||
od.unknown020 = Strings::ToInt(row[11]);
|
||||
|
||||
switch (od.object_type) {
|
||||
case 0: // Static Object
|
||||
@@ -162,7 +162,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
if (sep->argnum > 3) { // Model name in arg3?
|
||||
if ((sep->arg[3][0] <= '9') && (sep->arg[3][0] >= '0')) {
|
||||
// Nope, user must have specified ObjectID. Extract it.
|
||||
id = atoi(sep->arg[2]);
|
||||
id = Strings::ToInt(sep->arg[2]);
|
||||
col = 1; // Bump all other arguments one to the right. Model is in arg4.
|
||||
}
|
||||
else {
|
||||
@@ -179,18 +179,18 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
memset(&od, 0, sizeof(od));
|
||||
|
||||
od.object_type = atoi(sep->arg[2 + col]);
|
||||
od.object_type = Strings::ToInt(sep->arg[2 + col]);
|
||||
|
||||
switch (od.object_type) {
|
||||
case 0: // Static Object
|
||||
if ((sep->argnum - col) > 3) {
|
||||
od.size = atoi(sep->arg[4 + col]); // Size specified
|
||||
od.size = Strings::ToInt(sep->arg[4 + col]); // Size specified
|
||||
|
||||
if ((sep->argnum - col) > 4) {
|
||||
od.solidtype = atoi(sep->arg[5 + col]); // SolidType specified
|
||||
od.solidtype = Strings::ToInt(sep->arg[5 + col]); // SolidType specified
|
||||
|
||||
if ((sep->argnum - col) > 5) {
|
||||
od.unknown020 = atoi(sep->arg[6 + col]);
|
||||
od.unknown020 = Strings::ToInt(sep->arg[6 + col]);
|
||||
} // Incline specified
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
|
||||
default: // Everything else == Tradeskill Object
|
||||
icon = ((sep->argnum - col) > 3) ? atoi(sep->arg[4 + col]) : 0;
|
||||
icon = ((sep->argnum - col) > 3) ? Strings::ToInt(sep->arg[4 + col]) : 0;
|
||||
|
||||
if (icon == 0) {
|
||||
c->Message(Chat::White, "ERROR: Required property 'Icon' not specified for Tradeskill Object");
|
||||
@@ -227,7 +227,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (results.Success() && results.RowCount() != 0) {
|
||||
auto row = results.begin();
|
||||
if (atoi(row[0]) > 0) { // Yep, in database already.
|
||||
if (Strings::ToInt(row[0]) > 0) { // Yep, in database already.
|
||||
id = 0;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (id == 0) {
|
||||
c->Message(Chat::White, "ERROR: An object already exists with the id %u", atoi(sep->arg[2]));
|
||||
c->Message(Chat::White, "ERROR: An object already exists with the id %u", Strings::ToInt(sep->arg[2]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (results.Success() && results.RowCount() != 0) {
|
||||
auto row = results.begin();
|
||||
objectsFound = atoi(row[0]); // Number of nearby objects from database
|
||||
objectsFound = Strings::ToInt(row[0]); // Number of nearby objects from database
|
||||
}
|
||||
|
||||
// No objects found in database too close. How about spawned but not yet saved?
|
||||
@@ -304,7 +304,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
results = content_db.QueryDatabase(query);
|
||||
if (results.Success() && results.RowCount() != 0) {
|
||||
auto row = results.begin();
|
||||
id = atoi(row[0]);
|
||||
id = Strings::ToInt(row[0]);
|
||||
}
|
||||
|
||||
id++;
|
||||
@@ -352,7 +352,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
if (strcasecmp(sep->arg[1], "edit") == 0) {
|
||||
|
||||
if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) < 1)) {
|
||||
if ((sep->argnum < 2) || ((id = Strings::ToInt(sep->arg[2])) < 1)) {
|
||||
c->Message(Chat::White, "Usage: #object Edit (ObjectID) [PropertyName] [NewValue]");
|
||||
c->Message(Chat::White, "- Static Object (Type 0) Properties: model, type, size, solidtype, incline");
|
||||
c->Message(Chat::White, "- Tradeskill Object (Type 2+) Properties: model, type, icon");
|
||||
@@ -381,9 +381,9 @@ void command_object(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
od.zone_id = atoi(row[0]);
|
||||
od.zone_instance = atoi(row[1]);
|
||||
od.object_type = atoi(row[2]);
|
||||
od.zone_id = Strings::ToInt(row[0]);
|
||||
od.zone_instance = Strings::ToInt(row[1]);
|
||||
od.object_type = Strings::ToInt(row[2]);
|
||||
uint32 objectsFound = 1;
|
||||
|
||||
// Object not in this zone?
|
||||
@@ -471,7 +471,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
od.object_type = atoi(sep->arg[4]);
|
||||
od.object_type = Strings::ToInt(sep->arg[4]);
|
||||
|
||||
switch (od.object_type) {
|
||||
case 0:
|
||||
@@ -514,7 +514,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
od.size = atoi(sep->arg[4]);
|
||||
od.size = Strings::ToInt(sep->arg[4]);
|
||||
o->SetObjectData(&od);
|
||||
|
||||
if (od.size == 0) { // 0 == unspecified == 100%
|
||||
@@ -544,7 +544,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
od.solidtype = atoi(sep->arg[4]);
|
||||
od.solidtype = Strings::ToInt(sep->arg[4]);
|
||||
o->SetObjectData(&od);
|
||||
|
||||
c->Message(
|
||||
@@ -565,7 +565,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((icon = atoi(sep->arg[4])) == 0) {
|
||||
if ((icon = Strings::ToInt(sep->arg[4])) == 0) {
|
||||
c->Message(Chat::White, "ERROR: Invalid Icon specified. Please enter an icon number.");
|
||||
return;
|
||||
}
|
||||
@@ -591,7 +591,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
od.unknown020 = atoi(sep->arg[4]);
|
||||
od.unknown020 = Strings::ToInt(sep->arg[4]);
|
||||
o->SetObjectData(&od);
|
||||
|
||||
c->Message(
|
||||
@@ -622,7 +622,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
if (strcasecmp(sep->arg[1], "move") == 0) {
|
||||
|
||||
if ((sep->argnum < 2) || // Not enough arguments
|
||||
((id = atoi(sep->arg[2])) == 0) || // ID not specified
|
||||
((id = Strings::ToInt(sep->arg[2])) == 0) || // ID not specified
|
||||
(((sep->arg[3][0] < '0') || (sep->arg[3][0] > '9')) && ((sep->arg[3][0] & 0xDF) != 'T') &&
|
||||
(sep->arg[3][0] != '-') && (sep->arg[3][0] != '.'))) { // Location argument not specified correctly
|
||||
c->Message(Chat::White, "Usage: #object Move (ObjectID) ToMe|(x y z [h])");
|
||||
@@ -638,9 +638,9 @@ void command_object(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
od.zone_id = atoi(row[0]);
|
||||
od.zone_instance = atoi(row[1]);
|
||||
od.object_type = atoi(row[2]);
|
||||
od.zone_id = Strings::ToInt(row[0]);
|
||||
od.zone_instance = Strings::ToInt(row[1]);
|
||||
od.object_type = Strings::ToInt(row[2]);
|
||||
|
||||
if (od.zone_id != zone->GetZoneID()) {
|
||||
c->Message(Chat::White, "ERROR: Object %u is not in this zone", id);
|
||||
@@ -702,23 +702,23 @@ void command_object(Client *c, const Seperator *sep)
|
||||
c->MovePC(c->GetX() - x2, c->GetY() - y2, c->GetZ(), c->GetHeading());
|
||||
} // Move to x, y, z [h]
|
||||
else {
|
||||
od.x = atof(sep->arg[3]);
|
||||
od.x = Strings::ToFloat(sep->arg[3]);
|
||||
if (sep->argnum > 3) {
|
||||
od.y = atof(sep->arg[4]);
|
||||
od.y = Strings::ToFloat(sep->arg[4]);
|
||||
}
|
||||
else {
|
||||
o->GetLocation(nullptr, &od.y, nullptr);
|
||||
}
|
||||
|
||||
if (sep->argnum > 4) {
|
||||
od.z = atof(sep->arg[5]);
|
||||
od.z = Strings::ToFloat(sep->arg[5]);
|
||||
}
|
||||
else {
|
||||
o->GetLocation(nullptr, nullptr, &od.z);
|
||||
}
|
||||
|
||||
if (sep->argnum > 5) {
|
||||
o->SetHeading(atof(sep->arg[6]));
|
||||
o->SetHeading(Strings::ToFloat(sep->arg[6]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
if (strcasecmp(sep->arg[1], "rotate") == 0) {
|
||||
// Insufficient or invalid arguments
|
||||
if ((sep->argnum < 3) || ((id = atoi(sep->arg[2])) == 0)) {
|
||||
if ((sep->argnum < 3) || ((id = Strings::ToInt(sep->arg[2])) == 0)) {
|
||||
c->Message(Chat::White, "Usage: #object Rotate (ObjectID) (Heading, 0-512)");
|
||||
return;
|
||||
}
|
||||
@@ -753,7 +753,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
o->SetHeading(atof(sep->arg[3]));
|
||||
o->SetHeading(Strings::ToFloat(sep->arg[3]));
|
||||
|
||||
// Despawn and respawn object to reflect change
|
||||
app = new EQApplicationPacket();
|
||||
@@ -770,7 +770,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
if (strcasecmp(sep->arg[1], "save") == 0) {
|
||||
// Insufficient or invalid arguments
|
||||
if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) == 0)) {
|
||||
if ((sep->argnum < 2) || ((id = Strings::ToInt(sep->arg[2])) == 0)) {
|
||||
c->Message(Chat::White, "Usage: #object Save (ObjectID)");
|
||||
return;
|
||||
}
|
||||
@@ -787,9 +787,9 @@ void command_object(Client *c, const Seperator *sep)
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (results.Success() && results.RowCount() != 0) {
|
||||
auto row = results.begin();
|
||||
od.zone_id = atoi(row[0]);
|
||||
od.zone_instance = atoi(row[1]);
|
||||
od.object_type = atoi(row[2]);
|
||||
od.zone_id = Strings::ToInt(row[0]);
|
||||
od.zone_instance = Strings::ToInt(row[1]);
|
||||
od.object_type = Strings::ToInt(row[2]);
|
||||
|
||||
// ID already in database. Not a new object.
|
||||
bNewObject = false;
|
||||
@@ -1014,7 +1014,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
od.zone_instance = atoi(sep->arg[3]);
|
||||
od.zone_instance = Strings::ToInt(sep->arg[3]);
|
||||
|
||||
if (od.zone_instance == zone->GetInstanceVersion()) {
|
||||
c->Message(Chat::White, "ERROR: Source and destination instance versions are the same.");
|
||||
@@ -1046,7 +1046,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
id = atoi(sep->arg[2]);
|
||||
id = Strings::ToInt(sep->arg[2]);
|
||||
|
||||
std::string query = StringFormat(
|
||||
"INSERT INTO object "
|
||||
@@ -1085,13 +1085,13 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
auto row = results.begin();
|
||||
// Wrong ZoneID?
|
||||
if (atoi(row[0]) != zone->GetZoneID()) {
|
||||
if (Strings::ToInt(row[0]) != zone->GetZoneID()) {
|
||||
c->Message(Chat::White, "ERROR: Object %u is not part of this zone.", id);
|
||||
return;
|
||||
}
|
||||
|
||||
// Wrong Instance Version?
|
||||
if (atoi(row[1]) != zone->GetInstanceVersion()) {
|
||||
if (Strings::ToInt(row[1]) != zone->GetInstanceVersion()) {
|
||||
c->Message(Chat::White, "ERROR: Object %u is not part of this instance version.", id);
|
||||
return;
|
||||
}
|
||||
@@ -1106,7 +1106,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
if (strcasecmp(sep->arg[1], "delete") == 0) {
|
||||
|
||||
if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) <= 0)) {
|
||||
if ((sep->argnum < 2) || ((id = Strings::ToInt(sep->arg[2])) <= 0)) {
|
||||
c->Message(
|
||||
Chat::White, "Usage: #object Delete (ObjectID) -- NOTE: Object deletions are permanent and "
|
||||
"cannot be undone!"
|
||||
@@ -1156,7 +1156,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
switch (atoi(row[0])) {
|
||||
switch (Strings::ToInt(row[0])) {
|
||||
case 0: // Static Object
|
||||
query = StringFormat(
|
||||
"DELETE FROM object WHERE id = %u "
|
||||
@@ -1185,7 +1185,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
if (strcasecmp(sep->arg[1], "undo") == 0) {
|
||||
// Insufficient or invalid arguments
|
||||
if ((sep->argnum < 2) || ((id = atoi(sep->arg[2])) == 0)) {
|
||||
if ((sep->argnum < 2) || ((id = Strings::ToInt(sep->arg[2])) == 0)) {
|
||||
c->Message(
|
||||
Chat::White, "Usage: #object Undo (ObjectID) -- Reload object from database, undoing any "
|
||||
"changes you have made"
|
||||
@@ -1236,16 +1236,16 @@ void command_object(Client *c, const Seperator *sep)
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
od.x = atof(row[0]);
|
||||
od.y = atof(row[1]);
|
||||
od.z = atof(row[2]);
|
||||
od.heading = atof(row[3]);
|
||||
od.x = Strings::ToFloat(row[0]);
|
||||
od.y = Strings::ToFloat(row[1]);
|
||||
od.z = Strings::ToFloat(row[2]);
|
||||
od.heading = Strings::ToFloat(row[3]);
|
||||
strn0cpy(od.object_name, row[4], sizeof(od.object_name));
|
||||
od.object_type = atoi(row[5]);
|
||||
icon = atoi(row[6]);
|
||||
od.size = atoi(row[7]);
|
||||
od.solidtype = atoi(row[8]);
|
||||
od.unknown020 = atoi(row[9]);
|
||||
od.object_type = Strings::ToInt(row[5]);
|
||||
icon = Strings::ToInt(row[6]);
|
||||
od.size = Strings::ToInt(row[7]);
|
||||
od.solidtype = Strings::ToInt(row[8]);
|
||||
od.unknown020 = Strings::ToInt(row[9]);
|
||||
|
||||
if (od.object_type == 0) {
|
||||
od.object_type = staticType;
|
||||
|
||||
@@ -10,7 +10,7 @@ void command_oocmute(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
bool is_muted = std::stoi(sep->arg[1]) ? true : false;
|
||||
bool is_muted = Strings::ToInt(sep->arg[1]) ? true : false;
|
||||
|
||||
ServerPacket pack(ServerOP_OOCMute, sizeof(ServerOOCMute_Struct));
|
||||
auto o = (ServerOOCMute_Struct*) pack.pBuffer;
|
||||
|
||||
@@ -49,7 +49,7 @@ void command_peqzone(Client *c, const Seperator *sep)
|
||||
|
||||
auto zone_id = (
|
||||
sep->IsNumber(1) ?
|
||||
static_cast<uint16>(std::stoul(sep->arg[1])) :
|
||||
static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1])) :
|
||||
static_cast<uint16>(ZoneID(sep->arg[1]))
|
||||
);
|
||||
auto zone_short_name = ZoneName(zone_id);
|
||||
|
||||
@@ -13,8 +13,8 @@ void command_permaclass(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto class_id = std::stoi(sep->arg[1]);
|
||||
|
||||
auto class_id = Strings::ToInt(sep->arg[1]);
|
||||
|
||||
LogInfo("Class changed by {} for {} to {} ({})",
|
||||
c->GetCleanName(),
|
||||
c->GetTargetDescription(target),
|
||||
|
||||
@@ -14,13 +14,13 @@ void command_permagender(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto gender_id = std::stoi(sep->arg[1]);
|
||||
auto gender_id = Strings::ToInt(sep->arg[1]);
|
||||
if (gender_id < 0 || gender_id > 2) {
|
||||
c->Message(Chat::White, "Usage: #permagender [Gender ID]");
|
||||
c->Message(Chat::White, "Genders: 0 = Male, 1 = Female, 2 = Neuter");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LogInfo("Gender changed by {} for {} to {} ({})",
|
||||
c->GetCleanName(),
|
||||
c->GetTargetDescription(target),
|
||||
|
||||
@@ -17,9 +17,9 @@ void command_permarace(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto race_id = std::stoi(sep->arg[1]);
|
||||
auto race_id = Strings::ToInt(sep->arg[1]);
|
||||
auto gender_id = Mob::GetDefaultGender(race_id, target->GetBaseGender());
|
||||
|
||||
|
||||
LogInfo("Race changed by {} for {} to {} ({})",
|
||||
c->GetCleanName(),
|
||||
c->GetTargetDescription(target),
|
||||
|
||||
@@ -13,7 +13,7 @@ void command_petitioninfo(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
LogInfo("Petition information request from [{}], petition number:", c->GetName(), atoi(sep->argplus[1]));
|
||||
LogInfo("Petition information request from [{}], petition number:", c->GetName(), Strings::ToInt(sep->argplus[1]));
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
c->Message(Chat::Red, "There was an error in your request: ID not found! Please check the Id and try again.");
|
||||
|
||||
@@ -17,11 +17,11 @@ void command_push(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
auto target = c->GetTarget();
|
||||
auto back = std::stof(sep->arg[1]);
|
||||
auto back = Strings::ToFloat(sep->arg[1]);
|
||||
auto up = 0.0f;
|
||||
|
||||
if (arguments == 2 && sep->IsNumber(2)) {
|
||||
up = std::stof(sep->arg[2]);
|
||||
up = Strings::ToFloat(sep->arg[2]);
|
||||
}
|
||||
|
||||
c->Message(
|
||||
|
||||
@@ -5,7 +5,7 @@ void command_race(Client *c, const Seperator *sep)
|
||||
Mob *target = c->CastToMob();
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
auto race = atoi(sep->arg[1]);
|
||||
auto race = Strings::ToInt(sep->arg[1]);
|
||||
if ((race >= 0 && race <= RuleI(NPC, MaxRaceID)) || (race >= 2253 && race <= 2259)) {
|
||||
if ((c->GetTarget()) && c->Admin() >= commandRaceOthers) {
|
||||
target = c->GetTarget();
|
||||
|
||||
@@ -135,7 +135,7 @@ void command_reload(Client *c, const Seperator *sep)
|
||||
bool stop_timers = false;
|
||||
|
||||
if (sep->IsNumber(2)) {
|
||||
stop_timers = std::stoi(sep->arg[2]) != 0 ? true : false;
|
||||
stop_timers = Strings::ToInt(sep->arg[2]) != 0 ? true : false;
|
||||
}
|
||||
|
||||
std::string stop_timers_message = stop_timers ? " and timers stopped" : "";
|
||||
@@ -167,7 +167,7 @@ void command_reload(Client *c, const Seperator *sep)
|
||||
pack = new ServerPacket(ServerOP_ReloadTasks, sizeof(ReloadTasks_Struct));
|
||||
}
|
||||
else {
|
||||
task_id = std::stoul(sep->arg[2]);
|
||||
task_id = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
}
|
||||
|
||||
auto rts = (ReloadTasks_Struct *) pack->pBuffer;
|
||||
@@ -191,7 +191,7 @@ void command_reload(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
bool global = std::stoi(sep->arg[2]) ? true : false;
|
||||
bool global = Strings::ToInt(sep->arg[2]) ? true : false;
|
||||
|
||||
if (!global) {
|
||||
entity_list.UpdateAllTraps(true, true);
|
||||
@@ -220,7 +220,7 @@ void command_reload(Client *c, const Seperator *sep)
|
||||
uint8 global_repop = ReloadWorld::NoRepop;
|
||||
|
||||
if (sep->IsNumber(2)) {
|
||||
global_repop = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
global_repop = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
|
||||
if (global_repop > ReloadWorld::ForceRepop) {
|
||||
global_repop = ReloadWorld::ForceRepop;
|
||||
@@ -268,7 +268,7 @@ void command_reload(Client *c, const Seperator *sep)
|
||||
|
||||
auto zone_id = (
|
||||
sep->IsNumber(2) ?
|
||||
std::stoul(sep->arg[2]) :
|
||||
Strings::ToUnsignedInt(sep->arg[2]) :
|
||||
ZoneID(sep->arg[2])
|
||||
);
|
||||
if (!zone_id) {
|
||||
@@ -286,7 +286,7 @@ void command_reload(Client *c, const Seperator *sep)
|
||||
auto zone_long_name = ZoneLongName(zone_id);
|
||||
auto version = (
|
||||
sep->IsNumber(3) ?
|
||||
std::stoul(sep->arg[3]) :
|
||||
Strings::ToUnsignedInt(sep->arg[3]) :
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ void command_removeitem(Client *c, const Seperator *sep)
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto item_id = std::stoi(sep->arg[1]);
|
||||
|
||||
auto item_id = Strings::ToInt(sep->arg[1]);
|
||||
if (!database.GetItem(item_id)) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -24,9 +24,9 @@ void command_removeitem(Client *c, const Seperator *sep)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto item_link = database.CreateItemLink(item_id);
|
||||
auto amount = sep->IsNumber(2) ? std::stoul(sep->arg[2]) : 1;
|
||||
auto amount = sep->IsNumber(2) ? Strings::ToUnsignedInt(sep->arg[2]) : 1;
|
||||
auto item_count = target->CountItem(item_id);
|
||||
if (item_count) {
|
||||
if (item_count >= amount) {
|
||||
|
||||
@@ -29,7 +29,7 @@ void command_resetaa_timer(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
int timer_id = std::stoi(sep->arg[1]);
|
||||
int timer_id = Strings::ToInt(sep->arg[1]);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
|
||||
@@ -29,7 +29,7 @@ void command_resetdisc_timer(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (sep->IsNumber(1)) {
|
||||
auto timer_id = std::stoul(sep->arg[1]);
|
||||
auto timer_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
|
||||
@@ -25,7 +25,7 @@ void command_revoke(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
bool revoked = std::stoi(sep->arg[2]) ? true : false;
|
||||
bool revoked = Strings::ToInt(sep->arg[2]) ? true : false;
|
||||
|
||||
auto query = fmt::format(
|
||||
"UPDATE account SET revoked = {} WHERE id = {}",
|
||||
|
||||
@@ -52,10 +52,10 @@ void command_roambox(Client *c, const Seperator *sep)
|
||||
int delay = 15000;
|
||||
|
||||
if (arguments >= 2) {
|
||||
box_size = std::stof(sep->arg[2]);
|
||||
box_size = Strings::ToFloat(sep->arg[2]);
|
||||
|
||||
if (arguments == 3) {
|
||||
delay = std::stoi(sep->arg[3]);
|
||||
delay = Strings::ToInt(sep->arg[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ void command_scribespell(Client *c, const Seperator *sep)
|
||||
t = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
const auto spell_id = std::stoul(sep->arg[1]);
|
||||
const auto spell_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
|
||||
if (IsValidSpell(spell_id)) {
|
||||
t->Message(
|
||||
|
||||
@@ -14,10 +14,10 @@ void command_scribespells(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
uint8 rule_max_level = RuleI(Character, MaxLevel);
|
||||
auto max_level = static_cast<uint8>(std::stoul(sep->arg[1]));
|
||||
auto max_level = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
uint8 min_level = (
|
||||
sep->IsNumber(2) ?
|
||||
static_cast<uint8>(std::stoul(sep->arg[2])) :
|
||||
static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2])) :
|
||||
1
|
||||
); // Default to Level 1 if there isn't a 2nd argument
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ void command_serverlock(Client *c, const Seperator *sep)
|
||||
c->Message(Chat::White, "Usage: #serverlock [0|1] - Lock or Unlock the World Server (0 = Unlocked, 1 = Locked)");
|
||||
return;
|
||||
}
|
||||
|
||||
auto is_locked = std::stoi(sep->arg[1]) ? true : false;
|
||||
|
||||
auto is_locked = Strings::ToInt(sep->arg[1]) ? true : false;
|
||||
|
||||
auto pack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct));
|
||||
auto l = (ServerLock_Struct *) pack->pBuffer;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
void command_set_adventure_points(Client *c, const Seperator *sep)
|
||||
{
|
||||
int arguments = sep->argnum;
|
||||
|
||||
|
||||
if (
|
||||
!arguments ||
|
||||
!sep->IsNumber(1) ||
|
||||
@@ -32,7 +32,7 @@ void command_set_adventure_points(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto theme_id = std::stoul(sep->arg[1]);
|
||||
auto theme_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
if (!EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
|
||||
c->Message(Chat::White, "Valid themes are as follows.");
|
||||
auto theme_map = EQ::constants::GetLDoNThemeMap();
|
||||
@@ -45,12 +45,12 @@ void command_set_adventure_points(Client *c, const Seperator *sep)
|
||||
theme.second
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
c->Message(Chat::White, "Note: Theme 0 splits the points evenly across all Themes.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto points = std::stoi(sep->arg[2]);
|
||||
auto points = Strings::ToInt(sep->arg[2]);
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
|
||||
@@ -18,7 +18,7 @@ void command_setaapts(Client *c, const Seperator *sep)
|
||||
|
||||
std::string aa_type = Strings::ToLower(sep->arg[1]);
|
||||
std::string group_raid_string;
|
||||
uint32 aa_points = static_cast<uint32>(std::min(std::stoull(sep->arg[2]), (unsigned long long) 2000000000));
|
||||
uint32 aa_points = static_cast<uint32>(std::min(Strings::ToUnsignedBigInt(sep->arg[2]), (uint64) 2000000000));
|
||||
bool is_aa = aa_type.find("aa") != std::string::npos;
|
||||
bool is_group = aa_type.find("group") != std::string::npos;
|
||||
bool is_raid = aa_type.find("raid") != std::string::npos;
|
||||
|
||||
@@ -19,8 +19,8 @@ void command_setaaxp(Client *c, const Seperator *sep)
|
||||
std::string aa_type = Strings::ToLower(sep->arg[1]);
|
||||
std::string group_raid_string;
|
||||
uint32 aa_experience = static_cast<uint32>(std::min(
|
||||
std::stoull(sep->arg[2]),
|
||||
(unsigned long long) 2000000000
|
||||
Strings::ToUnsignedBigInt(sep->arg[2]),
|
||||
(uint64) 2000000000
|
||||
));
|
||||
bool is_aa = aa_type.find("aa") != std::string::npos;
|
||||
bool is_group = aa_type.find("group") != std::string::npos;
|
||||
|
||||
@@ -17,8 +17,8 @@ void command_setaltcurrency(Client *c, const Seperator *sep)
|
||||
target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
auto currency_id = std::stoul(sep->arg[1]);
|
||||
auto amount = static_cast<int>(std::min(std::stoll(sep->arg[2]), (long long) 2000000000));
|
||||
auto currency_id = Strings::ToUnsignedInt(sep->arg[1]);
|
||||
auto amount = static_cast<int>(std::min(Strings::ToBigInt(sep->arg[2]), (int64) 2000000000));
|
||||
uint32 currency_item_id = zone->GetCurrencyItemID(currency_id);
|
||||
if (!currency_item_id) {
|
||||
c->Message(
|
||||
@@ -32,7 +32,7 @@ void command_setaltcurrency(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
target->SetAlternateCurrencyValue(currency_id, amount);
|
||||
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
|
||||
@@ -14,7 +14,7 @@ void command_setanim(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
|
||||
int animation_id = std::stoi(sep->arg[1]);
|
||||
int animation_id = Strings::ToInt(sep->arg[1]);
|
||||
if (
|
||||
animation_id < 0 ||
|
||||
animation_id > eaLooting
|
||||
@@ -36,7 +36,7 @@ void command_setanim(Client *c, const Seperator *sep)
|
||||
} else if (animation_id == eaLooting) {
|
||||
animation_name = "Looting";
|
||||
}
|
||||
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
|
||||
@@ -12,7 +12,7 @@ void command_setanon(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
if (arguments == 1) {
|
||||
const uint8 anon_flag = static_cast<uint8>(std::stoul(sep->arg[1]));
|
||||
const uint8 anon_flag = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
|
||||
auto t = c;
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient() && c->GetGM()) {
|
||||
t = c->GetTarget()->CastToClient();
|
||||
@@ -44,8 +44,8 @@ void command_setanon(Client *c, const Seperator *sep)
|
||||
).c_str()
|
||||
);
|
||||
} else if (arguments == 2) {
|
||||
const auto character_id = std::stoi(sep->arg[1]);
|
||||
const uint8 anon_flag = static_cast<uint8>(std::stoul(sep->arg[2]));
|
||||
const auto character_id = Strings::ToInt(sep->arg[1]);
|
||||
const uint8 anon_flag = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
|
||||
|
||||
auto e = CharacterDataRepository::FindOne(content_db, character_id);
|
||||
if (!e.id) {
|
||||
|
||||
@@ -15,8 +15,8 @@ void command_setcrystals(Client *c, const Seperator *sep)
|
||||
|
||||
std::string crystal_type = Strings::ToLower(sep->arg[1]);
|
||||
uint32 crystal_amount = static_cast<uint32>(std::min(
|
||||
std::stoull(sep->arg[2]),
|
||||
(unsigned long long) 2000000000
|
||||
Strings::ToUnsignedBigInt(sep->arg[2]),
|
||||
(uint64) 2000000000
|
||||
));
|
||||
bool is_ebon = crystal_type.find("ebon") != std::string::npos;
|
||||
bool is_radiant = crystal_type.find("radiant") != std::string::npos;
|
||||
|
||||
@@ -8,13 +8,13 @@ void command_setendurance(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto endurance = static_cast<int>(std::min(std::stoll(sep->arg[1]), (long long) 2000000000));
|
||||
auto endurance = static_cast<int>(std::min(Strings::ToBigInt(sep->arg[1]), (int64) 2000000000));
|
||||
bool set_to_max = false;
|
||||
Mob* target = c;
|
||||
if (c->GetTarget()) {
|
||||
target = c->GetTarget();
|
||||
}
|
||||
|
||||
|
||||
if (target->IsClient()) {
|
||||
if (endurance >= target->CastToClient()->GetMaxEndurance()) {
|
||||
endurance = target->CastToClient()->GetMaxEndurance();
|
||||
@@ -51,4 +51,4 @@ void command_setendurance(Client *c, const Seperator *sep)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user