Add #dz expedition unlock command

Add expedition name and zone to #dz expedition list

Adjust #dz list output
This commit is contained in:
hg 2020-09-27 17:11:36 -04:00
parent 6266aa86a4
commit 18dd9e6637

View File

@ -6844,10 +6844,14 @@ void command_dz(Client* c, const Seperator* sep)
auto seconds = expedition.second->GetDynamicZone().GetSecondsRemaining();
c->Message(Chat::White, fmt::format(
"Expedition id: [{}]: leader: [{}] instance id: [{}] members: [{}] remaining: [{:02}:{:02}:{:02}]",
"Expedition id: [{}] name: [{}] leader: [{}] zone: [{}]:[{}]:[{}]:[{}] members: [{}] remaining: [{:02}:{:02}:{:02}]",
expedition.second->GetID(),
expedition.second->GetName(),
expedition.second->GetLeaderName(),
ZoneName(expedition.second->GetDynamicZone().GetZoneID()),
expedition.second->GetDynamicZone().GetZoneID(),
expedition.second->GetInstanceID(),
expedition.second->GetDynamicZone().GetZoneVersion(),
expedition.second->GetMemberCount(),
seconds / 3600, // hours
(seconds / 60) % 60, // minutes
@ -6868,9 +6872,8 @@ void command_dz(Client* c, const Seperator* sep)
auto expedition = Expedition::FindCachedExpeditionByID(expedition_id);
if (expedition)
{
c->Message(Chat::White, fmt::format(
"Destroying expedition [{}] ({})", expedition_id, expedition->GetName()).c_str()
);
c->Message(Chat::White, fmt::format("Destroying expedition [{}] ({})",
expedition_id, expedition->GetName()).c_str());
expedition->RemoveAllMembers();
}
else
@ -6878,6 +6881,20 @@ void command_dz(Client* c, const Seperator* sep)
c->Message(Chat::Red, fmt::format("Failed to destroy expedition [{}]", sep->arg[3]).c_str());
}
}
else if (strcasecmp(sep->arg[2], "unlock") == 0 && sep->IsNumber(3))
{
auto expedition_id = std::strtoul(sep->arg[3], nullptr, 10);
auto expedition = Expedition::FindCachedExpeditionByID(expedition_id);
if (expedition)
{
c->Message(Chat::White, fmt::format("Unlocking expedition [{}]", expedition_id).c_str());
expedition->SetLocked(false, ExpeditionLockMessage::None, true);
}
else
{
c->Message(Chat::Red, fmt::format("Failed to find expedition [{}]", sep->arg[3]).c_str());
}
}
}
else if (strcasecmp(sep->arg[1], "list") == 0)
{
@ -6914,10 +6931,10 @@ void command_dz(Client* c, const Seperator* sep)
if (!is_expired || strcasecmp(sep->arg[2], "all") == 0)
{
c->Message(Chat::White, fmt::format(
"type: [{}] instance: [{}] zone: [{}] version: [{}] members: [{}] remaining: [{:02}:{:02}:{:02}]",
"type: [{}] zone: [{}]:[{}]:[{}] members: [{}] remaining: [{:02}:{:02}:{:02}]",
strtoul(row[0], nullptr, 10),
strtoul(row[1], nullptr, 10),
strtoul(row[2], nullptr, 10),
strtoul(row[1], nullptr, 10),
strtoul(row[3], nullptr, 10),
strtoul(row[6], nullptr, 10),
seconds / 3600, // hours
@ -6980,6 +6997,7 @@ void command_dz(Client* c, const Seperator* sep)
c->Message(Chat::White, "#dz expedition list - list expeditions in current zone cache");
c->Message(Chat::White, "#dz expedition reload - reload expedition zone cache from database");
c->Message(Chat::White, "#dz expedition destroy <expedition_id> - destroy expedition globally (must be in cache)");
c->Message(Chat::White, "#dz expedition unlock <expedition_id> - unlock expedition");
c->Message(Chat::White, "#dz list [all] - list dynamic zone instances from database -- 'all' includes expired");
c->Message(Chat::White, "#dz lockouts remove <char_name> - delete all of character's expedition lockouts");
c->Message(Chat::White, "#dz lockouts remove <char_name> \"<expedition_name>\" - delete lockouts by expedition");