Compare commits

...

17 Commits

Author SHA1 Message Date
Akkadius 05f566ad07 tweak 2025-06-22 13:42:45 -05:00
Chris Miles c7a8d796fc Update CMakeLists.txt 2025-06-22 13:21:11 -05:00
Chris Miles 77163ec137 Update eqemu_logsys.h 2025-06-22 04:23:03 -05:00
Chris Miles e846bb86b6 [Code] Remove Regex Compile Bloat (#4947) 2025-06-22 02:08:15 -05:00
Chris Miles 3e6a3e2168 [Build] Significantly Improve Build Times Using Unity Builds (#4948) 2025-06-22 02:08:03 -05:00
Alex King 2aebf1a78a [Code] Remove Unused MZoneShutdown Mutex (#4946) 2025-06-22 01:49:39 -05:00
Chris Miles 1be7e56b86 [Databuckets] Move Databuckets to Common (#4918)
* [Databuckets] Move Databuckets to Common

* Fix linking issue
2025-06-16 16:48:29 -05:00
Chris Miles a0ff9d67a1 [Fix] Bulk Send Corpses after Idle State (#4910) 2025-06-09 14:31:28 -05:00
Chris Miles befee1c729 [Quests] Support Multiple Quest, Plugin, and Lua Module Paths (#4906)
* [Quests] Add Support for Multiple Load Paths

* Adjust load paths

* plugin != m_lua_module_directories
2025-06-09 12:49:46 -05:00
nytmyr 3d70063a68 [Doors] Fix door saving for versions (#4905)
* [Doors] Fix door saving for versions

- Door saving wasn't saving to the proper version on `#door save`

* Update doors.cpp

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-09 12:47:56 -05:00
JJ 4e28bcf85e Bump libuv to 1.50.0 (#4898) 2025-06-09 12:40:37 -05:00
JJ 687d10960a [Logs] Fix output for tasks in logs (#4907) 2025-06-09 12:32:45 -05:00
Chris Miles 567d46c3d6 [Performance] Auto Idle / AFK (#4903)
* [Performance] AFK Client Packet Filtering

* Player feedback

* Update client_packet.cpp

* Fixes

* Streamline updates to SetAFK

* Decouple idling and AFK and manual AFK

* Reset clock timer when we take AFK or idle off

* Exclude bard songs in non combat zones from resetting timer

* GM exclusion adjustments
2025-05-22 13:08:32 -05:00
Chris Miles 53cc2de459 [World API] Input Validation (#4904)
* [World API] Input Validation

* Update eqemu_api_world_data_service.cpp

* Add db ping to player events processor, move back into main thread
2025-05-22 13:08:17 -05:00
Chris Miles cb866cba31 [Release] 23.7.0 (#4902) 2025-05-19 12:31:37 -05:00
JJ e2162c08da [CLI] Add custom database version output (#4901)
* Add custom database version output to CLI from #4892

* Spacing alignment
2025-05-18 11:28:10 -05:00
Chris Miles e657953b8f [Netcode] Resend Logic Adjustments (#4900)
* Timeout adjustment

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp

* Stuff

* Update daybreak_connection.h

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp

* Update daybreak_connection.cpp
2025-05-18 11:19:37 -05:00
76 changed files with 1496 additions and 960 deletions
+44
View File
@@ -1,3 +1,47 @@
## [23.7.0] 5/19/2025
### CLI
* Add custom database version output ([#4901](https://github.com/EQEmu/Server/pull/4901)) @joligario 2025-05-18
* Fix MySQL check in database dumper ([#4897](https://github.com/EQEmu/Server/pull/4897)) @joligario 2025-05-16
### Commands
* Add #zonevariable Command ([#4882](https://github.com/EQEmu/Server/pull/4882)) @Kinglykrab 2025-05-15
### Database
* Add Custom Database Migrations for Operators ([#4892](https://github.com/EQEmu/Server/pull/4892)) @Akkadius 2025-05-16
* Remove Transaction Wrapped Character Save ([#4894](https://github.com/EQEmu/Server/pull/4894)) @Akkadius 2025-05-16
### Fixes
* Deadlock on failed #copycharacter commands ([#4887](https://github.com/EQEmu/Server/pull/4887)) @Akkadius 2025-05-16
### Logging
* Auto Update Log Category Names ([#4890](https://github.com/EQEmu/Server/pull/4890)) @Akkadius 2025-05-16
### Netcode
* Resend Logic Adjustments ([#4900](https://github.com/EQEmu/Server/pull/4900)) @Akkadius 2025-05-18
### Player Events
* Add rule to ignore configured GM commands ([#4888](https://github.com/EQEmu/Server/pull/4888)) @Akkadius 2025-05-16
### Rules
* Auto Update Rule Notes from Source ([#4891](https://github.com/EQEmu/Server/pull/4891)) @Akkadius 2025-05-16
### World
* Fix Rarer Reload Deadlock ([#4893](https://github.com/EQEmu/Server/pull/4893)) @Akkadius 2025-05-16
### Zone State
* Load New Spawn2 Data When Present ([#4889](https://github.com/EQEmu/Server/pull/4889)) @Akkadius 2025-05-16
## [23.6.0] 5/14/2025
### Bots
+1
View File
@@ -42,6 +42,7 @@ IF(USE_MAP_MMFS)
ENDIF (USE_MAP_MMFS)
IF(MSVC)
add_compile_options(/bigobj)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-DNOMINMAX)
ADD_DEFINITIONS(-DCRASH_LOGGING)
+13 -29
View File
@@ -1,18 +1,23 @@
#include "data_bucket.h"
#include "zonedb.h"
#include "mob.h"
#include "client.h"
#include "worldserver.h"
#include "../common/data_bucket.h"
#include "database.h"
#include <ctime>
#include <cctype>
#include "../common/json/json.hpp"
using json = nlohmann::json;
extern WorldServer worldserver;
const std::string NESTED_KEY_DELIMITER = ".";
const std::string NESTED_KEY_DELIMITER = ".";
std::vector<DataBucketsRepository::DataBuckets> g_data_bucket_cache = {};
std::vector<DataBucketsRepository::DataBuckets> g_data_bucket_cache = {};
#if defined(ZONE)
#include "../zone/zonedb.h"
extern ZoneDatabase database;
#elif defined(WORLD)
#include "../world/worlddb.h"
extern WorldDatabase database;
#else
#error "You must define either ZONE or WORLD"
#endif
void DataBucket::SetData(const std::string &bucket_key, const std::string &bucket_value, std::string expires_time)
{
@@ -347,27 +352,6 @@ bool DataBucket::DeleteData(const std::string &bucket_key)
return DeleteData(DataBucketKey{.key = bucket_key});
}
// GetDataBuckets bulk loads all data buckets for a mob
bool DataBucket::GetDataBuckets(Mob *mob)
{
const uint32 id = mob->GetMobTypeIdentifier();
if (!id) {
return false;
}
if (mob->IsBot()) {
BulkLoadEntitiesToCache(DataBucketLoadType::Bot, {id});
}
else if (mob->IsClient()) {
uint32 account_id = mob->CastToClient()->AccountID();
BulkLoadEntitiesToCache(DataBucketLoadType::Account, {account_id});
BulkLoadEntitiesToCache(DataBucketLoadType::Client, {id});
}
return true;
}
bool DataBucket::DeleteData(const DataBucketKey &k)
{
bool is_nested_key = k.key.find(NESTED_KEY_DELIMITER) != std::string::npos;
+3 -7
View File
@@ -2,11 +2,9 @@
#define EQEMU_DATABUCKET_H
#include <string>
#include "../common/types.h"
#include "../common/repositories/data_buckets_repository.h"
#include "mob.h"
#include "../common/json/json_archive_single_line.h"
#include "../common/servertalk.h"
#include "types.h"
#include "repositories/data_buckets_repository.h"
#include "json/json_archive_single_line.h"
struct DataBucketKey {
std::string key;
@@ -46,8 +44,6 @@ public:
static std::string GetDataExpires(const std::string &bucket_key);
static std::string GetDataRemaining(const std::string &bucket_key);
static bool GetDataBuckets(Mob *mob);
// scoped bucket methods
static void SetData(const DataBucketKey &k_);
static bool DeleteData(const DataBucketKey &k);
-1
View File
@@ -4,7 +4,6 @@
#include <string>
#include "../types.h"
#include "../http/httplib.h"
#include "../repositories/player_event_logs_repository.h"
#include "../events/player_events.h"
+15
View File
@@ -177,6 +177,21 @@ void EQEmuConfig::parse_config()
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
auto load_paths = [&](const std::string& key, std::vector<std::string>& target) {
const auto& paths = _root["server"]["directories"][key];
if (paths.isArray()) {
for (const auto& dir : paths) {
if (dir.isString()) {
target.push_back(dir.asString());
}
}
}
};
load_paths("quest_paths", m_quest_directories);
load_paths("plugin_paths", m_plugin_directories);
load_paths("lua_module_paths", m_lua_module_directories);
/**
* Logs
*/
+21
View File
@@ -120,6 +120,22 @@ class EQEmuConfig
const std::string &GetUCSHost() const;
uint16 GetUCSPort() const;
std::vector<std::string> GetQuestDirectories() const
{
return m_quest_directories;
}
std::vector<std::string> GetPluginsDirectories() const
{
return m_plugin_directories;
}
std::vector<std::string> GetLuaModuleDirectories() const
{
return m_lua_module_directories;
}
// uint16 DynamicCount;
// map<string,uint16> StaticZones;
@@ -133,6 +149,11 @@ class EQEmuConfig
Json::Value _root;
static std::string ConfigFile;
std::vector<std::string> m_quest_directories = {};
std::vector<std::string> m_plugin_directories = {};
std::vector<std::string> m_lua_module_directories = {};
protected:
void parse_config();
EQEmuConfig()
+14 -4
View File
@@ -454,9 +454,19 @@ void OutF(
}
**/
#define OutF(ls, debug_level, log_category, file, func, line, formatStr, ...) \
do { \
ls.Out(debug_level, log_category, file, func, line, fmt::format(formatStr, ##__VA_ARGS__).c_str()); \
} while(0)
template<typename... Args>
inline void OutF(
EQEmuLogSys& ls,
Logs::DebugLevel debug_level,
uint16 log_category,
const char* file,
const char* func,
int line,
fmt::format_string<Args...> fmt_str,
Args&&... args
) {
std::string formatted = fmt::format(fmt_str, std::forward<Args>(args)...);
ls.Out(debug_level, log_category, file, func, line, formatted.c_str());
}
#endif
+5 -1
View File
@@ -15,9 +15,9 @@ const uint32 PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL = 60 * 60 * 1000; // 1
// general initialization routine
void PlayerEventLogs::Init()
{
m_process_batch_events_timer.SetTimer(RuleI(Logging, BatchPlayerEventProcessIntervalSeconds) * 1000);
m_process_retention_truncation_timer.SetTimer(PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL);
m_database_ping_timer.SetTimer(10 * 1000); // 10 seconds
ValidateDatabaseConnection();
@@ -916,6 +916,10 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
// general process function, used in world or QS depending on rule Logging:PlayerEventsQSProcess
void PlayerEventLogs::Process()
{
if (m_database_ping_timer.Check()) {
m_database->ping();
}
if (m_process_batch_events_timer.Check() ||
m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) {
ProcessBatchQueue();
+1
View File
@@ -113,6 +113,7 @@ private:
std::map<PlayerEvent::EventType, EtlSettings> m_etl_settings{};
// timers
Timer m_database_ping_timer; // database ping timer
Timer m_process_batch_events_timer; // events processing timer
Timer m_process_retention_truncation_timer; // timer for truncating events based on retention settings
+55 -7
View File
@@ -1127,22 +1127,59 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
auto time_since_first_sent = std::chrono::duration_cast<std::chrono::milliseconds>(now - first_packet.first_sent).count();
if (time_since_first_sent >= m_owner->m_options.resend_timeout) {
auto now_ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
auto first_sent_ms = std::chrono::duration_cast<std::chrono::milliseconds>(first_packet.first_sent.time_since_epoch()).count();
LogNetClient(
"Closing connection for m_endpoint [{}] m_port [{}] time_since_first_sent [{}] >= m_owner->m_options.resend_timeout [{}] now [{}] first_packet.first_sent [{}]",
m_endpoint,
m_port,
time_since_first_sent,
m_owner->m_options.resend_timeout,
now_ms,
first_sent_ms
);
Close();
return;
}
if (m_last_ack - now > std::chrono::milliseconds(1000)) {
LogNetClient(
"Resetting m_acked_since_last_resend flag for m_endpoint [{}] m_port [{}]",
m_endpoint,
m_port
);
m_acked_since_last_resend = true;
}
// make sure that the first_packet in the list first_sent time is within the resend_delay and now
// if it is not, then we need to resend all packets in the list
if (time_since_first_sent <= first_packet.resend_delay && !m_acked_since_last_resend) {
LogNetClientDetail(
"Not resending packets for m_endpoint [{}] m_port [{}] packets [{}] time_first_sent [{}] resend_delay [{}] m_acked_since_last_resend [{}]",
m_endpoint,
m_port,
s->sent_packets.size(),
time_since_first_sent,
first_packet.resend_delay,
m_acked_since_last_resend
);
return;
}
}
if (LogSys.IsLogEnabled(Logs::Detail, Logs::Netcode)) {
if (LogSys.IsLogEnabled(Logs::General, Logs::NetClient)) {
size_t total_size = 0;
for (auto &e: s->sent_packets) {
total_size += e.second.packet.Length();
}
LogNetClient(
"Resending packets for stream [{}] packet count [{}] total packet size [{}]",
stream,
LogNetClientDetail(
"Resending packets for m_endpoint [{}] m_port [{}] packet count [{}] total packet size [{}] m_acked_since_last_resend [{}]",
m_endpoint,
m_port,
s->sent_packets.size(),
total_size
total_size,
m_acked_since_last_resend
);
}
@@ -1150,9 +1187,12 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
if (m_resend_packets_sent >= MAX_CLIENT_RECV_PACKETS_PER_WINDOW ||
m_resend_bytes_sent >= MAX_CLIENT_RECV_BYTES_PER_WINDOW) {
LogNetClient(
"Stopping resend because we hit thresholds m_resend_packets_sent [{}] max [{}] m_resend_bytes_sent [{}] max [{}]",
"Stopping resend because we hit thresholds for m_endpoint [{}] m_port [{}] m_resend_packets_sent [{}] max [{}] in_queue [{}] m_resend_bytes_sent [{}] max [{}]",
m_endpoint,
m_port,
m_resend_packets_sent,
MAX_CLIENT_RECV_PACKETS_PER_WINDOW,
s->sent_packets.size(),
m_resend_bytes_sent,
MAX_CLIENT_RECV_BYTES_PER_WINDOW
);
@@ -1187,11 +1227,13 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
m_owner->m_options.resend_delay_max
);
}
m_acked_since_last_resend = false;
m_last_ack = now;
}
void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
{
auto now = Clock::now();
auto s = &m_streams[stream];
auto iter = s->sent_packets.begin();
@@ -1212,6 +1254,9 @@ void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
++iter;
}
}
m_acked_since_last_resend = true;
m_last_ack = now;
}
void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
@@ -1229,6 +1274,9 @@ void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
s->sent_packets.erase(iter);
}
m_acked_since_last_resend = true;
m_last_ack = now;
}
void EQ::Net::DaybreakConnection::UpdateDataBudget(double budget_add)
+2
View File
@@ -185,6 +185,8 @@ namespace EQ
// resend tracking
size_t m_resend_packets_sent = 0;
size_t m_resend_bytes_sent = 0;
bool m_acked_since_last_resend = false;
Timestamp m_last_ack;
struct DaybreakSentPacket
{
+43 -22
View File
@@ -48,10 +48,23 @@ void PathManager::LoadPaths()
return dir;
};
auto load_many_paths_fallback = [&](const std::vector<std::string>& dirs, const std::string& fallback, std::vector<std::string>& target) {
target.clear();
if (!dirs.empty()) {
for (const auto& path : dirs) {
target.push_back(resolve_path(path));
}
} else {
target.push_back(resolve_path(fallback));
}
};
load_many_paths_fallback(c->GetQuestDirectories(), c->QuestDir, m_quests_paths);
load_many_paths_fallback(c->GetPluginsDirectories(), c->PluginDir, m_plugin_paths);
load_many_paths_fallback(c->GetLuaModuleDirectories(), c->LuaModuleDir, m_lua_module_paths);
// resolve all paths
m_maps_path = resolve_path(c->MapDir, {"maps", "Maps"});
m_quests_path = resolve_path(c->QuestDir);
m_plugins_path = resolve_path(c->PluginDir);
m_lua_modules_path = resolve_path(c->LuaModuleDir);
m_lua_mods_path = resolve_path("mods");
m_patch_path = resolve_path(c->PatchDir);
m_opcode_path = resolve_path(c->OpcodeDir);
@@ -62,13 +75,10 @@ void PathManager::LoadPaths()
std::vector<std::pair<std::string, std::string>> paths = {
{"server", m_server_path},
{"logs", m_log_path},
{"lua mods", m_lua_mods_path},
{"lua_modules", m_lua_modules_path},
{"maps", m_maps_path},
{"lua mods", m_lua_mods_path},
{"patches", m_patch_path},
{"opcode", m_opcode_path},
{"plugins", m_plugins_path},
{"quests", m_quests_path},
{"shared_memory", m_shared_memory_path}
};
@@ -83,6 +93,17 @@ void PathManager::LoadPaths()
LogInfo("{:>{}} > [{:<{}}]", name, name_width, in_path, path_width);
}
}
auto log_paths = [&](const std::string& label, const std::vector<std::string>& paths) {
if (!paths.empty()) {
LogInfo("{:>{}} > [{:<{}}]", label, name_width - 1, Strings::Join(paths, ";"), path_width);
}
};
log_paths("quests", m_quests_paths);
log_paths("plugins", m_plugin_paths);
log_paths("lua_modules", m_lua_module_paths);
LogInfo("{}", Strings::Repeat("-", break_length));
}
@@ -96,21 +117,26 @@ const std::string &PathManager::GetMapsPath() const
return m_maps_path;
}
const std::string &PathManager::GetQuestsPath() const
{
return m_quests_path;
}
const std::string &PathManager::GetPluginsPath() const
{
return m_plugins_path;
}
const std::string &PathManager::GetSharedMemoryPath() const
{
return m_shared_memory_path;
}
std::vector<std::string> PathManager::GetQuestPaths() const
{
return m_quests_paths;
}
std::vector<std::string> PathManager::GetPluginPaths() const
{
return m_plugin_paths;
}
std::vector<std::string> PathManager::GetLuaModulePaths() const
{
return m_lua_module_paths;
}
const std::string &PathManager::GetLogPath() const
{
return m_log_path;
@@ -126,11 +152,6 @@ const std::string &PathManager::GetOpcodePath() const
return m_opcode_path;
}
const std::string &PathManager::GetLuaModulesPath() const
{
return m_lua_modules_path;
}
const std::string &PathManager::GetLuaModsPath() const
{
return m_lua_mods_path;
+18 -12
View File
@@ -3,6 +3,7 @@
#include <string>
#include <vector>
class PathManager {
public:
@@ -14,22 +15,27 @@ public:
[[nodiscard]] const std::string &GetMapsPath() const;
[[nodiscard]] const std::string &GetPatchPath() const;
[[nodiscard]] const std::string &GetOpcodePath() const;
[[nodiscard]] const std::string &GetPluginsPath() const;
[[nodiscard]] const std::string &GetQuestsPath() const;
[[nodiscard]] const std::string &GetServerPath() const;
[[nodiscard]] const std::string &GetSharedMemoryPath() const;
[[nodiscard]] std::vector<std::string> GetQuestPaths() const;
[[nodiscard]] std::vector<std::string> GetPluginPaths() const;
[[nodiscard]] std::vector<std::string> GetLuaModulePaths() const;
private:
std::string m_log_path;
std::string m_lua_mods_path;
std::string m_lua_modules_path;
std::string m_maps_path;
std::string m_patch_path;
std::string m_opcode_path;
std::string m_plugins_path;
std::string m_quests_path;
std::string m_server_path;
std::string m_shared_memory_path;
std::string m_log_path;
std::string m_lua_mods_path;
std::string m_maps_path;
std::string m_patch_path;
std::string m_opcode_path;
std::string m_quests_path;
std::vector<std::string> m_quests_paths;
std::vector<std::string> m_plugin_paths;
std::vector<std::string> m_lua_module_paths;
private:
std::string m_server_path;
std::string m_shared_memory_path;
};
extern PathManager path;
+6
View File
@@ -233,6 +233,12 @@ RULE_BOOL(Character, SneakAlwaysSucceedOver100, false, "When sneak skill is over
RULE_INT(Character, BandolierSwapDelay, 0, "Bandolier swap delay in milliseconds, default is 0")
RULE_BOOL(Character, EnableHackedFastCampForGM, false, "Enables hacked fast camp for GM clients, if the GM doesn't have a hacked client they'll camp like normal")
RULE_BOOL(Character, AlwaysAllowNameChange, false, "Enable this option to allow /changename to work without enabling a name change via scripts.")
RULE_BOOL(Character, EnableAutoAFK, true, "Enable or disable the auto AFK feature, cuts down on packet spam")
RULE_BOOL(Character, AutoIdleFilterPackets, true, "Enable or disable filtering packets when auto AFK is enabled, heavily cuts down on packet spam in zones with lots of players")
RULE_INT(Character, SecondsBeforeIdleCombatZone, 600, "Seconds before a player is considered idle in combat zones (600 = 10 minutes)")
RULE_INT(Character, SecondsBeforeIdleNonCombatZone, 60, "Seconds before a player is considered idle in non-combat zones (60 = 1 minute)")
RULE_INT(Character, SecondsBeforeAFKCombatZone, 1800, "Seconds before a player is considered AFK in combat zones (1800 = 30 minutes)")
RULE_INT(Character, SecondsBeforeAFKNonCombatZone, 600, "Seconds before a player is considered AFK in non-combat zones (600 = 10 minutes)")
RULE_CATEGORY_END()
RULE_CATEGORY(Mercs)
+1 -1
View File
@@ -48,7 +48,7 @@ enum class SharedTaskRequestGroupType {
struct ServerSharedTaskRequest_Struct {
uint32 requested_character_id;
uint32 requested_task_id;
uint32 requested_npc_type_id; // original task logic passthrough
uint32 requested_npc_entity_id; // original task logic passthrough
uint32 accept_time;
};
+1 -1
View File
@@ -25,7 +25,7 @@
// Build variables
// these get injected during the build pipeline
#define CURRENT_VERSION "23.6.0-dev" // always append -dev to the current version for custom-builds
#define CURRENT_VERSION "23.7.0-dev" // always append -dev to the current version for custom-builds
#define LOGIN_VERSION "0.8.0"
#define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "eqemu-server",
"version": "23.6.0",
"version": "23.7.0",
"repository": {
"type": "git",
"url": "https://github.com/EQEmu/Server.git"
+3 -1
View File
@@ -1,6 +1,8 @@
module should-release
go 1.18
go 1.23.0
toolchain go1.23.5
require (
github.com/google/go-github/v41 v41.0.0
+2
View File
@@ -7,6 +7,7 @@ SET(world_sources
cliententry.cpp
clientlist.cpp
console.cpp
../common/data_bucket.cpp
dynamic_zone.cpp
dynamic_zone_manager.cpp
eql_config.cpp
@@ -42,6 +43,7 @@ SET(world_headers
cliententry.h
clientlist.h
console.h
../common/data_bucket.h
dynamic_zone.h
dynamic_zone_manager.h
eql_config.h
+3 -2
View File
@@ -12,8 +12,9 @@ void WorldserverCLI::DatabaseVersion(int argc, char **argv, argh::parser &cmd, s
Json::Value v;
v["database_version"] = CURRENT_BINARY_DATABASE_VERSION;
v["bots_database_version"] = RuleB(Bots, Enabled) ? CURRENT_BINARY_BOTS_DATABASE_VERSION : 0;
v["database_version"] = CURRENT_BINARY_DATABASE_VERSION;
v["bots_database_version"] = RuleB(Bots, Enabled) ? CURRENT_BINARY_BOTS_DATABASE_VERSION : 0;
v["custom_database_version"] = CUSTOM_BINARY_DATABASE_VERSION;
std::stringstream payload;
payload << v;
+6 -5
View File
@@ -11,11 +11,12 @@ void WorldserverCLI::Version(int argc, char **argv, argh::parser &cmd, std::stri
Json::Value j;
j["bots_database_version"] = CURRENT_BINARY_BOTS_DATABASE_VERSION;
j["compile_date"] = COMPILE_DATE;
j["compile_time"] = COMPILE_TIME;
j["database_version"] = CURRENT_BINARY_DATABASE_VERSION;
j["server_version"] = CURRENT_VERSION;
j["bots_database_version"] = CURRENT_BINARY_BOTS_DATABASE_VERSION;
j["compile_date"] = COMPILE_DATE;
j["compile_time"] = COMPILE_TIME;
j["custom_database_version"] = CUSTOM_BINARY_DATABASE_VERSION;
j["database_version"] = CURRENT_BINARY_DATABASE_VERSION;
j["server_version"] = CURRENT_VERSION;
std::stringstream payload;
payload << j;
+15 -3
View File
@@ -95,9 +95,22 @@ void ConsoleApi(
BenchTimer timer;
timer.reset();
EQEmuApiWorldDataService::get(response, args);
std::string method = args.empty() ? "" : args[0];
std::string method = args[0];
if (method.empty()) {
root["execution_time"] = std::to_string(timer.elapsed());
root["method"] = method;
root["data"] = response;
root["error"] = "No method specified";
std::stringstream payload;
payload << root;
connection->SendLine(payload.str());
return;
}
// Safe to call now that args[0] is known to exist
EQEmuApiWorldDataService::get(response, args);
root["execution_time"] = std::to_string(timer.elapsed());
root["method"] = method;
@@ -105,7 +118,6 @@ void ConsoleApi(
std::stringstream payload;
payload << root;
connection->SendLine(payload.str());
}
+4
View File
@@ -24,6 +24,10 @@ void callGetZoneList(Json::Value &response)
for (auto &zone: zoneserver_list.getZoneServerList()) {
Json::Value row;
if (!zone) {
continue;
}
if (!zone->IsConnected()) {
continue;
}
+8 -12
View File
@@ -182,7 +182,8 @@ int main(int argc, char **argv)
EQTimeTimer.Start(600000);
Timer parcel_prune_timer(86400000);
parcel_prune_timer.Start(86400000);
Timer player_event_log_process(1000);
player_event_log_process.Start(1000);
// global loads
LogInfo("Loading launcher list");
@@ -385,15 +386,6 @@ int main(int argc, char **argv)
player_event_logs.Init();
}
auto event_log_processor = std::jthread([](const std::stop_token& stoken) {
while (!stoken.stop_requested()) {
if (!RuleB(Logging, PlayerEventsQSProcess)) {
player_event_logs.Process();
}
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
});
auto loop_fn = [&](EQ::Timer* t) {
Timer::SetCurrentTime();
@@ -487,6 +479,12 @@ int main(int argc, char **argv)
shared_task_manager.Process();
dynamic_zone_manager.Process();
if (!RuleB(Logging, PlayerEventsQSProcess)) {
if (player_event_log_process.Check()) {
player_event_logs.Process();
}
}
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
@@ -506,8 +504,6 @@ int main(int argc, char **argv)
EQ::EventLoop::Get().Run();
event_log_processor.request_stop();
LogInfo("World main loop completed");
LogInfo("Shutting down zone connections (if any)");
zoneserver_list.KillAll();
+4 -4
View File
@@ -677,10 +677,10 @@ void SharedTaskManager::SendAcceptNewSharedTaskPacket(
);
auto d = reinterpret_cast<ServerSharedTaskRequest_Struct *>(p->pBuffer);
d->requested_character_id = character_id;
d->requested_task_id = task_id;
d->requested_npc_type_id = npc_context_id;
d->accept_time = accept_time;
d->requested_character_id = character_id;
d->requested_task_id = task_id;
d->requested_npc_entity_id = npc_context_id;
d->accept_time = accept_time;
// get requested character zone server
ClientListEntry *cle = client_list.FindCLEByCharacterID(character_id);
+3 -3
View File
@@ -24,16 +24,16 @@ void SharedTaskWorldMessaging::HandleZoneMessage(ServerPacket *pack)
case ServerOP_SharedTaskRequest: {
auto *r = (ServerSharedTaskRequest_Struct *) pack->pBuffer;
LogTasksDetail(
"[ServerOP_SharedTaskRequest] Received request from character [{}] task_id [{}] npc_type_id [{}]",
"[ServerOP_SharedTaskRequest] Received request from character [{}] task_id [{}] npc_entity_id [{}]",
r->requested_character_id,
r->requested_task_id,
r->requested_npc_type_id
r->requested_npc_entity_id
);
shared_task_manager.AttemptSharedTaskCreation(
r->requested_task_id,
r->requested_character_id,
r->requested_npc_type_id
r->requested_npc_entity_id
);
break;
-1
View File
@@ -46,7 +46,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/repositories/player_event_logs_repository.h"
#include "../common/events/player_event_logs.h"
#include "../common/patches/patches.h"
#include "../zone/data_bucket.h"
#include "../common/repositories/guild_tributes_repository.h"
#include "../common/skill_caps.h"
#include "../common/server_reload_types.h"
+254 -59
View File
@@ -12,7 +12,6 @@ SET(zone_sources
bonuses.cpp
bot.cpp
bot_raid.cpp
bot_command.cpp
bot_database.cpp
botspellsai.cpp
cheat_manager.cpp
@@ -23,9 +22,8 @@ SET(zone_sources
client_packet.cpp
client_process.cpp
combat_record.cpp
command.cpp
corpse.cpp
data_bucket.cpp
../common/data_bucket.cpp
doors.cpp
dialogue_window.cpp
dynamic_zone.cpp
@@ -48,36 +46,6 @@ SET(zone_sources
horse.cpp
inventory.cpp
loot.cpp
lua_bot.cpp
lua_bit.cpp
lua_buff.cpp
lua_corpse.cpp
lua_client.cpp
lua_database.cpp
lua_door.cpp
lua_encounter.cpp
lua_entity.cpp
lua_entity_list.cpp
lua_expedition.cpp
lua_general.cpp
lua_group.cpp
lua_hate_list.cpp
lua_inventory.cpp
lua_item.cpp
lua_iteminst.cpp
lua_merc.cpp
lua_mob.cpp
lua_mod.cpp
lua_npc.cpp
lua_object.cpp
lua_packet.cpp
lua_parser.cpp
lua_parser_events.cpp
lua_raid.cpp
lua_spawn.cpp
lua_spell.cpp
lua_stat_bonuses.cpp
lua_zone.cpp
embperl.cpp
entity.cpp
exp.cpp
@@ -108,30 +76,6 @@ SET(zone_sources
pathfinder_nav_mesh.cpp
pathfinder_null.cpp
pathing.cpp
perl_bot.cpp
perl_buff.cpp
perl_client.cpp
perl_database.cpp
perl_doors.cpp
perl_entity.cpp
perl_expedition.cpp
perl_groups.cpp
perl_hateentry.cpp
perl_inventory.cpp
perl_merc.cpp
perl_mob.cpp
perl_npc.cpp
perl_object.cpp
perl_perlpacket.cpp
perl_player_corpse.cpp
perl_questitem.cpp
perl_questitem_data.cpp
perl_raids.cpp
perl_spawn.cpp
perl_spell.cpp
perl_stat_bonuses.cpp
perl_zone.cpp
perlpacket.cpp
petitions.cpp
pets.cpp
position.cpp
@@ -195,7 +139,7 @@ SET(zone_headers
command.h
common.h
corpse.h
data_bucket.h
../common/data_bucket.h
doors.h
dialogue_window.h
dynamic_zone.h
@@ -296,10 +240,247 @@ SET(zone_headers
zone_save_state.h
zone_cli.cpp)
# lua unity build
set(lua_sources
lua_bot.cpp
lua_bit.cpp
lua_buff.cpp
lua_corpse.cpp
lua_client.cpp
lua_database.cpp
lua_door.cpp
lua_encounter.cpp
lua_entity.cpp
lua_entity_list.cpp
lua_expedition.cpp
lua_general.cpp
lua_group.cpp
lua_hate_list.cpp
lua_inventory.cpp
lua_item.cpp
lua_iteminst.cpp
lua_merc.cpp
lua_mob.cpp
lua_mod.cpp
lua_npc.cpp
lua_object.cpp
lua_packet.cpp
lua_parser.cpp
lua_parser_events.cpp
lua_raid.cpp
lua_spawn.cpp
lua_spell.cpp
lua_stat_bonuses.cpp
lua_zone.cpp
)
add_library(lua_zone STATIC ${lua_sources})
set_target_properties(lua_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 8)
# perl unity build
set(perl_sources
perl_bot.cpp
perl_buff.cpp
perl_client.cpp
perl_database.cpp
perl_doors.cpp
perl_entity.cpp
perl_expedition.cpp
perl_groups.cpp
perl_hateentry.cpp
perl_inventory.cpp
perl_merc.cpp
perl_mob.cpp
perl_npc.cpp
perl_object.cpp
perl_perlpacket.cpp
perl_player_corpse.cpp
perl_questitem.cpp
perl_questitem_data.cpp
perl_raids.cpp
perl_spawn.cpp
perl_spell.cpp
perl_stat_bonuses.cpp
perl_zone.cpp
perlpacket.cpp
)
add_library(perl_zone STATIC ${perl_sources})
set_target_properties(perl_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 8)
# gm commands
set(gm_command_sources
command.cpp
bot_command.cpp
gm_commands/acceptrules.cpp
gm_commands/advnpcspawn.cpp
gm_commands/aggrozone.cpp
gm_commands/ai.cpp
gm_commands/appearance.cpp
gm_commands/appearanceeffects.cpp
gm_commands/attack.cpp
gm_commands/augmentitem.cpp
gm_commands/ban.cpp
gm_commands/bugs.cpp
gm_commands/camerashake.cpp
gm_commands/castspell.cpp
gm_commands/chat.cpp
gm_commands/clearxtargets.cpp
gm_commands/copycharacter.cpp
gm_commands/corpse.cpp
gm_commands/corpsefix.cpp
gm_commands/countitem.cpp
gm_commands/damage.cpp
gm_commands/databuckets.cpp
gm_commands/dbspawn2.cpp
gm_commands/delacct.cpp
gm_commands/delpetition.cpp
gm_commands/depop.cpp
gm_commands/depopzone.cpp
gm_commands/devtools.cpp
gm_commands/disablerecipe.cpp
gm_commands/disarmtrap.cpp
gm_commands/doanim.cpp
gm_commands/door.cpp
gm_commands/door_manipulation.cpp
gm_commands/dye.cpp
gm_commands/dz.cpp
gm_commands/dzkickplayers.cpp
gm_commands/editmassrespawn.cpp
gm_commands/emote.cpp
gm_commands/emptyinventory.cpp
gm_commands/enablerecipe.cpp
gm_commands/entityvariable.cpp
gm_commands/exptoggle.cpp
gm_commands/faction.cpp
gm_commands/evolving_items.cpp
gm_commands/feature.cpp
gm_commands/find.cpp
gm_commands/fish.cpp
gm_commands/fixmob.cpp
gm_commands/flagedit.cpp
gm_commands/fleeinfo.cpp
gm_commands/forage.cpp
gm_commands/gearup.cpp
gm_commands/giveitem.cpp
gm_commands/givemoney.cpp
gm_commands/gmzone.cpp
gm_commands/goto.cpp
gm_commands/grantaa.cpp
gm_commands/grid.cpp
gm_commands/guild.cpp
gm_commands/hp.cpp
gm_commands/illusion_block.cpp
gm_commands/instance.cpp
gm_commands/interrogateinv.cpp
gm_commands/interrupt.cpp
gm_commands/invsnapshot.cpp
gm_commands/ipban.cpp
gm_commands/kick.cpp
gm_commands/kill.cpp
gm_commands/killallnpcs.cpp
gm_commands/list.cpp
gm_commands/lootsim.cpp
gm_commands/loc.cpp
gm_commands/logs.cpp
gm_commands/makepet.cpp
gm_commands/memspell.cpp
gm_commands/merchantshop.cpp
gm_commands/modifynpcstat.cpp
gm_commands/movechar.cpp
gm_commands/movement.cpp
gm_commands/myskills.cpp
gm_commands/mysql.cpp
gm_commands/mystats.cpp
gm_commands/npccast.cpp
gm_commands/npcedit.cpp
gm_commands/npceditmass.cpp
gm_commands/npcemote.cpp
gm_commands/npcloot.cpp
gm_commands/npcsay.cpp
gm_commands/npcshout.cpp
gm_commands/npcspawn.cpp
gm_commands/npctypespawn.cpp
gm_commands/nudge.cpp
gm_commands/nukebuffs.cpp
gm_commands/nukeitem.cpp
gm_commands/object.cpp
gm_commands/object_manipulation.cpp
gm_commands/parcels.cpp
gm_commands/path.cpp
gm_commands/peqzone.cpp
gm_commands/petitems.cpp
gm_commands/petname.cpp
gm_commands/picklock.cpp
gm_commands/profanity.cpp
gm_commands/push.cpp
gm_commands/raidloot.cpp
gm_commands/randomfeatures.cpp
gm_commands/refreshgroup.cpp
gm_commands/reload.cpp
gm_commands/removeitem.cpp
gm_commands/repop.cpp
gm_commands/resetaa.cpp
gm_commands/resetaa_timer.cpp
gm_commands/resetdisc_timer.cpp
gm_commands/revoke.cpp
gm_commands/roambox.cpp
gm_commands/rules.cpp
gm_commands/save.cpp
gm_commands/scale.cpp
gm_commands/scribespell.cpp
gm_commands/scribespells.cpp
gm_commands/sendzonespawns.cpp
gm_commands/sensetrap.cpp
gm_commands/serverrules.cpp
gm_commands/set.cpp
gm_commands/show.cpp
gm_commands/shutdown.cpp
gm_commands/spawn.cpp
gm_commands/spawneditmass.cpp
gm_commands/spawnfix.cpp
gm_commands/faction_association.cpp
gm_commands/stun.cpp
gm_commands/summon.cpp
gm_commands/summonburiedplayercorpse.cpp
gm_commands/summonitem.cpp
gm_commands/suspend.cpp
gm_commands/suspendmulti.cpp
gm_commands/takeplatinum.cpp
gm_commands/task.cpp
gm_commands/traindisc.cpp
gm_commands/tune.cpp
gm_commands/undye.cpp
gm_commands/unmemspell.cpp
gm_commands/unmemspells.cpp
gm_commands/unscribespell.cpp
gm_commands/unscribespells.cpp
gm_commands/untraindisc.cpp
gm_commands/untraindiscs.cpp
gm_commands/wc.cpp
gm_commands/worldshutdown.cpp
gm_commands/worldwide.cpp
gm_commands/wp.cpp
gm_commands/wpadd.cpp
gm_commands/zone.cpp
gm_commands/zonebootup.cpp
gm_commands/zoneshutdown.cpp
gm_commands/zonevariable.cpp
gm_commands/zone_instance.cpp
gm_commands/zone_shard.cpp
gm_commands/zsave.cpp
)
add_library(gm_commands_zone STATIC ${gm_command_sources})
set_target_properties(gm_commands_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 32)
# zone combine sources and headers
ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
# binary output directory
INSTALL(TARGETS zone RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
# precompile headers
IF (WIN32 AND EQEMU_BUILD_PCH)
TARGET_PRECOMPILE_HEADERS(zone PRIVATE ../common/pch/pch.h)
TARGET_PRECOMPILE_HEADERS(zone PRIVATE ../common/types.h ../common/eqemu_logsys.h ../common/eqemu_logsys_log_aliases.h ../common/features.h ../common/global_define.h)
@@ -308,6 +489,20 @@ ENDIF()
ADD_DEFINITIONS(-DZONE)
TARGET_LINK_LIBRARIES(zone ${ZONE_LIBS})
# link lua_zone unity build against luabind
target_link_libraries(lua_zone PRIVATE luabind)
if (EQEMU_BUILD_STATIC AND LUA_LIBRARY)
target_link_libraries(zone PRIVATE ${LUA_LIBRARY})
endif()
# perl unity build links against perl_zone
target_link_libraries(perl_zone PRIVATE perlbind)
if (EQEMU_BUILD_STATIC AND PERL_LIBRARY)
target_link_libraries(zone PRIVATE ${PERL_LIBRARY})
endif()
# link zone against common libraries
target_link_libraries(zone PRIVATE ${ZONE_LIBS} lua_zone perl_zone gm_commands_zone)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+1 -1
View File
@@ -9,7 +9,7 @@
Aura::Aura(NPCType *type_data, Mob *owner, AuraRecord &record)
: NPC(type_data, 0, owner->GetPosition(), GravityBehavior::Flying), spell_id(record.spell_id),
distance(record.distance),
remove_timer(record.duration), movement_timer(100), process_timer(1000), aura_id(-1)
remove_timer(record.duration), movement_timer(1000), process_timer(1000), aura_id(-1)
{
GiveNPCTypeData(type_data); // we will delete this later on
m_owner = owner->GetID();
+1 -1
View File
@@ -3640,7 +3640,7 @@ bool Bot::Spawn(Client* botCharacterOwner) {
entity_list.AddBot(this, true, true);
ClearDataBucketCache();
DataBucket::GetDataBuckets(this);
LoadDataBucketsCache();
LoadBotSpellSettings();
if (!AI_AddBotSpells(GetBotSpellID())) {
GetBotOwner()->CastToClient()->Message(
+1 -1
View File
@@ -5,7 +5,7 @@
#include "../../common/eqemu_logsys.h"
#include "../sidecar_api/sidecar_api.h"
#include "../../common/platform.h"
#include "../data_bucket.h"
#include "../../common/data_bucket.h"
#include "../zonedb.h"
#include "../../common/repositories/data_buckets_repository.h"
@@ -1,4 +1,3 @@
#include "../../common/http/httplib.h"
#include "../../common/eqemu_logsys.h"
#include "../../common/platform.h"
#include "../../zone.h"
+53 -17
View File
@@ -39,7 +39,7 @@ extern volatile bool RunLoops;
#include "../common/strings.h"
#include "../common/data_verification.h"
#include "../common/profanity_manager.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "dynamic_zone.h"
#include "expedition_request.h"
#include "position.h"
@@ -226,8 +226,8 @@ Client::Client() : Mob(
last_reported_endurance_percent = 0;
last_reported_mana_percent = 0;
gm_hide_me = false;
AFK = false;
LFG = false;
m_is_afk = false;
LFG = false;
LFGFromLevel = 0;
LFGToLevel = 0;
LFGMatchFilter = false;
@@ -536,8 +536,8 @@ Client::Client(EQStreamInterface *ieqs) : Mob(
last_reported_endurance_percent = 0;
last_reported_mana_percent = 0;
gm_hide_me = false;
AFK = false;
LFG = false;
m_is_afk = false;
LFG = false;
LFGFromLevel = 0;
LFGToLevel = 0;
LFGMatchFilter = false;
@@ -1175,6 +1175,10 @@ void Client::QueuePacket(const EQApplicationPacket* app, bool ack_req, CLIENT_CO
return;
}
if (RuleB(Character, AutoIdleFilterPackets) && m_is_idle && IsFilteredAFKPacket(app)) {
return;
}
if (client_state != CLIENT_CONNECTED && required_state == CLIENT_CONNECTED) {
AddPacket(app, ack_req);
return;
@@ -2528,7 +2532,7 @@ void Client::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
Mob::FillSpawnStruct(ns, ForWho);
// Populate client-specific spawn information
ns->spawn.afk = AFK;
ns->spawn.afk = m_is_afk;
ns->spawn.lfg = LFG; // afk and lfg are cleared on zoning on live
ns->spawn.anon = m_pp.anon;
ns->spawn.gm = GetGM() ? 1 : 0;
@@ -10839,15 +10843,37 @@ void Client::SetAnon(uint8 anon_flag) {
safe_delete(outapp);
}
void Client::SetAFK(uint8 afk_flag) {
AFK = afk_flag;
auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* spawn_appearance = (SpawnAppearance_Struct*)outapp->pBuffer;
spawn_appearance->spawn_id = GetID();
spawn_appearance->type = AppearanceType::AFK;
spawn_appearance->parameter = afk_flag;
entity_list.QueueClients(this, outapp);
safe_delete(outapp);
void Client::SetAFK(uint8 afk_flag)
{
if (!afk_flag) {
ResetAFKTimer();
}
bool changed_afk_state = (m_is_afk && !afk_flag) || (!m_is_afk && afk_flag);
if (!changed_afk_state) {
return;
}
// set messaging based on the state
std::string you_are = "You are no longer AFK.";
if (!m_is_afk && afk_flag) {
you_are = "You are now AFK.";
}
// set the state
m_is_afk = afk_flag;
// inform of state change
Message(Chat::Yellow, you_are.c_str());
// send the spawn appearance packet to all clients
static EQApplicationPacket p(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
auto *s = (SpawnAppearance_Struct *) p.pBuffer;
s->spawn_id = GetID();
s->type = AppearanceType::AFK;
s->parameter = afk_flag;
entity_list.QueueClients(this, &p);
}
void Client::SendToInstance(std::string instance_type, std::string zone_short_name, uint32 instance_version, float x, float y, float z, float heading, std::string instance_identifier, uint32 duration) {
@@ -12713,7 +12739,7 @@ void Client::SendTopLevelInventory()
}
}
void Client::CheckSendBulkNpcPositions()
void Client::CheckSendBulkNpcPositions(bool force)
{
float distance_moved = DistanceNoZ(m_last_position_before_bulk_update, GetPosition());
float update_range = RuleI(Range, MobCloseScanDistance);
@@ -12724,7 +12750,7 @@ void Client::CheckSendBulkNpcPositions()
int updated_count = 0;
int skipped_count = 0;
if (is_ready_to_update) {
if (is_ready_to_update || force) {
auto &mob_movement_manager = MobMovementManager::Get();
for (auto &e: entity_list.GetMobList()) {
@@ -12770,6 +12796,16 @@ void Client::CheckSendBulkNpcPositions()
updated_count++;
}
if (force) {
static EQApplicationPacket p(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
auto *s = (PlayerPositionUpdateServer_Struct *) p.pBuffer;
for (auto &e: entity_list.GetCorpseList()) {
Corpse *c = e.second;
MakeSpawnUpdate(s);
QueuePacket(&p, false);
}
}
LogPositionUpdate(
"[{}] Sent [{}] bulk updated NPC positions, skipped [{}] distance_moved [{}] update_range [{}]",
GetCleanName(),
+22 -3
View File
@@ -501,9 +501,19 @@ public:
void Kick(const std::string &reason);
void WorldKick();
inline uint8 GetAnon() const { return m_pp.anon; }
inline uint8 GetAFK() const { return AFK; }
inline uint8 GetAFK() const { return m_is_afk; }
void SetAnon(uint8 anon_flag);
inline Client* ResetAFKTimer() {
if (!RuleB(Character, EnableAutoAFK)) {
return this;
}
m_afk_reset = true;
m_last_moved = std::chrono::steady_clock::now();
return this;
};
void SetAFK(uint8 afk_flag);
inline bool IsIdle() { return m_is_idle; }
inline PlayerProfile_Struct& GetPP() { return m_pp; }
inline ExtendedProfile_Struct& GetEPP() { return m_epp; }
inline EQ::InventoryProfile& GetInv() { return m_inv; }
@@ -2062,7 +2072,8 @@ private:
uint8 LFGToLevel;
bool LFGMatchFilter;
char LFGComments[64];
bool AFK;
bool m_is_afk = false;
bool m_is_manual_afk = false;
bool auto_attack;
bool auto_fire;
bool runmode;
@@ -2216,7 +2227,12 @@ private:
glm::vec4 m_last_position_before_bulk_update;
Timer m_client_bulk_npc_pos_update_timer;
Timer m_position_update_timer;
void CheckSendBulkNpcPositions();
void CheckSendBulkNpcPositions(bool force = false);
// afk
bool m_is_idle = false;
bool m_afk_reset = false; // used to trigger next-tic afk reset
std::chrono::steady_clock::time_point m_last_moved = std::chrono::steady_clock::now();
void BulkSendInventoryItems();
@@ -2410,6 +2426,9 @@ public:
const std::string &GetMailKey() const;
void ShowZoneShardMenu();
void Handle_OP_ChangePetName(const EQApplicationPacket *app);
bool IsFilteredAFKPacket(const EQApplicationPacket *p);
void CheckAutoIdleAFK(PlayerPositionUpdateClient_Struct *p);
void SyncWorldPositionsToClient(bool ignore_idle = false);
};
#endif
+191 -3
View File
@@ -42,7 +42,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/data_verification.h"
#include "../common/rdtsc.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "dynamic_zone.h"
#include "event_codes.h"
#include "guild_mgr.h"
@@ -1473,7 +1473,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
// Load Data Buckets
ClearDataBucketCache();
DataBucket::GetDataBuckets(this);
LoadDataBucketsCache();
// Max Level for Character:PerCharacterQglobalMaxLevel and Character:PerCharacterBucketMaxLevel
uint8 client_max_level = 0;
@@ -4383,6 +4383,14 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
m_TargetRing = glm::vec3(castspell->x_pos, castspell->y_pos, castspell->z_pos);
if (castspell->spell_id && IsValidSpell(castspell->spell_id)) {
bool is_non_combat_zone = !zone->CanDoCombat() || zone->BuffTimersSuspended();
bool is_excluded_reset = is_non_combat_zone && IsBardSong(castspell->spell_id);
if (!is_excluded_reset) {
ResetAFKTimer();
}
}
LogSpells("OP CastSpell: slot [{}] spell [{}] target [{}] inv [{}]", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot);
CastingSlot slot = static_cast<CastingSlot>(castspell->slot);
@@ -4566,6 +4574,12 @@ void Client::Handle_OP_ChannelMessage(const EQApplicationPacket *app)
return;
}
// reject automatic AFK messages from resetting /afk
std::string message = cm->message;
if (!Strings::Contains(message, "Sorry, I am A.F.K.")) {
ResetAFKTimer();
}
if (IsAIControlled() && !GetGM()) {
Message(Chat::Red, "You try to speak but can't move your mouth!");
return;
@@ -4992,6 +5006,10 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
SetMoving(!(cy == m_Position.y && cx == m_Position.x));
if (RuleB(Character, EnableAutoAFK)) {
CheckAutoIdleAFK(ppu);
}
CheckClientToNpcAggroTimer();
if (m_mob_check_moving_timer.Check()) {
@@ -10792,6 +10810,8 @@ void Client::Handle_OP_MoveItem(const EQApplicationPacket *app)
return;
}
ResetAFKTimer();
BenchTimer bench;
MoveItem_Struct* mi = (MoveItem_Struct*) app->pBuffer;
@@ -14732,7 +14752,9 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
}
else if (sa->type == AppearanceType::AFK) {
if (afk_toggle_timer.Check()) {
AFK = (sa->parameter == 1);
m_is_afk = (sa->parameter == 1);
m_is_manual_afk = (sa->parameter == 1);
ResetAFKTimer();
entity_list.QueueClients(this, app, true);
}
}
@@ -15551,6 +15573,14 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app)
// Pass trade request on to recipient
if (tradee && tradee->IsClient()) {
// if we are idling we need to sync client positions otherwise clients will not be aware of each other
if (m_is_idle) {
SyncWorldPositionsToClient(true);
}
if (tradee->CastToClient()->IsIdle()) {
tradee->CastToClient()->SyncWorldPositionsToClient(true);
}
tradee->CastToClient()->QueuePacket(app);
}
else if (tradee && (tradee->IsNPC() || tradee->IsBot())) {
@@ -15580,6 +15610,14 @@ void Client::Handle_OP_TradeRequestAck(const EQApplicationPacket *app)
Mob* tradee = entity_list.GetMob(msg->to_mob_id);
if (tradee && tradee->IsClient()) {
// if we are idling we need to sync client positions otherwise clients will not be aware of each other
if (m_is_idle) {
SyncWorldPositionsToClient(true);
}
if (tradee->CastToClient()->IsIdle()) {
tradee->CastToClient()->SyncWorldPositionsToClient(true);
}
trade->Start(msg->to_mob_id);
tradee->CastToClient()->QueuePacket(app);
}
@@ -17166,3 +17204,153 @@ void Client::Handle_OP_EvolveItem(const EQApplicationPacket *app)
}
}
}
bool Client::IsFilteredAFKPacket(const EQApplicationPacket *p)
{
if (p->GetOpcode() == OP_ClientUpdate) {
return true;
}
return false;
}
void Client::CheckAutoIdleAFK(PlayerPositionUpdateClient_Struct *p)
{
if (!RuleB(Character, EnableAutoAFK)) {
return;
}
bool is_non_combat_zone = !zone->CanDoCombat() || zone->BuffTimersSuspended();
int seconds_before_afk =
is_non_combat_zone ?
RuleI(Character, SecondsBeforeAFKNonCombatZone) :
RuleI(Character, SecondsBeforeAFKCombatZone);
int seconds_before_idle =
is_non_combat_zone ?
RuleI(Character, SecondsBeforeIdleNonCombatZone) :
RuleI(Character, SecondsBeforeIdleCombatZone);
// seconds_before_idle can't be greater than seconds_before_afk
if (seconds_before_idle > seconds_before_afk) {
seconds_before_idle = seconds_before_afk;
}
bool has_moved =
m_Position.x != p->x_pos ||
m_Position.y != p->y_pos ||
m_Position.z != p->z_pos ||
m_Position.w != EQ12toFloat(p->heading);
bool triggered_reset = m_afk_reset;
bool was_idle = m_is_idle;
bool is_idle_or_afk = m_is_idle || m_is_afk;
if (!has_moved && (!m_is_idle || !m_is_afk)) {
auto now = std::chrono::steady_clock::now();
auto since_last_moved = now - m_last_moved;
if (!m_is_manual_afk && !m_is_afk && since_last_moved > std::chrono::seconds(seconds_before_afk)) {
bool is_client_excluded_from_afk = (IsBuyer() || IsTrader() || GetGM());
if (is_client_excluded_from_afk) {
return;
}
LogInfo(
"Client [{}] has been AFK for [{}] seconds",
GetCleanName(),
std::chrono::duration_cast<std::chrono::seconds>(since_last_moved).count()
);
SetAFK(true);
return;
}
else if (!m_is_idle && since_last_moved > std::chrono::seconds(seconds_before_idle)) {
bool is_client_excluded_from_idle = GetGM() && !is_non_combat_zone;
if (is_client_excluded_from_idle) {
return;
}
LogInfo(
"Client [{}] has been idle for [{}] seconds",
GetCleanName(),
std::chrono::duration_cast<std::chrono::seconds>(since_last_moved).count()
);
m_is_idle = true;
Message(Chat::Yellow, "You are now idle. Updates will be sent to you less frequently.");
return;
}
}
// if we triggered a reset, but didn't move, we are still idling but not AFK
if (triggered_reset && was_idle) {
m_is_idle = true;
}
// if we moved or triggered reset through other actions, we are no longer AFK.
// we could trigger resetting AFK status through actions like message, cast, attack etc but still by idle until we move
if (!m_is_manual_afk && (has_moved || triggered_reset) && m_is_afk) {
LogInfo("AFK [{}] is no longer idle, syncing positions", GetCleanName());
SetAFK(false);
ResetAFKTimer();
}
// we could be not AFK and idle at the same time
if (has_moved && m_is_idle) {
LogInfo("Idle [{}] is no longer idle, syncing positions", GetCleanName());
m_is_idle = false;
Message(Chat::Yellow, "You are no longer idle.");
SyncWorldPositionsToClient();
ResetAFKTimer();
}
m_afk_reset = false;
}
void Client::SyncWorldPositionsToClient(bool ignore_idle)
{
// if we are idle currently, we need to force updates (which bypasses idle status) and reset idle status
bool reset_idle = false;
if (ignore_idle && m_is_idle) {
m_is_idle = false;
reset_idle = true;
}
LogInfo("Syncing positions for client [{}]", GetCleanName());
CheckSendBulkNpcPositions(true);
static EQApplicationPacket cu(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct));
for (auto &e: entity_list.GetClientList()) {
auto c = e.second;
// skip if not in range
if (Distance(c->GetPosition(), GetPosition()) > RuleI(Range, ClientPositionUpdates)) {
continue;
}
// skip self
if (c == this) {
continue;
}
auto *spu = (PlayerPositionUpdateServer_Struct *) cu.pBuffer;
memset(spu, 0x00, sizeof(PlayerPositionUpdateServer_Struct));
spu->spawn_id = c->GetID();
spu->x_pos = FloatToEQ19(c->GetX());
spu->y_pos = FloatToEQ19(c->GetY());
spu->z_pos = FloatToEQ19(c->GetZ());
spu->heading = FloatToEQ12(c->GetHeading());
spu->delta_x = FloatToEQ13(0);
spu->delta_y = FloatToEQ13(0);
spu->delta_z = FloatToEQ13(0);
spu->delta_heading = FloatToEQ10(0);
spu->animation = 0;
QueuePacket(&cu);
}
if (ignore_idle && reset_idle) {
m_is_idle = false;
}
}
+4
View File
@@ -536,6 +536,10 @@ bool Client::Process() {
DoEnduranceRegen();
BuffProcess();
if (auto_attack) {
ResetAFKTimer();
}
if (tribute_timer.Check()) {
ToggleTribute(true); //re-activate the tribute.
}
+1 -159
View File
@@ -19,7 +19,7 @@
#include "../common/file.h"
#include "../common/repositories/dynamic_zones_repository.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "command.h"
#include "dynamic_zone.h"
#include "queryserv.h"
@@ -783,161 +783,3 @@ void command_bot(Client *c, const Seperator *sep)
c->Message(Chat::Red, "Bots are disabled on this server.");
}
}
#include "gm_commands/acceptrules.cpp"
#include "gm_commands/advnpcspawn.cpp"
#include "gm_commands/aggrozone.cpp"
#include "gm_commands/ai.cpp"
#include "gm_commands/appearance.cpp"
#include "gm_commands/appearanceeffects.cpp"
#include "gm_commands/attack.cpp"
#include "gm_commands/augmentitem.cpp"
#include "gm_commands/ban.cpp"
#include "gm_commands/bugs.cpp"
#include "gm_commands/camerashake.cpp"
#include "gm_commands/castspell.cpp"
#include "gm_commands/chat.cpp"
#include "gm_commands/clearxtargets.cpp"
#include "gm_commands/copycharacter.cpp"
#include "gm_commands/corpse.cpp"
#include "gm_commands/corpsefix.cpp"
#include "gm_commands/countitem.cpp"
#include "gm_commands/damage.cpp"
#include "gm_commands/databuckets.cpp"
#include "gm_commands/dbspawn2.cpp"
#include "gm_commands/delacct.cpp"
#include "gm_commands/delpetition.cpp"
#include "gm_commands/depop.cpp"
#include "gm_commands/depopzone.cpp"
#include "gm_commands/devtools.cpp"
#include "gm_commands/disablerecipe.cpp"
#include "gm_commands/disarmtrap.cpp"
#include "gm_commands/doanim.cpp"
#include "gm_commands/door.cpp"
#include "gm_commands/door_manipulation.cpp"
#include "gm_commands/dye.cpp"
#include "gm_commands/dz.cpp"
#include "gm_commands/dzkickplayers.cpp"
#include "gm_commands/editmassrespawn.cpp"
#include "gm_commands/emote.cpp"
#include "gm_commands/emptyinventory.cpp"
#include "gm_commands/enablerecipe.cpp"
#include "gm_commands/entityvariable.cpp"
#include "gm_commands/exptoggle.cpp"
#include "gm_commands/faction.cpp"
#include "gm_commands/evolving_items.cpp"
#include "gm_commands/feature.cpp"
#include "gm_commands/find.cpp"
#include "gm_commands/fish.cpp"
#include "gm_commands/fixmob.cpp"
#include "gm_commands/flagedit.cpp"
#include "gm_commands/fleeinfo.cpp"
#include "gm_commands/forage.cpp"
#include "gm_commands/gearup.cpp"
#include "gm_commands/giveitem.cpp"
#include "gm_commands/givemoney.cpp"
#include "gm_commands/gmzone.cpp"
#include "gm_commands/goto.cpp"
#include "gm_commands/grantaa.cpp"
#include "gm_commands/grid.cpp"
#include "gm_commands/guild.cpp"
#include "gm_commands/hp.cpp"
#include "gm_commands/illusion_block.cpp"
#include "gm_commands/instance.cpp"
#include "gm_commands/interrogateinv.cpp"
#include "gm_commands/interrupt.cpp"
#include "gm_commands/invsnapshot.cpp"
#include "gm_commands/ipban.cpp"
#include "gm_commands/kick.cpp"
#include "gm_commands/kill.cpp"
#include "gm_commands/killallnpcs.cpp"
#include "gm_commands/list.cpp"
#include "gm_commands/lootsim.cpp"
#include "gm_commands/loc.cpp"
#include "gm_commands/logs.cpp"
#include "gm_commands/makepet.cpp"
#include "gm_commands/memspell.cpp"
#include "gm_commands/merchantshop.cpp"
#include "gm_commands/modifynpcstat.cpp"
#include "gm_commands/movechar.cpp"
#include "gm_commands/movement.cpp"
#include "gm_commands/myskills.cpp"
#include "gm_commands/mysql.cpp"
#include "gm_commands/mystats.cpp"
#include "gm_commands/npccast.cpp"
#include "gm_commands/npcedit.cpp"
#include "gm_commands/npceditmass.cpp"
#include "gm_commands/npcemote.cpp"
#include "gm_commands/npcloot.cpp"
#include "gm_commands/npcsay.cpp"
#include "gm_commands/npcshout.cpp"
#include "gm_commands/npcspawn.cpp"
#include "gm_commands/npctypespawn.cpp"
#include "gm_commands/nudge.cpp"
#include "gm_commands/nukebuffs.cpp"
#include "gm_commands/nukeitem.cpp"
#include "gm_commands/object.cpp"
#include "gm_commands/object_manipulation.cpp"
#include "gm_commands/parcels.cpp"
#include "gm_commands/path.cpp"
#include "gm_commands/peqzone.cpp"
#include "gm_commands/petitems.cpp"
#include "gm_commands/petname.cpp"
#include "gm_commands/picklock.cpp"
#include "gm_commands/profanity.cpp"
#include "gm_commands/push.cpp"
#include "gm_commands/raidloot.cpp"
#include "gm_commands/randomfeatures.cpp"
#include "gm_commands/refreshgroup.cpp"
#include "gm_commands/reload.cpp"
#include "gm_commands/removeitem.cpp"
#include "gm_commands/repop.cpp"
#include "gm_commands/resetaa.cpp"
#include "gm_commands/resetaa_timer.cpp"
#include "gm_commands/resetdisc_timer.cpp"
#include "gm_commands/revoke.cpp"
#include "gm_commands/roambox.cpp"
#include "gm_commands/rules.cpp"
#include "gm_commands/save.cpp"
#include "gm_commands/scale.cpp"
#include "gm_commands/scribespell.cpp"
#include "gm_commands/scribespells.cpp"
#include "gm_commands/sendzonespawns.cpp"
#include "gm_commands/sensetrap.cpp"
#include "gm_commands/serverrules.cpp"
#include "gm_commands/set.cpp"
#include "gm_commands/show.cpp"
#include "gm_commands/shutdown.cpp"
#include "gm_commands/spawn.cpp"
#include "gm_commands/spawneditmass.cpp"
#include "gm_commands/spawnfix.cpp"
#include "gm_commands/faction_association.cpp"
#include "gm_commands/stun.cpp"
#include "gm_commands/summon.cpp"
#include "gm_commands/summonburiedplayercorpse.cpp"
#include "gm_commands/summonitem.cpp"
#include "gm_commands/suspend.cpp"
#include "gm_commands/suspendmulti.cpp"
#include "gm_commands/takeplatinum.cpp"
#include "gm_commands/task.cpp"
#include "gm_commands/traindisc.cpp"
#include "gm_commands/tune.cpp"
#include "gm_commands/undye.cpp"
#include "gm_commands/unmemspell.cpp"
#include "gm_commands/unmemspells.cpp"
#include "gm_commands/unscribespell.cpp"
#include "gm_commands/unscribespells.cpp"
#include "gm_commands/untraindisc.cpp"
#include "gm_commands/untraindiscs.cpp"
#include "gm_commands/wc.cpp"
#include "gm_commands/worldshutdown.cpp"
#include "gm_commands/worldwide.cpp"
#include "gm_commands/wp.cpp"
#include "gm_commands/wpadd.cpp"
#include "gm_commands/zone.cpp"
#include "gm_commands/zonebootup.cpp"
#include "gm_commands/zoneshutdown.cpp"
#include "gm_commands/zonevariable.cpp"
#include "gm_commands/zone_instance.cpp"
#include "gm_commands/zone_shard.cpp"
#include "gm_commands/zsave.cpp"
+12 -7
View File
@@ -1,5 +1,3 @@
#include <regex>
#include "dialogue_window.h"
void DialogueWindow::Render(Client *c, std::string markdown)
@@ -529,12 +527,19 @@ std::string DialogueWindow::CenterMessage(std::string message)
return std::string();
}
auto cleaned_message = message;
std::string cleaned_message;
cleaned_message.reserve(message.size());
std::regex tags("<[^>]*>");
if (std::regex_search(cleaned_message, tags)) {
std::regex_replace(cleaned_message, tags, cleaned_message);
// Strip HTML-like tags
bool in_tag = false;
for (char c : message) {
if (c == '<') {
in_tag = true;
} else if (c == '>' && in_tag) {
in_tag = false;
} else if (!in_tag) {
cleaned_message += c;
}
}
auto message_len = cleaned_message.length();
+3 -1
View File
@@ -852,11 +852,13 @@ void Doors::CreateDatabaseEntry()
const auto& l = DoorsRepository::GetWhere(
content_db,
fmt::format(
"zone = '{}' AND doorid = {}",
"zone = '{}' AND (version = {} OR version = -1) AND doorid = {}",
zone->GetShortName(),
zone->GetInstanceVersion(),
GetDoorID()
)
);
if (!l.empty()) {
auto e = l[0];
+1 -1
View File
@@ -33,7 +33,7 @@
#include "queryserv.h"
#include "questmgr.h"
#include "zone.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "../common/events/player_event_logs.h"
#include "worldserver.h"
+22 -19
View File
@@ -137,25 +137,28 @@ void Embperl::DoInit()
catch (std::string& e) {
LogQuests("Warning [{}]: [{}]", Config->PluginPlFile, e);
}
try {
//should probably read the directory in c, instead, so that
//I can echo filenames as I do it, but c'mon... I'm lazy and this 1 line reads in all the plugins
const std::string& perl_command = (
"if(opendir(D,'" +
path.GetPluginsPath() +
"')) { "
" my @d = readdir(D);"
" closedir(D);"
" foreach(@d){ "
" main::eval_file('plugin','" +
path.GetPluginsPath() +
"/'.$_)if/\\.pl$/;"
" }"
"}");
eval_pv(perl_command.c_str(), FALSE);
}
catch (std::string& e) {
LogQuests("Warning [{}]", e);
for (auto & dir : path.GetPluginPaths()) {
try {
//should probably read the directory in c, instead, so that
//I can echo filenames as I do it, but c'mon... I'm lazy and this 1 line reads in all the plugins
const std::string& perl_command = (
"if(opendir(D,'" +
dir +
"')) { "
" my @d = readdir(D);"
" closedir(D);"
" foreach(@d){ "
" main::eval_file('plugin','" +
dir +
"/'.$_)if/\\.pl$/;"
" }"
"}");
eval_pv(perl_command.c_str(), FALSE);
}
catch (std::string& e) {
LogQuests("Warning [{}]", e);
}
}
#endif //EMBPERL_PLUGIN
}
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../common/strings.h"
#include "client.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "groups.h"
#include "mob.h"
#include "raids.h"
+10 -10
View File
@@ -1,8 +1,17 @@
#include "../client.h"
#include "../data_bucket.h"
#include "../../common/data_bucket.h"
#include "../dialogue_window.h"
#include "../../common/repositories/data_buckets_repository.h"
void SendDataBucketsSubCommands(Client *c)
{
c->Message(Chat::White, "Usage: #databuckets delete [Key] [Character ID] [NPC ID] [Bot ID]");
c->Message(Chat::White, "Usage: #databuckets edit [Key] [Character ID] [NPC ID] [Bot ID] [Value] [Expires]");
c->Message(Chat::White, "Usage: #databuckets view [Partial Key] [Character ID] [NPC ID] [Bot ID]");
c->Message(Chat::White, "Note: Character ID, NPC ID, and Bot ID are optional if not needed, if needed they are required for specificity");
c->Message(Chat::White, "Note: Edit requires Character ID, NPC ID, Bot ID, and Value, Expires is optional and does not modify the existing expiration time if not provided");
}
void command_databuckets(Client *c, const Seperator *sep)
{
const int arguments = sep->argnum;
@@ -251,12 +260,3 @@ void command_databuckets(Client *c, const Seperator *sep)
c->Message(Chat::White, response.c_str());
}
}
void SendDataBucketsSubCommands(Client *c)
{
c->Message(Chat::White, "Usage: #databuckets delete [Key] [Character ID] [NPC ID] [Bot ID]");
c->Message(Chat::White, "Usage: #databuckets edit [Key] [Character ID] [NPC ID] [Bot ID] [Value] [Expires]");
c->Message(Chat::White, "Usage: #databuckets view [Partial Key] [Character ID] [NPC ID] [Bot ID]");
c->Message(Chat::White, "Note: Character ID, NPC ID, and Bot ID are optional if not needed, if needed they are required for specificity");
c->Message(Chat::White, "Note: Edit requires Character ID, NPC ID, Bot ID, and Value, Expires is optional and does not modify the existing expiration time if not provided");
}
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../client.h"
#include "../data_bucket.h"
#include "../../common/data_bucket.h"
void command_devtools(Client *c, const Seperator *sep)
{
+1
View File
@@ -1,3 +1,4 @@
#include "../../object.h"
#include "../../client.h"
void FindObjectType(Client *c, const Seperator *sep)
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../client.h"
#include "../data_bucket.h"
#include "../../common/data_bucket.h"
void command_gmzone(Client *c, const Seperator *sep)
{
+17 -17
View File
@@ -8,6 +8,22 @@ extern QueryServ *QServ;
#include "../guild_mgr.h"
#include "../doors.h"
void SendGuildSubCommands(Client* c)
{
c->Message(Chat::White, "#guild create [Character ID|Character Name] [Guild Name]");
c->Message(Chat::White, "#guild delete [Guild ID]");
c->Message(Chat::White, "#guild details [Guild ID]");
c->Message(Chat::White, "#guild help");
c->Message(Chat::White, "#guild info [Guild ID]");
c->Message(Chat::White, "#guild list");
c->Message(Chat::White, "#guild rename [Guild ID] [New Name]");
c->Message(Chat::White, "#guild search [Search Criteria]");
c->Message(Chat::White, "#guild set [Character ID|Character Name] [Guild ID] (Guild ID 0 is Guildless)");
c->Message(Chat::White, "#guild setleader [Guild ID] [Character ID|Character Name]");
c->Message(Chat::White, "#guild setrank [Character ID|Character Name] [Rank]");
c->Message(Chat::White, "#guild status [Character ID|Character Name]");
}
void command_guild(Client* c, const Seperator* sep)
{
const auto arguments = sep->argnum;
@@ -675,20 +691,4 @@ void command_guild(Client* c, const Seperator* sep)
// }
}
}
}
void SendGuildSubCommands(Client* c)
{
c->Message(Chat::White, "#guild create [Character ID|Character Name] [Guild Name]");
c->Message(Chat::White, "#guild delete [Guild ID]");
c->Message(Chat::White, "#guild details [Guild ID]");
c->Message(Chat::White, "#guild help");
c->Message(Chat::White, "#guild info [Guild ID]");
c->Message(Chat::White, "#guild list");
c->Message(Chat::White, "#guild rename [Guild ID] [New Name]");
c->Message(Chat::White, "#guild search [Search Criteria]");
c->Message(Chat::White, "#guild set [Character ID|Character Name] [Guild ID] (Guild ID 0 is Guildless)");
c->Message(Chat::White, "#guild setleader [Guild ID] [Character ID|Character Name]");
c->Message(Chat::White, "#guild setrank [Character ID|Character Name] [Rank]");
c->Message(Chat::White, "#guild status [Character ID|Character Name]");
}
}
+1
View File
@@ -1,3 +1,4 @@
#include "../dialogue_window.h"
#include "../client.h"
void command_illusion_block(Client* c, const Seperator* sep)
+1
View File
@@ -2,6 +2,7 @@
#include "../corpse.h"
#include "../object.h"
#include "../doors.h"
#include "../command.h"
struct UniqueEntity {
uint16 entity_id;
+1
View File
@@ -1,4 +1,5 @@
#include "../client.h"
#include "../water_map.h"
void command_loc(Client *c, const Seperator *sep)
{
+58 -58
View File
@@ -1,63 +1,5 @@
#include "../client.h"
void command_modifynpcstat(Client *c, const Seperator *sep)
{
auto arguments = sep->argnum;
if (!arguments) {
c->Message(Chat::White, "Usage: #modifynpcstat [Stat] [Value]");
ListModifyNPCStatMap(c);
return;
}
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
auto target = c->GetTarget()->CastToNPC();
const std::string& stat = sep->arg[1] ? sep->arg[1] : "";
const std::string& value = sep->arg[2] ? sep->arg[2] : "";
if (stat.empty() || value.empty()) {
c->Message(Chat::White, "Usage: #modifynpcstat [Stat] [Value]");
ListModifyNPCStatMap(c);
return;
}
auto stat_description = GetModifyNPCStatDescription(stat);
if (!stat_description.length()) {
c->Message(
Chat::White,
fmt::format(
"Stat '{}' does not exist.",
stat
).c_str()
);
return;
}
target->ModifyNPCStat(stat, value);
c->Message(
Chat::White,
fmt::format(
"Stat Modified | Target: {}",
c->GetTargetDescription(target)
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Stat Modified | Stat: {} ({}) Value: {}",
GetModifyNPCStatDescription(stat),
stat,
value
).c_str()
);
}
std::map<std::string, std::string> GetModifyNPCStatMap()
{
std::map<std::string, std::string> identifiers_map = {
@@ -134,3 +76,61 @@ void ListModifyNPCStatMap(Client *c)
);
}
}
void command_modifynpcstat(Client *c, const Seperator *sep)
{
auto arguments = sep->argnum;
if (!arguments) {
c->Message(Chat::White, "Usage: #modifynpcstat [Stat] [Value]");
ListModifyNPCStatMap(c);
return;
}
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
auto target = c->GetTarget()->CastToNPC();
const std::string& stat = sep->arg[1] ? sep->arg[1] : "";
const std::string& value = sep->arg[2] ? sep->arg[2] : "";
if (stat.empty() || value.empty()) {
c->Message(Chat::White, "Usage: #modifynpcstat [Stat] [Value]");
ListModifyNPCStatMap(c);
return;
}
auto stat_description = GetModifyNPCStatDescription(stat);
if (!stat_description.length()) {
c->Message(
Chat::White,
fmt::format(
"Stat '{}' does not exist.",
stat
).c_str()
);
return;
}
target->ModifyNPCStat(stat, value);
c->Message(
Chat::White,
fmt::format(
"Stat Modified | Target: {}",
c->GetTargetDescription(target)
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Stat Modified | Stat: {} ({}) Value: {}",
GetModifyNPCStatDescription(stat),
stat,
value
).c_str()
);
}
+1
View File
@@ -1,3 +1,4 @@
#include "../bot.h"
#include "../client.h"
void command_mystats(Client *c, const Seperator *sep)
+110 -110
View File
@@ -3,6 +3,115 @@
#include "../raids.h"
#include "../../common/repositories/npc_types_repository.h"
void SendNPCEditSubCommands(Client *c)
{
c->Message(Chat::White, "Usage: #npcedit name [Name] - Sets an NPC's Name");
c->Message(Chat::White, "Usage: #npcedit lastname [Last Name] - Sets an NPC's Last Name");
c->Message(Chat::White, "Usage: #npcedit level [Level] - Sets an NPC's Level");
c->Message(Chat::White, "Usage: #npcedit race [Race ID] - Sets an NPC's Race");
c->Message(Chat::White, "Usage: #npcedit class [Class ID] - Sets an NPC's Class");
c->Message(Chat::White, "Usage: #npcedit bodytype [Body Type ID] - Sets an NPC's Bodytype");
c->Message(Chat::White, "Usage: #npcedit hp [HP] - Sets an NPC's HP");
c->Message(Chat::White, "Usage: #npcedit mana [Mana] - Sets an NPC's Mana");
c->Message(Chat::White, "Usage: #npcedit gender [Gender ID] - Sets an NPC's Gender");
c->Message(Chat::White, "Usage: #npcedit texture [Texture] - Sets an NPC's Texture");
c->Message(Chat::White, "Usage: #npcedit helmtexture [Helmet Texture] - Sets an NPC's Helmet Texture");
c->Message(Chat::White, "Usage: #npcedit herosforgemodel [Model Number] - Sets an NPC's Hero's Forge Model");
c->Message(Chat::White, "Usage: #npcedit size [Size] - Sets an NPC's Size");
c->Message(Chat::White, "Usage: #npcedit hpregen [HP Regen] - Sets an NPC's HP Regen Rate Per Tick");
c->Message(Chat::White, "Usage: #npcedit hp_regen_per_second [HP Regen] - Sets an NPC's HP Regen Rate Per Second");
c->Message(Chat::White, "Usage: #npcedit manaregen [Mana Regen] - Sets an NPC's Mana Regen Rate Per Tick");
c->Message(Chat::White, "Usage: #npcedit loottable [Loottable ID] - Sets an NPC's Loottable ID");
c->Message(Chat::White, "Usage: #npcedit merchantid [Merchant ID] - Sets an NPC's Merchant ID");
c->Message(Chat::White, "Usage: #npcedit alt_currency_id [Alternate Currency ID] - Sets an NPC's Alternate Currency ID");
c->Message(Chat::White, "Usage: #npcedit spell [Spell List ID] - Sets an NPC's Spells List ID");
c->Message(Chat::White, "Usage: #npcedit npc_spells_effects_id [Spell Effects ID] - Sets an NPC's Spell Effects ID");
c->Message(Chat::White, "Usage: #npcedit faction [Faction ID] - Sets an NPC's Faction ID");
c->Message(Chat::White, "Usage: #npcedit adventure_template_id [Template ID] - Sets an NPC's Adventure Template ID");
c->Message(Chat::White, "Usage: #npcedit trap_template [Template ID] - Sets an NPC's Trap Template ID");
c->Message(Chat::White, "Usage: #npcedit damage [Minimum] [Maximum] - Sets an NPC's Damage");
c->Message(Chat::White, "Usage: #npcedit attackcount [Attack Count] - Sets an NPC's Attack Count");
c->Message(Chat::White, "Usage: #npcedit special_attacks [Special Attacks] - Sets an NPC's Special Attacks");
c->Message(Chat::White, "Usage: #npcedit special_abilities [Special Abilities] - Sets an NPC's Special Abilities");
c->Message(Chat::White, "Usage: #npcedit aggroradius [Radius] - Sets an NPC's Aggro Radius");
c->Message(Chat::White, "Usage: #npcedit assistradius [Radius] - Sets an NPC's Assist Radius");
c->Message(Chat::White, "Usage: #npcedit featuresave - Saves an NPC's current facial features to the database");
c->Message(Chat::White, "Usage: #npcedit armortint_id [Armor Tint ID] - Sets an NPC's Armor Tint ID");
c->Message(Chat::White, "Usage: #npcedit color [Red] [Green] [Blue] - Sets an NPC's Red, Green, and Blue armor tint");
c->Message(Chat::White, "Usage: #npcedit ammoidfile [ID File] - Sets an NPC's Ammo ID File");
c->Message(Chat::White, "Usage: #npcedit weapon [Primary Model] [Secondary Model] - Sets an NPC's Primary and Secondary Weapon Model");
c->Message(Chat::White, "Usage: #npcedit meleetype [Primary Type] [Secondary Type] - Sets an NPC's Melee Skill Types");
c->Message(Chat::White, "Usage: #npcedit rangedtype [Type] - Sets an NPC's Ranged Skill Type");
c->Message(Chat::White, "Usage: #npcedit runspeed [Run Speed] - Sets an NPC's Run Speed");
c->Message(Chat::White, "Usage: #npcedit mr [Resistance] - Sets an NPC's Magic Resistance");
c->Message(Chat::White, "Usage: #npcedit pr [Resistance] - Sets an NPC's Poison Resistance");
c->Message(Chat::White, "Usage: #npcedit dr [Resistance] - Sets an NPC's Disease Resistance");
c->Message(Chat::White, "Usage: #npcedit fr [Resistance] - Sets an NPC's Fire Resistance");
c->Message(Chat::White, "Usage: #npcedit cr [Resistance] - Sets an NPC's Cold Resistance");
c->Message(Chat::White, "Usage: #npcedit corrup [Resistance] - Sets an NPC's Corruption Resistance");
c->Message(Chat::White, "Usage: #npcedit phr [Resistance] - Sets and NPC's Physical Resistance");
c->Message(Chat::White, "Usage: #npcedit seeinvis [Flag] - Sets an NPC's See Invisible Flag [0 = Cannot See Invisible, 1 = Can See Invisible]");
c->Message(Chat::White, "Usage: #npcedit seeinvisundead [Flag] - Sets an NPC's See Invisible vs. Undead Flag [0 = Cannot See Invisible vs. Undead, 1 = Can See Invisible vs. Undead]");
c->Message(Chat::White, "Usage: #npcedit qglobal [Flag] - Sets an NPC's Quest Global Flag [0 = Quest Globals Off, 1 = Quest Globals On]");
c->Message(Chat::White, "Usage: #npcedit ac [Armor Class] - Sets an NPC's Armor Class");
c->Message(Chat::White, "Usage: #npcedit npcaggro [Flag] - Sets an NPC's NPC Aggro Flag [0 = Aggro NPCs Off, 1 = Aggro NPCs On]");
c->Message(Chat::White, "Usage: #npcedit spawn_limit [Limit] - Sets an NPC's Spawn Limit Counter");
c->Message(Chat::White, "Usage: #npcedit attackspeed [Attack Speed] - Sets an NPC's Attack Speed Modifier");
c->Message(Chat::White, "Usage: #npcedit attackdelay [Attack Delay] - Sets an NPC's Attack Delay");
c->Message(Chat::White, "Usage: #npcedit findable [Flag] - Sets an NPC's Findable Flag [0 = Not Findable, 1 = Findable]");
c->Message(Chat::White, "Usage: #npcedit str [Strength] - Sets an NPC's Strength");
c->Message(Chat::White, "Usage: #npcedit sta [Stamina] - Sets an NPC's Stamina");
c->Message(Chat::White, "Usage: #npcedit agi [Agility] - Sets an NPC's Agility");
c->Message(Chat::White, "Usage: #npcedit dex [Dexterity] - Sets an NPC's Dexterity");
c->Message(Chat::White, "Usage: #npcedit int [Intelligence] - Sets an NPC's Intelligence");
c->Message(Chat::White, "Usage: #npcedit wis [Wisdom] - Sets an NPC's Wisdom");
c->Message(Chat::White, "Usage: #npcedit cha [Charisma] - Sets an NPC's Charisma");
c->Message(Chat::White, "Usage: #npcedit seehide [Flag] - Sets an NPC's See Hide Flag [0 = Cannot See Hide, 1 = Can See Hide]");
c->Message(Chat::White, "Usage: #npcedit seeimprovedhide [Flag] - Sets an NPC's See Improved Hide Flag [0 = Cannot See Improved Hide, 1 = Can See Improved Hide]");
c->Message(Chat::White, "Usage: #npcedit trackable [Flag] - Sets an NPC's Trackable Flag [0 = Not Trackable, 1 = Trackable]");
c->Message(Chat::White, "Usage: #npcedit atk [Attack] - Sets an NPC's Attack");
c->Message(Chat::White, "Usage: #npcedit accuracy [Accuracy] - Sets an NPC's Accuracy");
c->Message(Chat::White, "Usage: #npcedit avoidance [Avoidance] - Sets an NPC's Avoidance");
c->Message(Chat::White, "Usage: #npcedit slow_mitigation [Slow Mitigation] - Sets an NPC's Slow Mitigation");
c->Message(Chat::White, "Usage: #npcedit version [Version] - Sets an NPC's Version");
c->Message(Chat::White, "Usage: #npcedit maxlevel [Max Level] - Sets an NPC's Maximum Level");
c->Message(Chat::White, "Usage: #npcedit scalerate [Scale Rate] - Sets an NPC's Scaling Rate [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit emoteid [Emote ID] - Sets an NPC's Emote ID");
c->Message(Chat::White, "Usage: #npcedit spellscale [Scale Rate] - Sets an NPC's Spell Scaling Rate [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit healscale [Scale Rate] - Sets an NPC's Heal Scaling Rate [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit no_target [Flag] - Sets an NPC's No Target Hotkey Flag [0 = Not Targetable with Target Hotkey, 1 = Targetable with Target Hotkey]");
c->Message(Chat::White, "Usage: #npcedit raidtarget [Flag] - Sets an NPC's Raid Target Flag [0 = Not a Raid Target, 1 = Raid Target]");
c->Message(Chat::White, "Usage: #npcedit armtexture [Texture] - Sets an NPC's Arm Texture");
c->Message(Chat::White, "Usage: #npcedit bracertexture [Texture] - Sets an NPC's Bracer Texture");
c->Message(Chat::White, "Usage: #npcedit handtexture [Texture] - Sets an NPC's Hand Texture");
c->Message(Chat::White, "Usage: #npcedit legtexture [Texture] - Sets an NPC's Leg Texture");
c->Message(Chat::White, "Usage: #npcedit feettexture [Texture] - Sets an NPC's Feet Texture");
c->Message(Chat::White, "Usage: #npcedit walkspeed [Walk Speed] - Sets an NPC's Walk Speed");
c->Message(Chat::White, "Usage: #npcedit show_name [Flag] - Sets an NPC's Show Name Flag [0 = Hidden, 1 = Shown]");
c->Message(Chat::White, "Usage: #npcedit untargetable [Flag] - Sets an NPC's Untargetable Flag [0 = Targetable, 1 = Untargetable]");
c->Message(Chat::White, "Usage: #npcedit charm_ac [Armor Class] - Sets an NPC's Armor Class while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_min_dmg [Damage] - Sets an NPC's Minimum Damage while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_max_dmg [Damage] - Sets an NPC's Maximum Damage while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_attack_delay [Attack Delay] - Sets an NPC's Attack Delay while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_accuracy_rating [Accuracy] - Sets an NPC's Accuracy Rating while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_avoidance_rating [Avoidance] - Sets an NPC's Avoidance Rating while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_atk [Attack] - Sets an NPC's Attack while Charmed");
c->Message(Chat::White, "Usage: #npcedit skip_global_loot [Flag] - Sets an NPC's Skip Global Loot Flag [0 = Don't Skip, 1 = Skip");
c->Message(Chat::White, "Usage: #npcedit rarespawn [Flag] - Sets an NPC's Rare Spawn Flag [0 = Not a Rare Spawn, 1 = Rare Spawn]");
c->Message(Chat::White, "Usage: #npcedit stuck_behavior [Stuck Behavior] - Sets an NPC's Stuck Behavior [0 = Run to Target, 1 = Warp to Target, 2 = Take No Action, 3 = Evade Combat]");
c->Message(Chat::White, "Usage: #npcedit model [Race ID] - Sets an NPC's Race Model");
c->Message(Chat::White, "Usage: #npcedit flymode [Fly Mode] - Sets an NPC's Fly Mode [0 = Ground, 1 = Flying, 2 = Levitating, 3 = Water, 4 = Floating, 5 = Levitating While Running]");
c->Message(Chat::White, "Usage: #npcedit always_aggro [Flag] - Sets an NPC's Always Aggro Flag [0 = Does not Always Aggro, 1 = Always Aggro]");
c->Message(Chat::White, "Usage: #npcedit exp_mod [Modifier] - Sets an NPC's Experience Modifier [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit heroic_strikethrough [Heroic Strikethrough] - Sets an NPC's Heroic Strikethrough");
c->Message(Chat::White, "Usage: #npcedit faction_amount [Faction Amount] - Sets an NPC's Faction Amount");
c->Message(Chat::White, "Usage: #npcedit keeps_sold_items [Flag] - Sets an NPC's Keeps Sold Items Flag [0 = False, 1 = True]");
c->Message(Chat::White, "Usage: #npcedit is_parcel_merchant [Flag] - Sets an NPC's Parcel Merchant Flag [0 = False, 1 = True]");
c->Message(Chat::White, "Usage: #npcedit setanimation [Animation ID] - Sets an NPC's Animation on Spawn (Stored in spawn2 table)");
c->Message(Chat::White, "Usage: #npcedit respawntime [Respawn Time] - Sets an NPC's Respawn Timer in Seconds (Stored in spawn2 table)");
c->Message(Chat::White, "Usage: #npcedit set_grid [Grid ID] - Sets an NPC's Grid ID");
}
void command_npcedit(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
@@ -1727,113 +1836,4 @@ void command_npcedit(Client *c, const Seperator *sep)
}
c->Message(Chat::White, d.c_str());
}
void SendNPCEditSubCommands(Client *c)
{
c->Message(Chat::White, "Usage: #npcedit name [Name] - Sets an NPC's Name");
c->Message(Chat::White, "Usage: #npcedit lastname [Last Name] - Sets an NPC's Last Name");
c->Message(Chat::White, "Usage: #npcedit level [Level] - Sets an NPC's Level");
c->Message(Chat::White, "Usage: #npcedit race [Race ID] - Sets an NPC's Race");
c->Message(Chat::White, "Usage: #npcedit class [Class ID] - Sets an NPC's Class");
c->Message(Chat::White, "Usage: #npcedit bodytype [Body Type ID] - Sets an NPC's Bodytype");
c->Message(Chat::White, "Usage: #npcedit hp [HP] - Sets an NPC's HP");
c->Message(Chat::White, "Usage: #npcedit mana [Mana] - Sets an NPC's Mana");
c->Message(Chat::White, "Usage: #npcedit gender [Gender ID] - Sets an NPC's Gender");
c->Message(Chat::White, "Usage: #npcedit texture [Texture] - Sets an NPC's Texture");
c->Message(Chat::White, "Usage: #npcedit helmtexture [Helmet Texture] - Sets an NPC's Helmet Texture");
c->Message(Chat::White, "Usage: #npcedit herosforgemodel [Model Number] - Sets an NPC's Hero's Forge Model");
c->Message(Chat::White, "Usage: #npcedit size [Size] - Sets an NPC's Size");
c->Message(Chat::White, "Usage: #npcedit hpregen [HP Regen] - Sets an NPC's HP Regen Rate Per Tick");
c->Message(Chat::White, "Usage: #npcedit hp_regen_per_second [HP Regen] - Sets an NPC's HP Regen Rate Per Second");
c->Message(Chat::White, "Usage: #npcedit manaregen [Mana Regen] - Sets an NPC's Mana Regen Rate Per Tick");
c->Message(Chat::White, "Usage: #npcedit loottable [Loottable ID] - Sets an NPC's Loottable ID");
c->Message(Chat::White, "Usage: #npcedit merchantid [Merchant ID] - Sets an NPC's Merchant ID");
c->Message(Chat::White, "Usage: #npcedit alt_currency_id [Alternate Currency ID] - Sets an NPC's Alternate Currency ID");
c->Message(Chat::White, "Usage: #npcedit spell [Spell List ID] - Sets an NPC's Spells List ID");
c->Message(Chat::White, "Usage: #npcedit npc_spells_effects_id [Spell Effects ID] - Sets an NPC's Spell Effects ID");
c->Message(Chat::White, "Usage: #npcedit faction [Faction ID] - Sets an NPC's Faction ID");
c->Message(Chat::White, "Usage: #npcedit adventure_template_id [Template ID] - Sets an NPC's Adventure Template ID");
c->Message(Chat::White, "Usage: #npcedit trap_template [Template ID] - Sets an NPC's Trap Template ID");
c->Message(Chat::White, "Usage: #npcedit damage [Minimum] [Maximum] - Sets an NPC's Damage");
c->Message(Chat::White, "Usage: #npcedit attackcount [Attack Count] - Sets an NPC's Attack Count");
c->Message(Chat::White, "Usage: #npcedit special_attacks [Special Attacks] - Sets an NPC's Special Attacks");
c->Message(Chat::White, "Usage: #npcedit special_abilities [Special Abilities] - Sets an NPC's Special Abilities");
c->Message(Chat::White, "Usage: #npcedit aggroradius [Radius] - Sets an NPC's Aggro Radius");
c->Message(Chat::White, "Usage: #npcedit assistradius [Radius] - Sets an NPC's Assist Radius");
c->Message(Chat::White, "Usage: #npcedit featuresave - Saves an NPC's current facial features to the database");
c->Message(Chat::White, "Usage: #npcedit armortint_id [Armor Tint ID] - Sets an NPC's Armor Tint ID");
c->Message(Chat::White, "Usage: #npcedit color [Red] [Green] [Blue] - Sets an NPC's Red, Green, and Blue armor tint");
c->Message(Chat::White, "Usage: #npcedit ammoidfile [ID File] - Sets an NPC's Ammo ID File");
c->Message(Chat::White, "Usage: #npcedit weapon [Primary Model] [Secondary Model] - Sets an NPC's Primary and Secondary Weapon Model");
c->Message(Chat::White, "Usage: #npcedit meleetype [Primary Type] [Secondary Type] - Sets an NPC's Melee Skill Types");
c->Message(Chat::White, "Usage: #npcedit rangedtype [Type] - Sets an NPC's Ranged Skill Type");
c->Message(Chat::White, "Usage: #npcedit runspeed [Run Speed] - Sets an NPC's Run Speed");
c->Message(Chat::White, "Usage: #npcedit mr [Resistance] - Sets an NPC's Magic Resistance");
c->Message(Chat::White, "Usage: #npcedit pr [Resistance] - Sets an NPC's Poison Resistance");
c->Message(Chat::White, "Usage: #npcedit dr [Resistance] - Sets an NPC's Disease Resistance");
c->Message(Chat::White, "Usage: #npcedit fr [Resistance] - Sets an NPC's Fire Resistance");
c->Message(Chat::White, "Usage: #npcedit cr [Resistance] - Sets an NPC's Cold Resistance");
c->Message(Chat::White, "Usage: #npcedit corrup [Resistance] - Sets an NPC's Corruption Resistance");
c->Message(Chat::White, "Usage: #npcedit phr [Resistance] - Sets and NPC's Physical Resistance");
c->Message(Chat::White, "Usage: #npcedit seeinvis [Flag] - Sets an NPC's See Invisible Flag [0 = Cannot See Invisible, 1 = Can See Invisible]");
c->Message(Chat::White, "Usage: #npcedit seeinvisundead [Flag] - Sets an NPC's See Invisible vs. Undead Flag [0 = Cannot See Invisible vs. Undead, 1 = Can See Invisible vs. Undead]");
c->Message(Chat::White, "Usage: #npcedit qglobal [Flag] - Sets an NPC's Quest Global Flag [0 = Quest Globals Off, 1 = Quest Globals On]");
c->Message(Chat::White, "Usage: #npcedit ac [Armor Class] - Sets an NPC's Armor Class");
c->Message(Chat::White, "Usage: #npcedit npcaggro [Flag] - Sets an NPC's NPC Aggro Flag [0 = Aggro NPCs Off, 1 = Aggro NPCs On]");
c->Message(Chat::White, "Usage: #npcedit spawn_limit [Limit] - Sets an NPC's Spawn Limit Counter");
c->Message(Chat::White, "Usage: #npcedit attackspeed [Attack Speed] - Sets an NPC's Attack Speed Modifier");
c->Message(Chat::White, "Usage: #npcedit attackdelay [Attack Delay] - Sets an NPC's Attack Delay");
c->Message(Chat::White, "Usage: #npcedit findable [Flag] - Sets an NPC's Findable Flag [0 = Not Findable, 1 = Findable]");
c->Message(Chat::White, "Usage: #npcedit str [Strength] - Sets an NPC's Strength");
c->Message(Chat::White, "Usage: #npcedit sta [Stamina] - Sets an NPC's Stamina");
c->Message(Chat::White, "Usage: #npcedit agi [Agility] - Sets an NPC's Agility");
c->Message(Chat::White, "Usage: #npcedit dex [Dexterity] - Sets an NPC's Dexterity");
c->Message(Chat::White, "Usage: #npcedit int [Intelligence] - Sets an NPC's Intelligence");
c->Message(Chat::White, "Usage: #npcedit wis [Wisdom] - Sets an NPC's Wisdom");
c->Message(Chat::White, "Usage: #npcedit cha [Charisma] - Sets an NPC's Charisma");
c->Message(Chat::White, "Usage: #npcedit seehide [Flag] - Sets an NPC's See Hide Flag [0 = Cannot See Hide, 1 = Can See Hide]");
c->Message(Chat::White, "Usage: #npcedit seeimprovedhide [Flag] - Sets an NPC's See Improved Hide Flag [0 = Cannot See Improved Hide, 1 = Can See Improved Hide]");
c->Message(Chat::White, "Usage: #npcedit trackable [Flag] - Sets an NPC's Trackable Flag [0 = Not Trackable, 1 = Trackable]");
c->Message(Chat::White, "Usage: #npcedit atk [Attack] - Sets an NPC's Attack");
c->Message(Chat::White, "Usage: #npcedit accuracy [Accuracy] - Sets an NPC's Accuracy");
c->Message(Chat::White, "Usage: #npcedit avoidance [Avoidance] - Sets an NPC's Avoidance");
c->Message(Chat::White, "Usage: #npcedit slow_mitigation [Slow Mitigation] - Sets an NPC's Slow Mitigation");
c->Message(Chat::White, "Usage: #npcedit version [Version] - Sets an NPC's Version");
c->Message(Chat::White, "Usage: #npcedit maxlevel [Max Level] - Sets an NPC's Maximum Level");
c->Message(Chat::White, "Usage: #npcedit scalerate [Scale Rate] - Sets an NPC's Scaling Rate [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit emoteid [Emote ID] - Sets an NPC's Emote ID");
c->Message(Chat::White, "Usage: #npcedit spellscale [Scale Rate] - Sets an NPC's Spell Scaling Rate [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit healscale [Scale Rate] - Sets an NPC's Heal Scaling Rate [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit no_target [Flag] - Sets an NPC's No Target Hotkey Flag [0 = Not Targetable with Target Hotkey, 1 = Targetable with Target Hotkey]");
c->Message(Chat::White, "Usage: #npcedit raidtarget [Flag] - Sets an NPC's Raid Target Flag [0 = Not a Raid Target, 1 = Raid Target]");
c->Message(Chat::White, "Usage: #npcedit armtexture [Texture] - Sets an NPC's Arm Texture");
c->Message(Chat::White, "Usage: #npcedit bracertexture [Texture] - Sets an NPC's Bracer Texture");
c->Message(Chat::White, "Usage: #npcedit handtexture [Texture] - Sets an NPC's Hand Texture");
c->Message(Chat::White, "Usage: #npcedit legtexture [Texture] - Sets an NPC's Leg Texture");
c->Message(Chat::White, "Usage: #npcedit feettexture [Texture] - Sets an NPC's Feet Texture");
c->Message(Chat::White, "Usage: #npcedit walkspeed [Walk Speed] - Sets an NPC's Walk Speed");
c->Message(Chat::White, "Usage: #npcedit show_name [Flag] - Sets an NPC's Show Name Flag [0 = Hidden, 1 = Shown]");
c->Message(Chat::White, "Usage: #npcedit untargetable [Flag] - Sets an NPC's Untargetable Flag [0 = Targetable, 1 = Untargetable]");
c->Message(Chat::White, "Usage: #npcedit charm_ac [Armor Class] - Sets an NPC's Armor Class while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_min_dmg [Damage] - Sets an NPC's Minimum Damage while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_max_dmg [Damage] - Sets an NPC's Maximum Damage while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_attack_delay [Attack Delay] - Sets an NPC's Attack Delay while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_accuracy_rating [Accuracy] - Sets an NPC's Accuracy Rating while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_avoidance_rating [Avoidance] - Sets an NPC's Avoidance Rating while Charmed");
c->Message(Chat::White, "Usage: #npcedit charm_atk [Attack] - Sets an NPC's Attack while Charmed");
c->Message(Chat::White, "Usage: #npcedit skip_global_loot [Flag] - Sets an NPC's Skip Global Loot Flag [0 = Don't Skip, 1 = Skip");
c->Message(Chat::White, "Usage: #npcedit rarespawn [Flag] - Sets an NPC's Rare Spawn Flag [0 = Not a Rare Spawn, 1 = Rare Spawn]");
c->Message(Chat::White, "Usage: #npcedit stuck_behavior [Stuck Behavior] - Sets an NPC's Stuck Behavior [0 = Run to Target, 1 = Warp to Target, 2 = Take No Action, 3 = Evade Combat]");
c->Message(Chat::White, "Usage: #npcedit model [Race ID] - Sets an NPC's Race Model");
c->Message(Chat::White, "Usage: #npcedit flymode [Fly Mode] - Sets an NPC's Fly Mode [0 = Ground, 1 = Flying, 2 = Levitating, 3 = Water, 4 = Floating, 5 = Levitating While Running]");
c->Message(Chat::White, "Usage: #npcedit always_aggro [Flag] - Sets an NPC's Always Aggro Flag [0 = Does not Always Aggro, 1 = Always Aggro]");
c->Message(Chat::White, "Usage: #npcedit exp_mod [Modifier] - Sets an NPC's Experience Modifier [50 = 50%, 100 = 100%, 200 = 200%]");
c->Message(Chat::White, "Usage: #npcedit heroic_strikethrough [Heroic Strikethrough] - Sets an NPC's Heroic Strikethrough");
c->Message(Chat::White, "Usage: #npcedit faction_amount [Faction Amount] - Sets an NPC's Faction Amount");
c->Message(Chat::White, "Usage: #npcedit keeps_sold_items [Flag] - Sets an NPC's Keeps Sold Items Flag [0 = False, 1 = True]");
c->Message(Chat::White, "Usage: #npcedit is_parcel_merchant [Flag] - Sets an NPC's Parcel Merchant Flag [0 = False, 1 = True]");
c->Message(Chat::White, "Usage: #npcedit setanimation [Animation ID] - Sets an NPC's Animation on Spawn (Stored in spawn2 table)");
c->Message(Chat::White, "Usage: #npcedit respawntime [Respawn Time] - Sets an NPC's Respawn Timer in Seconds (Stored in spawn2 table)");
c->Message(Chat::White, "Usage: #npcedit set_grid [Grid ID] - Sets an NPC's Grid ID");
}
}
+16 -13
View File
@@ -1,9 +1,23 @@
#include "../client.h"
#include "../queryserv.h"
#include "../worldserver.h"
#include "../../common/events/player_events.h"
#include "../../common/events/player_event_logs.h"
#include "../string_ids.h"
extern QueryServ *QServ;
extern WorldServer worldserver;
void SendParcelsSubCommands(Client *c)
{
c->Message(Chat::White, "#parcels listdb [Character Name]");
c->Message(Chat::White, "#parcels listmemory [Character Name] (Must be in the same zone)");
c->Message(
Chat::White,
"#parcels add [Character Name] [item id] [quantity] [note]. To send money use item id of 99990. Quantity is valid for stackable items, charges on an item, or amount of copper."
);
c->Message(Chat::White, "#parcels details [Character Name]");
}
void command_parcels(Client *c, const Seperator *sep)
{
const auto arguments = sep->argnum;
@@ -305,15 +319,4 @@ void command_parcels(Client *c, const Seperator *sep)
c->SendParcelDeliveryToWorld(ps);
}
}
}
void SendParcelsSubCommands(Client *c)
{
c->Message(Chat::White, "#parcels listdb [Character Name]");
c->Message(Chat::White, "#parcels listmemory [Character Name] (Must be in the same zone)");
c->Message(
Chat::White,
"#parcels add [Character Name] [item id] [quantity] [note]. To send money use item id of 99990. Quantity is valid for stackable items, charges on an item, or amount of copper."
);
c->Message(Chat::White, "#parcels details [Character Name]");
}
}
+1
View File
@@ -1,3 +1,4 @@
#include "../bot.h"
#include "../client.h"
void command_petitems(Client *c, const Seperator *sep)
+1
View File
@@ -1,3 +1,4 @@
#include "../../bot.h"
#include "../../client.h"
void SetHaste(Client *c, const Seperator *sep)
+17 -17
View File
@@ -1,6 +1,22 @@
#include "../../client.h"
#include "../../object.h"
void SendShowInventorySubCommands(Client* c) {
c->Message(Chat::White, "Usage: #show inventory equip - Shows items in Equipment slots");
c->Message(Chat::White, "Usage: #show inventory gen - Shows items in General slots");
c->Message(Chat::White, "Usage: #show inventory cursor - Shows items in Cursor slots");
c->Message(Chat::White, "Usage: #show inventory poss - Shows items in Equipment, General, and Cursor slots");
c->Message(Chat::White, "Usage: #show inventory limbo - Shows items in Limbo slots");
c->Message(Chat::White, "Usage: #show inventory curlim - Shows items in Cursor and Limbo slots");
c->Message(Chat::White, "Usage: #show inventory trib - Shows items in Tribute slots");
c->Message(Chat::White, "Usage: #show inventory bank - Shows items in Bank slots");
c->Message(Chat::White, "Usage: #show inventory shbank - Shows items in Shared Bank slots");
c->Message(Chat::White, "Usage: #show inventory allbank - Shows items in Bank and Shared Bank slots");
c->Message(Chat::White, "Usage: #show inventory trade - Shows items in Trade slots");
c->Message(Chat::White, "Usage: #show inventory world - Shows items in World slots");
c->Message(Chat::White, "Usage: #show inventory all - Shows items in all slots");
}
void ShowInventory(Client *c, const Seperator *sep)
{
const auto arguments = sep->argnum;
@@ -432,20 +448,4 @@ void ShowInventory(Client *c, const Seperator *sep)
if (!found_items) {
c->Message(Chat::White, "No items found.");
}
}
void SendShowInventorySubCommands(Client* c) {
c->Message(Chat::White, "Usage: #show inventory equip - Shows items in Equipment slots");
c->Message(Chat::White, "Usage: #show inventory gen - Shows items in General slots");
c->Message(Chat::White, "Usage: #show inventory cursor - Shows items in Cursor slots");
c->Message(Chat::White, "Usage: #show inventory poss - Shows items in Equipment, General, and Cursor slots");
c->Message(Chat::White, "Usage: #show inventory limbo - Shows items in Limbo slots");
c->Message(Chat::White, "Usage: #show inventory curlim - Shows items in Cursor and Limbo slots");
c->Message(Chat::White, "Usage: #show inventory trib - Shows items in Tribute slots");
c->Message(Chat::White, "Usage: #show inventory bank - Shows items in Bank slots");
c->Message(Chat::White, "Usage: #show inventory shbank - Shows items in Shared Bank slots");
c->Message(Chat::White, "Usage: #show inventory allbank - Shows items in Bank and Shared Bank slots");
c->Message(Chat::White, "Usage: #show inventory trade - Shows items in Trade slots");
c->Message(Chat::White, "Usage: #show inventory world - Shows items in World slots");
c->Message(Chat::White, "Usage: #show inventory all - Shows items in all slots");
}
}
+1
View File
@@ -1,3 +1,4 @@
#include "../bot.h"
#include "../client.h"
void command_zone(Client *c, const Seperator *sep)
+2 -2
View File
@@ -107,12 +107,12 @@ void Lua_Bot::SetExpansionBitmask(int expansion_bitmask) {
bool Lua_Bot::ReloadBotDataBuckets() {
Lua_Safe_Call_Bool();
return DataBucket::GetDataBuckets(self);
return self->LoadDataBucketsCache();;
}
bool Lua_Bot::ReloadBotOwnerDataBuckets() {
Lua_Safe_Call_Bool();
return self->HasOwner() && DataBucket::GetDataBuckets(self->GetBotOwner());
return self->HasOwner() && self->LoadDataBucketsCache();
}
bool Lua_Bot::ReloadBotSpells() {
+1 -1
View File
@@ -3131,7 +3131,7 @@ bool Lua_Client::IsAutoFireEnabled()
bool Lua_Client::ReloadDataBuckets() {
Lua_Safe_Call_Bool();
return DataBucket::GetDataBuckets(self);
return self->LoadDataBucketsCache();
}
uint32 Lua_Client::GetEXPForLevel(uint16 check_level)
+1 -1
View File
@@ -24,7 +24,7 @@
#include "qglobals.h"
#include "encounter.h"
#include "lua_encounter.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "dialogue_window.h"
#include "dynamic_zone.h"
#include "../common/events/player_event_logs.h"
+45 -36
View File
@@ -1067,13 +1067,16 @@ void LuaParser::ReloadQuests() {
lua_getglobal(L, "package");
lua_getfield(L, -1, "path");
std::string module_path = lua_tostring(L,-1);
module_path += ";" + path.GetLuaModulesPath() + "/?.lua;" + path.GetLuaModulesPath() + "/?/init.lua";
// luarock paths using lua_modules as tree
// to path it adds foo/share/lua/5.1/?.lua and foo/share/lua/5.1/?/init.lua
module_path += ";" + path.GetLuaModulesPath() + "/share/lua/" + lua_version + "/?.lua";
module_path += ";" + path.GetLuaModulesPath() + "/share/lua/" + lua_version + "/?/init.lua";
std::string module_path = lua_tostring(L, -1);
lua_pop(L, 1);
for (const auto& dir : path.GetLuaModulePaths()) {
module_path += fmt::format(";{}/?.lua", dir);
module_path += fmt::format(";{}/?/init.lua", dir);
module_path += fmt::format(";{}/share/lua/{}/?.lua", dir, lua_version);
module_path += fmt::format(";{}/share/lua/{}/?/init.lua", dir, lua_version);
}
lua_pushstring(L, module_path.c_str());
lua_setfield(L, -2, "path");
lua_pop(L, 1);
@@ -1081,11 +1084,13 @@ void LuaParser::ReloadQuests() {
lua_getglobal(L, "package");
lua_getfield(L, -1, "cpath");
module_path = lua_tostring(L, -1);
module_path += ";" + path.GetLuaModulesPath() + "/?" + libext;
// luarock paths using lua_modules as tree
// luarocks adds foo/lib/lua/5.1/?.so for cpath
module_path += ";" + path.GetLuaModulesPath() + "/lib/lua/" + lua_version + "/?" + libext;
lua_pop(L, 1);
for (const auto& dir : path.GetLuaModulePaths()) {
module_path += fmt::format(";{}/?{}", dir, libext);
module_path += fmt::format(";{}/lib/lua/{}/?{}", dir, lua_version, libext);
}
lua_pushstring(L, module_path.c_str());
lua_setfield(L, -2, "cpath");
lua_pop(L, 1);
@@ -1093,40 +1098,31 @@ void LuaParser::ReloadQuests() {
MapFunctions(L);
// load init
std::string filename = fmt::format("{}/{}/script_init.lua", path.GetQuestsPath(), QUEST_GLOBAL_DIRECTORY);
for (auto& dir : path.GetQuestPaths()) {
std::string filename = fmt::format("{}/{}/script_init.lua", dir, QUEST_GLOBAL_DIRECTORY);
FILE *f = fopen(filename.c_str(), "r");
if(f) {
fclose(f);
if(luaL_dofile(L, filename.c_str())) {
std::string error = lua_tostring(L, -1);
AddError(error);
}
}
//zone init - always loads after global
if(zone) {
std::string zone_script = fmt::format(
"{}/{}/script_init_v{}.lua",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
f = fopen(zone_script.c_str(), "r");
if(f) {
FILE* f = fopen(filename.c_str(), "r");
if (f) {
fclose(f);
if(luaL_dofile(L, zone_script.c_str())) {
if (luaL_dofile(L, filename.c_str())) {
std::string error = lua_tostring(L, -1);
AddError(error);
}
}
else {
zone_script = fmt::format("{}/{}/script_init.lua", path.GetQuestsPath(), zone->GetShortName());
}
f = fopen(zone_script.c_str(), "r");
//zone init - always loads after global
if (zone) {
for (auto& dir : path.GetQuestPaths()) {
std::string zone_script = fmt::format(
"{}/{}/script_init_v{}.lua",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
FILE* f = fopen(zone_script.c_str(), "r");
if (f) {
fclose(f);
@@ -1135,6 +1131,19 @@ void LuaParser::ReloadQuests() {
AddError(error);
}
}
else {
zone_script = fmt::format("{}/{}/script_init.lua", dir, zone->GetShortName());
f = fopen(zone_script.c_str(), "r");
if (f) {
fclose(f);
if (luaL_dofile(L, zone_script.c_str())) {
std::string error = lua_tostring(L, -1);
AddError(error);
}
}
}
}
}
-1
View File
@@ -4,7 +4,6 @@
#include <luabind/luabind.hpp>
#include "../common/global_define.h"
#include "embperl.h"
#include "lua_zone.h"
bool Lua_Zone::BuffTimersSuspended()
+22 -2
View File
@@ -24,7 +24,7 @@
#include "../common/repositories/bot_data_repository.h"
#include "../common/repositories/character_data_repository.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "quest_parser_collection.h"
#include "string_ids.h"
#include "worldserver.h"
@@ -2646,7 +2646,7 @@ void Mob::SendStatsWindow(Client* c, bool use_window)
Chat::White,
fmt::format(
" AFK: {} LFG: {} Anon: {} PVP: {} GM: {} Fly Mode: {} ({}) GM Speed: {} Hide Me: {} Invulnerability: {} LD: {} Client Version: {} Tells Off: {}",
CastToClient()->AFK ? "Yes" : "No",
CastToClient()->m_is_afk ? "Yes" : "No",
CastToClient()->LFG ? "Yes" : "No",
CastToClient()->GetAnon() ? "Yes" : "No",
CastToClient()->GetPVP() ? "Yes" : "No",
@@ -8772,3 +8772,23 @@ bool Mob::IsGuildmaster() const {
return false;
}
}
bool Mob::LoadDataBucketsCache()
{
const uint32 id = GetMobTypeIdentifier();
if (!id) {
return false;
}
if (IsBot()) {
DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Bot, {id});
}
else if (IsClient()) {
uint32 account_id = CastToClient()->AccountID();
DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Account, {account_id});
DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Client, {id});
}
return true;
}
+2 -1
View File
@@ -20,7 +20,7 @@
#define MOB_H
#include "common.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "entity.h"
#include "hate_list.h"
#include "pathfinder_interface.h"
@@ -1504,6 +1504,7 @@ public:
void CalcHeroicBonuses(StatBonuses* newbon);
DataBucketKey GetScopedBucketKeys();
bool LoadDataBucketsCache();
bool IsCloseToBanker();
+8
View File
@@ -839,6 +839,10 @@ void MobMovementManager::SendCommandToClients(
continue;
}
if (c->IsIdle()) {
continue;
}
_impl->Stats.TotalSent++;
if (anim != 0) {
@@ -879,6 +883,10 @@ void MobMovementManager::SendCommandToClients(
continue;
}
if (c->IsIdle()) {
continue;
}
float distance = c->CalculateDistance(mob->GetX(), mob->GetY(), mob->GetZ());
bool match = false;
+2 -2
View File
@@ -492,12 +492,12 @@ void Perl_Bot_SetSpellDurationRaid(Bot* self, int spell_id, int duration, int le
bool Perl_Bot_ReloadBotDataBuckets(Bot* self)
{
return DataBucket::GetDataBuckets(self);
return self->LoadDataBucketsCache();
}
bool Perl_Bot_ReloadBotOwnerDataBuckets(Bot* self)
{
return self->HasOwner() && DataBucket::GetDataBuckets(self->GetBotOwner());
return self->HasOwner() && self->LoadDataBucketsCache();
}
bool Perl_Bot_ReloadBotSpells(Bot* self)
+1 -1
View File
@@ -2995,7 +2995,7 @@ bool Perl_Client_IsAutoFireEnabled(Client* self)
bool Perl_Client_ReloadDataBuckets(Client* self)
{
return DataBucket::GetDataBuckets(self);
return self->LoadDataBucketsCache();
}
uint32 Perl_Client_GetEXPForLevel(Client* self, uint16 check_level)
+307 -285
View File
@@ -939,59 +939,61 @@ QuestInterface* QuestParserCollection::GetQIByNPCQuest(uint32 npc_id, std::strin
Strings::FindReplace(npc_name, "`", "-");
const std::string& npc_id_and_name = fmt::format(
"{}_{}",
npc_name,
npc_id
);
for (auto & dir : path.GetQuestPaths()) {
const std::string& npc_id_and_name = fmt::format(
"{}_{}",
npc_name,
npc_id
);
const std::string& global_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY
);
const std::string& global_path = fmt::format(
"{}/{}",
dir,
QUEST_GLOBAL_DIRECTORY
);
const std::string& zone_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
zone->GetShortName()
);
const std::string& zone_path = fmt::format(
"{}/{}",
dir,
zone->GetShortName()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, npc_id), // Local versioned by NPC ID (./quests/zone/v0/10.ext)
fmt::format("{}/{}", zone_versioned_path, npc_name), // Local versioned by NPC Name (./quests/zone/v0/name.ext)
fmt::format("{}/{}", zone_versioned_path, npc_id_and_name), // Local versioned by NPC ID and NPC Name (./quests/zone/v0/10_name.ext)
fmt::format("{}/{}", zone_path, npc_id), // Local by NPC ID
fmt::format("{}/{}", zone_path, npc_name), // Local by NPC Name
fmt::format("{}/{}", zone_path, npc_id_and_name), // Local by NPC ID and NPC Name
fmt::format("{}/{}", global_path, npc_id), // Global by NPC ID
fmt::format("{}/{}", global_path, npc_name), // Global by NPC ID
fmt::format("{}/{}", global_path, npc_id_and_name), // Global by NPC ID and NPC Name
fmt::format("{}/default", zone_versioned_path), // Zone Versioned Default (./quests/zone/v0/default.ext)
fmt::format("{}/default", zone_path), // Zone Default
fmt::format("{}/default", global_path), // Global Default
};
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, npc_id), // Local versioned by NPC ID (./quests/zone/v0/10.ext)
fmt::format("{}/{}", zone_versioned_path, npc_name), // Local versioned by NPC Name (./quests/zone/v0/name.ext)
fmt::format("{}/{}", zone_versioned_path, npc_id_and_name), // Local versioned by NPC ID and NPC Name (./quests/zone/v0/10_name.ext)
fmt::format("{}/{}", zone_path, npc_id), // Local by NPC ID
fmt::format("{}/{}", zone_path, npc_name), // Local by NPC Name
fmt::format("{}/{}", zone_path, npc_id_and_name), // Local by NPC ID and NPC Name
fmt::format("{}/{}", global_path, npc_id), // Global by NPC ID
fmt::format("{}/{}", global_path, npc_name), // Global by NPC ID
fmt::format("{}/{}", global_path, npc_id_and_name), // Global by NPC ID and NPC Name
fmt::format("{}/default", zone_versioned_path), // Zone Versioned Default (./quests/zone/v0/default.ext)
fmt::format("{}/default", zone_path), // Zone Default
fmt::format("{}/default", global_path), // Global Default
};
std::string file_name;
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
}
@@ -1005,44 +1007,46 @@ QuestInterface* QuestParserCollection::GetQIByPlayerQuest(std::string& filename)
return nullptr;
}
const std::string& global_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY
);
for (auto & dir : path.GetQuestPaths()) {
const std::string& global_path = fmt::format(
"{}/{}",
dir,
QUEST_GLOBAL_DIRECTORY
);
const std::string& zone_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
zone->GetShortName()
);
const std::string& zone_path = fmt::format(
"{}/{}",
dir,
zone->GetShortName()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
std::vector<std::string> file_names = {
fmt::format("{}/player", zone_versioned_path), // Local by Instance Version ./quests/zone/v0/player.ext
fmt::format("{}/player_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version
fmt::format("{}/player", zone_path), // Local
fmt::format("{}/player", global_path) // Global
};
std::vector<std::string> file_names = {
fmt::format("{}/player", zone_versioned_path), // Local by Instance Version ./quests/zone/v0/player.ext
fmt::format("{}/player_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version
fmt::format("{}/player", zone_path), // Local
fmt::format("{}/player", global_path) // Global
};
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
}
@@ -1058,17 +1062,19 @@ QuestInterface* QuestParserCollection::GetQIByGlobalNPCQuest(std::string& filena
std::string file_name;
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_npc.{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
for (auto & dir : path.GetQuestPaths()) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_npc.{}",
dir,
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
@@ -1082,17 +1088,19 @@ QuestInterface* QuestParserCollection::GetQIByGlobalPlayerQuest(std::string& fil
}
std::string file_name;
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_player.{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
for (auto & dir : path.GetQuestPaths()) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_player.{}",
dir,
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
@@ -1105,45 +1113,47 @@ QuestInterface* QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
return nullptr;
}
const std::string& global_path = fmt::format(
"{}/{}/spells",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY
);
for (auto & dir : path.GetQuestPaths()) {
const std::string& global_path = fmt::format(
"{}/{}/spells",
dir,
QUEST_GLOBAL_DIRECTORY
);
const std::string& zone_path = fmt::format(
"{}/{}/spells",
path.GetQuestsPath(),
zone->GetShortName()
);
const std::string& zone_path = fmt::format(
"{}/{}/spells",
dir,
zone->GetShortName()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}/spells",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}/spells",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, spell_id), // Local versioned by Spell ID ./quests/zone/v0/spells/10.ext
fmt::format("{}/{}", zone_path, spell_id), // Local
fmt::format("{}/{}", global_path, spell_id), // Global
fmt::format("{}/default", zone_path), // Local Default
fmt::format("{}/default", global_path) // Global Default
};
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, spell_id), // Local versioned by Spell ID ./quests/zone/v0/spells/10.ext
fmt::format("{}/{}", zone_path, spell_id), // Local
fmt::format("{}/{}", global_path, spell_id), // Global
fmt::format("{}/default", zone_path), // Local Default
fmt::format("{}/default", global_path) // Global Default
};
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
}
@@ -1157,45 +1167,47 @@ QuestInterface* QuestParserCollection::GetQIByItemQuest(std::string item_script,
return nullptr;
}
const std::string& global_path = fmt::format(
"{}/{}/items",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY
);
for (auto & dir : path.GetQuestPaths()) {
const std::string& global_path = fmt::format(
"{}/{}/items",
dir,
QUEST_GLOBAL_DIRECTORY
);
const std::string& zone_path = fmt::format(
"{}/{}/items",
path.GetQuestsPath(),
zone->GetShortName()
);
const std::string& zone_path = fmt::format(
"{}/{}/items",
dir,
zone->GetShortName()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}/items",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}/items",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, item_script), // Local versioned by Item Script ./quests/zone/v0/items/10.ext
fmt::format("{}/{}", zone_path, item_script), // Local
fmt::format("{}/{}", global_path, item_script), // Global
fmt::format("{}/default", zone_path), // Local Default
fmt::format("{}/default", global_path) // Global Default
};
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, item_script), // Local versioned by Item Script ./quests/zone/v0/items/10.ext
fmt::format("{}/{}", zone_path, item_script), // Local
fmt::format("{}/{}", global_path, item_script), // Global
fmt::format("{}/default", zone_path), // Local Default
fmt::format("{}/default", global_path) // Global Default
};
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
}
@@ -1209,43 +1221,45 @@ QuestInterface* QuestParserCollection::GetQIByEncounterQuest(std::string encount
return nullptr;
}
const std::string& global_path = fmt::format(
"{}/{}/encounters",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY
);
for (auto & dir : path.GetQuestPaths()) {
const std::string& global_path = fmt::format(
"{}/{}/encounters",
dir,
QUEST_GLOBAL_DIRECTORY
);
const std::string& zone_path = fmt::format(
"{}/{}/encounters",
path.GetQuestsPath(),
zone->GetShortName()
);
const std::string& zone_path = fmt::format(
"{}/{}/encounters",
dir,
zone->GetShortName()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}/encounters",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}/encounters",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, encounter_name), // Local versioned ./quests/zone/v0/encounters/name.ext
fmt::format("{}/{}", zone_path, encounter_name), // Local
fmt::format("{}/{}", global_path, encounter_name) // Global
};
std::vector<std::string> file_names = {
fmt::format("{}/{}", zone_versioned_path, encounter_name), // Local versioned ./quests/zone/v0/encounters/name.ext
fmt::format("{}/{}", zone_path, encounter_name), // Local
fmt::format("{}/{}", global_path, encounter_name) // Global
};
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
}
@@ -1259,44 +1273,46 @@ QuestInterface* QuestParserCollection::GetQIByBotQuest(std::string& filename)
return nullptr;
}
const std::string& global_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY
);
for (auto & dir : path.GetQuestPaths()) {
const std::string& global_path = fmt::format(
"{}/{}",
dir,
QUEST_GLOBAL_DIRECTORY
);
const std::string& zone_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
zone->GetShortName()
);
const std::string& zone_path = fmt::format(
"{}/{}",
dir,
zone->GetShortName()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
std::vector<std::string> file_names = {
fmt::format("{}/bot", zone_versioned_path), // Local versioned by Instance Version ./quests/zone/v0/bot.ext
fmt::format("{}/bot_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version
fmt::format("{}/bot", zone_path), // Local
fmt::format("{}/bot", global_path) // Global
};
std::vector<std::string> file_names = {
fmt::format("{}/bot", zone_versioned_path), // Local versioned by Instance Version ./quests/zone/v0/bot.ext
fmt::format("{}/bot_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version
fmt::format("{}/bot", zone_path), // Local
fmt::format("{}/bot", global_path) // Global
};
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
}
@@ -1311,17 +1327,19 @@ QuestInterface* QuestParserCollection::GetQIByGlobalBotQuest(std::string& filena
}
std::string file_name;
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_bot.{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
for (auto & dir : path.GetQuestPaths()) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_bot.{}",
dir,
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
@@ -1334,44 +1352,46 @@ QuestInterface* QuestParserCollection::GetQIByMercQuest(std::string& filename)
return nullptr;
}
const std::string& global_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY
);
for (auto & dir : path.GetQuestPaths()) {
const std::string& global_path = fmt::format(
"{}/{}",
dir,
QUEST_GLOBAL_DIRECTORY
);
const std::string& zone_path = fmt::format(
"{}/{}",
path.GetQuestsPath(),
zone->GetShortName()
);
const std::string& zone_path = fmt::format(
"{}/{}",
dir,
zone->GetShortName()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
path.GetQuestsPath(),
zone->GetShortName(),
zone->GetInstanceVersion()
);
const std::string& zone_versioned_path = fmt::format(
"{}/{}/v{}",
dir,
zone->GetShortName(),
zone->GetInstanceVersion()
);
std::vector<std::string> file_names = {
fmt::format("{}/merc", zone_versioned_path), // Local versioned by Instance Version ./quests/zone/v0/merc.ext
fmt::format("{}/merc_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version
fmt::format("{}/merc", zone_path), // Local
fmt::format("{}/merc", global_path) // Global
};
std::vector<std::string> file_names = {
fmt::format("{}/merc", zone_versioned_path), // Local versioned by Instance Version ./quests/zone/v0/merc.ext
fmt::format("{}/merc_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version
fmt::format("{}/merc", zone_path), // Local
fmt::format("{}/merc", global_path) // Global
};
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
std::string file_name;
for (auto & file : file_names) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}.{}",
file,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
}
@@ -1386,17 +1406,19 @@ QuestInterface* QuestParserCollection::GetQIByGlobalMercQuest(std::string& filen
}
std::string file_name;
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_merc.{}",
path.GetQuestsPath(),
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
for (auto & dir : path.GetQuestPaths()) {
for (auto* e: _load_precedence) {
file_name = fmt::format(
"{}/{}/global_merc.{}",
dir,
QUEST_GLOBAL_DIRECTORY,
_extensions.find(e->GetIdentifier())->second
);
if (File::Exists(file_name)) {
filename = file_name;
return e;
if (File::Exists(file_name)) {
filename = file_name;
return e;
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ void SharedTaskZoneMessaging::HandleWorldMessage(ServerPacket *pack)
->AcceptNewTask(
c,
(int) p->requested_task_id,
(int) p->requested_npc_type_id,
(int) p->requested_npc_entity_id,
p->accept_time
);
c->LoadClientTaskState();
+1 -1
View File
@@ -80,7 +80,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
#include "../common/repositories/character_corpses_repository.h"
#include "../common/repositories/spell_buckets_repository.h"
#include "data_bucket.h"
#include "../common/data_bucket.h"
#include "quest_parser_collection.h"
#include "string_ids.h"
#include "worldserver.h"
+4 -4
View File
@@ -1968,7 +1968,7 @@ void ClientTaskState::RemoveTaskByTaskID(Client *client, uint32 task_id)
void ClientTaskState::AcceptNewTask(
Client *client,
int task_id,
int npc_type_id,
int npc_entity_id,
time_t accept_time,
bool enforce_level_requirement
)
@@ -2001,7 +2001,7 @@ void ClientTaskState::AcceptNewTask(
// fill
r->requested_character_id = client->CharacterID();
r->requested_task_id = task_id;
r->requested_npc_type_id = npc_type_id;
r->requested_npc_entity_id = npc_entity_id;
// send
worldserver.SendPacket(pack);
@@ -2190,11 +2190,11 @@ void ClientTaskState::AcceptNewTask(
task_manager->SaveClientState(client, this);
NPC *npc = entity_list.GetID(npc_type_id)->CastToNPC();
NPC *npc = entity_list.GetNPCByID(npc_entity_id);
if (npc) {
if (player_event_logs.IsEventEnabled(PlayerEvent::TASK_ACCEPT)) {
auto e = PlayerEvent::TaskAcceptEvent{
.npc_id = static_cast<uint32>(npc_type_id),
.npc_id = npc->GetNPCTypeID(),
.npc_name = npc->GetCleanName(),
.task_id = static_cast<uint32>(task_id),
.task_name = task_manager->GetTaskName(static_cast<uint32>(task_id)),
+1 -1
View File
@@ -42,7 +42,7 @@ public:
int GetTaskActivityDoneCount(TaskType task_type, int index, int activity_id);
int GetTaskActivityDoneCountFromTaskID(int task_id, int activity_id);
int GetTaskStartTime(TaskType task_type, int index);
void AcceptNewTask(Client *client, int task_id, int npc_type_id, time_t accept_time, bool enforce_level_requirement = false);
void AcceptNewTask(Client *client, int task_id, int npc_entity_id, time_t accept_time, bool enforce_level_requirement = false);
void FailTask(Client *client, int task_id);
int TaskTimeLeft(int task_id);
bool IsTaskCompleted(int task_id, Client *c = nullptr);
-2
View File
@@ -88,8 +88,6 @@ extern WorldServer worldserver;
extern Zone* zone;
extern NpcScaleManager* npc_scale_manager;
Mutex MZoneShutdown;
volatile bool is_zone_loaded = false;
Zone* zone = 0;