Compare commits

..

44 Commits

Author SHA1 Message Date
Chris Miles 585ed3bd25 [Release] 23.8.1 2025-06-28 17:29:25 -05:00
Chris Miles 2eb291a461 [Databuckets] Revert Caching Changes of #4917 (#4957)
* [Databuckets] Revert Caching Changes of #4917

* Comment caching tests until addressed later
2025-06-28 17:28:19 -05:00
Alex King a1421af214 [Bug Fix] Fix Hero Forge on Character Select (#4954) 2025-06-26 19:35:28 -04:00
Alex King 13aad6229f [Crash Fix] Fix Possible Crashes with Raid Methods (#4955) 2025-06-26 19:35:20 -04:00
Alex King 76d46ceaf0 [Bug Fix] Fix FindCharacter Using content_db (#4956) 2025-06-26 19:35:11 -04:00
Chris Miles 389047c4e2 [Release] 23.8.0 (#4953)
* [Release] 23.8.0

* Changelog

* Update ruletypes.h
2025-06-25 21:12:05 -05:00
Chris Miles 2c6d405b2c [Hotfix] Fix ClientList Singleton Shortcomings of #4942 2025-06-25 15:50:34 -05:00
Fryguy 50ae0f8351 [Corpses] Add corpse entity variables to DB (#4911)
* [Corpses] Add corpse entity variables to DB

- When corpses have entity variables add/remove/modified it will update the database accordingly.
- Corpse loading will pull the database values if they exist.

* Updates per review

* Update version.h

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 15:21:52 -05:00
Alex King dc261bb203 [Code] ZSList Global to Singleton Cleanup (#4940)
* [Code] ZSList Global to Singleton Cleanup

* Final

* Post merge fixes

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 15:16:44 -05:00
Alex King 643ee56433 [Code] PlayerEventLogs Global to Singleton Cleanup (#4928)
* [Code] PlayerEventLogs Global to Singleton Cleanup

* Fix

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 15:05:33 -05:00
Alex King c0bb32ed12 [Code] WorldContentServer Global to Singleton Cleanup (#4939) 2025-06-25 14:55:39 -05:00
Alex King c99bda3f47 [Code] WebInterfaceList Global to Singleton Cleanup (#4935) 2025-06-25 14:49:32 -05:00
Alex King 967a13e692 [Code] WorldEventScheduler and ZoneEventScheduler Global to Singleton Cleanup (#4932) 2025-06-25 14:47:37 -05:00
Alex King f304f9cc61 [Code] QueryServConnection Global to Singleton Cleanup (#4938)
* [Code] QueryServConnection Global to Singleton Cleanup

* Fix missed file in PR

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 14:43:01 -05:00
Alex King 004e2ca63f [Code] AdventureManager Global to Singleton Cleanup (#4931)
* [Code] AdventureManager Global to Singleton Cleanup

* Post merge fix

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 14:38:24 -05:00
Alex King 128732e05d [Code] EvolvingItemsManager Global to Singleton Cleanup (#4929)
Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 14:26:29 -05:00
Alex King 1e6a4dac78 [Code] UCSConnection Global to Singleton Cleanup (#4937)
Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 14:25:37 -05:00
Alex King 654764685a [Code] LFGuildManager Global to Singleton Cleanup (#4927)
* [Code] LFGuildManager Global to Singleton Cleanup

* Update lfguild.h

* Update worldserver.cpp

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 14:19:52 -05:00
Alex King c5ab35e4af [Code] SharedTaskManager Global to Singleton Cleanup (#4930)
Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 14:11:40 -05:00
Chris Miles 947795f1d1 [Code] EQEmuLogSys Global to Singleton Cleanup (#4925)
* [Code] EQEmuLogSys Global to Singleton Cleanup

* Post merge fix
2025-06-25 14:05:49 -05:00
Alex King 1153c9ab96 [Code] LoginServerList Global to Singleton Cleanup (#4941) 2025-06-25 13:49:55 -05:00
Alex King 2128b45313 [Code] ClientList Global to Singleton Cleanup (#4942) 2025-06-25 13:49:42 -05:00
Alex King 4f7ff2d6f2 [Code] DatabaseUpdate Global to Singleton Cleanup (#4943)
Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 13:48:18 -05:00
Alex King b5f1e99d3b [Code] DiscordManager Global to Singleton Cleanup (#4926)
* [Code] DiscordManager Global to Singleton Cleanup

* Update discord_manager.h

---------

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 13:47:47 -05:00
Chris Miles 83918ce020 [Performance] Wearchange Packet Send Deduplication (#4916)
* [Performance] Wearchange Packet Send Deduplication

* Update mob_appearance.cpp

* Reduce one allocation

* Update mob_appearance.cpp

* Change

* Update mob_appearance.cpp

* Update mob_appearance.cpp

* Update mob_appearance.cpp

* Update mob_appearance.cpp

* Update mob_appearance.cpp

* Wut

* ffs
2025-06-25 13:19:29 -05:00
Alex King f3aaeff0a9 [Code] PetitionList Global to Singleton Cleanup (#4944)
* [Code] PetitionList Global to Singleton Cleanup

* Update worldserver.cpp

* Update worldserver.cpp
2025-06-25 13:15:21 -05:00
Chris Miles 98eff43346 chore: Update language for clarity and attribution 2025-06-25 13:09:43 -05:00
Bemvaras 46b43a990f [Quest API] Add CompleteTask and UncompleteTask methods to Perl/Lua (#4921)
* Add quest::uncompletetask to quest API

* Remove CMakeSettings.json (local build config) from PR

* Push

* Final

* Update embparser_api.cpp

* Update questmgr.cpp

* Update lua_client.cpp

* Fix parcel slot duplication for evolving item augments

---------

Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
Co-authored-by: Chris Miles <akkadius1@gmail.com>
2025-06-25 13:03:23 -05:00
Chris Miles ea96cbf885 [Databuckets] Nested Caching (#4917)
* [Databuckets] Nested Caching

* One more

* Update benchmark_databuckets.cpp

* Add caching tests

* Fix tests and scoping

* Update databuckets.cpp

* Fix tests

* Rebase fixes

* [Databuckets] Implement Cache in World (#4920)
2025-06-25 12:47:43 -05:00
regneq de07870c99 [Fix] Fix breaking changes to Titanium, SoF, SoD patches causes by big bags update (#4922)
* [Fix] Fix breaking change to Titanium patches caused by Big Bags update.

* Fixes for Titanium, SoD, SoF causes by big bag bug.
2025-06-25 12:41:13 -05:00
Chris Miles b3b228c26c [Code] PCH Cleanup (#4952)
* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update app-pch.h

* Update CMakeLists.txt

* Split out pch to zone

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update windows-build.ps1

* Update windows-build.ps1

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt
2025-06-25 12:26:38 -05:00
Fryguy 27b5c80c3c [Quest API] Lua Client Scoped EnableTitleSets (#4914)
Example usage:
```lua
client:EnableTitleSet(reward.title_set)
```
2025-06-25 12:25:35 -05:00
Chris Miles fb4d003e19 [Player Events] Zone Fetch Settings from QS if Enabled (#4915)
* [Player Events] Zone Fetch Settings from QS if Enabled

* Update zonelist.cpp

* Update zoneserver.cpp
2025-06-25 12:21:35 -05:00
Chris Miles f025e5741b [Player Event Logs] Don't Clear Event Data on ETL Events (#4913)
* [Player Event Logs] Don't Clear Event Data on ETL Events

* Migration
2025-06-24 20:15:22 -04:00
Chris Miles c3f2708f1b [Player Events] Don't Write Empty Data (#4912)
* [Player Events] Don't Write Empty Data

* Revert "[Player Events] Don't Write Empty Data"

This reverts commit f64a824b33.

* Update player_events.h

* Augs
2025-06-24 20:14:51 -04:00
Alex King 2e760d6397 [Code] ZoneStore Global to Singleton Cleanup (#4934) 2025-06-23 06:45:06 -04:00
Chris Miles bac892b582 [API] Add wwmarquee <type> <message> (#4919)
* [API] Implement Console "wwmarquee"

* Fin
2025-06-23 05:25:50 -04:00
Chris Miles 4005b68383 [Code] Optimize PCH Config (Faster Builds) (#4951) 2025-06-22 13:52:23 -05:00
Chris Miles 5ac9dd04e4 [Code] Cleanup Strings Header (#4950)
* [Code] Cleanup Strings Header

* Include optimize
2025-06-22 13:52:13 -05:00
Alex King f0c041e8b3 [Code] EQ::Random Global to Singleton Cleanup (#4936) 2025-06-22 14:13:58 -04:00
Alex King 2f4a5b56dd [Code] SkillCaps Global to Singleton Cleanup (#4933) 2025-06-22 14:13:16 -04:00
Alex King 940f97c9ae [Code] TaskManager Global to Singleton Cleanup (#4945)
* [Code] TaskManager Global to Singleton Cleanup

* Remove checks for existence

* Final
2025-06-22 14:10:48 -04:00
Chris Miles f8ee664b27 [Code] Remove Lua Rule Constants (#4949) 2025-06-22 13:55:55 -04:00
Chris Miles df86ad371b [Code] PathManager Global to Singleton Cleanup (#4924) 2025-06-22 13:50:52 -04:00
200 changed files with 3684 additions and 2642 deletions
+106
View File
@@ -1,3 +1,109 @@
## [23.8.1] 6/28/2025
### Crash Fix
* Fix Possible Crashes with Raid Methods ([#4955](https://github.com/EQEmu/Server/pull/4955)) @Kinglykrab 2025-06-26
### Databuckets
* Revert Caching Changes of #4917 ([#4957](https://github.com/EQEmu/Server/pull/4957)) @Akkadius 2025-06-28
### Fixes
* Fix FindCharacter Using content_db ([#4956](https://github.com/EQEmu/Server/pull/4956)) @Kinglykrab 2025-06-26
* Fix Hero Forge on Character Select ([#4954](https://github.com/EQEmu/Server/pull/4954)) @Kinglykrab 2025-06-26
## [23.8.0] 6/25/2025
### API
* Add wwmarquee <type> <message> ([#4919](https://github.com/EQEmu/Server/pull/4919)) @Akkadius 2025-06-23
### Build
* Significantly Improve Build Times Using Unity Builds ([#4948](https://github.com/EQEmu/Server/pull/4948)) @Akkadius 2025-06-22
### Code
* AdventureManager Global to Singleton Cleanup ([#4931](https://github.com/EQEmu/Server/pull/4931)) @Kinglykrab 2025-06-25
* Cleanup Strings Header ([#4950](https://github.com/EQEmu/Server/pull/4950)) @Akkadius 2025-06-22
* ClientList Global to Singleton Cleanup ([#4942](https://github.com/EQEmu/Server/pull/4942)) @Kinglykrab 2025-06-25
* DatabaseUpdate Global to Singleton Cleanup ([#4943](https://github.com/EQEmu/Server/pull/4943)) @Kinglykrab 2025-06-25
* DiscordManager Global to Singleton Cleanup ([#4926](https://github.com/EQEmu/Server/pull/4926)) @Kinglykrab 2025-06-25
* EQ::Random Global to Singleton Cleanup ([#4936](https://github.com/EQEmu/Server/pull/4936)) @Kinglykrab 2025-06-22
* EQEmuLogSys Global to Singleton Cleanup ([#4925](https://github.com/EQEmu/Server/pull/4925)) @Akkadius 2025-06-25
* EvolvingItemsManager Global to Singleton Cleanup ([#4929](https://github.com/EQEmu/Server/pull/4929)) @Kinglykrab 2025-06-25
* LFGuildManager Global to Singleton Cleanup ([#4927](https://github.com/EQEmu/Server/pull/4927)) @Kinglykrab 2025-06-25
* LoginServerList Global to Singleton Cleanup ([#4941](https://github.com/EQEmu/Server/pull/4941)) @Kinglykrab 2025-06-25
* Optimize PCH Config (Faster Builds) ([#4951](https://github.com/EQEmu/Server/pull/4951)) @Akkadius 2025-06-22
* PCH Cleanup ([#4952](https://github.com/EQEmu/Server/pull/4952)) @Akkadius 2025-06-25
* PathManager Global to Singleton Cleanup ([#4924](https://github.com/EQEmu/Server/pull/4924)) @Akkadius 2025-06-22
* PetitionList Global to Singleton Cleanup ([#4944](https://github.com/EQEmu/Server/pull/4944)) @Kinglykrab 2025-06-25
* PlayerEventLogs Global to Singleton Cleanup ([#4928](https://github.com/EQEmu/Server/pull/4928)) @Kinglykrab 2025-06-25
* QueryServConnection Global to Singleton Cleanup ([#4938](https://github.com/EQEmu/Server/pull/4938)) @Kinglykrab 2025-06-25
* Remove Lua Rule Constants ([#4949](https://github.com/EQEmu/Server/pull/4949)) @Akkadius 2025-06-22
* Remove Regex Compile Bloat ([#4947](https://github.com/EQEmu/Server/pull/4947)) @Akkadius 2025-06-22
* Remove Unused MZoneShutdown Mutex ([#4946](https://github.com/EQEmu/Server/pull/4946)) @Kinglykrab 2025-06-22
* SharedTaskManager Global to Singleton Cleanup ([#4930](https://github.com/EQEmu/Server/pull/4930)) @Kinglykrab 2025-06-25
* SkillCaps Global to Singleton Cleanup ([#4933](https://github.com/EQEmu/Server/pull/4933)) @Kinglykrab 2025-06-22
* TaskManager Global to Singleton Cleanup ([#4945](https://github.com/EQEmu/Server/pull/4945)) @Kinglykrab 2025-06-22
* UCSConnection Global to Singleton Cleanup ([#4937](https://github.com/EQEmu/Server/pull/4937)) @Kinglykrab 2025-06-25
* WebInterfaceList Global to Singleton Cleanup ([#4935](https://github.com/EQEmu/Server/pull/4935)) @Kinglykrab 2025-06-25
* WorldContentServer Global to Singleton Cleanup ([#4939](https://github.com/EQEmu/Server/pull/4939)) @Kinglykrab 2025-06-25
* WorldEventScheduler and ZoneEventScheduler Global to Singleton Cleanup ([#4932](https://github.com/EQEmu/Server/pull/4932)) @Kinglykrab 2025-06-25
* ZSList Global to Singleton Cleanup ([#4940](https://github.com/EQEmu/Server/pull/4940)) @Kinglykrab 2025-06-25
* ZoneStore Global to Singleton Cleanup ([#4934](https://github.com/EQEmu/Server/pull/4934)) @Kinglykrab 2025-06-23
### Corpses
* Add corpse entity variables to DB ([#4911](https://github.com/EQEmu/Server/pull/4911)) @fryguy503 2025-06-25
### Databuckets
* Move Databuckets to Common ([#4918](https://github.com/EQEmu/Server/pull/4918)) @Akkadius 2025-06-16
* Nested Caching ([#4917](https://github.com/EQEmu/Server/pull/4917)) @Akkadius 2025-06-25
### Doors
* Fix door saving for versions ([#4905](https://github.com/EQEmu/Server/pull/4905)) @nytmyr 2025-06-09
### Fixes
* Bulk Send Corpses after Idle State ([#4910](https://github.com/EQEmu/Server/pull/4910)) @Akkadius 2025-06-09
* Fix ClientList Singleton Shortcomings of #4942 @Akkadius 2025-06-25
* Fix breaking changes to Titanium, SoF, SoD patches causes by big bags update ([#4922](https://github.com/EQEmu/Server/pull/4922)) @regneq 2025-06-25
### Logs
* Fix output for tasks in logs ([#4907](https://github.com/EQEmu/Server/pull/4907)) @joligario 2025-06-09
### Performance
* Auto Idle / AFK ([#4903](https://github.com/EQEmu/Server/pull/4903)) @Akkadius 2025-05-22
* Wearchange Packet Send Deduplication ([#4916](https://github.com/EQEmu/Server/pull/4916)) @Akkadius 2025-06-25
### Player Event Logs
* Don't Clear Event Data on ETL Events ([#4913](https://github.com/EQEmu/Server/pull/4913)) @Akkadius 2025-06-25
### Player Events
* Don't Write Empty Data ([#4912](https://github.com/EQEmu/Server/pull/4912)) @Akkadius 2025-06-25
* Zone Fetch Settings from QS if Enabled ([#4915](https://github.com/EQEmu/Server/pull/4915)) @Akkadius 2025-06-25
### Quest API
* Add CompleteTask and UncompleteTask methods to Perl/Lua ([#4921](https://github.com/EQEmu/Server/pull/4921)) @Barathos 2025-06-25
* Lua Client Scoped EnableTitleSets ([#4914](https://github.com/EQEmu/Server/pull/4914)) @fryguy503 2025-06-25
### Quests
* Support Multiple Quest, Plugin, and Lua Module Paths ([#4906](https://github.com/EQEmu/Server/pull/4906)) @Akkadius 2025-06-09
### World API
* Input Validation ([#4904](https://github.com/EQEmu/Server/pull/4904)) @Akkadius 2025-05-22
## [23.7.0] 5/19/2025
### CLI
+8 -9
View File
@@ -5,7 +5,7 @@
</p>
<p align="center">
<b>EverQuest Emulator (EQEmu) - A Fan-Made Project Honoring the Legendary MMORPG</b>
<b>EQEmulator - A Fan-Made Project Honoring a Legendary MMORPG</b>
</p>
<p align="center">
@@ -26,19 +26,19 @@
***
<p align="center">
EQEmulator is a <b>passion-driven</b>, <b>open source server emulator</b> project dedicated to preserving and celebrating the groundbreaking world of <b>EverQuest</b>, the massively multiplayer online role-playing game originally developed by <b>Verant Interactive</b> and <b>Sony Online Entertainment (now Daybreak Game Company)</b>.
EQEmulator is a <b>passion-driven</b>, <b>open source server emulator</b> project dedicated to preserving and celebrating the legacy of a groundbreaking classic MMORPG.
</p>
<p align="center">
For over two decades and continuing, EQEmulator has served as a <strong>fan tribute</strong>, providing tools and technology that allow players to explore, customize, and experience EverQuests iconic gameplay in new ways. This project exists solely out of <strong>deep admiration</strong> for the original developers, artists, designers, and visionaries who created one of the most influential online worlds of all time.
For over two decades and continuing, EQEmulator has served as a <strong>fan tribute</strong>, providing tools and technology that allow players to explore, customize, and experience the legendary game's iconic gameplay in new ways. This project exists solely out of <strong>deep admiration</strong> for the original developers, artists, designers, and visionaries who created one of the most influential online worlds of all time.
</p>
<p align="center">
We do not claim ownership of EverQuest or its assets. <strong>All credit and respect belong to the original creators and Daybreak Game Company</strong>, whose work continues to inspire generations of players and developers alike.
We do not claim ownership of the original game or its assets. <strong>All credit and respect belong to the original creators and Daybreak Game Company</strong>, whose work continues to inspire generations of players and developers alike.
</p>
<p align="center">
EQEmulator has for over 20 years and always will be a <strong>fan-based, non-commercial open-source effort</strong> made by players, for players—preserving the legacy of EverQuest while empowering community-driven creativity, learning and joy that the game and its creators has so strongly inspired in us all.
EQEmulator has for over 20 years and always will be a <strong>fan-based, non-commercial open-source effort</strong> made by players, for players—preserving the legacy of the game while empowering community-driven creativity, learning and joy that the game and its creators has so strongly inspired in us all.
</p>
***
@@ -47,7 +47,7 @@ EQEmulator has for over 20 years and always will be a <strong>fan-based, non-com
Technical Overview & Reverse Engineering Effort
</h1>
<p align="center">EQEmulator represents <strong>over two decades of collaborative reverse engineering</strong>, rebuilding the EverQuest server from the ground up without access to the original source code. This effort was achieved entirely through <strong>community-driven analysis, network protocol decoding, and in-game behavioral research</strong>.</p>
<p align="center">EQEmulator represents <strong>over two decades of collaborative reverse engineering</strong>, building the server from the ground up without access to the original source code. This effort was achieved entirely through <strong>community-driven analysis, network protocol decoding, and in-game behavioral research</strong>.</p>
<h1 align="center">
💡 How We Did It
@@ -104,10 +104,10 @@ Every system, packet, opcode, and game mechanic has been reconstructed through c
🚀 Why It Matters
</h1>
<p align="center">🧬 EQEmulator stands as a <strong>technical preservation project</strong>, ensuring that the magic of classic and custom EverQuest servers lives on for future generations of players, tinkerers, and game designers.
<p align="center">🧬 EQEmulator stands as a <strong>technical preservation project</strong>, ensuring that the magic of classic and custom servers lives on for future generations of players, tinkerers, and game designers.
</p>
> We humbly acknowledge and thank the original developers at **Verant Interactive** and **Sony Online Entertainment (now Daybreak Game Company)** for creating one of the most influential online experiences in gaming history.
> We humbly acknowledge and thank the original developers for creating one of the most influential online experiences in gaming history.
<h1 align="center">
🧑‍💻🖥️ Supported Clients
@@ -148,4 +148,3 @@ If you want to set up your own EQEmulator server, please refer to the current [s
<a href="https://github.com/EQEmu/server/graphs/contributors">
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
</a>
+9 -16
View File
@@ -38,13 +38,6 @@
#include "../../common/skill_caps.h"
#include "../../common/evolving_items.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
ZoneStore zone_store;
PathManager path;
PlayerEventLogs player_event_logs;
EvolvingItemsManager evolving_items_manager;
void ExportSpells(SharedDatabase *db);
void ExportSkillCaps(SharedDatabase *db);
void ExportBaseData(SharedDatabase *db);
@@ -53,10 +46,10 @@ void ExportDBStrings(SharedDatabase *db);
int main(int argc, char **argv)
{
RegisterExecutablePlatform(ExePlatformClientExport);
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
set_exception_handler();
path.LoadPaths();
PathManager::Instance()->Init();
LogInfo("Client Files Export Utility");
if (!EQEmuConfig::LoadConfig()) {
@@ -99,8 +92,8 @@ int main(int argc, char **argv)
content_db.SetMySQL(database);
}
LogSys.SetDatabase(&database)
->SetLogPath(path.GetLogPath())
EQEmuLogSys::Instance()->SetDatabase(&database)
->SetLogPath(PathManager::Instance()->GetLogPath())
->LoadLogDatabaseSettings()
->StartFileLogs();
@@ -129,14 +122,14 @@ int main(int argc, char **argv)
ExportBaseData(&content_db);
ExportDBStrings(&database);
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
return 0;
}
void ExportSpells(SharedDatabase* db)
{
std::ofstream file(fmt::format("{}/export/spells_us.txt", path.GetServerPath()));
std::ofstream file(fmt::format("{}/export/spells_us.txt", PathManager::Instance()->GetServerPath()));
if (!file || !file.is_open()) {
LogError("Unable to open export/spells_us.txt to write, skipping.");
return;
@@ -155,7 +148,7 @@ void ExportSpells(SharedDatabase* db)
void ExportSkillCaps(SharedDatabase* db)
{
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", path.GetServerPath()));
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", PathManager::Instance()->GetServerPath()));
if (!file || !file.is_open()) {
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
return;
@@ -174,7 +167,7 @@ void ExportSkillCaps(SharedDatabase* db)
void ExportBaseData(SharedDatabase *db)
{
std::ofstream file(fmt::format("{}/export/BaseData.txt", path.GetServerPath()));
std::ofstream file(fmt::format("{}/export/BaseData.txt", PathManager::Instance()->GetServerPath()));
if (!file || !file.is_open()) {
LogError("Unable to open export/BaseData.txt to write, skipping.");
return;
@@ -193,7 +186,7 @@ void ExportBaseData(SharedDatabase *db)
void ExportDBStrings(SharedDatabase *db)
{
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", path.GetServerPath()));
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", PathManager::Instance()->GetServerPath()));
if (!file || !file.is_open()) {
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
return;
+9 -16
View File
@@ -32,13 +32,6 @@
#include "../../common/events/player_event_logs.h"
#include "../../common/evolving_items.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
ZoneStore zone_store;
PathManager path;
PlayerEventLogs player_event_logs;
EvolvingItemsManager evolving_items_manager;
void ImportSpells(SharedDatabase *db);
void ImportSkillCaps(SharedDatabase *db);
void ImportBaseData(SharedDatabase *db);
@@ -46,10 +39,10 @@ void ImportDBStrings(SharedDatabase *db);
int main(int argc, char **argv) {
RegisterExecutablePlatform(ExePlatformClientImport);
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
set_exception_handler();
path.LoadPaths();
PathManager::Instance()->Init();
LogInfo("Client Files Import Utility");
if(!EQEmuConfig::LoadConfig()) {
@@ -92,8 +85,8 @@ int main(int argc, char **argv) {
content_db.SetMySQL(database);
}
LogSys.SetDatabase(&database)
->SetLogPath(path.GetLogPath())
EQEmuLogSys::Instance()->SetDatabase(&database)
->SetLogPath(PathManager::Instance()->GetLogPath())
->LoadLogDatabaseSettings()
->StartFileLogs();
@@ -102,7 +95,7 @@ int main(int argc, char **argv) {
ImportBaseData(&content_db);
ImportDBStrings(&database);
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
return 0;
}
@@ -138,7 +131,7 @@ bool IsStringField(int i) {
void ImportSpells(SharedDatabase *db) {
LogInfo("Importing Spells");
std::string file = fmt::format("{}/import/spells_us.txt", path.GetServerPath());
std::string file = fmt::format("{}/import/spells_us.txt", PathManager::Instance()->GetServerPath());
FILE *f = fopen(file.c_str(), "r");
if(!f) {
LogError("Unable to open {} to read, skipping.", file);
@@ -228,7 +221,7 @@ void ImportSpells(SharedDatabase *db) {
void ImportSkillCaps(SharedDatabase *db) {
LogInfo("Importing Skill Caps");
std::string file = fmt::format("{}/import/SkillCaps.txt", path.GetServerPath());
std::string file = fmt::format("{}/import/SkillCaps.txt", PathManager::Instance()->GetServerPath());
FILE *f = fopen(file.c_str(), "r");
if(!f) {
LogError("Unable to open {} to read, skipping.", file);
@@ -265,7 +258,7 @@ void ImportBaseData(SharedDatabase *db)
{
LogInfo("Importing Base Data");
const std::string& file_name = fmt::format("{}/import/BaseData.txt", path.GetServerPath());
const std::string& file_name = fmt::format("{}/import/BaseData.txt", PathManager::Instance()->GetServerPath());
const auto& file_contents = File::GetContents(file_name);
if (!file_contents.error.empty()) {
@@ -305,7 +298,7 @@ void ImportBaseData(SharedDatabase *db)
void ImportDBStrings(SharedDatabase *db) {
LogInfo("Importing DB Strings");
std::string file = fmt::format("{}/import/dbstr_us.txt", path.GetServerPath());
std::string file = fmt::format("{}/import/dbstr_us.txt", PathManager::Instance()->GetServerPath());
FILE *f = fopen(file.c_str(), "r");
if(!f) {
LogError("Unable to open {} to read, skipping.", file);
+1 -1
View File
@@ -842,7 +842,7 @@ IF (UNIX)
ENDIF (UNIX)
IF (WIN32 AND EQEMU_BUILD_PCH)
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h)
ENDIF ()
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+5 -5
View File
@@ -27,7 +27,7 @@ WorldContentService *WorldContentService::SetExpansionContext()
// pull expansion from rules
int expansion = RuleI(Expansion, CurrentExpansion);
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
content_service.SetCurrentExpansion(expansion);
WorldContentService::Instance()->SetCurrentExpansion(expansion);
}
LogInfo(
@@ -41,12 +41,12 @@ WorldContentService *WorldContentService::SetExpansionContext()
std::string WorldContentService::GetCurrentExpansionName()
{
if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
if (WorldContentService::Instance()->GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
return "All Expansions";
}
if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
return Expansion::ExpansionName[content_service.GetCurrentExpansion()];
return Expansion::ExpansionName[WorldContentService::Instance()->GetCurrentExpansion()];
}
return "Unknown Expansion";
@@ -185,7 +185,7 @@ void WorldContentService::ReloadContentFlags()
SetContentFlags(set_content_flags);
LoadStaticGlobalZoneInstances();
zone_store.LoadZones(*m_content_database);
ZoneStore::Instance()->LoadZones(*m_content_database);
}
Database *WorldContentService::GetDatabase() const
@@ -291,7 +291,7 @@ WorldContentService *WorldContentService::LoadStaticGlobalZoneInstances()
// instance_list table entry for lavastorm has version = 1, is_global = 1, never_expires = 1
WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id, uint32 instance_id)
{
for (const auto &z: zone_store.GetZones()) {
for (const auto &z: ZoneStore::Instance()->GetZones()) {
for (auto &i: m_zone_static_instances) {
if (
z.zoneidnumber == zone_id &&
+6 -2
View File
@@ -181,6 +181,12 @@ public:
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
bool IsInPublicStaticInstance(uint32 instance_id);
static WorldContentService* Instance()
{
static WorldContentService instance;
return &instance;
}
private:
int current_expansion{};
std::vector<ContentFlagsRepository::ContentFlags> content_flags;
@@ -194,6 +200,4 @@ private:
std::vector<InstanceListRepository::InstanceList> m_zone_static_instances;
};
extern WorldContentService content_service;
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
+7 -5
View File
@@ -27,6 +27,8 @@ void SendCrashReport(const std::string &crash_report)
// "http://localhost:3010/api/v1/analytics/server-crash-report", // development
};
EQEmuLogSys* log = EQEmuLogSys::Instance();
auto config = EQEmuConfig::get();
for (auto &e: endpoints) {
uri u(e);
@@ -68,12 +70,12 @@ void SendCrashReport(const std::string &crash_report)
p["cpus"] = cpus.size();
p["origination_info"] = "";
if (!LogSys.origination_info.zone_short_name.empty()) {
if (!log->origination_info.zone_short_name.empty()) {
p["origination_info"] = fmt::format(
"{} ({}) instance_id [{}]",
LogSys.origination_info.zone_short_name,
LogSys.origination_info.zone_long_name,
LogSys.origination_info.instance_id
log->origination_info.zone_short_name,
log->origination_info.zone_long_name,
log->origination_info.instance_id
);
}
@@ -294,7 +296,7 @@ void print_trace()
SendCrashReport(crash_report);
}
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
exit(1);
}
+1 -1
View File
@@ -843,4 +843,4 @@ bool DataBucket::CanCache(const DataBucketKey &key)
}
return false;
}
}
+15 -1
View File
@@ -708,6 +708,20 @@ const std::string Database::GetNPCNameByID(uint32 npc_id)
return e.id ? e.name : std::string();
}
template<typename InputIterator, typename OutputIterator>
inline auto CleanMobName(InputIterator first, InputIterator last, OutputIterator result)
{
for (; first != last; ++first) {
if (*first == '_') {
*result = ' ';
}
else if (isalpha(*first) || *first == '`') {
*result = *first;
}
}
return result;
}
const std::string Database::GetCleanNPCNameByID(uint32 npc_id)
{
const auto& e = NpcTypesRepository::FindOne(*this, npc_id);
@@ -2230,7 +2244,7 @@ void Database::PurgeCharacterParcels()
pel.event_data = ss.str();
pel.created_at = std::time(nullptr);
player_event_logs.AddToQueue(pel);
PlayerEventLogs::Instance()->AddToQueue(pel);
ss.str("");
ss.clear();
+2 -2
View File
@@ -204,7 +204,7 @@ void DatabaseDumpService::DatabaseDump()
}
if (IsDumpOutputToConsole()) {
LogSys.SilenceConsoleLogging();
EQEmuLogSys::Instance()->SilenceConsoleLogging();
}
LogInfo("MySQL installed [{}]", GetMySQLVersion());
@@ -324,7 +324,7 @@ void DatabaseDumpService::DatabaseDump()
}
if (!IsDumpOutputToConsole()) {
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
}
if (!pipe_file.empty()) {
+2 -2
View File
@@ -154,7 +154,7 @@ bool DatabaseUpdate::UpdateManifest(
std::vector<int> missing_migrations = {};
if (version_low != version_high) {
LogSys.DisableMySQLErrorLogs();
EQEmuLogSys::Instance()->DisableMySQLErrorLogs();
bool force_interactive = false;
for (int version = version_low + 1; version <= version_high; ++version) {
for (auto &e: entries) {
@@ -184,7 +184,7 @@ bool DatabaseUpdate::UpdateManifest(
}
}
}
LogSys.EnableMySQLErrorLogs();
EQEmuLogSys::Instance()->EnableMySQLErrorLogs();
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
if (!missing_migrations.empty() && m_skip_backup) {
+7
View File
@@ -33,6 +33,13 @@ public:
DatabaseUpdate *SetContentDatabase(Database *db);
DatabaseUpdate *SetSkipBackup(bool skip);
bool HasPendingUpdates();
static DatabaseUpdate* Instance()
{
static DatabaseUpdate instance;
return &instance;
}
private:
bool m_skip_backup = false;
Database *m_database;
@@ -7109,6 +7109,30 @@ ALTER TABLE `npc_types`
ALTER TABLE `character_data`
CHANGE COLUMN `firstlogon` `ingame` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`,
ADD COLUMN `first_login` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`;
)",
.content_schema_update = false
},
ManifestEntry{
.version = 9324,
.description = "2025_06_11_player_event_logs_table.sql",
.check = "SHOW CREATE TABLE `player_event_logs`",
.condition = "missing",
.match = "COMPRESS",
.sql = R"(
ALTER TABLE player_event_logs ROW_FORMAT=COMPRESSED;
CREATE INDEX idx_event_type_char_id ON player_event_logs (event_type_id, character_id);
)",
.content_schema_update = false
},
ManifestEntry{
.version = 9325,
.description = "2025_06_10_character_corpses_entity_variables.sql",
.check = "SHOW COLUMNS FROM `character_corpses` LIKE 'entity_variables'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `character_corpses`
ADD COLUMN `entity_variables` TEXT DEFAULT NULL AFTER `rezzable`;
)",
.content_schema_update = false
},
+1 -1
View File
@@ -160,7 +160,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
(uint32) mysql_insert_id(mysql)
);
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
if (EQEmuLogSys::Instance()->log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
if ((strncasecmp(query, "select", 6) == 0)) {
LogMySQLQuery(
"{0} -- ({1} row{2} returned) ({3}s)",
+2 -2
View File
@@ -26,7 +26,7 @@ void DiscordManager::ProcessMessageQueue()
continue;
}
auto webhook = LogSys.GetDiscordWebhooks()[q.first];
auto webhook = EQEmuLogSys::Instance()->GetDiscordWebhooks()[q.first];
std::string message;
for (auto &m: q.second) {
@@ -68,7 +68,7 @@ void DiscordManager::ProcessMessageQueue()
void DiscordManager::QueuePlayerEventMessage(const PlayerEvent::PlayerEventContainer& e)
{
auto w = player_event_logs.GetDiscordWebhookUrlFromEventType(e.player_event_log.event_type_id);
auto w = PlayerEventLogs::Instance()->GetDiscordWebhookUrlFromEventType(e.player_event_log.event_type_id);
if (!w.empty()) {
Discord::SendPlayerEventMessage(e, w);
}
+6
View File
@@ -13,6 +13,12 @@ public:
void QueueWebhookMessage(uint32 webhook_id, const std::string& message);
void ProcessMessageQueue();
void QueuePlayerEventMessage(const PlayerEvent::PlayerEventContainer& e);
static DiscordManager* Instance()
{
static DiscordManager instance;
return &instance;
}
private:
std::mutex webhook_queue_lock{};
std::map<uint32, std::vector<std::string>> webhook_message_queue{};
+2 -2
View File
@@ -545,13 +545,13 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
uint32 chunksize, used;
uint32 length;
if (LogSys.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
if (EQEmuLogSys::Instance()->log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
if (p->GetOpcode() != OP_SpecialMesg){
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
}
}
if (LogSys.log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
if (EQEmuLogSys::Instance()->log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
if (p->GetOpcode() != OP_SpecialMesg){
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
}
+2 -2
View File
@@ -436,11 +436,11 @@ void EQEmuConfig::CheckUcsConfigConversion()
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
std::string config_file_path = std::filesystem::path{
path.GetServerPath() + "/eqemu_config.json"
PathManager::Instance()->GetServerPath() + "/eqemu_config.json"
}.string();
std::string config_file_bak_path = std::filesystem::path{
path.GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
PathManager::Instance()->GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
}.string();
// copy eqemu_config.json to eqemu_config.json.bak
+1 -1
View File
@@ -191,7 +191,7 @@ class EQEmuConfig
std::string file = fmt::format(
"{}/{}",
(file_path.empty() ? path.GetServerPath() : file_path),
(file_path.empty() ? PathManager::Instance()->GetServerPath() : file_path),
EQEmuConfig::ConfigFile
);
+4 -4
View File
@@ -537,9 +537,9 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
{
EQEmuLogSys::CloseFileLogs();
if (!File::Exists(path.GetLogPath())) {
LogInfo("Logs directory not found, creating [{}]", path.GetLogPath());
File::Makedir(path.GetLogPath());
if (!File::Exists(PathManager::Instance()->GetLogPath())) {
LogInfo("Logs directory not found, creating [{}]", PathManager::Instance()->GetLogPath());
File::Makedir(PathManager::Instance()->GetLogPath());
}
/**
@@ -656,7 +656,7 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
// If we go through this whole loop and nothing is set to any debug level, there
// is no point to create a file or keep anything open
if (log_settings[c.log_category_id].log_to_file > 0) {
LogSys.m_file_logs_enabled = true;
m_file_logs_enabled = true;
}
db_categories.emplace_back(c.log_category_id);
+12 -18
View File
@@ -266,8 +266,6 @@ namespace Logs {
};
}
#include "eqemu_logsys_log_aliases.h"
class Database;
constexpr uint16 MAX_DISCORD_WEBHOOK_ID = 300;
@@ -285,6 +283,12 @@ public:
EQEmuLogSys *LoadLogSettingsDefaults();
EQEmuLogSys *LoadLogDatabaseSettings(bool silent_load = false);
static EQEmuLogSys *Instance()
{
static EQEmuLogSys instance;
return &instance;
}
/**
* @param directory_name
*/
@@ -350,7 +354,7 @@ public:
/**
* Internally used memory reference for all log settings per category
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
* Database loaded via LogSys.SetDatabase(&database)->LoadLogDatabaseSettings();
* Database loaded via EQEmuLogSys::Instance()->SetDatabase(&database)->LoadLogDatabaseSettings();
*/
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
@@ -434,7 +438,7 @@ private:
void InjectTablesIfNotExist();
};
extern EQEmuLogSys LogSys;
#include "eqemu_logsys_log_aliases.h"
/**
template<typename... Args>
@@ -454,19 +458,9 @@ void OutF(
}
**/
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());
}
#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)
#endif
File diff suppressed because it is too large Load Diff
@@ -716,7 +716,7 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
);
for (int i = 0; i < h.augment_ids.size(); i++) {
if (!Strings::EqualFold(h.augment_names[i], "None")) {
if (!h.augment_names[i].empty()) {
const uint8 slot_id = (i + 1);
handin_items_info += fmt::format(
"Augment {}: {} ({})\n",
@@ -741,7 +741,7 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
);
for (int i = 0; i < r.augment_ids.size(); i++) {
if (!Strings::EqualFold(r.augment_names[i], "None")) {
if (!r.augment_names[i].empty()) {
const uint8 slot_id = (i + 1);
return_items_info += fmt::format(
"Augment {}: {} ({})\n",
+23 -8
View File
@@ -195,10 +195,12 @@ void PlayerEventLogs::ProcessBatchQueue()
};
// Helper to assign ETL table ID
auto AssignEtlId = [&](
PlayerEventLogsRepository::PlayerEventLogs &r,
PlayerEvent::EventType type
) {
auto AssignEtlId = [&](
PlayerEventLogsRepository::PlayerEventLogs& r,
PlayerEvent::EventType type
)
{
if (m_etl_settings.contains(type)) {
r.etl_table_id = m_etl_settings.at(type).next_id++;
}
@@ -406,7 +408,6 @@ void PlayerEventLogs::ProcessBatchQueue()
auto it = event_processors.find(static_cast<PlayerEvent::EventType>(r.event_type_id));
if (it != event_processors.end()) {
it->second(r); // Call the appropriate lambda
r.event_data = "{}"; // Clear event data
}
else {
LogPlayerEventsDetail("Non-Implemented ETL routing [{}]", r.event_type_id);
@@ -508,7 +509,7 @@ bool PlayerEventLogs::IsEventDiscordEnabled(int32_t event_type_id)
}
// ensure there is a matching webhook to begin with
if (!LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
if (!EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
return true;
}
@@ -528,13 +529,27 @@ std::string PlayerEventLogs::GetDiscordWebhookUrlFromEventType(int32_t event_typ
}
// ensure there is a matching webhook to begin with
if (!LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
return LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url;
if (!EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
return EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url;
}
return "";
}
void PlayerEventLogs::LoadPlayerEventSettingsFromQS(
const std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings> &settings
)
{
for (const auto &e : settings) {
if (e.id >= PlayerEvent::MAX || e.id < 0) {
continue;
}
m_settings[e.id] = e;
}
LogInfo("Applied [{}] player event log settings from QS", settings.size());
}
// GM_COMMAND | [x] Implemented Formatter
// ZONING | [x] Implemented Formatter
// AA_GAIN | [x] Implemented Formatter
+11 -5
View File
@@ -73,9 +73,11 @@ public:
return BuildPlayerEventPacket(c);
}
[[nodiscard]] const PlayerEventLogSettingsRepository::PlayerEventLogSettings *GetSettings() const;
bool IsEventDiscordEnabled(int32_t event_type_id);
std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
[[nodiscard]] const PlayerEventLogSettingsRepository::PlayerEventLogSettings * GetSettings() const;
bool IsEventDiscordEnabled(int32_t event_type_id);
std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
void LoadPlayerEventSettingsFromQS(const std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings>& settings);
static std::string GetDiscordPayloadFromEvent(const PlayerEvent::PlayerEventContainer &e);
@@ -94,6 +96,12 @@ public:
std::vector<PlayerEventAaPurchaseRepository::PlayerEventAaPurchase> aa_purchase;
};
static PlayerEventLogs* Instance()
{
static PlayerEventLogs instance;
return &instance;
}
private:
struct EtlSettings {
bool enabled;
@@ -127,6 +135,4 @@ public:
std::map<PlayerEvent::EventType, EtlSettings> &GetEtlSettings() { return m_etl_settings;}
};
extern PlayerEventLogs player_event_logs;
#endif //EQEMU_PLAYER_EVENT_LOGS_H
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -21,8 +21,8 @@ void EvolvingItemsManager::LoadEvolvingItems() const
results.begin(),
results.end(),
std::inserter(
evolving_items_manager.GetEvolvingItemsCache(),
evolving_items_manager.GetEvolvingItemsCache().end()
EvolvingItemsManager::Instance()->GetEvolvingItemsCache(),
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().end()
),
[](const ItemsEvolvingDetailsRepository::ItemsEvolvingDetails &x) {
return std::make_pair(x.item_id, x);
@@ -42,13 +42,13 @@ void EvolvingItemsManager::SetContentDatabase(Database *db)
double EvolvingItemsManager::CalculateProgression(const uint64 current_amount, const uint32 item_id)
{
if (!evolving_items_manager.GetEvolvingItemsCache().contains(item_id)) {
if (!EvolvingItemsManager::Instance()->GetEvolvingItemsCache().contains(item_id)) {
return 0;
}
return evolving_items_manager.GetEvolvingItemsCache().at(item_id).required_amount > 0
return EvolvingItemsManager::Instance()->GetEvolvingItemsCache().at(item_id).required_amount > 0
? static_cast<double>(current_amount)
/ static_cast<double>(evolving_items_manager.GetEvolvingItemsCache().at(item_id).required_amount) * 100
/ static_cast<double>(EvolvingItemsManager::Instance()->GetEvolvingItemsCache().at(item_id).required_amount) * 100
: 0;
}
@@ -73,7 +73,7 @@ void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_
e.character_id = char_id;
e.item_id = inst.GetID();
e.equipped = inst.GetEvolveEquipped();
e.final_item_id = evolving_items_manager.GetFinalItemID(inst);
e.final_item_id = EvolvingItemsManager::Instance()->GetFinalItemID(inst);
auto r = CharacterEvolvingItemsRepository::InsertOne(*m_db, e);
e.id = r.id;
@@ -96,20 +96,20 @@ uint32 EvolvingItemsManager::GetFinalItemID(const EQ::ItemInstance &inst) const
}
const auto start_iterator = std::ranges::find_if(
evolving_items_manager.GetEvolvingItemsCache().cbegin(),
evolving_items_manager.GetEvolvingItemsCache().cend(),
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cbegin(),
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cend(),
[&](const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a) {
return a.second.item_evo_id == inst.GetEvolveLoreID();
}
);
if (start_iterator == std::end(evolving_items_manager.GetEvolvingItemsCache())) {
if (start_iterator == std::end(EvolvingItemsManager::Instance()->GetEvolvingItemsCache())) {
return 0;
}
const auto final_id = std::ranges::max_element(
start_iterator,
evolving_items_manager.GetEvolvingItemsCache().cend(),
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cend(),
[&](
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a,
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &b
@@ -131,15 +131,15 @@ uint32 EvolvingItemsManager::GetNextEvolveItemID(const EQ::ItemInstance &inst) c
int8 const current_level = inst.GetEvolveLvl();
const auto iterator = std::ranges::find_if(
evolving_items_manager.GetEvolvingItemsCache().cbegin(),
evolving_items_manager.GetEvolvingItemsCache().cend(),
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cbegin(),
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cend(),
[&](const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a) {
return a.second.item_evo_id == inst.GetEvolveLoreID() &&
a.second.item_evolve_level == current_level + 1;
}
);
if (iterator == std::end(evolving_items_manager.GetEvolvingItemsCache())) {
if (iterator == std::end(EvolvingItemsManager::Instance()->GetEvolvingItemsCache())) {
return 0;
}
@@ -255,8 +255,8 @@ EvolveTransfer EvolvingItemsManager::DetermineTransferResults(
return ets;
}
auto evolving_details_inst_from = evolving_items_manager.GetEvolveItemDetails(inst_from.GetID());
auto evolving_details_inst_to = evolving_items_manager.GetEvolveItemDetails(inst_to.GetID());
auto evolving_details_inst_from = EvolvingItemsManager::Instance()->GetEvolveItemDetails(inst_from.GetID());
auto evolving_details_inst_to = EvolvingItemsManager::Instance()->GetEvolveItemDetails(inst_to.GetID());
if (!evolving_details_inst_from.id || !evolving_details_inst_to.id) {
return ets;
@@ -272,10 +272,10 @@ EvolveTransfer EvolvingItemsManager::DetermineTransferResults(
compatibility = 30;
}
xp = evolving_items_manager.GetTotalEarnedXP(inst_from) * compatibility / 100;
auto results = evolving_items_manager.GetNextItemByXP(inst_to, xp);
xp = EvolvingItemsManager::Instance()->GetTotalEarnedXP(inst_from) * compatibility / 100;
auto results = EvolvingItemsManager::Instance()->GetNextItemByXP(inst_to, xp);
ets.item_from_id = evolving_items_manager.GetFirstItemInLoreGroup(inst_from.GetEvolveLoreID());
ets.item_from_id = EvolvingItemsManager::Instance()->GetFirstItemInLoreGroup(inst_from.GetEvolveLoreID());
ets.item_from_current_amount = results.from_current_amount;
ets.item_to_id = results.new_item_id;
ets.item_to_current_amount = results.new_current_amount;
+5 -2
View File
@@ -56,12 +56,15 @@ public:
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails>& GetEvolvingItemsCache() { return m_evolving_items_cache; }
std::vector<ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> GetEvolveIDItems(uint32 evolve_id);
static EvolvingItemsManager* Instance()
{
static EvolvingItemsManager instance;
return &instance;
}
private:
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> m_evolving_items_cache;
Database * m_db;
Database * m_content_db;
};
extern EvolvingItemsManager evolving_items_manager;
#endif //EVOLVING_H
+1 -1
View File
@@ -55,7 +55,7 @@ namespace EQ {
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
}
#else
std::string final_name = fmt::format("{}/{}.lock", path.GetSharedMemoryPath(), name);
std::string final_name = fmt::format("{}/{}.lock", PathManager::Instance()->GetSharedMemoryPath(), name);
#ifdef __DARWIN
#if __DARWIN_C_LEVEL < 200809L
+2 -2
View File
@@ -574,7 +574,7 @@ EQ::ItemInstance* EQ::ItemInstance::GetOrnamentationAugment() const
uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const
{
// Not a Hero Forge item.
if (m_ornament_hero_model == 0 || material_slot < 0) {
if (m_ornament_hero_model == 0) {
return 0;
}
@@ -1799,7 +1799,7 @@ std::vector<std::string> EQ::ItemInstance::GetAugmentNames() const
for (uint8 slot_id = invaug::SOCKET_BEGIN; slot_id <= invaug::SOCKET_END; slot_id++) {
const auto augment = GetAugment(slot_id);
augment_names.push_back(augment ? augment->GetItem()->Name : "None");
augment_names.push_back(augment ? augment->GetItem()->Name : "");
}
return augment_names;
+1 -1
View File
@@ -335,7 +335,7 @@ namespace EQ
void SetEvolveAddToCurrentAmount(const uint64 in) const { m_evolving_details.current_amount += in; }
void SetEvolveFinalItemID(const uint32 in) const { m_evolving_details.final_item_id = in; }
bool TransferOwnership(Database& db, const uint32 to_char_id) const;
void CalculateEvolveProgression() const { m_evolving_details.progression = evolving_items_manager.CalculateProgression(GetEvolveCurrentAmount(), GetID()); }
void CalculateEvolveProgression() const { m_evolving_details.progression = EvolvingItemsManager::Instance()->CalculateProgression(GetEvolveCurrentAmount(), GetID()); }
protected:
//////////////////////////
+1 -1
View File
@@ -1167,7 +1167,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
}
}
if (LogSys.IsLogEnabled(Logs::General, Logs::NetClient)) {
if (EQEmuLogSys::Instance()->IsLogEnabled(Logs::General, Logs::NetClient)) {
size_t total_size = 0;
for (auto &e: s->sent_packets) {
total_size += e.second.packet.Length();
+1 -1
View File
@@ -71,7 +71,7 @@ void EQ::Net::EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req)
OpcodeManager::EmuToName(p->GetOpcode()),
(*m_opcode_manager)->EmuToEQ(p->GetOpcode()),
p->Size(),
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketServerClient) ? DumpPacketToString(p) : "")
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketServerClient) ? DumpPacketToString(p) : "")
);
if (m_opcode_manager && *m_opcode_manager) {
+1 -1
View File
@@ -319,7 +319,7 @@ void EQ::Net::ServertalkServerConnection::ProcessMessage(EQ::Net::Packet &p)
size_t message_len = length;
EQ::Net::StaticPacket packet(&data[0], message_len);
const auto is_detail_enabled = LogSys.IsLogEnabled(Logs::Detail, Logs::PacketServerToServer);
const auto is_detail_enabled = EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketServerToServer);
if (opcode != ServerOP_KeepAlive || is_detail_enabled) {
LogPacketServerToServer(
"[{:#06x}] Size [{}] {}",
+2 -2
View File
@@ -78,7 +78,7 @@ namespace RoF
{
//create our opcode manager if we havent already
if (opcodes == nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
//load up the opcode manager.
//TODO: figure out how to support shared memory with multiple patches...
@@ -117,7 +117,7 @@ namespace RoF
//we need to go to every stream and replace it's manager.
if (opcodes != nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
return;
+2 -2
View File
@@ -81,7 +81,7 @@ namespace RoF2
//create our opcode manager if we havent already
if (opcodes == nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
//load up the opcode manager.
//TODO: figure out how to support shared memory with multiple patches...
@@ -123,7 +123,7 @@ namespace RoF2
//we need to go to every stream and replace it's manager.
if (opcodes != nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
return;
+13 -13
View File
@@ -72,7 +72,7 @@ namespace SoD
{
//create our opcode manager if we havent already
if (opcodes == nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
//load up the opcode manager.
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
@@ -113,7 +113,7 @@ namespace SoD
//we need to go to every stream and replace it's manager.
if (opcodes != nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
return;
@@ -3966,12 +3966,12 @@ namespace SoD
SoDSlot = serverSlot - 2;
}
else if (serverSlot <= EQ::invbag::GENERAL_BAGS_8_END && serverSlot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
SoDSlot = serverSlot + 11;
else if (serverSlot <= EQ::invbag::GENERAL_BAGS_END && serverSlot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
SoDSlot = serverSlot - (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));;
}
else if (serverSlot <= EQ::invbag::CURSOR_BAG_END && serverSlot >= EQ::invbag::CURSOR_BAG_BEGIN) {
SoDSlot = serverSlot - 9;
SoDSlot = serverSlot - (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (serverSlot <= EQ::invslot::TRIBUTE_END && serverSlot >= EQ::invslot::TRIBUTE_BEGIN) {
@@ -3991,7 +3991,7 @@ namespace SoD
}
else if (serverSlot <= EQ::invbag::BANK_BAGS_END && serverSlot >= EQ::invbag::BANK_BAGS_BEGIN) {
SoDSlot = serverSlot + 1;
SoDSlot = serverSlot - (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));;
}
else if (serverSlot <= EQ::invslot::SHARED_BANK_END && serverSlot >= EQ::invslot::SHARED_BANK_BEGIN) {
@@ -3999,7 +3999,7 @@ namespace SoD
}
else if (serverSlot <= EQ::invbag::SHARED_BANK_BAGS_END && serverSlot >= EQ::invbag::SHARED_BANK_BAGS_BEGIN) {
SoDSlot = serverSlot + 1;
SoDSlot = serverSlot - (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::SHARED_BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (serverSlot <= EQ::invslot::TRADE_END && serverSlot >= EQ::invslot::TRADE_BEGIN) {
@@ -4007,7 +4007,7 @@ namespace SoD
}
else if (serverSlot <= EQ::invbag::TRADE_BAGS_END && serverSlot >= EQ::invbag::TRADE_BAGS_BEGIN) {
SoDSlot = serverSlot;
SoDSlot = serverSlot - (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((serverSlot - EQ::invbag::TRADE_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (serverSlot <= EQ::invslot::WORLD_END && serverSlot >= EQ::invslot::WORLD_BEGIN) {
@@ -4049,11 +4049,11 @@ namespace SoD
}
else if (sod_slot <= invbag::GENERAL_BAGS_END && sod_slot >= invbag::GENERAL_BAGS_BEGIN) {
server_slot = sod_slot - 11;
server_slot = sod_slot + (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invbag::CURSOR_BAG_END && sod_slot >= invbag::CURSOR_BAG_BEGIN) {
server_slot = sod_slot + 9;
server_slot = sod_slot + (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (sod_slot <= invslot::TRIBUTE_END && sod_slot >= invslot::TRIBUTE_BEGIN) {
@@ -4073,7 +4073,7 @@ namespace SoD
}
else if (sod_slot <= invbag::BANK_BAGS_END && sod_slot >= invbag::BANK_BAGS_BEGIN) {
server_slot = sod_slot - 1;
server_slot = sod_slot + (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invslot::SHARED_BANK_END && sod_slot >= invslot::SHARED_BANK_BEGIN) {
@@ -4081,7 +4081,7 @@ namespace SoD
}
else if (sod_slot <= invbag::SHARED_BANK_BAGS_END && sod_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
server_slot = sod_slot - 1;
server_slot = sod_slot + (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::SHARED_BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invslot::TRADE_END && sod_slot >= invslot::TRADE_BEGIN) {
@@ -4089,7 +4089,7 @@ namespace SoD
}
else if (sod_slot <= invbag::TRADE_BAGS_END && sod_slot >= invbag::TRADE_BAGS_BEGIN) {
server_slot = sod_slot;
server_slot = sod_slot + (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sod_slot - invbag::TRADE_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (sod_slot <= invslot::WORLD_END && sod_slot >= invslot::WORLD_BEGIN) {
+13 -13
View File
@@ -71,7 +71,7 @@ namespace SoF
{
//create our opcode manager if we havent already
if (opcodes == nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
//load up the opcode manager.
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
@@ -110,7 +110,7 @@ namespace SoF
//we need to go to every stream and replace it's manager.
if (opcodes != nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
return;
@@ -3355,12 +3355,12 @@ namespace SoF
sof_slot = server_slot - 2;
}
else if (server_slot <= EQ::invbag::GENERAL_BAGS_8_END && server_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
sof_slot = server_slot + 11;
else if (server_slot <= EQ::invbag::GENERAL_BAGS_END && server_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
sof_slot = server_slot - (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));;
}
else if (server_slot <= EQ::invbag::CURSOR_BAG_END && server_slot >= EQ::invbag::CURSOR_BAG_BEGIN) {
sof_slot = server_slot - 9;
sof_slot = server_slot - (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (server_slot <= EQ::invslot::TRIBUTE_END && server_slot >= EQ::invslot::TRIBUTE_BEGIN) {
@@ -3380,7 +3380,7 @@ namespace SoF
}
else if (server_slot <= EQ::invbag::BANK_BAGS_END && server_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
sof_slot = server_slot + 1;
sof_slot = server_slot - (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::SHARED_BANK_END && server_slot >= EQ::invslot::SHARED_BANK_BEGIN) {
@@ -3388,7 +3388,7 @@ namespace SoF
}
else if (server_slot <= EQ::invbag::SHARED_BANK_BAGS_END && server_slot >= EQ::invbag::SHARED_BANK_BAGS_BEGIN) {
sof_slot = server_slot + 1;
sof_slot = server_slot - (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::SHARED_BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::TRADE_END && server_slot >= EQ::invslot::TRADE_BEGIN) {
@@ -3396,7 +3396,7 @@ namespace SoF
}
else if (server_slot <= EQ::invbag::TRADE_BAGS_END && server_slot >= EQ::invbag::TRADE_BAGS_BEGIN) {
sof_slot = server_slot;
sof_slot = server_slot - (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::TRADE_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::WORLD_END && server_slot >= EQ::invslot::WORLD_BEGIN) {
@@ -3442,11 +3442,11 @@ namespace SoF
}
else if (sof_slot <= invbag::GENERAL_BAGS_END && sof_slot >= invbag::GENERAL_BAGS_BEGIN) {
server_slot = sof_slot - 11;
server_slot = sof_slot + (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invbag::CURSOR_BAG_END && sof_slot >= invbag::CURSOR_BAG_BEGIN) {
server_slot = sof_slot + 9;
server_slot = sof_slot + (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (sof_slot <= invslot::TRIBUTE_END && sof_slot >= invslot::TRIBUTE_BEGIN) {
@@ -3466,7 +3466,7 @@ namespace SoF
}
else if (sof_slot <= invbag::BANK_BAGS_END && sof_slot >= invbag::BANK_BAGS_BEGIN) {
server_slot = sof_slot - 1;
server_slot = sof_slot + (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invslot::SHARED_BANK_END && sof_slot >= invslot::SHARED_BANK_BEGIN) {
@@ -3474,7 +3474,7 @@ namespace SoF
}
else if (sof_slot <= invbag::SHARED_BANK_BAGS_END && sof_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
server_slot = sof_slot - 1;
server_slot = sof_slot + (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::SHARED_BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invslot::TRADE_END && sof_slot >= invslot::TRADE_BEGIN) {
@@ -3482,7 +3482,7 @@ namespace SoF
}
else if (sof_slot <= invbag::TRADE_BAGS_END && sof_slot >= invbag::TRADE_BAGS_BEGIN) {
server_slot = sof_slot;
server_slot = sof_slot + (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((sof_slot - invbag::TRADE_BAGS_BEGIN) / invbag::SLOT_COUNT));;
}
else if (sof_slot <= invslot::WORLD_END && sof_slot >= invslot::WORLD_BEGIN) {
+14 -14
View File
@@ -73,7 +73,7 @@ namespace Titanium
auto Config = EQEmuConfig::get();
//create our opcode manager if we havent already
if (opcodes == nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
//load up the opcode manager.
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
@@ -114,7 +114,7 @@ namespace Titanium
//we need to go to every stream and replace it's manager.
if (opcodes != nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
return;
@@ -3596,12 +3596,12 @@ namespace Titanium
else if (server_slot == (EQ::invslot::POSSESSIONS_COUNT + EQ::invslot::slotAmmo)) {
titanium_slot = server_slot - 4;
}
else if (server_slot <= EQ::invbag::GENERAL_BAGS_8_END &&
else if (server_slot <= EQ::invbag::GENERAL_BAGS_END &&
server_slot >= EQ::invbag::GENERAL_BAGS_BEGIN) {
titanium_slot = server_slot;
titanium_slot = server_slot - (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invbag::CURSOR_BAG_END && server_slot >= EQ::invbag::CURSOR_BAG_BEGIN) {
titanium_slot = server_slot - 20;
titanium_slot = server_slot - (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (server_slot <= EQ::invslot::TRIBUTE_END && server_slot >= EQ::invslot::TRIBUTE_BEGIN) {
titanium_slot = server_slot;
@@ -3616,21 +3616,21 @@ namespace Titanium
else if (server_slot <= EQ::invslot::BANK_END && server_slot >= EQ::invslot::BANK_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQ::invbag::BANK_BAGS_16_END && server_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
titanium_slot = server_slot;
else if (server_slot <= EQ::invbag::BANK_BAGS_END && server_slot >= EQ::invbag::BANK_BAGS_BEGIN) {
titanium_slot = server_slot - (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::SHARED_BANK_END && server_slot >= EQ::invslot::SHARED_BANK_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQ::invbag::SHARED_BANK_BAGS_END &&
server_slot >= EQ::invbag::SHARED_BANK_BAGS_BEGIN) {
titanium_slot = server_slot;
titanium_slot = server_slot - (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::SHARED_BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::TRADE_END && server_slot >= EQ::invslot::TRADE_BEGIN) {
titanium_slot = server_slot;
}
else if (server_slot <= EQ::invbag::TRADE_BAGS_END && server_slot >= EQ::invbag::TRADE_BAGS_BEGIN) {
titanium_slot = server_slot;
titanium_slot = server_slot - (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) - ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((server_slot - EQ::invbag::TRADE_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT));
}
else if (server_slot <= EQ::invslot::WORLD_END && server_slot >= EQ::invslot::WORLD_BEGIN) {
titanium_slot = server_slot;
@@ -3687,10 +3687,10 @@ namespace Titanium
server_slot = titanium_slot + 4;
}
else if (titanium_slot <= invbag::GENERAL_BAGS_END && titanium_slot >= invbag::GENERAL_BAGS_BEGIN) {
server_slot = titanium_slot;
server_slot = titanium_slot + (EQ::invbag::GENERAL_BAGS_BEGIN - invbag::GENERAL_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::GENERAL_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invbag::CURSOR_BAG_END && titanium_slot >= invbag::CURSOR_BAG_BEGIN) {
server_slot = titanium_slot + 20;
server_slot = titanium_slot + (EQ::invbag::CURSOR_BAG_BEGIN - invbag::CURSOR_BAG_BEGIN);
}
else if (titanium_slot <= invslot::TRIBUTE_END && titanium_slot >= invslot::TRIBUTE_BEGIN) {
server_slot = titanium_slot;
@@ -3705,19 +3705,19 @@ namespace Titanium
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::BANK_BAGS_END && titanium_slot >= invbag::BANK_BAGS_BEGIN) {
server_slot = titanium_slot;
server_slot = titanium_slot + (EQ::invbag::BANK_BAGS_BEGIN - invbag::BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invslot::SHARED_BANK_END && titanium_slot >= invslot::SHARED_BANK_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::SHARED_BANK_BAGS_END && titanium_slot >= invbag::SHARED_BANK_BAGS_BEGIN) {
server_slot = titanium_slot;
server_slot = titanium_slot + (EQ::invbag::SHARED_BANK_BAGS_BEGIN - invbag::SHARED_BANK_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::SHARED_BANK_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invslot::TRADE_END && titanium_slot >= invslot::TRADE_BEGIN) {
server_slot = titanium_slot;
}
else if (titanium_slot <= invbag::TRADE_BAGS_END && titanium_slot >= invbag::TRADE_BAGS_BEGIN) {
server_slot = titanium_slot;
server_slot = titanium_slot + (EQ::invbag::TRADE_BAGS_BEGIN - invbag::TRADE_BAGS_BEGIN) + ((EQ::invbag::SLOT_COUNT - invbag::SLOT_COUNT) * ((titanium_slot - invbag::TRADE_BAGS_BEGIN) / invbag::SLOT_COUNT));
}
else if (titanium_slot <= invslot::WORLD_END && titanium_slot >= invslot::WORLD_BEGIN) {
server_slot = titanium_slot;
+2 -2
View File
@@ -76,7 +76,7 @@ namespace UF
{
//create our opcode manager if we havent already
if (opcodes == nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
//load up the opcode manager.
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
@@ -117,7 +117,7 @@ namespace UF
//we need to go to every stream and replace it's manager.
if (opcodes != nullptr) {
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
return;
+1 -1
View File
@@ -8,7 +8,7 @@
namespace fs = std::filesystem;
void PathManager::LoadPaths()
void PathManager::Init()
{
m_server_path = File::FindEqemuConfigPath();
+7 -3
View File
@@ -7,7 +7,13 @@
class PathManager {
public:
void LoadPaths();
void Init();
static PathManager *Instance()
{
static PathManager instance;
return &instance;
}
[[nodiscard]] const std::string &GetLogPath() const;
[[nodiscard]] const std::string &GetLuaModsPath() const;
@@ -38,6 +44,4 @@ private:
std::string m_shared_memory_path;
};
extern PathManager path;
#endif //EQEMU_PATH_MANAGER_H
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#include "../types.h"
#include "../database.h"
#include "../strings.h"
#include "../eqemu_logsys.h"
#include "../eqemu_logsys_log_aliases.h"
#include "../features.h"
#include "../global_define.h"
+1
View File
@@ -1,6 +1,7 @@
#include <string>
#include <memory>
#include "process.h"
#include <fmt/format.h>
std::string Process::execute(const std::string &cmd)
{
+6
View File
@@ -116,6 +116,12 @@ namespace EQ {
Reseed();
}
static Random* Instance()
{
static Random instance;
return &instance;
}
private:
#ifndef BIASED_INT_DIST
typedef std::uniform_int_distribution<int>::param_type int_param_t;
@@ -70,6 +70,7 @@ public:
uint32_t gm_exp;
uint32_t killed_by;
uint8_t rezzable;
std::string entity_variables;
};
static std::string PrimaryKey()
@@ -131,6 +132,7 @@ public:
"gm_exp",
"killed_by",
"rezzable",
"entity_variables",
};
}
@@ -188,6 +190,7 @@ public:
"gm_exp",
"killed_by",
"rezzable",
"entity_variables",
};
}
@@ -279,6 +282,7 @@ public:
e.gm_exp = 0;
e.killed_by = 0;
e.rezzable = 0;
e.entity_variables = "";
return e;
}
@@ -366,6 +370,7 @@ public:
e.gm_exp = row[48] ? static_cast<uint32_t>(strtoul(row[48], nullptr, 10)) : 0;
e.killed_by = row[49] ? static_cast<uint32_t>(strtoul(row[49], nullptr, 10)) : 0;
e.rezzable = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0;
e.entity_variables = row[51] ? row[51] : "";
return e;
}
@@ -449,6 +454,7 @@ public:
v.push_back(columns[48] + " = " + std::to_string(e.gm_exp));
v.push_back(columns[49] + " = " + std::to_string(e.killed_by));
v.push_back(columns[50] + " = " + std::to_string(e.rezzable));
v.push_back(columns[51] + " = '" + Strings::Escape(e.entity_variables) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -521,6 +527,7 @@ public:
v.push_back(std::to_string(e.gm_exp));
v.push_back(std::to_string(e.killed_by));
v.push_back(std::to_string(e.rezzable));
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -601,6 +608,7 @@ public:
v.push_back(std::to_string(e.gm_exp));
v.push_back(std::to_string(e.killed_by));
v.push_back(std::to_string(e.rezzable));
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}
@@ -685,6 +693,7 @@ public:
e.gm_exp = row[48] ? static_cast<uint32_t>(strtoul(row[48], nullptr, 10)) : 0;
e.killed_by = row[49] ? static_cast<uint32_t>(strtoul(row[49], nullptr, 10)) : 0;
e.rezzable = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0;
e.entity_variables = row[51] ? row[51] : "";
all_entries.push_back(e);
}
@@ -760,6 +769,7 @@ public:
e.gm_exp = row[48] ? static_cast<uint32_t>(strtoul(row[48], nullptr, 10)) : 0;
e.killed_by = row[49] ? static_cast<uint32_t>(strtoul(row[49], nullptr, 10)) : 0;
e.rezzable = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0;
e.entity_variables = row[51] ? row[51] : "";
all_entries.push_back(e);
}
@@ -885,6 +895,7 @@ public:
v.push_back(std::to_string(e.gm_exp));
v.push_back(std::to_string(e.killed_by));
v.push_back(std::to_string(e.rezzable));
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -958,6 +969,7 @@ public:
v.push_back(std::to_string(e.gm_exp));
v.push_back(std::to_string(e.killed_by));
v.push_back(std::to_string(e.rezzable));
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}
@@ -15,7 +15,7 @@
#include "../../database.h"
#include "../../strings.h"
#include <ctime>
#include <cereal/cereal.hpp>
class BasePlayerEventLogSettingsRepository {
public:
struct PlayerEventLogSettings {
@@ -25,6 +25,20 @@ public:
int32_t retention_days;
int32_t discord_webhook_id;
uint8_t etl_enabled;
// cereal
template<class Archive>
void serialize(Archive &ar)
{
ar(
CEREAL_NVP(id),
CEREAL_NVP(event_name),
CEREAL_NVP(event_enabled),
CEREAL_NVP(retention_days),
CEREAL_NVP(discord_webhook_id),
CEREAL_NVP(etl_enabled)
);
}
};
static std::string PrimaryKey()
@@ -231,6 +231,21 @@ public:
return UpdateOne(db, corpse);
}
static int UpdateEntityVariables(Database& db, uint32 corpse_id, const std::string& json_string)
{
auto results = db.QueryDatabase(
fmt::format(
"UPDATE `{}` SET `entity_variables` = '{}' WHERE `{}` = {}",
TableName(),
Strings::Escape(json_string),
PrimaryKey(),
corpse_id
)
);
return results.Success() ? results.RowsAffected() : 0;
}
};
#endif //EQEMU_CHARACTER_CORPSES_REPOSITORY_H
@@ -167,6 +167,30 @@ public:
return zone_player_counts;
}
static std::vector<uint32_t> GetCharacterIDsByAccountID(
Database& db,
uint32_t account_id
)
{
std::vector<uint32_t> character_ids;
auto query = fmt::format(
"SELECT id FROM character_data WHERE account_id = {} AND deleted_at IS NULL",
account_id
);
auto results = db.QueryDatabase(query);
if (results.Success()) {
for (auto row : results) {
if (row[0]) {
character_ids.push_back(static_cast<uint32_t>(std::stoul(row[0])));
}
}
}
return character_ids;
}
};
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
@@ -14,7 +14,7 @@ namespace ContentFilterCriteria {
table_prefix = table_prefix + ".";
}
int current_expansion_filter_criteria = content_service.GetCurrentExpansion();
int current_expansion_filter_criteria = WorldContentService::Instance()->GetCurrentExpansion();
if (current_expansion_filter_criteria == Expansion::EXPANSION_ALL) {
current_expansion_filter_criteria = Expansion::EXPANSION_FILTER_MAX;
}
@@ -33,8 +33,8 @@ namespace ContentFilterCriteria {
table_prefix
);
std::vector<std::string> flags_disabled = content_service.GetContentFlagsDisabled();
std::vector<std::string> flags_enabled = content_service.GetContentFlagsEnabled();
std::vector<std::string> flags_disabled = WorldContentService::Instance()->GetContentFlagsDisabled();
std::vector<std::string> flags_enabled = WorldContentService::Instance()->GetContentFlagsEnabled();
std::string flags_in_filter_enabled;
std::string flags_in_filter_disabled;
if (!flags_enabled.empty()) {
+59 -2
View File
@@ -43,6 +43,47 @@ public:
* method and encapsulate filters there
*/
template<typename T1, typename T2, typename T3, typename T4>
static std::vector<std::string> join_tuple(
const std::string &glue,
const std::pair<char, char> &encapsulation,
const std::vector<std::tuple<T1, T2, T3, T4>> &src
)
{
if (src.empty()) {
return {};
}
std::vector<std::string> output;
for (const std::tuple<T1, T2, T3, T4> &src_iter: src) {
output.emplace_back(
fmt::format(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
encapsulation.first,
std::get<0>(src_iter),
encapsulation.second,
glue,
encapsulation.first,
std::get<1>(src_iter),
encapsulation.second,
glue,
encapsulation.first,
std::get<2>(src_iter),
encapsulation.second,
glue,
encapsulation.first,
std::get<3>(src_iter),
encapsulation.second
)
);
}
return output;
}
// Custom extended repository methods here
static std::vector<std::string> GetRuleNames(Database &db, int rule_set_id)
{
@@ -87,12 +128,28 @@ public:
return v;
}
template<typename T>
static std::string
ImplodePair(const std::string &glue, const std::pair<char, char> &encapsulation, const std::vector<T> &src)
{
if (src.empty()) {
return {};
}
std::ostringstream oss;
for (const T &src_iter: src) {
oss << encapsulation.first << src_iter << encapsulation.second << glue;
}
std::string output(oss.str());
output.resize(output.size() - glue.size());
return output;
}
static bool DeleteOrphanedRules(Database& db, std::vector<std::string>& v)
{
const auto query = fmt::format(
"DELETE FROM {} WHERE rule_name IN ({})",
TableName(),
Strings::ImplodePair(",", std::pair<char, char>('\'', '\''), v)
ImplodePair(",", std::pair<char, char>('\'', '\''), v)
);
return db.QueryDatabase(query).Success();
@@ -103,7 +160,7 @@ public:
const auto query = fmt::format(
"REPLACE INTO {} (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES {}",
TableName(),
Strings::ImplodePair(
ImplodePair(
",",
std::pair<char, char>('(', ')'),
join_tuple(",", std::pair<char, char>('\'', '\''), v)
+1 -1
View File
@@ -233,7 +233,7 @@ 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, EnableAutoAFK, false, "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)")
+3 -1
View File
@@ -273,8 +273,9 @@
#define ServerOP_WWTaskUpdate 0x4758
// player events
#define ServerOP_QSSendQuery 0x5000
#define ServerOP_QSSendQuery 0x5000
#define ServerOP_PlayerEvent 0x5100
#define ServerOP_SendPlayerEventSettings 0x5101
enum {
CZUpdateType_Character,
@@ -1778,6 +1779,7 @@ struct BazaarPurchaseMessaging_Struct {
uint32 id;
};
#pragma pack()
#endif
+54 -6
View File
@@ -824,7 +824,7 @@ bool SharedDatabase::GetInventory(Client *c)
e.character_id = char_id;
e.item_id = item_id;
e.equipped = inst->GetEvolveEquipped();
e.final_item_id = evolving_items_manager.GetFinalItemID(*inst);
e.final_item_id = EvolvingItemsManager::Instance()->GetFinalItemID(*inst);
auto r = CharacterEvolvingItemsRepository::InsertOne(*this, e);
e.id = r.id;
@@ -974,7 +974,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
const auto Config = EQEmuConfig::get();
EQ::IPCMutex mutex("items");
mutex.Lock();
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("items"));
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("items"));
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(static_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
mutex.Unlock();
@@ -1544,12 +1544,60 @@ bool SharedDatabase::GetCommandSettings(std::map<std::string, std::pair<uint8, s
return true;
}
template<typename T1, typename T2>
inline std::vector<std::string> join_pair(
const std::string &glue,
const std::pair<char, char> &encapsulation,
const std::vector<std::pair<T1, T2>> &src
)
{
if (src.empty()) {
return {};
}
std::vector<std::string> output;
for (const std::pair<T1, T2> &src_iter: src) {
output.emplace_back(
fmt::format(
"{}{}{}{}{}{}{}",
encapsulation.first,
src_iter.first,
encapsulation.second,
glue,
encapsulation.first,
src_iter.second,
encapsulation.second
)
);
}
return output;
}
template<typename T>
inline std::string
ImplodePair(const std::string &glue, const std::pair<char, char> &encapsulation, const std::vector<T> &src)
{
if (src.empty()) {
return {};
}
std::ostringstream oss;
for (const T &src_iter: src) {
oss << encapsulation.first << src_iter << encapsulation.second << glue;
}
std::string output(oss.str());
output.resize(output.size() - glue.size());
return output;
}
bool SharedDatabase::UpdateInjectedCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected)
{
if (injected.size()) {
const std::string query = fmt::format(
"REPLACE INTO `command_settings`(`command`, `access`) VALUES {}",
Strings::ImplodePair(
ImplodePair(
",",
std::pair<char, char>('(', ')'),
join_pair(",", std::pair<char, char>('\'', '\''), injected)
@@ -1576,7 +1624,7 @@ bool SharedDatabase::UpdateOrphanedCommandSettings(const std::vector<std::string
if (orphaned.size()) {
std::string query = fmt::format(
"DELETE FROM `command_settings` WHERE `command` IN ({})",
Strings::ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
);
auto results = QueryDatabase(query);
@@ -1586,7 +1634,7 @@ bool SharedDatabase::UpdateOrphanedCommandSettings(const std::vector<std::string
query = fmt::format(
"DELETE FROM `command_subsettings` WHERE `parent_command` IN ({})",
Strings::ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
ImplodePair(",", std::pair<char, char>('\'', '\''), orphaned)
);
auto results_two = QueryDatabase(query);
@@ -1665,7 +1713,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
EQ::IPCMutex mutex("spells");
mutex.Lock();
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("spells"));
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("spells"));
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
LogInfo("Loading [{}]", file_name);
*records = *static_cast<uint32*>(spells_mmf->Get());
+6 -2
View File
@@ -16,12 +16,16 @@ public:
static int32_t GetSkillCapMaxLevel(uint8 class_id, EQ::skills::SkillType skill_id);
SkillCaps *SetContentDatabase(Database *db);
static SkillCaps* Instance()
{
static SkillCaps instance;
return &instance;
}
private:
Database *m_content_database{};
std::map<uint64, SkillCapsRepository::SkillCaps> m_skill_caps = {};
};
extern SkillCaps skill_caps;
#endif //CODE_SKILL_CAPS_H
+20
View File
@@ -34,6 +34,7 @@
*/
#include "strings.h"
#include <cereal/external/rapidjson/document.h>
#include <fmt/format.h>
#include <algorithm>
#include <cctype>
@@ -41,6 +42,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <random>
#include <string>
@@ -49,6 +51,12 @@
#include "strings_legacy.cpp" // legacy c functions
#include "strings_misc.cpp" // anything non "Strings" scoped
#ifdef _WINDOWS
#include <ctype.h>
#include <functional>
#include <algorithm>
#endif
std::string Strings::Random(size_t length)
{
static auto &chrs = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -701,6 +709,18 @@ std::string &Strings::Trim(std::string &str, const std::string &chars)
return LTrim(RTrim(str, chars), chars);
}
const std::string NUM_TO_ENGLISH_X[] = {
"", "One ", "Two ", "Three ", "Four ",
"Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
"Twelve ", "Thirteen ", "Fourteen ", "Fifteen ",
"Sixteen ", "Seventeen ", "Eighteen ", "Nineteen "
};
const std::string NUM_TO_ENGLISH_Y[] = {
"", "", "Twenty ", "Thirty ", "Forty ",
"Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety "
};
// Function to convert single digit or two digit number into words
std::string Strings::ConvertToDigit(int n, const std::string& suffix)
{
+3 -193
View File
@@ -36,53 +36,19 @@
#define _STRINGUTIL_H_
#include <charconv>
#include <sstream>
#include <string.h>
#include <cstring>
#include <string_view>
#include <string>
#include <vector>
#include <cstdarg>
#include <tuple>
#include <type_traits>
#include <fmt/format.h>
#include <cereal/external/rapidjson/document.h>
#ifndef _WIN32
// this doesn't appear to affect linux-based systems..need feedback for _WIN64
#endif
#ifdef _WINDOWS
#ifdef _WIN32
#include <ctype.h>
#include <functional>
#include <algorithm>
#endif
#include "types.h"
namespace detail {
// template magic to check if std::from_chars floating point functions exist
template <typename T, typename = void>
struct has_from_chars_float : std::false_type { };
// basically it "uses" this template if they do exist because reasons
template <typename T>
struct has_from_chars_float < T,
std::void_t<decltype(std::from_chars(std::declval<const char *>(), std::declval<const char *>(),
std::declval<T &>()))>> : std::true_type { };
}; // namespace detail
namespace EQ {
// lame -- older GCC's didn't define this, clang's libc++ however does, even though they lack FP support
#if defined(__GNUC__) && (__GNUC__ < 11) && !defined(__clang__)
enum class chars_format {
scientific = 1, fixed = 2, hex = 4, general = fixed | scientific
};
#else
using chars_format = std::chars_format;
#endif
}; // namespace EQ
class Strings {
public:
static bool Contains(std::vector<std::string> container, const std::string& element);
@@ -133,61 +99,6 @@ public:
static bool BeginsWith(const std::string& subject, const std::string& search);
static bool EndsWith(const std::string& subject, const std::string& search);
static std::string ZoneTime(const uint8 hours, const uint8 minutes);
template<typename T>
static std::string
ImplodePair(const std::string &glue, const std::pair<char, char> &encapsulation, const std::vector<T> &src)
{
if (src.empty()) {
return {};
}
std::ostringstream oss;
for (const T &src_iter: src) {
oss << encapsulation.first << src_iter << encapsulation.second << glue;
}
std::string output(oss.str());
output.resize(output.size() - glue.size());
return output;
}
// basic string_view overloads that just use std stuff since they work!
template <typename T>
std::enable_if_t<std::is_floating_point_v<T> && detail::has_from_chars_float<T>::value, std::from_chars_result>
static from_chars(std::string_view str, T& value, EQ::chars_format fmt = EQ::chars_format::general)
{
return std::from_chars(str.data(), str.data() + str.size(), value, fmt);
}
template <typename T>
std::enable_if_t<std::is_integral_v<T>, std::from_chars_result>
static from_chars(std::string_view str, T& value, int base = 10)
{
return std::from_chars(str.data(), str.data() + str.size(), value, base);
}
// fallback versions of floating point in case they're not implemented
// TODO: add error handling ...
// This does have to allocate since from_chars doesn't need a null terminated string and neither does string_view
template <typename T>
std::enable_if_t<std::is_floating_point_v<T> && !detail::has_from_chars_float<T>::value && std::is_same_v<T, float>, std::from_chars_result>
static from_chars(std::string_view str, T& value, EQ::chars_format fmt = EQ::chars_format::general)
{
std::from_chars_result res{};
std::string tmp_str(str.data(), str.size());
value = strtof(tmp_str.data(), nullptr);
return res;
}
template <typename T>
std::enable_if_t<std::is_floating_point_v<T> && !detail::has_from_chars_float<T>::value && std::is_same_v<T, double>, std::from_chars_result>
static from_chars(std::string_view str, T& value, EQ::chars_format fmt = EQ::chars_format::general)
{
std::from_chars_result res{};
std::string tmp_str(str.data(), str.size());
value = strtod(tmp_str.data(), nullptr);
return res;
}
static std::string Slugify(const std::string &input, const std::string &separator = "-");
static bool IsValidJson(const std::string& json);
};
@@ -199,93 +110,6 @@ const std::string vStringFormat(const char *format, va_list args);
// Used for grid nodes, as NPC names remove numerals.
// But general purpose
const std::string NUM_TO_ENGLISH_X[] = {
"", "One ", "Two ", "Three ", "Four ",
"Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
"Twelve ", "Thirteen ", "Fourteen ", "Fifteen ",
"Sixteen ", "Seventeen ", "Eighteen ", "Nineteen "
};
const std::string NUM_TO_ENGLISH_Y[] = {
"", "", "Twenty ", "Thirty ", "Forty ",
"Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety "
};
// _WIN32 builds require that #include<fmt/format.h> be included in whatever code file the invocation is made from (no header files)
template<typename T1, typename T2>
std::vector<std::string> join_pair(
const std::string &glue,
const std::pair<char, char> &encapsulation,
const std::vector<std::pair<T1, T2>> &src
)
{
if (src.empty()) {
return {};
}
std::vector<std::string> output;
for (const std::pair<T1, T2> &src_iter: src) {
output.emplace_back(
fmt::format(
"{}{}{}{}{}{}{}",
encapsulation.first,
src_iter.first,
encapsulation.second,
glue,
encapsulation.first,
src_iter.second,
encapsulation.second
)
);
}
return output;
}
// _WIN32 builds require that #include<fmt/format.h> be included in whatever code file the invocation is made from (no header files)
template<typename T1, typename T2, typename T3, typename T4>
std::vector<std::string> join_tuple(
const std::string &glue,
const std::pair<char, char> &encapsulation,
const std::vector<std::tuple<T1, T2, T3, T4>> &src
)
{
if (src.empty()) {
return {};
}
std::vector<std::string> output;
for (const std::tuple<T1, T2, T3, T4> &src_iter: src) {
output.emplace_back(
fmt::format(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
encapsulation.first,
std::get<0>(src_iter),
encapsulation.second,
glue,
encapsulation.first,
std::get<1>(src_iter),
encapsulation.second,
glue,
encapsulation.first,
std::get<2>(src_iter),
encapsulation.second,
glue,
encapsulation.first,
std::get<3>(src_iter),
encapsulation.second
)
);
}
return output;
}
// misc functions
std::string SanitizeWorldServerName(std::string server_long_name);
std::vector<std::string> GetBadWords();
@@ -310,18 +134,4 @@ std::string FormatName(const std::string &char_name);
bool IsAllowedWorldServerCharacterList(char c);
void SanitizeWorldServerName(char *name);
template<typename InputIterator, typename OutputIterator>
auto CleanMobName(InputIterator first, InputIterator last, OutputIterator result)
{
for (; first != last; ++first) {
if (*first == '_') {
*result = ' ';
}
else if (isalpha(*first) || *first == '`') {
*result = *first;
}
}
return result;
}
#endif
+2 -2
View File
@@ -25,7 +25,7 @@
// Build variables
// these get injected during the build pipeline
#define CURRENT_VERSION "23.7.0-dev" // always append -dev to the current version for custom-builds
#define CURRENT_VERSION "23.8.1-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__
@@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9323
#define CURRENT_BINARY_DATABASE_VERSION 9325
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
#define CUSTOM_BINARY_DATABASE_VERSION 0
+13 -10
View File
@@ -104,36 +104,39 @@ public:
uint8 GetZoneIdleWhenEmpty(uint32 zone_id, int version = 0);
uint32 GetZoneSecondsBeforeIdle(uint32 zone_id, int version = 0);
static ZoneStore* Instance()
{
static ZoneStore instance;
return &instance;
}
private:
std::vector<ZoneRepository::Zone> m_zones;
};
extern ZoneStore zone_store;
/**
* Global helpers
*/
inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); }
inline uint32 ZoneID(const std::string& zone_name) { return zone_store.GetZoneID(zone_name); }
inline uint32 ZoneID(const char *in_zone_name) { return ZoneStore::Instance()->GetZoneID(in_zone_name); }
inline uint32 ZoneID(const std::string& zone_name) { return ZoneStore::Instance()->GetZoneID(zone_name); }
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
{
return zone_store.GetZoneName(
return ZoneStore::Instance()->GetZoneName(
zone_id,
error_unknown
);
}
inline const char *ZoneLongName(uint32 zone_id, bool error_unknown = false)
{
return zone_store.GetZoneLongName(
return ZoneStore::Instance()->GetZoneLongName(
zone_id,
error_unknown
);
}
inline ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0) { return zone_store.GetZone(zone_id, version); };
inline ZoneRepository::Zone *GetZone(const char *in_zone_name) { return zone_store.GetZone(in_zone_name); };
inline ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0) { return ZoneStore::Instance()->GetZone(zone_id, version); };
inline ZoneRepository::Zone *GetZone(const char *in_zone_name) { return ZoneStore::Instance()->GetZone(in_zone_name); };
inline ZoneRepository::Zone *GetZone(const char *in_zone_name, int version = 0)
{
return zone_store.GetZone(
return ZoneStore::Instance()->GetZone(
ZoneID(
in_zone_name
), version
@@ -141,7 +144,7 @@ inline ZoneRepository::Zone *GetZone(const char *in_zone_name, int version = 0)
};
inline ZoneRepository::Zone *GetZoneVersionWithFallback(uint32 zone_id, int version = 0)
{
return zone_store.GetZoneWithFallback(
return ZoneStore::Instance()->GetZoneWithFallback(
zone_id,
version
);
+3 -6
View File
@@ -33,19 +33,16 @@
#include <signal.h>
#include <time.h>
EQEmuLogSys LogSys;
PathManager path;
bool RunLoops = false;
void CatchSignal(int sig_num);
int main(int argc, char *argv[]) {
RegisterExecutablePlatform(ExePlatformLaunch);
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
set_exception_handler();
path.LoadPaths();
PathManager::Instance()->Init();
std::string launcher_name;
if(argc == 2) {
@@ -169,7 +166,7 @@ int main(int argc, char *argv[]) {
delete zone->second;
}
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
return 0;
}
+1 -1
View File
@@ -25,7 +25,7 @@ bool Client::Process()
OpcodeManager::EmuToName(app->GetOpcode()),
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
app->Size(),
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
);
if (m_client_status == cs_failed_to_login) {
+3 -3
View File
@@ -94,7 +94,7 @@ ClientManager::ClientManager()
std::string opcodes_path = fmt::format(
"{}/{}",
path.GetOpcodePath(),
PathManager::Instance()->GetOpcodePath(),
"login_opcodes.conf"
);
@@ -131,7 +131,7 @@ ClientManager::ClientManager()
opcodes_path = fmt::format(
"{}/{}",
path.GetOpcodePath(),
PathManager::Instance()->GetOpcodePath(),
"login_opcodes_sod.conf"
);
@@ -169,7 +169,7 @@ ClientManager::ClientManager()
opcodes_path = fmt::format(
"{}/{}",
path.GetOpcodePath(),
PathManager::Instance()->GetOpcodePath(),
"login_opcodes_larion.conf"
);
+8 -12
View File
@@ -22,12 +22,8 @@
#include <thread>
LoginServer server;
EQEmuLogSys LogSys;
bool run_server = true;
PathManager path;
Database database;
PlayerEventLogs player_event_logs;
ZoneStore zone_store;
void CatchSignal(int sig_num)
{
@@ -52,7 +48,7 @@ void LoadDatabaseConnection()
void LoadServerConfig()
{
server.config = EQ::JsonConfigFile::Load(
fmt::format("{}/login.json", path.GetServerPath())
fmt::format("{}/login.json", PathManager::Instance()->GetServerPath())
);
LogInfo("Config System Init");
@@ -159,21 +155,21 @@ int main(int argc, char **argv)
LogInfo("Logging System Init");
if (argc == 1) {
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
}
path.LoadPaths();
PathManager::Instance()->Init();
// command handler
if (argc > 1) {
LogSys.SilenceConsoleLogging();
EQEmuLogSys::Instance()->SilenceConsoleLogging();
LoadServerConfig();
LoadDatabaseConnection();
LogSys.LoadLogSettingsDefaults();
LogSys.log_settings[Logs::Debug].log_to_console = static_cast<uint8>(Logs::General);
LogSys.log_settings[Logs::Debug].is_category_enabled = 1;
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->log_settings[Logs::Debug].log_to_console = static_cast<uint8>(Logs::General);
EQEmuLogSys::Instance()->log_settings[Logs::Debug].is_category_enabled = 1;
LoginserverCommandHandler::CommandHandler(argc, argv);
}
@@ -182,7 +178,7 @@ int main(int argc, char **argv)
LoadDatabaseConnection();
if (argc == 1) {
LogSys.SetDatabase(&database)
EQEmuLogSys::Instance()->SetDatabase(&database)
->SetLogPath("logs")
->LoadLogDatabaseSettings()
->StartFileLogs();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "eqemu-server",
"version": "23.7.0",
"version": "23.8.1",
"repository": {
"type": "git",
"url": "https://github.com/EQEmu/Server.git"
+6
View File
@@ -44,6 +44,12 @@ public:
bool LoadDatabase();
void HandlePacket(ServerPacket *pack);
void ExpireEntries();
static LFGuildManager* Instance()
{
static LFGuildManager instance;
return &instance;
}
private:
void SendPlayerMatches(uint32 FromZoneID, uint32 FromInstanceID, char *From, uint32 FromLevel, uint32 ToLevel, uint32 MinAA, uint32 TimeZone, uint32 Classes);
void SendGuildMatches(uint32 FromZoneID, uint32 FromInstanceID, char *From, uint32 Level, uint32 AAPoints, uint32 TimeZone, uint32 Class);
+11 -19
View File
@@ -20,23 +20,15 @@
#include "../common/net/console_server.h"
#include "../queryserv/zonelist.h"
#include "../queryserv/zoneserver.h"
#include "../common/discord/discord_manager.h"
volatile bool RunLoops = true;
QSDatabase qs_database;
Database database;
LFGuildManager lfguildmanager;
std::string WorldShortName;
const queryservconfig *Config;
WorldServer *worldserver = 0;
EQEmuLogSys LogSys;
PathManager path;
ZoneStore zone_store;
PlayerEventLogs player_event_logs;
ZSList zs_list;
uint32 numzones = 0;
DiscordManager discord_manager;
void CatchSignal(int sig_num)
{
@@ -46,11 +38,11 @@ void CatchSignal(int sig_num)
int main()
{
RegisterExecutablePlatform(ExePlatformQueryServ);
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
set_exception_handler();
Timer LFGuildExpireTimer(60000);
path.LoadPaths();
PathManager::Instance()->Init();
LogInfo("Starting EQEmu QueryServ");
if (!queryservconfig::LoadConfig()) {
@@ -85,8 +77,8 @@ int main()
return 1;
}
LogSys.SetDatabase(&database)
->SetLogPath(path.GetLogPath())
EQEmuLogSys::Instance()->SetDatabase(&database)
->SetLogPath(PathManager::Instance()->GetLogPath())
->LoadLogDatabaseSettings()
->StartFileLogs();
@@ -129,7 +121,7 @@ int main()
server_connection->OnConnectionIdentified(
"Zone", [&console](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
numzones++;
zs_list.Add(new ZoneServer(connection, console.get()));
ZSList::Instance()->Add(new ZoneServer(connection, console.get()));
LogInfo(
"New Zone Server connection from [{}] at [{}:{}] zone_count [{}]",
@@ -144,7 +136,7 @@ int main()
server_connection->OnConnectionRemoved(
"Zone", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> connection) {
numzones--;
zs_list.Remove(connection->GetUUID());
ZSList::Instance()->Remove(connection->GetUUID());
LogInfo(
"Removed Zone Server connection from [{}] total zone_count [{}]",
@@ -159,10 +151,10 @@ int main()
worldserver->Connect();
/* Load Looking For Guild Manager */
lfguildmanager.LoadDatabase();
LFGuildManager::Instance()->LoadDatabase();
Timer player_event_process_timer(1000);
player_event_logs.SetDatabase(&qs_database)->Init();
PlayerEventLogs::Instance()->SetDatabase(&qs_database)->Init();
auto loop_fn = [&](EQ::Timer *t) {
Timer::SetCurrentTime();
@@ -173,11 +165,11 @@ int main()
}
if (LFGuildExpireTimer.Check()) {
lfguildmanager.ExpireEntries();
LFGuildManager::Instance()->ExpireEntries();
}
if (player_event_process_timer.Check()) {
player_event_logs.Process();
PlayerEventLogs::Instance()->Process();
}
};
@@ -187,7 +179,7 @@ int main()
EQ::EventLoop::Get().Run();
safe_delete(worldserver);
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
}
void UpdateWindowTitle(char *iNewTitle)
+6 -4
View File
@@ -21,10 +21,11 @@
#include <string.h>
#include <time.h>
#include "zonelist.h"
extern WorldServer worldserver;
extern const queryservconfig *Config;
extern QSDatabase qs_database;
extern LFGuildManager lfguildmanager;
WorldServer::WorldServer()
{
@@ -76,8 +77,9 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
case ServerOP_ServerReloadRequest: {
auto o = (ServerReload::Request*) p.Data();
if (o->type == ServerReload::Type::Logs) {
LogSys.LoadLogDatabaseSettings();
player_event_logs.ReloadSettings();
EQEmuLogSys::Instance()->LoadLogDatabaseSettings();
PlayerEventLogs::Instance()->ReloadSettings();
ZSList::Instance()->SendPlayerEventLogSettings();
}
break;
@@ -112,7 +114,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
pack.pBuffer = (uchar *) p.Data();
pack.opcode = opcode;
pack.size = (uint32) p.Length();
lfguildmanager.HandlePacket(&pack);
LFGuildManager::Instance()->HandlePacket(&pack);
pack.pBuffer = nullptr;
break;
}
+9
View File
@@ -5,6 +5,8 @@
void ZSList::Add(ZoneServer* zoneserver) {
zone_server_list.emplace_back(std::unique_ptr<ZoneServer>(zoneserver));
zoneserver->SetIsZoneConnected(true);
zoneserver->SendPlayerEventLogSettings();
}
void ZSList::Remove(const std::string &uuid)
@@ -18,3 +20,10 @@ void ZSList::Remove(const std::string &uuid)
iter++;
}
}
void ZSList::SendPlayerEventLogSettings()
{
for (auto &zs : zone_server_list) {
zs->SendPlayerEventLogSettings();
}
}
+11 -4
View File
@@ -6,15 +6,22 @@
#include <vector>
#include <memory>
#include <list>
#include "zoneserver.h"
class WorldTCPConnection;
class ZoneServer;
class ZSList {
public:
std::list<std::unique_ptr<ZoneServer>> &GetZsList() { return zone_server_list; }
void Add(ZoneServer *zoneserver);
void Remove(const std::string &uuid);
std::list<std::unique_ptr<ZoneServer>>& GetZsList() { return zone_server_list; }
void Add(ZoneServer* zoneserver);
void Remove(const std::string& uuid);
void SendPlayerEventLogSettings();
static ZSList* Instance()
{
static ZSList instance;
return &instance;
}
private:
std::list<std::unique_ptr<ZoneServer>> zone_server_list;
+26 -4
View File
@@ -5,8 +5,6 @@
#include "../common/events/player_event_logs.h"
#include "../common/discord/discord_manager.h"
extern DiscordManager discord_manager;
ZoneServer::ZoneServer(
std::shared_ptr<EQ::Net::ServertalkServerConnection> in_connection,
EQ::Net::ConsoleServer *in_console
@@ -35,9 +33,9 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
cereal::BinaryInputArchive archive(ss);
archive(n);
player_event_logs.AddToQueue(n.player_event_log);
PlayerEventLogs::Instance()->AddToQueue(n.player_event_log);
discord_manager.QueuePlayerEventMessage(n);
DiscordManager::Instance()->QueuePlayerEventMessage(n);
break;
}
default: {
@@ -46,3 +44,27 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
}
}
}
void ZoneServer::SendPlayerEventLogSettings()
{
EQ::Net::DynamicPacket dyn_pack;
std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings> settings(
PlayerEventLogs::Instance()->GetSettings(),
PlayerEventLogs::Instance()->GetSettings() + PlayerEvent::EventType::MAX
);
dyn_pack.PutSerialize(0, settings);
auto packet_size = sizeof(ServerSendPlayerEvent_Struct) + dyn_pack.Length();
auto pack = std::make_unique<ServerPacket>(
ServerOP_SendPlayerEventSettings,
static_cast<uint32_t>(packet_size)
);
auto* buf = reinterpret_cast<ServerSendPlayerEvent_Struct*>(pack->pBuffer);
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
SendPacket(pack.release());
}
+5 -4
View File
@@ -16,11 +16,12 @@ class ZoneServer : public WorldTCPConnection {
public:
ZoneServer(std::shared_ptr<EQ::Net::ServertalkServerConnection> in_connection, EQ::Net::ConsoleServer *in_console);
~ZoneServer();
void SendPacket(ServerPacket *pack) { m_connection->SendPacket(pack); }
void SetIsZoneConnected(bool in) { m_is_zone_connected = in; }
bool GetIsZoneConnected() { return m_is_zone_connected; }
void HandleMessage(uint16 opcode, const EQ::Net::Packet &p);
void SendPacket(ServerPacket *pack) { m_connection->SendPacket(pack); }
void SetIsZoneConnected(bool in) { m_is_zone_connected = in; }
bool GetIsZoneConnected() { return m_is_zone_connected; }
void HandleMessage(uint16 opcode, const EQ::Net::Packet &p);
std::string GetUUID() const { return m_connection->GetUUID(); }
void SendPlayerEventLogSettings();
private:
std::shared_ptr<EQ::Net::ServertalkServerConnection> m_connection{};
+9 -16
View File
@@ -35,13 +35,6 @@
#include "../common/events/player_event_logs.h"
#include "../common/evolving_items.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
ZoneStore zone_store;
PathManager path;
PlayerEventLogs player_event_logs;
EvolvingItemsManager evolving_items_manager;
#ifdef _WINDOWS
#include <direct.h>
#else
@@ -81,10 +74,10 @@ inline bool MakeDirectory(const std::string &directory_name)
int main(int argc, char **argv)
{
RegisterExecutablePlatform(ExePlatformSharedMemory);
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
set_exception_handler();
path.LoadPaths();
PathManager::Instance()->Init();
LogInfo("Shared Memory Loader Program");
if (!EQEmuConfig::LoadConfig()) {
@@ -126,8 +119,8 @@ int main(int argc, char **argv)
content_db.SetMySQL(database);
}
LogSys.SetDatabase(&database)
->SetLogPath(path.GetLogPath())
EQEmuLogSys::Instance()->SetDatabase(&database)
->SetLogPath(PathManager::Instance()->GetLogPath())
->LoadLogDatabaseSettings()
->StartFileLogs();
@@ -169,16 +162,16 @@ int main(int argc, char **argv)
}
content_service.SetCurrentExpansion(RuleI(Expansion, CurrentExpansion));
content_service.SetDatabase(&database)
WorldContentService::Instance()->SetCurrentExpansion(RuleI(Expansion, CurrentExpansion));
WorldContentService::Instance()->SetDatabase(&database)
->SetContentDatabase(&content_db)
->SetExpansionContext()
->ReloadContentFlags();
LogInfo(
"Current expansion is [{}] ({})",
content_service.GetCurrentExpansion(),
content_service.GetCurrentExpansionName()
WorldContentService::Instance()->GetCurrentExpansion(),
WorldContentService::Instance()->GetCurrentExpansionName()
);
std::string hotfix_name = "";
@@ -244,6 +237,6 @@ int main(int argc, char **argv)
}
}
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
return 0;
}
+2 -4
View File
@@ -34,14 +34,12 @@
#include "task_state_test.h"
const EQEmuConfig *Config;
EQEmuLogSys LogSys;
PathManager path;
int main()
{
RegisterExecutablePlatform(ExePlatformClientImport);
LogSys.LoadLogSettingsDefaults();
path.LoadPaths();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
PathManager::Instance()->Init();
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
Config = EQEmuConfig::get();
-16
View File
@@ -30,7 +30,6 @@ public:
TEST_ADD(StringUtilTest::EscapeStringTest);
TEST_ADD(StringUtilTest::SearchDeliminatedStringTest);
TEST_ADD(StringUtilTest::SplitStringTest);
TEST_ADD(StringUtilTest::FromCharsTest);
TEST_ADD(StringUtilTest::TestIsFloat);
TEST_ADD(StringUtilTest::TestIsNumber);
}
@@ -108,21 +107,6 @@ public:
TEST_ASSERT(v[2] == "789");
}
void FromCharsTest() {
char int_chars[] = "123";
int int_value = 0;
char float_chars[] = "3.14";
float float_value = 0.0f;
Strings::from_chars(int_chars, int_value);
TEST_ASSERT(int_value == 123);
Strings::from_chars(float_chars, float_value);
TEST_ASSERT(float_value == 3.14f);
}
void TestIsFloat() {
TEST_ASSERT_EQUALS(Strings::IsFloat("0.23424523"), true);
TEST_ASSERT_EQUALS(Strings::IsFloat("12312312313.23424523"), true);
+2 -2
View File
@@ -482,7 +482,7 @@ Clientlist::Clientlist(int ChatPort) {
const ucsconfig *Config = ucsconfig::get();
std::string opcodes_file = fmt::format("{}/{}", path.GetServerPath(), Config->MailOpCodesFile);
std::string opcodes_file = fmt::format("{}/{}", PathManager::Instance()->GetServerPath(), Config->MailOpCodesFile);
LogInfo("Loading [{}]", opcodes_file);
if (!ChatOpMgr->LoadOpcodes(opcodes_file.c_str()))
@@ -651,7 +651,7 @@ void Clientlist::Process()
OpcodeManager::EmuToName(app->GetOpcode()),
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
app->Size(),
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
);
switch (opcode) {
+9 -13
View File
@@ -44,13 +44,8 @@
ChatChannelList *ChannelList;
Clientlist *g_Clientlist;
EQEmuLogSys LogSys;
UCSDatabase database;
WorldServer *worldserver = nullptr;
DiscordManager discord_manager;
PathManager path;
ZoneStore zone_store;
PlayerEventLogs player_event_logs;
const ucsconfig *Config;
@@ -75,7 +70,7 @@ void Shutdown() {
LogInfo("Shutting down...");
ChannelList->RemoveAllChannels();
g_Clientlist->CloseAllConnections();
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
}
int caught_loop = 0;
@@ -90,24 +85,24 @@ void CatchSignal(int sig_num) {
LogInfo("In a signal handler loop and process is incapable of exiting properly, forcefully cleaning up");
ChannelList->RemoveAllChannels();
g_Clientlist->CloseAllConnections();
LogSys.CloseFileLogs();
EQEmuLogSys::Instance()->CloseFileLogs();
std::exit(0);
}
}
void PlayerEventQueueListener() {
while (caught_loop == 0) {
discord_manager.ProcessMessageQueue();
DiscordManager::Instance()->ProcessMessageQueue();
Sleep(100);
}
}
int main() {
RegisterExecutablePlatform(ExePlatformUCS);
LogSys.LoadLogSettingsDefaults();
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
set_exception_handler();
path.LoadPaths();
PathManager::Instance()->Init();
// Check every minute for unused channels we can delete
//
@@ -139,12 +134,13 @@ int main() {
return 1;
}
LogSys.SetDatabase(&database)
->SetLogPath(path.GetLogPath())
EQEmuLogSys::Instance()
->SetDatabase(&database)
->SetLogPath(PathManager::Instance()->GetLogPath())
->LoadLogDatabaseSettings()
->StartFileLogs();
player_event_logs.SetDatabase(&database)->Init();
PlayerEventLogs::Instance()->SetDatabase(&database)->Init();
char tmp[64];
+4 -5
View File
@@ -42,7 +42,6 @@ extern WorldServer worldserver;
extern Clientlist *g_Clientlist;
extern const ucsconfig *Config;
extern UCSDatabase database;
extern DiscordManager discord_manager;
void ProcessMailTo(Client *c, const std::string& from, const std::string& subject, const std::string& message);
@@ -79,8 +78,8 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
case ServerOP_ServerReloadRequest: {
auto o = (ServerReload::Request*) pack->pBuffer;
if (o->type == ServerReload::Type::Logs) {
LogSys.LoadLogDatabaseSettings();
player_event_logs.ReloadSettings();
EQEmuLogSys::Instance()->LoadLogDatabaseSettings();
PlayerEventLogs::Instance()->ReloadSettings();
}
break;
@@ -92,14 +91,14 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
cereal::BinaryInputArchive archive(ss);
archive(n);
discord_manager.QueuePlayerEventMessage(n);
DiscordManager::Instance()->QueuePlayerEventMessage(n);
break;
}
case ServerOP_DiscordWebhookMessage: {
auto *q = (DiscordWebhookMessage_Struct *) p.Data();
discord_manager.QueueWebhookMessage(
DiscordManager::Instance()->QueueWebhookMessage(
q->webhook_id,
q->message
);
@@ -35,12 +35,12 @@ if (scalar(@enum) > 0) {
foreach my $cat (@cats) {
print "#define Log" . $cat . "(message, ...) do {\\
if (LogSys.IsLogEnabled(Logs::General, Logs::" . $cat . "))\\
if (EQEmuLogSys::Instance()->IsLogEnabled(Logs::General, Logs::" . $cat . "))\\
OutF(LogSys, Logs::General, Logs::" . $cat . ", __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\\
} while (0)
#define Log" . $cat . "Detail(message, ...) do {\\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::" . $cat . "))\\
if (EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::" . $cat . "))\\
OutF(LogSys, Logs::Detail, Logs::" . $cat . ", __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\\
} while (0)
@@ -114,7 +114,8 @@ if ($requested_table_to_generate ne "all") {
my @cereal_enabled_tables = (
"data_buckets",
"player_event_logs"
"player_event_logs",
"player_event_log_settings"
);
my $generated_base_repository_files = "";
+1 -1
View File
@@ -77,7 +77,7 @@ ADD_EXECUTABLE(world ${world_sources} ${world_headers})
INSTALL(TARGETS world RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
IF (WIN32 AND EQEMU_BUILD_PCH)
TARGET_PRECOMPILE_HEADERS(world PRIVATE ../common/pch/pch.h)
TARGET_PRECOMPILE_HEADERS(world PRIVATE ../common/pch/std-pch.h)
ENDIF ()
ADD_DEFINITIONS(-DWORLD)
+15 -18
View File
@@ -15,9 +15,6 @@
#include "../common/zone_store.h"
#include "../common/repositories/character_corpses_repository.h"
extern ZSList zoneserver_list;
extern ClientList client_list;
extern AdventureManager adventure_manager;
extern EQ::Random emu_random;
Adventure::Adventure(AdventureTemplate *t)
@@ -177,7 +174,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
ut->instance_id = instance_id;
ut->new_duration = adventure_template->duration + 60;
zoneserver_list.SendPacket(0, instance_id, pack);
ZSList::Instance()->SendPacket(0, instance_id, pack);
safe_delete(pack);
}
else if(new_status == AS_WaitingForSecondaryEndTime)
@@ -191,7 +188,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
ut->instance_id = instance_id;
ut->new_duration = 1860;
zoneserver_list.SendPacket(0, instance_id, pack);
ZSList::Instance()->SendPacket(0, instance_id, pack);
safe_delete(pack);
}
else if(new_status == AS_Finished)
@@ -205,7 +202,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
ut->instance_id = instance_id;
ut->new_duration = 1860;
zoneserver_list.SendPacket(0, instance_id, pack);
ZSList::Instance()->SendPacket(0, instance_id, pack);
safe_delete(pack);
}
else
@@ -216,7 +213,7 @@ void Adventure::SetStatus(AdventureStatus new_status)
auto iter = players.begin();
while(iter != players.end())
{
adventure_manager.GetAdventureData((*iter).c_str());
AdventureManager::Instance()->GetAdventureData((*iter).c_str());
++iter;
}
}
@@ -230,11 +227,11 @@ void Adventure::SendAdventureMessage(uint32 type, const char *msg)
auto iter = players.begin();
while(iter != players.end())
{
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
ClientListEntry *current = ClientList::Instance()->FindCharacter((*iter).c_str());
if(current)
{
strcpy(sms->to, (*iter).c_str());
zoneserver_list.SendPacket(current->zone(), current->instance(), pack);
ZSList::Instance()->SendPacket(current->zone(), current->instance(), pack);
}
++iter;
}
@@ -283,7 +280,7 @@ void Adventure::Finished(AdventureWinStatus ws)
{
auto iter = players.begin();
while (iter != players.end()) {
ClientListEntry *current = client_list.FindCharacter((*iter).c_str());
ClientListEntry *current = ClientList::Instance()->FindCharacter((*iter).c_str());
auto character_id = database.GetCharacterID(*iter);
if (character_id == 0) {
@@ -310,7 +307,7 @@ void Adventure::Finished(AdventureWinStatus ws)
af->win = false;
af->points = 0;
}
zoneserver_list.SendPacket(current->zone(), current->instance(), pack);
ZSList::Instance()->SendPacket(current->zone(), current->instance(), pack);
database.UpdateAdventureStatsEntry(character_id, GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
delete pack;
}
@@ -331,7 +328,7 @@ void Adventure::Finished(AdventureWinStatus ws)
afe.win = false;
afe.points = 0;
}
adventure_manager.AddFinishedEvent(afe);
AdventureManager::Instance()->AddFinishedEvent(afe);
database.UpdateAdventureStatsEntry(character_id, GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
}
}
@@ -352,12 +349,12 @@ void Adventure::Finished(AdventureWinStatus ws)
afe.win = false;
afe.points = 0;
}
adventure_manager.AddFinishedEvent(afe);
AdventureManager::Instance()->AddFinishedEvent(afe);
database.UpdateAdventureStatsEntry(character_id, GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
}
++iter;
}
adventure_manager.GetAdventureData(this);
AdventureManager::Instance()->GetAdventureData(this);
}
void Adventure::MoveCorpsesToGraveyard()
@@ -368,8 +365,8 @@ void Adventure::MoveCorpsesToGraveyard()
glm::vec4 position;
float x = GetTemplate()->graveyard_x + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float y = GetTemplate()->graveyard_y + emu_random.Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float x = GetTemplate()->graveyard_x + EQ::Random::Instance()->Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float y = GetTemplate()->graveyard_y + EQ::Random::Instance()->Real(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
float z = GetTemplate()->graveyard_z;
position.x = x;
@@ -396,7 +393,7 @@ void Adventure::MoveCorpsesToGraveyard()
d->InstanceID = 0;
d->ZoneID = GetTemplate()->graveyard_zone_id;
zoneserver_list.SendPacket(0, GetInstanceID(), pack);
ZSList::Instance()->SendPacket(0, GetInstanceID(), pack);
delete pack;
@@ -407,7 +404,7 @@ void Adventure::MoveCorpsesToGraveyard()
spc->player_corpse_id = e.id;
spc->zone_id = GetTemplate()->graveyard_zone_id;
zoneserver_list.SendPacket(spc->zone_id, 0, pack);
ZSList::Instance()->SendPacket(spc->zone_id, 0, pack);
delete pack;
}
+55 -59
View File
@@ -14,10 +14,6 @@
#include <sstream>
#include <stdio.h>
extern ZSList zoneserver_list;
extern ClientList client_list;
extern EQ::Random emu_random;
AdventureManager::AdventureManager()
{
process_timer = new Timer(500);
@@ -68,7 +64,7 @@ void AdventureManager::Process()
void AdventureManager::CalculateAdventureRequestReply(const char *data)
{
ServerAdventureRequest_Struct *sar = (ServerAdventureRequest_Struct*)data;
ClientListEntry *leader = client_list.FindCharacter(sar->leader);
ClientListEntry *leader = ClientList::Instance()->FindCharacter(sar->leader);
if(!leader)
{
return;
@@ -84,7 +80,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
strcpy(deny->reason, "There are currently no adventures set for this theme.");
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
return;
}
@@ -113,7 +109,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ss << (data + sizeof(ServerAdventureRequest_Struct) + (64 * i)) << " is already apart of an active adventure.";
strcpy(deny->reason, ss.str().c_str());
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
return;
}
@@ -185,7 +181,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
for(int i = 0; i < sar->member_count; ++i)
{
ClientListEntry *current = client_list.FindCharacter((data + sizeof(ServerAdventureRequest_Struct) + (64 * i)));
ClientListEntry *current = ClientList::Instance()->FindCharacter((data + sizeof(ServerAdventureRequest_Struct) + (64 * i)));
if(current)
{
int lvl = current->level();
@@ -244,7 +240,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
strcpy(deny->reason, "The number of found players for this adventure was zero.");
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
return;
}
@@ -261,7 +257,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ss << "The maximum level range for this adventure is " << RuleI(Adventure, MaxLevelRange);
ss << " but the level range calculated was " << (max_level - min_level) << ".";
strcpy(deny->reason, ss.str().c_str());
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
return;
}
@@ -324,7 +320,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
if(eligible_adventures.size() > 0)
{
ea_iter = eligible_adventures.begin();
int c_index = emu_random.Int(0, (eligible_adventures.size()-1));
int c_index = EQ::Random::Instance()->Int(0, (eligible_adventures.size()-1));
for(int i = 0; i < c_index; ++i)
{
++ea_iter;
@@ -338,7 +334,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
sra->id = (*ea_iter)->id;
sra->member_count = sar->member_count;
memcpy((pack->pBuffer + sizeof(ServerAdventureRequestAccept_Struct)), (data + sizeof(ServerAdventureRequest_Struct)), (sar->member_count * 64));
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
return;
}
@@ -348,7 +344,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
ServerAdventureRequestDeny_Struct *deny = (ServerAdventureRequestDeny_Struct*)pack->pBuffer;
strcpy(deny->leader, sar->leader);
strcpy(deny->reason, "The number of adventures returned was zero.");
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
return;
}
@@ -357,7 +353,7 @@ void AdventureManager::CalculateAdventureRequestReply(const char *data)
void AdventureManager::TryAdventureCreate(const char *data)
{
ServerAdventureRequestCreate_Struct *src = (ServerAdventureRequestCreate_Struct*)data;
ClientListEntry *leader = client_list.FindCharacter(src->leader);
ClientListEntry *leader = ClientList::Instance()->FindCharacter(src->leader);
if(!leader)
{
return;
@@ -368,7 +364,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
{
auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
strcpy((char*)pack->pBuffer, src->leader);
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
return;
}
@@ -378,7 +374,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
{
auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
strcpy((char*)pack->pBuffer, src->leader);
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
delete adv;
return;
@@ -391,7 +387,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
{
auto pack = new ServerPacket(ServerOP_AdventureCreateDeny, 64);
strcpy((char*)pack->pBuffer, src->leader);
zoneserver_list.SendPacket(leader->zone(), leader->instance(), pack);
ZSList::Instance()->SendPacket(leader->zone(), leader->instance(), pack);
delete pack;
delete adv;
return;
@@ -404,7 +400,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
for(int i = 0; i < src->member_count; ++i)
{
ClientListEntry *player = client_list.FindCharacter((data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i)));
ClientListEntry *player = ClientList::Instance()->FindCharacter((data + sizeof(ServerAdventureRequestCreate_Struct) + (64 * i)));
if(player)
{
int f_count = 0;
@@ -436,7 +432,7 @@ void AdventureManager::TryAdventureCreate(const char *data)
sfa->zone_in_object = finished_adventures[f]->GetTemplate()->zone_in_object_id;
}
zoneserver_list.SendPacket(player->zone(), player->instance(), pack);
ZSList::Instance()->SendPacket(player->zone(), player->instance(), pack);
safe_delete_array(finished_adventures);
delete pack;
}
@@ -458,7 +454,7 @@ void AdventureManager::GetAdventureData(Adventure *adv)
void AdventureManager::GetAdventureData(const char *name)
{
ClientListEntry *player = client_list.FindCharacter(name);
ClientListEntry *player = ClientList::Instance()->FindCharacter(name);
if(player)
{
int f_count = 0;
@@ -497,7 +493,7 @@ void AdventureManager::GetAdventureData(const char *name)
delete pack;
auto pack = new ServerPacket(ServerOP_AdventureDataClear, 64);
strcpy((char*)pack->pBuffer, name);
zoneserver_list.SendPacket(player->zone(), player->instance(), pack);
ZSList::Instance()->SendPacket(player->zone(), player->instance(), pack);
delete pack;
delete[] finished_adventures;
@@ -515,7 +511,7 @@ void AdventureManager::GetAdventureData(const char *name)
sfa->zone_in_object = finished_adventures[i]->GetTemplate()->zone_in_object_id;
}
zoneserver_list.SendPacket(player->zone(), player->instance(), pack);
ZSList::Instance()->SendPacket(player->zone(), player->instance(), pack);
safe_delete_array(finished_adventures);
delete pack;
delete[] finished_adventures;
@@ -764,7 +760,7 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do
{
if((*iter)->PlayerExists(player))
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack =
@@ -783,7 +779,7 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do
(*iter)->SetStatus(AS_WaitingForPrimaryEndTime);
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
safe_delete(pack);
}
return;
@@ -792,19 +788,19 @@ void AdventureManager::PlayerClickedDoor(const char *player, int zone_id, int do
++iter;
}
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureClickDoorError, 64);
strcpy((char*)pack->pBuffer, player);
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
safe_delete(pack);
}
}
void AdventureManager::LeaveAdventure(const char *name)
{
ClientListEntry *pc = client_list.FindCharacter(name);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(name);
if(pc)
{
Adventure *current = GetActiveAdventure(name);
@@ -814,7 +810,7 @@ void AdventureManager::LeaveAdventure(const char *name)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaveDeny, 64);
strcpy((char*)pack->pBuffer, name);
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
safe_delete(pack);
}
else
@@ -827,7 +823,7 @@ void AdventureManager::LeaveAdventure(const char *name)
current->RemovePlayer(name);
auto pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64);
strcpy((char*)pack->pBuffer, name);
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
safe_delete(pack);
}
}
@@ -835,7 +831,7 @@ void AdventureManager::LeaveAdventure(const char *name)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaveReply, 64);
strcpy((char*)pack->pBuffer, name);
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
safe_delete(pack);
}
}
@@ -867,12 +863,12 @@ void AdventureManager::IncrementCount(uint16 instance_id)
while(siter != slist.end())
{
ClientListEntry *pc = client_list.FindCharacter((*siter).c_str());
ClientListEntry *pc = ClientList::Instance()->FindCharacter((*siter).c_str());
if(pc)
{
memset(ac->player, 0, 64);
strcpy(ac->player, (*siter).c_str());
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
}
++siter;
}
@@ -936,7 +932,7 @@ void AdventureManager::GetZoneData(uint16 instance_id)
zd->dest_y = temp->dest_y;
zd->dest_z = temp->dest_z;
zd->dest_h = temp->dest_h;
zoneserver_list.SendPacket(0, instance_id, pack);
ZSList::Instance()->SendPacket(0, instance_id, pack);
delete pack;
}
}
@@ -1262,7 +1258,7 @@ void AdventureManager::DoLeaderboardRequest(const char* player, uint8 type)
void AdventureManager::DoLeaderboardRequestWins(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1321,14 +1317,14 @@ void AdventureManager::DoLeaderboardRequestWins(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestPercentage(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1387,14 +1383,14 @@ void AdventureManager::DoLeaderboardRequestPercentage(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1453,14 +1449,14 @@ void AdventureManager::DoLeaderboardRequestWinsGuk(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1519,14 +1515,14 @@ void AdventureManager::DoLeaderboardRequestPercentageGuk(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestWinsMir(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1585,14 +1581,14 @@ void AdventureManager::DoLeaderboardRequestWinsMir(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1651,14 +1647,14 @@ void AdventureManager::DoLeaderboardRequestPercentageMir(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1717,14 +1713,14 @@ void AdventureManager::DoLeaderboardRequestWinsMmc(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1783,14 +1779,14 @@ void AdventureManager::DoLeaderboardRequestPercentageMmc(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1849,14 +1845,14 @@ void AdventureManager::DoLeaderboardRequestWinsRuj(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1915,14 +1911,14 @@ void AdventureManager::DoLeaderboardRequestPercentageRuj(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestWinsTak(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -1981,14 +1977,14 @@ void AdventureManager::DoLeaderboardRequestWinsTak(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
{
ClientListEntry *pc = client_list.FindCharacter(player);
ClientListEntry *pc = ClientList::Instance()->FindCharacter(player);
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureLeaderboard, 64 + sizeof(AdventureLeaderboard_Struct));
@@ -2047,7 +2043,7 @@ void AdventureManager::DoLeaderboardRequestPercentageTak(const char* player)
al->failure = our_failures;
}
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
@@ -2074,7 +2070,7 @@ bool AdventureManager::PopFinishedEvent(const char *name, AdventureFinishEvent &
void AdventureManager::SendAdventureFinish(AdventureFinishEvent fe)
{
ClientListEntry *pc = client_list.FindCharacter(fe.name.c_str());
ClientListEntry *pc = ClientList::Instance()->FindCharacter(fe.name.c_str());
if(pc)
{
auto pack = new ServerPacket(ServerOP_AdventureFinish, sizeof(ServerAdventureFinish_Struct));
@@ -2084,7 +2080,7 @@ void AdventureManager::SendAdventureFinish(AdventureFinishEvent fe)
af->win = fe.win;
af->points = fe.points;
zoneserver_list.SendPacket(pc->zone(), pc->instance(), pack);
ZSList::Instance()->SendPacket(pc->zone(), pc->instance(), pack);
delete pack;
}
}
+6
View File
@@ -40,6 +40,12 @@ public:
AdventureTemplate *GetAdventureTemplate(int theme, int id);
AdventureTemplate *GetAdventureTemplate(int id);
void GetZoneData(uint16 instance_id);
static AdventureManager* Instance()
{
static AdventureManager instance;
return &instance;
}
protected:
bool IsInExcludedZoneList(std::list<AdventureZones> excluded_zones, std::string zone_name, int version);
bool IsInExcludedZoneInList(std::list<AdventureZoneIn> excluded_zone_ins, int zone_id, int door_object);
+3 -3
View File
@@ -12,9 +12,9 @@ void WorldserverCLI::EtlGetSettings(int argc, char **argv, argh::parser &cmd, st
Json::Value etl_settings;
Json::Value player_events;
player_event_logs.SetDatabase(&database)->Init();
auto event_settings = player_event_logs.GetSettings();
auto etl_details = player_event_logs.GetEtlSettings();
PlayerEventLogs::Instance()->SetDatabase(&database)->Init();
auto event_settings = PlayerEventLogs::Instance()->GetSettings();
auto etl_details = PlayerEventLogs::Instance()->GetEtlSettings();
for (int i = PlayerEvent::GM_COMMAND; i < PlayerEvent::EventType::MAX; i++) {
player_events["event_id"] = event_settings[i].id;
+5 -5
View File
@@ -16,7 +16,7 @@ void WorldserverCLI::ExpansionTestCommand(int argc, char **argv, argh::parser &c
LogInfo("No rule set configured, using default rules");
}
content_service.SetCurrentExpansion(RuleI(Expansion, CurrentExpansion));
WorldContentService::Instance()->SetCurrentExpansion(RuleI(Expansion, CurrentExpansion));
std::vector<ContentFlagsRepository::ContentFlags> flags = {};
auto f = ContentFlagsRepository::NewEntity();
@@ -32,13 +32,13 @@ void WorldserverCLI::ExpansionTestCommand(int argc, char **argv, argh::parser &c
flags.push_back(f);
}
content_service.SetContentFlags(flags);
WorldContentService::Instance()->SetContentFlags(flags);
LogInfo(
"Current expansion is [{}] ({}) is Velious Enabled [{}] Criteria [{}]",
content_service.GetCurrentExpansion(),
content_service.GetCurrentExpansionName(),
content_service.IsTheScarsOfVeliousEnabled() ? "true" : "false",
WorldContentService::Instance()->GetCurrentExpansion(),
WorldContentService::Instance()->GetCurrentExpansionName(),
WorldContentService::Instance()->IsTheScarsOfVeliousEnabled() ? "true" : "false",
ContentFilterCriteria::apply()
);
}
+38 -21
View File
@@ -36,6 +36,7 @@
#include "../common/shareddb.h"
#include "../common/opcodemgr.h"
#include "../common/data_verification.h"
#include "../common/data_bucket.h"
#include "client.h"
#include "worlddb.h"
@@ -88,10 +89,6 @@
std::vector<RaceClassAllocation> character_create_allocations;
std::vector<RaceClassCombos> character_create_race_class_combos;
extern ZSList zoneserver_list;
extern LoginServerList loginserverlist;
extern ClientList client_list;
extern EQ::Random emu_random;
extern uint32 numclients;
extern volatile bool RunLoops;
extern volatile bool UCSServerAvailable_;
@@ -135,6 +132,8 @@ Client::Client(EQStreamInterface* ieqs)
}
Client::~Client() {
ClearDataBucketsCache();
if (RunLoops && cle && zone_id == 0)
cle->SetOnline(CLE_Status::Offline);
@@ -476,7 +475,9 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
LogClientLogin("Checking authentication id [{}]", id);
if ((cle = client_list.CheckAuth(id, password))) {
if ((cle = ClientList::Instance()->CheckAuth(id, password))) {
LoadDataBucketsCache();
LogClientLogin("Checking authentication id [{}] passed", id);
if (!is_player_zoning) {
// Track who is in and who is out of the game
@@ -514,7 +515,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
ServerLSPlayerJoinWorld_Struct* join =(ServerLSPlayerJoinWorld_Struct*)pack->pBuffer;
strcpy(join->key,GetLSKey());
join->lsaccount_id = GetLSID();
loginserverlist.SendPacket(pack);
LoginServerList::Instance()->SendPacket(pack);
safe_delete(pack);
}
@@ -797,7 +798,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
RuleB(World, EnableIPExemptions) ||
RuleI(World, MaxClientsPerIP) > 0
) {
client_list.GetCLEIP(GetIP()); //Check current CLE Entry IPs against incoming connection
ClientList::Instance()->GetCLEIP(GetIP()); //Check current CLE Entry IPs against incoming connection
}
auto ew = (EnterWorld_Struct *) app->pBuffer;
@@ -817,7 +818,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
return true;
}
auto r = content_service.FindZone(zone_id, instance_id);
auto r = WorldContentService::Instance()->FindZone(zone_id, instance_id);
if (r.zone_id && r.instance.id != instance_id) {
LogInfo(
"Zone [{}] has been remapped to instance_id [{}] from instance_id [{}] for client [{}]",
@@ -984,7 +985,7 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
safe_delete(outapp);
// set mailkey - used for duration of character session
int mail_key = emu_random.Int(1, INT_MAX);
int mail_key = EQ::Random::Instance()->Int(1, INT_MAX);
database.SetMailKey(charid, GetIP(), mail_key);
if (UCSServerAvailable_) {
@@ -1097,7 +1098,7 @@ bool Client::HandlePacket(const EQApplicationPacket *app) {
OpcodeManager::EmuToName(app->GetOpcode()),
o->EmuToEQ(app->GetOpcode()) == 0 ? app->GetProtocolOpcode() : o->EmuToEQ(app->GetOpcode()),
app->Size(),
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketClientServer) ? DumpPacketToString(app) : "")
);
if (!eqs->CheckState(ESTABLISHED)) {
@@ -1246,7 +1247,7 @@ bool Client::Process() {
ServerLSPlayerLeftWorld_Struct* logout =(ServerLSPlayerLeftWorld_Struct*)pack->pBuffer;
strcpy(logout->key,GetLSKey());
logout->lsaccount_id = GetLSID();
loginserverlist.SendPacket(pack);
LoginServerList::Instance()->SendPacket(pack);
safe_delete(pack);
}
LogInfo("Client disconnected (not active in process)");
@@ -1412,18 +1413,18 @@ void Client::EnterWorld(bool TryBootup) {
return;
}
zone_server = zoneserver_list.FindByInstanceID(instance_id);
zone_server = ZSList::Instance()->FindByInstanceID(instance_id);
}
else
{
zone_server = zoneserver_list.FindByZoneID(zone_id);
zone_server = ZSList::Instance()->FindByZoneID(zone_id);
}
const char *zone_name = ZoneName(zone_id, true);
if (zone_server) {
if (false == enter_world_triggered) {
//Drop any clients we own in other zones.
zoneserver_list.DropClient(GetLSID(), zone_server);
ZSList::Instance()->DropClient(GetLSID(), zone_server);
// warn the zone we're coming
zone_server->IncomingClient(this);
@@ -1436,7 +1437,7 @@ void Client::EnterWorld(bool TryBootup) {
if (TryBootup) {
LogInfo("Attempting autobootup of [{}] [{}] [{}]", zone_name, zone_id, instance_id);
autobootup_timeout.Start();
zone_waiting_for_bootup = zoneserver_list.TriggerBootup(zone_id, instance_id);
zone_waiting_for_bootup = ZSList::Instance()->TriggerBootup(zone_id, instance_id);
if (zone_waiting_for_bootup == 0) {
LogInfo("No zoneserver available to boot up");
TellClientZoneUnavailable();
@@ -1452,7 +1453,7 @@ void Client::EnterWorld(bool TryBootup) {
zone_waiting_for_bootup = 0;
if (GetAdmin() < 80 && zoneserver_list.IsZoneLocked(zone_id)) {
if (GetAdmin() < 80 && ZSList::Instance()->IsZoneLocked(zone_id)) {
LogInfo("Enter world failed. Zone is locked");
TellClientZoneUnavailable();
return;
@@ -1498,11 +1499,11 @@ void Client::Clearance(int8 response)
ZoneServer* zs = nullptr;
if(instance_id > 0)
{
zs = zoneserver_list.FindByInstanceID(instance_id);
zs = ZSList::Instance()->FindByInstanceID(instance_id);
}
else
{
zs = zoneserver_list.FindByZoneID(zone_id);
zs = ZSList::Instance()->FindByZoneID(zone_id);
}
if(zs == 0 || response == -1 || response == 0)
@@ -2171,7 +2172,7 @@ void Client::SetClassStartingSkills(PlayerProfile_Struct *pp)
i == EQ::skills::SkillAlcoholTolerance || i == EQ::skills::SkillBindWound)
continue;
pp->skills[i] = skill_caps.GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1).cap;
pp->skills[i] = SkillCaps::Instance()->GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1).cap;
}
}
@@ -2369,7 +2370,7 @@ bool Client::StoreCharacter(
return false;
}
const std::string& zone_name = zone_store.GetZoneName(p_player_profile_struct->zone_id, true);
const std::string& zone_name = ZoneStore::Instance()->GetZoneName(p_player_profile_struct->zone_id, true);
if (Strings::EqualFold(zone_name, "UNKNOWN")) {
p_player_profile_struct->zone_id = Zones::QEYNOS;
}
@@ -2427,7 +2428,7 @@ bool Client::StoreCharacter(
void Client::RecordPossibleHack(const std::string& message)
{
if (player_event_logs.IsEventEnabled(PlayerEvent::POSSIBLE_HACK)) {
if (PlayerEventLogs::Instance()->IsEventEnabled(PlayerEvent::POSSIBLE_HACK)) {
auto event = PlayerEvent::PossibleHackEvent{.message = message};
std::stringstream ss;
{
@@ -2518,3 +2519,19 @@ void Client::SendUnsupportedClientPacket(const std::string& message)
QueuePacket(&packet);
}
void Client::LoadDataBucketsCache()
{
DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Account, {GetAccountID()});
const auto ids = CharacterDataRepository::GetCharacterIDsByAccountID(database, GetAccountID());
DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Client, ids);
}
void Client::ClearDataBucketsCache()
{
DataBucket::DeleteFromCache(GetAccountID(), DataBucketLoadType::Account);
auto ids = CharacterDataRepository::GetCharacterIDsByAccountID(database, GetAccountID());
for (const auto& id : ids) {
DataBucket::DeleteFromCache(id, DataBucketLoadType::Client);
}
}
+3
View File
@@ -121,6 +121,9 @@ private:
bool CanTradeFVNoDropItem();
void RecordPossibleHack(const std::string& message);
void SendUnsupportedClientPacket(const std::string& message);
void LoadDataBucketsCache();
void ClearDataBucketsCache();
};
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
+4 -7
View File
@@ -9,10 +9,7 @@
#include "world_config.h"
extern uint32 numplayers;
extern LoginServerList loginserverlist;
extern ClientList client_list;
extern volatile bool RunLoops;
extern SharedTaskManager shared_task_manager;
ClientListEntry::ClientListEntry(
uint32 id,
@@ -94,7 +91,7 @@ ClientListEntry::~ClientListEntry()
{
if (RunLoops) {
Camp(); // updates zoneserver's numplayers
client_list.RemoveCLEReferances(this);
ClientList::Instance()->RemoveCLEReferances(this);
}
for (auto &elem: m_tell_queue) {
safe_delete_array(elem);
@@ -146,7 +143,7 @@ void ClientListEntry::LSUpdate(ZoneServer *iZS)
zone->count = iZS->NumPlayers();
zone->zone = iZS->GetZoneID();
zone->zone_wid = iZS->GetID();
loginserverlist.SendPacket(pack);
LoginServerList::Instance()->SendPacket(pack);
safe_delete(pack);
}
}
@@ -162,7 +159,7 @@ void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
zonechange->lsaccount_id = LSID();
zonechange->from = ztz->current_zone_id;
zonechange->to = ztz->requested_zone_id;
loginserverlist.SendPacket(pack);
LoginServerList::Instance()->SendPacket(pack);
safe_delete(pack);
}
}
@@ -224,7 +221,7 @@ void ClientListEntry::LeavingZone(ZoneServer *iZS, CLE_Status iOnline)
}
SetOnline(iOnline);
shared_task_manager.RemoveActiveInvitationByCharacterID(CharID());
SharedTaskManager::Instance()->RemoveActiveInvitationByCharacterID(CharID());
if (m_zone_server) {
m_zone_server->RemovePlayer();
+12 -15
View File
@@ -36,9 +36,6 @@
#include "../common/zone_store.h"
#include <set>
extern WebInterfaceList web_interface;
extern ZSList zoneserver_list;
uint32 numplayers = 0; //this really wants to be a member variable of ClientList...
ClientList::ClientList()
@@ -234,7 +231,7 @@ void ClientList::DisconnectByIP(uint32 in_ip) {
strn0cpy(skp->adminname, "SessionLimit", sizeof(skp->adminname));
strn0cpy(skp->name, cle->name(), sizeof(skp->name));
skp->adminrank = 255;
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
}
cle->SetOnline(CLE_Status::Offline);
@@ -553,7 +550,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
Iterator.Advance();
}
zoneserver_list.SendPacket(from->zone(), from->instance(), pack);
ZSList::Instance()->SendPacket(from->zone(), from->instance(), pack);
safe_delete(pack);
}
@@ -1318,7 +1315,7 @@ void ClientList::RemoveCLEReferances(ClientListEntry* cle) {
bool ClientList::SendPacket(const char* to, ServerPacket* pack) {
if (to == 0 || to[0] == 0) {
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
return true;
}
else if (to[0] == '*') {
@@ -1334,7 +1331,7 @@ bool ClientList::SendPacket(const char* to, ServerPacket* pack) {
}
return false;
} else {
ZoneServer* zs = zoneserver_list.FindByName(to);
ZoneServer* zs = ZSList::Instance()->FindByName(to);
if (zs != nullptr) {
zs->SendPacket(pack);
return true;
@@ -1439,7 +1436,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
);
if (client_count[EQ::versions::ClientVersion::Titanium]) {
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
Name,
0,
AccountStatus::Player,
@@ -1452,7 +1449,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
if (client_count[EQ::versions::ClientVersion::SoF]) {
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
Name,
0,
AccountStatus::Player,
@@ -1465,7 +1462,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
if (client_count[EQ::versions::ClientVersion::SoD]) {
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
Name,
0,
AccountStatus::Player,
@@ -1478,7 +1475,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
if (client_count[EQ::versions::ClientVersion::UF]) {
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
Name,
0,
AccountStatus::Player,
@@ -1491,7 +1488,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
if (client_count[EQ::versions::ClientVersion::RoF]) {
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
Name,
0,
AccountStatus::Player,
@@ -1504,7 +1501,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
if (client_count[EQ::versions::ClientVersion::RoF2]) {
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
Name,
0,
AccountStatus::Player,
@@ -1517,7 +1514,7 @@ void ClientList::SendClientVersionSummary(const char *Name)
}
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
Name,
0,
AccountStatus::Player,
@@ -1613,7 +1610,7 @@ void ClientList::OnTick(EQ::Timer *t)
Iterator.Advance();
}
web_interface.SendEvent(out);
WebInterfaceList::Instance()->SendEvent(out);
}
/**
+6
View File
@@ -85,6 +85,12 @@ public:
return {m_gm_zone_server_ids.begin(), m_gm_zone_server_ids.end()};
}
static ClientList* Instance()
{
static ClientList instance;
return &instance;
}
private:
void OnTick(EQ::Timer *t);
inline uint32 GetNextCLEID() { return NextCLEID++; }
+83 -45
View File
@@ -33,10 +33,6 @@
#include "../common/zone_store.h"
#include <fmt/format.h>
extern ClientList client_list;
extern ZSList zoneserver_list;
extern LoginServerList loginserverlist;
/**
* @param username
* @param password
@@ -149,7 +145,7 @@ void ConsoleZoneStatus(
)
{
WorldConsoleTCPConnection console_connection(connection);
zoneserver_list.SendZoneStatus(0, connection->Admin(), &console_connection);
ZSList::Instance()->SendZoneStatus(0, connection->Admin(), &console_connection);
}
/**
@@ -193,7 +189,7 @@ void ConsoleWho(
}
WorldConsoleTCPConnection console_connection(connection);
client_list.ConsoleSendWhoAll(0, connection->Admin(), &whom, &console_connection);
ClientList::Instance()->ConsoleSendWhoAll(0, connection->Admin(), &whom, &console_connection);
}
/**
@@ -216,7 +212,7 @@ void ConsoleUptime(
ServerUptime_Struct *sus = (ServerUptime_Struct *) pack->pBuffer;
snprintf(sus->adminname, sizeof(sus->adminname), "*%s", connection->UserName().c_str());
sus->zoneserverid = Strings::ToInt(args[0]);
ZoneServer *zs = zoneserver_list.FindByID(sus->zoneserverid);
ZoneServer *zs = ZSList::Instance()->FindByID(sus->zoneserverid);
if (zs) {
zs->SendPacket(pack);
}
@@ -291,7 +287,7 @@ void ConsoleEmote(
join_args.erase(join_args.begin(), join_args.begin() + 2);
if (strcasecmp(args[0].c_str(), "world") == 0) {
zoneserver_list.SendEmoteMessageRaw(
ZSList::Instance()->SendEmoteMessageRaw(
0,
0,
AccountStatus::Player,
@@ -300,7 +296,7 @@ void ConsoleEmote(
);
}
else {
ZoneServer *zs = zoneserver_list.FindByName(args[0].c_str());
ZoneServer *zs = ZSList::Instance()->FindByName(args[0].c_str());
if (zs != 0) {
zs->SendEmoteMessageRaw(
0,
@@ -311,7 +307,7 @@ void ConsoleEmote(
);
}
else {
zoneserver_list.SendEmoteMessageRaw(
ZSList::Instance()->SendEmoteMessageRaw(
args[0].c_str(),
0,
AccountStatus::Player,
@@ -372,7 +368,7 @@ void ConsoleTell(
auto join_args = args;
join_args.erase(join_args.begin(), join_args.begin() + 1);
zoneserver_list.SendChannelMessage(tmpname, to.c_str(), ChatChannel_Tell, 0, Strings::Join(join_args, " ").c_str());
ZSList::Instance()->SendChannelMessage(tmpname, to.c_str(), ChatChannel_Tell, 0, Strings::Join(join_args, " ").c_str());
}
/**
@@ -393,7 +389,7 @@ void ConsoleBroadcast(
char tmpname[64];
tmpname[0] = '*';
strcpy(&tmpname[1], connection->UserName().c_str());
zoneserver_list.SendChannelMessage(tmpname, 0, ChatChannel_Broadcast, 0, Strings::Join(args, " ").c_str());
ZSList::Instance()->SendChannelMessage(tmpname, 0, ChatChannel_Broadcast, 0, Strings::Join(args, " ").c_str());
}
/**
@@ -414,7 +410,7 @@ void ConsoleGMSay(
char tmpname[64];
tmpname[0] = '*';
strcpy(&tmpname[1], connection->UserName().c_str());
zoneserver_list.SendChannelMessage(tmpname, 0, ChatChannel_GMSAY, 0, Strings::Join(args, " ").c_str());
ZSList::Instance()->SendChannelMessage(tmpname, 0, ChatChannel_GMSAY, 0, Strings::Join(args, " ").c_str());
}
/**
@@ -447,7 +443,7 @@ void ConsoleGuildSay(
Strings::Join(join_args, " ")
);
zoneserver_list.SendEmoteMessage(0, guild_id, AccountStatus::Player, Chat::Guild, message.c_str());
ZSList::Instance()->SendEmoteMessage(0, guild_id, AccountStatus::Player, Chat::Guild, message.c_str());
}
/**
@@ -468,7 +464,7 @@ void ConsoleOOC(
char tmpname[64];
tmpname[0] = '*';
strcpy(&tmpname[1], connection->UserName().c_str());
zoneserver_list.SendChannelMessage(tmpname, 0, ChatChannel_OOC, 0, Strings::Join(args, " ").c_str());
ZSList::Instance()->SendChannelMessage(tmpname, 0, ChatChannel_OOC, 0, Strings::Join(args, " ").c_str());
}
/**
@@ -489,7 +485,7 @@ void ConsoleAuction(
char tmpname[64];
tmpname[0] = '*';
strcpy(&tmpname[1], connection->UserName().c_str());
zoneserver_list.SendChannelMessage(tmpname, 0, ChatChannel_Auction, 0, Strings::Join(args, " ").c_str());
ZSList::Instance()->SendChannelMessage(tmpname, 0, ChatChannel_Auction, 0, Strings::Join(args, " ").c_str());
}
/**
@@ -518,7 +514,7 @@ void ConsoleKick(
strcpy(skp->adminname, tmpname);
strcpy(skp->name, args[0].c_str());
skp->adminrank = connection->Admin();
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
delete pack;
}
@@ -534,8 +530,8 @@ void ConsoleLock(
)
{
WorldConfig::LockWorld();
if (loginserverlist.Connected()) {
loginserverlist.SendStatus();
if (LoginServerList::Instance()->Connected()) {
LoginServerList::Instance()->SendStatus();
connection->SendLine("World locked.");
}
else {
@@ -555,8 +551,8 @@ void ConsoleUnlock(
)
{
WorldConfig::UnlockWorld();
if (loginserverlist.Connected()) {
loginserverlist.SendStatus();
if (LoginServerList::Instance()->Connected()) {
LoginServerList::Instance()->SendStatus();
connection->SendLine("World unlocked.");
}
else {
@@ -604,10 +600,10 @@ void ConsoleZoneShutdown(
ZoneServer *zs = 0;
if (s->zone_server_id != 0) {
zs = zoneserver_list.FindByID(s->zone_server_id);
zs = ZSList::Instance()->FindByID(s->zone_server_id);
}
else if (s->zone_id != 0) {
zs = zoneserver_list.FindByName(ZoneName(s->zone_id));
zs = ZSList::Instance()->FindByName(ZoneName(s->zone_id));
}
else {
connection->SendLine("Error: ZoneShutdown: neither ID nor name specified");
@@ -648,14 +644,14 @@ void ConsoleZoneBootup(
strcpy(&tmpname[1], connection->UserName().c_str());
if (args.size() > 2) {
zoneserver_list.SOPZoneBootup(
ZSList::Instance()->SOPZoneBootup(
tmpname,
Strings::ToInt(args[0]),
args[1].c_str(),
(bool) (strcasecmp(args[1].c_str(), "static") == 0));
}
else {
zoneserver_list.SOPZoneBootup(tmpname, Strings::ToInt(args[0]), args[1].c_str(), false);
ZSList::Instance()->SOPZoneBootup(tmpname, Strings::ToInt(args[0]), args[1].c_str(), false);
}
}
}
@@ -677,7 +673,7 @@ void ConsoleZoneLock(
if (strcasecmp(args[0].c_str(), "list") == 0) {
WorldConsoleTCPConnection console_connection(connection);
zoneserver_list.ListLockedZones(0, &console_connection);
ZSList::Instance()->ListLockedZones(0, &console_connection);
}
else if (strcasecmp(args[0].c_str(), "lock") == 0 && connection->Admin() >= 101) {
if (args.size() < 2) {
@@ -686,8 +682,8 @@ void ConsoleZoneLock(
uint16 tmp = ZoneID(args[1].c_str());
if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, true)) {
zoneserver_list.SendEmoteMessage(
if (ZSList::Instance()->SetLockedZone(tmp, true)) {
ZSList::Instance()->SendEmoteMessage(
0,
0,
AccountStatus::QuestTroupe,
@@ -713,8 +709,8 @@ void ConsoleZoneLock(
uint16 tmp = ZoneID(args[1].c_str());
if (tmp) {
if (zoneserver_list.SetLockedZone(tmp, false)) {
zoneserver_list.SendEmoteMessage(
if (ZSList::Instance()->SetLockedZone(tmp, false)) {
ZSList::Instance()->SendEmoteMessage(
0,
0,
AccountStatus::QuestTroupe,
@@ -834,7 +830,7 @@ void ConsoleWorldShutdown(
int32 time, interval;
if (Strings::IsNumber(args[0]) && Strings::IsNumber(args[1]) && ((time = Strings::ToInt(args[0])) > 0) &&
((interval = Strings::ToInt(args[1])) > 0)) {
zoneserver_list.WorldShutDown(time, interval);
ZSList::Instance()->WorldShutDown(time, interval);
}
else {
connection->SendLine("Usage: worldshutdown [now] [disable] ([time] [interval])");
@@ -842,19 +838,19 @@ void ConsoleWorldShutdown(
}
else if (args.size() == 1) {
if (strcasecmp(args[0].c_str(), "now") == 0) {
zoneserver_list.WorldShutDown(0, 0);
ZSList::Instance()->WorldShutDown(0, 0);
}
else if (strcasecmp(args[0].c_str(), "disable") == 0) {
connection->SendLine("[SYSTEM] World shutdown has been aborted.");
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
0,
0,
AccountStatus::Player,
Chat::Yellow,
"[SYSTEM] World shutdown has been aborted."
);
zoneserver_list.shutdowntimer->Disable();
zoneserver_list.reminder->Disable();
ZSList::Instance()->shutdowntimer->Disable();
ZSList::Instance()->reminder->Disable();
}
else {
connection->SendLine("Usage: worldshutdown [now] [disable] ([time] [interval])");
@@ -878,7 +874,7 @@ void ConsoleIpLookup(
{
if (!args.empty()) {
WorldConsoleTCPConnection console_connection(connection);
client_list.SendCLEList(connection->Admin(), nullptr, &console_connection, args[0].c_str());
ClientList::Instance()->SendCLEList(connection->Admin(), nullptr, &console_connection, args[0].c_str());
}
}
@@ -907,7 +903,7 @@ void ConsoleSignalCharByName(
CZS->update_identifier = update_identifier;
CZS->signal_id = Strings::ToInt(args[1]);
strn0cpy(CZS->client_name, (char *) args[0].c_str(), 64);
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
}
@@ -923,7 +919,7 @@ void ConsoleReloadWorld(
)
{
connection->SendLine("Reloading World...");
zoneserver_list.SendServerReload(ServerReload::Type::WorldRepop, nullptr);
ZSList::Instance()->SendServerReload(ServerReload::Type::WorldRepop, nullptr);
}
auto debounce_reload = std::chrono::system_clock::now();
@@ -960,7 +956,7 @@ void ConsoleReloadZoneQuests(
auto *hot_reload_quests = (HotReloadQuestsStruct *) pack->pBuffer;
strn0cpy(hot_reload_quests->zone_short_name, (char *) zone_short_name.c_str(), 200);
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
}
@@ -1076,7 +1072,7 @@ void ConsoleCrossZoneCastSpell(
strn0cpy(CZS->client_name, name.c_str(), sizeof(CZS->client_name));
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
connection->SendLine(
@@ -1127,7 +1123,7 @@ void ConsoleWorldWideCastSpell(
WWS->min_status = min_status;
WWS->max_status = max_status;
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
connection->SendLine(
@@ -1219,7 +1215,7 @@ void ConsoleCrossZoneMove(
const auto& zone_short_name = !Strings::IsNumber(args[2]) ? args[2] : "";
const uint16 instance_id = Strings::IsNumber(args[2]) ? static_cast<uint16>(Strings::ToUnsignedInt(args[2])) : 0;
const auto& z = !zone_short_name.empty() ? zone_store.GetZone(zone_short_name) : nullptr;
const auto& z = !zone_short_name.empty() ? ZoneStore::Instance()->GetZone(zone_short_name) : nullptr;
if (z && !z->id) {
connection->SendLine(fmt::format("No zone with the short name '{}' exists.", zone_short_name));
@@ -1258,7 +1254,7 @@ void ConsoleCrossZoneMove(
m->zone_short_name = zone_short_name;
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
connection->SendLine(
@@ -1289,7 +1285,7 @@ void ConsoleWorldWideMove(
const auto& zone_short_name = !Strings::IsNumber(args[2]) ? args[2] : "";
const uint16 instance_id = Strings::IsNumber(args[2]) ? static_cast<uint16>(Strings::ToUnsignedInt(args[2])) : 0;
const auto& z = !zone_short_name.empty() ? zone_store.GetZone(zone_short_name) : nullptr;
const auto& z = !zone_short_name.empty() ? ZoneStore::Instance()->GetZone(zone_short_name) : nullptr;
if (z && !z->id) {
connection->SendLine(fmt::format("No zone with the short name '{}' exists.", zone_short_name));
@@ -1317,7 +1313,7 @@ void ConsoleWorldWideMove(
strn0cpy(WWM->zone_short_name, zone_short_name.c_str(), sizeof(WWM->zone_short_name));
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
connection->SendLine(
@@ -1330,6 +1326,42 @@ void ConsoleWorldWideMove(
);
}
void ConsoleWWMarquee(
EQ::Net::ConsoleServerConnection* connection,
const std::string& command,
const std::vector<std::string>& args
)
{
if (args.size() < 2) {
connection->SendLine("Usage: wwmarquee <type> <message>");
return;
}
const uint32 type = Strings::IsNumber(args[0]) ? Strings::ToUnsignedInt(args[0]) : 0;
std::string message = Strings::Join(std::vector<std::string>(args.begin() + 1, args.end()), " ");
if (message.empty()) {
connection->SendLine("Message cannot be empty.");
return;
}
auto pack = new ServerPacket(ServerOP_WWMarquee, sizeof(WWMarquee_Struct));
auto* wwm = (WWMarquee_Struct*)pack->pBuffer;
wwm->type = type;
wwm->priority = 510;
wwm->fade_in = 0;
wwm->fade_out = 0;
wwm->duration = 5000;
wwm->min_status = AccountStatus::Player;
wwm->max_status = AccountStatus::Player;
strn0cpy(wwm->message, message.c_str(), sizeof(wwm->message));
ZSList::Instance()->SendPacket(pack);
safe_delete(pack);
connection->SendLine(fmt::format("Sent world marquee type {}: {}", type, message));
}
/**
* @param console
@@ -1367,6 +1399,12 @@ void RegisterConsoleFunctions(std::unique_ptr<EQ::Net::ConsoleServer>& console)
console->RegisterCall("whoami", 50, "whoami", std::bind(ConsoleWhoami, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("worldshutdown", 200, "worldshutdown", std::bind(ConsoleWorldShutdown, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("wwcast", 50, "wwcast [spell_id] [min_status] [max_status] - min_status and max_status are optional", std::bind(ConsoleWorldWideCastSpell, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall(
"wwmarquee",
50,
"wwmarquee <type> <message>",
std::bind(ConsoleWWMarquee, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
);
console->RegisterCall("wwmove", 50, "wwmove [instance_id|zone_short_name] [min_status] [max_status] - min_status and max_status are optional, instance_id and zone_short_name are interchangeable", std::bind(ConsoleWorldWideMove, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("zonebootup", 150, "zonebootup [zone_server_id] [zone_short_name]", std::bind(ConsoleZoneBootup, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
console->RegisterCall("zonelock", 150, "zonelock [list|lock|unlock] [zone_short_name]", std::bind(ConsoleZoneLock, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+10 -13
View File
@@ -8,9 +8,6 @@
#include "../common/eqemu_logsys.h"
#include "../common/repositories/instance_list_repository.h"
extern ClientList client_list;
extern ZSList zoneserver_list;
Database& DynamicZone::GetDatabase()
{
return database;
@@ -18,7 +15,7 @@ Database& DynamicZone::GetDatabase()
bool DynamicZone::SendServerPacket(ServerPacket* packet)
{
return zoneserver_list.SendPacket(packet);
return ZSList::Instance()->SendPacket(packet);
}
DynamicZone* DynamicZone::FindDynamicZoneByID(uint32_t dz_id)
@@ -41,7 +38,7 @@ void DynamicZone::ChooseNewLeader()
auto it = std::find_if(m_members.begin(), m_members.end(), [&](const DynamicZoneMember& member) {
if (member.id != GetLeaderID() && member.IsOnline()) {
auto member_cle = client_list.FindCLEByCharacterID(member.id);
auto member_cle = ClientList::Instance()->FindCLEByCharacterID(member.id);
return (member_cle && member_cle->GetOnline() == CLE_Status::InZone);
}
return false;
@@ -91,7 +88,7 @@ DynamicZoneStatus DynamicZone::Process()
{
status = DynamicZoneStatus::Expired;
auto dz_zoneserver = zoneserver_list.FindByInstanceID(GetInstanceID());
auto dz_zoneserver = ZSList::Instance()->FindByInstanceID(GetInstanceID());
if (!dz_zoneserver || dz_zoneserver->NumPlayers() == 0) // no clients inside dz
{
status = DynamicZoneStatus::ExpiredEmpty;
@@ -119,7 +116,7 @@ void DynamicZone::SendZonesDynamicZoneDeleted()
auto pack = std::make_unique<ServerPacket>(ServerOP_DzDeleted, pack_size);
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
zoneserver_list.SendPacket(pack.get());
ZSList::Instance()->SendPacket(pack.get());
}
void DynamicZone::SetSecondsRemaining(uint32_t seconds_remaining)
@@ -154,7 +151,7 @@ void DynamicZone::SendZonesDurationUpdate()
auto packbuf = reinterpret_cast<ServerDzSetDuration_Struct*>(pack->pBuffer);
packbuf->dz_id = GetID();
packbuf->seconds = static_cast<uint32_t>(m_duration.count());
zoneserver_list.SendPacket(pack.get());
ZSList::Instance()->SendPacket(pack.get());
}
void DynamicZone::SendZonesLeaderChanged()
@@ -164,7 +161,7 @@ void DynamicZone::SendZonesLeaderChanged()
auto buf = reinterpret_cast<ServerDzLeaderID_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->leader_id = GetLeaderID();
zoneserver_list.SendPacket(pack.get());
ZSList::Instance()->SendPacket(pack.get());
}
void DynamicZone::ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed)
@@ -198,7 +195,7 @@ void DynamicZone::SendZonesExpireWarning(uint32_t minutes_remaining)
auto buf = reinterpret_cast<ServerDzExpireWarning_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->minutes_remaining = minutes_remaining;
zoneserver_list.SendPacket(pack.get());
ZSList::Instance()->SendPacket(pack.get());
}
void DynamicZone::SendZoneMemberStatuses(uint16_t zone_id, uint16_t instance_id)
@@ -217,7 +214,7 @@ void DynamicZone::SendZoneMemberStatuses(uint16_t zone_id, uint16_t instance_id)
buf->entries[i].online_status = static_cast<uint8_t>(m_members[i].status);
}
zoneserver_list.SendPacket(zone_id, instance_id, pack.get());
ZSList::Instance()->SendPacket(zone_id, instance_id, pack.get());
}
void DynamicZone::CacheMemberStatuses()
@@ -230,8 +227,8 @@ void DynamicZone::CacheMemberStatuses()
// called when a new dz is cached to fill member statuses
std::string zone_name;
std::vector<ClientListEntry*> all_clients;
all_clients.reserve(client_list.GetClientCount());
client_list.GetClients(zone_name.c_str(), all_clients);
all_clients.reserve(ClientList::Instance()->GetClientCount());
ClientList::Instance()->GetClients(zone_name.c_str(), all_clients);
for (const auto& member : m_members)
{
+21 -24
View File
@@ -9,9 +9,6 @@
#include "../common/repositories/dynamic_zone_lockouts_repository.h"
#include <cereal/types/utility.hpp>
extern ClientList client_list;
extern ZSList zoneserver_list;
DynamicZoneManager dynamic_zone_manager;
DynamicZoneManager::DynamicZoneManager() :
@@ -56,7 +53,7 @@ DynamicZone* DynamicZoneManager::TryCreate(DynamicZone& dz_request, const std::v
LogDynamicZones("Created new dz [{}] for zone [{}]", dz_id, dz_request.GetZoneID());
auto pack = dz->CreateServerPacket(0, 0);
zoneserver_list.SendPacket(pack.get());
ZSList::Instance()->SendPacket(pack.get());
auto inserted = dynamic_zone_cache.emplace(dz_id, std::move(dz));
return inserted.first->second.get();
@@ -76,7 +73,7 @@ void DynamicZoneManager::CacheNewDynamicZone(ServerPacket* pack)
dynamic_zone_cache.emplace(buf->dz_id, std::move(new_dz));
LogDynamicZones("Cached new dynamic zone [{}]", buf->dz_id);
zoneserver_list.SendPacket(repack.get());
ZSList::Instance()->SendPacket(repack.get());
}
void DynamicZoneManager::CacheAllFromDatabase()
@@ -194,7 +191,7 @@ void DynamicZoneManager::SendBulkMemberStatuses(uint32_t zone_id, uint16_t inst_
buf->cereal_size = static_cast<uint32_t>(sv.size());
memcpy(buf->cereal_data, sv.data(), sv.size());
zoneserver_list.SendPacket(zone_id, inst_id, &pack);
ZSList::Instance()->SendPacket(zone_id, inst_id, &pack);
}
void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
@@ -210,7 +207,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
{
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
ClientListEntry* cle = client_list.FindCharacter(buf->target_name);
ClientListEntry* cle = ClientList::Instance()->FindCharacter(buf->target_name);
if (cle && cle->Server())
{
// continue in the add target's zone
@@ -220,7 +217,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
else
{
// add target not online, return to inviter
ClientListEntry* inviter_cle = client_list.FindCharacter(buf->requester_name);
ClientListEntry* inviter_cle = ClientList::Instance()->FindCharacter(buf->requester_name);
if (inviter_cle && inviter_cle->Server())
{
inviter_cle->Server()->SendPacket(pack);
@@ -231,7 +228,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
case ServerOP_DzSaveInvite:
{
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
if (ClientListEntry* cle = client_list.FindCharacter(buf->target_name))
if (ClientListEntry* cle = ClientList::Instance()->FindCharacter(buf->target_name))
{
// store packet on cle and re-send it when client requests it
buf->is_char_online = true;
@@ -243,7 +240,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
case ServerOP_DzRequestInvite:
{
auto buf = reinterpret_cast<ServerCharacterID_Struct*>(pack->pBuffer);
if (ClientListEntry* cle = client_list.FindCLEByCharacterID(buf->char_id))
if (ClientListEntry* cle = ClientList::Instance()->FindCLEByCharacterID(buf->char_id))
{
auto invite_pack = cle->GetPendingDzInvite();
if (invite_pack && cle->Server())
@@ -259,7 +256,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
// notify requester (old leader) and new leader of the result
ZoneServer* new_leader_zs = nullptr;
ClientListEntry* leader_cle = client_list.FindCharacter(buf->new_leader_name);
ClientListEntry* leader_cle = ClientList::Instance()->FindCharacter(buf->new_leader_name);
if (leader_cle && leader_cle->Server())
{
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
@@ -274,7 +271,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
}
// if old and new leader are in the same zone only send one message
ClientListEntry* requester_cle = client_list.FindCLEByCharacterID(buf->requester_id);
ClientListEntry* requester_cle = ClientList::Instance()->FindCLEByCharacterID(buf->requester_id);
if (requester_cle && requester_cle->Server() && requester_cle->Server() != new_leader_zs)
{
requester_cle->Server()->SendPacket(pack);
@@ -301,7 +298,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
dz->SetZoneInLocation(buf->x, buf->y, buf->z, buf->heading, false);
}
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzSetSwitchID:
@@ -311,7 +308,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
{
dz->ProcessSetSwitchID(buf->dz_switch_id);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzAddRemoveMember:
@@ -322,7 +319,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
auto status = static_cast<DynamicZoneMemberStatus>(buf->character_status);
dz->ProcessMemberAddRemove({ buf->character_id, buf->character_name, status }, buf->removed);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzSwapMembers:
@@ -335,7 +332,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
dz->ProcessMemberAddRemove({ buf->add_character_id, buf->add_character_name, status }, false);
dz->ProcessMemberAddRemove({ buf->remove_character_id, buf->remove_character_name }, true);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzRemoveAllMembers:
@@ -345,7 +342,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
{
dz->ProcessRemoveAllMembers();
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzSetSecondsRemaining:
@@ -383,7 +380,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
auto status = static_cast<DynamicZoneMemberStatus>(buf->status);
dz->ProcessMemberStatusChange(buf->character_id, status);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzMovePC:
@@ -392,7 +389,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
if (dz && dz->HasMember(buf->character_id))
{
zoneserver_list.SendPacket(buf->sender_zone_id, buf->sender_instance_id, pack);
ZSList::Instance()->SendPacket(buf->sender_zone_id, buf->sender_instance_id, pack);
}
break;
}
@@ -403,7 +400,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
{
dz->SetLocked(buf->lock);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzReplayOnJoin:
@@ -413,7 +410,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
{
dz->SetReplayOnJoin(buf->enabled);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzLockout:
@@ -424,7 +421,7 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
DzLockout lockout{ dz->GetUUID(), dz->GetName(), buf->event_name, buf->expire_time, buf->duration };
dz->HandleLockoutUpdate(lockout, buf->remove, buf->members_only);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzLockoutDuration:
@@ -435,13 +432,13 @@ void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
DzLockout lockout{ dz->GetUUID(), dz->GetName(), buf->event_name, buf->expire_time, buf->duration };
dz->HandleLockoutDuration(lockout, buf->seconds, buf->members_only, false);
}
zoneserver_list.SendPacket(pack);
ZSList::Instance()->SendPacket(pack);
break;
}
case ServerOP_DzCharacterLockout:
{
auto buf = reinterpret_cast<ServerDzCharacterLockout_Struct*>(pack->pBuffer);
auto cle = client_list.FindCLEByCharacterID(buf->char_id);
auto cle = ClientList::Instance()->FindCLEByCharacterID(buf->char_id);
if (cle && cle->Server())
{
cle->Server()->SendPacket(pack);
+6 -10
View File
@@ -13,15 +13,11 @@
#include "ucs.h"
#include "queryserv.h"
extern ZSList zoneserver_list;
extern ClientList client_list;
extern WorldGuildManager guild_mgr;
extern UCSConnection UCSLink;
extern QueryServConnection QSLink;
void callGetZoneList(Json::Value &response)
{
for (auto &zone: zoneserver_list.getZoneServerList()) {
for (auto &zone: ZSList::Instance()->getZoneServerList()) {
Json::Value row;
if (!zone) {
@@ -125,7 +121,7 @@ void callGetClientList(Json::Value &response, const std::vector<std::string> &ar
}
}
client_list.GetClientList(response, full_list);
ClientList::Instance()->GetClientList(response, full_list);
}
void getReloadTypes(Json::Value &response)
@@ -141,8 +137,8 @@ void getReloadTypes(Json::Value &response)
void getServerCounts(Json::Value &response, const std::vector<std::string> &args)
{
response["zone_count"] = zoneserver_list.GetServerListCount();
response["client_count"] = client_list.GetClientCount();
response["zone_count"] = ZSList::Instance()->GetServerListCount();
response["client_count"] = ClientList::Instance()->GetClientCount();
}
void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::string> &args)
@@ -167,7 +163,7 @@ void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::str
if (std::to_string(t) == command || Strings::ToLower(ServerReload::GetName(t)) == command) {
message(r, fmt::format("Reloading [{}] globally", ServerReload::GetName(t)));
LogInfo("Queueing reload of type [{}] to zones", ServerReload::GetName(t));
zoneserver_list.QueueServerReload(t);
ZSList::Instance()->QueueServerReload(t);
}
found_command = true;
}
@@ -259,7 +255,7 @@ void EQEmuApiWorldDataService::callGetGuildDetails(Json::Value &response, const
row["tribute"]["time_remaining"] = guild->tribute.time_remaining;
row["tribute"]["enabled"] = guild->tribute.enabled;
client_list.GetGuildClientList(response, guild_id);
ClientList::Instance()->GetGuildClientList(response, guild_id);
response.append(row);
}
+15 -18
View File
@@ -45,10 +45,7 @@
#include <algorithm>
extern ZSList zoneserver_list;
extern ClientList client_list;
extern uint32 numzones;
extern LoginServerList loginserverlist;
extern LauncherList launcher_list;
extern volatile bool RunLoops;
@@ -86,15 +83,15 @@ const std::string &EQW::GetOutput() const {
void EQW::LockWorld() {
WorldConfig::LockWorld();
if (loginserverlist.Connected()) {
loginserverlist.SendStatus();
if (LoginServerList::Instance()->Connected()) {
LoginServerList::Instance()->SendStatus();
}
}
void EQW::UnlockWorld() {
WorldConfig::UnlockWorld();
if (loginserverlist.Connected()) {
loginserverlist.SendStatus();
if (LoginServerList::Instance()->Connected()) {
LoginServerList::Instance()->SendStatus();
}
}
@@ -104,11 +101,11 @@ Const_char *EQW::GetConfig(Const_char *var_name) {
}
bool EQW::LSConnected() {
return(loginserverlist.Connected());
return(LoginServerList::Instance()->Connected());
}
int EQW::CountZones() {
return(zoneserver_list.GetZoneCount());
return(ZSList::Instance()->GetZoneCount());
}
//returns an array of zone_refs (opaque)
@@ -116,7 +113,7 @@ std::vector<std::string> EQW::ListBootedZones() {
std::vector<std::string> res;
std::vector<uint32> zones;
zoneserver_list.GetZoneIDList(zones);
ZSList::Instance()->GetZoneIDList(zones);
std::vector<uint32>::iterator cur, end;
cur = zones.begin();
@@ -131,7 +128,7 @@ std::vector<std::string> EQW::ListBootedZones() {
std::map<std::string,std::string> EQW::GetZoneDetails(Const_char *zone_ref) {
std::map<std::string,std::string> res;
ZoneServer *zs = zoneserver_list.FindByID(Strings::ToInt(zone_ref));
ZoneServer *zs = ZSList::Instance()->FindByID(Strings::ToInt(zone_ref));
if(zs == nullptr) {
res["error"] = "Invalid zone.";
return(res);
@@ -158,7 +155,7 @@ std::map<std::string,std::string> EQW::GetZoneDetails(Const_char *zone_ref) {
}
int EQW::CountPlayers() {
return(client_list.GetClientCount());
return(ClientList::Instance()->GetClientCount());
}
//returns an array of character names in the zone (empty=all zones)
@@ -166,7 +163,7 @@ std::vector<std::string> EQW::ListPlayers(Const_char *zone_name) {
std::vector<std::string> res;
std::vector<ClientListEntry *> list;
client_list.GetClients(zone_name, list);
ClientList::Instance()->GetClients(zone_name, list);
std::vector<ClientListEntry *>::iterator cur, end;
cur = list.begin();
@@ -180,7 +177,7 @@ std::vector<std::string> EQW::ListPlayers(Const_char *zone_name) {
std::map<std::string,std::string> EQW::GetPlayerDetails(Const_char *char_name) {
std::map<std::string,std::string> res;
ClientListEntry *cle = client_list.FindCharacter(char_name);
ClientListEntry *cle = ClientList::Instance()->FindCharacter(char_name);
if(cle == nullptr) {
res["error"] = "1";
return(res);
@@ -265,7 +262,7 @@ void EQW::CreateLauncher(Const_char *launcher_name, int dynamic_count) {
uint32 EQW::CreateGuild(const char* name, uint32 leader_char_id) {
uint32 id = guild_mgr.CreateGuild(name, leader_char_id);
if(id != GUILD_NONE)
client_list.UpdateClientGuild(leader_char_id, id);
ClientList::Instance()->UpdateClientGuild(leader_char_id, id);
return(id);
}
@@ -286,7 +283,7 @@ bool EQW::SetGuildLeader(uint32 guild_id, uint32 leader_char_id) {
}
bool EQW::SetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
client_list.UpdateClientGuild(charid, guild_id);
ClientList::Instance()->UpdateClientGuild(charid, guild_id);
return(guild_mgr.SetGuild(charid, guild_id, rank));
}
@@ -361,7 +358,7 @@ void EQW::ResolveBug(const char *id) {
}
void EQW::SendMessage(uint32 type, const char *msg) {
zoneserver_list.SendEmoteMessage(
ZSList::Instance()->SendEmoteMessage(
0,
0,
AccountStatus::Player,
@@ -371,7 +368,7 @@ void EQW::SendMessage(uint32 type, const char *msg) {
}
void EQW::WorldShutDown(uint32 time, uint32 interval) {
zoneserver_list.WorldShutDown(time, interval);
ZSList::Instance()->WorldShutDown(time, interval);
}
#endif //EMBPERL
+4 -7
View File
@@ -25,9 +25,6 @@
#include "../common/misc_functions.h"
#include "../common/classes.h"
extern ClientList client_list;
extern ZSList zoneserver_list;
GroupLFP::GroupLFP(uint32 inLeaderID) {
LeaderID = inLeaderID;
@@ -69,7 +66,7 @@ void GroupLFP::SetDetails(ServerLFPUpdate_Struct *Update) {
}
// Otherwise try and find the information ourselves.
else {
CLE = client_list.FindCharacter(Members[i].Name);
CLE = ClientList::Instance()->FindCharacter(Members[i].Name);
if(CLE) {
Members[i].Class = CLE->class_();
Members[i].Level = CLE->level();
@@ -125,7 +122,7 @@ void GroupLFPList::Process() {
if(GroupMembers[i].Name[0] == '\0')
continue;
ClientListEntry *CLE = client_list.FindCharacter(GroupMembers[i].Name);
ClientListEntry *CLE = ClientList::Instance()->FindCharacter(GroupMembers[i].Name);
if(!CLE) {
// The first member entry is always the person who posted the LFP group, either
// a single ungrouped player, or the leader of the group. If (s)he is gone, remove
@@ -264,13 +261,13 @@ void GroupLFPList::SendLFPMatches(ServerLFPMatchesRequest_Struct* smrs) {
}
}
ClientListEntry* CLE = client_list.FindCharacter(smrs->FromName);
ClientListEntry* CLE = ClientList::Instance()->FindCharacter(smrs->FromName);
if (CLE != nullptr) {
if (CLE->Server() != nullptr)
CLE->Server()->SendPacket(Pack);
}
else {
ZoneServer* zs = zoneserver_list.FindByName(smrs->FromName);
ZoneServer* zs = ZSList::Instance()->FindByName(smrs->FromName);
if (zs != nullptr)
zs->SendPacket(Pack);
}
+7 -9
View File
@@ -20,8 +20,6 @@
#include "cliententry.h"
#include "world_config.h"
extern ZSList zoneserver_list;
extern ClientList client_list;
extern uint32 numzones;
extern uint32 numplayers;
extern volatile bool RunLoops;
@@ -108,7 +106,7 @@ void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p)
}
if (RuleB(World, EnforceCharacterLimitAtLogin)) {
if (client_list.IsAccountInGame(utwr->lsaccountid)) {
if (ClientList::Instance()->IsAccountInGame(utwr->lsaccountid)) {
LogDebug("User already online account_id [{0}]", utwr->lsaccountid);
utwrs->response = UserToWorldStatusAlreadyOnline;
SendPacket(&outpack);
@@ -189,7 +187,7 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
}
if (RuleB(World, EnforceCharacterLimitAtLogin)) {
if (client_list.IsAccountInGame(utwr->lsaccountid)) {
if (ClientList::Instance()->IsAccountInGame(utwr->lsaccountid)) {
LogDebug("User already online account_id [{0}]", utwr->lsaccountid);
utwrs->response = UserToWorldStatusAlreadyOnline;
SendPacket(&outpack);
@@ -221,7 +219,7 @@ void LoginServer::ProcessLSClientAuthLegacy(uint16_t opcode, EQ::Net::Packet &p)
r.is_client_from_local_network
);
client_list.CLEAdd(
ClientList::Instance()->CLEAdd(
r.loginserver_account_id,
"eqemu",
r.loginserver_account_name,
@@ -256,7 +254,7 @@ void LoginServer::ProcessLSClientAuth(uint16_t opcode, EQ::Net::Packet &p)
r.is_client_from_local_network
);
client_list.CLEAdd(
ClientList::Instance()->CLEAdd(
r.loginserver_account_id,
r.loginserver_name,
r.account_name,
@@ -312,7 +310,7 @@ void LoginServer::ProcessSystemwideMessage(uint16_t opcode, EQ::Net::Packet &p)
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
ServerSystemwideMessage *swm = (ServerSystemwideMessage *) p.Data();
zoneserver_list.SendEmoteMessageRaw(
ZSList::Instance()->SendEmoteMessageRaw(
0,
0,
AccountStatus::Player,
@@ -376,7 +374,7 @@ bool LoginServer::Connect()
SendInfo();
SendStatus();
zoneserver_list.SendLSZones();
ZSList::Instance()->SendLSZones();
m_statusupdate_timer = std::make_unique<EQ::Timer>(
LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
@@ -485,7 +483,7 @@ bool LoginServer::Connect()
);
SendInfo();
SendStatus();
zoneserver_list.SendLSZones();
ZSList::Instance()->SendLSZones();
m_statusupdate_timer = std::make_unique<EQ::Timer>(
LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
-3
View File
@@ -36,9 +36,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "clientlist.h"
#include "world_config.h"
extern ZSList zoneserver_list;
extern LoginServerList loginserverlist;
extern ClientList client_list;
extern uint32 numzones;
extern uint32 numplayers;
extern volatile bool RunLoops;

Some files were not shown because too many files have changed in this diff Show More