Implement initial expedition system

Add Expeditions logging category

Add handlers for all Dynamic Zone/Expedition related opcodes

Add FormatName string_util function to format character names

Add Zone::IsZone helper method

Add cross zone MessageString support with variable parameters

Add static Client method helpers for cross zone messaging

Add #dz gm command to debug expedition cache for current zone
This commit is contained in:
hg
2020-04-14 17:18:54 -04:00
parent a77f8b582e
commit da067be2fa
31 changed files with 4011 additions and 12 deletions
+3 -1
View File
@@ -118,6 +118,7 @@ namespace Logs {
Merchants,
ZonePoints,
Loot,
Expeditions,
MaxCategoryID /* Don't Remove this */
};
@@ -194,7 +195,8 @@ namespace Logs {
"HotReload",
"Merchants",
"ZonePoints",
"Loot"
"Loot",
"Expeditions",
};
}
+24
View File
@@ -601,6 +601,21 @@
OutF(LogSys, Logs::Detail, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditions(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditionsModerate(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::Moderate, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditionsDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -952,6 +967,15 @@
#define LogZonePointsDetail(message, ...) do {\
} while (0)
#define LogExpeditions(message, ...) do {\
} while (0)
#define LogExpeditionsModerate(message, ...) do {\
} while (0)
#define LogExpeditionsDetail(message, ...) do {\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
} while (0)
+5
View File
@@ -785,6 +785,11 @@ RULE_BOOL(Instances, RecycleInstanceIds, true, "Setting whether free instance ID
RULE_INT(Instances, GuildHallExpirationDays, 90, "Amount of days before a Guild Hall instance expires")
RULE_CATEGORY_END()
RULE_CATEGORY(Expedition)
RULE_INT(Expedition, MinStatusToBypassPlayerCountRequirements, 80, "Minimum GM status to bypass minimum player requirements for Expedition creation")
RULE_BOOL(Expedition, UseDatabaseToVerifyLeaderCommands, false, "Use database instead of zone cache to verify Expedition leader for commands")
RULE_CATEGORY_END()
#undef RULE_CATEGORY
#undef RULE_INT
#undef RULE_REAL
+95
View File
@@ -140,6 +140,18 @@
#define ServerOP_LFPUpdate 0x0213
#define ServerOP_LFPMatches 0x0214
#define ServerOP_ClientVersionSummary 0x0215
#define ServerOP_ExpeditionCreate 0x0400
#define ServerOP_ExpeditionDeleted 0x0401
#define ServerOP_ExpeditionLeaderChanged 0x0402
#define ServerOP_ExpeditionLockout 0x0403
#define ServerOP_ExpeditionMemberChange 0x0404
#define ServerOP_ExpeditionMemberSwap 0x0405
#define ServerOP_ExpeditionMemberStatus 0x0406
#define ServerOP_ExpeditionGetOnlineMembers 0x0407
#define ServerOP_ExpeditionDzAddPlayer 0x0408
#define ServerOP_ExpeditionDzMakeLeader 0x0409
#define ServerOP_LSInfo 0x1000
#define ServerOP_LSStatus 0x1001
#define ServerOP_LSClientAuthLeg 0x1002
@@ -257,6 +269,8 @@
#define ServerOP_CZTaskRemoveGroup 0x4560
#define ServerOP_CZTaskRemoveRaid 0x4561
#define ServerOP_CZTaskRemoveGuild 0x4562
#define ServerOP_CZClientMessage 0x4563
#define ServerOP_CZClientMessageString 0x4564
#define ServerOP_WWAssignTask 0x4750
#define ServerOP_WWCastSpell 0x4751
@@ -1958,6 +1972,87 @@ struct UCSServerStatus_Struct {
};
};
struct ServerCZClientMessage_Struct {
uint16 chat_type;
char character_name[64];
uint32 message_size;
char message[1];
};
struct ServerCZClientMessageString_Struct {
uint32 string_id;
uint16 chat_type;
char character_name[64];
uint32 string_params_size;
char string_params[1]; // null delimited
};
struct ServerExpeditionID_Struct {
uint32 expedition_id;
uint32 sender_zone_id;
uint32 sender_instance_id;
};
struct ServerExpeditionMemberChange_Struct {
uint32 expedition_id;
uint32 sender_zone_id;
uint16 sender_instance_id;
uint8 removed; // 0: added, 1: removed
uint32 char_id;
char char_name[64];
};
struct ServerExpeditionMemberSwap_Struct {
uint32 expedition_id;
uint32 sender_zone_id;
uint16 sender_instance_id;
uint32 add_char_id;
uint32 remove_char_id;
char add_char_name[64];
char remove_char_name[64];
};
struct ServerExpeditionMemberStatus_Struct {
uint32 expedition_id;
uint32 sender_zone_id;
uint16 sender_instance_id;
uint8 status; // 0: unknown 1: Online 2: Offline 3: In Dynamic Zone 4: Link Dead
uint32 character_id;
};
struct ServerExpeditionCharacterEntry_Struct {
uint32 character_id;
uint32 character_zone_id;
uint16 character_instance_id;
uint8 character_online; // 0: offline 1: online
};
struct ServerExpeditionCharacters_Struct {
uint32 expedition_id;
uint32 sender_zone_id;
uint16 sender_instance_id;
uint32 count;
ServerExpeditionCharacterEntry_Struct entries[0];
};
struct ServerExpeditionLockout_Struct {
uint32 expedition_id;
uint64 expire_time;
uint32 duration;
uint32 sender_zone_id;
uint16 sender_instance_id;
uint8 remove;
char event_name[256];
};
struct ServerDzCommand_Struct {
uint32 expedition_id;
uint8 is_char_online; // 0: target name is offline, 1: online
char requester_name[64];
char target_name[64];
char remove_name[64]; // used for swap command
};
#pragma pack()
#endif
+11
View File
@@ -592,3 +592,14 @@ std::string numberToWords(unsigned long long int n)
return res;
}
std::string FormatName(const std::string& char_name)
{
std::string formatted(char_name);
if (!formatted.empty())
{
std::transform(formatted.begin(), formatted.end(), formatted.begin(), ::tolower);
formatted[0] = ::toupper(formatted[0]);
}
return formatted;
}
+1 -1
View File
@@ -206,6 +206,6 @@ void MakeLowerString(const char *source, char *target);
void RemoveApostrophes(std::string &s);
std::string convert2digit(int n, std::string suffix);
std::string numberToWords(unsigned long long int n);
std::string FormatName(const std::string& char_name);
#endif