Add #dz lockouts remove by event name

This commit is contained in:
hg 2020-05-28 00:24:07 -04:00
parent 9164073d14
commit 9b82cf57e4
5 changed files with 33 additions and 18 deletions

View File

@ -2065,9 +2065,10 @@ struct ServerExpeditionSetting_Struct {
uint8 enabled; uint8 enabled;
}; };
struct ServerExpeditionCharacterName_Struct { struct ServerExpeditionCharacterLockout_Struct {
char character_name[64]; char character_name[64];
char expedition_name[128]; char expedition_name[128];
char event_name[256];
}; };
struct ServerExpeditionCharacterID_Struct { struct ServerExpeditionCharacterID_Struct {

View File

@ -437,7 +437,7 @@ void ExpeditionMessage::HandleZoneMessage(ServerPacket* pack)
} }
case ServerOP_ExpeditionRemoveCharLockouts: case ServerOP_ExpeditionRemoveCharLockouts:
{ {
auto buf = reinterpret_cast<ServerExpeditionCharacterName_Struct*>(pack->pBuffer); auto buf = reinterpret_cast<ServerExpeditionCharacterLockout_Struct*>(pack->pBuffer);
client_list.SendPacket(buf->character_name, pack); client_list.SendPacket(buf->character_name, pack);
break; break;
} }

View File

@ -6932,11 +6932,19 @@ void command_dz(Client* c, const Seperator* sep)
{ {
if (strcasecmp(sep->arg[2], "remove") == 0 && sep->arg[3][0] != '\0') if (strcasecmp(sep->arg[2], "remove") == 0 && sep->arg[3][0] != '\0')
{ {
c->Message(Chat::White, fmt::format( if (sep->arg[5][0] == '\0')
"Removing [{}] lockouts on [{}].", sep->arg[4][0] ? sep->arg[4] : "all", sep->arg[3] {
).c_str()); c->Message(Chat::White, fmt::format(
"Removing [{}] lockouts on [{}].", sep->arg[4][0] ? sep->arg[4] : "all", sep->arg[3]
Expedition::RemoveAllCharacterLockouts(sep->arg[3], sep->arg[4]); ).c_str());
}
else
{
c->Message(Chat::White, fmt::format(
"Removing [{}]:[{}] lockout on [{}].", sep->arg[4], sep->arg[5], sep->arg[3]
).c_str());
}
Expedition::RemoveCharacterLockouts(sep->arg[3], sep->arg[4], sep->arg[5]);
} }
} }
else else
@ -6948,6 +6956,7 @@ void command_dz(Client* c, const Seperator* sep)
c->Message(Chat::White, "#dz list [all] - list dynamic zone instances from database -- 'all' includes expired"); 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> - delete all of character's expedition lockouts");
c->Message(Chat::White, "#dz lockouts remove <char_name> \"<expedition_name>\" - delete lockouts by expedition"); c->Message(Chat::White, "#dz lockouts remove <char_name> \"<expedition_name>\" - delete lockouts by expedition");
c->Message(Chat::White, "#dz lockouts remove <char_name> \"<expedition_name>\" \"<event_name>\" - delete lockout by expedition event");
} }
} }

View File

@ -1556,17 +1556,15 @@ void Expedition::SendWorldGetOnlineMembers()
worldserver.SendPacket(pack.get()); worldserver.SendPacket(pack.get());
} }
void Expedition::RemoveAllCharacterLockouts(std::string character_name, std::string expedition_name) void Expedition::RemoveCharacterLockouts(
std::string character_name, std::string expedition_name, std::string event_name)
{ {
uint32_t pack_size = sizeof(ServerExpeditionCharacterName_Struct); uint32_t pack_size = sizeof(ServerExpeditionCharacterLockout_Struct);
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionRemoveCharLockouts, pack_size)); auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionRemoveCharLockouts, pack_size));
auto buf = reinterpret_cast<ServerExpeditionCharacterName_Struct*>(pack->pBuffer); auto buf = reinterpret_cast<ServerExpeditionCharacterLockout_Struct*>(pack->pBuffer);
strn0cpy(buf->character_name, character_name.c_str(), sizeof(buf->character_name)); strn0cpy(buf->character_name, character_name.c_str(), sizeof(buf->character_name));
buf->expedition_name[0] = '\0'; strn0cpy(buf->expedition_name, expedition_name.c_str(), sizeof(buf->expedition_name));
if (!expedition_name.empty()) strn0cpy(buf->event_name, event_name.c_str(), sizeof(buf->event_name));
{
strn0cpy(buf->expedition_name, expedition_name.c_str(), sizeof(buf->expedition_name));
}
worldserver.SendPacket(pack.get()); worldserver.SendPacket(pack.get());
} }
@ -1788,11 +1786,18 @@ void Expedition::HandleWorldMessage(ServerPacket* pack)
} }
case ServerOP_ExpeditionRemoveCharLockouts: case ServerOP_ExpeditionRemoveCharLockouts:
{ {
auto buf = reinterpret_cast<ServerExpeditionCharacterName_Struct*>(pack->pBuffer); auto buf = reinterpret_cast<ServerExpeditionCharacterLockout_Struct*>(pack->pBuffer);
Client* client = entity_list.GetClientByName(buf->character_name); Client* client = entity_list.GetClientByName(buf->character_name);
if (client) if (client)
{ {
client->RemoveAllExpeditionLockouts(buf->expedition_name); if (buf->event_name[0] != '\0')
{
client->RemoveExpeditionLockout(buf->expedition_name, buf->event_name, true);
}
else
{
client->RemoveAllExpeditionLockouts(buf->expedition_name);
}
} }
break; break;
} }

View File

@ -84,7 +84,7 @@ public:
static Expedition* FindCachedExpeditionByCharacterName(const std::string& char_name); static Expedition* FindCachedExpeditionByCharacterName(const std::string& char_name);
static Expedition* FindCachedExpeditionByID(uint32_t expedition_id); static Expedition* FindCachedExpeditionByID(uint32_t expedition_id);
static Expedition* FindExpeditionByInstanceID(uint32_t instance_id); static Expedition* FindExpeditionByInstanceID(uint32_t instance_id);
static void RemoveAllCharacterLockouts(std::string character_name, std::string expedition_name = {}); static void RemoveCharacterLockouts(std::string character_name, std::string expedition_name = {}, std::string event_name = {});
static void HandleWorldMessage(ServerPacket* pack); static void HandleWorldMessage(ServerPacket* pack);
uint32_t GetID() const { return m_id; } uint32_t GetID() const { return m_id; }