mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Saylinks] Add Silent helper (#2372)
* [Saylinks] Add Silent helper * Swap out usage in door manipulation for silent saylink helper
This commit is contained in:
parent
f6889d20e9
commit
597b041d92
@ -418,7 +418,11 @@ SaylinkRepository::Saylink EQ::SayLinkEngine::GetOrSaveSaylink(std::string sayli
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Saylink::Create(std::string saylink_text, bool silent, std::string link_name)
|
std::string Saylink::Create(const std::string &saylink_text, bool silent, const std::string &link_name)
|
||||||
{
|
{
|
||||||
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, silent, link_name);
|
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, silent, link_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Saylink::Silent(const std::string &saylink_text, const std::string &link_name) {
|
||||||
|
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, true, link_name);
|
||||||
|
}
|
||||||
|
|||||||
@ -129,7 +129,8 @@ namespace EQ
|
|||||||
|
|
||||||
class Saylink {
|
class Saylink {
|
||||||
public:
|
public:
|
||||||
static std::string Create(std::string saylink_text, bool silent, std::string link_name);
|
static std::string Create(const std::string &saylink_text, bool silent, const std::string &link_name);
|
||||||
|
static std::string Silent(const std::string &saylink_text, const std::string &link_name);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*COMMON_SAY_LINK_H*/
|
#endif /*COMMON_SAY_LINK_H*/
|
||||||
|
|||||||
@ -162,8 +162,8 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
door->GetDoorName(),
|
door->GetDoorName(),
|
||||||
door->GetOpenType(),
|
door->GetOpenType(),
|
||||||
door->GetInvertState(),
|
door->GetInvertState(),
|
||||||
Saylink::Create("#door setinvertstate 0", true, "0"),
|
Saylink::Silent("#door setinvertstate 0", "0"),
|
||||||
Saylink::Create("#door setinvertstate 1", true, "1")
|
Saylink::Silent("#door setinvertstate 1", "1")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -195,17 +195,17 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
for (const auto &o: move_options) {
|
for (const auto &o: move_options) {
|
||||||
if (o == move_x_action) {
|
if (o == move_x_action) {
|
||||||
move_x_options_positive.emplace_back(
|
move_x_options_positive.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} {}", o, v), true, v)
|
Saylink::Silent(fmt::format("#door edit {} {}", o, v), v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (o == move_y_action) {
|
else if (o == move_y_action) {
|
||||||
move_y_options_positive.emplace_back(
|
move_y_options_positive.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} {}", o, v), true, v)
|
Saylink::Silent(fmt::format("#door edit {} {}", o, v), v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (o == move_z_action) {
|
else if (o == move_z_action) {
|
||||||
move_z_options_positive.emplace_back(
|
move_z_options_positive.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} {}", o, v), true, v)
|
Saylink::Silent(fmt::format("#door edit {} {}", o, v), v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,17 +217,17 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
for (const auto &o: move_options) {
|
for (const auto &o: move_options) {
|
||||||
if (o == move_x_action) {
|
if (o == move_x_action) {
|
||||||
move_x_options_negative.emplace_back(
|
move_x_options_negative.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} -{}", o, *v), true, *v)
|
Saylink::Silent(fmt::format("#door edit {} -{}", o, *v), *v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (o == move_y_action) {
|
else if (o == move_y_action) {
|
||||||
move_y_options_negative.emplace_back(
|
move_y_options_negative.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} -{}", o, *v), true, *v)
|
Saylink::Silent(fmt::format("#door edit {} -{}", o, *v), *v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (o == move_z_action) {
|
else if (o == move_z_action) {
|
||||||
move_z_options_negative.emplace_back(
|
move_z_options_negative.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} -{}", o, *v), true, *v)
|
Saylink::Silent(fmt::format("#door edit {} -{}", o, *v), *v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
// build positive options h
|
// build positive options h
|
||||||
for (const auto &v: heading_values) {
|
for (const auto &v: heading_values) {
|
||||||
move_h_options_positive.emplace_back(
|
move_h_options_positive.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} {}", move_h_action, v), true, v)
|
Saylink::Silent(fmt::format("#door edit {} {}", move_h_action, v), v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
// build negative options h
|
// build negative options h
|
||||||
for (auto v = heading_values.rbegin(); v != heading_values.rend(); ++v) {
|
for (auto v = heading_values.rbegin(); v != heading_values.rend(); ++v) {
|
||||||
move_h_options_negative.emplace_back(
|
move_h_options_negative.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} -{}", move_h_action, *v), true, *v)
|
Saylink::Silent(fmt::format("#door edit {} -{}", move_h_action, *v), *v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
// build positive options size
|
// build positive options size
|
||||||
for (const auto &v: size_values) {
|
for (const auto &v: size_values) {
|
||||||
set_size_options_positive.emplace_back(
|
set_size_options_positive.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} {}", set_size_action, v), true, v)
|
Saylink::Silent(fmt::format("#door edit {} {}", set_size_action, v), v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
// build negative options size
|
// build negative options size
|
||||||
for (auto v = size_values.rbegin(); v != size_values.rend(); ++v) {
|
for (auto v = size_values.rbegin(); v != size_values.rend(); ++v) {
|
||||||
set_size_options_negative.emplace_back(
|
set_size_options_negative.emplace_back(
|
||||||
Saylink::Create(fmt::format("#door edit {} -{}", set_size_action, *v), true, *v)
|
Saylink::Silent(fmt::format("#door edit {} -{}", set_size_action, *v), *v)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,21 +276,9 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
fmt::format(
|
fmt::format(
|
||||||
"Name [{}] [{}] [{}] [{}]",
|
"Name [{}] [{}] [{}] [{}]",
|
||||||
door->GetDoorName(),
|
door->GetDoorName(),
|
||||||
Saylink::Create(
|
Saylink::Silent("#door save", "Save"),
|
||||||
"#door save",
|
Saylink::Silent("#door changemodelqueue", "Change Model"),
|
||||||
true,
|
Saylink::Silent("#door setinclineinc", "Incline")
|
||||||
"Save"
|
|
||||||
),
|
|
||||||
Saylink::Create(
|
|
||||||
"#door changemodelqueue",
|
|
||||||
true,
|
|
||||||
"Change Model"
|
|
||||||
),
|
|
||||||
Saylink::Create(
|
|
||||||
"#door setinclineinc",
|
|
||||||
true,
|
|
||||||
"Incline"
|
|
||||||
)
|
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
c->Message(
|
c->Message(
|
||||||
@ -371,8 +359,8 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
||||||
Saylink::Create("#door showmodelszone", true, "local zone"),
|
Saylink::Silent("#door showmodelszone", "local zone"),
|
||||||
Saylink::Create("#door showmodelsglobal", true, "global")
|
Saylink::Silent("#door showmodelsglobal", "global")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -436,12 +424,11 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
std::vector<std::string> incline_negative_options;
|
std::vector<std::string> incline_negative_options;
|
||||||
for (auto incline_value: incline_values) {
|
for (auto incline_value: incline_values) {
|
||||||
incline_normal_options.emplace_back(
|
incline_normal_options.emplace_back(
|
||||||
Saylink::Create(
|
Saylink::Silent(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"#door setincline {}",
|
"#door setincline {}",
|
||||||
incline_value.first
|
incline_value.first
|
||||||
),
|
),
|
||||||
true,
|
|
||||||
incline_value.second
|
incline_value.second
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -450,12 +437,11 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
for (int incline_index = 0; incline_index <= 100; incline_index += 10) {
|
for (int incline_index = 0; incline_index <= 100; incline_index += 10) {
|
||||||
int incline_value = (incline_index == 0 ? 1 : incline_index);
|
int incline_value = (incline_index == 0 ? 1 : incline_index);
|
||||||
incline_positive_options.emplace_back(
|
incline_positive_options.emplace_back(
|
||||||
Saylink::Create(
|
Saylink::Silent(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"#door setinclineinc {}",
|
"#door setinclineinc {}",
|
||||||
incline_value
|
incline_value
|
||||||
),
|
),
|
||||||
true,
|
|
||||||
itoa(std::abs(incline_value))
|
itoa(std::abs(incline_value))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -464,12 +450,11 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
for (int incline_index = -100; incline_index <= 1; incline_index += 10) {
|
for (int incline_index = -100; incline_index <= 1; incline_index += 10) {
|
||||||
int incline_value = (incline_index == 0 ? -1 : incline_index);
|
int incline_value = (incline_index == 0 ? -1 : incline_index);
|
||||||
incline_negative_options.emplace_back(
|
incline_negative_options.emplace_back(
|
||||||
Saylink::Create(
|
Saylink::Silent(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"#door setinclineinc {}",
|
"#door setinclineinc {}",
|
||||||
incline_value
|
incline_value
|
||||||
),
|
),
|
||||||
true,
|
|
||||||
itoa(std::abs(incline_value))
|
itoa(std::abs(incline_value))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -562,8 +547,8 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
||||||
Saylink::Create("#door showmodelszone", true, "local zone"),
|
Saylink::Silent("#door showmodelszone", "local zone"),
|
||||||
Saylink::Create("#door showmodelsglobal", true, "global")
|
Saylink::Silent("#door showmodelsglobal", "global")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
c->Message(
|
c->Message(
|
||||||
@ -575,7 +560,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} | Shows available models in the current zone that you are in",
|
"{} | Shows available models in the current zone that you are in",
|
||||||
Saylink::Create("#door showmodelszone", true, "#door showmodelszone")
|
Saylink::Silent("#door showmodelszone", "#door showmodelszone")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -583,7 +568,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} | Shows available models globally by first listing all global model files",
|
"{} | Shows available models globally by first listing all global model files",
|
||||||
Saylink::Create("#door showmodelsglobal", true, "#door showmodelsglobal")
|
Saylink::Silent("#door showmodelsglobal", "#door showmodelsglobal")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -592,14 +577,14 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} - Brings up editing interface for selected door",
|
"{} - Brings up editing interface for selected door",
|
||||||
Saylink::Create("#door edit", true, "#door edit")
|
Saylink::Silent("#door edit", "#door edit")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{} - lists doors in zone",
|
"{} - lists doors in zone",
|
||||||
Saylink::Create("#list doors", true, "#list doors")
|
Saylink::Silent("#list doors", "#list doors")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -625,9 +610,8 @@ void DoorManipulation::DisplayObjectResultToClient(
|
|||||||
say_links.emplace_back(
|
say_links.emplace_back(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"[{}] ",
|
"[{}] ",
|
||||||
Saylink::Create(
|
Saylink::Silent(
|
||||||
fmt::format("#door model {}", g.object_name),
|
fmt::format("#door model {}", g.object_name),
|
||||||
true,
|
|
||||||
g.object_name
|
g.object_name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -673,9 +657,8 @@ void DoorManipulation::DisplayModelsFromFileResults(
|
|||||||
say_links.emplace_back(
|
say_links.emplace_back(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"[{}] ",
|
"[{}] ",
|
||||||
Saylink::Create(
|
Saylink::Silent(
|
||||||
fmt::format("#door showmodelsfromfile {}", g.file_from),
|
fmt::format("#door showmodelsfromfile {}", g.file_from),
|
||||||
true,
|
|
||||||
g.file_from
|
g.file_from
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user