mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Cleanup] Cleanup excessive type casting: string -> char * -> string (#3169)
* [Cleanup] Cleanup excessive type casting: string -> char * -> string * [Cleanup] Cleanup excessive type casting: string -> char * -> string
This commit is contained in:
parent
0df84e1ee6
commit
31ede355a8
@ -2345,7 +2345,7 @@ void Database::SourceDatabaseTableFromUrl(std::string table_name, std::string ur
|
|||||||
|
|
||||||
int sourced_queries = 0;
|
int sourced_queries = 0;
|
||||||
|
|
||||||
if (auto res = cli.Get(request_uri.get_path().c_str())) {
|
if (auto res = cli.Get(request_uri.get_path())) {
|
||||||
if (res->status == 200) {
|
if (res->status == 200) {
|
||||||
for (auto &s: Strings::Split(res->body, ';')) {
|
for (auto &s: Strings::Split(res->body, ';')) {
|
||||||
if (!Strings::Trim(s).empty()) {
|
if (!Strings::Trim(s).empty()) {
|
||||||
|
|||||||
@ -6690,7 +6690,7 @@ static WSInit wsinit_;
|
|||||||
if (params.empty()) { return Get(path, headers); }
|
if (params.empty()) { return Get(path, headers); }
|
||||||
|
|
||||||
std::string path_with_query = append_query_params(path, params);
|
std::string path_with_query = append_query_params(path, params);
|
||||||
return Get(path_with_query.c_str(), headers, progress);
|
return Get(path_with_query, headers, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Get(const std::string &path, const Params ¶ms,
|
inline Result ClientImpl::Get(const std::string &path, const Params ¶ms,
|
||||||
@ -6710,7 +6710,7 @@ static WSInit wsinit_;
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string path_with_query = append_query_params(path, params);
|
std::string path_with_query = append_query_params(path, params);
|
||||||
return Get(path_with_query.c_str(), headers, response_handler,
|
return Get(path_with_query, headers, response_handler,
|
||||||
content_receiver, progress);
|
content_receiver, progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6807,7 +6807,7 @@ static WSInit wsinit_;
|
|||||||
std::string content_type;
|
std::string content_type;
|
||||||
const auto &body = detail::serialize_multipart_formdata(
|
const auto &body = detail::serialize_multipart_formdata(
|
||||||
items, detail::make_multipart_data_boundary(), content_type);
|
items, detail::make_multipart_data_boundary(), content_type);
|
||||||
return Post(path, headers, body, content_type.c_str());
|
return Post(path, headers, body, content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
||||||
@ -6820,7 +6820,7 @@ static WSInit wsinit_;
|
|||||||
std::string content_type;
|
std::string content_type;
|
||||||
const auto &body =
|
const auto &body =
|
||||||
detail::serialize_multipart_formdata(items, boundary, content_type);
|
detail::serialize_multipart_formdata(items, boundary, content_type);
|
||||||
return Post(path, headers, body, content_type.c_str());
|
return Post(path, headers, body, content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Put(const std::string &path) {
|
inline Result ClientImpl::Put(const std::string &path) {
|
||||||
|
|||||||
@ -151,7 +151,7 @@ static char *temp=nullptr;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
uint32 id = Strings::ToUnsignedInt(field[id_pos].c_str());
|
uint32 id = Strings::ToUnsignedInt(field[id_pos]);
|
||||||
items[id]=field;
|
items[id]=field;
|
||||||
|
|
||||||
for(i=0;i<10;i++) {
|
for(i=0;i<10;i++) {
|
||||||
|
|||||||
@ -141,11 +141,11 @@ bool RuleManager::SetRule(const std::string &rule_name, const std::string &rule_
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IntRule:
|
case IntRule:
|
||||||
m_RuleIntValues[index] = Strings::ToInt(rule_value.c_str());
|
m_RuleIntValues[index] = Strings::ToInt(rule_value);
|
||||||
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleIntValues[index]);
|
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleIntValues[index]);
|
||||||
break;
|
break;
|
||||||
case RealRule:
|
case RealRule:
|
||||||
m_RuleRealValues[index] = Strings::ToFloat(rule_value.c_str());
|
m_RuleRealValues[index] = Strings::ToFloat(rule_value);
|
||||||
LogRules("Set rule [{}] to value [{:.2f}]", rule_name, m_RuleRealValues[index]);
|
LogRules("Set rule [{}] to value [{:.2f}]", rule_name, m_RuleRealValues[index]);
|
||||||
break;
|
break;
|
||||||
case BoolRule:
|
case BoolRule:
|
||||||
|
|||||||
@ -659,7 +659,7 @@ ChatChannel *ChatChannelList::RemoveClientFromChannel(const std::string& in_chan
|
|||||||
std::string channel_name = in_channel_name;
|
std::string channel_name = in_channel_name;
|
||||||
|
|
||||||
if (in_channel_name.length() > 0 && isdigit(channel_name[0])) {
|
if (in_channel_name.length() > 0 && isdigit(channel_name[0])) {
|
||||||
channel_name = c->ChannelSlotName(Strings::ToInt(in_channel_name.c_str()));
|
channel_name = c->ChannelSlotName(Strings::ToInt(in_channel_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *required_channel = FindChannel(channel_name);
|
auto *required_channel = FindChannel(channel_name);
|
||||||
|
|||||||
@ -379,14 +379,14 @@ static void ProcessSetMessageStatus(std::string SetMessageCommand) {
|
|||||||
|
|
||||||
if (NumEnd == std::string::npos) {
|
if (NumEnd == std::string::npos) {
|
||||||
|
|
||||||
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart).c_str());
|
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart));
|
||||||
|
|
||||||
database.SetMessageStatus(MessageNumber, Status);
|
database.SetMessageStatus(MessageNumber, Status);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart, NumEnd - NumStart).c_str());
|
MessageNumber = Strings::ToInt(SetMessageCommand.substr(NumStart, NumEnd - NumStart));
|
||||||
|
|
||||||
database.SetMessageStatus(MessageNumber, Status);
|
database.SetMessageStatus(MessageNumber, Status);
|
||||||
|
|
||||||
@ -878,7 +878,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CommandGetBody:
|
case CommandGetBody:
|
||||||
database.SendBody(c, Strings::ToInt(parameters.c_str()));
|
database.SendBody(c, Strings::ToInt(parameters));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CommandMailTo:
|
case CommandMailTo:
|
||||||
@ -893,7 +893,7 @@ void Clientlist::ProcessOPMailCommand(Client *c, std::string command_string, boo
|
|||||||
case CommandSelectMailBox:
|
case CommandSelectMailBox:
|
||||||
{
|
{
|
||||||
std::string::size_type NumStart = parameters.find_first_of("0123456789");
|
std::string::size_type NumStart = parameters.find_first_of("0123456789");
|
||||||
c->ChangeMailBox(Strings::ToInt(parameters.substr(NumStart).c_str()));
|
c->ChangeMailBox(Strings::ToInt(parameters.substr(NumStart)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CommandSetMailForwarding:
|
case CommandSetMailForwarding:
|
||||||
@ -1255,7 +1255,7 @@ void Client::ProcessChannelList(std::string Input) {
|
|||||||
std::string ChannelName = Input;
|
std::string ChannelName = Input;
|
||||||
|
|
||||||
if (isdigit(ChannelName[0]))
|
if (isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@ -1416,7 +1416,7 @@ void Client::SendChannelMessageByNumber(std::string Message) {
|
|||||||
if (MessageStart == std::string::npos)
|
if (MessageStart == std::string::npos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int ChannelNumber = Strings::ToInt(Message.substr(0, MessageStart).c_str());
|
int ChannelNumber = Strings::ToInt(Message.substr(0, MessageStart));
|
||||||
|
|
||||||
if ((ChannelNumber < 1) || (ChannelNumber > MAX_JOINED_CHANNELS)) {
|
if ((ChannelNumber < 1) || (ChannelNumber > MAX_JOINED_CHANNELS)) {
|
||||||
|
|
||||||
@ -1659,7 +1659,7 @@ void Client::SetChannelPassword(std::string ChannelPassword) {
|
|||||||
std::string ChannelName = ChannelPassword.substr(ChannelStart);
|
std::string ChannelName = ChannelPassword.substr(ChannelStart);
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
std::string Message;
|
std::string Message;
|
||||||
|
|
||||||
@ -1724,7 +1724,7 @@ void Client::SetChannelOwner(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str());
|
LogInfo("Set owner of channel [[{}]] to [[{}]]", ChannelName.c_str(), NewOwner.c_str());
|
||||||
|
|
||||||
@ -1770,7 +1770,7 @@ void Client::OPList(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@ -1813,7 +1813,7 @@ void Client::ChannelInvite(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] invites [[{}]] to channel [[{}]]", GetName().c_str(), Invitee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
@ -1883,7 +1883,7 @@ void Client::ChannelModerate(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
ChatChannel *RequiredChannel = ChannelList->FindChannel(ChannelName);
|
||||||
|
|
||||||
@ -1941,7 +1941,7 @@ void Client::ChannelGrantModerator(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] gives [[{}]] moderator rights to channel [[{}]]", GetName().c_str(), Moderator.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
@ -2022,7 +2022,7 @@ void Client::ChannelGrantVoice(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] gives [[{}]] voice to channel [[{}]]", GetName().c_str(), Voicee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
@ -2110,7 +2110,7 @@ void Client::ChannelKick(std::string CommandString) {
|
|||||||
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
std::string ChannelName = CapitaliseName(CommandString.substr(ChannelStart));
|
||||||
|
|
||||||
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
if ((ChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||||
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName.c_str()));
|
ChannelName = ChannelSlotName(Strings::ToInt(ChannelName));
|
||||||
|
|
||||||
LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
|
LogInfo("[[{}]] kicks [[{}]] from channel [[{}]]", GetName().c_str(), Kickee.c_str(), ChannelName.c_str());
|
||||||
|
|
||||||
|
|||||||
@ -1258,7 +1258,7 @@ bool Client::ChecksumVerificationCRCEQGame(uint64 checksum)
|
|||||||
std::string checksumvar;
|
std::string checksumvar;
|
||||||
uint64_t checksumint;
|
uint64_t checksumint;
|
||||||
if (database.GetVariable("crc_eqgame", checksumvar)) {
|
if (database.GetVariable("crc_eqgame", checksumvar)) {
|
||||||
checksumint = Strings::ToBigInt(checksumvar.c_str());
|
checksumint = Strings::ToBigInt(checksumvar);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogChecksumVerification("variable not set in variables table.");
|
LogChecksumVerification("variable not set in variables table.");
|
||||||
@ -1281,7 +1281,7 @@ bool Client::ChecksumVerificationCRCSkillCaps(uint64 checksum)
|
|||||||
std::string checksumvar;
|
std::string checksumvar;
|
||||||
uint64_t checksumint;
|
uint64_t checksumint;
|
||||||
if (database.GetVariable("crc_skillcaps", checksumvar)) {
|
if (database.GetVariable("crc_skillcaps", checksumvar)) {
|
||||||
checksumint = Strings::ToBigInt(checksumvar.c_str());
|
checksumint = Strings::ToBigInt(checksumvar);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogChecksumVerification("[checksum_crc2_skillcaps] variable not set in variables table.");
|
LogChecksumVerification("[checksum_crc2_skillcaps] variable not set in variables table.");
|
||||||
@ -1304,7 +1304,7 @@ bool Client::ChecksumVerificationCRCBaseData(uint64 checksum)
|
|||||||
std::string checksumvar;
|
std::string checksumvar;
|
||||||
uint64_t checksumint;
|
uint64_t checksumint;
|
||||||
if (database.GetVariable("crc_basedata", checksumvar)) {
|
if (database.GetVariable("crc_basedata", checksumvar)) {
|
||||||
checksumint = Strings::ToBigInt(checksumvar.c_str());
|
checksumint = Strings::ToBigInt(checksumvar);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogChecksumVerification("variable not set in variables table.");
|
LogChecksumVerification("variable not set in variables table.");
|
||||||
|
|||||||
@ -360,7 +360,7 @@ bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_p
|
|||||||
}
|
}
|
||||||
std::string lsworldadmin;
|
std::string lsworldadmin;
|
||||||
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
||||||
if (Strings::ToInt(lsworldadmin.c_str()) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
|
if (Strings::ToInt(lsworldadmin) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
|
||||||
padmin = pworldadmin;
|
padmin = pworldadmin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,14 +166,14 @@ void ConsoleWho(
|
|||||||
}
|
}
|
||||||
else if (Strings::IsNumber(arg)) {
|
else if (Strings::IsNumber(arg)) {
|
||||||
if (whom.lvllow == 0xFFFF) {
|
if (whom.lvllow == 0xFFFF) {
|
||||||
whom.lvllow = Strings::ToInt(arg.c_str());
|
whom.lvllow = Strings::ToInt(arg);
|
||||||
whom.lvlhigh = whom.lvllow;
|
whom.lvlhigh = whom.lvllow;
|
||||||
}
|
}
|
||||||
else if (Strings::ToInt(arg.c_str()) > int(whom.lvllow)) {
|
else if (Strings::ToInt(arg) > int(whom.lvllow)) {
|
||||||
whom.lvlhigh = Strings::ToInt(arg.c_str());
|
whom.lvlhigh = Strings::ToInt(arg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
whom.lvllow = Strings::ToInt(arg.c_str());
|
whom.lvllow = Strings::ToInt(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -200,11 +200,11 @@ void ConsoleUptime(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Strings::IsNumber(args[0]) && Strings::ToInt(args[0].c_str()) > 0) {
|
if (Strings::IsNumber(args[0]) && Strings::ToInt(args[0]) > 0) {
|
||||||
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
|
auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct));
|
||||||
ServerUptime_Struct *sus = (ServerUptime_Struct *) pack->pBuffer;
|
ServerUptime_Struct *sus = (ServerUptime_Struct *) pack->pBuffer;
|
||||||
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", connection->UserName().c_str());
|
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", connection->UserName().c_str());
|
||||||
sus->zoneserverid = Strings::ToInt(args[0].c_str());
|
sus->zoneserverid = Strings::ToInt(args[0]);
|
||||||
ZoneServer *zs = zoneserver_list.FindByID(sus->zoneserverid);
|
ZoneServer *zs = zoneserver_list.FindByID(sus->zoneserverid);
|
||||||
if (zs) {
|
if (zs) {
|
||||||
zs->SendPacket(pack);
|
zs->SendPacket(pack);
|
||||||
@ -284,7 +284,7 @@ void ConsoleEmote(
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccountStatus::Player,
|
AccountStatus::Player,
|
||||||
Strings::ToInt(args[1].c_str()),
|
Strings::ToInt(args[1]),
|
||||||
Strings::Join(join_args, " ").c_str()
|
Strings::Join(join_args, " ").c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ void ConsoleEmote(
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
AccountStatus::Player,
|
AccountStatus::Player,
|
||||||
Strings::ToInt(args[1].c_str()),
|
Strings::ToInt(args[1]),
|
||||||
Strings::Join(join_args, " ").c_str()
|
Strings::Join(join_args, " ").c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ void ConsoleEmote(
|
|||||||
args[0].c_str(),
|
args[0].c_str(),
|
||||||
0,
|
0,
|
||||||
AccountStatus::Player,
|
AccountStatus::Player,
|
||||||
Strings::ToInt(args[1].c_str()),
|
Strings::ToInt(args[1]),
|
||||||
Strings::Join(join_args, " ").c_str()
|
Strings::Join(join_args, " ").c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ void ConsoleZoneShutdown(
|
|||||||
pack->opcode = ServerOP_ZoneShutdown;
|
pack->opcode = ServerOP_ZoneShutdown;
|
||||||
strcpy(s->adminname, tmpname);
|
strcpy(s->adminname, tmpname);
|
||||||
if (Strings::IsNumber(args[0])) {
|
if (Strings::IsNumber(args[0])) {
|
||||||
s->ZoneServerID = Strings::ToInt(args[0].c_str());
|
s->ZoneServerID = Strings::ToInt(args[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s->zoneid = ZoneID(args[0].c_str());
|
s->zoneid = ZoneID(args[0].c_str());
|
||||||
@ -639,12 +639,12 @@ void ConsoleZoneBootup(
|
|||||||
if (args.size() > 2) {
|
if (args.size() > 2) {
|
||||||
zoneserver_list.SOPZoneBootup(
|
zoneserver_list.SOPZoneBootup(
|
||||||
tmpname,
|
tmpname,
|
||||||
Strings::ToInt(args[0].c_str()),
|
Strings::ToInt(args[0]),
|
||||||
args[1].c_str(),
|
args[1].c_str(),
|
||||||
(bool) (strcasecmp(args[1].c_str(), "static") == 0));
|
(bool) (strcasecmp(args[1].c_str(), "static") == 0));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
zoneserver_list.SOPZoneBootup(tmpname, Strings::ToInt(args[0].c_str()), args[1].c_str(), false);
|
zoneserver_list.SOPZoneBootup(tmpname, Strings::ToInt(args[0]), args[1].c_str(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,10 +751,10 @@ void ConsoleFlag(
|
|||||||
connection->SendLine("Usage: flag [status] [accountname]");
|
connection->SendLine("Usage: flag [status] [accountname]");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (Strings::ToInt(args[0].c_str()) > connection->Admin()) {
|
if (Strings::ToInt(args[0]) > connection->Admin()) {
|
||||||
connection->SendLine("You cannot set people's status to higher than your own");
|
connection->SendLine("You cannot set people's status to higher than your own");
|
||||||
}
|
}
|
||||||
else if (!database.SetAccountStatus(args[1].c_str(), Strings::ToInt(args[0].c_str()))) {
|
else if (!database.SetAccountStatus(args[1].c_str(), Strings::ToInt(args[0]))) {
|
||||||
connection->SendLine("Unable to flag account!");
|
connection->SendLine("Unable to flag account!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -821,8 +821,8 @@ void ConsoleWorldShutdown(
|
|||||||
{
|
{
|
||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
int32 time, interval;
|
int32 time, interval;
|
||||||
if (Strings::IsNumber(args[0]) && Strings::IsNumber(args[1]) && ((time = Strings::ToInt(args[0].c_str())) > 0) &&
|
if (Strings::IsNumber(args[0]) && Strings::IsNumber(args[1]) && ((time = Strings::ToInt(args[0])) > 0) &&
|
||||||
((interval = Strings::ToInt(args[1].c_str())) > 0)) {
|
((interval = Strings::ToInt(args[1])) > 0)) {
|
||||||
zoneserver_list.WorldShutDown(time, interval);
|
zoneserver_list.WorldShutDown(time, interval);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -886,7 +886,7 @@ void ConsoleSignalCharByName(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection->SendLine(StringFormat("Signal Sent to %s with ID %i", (char *) args[0].c_str(), Strings::ToInt(args[1].c_str())));
|
connection->SendLine(StringFormat("Signal Sent to %s with ID %i", (char *) args[0].c_str(), Strings::ToInt(args[1])));
|
||||||
uint32 message_len = strlen((char *) args[0].c_str()) + 1;
|
uint32 message_len = strlen((char *) args[0].c_str()) + 1;
|
||||||
auto pack = new ServerPacket(ServerOP_CZSignal, sizeof(CZSignal_Struct) + message_len);
|
auto pack = new ServerPacket(ServerOP_CZSignal, sizeof(CZSignal_Struct) + message_len);
|
||||||
CZSignal_Struct* CZS = (CZSignal_Struct*) pack->pBuffer;
|
CZSignal_Struct* CZS = (CZSignal_Struct*) pack->pBuffer;
|
||||||
@ -894,7 +894,7 @@ void ConsoleSignalCharByName(
|
|||||||
int update_identifier = 0;
|
int update_identifier = 0;
|
||||||
CZS->update_type = update_type;
|
CZS->update_type = update_type;
|
||||||
CZS->update_identifier = update_identifier;
|
CZS->update_identifier = update_identifier;
|
||||||
CZS->signal_id = Strings::ToInt(args[1].c_str());
|
CZS->signal_id = Strings::ToInt(args[1]);
|
||||||
strn0cpy(CZS->client_name, (char *) args[0].c_str(), 64);
|
strn0cpy(CZS->client_name, (char *) args[0].c_str(), 64);
|
||||||
zoneserver_list.SendPacket(pack);
|
zoneserver_list.SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
|
|||||||
@ -204,7 +204,7 @@ void WorldBoot::CheckForServerScript(bool force_download)
|
|||||||
r.set_read_timeout(1, 0);
|
r.set_read_timeout(1, 0);
|
||||||
r.set_write_timeout(1, 0);
|
r.set_write_timeout(1, 0);
|
||||||
|
|
||||||
if (auto res = r.Get(u.get_path().c_str())) {
|
if (auto res = r.Get(u.get_path())) {
|
||||||
if (res->status == 200) {
|
if (res->status == 200) {
|
||||||
// write file
|
// write file
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
|||||||
if (database.GetVariable("RuleSet", tmp)) {
|
if (database.GetVariable("RuleSet", tmp)) {
|
||||||
LogInfo("Loading rule set [{}]", tmp.c_str());
|
LogInfo("Loading rule set [{}]", tmp.c_str());
|
||||||
|
|
||||||
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) {
|
if (!RuleManager::Instance()->LoadRules(&database, tmp, false)) {
|
||||||
LogInfo("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
|
LogInfo("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1978,10 +1978,10 @@ bool Client::Death(Mob* killerMob, int64 damage, uint16 spell, EQ::skills::Skill
|
|||||||
database.GetVariable("ServerType", tmp);
|
database.GetVariable("ServerType", tmp);
|
||||||
if (tmp[0] == '1' && tmp[1] == '\0' && killerMob && killerMob->IsClient()) {
|
if (tmp[0] == '1' && tmp[1] == '\0' && killerMob && killerMob->IsClient()) {
|
||||||
database.GetVariable("PvPreward", tmp);
|
database.GetVariable("PvPreward", tmp);
|
||||||
auto reward = Strings::ToInt(tmp.c_str());
|
auto reward = Strings::ToInt(tmp);
|
||||||
if (reward == 3) {
|
if (reward == 3) {
|
||||||
database.GetVariable("PvPitem", tmp);
|
database.GetVariable("PvPitem", tmp);
|
||||||
auto pvp_item_id = Strings::ToInt(tmp.c_str());
|
auto pvp_item_id = Strings::ToInt(tmp);
|
||||||
const auto* item = database.GetItem(pvp_item_id);
|
const auto* item = database.GetItem(pvp_item_id);
|
||||||
if (item) {
|
if (item) {
|
||||||
new_corpse->SetPlayerKillItemID(pvp_item_id);
|
new_corpse->SetPlayerKillItemID(pvp_item_id);
|
||||||
|
|||||||
@ -10446,7 +10446,7 @@ void Client::SendToInstance(std::string instance_type, std::string zone_short_na
|
|||||||
uint16 instance_id = 0;
|
uint16 instance_id = 0;
|
||||||
|
|
||||||
if (current_bucket_value.length() > 0) {
|
if (current_bucket_value.length() > 0) {
|
||||||
instance_id = Strings::ToInt(current_bucket_value.c_str());
|
instance_id = Strings::ToInt(current_bucket_value);
|
||||||
} else {
|
} else {
|
||||||
if(!database.GetUnusedInstanceID(instance_id)) {
|
if(!database.GetUnusedInstanceID(instance_id)) {
|
||||||
Message(Chat::White, "Server was unable to find a free instance id.");
|
Message(Chat::White, "Server was unable to find a free instance id.");
|
||||||
|
|||||||
@ -203,8 +203,8 @@ enum eInnateSkill {
|
|||||||
InnateDisabled = 255
|
InnateDisabled = 255
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string DIAWIND_RESPONSE_ONE_KEY = "diawind_npc_response_one";
|
inline const std::string DIAWIND_RESPONSE_ONE_KEY = "diawind_npc_response_one";
|
||||||
const std::string DIAWIND_RESPONSE_TWO_KEY = "diawind_npc_response_two";
|
inline const std::string DIAWIND_RESPONSE_TWO_KEY = "diawind_npc_response_two";
|
||||||
const uint32 POPUPID_DIAWIND_ONE = 99999;
|
const uint32 POPUPID_DIAWIND_ONE = 99999;
|
||||||
const uint32 POPUPID_DIAWIND_TWO = 100000;
|
const uint32 POPUPID_DIAWIND_TWO = 100000;
|
||||||
const uint32 POPUPID_UPDATE_SHOWSTATSWINDOW = 1000000;
|
const uint32 POPUPID_UPDATE_SHOWSTATSWINDOW = 1000000;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ void DataBucket::SetData(const std::string& bucket_key, const std::string& bucke
|
|||||||
if (isalpha(expires_time[0]) || isalpha(expires_time[expires_time.length() - 1])) {
|
if (isalpha(expires_time[0]) || isalpha(expires_time[expires_time.length() - 1])) {
|
||||||
expires_time_unix = (long long) std::time(nullptr) + Strings::TimeToSeconds(expires_time);
|
expires_time_unix = (long long) std::time(nullptr) + Strings::TimeToSeconds(expires_time);
|
||||||
} else {
|
} else {
|
||||||
expires_time_unix = (long long) std::time(nullptr) + Strings::ToInt(expires_time.c_str());
|
expires_time_unix = (long long) std::time(nullptr) + Strings::ToInt(expires_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -199,7 +199,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
|
|||||||
|
|
||||||
// set the popup id
|
// set the popup id
|
||||||
if (!popupid.empty()) {
|
if (!popupid.empty()) {
|
||||||
popup_id = (Strings::IsNumber(popupid) ? Strings::ToInt(popupid.c_str()) : 0);
|
popup_id = (Strings::IsNumber(popupid) ? Strings::ToInt(popupid) : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
|
|||||||
Strings::FindReplace(output, fmt::format("secondresponseid:{}", secondresponseid), "");
|
Strings::FindReplace(output, fmt::format("secondresponseid:{}", secondresponseid), "");
|
||||||
|
|
||||||
if (!secondresponseid.empty()) {
|
if (!secondresponseid.empty()) {
|
||||||
negative_id = (Strings::IsNumber(secondresponseid) ? Strings::ToInt(secondresponseid.c_str()) : 0);
|
negative_id = (Strings::IsNumber(secondresponseid) ? Strings::ToInt(secondresponseid) : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,7 +410,7 @@ void DialogueWindow::Render(Client *c, std::string markdown)
|
|||||||
|
|
||||||
// click response
|
// click response
|
||||||
// window type response
|
// window type response
|
||||||
uint32 window_type = (Strings::IsNumber(wintype) ? Strings::ToInt(wintype.c_str()) : 0);
|
uint32 window_type = (Strings::IsNumber(wintype) ? Strings::ToInt(wintype) : 0);
|
||||||
std::string click_response_button = (window_type == 1 ? "Yes" : "OK");
|
std::string click_response_button = (window_type == 1 ? "Yes" : "OK");
|
||||||
std::string click_response = fmt::format(
|
std::string click_response = fmt::format(
|
||||||
"<c \"#F07F00\">Click [{}] to continue...</c>",
|
"<c \"#F07F00\">Click [{}] to continue...</c>",
|
||||||
|
|||||||
@ -55,23 +55,23 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
float set_size = 0.0f;
|
float set_size = 0.0f;
|
||||||
|
|
||||||
if (arg2 == move_x_action) {
|
if (arg2 == move_x_action) {
|
||||||
x_move = Strings::ToFloat(arg3.c_str());
|
x_move = Strings::ToFloat(arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg2 == move_y_action) {
|
if (arg2 == move_y_action) {
|
||||||
y_move = Strings::ToFloat(arg3.c_str());
|
y_move = Strings::ToFloat(arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg2 == move_z_action) {
|
if (arg2 == move_z_action) {
|
||||||
z_move = Strings::ToFloat(arg3.c_str());
|
z_move = Strings::ToFloat(arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg2 == move_h_action) {
|
if (arg2 == move_h_action) {
|
||||||
h_move = Strings::ToFloat(arg3.c_str());
|
h_move = Strings::ToFloat(arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg2 == set_size_action) {
|
if (arg2 == set_size_action) {
|
||||||
set_size = Strings::ToFloat(arg3.c_str());
|
set_size = Strings::ToFloat(arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
door->SetLocation(
|
door->SetLocation(
|
||||||
@ -370,7 +370,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
if (arg1 == "opentype" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
if (arg1 == "opentype" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||||
if (door) {
|
if (door) {
|
||||||
door->SetOpenType(Strings::ToInt(arg2.c_str()));
|
door->SetOpenType(Strings::ToInt(arg2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
if (arg1 == "setincline" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
if (arg1 == "setincline" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||||
if (door) {
|
if (door) {
|
||||||
door->SetIncline(Strings::ToInt(arg2.c_str()));
|
door->SetIncline(Strings::ToInt(arg2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
if (arg1 == "setinvertstate" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
if (arg1 == "setinvertstate" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||||
if (door) {
|
if (door) {
|
||||||
door->SetInvertState(Strings::ToInt(arg2.c_str()));
|
door->SetInvertState(Strings::ToInt(arg2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
if (arg1 == "setinclineinc" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
if (arg1 == "setinclineinc" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||||
if (door) {
|
if (door) {
|
||||||
door->SetIncline(door->GetIncline() + Strings::ToInt(arg2.c_str()));
|
door->SetIncline(door->GetIncline() + Strings::ToInt(arg2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ void command_faction(Client *c, const Seperator *sep)
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
uint32 character_id = target->CharacterID();
|
uint32 character_id = target->CharacterID();
|
||||||
uint32 faction_id = Strings::ToUnsignedInt(faction_filter.c_str());
|
uint32 faction_id = Strings::ToUnsignedInt(faction_filter);
|
||||||
if (target->ReloadCharacterFaction(target, faction_id, character_id)) {
|
if (target->ReloadCharacterFaction(target, faction_id, character_id)) {
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
|
|||||||
@ -170,7 +170,7 @@ bool HealRotation::ClearMemberPool()
|
|||||||
if (!ClearTargetPool())
|
if (!ClearTargetPool())
|
||||||
LogError("failed to clear m_target_pool (size: [{}])", m_target_pool.size());
|
LogError("failed to clear m_target_pool (size: [{}])", m_target_pool.size());
|
||||||
|
|
||||||
auto clear_list = const_cast<const std::list<Bot*>&>(m_member_pool);
|
auto& clear_list = const_cast<const std::list<Bot*>&>(m_member_pool);
|
||||||
for (auto member_iter : clear_list)
|
for (auto member_iter : clear_list)
|
||||||
member_iter->LeaveHealRotationMemberPool();
|
member_iter->LeaveHealRotationMemberPool();
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ bool HealRotation::ClearTargetPool()
|
|||||||
m_hot_active = false;
|
m_hot_active = false;
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
|
|
||||||
auto clear_list = const_cast<const std::list<Mob*>&>(m_target_pool);
|
auto& clear_list = const_cast<const std::list<Mob*>&>(m_target_pool);
|
||||||
for (auto target_iter : clear_list)
|
for (auto target_iter : clear_list)
|
||||||
target_iter->LeaveHealRotationTargetPool();
|
target_iter->LeaveHealRotationTargetPool();
|
||||||
|
|
||||||
|
|||||||
@ -907,12 +907,12 @@ std::string lua_say_link(const char *phrase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void lua_set_rule(std::string rule_name, std::string rule_value) {
|
void lua_set_rule(std::string rule_name, std::string rule_value) {
|
||||||
RuleManager::Instance()->SetRule(rule_name.c_str(), rule_value.c_str());
|
RuleManager::Instance()->SetRule(rule_name, rule_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string lua_get_rule(std::string rule_name) {
|
std::string lua_get_rule(std::string rule_name) {
|
||||||
std::string rule_value;
|
std::string rule_value;
|
||||||
RuleManager::Instance()->GetRule(rule_name.c_str(), rule_value);
|
RuleManager::Instance()->GetRule(rule_name, rule_value);
|
||||||
return rule_value;
|
return rule_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -172,7 +172,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (zone_port.size() > 1) {
|
if (zone_port.size() > 1) {
|
||||||
std::string p_name = zone_port[1];
|
std::string p_name = zone_port[1];
|
||||||
Config->SetZonePort(Strings::ToInt(p_name.c_str()));
|
Config->SetZonePort(Strings::ToInt(p_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
worldserver.SetLaunchedName(z_name.c_str());
|
worldserver.SetLaunchedName(z_name.c_str());
|
||||||
@ -193,7 +193,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (zone_port.size() > 1) {
|
if (zone_port.size() > 1) {
|
||||||
std::string p_name = zone_port[1];
|
std::string p_name = zone_port[1];
|
||||||
Config->SetZonePort(Strings::ToInt(p_name.c_str()));
|
Config->SetZonePort(Strings::ToInt(p_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
worldserver.SetLaunchedName(z_name.c_str());
|
worldserver.SetLaunchedName(z_name.c_str());
|
||||||
@ -214,7 +214,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (zone_port.size() > 1) {
|
if (zone_port.size() > 1) {
|
||||||
std::string p_name = zone_port[1];
|
std::string p_name = zone_port[1];
|
||||||
Config->SetZonePort(Strings::ToInt(p_name.c_str()));
|
Config->SetZonePort(Strings::ToInt(p_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
worldserver.SetLaunchedName(z_name.c_str());
|
worldserver.SetLaunchedName(z_name.c_str());
|
||||||
@ -380,7 +380,7 @@ int main(int argc, char** argv) {
|
|||||||
std::string tmp;
|
std::string tmp;
|
||||||
if (database.GetVariable("RuleSet", tmp)) {
|
if (database.GetVariable("RuleSet", tmp)) {
|
||||||
LogInfo("Loading rule set [{}]", tmp.c_str());
|
LogInfo("Loading rule set [{}]", tmp.c_str());
|
||||||
if (!RuleManager::Instance()->LoadRules(&database, tmp.c_str(), false)) {
|
if (!RuleManager::Instance()->LoadRules(&database, tmp, false)) {
|
||||||
LogError("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
|
LogError("Failed to load ruleset [{}], falling back to defaults", tmp.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6976,9 +6976,9 @@ std::string Mob::GetBucketKey() {
|
|||||||
std::string Mob::GetBucketRemaining(std::string bucket_name) {
|
std::string Mob::GetBucketRemaining(std::string bucket_name) {
|
||||||
std::string full_bucket_name = fmt::format("{}-{}", GetBucketKey(), bucket_name);
|
std::string full_bucket_name = fmt::format("{}-{}", GetBucketKey(), bucket_name);
|
||||||
std::string bucket_remaining = DataBucket::GetDataRemaining(full_bucket_name);
|
std::string bucket_remaining = DataBucket::GetDataRemaining(full_bucket_name);
|
||||||
if (!bucket_remaining.empty() && Strings::ToInt(bucket_remaining.c_str()) > 0) {
|
if (!bucket_remaining.empty() && Strings::ToInt(bucket_remaining) > 0) {
|
||||||
return bucket_remaining;
|
return bucket_remaining;
|
||||||
} else if (Strings::ToInt(bucket_remaining.c_str()) == 0) {
|
} else if (Strings::ToInt(bucket_remaining) == 0) {
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
return std::string();
|
return std::string();
|
||||||
|
|||||||
@ -3535,71 +3535,71 @@ std::string QuestManager::GetEncounter() const {
|
|||||||
|
|
||||||
void QuestManager::UpdateZoneHeader(std::string type, std::string value) {
|
void QuestManager::UpdateZoneHeader(std::string type, std::string value) {
|
||||||
if (strcasecmp(type.c_str(), "ztype") == 0)
|
if (strcasecmp(type.c_str(), "ztype") == 0)
|
||||||
zone->newzone_data.ztype = Strings::ToInt(value.c_str());
|
zone->newzone_data.ztype = Strings::ToInt(value);
|
||||||
else if (strcasecmp(type.c_str(), "fog_red") == 0) {
|
else if (strcasecmp(type.c_str(), "fog_red") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.fog_red[i] = Strings::ToInt(value.c_str());
|
zone->newzone_data.fog_red[i] = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "fog_green") == 0) {
|
} else if (strcasecmp(type.c_str(), "fog_green") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.fog_green[i] = Strings::ToInt(value.c_str());
|
zone->newzone_data.fog_green[i] = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "fog_blue") == 0) {
|
} else if (strcasecmp(type.c_str(), "fog_blue") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.fog_blue[i] = Strings::ToInt(value.c_str());
|
zone->newzone_data.fog_blue[i] = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "fog_minclip") == 0) {
|
} else if (strcasecmp(type.c_str(), "fog_minclip") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.fog_minclip[i] = Strings::ToFloat(value.c_str());
|
zone->newzone_data.fog_minclip[i] = Strings::ToFloat(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "fog_maxclip") == 0) {
|
} else if (strcasecmp(type.c_str(), "fog_maxclip") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.fog_maxclip[i] = Strings::ToFloat(value.c_str());
|
zone->newzone_data.fog_maxclip[i] = Strings::ToFloat(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "gravity") == 0) {
|
} else if (strcasecmp(type.c_str(), "gravity") == 0) {
|
||||||
zone->newzone_data.gravity = Strings::ToFloat(value.c_str());
|
zone->newzone_data.gravity = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "time_type") == 0) {
|
} else if (strcasecmp(type.c_str(), "time_type") == 0) {
|
||||||
zone->newzone_data.time_type = Strings::ToInt(value.c_str());
|
zone->newzone_data.time_type = Strings::ToInt(value);
|
||||||
} else if (strcasecmp(type.c_str(), "rain_chance") == 0) {
|
} else if (strcasecmp(type.c_str(), "rain_chance") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.rain_chance[i] = Strings::ToInt(value.c_str());
|
zone->newzone_data.rain_chance[i] = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "rain_duration") == 0) {
|
} else if (strcasecmp(type.c_str(), "rain_duration") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.rain_duration[i] = Strings::ToInt(value.c_str());
|
zone->newzone_data.rain_duration[i] = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "snow_chance") == 0) {
|
} else if (strcasecmp(type.c_str(), "snow_chance") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.snow_chance[i] = Strings::ToInt(value.c_str());
|
zone->newzone_data.snow_chance[i] = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "snow_duration") == 0) {
|
} else if (strcasecmp(type.c_str(), "snow_duration") == 0) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
zone->newzone_data.snow_duration[i] = Strings::ToInt(value.c_str());
|
zone->newzone_data.snow_duration[i] = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(type.c_str(), "sky") == 0) {
|
} else if (strcasecmp(type.c_str(), "sky") == 0) {
|
||||||
zone->newzone_data.sky = Strings::ToInt(value.c_str());
|
zone->newzone_data.sky = Strings::ToInt(value);
|
||||||
} else if (strcasecmp(type.c_str(), "safe_x") == 0) {
|
} else if (strcasecmp(type.c_str(), "safe_x") == 0) {
|
||||||
zone->newzone_data.safe_x = Strings::ToFloat(value.c_str());
|
zone->newzone_data.safe_x = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "safe_y") == 0) {
|
} else if (strcasecmp(type.c_str(), "safe_y") == 0) {
|
||||||
zone->newzone_data.safe_y = Strings::ToFloat(value.c_str());
|
zone->newzone_data.safe_y = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "safe_z") == 0) {
|
} else if (strcasecmp(type.c_str(), "safe_z") == 0) {
|
||||||
zone->newzone_data.safe_z = Strings::ToFloat(value.c_str());
|
zone->newzone_data.safe_z = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "max_z") == 0) {
|
} else if (strcasecmp(type.c_str(), "max_z") == 0) {
|
||||||
zone->newzone_data.max_z = Strings::ToFloat(value.c_str());
|
zone->newzone_data.max_z = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "underworld") == 0) {
|
} else if (strcasecmp(type.c_str(), "underworld") == 0) {
|
||||||
zone->newzone_data.underworld = Strings::ToFloat(value.c_str());
|
zone->newzone_data.underworld = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "minclip") == 0) {
|
} else if (strcasecmp(type.c_str(), "minclip") == 0) {
|
||||||
zone->newzone_data.minclip = Strings::ToFloat(value.c_str());
|
zone->newzone_data.minclip = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "maxclip") == 0) {
|
} else if (strcasecmp(type.c_str(), "maxclip") == 0) {
|
||||||
zone->newzone_data.maxclip = Strings::ToFloat(value.c_str());
|
zone->newzone_data.maxclip = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "fog_density") == 0) {
|
} else if (strcasecmp(type.c_str(), "fog_density") == 0) {
|
||||||
zone->newzone_data.fog_density = Strings::ToFloat(value.c_str());
|
zone->newzone_data.fog_density = Strings::ToFloat(value);
|
||||||
} else if (strcasecmp(type.c_str(), "suspendbuffs") == 0) {
|
} else if (strcasecmp(type.c_str(), "suspendbuffs") == 0) {
|
||||||
zone->newzone_data.suspend_buffs = Strings::ToInt(value.c_str());
|
zone->newzone_data.suspend_buffs = Strings::ToInt(value);
|
||||||
} else if (strcasecmp(type.c_str(), "lavadamage") == 0) {
|
} else if (strcasecmp(type.c_str(), "lavadamage") == 0) {
|
||||||
zone->newzone_data.lava_damage = Strings::ToInt(value.c_str());
|
zone->newzone_data.lava_damage = Strings::ToInt(value);
|
||||||
} else if (strcasecmp(type.c_str(), "minlavadamage") == 0) {
|
} else if (strcasecmp(type.c_str(), "minlavadamage") == 0) {
|
||||||
zone->newzone_data.min_lava_damage = Strings::ToInt(value.c_str());
|
zone->newzone_data.min_lava_damage = Strings::ToInt(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
||||||
|
|||||||
@ -116,7 +116,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool is_static) {
|
|||||||
std::string tmp;
|
std::string tmp;
|
||||||
if (database.GetVariable("loglevel", tmp)) {
|
if (database.GetVariable("loglevel", tmp)) {
|
||||||
int log_levels[4];
|
int log_levels[4];
|
||||||
int tmp_i = Strings::ToInt(tmp.c_str());
|
int tmp_i = Strings::ToInt(tmp);
|
||||||
if (tmp_i>9){ //Server is using the new code
|
if (tmp_i>9){ //Server is using the new code
|
||||||
for(int i=0;i<4;i++){
|
for(int i=0;i<4;i++){
|
||||||
if (((int)tmp[i]>=48) && ((int)tmp[i]<=57))
|
if (((int)tmp[i]>=48) && ((int)tmp[i]<=57))
|
||||||
@ -1113,7 +1113,7 @@ bool Zone::Init(bool is_static) {
|
|||||||
if (RuleManager::Instance()->GetActiveRulesetID() != default_ruleset) {
|
if (RuleManager::Instance()->GetActiveRulesetID() != default_ruleset) {
|
||||||
std::string r_name = RuleSetsRepository::GetRuleSetName(database, default_ruleset);
|
std::string r_name = RuleSetsRepository::GetRuleSetName(database, default_ruleset);
|
||||||
if (r_name.size() > 0) {
|
if (r_name.size() > 0) {
|
||||||
RuleManager::Instance()->LoadRules(&database, r_name.c_str(), false);
|
RuleManager::Instance()->LoadRules(&database, r_name, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ void ZoneEventScheduler::Process(Zone *zone, WorldContentService *content_servic
|
|||||||
rule_key,
|
rule_key,
|
||||||
rule_value
|
rule_value
|
||||||
);
|
);
|
||||||
RuleManager::Instance()->SetRule(rule_key.c_str(), rule_value.c_str(), nullptr, false, true);
|
RuleManager::Instance()->SetRule(rule_key, rule_value, nullptr, false, true);
|
||||||
}
|
}
|
||||||
m_active_events.push_back(e);
|
m_active_events.push_back(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user