mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add api to update expedition expire time
Add SetSecondsRemaining method to set expire time on expedition
This commit is contained in:
parent
2c2c2ac5ee
commit
b965a165b1
@ -162,6 +162,7 @@
|
||||
#define ServerOP_ExpeditionMembersRemoved 0x0412
|
||||
#define ServerOP_ExpeditionDzDuration 0x0413
|
||||
#define ServerOP_ExpeditionLockoutDuration 0x0414
|
||||
#define ServerOP_ExpeditionSecondsRemaining 0x0415
|
||||
|
||||
#define ServerOP_DzCharacterChange 0x0450
|
||||
#define ServerOP_DzRemoveAllCharacters 0x0451
|
||||
|
||||
@ -157,6 +157,18 @@ void ExpeditionCache::RemoveAllMembers(uint32_t expedition_id)
|
||||
}
|
||||
}
|
||||
|
||||
void ExpeditionCache::SetSecondsRemaining(uint32_t expedition_id, uint32_t seconds_remaining)
|
||||
{
|
||||
auto it = std::find_if(m_expeditions.begin(), m_expeditions.end(), [&](const Expedition& expedition) {
|
||||
return expedition.GetID() == expedition_id;
|
||||
});
|
||||
|
||||
if (it != m_expeditions.end())
|
||||
{
|
||||
it->UpdateDzSecondsRemaining(seconds_remaining);
|
||||
}
|
||||
}
|
||||
|
||||
void ExpeditionCache::Process()
|
||||
{
|
||||
if (!m_process_throttle_timer.Check())
|
||||
@ -448,6 +460,12 @@ void ExpeditionMessage::HandleZoneMessage(ServerPacket* pack)
|
||||
ExpeditionMessage::RequestInvite(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ExpeditionSecondsRemaining:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerExpeditionUpdateDuration_Struct*>(pack->pBuffer);
|
||||
expedition_cache.SetSecondsRemaining(buf->expedition_id, buf->new_duration_seconds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +60,7 @@ public:
|
||||
void LoadActiveExpeditions();
|
||||
void MemberChange(uint32_t expedition_id, uint32_t character_id, bool remove);
|
||||
void RemoveAllMembers(uint32_t expedition_id);
|
||||
void SetSecondsRemaining(uint32_t expedition_id, uint32_t seconds_remaining);
|
||||
void Process();
|
||||
|
||||
private:
|
||||
|
||||
@ -1385,6 +1385,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
case ServerOP_ExpeditionCharacterLockout:
|
||||
case ServerOP_ExpeditionSaveInvite:
|
||||
case ServerOP_ExpeditionRequestInvite:
|
||||
case ServerOP_ExpeditionSecondsRemaining:
|
||||
{
|
||||
ExpeditionMessage::HandleZoneMessage(pack);
|
||||
break;
|
||||
|
||||
@ -535,6 +535,9 @@ void DynamicZone::SetUpdatedDuration(uint32_t new_duration)
|
||||
m_duration = std::chrono::seconds(new_duration);
|
||||
m_expire_time = m_start_time + m_duration;
|
||||
|
||||
LogDynamicZones("Updated zone [{}]:[{}] seconds remaining: [{}]",
|
||||
m_zone_id, m_instance_id, GetSecondsRemaining());
|
||||
|
||||
if (zone && IsCurrentZoneDzInstance())
|
||||
{
|
||||
zone->SetInstanceTimer(GetSecondsRemaining());
|
||||
|
||||
@ -1736,6 +1736,16 @@ void Expedition::SendWorldCharacterLockout(
|
||||
worldserver.SendPacket(pack.get());
|
||||
}
|
||||
|
||||
void Expedition::SendWorldSetSecondsRemaining(uint32_t seconds_remaining)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionUpdateDuration_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionSecondsRemaining, pack_size));
|
||||
auto buf = reinterpret_cast<ServerExpeditionUpdateDuration_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->new_duration_seconds = seconds_remaining;
|
||||
worldserver.SendPacket(pack.get());
|
||||
}
|
||||
|
||||
void Expedition::AddLockoutByCharacterID(
|
||||
uint32_t character_id, const std::string& expedition_name, const std::string& event_name,
|
||||
uint32_t seconds, const std::string& uuid)
|
||||
@ -2074,7 +2084,7 @@ void Expedition::HandleWorldMessage(ServerPacket* pack)
|
||||
auto expedition = Expedition::FindCachedExpeditionByID(buf->expedition_id);
|
||||
if (expedition)
|
||||
{
|
||||
expedition->SetDzDuration(buf->new_duration_seconds);
|
||||
expedition->UpdateDzDuration(buf->new_duration_seconds);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2125,6 +2135,11 @@ void Expedition::SetDzSafeReturn(const std::string& zone_name, float x, float y,
|
||||
SetDzSafeReturn(zone_id, x, y, z, heading, update_db);
|
||||
}
|
||||
|
||||
void Expedition::SetDzSecondsRemaining(uint32_t seconds_remaining)
|
||||
{
|
||||
SendWorldSetSecondsRemaining(seconds_remaining); // async
|
||||
}
|
||||
|
||||
void Expedition::SetDzZoneInLocation(float x, float y, float z, float heading, bool update_db)
|
||||
{
|
||||
DynamicZoneLocation location{ 0, x, y, z, heading };
|
||||
|
||||
@ -158,8 +158,8 @@ public:
|
||||
void SetDzCompass(const std::string& zone_name, float x, float y, float z, bool update_db = false);
|
||||
void SetDzSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
||||
void SetDzSafeReturn(const std::string& zone_name, float x, float y, float z, float heading, bool update_db = false);
|
||||
void SetDzSecondsRemaining(uint32_t seconds_remaining);
|
||||
void SetDzZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
||||
void SetDzDuration(uint32_t new_duration) { m_dynamiczone.SetUpdatedDuration(new_duration); }
|
||||
|
||||
static const int32_t REPLAY_TIMER_ID;
|
||||
static const int32_t EVENT_TIMER_ID;
|
||||
@ -202,9 +202,11 @@ private:
|
||||
void SendWorldMemberStatus(uint32_t character_id, ExpeditionMemberStatus status);
|
||||
void SendWorldMemberSwapped(const std::string& remove_char_name, uint32_t remove_char_id,
|
||||
const std::string& add_char_name, uint32_t add_char_id);
|
||||
void SendWorldSetSecondsRemaining(uint32_t seconds_remaining);
|
||||
void SendWorldSettingChanged(uint16_t server_opcode, bool setting_value);
|
||||
void TryAddClient(Client* add_client, const std::string& inviter_name,
|
||||
const std::string& swap_remove_name, Client* leader_client = nullptr);
|
||||
void UpdateDzDuration(uint32_t new_duration) { m_dynamiczone.SetUpdatedDuration(new_duration); }
|
||||
void UpdateMemberStatus(uint32_t update_character_id, ExpeditionMemberStatus status);
|
||||
|
||||
ExpeditionMember GetMemberData(uint32_t character_id);
|
||||
|
||||
@ -206,6 +206,12 @@ void Lua_Expedition::SetSafeReturn(std::string zone_name, float x, float y, floa
|
||||
self->SetDzSafeReturn(zone_name, x, y, z, heading, true);
|
||||
}
|
||||
|
||||
void Lua_Expedition::SetSecondsRemaining(uint32_t seconds_remaining)
|
||||
{
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetDzSecondsRemaining(seconds_remaining);
|
||||
}
|
||||
|
||||
void Lua_Expedition::SetZoneInLocation(float x, float y, float z, float heading) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->SetDzZoneInLocation(x, y, z, heading, true);
|
||||
@ -258,6 +264,7 @@ luabind::scope lua_register_expedition() {
|
||||
.def("SetReplayLockoutOnMemberJoin", (void(Lua_Expedition::*)(bool))&Lua_Expedition::SetReplayLockoutOnMemberJoin)
|
||||
.def("SetSafeReturn", (void(Lua_Expedition::*)(uint32_t, float, float, float, float))&Lua_Expedition::SetSafeReturn)
|
||||
.def("SetSafeReturn", (void(Lua_Expedition::*)(std::string, float, float, float, float))&Lua_Expedition::SetSafeReturn)
|
||||
.def("SetSecondsRemaining", &Lua_Expedition::SetSecondsRemaining)
|
||||
.def("SetZoneInLocation", (void(Lua_Expedition::*)(float, float, float, float))&Lua_Expedition::SetZoneInLocation)
|
||||
.def("UpdateLockoutDuration", (void(Lua_Expedition::*)(std::string, uint32_t))&Lua_Expedition::UpdateLockoutDuration)
|
||||
.def("UpdateLockoutDuration", (void(Lua_Expedition::*)(std::string, uint32_t, bool))&Lua_Expedition::UpdateLockoutDuration);
|
||||
|
||||
@ -85,6 +85,7 @@ public:
|
||||
void SetReplayLockoutOnMemberJoin(bool enable);
|
||||
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading);
|
||||
void SetSafeReturn(std::string zone_name, float x, float y, float z, float heading);
|
||||
void SetSecondsRemaining(uint32_t seconds_remaining);
|
||||
void SetZoneInLocation(float x, float y, float z, float heading);
|
||||
void UpdateLockoutDuration(std::string event_name, uint32_t duration);
|
||||
void UpdateLockoutDuration(std::string event_name, uint32_t duration, bool members_only);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user