mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
Remove replay timer argument to CreateExpedition
Breaking change to the current API has_replay_timer column removed from expedition_details table This argument is unnecessary and just creates confusion. Expedition replay timers use a hardcoded name precisely for this purpose and those lockouts are already being checked on creation requests.
This commit is contained in:
parent
892556e26d
commit
f23ca8055f
@ -5,7 +5,6 @@ CREATE TABLE `expedition_details` (
|
||||
`leader_id` INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`min_players` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`max_players` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`has_replay_timer` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
|
||||
`add_replay_on_join` TINYINT(3) UNSIGNED NOT NULL DEFAULT 1,
|
||||
`is_locked` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@ -9593,10 +9593,10 @@ Expedition* Client::CreateExpedition(DynamicZone& dz_instance, ExpeditionRequest
|
||||
|
||||
Expedition* Client::CreateExpedition(
|
||||
std::string zone_name, uint32 version, uint32 duration, std::string expedition_name,
|
||||
uint32 min_players, uint32 max_players, bool has_replay_timer, bool disable_messages)
|
||||
uint32 min_players, uint32 max_players, bool disable_messages)
|
||||
{
|
||||
DynamicZone dz_instance{ zone_name, version, duration, DynamicZoneType::Expedition };
|
||||
ExpeditionRequest request{ expedition_name, min_players, max_players, has_replay_timer, disable_messages };
|
||||
ExpeditionRequest request{ expedition_name, min_players, max_players, disable_messages };
|
||||
return Expedition::TryCreate(this, dz_instance, request);
|
||||
}
|
||||
|
||||
|
||||
@ -1122,7 +1122,7 @@ public:
|
||||
Expedition* CreateExpedition(DynamicZone& dz_instance, ExpeditionRequest& request);
|
||||
Expedition* CreateExpedition(
|
||||
std::string zone_name, uint32 version, uint32 duration, std::string expedition_name,
|
||||
uint32 min_players, uint32 max_players, bool has_replay_timer = false, bool disable_messages = false);
|
||||
uint32 min_players, uint32 max_players, bool disable_messages = false);
|
||||
Expedition* GetExpedition() const;
|
||||
uint32 GetExpeditionID() const { return m_expedition_id; }
|
||||
const ExpeditionLockoutTimer* GetExpeditionLockout(
|
||||
|
||||
@ -47,15 +47,14 @@ const uint32_t Expedition::EVENT_TIMER_ID = 1;
|
||||
|
||||
Expedition::Expedition(
|
||||
uint32_t id, const DynamicZone& dynamic_zone, std::string expedition_name,
|
||||
const ExpeditionMember& leader, uint32_t min_players, uint32_t max_players, bool replay_timer
|
||||
const ExpeditionMember& leader, uint32_t min_players, uint32_t max_players
|
||||
) :
|
||||
m_id(id),
|
||||
m_dynamiczone(dynamic_zone),
|
||||
m_expedition_name(expedition_name),
|
||||
m_leader(leader),
|
||||
m_min_players(min_players),
|
||||
m_max_players(max_players),
|
||||
m_has_replay_timer(replay_timer)
|
||||
m_max_players(max_players)
|
||||
{
|
||||
}
|
||||
|
||||
@ -98,8 +97,7 @@ Expedition* Expedition::TryCreate(
|
||||
request.GetExpeditionName(),
|
||||
leader.char_id,
|
||||
request.GetMinPlayers(),
|
||||
request.GetMaxPlayers(),
|
||||
request.HasReplayTimer()
|
||||
request.GetMaxPlayers()
|
||||
);
|
||||
|
||||
if (expedition_id)
|
||||
@ -112,8 +110,7 @@ Expedition* Expedition::TryCreate(
|
||||
request.GetExpeditionName(),
|
||||
leader,
|
||||
request.GetMinPlayers(),
|
||||
request.GetMaxPlayers(),
|
||||
request.HasReplayTimer()
|
||||
request.GetMaxPlayers()
|
||||
));
|
||||
|
||||
LogExpeditions(
|
||||
@ -189,8 +186,7 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
|
||||
row[col::expedition_name], // expedition name
|
||||
ExpeditionMember{leader_id, row[col::leader_name]}, // expedition leader id, name
|
||||
strtoul(row[col::min_players], nullptr, 10), // min_players
|
||||
strtoul(row[col::max_players], nullptr, 10), // max_players
|
||||
(strtoul(row[col::has_replay_timer], nullptr, 10) != 0) // has_replay_timer
|
||||
strtoul(row[col::max_players], nullptr, 10) // max_players
|
||||
));
|
||||
|
||||
bool add_replay_on_join = (strtoul(row[col::add_replay_on_join], nullptr, 10) != 0);
|
||||
@ -697,7 +693,7 @@ bool Expedition::ProcessAddConflicts(Client* leader_client, Client* add_client,
|
||||
// client with a replay lockout is allowed only if they were a previous member
|
||||
auto member_iter = m_member_id_history.find(add_client->CharacterID());
|
||||
bool was_member = (member_iter != m_member_id_history.end());
|
||||
if (!was_member && m_has_replay_timer)
|
||||
if (!was_member)
|
||||
{
|
||||
auto replay_lockout = add_client->GetExpeditionLockout(m_expedition_name, DZ_REPLAY_TIMER_NAME);
|
||||
if (replay_lockout)
|
||||
@ -815,7 +811,7 @@ void Expedition::DzInviteResponse(Client* add_client, bool accepted, const std::
|
||||
{
|
||||
// replay timers are optionally added to new members immediately on
|
||||
// join with a fresh expire time using the original duration.
|
||||
if (m_has_replay_timer && lockout.IsReplayTimer())
|
||||
if (lockout.IsReplayTimer())
|
||||
{
|
||||
if (m_add_replay_on_join)
|
||||
{
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
Expedition() = delete;
|
||||
Expedition(
|
||||
uint32_t id, const DynamicZone& dz, std::string expedition_name, const ExpeditionMember& leader,
|
||||
uint32_t min_players, uint32_t max_players, bool replay_timer);
|
||||
uint32_t min_players, uint32_t max_players);
|
||||
|
||||
static Expedition* TryCreate(Client* requester, DynamicZone& dynamiczone, ExpeditionRequest& request);
|
||||
|
||||
@ -178,7 +178,6 @@ private:
|
||||
uint32_t m_min_players = 0;
|
||||
uint32_t m_max_players = 0;
|
||||
bool m_is_locked = false;
|
||||
bool m_has_replay_timer = false;
|
||||
bool m_add_replay_on_join = true;
|
||||
std::string m_expedition_name;
|
||||
DynamicZone m_dynamiczone { DynamicZoneType::Expedition };
|
||||
|
||||
@ -27,16 +27,16 @@
|
||||
|
||||
uint32_t ExpeditionDatabase::InsertExpedition(
|
||||
uint32_t instance_id, const std::string& expedition_name, uint32_t leader_id,
|
||||
uint32_t min_players, uint32_t max_players, bool has_replay_lockout)
|
||||
uint32_t min_players, uint32_t max_players)
|
||||
{
|
||||
LogExpeditionsDetail("Inserting new expedition [{}] leader [{}]", expedition_name, leader_id);
|
||||
|
||||
std::string query = fmt::format(SQL(
|
||||
INSERT INTO expedition_details
|
||||
(instance_id, expedition_name, leader_id, min_players, max_players, has_replay_timer)
|
||||
(instance_id, expedition_name, leader_id, min_players, max_players)
|
||||
VALUES
|
||||
({}, '{}', {}, {}, {}, {});
|
||||
), instance_id, expedition_name, leader_id, min_players, max_players, has_replay_lockout);
|
||||
({}, '{}', {}, {}, {});
|
||||
), instance_id, expedition_name, leader_id, min_players, max_players);
|
||||
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
@ -58,7 +58,6 @@ std::string ExpeditionDatabase::LoadExpeditionsSelectQuery()
|
||||
expedition_details.leader_id,
|
||||
expedition_details.min_players,
|
||||
expedition_details.max_players,
|
||||
expedition_details.has_replay_timer,
|
||||
expedition_details.add_replay_on_join,
|
||||
expedition_details.is_locked,
|
||||
character_data.name leader_name,
|
||||
|
||||
@ -37,7 +37,7 @@ namespace ExpeditionDatabase
|
||||
{
|
||||
uint32_t InsertExpedition(
|
||||
uint32_t instance_id, const std::string& expedition_name, uint32_t leader_id,
|
||||
uint32_t min_players, uint32_t max_players, bool has_replay_lockout);
|
||||
uint32_t min_players, uint32_t max_players);
|
||||
std::string LoadExpeditionsSelectQuery();
|
||||
MySQLRequestResult LoadExpedition(uint32_t expedition_id);
|
||||
MySQLRequestResult LoadAllExpeditions();
|
||||
@ -84,7 +84,6 @@ namespace LoadExpeditionColumns
|
||||
leader_id,
|
||||
min_players,
|
||||
max_players,
|
||||
has_replay_timer,
|
||||
add_replay_on_join,
|
||||
is_locked,
|
||||
leader_name,
|
||||
|
||||
@ -38,13 +38,11 @@ struct ExpeditionRequestConflict
|
||||
};
|
||||
|
||||
ExpeditionRequest::ExpeditionRequest(
|
||||
std::string expedition_name, uint32_t min_players, uint32_t max_players,
|
||||
bool has_replay_timer, bool disable_messages
|
||||
std::string expedition_name, uint32_t min_players, uint32_t max_players, bool disable_messages
|
||||
) :
|
||||
m_expedition_name(expedition_name),
|
||||
m_min_players(min_players),
|
||||
m_max_players(max_players),
|
||||
m_has_replay_timer(has_replay_timer),
|
||||
m_disable_messages(disable_messages)
|
||||
{
|
||||
}
|
||||
@ -183,7 +181,7 @@ bool ExpeditionRequest::LoadLeaderLockouts()
|
||||
m_lockouts.emplace(lockout.GetEventName(), lockout);
|
||||
|
||||
// on live if leader has a replay lockout it never bothers checking for event conflicts
|
||||
if (m_check_event_lockouts && m_has_replay_timer && lockout.IsReplayTimer())
|
||||
if (m_check_event_lockouts && lockout.IsReplayTimer())
|
||||
{
|
||||
m_check_event_lockouts = false;
|
||||
}
|
||||
@ -260,23 +258,20 @@ bool ExpeditionRequest::CheckMembersForConflicts(const std::vector<std::string>&
|
||||
character_id, lockout.GetEventName(), lockout.GetSecondsRemaining(), leeway_seconds
|
||||
);
|
||||
}
|
||||
else
|
||||
else if (lockout.IsReplayTimer())
|
||||
{
|
||||
// replay timer conflict messages always show up before event conflicts
|
||||
if (/*m_has_replay_timer && */lockout.IsReplayTimer())
|
||||
has_conflicts = true;
|
||||
SendLeaderMemberReplayLockout(character_name, lockout, is_solo);
|
||||
}
|
||||
else if (m_check_event_lockouts && character_id != m_leader_id)
|
||||
{
|
||||
if (m_lockouts.find(lockout.GetEventName()) == m_lockouts.end())
|
||||
{
|
||||
// leader doesn't have this lockout. queue instead of messaging
|
||||
// now so message comes after any replay lockout messages
|
||||
has_conflicts = true;
|
||||
SendLeaderMemberReplayLockout(character_name, lockout, is_solo);
|
||||
}
|
||||
else if (m_check_event_lockouts && character_id != m_leader_id)
|
||||
{
|
||||
if (m_lockouts.find(lockout.GetEventName()) == m_lockouts.end())
|
||||
{
|
||||
// leader doesn't have this lockout. queue instead of messaging
|
||||
// now so message comes after any replay lockout messages
|
||||
has_conflicts = true;
|
||||
member_lockout_conflicts.emplace_back(ExpeditionRequestConflict{character_name, lockout});
|
||||
}
|
||||
member_lockout_conflicts.emplace_back(ExpeditionRequestConflict{character_name, lockout});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ class ExpeditionRequest
|
||||
public:
|
||||
ExpeditionRequest(
|
||||
std::string expedition_name, uint32_t min_players, uint32_t max_players,
|
||||
bool has_replay_timer, bool disable_messages = false);
|
||||
bool disable_messages = false);
|
||||
|
||||
bool Validate(Client* requester);
|
||||
|
||||
@ -49,7 +49,6 @@ public:
|
||||
const std::string& GetLeaderName() const { return m_leader_name; }
|
||||
uint32_t GetMinPlayers() const { return m_min_players; }
|
||||
uint32_t GetMaxPlayers() const { return m_max_players; }
|
||||
bool HasReplayTimer() const { return m_has_replay_timer; }
|
||||
std::vector<ExpeditionMember> GetMembers() const { return m_members; }
|
||||
std::unordered_map<std::string, ExpeditionLockoutTimer> GetLockouts() const { return m_lockouts; }
|
||||
|
||||
@ -73,7 +72,6 @@ private:
|
||||
uint32_t m_max_players = 0;
|
||||
bool m_check_event_lockouts = true;
|
||||
bool m_disable_messages = false;
|
||||
bool m_has_replay_timer = false;
|
||||
std::string m_expedition_name;
|
||||
std::string m_leader_name;
|
||||
std::vector<ExpeditionMember> m_members;
|
||||
|
||||
@ -1701,20 +1701,14 @@ Lua_Expedition Lua_Client::CreateExpedition(luabind::object dz_info, luabind::ob
|
||||
std::string expedition_name = luabind::object_cast<std::string>(expedition_info[1]);
|
||||
uint32_t min_players = luabind::object_cast<uint32_t>(expedition_info[2]);
|
||||
uint32_t max_players = luabind::object_cast<uint32_t>(expedition_info[3]);
|
||||
bool has_replay_timer = false;
|
||||
bool disable_messages = false;
|
||||
|
||||
if (luabind::type(expedition_info[4]) == LUA_TBOOLEAN)
|
||||
{
|
||||
has_replay_timer = luabind::object_cast<bool>(expedition_info[4]);
|
||||
disable_messages = luabind::object_cast<bool>(expedition_info[4]);
|
||||
}
|
||||
|
||||
if (luabind::type(expedition_info[5]) == LUA_TBOOLEAN)
|
||||
{
|
||||
disable_messages = luabind::object_cast<bool>(expedition_info[5]);
|
||||
}
|
||||
|
||||
ExpeditionRequest request{ expedition_name, min_players, max_players, has_replay_timer, disable_messages };
|
||||
ExpeditionRequest request{ expedition_name, min_players, max_players, disable_messages };
|
||||
|
||||
return self->CreateExpedition(dz, request);
|
||||
}
|
||||
@ -1724,14 +1718,9 @@ Lua_Expedition Lua_Client::CreateExpedition(std::string zone_name, uint32 versio
|
||||
return self->CreateExpedition(zone_name, version, duration, expedition_name, min_players, max_players);
|
||||
}
|
||||
|
||||
Lua_Expedition Lua_Client::CreateExpedition(std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players, bool has_replay_timer) {
|
||||
Lua_Expedition Lua_Client::CreateExpedition(std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players, bool disable_messages) {
|
||||
Lua_Safe_Call_Class(Lua_Expedition);
|
||||
return self->CreateExpedition(zone_name, version, duration, expedition_name, min_players, max_players, has_replay_timer);
|
||||
}
|
||||
|
||||
Lua_Expedition Lua_Client::CreateExpedition(std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players, bool has_replay_timer, bool disable_messages) {
|
||||
Lua_Safe_Call_Class(Lua_Expedition);
|
||||
return self->CreateExpedition(zone_name, version, duration, expedition_name, min_players, max_players, has_replay_timer, disable_messages);
|
||||
return self->CreateExpedition(zone_name, version, duration, expedition_name, min_players, max_players, disable_messages);
|
||||
}
|
||||
|
||||
Lua_Expedition Lua_Client::GetExpedition() {
|
||||
@ -2124,7 +2113,6 @@ luabind::scope lua_register_client() {
|
||||
.def("CreateExpedition", (Lua_Expedition(Lua_Client::*)(luabind::object, luabind::object))&Lua_Client::CreateExpedition)
|
||||
.def("CreateExpedition", (Lua_Expedition(Lua_Client::*)(std::string, uint32, uint32, std::string, uint32, uint32))&Lua_Client::CreateExpedition)
|
||||
.def("CreateExpedition", (Lua_Expedition(Lua_Client::*)(std::string, uint32, uint32, std::string, uint32, uint32, bool))&Lua_Client::CreateExpedition)
|
||||
.def("CreateExpedition", (Lua_Expedition(Lua_Client::*)(std::string, uint32, uint32, std::string, uint32, uint32, bool, bool))&Lua_Client::CreateExpedition)
|
||||
.def("GetExpedition", (Lua_Expedition(Lua_Client::*)(void))&Lua_Client::GetExpedition)
|
||||
.def("GetExpeditionLockouts", (luabind::object(Lua_Client::*)(lua_State* L))&Lua_Client::GetExpeditionLockouts)
|
||||
.def("GetExpeditionLockouts", (luabind::object(Lua_Client::*)(lua_State* L, std::string))&Lua_Client::GetExpeditionLockouts)
|
||||
|
||||
@ -341,8 +341,7 @@ public:
|
||||
|
||||
Lua_Expedition CreateExpedition(luabind::object dz_info, luabind::object expedition_info);
|
||||
Lua_Expedition CreateExpedition(std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players);
|
||||
Lua_Expedition CreateExpedition(std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players, bool has_replay_timer);
|
||||
Lua_Expedition CreateExpedition(std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players, bool has_replay_timer, bool disable_messages);
|
||||
Lua_Expedition CreateExpedition(std::string zone_name, uint32 version, uint32 duration, std::string expedition_name, uint32 min_players, uint32 max_players, bool disable_messages);
|
||||
Lua_Expedition GetExpedition();
|
||||
luabind::object GetExpeditionLockouts(lua_State* L);
|
||||
luabind::object GetExpeditionLockouts(lua_State* L, std::string expedition_name);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user