Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Door Manipulation] Resolve some typos and add a GM check. #1550

Merged
merged 2 commits into from Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/shareddb.cpp
Expand Up @@ -2287,4 +2287,4 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) {
std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str());
auto results = QueryDatabase(query);
}
}
2 changes: 1 addition & 1 deletion zone/client.cpp
Expand Up @@ -9191,7 +9191,7 @@ void Client::SetDisplayMobInfoWindow(bool display_mob_info_window)

bool Client::IsDevToolsEnabled() const
{
return dev_tools_enabled && RuleB(World, EnableDevTools);
return dev_tools_enabled && GetGM() && RuleB(World, EnableDevTools);
}

void Client::SetDevToolsEnabled(bool in_dev_tools_enabled)
Expand Down
40 changes: 22 additions & 18 deletions zone/gm_commands/door_manipulation.cpp
Expand Up @@ -129,7 +129,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
std::vector<std::string> move_h_options_negative;
std::vector<std::string> set_size_options_positive;
std::vector<std::string> set_size_options_negative;
for (const auto &move_option : move_options) {
for (const auto &move_option : move_options) {
if (move_option == move_x_action) {
move_x_options_positive.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
Expand Down Expand Up @@ -165,7 +165,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
EQ::SayLinkEngine::GenerateQuestSaylink(
fmt::format("#door edit {} -.25", move_option),
false,
"-.25"
".25"
)
);
}
Expand All @@ -190,7 +190,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
}

for (int move_index = -15; move_index <= 0; move_index += 5) {
int value = (move_index == 0 ? 1 : move_index);
int value = (move_index == 0 ? -1 : move_index);
move_y_options_negative.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
fmt::format("#door edit {} {}", move_option, value),
Expand All @@ -204,7 +204,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
EQ::SayLinkEngine::GenerateQuestSaylink(
fmt::format("#door edit {} -.25", move_option),
false,
"-.25"
".25"
)
);
}
Expand All @@ -229,7 +229,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
}

for (int move_index = -15; move_index <= 0; move_index += 5) {
int value = (move_index == 0 ? 1 : move_index);
int value = (move_index == 0 ? -1 : move_index);
move_z_options_negative.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
fmt::format("#door edit {} {}", move_option, value),
Expand All @@ -243,7 +243,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
EQ::SayLinkEngine::GenerateQuestSaylink(
fmt::format("#door edit {} -.25", move_option),
false,
"-.25"
".25"
)
);
}
Expand All @@ -260,7 +260,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
}

for (int move_index = -50; move_index <= 0; move_index += 5) {
int value = (move_index == 0 ? 1 : move_index);
int value = (move_index == 0 ? -1 : move_index);
move_h_options_negative.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
fmt::format("#door edit {} {}", move_option, value),
Expand All @@ -283,7 +283,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
}

for (int move_index = -100; move_index <= 0; move_index += 10) {
int value = (move_index == 0 ? 1 : move_index);
int value = (move_index == 0 ? -1 : move_index);
set_size_options_negative.emplace_back(
EQ::SayLinkEngine::GenerateQuestSaylink(
fmt::format("#door edit {} {}", move_option, value),
Expand All @@ -297,26 +297,30 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)

// we're passing a move action here
if (!arg3.empty() && StringIsNumber(arg3)) {
int x_move = 0;
int y_move = 0;
int z_move = 0;
int h_move = 0;
int set_size = 0;
float x_move = 0.0f;
float y_move = 0.0f;
float z_move = 0.0f;
float h_move = 0.0f;
float set_size = 0.0f;

if (arg2 == move_x_action) {
x_move = std::atoi(arg3.c_str());
x_move = std::atof(arg3.c_str());
}

if (arg2 == move_y_action) {
y_move = std::atoi(arg3.c_str());
y_move = std::atof(arg3.c_str());
}

if (arg2 == move_z_action) {
z_move = std::atoi(arg3.c_str());
z_move = std::atof(arg3.c_str());
}

if (arg2 == move_h_action) {
h_move = std::atoi(arg3.c_str());
h_move = std::atof(arg3.c_str());
}

if (arg2 == set_size_action) {
set_size = std::atoi(arg3.c_str());
set_size = std::atof(arg3.c_str());
}

door->SetLocation(
Expand Down