[Strings] Add more number formatters (#2873)

* [Strings] Add more number formatters

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

* [Strings] Add more number formatters

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

* Rebase cleanup

* Changes/benchmarks/tests

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King
2023-03-04 18:01:19 -05:00
committed by GitHub
parent be567af70d
commit 2a6cf8c8e7
261 changed files with 3178 additions and 3012 deletions
+35 -35
View File
@@ -1448,9 +1448,9 @@ bool ZoneDatabase::LoadAlternateAdvancement(Client *c) {
int i = 0;
for(auto row = results.begin(); row != results.end(); ++row) {
uint32 aa = atoi(row[0]);
uint32 value = atoi(row[1]);
uint32 charges = atoi(row[2]);
uint32 aa = Strings::ToInt(row[0]);
uint32 value = Strings::ToInt(row[1]);
uint32 charges = Strings::ToInt(row[2]);
auto rank = zone->GetAlternateAdvancementRank(aa);
if(!rank) {
@@ -1775,20 +1775,20 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
auto ability = new AA::Ability;
ability->id = atoi(row[0]);
ability->id = Strings::ToInt(row[0]);
ability->name = row[1];
ability->category = atoi(row[2]);
ability->category = Strings::ToInt(row[2]);
//EQ client has classes left shifted by one bit for some odd reason
ability->classes = atoi(row[3]) << 1;
ability->races = atoi(row[4]);
ability->deities = atoi(row[5]);
ability->drakkin_heritage = atoi(row[6]);
ability->status = atoi(row[7]);
ability->type = atoi(row[8]);
ability->charges = atoi(row[9]);
ability->grant_only = atoi(row[10]) != 0 ? true : false;
ability->reset_on_death = atoi(row[11]) != 0 ? true : false;
ability->first_rank_id = atoi(row[12]);
ability->classes = Strings::ToInt(row[3]) << 1;
ability->races = Strings::ToInt(row[4]);
ability->deities = Strings::ToInt(row[5]);
ability->drakkin_heritage = Strings::ToInt(row[6]);
ability->status = Strings::ToInt(row[7]);
ability->type = Strings::ToInt(row[8]);
ability->charges = Strings::ToInt(row[9]);
ability->grant_only = Strings::ToInt(row[10]) != 0 ? true : false;
ability->reset_on_death = Strings::ToInt(row[11]) != 0 ? true : false;
ability->first_rank_id = Strings::ToInt(row[12]);
ability->first = nullptr;
abilities[ability->id] = std::unique_ptr<AA::Ability>(ability);
@@ -1814,18 +1814,18 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
auto rank = new AA::Rank;
rank->id = atoi(row[0]);
rank->upper_hotkey_sid = atoi(row[1]);
rank->lower_hotkey_sid = atoi(row[2]);
rank->title_sid = atoi(row[3]);
rank->desc_sid = atoi(row[4]);
rank->cost = atoi(row[5]);
rank->level_req = atoi(row[6]);
rank->spell = atoi(row[7]);
rank->spell_type = atoi(row[8]);
rank->recast_time = atoi(row[9]);
rank->next_id = atoi(row[10]);
rank->expansion = atoi(row[11]);
rank->id = Strings::ToInt(row[0]);
rank->upper_hotkey_sid = Strings::ToInt(row[1]);
rank->lower_hotkey_sid = Strings::ToInt(row[2]);
rank->title_sid = Strings::ToInt(row[3]);
rank->desc_sid = Strings::ToInt(row[4]);
rank->cost = Strings::ToInt(row[5]);
rank->level_req = Strings::ToInt(row[6]);
rank->spell = Strings::ToInt(row[7]);
rank->spell_type = Strings::ToInt(row[8]);
rank->recast_time = Strings::ToInt(row[9]);
rank->next_id = Strings::ToInt(row[10]);
rank->expansion = Strings::ToInt(row[11]);
rank->base_ability = nullptr;
rank->total_cost = 0;
rank->prev_id = -1;
@@ -1846,11 +1846,11 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
AA::RankEffect effect;
int rank_id = atoi(row[0]);
effect.slot = atoi(row[1]);
effect.effect_id = atoi(row[2]);
effect.base_value = atoi(row[3]);
effect.limit_value = atoi(row[4]);
int rank_id = Strings::ToInt(row[0]);
effect.slot = Strings::ToInt(row[1]);
effect.effect_id = Strings::ToInt(row[2]);
effect.base_value = Strings::ToInt(row[3]);
effect.limit_value = Strings::ToInt(row[4]);
if(effect.slot < 1)
continue;
@@ -1871,9 +1871,9 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
results = QueryDatabase(query);
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
int rank_id = atoi(row[0]);
int aa_id = atoi(row[1]);
int points = atoi(row[2]);
int rank_id = Strings::ToInt(row[0]);
int aa_id = Strings::ToInt(row[1]);
int points = Strings::ToInt(row[2]);
if(aa_id <= 0 || points <= 0) {
continue;
+2 -2
View File
@@ -1979,10 +1979,10 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
database.GetVariable("ServerType", tmp);
if (tmp[0] == '1' && tmp[1] == '\0' && killerMob && killerMob->IsClient()) {
database.GetVariable("PvPreward", tmp);
auto reward = atoi(tmp.c_str());
auto reward = Strings::ToInt(tmp.c_str());
if (reward == 3) {
database.GetVariable("PvPitem", tmp);
auto pvp_item_id = atoi(tmp.c_str());
auto pvp_item_id = Strings::ToInt(tmp.c_str());
const auto* item = database.GetItem(pvp_item_id);
if (item) {
new_corpse->SetPlayerKillItemID(pvp_item_id);
+9 -9
View File
@@ -946,17 +946,17 @@ bool ZoneDatabase::GetAuraEntry(uint16 spell_id, AuraRecord &record)
auto row = results.begin();
record.npc_type = atoi(row[0]);
record.npc_type = Strings::ToInt(row[0]);
strn0cpy(record.name, row[1], 64);
record.spell_id = atoi(row[2]);
record.distance = atoi(row[3]);
record.spell_id = Strings::ToInt(row[2]);
record.distance = Strings::ToInt(row[3]);
record.distance *= record.distance; // so we can avoid sqrt
record.aura_type = atoi(row[4]);
record.spawn_type = atoi(row[5]);
record.movement = atoi(row[6]);
record.duration = atoi(row[7]) * 1000; // DB is in seconds
record.icon = atoi(row[8]);
record.cast_time = atoi(row[9]) * 1000; // DB is in seconds
record.aura_type = Strings::ToInt(row[4]);
record.spawn_type = Strings::ToInt(row[5]);
record.movement = Strings::ToInt(row[6]);
record.duration = Strings::ToInt(row[7]) * 1000; // DB is in seconds
record.icon = Strings::ToInt(row[8]);
record.cast_time = Strings::ToInt(row[9]) * 1000; // DB is in seconds
return true;
}
+2 -2
View File
@@ -4139,7 +4139,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment.Primary.Material = atoi(&item->IDFile[2]);
ns->spawn.equipment.Primary.Material = Strings::ToInt(&item->IDFile[2]);
ns->spawn.equipment_tint.Primary.Color = GetEquipmentColor(EQ::textures::weaponPrimary);
}
@@ -4150,7 +4150,7 @@ void Bot::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
item = inst->GetItem();
if(item) {
if(strlen(item->IDFile) > 2)
ns->spawn.equipment.Secondary.Material = atoi(&item->IDFile[2]);
ns->spawn.equipment.Secondary.Material = Strings::ToInt(&item->IDFile[2]);
ns->spawn.equipment_tint.Secondary.Color = GetEquipmentColor(EQ::textures::weaponSecondary);
}
+44 -44
View File
@@ -5041,7 +5041,7 @@ void bot_subcommand_bot_beard_color(Client *c, const Seperator *sep)
return;
}
uint8 uvalue = atoi(sep->arg[1]);
uint8 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (my_bot->GetGender() != MALE && my_bot->GetRace() != DWARF)
@@ -5078,7 +5078,7 @@ void bot_subcommand_bot_beard_style(Client *c, const Seperator *sep)
return;
}
uint8 uvalue = atoi(sep->arg[1]);
uint8 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (my_bot->GetGender() != MALE && my_bot->GetRace() != DWARF)
@@ -5358,7 +5358,7 @@ void bot_command_view_combos(Client *c, const Seperator *sep)
return;
}
const uint16 bot_race = static_cast<uint16>(std::stoul(sep->arg[1]));
const uint16 bot_race = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
const std::string race_name = GetRaceIDName(bot_race);
if (!Mob::IsPlayerRace(bot_race)) {
@@ -5562,14 +5562,14 @@ void bot_subcommand_bot_create(Client *c, const Seperator *sep)
return;
}
auto bot_class = static_cast<uint8>(std::stoul(sep->arg[2]));
auto bot_class = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[2]));
if (arguments < 3 || !sep->IsNumber(3)) {
c->Message(Chat::White, "Invalid race!");
return;
}
auto bot_race = static_cast<uint16>(std::stoul(sep->arg[3]));
auto bot_race = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[3]));
if (arguments < 4) {
c->Message(Chat::White, "Invalid gender!");
@@ -5579,7 +5579,7 @@ void bot_subcommand_bot_create(Client *c, const Seperator *sep)
auto bot_gender = MALE;
if (sep->IsNumber(4)) {
bot_gender = static_cast<uint8>(std::stoul(sep->arg[4]));
bot_gender = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[4]));
if (bot_gender == NEUTER) {
bot_gender = MALE;
}
@@ -5647,7 +5647,7 @@ void bot_subcommand_bot_details(Client *c, const Seperator *sep)
return;
}
uint32 uvalue = atoi(sep->arg[1]);
uint32 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (my_bot->GetRace() != DRAKKIN)
@@ -5700,7 +5700,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
bool dye_all = (sep->arg[1][0] == '*');
if (!dye_all) {
material_slot = std::stoi(sep->arg[1]);
material_slot = Strings::ToInt(sep->arg[1]);
slot_id = EQ::InventoryProfile::CalcSlotFromMaterial(material_slot);
if (!sep->IsNumber(1) || slot_id == INVALID_INDEX || material_slot > EQ::textures::LastTintableTexture) {
@@ -5715,7 +5715,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
return;
}
uint32 red_value = std::stoul(sep->arg[2]);
uint32 red_value = Strings::ToUnsignedInt(sep->arg[2]);
if (red_value > 255) {
red_value = 255;
}
@@ -5725,7 +5725,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
return;
}
uint32 green_value = std::stoul(sep->arg[3]);
uint32 green_value = Strings::ToUnsignedInt(sep->arg[3]);
if (green_value > 255) {
green_value = 255;
}
@@ -5735,7 +5735,7 @@ void bot_subcommand_bot_dye_armor(Client *c, const Seperator *sep)
return;
}
uint32 blue_value = std::stoul(sep->arg[4]);
uint32 blue_value = Strings::ToUnsignedInt(sep->arg[4]);
if (blue_value > 255) {
blue_value = 255;
}
@@ -5815,7 +5815,7 @@ void bot_subcommand_bot_eyes(Client *c, const Seperator *sep)
return;
}
uint8 uvalue = atoi(sep->arg[1]);
uint8 uvalue = Strings::ToInt(sep->arg[1]);
//uint8 eye_bias = 0;
//std::string arg2 = sep->arg[2];
@@ -5869,7 +5869,7 @@ void bot_subcommand_bot_face(Client *c, const Seperator *sep)
return;
}
uint8 uvalue = atoi(sep->arg[1]);
uint8 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (!PlayerAppearance::IsValidFace(my_bot->GetRace(), my_bot->GetGender(), uvalue)) {
@@ -5909,7 +5909,7 @@ void bot_subcommand_bot_follow_distance(Client *c, const Seperator *sep)
return;
}
bfd = atoi(sep->arg[2]);
bfd = Strings::ToInt(sep->arg[2]);
if (bfd < 1)
bfd = 1;
if (bfd > BOT_FOLLOW_DISTANCE_DEFAULT_MAX)
@@ -5975,7 +5975,7 @@ void bot_subcommand_bot_hair_color(Client *c, const Seperator *sep)
return;
}
uint8 uvalue = atoi(sep->arg[1]);
uint8 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (!PlayerAppearance::IsValidHairColor(my_bot->GetRace(), my_bot->GetGender(), uvalue))
@@ -6010,7 +6010,7 @@ void bot_subcommand_bot_hairstyle(Client *c, const Seperator *sep)
return;
}
uint8 uvalue = atoi(sep->arg[1]);
uint8 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (!PlayerAppearance::IsValidHair(my_bot->GetRace(), my_bot->GetGender(), uvalue))
@@ -6047,7 +6047,7 @@ void bot_subcommand_bot_heritage(Client *c, const Seperator *sep)
return;
}
uint32 uvalue = atoi(sep->arg[1]);
uint32 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (my_bot->GetRace() != DRAKKIN)
@@ -6184,13 +6184,13 @@ void bot_subcommand_bot_list(Client *c, const Seperator *sep)
if (!strcasecmp(sep->arg[i], "class")) {
filter_mask |= MaskClass;
filter_value[FilterClass] = atoi(sep->arg[i + 1]);
filter_value[FilterClass] = Strings::ToInt(sep->arg[i + 1]);
continue;
}
if (!strcasecmp(sep->arg[i], "race")) {
filter_mask |= MaskRace;
filter_value[FilterRace] = atoi(sep->arg[i + 1]);
filter_value[FilterRace] = Strings::ToInt(sep->arg[i + 1]);
continue;
}
@@ -6751,7 +6751,7 @@ void bot_subcommand_bot_stance(Client *c, const Seperator *sep)
if (!strcasecmp(sep->arg[1], "current"))
current_flag = true;
else if (sep->IsNumber(1)) {
bst = (EQ::constants::StanceType)atoi(sep->arg[1]);
bst = (EQ::constants::StanceType)Strings::ToInt(sep->arg[1]);
if (bst < EQ::constants::stanceUnknown || bst > EQ::constants::stanceBurnAE)
bst = EQ::constants::stanceUnknown;
}
@@ -6810,7 +6810,7 @@ void bot_subcommand_bot_stop_melee_level(Client *c, const Seperator *sep)
uint8 sml = RuleI(Bots, CasterStopMeleeLevel);
if (sep->IsNumber(1)) {
sml = atoi(sep->arg[1]);
sml = Strings::ToInt(sep->arg[1]);
}
else if (!strcasecmp(sep->arg[1], "sync")) {
sml = my_bot->GetLevel();
@@ -6916,7 +6916,7 @@ void bot_subcommand_bot_tattoo(Client *c, const Seperator *sep)
return;
}
uint32 uvalue = atoi(sep->arg[1]);
uint32 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (my_bot->GetRace() != DRAKKIN)
@@ -7160,7 +7160,7 @@ void bot_subcommand_bot_woad(Client *c, const Seperator *sep)
return;
}
uint8 uvalue = atoi(sep->arg[1]);
uint8 uvalue = Strings::ToInt(sep->arg[1]);
auto fail_type = BCEnum::AFT_None;
if (my_bot->GetRace() != BARBARIAN) {
@@ -8228,7 +8228,7 @@ void bot_subcommand_heal_rotation_adjust_critical(Client *c, const Seperator *se
uint8 armor_type_value = 255;
if (sep->IsNumber(1))
armor_type_value = atoi(armor_type_arg.c_str());
armor_type_value = Strings::ToInt(armor_type_arg.c_str());
if (armor_type_value > ARMOR_TYPE_LAST) {
c->Message(Chat::White, "You must specify a valid [armor_type: %u-%u] to use this command", ARMOR_TYPE_FIRST, ARMOR_TYPE_LAST);
@@ -8257,7 +8257,7 @@ void bot_subcommand_heal_rotation_adjust_critical(Client *c, const Seperator *se
float critical_ratio = CRITICAL_HP_RATIO_BASE;
if (sep->IsNumber(2))
critical_ratio = atof(critical_arg.c_str());
critical_ratio = Strings::ToFloat(critical_arg.c_str());
else if (!critical_arg.compare("+"))
critical_ratio = (*current_member->MemberOfHealRotation())->ArmorTypeCriticalHPRatio(armor_type_value) + HP_RATIO_DELTA;
else if (!critical_arg.compare("-"))
@@ -8294,7 +8294,7 @@ void bot_subcommand_heal_rotation_adjust_safe(Client *c, const Seperator *sep)
uint8 armor_type_value = 255;
if (sep->IsNumber(1))
armor_type_value = atoi(armor_type_arg.c_str());
armor_type_value = Strings::ToInt(armor_type_arg.c_str());
if (armor_type_value > ARMOR_TYPE_LAST) {
c->Message(Chat::White, "You must specify a valid [armor_type: %u-%u] to use this command", ARMOR_TYPE_FIRST, ARMOR_TYPE_LAST);
@@ -8323,7 +8323,7 @@ void bot_subcommand_heal_rotation_adjust_safe(Client *c, const Seperator *sep)
float safe_ratio = SAFE_HP_RATIO_BASE;
if (sep->IsNumber(2))
safe_ratio = atof(safe_arg.c_str());
safe_ratio = Strings::ToFloat(safe_arg.c_str());
else if (!safe_arg.compare("+"))
safe_ratio = (*current_member->MemberOfHealRotation())->ArmorTypeSafeHPRatio(armor_type_value) + HP_RATIO_DELTA;
else if (!safe_arg.compare("-"))
@@ -8437,7 +8437,7 @@ void bot_subcommand_heal_rotation_change_interval(Client *c, const Seperator *se
uint32 hr_change_interval_s = CASTING_CYCLE_DEFAULT_INTERVAL_S;
if (!change_interval_arg.empty()) {
hr_change_interval_s = atoi(change_interval_arg.c_str());
hr_change_interval_s = Strings::ToInt(change_interval_arg.c_str());
}
else {
hr_change_interval_s = (*current_member->MemberOfHealRotation())->IntervalS();
@@ -8585,14 +8585,14 @@ void bot_subcommand_heal_rotation_create(Client *c, const Seperator *sep)
hr_adaptive_targeting = true;
if (!fast_heals_arg.compare("on"))
hr_fast_heals = true;
hr_interval_s = atoi(interval_arg.c_str());
hr_interval_s = Strings::ToInt(interval_arg.c_str());
}
else if (!casting_override_arg.compare("off")) {
if (!adaptive_targeting_arg.compare("on"))
hr_adaptive_targeting = true;
if (!fast_heals_arg.compare("on"))
hr_fast_heals = true;
hr_interval_s = atoi(interval_arg.c_str());
hr_interval_s = Strings::ToInt(interval_arg.c_str());
}
if (hr_interval_s < CASTING_CYCLE_MINIMUM_INTERVAL_S || hr_interval_s > CASTING_CYCLE_MAXIMUM_INTERVAL_S)
@@ -9315,7 +9315,7 @@ void bot_subcommand_inventory_remove(Client *c, const Seperator *sep)
return;
}
auto slot_id = static_cast<uint16>(std::stoul(sep->arg[1]));
auto slot_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
if (slot_id > EQ::invslot::EQUIPMENT_END || slot_id < EQ::invslot::EQUIPMENT_BEGIN) {
c->Message(Chat::White, "Valid slots are 0 to 22.");
return;
@@ -10307,7 +10307,7 @@ void bot_command_spell_list(Client* c, const Seperator *sep)
uint8 min_level = 0;
if (sep->IsNumber(1)) {
min_level = static_cast<uint8>(std::stoul(sep->arg[1]));
min_level = static_cast<uint8>(Strings::ToUnsignedInt(sep->arg[1]));
}
my_bot->ListBotSpells(min_level);
@@ -10354,7 +10354,7 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
return;
}
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(
@@ -10381,9 +10381,9 @@ void bot_command_spell_settings_add(Client *c, const Seperator *sep)
return;
}
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[3]), -1, 99));
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[4]), -1, 100));
auto priority = static_cast<int16>(Strings::ToInt(sep->arg[2]));
auto min_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[3]), -1, 99));
auto max_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[4]), -1, 100));
BotSpellSetting bs;
@@ -10469,7 +10469,7 @@ void bot_command_spell_settings_delete(Client *c, const Seperator *sep)
return;
}
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(
@@ -10577,7 +10577,7 @@ void bot_command_spell_settings_toggle(Client *c, const Seperator *sep)
return;
}
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,
@@ -10591,7 +10591,7 @@ void bot_command_spell_settings_toggle(Client *c, const Seperator *sep)
bool toggle = (
sep->IsNumber(2) ?
(std::stoi(sep->arg[2]) ? true : false) :
(Strings::ToInt(sep->arg[2]) ? true : false) :
atobool(sep->arg[2])
);
@@ -10682,7 +10682,7 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
return;
}
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(
@@ -10695,9 +10695,9 @@ void bot_command_spell_settings_update(Client *c, const Seperator *sep)
return;
}
auto priority = static_cast<int16>(std::stoi(sep->arg[2]));
auto min_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[3]), -1, 99));
auto max_hp = static_cast<int8>(EQ::Clamp(std::stoi(sep->arg[4]), -1, 100));
auto priority = static_cast<int16>(Strings::ToInt(sep->arg[2]));
auto min_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[3]), -1, 99));
auto max_hp = static_cast<int8>(EQ::Clamp(Strings::ToInt(sep->arg[4]), -1, 100));
BotSpellSetting bs;
@@ -10772,7 +10772,7 @@ void bot_spell_info_dialogue_window(Client* c, const Seperator *sep)
return;
}
auto spell_id = static_cast<uint16>(std::stoul(sep->arg[1]));
auto spell_id = static_cast<uint16>(Strings::ToUnsignedInt(sep->arg[1]));
auto min_level = spells[spell_id].classes;
auto class_level = min_level[my_bot->GetBotClass() - 1];
+89 -89
View File
@@ -43,7 +43,7 @@ bool BotDatabase::LoadBotCommandSettings(std::map<std::string, std::pair<uint8,
return false;
for (auto row = results.begin(); row != results.end(); ++row) {
bot_command_settings[row[0]].first = atoi(row[1]);
bot_command_settings[row[0]].first = Strings::ToInt(row[1]);
if (row[2][0] == 0)
continue;
@@ -138,19 +138,19 @@ bool BotDatabase::LoadBotSpellCastingChances()
return false;
for (auto row = results.begin(); row != results.end(); ++row) {
uint8 spell_type_index = atoi(row[0]);
uint8 spell_type_index = Strings::ToInt(row[0]);
if (spell_type_index >= Bot::SPELL_TYPE_COUNT)
continue;
uint8 class_index = atoi(row[1]);
uint8 class_index = Strings::ToInt(row[1]);
if (class_index < WARRIOR || class_index > BERSERKER)
continue;
--class_index;
uint8 stance_index = atoi(row[2]);
uint8 stance_index = Strings::ToInt(row[2]);
if (stance_index >= EQ::constants::STANCE_TYPE_COUNT)
continue;
for (uint8 conditional_index = nHSND; conditional_index < cntHSND; ++conditional_index) {
uint8 value = atoi(row[3 + conditional_index]);
uint8 value = Strings::ToInt(row[3 + conditional_index]);
if (!value)
continue;
if (value > 100)
@@ -223,7 +223,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, int class_id, uint32& bot
}
auto row = results.begin();
bot_count = std::stoul(row[0]);
bot_count = Strings::ToUnsignedInt(row[0]);
if (EQ::ValueWithin(class_id, WARRIOR, BERSERKER)) {
query = fmt::format(
@@ -241,7 +241,7 @@ bool BotDatabase::QueryBotCount(const uint32 owner_id, int class_id, uint32& bot
}
auto row = results.begin();
bot_class_count = std::stoul(row[0]);
bot_class_count = Strings::ToUnsignedInt(row[0]);
}
return true;
@@ -269,7 +269,7 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
for (auto row = results.begin(); row != results.end(); ++row) {
BotsAvailableList bot_entry;
bot_entry.ID = atoi(row[0]);
bot_entry.ID = Strings::ToInt(row[0]);
memset(&bot_entry.Name, 0, sizeof(bot_entry.Name));
std::string bot_name = row[1];
@@ -283,11 +283,11 @@ bool BotDatabase::LoadBotsList(const uint32 owner_id, std::list<BotsAvailableLis
bot_owner = bot_owner.substr(0, 63);
if (!bot_owner.empty())
strcpy(bot_entry.Owner, bot_owner.c_str());
bot_entry.Class = atoi(row[2]);
bot_entry.Level = atoi(row[3]);
bot_entry.Race = atoi(row[4]);
bot_entry.Gender = atoi(row[5]);
bot_entry.Owner_ID = atoi(row[7]);
bot_entry.Class = Strings::ToInt(row[2]);
bot_entry.Level = Strings::ToInt(row[3]);
bot_entry.Race = Strings::ToInt(row[4]);
bot_entry.Gender = Strings::ToInt(row[5]);
bot_entry.Owner_ID = Strings::ToInt(row[7]);
bots_list.push_back(bot_entry);
}
@@ -307,7 +307,7 @@ bool BotDatabase::LoadOwnerID(const std::string& bot_name, uint32& owner_id)
return true;
auto row = results.begin();
owner_id = atoi(row[0]);
owner_id = Strings::ToInt(row[0]);
return true;
}
@@ -325,7 +325,7 @@ bool BotDatabase::LoadOwnerID(const uint32 bot_id, uint32& owner_id)
return true;
auto row = results.begin();
owner_id = atoi(row[0]);
owner_id = Strings::ToInt(row[0]);
return true;
}
@@ -366,7 +366,7 @@ bool BotDatabase::LoadBotID(const uint32 owner_id, const std::string& bot_name,
}
auto row = results.begin();
bot_id = std::stoul(row[0]);
bot_id = Strings::ToUnsignedInt(row[0]);
return true;
}
@@ -393,8 +393,8 @@ bool BotDatabase::LoadBotID(const uint32 owner_id, const std::string& bot_name,
}
auto row = results.begin();
bot_id = std::stoul(row[0]);
bot_class_id = static_cast<uint8>(std::stoul(row[1]));
bot_id = Strings::ToUnsignedInt(row[0]);
bot_class_id = static_cast<uint8>(Strings::ToUnsignedInt(row[1]));
return true;
}
@@ -693,32 +693,32 @@ bool BotDatabase::LoadBuffs(Bot* bot_inst)
int buff_count = 0;
for (auto row = results.begin(); row != results.end() && buff_count < BUFF_COUNT; ++row) {
bot_buffs[buff_count].spellid = atoul(row[0]);
bot_buffs[buff_count].casterlevel = atoul(row[1]);
bot_buffs[buff_count].spellid = Strings::ToUnsignedInt(row[0]);
bot_buffs[buff_count].casterlevel = Strings::ToUnsignedInt(row[1]);
//row[2] (duration_formula) can probably be removed
bot_buffs[buff_count].ticsremaining = Strings::ToInt(row[3]);
bot_buffs[buff_count].counters = 0;
if (CalculatePoisonCounters(bot_buffs[buff_count].spellid) > 0) {
bot_buffs[buff_count].counters = atoul(row[4]);
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[4]);
} else if (CalculateDiseaseCounters(bot_buffs[buff_count].spellid) > 0) {
bot_buffs[buff_count].counters = atoul(row[5]);
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[5]);
} else if (CalculateCurseCounters(bot_buffs[buff_count].spellid) > 0) {
bot_buffs[buff_count].counters = atoul(row[6]);
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[6]);
} else if (CalculateCorruptionCounters(bot_buffs[buff_count].spellid) > 0) {
bot_buffs[buff_count].counters = atoul(row[7]);
bot_buffs[buff_count].counters = Strings::ToUnsignedInt(row[7]);
}
bot_buffs[buff_count].hit_number = atoul(row[8]);
bot_buffs[buff_count].melee_rune = atoul(row[9]);
bot_buffs[buff_count].magic_rune = atoul(row[10]);
bot_buffs[buff_count].dot_rune = atoul(row[11]);
bot_buffs[buff_count].hit_number = Strings::ToUnsignedInt(row[8]);
bot_buffs[buff_count].melee_rune = Strings::ToUnsignedInt(row[9]);
bot_buffs[buff_count].magic_rune = Strings::ToUnsignedInt(row[10]);
bot_buffs[buff_count].dot_rune = Strings::ToUnsignedInt(row[11]);
bot_buffs[buff_count].persistant_buff = (Strings::ToBool(row[12])) != 0;
bot_buffs[buff_count].caston_x = Strings::ToInt(row[13]);
bot_buffs[buff_count].caston_y = Strings::ToInt(row[14]);
bot_buffs[buff_count].caston_z = Strings::ToInt(row[15]);
bot_buffs[buff_count].ExtraDIChance = Strings::ToInt(row[16]);
bot_buffs[buff_count].instrument_mod = atoul(row[17]);
bot_buffs[buff_count].instrument_mod = Strings::ToUnsignedInt(row[17]);
bot_buffs[buff_count].casterid = 0;
++buff_count;
}
@@ -839,7 +839,7 @@ bool BotDatabase::LoadStance(const uint32 bot_id, int& bot_stance)
return true;
auto row = results.begin();
bot_stance = atoi(row[0]);
bot_stance = Strings::ToInt(row[0]);
return true;
}
@@ -859,7 +859,7 @@ bool BotDatabase::LoadStance(Bot* bot_inst, bool& stance_flag)
return true;
auto row = results.begin();
bot_inst->SetBotStance((EQ::constants::StanceType)atoi(row[0]));
bot_inst->SetBotStance((EQ::constants::StanceType)Strings::ToInt(row[0]));
stance_flag = true;
return true;
@@ -952,9 +952,9 @@ bool BotDatabase::LoadTimers(Bot* bot_inst)
uint32 timer_value = 0;
uint32 max_value = 0;
for (auto row = results.begin(); row != results.end(); ++row) {
timer_id = atoi(row[0]) - 1;
timer_value = atoi(row[1]);
max_value = atoi(row[2]);
timer_id = Strings::ToInt(row[0]) - 1;
timer_value = Strings::ToInt(row[1]);
max_value = Strings::ToInt(row[2]);
if (timer_id >= 0 && timer_id < MaxTimer && timer_value < (Timer::GetCurrentTime() + max_value))
bot_timers[timer_id] = timer_value;
@@ -1020,7 +1020,7 @@ bool BotDatabase::QueryInventoryCount(const uint32 bot_id, uint32& item_count)
return true;
auto row = results.begin();
item_count = atoi(row[0]);
item_count = Strings::ToInt(row[0]);
return true;
}
@@ -1059,22 +1059,22 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQ::InventoryProfile& inventory
return true;
for (auto row = results.begin(); row != results.end(); ++row) {
int16 slot_id = atoi(row[0]);
int16 slot_id = Strings::ToInt(row[0]);
if (slot_id < EQ::invslot::EQUIPMENT_BEGIN || slot_id > EQ::invslot::EQUIPMENT_END)
continue;
uint32 item_id = atoi(row[1]);
uint16 item_charges = (uint16)atoi(row[2]);
uint32 item_id = Strings::ToInt(row[1]);
uint16 item_charges = (uint16)Strings::ToInt(row[2]);
EQ::ItemInstance* item_inst = database.CreateItem(
item_id,
item_charges,
(uint32)atoul(row[9]),
(uint32)atoul(row[10]),
(uint32)atoul(row[11]),
(uint32)atoul(row[12]),
(uint32)atoul(row[13]),
(uint32)atoul(row[14])
(uint32)Strings::ToUnsignedInt(row[9]),
(uint32)Strings::ToUnsignedInt(row[10]),
(uint32)Strings::ToUnsignedInt(row[11]),
(uint32)Strings::ToUnsignedInt(row[12]),
(uint32)Strings::ToUnsignedInt(row[13]),
(uint32)Strings::ToUnsignedInt(row[14])
);
if (!item_inst) {
LogError("Warning: bot_id [{}] has an invalid item_id [{}] in inventory slot [{}]", bot_id, item_id, slot_id);
@@ -1088,12 +1088,12 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQ::InventoryProfile& inventory
else
item_inst->SetCharges(item_charges);
uint32 item_color = atoul(row[3]);
uint32 item_color = Strings::ToUnsignedInt(row[3]);
if (item_color > 0)
item_inst->SetColor(item_color);
if (item_inst->GetItem()->Attuneable) {
if (atoi(row[4]))
if (Strings::ToInt(row[4]))
item_inst->SetAttuned(true);
else if (slot_id >= EQ::invslot::EQUIPMENT_BEGIN && slot_id <= EQ::invslot::EQUIPMENT_END)
item_inst->SetAttuned(true);
@@ -1125,9 +1125,9 @@ bool BotDatabase::LoadItems(const uint32 bot_id, EQ::InventoryProfile& inventory
}
}
item_inst->SetOrnamentIcon((uint32)atoul(row[6]));
item_inst->SetOrnamentationIDFile((uint32)atoul(row[7]));
item_inst->SetOrnamentHeroModel((uint32)atoul(row[8]));
item_inst->SetOrnamentIcon((uint32)Strings::ToUnsignedInt(row[6]));
item_inst->SetOrnamentationIDFile((uint32)Strings::ToUnsignedInt(row[7]));
item_inst->SetOrnamentHeroModel((uint32)Strings::ToUnsignedInt(row[8]));
if (inventory_inst.PutItem(slot_id, *item_inst) == INVALID_INDEX)
LogError("Warning: Invalid slot_id for item in inventory: bot_id = [{}], item_id = [{}], slot_id = [{}]", bot_id, item_id, slot_id);
@@ -1174,7 +1174,7 @@ bool BotDatabase::LoadItemBySlot(const uint32 bot_id, const uint32 slot_id, uint
return true;
auto row = results.begin();
item_id = atoi(row[0]);
item_id = Strings::ToInt(row[0]);
return true;
}
@@ -1315,7 +1315,7 @@ bool BotDatabase::LoadEquipmentColor(const uint32 bot_id, const uint8 material_s
return true;
auto row = results.begin();
rgb = atoul(row[0]);
rgb = Strings::ToUnsignedInt(row[0]);
return true;
}
@@ -1366,7 +1366,7 @@ bool BotDatabase::LoadPetIndex(const uint32 bot_id, uint32& pet_index)
return true;
auto row = results.begin();
pet_index = atoi(row[0]);
pet_index = Strings::ToInt(row[0]);
return true;
}
@@ -1384,7 +1384,7 @@ bool BotDatabase::LoadPetSpellID(const uint32 bot_id, uint32& pet_spell_id)
return true;
auto row = results.begin();
pet_spell_id = atoi(row[0]);
pet_spell_id = Strings::ToInt(row[0]);
return true;
}
@@ -1408,10 +1408,10 @@ bool BotDatabase::LoadPetStats(const uint32 bot_id, std::string& pet_name, uint3
return true;
auto row = results.begin();
pet_spell_id = atoi(row[0]);
pet_spell_id = Strings::ToInt(row[0]);
pet_name = row[1];
pet_mana = atoi(row[2]);
pet_hp = atoi(row[3]);
pet_mana = Strings::ToInt(row[2]);
pet_hp = Strings::ToInt(row[3]);
return true;
}
@@ -1497,9 +1497,9 @@ bool BotDatabase::LoadPetBuffs(const uint32 bot_id, SpellBuff_Struct* pet_buffs)
int buff_index = 0;
for (auto row = results.begin(); row != results.end() && buff_index < PET_BUFF_COUNT; ++row) {
pet_buffs[buff_index].spellid = atoi(row[0]);
pet_buffs[buff_index].level = atoi(row[1]);
pet_buffs[buff_index].duration = atoi(row[2]);
pet_buffs[buff_index].spellid = Strings::ToInt(row[0]);
pet_buffs[buff_index].level = Strings::ToInt(row[1]);
pet_buffs[buff_index].duration = Strings::ToInt(row[2]);
// Work around for loading the counters and setting them back to max. Need entry in DB for saved counters
if (CalculatePoisonCounters(pet_buffs[buff_index].spellid) > 0)
@@ -1605,7 +1605,7 @@ bool BotDatabase::LoadPetItems(const uint32 bot_id, uint32* pet_items)
int item_index = EQ::invslot::EQUIPMENT_BEGIN;
for (auto row = results.begin(); row != results.end() && (item_index >= EQ::invslot::EQUIPMENT_BEGIN && item_index <= EQ::invslot::EQUIPMENT_END); ++row) {
pet_items[item_index] = atoi(row[0]);
pet_items[item_index] = Strings::ToInt(row[0]);
++item_index;
}
@@ -2145,7 +2145,7 @@ bool BotDatabase::LoadOwnerOptions(Client *owner)
for (auto row : results) {
owner->SetBotOption(static_cast<Client::BotOwnerOption>(atoul(row[0])), (atoul(row[1]) != 0));
owner->SetBotOption(static_cast<Client::BotOwnerOption>(Strings::ToUnsignedInt(row[0])), (Strings::ToUnsignedInt(row[1]) != 0));
}
return true;
@@ -2267,7 +2267,7 @@ bool BotDatabase::LoadBotGroupIDByBotGroupName(const std::string& group_name, ui
}
auto row = results.begin();
botgroup_id = std::stoul(row[0]);
botgroup_id = Strings::ToUnsignedInt(row[0]);
return true;
}
@@ -2293,7 +2293,7 @@ bool BotDatabase::LoadBotGroupIDByLeaderID(const uint32 leader_id, uint32& botgr
}
auto row = results.begin();
botgroup_id = std::stoul(row[0]);
botgroup_id = Strings::ToUnsignedInt(row[0]);
return true;
}
@@ -2319,7 +2319,7 @@ bool BotDatabase::LoadBotGroupIDByMemberID(const uint32 member_id, uint32& botgr
}
auto row = results.begin();
botgroup_id = std::stoul(row[0]);
botgroup_id = Strings::ToUnsignedInt(row[0]);
return true;
}
@@ -2345,7 +2345,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupName(const std::string& group_name, uint
}
auto row = results.begin();
leader_id = std::stoul(row[0]);
leader_id = Strings::ToUnsignedInt(row[0]);
return true;
}
@@ -2371,7 +2371,7 @@ bool BotDatabase::LoadLeaderIDByBotGroupID(const uint32 group_id, uint32& leader
}
auto row = results.begin();
leader_id = std::stoul(row[0]);
leader_id = Strings::ToUnsignedInt(row[0]);
return true;
}
@@ -2593,7 +2593,7 @@ bool BotDatabase::LoadBotGroupIDForLoadBotGroup(const uint32 owner_id, std::stri
for (auto row : results) {
if (!group_name.compare(row[1])) {
botgroup_id = std::stoul(row[0]);
botgroup_id = Strings::ToUnsignedInt(row[0]);
break;
}
}
@@ -2631,7 +2631,7 @@ bool BotDatabase::LoadBotGroup(const std::string& group_name, std::map<uint32, s
}
for (auto row : results) {
member_list[botgroup_id].push_back(std::stoul(row[0]));
member_list[botgroup_id].push_back(Strings::ToUnsignedInt(row[0]));
}
return true;
@@ -2663,7 +2663,7 @@ bool BotDatabase::LoadBotGroupsListByOwnerID(const uint32 owner_id, std::list<st
}
for (auto row : results) {
botgroups_list.push_back(std::pair<std::string, uint32>(row[0], atoul(row[1])));
botgroups_list.push_back(std::pair<std::string, uint32>(row[0], Strings::ToUnsignedInt(row[1])));
}
return true;
@@ -2735,7 +2735,7 @@ bool BotDatabase::LoadAutoSpawnBotGroupsByOwnerID(const uint32 owner_id, std::li
for (auto row : results) {
group_list.push_back(
std::pair<uint32,std::string>(std::stoul(row[0]), row[1])
std::pair<uint32,std::string>(Strings::ToUnsignedInt(row[0]), row[1])
);
}
@@ -2767,7 +2767,7 @@ bool BotDatabase::LoadGroupedBotsByGroupID(const uint32 owner_id, const uint32 g
}
for (auto row : results) {
group_list.push_back(std::stoul(row[0]));
group_list.push_back(Strings::ToUnsignedInt(row[0]));
}
return true;
@@ -2788,7 +2788,7 @@ bool BotDatabase::LoadHealRotationIDByBotID(const uint32 bot_id, uint32& hr_inde
return true;
auto row = results.begin();
hr_index = atoi(row[0]);
hr_index = Strings::ToInt(row[0]);
return true;
}
@@ -2835,20 +2835,20 @@ bool BotDatabase::LoadHealRotation(Bot* hr_member, std::list<uint32>& member_lis
return true;
auto row = results.begin();
(*hr_member->MemberOfHealRotation())->SetIntervalS((uint32)atoi(row[0]));
(*hr_member->MemberOfHealRotation())->SetFastHeals((bool)atoi(row[1]));
(*hr_member->MemberOfHealRotation())->SetAdaptiveTargeting((bool)atoi(row[2]));
(*hr_member->MemberOfHealRotation())->SetCastingOverride((bool)atoi(row[3]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_UNKNOWN, atof(row[4]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CLOTH, atof(row[5]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_LEATHER, atof(row[6]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CHAIN, atof(row[7]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_PLATE, atof(row[8]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_UNKNOWN, atof(row[9]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CLOTH, atof(row[10]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_LEATHER, atof(row[11]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CHAIN, atof(row[12]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_PLATE, atof(row[13]));
(*hr_member->MemberOfHealRotation())->SetIntervalS((uint32)Strings::ToInt(row[0]));
(*hr_member->MemberOfHealRotation())->SetFastHeals((bool)Strings::ToInt(row[1]));
(*hr_member->MemberOfHealRotation())->SetAdaptiveTargeting((bool)Strings::ToInt(row[2]));
(*hr_member->MemberOfHealRotation())->SetCastingOverride((bool)Strings::ToInt(row[3]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_UNKNOWN, Strings::ToFloat(row[4]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CLOTH, Strings::ToFloat(row[5]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_LEATHER, Strings::ToFloat(row[6]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_CHAIN, Strings::ToFloat(row[7]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeSafeHPRatio(ARMOR_TYPE_PLATE, Strings::ToFloat(row[8]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_UNKNOWN, Strings::ToFloat(row[9]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CLOTH, Strings::ToFloat(row[10]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_LEATHER, Strings::ToFloat(row[11]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_CHAIN, Strings::ToFloat(row[12]));
(*hr_member->MemberOfHealRotation())->SetArmorTypeCriticalHPRatio(ARMOR_TYPE_PLATE, Strings::ToFloat(row[13]));
load_flag = true;
@@ -2875,7 +2875,7 @@ bool BotDatabase::LoadHealRotationMembers(const uint32 hr_index, std::list<uint3
for (auto row : results) {
if (row[0])
member_list.push_back(atoi(row[0]));
member_list.push_back(Strings::ToInt(row[0]));
}
return true;
@@ -3045,7 +3045,7 @@ bool BotDatabase::DeleteAllHealRotations(const uint32 owner_id)
if (!row[0])
continue;
DeleteHealRotation(atoi(row[0]));
DeleteHealRotation(Strings::ToInt(row[0]));
}
return true;
@@ -3077,7 +3077,7 @@ uint16 BotDatabase::GetRaceClassBitmask(uint16 bot_race)
uint16 classes = 0;
if (results.RowCount() == 1) {
auto row = results.begin();
classes = atoi(row[0]);
classes = Strings::ToInt(row[0]);
}
return classes;
}
+8 -8
View File
@@ -4012,7 +4012,7 @@ void Client::KeyRingLoad()
}
for (auto row = results.begin(); row != results.end(); ++row)
keyring.push_back(atoi(row[0]));
keyring.push_back(Strings::ToInt(row[0]));
}
@@ -5221,8 +5221,8 @@ void Client::SendRewards()
for (auto row = results.begin(); row != results.end(); ++row) {
ClientReward cr;
cr.id = atoi(row[0]);
cr.amount = atoi(row[1]);
cr.id = Strings::ToInt(row[0]);
cr.amount = Strings::ToInt(row[1]);
rewards.push_back(cr);
}
@@ -5290,7 +5290,7 @@ bool Client::TryReward(uint32 claim_id)
auto row = results.begin();
uint32 amt = atoi(row[0]);
uint32 amt = Strings::ToInt(row[0]);
if (amt == 0)
return false;
@@ -8483,7 +8483,7 @@ void Client::ExpeditionSay(const char *str, int ExpID) {
).c_str()
);
}
// ChannelList->CreateChannel(ChannelName, ChannelOwner, ChannelPassword, true, atoi(row[3]));
// ChannelList->CreateChannel(ChannelName, ChannelOwner, ChannelPassword, true, Strings::ToInt(row[3]));
}
@@ -9324,8 +9324,8 @@ void Client::SendToGuildHall()
uint16 instance_id = 0;
std::string guild_hall_instance_key = fmt::format("guild-hall-instance-{}", GuildID());
std::string instance_data = DataBucket::GetData(guild_hall_instance_key);
if (!instance_data.empty() && std::stoi(instance_data) > 0) {
instance_id = std::stoi(instance_data);
if (!instance_data.empty() && Strings::ToInt(instance_data) > 0) {
instance_id = Strings::ToInt(instance_data);
}
if (instance_id <= 0) {
@@ -10456,7 +10456,7 @@ void Client::SendToInstance(std::string instance_type, std::string zone_short_na
uint16 instance_id = 0;
if (current_bucket_value.length() > 0) {
instance_id = atoi(current_bucket_value.c_str());
instance_id = Strings::ToInt(current_bucket_value.c_str());
} else {
if(!database.GetUnusedInstanceID(instance_id)) {
Message(Chat::White, "Server was unable to find a free instance id.");
+4 -4
View File
@@ -33,7 +33,7 @@ uint32 Client::GetBotCreationLimit(uint8 class_id)
auto bucket_value = GetBucket(bucket_name);
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
bot_creation_limit = std::stoul(bucket_value);
bot_creation_limit = Strings::ToUnsignedInt(bucket_value);
}
return bot_creation_limit;
@@ -57,7 +57,7 @@ int Client::GetBotRequiredLevel(uint8 class_id)
auto bucket_value = GetBucket(bucket_name);
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
bot_character_level = std::stoi(bucket_value);
bot_character_level = Strings::ToInt(bucket_value);
}
return bot_character_level;
@@ -81,7 +81,7 @@ int Client::GetBotSpawnLimit(uint8 class_id)
auto bucket_value = GetBucket(bucket_name);
if (!bucket_value.empty() && Strings::IsNumber(bucket_value)) {
bot_spawn_limit = std::stoi(bucket_value);
bot_spawn_limit = Strings::ToInt(bucket_value);
return bot_spawn_limit;
}
@@ -98,7 +98,7 @@ int Client::GetBotSpawnLimit(uint8 class_id)
}
auto row = results.begin();
bot_spawn_limit = std::stoi(row[0]);
bot_spawn_limit = Strings::ToInt(row[0]);
}
return bot_spawn_limit;
+24 -24
View File
@@ -1238,17 +1238,17 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
);
auto results = database.QueryDatabase(query);
for (auto row : results) {
if (row[4] && atoi(row[4]) > 0) {
guild_id = atoi(row[4]);
guildrank = row[5] ? atoi(row[5]) : GUILD_RANK_NONE;
if (row[4] && Strings::ToInt(row[4]) > 0) {
guild_id = Strings::ToInt(row[4]);
guildrank = row[5] ? Strings::ToInt(row[5]) : GUILD_RANK_NONE;
}
SetEXPEnabled(atobool(row[6]));
if (LFP) { LFP = atoi(row[0]); }
if (LFG) { LFG = atoi(row[1]); }
if (LFP) { LFP = Strings::ToInt(row[0]); }
if (LFG) { LFG = Strings::ToInt(row[1]); }
if (row[3])
firstlogon = atoi(row[3]);
firstlogon = Strings::ToInt(row[3]);
}
if (RuleB(Character, SharedBankPlat))
@@ -6747,15 +6747,15 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
strn0cpy(charName, row[0], sizeof(charName));
uint32 ZoneID = atoi(row[1]);
float CorpseX = atof(row[2]);
float CorpseY = atof(row[3]);
float CorpseZ = atof(row[4]);
uint32 ZoneID = Strings::ToInt(row[1]);
float CorpseX = Strings::ToFloat(row[2]);
float CorpseY = Strings::ToFloat(row[3]);
float CorpseZ = Strings::ToFloat(row[4]);
strn0cpy(time_of_death, row[5], sizeof(time_of_death));
bool corpseRezzed = atoi(row[6]);
bool corpseBuried = atoi(row[7]);
bool corpseRezzed = Strings::ToInt(row[6]);
bool corpseBuried = Strings::ToInt(row[7]);
popupText += StringFormat("<tr><td>%s</td><td>%s</td><td>%8.0f</td><td>%8.0f</td><td>%8.0f</td><td>%s</td><td>%s</td><td>%s</td></tr>",
charName, StaticGetZoneName(ZoneID), CorpseX, CorpseY, CorpseZ, time_of_death,
@@ -11436,8 +11436,8 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app)
std::string response;
switch (popup_response->popupid) {
case POPUPID_REPLACE_SPELLWINDOW:
DeleteItemInInventory(std::stoi(GetEntityVariable("slot_id")), 1, true);
MemorizeSpellFromItem(std::stoi(GetEntityVariable("spell_id")));
DeleteItemInInventory(Strings::ToInt(GetEntityVariable("slot_id")), 1, true);
MemorizeSpellFromItem(Strings::ToInt(GetEntityVariable("spell_id")));
return;
break;
@@ -13158,19 +13158,19 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
bool valid_city = false;
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[1]) != 0)
zone_id = atoi(row[1]);
if (Strings::ToInt(row[1]) != 0)
zone_id = Strings::ToInt(row[1]);
else
zone_id = atoi(row[0]);
zone_id = Strings::ToInt(row[0]);
if (zone_id != start_city)
continue;
valid_city = true;
x = atof(row[2]);
y = atof(row[3]);
z = atof(row[4]);
heading = atof(row[5]);
x = Strings::ToFloat(row[2]);
y = Strings::ToFloat(row[3]);
z = Strings::ToFloat(row[4]);
heading = Strings::ToFloat(row[5]);
}
if (valid_city) {
@@ -13203,10 +13203,10 @@ void Client::Handle_OP_SetStartCity(const EQApplicationPacket *app)
Message(Chat::Yellow, "Use \"/setstartcity #\" to choose a home city from the following list:");
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[1]) != 0)
zone_id = atoi(row[1]);
if (Strings::ToInt(row[1]) != 0)
zone_id = Strings::ToInt(row[1]);
else
zone_id = atoi(row[0]);
zone_id = Strings::ToInt(row[0]);
std::string zone_long_name = ZoneLongName(zone_id);
Message(Chat::Yellow, "%d - %s", zone_id, zone_long_name.c_str());
+2 -2
View File
@@ -23,7 +23,7 @@ void DataBucket::SetData(std::string bucket_key, std::string bucket_value, std::
if (isalpha(expires_time[0]) || isalpha(expires_time[expires_time.length() - 1])) {
expires_time_unix = (long long) std::time(nullptr) + Strings::TimeToSeconds(expires_time);
} else {
expires_time_unix = (long long) std::time(nullptr) + atoi(expires_time.c_str());
expires_time_unix = (long long) std::time(nullptr) + Strings::ToInt(expires_time.c_str());
}
}
@@ -146,7 +146,7 @@ uint64 DataBucket::DoesBucketExist(std::string bucket_key) {
if (results.RowCount() != 1)
return 0;
return std::stoull(row[0]);
return Strings::ToUnsignedBigInt(row[0]);
}
/**
+6 -5
View File
@@ -1,6 +1,7 @@
#include <regex>
#include "dialogue_window.h"
#include "../common/strings.h"
void DialogueWindow::Render(Client *c, std::string markdown)
{
@@ -74,7 +75,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
bool found_animation = false;
if (Strings::IsNumber(animation)) {
LogDiaWindDetail("Client [{}] Animation is a number, firing animation [{}]", c->GetCleanName(), animation);
target->DoAnim(std::stoi(animation));
target->DoAnim(Strings::ToInt(animation));
found_animation = true;
}
else {
@@ -126,7 +127,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
c->GetCleanName(),
expire_time
);
window_expire_seconds = std::stoi(expire_time);
window_expire_seconds = Strings::ToInt(expire_time);
}
}
@@ -198,7 +199,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
// set the popup id
if (!popupid.empty()) {
popup_id = (Strings::IsNumber(popupid) ? std::atoi(popupid.c_str()) : 0);
popup_id = (Strings::IsNumber(popupid) ? Strings::ToInt(popupid.c_str()) : 0);
}
}
}
@@ -230,7 +231,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
Strings::FindReplace(output, fmt::format("secondresponseid:{}", secondresponseid), "");
if (!secondresponseid.empty()) {
negative_id = (Strings::IsNumber(secondresponseid) ? std::atoi(secondresponseid.c_str()) : 0);
negative_id = (Strings::IsNumber(secondresponseid) ? Strings::ToInt(secondresponseid.c_str()) : 0);
}
}
}
@@ -409,7 +410,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
// click response
// window type response
uint32 window_type = (Strings::IsNumber(wintype) ? std::atoi(wintype.c_str()) : 0);
uint32 window_type = (Strings::IsNumber(wintype) ? Strings::ToInt(wintype.c_str()) : 0);
std::string click_response_button = (window_type == 1 ? "Yes" : "OK");
std::string click_response = fmt::format(
"<c \"#F07F00\">Click [{}] to continue...</c>",
+2 -2
View File
@@ -276,7 +276,7 @@ void Doors::HandleClick(Client *sender, uint8 trigger)
// enforce flags before they hit zoning process
auto z = GetZone(m_destination_zone_name, 0);
if (z && !z->flag_needed.empty() && Strings::IsNumber(z->flag_needed) && std::stoi(z->flag_needed) == 1) {
if (z && !z->flag_needed.empty() && Strings::IsNumber(z->flag_needed) && Strings::ToInt(z->flag_needed) == 1) {
if (sender->Admin() < minStatusToIgnoreZoneFlags && !sender->HasZoneFlag(z->zoneidnumber)) {
LogInfo(
"Character [{}] does not have the flag to be in this zone [{}]!",
@@ -727,7 +727,7 @@ int ZoneDatabase::GetDoorsDBCountPlusOne(std::string zone_short_name, int16 vers
return 0;
}
return std::stoi(row[0]) + 1;
return Strings::ToInt(row[0]) + 1;
}
std::vector<DoorsRepository::Doors> ZoneDatabase::LoadDoors(const std::string &zone_name, int16 version)
+3 -3
View File
@@ -1952,7 +1952,7 @@ void PerlembParser::ExportEventVariables(
}
case EVENT_CONSIDER: {
ExportVar(package_name.c_str(), "entity_id", std::stoi(data));
ExportVar(package_name.c_str(), "entity_id", Strings::ToInt(data));
if (extra_pointers && extra_pointers->size() == 1) {
ExportVar(package_name.c_str(), "target", "Mob", std::any_cast<Mob*>(extra_pointers->at(0)));
}
@@ -1960,7 +1960,7 @@ void PerlembParser::ExportEventVariables(
}
case EVENT_CONSIDER_CORPSE: {
ExportVar(package_name.c_str(), "corpse_entity_id", std::stoi(data));
ExportVar(package_name.c_str(), "corpse_entity_id", Strings::ToInt(data));
if (extra_pointers && extra_pointers->size() == 1) {
ExportVar(package_name.c_str(), "corpse", "Corpse", std::any_cast<Corpse*>(extra_pointers->at(0)));
}
@@ -1968,7 +1968,7 @@ void PerlembParser::ExportEventVariables(
}
case EVENT_COMBINE: {
ExportVar(package_name.c_str(), "container_slot", std::stoi(data));
ExportVar(package_name.c_str(), "container_slot", Strings::ToInt(data));
break;
}
+2 -2
View File
@@ -3261,7 +3261,7 @@ char *EntityList::MakeNameUnique(char *name)
if (it->second->IsMob()) {
if (strncasecmp(it->second->CastToMob()->GetName(), name, len) == 0) {
if (Seperator::IsNumber(&it->second->CastToMob()->GetName()[len])) {
used[atoi(&it->second->CastToMob()->GetName()[len])] = true;
used[Strings::ToInt(&it->second->CastToMob()->GetName()[len])] = true;
}
}
}
@@ -5906,7 +5906,7 @@ void EntityList::DespawnGridNodes(int32 grid_id) {
mob->IsNPC() &&
mob->GetRace() == RACE_NODE_2254 &&
mob->EntityVariableExists("grid_id") &&
std::stoi(mob->GetEntityVariable("grid_id")) == grid_id)
Strings::ToInt(mob->GetEntityVariable("grid_id")) == grid_id)
{
mob->Depop();
}
+3 -3
View File
@@ -1263,7 +1263,7 @@ uint8 Client::GetCharMaxLevelFromQGlobal() {
for (const auto& global : global_map) {
if (global.name == "CharMaxLevel") {
if (Strings::IsNumber(global.value)) {
return static_cast<uint8>(std::stoul(global.value));
return static_cast<uint8>(Strings::ToUnsignedInt(global.value));
}
}
}
@@ -1281,7 +1281,7 @@ uint8 Client::GetCharMaxLevelFromBucket()
auto bucket_value = DataBucket::GetData(new_bucket_name);
if (!bucket_value.empty()) {
if (Strings::IsNumber(bucket_value)) {
return static_cast<uint8>(std::stoul(bucket_value));
return static_cast<uint8>(Strings::ToUnsignedInt(bucket_value));
}
}
@@ -1293,7 +1293,7 @@ uint8 Client::GetCharMaxLevelFromBucket()
bucket_value = DataBucket::GetData(old_bucket_name);
if (!bucket_value.empty()) {
if (Strings::IsNumber(bucket_value)) {
return static_cast<uint8>(std::stoul(bucket_value));
return static_cast<uint8>(Strings::ToUnsignedInt(bucket_value));
}
}
+7 -7
View File
@@ -90,9 +90,9 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
break;
}
item[index] = atoi(row[0]);
chance[index] = atoi(row[1]) + chancepool;
chancepool = chance[index];
item[index] = Strings::ToInt(row[0]);
chance[index] = Strings::ToInt(row[1]) + chancepool;
chancepool = chance[index];
}
if(chancepool == 0 || index < 1)
@@ -158,12 +158,12 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
if (index >= 50)
break;
item[index] = atoi(row[0]);
chance[index] = atoi(row[1])+chancepool;
item[index] = Strings::ToInt(row[0]);
chance[index] = Strings::ToInt(row[1])+chancepool;
chancepool = chance[index];
npc_ids[index] = atoi(row[2]);
npc_chances[index] = atoi(row[3]);
npc_ids[index] = Strings::ToInt(row[2]);
npc_chances[index] = Strings::ToInt(row[3]);
}
npc_id = 0;
+26 -26
View File
@@ -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 = {}",
+1 -1
View File
@@ -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
View File
@@ -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);
+1 -1
View File
@@ -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",
+2 -2
View File
@@ -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,
+4 -4
View File
@@ -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) {
+2 -2
View File
@@ -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;
+3 -3
View File
@@ -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) {
+1 -1
View File
@@ -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.");
+9 -9
View File
@@ -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
) :
+2 -2
View File
@@ -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,
+1 -1
View File
@@ -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);
}
+2 -2
View File
@@ -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];
+5 -5
View File
@@ -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,
+5 -5
View File
@@ -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,
+1 -1
View File
@@ -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(
+3 -3
View File
@@ -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]));
}
+1 -1
View File
@@ -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(
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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 = (
+10 -9
View File
@@ -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()));
}
}
+5 -5
View File
@@ -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)) {
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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, "^")) {
+3 -3
View File
@@ -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()) {
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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,
+1 -1
View File
@@ -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]));
}
+15 -15
View File
@@ -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;
}
+1 -1
View File
@@ -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(
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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(
+1 -1
View File
@@ -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(
+1 -1
View File
@@ -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 &&
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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 = (
+2 -2
View File
@@ -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);
+4 -4
View File
@@ -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();
+5 -5
View File
@@ -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));
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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) {
+3 -3
View File
@@ -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(
+1 -1
View File
@@ -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");
+8 -8
View File
@@ -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(
+4 -4
View File
@@ -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;
+3 -3
View File
@@ -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(
+4 -4
View File
@@ -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 {
+6 -6
View File
@@ -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
View File
@@ -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);
+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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.");
+6 -6
View File
@@ -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.");
+2 -2
View File
@@ -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);
+4 -4
View File
@@ -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(
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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)) {
+3 -3
View File
@@ -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;
+4 -4
View File
@@ -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;
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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;
+5 -5
View File
@@ -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
);
}
+14 -14
View File
@@ -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 {
+3 -3
View File
@@ -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(
+99 -99
View File
@@ -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 {}.",
+13 -13
View File
@@ -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);
+1 -1
View File
@@ -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 ?
+2 -2
View File
@@ -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);
}
+4 -4
View File
@@ -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;
+2 -2
View File
@@ -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
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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),
+2 -2
View File
@@ -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),
+2 -2
View File
@@ -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),
+1 -1
View File
@@ -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.");
+2 -2
View File
@@ -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(
+1 -1
View File
@@ -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();
+6 -6
View File
@@ -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
);

Some files were not shown because too many files have changed in this diff Show More