mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Add expedition lock messages
This commit is contained in:
parent
b5db40cba6
commit
8e52dd0579
@ -2051,6 +2051,14 @@ struct ServerExpeditionLockout_Struct {
|
|||||||
char event_name[256];
|
char event_name[256];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ServerExpeditionLockState_Struct {
|
||||||
|
uint32 expedition_id;
|
||||||
|
uint32 sender_zone_id;
|
||||||
|
uint16 sender_instance_id;
|
||||||
|
uint8 enabled;
|
||||||
|
uint8 lock_msg; // 0: none, 1: closing 2: trial begin
|
||||||
|
};
|
||||||
|
|
||||||
struct ServerExpeditionSetting_Struct {
|
struct ServerExpeditionSetting_Struct {
|
||||||
uint32 expedition_id;
|
uint32 expedition_id;
|
||||||
uint32 sender_zone_id;
|
uint32 sender_zone_id;
|
||||||
|
|||||||
@ -42,6 +42,9 @@ const char* const DZADD_INVITE_WARNING_TIMER = "%s - %sD:%sH:%sM";
|
|||||||
const char* const KICKPLAYERS_EVERYONE = "Everyone";
|
const char* const KICKPLAYERS_EVERYONE = "Everyone";
|
||||||
// message string 8312 added in September 08 2020 Test patch (used by both dz and shared tasks)
|
// message string 8312 added in September 08 2020 Test patch (used by both dz and shared tasks)
|
||||||
const char* const CREATE_NOT_ALL_ADDED = "Not all players in your {} were added to the {}. The {} can take a maximum of {} players, and your {} has {}.";
|
const char* const CREATE_NOT_ALL_ADDED = "Not all players in your {} were added to the {}. The {} can take a maximum of {} players, and your {} has {}.";
|
||||||
|
// various expeditions re-use these strings when locking
|
||||||
|
constexpr char LOCK_CLOSE[] = "Your expedition is nearing its close. You cannot bring any additional people into your expedition at this time.";
|
||||||
|
constexpr char LOCK_BEGIN[] = "The trial has begun. You cannot bring any additional people into your expedition at this time.";
|
||||||
|
|
||||||
const int32_t Expedition::REPLAY_TIMER_ID = -1;
|
const int32_t Expedition::REPLAY_TIMER_ID = -1;
|
||||||
const int32_t Expedition::EVENT_TIMER_ID = 1;
|
const int32_t Expedition::EVENT_TIMER_ID = 1;
|
||||||
@ -198,7 +201,7 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
|
|||||||
bool is_locked = (strtoul(row[col::is_locked], nullptr, 10) != 0);
|
bool is_locked = (strtoul(row[col::is_locked], nullptr, 10) != 0);
|
||||||
|
|
||||||
expedition->SetReplayLockoutOnMemberJoin(add_replay_on_join);
|
expedition->SetReplayLockoutOnMemberJoin(add_replay_on_join);
|
||||||
expedition->SetLocked(is_locked);
|
expedition->SetLocked(is_locked, ExpeditionLockMessage::None);
|
||||||
|
|
||||||
zone->expedition_cache.emplace(expedition_id, std::move(expedition));
|
zone->expedition_cache.emplace(expedition_id, std::move(expedition));
|
||||||
}
|
}
|
||||||
@ -1114,10 +1117,23 @@ void Expedition::DzKickPlayers(Client* requester)
|
|||||||
requester->MessageString(Chat::Red, EXPEDITION_REMOVED, KICKPLAYERS_EVERYONE, m_expedition_name.c_str());
|
requester->MessageString(Chat::Red, EXPEDITION_REMOVED, KICKPLAYERS_EVERYONE, m_expedition_name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Expedition::SetLocked(bool lock_expedition, bool update_db)
|
void Expedition::SetLocked(
|
||||||
|
bool lock_expedition, ExpeditionLockMessage lock_msg, bool update_db, uint32_t msg_color)
|
||||||
{
|
{
|
||||||
m_is_locked = lock_expedition;
|
m_is_locked = lock_expedition;
|
||||||
|
|
||||||
|
if (m_is_locked && lock_msg != ExpeditionLockMessage::None && m_dynamiczone.IsCurrentZoneDzInstance())
|
||||||
|
{
|
||||||
|
auto msg = (lock_msg == ExpeditionLockMessage::Close) ? LOCK_CLOSE : LOCK_BEGIN;
|
||||||
|
for (const auto& client_iter : entity_list.GetClientList())
|
||||||
|
{
|
||||||
|
if (client_iter.second)
|
||||||
|
{
|
||||||
|
client_iter.second->Message(msg_color, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (update_db)
|
if (update_db)
|
||||||
{
|
{
|
||||||
ExpeditionDatabase::UpdateLockState(m_id, lock_expedition);
|
ExpeditionDatabase::UpdateLockState(m_id, lock_expedition);
|
||||||
@ -1813,6 +1829,18 @@ void Expedition::HandleWorldMessage(ServerPacket* pack)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_ExpeditionLockState:
|
case ServerOP_ExpeditionLockState:
|
||||||
|
{
|
||||||
|
auto buf = reinterpret_cast<ServerExpeditionLockState_Struct*>(pack->pBuffer);
|
||||||
|
if (zone && !zone->IsZone(buf->sender_zone_id, buf->sender_instance_id))
|
||||||
|
{
|
||||||
|
auto expedition = Expedition::FindCachedExpeditionByID(buf->expedition_id);
|
||||||
|
if (expedition)
|
||||||
|
{
|
||||||
|
expedition->SetLocked(buf->enabled, static_cast<ExpeditionLockMessage>(buf->lock_msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ServerOP_ExpeditionReplayOnJoin:
|
case ServerOP_ExpeditionReplayOnJoin:
|
||||||
{
|
{
|
||||||
auto buf = reinterpret_cast<ServerExpeditionSetting_Struct*>(pack->pBuffer);
|
auto buf = reinterpret_cast<ServerExpeditionSetting_Struct*>(pack->pBuffer);
|
||||||
@ -1820,17 +1848,10 @@ void Expedition::HandleWorldMessage(ServerPacket* pack)
|
|||||||
{
|
{
|
||||||
auto expedition = Expedition::FindCachedExpeditionByID(buf->expedition_id);
|
auto expedition = Expedition::FindCachedExpeditionByID(buf->expedition_id);
|
||||||
if (expedition)
|
if (expedition)
|
||||||
{
|
|
||||||
if (pack->opcode == ServerOP_ExpeditionLockState)
|
|
||||||
{
|
|
||||||
expedition->SetLocked(buf->enabled);
|
|
||||||
}
|
|
||||||
else if (pack->opcode == ServerOP_ExpeditionReplayOnJoin)
|
|
||||||
{
|
{
|
||||||
expedition->SetReplayLockoutOnMemberJoin(buf->enabled);
|
expedition->SetReplayLockoutOnMemberJoin(buf->enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_ExpeditionGetOnlineMembers:
|
case ServerOP_ExpeditionGetOnlineMembers:
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "dynamiczone.h"
|
#include "dynamiczone.h"
|
||||||
#include "expedition_lockout_timer.h"
|
#include "expedition_lockout_timer.h"
|
||||||
|
#include "../common/eq_constants.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -49,6 +50,13 @@ enum class ExpeditionMemberStatus : uint8_t
|
|||||||
LinkDead
|
LinkDead
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class ExpeditionLockMessage : uint8_t
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Close,
|
||||||
|
Begin
|
||||||
|
};
|
||||||
|
|
||||||
struct ExpeditionMember
|
struct ExpeditionMember
|
||||||
{
|
{
|
||||||
uint32_t char_id = 0;
|
uint32_t char_id = 0;
|
||||||
@ -114,7 +122,8 @@ public:
|
|||||||
void SetMemberStatus(Client* client, ExpeditionMemberStatus status);
|
void SetMemberStatus(Client* client, ExpeditionMemberStatus status);
|
||||||
void SetNewLeader(uint32_t new_leader_id, const std::string& new_leader_name);
|
void SetNewLeader(uint32_t new_leader_id, const std::string& new_leader_name);
|
||||||
void SwapMember(Client* add_client, const std::string& remove_char_name);
|
void SwapMember(Client* add_client, const std::string& remove_char_name);
|
||||||
void SetLocked(bool lock_expedition, bool update_db = false);
|
void SetLocked(bool lock_expedition, ExpeditionLockMessage lock_msg,
|
||||||
|
bool update_db = false, uint32_t msg_color = Chat::Yellow);
|
||||||
|
|
||||||
void AddLockout(const std::string& event_name, uint32_t seconds);
|
void AddLockout(const std::string& event_name, uint32_t seconds);
|
||||||
void AddReplayLockout(uint32_t seconds);
|
void AddReplayLockout(uint32_t seconds);
|
||||||
|
|||||||
@ -152,7 +152,17 @@ void Lua_Expedition::SetCompass(std::string zone_name, float x, float y, float z
|
|||||||
|
|
||||||
void Lua_Expedition::SetLocked(bool lock_expedition) {
|
void Lua_Expedition::SetLocked(bool lock_expedition) {
|
||||||
Lua_Safe_Call_Void();
|
Lua_Safe_Call_Void();
|
||||||
self->SetLocked(lock_expedition, true);
|
self->SetLocked(lock_expedition, ExpeditionLockMessage::None, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lua_Expedition::SetLocked(bool lock_expedition, int lock_msg) {
|
||||||
|
Lua_Safe_Call_Void();
|
||||||
|
self->SetLocked(lock_expedition, static_cast<ExpeditionLockMessage>(lock_msg), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lua_Expedition::SetLocked(bool lock_expedition, int lock_msg, uint32_t msg_color) {
|
||||||
|
Lua_Safe_Call_Void();
|
||||||
|
self->SetLocked(lock_expedition, static_cast<ExpeditionLockMessage>(lock_msg), true, msg_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_Expedition::SetLootEventByNPCTypeID(uint32_t npc_type_id, std::string event_name) {
|
void Lua_Expedition::SetLootEventByNPCTypeID(uint32_t npc_type_id, std::string event_name) {
|
||||||
@ -222,6 +232,8 @@ luabind::scope lua_register_expedition() {
|
|||||||
.def("SetCompass", (void(Lua_Expedition::*)(uint32_t, float, float, float))&Lua_Expedition::SetCompass)
|
.def("SetCompass", (void(Lua_Expedition::*)(uint32_t, float, float, float))&Lua_Expedition::SetCompass)
|
||||||
.def("SetCompass", (void(Lua_Expedition::*)(std::string, float, float, float))&Lua_Expedition::SetCompass)
|
.def("SetCompass", (void(Lua_Expedition::*)(std::string, float, float, float))&Lua_Expedition::SetCompass)
|
||||||
.def("SetLocked", (void(Lua_Expedition::*)(bool))&Lua_Expedition::SetLocked)
|
.def("SetLocked", (void(Lua_Expedition::*)(bool))&Lua_Expedition::SetLocked)
|
||||||
|
.def("SetLocked", (void(Lua_Expedition::*)(bool, int))&Lua_Expedition::SetLocked)
|
||||||
|
.def("SetLocked", (void(Lua_Expedition::*)(bool, int, uint32_t))&Lua_Expedition::SetLocked)
|
||||||
.def("SetLootEventByNPCTypeID", (void(Lua_Expedition::*)(uint32_t, std::string))&Lua_Expedition::SetLootEventByNPCTypeID)
|
.def("SetLootEventByNPCTypeID", (void(Lua_Expedition::*)(uint32_t, std::string))&Lua_Expedition::SetLootEventByNPCTypeID)
|
||||||
.def("SetLootEventBySpawnID", (void(Lua_Expedition::*)(uint32_t, std::string))&Lua_Expedition::SetLootEventBySpawnID)
|
.def("SetLootEventBySpawnID", (void(Lua_Expedition::*)(uint32_t, std::string))&Lua_Expedition::SetLootEventBySpawnID)
|
||||||
.def("SetReplayLockoutOnMemberJoin", (void(Lua_Expedition::*)(bool))&Lua_Expedition::SetReplayLockoutOnMemberJoin)
|
.def("SetReplayLockoutOnMemberJoin", (void(Lua_Expedition::*)(bool))&Lua_Expedition::SetReplayLockoutOnMemberJoin)
|
||||||
@ -232,4 +244,14 @@ luabind::scope lua_register_expedition() {
|
|||||||
.def("UpdateLockoutDuration", (void(Lua_Expedition::*)(std::string, uint32_t, bool))&Lua_Expedition::UpdateLockoutDuration);
|
.def("UpdateLockoutDuration", (void(Lua_Expedition::*)(std::string, uint32_t, bool))&Lua_Expedition::UpdateLockoutDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luabind::scope lua_register_expedition_lock_messages() {
|
||||||
|
return luabind::class_<ExpeditionLockMessage>("ExpeditionLockMessage")
|
||||||
|
.enum_("constants")
|
||||||
|
[
|
||||||
|
luabind::value("None", static_cast<int>(ExpeditionLockMessage::None)),
|
||||||
|
luabind::value("Close", static_cast<int>(ExpeditionLockMessage::Close)),
|
||||||
|
luabind::value("Begin", static_cast<int>(ExpeditionLockMessage::Begin))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LUA_EQEMU
|
#endif // LUA_EQEMU
|
||||||
|
|||||||
@ -39,6 +39,7 @@ namespace luabind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
luabind::scope lua_register_expedition();
|
luabind::scope lua_register_expedition();
|
||||||
|
luabind::scope lua_register_expedition_lock_messages();
|
||||||
|
|
||||||
class Lua_Expedition : public Lua_Ptr<Expedition>
|
class Lua_Expedition : public Lua_Ptr<Expedition>
|
||||||
{
|
{
|
||||||
@ -74,6 +75,8 @@ public:
|
|||||||
void SetCompass(uint32_t zone_id, float x, float y, float z);
|
void SetCompass(uint32_t zone_id, float x, float y, float z);
|
||||||
void SetCompass(std::string zone_name, float x, float y, float z);
|
void SetCompass(std::string zone_name, float x, float y, float z);
|
||||||
void SetLocked(bool lock_expedition);
|
void SetLocked(bool lock_expedition);
|
||||||
|
void SetLocked(bool lock_expedition, int lock_msg);
|
||||||
|
void SetLocked(bool lock_expedition, int lock_msg, uint32_t color);
|
||||||
void SetLootEventByNPCTypeID(uint32_t npc_type_id, std::string event_name);
|
void SetLootEventByNPCTypeID(uint32_t npc_type_id, std::string event_name);
|
||||||
void SetLootEventBySpawnID(uint32_t spawn_id, std::string event_name);
|
void SetLootEventBySpawnID(uint32_t spawn_id, std::string event_name);
|
||||||
void SetReplayLockoutOnMemberJoin(bool enable);
|
void SetReplayLockoutOnMemberJoin(bool enable);
|
||||||
|
|||||||
@ -1110,7 +1110,8 @@ void LuaParser::MapFunctions(lua_State *L) {
|
|||||||
lua_register_ruleb(),
|
lua_register_ruleb(),
|
||||||
lua_register_journal_speakmode(),
|
lua_register_journal_speakmode(),
|
||||||
lua_register_journal_mode(),
|
lua_register_journal_mode(),
|
||||||
lua_register_expedition()
|
lua_register_expedition(),
|
||||||
|
lua_register_expedition_lock_messages()
|
||||||
];
|
];
|
||||||
|
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user