mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b894d7ee3a | |||
| eecfce6514 | |||
| 2d6950149a | |||
| 3945a8c0c0 | |||
| f27209a812 | |||
| d4982743bf | |||
| e2dd8f5f60 | |||
| bfc0cceecc | |||
| c9902881b7 | |||
| 62bb426847 |
@@ -68,4 +68,3 @@ compile_flags.txt
|
|||||||
|
|
||||||
# CMake Files
|
# CMake Files
|
||||||
cmake-build-relwithdebinfo/*
|
cmake-build-relwithdebinfo/*
|
||||||
skill-caps.diff
|
|
||||||
|
|||||||
-219
@@ -1,222 +1,3 @@
|
|||||||
## [22.61.0] 1/6/2025
|
|
||||||
|
|
||||||
### Bots
|
|
||||||
|
|
||||||
* Fix AA ranks to account for level ([#4567](https://github.com/EQEmu/Server/pull/4567)) @nytmyr 2024-12-07
|
|
||||||
|
|
||||||
### Code
|
|
||||||
|
|
||||||
* Convert Event Parses to Single Line ([#4569](https://github.com/EQEmu/Server/pull/4569)) @Kinglykrab 2024-12-12
|
|
||||||
* Fix GM Flag Spell Restriction Bypasses ([#4571](https://github.com/EQEmu/Server/pull/4571)) @Kinglykrab 2025-01-06
|
|
||||||
* Remove Unused Group Methods ([#4559](https://github.com/EQEmu/Server/pull/4559)) @Kinglykrab 2024-12-12
|
|
||||||
|
|
||||||
### Commands
|
|
||||||
|
|
||||||
* Add #find bot Subcommand ([#4563](https://github.com/EQEmu/Server/pull/4563)) @Kinglykrab 2024-12-12
|
|
||||||
* Add #find ldon_theme Subcommand ([#4564](https://github.com/EQEmu/Server/pull/4564)) @Kinglykrab 2024-12-12
|
|
||||||
* Fix #copycharacter ([#4582](https://github.com/EQEmu/Server/pull/4582)) @Akkadius 2025-01-06
|
|
||||||
|
|
||||||
### Databuckets
|
|
||||||
|
|
||||||
* Improved Reliability and Performance of Databuckets ([#4562](https://github.com/EQEmu/Server/pull/4562)) @Akkadius 2024-12-12
|
|
||||||
|
|
||||||
### Feature
|
|
||||||
|
|
||||||
* Enable bazaar window 'Find Trader' functionality ([#4560](https://github.com/EQEmu/Server/pull/4560)) @neckkola 2024-12-12
|
|
||||||
|
|
||||||
### Filesystem
|
|
||||||
|
|
||||||
* Path Manager Improvements ([#4557](https://github.com/EQEmu/Server/pull/4557)) @Akkadius 2025-01-06
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Allow Items in ROF2 to Stack to 32,767 ([#4556](https://github.com/EQEmu/Server/pull/4556)) @Kinglykrab 2024-12-12
|
|
||||||
* Fix EVENT_COMBAT on NPC Death ([#4558](https://github.com/EQEmu/Server/pull/4558)) @Kinglykrab 2024-11-28
|
|
||||||
* Guild Membership Update Fix ([#4581](https://github.com/EQEmu/Server/pull/4581)) @neckkola 2025-01-06
|
|
||||||
* Guild creation to propagate across zones ([#4575](https://github.com/EQEmu/Server/pull/4575)) @neckkola 2025-01-06
|
|
||||||
* Repair a EQEMUConfig Memory Leak ([#4584](https://github.com/EQEmu/Server/pull/4584)) @neckkola 2025-01-06
|
|
||||||
* Repair a LoadNPCEmote MemoryLeak ([#4586](https://github.com/EQEmu/Server/pull/4586)) @neckkola 2025-01-06
|
|
||||||
* Repair a memory leak in GuildsList ([#4585](https://github.com/EQEmu/Server/pull/4585)) @neckkola 2025-01-06
|
|
||||||
* Resolve a client crash when logging in or zoning ([#4572](https://github.com/EQEmu/Server/pull/4572)) @neckkola 2024-12-14
|
|
||||||
|
|
||||||
### Groups
|
|
||||||
|
|
||||||
* Fix AmIMainAssist incorrectly checking for MainTankName ([#4565](https://github.com/EQEmu/Server/pull/4565)) @nytmyr 2024-12-04
|
|
||||||
|
|
||||||
### Inventory
|
|
||||||
|
|
||||||
* Add GetInventorySlots() Method ([#4566](https://github.com/EQEmu/Server/pull/4566)) @Kinglykrab 2025-01-06
|
|
||||||
|
|
||||||
### Logs
|
|
||||||
|
|
||||||
* Improve Crash log defaults ([#4579](https://github.com/EQEmu/Server/pull/4579)) @Akkadius 2025-01-06
|
|
||||||
|
|
||||||
### Maps
|
|
||||||
|
|
||||||
* Fix broken Map MMFS implementation ([#4576](https://github.com/EQEmu/Server/pull/4576)) @Akkadius 2025-01-06
|
|
||||||
|
|
||||||
### Network
|
|
||||||
|
|
||||||
* Prune / disconnect TCP connections gracefully ([#4574](https://github.com/EQEmu/Server/pull/4574)) @Akkadius 2025-01-06
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
* Add rules for requiring custom files from client ([#4561](https://github.com/EQEmu/Server/pull/4561)) @knervous 2024-12-12
|
|
||||||
|
|
||||||
## [22.60.0] 11/25/2024
|
|
||||||
|
|
||||||
### Bazaar
|
|
||||||
|
|
||||||
* Further refinements for instanced bazaar ([#4544](https://github.com/EQEmu/Server/pull/4544)) @neckkola 2024-11-16
|
|
||||||
|
|
||||||
### Code
|
|
||||||
|
|
||||||
* Fix build with older C++ libraries ([#4549](https://github.com/EQEmu/Server/pull/4549)) @hgtw 2024-11-24
|
|
||||||
|
|
||||||
### Config
|
|
||||||
|
|
||||||
* Fix World TCP Address Configuration Default ([#4551](https://github.com/EQEmu/Server/pull/4551)) @Akkadius 2024-11-24
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Fix Issue with Perl EVENT_PAYLOAD ([#4545](https://github.com/EQEmu/Server/pull/4545)) @Kinglykrab 2024-11-24
|
|
||||||
* Fix Possible Item Loss in Trades ([#4554](https://github.com/EQEmu/Server/pull/4554)) @Kinglykrab 2024-11-24
|
|
||||||
* Fix Strings::Commify bug with #mystats ([#4547](https://github.com/EQEmu/Server/pull/4547)) @carolus21rex 2024-11-22
|
|
||||||
* Fix an edge case with augmented items inside parceled containers ([#4546](https://github.com/EQEmu/Server/pull/4546)) @neckkola 2024-11-21
|
|
||||||
* Fix for bazaar search of containers. ([#4540](https://github.com/EQEmu/Server/pull/4540)) @neckkola 2024-11-15
|
|
||||||
* Fix for mult-instanced bazaar zones ([#4541](https://github.com/EQEmu/Server/pull/4541)) @neckkola 2024-11-15
|
|
||||||
* Fix for sending money via Parcel, then changing your mind ([#4552](https://github.com/EQEmu/Server/pull/4552)) @neckkola 2024-11-24
|
|
||||||
* Fix issue where NPC's are being hidden as traders ([#4539](https://github.com/EQEmu/Server/pull/4539)) @Akkadius 2024-11-15
|
|
||||||
* Players could become flagged as a Trader when they were not trading ([#4553](https://github.com/EQEmu/Server/pull/4553)) @neckkola 2024-11-24
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
* Add Rule to Disable NPCs Facing Target ([#4543](https://github.com/EQEmu/Server/pull/4543)) @Kinglykrab 2024-11-24
|
|
||||||
|
|
||||||
### Tasks
|
|
||||||
|
|
||||||
* Update tasks in all zones if invalid zone set ([#4550](https://github.com/EQEmu/Server/pull/4550)) @hgtw 2024-11-25
|
|
||||||
|
|
||||||
## [22.59.1] 11/13/2024
|
|
||||||
|
|
||||||
### Hotfix
|
|
||||||
|
|
||||||
* Fix faulty database migration condition with databuckets (9285)
|
|
||||||
|
|
||||||
## [22.59.0] 11/13/2024
|
|
||||||
|
|
||||||
### Databuckets
|
|
||||||
|
|
||||||
* Add database index to data_buckets ([#4535](https://github.com/EQEmu/Server/pull/4535)) @Akkadius 2024-11-09
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Bazaar two edge case issues resolved ([#4533](https://github.com/EQEmu/Server/pull/4533)) @neckkola 2024-11-09
|
|
||||||
* Check if the mob is already in the close mobs list before inserting @Akkadius 2024-11-11
|
|
||||||
* ScanCloseMobs - Ensure scanning mob has an entity ID @Akkadius 2024-11-10
|
|
||||||
|
|
||||||
### Performance
|
|
||||||
|
|
||||||
* Improvements to ScanCloseMobs logic ([#4534](https://github.com/EQEmu/Server/pull/4534)) @Akkadius 2024-11-08
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add Native Database Querying Interface ([#4531](https://github.com/EQEmu/Server/pull/4531)) @hgtw 2024-11-13
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
* Add Rule for restricting client versions to world server ([#4527](https://github.com/EQEmu/Server/pull/4527)) @knervous 2024-11-12
|
|
||||||
|
|
||||||
## [22.58.0] 11/5/2024
|
|
||||||
|
|
||||||
### Code
|
|
||||||
|
|
||||||
* Add mysql prepared statement support ([#4530](https://github.com/EQEmu/Server/pull/4530)) @hgtw 2024-11-06
|
|
||||||
* Update perlbind to 1.1.0 ([#4529](https://github.com/EQEmu/Server/pull/4529)) @hgtw 2024-11-06
|
|
||||||
|
|
||||||
### Feature
|
|
||||||
|
|
||||||
* Focus Skill Attack Spells ([#4528](https://github.com/EQEmu/Server/pull/4528)) @mmcgarvey 2024-10-31
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Add Missing Lua Registers ([#4525](https://github.com/EQEmu/Server/pull/4525)) @Kinglykrab 2024-10-24
|
|
||||||
* Fix cross_zone_set_entity_variable_by_char_id in Lua ([#4526](https://github.com/EQEmu/Server/pull/4526)) @Kinglykrab 2024-10-24
|
|
||||||
|
|
||||||
### Loginserver
|
|
||||||
|
|
||||||
* Automatifc Opcode File Creation ([#4521](https://github.com/EQEmu/Server/pull/4521)) @KimLS 2024-10-22
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add Spawn Circle/Grid Methods to Perl/Lua ([#4524](https://github.com/EQEmu/Server/pull/4524)) @Kinglykrab 2024-10-24
|
|
||||||
|
|
||||||
## [22.57.1] 10/22/2024
|
|
||||||
|
|
||||||
### Bots
|
|
||||||
|
|
||||||
* Enable Bot Commands Only if Rule Enabled ([#4519](https://github.com/EQEmu/Server/pull/4519)) @Kinglykrab 2024-10-22
|
|
||||||
* Fix pet buffs from saving duplicates every save ([#4520](https://github.com/EQEmu/Server/pull/4520)) @nytmyr 2024-10-22
|
|
||||||
|
|
||||||
### Loginserver
|
|
||||||
|
|
||||||
* Automatic Opcode File Creation ([#4521](https://github.com/EQEmu/Server/pull/4521)) @KimLS 2024-10-22
|
|
||||||
|
|
||||||
## [22.57.0] 10/20/2024
|
|
||||||
|
|
||||||
### Bots
|
|
||||||
|
|
||||||
* Add "silent" option to ^spawn and mute raid spawn ([#4494](https://github.com/EQEmu/Server/pull/4494)) @nytmyr 2024-10-05
|
|
||||||
* Add attack flag when told to attack ([#4490](https://github.com/EQEmu/Server/pull/4490)) @nytmyr 2024-09-29
|
|
||||||
* Fix timers loading on spawn and zone ([#4516](https://github.com/EQEmu/Server/pull/4516)) @nytmyr 2024-10-20
|
|
||||||
|
|
||||||
### Code
|
|
||||||
|
|
||||||
* Fixed a typo in Zoning.cpp ([#4515](https://github.com/EQEmu/Server/pull/4515)) @carolus21rex 2024-10-20
|
|
||||||
* Optimization Code Cleanup ([#4489](https://github.com/EQEmu/Server/pull/4489)) @Akkadius 2024-09-30
|
|
||||||
* Remove Extra Skill in EQ::skills::GetExtraDamageSkills() ([#4486](https://github.com/EQEmu/Server/pull/4486)) @Kinglykrab 2024-10-03
|
|
||||||
|
|
||||||
### Crash
|
|
||||||
|
|
||||||
* Fixes a crash when the faction_list db table is empty. ([#4511](https://github.com/EQEmu/Server/pull/4511)) @KimLS 2024-10-14
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Add character_instance_safereturns to tables_to_zero_id ([#4485](https://github.com/EQEmu/Server/pull/4485)) @Morzain 2024-09-26
|
|
||||||
* Correctly limit max targets of PBAOE ([#4507](https://github.com/EQEmu/Server/pull/4507)) @catapultam-habeo 2024-10-11
|
|
||||||
* FindBestZ selecting false zone floor as bestz - Results in roambox failures ([#4504](https://github.com/EQEmu/Server/pull/4504)) @fryguy503 2024-10-13
|
|
||||||
* Fix #set motd Crash ([#4495](https://github.com/EQEmu/Server/pull/4495)) @Kinglykrab 2024-10-05
|
|
||||||
* Fix `character_exp_modifiers` Default Values ([#4502](https://github.com/EQEmu/Server/pull/4502)) @Kinglykrab 2024-10-09
|
|
||||||
* Fix a display error regarding a few trader/buyer query errors ([#4514](https://github.com/EQEmu/Server/pull/4514)) @neckkola 2024-10-17
|
|
||||||
* Fix Group ID 0 in Group::SaveGroupLeaderAA() ([#4487](https://github.com/EQEmu/Server/pull/4487)) @Kinglykrab 2024-10-03
|
|
||||||
* Fix Mercenary Encounter Crash ([#4509](https://github.com/EQEmu/Server/pull/4509)) @Kinglykrab 2024-10-12
|
|
||||||
* Fix NPC::CanTalk() Crash ([#4499](https://github.com/EQEmu/Server/pull/4499)) @Kinglykrab 2024-10-07
|
|
||||||
* Fix Spells:DefaultAOEMaxTargets Default Value ([#4508](https://github.com/EQEmu/Server/pull/4508)) @Kinglykrab 2024-10-12
|
|
||||||
* Fix Targeted AOE Max Targets Rule ([#4488](https://github.com/EQEmu/Server/pull/4488)) @Kinglykrab 2024-10-03
|
|
||||||
* fixed a bug where it would use npc value instead of faction value in the database. ([#4491](https://github.com/EQEmu/Server/pull/4491)) @regneq 2024-09-29
|
|
||||||
* Master of Disguise should apply to illusions casted by others. ([#4506](https://github.com/EQEmu/Server/pull/4506)) @fryguy503 2024-10-11
|
|
||||||
* Spells - Self Only (Yellow) cast when non group member is targeted ([#4503](https://github.com/EQEmu/Server/pull/4503)) @fryguy503 2024-10-11
|
|
||||||
|
|
||||||
### Loginserver
|
|
||||||
|
|
||||||
* Larion loginserver support ([#4492](https://github.com/EQEmu/Server/pull/4492)) @KimLS 2024-10-03
|
|
||||||
* Login Fatal Error Spamming ([#4476](https://github.com/EQEmu/Server/pull/4476)) @KimLS 2024-10-09
|
|
||||||
|
|
||||||
### Logs
|
|
||||||
|
|
||||||
* Add NPC Trades to Player Events ([#4505](https://github.com/EQEmu/Server/pull/4505)) @Kinglykrab 2024-10-13
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add Buff Fade Methods to Perl/Lua ([#4501](https://github.com/EQEmu/Server/pull/4501)) @Kinglykrab 2024-10-09
|
|
||||||
* Add EVENT_READ_ITEM to Perl/Lua ([#4497](https://github.com/EQEmu/Server/pull/4497)) @Kinglykrab 2024-10-08
|
|
||||||
* Add NPC List Filter Methods to Perl/Lua ([#4493](https://github.com/EQEmu/Server/pull/4493)) @Kinglykrab 2024-10-04
|
|
||||||
* Add Scripting Support to Mercenaries ([#4500](https://github.com/EQEmu/Server/pull/4500)) @Kinglykrab 2024-10-11
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
* Add Rule to disable PVP Regions ([#4513](https://github.com/EQEmu/Server/pull/4513)) @Kinglykrab 2024-10-17
|
|
||||||
|
|
||||||
## [22.56.3] 9/23/2024
|
## [22.56.3] 9/23/2024
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ IF(EQEMU_ADD_PROFILER)
|
|||||||
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed")
|
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed")
|
||||||
ENDIF(EQEMU_ADD_PROFILER)
|
ENDIF(EQEMU_ADD_PROFILER)
|
||||||
|
|
||||||
IF(USE_MAP_MMFS)
|
|
||||||
ADD_DEFINITIONS(-DUSE_MAP_MMFS)
|
|
||||||
ENDIF (USE_MAP_MMFS)
|
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
|||||||
@@ -36,14 +36,12 @@
|
|||||||
#include "../../common/file.h"
|
#include "../../common/file.h"
|
||||||
#include "../../common/events/player_event_logs.h"
|
#include "../../common/events/player_event_logs.h"
|
||||||
#include "../../common/skill_caps.h"
|
#include "../../common/skill_caps.h"
|
||||||
#include "../../common/evolving_items.h"
|
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PathManager path;
|
PathManager path;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
|
||||||
|
|
||||||
void ExportSpells(SharedDatabase *db);
|
void ExportSpells(SharedDatabase *db);
|
||||||
void ExportSkillCaps(SharedDatabase *db);
|
void ExportSkillCaps(SharedDatabase *db);
|
||||||
|
|||||||
@@ -30,14 +30,12 @@
|
|||||||
#include "../../common/repositories/base_data_repository.h"
|
#include "../../common/repositories/base_data_repository.h"
|
||||||
#include "../../common/file.h"
|
#include "../../common/file.h"
|
||||||
#include "../../common/events/player_event_logs.h"
|
#include "../../common/events/player_event_logs.h"
|
||||||
#include "../../common/evolving_items.h"
|
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PathManager path;
|
PathManager path;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
|
||||||
|
|
||||||
void ImportSpells(SharedDatabase *db);
|
void ImportSpells(SharedDatabase *db);
|
||||||
void ImportSkillCaps(SharedDatabase *db);
|
void ImportSkillCaps(SharedDatabase *db);
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ SET(common_sources
|
|||||||
event_sub.cpp
|
event_sub.cpp
|
||||||
events/player_event_logs.cpp
|
events/player_event_logs.cpp
|
||||||
events/player_event_discord_formatter.cpp
|
events/player_event_discord_formatter.cpp
|
||||||
evolving_items.cpp
|
|
||||||
expedition_lockout_timer.cpp
|
expedition_lockout_timer.cpp
|
||||||
extprofile.cpp
|
extprofile.cpp
|
||||||
discord/discord_manager.cpp
|
discord/discord_manager.cpp
|
||||||
@@ -63,7 +62,6 @@ SET(common_sources
|
|||||||
mutex.cpp
|
mutex.cpp
|
||||||
mysql_request_result.cpp
|
mysql_request_result.cpp
|
||||||
mysql_request_row.cpp
|
mysql_request_row.cpp
|
||||||
mysql_stmt.cpp
|
|
||||||
opcode_map.cpp
|
opcode_map.cpp
|
||||||
opcodemgr.cpp
|
opcodemgr.cpp
|
||||||
packet_dump.cpp
|
packet_dump.cpp
|
||||||
@@ -98,7 +96,6 @@ SET(common_sources
|
|||||||
json/json.hpp
|
json/json.hpp
|
||||||
json/jsoncpp.cpp
|
json/jsoncpp.cpp
|
||||||
zone_store.cpp
|
zone_store.cpp
|
||||||
memory/ksm.hpp
|
|
||||||
net/console_server.cpp
|
net/console_server.cpp
|
||||||
net/console_server_connection.cpp
|
net/console_server_connection.cpp
|
||||||
net/crc32.cpp
|
net/crc32.cpp
|
||||||
@@ -174,7 +171,6 @@ SET(repositories
|
|||||||
repositories/base/base_character_currency_repository.h
|
repositories/base/base_character_currency_repository.h
|
||||||
repositories/base/base_character_data_repository.h
|
repositories/base/base_character_data_repository.h
|
||||||
repositories/base/base_character_disciplines_repository.h
|
repositories/base/base_character_disciplines_repository.h
|
||||||
repositories/base/base_character_evolving_items_repository.h
|
|
||||||
repositories/base/base_character_expedition_lockouts_repository.h
|
repositories/base/base_character_expedition_lockouts_repository.h
|
||||||
repositories/base/base_character_exp_modifiers_repository.h
|
repositories/base/base_character_exp_modifiers_repository.h
|
||||||
repositories/base/base_character_inspect_messages_repository.h
|
repositories/base/base_character_inspect_messages_repository.h
|
||||||
@@ -243,7 +239,6 @@ SET(repositories
|
|||||||
repositories/base/base_inventory_snapshots_repository.h
|
repositories/base/base_inventory_snapshots_repository.h
|
||||||
repositories/base/base_ip_exemptions_repository.h
|
repositories/base/base_ip_exemptions_repository.h
|
||||||
repositories/base/base_items_repository.h
|
repositories/base/base_items_repository.h
|
||||||
repositories/base/base_items_evolving_details_repository.h
|
|
||||||
repositories/base/base_ldon_trap_entries_repository.h
|
repositories/base/base_ldon_trap_entries_repository.h
|
||||||
repositories/base/base_ldon_trap_templates_repository.h
|
repositories/base/base_ldon_trap_templates_repository.h
|
||||||
repositories/base/base_level_exp_mods_repository.h
|
repositories/base/base_level_exp_mods_repository.h
|
||||||
@@ -359,7 +354,6 @@ SET(repositories
|
|||||||
repositories/character_currency_repository.h
|
repositories/character_currency_repository.h
|
||||||
repositories/character_data_repository.h
|
repositories/character_data_repository.h
|
||||||
repositories/character_disciplines_repository.h
|
repositories/character_disciplines_repository.h
|
||||||
repositories/character_evolving_items_repository.h
|
|
||||||
repositories/character_expedition_lockouts_repository.h
|
repositories/character_expedition_lockouts_repository.h
|
||||||
repositories/character_exp_modifiers_repository.h
|
repositories/character_exp_modifiers_repository.h
|
||||||
repositories/character_inspect_messages_repository.h
|
repositories/character_inspect_messages_repository.h
|
||||||
@@ -428,7 +422,6 @@ SET(repositories
|
|||||||
repositories/inventory_snapshots_repository.h
|
repositories/inventory_snapshots_repository.h
|
||||||
repositories/ip_exemptions_repository.h
|
repositories/ip_exemptions_repository.h
|
||||||
repositories/items_repository.h
|
repositories/items_repository.h
|
||||||
repositories/items_evolving_details_repository.h
|
|
||||||
repositories/ldon_trap_entries_repository.h
|
repositories/ldon_trap_entries_repository.h
|
||||||
repositories/ldon_trap_templates_repository.h
|
repositories/ldon_trap_templates_repository.h
|
||||||
repositories/level_exp_mods_repository.h
|
repositories/level_exp_mods_repository.h
|
||||||
@@ -561,7 +554,6 @@ SET(common_headers
|
|||||||
events/player_event_discord_formatter.h
|
events/player_event_discord_formatter.h
|
||||||
events/player_events.h
|
events/player_events.h
|
||||||
event_sub.h
|
event_sub.h
|
||||||
evolving_items.h
|
|
||||||
expedition_lockout_timer.h
|
expedition_lockout_timer.h
|
||||||
extprofile.h
|
extprofile.h
|
||||||
faction.h
|
faction.h
|
||||||
@@ -594,7 +586,6 @@ SET(common_headers
|
|||||||
mutex.h
|
mutex.h
|
||||||
mysql_request_result.h
|
mysql_request_result.h
|
||||||
mysql_request_row.h
|
mysql_request_row.h
|
||||||
mysql_stmt.h
|
|
||||||
op_codes.h
|
op_codes.h
|
||||||
opcode_dispatch.h
|
opcode_dispatch.h
|
||||||
opcodemgr.h
|
opcodemgr.h
|
||||||
|
|||||||
+8
-40
@@ -8,14 +8,13 @@ std::vector<BazaarSearchResultsFromDB_Struct>
|
|||||||
Bazaar::GetSearchResults(
|
Bazaar::GetSearchResults(
|
||||||
SharedDatabase &db,
|
SharedDatabase &db,
|
||||||
BazaarSearchCriteria_Struct search,
|
BazaarSearchCriteria_Struct search,
|
||||||
uint32 char_zone_id,
|
uint32 char_zone_id
|
||||||
int32 char_zone_instance_id
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LogTrading(
|
LogTrading(
|
||||||
"Searching for items with search criteria - item_name [{}] min_cost [{}] max_cost [{}] min_level [{}] "
|
"Searching for items with search criteria - item_name [{}] min_cost [{}] max_cost [{}] min_level [{}] "
|
||||||
"max_level [{}] max_results [{}] prestige [{}] augment [{}] trader_entity_id [{}] trader_id [{}] "
|
"max_level [{}] max_results [{}] prestige [{}] augment [{}] trader_entity_id [{}] trader_id [{}] "
|
||||||
"search_scope [{}] char_zone_id [{}], char_zone_instance_id [{}]",
|
"search_scope [{}] char_zone_id [{}]",
|
||||||
search.item_name,
|
search.item_name,
|
||||||
search.min_cost,
|
search.min_cost,
|
||||||
search.max_cost,
|
search.max_cost,
|
||||||
@@ -27,49 +26,26 @@ Bazaar::GetSearchResults(
|
|||||||
search.trader_entity_id,
|
search.trader_entity_id,
|
||||||
search.trader_id,
|
search.trader_id,
|
||||||
search.search_scope,
|
search.search_scope,
|
||||||
char_zone_id,
|
char_zone_id
|
||||||
char_zone_instance_id
|
|
||||||
);
|
);
|
||||||
|
|
||||||
bool convert = false;
|
|
||||||
std::string search_criteria_trader("TRUE ");
|
std::string search_criteria_trader("TRUE ");
|
||||||
|
|
||||||
if (search.search_scope == NonRoFBazaarSearchScope) {
|
if (search.search_scope == NonRoFBazaarSearchScope) {
|
||||||
search_criteria_trader.append(
|
search_criteria_trader.append(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
" AND trader.char_entity_id = {} AND trader.char_zone_id = {} AND trader.char_zone_instance_id = {}",
|
" AND trader.char_entity_id = {} AND trader.char_zone_id = {}",
|
||||||
search.trader_entity_id,
|
search.trader_entity_id,
|
||||||
Zones::BAZAAR,
|
Zones::BAZAAR
|
||||||
char_zone_instance_id
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (search.search_scope == Local_Scope) {
|
else if (search.search_scope == Local_Scope) {
|
||||||
search_criteria_trader.append(fmt::format(
|
search_criteria_trader.append(fmt::format(" AND trader.char_zone_id = {}", char_zone_id));
|
||||||
" AND trader.char_zone_id = {} AND trader.char_zone_instance_id = {}",
|
|
||||||
char_zone_id,
|
|
||||||
char_zone_instance_id)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else if (search.trader_id > 0) {
|
else if (search.trader_id > 0) {
|
||||||
if (RuleB(Bazaar, UseAlternateBazaarSearch)) {
|
|
||||||
if (search.trader_id >= TraderRepository::TRADER_CONVERT_ID) {
|
|
||||||
convert = true;
|
|
||||||
search_criteria_trader.append(fmt::format(
|
|
||||||
" AND trader.char_zone_id = {} AND trader.char_zone_instance_id = {}",
|
|
||||||
Zones::BAZAAR,
|
|
||||||
search.trader_id - TraderRepository::TRADER_CONVERT_ID)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
search_criteria_trader.append(fmt::format(" AND trader.char_id = {}", search.trader_id));
|
search_criteria_trader.append(fmt::format(" AND trader.char_id = {}", search.trader_id));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
search_criteria_trader.append(fmt::format(" AND trader.char_id = {}", search.trader_id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.min_cost != 0) {
|
if (search.min_cost != 0) {
|
||||||
search_criteria_trader.append(fmt::format(" AND trader.item_cost >= {}", search.min_cost * 1000));
|
search_criteria_trader.append(fmt::format(" AND trader.item_cost >= {}", search.min_cost * 1000));
|
||||||
}
|
}
|
||||||
@@ -86,7 +62,7 @@ Bazaar::GetSearchResults(
|
|||||||
std::string query = fmt::format(
|
std::string query = fmt::format(
|
||||||
"SELECT COUNT(item_id), trader.char_id, trader.item_id, trader.item_sn, trader.item_charges, trader.item_cost, "
|
"SELECT COUNT(item_id), trader.char_id, trader.item_id, trader.item_sn, trader.item_charges, trader.item_cost, "
|
||||||
"trader.slot_id, SUM(trader.item_charges), trader.char_zone_id, trader.char_entity_id, character_data.name, "
|
"trader.slot_id, SUM(trader.item_charges), trader.char_zone_id, trader.char_entity_id, character_data.name, "
|
||||||
"aug_slot_1, aug_slot_2, aug_slot_3, aug_slot_4, aug_slot_5, aug_slot_6, trader.char_zone_instance_id "
|
"aug_slot_1, aug_slot_2, aug_slot_3, aug_slot_4, aug_slot_5, aug_slot_6 "
|
||||||
"FROM trader, character_data "
|
"FROM trader, character_data "
|
||||||
"WHERE {} AND trader.char_id = character_data.id "
|
"WHERE {} AND trader.char_id = character_data.id "
|
||||||
"GROUP BY trader.item_sn, trader.item_charges, trader.char_id",
|
"GROUP BY trader.item_sn, trader.item_charges, trader.char_id",
|
||||||
@@ -155,7 +131,6 @@ Bazaar::GetSearchResults(
|
|||||||
r.stackable = item->Stackable;
|
r.stackable = item->Stackable;
|
||||||
r.icon_id = item->Icon;
|
r.icon_id = item->Icon;
|
||||||
r.trader_zone_id = Strings::ToInt(row[8]);
|
r.trader_zone_id = Strings::ToInt(row[8]);
|
||||||
r.trader_zone_instance_id = Strings::ToInt(row[17]);
|
|
||||||
r.trader_entity_id = Strings::ToInt(row[9]);
|
r.trader_entity_id = Strings::ToInt(row[9]);
|
||||||
r.serial_number_RoF = fmt::format("{:016}\0", Strings::ToInt(row[3]));
|
r.serial_number_RoF = fmt::format("{:016}\0", Strings::ToInt(row[3]));
|
||||||
r.item_name = fmt::format("{:.63}\0", item->Name);
|
r.item_name = fmt::format("{:.63}\0", item->Name);
|
||||||
@@ -260,8 +235,7 @@ Bazaar::GetSearchResults(
|
|||||||
std::vector<ItemSearchType> item_search_types = {
|
std::vector<ItemSearchType> item_search_types = {
|
||||||
{EQ::item::ItemType::ItemTypeAll, true},
|
{EQ::item::ItemType::ItemTypeAll, true},
|
||||||
{EQ::item::ItemType::ItemTypeBook, item->ItemClass == EQ::item::ItemType::ItemTypeBook},
|
{EQ::item::ItemType::ItemTypeBook, item->ItemClass == EQ::item::ItemType::ItemTypeBook},
|
||||||
{EQ::item::ItemType::ItemTypeContainer, item->ItemClass == EQ::item::ItemType::ItemTypeContainer ||
|
{EQ::item::ItemType::ItemTypeContainer, item->ItemClass == EQ::item::ItemType::ItemTypeContainer},
|
||||||
item->IsClassBag()},
|
|
||||||
{EQ::item::ItemType::ItemTypeAllEffects, item->Scroll.Effect > 0 && item->Scroll.Effect < 65000},
|
{EQ::item::ItemType::ItemTypeAllEffects, item->Scroll.Effect > 0 && item->Scroll.Effect < 65000},
|
||||||
{EQ::item::ItemType::ItemTypeUnknown9, item->Worn.Effect == 998},
|
{EQ::item::ItemType::ItemTypeUnknown9, item->Worn.Effect == 998},
|
||||||
{EQ::item::ItemType::ItemTypeUnknown10, item->Worn.Effect >= 1298 && item->Worn.Effect <= 1307},
|
{EQ::item::ItemType::ItemTypeUnknown10, item->Worn.Effect >= 1298 && item->Worn.Effect <= 1307},
|
||||||
@@ -372,12 +346,6 @@ Bazaar::GetSearchResults(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogTradingDetail("Found item [{}] meeting search criteria.", r.item_name);
|
LogTradingDetail("Found item [{}] meeting search criteria.", r.item_name);
|
||||||
if (RuleB(Bazaar, UseAlternateBazaarSearch)) {
|
|
||||||
if (convert || (r.trader_zone_id == Zones::BAZAAR && r.trader_zone_instance_id != char_zone_instance_id)) {
|
|
||||||
r.trader_id = TraderRepository::TRADER_CONVERT_ID + r.trader_zone_instance_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
all_entries.push_back(r);
|
all_entries.push_back(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
class Bazaar {
|
class Bazaar {
|
||||||
public:
|
public:
|
||||||
static std::vector<BazaarSearchResultsFromDB_Struct>
|
static std::vector<BazaarSearchResultsFromDB_Struct>
|
||||||
GetSearchResults(SharedDatabase &db, BazaarSearchCriteria_Struct search, unsigned int char_zone_id, int char_zone_instance_id);
|
GetSearchResults(SharedDatabase &db, BazaarSearchCriteria_Struct search, unsigned int char_zone_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -294,8 +294,6 @@ void print_trace()
|
|||||||
SendCrashReport(crash_report);
|
SendCrashReport(crash_report);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-56
@@ -50,7 +50,6 @@
|
|||||||
#include "../common/repositories/raid_members_repository.h"
|
#include "../common/repositories/raid_members_repository.h"
|
||||||
#include "../common/repositories/reports_repository.h"
|
#include "../common/repositories/reports_repository.h"
|
||||||
#include "../common/repositories/variables_repository.h"
|
#include "../common/repositories/variables_repository.h"
|
||||||
#include "../common/repositories/character_pet_name_repository.h"
|
|
||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
|
|
||||||
// Disgrace: for windows compile
|
// Disgrace: for windows compile
|
||||||
@@ -314,12 +313,6 @@ bool Database::ReserveName(uint32 account_id, const std::string& name)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& p = CharacterPetNameRepository::GetWhere(*this, where_filter);
|
|
||||||
if (!p.empty()) {
|
|
||||||
LogInfo("Account [{}] requested name [{}] but name is already taken by an Pet", account_id, name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto e = CharacterDataRepository::NewEntity();
|
auto e = CharacterDataRepository::NewEntity();
|
||||||
|
|
||||||
e.account_id = account_id;
|
e.account_id = account_id;
|
||||||
@@ -521,6 +514,12 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
|||||||
c.raid_auto_consent = pp->raidAutoconsent;
|
c.raid_auto_consent = pp->raidAutoconsent;
|
||||||
c.guild_auto_consent = pp->guildAutoconsent;
|
c.guild_auto_consent = pp->guildAutoconsent;
|
||||||
c.RestTimer = pp->RestTimer;
|
c.RestTimer = pp->RestTimer;
|
||||||
|
c.cold_resist = pp->cold_resist;
|
||||||
|
c.fire_resist = pp->fire_resist;
|
||||||
|
c.magic_resist = pp->magic_resist;
|
||||||
|
c.disease_resist = pp->disease_resist;
|
||||||
|
c.poison_resist = pp->poison_resist;
|
||||||
|
c.corruption_resist = pp->corruption_resist;
|
||||||
|
|
||||||
CharacterDataRepository::ReplaceOne(*this, c);
|
CharacterDataRepository::ReplaceOne(*this, c);
|
||||||
|
|
||||||
@@ -1867,35 +1866,7 @@ bool Database::CopyCharacter(
|
|||||||
|
|
||||||
const int64 new_character_id = (CharacterDataRepository::GetMaxId(*this) + 1);
|
const int64 new_character_id = (CharacterDataRepository::GetMaxId(*this) + 1);
|
||||||
|
|
||||||
// validate destination name doesn't exist already
|
std::vector<std::string> tables_to_zero_id = { "keyring", "data_buckets", "character_instance_safereturns" };
|
||||||
const auto& destination_characters = CharacterDataRepository::GetWhere(
|
|
||||||
*this,
|
|
||||||
fmt::format(
|
|
||||||
"`name` = '{}' AND `deleted_at` IS NULL LIMIT 1",
|
|
||||||
Strings::Escape(destination_character_name)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (!destination_characters.empty()) {
|
|
||||||
LogError("Character [{}] already exists", destination_character_name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> tables_to_zero_id = {
|
|
||||||
"keyring",
|
|
||||||
"data_buckets",
|
|
||||||
"character_instance_safereturns",
|
|
||||||
"character_expedition_lockouts",
|
|
||||||
"character_instance_lockouts",
|
|
||||||
"character_parcels",
|
|
||||||
"character_tribute",
|
|
||||||
"player_titlesets",
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<std::string> ignore_tables = {
|
|
||||||
"guilds",
|
|
||||||
};
|
|
||||||
|
|
||||||
size_t total_rows_copied = 0;
|
|
||||||
|
|
||||||
TransactionBegin();
|
TransactionBegin();
|
||||||
|
|
||||||
@@ -1903,10 +1874,6 @@ bool Database::CopyCharacter(
|
|||||||
const std::string& table_name = t.first;
|
const std::string& table_name = t.first;
|
||||||
const std::string& character_id_column_name = t.second;
|
const std::string& character_id_column_name = t.second;
|
||||||
|
|
||||||
if (Strings::Contains(ignore_tables, table_name)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto results = QueryDatabase(
|
auto results = QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"SHOW COLUMNS FROM {}",
|
"SHOW COLUMNS FROM {}",
|
||||||
@@ -1957,10 +1924,6 @@ bool Database::CopyCharacter(
|
|||||||
value = std::to_string(destination_account_id);
|
value = std::to_string(destination_account_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Strings::IsNumber(value)) {
|
|
||||||
value = Strings::Escape(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
new_values.emplace_back(value);
|
new_values.emplace_back(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1993,11 +1956,6 @@ bool Database::CopyCharacter(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
size_t rows_copied = insert_rows.size(); // Rows copied for this table
|
|
||||||
total_rows_copied += rows_copied; // Increment grand total
|
|
||||||
|
|
||||||
LogInfo("Copying table [{}] rows [{}]", table_name, Strings::Commify(rows_copied));
|
|
||||||
|
|
||||||
if (!insert.ErrorMessage().empty()) {
|
if (!insert.ErrorMessage().empty()) {
|
||||||
TransactionRollback();
|
TransactionRollback();
|
||||||
return false;
|
return false;
|
||||||
@@ -2007,13 +1965,6 @@ bool Database::CopyCharacter(
|
|||||||
|
|
||||||
TransactionCommit();
|
TransactionCommit();
|
||||||
|
|
||||||
LogInfo(
|
|
||||||
"Character [{}] copied to [{}] total rows [{}]",
|
|
||||||
source_character_name,
|
|
||||||
destination_character_name,
|
|
||||||
Strings::Commify(total_rows_copied)
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,10 +169,7 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
LogSys.EnableMySQLErrorLogs();
|
LogSys.EnableMySQLErrorLogs();
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
|
|
||||||
if (!missing_migrations.empty() && m_skip_backup) {
|
if (!missing_migrations.empty()) {
|
||||||
LogInfo("Skipping database backup");
|
|
||||||
}
|
|
||||||
else if (!missing_migrations.empty()) {
|
|
||||||
LogInfo("Automatically backing up database before applying updates");
|
LogInfo("Automatically backing up database before applying updates");
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
auto s = DatabaseDumpService();
|
auto s = DatabaseDumpService();
|
||||||
@@ -274,13 +271,6 @@ DatabaseUpdate *DatabaseUpdate::SetContentDatabase(Database *db)
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseUpdate *DatabaseUpdate::SetSkipBackup(bool skip)
|
|
||||||
{
|
|
||||||
m_skip_backup = skip;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DatabaseUpdate::CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b)
|
bool DatabaseUpdate::CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b)
|
||||||
{
|
{
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
|
|||||||
@@ -29,15 +29,12 @@ public:
|
|||||||
|
|
||||||
DatabaseUpdate *SetDatabase(Database *db);
|
DatabaseUpdate *SetDatabase(Database *db);
|
||||||
DatabaseUpdate *SetContentDatabase(Database *db);
|
DatabaseUpdate *SetContentDatabase(Database *db);
|
||||||
DatabaseUpdate *SetSkipBackup(bool skip);
|
|
||||||
bool HasPendingUpdates();
|
bool HasPendingUpdates();
|
||||||
private:
|
private:
|
||||||
bool m_skip_backup = false;
|
|
||||||
Database *m_database;
|
Database *m_database;
|
||||||
Database *m_content_database;
|
Database *m_content_database;
|
||||||
static bool CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b);
|
static bool CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b);
|
||||||
void InjectBotsVersionColumn();
|
void InjectBotsVersionColumn();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_DATABASE_UPDATE_H
|
#endif //EQEMU_DATABASE_UPDATE_H
|
||||||
|
|||||||
@@ -5759,580 +5759,7 @@ ALTER TABLE `character_exp_modifiers`
|
|||||||
MODIFY COLUMN `aa_modifier` float NOT NULL DEFAULT 1.0 AFTER `instance_version`,
|
MODIFY COLUMN `aa_modifier` float NOT NULL DEFAULT 1.0 AFTER `instance_version`,
|
||||||
MODIFY COLUMN `exp_modifier` float NOT NULL DEFAULT 1.0 AFTER `aa_modifier`;
|
MODIFY COLUMN `exp_modifier` float NOT NULL DEFAULT 1.0 AFTER `aa_modifier`;
|
||||||
)"
|
)"
|
||||||
},
|
}
|
||||||
ManifestEntry{
|
|
||||||
.version = 9285,
|
|
||||||
.description = "2024_11_08_data_buckets_indexes.sql",
|
|
||||||
.check = "SHOW CREATE TABLE `data_buckets`",
|
|
||||||
.condition = "missing",
|
|
||||||
.match = "idx_character_expires",
|
|
||||||
.sql = R"(
|
|
||||||
CREATE INDEX idx_character_expires ON data_buckets (character_id, expires);
|
|
||||||
CREATE INDEX idx_npc_expires ON data_buckets (npc_id, expires);
|
|
||||||
CREATE INDEX idx_bot_expires ON data_buckets (bot_id, expires);
|
|
||||||
)"
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9286,
|
|
||||||
.description = "2024_11_26_bazaar_find_trader.sql",
|
|
||||||
.check = "SHOW COLUMNS FROM `trader` LIKE 'char_zone_instance_id'",
|
|
||||||
.condition = "empty",
|
|
||||||
.match = "",
|
|
||||||
.sql = R"(
|
|
||||||
ALTER TABLE `trader`
|
|
||||||
ADD COLUMN `char_zone_instance_id` INT NULL DEFAULT '0' AFTER `char_zone_id`;
|
|
||||||
)"
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9287,
|
|
||||||
.description = "2024_11_26_bazaar_find_trader.sql",
|
|
||||||
.check = "SHOW COLUMNS FROM `npc_types` LIKE 'walkspeed'",
|
|
||||||
.condition = "missing",
|
|
||||||
.match = "float",
|
|
||||||
.sql = R"(
|
|
||||||
ALTER TABLE `npc_types` MODIFY COLUMN `walkspeed` float NOT NULL DEFAULT 0;
|
|
||||||
)",
|
|
||||||
.content_schema_update = true
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9288,
|
|
||||||
.description = "2024_11_10_zone_player_partitioning.sql",
|
|
||||||
.check = "SHOW CREATE TABLE `zone`",
|
|
||||||
.condition = "missing",
|
|
||||||
.match = "shard_at_player_count",
|
|
||||||
.sql = R"(
|
|
||||||
ALTER TABLE `zone`
|
|
||||||
ADD COLUMN `shard_at_player_count` int(11) NULL DEFAULT 0 AFTER `seconds_before_idle`;
|
|
||||||
)",
|
|
||||||
.content_schema_update = true
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9289,
|
|
||||||
.description = "2025_01_19_evolving_items__character_evolving_items",
|
|
||||||
.check = "SHOW TABLES LIKE 'character_evolving_items'",
|
|
||||||
.condition = "empty",
|
|
||||||
.match = "",
|
|
||||||
.sql = R"(
|
|
||||||
CREATE TABLE `character_evolving_items` (
|
|
||||||
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
||||||
`character_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
|
||||||
`item_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
|
||||||
`activated` TINYINT(1) UNSIGNED NULL DEFAULT '0',
|
|
||||||
`equipped` TINYINT(3) UNSIGNED NULL DEFAULT '0',
|
|
||||||
`current_amount` BIGINT(20) NULL DEFAULT '0',
|
|
||||||
`progression` DOUBLE(22,0) NULL DEFAULT '0',
|
|
||||||
`final_item_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
|
||||||
`deleted_at` DATETIME NULL DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
)
|
|
||||||
COLLATE='latin1_swedish_ci'
|
|
||||||
ENGINE=InnoDB
|
|
||||||
AUTO_INCREMENT=1
|
|
||||||
;
|
|
||||||
)"
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9290,
|
|
||||||
.description = "2025_01_19_evolving_items__items_evolving_details",
|
|
||||||
.check = "SHOW TABLES LIKE 'items_evolving_details'",
|
|
||||||
.condition = "empty",
|
|
||||||
.match = "",
|
|
||||||
.sql = R"(
|
|
||||||
CREATE TABLE `items_evolving_details` (
|
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`item_evo_id` int(10) unsigned DEFAULT 0 COMMENT 'items.evoid',
|
|
||||||
`item_evolve_level` int(10) unsigned DEFAULT 0 COMMENT 'items.evolvinglevel',
|
|
||||||
`item_id` int(10) unsigned DEFAULT 0 COMMENT 'items.id',
|
|
||||||
`type` int(10) unsigned DEFAULT 0,
|
|
||||||
`sub_type` int(10) unsigned DEFAULT 0,
|
|
||||||
`required_amount` bigint(20) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
|
|
||||||
INSERT INTO `items_evolving_details` VALUES
|
|
||||||
(1,1000,1,86900,99,1,0),
|
|
||||||
(2,1000,2,86901,99,1,0),
|
|
||||||
(3,1000,3,86902,99,1,0),
|
|
||||||
(4,1000,4,86903,99,1,0),
|
|
||||||
(5,1000,5,86904,99,1,0),
|
|
||||||
(6,1001,1,86910,99,1,0),
|
|
||||||
(7,1001,2,86911,99,1,0),
|
|
||||||
(8,1001,3,86912,99,1,0),
|
|
||||||
(9,1001,4,86913,99,1,0),
|
|
||||||
(10,1001,5,86914,99,1,0),
|
|
||||||
(11,1001,6,86915,99,1,0),
|
|
||||||
(12,1001,7,86916,99,1,0),
|
|
||||||
(13,1002,1,86920,99,1,0),
|
|
||||||
(14,1002,2,86921,99,1,0),
|
|
||||||
(15,1002,3,86922,99,1,0),
|
|
||||||
(16,1002,4,86923,99,1,0),
|
|
||||||
(17,1002,5,86924,99,1,0),
|
|
||||||
(18,1002,6,86925,99,1,0),
|
|
||||||
(19,1002,7,86926,99,1,0),
|
|
||||||
(20,1003,1,86930,99,1,0),
|
|
||||||
(21,1003,2,86931,99,1,0),
|
|
||||||
(22,1003,3,86932,99,1,0),
|
|
||||||
(23,1003,4,86933,99,1,0),
|
|
||||||
(24,1003,5,86934,99,1,0),
|
|
||||||
(25,1003,6,86935,99,1,0),
|
|
||||||
(26,1004,1,86940,99,1,0),
|
|
||||||
(27,1004,2,86941,99,1,0),
|
|
||||||
(28,1004,3,86942,99,1,0),
|
|
||||||
(29,1004,4,86943,99,1,0),
|
|
||||||
(30,1004,5,86944,99,1,0),
|
|
||||||
(31,1004,6,86945,99,1,0),
|
|
||||||
(32,1005,1,86950,99,1,0),
|
|
||||||
(33,1005,2,86951,99,1,0),
|
|
||||||
(34,1005,3,86952,99,1,0),
|
|
||||||
(35,1005,4,86953,99,1,0),
|
|
||||||
(36,1005,5,86954,99,1,0),
|
|
||||||
(37,1005,6,86955,99,1,0),
|
|
||||||
(38,1005,7,86956,99,1,0),
|
|
||||||
(39,1006,1,86960,99,1,0),
|
|
||||||
(40,1006,2,86961,99,1,0),
|
|
||||||
(41,1006,3,86962,99,1,0),
|
|
||||||
(42,1006,4,86963,99,1,0),
|
|
||||||
(43,1006,5,86964,99,1,0),
|
|
||||||
(44,1006,6,86965,99,1,0),
|
|
||||||
(45,1006,7,86966,99,1,0),
|
|
||||||
(46,1007,1,86970,99,1,0),
|
|
||||||
(47,1007,2,86971,99,1,0),
|
|
||||||
(48,1007,3,86972,99,1,0),
|
|
||||||
(49,1007,4,86973,99,1,0),
|
|
||||||
(50,1007,5,86974,99,1,0),
|
|
||||||
(51,1007,6,86975,99,1,0),
|
|
||||||
(52,1007,7,86976,99,1,0),
|
|
||||||
(53,1008,1,86980,99,1,0),
|
|
||||||
(54,1008,2,86981,99,1,0),
|
|
||||||
(55,1008,3,86982,99,1,0),
|
|
||||||
(56,1008,4,86983,99,1,0),
|
|
||||||
(57,1008,5,86984,99,1,0),
|
|
||||||
(58,1009,1,86990,99,1,0),
|
|
||||||
(59,1009,2,86991,99,1,0),
|
|
||||||
(60,1009,3,86992,99,1,0),
|
|
||||||
(61,1009,4,86993,99,1,0),
|
|
||||||
(62,1009,5,86994,99,1,0),
|
|
||||||
(63,1009,6,86995,99,1,0),
|
|
||||||
(64,1009,7,86996,99,1,0),
|
|
||||||
(65,1009,8,86997,99,1,0),
|
|
||||||
(66,1009,9,86998,99,1,0),
|
|
||||||
(67,1009,10,86999,99,1,0),
|
|
||||||
(68,1010,1,90001,99,1,0),
|
|
||||||
(69,1010,2,90002,99,1,0),
|
|
||||||
(70,1010,3,90003,99,1,0),
|
|
||||||
(71,1010,6,90006,99,1,0),
|
|
||||||
(72,1010,7,90007,99,1,0),
|
|
||||||
(73,1010,8,90008,99,1,0),
|
|
||||||
(74,1010,10,90010,99,1,0),
|
|
||||||
(75,1050,1,89270,99,1,0),
|
|
||||||
(76,1050,2,89271,99,1,0),
|
|
||||||
(77,1050,3,89272,99,1,0),
|
|
||||||
(78,1050,4,89273,99,1,0),
|
|
||||||
(79,1050,5,89274,99,1,0),
|
|
||||||
(80,1050,6,89275,99,1,0),
|
|
||||||
(81,1051,1,89280,99,1,0),
|
|
||||||
(82,1051,2,89281,99,1,0),
|
|
||||||
(83,1051,3,89282,99,1,0),
|
|
||||||
(84,1051,4,89283,99,1,0),
|
|
||||||
(85,1051,5,89284,99,1,0),
|
|
||||||
(86,1052,1,89290,99,1,0),
|
|
||||||
(87,1052,2,89291,99,1,0),
|
|
||||||
(88,1052,3,89292,99,1,0),
|
|
||||||
(89,1052,4,89293,99,1,0),
|
|
||||||
(90,1052,5,89294,99,1,0),
|
|
||||||
(91,1052,6,89295,99,1,0),
|
|
||||||
(92,1052,7,89296,99,1,0),
|
|
||||||
(93,1053,1,89300,99,1,0),
|
|
||||||
(94,1053,2,89301,99,1,0),
|
|
||||||
(95,1053,3,89302,99,1,0),
|
|
||||||
(96,1053,4,89303,99,1,0),
|
|
||||||
(97,1053,5,89304,99,1,0),
|
|
||||||
(98,1053,6,89305,99,1,0),
|
|
||||||
(99,1053,7,89306,99,1,0),
|
|
||||||
(100,1053,8,89307,99,1,0),
|
|
||||||
(101,1053,9,89308,99,1,0),
|
|
||||||
(102,1054,1,89310,99,1,0),
|
|
||||||
(103,1054,2,89311,99,1,0),
|
|
||||||
(104,1054,3,89312,99,1,0),
|
|
||||||
(105,1054,4,89313,99,1,0),
|
|
||||||
(106,1054,5,89314,99,1,0),
|
|
||||||
(107,1054,6,89315,99,1,0),
|
|
||||||
(108,1055,1,89320,99,1,0),
|
|
||||||
(109,1055,2,89321,99,1,0),
|
|
||||||
(110,1055,3,89322,99,1,0),
|
|
||||||
(111,1055,4,89323,99,1,0),
|
|
||||||
(112,1055,5,89324,99,1,0),
|
|
||||||
(113,1055,6,89325,99,1,0),
|
|
||||||
(114,1055,7,89326,99,1,0),
|
|
||||||
(115,1056,1,89330,99,1,0),
|
|
||||||
(116,1056,2,89331,99,1,0),
|
|
||||||
(117,1056,3,89332,99,1,0),
|
|
||||||
(118,1056,4,89333,99,1,0),
|
|
||||||
(119,1056,5,89334,99,1,0),
|
|
||||||
(120,1057,1,89340,99,1,0),
|
|
||||||
(121,1057,2,89341,99,1,0),
|
|
||||||
(122,1057,3,89342,99,1,0),
|
|
||||||
(123,1057,4,89343,99,1,0),
|
|
||||||
(124,1057,5,89344,99,1,0),
|
|
||||||
(125,1057,6,89345,99,1,0),
|
|
||||||
(126,1057,7,89346,99,1,0),
|
|
||||||
(127,1057,8,89347,99,1,0),
|
|
||||||
(128,1058,1,89350,99,1,0),
|
|
||||||
(129,1058,2,89351,99,1,0),
|
|
||||||
(130,1058,3,89352,99,1,0),
|
|
||||||
(131,1058,4,89353,99,1,0),
|
|
||||||
(132,1058,5,89354,99,1,0),
|
|
||||||
(133,1058,6,89355,99,1,0),
|
|
||||||
(134,1058,7,89356,99,1,0),
|
|
||||||
(135,1059,1,89360,99,1,0),
|
|
||||||
(136,1059,2,89361,99,1,0),
|
|
||||||
(137,1059,3,89362,99,1,0),
|
|
||||||
(138,1060,1,89490,99,1,0),
|
|
||||||
(139,1060,2,89491,99,1,0),
|
|
||||||
(140,1060,3,89492,99,1,0),
|
|
||||||
(141,1061,1,89500,99,1,0),
|
|
||||||
(142,1061,2,89501,99,1,0),
|
|
||||||
(143,1061,3,89502,99,1,0),
|
|
||||||
(144,1062,1,89510,99,1,0),
|
|
||||||
(145,1062,2,89511,99,1,0),
|
|
||||||
(146,1062,3,89512,99,1,0),
|
|
||||||
(147,1063,1,89520,99,1,0),
|
|
||||||
(148,1063,2,89521,99,1,0),
|
|
||||||
(149,1063,3,89522,99,1,0),
|
|
||||||
(150,1064,1,89530,99,1,0),
|
|
||||||
(151,1064,2,89531,99,1,0),
|
|
||||||
(152,1064,3,89532,99,1,0),
|
|
||||||
(153,1065,1,89540,99,1,0),
|
|
||||||
(154,1065,2,89541,99,1,0),
|
|
||||||
(155,1065,3,89542,99,1,0),
|
|
||||||
(156,1066,1,89550,3,274,500),
|
|
||||||
(157,1066,2,89551,3,274,1000),
|
|
||||||
(158,1066,3,89552,3,274,2000),
|
|
||||||
(159,1067,1,89560,99,1,0),
|
|
||||||
(160,1067,2,89561,99,1,0),
|
|
||||||
(161,1067,3,89562,99,1,0),
|
|
||||||
(162,1069,1,85571,99,1,0),
|
|
||||||
(163,1069,2,85572,99,1,0),
|
|
||||||
(164,1069,3,85573,99,1,0),
|
|
||||||
(165,1200,1,95001,99,1,0),
|
|
||||||
(166,1200,2,95002,99,1,0),
|
|
||||||
(167,1200,3,95003,99,1,0),
|
|
||||||
(168,1200,4,95004,99,1,0),
|
|
||||||
(169,1200,5,95005,99,1,0),
|
|
||||||
(170,1200,6,95006,99,1,0),
|
|
||||||
(171,1200,7,95007,99,1,0),
|
|
||||||
(172,1201,1,95008,99,1,0),
|
|
||||||
(173,1201,2,95009,99,1,0),
|
|
||||||
(174,1201,3,95010,99,1,0),
|
|
||||||
(175,1201,4,95011,99,1,0),
|
|
||||||
(176,1201,5,95012,99,1,0),
|
|
||||||
(177,1201,6,95013,99,1,0),
|
|
||||||
(178,1201,7,95014,99,1,0),
|
|
||||||
(179,1202,1,95015,99,1,0),
|
|
||||||
(180,1202,2,95016,99,1,0),
|
|
||||||
(181,1202,3,95017,99,1,0),
|
|
||||||
(182,1202,4,95018,99,1,0),
|
|
||||||
(183,1202,5,95019,99,1,0),
|
|
||||||
(184,1202,6,95020,99,1,0),
|
|
||||||
(185,1202,7,95021,99,1,0),
|
|
||||||
(186,1203,1,95022,99,1,0),
|
|
||||||
(187,1203,2,95023,99,1,0),
|
|
||||||
(188,1203,3,95024,99,1,0),
|
|
||||||
(189,1203,4,95025,99,1,0),
|
|
||||||
(190,1203,5,95026,99,1,0),
|
|
||||||
(191,1203,6,95027,99,1,0),
|
|
||||||
(192,1203,7,95028,99,1,0),
|
|
||||||
(193,1204,1,95029,99,1,0),
|
|
||||||
(194,1204,2,95030,99,1,0),
|
|
||||||
(195,1204,3,95031,99,1,0),
|
|
||||||
(196,1204,4,95032,99,1,0),
|
|
||||||
(197,1204,5,95033,99,1,0),
|
|
||||||
(198,1204,6,95034,99,1,0),
|
|
||||||
(199,1204,7,95035,99,1,0),
|
|
||||||
(200,1205,1,95036,99,1,0),
|
|
||||||
(201,1205,2,95037,99,1,0),
|
|
||||||
(202,1205,3,95038,99,1,0),
|
|
||||||
(203,1205,4,95039,99,1,0),
|
|
||||||
(204,1205,5,95040,99,1,0),
|
|
||||||
(205,1205,6,95041,99,1,0),
|
|
||||||
(206,1205,7,95042,99,1,0),
|
|
||||||
(207,1206,1,95043,99,1,0),
|
|
||||||
(208,1206,2,95044,99,1,0),
|
|
||||||
(209,1206,3,95045,99,1,0),
|
|
||||||
(210,1206,4,95046,99,1,0),
|
|
||||||
(211,1206,5,95047,99,1,0),
|
|
||||||
(212,1206,6,95048,99,1,0),
|
|
||||||
(213,1206,7,95049,99,1,0),
|
|
||||||
(214,1207,1,95050,99,1,0),
|
|
||||||
(215,1207,2,95051,99,1,0),
|
|
||||||
(216,1207,3,95052,99,1,0),
|
|
||||||
(217,1207,4,95053,99,1,0),
|
|
||||||
(218,1207,5,95054,99,1,0),
|
|
||||||
(219,1207,6,95055,99,1,0),
|
|
||||||
(220,1207,7,95056,99,1,0),
|
|
||||||
(221,1208,1,95057,99,1,0),
|
|
||||||
(222,1208,2,95058,99,1,0),
|
|
||||||
(223,1208,3,95059,99,1,0),
|
|
||||||
(224,1208,4,95060,99,1,0),
|
|
||||||
(225,1208,5,95061,99,1,0),
|
|
||||||
(226,1208,6,95062,99,1,0),
|
|
||||||
(227,1208,7,95063,99,1,0),
|
|
||||||
(228,1209,1,95064,99,1,0),
|
|
||||||
(229,1209,2,95065,99,1,0),
|
|
||||||
(230,1209,3,95066,99,1,0),
|
|
||||||
(231,1209,4,95067,99,1,0),
|
|
||||||
(232,1209,5,95068,99,1,0),
|
|
||||||
(233,1209,6,95069,99,1,0),
|
|
||||||
(234,1209,7,95070,99,1,0),
|
|
||||||
(235,1210,1,95071,99,1,0),
|
|
||||||
(236,1210,2,95072,99,1,0),
|
|
||||||
(237,1210,3,95073,99,1,0),
|
|
||||||
(238,1210,4,95074,99,1,0),
|
|
||||||
(239,1210,5,95075,99,1,0),
|
|
||||||
(240,1210,6,95076,99,1,0),
|
|
||||||
(241,1210,7,95077,99,1,0),
|
|
||||||
(242,1211,1,85612,1,1,100000),
|
|
||||||
(243,1211,2,85613,1,1,200000),
|
|
||||||
(244,1211,3,85614,1,1,300000),
|
|
||||||
(245,1214,1,80035,99,1,0),
|
|
||||||
(246,1301,1,102700,99,1,0),
|
|
||||||
(247,1301,4,102703,99,1,0),
|
|
||||||
(248,1302,1,102704,99,1,0),
|
|
||||||
(249,1302,2,102705,99,1,0),
|
|
||||||
(250,1303,1,102706,99,1,0),
|
|
||||||
(251,1303,2,102707,99,1,0),
|
|
||||||
(252,1303,3,102708,99,1,0),
|
|
||||||
(253,1304,1,102709,99,1,0),
|
|
||||||
(254,1304,5,102713,99,1,0),
|
|
||||||
(255,1305,1,102714,99,1,0),
|
|
||||||
(256,1306,1,102716,99,1,0),
|
|
||||||
(257,1306,5,102720,99,1,0),
|
|
||||||
(258,1307,1,102721,99,1,0),
|
|
||||||
(259,1307,3,102723,99,1,0),
|
|
||||||
(260,1308,1,102724,99,1,0),
|
|
||||||
(261,1309,1,102727,99,1,0),
|
|
||||||
(262,1309,2,102728,99,1,0),
|
|
||||||
(263,1310,1,102729,99,1,0),
|
|
||||||
(264,1310,3,102731,99,1,0),
|
|
||||||
(265,1311,1,102732,99,1,0),
|
|
||||||
(266,1311,4,102735,99,1,0),
|
|
||||||
(267,1312,1,102736,99,1,0),
|
|
||||||
(268,1312,3,102738,99,1,0),
|
|
||||||
(269,1313,1,102739,99,1,0),
|
|
||||||
(270,1314,1,102743,99,1,0),
|
|
||||||
(271,1314,2,102744,99,1,0),
|
|
||||||
(272,1314,3,102745,99,1,0),
|
|
||||||
(273,1315,1,102746,99,1,0),
|
|
||||||
(274,1315,2,102747,99,1,0),
|
|
||||||
(275,1316,1,102748,99,1,0),
|
|
||||||
(276,1316,5,102752,99,1,0),
|
|
||||||
(277,1317,1,102753,99,1,0),
|
|
||||||
(278,1318,1,102756,99,1,0),
|
|
||||||
(279,1319,1,102759,99,1,0),
|
|
||||||
(280,1319,3,102761,99,1,0),
|
|
||||||
(281,1320,1,102762,99,1,0),
|
|
||||||
(282,1321,1,102765,99,1,0),
|
|
||||||
(283,1321,2,102766,99,1,0),
|
|
||||||
(284,1321,3,102767,99,1,0),
|
|
||||||
(285,1322,1,102768,99,1,0),
|
|
||||||
(286,1322,2,102769,99,1,0),
|
|
||||||
(287,1322,3,102770,99,1,0),
|
|
||||||
(288,1323,1,102771,99,1,0),
|
|
||||||
(289,1324,1,102774,99,1,0),
|
|
||||||
(290,1400,1,102800,99,1,0),
|
|
||||||
(291,1401,1,102807,99,1,0),
|
|
||||||
(292,1401,7,102813,99,1,0),
|
|
||||||
(293,1402,1,102814,99,1,0),
|
|
||||||
(294,1402,7,102820,99,1,0),
|
|
||||||
(295,1403,1,102821,99,1,0),
|
|
||||||
(296,1404,1,102828,99,1,0),
|
|
||||||
(297,1405,1,102835,99,1,0),
|
|
||||||
(298,1406,1,102842,99,1,0),
|
|
||||||
(299,1408,1,109310,99,1,0),
|
|
||||||
(300,1408,5,109314,99,1,0),
|
|
||||||
(301,1409,1,109315,99,1,0),
|
|
||||||
(302,1409,5,109319,99,1,0),
|
|
||||||
(303,1410,1,109320,99,1,0),
|
|
||||||
(304,1410,5,109324,99,1,0),
|
|
||||||
(305,1411,1,109325,99,1,0),
|
|
||||||
(306,1411,5,109329,99,1,0),
|
|
||||||
(307,1412,1,109330,99,1,0),
|
|
||||||
(308,1412,5,109334,99,1,0),
|
|
||||||
(309,1413,1,109335,99,1,0),
|
|
||||||
(310,1413,5,109339,99,1,0),
|
|
||||||
(311,1414,1,109340,99,1,0),
|
|
||||||
(312,1414,5,109344,99,1,0),
|
|
||||||
(313,1415,1,109345,99,1,0),
|
|
||||||
(314,1415,5,109349,99,1,0),
|
|
||||||
(315,1416,1,109350,99,1,0),
|
|
||||||
(316,1416,2,109351,99,1,0),
|
|
||||||
(317,1416,5,109354,99,1,0),
|
|
||||||
(318,1417,1,109355,99,1,0),
|
|
||||||
(319,1417,5,109359,99,1,0),
|
|
||||||
(320,1418,1,109360,99,1,0),
|
|
||||||
(321,1418,5,109364,99,1,0),
|
|
||||||
(322,1419,1,109365,99,1,0),
|
|
||||||
(323,1419,3,109367,99,1,0),
|
|
||||||
(324,1419,5,109369,99,1,0),
|
|
||||||
(325,1420,1,109370,99,1,0),
|
|
||||||
(326,1420,5,109374,99,1,0),
|
|
||||||
(327,1421,1,109375,99,1,0),
|
|
||||||
(328,1421,5,109379,99,1,0),
|
|
||||||
(329,1422,1,109380,99,1,0),
|
|
||||||
(330,1422,5,109384,99,1,0),
|
|
||||||
(331,1423,1,109385,99,1,0),
|
|
||||||
(332,1423,2,109386,99,1,0),
|
|
||||||
(333,1423,5,109389,99,1,0),
|
|
||||||
(334,1436,1,120378,99,1,0),
|
|
||||||
(335,1436,2,120379,99,1,0),
|
|
||||||
(336,1436,3,120380,99,1,0),
|
|
||||||
(337,1436,4,120381,99,1,0),
|
|
||||||
(338,1436,5,120382,99,1,0),
|
|
||||||
(339,1436,6,120383,99,1,0),
|
|
||||||
(340,1436,7,120384,99,1,0),
|
|
||||||
(341,1436,8,120385,99,1,0),
|
|
||||||
(342,1436,9,120386,99,1,0),
|
|
||||||
(343,1436,10,120387,99,1,0),
|
|
||||||
(344,1436,11,120388,99,1,0),
|
|
||||||
(345,1436,12,120389,99,1,0),
|
|
||||||
(346,1436,13,120390,99,1,0),
|
|
||||||
(347,1436,14,120391,99,1,0),
|
|
||||||
(348,1436,15,120392,99,1,0),
|
|
||||||
(349,1436,16,120393,99,1,0),
|
|
||||||
(350,1436,17,120394,99,1,0),
|
|
||||||
(351,1436,18,120395,99,1,0),
|
|
||||||
(352,1436,19,120396,99,1,0),
|
|
||||||
(353,1436,20,120397,99,1,0),
|
|
||||||
(354,1440,1,56992,99,1,0),
|
|
||||||
(355,1440,2,56993,99,1,0),
|
|
||||||
(356,1440,3,56994,99,1,0),
|
|
||||||
(357,1440,4,56995,99,1,0),
|
|
||||||
(358,1440,5,56996,99,1,0),
|
|
||||||
(359,1441,1,132787,99,1,0),
|
|
||||||
(360,1441,2,132788,99,1,0),
|
|
||||||
(361,1441,3,132789,99,1,0),
|
|
||||||
(362,1441,4,132790,99,1,0),
|
|
||||||
(363,1441,5,132791,99,1,0),
|
|
||||||
(364,1441,6,132792,99,1,0),
|
|
||||||
(365,1441,7,132793,99,1,0),
|
|
||||||
(366,1441,8,132794,99,1,0),
|
|
||||||
(367,1441,9,132795,99,1,0),
|
|
||||||
(368,1441,10,132796,99,1,0),
|
|
||||||
(369,1441,11,132797,99,1,0),
|
|
||||||
(370,1441,13,132799,99,1,0),
|
|
||||||
(371,1441,14,132800,99,1,0),
|
|
||||||
(372,1441,15,132801,99,1,0),
|
|
||||||
(373,1441,16,132802,99,1,0),
|
|
||||||
(374,1441,17,132803,99,1,0),
|
|
||||||
(375,1441,18,132804,99,1,0),
|
|
||||||
(376,1441,19,132805,99,1,0),
|
|
||||||
(377,1441,20,132806,99,1,0),
|
|
||||||
(378,1442,1,133137,99,1,0),
|
|
||||||
(379,1442,2,133138,99,1,0),
|
|
||||||
(380,1442,3,133139,99,1,0),
|
|
||||||
(381,1442,4,133140,99,1,0),
|
|
||||||
(382,1442,10,133146,99,1,0),
|
|
||||||
(383,1442,11,133147,99,1,0),
|
|
||||||
(384,1442,12,133148,99,1,0),
|
|
||||||
(385,1442,13,133149,99,1,0),
|
|
||||||
(386,1442,14,133150,99,1,0),
|
|
||||||
(387,1442,15,133151,99,1,0),
|
|
||||||
(388,1442,16,133152,99,1,0),
|
|
||||||
(389,1442,17,133153,99,1,0),
|
|
||||||
(390,1442,18,133154,99,1,0),
|
|
||||||
(391,1442,19,133155,99,1,0),
|
|
||||||
(392,1442,20,133156,99,1,0),
|
|
||||||
(393,1443,1,133406,99,1,0),
|
|
||||||
(394,1443,2,133407,99,1,0),
|
|
||||||
(395,1443,3,133408,99,1,0),
|
|
||||||
(396,1443,4,133409,99,1,0),
|
|
||||||
(397,1443,5,133410,99,1,0),
|
|
||||||
(398,1443,6,133411,99,1,0),
|
|
||||||
(399,1443,7,133412,99,1,0),
|
|
||||||
(400,1443,8,133413,99,1,0),
|
|
||||||
(401,1443,9,133414,99,1,0),
|
|
||||||
(402,1443,10,133415,99,1,0),
|
|
||||||
(403,1443,11,133416,99,1,0),
|
|
||||||
(404,1443,12,133417,99,1,0),
|
|
||||||
(405,1443,13,133418,99,1,0),
|
|
||||||
(406,1443,14,133419,99,1,0),
|
|
||||||
(407,1443,15,133420,99,1,0),
|
|
||||||
(408,1443,16,133421,99,1,0),
|
|
||||||
(409,1443,17,133422,99,1,0),
|
|
||||||
(410,1443,18,133423,99,1,0),
|
|
||||||
(411,1443,19,133424,99,1,0),
|
|
||||||
(412,1443,20,133425,99,1,0),
|
|
||||||
(413,1444,1,94938,99,1,0),
|
|
||||||
(414,1444,2,94939,99,1,0),
|
|
||||||
(415,1444,3,94940,99,1,0),
|
|
||||||
(416,1444,4,94941,99,1,0),
|
|
||||||
(417,1444,5,94942,99,1,0),
|
|
||||||
(418,1444,6,94943,99,1,0),
|
|
||||||
(419,1444,7,94944,99,1,0),
|
|
||||||
(420,1444,8,94945,99,1,0),
|
|
||||||
(421,1444,9,94946,99,1,0),
|
|
||||||
(422,1444,10,94947,99,1,0),
|
|
||||||
(423,1444,11,94948,99,1,0),
|
|
||||||
(424,1444,12,94949,99,1,0),
|
|
||||||
(425,1444,13,94950,99,1,0),
|
|
||||||
(426,1444,14,94951,99,1,0),
|
|
||||||
(427,1444,15,94952,99,1,0),
|
|
||||||
(428,1444,16,94953,99,1,0),
|
|
||||||
(429,1444,17,94954,99,1,0),
|
|
||||||
(430,1444,18,94955,99,1,0),
|
|
||||||
(431,1444,19,94956,99,1,0),
|
|
||||||
(432,1444,20,94957,99,1,0),
|
|
||||||
(433,1445,1,98858,99,1,0),
|
|
||||||
(434,1445,2,98859,99,1,0),
|
|
||||||
(435,1445,3,98860,99,1,0),
|
|
||||||
(436,1445,4,98861,99,1,0),
|
|
||||||
(437,1445,5,98862,99,1,0);
|
|
||||||
|
|
||||||
)",
|
|
||||||
.content_schema_update = true
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9291,
|
|
||||||
.description = "2025_01_21_add_remove_zone_fields",
|
|
||||||
.check = "SHOW COLUMNS FROM `zone` LIKE 'client_update_range'",
|
|
||||||
.condition = "empty",
|
|
||||||
.match = "",
|
|
||||||
.sql = R"(
|
|
||||||
ALTER TABLE zone DROP COLUMN IF EXISTS npc_update_range;
|
|
||||||
ALTER TABLE zone DROP COLUMN IF EXISTS max_movement_update_range;
|
|
||||||
ALTER TABLE `zone` ADD COLUMN `client_update_range` int(11) NOT NULL DEFAULT 600 AFTER `npc_max_aggro_dist`;
|
|
||||||
)",
|
|
||||||
.content_schema_update = true,
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9292,
|
|
||||||
.description = "2025_01_21_data_buckets_account_id",
|
|
||||||
.check = "SHOW COLUMNS FROM `data_buckets` LIKE 'account_id'",
|
|
||||||
.condition = "empty",
|
|
||||||
.match = "",
|
|
||||||
.sql = R"(
|
|
||||||
ALTER TABLE `data_buckets`
|
|
||||||
ADD COLUMN `account_id` bigint(11) NULL DEFAULT 0 AFTER `expires`,
|
|
||||||
DROP INDEX `keys`,
|
|
||||||
ADD UNIQUE INDEX `keys` (`key`, `character_id`, `npc_id`, `bot_id`, `account_id`) USING BTREE;
|
|
||||||
|
|
||||||
-- Add the INDEX for character_id and key
|
|
||||||
ALTER TABLE `data_buckets` ADD KEY `idx_account_id_key` (`account_id`, `key`);
|
|
||||||
)",
|
|
||||||
.content_schema_update = false
|
|
||||||
},
|
|
||||||
ManifestEntry{
|
|
||||||
.version = 9293,
|
|
||||||
.description = "2025_01_10_create_pet_names_table.sql",
|
|
||||||
.check = "SHOW TABLES LIKE 'character_pet_name'",
|
|
||||||
.condition = "empty",
|
|
||||||
.match = "",
|
|
||||||
.sql = R"(
|
|
||||||
CREATE TABLE `character_pet_name` (
|
|
||||||
`character_id` INT(11) NOT NULL PRIMARY KEY,
|
|
||||||
`name` VARCHAR(64) NOT NULL
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
||||||
)",
|
|
||||||
},
|
|
||||||
// -- template; copy/paste this when you need to create a new entry
|
// -- template; copy/paste this when you need to create a new entry
|
||||||
// ManifestEntry{
|
// ManifestEntry{
|
||||||
// .version = 9228,
|
// .version = 9228,
|
||||||
|
|||||||
@@ -114,9 +114,7 @@ bool Database::CheckInstanceExpired(uint16 instance_id)
|
|||||||
timeval tv{};
|
timeval tv{};
|
||||||
gettimeofday(&tv, nullptr);
|
gettimeofday(&tv, nullptr);
|
||||||
|
|
||||||
// Use uint64_t for the addition to prevent overflow
|
return (i.start_time + i.duration) <= tv.tv_sec;
|
||||||
uint64_t expiration_time = static_cast<uint64_t>(i.start_time) + static_cast<uint64_t>(i.duration);
|
|
||||||
return expiration_time <= tv.tv_sec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration)
|
bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration)
|
||||||
@@ -471,13 +469,15 @@ void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
|
|||||||
|
|
||||||
void Database::DeleteInstance(uint16 instance_id)
|
void Database::DeleteInstance(uint16 instance_id)
|
||||||
{
|
{
|
||||||
// I'm not sure why this isn't in here but we should add it in a later change and make sure it's tested
|
|
||||||
// InstanceListRepository::DeleteWhere(*this, fmt::format("id = {}", instance_id));
|
|
||||||
InstanceListPlayerRepository::DeleteWhere(*this, fmt::format("id = {}", instance_id));
|
InstanceListPlayerRepository::DeleteWhere(*this, fmt::format("id = {}", instance_id));
|
||||||
|
|
||||||
RespawnTimesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
RespawnTimesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||||
|
|
||||||
SpawnConditionValuesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
SpawnConditionValuesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||||
|
|
||||||
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
||||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||||
|
|
||||||
CharacterCorpsesRepository::BuryInstance(*this, instance_id);
|
CharacterCorpsesRepository::BuryInstance(*this, instance_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ namespace DatabaseSchema {
|
|||||||
{"character_enabledtasks", "charid"},
|
{"character_enabledtasks", "charid"},
|
||||||
{"character_expedition_lockouts", "character_id"},
|
{"character_expedition_lockouts", "character_id"},
|
||||||
{"character_exp_modifiers", "character_id"},
|
{"character_exp_modifiers", "character_id"},
|
||||||
{"character_evolving_items", "character_id"},
|
|
||||||
{"character_inspect_messages", "id"},
|
{"character_inspect_messages", "id"},
|
||||||
{"character_instance_safereturns", "character_id"},
|
{"character_instance_safereturns", "character_id"},
|
||||||
{"character_item_recast", "id"},
|
{"character_item_recast", "id"},
|
||||||
@@ -64,7 +63,6 @@ namespace DatabaseSchema {
|
|||||||
{"character_pet_buffs", "char_id"},
|
{"character_pet_buffs", "char_id"},
|
||||||
{"character_pet_info", "char_id"},
|
{"character_pet_info", "char_id"},
|
||||||
{"character_pet_inventory", "char_id"},
|
{"character_pet_inventory", "char_id"},
|
||||||
{"character_pet_name", "character_id"},
|
|
||||||
{"character_peqzone_flags", "id"},
|
{"character_peqzone_flags", "id"},
|
||||||
{"character_potionbelt", "id"},
|
{"character_potionbelt", "id"},
|
||||||
{"character_skills", "id"},
|
{"character_skills", "id"},
|
||||||
@@ -126,7 +124,6 @@ namespace DatabaseSchema {
|
|||||||
"character_enabledtasks",
|
"character_enabledtasks",
|
||||||
"character_expedition_lockouts",
|
"character_expedition_lockouts",
|
||||||
"character_exp_modifiers",
|
"character_exp_modifiers",
|
||||||
"character_evolving_items",
|
|
||||||
"character_inspect_messages",
|
"character_inspect_messages",
|
||||||
"character_instance_safereturns",
|
"character_instance_safereturns",
|
||||||
"character_item_recast",
|
"character_item_recast",
|
||||||
@@ -215,7 +212,6 @@ namespace DatabaseSchema {
|
|||||||
"ground_spawns",
|
"ground_spawns",
|
||||||
"horses",
|
"horses",
|
||||||
"items",
|
"items",
|
||||||
"items_evolving_details",
|
|
||||||
"ldon_trap_entries",
|
"ldon_trap_entries",
|
||||||
"ldon_trap_templates",
|
"ldon_trap_templates",
|
||||||
"lootdrop",
|
"lootdrop",
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
#include "dbcore.h"
|
#include "dbcore.h"
|
||||||
#include "mysql_stmt.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -437,8 +436,3 @@ MySQLRequestResult DBcore::QueryDatabaseMulti(const std::string &query)
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql::PreparedStmt DBcore::Prepare(std::string query)
|
|
||||||
{
|
|
||||||
return mysql::PreparedStmt(*mysql, std::move(query), m_mutex);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#define CR_SERVER_GONE_ERROR 2006
|
#define CR_SERVER_GONE_ERROR 2006
|
||||||
#define CR_SERVER_LOST 2013
|
#define CR_SERVER_LOST 2013
|
||||||
|
|
||||||
namespace mysql { class PreparedStmt; }
|
|
||||||
|
|
||||||
class DBcore {
|
class DBcore {
|
||||||
public:
|
public:
|
||||||
enum eStatus {
|
enum eStatus {
|
||||||
@@ -50,11 +48,6 @@ public:
|
|||||||
}
|
}
|
||||||
void SetMutex(Mutex *mutex);
|
void SetMutex(Mutex *mutex);
|
||||||
|
|
||||||
// only safe on connections shared with other threads if results buffered
|
|
||||||
// unsafe to use off main thread due to internal server logging
|
|
||||||
// throws std::runtime_error on failure
|
|
||||||
mysql::PreparedStmt Prepare(std::string query);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool Open(
|
bool Open(
|
||||||
const char *iHost,
|
const char *iHost,
|
||||||
|
|||||||
+23
-15
@@ -140,6 +140,29 @@ std::string EQ::constants::GetLanguageName(uint8 language_id)
|
|||||||
return EQ::constants::GetLanguageMap().find(language_id)->second;
|
return EQ::constants::GetLanguageMap().find(language_id)->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::map<uint32, std::string>& EQ::constants::GetLDoNThemeMap()
|
||||||
|
{
|
||||||
|
static const std::map<uint32, std::string> ldon_theme_map = {
|
||||||
|
{ LDoNThemes::Unused, "Unused" },
|
||||||
|
{ LDoNThemes::GUK, "Deepest Guk" },
|
||||||
|
{ LDoNThemes::MIR, "Miragul's Menagerie" },
|
||||||
|
{ LDoNThemes::MMC, "Mistmoore Catacombs" },
|
||||||
|
{ LDoNThemes::RUJ, "Rujarkian Hills" },
|
||||||
|
{ LDoNThemes::TAK, "Takish-Hiz" },
|
||||||
|
};
|
||||||
|
|
||||||
|
return ldon_theme_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string EQ::constants::GetLDoNThemeName(uint32 theme_id)
|
||||||
|
{
|
||||||
|
if (!EQ::ValueWithin(theme_id, LDoNThemes::Unused, LDoNThemes::TAK)) {
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
return EQ::constants::GetLDoNThemeMap().find(theme_id)->second;
|
||||||
|
}
|
||||||
|
|
||||||
const std::map<int8, std::string>& EQ::constants::GetFlyModeMap()
|
const std::map<int8, std::string>& EQ::constants::GetFlyModeMap()
|
||||||
{
|
{
|
||||||
static const std::map<int8, std::string> flymode_map = {
|
static const std::map<int8, std::string> flymode_map = {
|
||||||
@@ -436,18 +459,3 @@ bool ComparisonType::IsValid(uint8 type)
|
|||||||
{
|
{
|
||||||
return comparison_types.find(type) != comparison_types.end();
|
return comparison_types.find(type) != comparison_types.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 LDoNTheme::GetBitmask(uint32 theme_id)
|
|
||||||
{
|
|
||||||
return IsValid(theme_id) ? ldon_theme_names[theme_id].second : LDoNTheme::UnusedBit;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string LDoNTheme::GetName(uint32 theme_id)
|
|
||||||
{
|
|
||||||
return IsValid(theme_id) ? ldon_theme_names[theme_id].first : "UNKNOWN LDON THEME";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LDoNTheme::IsValid(uint32 theme_id)
|
|
||||||
{
|
|
||||||
return ldon_theme_names.find(theme_id) != ldon_theme_names.end();
|
|
||||||
}
|
|
||||||
|
|||||||
+3
-29
@@ -352,6 +352,9 @@ namespace EQ
|
|||||||
extern const std::map<uint8, std::string>& GetLanguageMap();
|
extern const std::map<uint8, std::string>& GetLanguageMap();
|
||||||
std::string GetLanguageName(uint8 language_id);
|
std::string GetLanguageName(uint8 language_id);
|
||||||
|
|
||||||
|
extern const std::map<uint32, std::string>& GetLDoNThemeMap();
|
||||||
|
std::string GetLDoNThemeName(uint32 theme_id);
|
||||||
|
|
||||||
extern const std::map<int8, std::string>& GetFlyModeMap();
|
extern const std::map<int8, std::string>& GetFlyModeMap();
|
||||||
std::string GetFlyModeName(int8 flymode_id);
|
std::string GetFlyModeName(int8 flymode_id);
|
||||||
|
|
||||||
@@ -748,35 +751,6 @@ static std::map<uint32, std::string> stance_names = {
|
|||||||
{ Stance::AEBurn, "AE Burn" }
|
{ Stance::AEBurn, "AE Burn" }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace LDoNTheme {
|
|
||||||
constexpr uint32 Unused = 0;
|
|
||||||
constexpr uint32 GUK = 1;
|
|
||||||
constexpr uint32 MIR = 2;
|
|
||||||
constexpr uint32 MMC = 3;
|
|
||||||
constexpr uint32 RUJ = 4;
|
|
||||||
constexpr uint32 TAK = 5;
|
|
||||||
|
|
||||||
constexpr uint32 UnusedBit = 0;
|
|
||||||
constexpr uint32 GUKBit = 1;
|
|
||||||
constexpr uint32 MIRBit = 2;
|
|
||||||
constexpr uint32 MMCBit = 4;
|
|
||||||
constexpr uint32 RUJBit = 8;
|
|
||||||
constexpr uint32 TAKBit = 16;
|
|
||||||
|
|
||||||
uint32 GetBitmask(uint32 theme_id);
|
|
||||||
std::string GetName(uint32 theme_id);
|
|
||||||
bool IsValid(uint32 theme_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::map<uint32, std::pair<std::string, uint32>> ldon_theme_names = {
|
|
||||||
{ LDoNTheme::Unused, { "Unused", LDoNTheme::UnusedBit }, },
|
|
||||||
{ LDoNTheme::GUK, { "Deepest Guk", LDoNTheme::GUKBit }, },
|
|
||||||
{ LDoNTheme::MIR, { "Miragul's Menagerie", LDoNTheme::MIRBit }, },
|
|
||||||
{ LDoNTheme::MMC, { "Mistmoore Catacombs", LDoNTheme::MMCBit }, },
|
|
||||||
{ LDoNTheme::RUJ, { "Rujarkian Hills", LDoNTheme::RUJBit }, },
|
|
||||||
{ LDoNTheme::TAK, { "Takish-Hiz", LDoNTheme::TAKBit }, },
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace PCNPCOnlyFlagType {
|
namespace PCNPCOnlyFlagType {
|
||||||
constexpr int PC = 1;
|
constexpr int PC = 1;
|
||||||
constexpr int NPC = 2;
|
constexpr int NPC = 2;
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ N(OP_CashReward),
|
|||||||
N(OP_CastSpell),
|
N(OP_CastSpell),
|
||||||
N(OP_ChangeSize),
|
N(OP_ChangeSize),
|
||||||
N(OP_ChannelMessage),
|
N(OP_ChannelMessage),
|
||||||
N(OP_ChangePetName),
|
|
||||||
N(OP_CharacterCreate),
|
N(OP_CharacterCreate),
|
||||||
N(OP_CharacterCreateRequest),
|
N(OP_CharacterCreateRequest),
|
||||||
N(OP_CharInventory),
|
N(OP_CharInventory),
|
||||||
@@ -163,7 +162,6 @@ N(OP_EnduranceUpdate),
|
|||||||
N(OP_EnterChat),
|
N(OP_EnterChat),
|
||||||
N(OP_EnterWorld),
|
N(OP_EnterWorld),
|
||||||
N(OP_EnvDamage),
|
N(OP_EnvDamage),
|
||||||
N(OP_EvolveItem),
|
|
||||||
N(OP_ExpansionInfo),
|
N(OP_ExpansionInfo),
|
||||||
N(OP_ExpUpdate),
|
N(OP_ExpUpdate),
|
||||||
N(OP_FaceChange),
|
N(OP_FaceChange),
|
||||||
@@ -285,15 +283,12 @@ N(OP_InspectMessageUpdate),
|
|||||||
N(OP_InspectRequest),
|
N(OP_InspectRequest),
|
||||||
N(OP_InstillDoubt),
|
N(OP_InstillDoubt),
|
||||||
N(OP_InterruptCast),
|
N(OP_InterruptCast),
|
||||||
N(OP_InvokeChangePetName),
|
|
||||||
N(OP_InvokeChangePetNameImmediate),
|
|
||||||
N(OP_ItemLinkClick),
|
N(OP_ItemLinkClick),
|
||||||
N(OP_ItemLinkResponse),
|
N(OP_ItemLinkResponse),
|
||||||
N(OP_ItemLinkText),
|
N(OP_ItemLinkText),
|
||||||
N(OP_ItemName),
|
N(OP_ItemName),
|
||||||
N(OP_ItemPacket),
|
N(OP_ItemPacket),
|
||||||
N(OP_ItemPreview),
|
N(OP_ItemPreview),
|
||||||
N(OP_ItemPreviewRequest),
|
|
||||||
N(OP_ItemRecastDelay),
|
N(OP_ItemRecastDelay),
|
||||||
N(OP_ItemVerifyReply),
|
N(OP_ItemVerifyReply),
|
||||||
N(OP_ItemVerifyRequest),
|
N(OP_ItemVerifyRequest),
|
||||||
@@ -405,8 +400,6 @@ N(OP_PetitionSearchText),
|
|||||||
N(OP_PetitionUnCheckout),
|
N(OP_PetitionUnCheckout),
|
||||||
N(OP_PetitionUpdate),
|
N(OP_PetitionUpdate),
|
||||||
N(OP_PickPocket),
|
N(OP_PickPocket),
|
||||||
N(OP_PickZone),
|
|
||||||
N(OP_PickZoneWindow),
|
|
||||||
N(OP_PlayerProfile),
|
N(OP_PlayerProfile),
|
||||||
N(OP_PlayerStateAdd),
|
N(OP_PlayerStateAdd),
|
||||||
N(OP_PlayerStateRemove),
|
N(OP_PlayerStateRemove),
|
||||||
|
|||||||
+18
-1
@@ -993,6 +993,24 @@ enum class DynamicZoneMemberStatus : uint8_t
|
|||||||
LinkDead
|
LinkDead
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum LDoNThemes {
|
||||||
|
Unused = 0,
|
||||||
|
GUK,
|
||||||
|
MIR,
|
||||||
|
MMC,
|
||||||
|
RUJ,
|
||||||
|
TAK
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LDoNThemeBits {
|
||||||
|
UnusedBit = 0,
|
||||||
|
GUKBit = 1,
|
||||||
|
MIRBit = 2,
|
||||||
|
MMCBit = 4,
|
||||||
|
RUJBit = 8,
|
||||||
|
TAKBit = 16
|
||||||
|
};
|
||||||
|
|
||||||
enum StartZoneIndex {
|
enum StartZoneIndex {
|
||||||
Odus = 0,
|
Odus = 0,
|
||||||
Qeynos,
|
Qeynos,
|
||||||
@@ -1114,5 +1132,4 @@ enum ExpSource
|
|||||||
namespace DoorType {
|
namespace DoorType {
|
||||||
constexpr uint32 BuyerStall = 155;
|
constexpr uint32 BuyerStall = 155;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||||
|
|||||||
+6
-14
@@ -47,7 +47,6 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
ClientUnknown::constants::EXPANSION_BIT,
|
ClientUnknown::constants::EXPANSION_BIT,
|
||||||
ClientUnknown::constants::EXPANSIONS_MASK,
|
ClientUnknown::constants::EXPANSIONS_MASK,
|
||||||
ClientUnknown::INULL,
|
ClientUnknown::INULL,
|
||||||
ClientUnknown::INULL,
|
|
||||||
ClientUnknown::INULL
|
ClientUnknown::INULL
|
||||||
),
|
),
|
||||||
/*[ClientVersion::Client62] =*/
|
/*[ClientVersion::Client62] =*/
|
||||||
@@ -56,7 +55,6 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
Client62::constants::EXPANSION_BIT,
|
Client62::constants::EXPANSION_BIT,
|
||||||
Client62::constants::EXPANSIONS_MASK,
|
Client62::constants::EXPANSIONS_MASK,
|
||||||
Client62::INULL,
|
Client62::INULL,
|
||||||
Client62::INULL,
|
|
||||||
Client62::INULL
|
Client62::INULL
|
||||||
),
|
),
|
||||||
/*[ClientVersion::Titanium] =*/
|
/*[ClientVersion::Titanium] =*/
|
||||||
@@ -65,8 +63,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
Titanium::constants::EXPANSION_BIT,
|
Titanium::constants::EXPANSION_BIT,
|
||||||
Titanium::constants::EXPANSIONS_MASK,
|
Titanium::constants::EXPANSIONS_MASK,
|
||||||
Titanium::constants::CHARACTER_CREATION_LIMIT,
|
Titanium::constants::CHARACTER_CREATION_LIMIT,
|
||||||
Titanium::constants::SAY_LINK_BODY_SIZE,
|
Titanium::constants::SAY_LINK_BODY_SIZE
|
||||||
Titanium::INULL
|
|
||||||
),
|
),
|
||||||
/*[ClientVersion::SoF] =*/
|
/*[ClientVersion::SoF] =*/
|
||||||
EQ::constants::LookupEntry(
|
EQ::constants::LookupEntry(
|
||||||
@@ -74,8 +71,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
SoF::constants::EXPANSION_BIT,
|
SoF::constants::EXPANSION_BIT,
|
||||||
SoF::constants::EXPANSIONS_MASK,
|
SoF::constants::EXPANSIONS_MASK,
|
||||||
SoF::constants::CHARACTER_CREATION_LIMIT,
|
SoF::constants::CHARACTER_CREATION_LIMIT,
|
||||||
SoF::constants::SAY_LINK_BODY_SIZE,
|
SoF::constants::SAY_LINK_BODY_SIZE
|
||||||
SoF::INULL
|
|
||||||
),
|
),
|
||||||
/*[ClientVersion::SoD] =*/
|
/*[ClientVersion::SoD] =*/
|
||||||
EQ::constants::LookupEntry(
|
EQ::constants::LookupEntry(
|
||||||
@@ -83,8 +79,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
SoD::constants::EXPANSION_BIT,
|
SoD::constants::EXPANSION_BIT,
|
||||||
SoD::constants::EXPANSIONS_MASK,
|
SoD::constants::EXPANSIONS_MASK,
|
||||||
SoD::constants::CHARACTER_CREATION_LIMIT,
|
SoD::constants::CHARACTER_CREATION_LIMIT,
|
||||||
SoD::constants::SAY_LINK_BODY_SIZE,
|
SoD::constants::SAY_LINK_BODY_SIZE
|
||||||
SoD::INULL
|
|
||||||
),
|
),
|
||||||
/*[ClientVersion::UF] =*/
|
/*[ClientVersion::UF] =*/
|
||||||
EQ::constants::LookupEntry(
|
EQ::constants::LookupEntry(
|
||||||
@@ -92,8 +87,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
UF::constants::EXPANSION_BIT,
|
UF::constants::EXPANSION_BIT,
|
||||||
UF::constants::EXPANSIONS_MASK,
|
UF::constants::EXPANSIONS_MASK,
|
||||||
UF::constants::CHARACTER_CREATION_LIMIT,
|
UF::constants::CHARACTER_CREATION_LIMIT,
|
||||||
UF::constants::SAY_LINK_BODY_SIZE,
|
UF::constants::SAY_LINK_BODY_SIZE
|
||||||
UF::INULL
|
|
||||||
),
|
),
|
||||||
/*[ClientVersion::RoF] =*/
|
/*[ClientVersion::RoF] =*/
|
||||||
EQ::constants::LookupEntry(
|
EQ::constants::LookupEntry(
|
||||||
@@ -101,8 +95,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
RoF::constants::EXPANSION_BIT,
|
RoF::constants::EXPANSION_BIT,
|
||||||
RoF::constants::EXPANSIONS_MASK,
|
RoF::constants::EXPANSIONS_MASK,
|
||||||
RoF::constants::CHARACTER_CREATION_LIMIT,
|
RoF::constants::CHARACTER_CREATION_LIMIT,
|
||||||
RoF::constants::SAY_LINK_BODY_SIZE,
|
RoF::constants::SAY_LINK_BODY_SIZE
|
||||||
RoF::INULL
|
|
||||||
),
|
),
|
||||||
/*[ClientVersion::RoF2] =*/
|
/*[ClientVersion::RoF2] =*/
|
||||||
EQ::constants::LookupEntry(
|
EQ::constants::LookupEntry(
|
||||||
@@ -110,8 +103,7 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
RoF2::constants::EXPANSION_BIT,
|
RoF2::constants::EXPANSION_BIT,
|
||||||
RoF2::constants::EXPANSIONS_MASK,
|
RoF2::constants::EXPANSIONS_MASK,
|
||||||
RoF2::constants::CHARACTER_CREATION_LIMIT,
|
RoF2::constants::CHARACTER_CREATION_LIMIT,
|
||||||
RoF2::constants::SAY_LINK_BODY_SIZE,
|
RoF2::constants::SAY_LINK_BODY_SIZE
|
||||||
RoF2::constants::MAX_BAZAAR_TRADERS
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+2
-5
@@ -42,7 +42,6 @@ namespace EQ
|
|||||||
uint32 ExpansionsMask;
|
uint32 ExpansionsMask;
|
||||||
int16 CharacterCreationLimit;
|
int16 CharacterCreationLimit;
|
||||||
size_t SayLinkBodySize;
|
size_t SayLinkBodySize;
|
||||||
uint32 BazaarTraderLimit;
|
|
||||||
|
|
||||||
LookupEntry(const LookupEntry *lookup_entry) { }
|
LookupEntry(const LookupEntry *lookup_entry) { }
|
||||||
LookupEntry(
|
LookupEntry(
|
||||||
@@ -50,15 +49,13 @@ namespace EQ
|
|||||||
uint32 ExpansionBit,
|
uint32 ExpansionBit,
|
||||||
uint32 ExpansionsMask,
|
uint32 ExpansionsMask,
|
||||||
int16 CharacterCreationLimit,
|
int16 CharacterCreationLimit,
|
||||||
size_t SayLinkBodySize,
|
size_t SayLinkBodySize
|
||||||
uint32 BazaarTraderLimit
|
|
||||||
) :
|
) :
|
||||||
Expansion(Expansion),
|
Expansion(Expansion),
|
||||||
ExpansionBit(ExpansionBit),
|
ExpansionBit(ExpansionBit),
|
||||||
ExpansionsMask(ExpansionsMask),
|
ExpansionsMask(ExpansionsMask),
|
||||||
CharacterCreationLimit(CharacterCreationLimit),
|
CharacterCreationLimit(CharacterCreationLimit),
|
||||||
SayLinkBodySize(SayLinkBodySize),
|
SayLinkBodySize(SayLinkBodySize)
|
||||||
BazaarTraderLimit(BazaarTraderLimit)
|
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+7
-105
@@ -1121,6 +1121,12 @@ struct PlayerProfile_Struct
|
|||||||
/*19559*/ uint8 unknown19595[5]; // ***Placeholder (6/29/2005)
|
/*19559*/ uint8 unknown19595[5]; // ***Placeholder (6/29/2005)
|
||||||
/*19564*/ uint32 RestTimer;
|
/*19564*/ uint32 RestTimer;
|
||||||
/*19568*/ uint32 char_id; // Found as part of bazaar revamp (5/15/2024)
|
/*19568*/ uint32 char_id; // Found as part of bazaar revamp (5/15/2024)
|
||||||
|
/*19572*/ uint32 cold_resist;
|
||||||
|
/*19576*/ uint32 fire_resist;
|
||||||
|
/*19580*/ uint32 magic_resist;
|
||||||
|
/*19584*/ uint32 disease_resist;
|
||||||
|
/*19588*/ uint32 poison_resist;
|
||||||
|
/*19592*/ uint32 corruption_resist;
|
||||||
|
|
||||||
// All player profile packets are translated and this overhead is ignored in out-bound packets
|
// All player profile packets are translated and this overhead is ignored in out-bound packets
|
||||||
PlayerProfile_Struct() : m_player_profile_version(EQ::versions::MobVersion::Unknown) { }
|
PlayerProfile_Struct() : m_player_profile_version(EQ::versions::MobVersion::Unknown) { }
|
||||||
@@ -3221,7 +3227,6 @@ struct BuyerMessaging_Struct {
|
|||||||
char item_name[64];
|
char item_name[64];
|
||||||
uint32 slot;
|
uint32 slot;
|
||||||
uint32 seller_quantity;
|
uint32 seller_quantity;
|
||||||
uint32 purchase_method; // 0 direct merchant, 1 via /barter window
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuyerAddBuyertoBarterWindow_Struct {
|
struct BuyerAddBuyertoBarterWindow_Struct {
|
||||||
@@ -3742,8 +3747,7 @@ struct GetItems_Struct{
|
|||||||
|
|
||||||
struct BecomeTrader_Struct {
|
struct BecomeTrader_Struct {
|
||||||
uint32 action;
|
uint32 action;
|
||||||
uint16 zone_id;
|
uint32 zone_id;
|
||||||
uint16 zone_instance_id;
|
|
||||||
uint32 trader_id;
|
uint32 trader_id;
|
||||||
uint32 entity_id;
|
uint32 entity_id;
|
||||||
char trader_name[64];
|
char trader_name[64];
|
||||||
@@ -5819,21 +5823,6 @@ struct ChangeSize_Struct
|
|||||||
/*16*/
|
/*16*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChangePetName_Struct {
|
|
||||||
/*00*/ char new_pet_name[64];
|
|
||||||
/*40*/ char pet_owner_name[64];
|
|
||||||
/*80*/ int response_code;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ChangePetNameResponse : int {
|
|
||||||
Denied = 0, // 5167 You have requested an invalid name or a Customer Service Representative has denied your name request. Please try another name.
|
|
||||||
Accepted = 1, // 5976 Your request for a name change was successful.
|
|
||||||
Timeout = -3, // 5979 You must wait longer before submitting another name request. Please try again in a few minutes.
|
|
||||||
NotEligible = -4, // 5980 Your character is not eligible for a name change.
|
|
||||||
Pending = -5, // 5193 You already have a name change pending. Please wait until it is fully processed before attempting another name change.
|
|
||||||
Unhandled = -1
|
|
||||||
};
|
|
||||||
|
|
||||||
// New OpCode/Struct for SoD+
|
// New OpCode/Struct for SoD+
|
||||||
struct GroupMakeLeader_Struct
|
struct GroupMakeLeader_Struct
|
||||||
{
|
{
|
||||||
@@ -6363,7 +6352,6 @@ enum BazaarTraderBarterActions {
|
|||||||
TraderAck2 = 22,
|
TraderAck2 = 22,
|
||||||
AddTraderToBazaarWindow = 24,
|
AddTraderToBazaarWindow = 24,
|
||||||
RemoveTraderFromBazaarWindow = 25,
|
RemoveTraderFromBazaarWindow = 25,
|
||||||
FirstOpenSearch = 26,
|
|
||||||
ClickTrader = 28,
|
ClickTrader = 28,
|
||||||
DeliveryCostUpdate = 29
|
DeliveryCostUpdate = 29
|
||||||
};
|
};
|
||||||
@@ -6403,7 +6391,6 @@ struct BazaarSearchResultsFromDB_Struct {
|
|||||||
uint32 icon_id;
|
uint32 icon_id;
|
||||||
uint32 sum_charges;
|
uint32 sum_charges;
|
||||||
uint32 trader_zone_id;
|
uint32 trader_zone_id;
|
||||||
int32 trader_zone_instance_id;
|
|
||||||
uint32 trader_entity_id;
|
uint32 trader_entity_id;
|
||||||
uint32 item_stat;
|
uint32 item_stat;
|
||||||
bool stackable;
|
bool stackable;
|
||||||
@@ -6425,7 +6412,6 @@ struct BazaarSearchResultsFromDB_Struct {
|
|||||||
CEREAL_NVP(icon_id),
|
CEREAL_NVP(icon_id),
|
||||||
CEREAL_NVP(sum_charges),
|
CEREAL_NVP(sum_charges),
|
||||||
CEREAL_NVP(trader_zone_id),
|
CEREAL_NVP(trader_zone_id),
|
||||||
CEREAL_NVP(trader_zone_instance_id),
|
|
||||||
CEREAL_NVP(trader_entity_id),
|
CEREAL_NVP(trader_entity_id),
|
||||||
CEREAL_NVP(item_stat),
|
CEREAL_NVP(item_stat),
|
||||||
CEREAL_NVP(stackable),
|
CEREAL_NVP(stackable),
|
||||||
@@ -6455,90 +6441,6 @@ struct BuylineItemDetails_Struct {
|
|||||||
uint32 item_quantity;
|
uint32 item_quantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PickZoneEntry_Struct {
|
|
||||||
int16 zone_id;
|
|
||||||
int16 unknown;
|
|
||||||
int32 player_count;
|
|
||||||
int32 instance_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PickZoneWindow_Struct {
|
|
||||||
char padding000[64];
|
|
||||||
int64 session_id;
|
|
||||||
int8 option_count;
|
|
||||||
char padding073[23];
|
|
||||||
PickZoneEntry_Struct entries[10];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PickZone_Struct {
|
|
||||||
int64 session_id;
|
|
||||||
int32 selection_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveItemToggle {
|
|
||||||
uint32 action;
|
|
||||||
uint32 unknown_004;
|
|
||||||
uint64 unique_id;
|
|
||||||
uint32 percentage;
|
|
||||||
uint32 activated;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveXPWindowReceive {
|
|
||||||
uint32 action;
|
|
||||||
uint32 unknown_004;
|
|
||||||
uint64 item1_unique_id;
|
|
||||||
uint64 item2_unique_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveItemMessaging {
|
|
||||||
uint32 action;
|
|
||||||
char serialized_data[];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveXPWindowSend {
|
|
||||||
/*000*/ uint32 action;
|
|
||||||
/*004*/ uint64 item1_unique_id;
|
|
||||||
/*012*/ uint64 item2_unique_id;
|
|
||||||
/*020*/ uint32 compatibility;
|
|
||||||
/*024*/ uint32 max_transfer_level;
|
|
||||||
/*028*/ uint8 item1_present;
|
|
||||||
/*029*/ uint8 item2_present;
|
|
||||||
/*030*/ std::string serialize_item_1;
|
|
||||||
/*034*/ std::string serialize_item_2;
|
|
||||||
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive &archive)
|
|
||||||
{
|
|
||||||
archive(
|
|
||||||
CEREAL_NVP(action),
|
|
||||||
CEREAL_NVP(item1_unique_id),
|
|
||||||
CEREAL_NVP(item2_unique_id),
|
|
||||||
CEREAL_NVP(compatibility),
|
|
||||||
CEREAL_NVP(max_transfer_level),
|
|
||||||
CEREAL_NVP(item1_present),
|
|
||||||
CEREAL_NVP(item2_present),
|
|
||||||
CEREAL_NVP(serialize_item_1),
|
|
||||||
CEREAL_NVP(serialize_item_2)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveTransfer {
|
|
||||||
uint32 item_from_id;
|
|
||||||
uint32 item_from_current_amount;
|
|
||||||
uint32 item_to_id;
|
|
||||||
uint32 item_to_current_amount;
|
|
||||||
uint32 compatibility;
|
|
||||||
uint32 max_transfer_level;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveGetNextItem {
|
|
||||||
uint32 new_item_id;
|
|
||||||
uint64 new_current_amount;
|
|
||||||
uint64 from_current_amount;
|
|
||||||
uint32 max_transfer_level;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Restore structure packing to default
|
// Restore structure packing to default
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void EQEmuConfig::parse_config()
|
|||||||
auto_database_updates = true;
|
auto_database_updates = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldIP = _root["server"]["world"]["tcp"].get("ip", "127.0.0.1").asString();
|
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
|
||||||
WorldTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["tcp"].get("port", "9000").asString());
|
WorldTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["tcp"].get("port", "9000").asString());
|
||||||
|
|
||||||
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
||||||
@@ -171,7 +171,6 @@ void EQEmuConfig::parse_config()
|
|||||||
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
||||||
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
||||||
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
||||||
OpcodeDir = _root["server"]["directories"].get("opcodes", "./").asString();
|
|
||||||
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
||||||
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ class EQEmuConfig
|
|||||||
std::string PluginDir;
|
std::string PluginDir;
|
||||||
std::string LuaModuleDir;
|
std::string LuaModuleDir;
|
||||||
std::string PatchDir;
|
std::string PatchDir;
|
||||||
std::string OpcodeDir;
|
|
||||||
std::string SharedMemDir;
|
std::string SharedMemDir;
|
||||||
std::string LogDir;
|
std::string LogDir;
|
||||||
|
|
||||||
@@ -137,9 +136,9 @@ class EQEmuConfig
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
virtual ~EQEmuConfig() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~EQEmuConfig() {}
|
|
||||||
|
|
||||||
// Produce a const singleton
|
// Produce a const singleton
|
||||||
static const EQEmuConfig *get()
|
static const EQEmuConfig *get()
|
||||||
|
|||||||
@@ -25,8 +25,6 @@
|
|||||||
#include "repositories/discord_webhooks_repository.h"
|
#include "repositories/discord_webhooks_repository.h"
|
||||||
#include "repositories/logsys_categories_repository.h"
|
#include "repositories/logsys_categories_repository.h"
|
||||||
#include "termcolor/rang.hpp"
|
#include "termcolor/rang.hpp"
|
||||||
#include "path_manager.h"
|
|
||||||
#include "file.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -87,7 +85,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
|||||||
* Set Defaults
|
* Set Defaults
|
||||||
*/
|
*/
|
||||||
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::Crash].log_to_file = static_cast<uint8>(Logs::General);
|
|
||||||
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
|
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
|
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||||
@@ -535,11 +532,6 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
|||||||
{
|
{
|
||||||
EQEmuLogSys::CloseFileLogs();
|
EQEmuLogSys::CloseFileLogs();
|
||||||
|
|
||||||
if (!File::Exists(path.GetLogPath())) {
|
|
||||||
LogInfo("Logs directory not found, creating [{}]", path.GetLogPath());
|
|
||||||
File::Makedir(path.GetLogPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When loading settings, we must have been given a reason in category based logging to output to a file in order to even create or open one...
|
* When loading settings, we must have been given a reason in category based logging to output to a file in order to even create or open one...
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -142,9 +142,6 @@ namespace Logs {
|
|||||||
EqTime,
|
EqTime,
|
||||||
Corpses,
|
Corpses,
|
||||||
XTargets,
|
XTargets,
|
||||||
EvolveItem,
|
|
||||||
PositionUpdate,
|
|
||||||
KSM,
|
|
||||||
MaxCategoryID /* Don't Remove this */
|
MaxCategoryID /* Don't Remove this */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -245,10 +242,7 @@ namespace Logs {
|
|||||||
"Zoning",
|
"Zoning",
|
||||||
"EqTime",
|
"EqTime",
|
||||||
"Corpses",
|
"Corpses",
|
||||||
"XTargets",
|
"XTargets"
|
||||||
"EvolveItem",
|
|
||||||
"PositionUpdate",
|
|
||||||
"KSM" // Kernel Samepage Merging
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,16 +131,6 @@
|
|||||||
OutF(LogSys, Logs::Detail, Logs::Error, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
OutF(LogSys, Logs::Detail, Logs::Error, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define LogEvolveItem(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::EvolveItem))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::EvolveItem, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogEvolveItemDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::EvolveItem))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::EvolveItem, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogGuilds(message, ...) do {\
|
#define LogGuilds(message, ...) do {\
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::Guilds))\
|
if (LogSys.IsLogEnabled(Logs::General, Logs::Guilds))\
|
||||||
OutF(LogSys, Logs::General, Logs::Guilds, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
OutF(LogSys, Logs::General, Logs::Guilds, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
@@ -854,26 +844,6 @@
|
|||||||
OutF(LogSys, Logs::Detail, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
OutF(LogSys, Logs::Detail, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define LogPositionUpdate(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::PositionUpdate))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::PositionUpdate, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogPositionUpdateDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::PositionUpdate))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::PositionUpdate, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogKSM(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::KSM))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::KSM, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogKSMDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::KSM))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::KSM, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define Log(debug_level, log_category, message, ...) do {\
|
#define Log(debug_level, log_category, message, ...) do {\
|
||||||
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
||||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
|
|||||||
@@ -789,36 +789,50 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string npc_info = fmt::format(
|
|
||||||
"{} ({})\n",
|
|
||||||
e.npc_name,
|
|
||||||
e.npc_id
|
|
||||||
);
|
|
||||||
|
|
||||||
npc_info += fmt::format(
|
|
||||||
"Is Quest Handin: {}",
|
|
||||||
e.is_quest_handin ? "Yes" : "No"
|
|
||||||
);
|
|
||||||
|
|
||||||
std::vector<DiscordField> f = {};
|
std::vector<DiscordField> f = {};
|
||||||
|
|
||||||
|
|
||||||
BuildDiscordField(&f, "NPC", npc_info);
|
|
||||||
|
|
||||||
if (!handin_items_info.empty()) {
|
if (!handin_items_info.empty()) {
|
||||||
BuildDiscordField(&f, "Handin Items", handin_items_info);
|
BuildDiscordField(
|
||||||
|
&f,
|
||||||
|
"Handin Items",
|
||||||
|
fmt::format(
|
||||||
|
"{}",
|
||||||
|
handin_items_info
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handin_money_info.empty()) {
|
if (!handin_money_info.empty()) {
|
||||||
BuildDiscordField(&f, "Handin Money", handin_money_info);
|
BuildDiscordField(
|
||||||
|
&f,
|
||||||
|
"Handin Money",
|
||||||
|
fmt::format(
|
||||||
|
"{}",
|
||||||
|
handin_money_info
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!return_items_info.empty()) {
|
if (!return_items_info.empty()) {
|
||||||
BuildDiscordField(&f, "Return Items", return_items_info);
|
BuildDiscordField(
|
||||||
|
&f,
|
||||||
|
"Return Items",
|
||||||
|
fmt::format(
|
||||||
|
"{}",
|
||||||
|
return_items_info
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!return_money_info.empty()) {
|
if (!return_money_info.empty()) {
|
||||||
BuildDiscordField(&f, "Return Money", return_money_info);
|
BuildDiscordField(
|
||||||
|
&f,
|
||||||
|
"Return Money",
|
||||||
|
fmt::format(
|
||||||
|
"{}",
|
||||||
|
return_money_info
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<DiscordEmbed> embeds = {};
|
std::vector<DiscordEmbed> embeds = {};
|
||||||
|
|||||||
@@ -707,7 +707,6 @@ void PlayerEventLogs::SetSettingsDefaults()
|
|||||||
m_settings[PlayerEvent::PARCEL_RETRIEVE].event_enabled = 1;
|
m_settings[PlayerEvent::PARCEL_RETRIEVE].event_enabled = 1;
|
||||||
m_settings[PlayerEvent::PARCEL_DELETE].event_enabled = 1;
|
m_settings[PlayerEvent::PARCEL_DELETE].event_enabled = 1;
|
||||||
m_settings[PlayerEvent::BARTER_TRANSACTION].event_enabled = 1;
|
m_settings[PlayerEvent::BARTER_TRANSACTION].event_enabled = 1;
|
||||||
m_settings[PlayerEvent::EVOLVE_ITEM].event_enabled = 1;
|
|
||||||
|
|
||||||
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
||||||
m_settings[i].retention_days = RETENTION_DAYS_DEFAULT;
|
m_settings[i].retention_days = RETENTION_DAYS_DEFAULT;
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ namespace PlayerEvent {
|
|||||||
PARCEL_RETRIEVE,
|
PARCEL_RETRIEVE,
|
||||||
PARCEL_DELETE,
|
PARCEL_DELETE,
|
||||||
BARTER_TRANSACTION,
|
BARTER_TRANSACTION,
|
||||||
EVOLVE_ITEM,
|
|
||||||
MAX // dont remove
|
MAX // dont remove
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,8 +124,7 @@ namespace PlayerEvent {
|
|||||||
"Parcel Item Sent",
|
"Parcel Item Sent",
|
||||||
"Parcel Item Retrieved",
|
"Parcel Item Retrieved",
|
||||||
"Parcel Prune Routine",
|
"Parcel Prune Routine",
|
||||||
"Barter Transaction",
|
"Barter Transaction"
|
||||||
"Evolve Item Update"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Generic struct used by all events
|
// Generic struct used by all events
|
||||||
@@ -864,8 +862,6 @@ namespace PlayerEvent {
|
|||||||
public:
|
public:
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
std::vector<uint32> augment_ids;
|
|
||||||
std::vector<std::string> augment_names;
|
|
||||||
uint16 charges;
|
uint16 charges;
|
||||||
bool attuned;
|
bool attuned;
|
||||||
|
|
||||||
@@ -876,8 +872,6 @@ namespace PlayerEvent {
|
|||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
CEREAL_NVP(augment_ids),
|
|
||||||
CEREAL_NVP(augment_names),
|
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(attuned)
|
CEREAL_NVP(attuned)
|
||||||
);
|
);
|
||||||
@@ -911,7 +905,6 @@ namespace PlayerEvent {
|
|||||||
HandinMoney handin_money;
|
HandinMoney handin_money;
|
||||||
std::vector<HandinEntry> return_items;
|
std::vector<HandinEntry> return_items;
|
||||||
HandinMoney return_money;
|
HandinMoney return_money;
|
||||||
bool is_quest_handin;
|
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
@@ -923,8 +916,7 @@ namespace PlayerEvent {
|
|||||||
CEREAL_NVP(handin_items),
|
CEREAL_NVP(handin_items),
|
||||||
CEREAL_NVP(handin_money),
|
CEREAL_NVP(handin_money),
|
||||||
CEREAL_NVP(return_items),
|
CEREAL_NVP(return_items),
|
||||||
CEREAL_NVP(return_money),
|
CEREAL_NVP(return_money)
|
||||||
CEREAL_NVP(is_quest_handin)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1117,29 +1109,6 @@ namespace PlayerEvent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EvolveItem {
|
|
||||||
std::string status;
|
|
||||||
uint32 item_id;
|
|
||||||
uint64 unique_id;
|
|
||||||
std::string item_name;
|
|
||||||
uint32 level;
|
|
||||||
double progression;
|
|
||||||
|
|
||||||
// cereal
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive &ar)
|
|
||||||
{
|
|
||||||
ar(
|
|
||||||
CEREAL_NVP(status),
|
|
||||||
CEREAL_NVP(item_id),
|
|
||||||
CEREAL_NVP(unique_id),
|
|
||||||
CEREAL_NVP(item_name),
|
|
||||||
CEREAL_NVP(level),
|
|
||||||
CEREAL_NVP(progression)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //EQEMU_PLAYER_EVENTS_H
|
#endif //EQEMU_PLAYER_EVENTS_H
|
||||||
|
|||||||
@@ -1,303 +0,0 @@
|
|||||||
#include "evolving_items.h"
|
|
||||||
#include "item_instance.h"
|
|
||||||
#include "events/player_event_logs.h"
|
|
||||||
#include "repositories/character_evolving_items_repository.h"
|
|
||||||
|
|
||||||
EvolvingItemsManager::EvolvingItemsManager()
|
|
||||||
{
|
|
||||||
m_db = nullptr;
|
|
||||||
m_content_db = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EvolvingItemsManager::LoadEvolvingItems() const
|
|
||||||
{
|
|
||||||
auto const &results = ItemsEvolvingDetailsRepository::All(*m_content_db);
|
|
||||||
|
|
||||||
if (results.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ranges::transform(
|
|
||||||
results.begin(),
|
|
||||||
results.end(),
|
|
||||||
std::inserter(
|
|
||||||
evolving_items_manager.GetEvolvingItemsCache(),
|
|
||||||
evolving_items_manager.GetEvolvingItemsCache().end()
|
|
||||||
),
|
|
||||||
[](const ItemsEvolvingDetailsRepository::ItemsEvolvingDetails &x) {
|
|
||||||
return std::make_pair(x.item_id, x);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EvolvingItemsManager::SetDatabase(Database *db)
|
|
||||||
{
|
|
||||||
m_db = db;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EvolvingItemsManager::SetContentDatabase(Database *db)
|
|
||||||
{
|
|
||||||
m_content_db = db;
|
|
||||||
}
|
|
||||||
|
|
||||||
double EvolvingItemsManager::CalculateProgression(const uint64 current_amount, const uint32 item_id)
|
|
||||||
{
|
|
||||||
if (!evolving_items_manager.GetEvolvingItemsCache().contains(item_id)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return evolving_items_manager.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
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_id, const EQ::ItemInstance &inst) const
|
|
||||||
{
|
|
||||||
inst.SetEvolveEquipped(false);
|
|
||||||
if (inst.IsEvolving() && slot_id <= EQ::invslot::EQUIPMENT_END && slot_id >= EQ::invslot::EQUIPMENT_BEGIN) {
|
|
||||||
inst.SetEvolveEquipped(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inst.IsEvolving()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inst.GetEvolveUniqueID()) {
|
|
||||||
auto e = CharacterEvolvingItemsRepository::NewEntity();
|
|
||||||
|
|
||||||
e.character_id = char_id;
|
|
||||||
e.item_id = inst.GetID();
|
|
||||||
e.equipped = inst.GetEvolveEquipped();
|
|
||||||
e.final_item_id = evolving_items_manager.GetFinalItemID(inst);
|
|
||||||
|
|
||||||
auto r = CharacterEvolvingItemsRepository::InsertOne(*m_db, e);
|
|
||||||
e.id = r.id;
|
|
||||||
|
|
||||||
inst.SetEvolveUniqueID(e.id);
|
|
||||||
inst.SetEvolveCharID(e.character_id);
|
|
||||||
inst.SetEvolveItemID(e.item_id);
|
|
||||||
inst.SetEvolveFinalItemID(e.final_item_id);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CharacterEvolvingItemsRepository::SetEquipped(*m_db, inst.GetEvolveUniqueID(), inst.GetEvolveEquipped());
|
|
||||||
}
|
|
||||||
|
|
||||||
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(),
|
|
||||||
[&](const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a) {
|
|
||||||
return a.second.item_evo_id == inst.GetEvolveLoreID();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (start_iterator == std::end(evolving_items_manager.GetEvolvingItemsCache())) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto final_id = std::ranges::max_element(
|
|
||||||
start_iterator,
|
|
||||||
evolving_items_manager.GetEvolvingItemsCache().cend(),
|
|
||||||
[&](
|
|
||||||
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a,
|
|
||||||
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &b
|
|
||||||
) {
|
|
||||||
return a.second.item_evo_id == b.second.item_evo_id &&
|
|
||||||
a.second.item_evolve_level < b.second.item_evolve_level;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return final_id->first;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 EvolvingItemsManager::GetNextEvolveItemID(const EQ::ItemInstance &inst) const
|
|
||||||
{
|
|
||||||
int8 const current_level = inst.GetEvolveLvl();
|
|
||||||
|
|
||||||
const auto iterator = std::ranges::find_if(
|
|
||||||
evolving_items_manager.GetEvolvingItemsCache().cbegin(),
|
|
||||||
evolving_items_manager.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())) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return iterator->first;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemsEvolvingDetailsRepository::ItemsEvolvingDetails EvolvingItemsManager::GetEvolveItemDetails(const uint64 unique_id)
|
|
||||||
{
|
|
||||||
if (GetEvolvingItemsCache().contains(unique_id)) {
|
|
||||||
return GetEvolvingItemsCache().at(unique_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ItemsEvolvingDetailsRepository::NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> EvolvingItemsManager::GetEvolveIDItems(
|
|
||||||
const uint32 evolve_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> e{};
|
|
||||||
|
|
||||||
for (auto const &[key, value]: GetEvolvingItemsCache()) {
|
|
||||||
if (value.item_evo_id == evolve_id) {
|
|
||||||
e.push_back(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ranges::sort(
|
|
||||||
e.begin(),
|
|
||||||
e.end(),
|
|
||||||
[&](
|
|
||||||
ItemsEvolvingDetailsRepository::ItemsEvolvingDetails const &a,
|
|
||||||
ItemsEvolvingDetailsRepository::ItemsEvolvingDetails const &b
|
|
||||||
) {
|
|
||||||
return a.item_evolve_level < b.item_evolve_level;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 EvolvingItemsManager::GetTotalEarnedXP(const EQ::ItemInstance &inst)
|
|
||||||
{
|
|
||||||
if (!inst) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 xp = inst.GetEvolveCurrentAmount();
|
|
||||||
auto evolve_id_item_cache = GetEvolveIDItems(inst.GetEvolveLoreID());
|
|
||||||
auto current_level = inst.GetEvolveLvl();
|
|
||||||
|
|
||||||
for (auto const &i: evolve_id_item_cache) {
|
|
||||||
if (i.item_evolve_level < current_level) {
|
|
||||||
xp += i.required_amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return xp;
|
|
||||||
}
|
|
||||||
|
|
||||||
EvolveGetNextItem EvolvingItemsManager::GetNextItemByXP(const EQ::ItemInstance &inst_in, const int64 in_xp)
|
|
||||||
{
|
|
||||||
EvolveGetNextItem ets{};
|
|
||||||
const auto evolve_items = GetEvolveIDItems(inst_in.GetEvolveLoreID());
|
|
||||||
uint32 max_transfer_level = 0;
|
|
||||||
int64 xp = in_xp;
|
|
||||||
|
|
||||||
for (auto const &e: evolve_items) {
|
|
||||||
if (e.item_evolve_level < inst_in.GetEvolveLvl()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64 have = 0;
|
|
||||||
if (e.item_evolve_level == inst_in.GetEvolveLvl()) {
|
|
||||||
have = inst_in.GetEvolveCurrentAmount();
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto required = e.required_amount;
|
|
||||||
const int64 need = required - have;
|
|
||||||
const int64 balance = xp - need;
|
|
||||||
|
|
||||||
if (balance <= 0) {
|
|
||||||
ets.new_current_amount = have + xp;
|
|
||||||
ets.new_item_id = e.item_id;
|
|
||||||
ets.from_current_amount = 0;
|
|
||||||
ets.max_transfer_level = max_transfer_level;
|
|
||||||
return ets;
|
|
||||||
}
|
|
||||||
|
|
||||||
xp = balance;
|
|
||||||
max_transfer_level += 1;
|
|
||||||
|
|
||||||
ets.new_current_amount = required;
|
|
||||||
ets.new_item_id = e.item_id;
|
|
||||||
ets.from_current_amount = balance - required;
|
|
||||||
ets.max_transfer_level = max_transfer_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ets;
|
|
||||||
}
|
|
||||||
|
|
||||||
EvolveTransfer EvolvingItemsManager::DetermineTransferResults(
|
|
||||||
const EQ::ItemInstance &inst_from,
|
|
||||||
const EQ::ItemInstance &inst_to
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EvolveTransfer 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());
|
|
||||||
|
|
||||||
if (!evolving_details_inst_from.id || !evolving_details_inst_to.id) {
|
|
||||||
return ets;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (evolving_details_inst_from.type == evolving_details_inst_to.type) {
|
|
||||||
uint32 compatibility = 0;
|
|
||||||
uint64 xp = 0;
|
|
||||||
if (evolving_details_inst_from.sub_type == evolving_details_inst_to.sub_type) {
|
|
||||||
compatibility = 100;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
compatibility = 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
xp = evolving_items_manager.GetTotalEarnedXP(inst_from) * compatibility / 100;
|
|
||||||
auto results = evolving_items_manager.GetNextItemByXP(inst_to, xp);
|
|
||||||
|
|
||||||
ets.item_from_id = evolving_items_manager.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;
|
|
||||||
ets.compatibility = compatibility;
|
|
||||||
ets.max_transfer_level = results.max_transfer_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ets;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 EvolvingItemsManager::GetFirstItemInLoreGroup(const uint32 lore_id)
|
|
||||||
{
|
|
||||||
for (auto const &[key, value]: GetEvolvingItemsCache()) {
|
|
||||||
if (value.item_evo_id == lore_id && value.item_evolve_level == 1) {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 EvolvingItemsManager::GetFirstItemInLoreGroupByItemID(const uint32 item_id)
|
|
||||||
{
|
|
||||||
for (auto const &[key, value]: GetEvolvingItemsCache()) {
|
|
||||||
if (value.item_id == item_id) {
|
|
||||||
for (auto const &[key2, value2]: GetEvolvingItemsCache()) {
|
|
||||||
if (value2.item_evo_id == value.item_evo_id && value2.item_evolve_level == 1) {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EvolvingItemsManager::LoadPlayerEvent(const EQ::ItemInstance &inst, PlayerEvent::EvolveItem &e)
|
|
||||||
{
|
|
||||||
e.item_id = inst.GetID();
|
|
||||||
e.item_name = inst.GetItem() ? inst.GetItem()->Name : std::string();
|
|
||||||
e.level = inst.GetEvolveLvl();
|
|
||||||
e.progression = inst.GetEvolveProgression();
|
|
||||||
e.unique_id = inst.GetEvolveUniqueID();
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
#ifndef EVOLVING_H
|
|
||||||
#define EVOLVING_H
|
|
||||||
|
|
||||||
#include "shareddb.h"
|
|
||||||
#include "events/player_events.h"
|
|
||||||
#include "repositories/items_evolving_details_repository.h"
|
|
||||||
|
|
||||||
namespace EQ {
|
|
||||||
class ItemInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace EvolvingItems {
|
|
||||||
namespace Actions {
|
|
||||||
constexpr int8 UPDATE_ITEMS = 0;
|
|
||||||
constexpr int8 TRANSFER_WINDOW_OPEN = 1;
|
|
||||||
constexpr int8 TRANSFER_WINDOW_DETAILS = 2;
|
|
||||||
constexpr int8 TRANSFER_XP = 3;
|
|
||||||
constexpr int8 FINAL_RESULT = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Types {
|
|
||||||
constexpr int8 AMOUNT_OF_EXP = 1;
|
|
||||||
constexpr int8 NUMBER_OF_KILLS = 2;
|
|
||||||
constexpr int8 SPECIFIC_MOB_RACE = 3;
|
|
||||||
constexpr int8 SPECIFIC_ZONE_ID = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace SubTypes {
|
|
||||||
constexpr int8 ALL_EXP = 0;
|
|
||||||
constexpr int8 SOLO_EXP = 1;
|
|
||||||
constexpr int8 GROUP_EXP = 2;
|
|
||||||
constexpr int8 RAID_EXP = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class EvolvingItemsManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EvolvingItemsManager();
|
|
||||||
void SetDatabase(Database *db);
|
|
||||||
void SetContentDatabase(Database *db);
|
|
||||||
|
|
||||||
void LoadEvolvingItems() const;
|
|
||||||
void DoLootChecks(uint32 char_id, uint16 slot_id, const EQ::ItemInstance &inst) const;
|
|
||||||
uint32 GetFinalItemID(const EQ::ItemInstance &inst) const;
|
|
||||||
uint32 GetNextEvolveItemID(const EQ::ItemInstance &inst) const;
|
|
||||||
uint32 GetFirstItemInLoreGroup(uint32 lore_id);
|
|
||||||
uint32 GetFirstItemInLoreGroupByItemID(uint32 item_id);
|
|
||||||
uint64 GetTotalEarnedXP(const EQ::ItemInstance &inst);
|
|
||||||
static double CalculateProgression(uint64 current_amount, uint32 item_id);
|
|
||||||
static void LoadPlayerEvent(const EQ::ItemInstance &inst, PlayerEvent::EvolveItem &e);
|
|
||||||
|
|
||||||
ItemsEvolvingDetailsRepository::ItemsEvolvingDetails GetEvolveItemDetails(uint64 id);
|
|
||||||
EvolveTransfer DetermineTransferResults(const EQ::ItemInstance& inst_from, const EQ::ItemInstance& inst_to);
|
|
||||||
EvolveGetNextItem GetNextItemByXP(const EQ::ItemInstance &inst_in, int64 in_xp);
|
|
||||||
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails>& GetEvolvingItemsCache() { return evolving_items_cache; }
|
|
||||||
std::vector<ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> GetEvolveIDItems(uint32 evolve_id);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> evolving_items_cache;
|
|
||||||
Database * m_db;
|
|
||||||
Database * m_content_db;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern EvolvingItemsManager evolving_items_manager;
|
|
||||||
|
|
||||||
#endif //EVOLVING_H
|
|
||||||
@@ -344,8 +344,6 @@ bool EQ::InventoryProfile::SwapItem(
|
|||||||
fail_state = swapNotAllowed;
|
fail_state = swapNotAllowed;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
source_item_instance->SetEvolveEquipped(false);
|
|
||||||
if ((destination_slot >= invslot::EQUIPMENT_BEGIN && destination_slot <= invslot::EQUIPMENT_END)) {
|
if ((destination_slot >= invslot::EQUIPMENT_BEGIN && destination_slot <= invslot::EQUIPMENT_END)) {
|
||||||
auto source_item = source_item_instance->GetItem();
|
auto source_item = source_item_instance->GetItem();
|
||||||
if (!source_item) {
|
if (!source_item) {
|
||||||
@@ -364,9 +362,6 @@ bool EQ::InventoryProfile::SwapItem(
|
|||||||
fail_state = swapLevel;
|
fail_state = swapLevel;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (source_item_instance->IsEvolving() > 0) {
|
|
||||||
source_item_instance->SetEvolveEquipped(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,8 +370,6 @@ bool EQ::InventoryProfile::SwapItem(
|
|||||||
fail_state = swapNotAllowed;
|
fail_state = swapNotAllowed;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
destination_item_instance->SetEvolveEquipped(false);
|
|
||||||
if ((source_slot >= invslot::EQUIPMENT_BEGIN && source_slot <= invslot::EQUIPMENT_END)) {
|
if ((source_slot >= invslot::EQUIPMENT_BEGIN && source_slot <= invslot::EQUIPMENT_END)) {
|
||||||
auto destination_item = destination_item_instance->GetItem();
|
auto destination_item = destination_item_instance->GetItem();
|
||||||
if (!destination_item) {
|
if (!destination_item) {
|
||||||
@@ -395,9 +388,6 @@ bool EQ::InventoryProfile::SwapItem(
|
|||||||
fail_state = swapLevel;
|
fail_state = swapLevel;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (destination_item_instance->IsEvolving()) {
|
|
||||||
destination_item_instance->SetEvolveEquipped(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,9 +612,9 @@ bool EQ::InventoryProfile::HasAugmentEquippedByID(uint32 item_id)
|
|||||||
return has_equipped;
|
return has_equipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EQ::InventoryProfile::CountAugmentEquippedByID(uint32 item_id)
|
int EQ::InventoryProfile::CountAugmentEquippedByID(uint32 item_id)
|
||||||
{
|
{
|
||||||
uint32 quantity = 0;
|
int quantity = 0;
|
||||||
ItemInstance* item = nullptr;
|
ItemInstance* item = nullptr;
|
||||||
|
|
||||||
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
||||||
@@ -653,9 +643,9 @@ bool EQ::InventoryProfile::HasItemEquippedByID(uint32 item_id)
|
|||||||
return has_equipped;
|
return has_equipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EQ::InventoryProfile::CountItemEquippedByID(uint32 item_id)
|
int EQ::InventoryProfile::CountItemEquippedByID(uint32 item_id)
|
||||||
{
|
{
|
||||||
uint32 quantity = 0;
|
int quantity = 0;
|
||||||
ItemInstance* item = nullptr;
|
ItemInstance* item = nullptr;
|
||||||
|
|
||||||
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
for (int slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invslot::EQUIPMENT_END; ++slot_id) {
|
||||||
@@ -1412,8 +1402,6 @@ int16 EQ::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
|
|||||||
int16 result = INVALID_INDEX;
|
int16 result = INVALID_INDEX;
|
||||||
int16 parentSlot = INVALID_INDEX;
|
int16 parentSlot = INVALID_INDEX;
|
||||||
|
|
||||||
inst->SetEvolveEquipped(false);
|
|
||||||
|
|
||||||
if (slot_id == invslot::slotCursor) {
|
if (slot_id == invslot::slotCursor) {
|
||||||
// Replace current item on cursor, if exists
|
// Replace current item on cursor, if exists
|
||||||
m_cursor.pop(); // no memory delete, clients of this function know what they are doing
|
m_cursor.pop(); // no memory delete, clients of this function know what they are doing
|
||||||
@@ -1422,9 +1410,6 @@ int16 EQ::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
|
|||||||
}
|
}
|
||||||
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
||||||
if (inst->IsEvolving()) {
|
|
||||||
inst->SetEvolveEquipped(true);
|
|
||||||
}
|
|
||||||
m_worn[slot_id] = inst;
|
m_worn[slot_id] = inst;
|
||||||
result = slot_id;
|
result = slot_id;
|
||||||
}
|
}
|
||||||
@@ -1823,182 +1808,3 @@ int16 EQ::InventoryProfile::FindFirstFreeSlotThatFitsItem(const EQ::ItemData *it
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//This function has the same flaw as noted above
|
|
||||||
// Helper functions for evolving items
|
|
||||||
int16 EQ::InventoryProfile::HasEvolvingItem(uint64 evolve_unique_id, uint8 quantity, uint8 where)
|
|
||||||
{
|
|
||||||
int16 slot_id = INVALID_INDEX;
|
|
||||||
|
|
||||||
// Altered by Father Nitwit to support a specification of
|
|
||||||
// where to search, with a default value to maintain compatibility
|
|
||||||
|
|
||||||
// Check each inventory bucket
|
|
||||||
if (where & invWhereWorn) {
|
|
||||||
slot_id = _HasEvolvingItem(m_worn, evolve_unique_id, quantity);
|
|
||||||
if (slot_id != INVALID_INDEX) {
|
|
||||||
return slot_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (where & invWherePersonal) {
|
|
||||||
slot_id = _HasEvolvingItem(m_inv, evolve_unique_id, quantity);
|
|
||||||
if (slot_id != INVALID_INDEX) {
|
|
||||||
return slot_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (where & invWhereBank) {
|
|
||||||
slot_id = _HasEvolvingItem(m_bank, evolve_unique_id, quantity);
|
|
||||||
if (slot_id != INVALID_INDEX) {
|
|
||||||
return slot_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (where & invWhereSharedBank) {
|
|
||||||
slot_id = _HasEvolvingItem(m_shbank, evolve_unique_id, quantity);
|
|
||||||
if (slot_id != INVALID_INDEX) {
|
|
||||||
return slot_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (where & invWhereTrading) {
|
|
||||||
slot_id = _HasEvolvingItem(m_trade, evolve_unique_id, quantity);
|
|
||||||
if (slot_id != INVALID_INDEX) {
|
|
||||||
return slot_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Behavioral change - Limbo is no longer checked due to improper handling of return value
|
|
||||||
if (where & invWhereCursor) {
|
|
||||||
// Check cursor queue
|
|
||||||
slot_id = _HasEvolvingItem(m_cursor, evolve_unique_id, quantity);
|
|
||||||
if (slot_id != INVALID_INDEX) {
|
|
||||||
return slot_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return slot_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Internal Method: Checks an inventory bucket for a particular evolving item unique id
|
|
||||||
int16 EQ::InventoryProfile::_HasEvolvingItem(
|
|
||||||
std::map<int16, ItemInstance *> &bucket, uint64 evolve_unique_id, uint8 quantity)
|
|
||||||
{
|
|
||||||
uint32 quantity_found = 0;
|
|
||||||
|
|
||||||
for (auto const &[key, value]: bucket) {
|
|
||||||
if (!value) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key <= EQ::invslot::POSSESSIONS_END && key >= EQ::invslot::POSSESSIONS_BEGIN) {
|
|
||||||
if (((uint64) 1 << key & m_lookup->PossessionsBitmask) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (key <= EQ::invslot::BANK_END && key >= EQ::invslot::BANK_BEGIN) {
|
|
||||||
if (key - EQ::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize.Bank) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (value->GetEvolveUniqueID() == evolve_unique_id) {
|
|
||||||
quantity_found += value->GetCharges() <= 0 ? 1 : value->GetCharges();
|
|
||||||
if (quantity_found >= quantity) {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
|
||||||
if (value->GetAugmentEvolveUniqueID(index) == evolve_unique_id && quantity <= 1) {
|
|
||||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!value->IsClassBag()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto const &[bag_key, bag_value]: *value->GetContents()) {
|
|
||||||
if (!bag_value) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bag_value->GetEvolveUniqueID() == evolve_unique_id) {
|
|
||||||
quantity_found += bag_value->GetCharges() <= 0 ? 1 : bag_value->GetCharges();
|
|
||||||
if (quantity_found >= quantity) {
|
|
||||||
return CalcSlotId(key, bag_key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
|
||||||
if (bag_value->GetAugmentEvolveUniqueID(index) == evolve_unique_id && quantity <= 1) {
|
|
||||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return INVALID_INDEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Internal Method: Checks an inventory queue type bucket for a particular item
|
|
||||||
int16 EQ::InventoryProfile::_HasEvolvingItem(ItemInstQueue &iqueue, uint64 evolve_unique_id, uint8 quantity)
|
|
||||||
{
|
|
||||||
// The downfall of this (these) queue procedure is that callers presume that when an item is
|
|
||||||
// found, it is presented as being available on the cursor. In cases of a parity check, this
|
|
||||||
// is sufficient. However, in cases where referential criteria is considered, this can lead
|
|
||||||
// to unintended results. Funtionality should be observed when referencing the return value
|
|
||||||
// of this query
|
|
||||||
|
|
||||||
uint32 quantity_found = 0;
|
|
||||||
|
|
||||||
for (auto const &inst: iqueue) {
|
|
||||||
if (!inst) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inst->GetEvolveUniqueID() == evolve_unique_id) {
|
|
||||||
quantity_found += inst->GetCharges() <= 0 ? 1 : inst->GetCharges();
|
|
||||||
if (quantity_found >= quantity) {
|
|
||||||
return invslot::slotCursor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
|
||||||
if (inst->GetAugmentEvolveUniqueID(index) == evolve_unique_id && quantity <= 1) {
|
|
||||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inst->IsClassBag()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto const &[bag_key, bag_value]: *inst->GetContents()) {
|
|
||||||
if (!bag_value) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bag_value->GetEvolveUniqueID() == evolve_unique_id) {
|
|
||||||
quantity_found += bag_value->GetCharges() <= 0 ? 1 : bag_value->GetCharges();
|
|
||||||
if (quantity_found >= quantity) {
|
|
||||||
return CalcSlotId(invslot::slotCursor, bag_key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = invaug::SOCKET_BEGIN; index <= invaug::SOCKET_END; ++index) {
|
|
||||||
if (bag_value->GetAugmentEvolveUniqueID(index) == evolve_unique_id && quantity <= 1) {
|
|
||||||
return invslot::SLOT_AUGMENT_GENERIC_RETURN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We only check the visible cursor due to lack of queue processing ability (client allows duplicate in limbo)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return INVALID_INDEX;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ public:
|
|||||||
|
|
||||||
inline std::list<EQ::ItemInstance*>::const_iterator cbegin() { return m_list.cbegin(); }
|
inline std::list<EQ::ItemInstance*>::const_iterator cbegin() { return m_list.cbegin(); }
|
||||||
inline std::list<EQ::ItemInstance*>::const_iterator cend() { return m_list.cend(); }
|
inline std::list<EQ::ItemInstance*>::const_iterator cend() { return m_list.cend(); }
|
||||||
inline std::list<EQ::ItemInstance*>::iterator begin() { return m_list.begin(); }
|
|
||||||
inline std::list<EQ::ItemInstance*>::iterator end() { return m_list.end(); }
|
|
||||||
|
|
||||||
inline int size() { return static_cast<int>(m_list.size()); } // TODO: change to size_t
|
inline int size() { return static_cast<int>(m_list.size()); } // TODO: change to size_t
|
||||||
inline bool empty() { return m_list.empty(); }
|
inline bool empty() { return m_list.empty(); }
|
||||||
@@ -149,13 +147,13 @@ namespace EQ
|
|||||||
bool HasItemEquippedByID(uint32 item_id);
|
bool HasItemEquippedByID(uint32 item_id);
|
||||||
|
|
||||||
// Check how many of a specific item the player has equipped by Item ID
|
// Check how many of a specific item the player has equipped by Item ID
|
||||||
uint32 CountItemEquippedByID(uint32 item_id);
|
int CountItemEquippedByID(uint32 item_id);
|
||||||
|
|
||||||
// Check if player has a specific augment equipped by Item ID
|
// Check if player has a specific augment equipped by Item ID
|
||||||
bool HasAugmentEquippedByID(uint32 item_id);
|
bool HasAugmentEquippedByID(uint32 item_id);
|
||||||
|
|
||||||
// Check how many of a specific augment the player has equipped by Item ID
|
// Check how many of a specific augment the player has equipped by Item ID
|
||||||
uint32 CountAugmentEquippedByID(uint32 item_id);
|
int CountAugmentEquippedByID(uint32 item_id);
|
||||||
|
|
||||||
// Get a list of augments from a specific slot ID
|
// Get a list of augments from a specific slot ID
|
||||||
std::vector<uint32> GetAugmentIDsBySlotID(int16 slot_id);
|
std::vector<uint32> GetAugmentIDsBySlotID(int16 slot_id);
|
||||||
@@ -213,13 +211,6 @@ namespace EQ
|
|||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, bool value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, bool value);
|
||||||
std::string GetCustomItemData(int16 slot_id, const std::string& identifier);
|
std::string GetCustomItemData(int16 slot_id, const std::string& identifier);
|
||||||
static const int GetItemStatValue(uint32 item_id, const std::string& identifier);
|
static const int GetItemStatValue(uint32 item_id, const std::string& identifier);
|
||||||
|
|
||||||
std::map<int16, ItemInstance*>& GetWorn() { return m_worn; }
|
|
||||||
std::map<int16, ItemInstance*>& GetPersonal() { return m_inv; }
|
|
||||||
int16 HasEvolvingItem(uint64 evolve_unique_id, uint8 quantity, uint8 where);
|
|
||||||
|
|
||||||
inline int16 PushItem(int16 slot_id, ItemInstance* inst) { return _PutItem(slot_id, inst); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// Protected Methods
|
// Protected Methods
|
||||||
@@ -242,8 +233,6 @@ namespace EQ
|
|||||||
int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity);
|
int16 _HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity);
|
||||||
int16 _HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup);
|
int16 _HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup);
|
||||||
int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup);
|
int16 _HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup);
|
||||||
int16 _HasEvolvingItem(std::map<int16, ItemInstance*>& bucket, uint64 evolve_unique_id, uint8 quantity);
|
|
||||||
int16 _HasEvolvingItem(ItemInstQueue& iqueue, uint64 evolve_unique_id, uint8 quantity);
|
|
||||||
|
|
||||||
|
|
||||||
// Player inventory
|
// Player inventory
|
||||||
|
|||||||
+50
-55
@@ -25,7 +25,6 @@
|
|||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "shareddb.h"
|
#include "shareddb.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
#include "evolving_items.h"
|
|
||||||
|
|
||||||
//#include "../common/light_source.h"
|
//#include "../common/light_source.h"
|
||||||
|
|
||||||
@@ -77,10 +76,6 @@ EQ::ItemInstance::ItemInstance(const ItemData* item, int16 charges) {
|
|||||||
m_color = m_item->Color;
|
m_color = m_item->Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEvolving()) {
|
|
||||||
SetTimer("evolve", RuleI(EvolvingItems, DelayUponEquipping));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
m_SerialNumber = GetNextItemInstSerialNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,10 +95,6 @@ EQ::ItemInstance::ItemInstance(SharedDatabase *db, uint32 item_id, int16 charges
|
|||||||
m_color = 0;
|
m_color = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEvolving()) {
|
|
||||||
SetTimer("evolve", RuleI(EvolvingItems, DelayUponEquipping));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_SerialNumber = GetNextItemInstSerialNumber();
|
m_SerialNumber = GetNextItemInstSerialNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +146,7 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
|
|||||||
|
|
||||||
m_exp = copy.m_exp;
|
m_exp = copy.m_exp;
|
||||||
m_evolveLvl = copy.m_evolveLvl;
|
m_evolveLvl = copy.m_evolveLvl;
|
||||||
|
m_activated = copy.m_activated;
|
||||||
|
|
||||||
if (copy.m_scaledItem) {
|
if (copy.m_scaledItem) {
|
||||||
m_scaledItem = new ItemData(*copy.m_scaledItem);
|
m_scaledItem = new ItemData(*copy.m_scaledItem);
|
||||||
@@ -162,7 +154,12 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
|
|||||||
m_scaledItem = nullptr;
|
m_scaledItem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_evolving_details = copy.m_evolving_details;
|
if (copy.m_evolveInfo) {
|
||||||
|
m_evolveInfo = new EvolveInfo(*copy.m_evolveInfo);
|
||||||
|
} else {
|
||||||
|
m_evolveInfo = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
m_scaling = copy.m_scaling;
|
m_scaling = copy.m_scaling;
|
||||||
m_ornamenticon = copy.m_ornamenticon;
|
m_ornamenticon = copy.m_ornamenticon;
|
||||||
m_ornamentidfile = copy.m_ornamentidfile;
|
m_ornamentidfile = copy.m_ornamentidfile;
|
||||||
@@ -177,6 +174,7 @@ EQ::ItemInstance::~ItemInstance()
|
|||||||
Clear();
|
Clear();
|
||||||
safe_delete(m_item);
|
safe_delete(m_item);
|
||||||
safe_delete(m_scaledItem);
|
safe_delete(m_scaledItem);
|
||||||
|
safe_delete(m_evolveInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query item type
|
// Query item type
|
||||||
@@ -1032,6 +1030,29 @@ void EQ::ItemInstance::ScaleItem() {
|
|||||||
m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself.
|
m_scaledItem->CharmFileID = 0; // this stops the client from trying to scale the item itself.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EQ::ItemInstance::EvolveOnAllKills() const {
|
||||||
|
return (m_evolveInfo && m_evolveInfo->AllKills);
|
||||||
|
}
|
||||||
|
|
||||||
|
int8 EQ::ItemInstance::GetMaxEvolveLvl() const {
|
||||||
|
if (m_evolveInfo)
|
||||||
|
return m_evolveInfo->MaxLvl;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 EQ::ItemInstance::GetKillsNeeded(uint8 currentlevel) {
|
||||||
|
uint32 kills = -1; // default to -1 (max uint32 value) because this value is usually divided by, so we don't want to ever return zero.
|
||||||
|
if (m_evolveInfo)
|
||||||
|
if (currentlevel != m_evolveInfo->MaxLvl)
|
||||||
|
kills = m_evolveInfo->LvlKills[currentlevel - 1];
|
||||||
|
|
||||||
|
if (kills == 0)
|
||||||
|
kills = -1;
|
||||||
|
|
||||||
|
return kills;
|
||||||
|
}
|
||||||
|
|
||||||
void EQ::ItemInstance::SetTimer(std::string name, uint32 time) {
|
void EQ::ItemInstance::SetTimer(std::string name, uint32 time) {
|
||||||
Timer t(time);
|
Timer t(time);
|
||||||
t.Start(time, false);
|
t.Start(time, false);
|
||||||
@@ -1930,54 +1951,28 @@ void EQ::ItemInstance::ClearGUIDMap()
|
|||||||
{
|
{
|
||||||
guids.clear();
|
guids.clear();
|
||||||
}
|
}
|
||||||
|
//
|
||||||
bool EQ::ItemInstance::TransferOwnership(Database &db, const uint32 to_char_id) const
|
// class EvolveInfo
|
||||||
{
|
//
|
||||||
if (!to_char_id || !IsEvolving()) {
|
EvolveInfo::EvolveInfo() {
|
||||||
return false;
|
// nothing here yet
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEvolveCharID(to_char_id);
|
EvolveInfo::EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 L3, uint32 L4, uint32 L5, uint32 L6, uint32 L7, uint32 L8, uint32 L9, uint32 L10) {
|
||||||
CharacterEvolvingItemsRepository::UpdateCharID(db, GetEvolveUniqueID(), to_char_id);
|
FirstItem = first;
|
||||||
return true;
|
MaxLvl = max;
|
||||||
|
AllKills = allkills;
|
||||||
|
LvlKills[0] = L2;
|
||||||
|
LvlKills[1] = L3;
|
||||||
|
LvlKills[2] = L4;
|
||||||
|
LvlKills[3] = L5;
|
||||||
|
LvlKills[4] = L6;
|
||||||
|
LvlKills[5] = L7;
|
||||||
|
LvlKills[6] = L8;
|
||||||
|
LvlKills[7] = L9;
|
||||||
|
LvlKills[8] = L10;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 EQ::ItemInstance::GetAugmentEvolveUniqueID(uint8 augment_index) const
|
EvolveInfo::~EvolveInfo() {
|
||||||
{
|
|
||||||
if (!m_item || !m_item->IsClassCommon()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto item = GetItem(augment_index);
|
|
||||||
if (item) {
|
|
||||||
return item->GetEvolveUniqueID();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQ::ItemInstance::SetTimer(std::string name, uint32 time) const{
|
|
||||||
Timer t(time);
|
|
||||||
t.Start(time, false);
|
|
||||||
m_timers[name] = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EQ::ItemInstance::SetEvolveEquipped(const bool in) const
|
|
||||||
{
|
|
||||||
if (!IsEvolving()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_evolving_details.equipped = in;
|
|
||||||
if (in && !GetTimers().contains("evolve")) {
|
|
||||||
SetTimer("evolve", RuleI(EvolvingItems, DelayUponEquipping));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in) {
|
|
||||||
GetTimers().at("evolve").SetTimer(RuleI(EvolvingItems, DelayUponEquipping));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetTimers().at("evolve").Disable();
|
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-34
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#ifndef COMMON_ITEM_INSTANCE_H
|
#ifndef COMMON_ITEM_INSTANCE_H
|
||||||
#define COMMON_ITEM_INSTANCE_H
|
#define COMMON_ITEM_INSTANCE_H
|
||||||
#include "evolving_items.h"
|
|
||||||
|
|
||||||
|
|
||||||
class ItemParse; // Parses item packets
|
class ItemParse; // Parses item packets
|
||||||
@@ -35,7 +34,6 @@ class EvolveInfo; // Stores information about an evolving item family
|
|||||||
#include "../common/bodytypes.h"
|
#include "../common/bodytypes.h"
|
||||||
#include "../common/deity.h"
|
#include "../common/deity.h"
|
||||||
#include "../common/memory_buffer.h"
|
#include "../common/memory_buffer.h"
|
||||||
#include "../common/repositories/character_evolving_items_repository.h"
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@@ -207,9 +205,13 @@ namespace EQ
|
|||||||
bool IsDroppable(bool recurse = true) const;
|
bool IsDroppable(bool recurse = true) const;
|
||||||
|
|
||||||
bool IsScaling() const { return m_scaling; }
|
bool IsScaling() const { return m_scaling; }
|
||||||
|
bool IsEvolving() const { return (m_evolveLvl >= 1); }
|
||||||
uint32 GetExp() const { return m_exp; }
|
uint32 GetExp() const { return m_exp; }
|
||||||
void SetExp(uint32 exp) { m_exp = exp; }
|
void SetExp(uint32 exp) { m_exp = exp; }
|
||||||
void AddExp(uint32 exp) { m_exp += exp; }
|
void AddExp(uint32 exp) { m_exp += exp; }
|
||||||
|
bool IsActivated() { return m_activated; }
|
||||||
|
void SetActivated(bool activated) { m_activated = activated; }
|
||||||
|
int8 GetEvolveLvl() const { return m_evolveLvl; }
|
||||||
void SetScaling(bool v) { m_scaling = v; }
|
void SetScaling(bool v) { m_scaling = v; }
|
||||||
uint32 GetOrnamentationIcon() const { return m_ornamenticon; }
|
uint32 GetOrnamentationIcon() const { return m_ornamenticon; }
|
||||||
void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; }
|
void SetOrnamentIcon(uint32 ornament_icon) { m_ornamenticon = ornament_icon; }
|
||||||
@@ -224,6 +226,9 @@ namespace EQ
|
|||||||
|
|
||||||
void Initialize(SharedDatabase *db = nullptr);
|
void Initialize(SharedDatabase *db = nullptr);
|
||||||
void ScaleItem();
|
void ScaleItem();
|
||||||
|
bool EvolveOnAllKills() const;
|
||||||
|
int8 GetMaxEvolveLvl() const;
|
||||||
|
uint32 GetKillsNeeded(uint8 currentlevel);
|
||||||
|
|
||||||
std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; }
|
std::string Serialize(int16 slot_id) const { InternalSerializedItem_Struct s; s.slot_id = slot_id; s.inst = (const void*)this; std::string ser; ser.assign((char*)&s, sizeof(InternalSerializedItem_Struct)); return ser; }
|
||||||
void Serialize(OutBuffer& ob, int16 slot_id) const { InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
|
void Serialize(OutBuffer& ob, int16 slot_id) const { InternalSerializedItem_Struct isi; isi.slot_id = slot_id; isi.inst = (const void*)this; ob.write((const char*)&isi, sizeof(isi)); }
|
||||||
@@ -231,9 +236,8 @@ namespace EQ
|
|||||||
inline int32 GetSerialNumber() const { return m_SerialNumber; }
|
inline int32 GetSerialNumber() const { return m_SerialNumber; }
|
||||||
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
inline void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
||||||
|
|
||||||
std::map<std::string, ::Timer>& GetTimers() const { return m_timers; }
|
std::map<std::string, ::Timer>& GetTimers() { return m_timers; }
|
||||||
void SetTimer(std::string name, uint32 time);
|
void SetTimer(std::string name, uint32 time);
|
||||||
void SetTimer(std::string name, uint32 time) const;
|
|
||||||
void StopTimer(std::string name);
|
void StopTimer(std::string name);
|
||||||
void ClearTimers();
|
void ClearTimers();
|
||||||
|
|
||||||
@@ -308,34 +312,6 @@ namespace EQ
|
|||||||
static void AddGUIDToMap(uint64 existing_serial_number);
|
static void AddGUIDToMap(uint64 existing_serial_number);
|
||||||
static void ClearGUIDMap();
|
static void ClearGUIDMap();
|
||||||
|
|
||||||
// evolving items stuff
|
|
||||||
CharacterEvolvingItemsRepository::CharacterEvolvingItems &GetEvolvingDetails() const { return m_evolving_details; }
|
|
||||||
|
|
||||||
int8 GetEvolveLvl() const { if (GetItem()) { return GetItem()->EvolvingLevel; } return false; }
|
|
||||||
bool IsEvolving() const { if (GetItem()) { return GetItem()->EvolvingItem; } return false; }
|
|
||||||
int8 GetMaxEvolveLvl() const { if (GetItem()) { return GetItem()->EvolvingMax; } return false; }
|
|
||||||
bool GetEvolveActivated() const { return m_evolving_details.activated ? true : false; }
|
|
||||||
bool GetEvolveEquipped() const { return m_evolving_details.equipped ? true : false; }
|
|
||||||
double GetEvolveProgression() const { return m_evolving_details.progression; }
|
|
||||||
uint64 GetEvolveUniqueID() const { return m_evolving_details.id; }
|
|
||||||
uint32 GetEvolveCharID() const { return m_evolving_details.character_id; }
|
|
||||||
uint32 GetEvolveItemID() const { return m_evolving_details.item_id; }
|
|
||||||
uint32 GetEvolveLoreID() const { if (GetItem()) { return GetItem()->EvolvingID; } return false; }
|
|
||||||
uint64 GetEvolveCurrentAmount() const { return m_evolving_details.current_amount; }
|
|
||||||
uint32 GetEvolveFinalItemID() const { return m_evolving_details.final_item_id; }
|
|
||||||
uint32 GetAugmentEvolveUniqueID(uint8 augment_index) const;
|
|
||||||
void SetEvolveEquipped(const bool in) const;
|
|
||||||
void SetEvolveActivated(const bool in) const { m_evolving_details.activated = in; }
|
|
||||||
void SetEvolveProgression(const double in) const { m_evolving_details.progression = in; }
|
|
||||||
void SetEvolveUniqueID(const uint64 in) const { m_evolving_details.id = in; }
|
|
||||||
void SetEvolveCharID(const uint32 in) const { m_evolving_details.character_id = in; }
|
|
||||||
void SetEvolveItemID(const uint32 in) const { m_evolving_details.item_id = in; }
|
|
||||||
void SetEvolveCurrentAmount(const uint64 in) const { m_evolving_details.current_amount = in; }
|
|
||||||
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()); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Protected Members
|
// Protected Members
|
||||||
@@ -359,7 +335,9 @@ namespace EQ
|
|||||||
int32 m_SerialNumber {0}; // Unique identifier for this instance of an item. Needed for Bazaar.
|
int32 m_SerialNumber {0}; // Unique identifier for this instance of an item. Needed for Bazaar.
|
||||||
uint32 m_exp {0};
|
uint32 m_exp {0};
|
||||||
int8 m_evolveLvl {0};
|
int8 m_evolveLvl {0};
|
||||||
|
bool m_activated {false};
|
||||||
ItemData* m_scaledItem {nullptr};
|
ItemData* m_scaledItem {nullptr};
|
||||||
|
::EvolveInfo* m_evolveInfo {nullptr};
|
||||||
bool m_scaling {false};
|
bool m_scaling {false};
|
||||||
uint32 m_ornamenticon {0};
|
uint32 m_ornamenticon {0};
|
||||||
uint32 m_ornamentidfile {0};
|
uint32 m_ornamentidfile {0};
|
||||||
@@ -367,12 +345,26 @@ namespace EQ
|
|||||||
uint32 m_ornament_hero_model {0};
|
uint32 m_ornament_hero_model {0};
|
||||||
uint32 m_recast_timestamp {0};
|
uint32 m_recast_timestamp {0};
|
||||||
int m_task_delivered_count {0};
|
int m_task_delivered_count {0};
|
||||||
mutable CharacterEvolvingItemsRepository::CharacterEvolvingItems m_evolving_details{};
|
|
||||||
|
|
||||||
// Items inside of this item (augs or contents) {};
|
// Items inside of this item (augs or contents) {};
|
||||||
std::map<uint8, ItemInstance*> m_contents {}; // Zero-based index: min=0, max=9
|
std::map<uint8, ItemInstance*> m_contents {}; // Zero-based index: min=0, max=9
|
||||||
std::map<std::string, std::string> m_custom_data {};
|
std::map<std::string, std::string> m_custom_data {};
|
||||||
mutable std::map<std::string, ::Timer> m_timers {};
|
std::map<std::string, ::Timer> m_timers {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EvolveInfo {
|
||||||
|
public:
|
||||||
|
friend class EQ::ItemInstance;
|
||||||
|
//temporary
|
||||||
|
uint16 LvlKills[9];
|
||||||
|
uint32 FirstItem;
|
||||||
|
uint8 MaxLvl;
|
||||||
|
bool AllKills;
|
||||||
|
|
||||||
|
EvolveInfo();
|
||||||
|
EvolveInfo(uint32 first, uint8 max, bool allkills, uint32 L2, uint32 L3, uint32 L4, uint32 L5, uint32 L6, uint32 L7, uint32 L8, uint32 L9, uint32 L10);
|
||||||
|
~EvolveInfo();
|
||||||
|
};
|
||||||
|
|
||||||
#endif /*COMMON_ITEM_INSTANCE_H*/
|
#endif /*COMMON_ITEM_INSTANCE_H*/
|
||||||
|
|||||||
@@ -1,220 +0,0 @@
|
|||||||
#ifndef EQEMU_KSM_HPP
|
|
||||||
#define EQEMU_KSM_HPP
|
|
||||||
|
|
||||||
#include "../eqemu_logsys.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
#include <cstring>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <malloc.h> // For _aligned_malloc, _aligned_free
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <sys/mman.h> // For madvise
|
|
||||||
#include <unistd.h> // For sysconf, sbrk
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Page-aligned allocator for std::vector
|
|
||||||
template <typename T>
|
|
||||||
class PageAlignedAllocator {
|
|
||||||
public:
|
|
||||||
using value_type = T;
|
|
||||||
|
|
||||||
PageAlignedAllocator() noexcept = default;
|
|
||||||
template <typename U>
|
|
||||||
PageAlignedAllocator(const PageAlignedAllocator<U>&) noexcept {}
|
|
||||||
|
|
||||||
T* allocate(std::size_t n) {
|
|
||||||
void* ptr = nullptr;
|
|
||||||
size_t size = n * sizeof(T);
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// Simply allocate memory without alignment
|
|
||||||
ptr = malloc(size);
|
|
||||||
if (!ptr) throw std::bad_alloc();
|
|
||||||
#else
|
|
||||||
size_t alignment = getPageSize(); // Get the system's page size
|
|
||||||
if (posix_memalign(&ptr, alignment, size) != 0) {
|
|
||||||
throw std::bad_alloc();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return static_cast<T*>(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deallocate(T* p, std::size_t) noexcept {
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
size_t getPageSize() const
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
SYSTEM_INFO sysInfo;
|
|
||||||
GetSystemInfo(&sysInfo);
|
|
||||||
return sysInfo.dwPageSize; // Page size in bytes
|
|
||||||
#else
|
|
||||||
return static_cast<size_t>(sysconf(_SC_PAGESIZE));
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T, typename U>
|
|
||||||
bool operator==(const PageAlignedAllocator<T>&, const PageAlignedAllocator<U>&) noexcept {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, typename U>
|
|
||||||
bool operator!=(const PageAlignedAllocator<T>&, const PageAlignedAllocator<U>&) noexcept {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kernel Samepage Merging (KSM) functionality
|
|
||||||
namespace KSM {
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// Windows-specific placeholder functions (no-op)
|
|
||||||
inline void CheckPageAlignment(void* ptr) {
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void* AllocatePageAligned(size_t size) {
|
|
||||||
return memset(malloc(size), 0, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void MarkMemoryForKSM(void* start, size_t size) {
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void AlignHeapToPageBoundary() {
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void* MarkHeapStart() {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline size_t MeasureHeapUsage(void* start) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
// Linux-specific functionality
|
|
||||||
inline void CheckPageAlignment(void* ptr) {
|
|
||||||
size_t page_size = sysconf(_SC_PAGESIZE);
|
|
||||||
if (reinterpret_cast<uintptr_t>(ptr) % page_size == 0) {
|
|
||||||
LogKSMDetail("Memory is page-aligned [{}]", ptr);
|
|
||||||
} else {
|
|
||||||
LogKSMDetail("Memory is NOT page-aligned [{}]", ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void* AllocatePageAligned(size_t size) {
|
|
||||||
size_t page_size = sysconf(_SC_PAGESIZE);
|
|
||||||
void* aligned_ptr = nullptr;
|
|
||||||
if (posix_memalign(&aligned_ptr, page_size, size) != 0) {
|
|
||||||
LogKSM("Failed to allocate page-aligned memory on Linux. page_size [{}] size [{}] bytes", page_size, size);
|
|
||||||
}
|
|
||||||
std::memset(aligned_ptr, 0, size);
|
|
||||||
return aligned_ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void MarkMemoryForKSM(void* start, size_t size) {
|
|
||||||
if (madvise(start, size, MADV_MERGEABLE) == 0) {
|
|
||||||
LogKSM("Marked memory for KSM | start [{}] size [{}] bytes", start, size);
|
|
||||||
} else {
|
|
||||||
perror("madvise failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void AlignHeapToPageBoundary() {
|
|
||||||
size_t page_size = sysconf(_SC_PAGESIZE);
|
|
||||||
if (page_size == 0) {
|
|
||||||
LogKSM("Failed to retrieve page size SC_PAGESIZE [{}]", page_size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* current_break = sbrk(0);
|
|
||||||
if (current_break == (void*)-1) {
|
|
||||||
LogKSM("Failed to retrieve the current program break");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uintptr_t current_address = reinterpret_cast<uintptr_t>(current_break);
|
|
||||||
size_t misalignment = current_address % page_size;
|
|
||||||
|
|
||||||
if (misalignment != 0) {
|
|
||||||
size_t adjustment = page_size - misalignment;
|
|
||||||
if (sbrk(adjustment) == (void*)-1) {
|
|
||||||
LogKSM("Failed to align heap to page boundary. adjustment [{}] bytes", adjustment);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogKSMDetail("Heap aligned to next page boundary. Current break [{}]", sbrk(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void* MarkHeapStart() {
|
|
||||||
void* current_pos = sbrk(0);
|
|
||||||
AlignHeapToPageBoundary();
|
|
||||||
return current_pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline size_t MeasureHeapUsage(void* start) {
|
|
||||||
void* current_break = sbrk(0);
|
|
||||||
return static_cast<char*>(current_break) - static_cast<char*>(start);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
inline size_t getPageSize()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
SYSTEM_INFO sysInfo;
|
|
||||||
GetSystemInfo(&sysInfo);
|
|
||||||
return sysInfo.dwPageSize; // Page size in bytes
|
|
||||||
#else
|
|
||||||
return static_cast<size_t>(sysconf(_SC_PAGESIZE)); // POSIX page size
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline void PageAlignVectorAligned(std::vector<T, PageAlignedAllocator<T>>& vec) {
|
|
||||||
if (vec.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t page_size = getPageSize();
|
|
||||||
void* start = vec.data();
|
|
||||||
size_t size = vec.size() * sizeof(T);
|
|
||||||
|
|
||||||
// Check if the memory is page-aligned
|
|
||||||
if (reinterpret_cast<std::uintptr_t>(start) % page_size != 0) {
|
|
||||||
// Allocate a new aligned vector
|
|
||||||
std::vector<T, PageAlignedAllocator<T>> aligned_vec(vec.get_allocator());
|
|
||||||
aligned_vec.reserve(vec.capacity()); // Match capacity to avoid reallocation during copy
|
|
||||||
|
|
||||||
// Copy elements from the original vector
|
|
||||||
aligned_vec.insert(aligned_vec.end(), vec.begin(), vec.end());
|
|
||||||
|
|
||||||
// Swap the aligned vector with the original vector
|
|
||||||
vec.swap(aligned_vec);
|
|
||||||
|
|
||||||
// Clear the temporary aligned vector to free its memory
|
|
||||||
aligned_vec.clear();
|
|
||||||
|
|
||||||
// Verify the new alignment
|
|
||||||
start = vec.data();
|
|
||||||
if (reinterpret_cast<std::uintptr_t>(start) % page_size != 0) {
|
|
||||||
throw std::runtime_error("Failed to align vector memory to page boundaries.");
|
|
||||||
}
|
|
||||||
|
|
||||||
LogKSMDetail("Vector reallocated to ensure page alignment. start [{}] size [{}] bytes", start, size);
|
|
||||||
} else {
|
|
||||||
LogKSMDetail("Vector is already page-aligned. start [{}] size [{}] bytes", start, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
// Mark memory for KSM (only on non-Windows systems)
|
|
||||||
MarkMemoryForKSM(start, size);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // EQEMU_KSM_HPP
|
|
||||||
@@ -1,600 +0,0 @@
|
|||||||
#include "mysql_stmt.h"
|
|
||||||
#include "eqemu_logsys.h"
|
|
||||||
#include "mutex.h"
|
|
||||||
#include "timer.h"
|
|
||||||
#include <charconv>
|
|
||||||
|
|
||||||
namespace mysql
|
|
||||||
{
|
|
||||||
|
|
||||||
void PreparedStmt::StmtDeleter::operator()(MYSQL_STMT* stmt) noexcept
|
|
||||||
{
|
|
||||||
// The connection must be locked when closing the stmt to avoid mysql errors
|
|
||||||
// in case another thread tries to use it during the close. If the mutex is
|
|
||||||
// changed to one that throws then exceptions need to be caught here.
|
|
||||||
LockMutex lock(mutex);
|
|
||||||
mysql_stmt_close(stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
PreparedStmt::PreparedStmt(MYSQL& mysql, std::string query, Mutex* mutex, StmtOptions opts)
|
|
||||||
: m_stmt(mysql_stmt_init(&mysql), { mutex }), m_query(std::move(query)), m_mutex(mutex), m_options(opts)
|
|
||||||
{
|
|
||||||
LockMutex lock(m_mutex);
|
|
||||||
if (mysql_stmt_prepare(m_stmt.get(), m_query.c_str(), static_cast<unsigned long>(m_query.size())) != 0)
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Prepare error: {}", GetStmtError()));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_params.resize(mysql_stmt_param_count(m_stmt.get()));
|
|
||||||
m_inputs.resize(m_params.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparedStmt::ThrowError(const std::string& error)
|
|
||||||
{
|
|
||||||
LogMySQLError("{}", error);
|
|
||||||
throw std::runtime_error(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string PreparedStmt::GetStmtError()
|
|
||||||
{
|
|
||||||
auto err = mysql_stmt_errno(m_stmt.get());
|
|
||||||
auto str = mysql_stmt_error(m_stmt.get());
|
|
||||||
return fmt::format("({}) [{}] for query [{}]", err, str, m_query);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void PreparedStmt::BindInput(size_t index, T value)
|
|
||||||
{
|
|
||||||
if (index >= m_inputs.size())
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Cannot bind input, index {} out of range", index));
|
|
||||||
}
|
|
||||||
|
|
||||||
impl::Bind& arg = m_inputs[index];
|
|
||||||
arg.is_null = std::is_same_v<T, std::nullptr_t>;
|
|
||||||
|
|
||||||
MYSQL_BIND& bind = m_params[index];
|
|
||||||
bind.is_unsigned = std::is_unsigned_v<T>;
|
|
||||||
bind.is_null = &arg.is_null;
|
|
||||||
bind.length = &arg.length;
|
|
||||||
|
|
||||||
auto old_type = bind.buffer_type;
|
|
||||||
|
|
||||||
if constexpr (std::is_arithmetic_v<T>)
|
|
||||||
{
|
|
||||||
if (arg.buffer.size() < sizeof(T))
|
|
||||||
{
|
|
||||||
arg.buffer.resize(std::max(sizeof(T), sizeof(int64_t)));
|
|
||||||
bind.buffer = arg.buffer.data();
|
|
||||||
m_need_bind = true;
|
|
||||||
}
|
|
||||||
memcpy(arg.buffer.data(), &value, sizeof(T));
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (std::is_same_v<T, int8_t> || std::is_same_v<T, uint8_t> || std::is_same_v<T, bool>)
|
|
||||||
{
|
|
||||||
bind.buffer_type = MYSQL_TYPE_TINY;
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, int16_t> || std::is_same_v<T, uint16_t>)
|
|
||||||
{
|
|
||||||
bind.buffer_type = MYSQL_TYPE_SHORT;
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>)
|
|
||||||
{
|
|
||||||
bind.buffer_type = MYSQL_TYPE_LONG;
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, int64_t> || std::is_same_v<T, uint64_t>)
|
|
||||||
{
|
|
||||||
bind.buffer_type = MYSQL_TYPE_LONGLONG;
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, float>)
|
|
||||||
{
|
|
||||||
bind.buffer_type = MYSQL_TYPE_FLOAT;
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, double>)
|
|
||||||
{
|
|
||||||
bind.buffer_type = MYSQL_TYPE_DOUBLE;
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, std::string_view>)
|
|
||||||
{
|
|
||||||
bind.buffer_type = MYSQL_TYPE_STRING;
|
|
||||||
if (arg.buffer.empty() || arg.buffer.size() < value.size())
|
|
||||||
{
|
|
||||||
arg.buffer.resize(static_cast<size_t>((value.size() + 1) * 1.5));
|
|
||||||
bind.buffer = arg.buffer.data();
|
|
||||||
bind.buffer_length = static_cast<unsigned long>(arg.buffer.size());
|
|
||||||
m_need_bind = true;
|
|
||||||
}
|
|
||||||
std::copy(value.begin(), value.end(), arg.buffer.begin());
|
|
||||||
arg.length = static_cast<unsigned long>(value.size());
|
|
||||||
}
|
|
||||||
else if constexpr (!std::is_same_v<T, std::nullptr_t>)
|
|
||||||
{
|
|
||||||
static_assert(false_v<T>, "Cannot bind unsupported type");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (old_type != bind.buffer_type)
|
|
||||||
{
|
|
||||||
m_need_bind = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparedStmt::BindInput(size_t index, const char* str)
|
|
||||||
{
|
|
||||||
BindInput(index, std::string_view(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparedStmt::BindInput(size_t index, const std::string& str)
|
|
||||||
{
|
|
||||||
BindInput(index, std::string_view(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
StmtResult PreparedStmt::Execute()
|
|
||||||
{
|
|
||||||
CheckArgs(0);
|
|
||||||
return DoExecute();
|
|
||||||
}
|
|
||||||
|
|
||||||
StmtResult PreparedStmt::Execute(const std::vector<param_t>& args)
|
|
||||||
{
|
|
||||||
CheckArgs(args.size());
|
|
||||||
for (size_t i = 0; i < args.size(); ++i)
|
|
||||||
{
|
|
||||||
std::visit([&](const auto& arg) { BindInput(i, arg); }, args[i]);
|
|
||||||
}
|
|
||||||
return DoExecute();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
StmtResult PreparedStmt::Execute(const std::vector<T>& args)
|
|
||||||
{
|
|
||||||
CheckArgs(args.size());
|
|
||||||
for (size_t i = 0; i < args.size(); ++i)
|
|
||||||
{
|
|
||||||
BindInput(i, args[i]);
|
|
||||||
}
|
|
||||||
return DoExecute();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparedStmt::CheckArgs(size_t argc)
|
|
||||||
{
|
|
||||||
if (argc != m_params.size())
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Bad arg count (got {}, expected {}) for [{}]", argc, m_params.size(), m_query));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StmtResult PreparedStmt::DoExecute()
|
|
||||||
{
|
|
||||||
BenchTimer timer;
|
|
||||||
LockMutex lock(m_mutex);
|
|
||||||
|
|
||||||
if (m_need_bind && mysql_stmt_bind_param(m_stmt.get(), m_params.data()) != 0)
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Bind param error: {}", GetStmtError()));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_need_bind = false;
|
|
||||||
|
|
||||||
if (mysql_stmt_execute(m_stmt.get()) != 0)
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Execute error: {}", GetStmtError()));
|
|
||||||
}
|
|
||||||
|
|
||||||
my_bool attr = m_options.use_max_length;
|
|
||||||
mysql_stmt_attr_set(m_stmt.get(), STMT_ATTR_UPDATE_MAX_LENGTH, &attr);
|
|
||||||
|
|
||||||
if (m_options.buffer_results && mysql_stmt_store_result(m_stmt.get()) != 0)
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Store result error: {}", GetStmtError()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Result buffers are bound on first execute and re-used if needed
|
|
||||||
if (m_results.empty())
|
|
||||||
{
|
|
||||||
BindResults();
|
|
||||||
}
|
|
||||||
|
|
||||||
StmtResult res(m_stmt.get(), m_results.size());
|
|
||||||
|
|
||||||
if (m_results.empty())
|
|
||||||
{
|
|
||||||
LogMySQLQuery("{} -- ({} row(s) affected) ({:.6f}s)", m_query, res.RowsAffected(), timer.elapsed());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogMySQLQuery("{} -- ({} row(s) returned) ({:.6f}s)", m_query, res.RowCount(), timer.elapsed());
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparedStmt::BindResults()
|
|
||||||
{
|
|
||||||
MYSQL_RES* res = mysql_stmt_result_metadata(m_stmt.get());
|
|
||||||
if (!res)
|
|
||||||
{
|
|
||||||
return; // did not produce a result set
|
|
||||||
}
|
|
||||||
|
|
||||||
MYSQL_FIELD* fields = mysql_fetch_fields(res);
|
|
||||||
m_columns.resize(mysql_num_fields(res));
|
|
||||||
m_results.resize(m_columns.size());
|
|
||||||
|
|
||||||
for (int i = 0; i < static_cast<int>(m_columns.size()); ++i)
|
|
||||||
{
|
|
||||||
impl::BindColumn& col = m_columns[i].m_col;
|
|
||||||
MYSQL_BIND& bind = m_results[i];
|
|
||||||
|
|
||||||
col.index = i;
|
|
||||||
col.name = fields[i].name;
|
|
||||||
col.buffer_type = fields[i].type;
|
|
||||||
col.is_unsigned = (fields[i].flags & UNSIGNED_FLAG) != 0;
|
|
||||||
col.buffer.resize(GetResultBufferSize(fields[i]));
|
|
||||||
|
|
||||||
bind.buffer_type = col.buffer_type;
|
|
||||||
bind.buffer = col.buffer.data();
|
|
||||||
bind.buffer_length = static_cast<unsigned long>(col.buffer.size());
|
|
||||||
bind.is_unsigned = col.is_unsigned;
|
|
||||||
bind.is_null = &col.is_null;
|
|
||||||
bind.length = &col.length;
|
|
||||||
bind.error = &col.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_free_result(res);
|
|
||||||
|
|
||||||
if (!m_results.empty() && mysql_stmt_bind_result(m_stmt.get(), m_results.data()) != 0)
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Bind result error: {}", GetStmtError()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int PreparedStmt::GetResultBufferSize(const MYSQL_FIELD& field) const
|
|
||||||
{
|
|
||||||
switch (field.type)
|
|
||||||
{
|
|
||||||
case MYSQL_TYPE_TINY:
|
|
||||||
return sizeof(int8_t);
|
|
||||||
case MYSQL_TYPE_SHORT:
|
|
||||||
return sizeof(int16_t);
|
|
||||||
case MYSQL_TYPE_INT24:
|
|
||||||
case MYSQL_TYPE_LONG:
|
|
||||||
return sizeof(int32_t);
|
|
||||||
case MYSQL_TYPE_LONGLONG:
|
|
||||||
return sizeof(int64_t);
|
|
||||||
case MYSQL_TYPE_FLOAT:
|
|
||||||
return sizeof(float);
|
|
||||||
case MYSQL_TYPE_DOUBLE:
|
|
||||||
return sizeof(double);
|
|
||||||
case MYSQL_TYPE_TIME:
|
|
||||||
case MYSQL_TYPE_DATE:
|
|
||||||
case MYSQL_TYPE_DATETIME:
|
|
||||||
case MYSQL_TYPE_TIMESTAMP:
|
|
||||||
return sizeof(MYSQL_TIME);
|
|
||||||
default: // if max_length is unavailable for strings buffers are resized on fetch
|
|
||||||
return field.max_length + 1; // ensure valid buffer created
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StmtRow PreparedStmt::Fetch()
|
|
||||||
{
|
|
||||||
StmtRow row;
|
|
||||||
if (!m_columns.empty())
|
|
||||||
{
|
|
||||||
int rc = mysql_stmt_fetch(m_stmt.get());
|
|
||||||
if (rc == 1)
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Fetch error: {}", GetStmtError()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != MYSQL_NO_DATA)
|
|
||||||
{
|
|
||||||
if (rc == MYSQL_DATA_TRUNCATED)
|
|
||||||
{
|
|
||||||
FetchTruncated();
|
|
||||||
}
|
|
||||||
row = StmtRow(m_columns);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreparedStmt::FetchTruncated()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < static_cast<int>(m_columns.size()); ++i)
|
|
||||||
{
|
|
||||||
impl::BindColumn& col = m_columns[i].m_col;
|
|
||||||
if (col.error)
|
|
||||||
{
|
|
||||||
MYSQL_BIND& bind = m_results[i];
|
|
||||||
col.buffer.resize(static_cast<size_t>(col.length * 1.5));
|
|
||||||
bind.buffer = col.buffer.data();
|
|
||||||
bind.buffer_length = static_cast<unsigned long>(col.buffer.size());
|
|
||||||
|
|
||||||
mysql_stmt_fetch_column(m_stmt.get(), &bind, i, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mysql_stmt_bind_result(m_stmt.get(), m_results.data()) != 0)
|
|
||||||
{
|
|
||||||
ThrowError(fmt::format("Fetch rebind result error: {}", GetStmtError()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
StmtResult::StmtResult(MYSQL_STMT* stmt, size_t columns)
|
|
||||||
{
|
|
||||||
m_num_cols = static_cast<int>(columns);
|
|
||||||
m_num_rows = mysql_stmt_num_rows(stmt); // requires buffered results
|
|
||||||
m_affected = mysql_stmt_affected_rows(stmt);
|
|
||||||
m_insert_id = mysql_stmt_insert_id(stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const StmtColumn* StmtRow::GetColumn(size_t index) const
|
|
||||||
{
|
|
||||||
return index < m_columns.size() ? &m_columns[index] : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const StmtColumn* StmtRow::GetColumn(std::string_view name) const
|
|
||||||
{
|
|
||||||
auto it = std::ranges::find_if(m_columns,
|
|
||||||
[name](const StmtColumn& col) { return col.Name() == name; });
|
|
||||||
|
|
||||||
return it != m_columns.end() ? &(*it) : nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string> StmtRow::operator[](size_t index) const
|
|
||||||
{
|
|
||||||
return GetStr(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string> StmtRow::operator[](std::string_view name) const
|
|
||||||
{
|
|
||||||
return GetStr(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string> StmtRow::GetStr(size_t index) const
|
|
||||||
{
|
|
||||||
const StmtColumn* col = GetColumn(index);
|
|
||||||
return col ? col->GetStr() : std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string> StmtRow::GetStr(std::string_view name) const
|
|
||||||
{
|
|
||||||
const StmtColumn* col = GetColumn(name);
|
|
||||||
return col ? col->GetStr() : std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> requires std::is_arithmetic_v<T>
|
|
||||||
std::optional<T> StmtRow::Get(size_t index) const
|
|
||||||
{
|
|
||||||
const StmtColumn* col = GetColumn(index);
|
|
||||||
return col ? col->Get<T>() : std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> requires std::is_arithmetic_v<T>
|
|
||||||
std::optional<T> StmtRow::Get(std::string_view name) const
|
|
||||||
{
|
|
||||||
const StmtColumn* col = GetColumn(name);
|
|
||||||
return col ? col->Get<T>() : std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static time_t MakeTime(const MYSQL_TIME& mt)
|
|
||||||
{
|
|
||||||
// buffer mt given in mysql session time zone (assumes local)
|
|
||||||
std::tm tm{};
|
|
||||||
tm.tm_year = mt.year - 1900;
|
|
||||||
tm.tm_mon = mt.month - 1;
|
|
||||||
tm.tm_mday = mt.day;
|
|
||||||
tm.tm_hour = mt.hour;
|
|
||||||
tm.tm_min = mt.minute;
|
|
||||||
tm.tm_sec = mt.second;
|
|
||||||
tm.tm_isdst = -1;
|
|
||||||
return std::mktime(&tm);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int MakeSeconds(const MYSQL_TIME& mt)
|
|
||||||
{
|
|
||||||
return (mt.neg ? -1 : 1) * static_cast<int>(mt.hour * 3600 + mt.minute * 60 + mt.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint64_t MakeBits(std::span<const uint8_t> data)
|
|
||||||
{
|
|
||||||
// byte stream for bits is in big endian
|
|
||||||
uint64_t bits = 0;
|
|
||||||
for (size_t i = 0; i < data.size() && i < sizeof(uint64_t); ++i)
|
|
||||||
{
|
|
||||||
bits |= static_cast<uint64_t>(data[data.size() - i - 1] & 0xff) << (i * 8);
|
|
||||||
}
|
|
||||||
return bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
concept has_from_chars = requires (const char* first, const char* last, T value)
|
|
||||||
{
|
|
||||||
std::from_chars(first, last, value);
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
static T FromString(std::string_view sv)
|
|
||||||
{
|
|
||||||
if constexpr (std::is_same_v<T, bool>)
|
|
||||||
{
|
|
||||||
// return false for empty (zero-length) strings
|
|
||||||
return !sv.empty();
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, float> && !has_from_chars<T>)
|
|
||||||
{
|
|
||||||
return std::strtof(std::string(sv).c_str(), nullptr);
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same_v<T, double> && !has_from_chars<T>)
|
|
||||||
{
|
|
||||||
return std::strtod(std::string(sv).c_str(), nullptr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// non numbers return a zero initialized T (could return nullopt instead)
|
|
||||||
T value = {};
|
|
||||||
std::from_chars(sv.data(), sv.data() + sv.size(), value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string FormatTime(enum_field_types type, const MYSQL_TIME& mt)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case MYSQL_TYPE_TIME: // hhh:mm:ss '-838:59:59' to '838:59:59'
|
|
||||||
return fmt::format("{}{:02d}:{:02d}:{:02d}", mt.neg ? "-" : "", mt.hour, mt.minute, mt.second);
|
|
||||||
case MYSQL_TYPE_DATE: // YYYY-MM-DD '1000-01-01' to '9999-12-31'
|
|
||||||
return fmt::format("{}-{:02d}-{:02d}", mt.year, mt.month, mt.day);
|
|
||||||
case MYSQL_TYPE_DATETIME: // YYYY-MM-DD hh:mm:ss '1000-01-01 00:00:00' to '9999-12-31 23:59:59'
|
|
||||||
case MYSQL_TYPE_TIMESTAMP: // YYYY-MM-DD hh:mm:ss '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC
|
|
||||||
return fmt::format("{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}", mt.year, mt.month, mt.day, mt.hour, mt.minute, mt.second);
|
|
||||||
default:
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string_view> StmtColumn::GetStrView() const
|
|
||||||
{
|
|
||||||
if (m_col.is_null)
|
|
||||||
{
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (m_col.buffer_type)
|
|
||||||
{
|
|
||||||
case MYSQL_TYPE_NEWDECIMAL:
|
|
||||||
case MYSQL_TYPE_TINY_BLOB:
|
|
||||||
case MYSQL_TYPE_MEDIUM_BLOB:
|
|
||||||
case MYSQL_TYPE_LONG_BLOB:
|
|
||||||
case MYSQL_TYPE_BLOB:
|
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
|
||||||
case MYSQL_TYPE_STRING:
|
|
||||||
return std::make_optional<std::string_view>(reinterpret_cast<const char*>(m_col.buffer.data()), m_col.length);
|
|
||||||
default:
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<std::string> StmtColumn::GetStr() const
|
|
||||||
{
|
|
||||||
if (m_col.is_null)
|
|
||||||
{
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (m_col.buffer_type)
|
|
||||||
{
|
|
||||||
case MYSQL_TYPE_TINY:
|
|
||||||
return m_col.is_unsigned ? fmt::format_int(BitCast<uint8_t>()).c_str() : fmt::format_int(BitCast<int8_t>()).c_str();
|
|
||||||
case MYSQL_TYPE_SHORT:
|
|
||||||
return m_col.is_unsigned ? fmt::format_int(BitCast<uint16_t>()).c_str() : fmt::format_int(BitCast<int16_t>()).c_str();
|
|
||||||
case MYSQL_TYPE_INT24:
|
|
||||||
case MYSQL_TYPE_LONG:
|
|
||||||
return m_col.is_unsigned ? fmt::format_int(BitCast<uint32_t>()).c_str() : fmt::format_int(BitCast<int32_t>()).c_str();
|
|
||||||
case MYSQL_TYPE_LONGLONG:
|
|
||||||
return m_col.is_unsigned ? fmt::format_int(BitCast<uint64_t>()).c_str() : fmt::format_int(BitCast<int64_t>()).c_str();
|
|
||||||
case MYSQL_TYPE_FLOAT:
|
|
||||||
return fmt::format("{}", BitCast<float>());
|
|
||||||
case MYSQL_TYPE_DOUBLE:
|
|
||||||
return fmt::format("{}", BitCast<double>());
|
|
||||||
case MYSQL_TYPE_TIME:
|
|
||||||
case MYSQL_TYPE_DATE:
|
|
||||||
case MYSQL_TYPE_DATETIME:
|
|
||||||
case MYSQL_TYPE_TIMESTAMP:
|
|
||||||
return FormatTime(m_col.buffer_type, BitCast<MYSQL_TIME>());
|
|
||||||
case MYSQL_TYPE_BIT:
|
|
||||||
return fmt::format_int(*Get<uint64_t>()).c_str();
|
|
||||||
case MYSQL_TYPE_NEWDECIMAL:
|
|
||||||
case MYSQL_TYPE_TINY_BLOB:
|
|
||||||
case MYSQL_TYPE_MEDIUM_BLOB:
|
|
||||||
case MYSQL_TYPE_LONG_BLOB:
|
|
||||||
case MYSQL_TYPE_BLOB:
|
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
|
||||||
case MYSQL_TYPE_STRING:
|
|
||||||
return std::make_optional<std::string>(reinterpret_cast<const char*>(m_col.buffer.data()), m_col.length);
|
|
||||||
default:
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> requires std::is_arithmetic_v<T>
|
|
||||||
std::optional<T> StmtColumn::Get() const
|
|
||||||
{
|
|
||||||
if (m_col.is_null)
|
|
||||||
{
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (m_col.buffer_type)
|
|
||||||
{
|
|
||||||
case MYSQL_TYPE_TINY:
|
|
||||||
return m_col.is_unsigned ? static_cast<T>(BitCast<uint8_t>()) : static_cast<T>(BitCast<int8_t>());
|
|
||||||
case MYSQL_TYPE_SHORT:
|
|
||||||
return m_col.is_unsigned ? static_cast<T>(BitCast<uint16_t>()) : static_cast<T>(BitCast<int16_t>());
|
|
||||||
case MYSQL_TYPE_INT24:
|
|
||||||
case MYSQL_TYPE_LONG:
|
|
||||||
return m_col.is_unsigned ? static_cast<T>(BitCast<uint32_t>()) : static_cast<T>(BitCast<int32_t>());
|
|
||||||
case MYSQL_TYPE_LONGLONG:
|
|
||||||
return m_col.is_unsigned ? static_cast<T>(BitCast<uint64_t>()) : static_cast<T>(BitCast<int64_t>());
|
|
||||||
case MYSQL_TYPE_FLOAT:
|
|
||||||
return static_cast<T>(BitCast<float>());
|
|
||||||
case MYSQL_TYPE_DOUBLE:
|
|
||||||
return static_cast<T>(BitCast<double>());
|
|
||||||
case MYSQL_TYPE_TIME: // return as total seconds
|
|
||||||
return static_cast<T>(MakeSeconds(BitCast<MYSQL_TIME>()));
|
|
||||||
case MYSQL_TYPE_DATE:
|
|
||||||
case MYSQL_TYPE_DATETIME:
|
|
||||||
case MYSQL_TYPE_TIMESTAMP: // return as epoch timestamp
|
|
||||||
return static_cast<T>(MakeTime(BitCast<MYSQL_TIME>()));
|
|
||||||
case MYSQL_TYPE_BIT:
|
|
||||||
return static_cast<T>(MakeBits({ m_col.buffer.data(), m_col.length }));
|
|
||||||
case MYSQL_TYPE_NEWDECIMAL:
|
|
||||||
case MYSQL_TYPE_TINY_BLOB:
|
|
||||||
case MYSQL_TYPE_MEDIUM_BLOB:
|
|
||||||
case MYSQL_TYPE_LONG_BLOB:
|
|
||||||
case MYSQL_TYPE_BLOB:
|
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
|
||||||
case MYSQL_TYPE_STRING:
|
|
||||||
return FromString<T>({ reinterpret_cast<const char*>(m_col.buffer.data()), m_col.length });
|
|
||||||
default:
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// explicit template instantiations for supported types
|
|
||||||
template void PreparedStmt::BindInput(size_t, std::string_view);
|
|
||||||
template void PreparedStmt::BindInput(size_t, std::nullptr_t);
|
|
||||||
template StmtResult PreparedStmt::Execute(const std::vector<std::string_view>&);
|
|
||||||
template StmtResult PreparedStmt::Execute(const std::vector<std::string>&);
|
|
||||||
template StmtResult PreparedStmt::Execute(const std::vector<const char*>&);
|
|
||||||
|
|
||||||
#define INSTANTIATE(T) \
|
|
||||||
template void PreparedStmt::BindInput(size_t, T); \
|
|
||||||
template StmtResult PreparedStmt::Execute(const std::vector<T>&); \
|
|
||||||
template std::optional<T> StmtRow::Get(size_t) const; \
|
|
||||||
template std::optional<T> StmtRow::Get(std::string_view) const; \
|
|
||||||
template std::optional<T> StmtColumn::Get() const;
|
|
||||||
|
|
||||||
INSTANTIATE(bool);
|
|
||||||
INSTANTIATE(int8_t);
|
|
||||||
INSTANTIATE(uint8_t);
|
|
||||||
INSTANTIATE(int16_t);
|
|
||||||
INSTANTIATE(uint16_t);
|
|
||||||
INSTANTIATE(int32_t);
|
|
||||||
INSTANTIATE(uint32_t);
|
|
||||||
INSTANTIATE(int64_t);
|
|
||||||
INSTANTIATE(uint64_t);
|
|
||||||
INSTANTIATE(float);
|
|
||||||
INSTANTIATE(double);
|
|
||||||
|
|
||||||
} // namespace mysql
|
|
||||||
@@ -1,221 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "mysql.h"
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstring>
|
|
||||||
#include <memory>
|
|
||||||
#include <optional>
|
|
||||||
#include <span>
|
|
||||||
#include <string>
|
|
||||||
#include <string_view>
|
|
||||||
#include <variant>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class Mutex;
|
|
||||||
|
|
||||||
namespace mysql
|
|
||||||
{
|
|
||||||
|
|
||||||
// support MySQL 8.0.1+ API which removed the my_bool type
|
|
||||||
#if !defined(MARIADB_VERSION_ID) && MYSQL_VERSION_ID >= 80001
|
|
||||||
using my_bool = bool;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename>
|
|
||||||
inline constexpr bool false_v = false;
|
|
||||||
|
|
||||||
namespace impl
|
|
||||||
{
|
|
||||||
|
|
||||||
struct Bind
|
|
||||||
{
|
|
||||||
std::vector<uint8_t> buffer;
|
|
||||||
unsigned long length = 0;
|
|
||||||
my_bool is_null = false;
|
|
||||||
my_bool error = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BindColumn : Bind
|
|
||||||
{
|
|
||||||
int index = 0;
|
|
||||||
std::string name;
|
|
||||||
bool is_unsigned = false;
|
|
||||||
enum_field_types buffer_type = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace impl
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct StmtOptions
|
|
||||||
{
|
|
||||||
// Enable buffering (storing) entire result set after executing a statement
|
|
||||||
bool buffer_results = true;
|
|
||||||
|
|
||||||
// Enable MySQL to update max_length of fields in execute result set (requires buffering)
|
|
||||||
bool use_max_length = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Holds ownership of bound column value buffer
|
|
||||||
class StmtColumn
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int Index() const { return m_col.index; }
|
|
||||||
bool IsNull() const { return m_col.is_null; }
|
|
||||||
bool IsUnsigned() const { return m_col.is_unsigned; }
|
|
||||||
enum_field_types Type() const { return m_col.buffer_type; }
|
|
||||||
const std::string& Name() const { return m_col.name; }
|
|
||||||
|
|
||||||
// Get view of column value buffer
|
|
||||||
std::span<const uint8_t> GetBuf() const { return { m_col.buffer.data(), m_col.length }; }
|
|
||||||
|
|
||||||
// Get view of column string value. Returns nullopt if value is NULL or not a string
|
|
||||||
std::optional<std::string_view> GetStrView() const;
|
|
||||||
|
|
||||||
// Get column value as string. Returns nullopt if value is NULL or field type unsupported
|
|
||||||
std::optional<std::string> GetStr() const;
|
|
||||||
|
|
||||||
// Get column value as numeric T. Returns nullopt if value NULL or field type unsupported
|
|
||||||
template <typename T> requires std::is_arithmetic_v<T>
|
|
||||||
std::optional<T> Get() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// uses memcpy for type punning buffer data to avoid UB with strict aliasing
|
|
||||||
template <typename T>
|
|
||||||
T BitCast() const
|
|
||||||
{
|
|
||||||
T val;
|
|
||||||
assert(sizeof(T) == m_col.length);
|
|
||||||
memcpy(&val, m_col.buffer.data(), sizeof(T));
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend class PreparedStmt; // access to allocate and bind buffers
|
|
||||||
friend class StmtResult; // access to resize truncated buffers
|
|
||||||
impl::BindColumn m_col;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Provides a non-owning view of PreparedStmt column value buffers
|
|
||||||
// Evaluates false if it does not contain a valid row
|
|
||||||
class StmtRow
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StmtRow() = default;
|
|
||||||
StmtRow(std::span<const StmtColumn> columns) : m_columns(columns) {};
|
|
||||||
|
|
||||||
explicit operator bool() const noexcept { return !m_columns.empty(); }
|
|
||||||
|
|
||||||
int ColumnCount() const { return static_cast<int>(m_columns.size()); }
|
|
||||||
const StmtColumn* GetColumn(size_t index) const;
|
|
||||||
const StmtColumn* GetColumn(std::string_view name) const;
|
|
||||||
|
|
||||||
// Get specified column value as string
|
|
||||||
// Returns nullopt if column invalid, value is NULL, or field type unsupported
|
|
||||||
std::optional<std::string> operator[](size_t index) const;
|
|
||||||
std::optional<std::string> operator[](std::string_view name) const;
|
|
||||||
std::optional<std::string> GetStr(size_t index) const;
|
|
||||||
std::optional<std::string> GetStr(std::string_view name) const;
|
|
||||||
|
|
||||||
// Get specified column value as numeric T
|
|
||||||
// Returns nullopt if column invalid, value is NULL, or field type unsupported
|
|
||||||
template <typename T> requires std::is_arithmetic_v<T>
|
|
||||||
std::optional<T> Get(size_t index) const;
|
|
||||||
|
|
||||||
template <typename T> requires std::is_arithmetic_v<T>
|
|
||||||
std::optional<T> Get(std::string_view name) const;
|
|
||||||
|
|
||||||
auto begin() const { return m_columns.begin(); }
|
|
||||||
auto end() const { return m_columns.end(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::span<const StmtColumn> m_columns;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Result meta data for an executed prepared statement
|
|
||||||
class StmtResult
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StmtResult() = default;
|
|
||||||
StmtResult(MYSQL_STMT* stmt, size_t columns);
|
|
||||||
|
|
||||||
int ColumnCount() const { return m_num_cols; }
|
|
||||||
uint64_t RowCount() const { return m_num_rows; }
|
|
||||||
uint64_t RowsAffected() const { return m_affected; }
|
|
||||||
uint64_t LastInsertID() const { return m_insert_id; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_num_cols = 0;
|
|
||||||
uint64_t m_num_rows = 0;
|
|
||||||
uint64_t m_affected = 0;
|
|
||||||
uint64_t m_insert_id = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class PreparedStmt
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Supported argument types for execute
|
|
||||||
using param_t = std::variant<int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
|
|
||||||
int64_t, uint64_t, float, double, bool, std::string_view, std::nullptr_t>;
|
|
||||||
|
|
||||||
PreparedStmt() = delete;
|
|
||||||
PreparedStmt(MYSQL& mysql, std::string query, Mutex* mutex, StmtOptions opts = {});
|
|
||||||
|
|
||||||
const std::string& GetQuery() const { return m_query; }
|
|
||||||
StmtOptions GetOptions() const { return m_options; }
|
|
||||||
void SetOptions(StmtOptions options) { m_options = options; }
|
|
||||||
void FreeResult() { mysql_stmt_free_result(m_stmt.get()); }
|
|
||||||
|
|
||||||
// Execute the prepared statement with specified arguments
|
|
||||||
// Throws exception on error
|
|
||||||
template <typename T>
|
|
||||||
StmtResult Execute(const std::vector<T>& args);
|
|
||||||
StmtResult Execute(const std::vector<param_t>& args);
|
|
||||||
StmtResult Execute();
|
|
||||||
|
|
||||||
// Fetch the next row into column buffers (overwrites previous row values)
|
|
||||||
// Return value evaluates false if no more rows to fetch
|
|
||||||
// Throws exception on error
|
|
||||||
StmtRow Fetch();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CheckArgs(size_t argc);
|
|
||||||
StmtResult DoExecute();
|
|
||||||
void BindResults();
|
|
||||||
void FetchTruncated();
|
|
||||||
int GetResultBufferSize(const MYSQL_FIELD& field) const;
|
|
||||||
void ThrowError(const std::string& error);
|
|
||||||
std::string GetStmtError();
|
|
||||||
|
|
||||||
// bind an input value to a query parameter by index
|
|
||||||
template <typename T>
|
|
||||||
void BindInput(size_t index, T value);
|
|
||||||
void BindInput(size_t index, const char* str);
|
|
||||||
void BindInput(size_t index, const std::string& str);
|
|
||||||
|
|
||||||
struct StmtDeleter
|
|
||||||
{
|
|
||||||
Mutex* mutex = nullptr;
|
|
||||||
void operator()(MYSQL_STMT* stmt) noexcept;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<MYSQL_STMT, StmtDeleter> m_stmt;
|
|
||||||
std::vector<MYSQL_BIND> m_params; // input binds
|
|
||||||
std::vector<MYSQL_BIND> m_results; // result binds
|
|
||||||
std::vector<impl::Bind> m_inputs; // execute buffers (addresses bound)
|
|
||||||
std::vector<StmtColumn> m_columns; // fetch buffers (addresses bound)
|
|
||||||
std::string m_query;
|
|
||||||
StmtOptions m_options = {};
|
|
||||||
bool m_need_bind = true;
|
|
||||||
Mutex* m_mutex = nullptr; // connection mutex
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace mysql
|
|
||||||
@@ -80,8 +80,6 @@ void EQ::Net::TCPConnection::Start() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nread == UV_EOF) {
|
else if (nread == UV_EOF) {
|
||||||
connection->Disconnect();
|
|
||||||
|
|
||||||
if (buf->base) {
|
if (buf->base) {
|
||||||
delete[] buf->base;
|
delete[] buf->base;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,7 +250,6 @@ IN(OP_TraderBuy, TraderBuy_Struct);
|
|||||||
IN(OP_Trader, Trader_ShowItems_Struct);
|
IN(OP_Trader, Trader_ShowItems_Struct);
|
||||||
IN(OP_GMFind, GMSummon_Struct);
|
IN(OP_GMFind, GMSummon_Struct);
|
||||||
IN(OP_PickPocket, PickPocket_Struct);
|
IN(OP_PickPocket, PickPocket_Struct);
|
||||||
IN(OP_PickZone, PickZone_Struct);
|
|
||||||
IN(OP_Bind_Wound, BindWound_Struct);
|
IN(OP_Bind_Wound, BindWound_Struct);
|
||||||
INr(OP_TrackTarget);
|
INr(OP_TrackTarget);
|
||||||
INr(OP_Track);
|
INr(OP_Track);
|
||||||
|
|||||||
+7
-14
@@ -2288,13 +2288,13 @@ namespace RoF
|
|||||||
outapp->WriteSInt32(345); // Mana Total ?
|
outapp->WriteSInt32(345); // Mana Total ?
|
||||||
|
|
||||||
// these are needed to fix display bugs
|
// these are needed to fix display bugs
|
||||||
outapp->WriteUInt32(0x19); // base CR
|
outapp->WriteUInt32(emu->cold_resist); // base CR
|
||||||
outapp->WriteUInt32(0x19); // base FR
|
outapp->WriteUInt32(emu->fire_resist); // base FR
|
||||||
outapp->WriteUInt32(0x19); // base MR
|
outapp->WriteUInt32(emu->magic_resist); // base MR
|
||||||
outapp->WriteUInt32(0xf); // base DR
|
outapp->WriteUInt32(emu->disease_resist); // base DR
|
||||||
outapp->WriteUInt32(0xf); // base PR
|
outapp->WriteUInt32(emu->poison_resist); // base PR
|
||||||
outapp->WriteUInt32(0xf); // base PhR?
|
outapp->WriteUInt32(0xf); // base PhR?
|
||||||
outapp->WriteUInt32(0xf); // base Corrup
|
outapp->WriteUInt32(emu->corruption_resist); // base Corrup
|
||||||
outapp->WriteUInt32(0); // Unknown
|
outapp->WriteUInt32(0); // Unknown
|
||||||
outapp->WriteUInt32(0); // Unknown
|
outapp->WriteUInt32(0); // Unknown
|
||||||
outapp->WriteUInt32(0); // Unknown
|
outapp->WriteUInt32(0); // Unknown
|
||||||
@@ -5188,14 +5188,7 @@ namespace RoF
|
|||||||
|
|
||||||
//sprintf(hdr.unknown000, "06e0002Y1W00");
|
//sprintf(hdr.unknown000, "06e0002Y1W00");
|
||||||
|
|
||||||
strn0cpy(
|
snprintf(hdr.unknown000, sizeof(hdr.unknown000), "%016d", item->ID);
|
||||||
hdr.unknown000,
|
|
||||||
fmt::format(
|
|
||||||
"{:016}\0",
|
|
||||||
packet_type == ItemPacketInvalid ? 0 : inst->GetSerialNumber()
|
|
||||||
).c_str(),
|
|
||||||
sizeof(hdr.unknown000)
|
|
||||||
);
|
|
||||||
|
|
||||||
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
|
hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
|
||||||
hdr.unknown004 = 0;
|
hdr.unknown004 = 0;
|
||||||
|
|||||||
+35
-140
@@ -433,9 +433,7 @@ namespace RoF2
|
|||||||
VARSTRUCT_ENCODE_TYPE(uint32, eq, i.item_icon);
|
VARSTRUCT_ENCODE_TYPE(uint32, eq, i.item_icon);
|
||||||
VARSTRUCT_SKIP_TYPE(uint32, eq);
|
VARSTRUCT_SKIP_TYPE(uint32, eq);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->QueuePacket(outapp.get());
|
dest->QueuePacket(outapp.get());
|
||||||
safe_delete(in);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -470,8 +468,8 @@ namespace RoF2
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto p_size = 41 * results.size() + name_size + 14;
|
auto p_size = 41 * results.size() + name_size + 14;
|
||||||
auto buffer = new char[p_size];
|
auto buffer = std::make_unique<char[]>(p_size);
|
||||||
auto bufptr = buffer;
|
auto bufptr = buffer.get();
|
||||||
|
|
||||||
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0);
|
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, 0);
|
||||||
VARSTRUCT_ENCODE_TYPE(uint16, bufptr, results[0].trader_zone_id);
|
VARSTRUCT_ENCODE_TYPE(uint16, bufptr, results[0].trader_zone_id);
|
||||||
@@ -489,11 +487,10 @@ namespace RoF2
|
|||||||
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, i.item_stat); //itemstat
|
VARSTRUCT_ENCODE_TYPE(uint32, bufptr, i.item_stat); //itemstat
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_delete_array(in->pBuffer);
|
safe_delete(in->pBuffer);
|
||||||
in->size = p_size;
|
in->size = p_size;
|
||||||
in->pBuffer = (uchar*)buffer;
|
in->pBuffer = (uchar *) buffer.get();
|
||||||
dest->QueuePacket(in);
|
dest->QueuePacket(in);
|
||||||
safe_delete(in);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -503,22 +500,21 @@ namespace RoF2
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WelcomeMessage: {
|
case WelcomeMessage: {
|
||||||
auto buffer = new char[sizeof(structs::BazaarWelcome_Struct)];
|
auto buffer = std::make_unique<char[]>(sizeof(structs::BazaarWelcome_Struct));
|
||||||
auto emu = (BazaarWelcome_Struct *) in->pBuffer;
|
auto emu = (BazaarWelcome_Struct *) in->pBuffer;
|
||||||
auto eq = (structs::BazaarWelcome_Struct *) buffer;
|
auto eq = (structs::BazaarWelcome_Struct *) buffer.get();
|
||||||
|
|
||||||
eq->action = structs::RoF2BazaarTraderBuyerActions::WelcomeMessage;
|
eq->action = structs::RoF2BazaarTraderBuyerActions::WelcomeMessage;
|
||||||
eq->num_of_traders = emu->traders;
|
eq->num_of_traders = emu->traders;
|
||||||
eq->num_of_items = emu->items;
|
eq->num_of_items = emu->items;
|
||||||
|
|
||||||
safe_delete_array(in->pBuffer);
|
safe_delete(in->pBuffer);
|
||||||
in->SetOpcode(OP_TraderShop);
|
in->SetOpcode(OP_TraderShop);
|
||||||
in->size = sizeof(structs::BazaarWelcome_Struct);
|
in->size = sizeof(structs::BazaarWelcome_Struct);
|
||||||
in->pBuffer = (uchar *)buffer;
|
in->pBuffer = (uchar *) buffer.get();
|
||||||
|
|
||||||
LogTrading("(RoF2) WelcomeMessage action <green>[{}]", action);
|
LogTrading("(RoF2) WelcomeMessage action <green>[{}]", action);
|
||||||
dest->QueuePacket(in);
|
dest->QueuePacket(in);
|
||||||
safe_delete(in);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -591,17 +587,15 @@ namespace RoF2
|
|||||||
eq->entity_id = emu->entity_id;
|
eq->entity_id = emu->entity_id;
|
||||||
eq->trader_id = emu->trader_id;
|
eq->trader_id = emu->trader_id;
|
||||||
eq->zone_id = emu->zone_id;
|
eq->zone_id = emu->zone_id;
|
||||||
eq->zone_instance_id = emu->zone_instance_id;
|
|
||||||
strn0cpy(eq->trader_name, emu->trader_name, sizeof(eq->trader_name));
|
strn0cpy(eq->trader_name, emu->trader_name, sizeof(eq->trader_name));
|
||||||
|
|
||||||
LogTrading(
|
LogTrading(
|
||||||
"(RoF2) AddTraderToBazaarWindow action <green>[{}] trader_id <green>[{}] entity_id <green>[{}] "
|
"(RoF2) AddTraderToBazaarWindow action <green>[{}] trader_id <green>[{}] entity_id <green>[{}] zone_id <green>[{}]",
|
||||||
"zone_id <green>[{}] zone_instance_id <green>[{}]",
|
|
||||||
eq->action,
|
eq->action,
|
||||||
eq->trader_id,
|
eq->trader_id,
|
||||||
eq->entity_id,
|
eq->entity_id,
|
||||||
eq->zone_id,
|
eq->zone_id
|
||||||
eq->zone_instance_id);
|
);
|
||||||
dest->FastQueuePacket(&outapp);
|
dest->FastQueuePacket(&outapp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -896,9 +890,7 @@ namespace RoF2
|
|||||||
VARSTRUCT_ENCODE_TYPE(uint16, eq, b.buyer_zone_instance_id);
|
VARSTRUCT_ENCODE_TYPE(uint16, eq, b.buyer_zone_instance_id);
|
||||||
VARSTRUCT_ENCODE_STRING(eq, b.buyer_name.c_str());
|
VARSTRUCT_ENCODE_STRING(eq, b.buyer_name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->QueuePacket(outapp.get());
|
dest->QueuePacket(outapp.get());
|
||||||
safe_delete(inapp);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Barter_RemoveFromMerchantWindow: {
|
case Barter_RemoveFromMerchantWindow: {
|
||||||
@@ -969,7 +961,6 @@ namespace RoF2
|
|||||||
VARSTRUCT_ENCODE_TYPE(uint32, eq, blsi.seller_quantity);
|
VARSTRUCT_ENCODE_TYPE(uint32, eq, blsi.seller_quantity);
|
||||||
|
|
||||||
dest->QueuePacket(outapp.get());
|
dest->QueuePacket(outapp.get());
|
||||||
safe_delete(inapp);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -1350,58 +1341,6 @@ namespace RoF2
|
|||||||
dest->FastQueuePacket(&in, ack_req);
|
dest->FastQueuePacket(&in, ack_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
ENCODE(OP_EvolveItem)
|
|
||||||
{
|
|
||||||
EQApplicationPacket *in = *p;
|
|
||||||
*p = nullptr;
|
|
||||||
|
|
||||||
auto action = *reinterpret_cast<uint32 *>(in->pBuffer);
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case EvolvingItems::Actions::TRANSFER_WINDOW_DETAILS: {
|
|
||||||
auto emu = reinterpret_cast<EvolveItemMessaging *>(in->pBuffer);
|
|
||||||
|
|
||||||
EvolveXPWindowSend e{};
|
|
||||||
EQ::Util::MemoryStreamReader ss(emu->serialized_data, in->size - sizeof(emu->action));
|
|
||||||
cereal::BinaryInputArchive ar(ss);
|
|
||||||
ar(e);
|
|
||||||
|
|
||||||
auto item_1 = static_cast<const EQ::ItemInstance *>(reinterpret_cast<EQ::InternalSerializedItem_Struct
|
|
||||||
*>(e.serialize_item_1.data())->inst);
|
|
||||||
auto item_2 = static_cast<const EQ::ItemInstance *>(reinterpret_cast<EQ::InternalSerializedItem_Struct
|
|
||||||
*>(e.serialize_item_2.data())->inst);
|
|
||||||
|
|
||||||
EQ::OutBuffer ob;
|
|
||||||
|
|
||||||
SerializeItem(ob, item_1, 0, 0, ItemPacketMerchant);
|
|
||||||
SerializeItem(ob, item_2, 0, 0, ItemPacketMerchant);
|
|
||||||
|
|
||||||
auto out = std::make_unique<EQApplicationPacket>(
|
|
||||||
OP_EvolveItem,
|
|
||||||
sizeof(EvolveXPWindowSendDetails_Struct) + ob.size()
|
|
||||||
);
|
|
||||||
auto data = reinterpret_cast<EvolveXPWindowSendDetails_Struct *>(out->pBuffer);
|
|
||||||
|
|
||||||
data->action = e.action;
|
|
||||||
data->compatibility = e.compatibility;
|
|
||||||
data->max_transfer_level = e.max_transfer_level;
|
|
||||||
data->item1_unique_id = e.item1_unique_id;
|
|
||||||
data->item2_unique_id = e.item2_unique_id;
|
|
||||||
data->item1_present = e.item1_present;
|
|
||||||
data->item2_present = e.item2_present;
|
|
||||||
|
|
||||||
memcpy(data->serialize_data, ob.str().data(), ob.size());
|
|
||||||
dest->QueuePacket(out.get());
|
|
||||||
safe_delete(in);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
dest->FastQueuePacket(&in);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ENCODE(OP_ExpansionInfo)
|
ENCODE(OP_ExpansionInfo)
|
||||||
{
|
{
|
||||||
ENCODE_LENGTH_EXACT(ExpansionInfo_Struct);
|
ENCODE_LENGTH_EXACT(ExpansionInfo_Struct);
|
||||||
@@ -1904,11 +1843,11 @@ namespace RoF2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_delete_array(in->pBuffer);
|
auto outapp = new EQApplicationPacket(OP_GuildsList);
|
||||||
|
outapp->size = packet_size;
|
||||||
|
outapp->pBuffer = buffer;
|
||||||
|
|
||||||
in->pBuffer = buffer;
|
dest->FastQueuePacket(&outapp);
|
||||||
in->size = packet_size;
|
|
||||||
dest->FastQueuePacket(&in);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ENCODE(OP_GuildTributeDonateItem)
|
ENCODE(OP_GuildTributeDonateItem)
|
||||||
@@ -2105,33 +2044,6 @@ namespace RoF2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ENCODE(OP_ItemPreviewRequest)
|
|
||||||
{
|
|
||||||
EQApplicationPacket* in = *p;
|
|
||||||
*p = nullptr;
|
|
||||||
|
|
||||||
uchar* in_buf = in->pBuffer;
|
|
||||||
|
|
||||||
auto int_item = (EQ::InternalSerializedItem_Struct*) in_buf;
|
|
||||||
|
|
||||||
EQ::OutBuffer buf;
|
|
||||||
EQ::OutBuffer::pos_type last_pos = buf.tellp();
|
|
||||||
|
|
||||||
SerializeItem(buf, (const EQ::ItemInstance*) int_item->inst, int_item->slot_id, 0, ItemPacketInvalid);
|
|
||||||
if (buf.tellp() == last_pos) {
|
|
||||||
LogNetcode("RoF2::ENCODE(OP_ItemPreviewRequest) Serialization failed");
|
|
||||||
safe_delete_array(in_buf);
|
|
||||||
safe_delete(in);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
in->size = buf.size();
|
|
||||||
in->pBuffer = buf.detach();
|
|
||||||
|
|
||||||
safe_delete_array(in_buf);
|
|
||||||
dest->FastQueuePacket(&in, ack_req);
|
|
||||||
}
|
|
||||||
|
|
||||||
ENCODE(OP_ItemVerifyReply)
|
ENCODE(OP_ItemVerifyReply)
|
||||||
{
|
{
|
||||||
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
|
ENCODE_LENGTH_EXACT(ItemVerifyReply_Struct);
|
||||||
@@ -2894,13 +2806,13 @@ namespace RoF2
|
|||||||
outapp->WriteSInt32(345); // Mana Total ?
|
outapp->WriteSInt32(345); // Mana Total ?
|
||||||
|
|
||||||
// these are needed to fix display bugs
|
// these are needed to fix display bugs
|
||||||
outapp->WriteUInt32(0x19); // base CR
|
outapp->WriteUInt32(emu->cold_resist); // base CR
|
||||||
outapp->WriteUInt32(0x19); // base FR
|
outapp->WriteUInt32(emu->fire_resist); // base FR
|
||||||
outapp->WriteUInt32(0x19); // base MR
|
outapp->WriteUInt32(emu->magic_resist); // base MR
|
||||||
outapp->WriteUInt32(0xf); // base DR
|
outapp->WriteUInt32(emu->disease_resist); // base DR
|
||||||
outapp->WriteUInt32(0xf); // base PR
|
outapp->WriteUInt32(emu->poison_resist); // base PR
|
||||||
outapp->WriteUInt32(0xf); // base PhR?
|
outapp->WriteUInt32(0xf); // base PhR?
|
||||||
outapp->WriteUInt32(0xf); // base Corrup
|
outapp->WriteUInt32(emu->corruption_resist); // base Corrup
|
||||||
outapp->WriteUInt32(0); // Unknown
|
outapp->WriteUInt32(0); // Unknown
|
||||||
outapp->WriteUInt32(0); // Unknown
|
outapp->WriteUInt32(0); // Unknown
|
||||||
outapp->WriteUInt32(0); // Unknown
|
outapp->WriteUInt32(0); // Unknown
|
||||||
@@ -6306,11 +6218,6 @@ namespace RoF2
|
|||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case structs::RoF2BazaarTraderBuyerActions::FirstOpenSearch: {
|
|
||||||
__packet->SetOpcode(OP_BazaarSearch);
|
|
||||||
LogTrading("(RoF2) First time opening Bazaar Search since zoning. Action <green>[{}]", action);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case structs::RoF2BazaarTraderBuyerActions::WelcomeMessage: {
|
case structs::RoF2BazaarTraderBuyerActions::WelcomeMessage: {
|
||||||
__packet->SetOpcode(OP_BazaarSearch);
|
__packet->SetOpcode(OP_BazaarSearch);
|
||||||
LogTrading("(RoF2) WelcomeMessage action <green>[{}]", action);
|
LogTrading("(RoF2) WelcomeMessage action <green>[{}]", action);
|
||||||
@@ -6451,18 +6358,9 @@ namespace RoF2
|
|||||||
//sprintf(hdr.unknown000, "06e0002Y1W00");
|
//sprintf(hdr.unknown000, "06e0002Y1W00");
|
||||||
strn0cpy(hdr.unknown000, fmt::format("{:016}\0", inst->GetSerialNumber()).c_str(),sizeof(hdr.unknown000));
|
strn0cpy(hdr.unknown000, fmt::format("{:016}\0", inst->GetSerialNumber()).c_str(),sizeof(hdr.unknown000));
|
||||||
|
|
||||||
hdr.stacksize = 1;
|
hdr.stacksize =
|
||||||
|
item->ID == PARCEL_MONEY_ITEM_ID ? inst->GetPrice() : (inst->IsStackable() ? ((inst->GetCharges() > 1000)
|
||||||
if (item->ID == PARCEL_MONEY_ITEM_ID) {
|
? 0xFFFFFFFF : inst->GetCharges()) : 1);
|
||||||
hdr.stacksize = inst->GetPrice();
|
|
||||||
} else if (inst->IsStackable()) {
|
|
||||||
if (inst->GetCharges() > std::numeric_limits<int16>::max()) {
|
|
||||||
hdr.stacksize = std::numeric_limits<uint32>::max();
|
|
||||||
} else {
|
|
||||||
hdr.stacksize = inst->GetCharges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hdr.unknown004 = 0;
|
hdr.unknown004 = 0;
|
||||||
|
|
||||||
structs::InventorySlot_Struct slot_id{};
|
structs::InventorySlot_Struct slot_id{};
|
||||||
@@ -6484,11 +6382,6 @@ namespace RoF2
|
|||||||
hdr.scaled_value = (inst->IsScaling() ? (inst->GetExp() / 100) : 0);
|
hdr.scaled_value = (inst->IsScaling() ? (inst->GetExp() / 100) : 0);
|
||||||
hdr.instance_id = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : inst->GetSerialNumber());
|
hdr.instance_id = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : inst->GetSerialNumber());
|
||||||
hdr.parcel_item_id = packet_type == ItemPacketParcel ? inst->GetID() : 0;
|
hdr.parcel_item_id = packet_type == ItemPacketParcel ? inst->GetID() : 0;
|
||||||
if (item->EvolvingItem) {
|
|
||||||
hdr.instance_id = inst->GetEvolveUniqueID() & 0xFFFFFFFF; //lower dword
|
|
||||||
hdr.parcel_item_id = inst->GetEvolveUniqueID() >> 32; //upper dword
|
|
||||||
}
|
|
||||||
|
|
||||||
hdr.last_cast_time = inst->GetRecastTimestamp();
|
hdr.last_cast_time = inst->GetRecastTimestamp();
|
||||||
hdr.charges = (inst->IsStackable() ? (item->MaxCharges ? 1 : 0) : ((inst->GetCharges() > 254)
|
hdr.charges = (inst->IsStackable() ? (item->MaxCharges ? 1 : 0) : ((inst->GetCharges() > 254)
|
||||||
? 0xFFFFFFFF
|
? 0xFFFFFFFF
|
||||||
@@ -6502,15 +6395,18 @@ namespace RoF2
|
|||||||
ob.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader));
|
ob.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader));
|
||||||
|
|
||||||
if (item->EvolvingItem > 0) {
|
if (item->EvolvingItem > 0) {
|
||||||
RoF2::structs::EvolvingItem_Struct evotop;
|
RoF2::structs::EvolvingItem evotop;
|
||||||
|
|
||||||
evotop.final_item_id = inst->GetEvolveFinalItemID();
|
evotop.unknown001 = 0;
|
||||||
evotop.evolve_level = item->EvolvingLevel;
|
evotop.unknown002 = 0;
|
||||||
evotop.progress = inst->GetEvolveProgression();
|
evotop.unknown003 = 0;
|
||||||
evotop.activated = inst->GetEvolveActivated();
|
evotop.unknown004 = 0;
|
||||||
evotop.evolve_max_level = item->EvolvingMax;
|
evotop.evoLevel = item->EvolvingLevel;
|
||||||
|
evotop.progress = 0;
|
||||||
|
evotop.Activated = 1;
|
||||||
|
evotop.evomaxlevel = item->EvolvingMax;
|
||||||
|
|
||||||
ob.write((const char*)&evotop, sizeof(RoF2::structs::EvolvingItem_Struct));
|
ob.write((const char*)&evotop, sizeof(RoF2::structs::EvolvingItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6884,13 +6780,12 @@ namespace RoF2
|
|||||||
iqbs.Heirloom = 0;
|
iqbs.Heirloom = 0;
|
||||||
iqbs.Placeable = 0;
|
iqbs.Placeable = 0;
|
||||||
iqbs.unknown28 = -1;
|
iqbs.unknown28 = -1;
|
||||||
iqbs.unknown29 = packet_type == ItemPacketInvalid ? 0xFF : 0;
|
|
||||||
iqbs.unknown30 = -1;
|
iqbs.unknown30 = -1;
|
||||||
iqbs.NoZone = 0;
|
iqbs.NoZone = 0;
|
||||||
iqbs.NoGround = 0;
|
iqbs.NoGround = 0;
|
||||||
iqbs.unknown37a = 0; // (guessed position) New to RoF2
|
iqbs.unknown37a = 0; // (guessed position) New to RoF2
|
||||||
iqbs.unknown38 = 0;
|
iqbs.unknown38 = 0;
|
||||||
iqbs.unknown39 = packet_type == ItemPacketInvalid ? 0 : 1;;
|
iqbs.unknown39 = 1;
|
||||||
|
|
||||||
ob.write((const char*)&iqbs, sizeof(RoF2::structs::ItemQuaternaryBodyStruct));
|
ob.write((const char*)&iqbs, sizeof(RoF2::structs::ItemQuaternaryBodyStruct));
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,6 @@ namespace RoF2
|
|||||||
|
|
||||||
const size_t SAY_LINK_BODY_SIZE = 56;
|
const size_t SAY_LINK_BODY_SIZE = 56;
|
||||||
const uint32 MAX_GUILD_ID = 50000;
|
const uint32 MAX_GUILD_ID = 50000;
|
||||||
const uint32 MAX_BAZAAR_TRADERS = 600;
|
|
||||||
|
|
||||||
} /*constants*/
|
} /*constants*/
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ E(OP_DzMemberListName)
|
|||||||
E(OP_DzMemberListStatus)
|
E(OP_DzMemberListStatus)
|
||||||
E(OP_DzSetLeaderName)
|
E(OP_DzSetLeaderName)
|
||||||
E(OP_Emote)
|
E(OP_Emote)
|
||||||
E(OP_EvolveItem)
|
|
||||||
E(OP_ExpansionInfo)
|
E(OP_ExpansionInfo)
|
||||||
E(OP_FormattedMessage)
|
E(OP_FormattedMessage)
|
||||||
E(OP_GMLastName)
|
E(OP_GMLastName)
|
||||||
@@ -92,7 +91,6 @@ E(OP_InspectBuffs)
|
|||||||
E(OP_InspectRequest)
|
E(OP_InspectRequest)
|
||||||
E(OP_ItemLinkResponse)
|
E(OP_ItemLinkResponse)
|
||||||
E(OP_ItemPacket)
|
E(OP_ItemPacket)
|
||||||
E(OP_ItemPreviewRequest)
|
|
||||||
E(OP_ItemVerifyReply)
|
E(OP_ItemVerifyReply)
|
||||||
E(OP_LeadershipExpUpdate)
|
E(OP_LeadershipExpUpdate)
|
||||||
E(OP_LogServer)
|
E(OP_LogServer)
|
||||||
|
|||||||
@@ -3119,8 +3119,7 @@ enum RoF2BazaarTraderBuyerActions {
|
|||||||
BazaarInspect = 18,
|
BazaarInspect = 18,
|
||||||
ClickTrader = 28,
|
ClickTrader = 28,
|
||||||
ItemMove = 19,
|
ItemMove = 19,
|
||||||
ReconcileItems = 20,
|
ReconcileItems = 20
|
||||||
FirstOpenSearch = 26
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RoF2BuyerActions {
|
enum RoF2BuyerActions {
|
||||||
@@ -4746,12 +4745,15 @@ struct ItemSerializationHeader
|
|||||||
uint8 isEvolving;
|
uint8 isEvolving;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EvolvingItem_Struct {
|
struct EvolvingItem {
|
||||||
uint32 final_item_id;
|
uint8 unknown001;
|
||||||
int32 evolve_level;
|
uint8 unknown002;
|
||||||
|
uint8 unknown003;
|
||||||
|
uint8 unknown004;
|
||||||
|
int32 evoLevel;
|
||||||
double progress;
|
double progress;
|
||||||
uint8 activated;
|
uint8 Activated;
|
||||||
int32 evolve_max_level;
|
int32 evomaxlevel;
|
||||||
uint8 unknown005[4];
|
uint8 unknown005[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5425,32 +5427,6 @@ struct Parcel_Struct
|
|||||||
};
|
};
|
||||||
}; /*structs*/
|
}; /*structs*/
|
||||||
|
|
||||||
struct EvolveItemToggle_Struct {
|
|
||||||
uint32 action;
|
|
||||||
uint32 unknown_004;
|
|
||||||
uint64 unique_id;
|
|
||||||
uint32 percentage;
|
|
||||||
uint32 activated;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveXPWindowReceive_Struct {
|
|
||||||
uint32 action;
|
|
||||||
uint32 unknown_004;
|
|
||||||
uint64 item1_unique_id;
|
|
||||||
uint64 item2_unique_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EvolveXPWindowSendDetails_Struct {
|
|
||||||
/*000*/ uint32 action;
|
|
||||||
/*004*/ uint64 item1_unique_id;
|
|
||||||
/*012*/ uint64 item2_unique_id;
|
|
||||||
/*020*/ uint32 compatibility;
|
|
||||||
/*024*/ uint32 max_transfer_level;
|
|
||||||
/*028*/ uint8 item1_present;
|
|
||||||
/*029*/ uint8 item2_present;
|
|
||||||
/*030*/ char serialize_data[];
|
|
||||||
};
|
|
||||||
|
|
||||||
}; /*RoF2*/
|
}; /*RoF2*/
|
||||||
|
|
||||||
#endif /*COMMON_ROF2_STRUCTS_H*/
|
#endif /*COMMON_ROF2_STRUCTS_H*/
|
||||||
|
|||||||
+19
-7
@@ -1669,15 +1669,27 @@ namespace SoD
|
|||||||
// OUT(unknown19584[4]);
|
// OUT(unknown19584[4]);
|
||||||
// OUT(unknown19588);
|
// OUT(unknown19588);
|
||||||
|
|
||||||
const uint8 bytes[] = {
|
const uint8 unknown12864_bytes[] = {
|
||||||
0xa3, 0x02, 0x00, 0x00, 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00,
|
0xa3, 0x02, 0x00, 0x00, 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
0x19, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00,
|
|
||||||
0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x85, 0xEB, 0x3E, 0x33, 0x33, 0x33, 0x3F,
|
|
||||||
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
||||||
};
|
};
|
||||||
|
|
||||||
memcpy(eq->unknown12864, bytes, sizeof(bytes));
|
memcpy(eq->unknown12864, unknown12864_bytes, sizeof(unknown12864_bytes));
|
||||||
|
|
||||||
|
eq->cold_resist = emu->cold_resist;
|
||||||
|
eq->fire_resist = emu->fire_resist;
|
||||||
|
eq->magic_resist = emu->magic_resist;
|
||||||
|
eq->disease_resist = emu->disease_resist;
|
||||||
|
eq->poison_resist = emu->poison_resist;
|
||||||
|
eq->physical_resist = 15;
|
||||||
|
eq->corruption_resist = emu->corruption_resist;
|
||||||
|
|
||||||
|
const uint8 unknown15112_bytes[] = {
|
||||||
|
0x1F, 0x85, 0xEB, 0x3E, 0x33, 0x33, 0x33, 0x3F, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
memcpy(eq->unknown15112, unknown15112_bytes, sizeof(unknown15112_bytes));
|
||||||
|
|
||||||
//set the checksum...
|
//set the checksum...
|
||||||
CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct) - 4);
|
CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct) - 4);
|
||||||
|
|||||||
@@ -944,7 +944,15 @@ struct PlayerProfile_Struct
|
|||||||
/*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot
|
/*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot
|
||||||
/*15060*/ uint8 unknown12852[8];
|
/*15060*/ uint8 unknown12852[8];
|
||||||
/*15068*/ uint32 available_slots;
|
/*15068*/ uint32 available_slots;
|
||||||
/*15072*/ uint8 unknown12864[80]; //#### uint8 uint8 unknown12864[76]; in Titanium ####[80]
|
/*15072*/ uint8 unknown12864[12]; //#### uint8 uint8 unknown12864[76]; in Titanium ####[80]
|
||||||
|
/*15084*/ uint32 cold_resist;
|
||||||
|
/*15088*/ uint32 fire_resist;
|
||||||
|
/*15092*/ uint32 magic_resist;
|
||||||
|
/*15096*/ uint32 disease_resist;
|
||||||
|
/*15100*/ uint32 poison_resist;
|
||||||
|
/*15104*/ uint32 physical_resist;
|
||||||
|
/*15108*/ uint32 corruption_resist;
|
||||||
|
/*15112*/ uint8 unknown15112[40];
|
||||||
//END SUB-STRUCT used for shrouding.
|
//END SUB-STRUCT used for shrouding.
|
||||||
/*15152*/ char name[64]; // Name of player
|
/*15152*/ char name[64]; // Name of player
|
||||||
/*15216*/ char last_name[32]; // Last name of player
|
/*15216*/ char last_name[32]; // Last name of player
|
||||||
|
|||||||
+19
-7
@@ -1339,15 +1339,27 @@ namespace SoF
|
|||||||
// OUT(unknown19584[4]);
|
// OUT(unknown19584[4]);
|
||||||
// OUT(unknown19588);
|
// OUT(unknown19588);
|
||||||
|
|
||||||
const uint8 bytes[] = {
|
const uint8 unknown12864_bytes[] = {
|
||||||
0xa3, 0x02, 0x00, 0x00, 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00,
|
0xa3, 0x02, 0x00, 0x00, 0x95, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
0x19, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00,
|
|
||||||
0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x85, 0xEB, 0x3E, 0x33, 0x33, 0x33, 0x3F,
|
|
||||||
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
||||||
};
|
};
|
||||||
|
|
||||||
memcpy(eq->unknown12864, bytes, sizeof(bytes));
|
memcpy(eq->unknown12864, unknown12864_bytes, sizeof(unknown12864_bytes));
|
||||||
|
|
||||||
|
eq->cold_resist = emu->cold_resist;
|
||||||
|
eq->fire_resist = emu->fire_resist;
|
||||||
|
eq->magic_resist = emu->magic_resist;
|
||||||
|
eq->disease_resist = emu->disease_resist;
|
||||||
|
eq->poison_resist = emu->poison_resist;
|
||||||
|
eq->physical_resist = 15;
|
||||||
|
eq->corruption_resist = emu->corruption_resist;
|
||||||
|
|
||||||
|
const uint8 unknown15112_bytes[] = {
|
||||||
|
0x1F, 0x85, 0xEB, 0x3E, 0x33, 0x33, 0x33, 0x3F, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
memcpy(eq->unknown15112, unknown15112_bytes, sizeof(unknown15112_bytes));
|
||||||
|
|
||||||
//set the checksum...
|
//set the checksum...
|
||||||
CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct) - 4);
|
CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct) - 4);
|
||||||
|
|||||||
@@ -944,7 +944,16 @@ struct PlayerProfile_Struct //23576 Octets
|
|||||||
/*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot
|
/*14700*/ PotionBelt_Struct potionbelt; // [360] potion belt 72 extra octets by adding 1 more belt slot
|
||||||
/*15060*/ uint8 unknown12852[8];
|
/*15060*/ uint8 unknown12852[8];
|
||||||
/*15068*/ uint32 available_slots;
|
/*15068*/ uint32 available_slots;
|
||||||
/*15072*/ uint8 unknown12864[80]; //#### uint8 uint8 unknown12864[76]; in Titanium ####[80]
|
/*15072*/ uint8 unknown12864[12]; //#### uint8 uint8 unknown12864[76]; in Titanium ####[80]
|
||||||
|
/*15084*/ uint32 cold_resist;
|
||||||
|
/*15088*/ uint32 fire_resist;
|
||||||
|
/*15092*/ uint32 magic_resist;
|
||||||
|
/*15096*/ uint32 disease_resist;
|
||||||
|
/*15100*/ uint32 poison_resist;
|
||||||
|
/*15104*/ uint32 physical_resist;
|
||||||
|
/*15108*/ uint32 corruption_resist;
|
||||||
|
/*15112*/ uint8 unknown15112[40];
|
||||||
|
|
||||||
//END SUB-STRUCT used for shrouding.
|
//END SUB-STRUCT used for shrouding.
|
||||||
/*15120*/ char name[64]; // Name of player
|
/*15120*/ char name[64]; // Name of player
|
||||||
/*15184*/ char last_name[32]; // Last name of player
|
/*15184*/ char last_name[32]; // Last name of player
|
||||||
|
|||||||
@@ -1600,14 +1600,25 @@ namespace Titanium
|
|||||||
// OUT(unknown19584[4]);
|
// OUT(unknown19584[4]);
|
||||||
// OUT(unknown19588);
|
// OUT(unknown19588);
|
||||||
|
|
||||||
|
const uint8 unknown12864_bytes[] = {
|
||||||
|
0x78, 0x03, 0x00, 0x00, 0x1A, 0x04, 0x00, 0x00, 0x1A, 0x04, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
const uint8 bytes[] = {
|
memcpy(eq->unknown12864, unknown12864_bytes, sizeof(unknown12864_bytes));
|
||||||
0x78, 0x03, 0x00, 0x00, 0x1A, 0x04, 0x00, 0x00, 0x1A, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00,
|
|
||||||
0x19, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00,
|
eq->cold_resist = emu->cold_resist;
|
||||||
0x0F, 0x00, 0x00, 0x00, 0x1F, 0x85, 0xEB, 0x3E, 0x33, 0x33, 0x33, 0x3F, 0x09, 0x00, 0x00, 0x00,
|
eq->fire_resist = emu->fire_resist;
|
||||||
|
eq->magic_resist = emu->magic_resist;
|
||||||
|
eq->disease_resist = emu->disease_resist;
|
||||||
|
eq->poison_resist = emu->poison_resist;
|
||||||
|
eq->physical_resist = 15;
|
||||||
|
|
||||||
|
const uint8 unknown12900_bytes[] = {
|
||||||
|
0x1F, 0x85, 0xEB, 0x3E, 0x33, 0x33, 0x33, 0x3F, 0x09, 0x00, 0x00, 0x00,
|
||||||
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14
|
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14
|
||||||
};
|
};
|
||||||
memcpy(eq->unknown12864, bytes, sizeof(bytes));
|
|
||||||
|
memcpy(eq->unknown12900, unknown12900_bytes, sizeof(unknown12900_bytes));
|
||||||
|
|
||||||
//set the checksum...
|
//set the checksum...
|
||||||
CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct) - 4);
|
CRC32::SetEQChecksum(__packet->pBuffer, sizeof(structs::PlayerProfile_Struct) - 4);
|
||||||
|
|||||||
@@ -879,7 +879,14 @@ struct PlayerProfile_Struct
|
|||||||
/*12564*/ PotionBelt_Struct potionbelt; // potion belt
|
/*12564*/ PotionBelt_Struct potionbelt; // potion belt
|
||||||
/*12852*/ uint8 unknown12852[8];
|
/*12852*/ uint8 unknown12852[8];
|
||||||
/*12860*/ uint32 available_slots;
|
/*12860*/ uint32 available_slots;
|
||||||
/*12864*/ uint8 unknown12864[76];
|
/*12864*/ uint8 unknown12864[12];
|
||||||
|
/*12876*/ uint32 cold_resist;
|
||||||
|
/*12880*/ uint32 fire_resist;
|
||||||
|
/*12884*/ uint32 magic_resist;
|
||||||
|
/*12888*/ uint32 disease_resist;
|
||||||
|
/*12892*/ uint32 poison_resist;
|
||||||
|
/*12896*/ uint32 physical_resist;
|
||||||
|
/*12900*/ uint8 unknown12900[40];
|
||||||
/*12940*/ char name[64]; // Name of player
|
/*12940*/ char name[64]; // Name of player
|
||||||
/*13004*/ char last_name[32]; // Last name of player
|
/*13004*/ char last_name[32]; // Last name of player
|
||||||
/*13036*/ uint32 guild_id; // guildid
|
/*13036*/ uint32 guild_id; // guildid
|
||||||
|
|||||||
+60
-57
@@ -5,19 +5,31 @@
|
|||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
inline std::string striptrailingslash(const std::string &file_path)
|
||||||
|
{
|
||||||
|
if (file_path.back() == '/' || file_path.back() == '\\') {
|
||||||
|
return file_path.substr(0, file_path.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return file_path;
|
||||||
|
}
|
||||||
|
|
||||||
void PathManager::LoadPaths()
|
void PathManager::LoadPaths()
|
||||||
{
|
{
|
||||||
m_server_path = File::FindEqemuConfigPath();
|
m_server_path = File::FindEqemuConfigPath();
|
||||||
|
|
||||||
|
if (!m_server_path.empty()) {
|
||||||
|
std::filesystem::current_path(m_server_path);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_server_path.empty()) {
|
if (m_server_path.empty()) {
|
||||||
LogInfo("Failed to load server path");
|
LogInfo("Failed to load server path");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::current_path(m_server_path);
|
LogInfo("server [{}]", m_server_path);
|
||||||
|
|
||||||
if (!EQEmuConfig::LoadConfig()) {
|
if (!EQEmuConfig::LoadConfig()) {
|
||||||
LogError("Failed to load eqemu config");
|
LogError("Failed to load eqemu config");
|
||||||
@@ -26,64 +38,60 @@ void PathManager::LoadPaths()
|
|||||||
|
|
||||||
const auto c = EQEmuConfig::get();
|
const auto c = EQEmuConfig::get();
|
||||||
|
|
||||||
auto resolve_path = [&](const std::string& dir, const std::vector<std::string>& fallback_dirs = {}) -> std::string {
|
// maps
|
||||||
// relative
|
if (File::Exists(fs::path{m_server_path + "/" + c->MapDir}.string())) {
|
||||||
if (File::Exists((fs::path{m_server_path} / dir).string())) {
|
m_maps_path = fs::relative(fs::path{m_server_path + "/" + c->MapDir}).string();
|
||||||
return fs::relative(fs::path{m_server_path} / dir).lexically_normal().string();
|
}
|
||||||
|
else if (File::Exists(fs::path{m_server_path + "/maps"}.string())) {
|
||||||
|
m_maps_path = fs::relative(fs::path{m_server_path + "/maps"}).string();
|
||||||
|
}
|
||||||
|
else if (File::Exists(fs::path{m_server_path + "/Maps"}.string())) {
|
||||||
|
m_maps_path = fs::relative(fs::path{m_server_path + "/Maps"}).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// absolute
|
// quests
|
||||||
if (File::Exists(fs::path{dir}.string())) {
|
if (File::Exists(fs::path{m_server_path + "/" + c->QuestDir}.string())) {
|
||||||
return fs::absolute(fs::path{dir}).string();
|
m_quests_path = fs::relative(fs::path{m_server_path + "/" + c->QuestDir}).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback search options if specified
|
// plugins
|
||||||
for (const auto& fallback : fallback_dirs) {
|
if (File::Exists(fs::path{m_server_path + "/" + c->PluginDir}.string())) {
|
||||||
if (File::Exists((fs::path{m_server_path} / fallback).string())) {
|
m_plugins_path = fs::relative(fs::path{m_server_path + "/" + c->PluginDir}).string();
|
||||||
return fs::relative(fs::path{m_server_path} / fallback).lexically_normal().string();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if all else fails, just set it to the config value
|
// lua_modules
|
||||||
return dir;
|
if (File::Exists(fs::path{m_server_path + "/" + c->LuaModuleDir}.string())) {
|
||||||
};
|
m_lua_modules_path = fs::relative(fs::path{m_server_path + "/" + c->LuaModuleDir}).string();
|
||||||
|
|
||||||
m_maps_path = resolve_path(c->MapDir, {"maps", "Maps"});
|
|
||||||
m_quests_path = resolve_path(c->QuestDir);
|
|
||||||
m_plugins_path = resolve_path(c->PluginDir);
|
|
||||||
m_lua_modules_path = resolve_path(c->LuaModuleDir);
|
|
||||||
m_lua_mods_path = resolve_path("mods");
|
|
||||||
m_patch_path = resolve_path(c->PatchDir);
|
|
||||||
m_opcode_path = resolve_path(c->OpcodeDir);
|
|
||||||
m_shared_memory_path = resolve_path(c->SharedMemDir);
|
|
||||||
m_log_path = resolve_path(c->LogDir, {"logs"});
|
|
||||||
|
|
||||||
// Log all paths in a loop
|
|
||||||
std::vector<std::pair<std::string, std::string>> paths = {
|
|
||||||
{"server", m_server_path},
|
|
||||||
{"logs", m_log_path},
|
|
||||||
{"lua mods", m_lua_mods_path},
|
|
||||||
{"lua_modules", m_lua_modules_path},
|
|
||||||
{"maps", m_maps_path},
|
|
||||||
{"patches", m_patch_path},
|
|
||||||
{"opcode", m_opcode_path},
|
|
||||||
{"plugins", m_plugins_path},
|
|
||||||
{"quests", m_quests_path},
|
|
||||||
{"shared_memory", m_shared_memory_path}
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr int name_width = 15;
|
|
||||||
constexpr int path_width = 0;
|
|
||||||
constexpr int break_length = 70;
|
|
||||||
|
|
||||||
std::cout << std::endl;
|
|
||||||
LogInfo("{}", Strings::Repeat("-", break_length));
|
|
||||||
for (const auto& [name, in_path] : paths) {
|
|
||||||
if (!in_path.empty()) {
|
|
||||||
LogInfo("{:>{}} > [{:<{}}]", name, name_width, in_path, path_width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lua mods
|
||||||
|
if (File::Exists(fs::path{ m_server_path + "/mods" }.string())) {
|
||||||
|
m_lua_mods_path = fs::relative(fs::path{ m_server_path + "/mods" }).string();
|
||||||
}
|
}
|
||||||
LogInfo("{}", Strings::Repeat("-", break_length));
|
|
||||||
|
// patches
|
||||||
|
if (File::Exists(fs::path{m_server_path + "/" + c->PatchDir}.string())) {
|
||||||
|
m_patch_path = fs::relative(fs::path{m_server_path + "/" + c->PatchDir}).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
// shared_memory_path
|
||||||
|
if (File::Exists(fs::path{m_server_path + "/" + c->SharedMemDir}.string())) {
|
||||||
|
m_shared_memory_path = fs::relative(fs::path{ m_server_path + "/" + c->SharedMemDir }).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
// logging path
|
||||||
|
if (File::Exists(fs::path{m_server_path + "/" + c->LogDir}.string())) {
|
||||||
|
m_log_path = fs::relative(fs::path{m_server_path + "/" + c->LogDir}).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
LogInfo("logs path [{}]", m_log_path);
|
||||||
|
LogInfo("lua mods path [{}]", m_lua_mods_path);
|
||||||
|
LogInfo("lua_modules path [{}]", m_lua_modules_path);
|
||||||
|
LogInfo("maps path [{}]", m_maps_path);
|
||||||
|
LogInfo("patches path [{}]", m_patch_path);
|
||||||
|
LogInfo("plugins path [{}]", m_plugins_path);
|
||||||
|
LogInfo("quests path [{}]", m_quests_path);
|
||||||
|
LogInfo("shared_memory path [{}]", m_shared_memory_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &PathManager::GetServerPath() const
|
const std::string &PathManager::GetServerPath() const
|
||||||
@@ -121,11 +129,6 @@ const std::string &PathManager::GetPatchPath() const
|
|||||||
return m_patch_path;
|
return m_patch_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &PathManager::GetOpcodePath() const
|
|
||||||
{
|
|
||||||
return m_opcode_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string &PathManager::GetLuaModulesPath() const
|
const std::string &PathManager::GetLuaModulesPath() const
|
||||||
{
|
{
|
||||||
return m_lua_modules_path;
|
return m_lua_modules_path;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ public:
|
|||||||
[[nodiscard]] const std::string &GetLuaModulesPath() const;
|
[[nodiscard]] const std::string &GetLuaModulesPath() const;
|
||||||
[[nodiscard]] const std::string &GetMapsPath() const;
|
[[nodiscard]] const std::string &GetMapsPath() const;
|
||||||
[[nodiscard]] const std::string &GetPatchPath() const;
|
[[nodiscard]] const std::string &GetPatchPath() const;
|
||||||
[[nodiscard]] const std::string &GetOpcodePath() const;
|
|
||||||
[[nodiscard]] const std::string &GetPluginsPath() const;
|
[[nodiscard]] const std::string &GetPluginsPath() const;
|
||||||
[[nodiscard]] const std::string &GetQuestsPath() const;
|
[[nodiscard]] const std::string &GetQuestsPath() const;
|
||||||
[[nodiscard]] const std::string &GetServerPath() const;
|
[[nodiscard]] const std::string &GetServerPath() const;
|
||||||
@@ -25,7 +24,6 @@ private:
|
|||||||
std::string m_lua_modules_path;
|
std::string m_lua_modules_path;
|
||||||
std::string m_maps_path;
|
std::string m_maps_path;
|
||||||
std::string m_patch_path;
|
std::string m_patch_path;
|
||||||
std::string m_opcode_path;
|
|
||||||
std::string m_plugins_path;
|
std::string m_plugins_path;
|
||||||
std::string m_quests_path;
|
std::string m_quests_path;
|
||||||
std::string m_server_path;
|
std::string m_server_path;
|
||||||
|
|||||||
@@ -49,23 +49,23 @@ public:
|
|||||||
std::string field;
|
std::string field;
|
||||||
|
|
||||||
switch (theme_id) {
|
switch (theme_id) {
|
||||||
case LDoNTheme::GUK: {
|
case LDoNThemes::GUK: {
|
||||||
field = "guk_";
|
field = "guk_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNTheme::MIR: {
|
case LDoNThemes::MIR: {
|
||||||
field = "mir_";
|
field = "mir_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNTheme::MMC: {
|
case LDoNThemes::MMC: {
|
||||||
field = "mmc_";
|
field = "mmc_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNTheme::RUJ: {
|
case LDoNThemes::RUJ: {
|
||||||
field = "ruj_";
|
field = "ruj_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LDoNTheme::TAK: {
|
case LDoNThemes::TAK: {
|
||||||
field = "tak_";
|
field = "tak_";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ public:
|
|||||||
uint32_t alloc_int;
|
uint32_t alloc_int;
|
||||||
uint32_t alloc_wis;
|
uint32_t alloc_wis;
|
||||||
uint32_t alloc_cha;
|
uint32_t alloc_cha;
|
||||||
|
uint32_t base_cr;
|
||||||
|
uint32_t base_fr;
|
||||||
|
uint32_t base_mr;
|
||||||
|
uint32_t base_dr;
|
||||||
|
uint32_t base_pr;
|
||||||
|
uint32_t base_corrup;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -59,6 +65,12 @@ public:
|
|||||||
"alloc_int",
|
"alloc_int",
|
||||||
"alloc_wis",
|
"alloc_wis",
|
||||||
"alloc_cha",
|
"alloc_cha",
|
||||||
|
"base_cr",
|
||||||
|
"base_fr",
|
||||||
|
"base_mr",
|
||||||
|
"base_dr",
|
||||||
|
"base_pr",
|
||||||
|
"base_corrup",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +92,12 @@ public:
|
|||||||
"alloc_int",
|
"alloc_int",
|
||||||
"alloc_wis",
|
"alloc_wis",
|
||||||
"alloc_cha",
|
"alloc_cha",
|
||||||
|
"base_cr",
|
||||||
|
"base_fr",
|
||||||
|
"base_mr",
|
||||||
|
"base_dr",
|
||||||
|
"base_pr",
|
||||||
|
"base_corrup",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +153,12 @@ public:
|
|||||||
e.alloc_int = 0;
|
e.alloc_int = 0;
|
||||||
e.alloc_wis = 0;
|
e.alloc_wis = 0;
|
||||||
e.alloc_cha = 0;
|
e.alloc_cha = 0;
|
||||||
|
e.base_cr = 0;
|
||||||
|
e.base_fr = 0;
|
||||||
|
e.base_mr = 0;
|
||||||
|
e.base_dr = 0;
|
||||||
|
e.base_pr = 0;
|
||||||
|
e.base_corrup = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -186,6 +210,12 @@ public:
|
|||||||
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||||
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
|
e.base_cr = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||||
|
e.base_fr = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||||
|
e.base_mr = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||||
|
e.base_dr = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||||
|
e.base_pr = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||||
|
e.base_corrup = row[20] ? static_cast<uint32_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -234,6 +264,12 @@ public:
|
|||||||
v.push_back(columns[12] + " = " + std::to_string(e.alloc_int));
|
v.push_back(columns[12] + " = " + std::to_string(e.alloc_int));
|
||||||
v.push_back(columns[13] + " = " + std::to_string(e.alloc_wis));
|
v.push_back(columns[13] + " = " + std::to_string(e.alloc_wis));
|
||||||
v.push_back(columns[14] + " = " + std::to_string(e.alloc_cha));
|
v.push_back(columns[14] + " = " + std::to_string(e.alloc_cha));
|
||||||
|
v.push_back(columns[15] + " = " + std::to_string(e.base_cr));
|
||||||
|
v.push_back(columns[16] + " = " + std::to_string(e.base_fr));
|
||||||
|
v.push_back(columns[17] + " = " + std::to_string(e.base_mr));
|
||||||
|
v.push_back(columns[18] + " = " + std::to_string(e.base_dr));
|
||||||
|
v.push_back(columns[19] + " = " + std::to_string(e.base_pr));
|
||||||
|
v.push_back(columns[20] + " = " + std::to_string(e.base_corrup));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -270,6 +306,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.alloc_int));
|
v.push_back(std::to_string(e.alloc_int));
|
||||||
v.push_back(std::to_string(e.alloc_wis));
|
v.push_back(std::to_string(e.alloc_wis));
|
||||||
v.push_back(std::to_string(e.alloc_cha));
|
v.push_back(std::to_string(e.alloc_cha));
|
||||||
|
v.push_back(std::to_string(e.base_cr));
|
||||||
|
v.push_back(std::to_string(e.base_fr));
|
||||||
|
v.push_back(std::to_string(e.base_mr));
|
||||||
|
v.push_back(std::to_string(e.base_dr));
|
||||||
|
v.push_back(std::to_string(e.base_pr));
|
||||||
|
v.push_back(std::to_string(e.base_corrup));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -314,6 +356,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.alloc_int));
|
v.push_back(std::to_string(e.alloc_int));
|
||||||
v.push_back(std::to_string(e.alloc_wis));
|
v.push_back(std::to_string(e.alloc_wis));
|
||||||
v.push_back(std::to_string(e.alloc_cha));
|
v.push_back(std::to_string(e.alloc_cha));
|
||||||
|
v.push_back(std::to_string(e.base_cr));
|
||||||
|
v.push_back(std::to_string(e.base_fr));
|
||||||
|
v.push_back(std::to_string(e.base_mr));
|
||||||
|
v.push_back(std::to_string(e.base_dr));
|
||||||
|
v.push_back(std::to_string(e.base_pr));
|
||||||
|
v.push_back(std::to_string(e.base_corrup));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -362,6 +410,12 @@ public:
|
|||||||
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||||
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
|
e.base_cr = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||||
|
e.base_fr = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||||
|
e.base_mr = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||||
|
e.base_dr = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||||
|
e.base_pr = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||||
|
e.base_corrup = row[20] ? static_cast<uint32_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -401,6 +455,12 @@ public:
|
|||||||
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||||
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
|
e.base_cr = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||||
|
e.base_fr = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||||
|
e.base_mr = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||||
|
e.base_dr = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||||
|
e.base_pr = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||||
|
e.base_corrup = row[20] ? static_cast<uint32_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -490,6 +550,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.alloc_int));
|
v.push_back(std::to_string(e.alloc_int));
|
||||||
v.push_back(std::to_string(e.alloc_wis));
|
v.push_back(std::to_string(e.alloc_wis));
|
||||||
v.push_back(std::to_string(e.alloc_cha));
|
v.push_back(std::to_string(e.alloc_cha));
|
||||||
|
v.push_back(std::to_string(e.base_cr));
|
||||||
|
v.push_back(std::to_string(e.base_fr));
|
||||||
|
v.push_back(std::to_string(e.base_mr));
|
||||||
|
v.push_back(std::to_string(e.base_dr));
|
||||||
|
v.push_back(std::to_string(e.base_pr));
|
||||||
|
v.push_back(std::to_string(e.base_corrup));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -527,6 +593,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.alloc_int));
|
v.push_back(std::to_string(e.alloc_int));
|
||||||
v.push_back(std::to_string(e.alloc_wis));
|
v.push_back(std::to_string(e.alloc_wis));
|
||||||
v.push_back(std::to_string(e.alloc_cha));
|
v.push_back(std::to_string(e.alloc_cha));
|
||||||
|
v.push_back(std::to_string(e.base_cr));
|
||||||
|
v.push_back(std::to_string(e.base_fr));
|
||||||
|
v.push_back(std::to_string(e.base_mr));
|
||||||
|
v.push_back(std::to_string(e.base_dr));
|
||||||
|
v.push_back(std::to_string(e.base_pr));
|
||||||
|
v.push_back(std::to_string(e.base_corrup));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,12 @@ public:
|
|||||||
uint32_t aa_points_old;
|
uint32_t aa_points_old;
|
||||||
uint32_t e_last_invsnapshot;
|
uint32_t e_last_invsnapshot;
|
||||||
time_t deleted_at;
|
time_t deleted_at;
|
||||||
|
uint32_t cold_resist;
|
||||||
|
uint32_t fire_resist;
|
||||||
|
uint32_t magic_resist;
|
||||||
|
uint32_t disease_resist;
|
||||||
|
uint32_t poison_resist;
|
||||||
|
uint32_t corruption_resist;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -237,6 +243,12 @@ public:
|
|||||||
"aa_points_old",
|
"aa_points_old",
|
||||||
"e_last_invsnapshot",
|
"e_last_invsnapshot",
|
||||||
"deleted_at",
|
"deleted_at",
|
||||||
|
"cold_resist",
|
||||||
|
"fire_resist",
|
||||||
|
"magic_resist",
|
||||||
|
"disease_resist",
|
||||||
|
"poison_resist",
|
||||||
|
"corruption_resist",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,6 +359,12 @@ public:
|
|||||||
"aa_points_old",
|
"aa_points_old",
|
||||||
"e_last_invsnapshot",
|
"e_last_invsnapshot",
|
||||||
"UNIX_TIMESTAMP(deleted_at)",
|
"UNIX_TIMESTAMP(deleted_at)",
|
||||||
|
"cold_resist",
|
||||||
|
"fire_resist",
|
||||||
|
"magic_resist",
|
||||||
|
"disease_resist",
|
||||||
|
"poison_resist",
|
||||||
|
"corruption_resist",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,6 +509,12 @@ public:
|
|||||||
e.aa_points_old = 0;
|
e.aa_points_old = 0;
|
||||||
e.e_last_invsnapshot = 0;
|
e.e_last_invsnapshot = 0;
|
||||||
e.deleted_at = 0;
|
e.deleted_at = 0;
|
||||||
|
e.cold_resist = 0;
|
||||||
|
e.fire_resist = 0;
|
||||||
|
e.magic_resist = 0;
|
||||||
|
e.disease_resist = 0;
|
||||||
|
e.poison_resist = 0;
|
||||||
|
e.corruption_resist = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -631,6 +655,12 @@ public:
|
|||||||
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
||||||
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0;
|
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0;
|
||||||
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
|
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
|
||||||
|
e.cold_resist = row[104] ? static_cast<uint32_t>(strtoul(row[104], nullptr, 10)) : 0;
|
||||||
|
e.fire_resist = row[105] ? static_cast<uint32_t>(strtoul(row[105], nullptr, 10)) : 0;
|
||||||
|
e.magic_resist = row[106] ? static_cast<uint32_t>(strtoul(row[106], nullptr, 10)) : 0;
|
||||||
|
e.disease_resist = row[107] ? static_cast<uint32_t>(strtoul(row[107], nullptr, 10)) : 0;
|
||||||
|
e.poison_resist = row[108] ? static_cast<uint32_t>(strtoul(row[108], nullptr, 10)) : 0;
|
||||||
|
e.corruption_resist = row[109] ? static_cast<uint32_t>(strtoul(row[109], nullptr, 10)) : 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -767,6 +797,12 @@ public:
|
|||||||
v.push_back(columns[101] + " = " + std::to_string(e.aa_points_old));
|
v.push_back(columns[101] + " = " + std::to_string(e.aa_points_old));
|
||||||
v.push_back(columns[102] + " = " + std::to_string(e.e_last_invsnapshot));
|
v.push_back(columns[102] + " = " + std::to_string(e.e_last_invsnapshot));
|
||||||
v.push_back(columns[103] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
v.push_back(columns[103] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
||||||
|
v.push_back(columns[104] + " = " + std::to_string(e.cold_resist));
|
||||||
|
v.push_back(columns[105] + " = " + std::to_string(e.fire_resist));
|
||||||
|
v.push_back(columns[106] + " = " + std::to_string(e.magic_resist));
|
||||||
|
v.push_back(columns[107] + " = " + std::to_string(e.disease_resist));
|
||||||
|
v.push_back(columns[108] + " = " + std::to_string(e.poison_resist));
|
||||||
|
v.push_back(columns[109] + " = " + std::to_string(e.corruption_resist));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -892,6 +928,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.aa_points_old));
|
v.push_back(std::to_string(e.aa_points_old));
|
||||||
v.push_back(std::to_string(e.e_last_invsnapshot));
|
v.push_back(std::to_string(e.e_last_invsnapshot));
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
||||||
|
v.push_back(std::to_string(e.cold_resist));
|
||||||
|
v.push_back(std::to_string(e.fire_resist));
|
||||||
|
v.push_back(std::to_string(e.magic_resist));
|
||||||
|
v.push_back(std::to_string(e.disease_resist));
|
||||||
|
v.push_back(std::to_string(e.poison_resist));
|
||||||
|
v.push_back(std::to_string(e.corruption_resist));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1025,6 +1067,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.aa_points_old));
|
v.push_back(std::to_string(e.aa_points_old));
|
||||||
v.push_back(std::to_string(e.e_last_invsnapshot));
|
v.push_back(std::to_string(e.e_last_invsnapshot));
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
||||||
|
v.push_back(std::to_string(e.cold_resist));
|
||||||
|
v.push_back(std::to_string(e.fire_resist));
|
||||||
|
v.push_back(std::to_string(e.magic_resist));
|
||||||
|
v.push_back(std::to_string(e.disease_resist));
|
||||||
|
v.push_back(std::to_string(e.poison_resist));
|
||||||
|
v.push_back(std::to_string(e.corruption_resist));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -1162,6 +1210,12 @@ public:
|
|||||||
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
||||||
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0;
|
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0;
|
||||||
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
|
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
|
||||||
|
e.cold_resist = row[104] ? static_cast<uint32_t>(strtoul(row[104], nullptr, 10)) : 0;
|
||||||
|
e.fire_resist = row[105] ? static_cast<uint32_t>(strtoul(row[105], nullptr, 10)) : 0;
|
||||||
|
e.magic_resist = row[106] ? static_cast<uint32_t>(strtoul(row[106], nullptr, 10)) : 0;
|
||||||
|
e.disease_resist = row[107] ? static_cast<uint32_t>(strtoul(row[107], nullptr, 10)) : 0;
|
||||||
|
e.poison_resist = row[108] ? static_cast<uint32_t>(strtoul(row[108], nullptr, 10)) : 0;
|
||||||
|
e.corruption_resist = row[109] ? static_cast<uint32_t>(strtoul(row[109], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1290,6 +1344,12 @@ public:
|
|||||||
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
||||||
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0;
|
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0;
|
||||||
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
|
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
|
||||||
|
e.cold_resist = row[104] ? static_cast<uint32_t>(strtoul(row[104], nullptr, 10)) : 0;
|
||||||
|
e.fire_resist = row[105] ? static_cast<uint32_t>(strtoul(row[105], nullptr, 10)) : 0;
|
||||||
|
e.magic_resist = row[106] ? static_cast<uint32_t>(strtoul(row[106], nullptr, 10)) : 0;
|
||||||
|
e.disease_resist = row[107] ? static_cast<uint32_t>(strtoul(row[107], nullptr, 10)) : 0;
|
||||||
|
e.poison_resist = row[108] ? static_cast<uint32_t>(strtoul(row[108], nullptr, 10)) : 0;
|
||||||
|
e.corruption_resist = row[109] ? static_cast<uint32_t>(strtoul(row[109], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1468,6 +1528,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.aa_points_old));
|
v.push_back(std::to_string(e.aa_points_old));
|
||||||
v.push_back(std::to_string(e.e_last_invsnapshot));
|
v.push_back(std::to_string(e.e_last_invsnapshot));
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
||||||
|
v.push_back(std::to_string(e.cold_resist));
|
||||||
|
v.push_back(std::to_string(e.fire_resist));
|
||||||
|
v.push_back(std::to_string(e.magic_resist));
|
||||||
|
v.push_back(std::to_string(e.disease_resist));
|
||||||
|
v.push_back(std::to_string(e.poison_resist));
|
||||||
|
v.push_back(std::to_string(e.corruption_resist));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1594,6 +1660,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.aa_points_old));
|
v.push_back(std::to_string(e.aa_points_old));
|
||||||
v.push_back(std::to_string(e.e_last_invsnapshot));
|
v.push_back(std::to_string(e.e_last_invsnapshot));
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
||||||
|
v.push_back(std::to_string(e.cold_resist));
|
||||||
|
v.push_back(std::to_string(e.fire_resist));
|
||||||
|
v.push_back(std::to_string(e.magic_resist));
|
||||||
|
v.push_back(std::to_string(e.disease_resist));
|
||||||
|
v.push_back(std::to_string(e.poison_resist));
|
||||||
|
v.push_back(std::to_string(e.corruption_resist));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,475 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://docs.eqemu.io/developer/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_CHARACTER_EVOLVING_ITEMS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_CHARACTER_EVOLVING_ITEMS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseCharacterEvolvingItemsRepository {
|
|
||||||
public:
|
|
||||||
struct CharacterEvolvingItems {
|
|
||||||
uint64_t id;
|
|
||||||
uint32_t character_id;
|
|
||||||
uint32_t item_id;
|
|
||||||
uint8_t activated;
|
|
||||||
uint8_t equipped;
|
|
||||||
int64_t current_amount;
|
|
||||||
double progression;
|
|
||||||
uint32_t final_item_id;
|
|
||||||
time_t deleted_at;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"character_id",
|
|
||||||
"item_id",
|
|
||||||
"activated",
|
|
||||||
"equipped",
|
|
||||||
"current_amount",
|
|
||||||
"progression",
|
|
||||||
"final_item_id",
|
|
||||||
"deleted_at",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"character_id",
|
|
||||||
"item_id",
|
|
||||||
"activated",
|
|
||||||
"equipped",
|
|
||||||
"current_amount",
|
|
||||||
"progression",
|
|
||||||
"final_item_id",
|
|
||||||
"UNIX_TIMESTAMP(deleted_at)",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(Strings::Implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SelectColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(Strings::Implode(", ", SelectColumns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("character_evolving_items");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterEvolvingItems NewEntity()
|
|
||||||
{
|
|
||||||
CharacterEvolvingItems e{};
|
|
||||||
|
|
||||||
e.id = 0;
|
|
||||||
e.character_id = 0;
|
|
||||||
e.item_id = 0;
|
|
||||||
e.activated = 0;
|
|
||||||
e.equipped = 0;
|
|
||||||
e.current_amount = 0;
|
|
||||||
e.progression = 0;
|
|
||||||
e.final_item_id = 0;
|
|
||||||
e.deleted_at = 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterEvolvingItems GetCharacterEvolvingItems(
|
|
||||||
const std::vector<CharacterEvolvingItems> &character_evolving_itemss,
|
|
||||||
int character_evolving_items_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &character_evolving_items : character_evolving_itemss) {
|
|
||||||
if (character_evolving_items.id == character_evolving_items_id) {
|
|
||||||
return character_evolving_items;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterEvolvingItems FindOne(
|
|
||||||
Database& db,
|
|
||||||
int character_evolving_items_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_evolving_items_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
CharacterEvolvingItems e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.activated = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.equipped = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.current_amount = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
|
||||||
e.progression = row[6] ? strtod(row[6], nullptr) : 0;
|
|
||||||
e.final_item_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.deleted_at = strtoll(row[8] ? row[8] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int character_evolving_items_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_evolving_items_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const CharacterEvolvingItems &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.character_id));
|
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.item_id));
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.activated));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.equipped));
|
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.current_amount));
|
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.progression));
|
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.final_item_id));
|
|
||||||
v.push_back(columns[8] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
Strings::Implode(", ", v),
|
|
||||||
PrimaryKey(),
|
|
||||||
e.id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterEvolvingItems InsertOne(
|
|
||||||
Database& db,
|
|
||||||
CharacterEvolvingItems e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.activated));
|
|
||||||
v.push_back(std::to_string(e.equipped));
|
|
||||||
v.push_back(std::to_string(e.current_amount));
|
|
||||||
v.push_back(std::to_string(e.progression));
|
|
||||||
v.push_back(std::to_string(e.final_item_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
Strings::Implode(",", v)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
e.id = results.LastInsertedID();
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
e = NewEntity();
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
const std::vector<CharacterEvolvingItems> &entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &e: entries) {
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.activated));
|
|
||||||
v.push_back(std::to_string(e.equipped));
|
|
||||||
v.push_back(std::to_string(e.current_amount));
|
|
||||||
v.push_back(std::to_string(e.progression));
|
|
||||||
v.push_back(std::to_string(e.final_item_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterEvolvingItems> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<CharacterEvolvingItems> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterEvolvingItems e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.activated = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.equipped = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.current_amount = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
|
||||||
e.progression = row[6] ? strtod(row[6], nullptr) : 0;
|
|
||||||
e.final_item_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.deleted_at = strtoll(row[8] ? row[8] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterEvolvingItems> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<CharacterEvolvingItems> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterEvolvingItems e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.activated = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.equipped = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.current_amount = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
|
||||||
e.progression = row[6] ? strtod(row[6], nullptr) : 0;
|
|
||||||
e.final_item_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.deleted_at = strtoll(row[8] ? row[8] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int64 GetMaxId(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"SELECT COALESCE(MAX({}), 0) FROM {}",
|
|
||||||
PrimaryKey(),
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int64 Count(Database& db, const std::string &where_filter = "")
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"SELECT COUNT(*) FROM {} {}",
|
|
||||||
TableName(),
|
|
||||||
(where_filter.empty() ? "" : "WHERE " + where_filter)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseReplace()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"REPLACE INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ReplaceOne(
|
|
||||||
Database& db,
|
|
||||||
const CharacterEvolvingItems &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.activated));
|
|
||||||
v.push_back(std::to_string(e.equipped));
|
|
||||||
v.push_back(std::to_string(e.current_amount));
|
|
||||||
v.push_back(std::to_string(e.progression));
|
|
||||||
v.push_back(std::to_string(e.final_item_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseReplace(),
|
|
||||||
Strings::Implode(",", v)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ReplaceMany(
|
|
||||||
Database& db,
|
|
||||||
const std::vector<CharacterEvolvingItems> &entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &e: entries) {
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.activated));
|
|
||||||
v.push_back(std::to_string(e.equipped));
|
|
||||||
v.push_back(std::to_string(e.current_amount));
|
|
||||||
v.push_back(std::to_string(e.progression));
|
|
||||||
v.push_back(std::to_string(e.final_item_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseReplace(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_CHARACTER_EVOLVING_ITEMS_REPOSITORY_H
|
|
||||||
@@ -1,392 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://docs.eqemu.io/developer/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_CHARACTER_PET_NAME_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_CHARACTER_PET_NAME_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseCharacterPetNameRepository {
|
|
||||||
public:
|
|
||||||
struct CharacterPetName {
|
|
||||||
int32_t character_id;
|
|
||||||
std::string name;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("character_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"character_id",
|
|
||||||
"name",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"character_id",
|
|
||||||
"name",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(Strings::Implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SelectColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(Strings::Implode(", ", SelectColumns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("character_pet_name");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterPetName NewEntity()
|
|
||||||
{
|
|
||||||
CharacterPetName e{};
|
|
||||||
|
|
||||||
e.character_id = 0;
|
|
||||||
e.name = "";
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterPetName GetCharacterPetName(
|
|
||||||
const std::vector<CharacterPetName> &character_pet_names,
|
|
||||||
int character_pet_name_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &character_pet_name : character_pet_names) {
|
|
||||||
if (character_pet_name.character_id == character_pet_name_id) {
|
|
||||||
return character_pet_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterPetName FindOne(
|
|
||||||
Database& db,
|
|
||||||
int character_pet_name_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_pet_name_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
CharacterPetName e{};
|
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
|
||||||
e.name = row[1] ? row[1] : "";
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int character_pet_name_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
character_pet_name_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const CharacterPetName &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[0] + " = " + std::to_string(e.character_id));
|
|
||||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
Strings::Implode(", ", v),
|
|
||||||
PrimaryKey(),
|
|
||||||
e.character_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterPetName InsertOne(
|
|
||||||
Database& db,
|
|
||||||
CharacterPetName e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
Strings::Implode(",", v)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
e.character_id = results.LastInsertedID();
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
e = NewEntity();
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
const std::vector<CharacterPetName> &entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &e: entries) {
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterPetName> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<CharacterPetName> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterPetName e{};
|
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
|
||||||
e.name = row[1] ? row[1] : "";
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<CharacterPetName> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<CharacterPetName> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
CharacterPetName e{};
|
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
|
||||||
e.name = row[1] ? row[1] : "";
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int64 GetMaxId(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"SELECT COALESCE(MAX({}), 0) FROM {}",
|
|
||||||
PrimaryKey(),
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int64 Count(Database& db, const std::string &where_filter = "")
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"SELECT COUNT(*) FROM {} {}",
|
|
||||||
TableName(),
|
|
||||||
(where_filter.empty() ? "" : "WHERE " + where_filter)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseReplace()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"REPLACE INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ReplaceOne(
|
|
||||||
Database& db,
|
|
||||||
const CharacterPetName &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseReplace(),
|
|
||||||
Strings::Implode(",", v)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ReplaceMany(
|
|
||||||
Database& db,
|
|
||||||
const std::vector<CharacterPetName> &entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &e: entries) {
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseReplace(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_CHARACTER_PET_NAME_REPOSITORY_H
|
|
||||||
@@ -23,7 +23,6 @@ public:
|
|||||||
std::string key_;
|
std::string key_;
|
||||||
std::string value;
|
std::string value;
|
||||||
uint32_t expires;
|
uint32_t expires;
|
||||||
int64_t account_id;
|
|
||||||
int64_t character_id;
|
int64_t character_id;
|
||||||
int64_t npc_id;
|
int64_t npc_id;
|
||||||
int64_t bot_id;
|
int64_t bot_id;
|
||||||
@@ -37,7 +36,6 @@ public:
|
|||||||
CEREAL_NVP(key_),
|
CEREAL_NVP(key_),
|
||||||
CEREAL_NVP(value),
|
CEREAL_NVP(value),
|
||||||
CEREAL_NVP(expires),
|
CEREAL_NVP(expires),
|
||||||
CEREAL_NVP(account_id),
|
|
||||||
CEREAL_NVP(character_id),
|
CEREAL_NVP(character_id),
|
||||||
CEREAL_NVP(npc_id),
|
CEREAL_NVP(npc_id),
|
||||||
CEREAL_NVP(bot_id)
|
CEREAL_NVP(bot_id)
|
||||||
@@ -57,7 +55,6 @@ public:
|
|||||||
"`key`",
|
"`key`",
|
||||||
"value",
|
"value",
|
||||||
"expires",
|
"expires",
|
||||||
"account_id",
|
|
||||||
"character_id",
|
"character_id",
|
||||||
"npc_id",
|
"npc_id",
|
||||||
"bot_id",
|
"bot_id",
|
||||||
@@ -71,7 +68,6 @@ public:
|
|||||||
"`key`",
|
"`key`",
|
||||||
"value",
|
"value",
|
||||||
"expires",
|
"expires",
|
||||||
"account_id",
|
|
||||||
"character_id",
|
"character_id",
|
||||||
"npc_id",
|
"npc_id",
|
||||||
"bot_id",
|
"bot_id",
|
||||||
@@ -119,7 +115,6 @@ public:
|
|||||||
e.key_ = "";
|
e.key_ = "";
|
||||||
e.value = "";
|
e.value = "";
|
||||||
e.expires = 0;
|
e.expires = 0;
|
||||||
e.account_id = 0;
|
|
||||||
e.character_id = 0;
|
e.character_id = 0;
|
||||||
e.npc_id = 0;
|
e.npc_id = 0;
|
||||||
e.bot_id = 0;
|
e.bot_id = 0;
|
||||||
@@ -163,10 +158,9 @@ public:
|
|||||||
e.key_ = row[1] ? row[1] : "";
|
e.key_ = row[1] ? row[1] : "";
|
||||||
e.value = row[2] ? row[2] : "";
|
e.value = row[2] ? row[2] : "";
|
||||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
e.character_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
e.npc_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
e.bot_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -203,10 +197,9 @@ public:
|
|||||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.key_) + "'");
|
v.push_back(columns[1] + " = '" + Strings::Escape(e.key_) + "'");
|
||||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.value) + "'");
|
v.push_back(columns[2] + " = '" + Strings::Escape(e.value) + "'");
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.expires));
|
v.push_back(columns[3] + " = " + std::to_string(e.expires));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.account_id));
|
v.push_back(columns[4] + " = " + std::to_string(e.character_id));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.character_id));
|
v.push_back(columns[5] + " = " + std::to_string(e.npc_id));
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.npc_id));
|
v.push_back(columns[6] + " = " + std::to_string(e.bot_id));
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.bot_id));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -232,7 +225,6 @@ public:
|
|||||||
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||||
v.push_back(std::to_string(e.expires));
|
v.push_back(std::to_string(e.expires));
|
||||||
v.push_back(std::to_string(e.account_id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
@@ -269,7 +261,6 @@ public:
|
|||||||
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||||
v.push_back(std::to_string(e.expires));
|
v.push_back(std::to_string(e.expires));
|
||||||
v.push_back(std::to_string(e.account_id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
@@ -310,10 +301,9 @@ public:
|
|||||||
e.key_ = row[1] ? row[1] : "";
|
e.key_ = row[1] ? row[1] : "";
|
||||||
e.value = row[2] ? row[2] : "";
|
e.value = row[2] ? row[2] : "";
|
||||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
e.character_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
e.npc_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
e.bot_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -342,10 +332,9 @@ public:
|
|||||||
e.key_ = row[1] ? row[1] : "";
|
e.key_ = row[1] ? row[1] : "";
|
||||||
e.value = row[2] ? row[2] : "";
|
e.value = row[2] ? row[2] : "";
|
||||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
e.character_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
e.npc_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
e.bot_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -424,7 +413,6 @@ public:
|
|||||||
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||||
v.push_back(std::to_string(e.expires));
|
v.push_back(std::to_string(e.expires));
|
||||||
v.push_back(std::to_string(e.account_id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
@@ -454,7 +442,6 @@ public:
|
|||||||
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
v.push_back("'" + Strings::Escape(e.key_) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||||
v.push_back(std::to_string(e.expires));
|
v.push_back(std::to_string(e.expires));
|
||||||
v.push_back(std::to_string(e.account_id));
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
|
|||||||
@@ -1,451 +0,0 @@
|
|||||||
/**
|
|
||||||
* DO NOT MODIFY THIS FILE
|
|
||||||
*
|
|
||||||
* This repository was automatically generated and is NOT to be modified directly.
|
|
||||||
* Any repository modifications are meant to be made to the repository extending the base.
|
|
||||||
* Any modifications to base repositories are to be made by the generator only
|
|
||||||
*
|
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
|
||||||
* @docs https://docs.eqemu.io/developer/repositories
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_ITEMS_EVOLVING_DETAILS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_ITEMS_EVOLVING_DETAILS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseItemsEvolvingDetailsRepository {
|
|
||||||
public:
|
|
||||||
struct ItemsEvolvingDetails {
|
|
||||||
uint32_t id;
|
|
||||||
uint32_t item_evo_id;
|
|
||||||
uint32_t item_evolve_level;
|
|
||||||
uint32_t item_id;
|
|
||||||
uint32_t type;
|
|
||||||
uint32_t sub_type;
|
|
||||||
int64_t required_amount;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"item_evo_id",
|
|
||||||
"item_evolve_level",
|
|
||||||
"item_id",
|
|
||||||
"type",
|
|
||||||
"sub_type",
|
|
||||||
"required_amount",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"item_evo_id",
|
|
||||||
"item_evolve_level",
|
|
||||||
"item_id",
|
|
||||||
"type",
|
|
||||||
"sub_type",
|
|
||||||
"required_amount",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(Strings::Implode(", ", Columns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string SelectColumnsRaw()
|
|
||||||
{
|
|
||||||
return std::string(Strings::Implode(", ", SelectColumns()));
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string TableName()
|
|
||||||
{
|
|
||||||
return std::string("items_evolving_details");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ItemsEvolvingDetails NewEntity()
|
|
||||||
{
|
|
||||||
ItemsEvolvingDetails e{};
|
|
||||||
|
|
||||||
e.id = 0;
|
|
||||||
e.item_evo_id = 0;
|
|
||||||
e.item_evolve_level = 0;
|
|
||||||
e.item_id = 0;
|
|
||||||
e.type = 0;
|
|
||||||
e.sub_type = 0;
|
|
||||||
e.required_amount = 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ItemsEvolvingDetails GetItemsEvolvingDetails(
|
|
||||||
const std::vector<ItemsEvolvingDetails> &items_evolving_detailss,
|
|
||||||
int items_evolving_details_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &items_evolving_details : items_evolving_detailss) {
|
|
||||||
if (items_evolving_details.id == items_evolving_details_id) {
|
|
||||||
return items_evolving_details;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static ItemsEvolvingDetails FindOne(
|
|
||||||
Database& db,
|
|
||||||
int items_evolving_details_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
items_evolving_details_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
ItemsEvolvingDetails e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
|
||||||
e.item_evo_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_evolve_level = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.type = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.sub_type = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int items_evolving_details_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
items_evolving_details_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const ItemsEvolvingDetails &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.item_evo_id));
|
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.item_evolve_level));
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.item_id));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.type));
|
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.sub_type));
|
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.required_amount));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"UPDATE {} SET {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
Strings::Implode(", ", v),
|
|
||||||
PrimaryKey(),
|
|
||||||
e.id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ItemsEvolvingDetails InsertOne(
|
|
||||||
Database& db,
|
|
||||||
ItemsEvolvingDetails e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.item_evo_id));
|
|
||||||
v.push_back(std::to_string(e.item_evolve_level));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.type));
|
|
||||||
v.push_back(std::to_string(e.sub_type));
|
|
||||||
v.push_back(std::to_string(e.required_amount));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseInsert(),
|
|
||||||
Strings::Implode(",", v)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.Success()) {
|
|
||||||
e.id = results.LastInsertedID();
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
e = NewEntity();
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int InsertMany(
|
|
||||||
Database& db,
|
|
||||||
const std::vector<ItemsEvolvingDetails> &entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &e: entries) {
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.item_evo_id));
|
|
||||||
v.push_back(std::to_string(e.item_evolve_level));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.type));
|
|
||||||
v.push_back(std::to_string(e.sub_type));
|
|
||||||
v.push_back(std::to_string(e.required_amount));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseInsert(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<ItemsEvolvingDetails> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<ItemsEvolvingDetails> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
ItemsEvolvingDetails e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
|
||||||
e.item_evo_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_evolve_level = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.type = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.sub_type = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<ItemsEvolvingDetails> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<ItemsEvolvingDetails> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {}",
|
|
||||||
BaseSelect(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
ItemsEvolvingDetails e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
|
||||||
e.item_evo_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_evolve_level = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.type = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.sub_type = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {}",
|
|
||||||
TableName(),
|
|
||||||
where_filter
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Truncate(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"TRUNCATE TABLE {}",
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int64 GetMaxId(Database& db)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"SELECT COALESCE(MAX({}), 0) FROM {}",
|
|
||||||
PrimaryKey(),
|
|
||||||
TableName()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int64 Count(Database& db, const std::string &where_filter = "")
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"SELECT COUNT(*) FROM {} {}",
|
|
||||||
TableName(),
|
|
||||||
(where_filter.empty() ? "" : "WHERE " + where_filter)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseReplace()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"REPLACE INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ReplaceOne(
|
|
||||||
Database& db,
|
|
||||||
const ItemsEvolvingDetails &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.item_evo_id));
|
|
||||||
v.push_back(std::to_string(e.item_evolve_level));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.type));
|
|
||||||
v.push_back(std::to_string(e.sub_type));
|
|
||||||
v.push_back(std::to_string(e.required_amount));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES ({})",
|
|
||||||
BaseReplace(),
|
|
||||||
Strings::Implode(",", v)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ReplaceMany(
|
|
||||||
Database& db,
|
|
||||||
const std::vector<ItemsEvolvingDetails> &entries
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> insert_chunks;
|
|
||||||
|
|
||||||
for (auto &e: entries) {
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.item_evo_id));
|
|
||||||
v.push_back(std::to_string(e.item_evolve_level));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.type));
|
|
||||||
v.push_back(std::to_string(e.sub_type));
|
|
||||||
v.push_back(std::to_string(e.required_amount));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} VALUES {}",
|
|
||||||
BaseReplace(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_BASE_ITEMS_EVOLVING_DETAILS_REPOSITORY_H
|
|
||||||
@@ -28,14 +28,13 @@ public:
|
|||||||
uint32_t aug_slot_4;
|
uint32_t aug_slot_4;
|
||||||
uint32_t aug_slot_5;
|
uint32_t aug_slot_5;
|
||||||
uint32_t aug_slot_6;
|
uint32_t aug_slot_6;
|
||||||
uint32_t item_sn;
|
int32_t item_sn;
|
||||||
int32_t item_charges;
|
int32_t item_charges;
|
||||||
uint32_t item_cost;
|
uint64_t item_cost;
|
||||||
uint8_t slot_id;
|
uint8_t slot_id;
|
||||||
uint32_t char_entity_id;
|
uint32_t char_entity_id;
|
||||||
uint32_t char_zone_id;
|
uint32_t char_zone_id;
|
||||||
int32_t char_zone_instance_id;
|
int8_t active_transaction;
|
||||||
uint8_t active_transaction;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -61,7 +60,6 @@ public:
|
|||||||
"slot_id",
|
"slot_id",
|
||||||
"char_entity_id",
|
"char_entity_id",
|
||||||
"char_zone_id",
|
"char_zone_id",
|
||||||
"char_zone_instance_id",
|
|
||||||
"active_transaction",
|
"active_transaction",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -84,7 +82,6 @@ public:
|
|||||||
"slot_id",
|
"slot_id",
|
||||||
"char_entity_id",
|
"char_entity_id",
|
||||||
"char_zone_id",
|
"char_zone_id",
|
||||||
"char_zone_instance_id",
|
|
||||||
"active_transaction",
|
"active_transaction",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -141,7 +138,6 @@ public:
|
|||||||
e.slot_id = 0;
|
e.slot_id = 0;
|
||||||
e.char_entity_id = 0;
|
e.char_entity_id = 0;
|
||||||
e.char_zone_id = 0;
|
e.char_zone_id = 0;
|
||||||
e.char_zone_instance_id = 0;
|
|
||||||
e.active_transaction = 0;
|
e.active_transaction = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
@@ -188,14 +184,13 @@ public:
|
|||||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
e.item_sn = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
e.item_sn = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||||
e.item_charges = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
e.item_charges = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||||
e.item_cost = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
e.item_cost = row[11] ? strtoull(row[11], nullptr, 10) : 0;
|
||||||
e.slot_id = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
e.slot_id = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||||
e.char_entity_id = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.char_entity_id = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.char_zone_id = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.char_zone_id = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
e.char_zone_instance_id = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
e.active_transaction = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
|
||||||
e.active_transaction = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -243,8 +238,7 @@ public:
|
|||||||
v.push_back(columns[12] + " = " + std::to_string(e.slot_id));
|
v.push_back(columns[12] + " = " + std::to_string(e.slot_id));
|
||||||
v.push_back(columns[13] + " = " + std::to_string(e.char_entity_id));
|
v.push_back(columns[13] + " = " + std::to_string(e.char_entity_id));
|
||||||
v.push_back(columns[14] + " = " + std::to_string(e.char_zone_id));
|
v.push_back(columns[14] + " = " + std::to_string(e.char_zone_id));
|
||||||
v.push_back(columns[15] + " = " + std::to_string(e.char_zone_instance_id));
|
v.push_back(columns[15] + " = " + std::to_string(e.active_transaction));
|
||||||
v.push_back(columns[16] + " = " + std::to_string(e.active_transaction));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -281,7 +275,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slot_id));
|
||||||
v.push_back(std::to_string(e.char_entity_id));
|
v.push_back(std::to_string(e.char_entity_id));
|
||||||
v.push_back(std::to_string(e.char_zone_id));
|
v.push_back(std::to_string(e.char_zone_id));
|
||||||
v.push_back(std::to_string(e.char_zone_instance_id));
|
|
||||||
v.push_back(std::to_string(e.active_transaction));
|
v.push_back(std::to_string(e.active_transaction));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -327,7 +320,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slot_id));
|
||||||
v.push_back(std::to_string(e.char_entity_id));
|
v.push_back(std::to_string(e.char_entity_id));
|
||||||
v.push_back(std::to_string(e.char_zone_id));
|
v.push_back(std::to_string(e.char_zone_id));
|
||||||
v.push_back(std::to_string(e.char_zone_instance_id));
|
|
||||||
v.push_back(std::to_string(e.active_transaction));
|
v.push_back(std::to_string(e.active_transaction));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
@@ -371,14 +363,13 @@ public:
|
|||||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
e.item_sn = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
e.item_sn = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||||
e.item_charges = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
e.item_charges = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||||
e.item_cost = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
e.item_cost = row[11] ? strtoull(row[11], nullptr, 10) : 0;
|
||||||
e.slot_id = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
e.slot_id = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||||
e.char_entity_id = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.char_entity_id = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.char_zone_id = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.char_zone_id = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
e.char_zone_instance_id = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
e.active_transaction = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
|
||||||
e.active_transaction = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -412,14 +403,13 @@ public:
|
|||||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
e.item_sn = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
e.item_sn = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||||
e.item_charges = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
e.item_charges = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||||
e.item_cost = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
e.item_cost = row[11] ? strtoull(row[11], nullptr, 10) : 0;
|
||||||
e.slot_id = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
e.slot_id = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||||
e.char_entity_id = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.char_entity_id = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.char_zone_id = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.char_zone_id = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
e.char_zone_instance_id = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
e.active_transaction = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
|
||||||
e.active_transaction = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -509,7 +499,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slot_id));
|
||||||
v.push_back(std::to_string(e.char_entity_id));
|
v.push_back(std::to_string(e.char_entity_id));
|
||||||
v.push_back(std::to_string(e.char_zone_id));
|
v.push_back(std::to_string(e.char_zone_id));
|
||||||
v.push_back(std::to_string(e.char_zone_instance_id));
|
|
||||||
v.push_back(std::to_string(e.active_transaction));
|
v.push_back(std::to_string(e.active_transaction));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -548,7 +537,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slot_id));
|
||||||
v.push_back(std::to_string(e.char_entity_id));
|
v.push_back(std::to_string(e.char_entity_id));
|
||||||
v.push_back(std::to_string(e.char_zone_id));
|
v.push_back(std::to_string(e.char_zone_id));
|
||||||
v.push_back(std::to_string(e.char_zone_instance_id));
|
|
||||||
v.push_back(std::to_string(e.active_transaction));
|
v.push_back(std::to_string(e.active_transaction));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
|
|||||||
@@ -111,13 +111,12 @@ public:
|
|||||||
int32_t fast_regen_mana;
|
int32_t fast_regen_mana;
|
||||||
int32_t fast_regen_endurance;
|
int32_t fast_regen_endurance;
|
||||||
int32_t npc_max_aggro_dist;
|
int32_t npc_max_aggro_dist;
|
||||||
uint32_t client_update_range;
|
uint32_t max_movement_update_range;
|
||||||
int32_t underworld_teleport_index;
|
int32_t underworld_teleport_index;
|
||||||
int32_t lava_damage;
|
int32_t lava_damage;
|
||||||
int32_t min_lava_damage;
|
int32_t min_lava_damage;
|
||||||
uint8_t idle_when_empty;
|
uint8_t idle_when_empty;
|
||||||
uint32_t seconds_before_idle;
|
uint32_t seconds_before_idle;
|
||||||
int32_t shard_at_player_count;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -220,13 +219,12 @@ public:
|
|||||||
"fast_regen_mana",
|
"fast_regen_mana",
|
||||||
"fast_regen_endurance",
|
"fast_regen_endurance",
|
||||||
"npc_max_aggro_dist",
|
"npc_max_aggro_dist",
|
||||||
"client_update_range",
|
"max_movement_update_range",
|
||||||
"underworld_teleport_index",
|
"underworld_teleport_index",
|
||||||
"lava_damage",
|
"lava_damage",
|
||||||
"min_lava_damage",
|
"min_lava_damage",
|
||||||
"idle_when_empty",
|
"idle_when_empty",
|
||||||
"seconds_before_idle",
|
"seconds_before_idle",
|
||||||
"shard_at_player_count",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,13 +323,12 @@ public:
|
|||||||
"fast_regen_mana",
|
"fast_regen_mana",
|
||||||
"fast_regen_endurance",
|
"fast_regen_endurance",
|
||||||
"npc_max_aggro_dist",
|
"npc_max_aggro_dist",
|
||||||
"client_update_range",
|
"max_movement_update_range",
|
||||||
"underworld_teleport_index",
|
"underworld_teleport_index",
|
||||||
"lava_damage",
|
"lava_damage",
|
||||||
"min_lava_damage",
|
"min_lava_damage",
|
||||||
"idle_when_empty",
|
"idle_when_empty",
|
||||||
"seconds_before_idle",
|
"seconds_before_idle",
|
||||||
"shard_at_player_count",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,13 +461,12 @@ public:
|
|||||||
e.fast_regen_mana = 180;
|
e.fast_regen_mana = 180;
|
||||||
e.fast_regen_endurance = 180;
|
e.fast_regen_endurance = 180;
|
||||||
e.npc_max_aggro_dist = 600;
|
e.npc_max_aggro_dist = 600;
|
||||||
e.client_update_range = 600;
|
e.max_movement_update_range = 600;
|
||||||
e.underworld_teleport_index = 0;
|
e.underworld_teleport_index = 0;
|
||||||
e.lava_damage = 50;
|
e.lava_damage = 50;
|
||||||
e.min_lava_damage = 10;
|
e.min_lava_damage = 10;
|
||||||
e.idle_when_empty = 1;
|
e.idle_when_empty = 1;
|
||||||
e.seconds_before_idle = 60;
|
e.seconds_before_idle = 60;
|
||||||
e.shard_at_player_count = 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -599,13 +595,12 @@ public:
|
|||||||
e.fast_regen_mana = row[89] ? static_cast<int32_t>(atoi(row[89])) : 180;
|
e.fast_regen_mana = row[89] ? static_cast<int32_t>(atoi(row[89])) : 180;
|
||||||
e.fast_regen_endurance = row[90] ? static_cast<int32_t>(atoi(row[90])) : 180;
|
e.fast_regen_endurance = row[90] ? static_cast<int32_t>(atoi(row[90])) : 180;
|
||||||
e.npc_max_aggro_dist = row[91] ? static_cast<int32_t>(atoi(row[91])) : 600;
|
e.npc_max_aggro_dist = row[91] ? static_cast<int32_t>(atoi(row[91])) : 600;
|
||||||
e.client_update_range = row[92] ? static_cast<uint32_t>(strtoul(row[92], nullptr, 10)) : 600;
|
e.max_movement_update_range = row[92] ? static_cast<uint32_t>(strtoul(row[92], nullptr, 10)) : 600;
|
||||||
e.underworld_teleport_index = row[93] ? static_cast<int32_t>(atoi(row[93])) : 0;
|
e.underworld_teleport_index = row[93] ? static_cast<int32_t>(atoi(row[93])) : 0;
|
||||||
e.lava_damage = row[94] ? static_cast<int32_t>(atoi(row[94])) : 50;
|
e.lava_damage = row[94] ? static_cast<int32_t>(atoi(row[94])) : 50;
|
||||||
e.min_lava_damage = row[95] ? static_cast<int32_t>(atoi(row[95])) : 10;
|
e.min_lava_damage = row[95] ? static_cast<int32_t>(atoi(row[95])) : 10;
|
||||||
e.idle_when_empty = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 1;
|
e.idle_when_empty = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 1;
|
||||||
e.seconds_before_idle = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 60;
|
e.seconds_before_idle = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 60;
|
||||||
e.shard_at_player_count = row[98] ? static_cast<int32_t>(atoi(row[98])) : 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -730,13 +725,12 @@ public:
|
|||||||
v.push_back(columns[89] + " = " + std::to_string(e.fast_regen_mana));
|
v.push_back(columns[89] + " = " + std::to_string(e.fast_regen_mana));
|
||||||
v.push_back(columns[90] + " = " + std::to_string(e.fast_regen_endurance));
|
v.push_back(columns[90] + " = " + std::to_string(e.fast_regen_endurance));
|
||||||
v.push_back(columns[91] + " = " + std::to_string(e.npc_max_aggro_dist));
|
v.push_back(columns[91] + " = " + std::to_string(e.npc_max_aggro_dist));
|
||||||
v.push_back(columns[92] + " = " + std::to_string(e.client_update_range));
|
v.push_back(columns[92] + " = " + std::to_string(e.max_movement_update_range));
|
||||||
v.push_back(columns[93] + " = " + std::to_string(e.underworld_teleport_index));
|
v.push_back(columns[93] + " = " + std::to_string(e.underworld_teleport_index));
|
||||||
v.push_back(columns[94] + " = " + std::to_string(e.lava_damage));
|
v.push_back(columns[94] + " = " + std::to_string(e.lava_damage));
|
||||||
v.push_back(columns[95] + " = " + std::to_string(e.min_lava_damage));
|
v.push_back(columns[95] + " = " + std::to_string(e.min_lava_damage));
|
||||||
v.push_back(columns[96] + " = " + std::to_string(e.idle_when_empty));
|
v.push_back(columns[96] + " = " + std::to_string(e.idle_when_empty));
|
||||||
v.push_back(columns[97] + " = " + std::to_string(e.seconds_before_idle));
|
v.push_back(columns[97] + " = " + std::to_string(e.seconds_before_idle));
|
||||||
v.push_back(columns[98] + " = " + std::to_string(e.shard_at_player_count));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -850,13 +844,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.fast_regen_mana));
|
v.push_back(std::to_string(e.fast_regen_mana));
|
||||||
v.push_back(std::to_string(e.fast_regen_endurance));
|
v.push_back(std::to_string(e.fast_regen_endurance));
|
||||||
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
||||||
v.push_back(std::to_string(e.client_update_range));
|
v.push_back(std::to_string(e.max_movement_update_range));
|
||||||
v.push_back(std::to_string(e.underworld_teleport_index));
|
v.push_back(std::to_string(e.underworld_teleport_index));
|
||||||
v.push_back(std::to_string(e.lava_damage));
|
v.push_back(std::to_string(e.lava_damage));
|
||||||
v.push_back(std::to_string(e.min_lava_damage));
|
v.push_back(std::to_string(e.min_lava_damage));
|
||||||
v.push_back(std::to_string(e.idle_when_empty));
|
v.push_back(std::to_string(e.idle_when_empty));
|
||||||
v.push_back(std::to_string(e.seconds_before_idle));
|
v.push_back(std::to_string(e.seconds_before_idle));
|
||||||
v.push_back(std::to_string(e.shard_at_player_count));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -978,13 +971,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.fast_regen_mana));
|
v.push_back(std::to_string(e.fast_regen_mana));
|
||||||
v.push_back(std::to_string(e.fast_regen_endurance));
|
v.push_back(std::to_string(e.fast_regen_endurance));
|
||||||
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
||||||
v.push_back(std::to_string(e.client_update_range));
|
v.push_back(std::to_string(e.max_movement_update_range));
|
||||||
v.push_back(std::to_string(e.underworld_teleport_index));
|
v.push_back(std::to_string(e.underworld_teleport_index));
|
||||||
v.push_back(std::to_string(e.lava_damage));
|
v.push_back(std::to_string(e.lava_damage));
|
||||||
v.push_back(std::to_string(e.min_lava_damage));
|
v.push_back(std::to_string(e.min_lava_damage));
|
||||||
v.push_back(std::to_string(e.idle_when_empty));
|
v.push_back(std::to_string(e.idle_when_empty));
|
||||||
v.push_back(std::to_string(e.seconds_before_idle));
|
v.push_back(std::to_string(e.seconds_before_idle));
|
||||||
v.push_back(std::to_string(e.shard_at_player_count));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -1110,13 +1102,12 @@ public:
|
|||||||
e.fast_regen_mana = row[89] ? static_cast<int32_t>(atoi(row[89])) : 180;
|
e.fast_regen_mana = row[89] ? static_cast<int32_t>(atoi(row[89])) : 180;
|
||||||
e.fast_regen_endurance = row[90] ? static_cast<int32_t>(atoi(row[90])) : 180;
|
e.fast_regen_endurance = row[90] ? static_cast<int32_t>(atoi(row[90])) : 180;
|
||||||
e.npc_max_aggro_dist = row[91] ? static_cast<int32_t>(atoi(row[91])) : 600;
|
e.npc_max_aggro_dist = row[91] ? static_cast<int32_t>(atoi(row[91])) : 600;
|
||||||
e.client_update_range = row[92] ? static_cast<uint32_t>(strtoul(row[92], nullptr, 10)) : 600;
|
e.max_movement_update_range = row[92] ? static_cast<uint32_t>(strtoul(row[92], nullptr, 10)) : 600;
|
||||||
e.underworld_teleport_index = row[93] ? static_cast<int32_t>(atoi(row[93])) : 0;
|
e.underworld_teleport_index = row[93] ? static_cast<int32_t>(atoi(row[93])) : 0;
|
||||||
e.lava_damage = row[94] ? static_cast<int32_t>(atoi(row[94])) : 50;
|
e.lava_damage = row[94] ? static_cast<int32_t>(atoi(row[94])) : 50;
|
||||||
e.min_lava_damage = row[95] ? static_cast<int32_t>(atoi(row[95])) : 10;
|
e.min_lava_damage = row[95] ? static_cast<int32_t>(atoi(row[95])) : 10;
|
||||||
e.idle_when_empty = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 1;
|
e.idle_when_empty = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 1;
|
||||||
e.seconds_before_idle = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 60;
|
e.seconds_before_idle = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 60;
|
||||||
e.shard_at_player_count = row[98] ? static_cast<int32_t>(atoi(row[98])) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1233,13 +1224,12 @@ public:
|
|||||||
e.fast_regen_mana = row[89] ? static_cast<int32_t>(atoi(row[89])) : 180;
|
e.fast_regen_mana = row[89] ? static_cast<int32_t>(atoi(row[89])) : 180;
|
||||||
e.fast_regen_endurance = row[90] ? static_cast<int32_t>(atoi(row[90])) : 180;
|
e.fast_regen_endurance = row[90] ? static_cast<int32_t>(atoi(row[90])) : 180;
|
||||||
e.npc_max_aggro_dist = row[91] ? static_cast<int32_t>(atoi(row[91])) : 600;
|
e.npc_max_aggro_dist = row[91] ? static_cast<int32_t>(atoi(row[91])) : 600;
|
||||||
e.client_update_range = row[92] ? static_cast<uint32_t>(strtoul(row[92], nullptr, 10)) : 600;
|
e.max_movement_update_range = row[92] ? static_cast<uint32_t>(strtoul(row[92], nullptr, 10)) : 600;
|
||||||
e.underworld_teleport_index = row[93] ? static_cast<int32_t>(atoi(row[93])) : 0;
|
e.underworld_teleport_index = row[93] ? static_cast<int32_t>(atoi(row[93])) : 0;
|
||||||
e.lava_damage = row[94] ? static_cast<int32_t>(atoi(row[94])) : 50;
|
e.lava_damage = row[94] ? static_cast<int32_t>(atoi(row[94])) : 50;
|
||||||
e.min_lava_damage = row[95] ? static_cast<int32_t>(atoi(row[95])) : 10;
|
e.min_lava_damage = row[95] ? static_cast<int32_t>(atoi(row[95])) : 10;
|
||||||
e.idle_when_empty = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 1;
|
e.idle_when_empty = row[96] ? static_cast<uint8_t>(strtoul(row[96], nullptr, 10)) : 1;
|
||||||
e.seconds_before_idle = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 60;
|
e.seconds_before_idle = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 60;
|
||||||
e.shard_at_player_count = row[98] ? static_cast<int32_t>(atoi(row[98])) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1406,13 +1396,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.fast_regen_mana));
|
v.push_back(std::to_string(e.fast_regen_mana));
|
||||||
v.push_back(std::to_string(e.fast_regen_endurance));
|
v.push_back(std::to_string(e.fast_regen_endurance));
|
||||||
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
||||||
v.push_back(std::to_string(e.client_update_range));
|
v.push_back(std::to_string(e.max_movement_update_range));
|
||||||
v.push_back(std::to_string(e.underworld_teleport_index));
|
v.push_back(std::to_string(e.underworld_teleport_index));
|
||||||
v.push_back(std::to_string(e.lava_damage));
|
v.push_back(std::to_string(e.lava_damage));
|
||||||
v.push_back(std::to_string(e.min_lava_damage));
|
v.push_back(std::to_string(e.min_lava_damage));
|
||||||
v.push_back(std::to_string(e.idle_when_empty));
|
v.push_back(std::to_string(e.idle_when_empty));
|
||||||
v.push_back(std::to_string(e.seconds_before_idle));
|
v.push_back(std::to_string(e.seconds_before_idle));
|
||||||
v.push_back(std::to_string(e.shard_at_player_count));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1527,13 +1516,12 @@ public:
|
|||||||
v.push_back(std::to_string(e.fast_regen_mana));
|
v.push_back(std::to_string(e.fast_regen_mana));
|
||||||
v.push_back(std::to_string(e.fast_regen_endurance));
|
v.push_back(std::to_string(e.fast_regen_endurance));
|
||||||
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
v.push_back(std::to_string(e.npc_max_aggro_dist));
|
||||||
v.push_back(std::to_string(e.client_update_range));
|
v.push_back(std::to_string(e.max_movement_update_range));
|
||||||
v.push_back(std::to_string(e.underworld_teleport_index));
|
v.push_back(std::to_string(e.underworld_teleport_index));
|
||||||
v.push_back(std::to_string(e.lava_damage));
|
v.push_back(std::to_string(e.lava_damage));
|
||||||
v.push_back(std::to_string(e.min_lava_damage));
|
v.push_back(std::to_string(e.min_lava_damage));
|
||||||
v.push_back(std::to_string(e.idle_when_empty));
|
v.push_back(std::to_string(e.idle_when_empty));
|
||||||
v.push_back(std::to_string(e.seconds_before_idle));
|
v.push_back(std::to_string(e.seconds_before_idle));
|
||||||
v.push_back(std::to_string(e.shard_at_player_count));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,10 +236,6 @@ public:
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (buyers.empty()) {
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> char_ids{};
|
std::vector<std::string> char_ids{};
|
||||||
for (auto const &bl : buyers) {
|
for (auto const &bl : buyers) {
|
||||||
char_ids.push_back((std::to_string(bl.char_id)));
|
char_ids.push_back((std::to_string(bl.char_id)));
|
||||||
|
|||||||
@@ -120,10 +120,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeleteWhere(db, fmt::format("`char_id` = '{}';", char_id));
|
DeleteWhere(db, fmt::format("`char_id` = '{}';", char_id));
|
||||||
if (buy_line_ids.empty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseBuyerBuyLinesRepository::DeleteWhere(
|
BaseBuyerBuyLinesRepository::DeleteWhere(
|
||||||
db,
|
db,
|
||||||
fmt::format("`id` IN({})", Strings::Implode(", ", buy_line_ids))
|
fmt::format("`id` IN({})", Strings::Implode(", ", buy_line_ids))
|
||||||
|
|||||||
@@ -80,93 +80,6 @@ public:
|
|||||||
|
|
||||||
return l.empty() ? CharacterDataRepository::NewEntity() : l.front();
|
return l.empty() ? CharacterDataRepository::NewEntity() : l.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InstancePlayerCount {
|
|
||||||
int32_t instance_id;
|
|
||||||
uint32_t zone_id;
|
|
||||||
uint32_t player_count;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::vector<InstancePlayerCount> GetInstanceZonePlayerCounts(Database& db, int zone_id) {
|
|
||||||
std::vector<InstancePlayerCount> zone_player_counts;
|
|
||||||
|
|
||||||
uint64_t shard_instance_duration = 3155760000;
|
|
||||||
|
|
||||||
auto query = fmt::format(SQL(
|
|
||||||
SELECT
|
|
||||||
zone_id,
|
|
||||||
0 AS instance_id,
|
|
||||||
COUNT(id) AS player_count
|
|
||||||
FROM
|
|
||||||
character_data
|
|
||||||
WHERE
|
|
||||||
zone_instance = 0
|
|
||||||
AND zone_id = {}
|
|
||||||
AND last_login >= UNIX_TIMESTAMP(NOW()) - 600
|
|
||||||
GROUP BY
|
|
||||||
zone_id
|
|
||||||
ORDER BY
|
|
||||||
zone_id, player_count DESC
|
|
||||||
), zone_id);
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(query);
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
InstancePlayerCount e{};
|
|
||||||
e.zone_id = std::stoi(row[0]);
|
|
||||||
e.instance_id = 0;
|
|
||||||
e.player_count = std::stoi(row[2]);
|
|
||||||
zone_player_counts.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zone_player_counts.empty()) {
|
|
||||||
InstancePlayerCount e{};
|
|
||||||
e.zone_id = zone_id;
|
|
||||||
e.instance_id = 0;
|
|
||||||
e.player_count = 0;
|
|
||||||
zone_player_counts.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// duration 3155760000 is for shards explicitly
|
|
||||||
query = fmt::format(
|
|
||||||
SQL(
|
|
||||||
SELECT
|
|
||||||
i.id AS instance_id,
|
|
||||||
i.zone AS zone_id,
|
|
||||||
COUNT(c.id) AS player_count
|
|
||||||
FROM
|
|
||||||
instance_list i
|
|
||||||
LEFT JOIN
|
|
||||||
character_data c
|
|
||||||
ON
|
|
||||||
i.zone = c.zone_id
|
|
||||||
AND i.id = c.zone_instance
|
|
||||||
AND c.last_login >= UNIX_TIMESTAMP(NOW()) - 600
|
|
||||||
AND (i.start_time + i.duration >= UNIX_TIMESTAMP(NOW()) OR i.never_expires = 0)
|
|
||||||
AND i.duration = {}
|
|
||||||
WHERE
|
|
||||||
i.zone IS NOT NULL AND i.zone = {}
|
|
||||||
GROUP BY
|
|
||||||
i.id, i.zone, i.version
|
|
||||||
ORDER BY
|
|
||||||
i.id ASC;
|
|
||||||
), shard_instance_duration, zone_id
|
|
||||||
);
|
|
||||||
|
|
||||||
results = db.QueryDatabase(query);
|
|
||||||
if (!results.Success() || results.RowCount() == 0) {
|
|
||||||
return zone_player_counts;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
InstancePlayerCount e{};
|
|
||||||
e.instance_id = std::stoi(row[0]);
|
|
||||||
e.zone_id = std::stoi(row[1]);
|
|
||||||
e.player_count = std::stoi(row[2]);
|
|
||||||
zone_player_counts.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return zone_player_counts;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
|
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
#ifndef EQEMU_CHARACTER_EVOLVING_ITEMS_REPOSITORY_H
|
|
||||||
#define EQEMU_CHARACTER_EVOLVING_ITEMS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../database.h"
|
|
||||||
#include "../strings.h"
|
|
||||||
#include "base/base_character_evolving_items_repository.h"
|
|
||||||
|
|
||||||
#include <boost/tuple/tuple_comparison.hpp>
|
|
||||||
|
|
||||||
class CharacterEvolvingItemsRepository: public BaseCharacterEvolvingItemsRepository {
|
|
||||||
public:
|
|
||||||
// Custom extended repository methods here
|
|
||||||
|
|
||||||
static CharacterEvolvingItems SetCurrentAmountAndProgression(Database& db, const uint64 id, const uint64 amount, const double progression)
|
|
||||||
{
|
|
||||||
auto e = FindOne(db, id);
|
|
||||||
if (e.id == 0) {
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
e.current_amount = amount;
|
|
||||||
e.progression = progression;
|
|
||||||
e.deleted_at = 0;
|
|
||||||
UpdateOne(db, e);
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterEvolvingItems SetEquipped(Database& db, const uint64 id, const bool equipped)
|
|
||||||
{
|
|
||||||
auto e = FindOne(db, id);
|
|
||||||
if (e.id == 0) {
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
e.equipped = equipped;
|
|
||||||
e.deleted_at = 0;
|
|
||||||
UpdateOne(db, e);
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterEvolvingItems SoftDelete(Database& db, const uint64 id)
|
|
||||||
{
|
|
||||||
auto e = FindOne(db, id);
|
|
||||||
if (e.id == 0) {
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
e.deleted_at = time(nullptr);
|
|
||||||
UpdateOne(db, e);
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool UpdateCharID(Database &db, const uint64 id, const uint32 to_char_id)
|
|
||||||
{
|
|
||||||
auto e = FindOne(db, id);
|
|
||||||
if (e.id == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.character_id = to_char_id;
|
|
||||||
e.deleted_at = 0;
|
|
||||||
return UpdateOne(db, e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_CHARACTER_EVOLVING_ITEMS_REPOSITORY_H
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#ifndef EQEMU_CHARACTER_PET_NAME_REPOSITORY_H
|
|
||||||
#define EQEMU_CHARACTER_PET_NAME_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../database.h"
|
|
||||||
#include "../strings.h"
|
|
||||||
#include "base/base_character_pet_name_repository.h"
|
|
||||||
|
|
||||||
class CharacterPetNameRepository: public BaseCharacterPetNameRepository {
|
|
||||||
public:
|
|
||||||
// Custom extended repository methods here
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_CHARACTER_PET_NAME_REPOSITORY_H
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef EQEMU_ITEMS_EVOLVING_DETAILS_REPOSITORY_H
|
|
||||||
#define EQEMU_ITEMS_EVOLVING_DETAILS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../database.h"
|
|
||||||
#include "../strings.h"
|
|
||||||
#include "base/base_items_evolving_details_repository.h"
|
|
||||||
|
|
||||||
class ItemsEvolvingDetailsRepository: public BaseItemsEvolvingDetailsRepository {
|
|
||||||
public:
|
|
||||||
// Custom extended repository methods here
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //EQEMU_ITEMS_EVOLVING_DETAILS_REPOSITORY_H
|
|
||||||
@@ -12,12 +12,10 @@
|
|||||||
|
|
||||||
class TraderRepository : public BaseTraderRepository {
|
class TraderRepository : public BaseTraderRepository {
|
||||||
public:
|
public:
|
||||||
static constexpr uint32 TRADER_CONVERT_ID = 4000000000;
|
|
||||||
|
|
||||||
struct DistinctTraders_Struct {
|
struct DistinctTraders_Struct {
|
||||||
uint32 trader_id;
|
uint32 trader_id;
|
||||||
uint32 zone_id;
|
uint32 zone_id;
|
||||||
uint32 zone_instance_id;
|
|
||||||
uint32 entity_id;
|
uint32 entity_id;
|
||||||
std::string trader_name;
|
std::string trader_name;
|
||||||
};
|
};
|
||||||
@@ -37,28 +35,18 @@ public:
|
|||||||
GetBazaarSearchResults(
|
GetBazaarSearchResults(
|
||||||
SharedDatabase &db,
|
SharedDatabase &db,
|
||||||
BazaarSearchCriteria_Struct search,
|
BazaarSearchCriteria_Struct search,
|
||||||
uint32 char_zone_id,
|
uint32 char_zone_id
|
||||||
int32 char_zone_instance_id
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static BulkTraders_Struct GetDistinctTraders(
|
static BulkTraders_Struct GetDistinctTraders(Database &db)
|
||||||
Database &db,
|
|
||||||
uint32 char_zone_instance_id,
|
|
||||||
uint32 max_results = std::numeric_limits<uint32>::max()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
BulkTraders_Struct all_entries{};
|
BulkTraders_Struct all_entries{};
|
||||||
std::vector<DistinctTraders_Struct> distinct_traders;
|
std::vector<DistinctTraders_Struct> distinct_traders;
|
||||||
|
|
||||||
auto results = db.QueryDatabase(fmt::format(
|
auto results = db.QueryDatabase(
|
||||||
"SELECT DISTINCT(t.char_id), t.char_zone_id, t.char_zone_instance_id, t.char_entity_id, c.name "
|
"SELECT DISTINCT(t.char_id), t.char_zone_id, t.char_entity_id, c.name "
|
||||||
"FROM trader AS t "
|
"FROM trader AS t "
|
||||||
"JOIN character_data AS c ON t.char_id = c.id "
|
"JOIN character_data AS c ON t.char_id = c.id;"
|
||||||
"WHERE t.char_zone_instance_id = {} "
|
|
||||||
"ORDER BY t.char_zone_instance_id ASC "
|
|
||||||
"LIMIT {}",
|
|
||||||
char_zone_instance_id,
|
|
||||||
max_results)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
distinct_traders.reserve(results.RowCount());
|
distinct_traders.reserve(results.RowCount());
|
||||||
@@ -68,9 +56,8 @@ public:
|
|||||||
|
|
||||||
e.trader_id = Strings::ToInt(row[0]);
|
e.trader_id = Strings::ToInt(row[0]);
|
||||||
e.zone_id = Strings::ToInt(row[1]);
|
e.zone_id = Strings::ToInt(row[1]);
|
||||||
e.zone_instance_id = Strings::ToInt(row[2]);
|
e.entity_id = Strings::ToInt(row[2]);
|
||||||
e.entity_id = Strings::ToInt(row[3]);
|
e.trader_name = row[3] ? row[3] : "";
|
||||||
e.trader_name = row[4] ? row[4] : "";
|
|
||||||
all_entries.name_length += e.trader_name.length() + 1;
|
all_entries.name_length += e.trader_name.length() + 1;
|
||||||
|
|
||||||
all_entries.traders.push_back(e);
|
all_entries.traders.push_back(e);
|
||||||
@@ -177,36 +164,38 @@ public:
|
|||||||
return UpdateOne(db, m);
|
return UpdateOne(db, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Trader GetItemBySerialNumber(Database &db, uint32 serial_number, uint32 trader_id)
|
static Trader GetItemBySerialNumber(Database &db, uint32 serial_number)
|
||||||
{
|
{
|
||||||
Trader e{};
|
Trader e{};
|
||||||
const auto trader_item = GetWhere(
|
const auto trader_item = GetWhere(
|
||||||
db,
|
db,
|
||||||
fmt::format("`char_id` = '{}' AND `item_sn` = '{}' LIMIT 1", trader_id, serial_number)
|
fmt::format("`item_sn` = '{}' LIMIT 1", serial_number)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (trader_item.empty()) {
|
if (trader_item.empty()) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return trader_item.at(0);
|
return trader_item.at(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Trader GetItemBySerialNumber(Database &db, std::string serial_number, uint32 trader_id)
|
static Trader GetItemBySerialNumber(Database &db, std::string serial_number)
|
||||||
{
|
{
|
||||||
Trader e{};
|
Trader e{};
|
||||||
auto sn = Strings::ToUnsignedBigInt(serial_number);
|
auto sn = Strings::ToUnsignedBigInt(serial_number);
|
||||||
const auto trader_item = GetWhere(
|
const auto trader_item = GetWhere(
|
||||||
db,
|
db,
|
||||||
fmt::format("`char_id` = '{}' AND `item_sn` = '{}' LIMIT 1", trader_id, sn)
|
fmt::format("`item_sn` = '{}' LIMIT 1", sn)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (trader_item.empty()) {
|
if (trader_item.empty()) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return trader_item.at(0);
|
return trader_item.at(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int UpdateActiveTransaction(Database &db, uint32 id, bool status)
|
static int UpdateActiveTransaction(Database &db, uint32 id, bool status)
|
||||||
{
|
{
|
||||||
@@ -228,43 +217,8 @@ public:
|
|||||||
delete_ids.push_back(std::to_string(e.id));
|
delete_ids.push_back(std::to_string(e.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delete_ids.empty()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DeleteWhere(db, fmt::format("`id` IN({})", Strings::Implode(",", delete_ids)));
|
return DeleteWhere(db, fmt::format("`id` IN({})", Strings::Implode(",", delete_ids)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static DistinctTraders_Struct GetTraderByInstanceAndSerialnumber(
|
|
||||||
Database &db,
|
|
||||||
uint32 instance_id,
|
|
||||||
const char *serial_number
|
|
||||||
)
|
|
||||||
{
|
|
||||||
DistinctTraders_Struct trader{};
|
|
||||||
|
|
||||||
auto query = fmt::format(
|
|
||||||
"SELECT t.id, t.char_id, c.name "
|
|
||||||
"FROM trader AS t "
|
|
||||||
"JOIN character_data AS c ON c.id = t.char_id "
|
|
||||||
"WHERE t.char_zone_id = 151 AND t.char_zone_instance_id = {} AND t.item_sn = {} LIMIT 1",
|
|
||||||
instance_id,
|
|
||||||
serial_number
|
|
||||||
);
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(query);
|
|
||||||
|
|
||||||
if (results.RowCount() == 0) {
|
|
||||||
return trader;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
std::string name = row[2];
|
|
||||||
trader.trader_id = Strings::ToUnsignedInt(row[1]);
|
|
||||||
trader.trader_name = row[2] ? row[2] : "";
|
|
||||||
|
|
||||||
return trader;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_TRADER_REPOSITORY_H
|
#endif //EQEMU_TRADER_REPOSITORY_H
|
||||||
|
|||||||
+1
-18
@@ -338,11 +338,6 @@ RULE_STRING(World, IPExemptionZones, "", "Comma-delimited list of zones to exclu
|
|||||||
RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to have this be used instead of variables table 'motd' value")
|
RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to have this be used instead of variables table 'motd' value")
|
||||||
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
|
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
|
||||||
RULE_BOOL(World, EnableAutoLogin, false, "Enables or disables auto login of characters, allowing people to log characters in directly from loginserver to ingame")
|
RULE_BOOL(World, EnableAutoLogin, false, "Enables or disables auto login of characters, allowing people to log characters in directly from loginserver to ingame")
|
||||||
RULE_BOOL(World, EnablePVPRegions, true, "Enables or disables PVP Regions automatically setting your PVP flag")
|
|
||||||
RULE_STRING(World, SupportedClients, "", "Comma-delimited list of clients to restrict to. Supported values are Titanium | SoF | SoD | UF | RoF | RoF2. Example: Titanium,RoF2")
|
|
||||||
RULE_STRING(World, CustomFilesKey, "", "Enable if the server requires custom files and sends a key to validate. Empty string to disable. Example: eqcustom_v1")
|
|
||||||
RULE_STRING(World, CustomFilesUrl, "github.com/knervous/eqnexus/releases", "URL to display at character select if client is missing custom files")
|
|
||||||
RULE_INT(World, CustomFilesAdminLevel, 20, "Admin level at which custom file key is not required when CustomFilesKey is specified")
|
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Zone)
|
RULE_CATEGORY(Zone)
|
||||||
@@ -372,7 +367,6 @@ RULE_INT(Zone, FishingChance, 399, "Chance of fishing from zone table vs global
|
|||||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnBots, false, "Set to true to allow cross zone spells (cast/remove) to affect bots")
|
RULE_BOOL(Zone, AllowCrossZoneSpellsOnBots, false, "Set to true to allow cross zone spells (cast/remove) to affect bots")
|
||||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnMercs, false, "Set to true to allow cross zone spells (cast/remove) to affect mercenaries")
|
RULE_BOOL(Zone, AllowCrossZoneSpellsOnMercs, false, "Set to true to allow cross zone spells (cast/remove) to affect mercenaries")
|
||||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets")
|
RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets")
|
||||||
RULE_BOOL(Zone, ZoneShardQuestMenuOnly, false, "Set to true if you only want quests to show the zone shard menu")
|
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Map)
|
RULE_CATEGORY(Map)
|
||||||
@@ -522,8 +516,7 @@ RULE_INT(Spells, HealAmountMessageFilterThreshold, 100, "Lifetaps below this thr
|
|||||||
RULE_BOOL(Spells, SnareOverridesSpeedBonuses, false, "Enabling will allow snares to override any speed bonuses the entity may have. Default: False")
|
RULE_BOOL(Spells, SnareOverridesSpeedBonuses, false, "Enabling will allow snares to override any speed bonuses the entity may have. Default: False")
|
||||||
RULE_INT(Spells, TargetedAOEMaxTargets, 4, "Max number of targets a Targeted AOE spell can cast on. Set to 0 for no limit.")
|
RULE_INT(Spells, TargetedAOEMaxTargets, 4, "Max number of targets a Targeted AOE spell can cast on. Set to 0 for no limit.")
|
||||||
RULE_INT(Spells, PointBlankAOEMaxTargets, 0, "Max number of targets a Point-Blank AOE spell can cast on. Set to 0 for no limit.")
|
RULE_INT(Spells, PointBlankAOEMaxTargets, 0, "Max number of targets a Point-Blank AOE spell can cast on. Set to 0 for no limit.")
|
||||||
RULE_INT(Spells, DefaultAOEMaxTargets, 0, "Max number of targets that an AOE spell which does not meet other descriptions can cast on. Set to 0 for no limit.")
|
RULE_INT(Spells, DefaultAOEMaxTargets, 4, "Max number of targets that an AOE spell which does not meet other descriptions can cast on. Set to 0 for no limit.")
|
||||||
RULE_BOOL(Spells, AllowFocusOnSkillDamageSpells, false, "Allow focus effects 185, 459, and 482 to enhance SkillAttack spell effect 193")
|
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Combat)
|
RULE_CATEGORY(Combat)
|
||||||
@@ -685,8 +678,6 @@ RULE_BOOL(NPC, DisableLastNames, false, "Enable to disable NPC Last Names")
|
|||||||
RULE_BOOL(NPC, NPCIgnoreLevelBasedHasteCaps, false, "Ignores hard coded level based haste caps.")
|
RULE_BOOL(NPC, NPCIgnoreLevelBasedHasteCaps, false, "Ignores hard coded level based haste caps.")
|
||||||
RULE_INT(NPC, NPCHasteCap, 150, "Haste cap for non-v3(over haste) haste")
|
RULE_INT(NPC, NPCHasteCap, 150, "Haste cap for non-v3(over haste) haste")
|
||||||
RULE_INT(NPC, NPCHastev3Cap, 25, "Haste cap for v3(over haste) haste")
|
RULE_INT(NPC, NPCHastev3Cap, 25, "Haste cap for v3(over haste) haste")
|
||||||
RULE_STRING(NPC, ExcludedFaceTargetRaces, "52,72,73,141,233,328,329,372,376,377,378,379,380,381,382,383,404,422,423,424,425,426,428,429,445,449,460,462,463,500,501,502,503,504,505,506,507,508,509,510,511,513,514,515,516,533,534,535,536,537,538,539,540,541,542,543,544,545,546,550,551,552,553,554,555,556,557,567,573,577,586,589,590,591,592,593,595,596,599,601,616,619,621,628,629,630,633,634,635,636,665,683,684,685,691,692,693,694,702,703,705,706,707,710,711,714,720,2250,2254", "Race IDs excluded from facing target when hailed")
|
|
||||||
RULE_BOOL(NPC, ResetUnderworldMobsToSpawn, false, "Reset mobs that are under the world back to spawn point if valid. DEFAULT: False")
|
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Aggro)
|
RULE_CATEGORY(Aggro)
|
||||||
@@ -831,7 +822,6 @@ RULE_REAL(Bazaar, ParcelDeliveryCostMod, 0.20, "Cost of parcel delivery for a ba
|
|||||||
RULE_INT(Bazaar, VoucherDeliveryCost, 200, "Number of vouchers for direct delivery for a bazaar purchase. Default is 200 vouchers. RoF+ Only.")
|
RULE_INT(Bazaar, VoucherDeliveryCost, 200, "Number of vouchers for direct delivery for a bazaar purchase. Default is 200 vouchers. RoF+ Only.")
|
||||||
RULE_BOOL(Bazaar, EnableParcelDelivery, true, "Enable bazaar purchases via parcel delivery. Default is True.")
|
RULE_BOOL(Bazaar, EnableParcelDelivery, true, "Enable bazaar purchases via parcel delivery. Default is True.")
|
||||||
RULE_INT(Bazaar, MaxBuyerInventorySearchResults, 200, "Maximum number of search results when a Buyer searches the global item list. Default is 200. RoF+ Only.")
|
RULE_INT(Bazaar, MaxBuyerInventorySearchResults, 200, "Maximum number of search results when a Buyer searches the global item list. Default is 200. RoF+ Only.")
|
||||||
RULE_BOOL(Bazaar, UseAlternateBazaarSearch, false, "Allows the bazaar search window to search across bazaar shards. Default is false.")
|
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Mail)
|
RULE_CATEGORY(Mail)
|
||||||
@@ -1040,13 +1030,6 @@ RULE_INT(Parcel, ParcelMaxItems, 50, "The maximum number of parcels a player is
|
|||||||
RULE_INT(Parcel, ParcelPruneDelay, 30, "The number of days after which a parcel is deleted. Items are lost!")
|
RULE_INT(Parcel, ParcelPruneDelay, 30, "The number of days after which a parcel is deleted. Items are lost!")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(EvolvingItems)
|
|
||||||
RULE_REAL(EvolvingItems, PercentOfSoloExperience, 0.1, "Percentage of solo experience allocated to evolving items that require experience.")
|
|
||||||
RULE_REAL(EvolvingItems, PercentOfGroupExperience, 0.1, "Percentage of group experience allocated to evolving items that require experience.")
|
|
||||||
RULE_REAL(EvolvingItems, PercentOfRaidExperience, 0.1, "Percentage of solo experience allocated to evolving items that require experience.")
|
|
||||||
RULE_INT(EvolvingItems, DelayUponEquipping, 30000, "Delay in ms before an evolving item will earn rewards after equipping. Default is 30000ms or 30s.")
|
|
||||||
RULE_CATEGORY_END()
|
|
||||||
|
|
||||||
#undef RULE_CATEGORY
|
#undef RULE_CATEGORY
|
||||||
#undef RULE_INT
|
#undef RULE_INT
|
||||||
#undef RULE_REAL
|
#undef RULE_REAL
|
||||||
|
|||||||
+2
-1
@@ -319,6 +319,8 @@
|
|||||||
// player events
|
// player events
|
||||||
#define ServerOP_PlayerEvent 0x5100
|
#define ServerOP_PlayerEvent 0x5100
|
||||||
|
|
||||||
|
#define ServerOP_DataBucketCacheUpdate 0x5200
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CZUpdateType_Character,
|
CZUpdateType_Character,
|
||||||
CZUpdateType_Group,
|
CZUpdateType_Group,
|
||||||
@@ -1943,7 +1945,6 @@ struct ServerOP_GuildMessage_Struct {
|
|||||||
struct TraderMessaging_Struct {
|
struct TraderMessaging_Struct {
|
||||||
uint32 action;
|
uint32 action;
|
||||||
uint32 zone_id;
|
uint32 zone_id;
|
||||||
uint32 instance_id;
|
|
||||||
uint32 trader_id;
|
uint32 trader_id;
|
||||||
uint32 entity_id;
|
uint32 entity_id;
|
||||||
char trader_name[64];
|
char trader_name[64];
|
||||||
|
|||||||
+14
-70
@@ -37,13 +37,11 @@
|
|||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
#include "eqemu_config.h"
|
#include "eqemu_config.h"
|
||||||
#include "data_verification.h"
|
#include "data_verification.h"
|
||||||
#include "evolving_items.h"
|
|
||||||
#include "repositories/criteria/content_filter_criteria.h"
|
#include "repositories/criteria/content_filter_criteria.h"
|
||||||
#include "repositories/account_repository.h"
|
#include "repositories/account_repository.h"
|
||||||
#include "repositories/faction_association_repository.h"
|
#include "repositories/faction_association_repository.h"
|
||||||
#include "repositories/starting_items_repository.h"
|
#include "repositories/starting_items_repository.h"
|
||||||
#include "path_manager.h"
|
#include "path_manager.h"
|
||||||
#include "../zone/client.h"
|
|
||||||
#include "repositories/loottable_repository.h"
|
#include "repositories/loottable_repository.h"
|
||||||
#include "repositories/character_item_recast_repository.h"
|
#include "repositories/character_item_recast_repository.h"
|
||||||
#include "repositories/character_corpses_repository.h"
|
#include "repositories/character_corpses_repository.h"
|
||||||
@@ -647,23 +645,15 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Overloaded: Retrieve character inventory based on character id (zone entry)
|
|
||||||
//bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
|
||||||
bool SharedDatabase::GetInventory(Client *c)
|
|
||||||
{
|
|
||||||
if (!c) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 char_id = c->CharacterID();
|
// Overloaded: Retrieve character inventory based on character id (zone entry)
|
||||||
EQ::InventoryProfile &inv = c->GetInv();
|
bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||||
|
{
|
||||||
|
if (!char_id || !inv)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Retrieve character inventory
|
// Retrieve character inventory
|
||||||
auto results = InventoryRepository::GetWhere(*this, fmt::format("`charid` = '{}' ORDER BY `slotid`", char_id));
|
auto results = InventoryRepository::GetWhere(*this, fmt::format("`charid` = '{}' ORDER BY `slotid`;", char_id));
|
||||||
auto e_results = CharacterEvolvingItemsRepository::GetWhere(
|
|
||||||
*this, fmt::format("`character_id` = '{}' AND `deleted_at` IS NULL", char_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (results.empty()) {
|
if (results.empty()) {
|
||||||
LogError("Error loading inventory for char_id {} from the database.", char_id);
|
LogError("Error loading inventory for char_id {} from the database.", char_id);
|
||||||
return false;
|
return false;
|
||||||
@@ -677,8 +667,8 @@ bool SharedDatabase::GetInventory(Client *c)
|
|||||||
|
|
||||||
const auto timestamps = GetItemRecastTimestamps(char_id);
|
const auto timestamps = GetItemRecastTimestamps(char_id);
|
||||||
auto cv_conflict = false;
|
auto cv_conflict = false;
|
||||||
const auto pmask = inv.GetLookup()->PossessionsBitmask;
|
const auto pmask = inv->GetLookup()->PossessionsBitmask;
|
||||||
const auto bank_size = inv.GetLookup()->InventoryTypeSize.Bank;
|
const auto bank_size = inv->GetLookup()->InventoryTypeSize.Bank;
|
||||||
|
|
||||||
std::vector<InventoryRepository::Inventory> queue{};
|
std::vector<InventoryRepository::Inventory> queue{};
|
||||||
for (auto &row: results) {
|
for (auto &row: results) {
|
||||||
@@ -795,55 +785,9 @@ bool SharedDatabase::GetInventory(Client *c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->EvolvingItem) {
|
|
||||||
if (slot_id >= EQ::invslot::EQUIPMENT_BEGIN && slot_id <= EQ::invslot::EQUIPMENT_END) {
|
|
||||||
inst->SetEvolveEquipped(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto t = std::ranges::find_if(
|
|
||||||
e_results.cbegin(),
|
|
||||||
e_results.cend(),
|
|
||||||
[&](const CharacterEvolvingItemsRepository::CharacterEvolvingItems &x) {
|
|
||||||
return x.item_id == item_id;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (t == std::end(e_results)) {
|
|
||||||
auto e = CharacterEvolvingItemsRepository::NewEntity();
|
|
||||||
|
|
||||||
e.character_id = char_id;
|
|
||||||
e.item_id = item_id;
|
|
||||||
e.equipped = inst->GetEvolveEquipped();
|
|
||||||
e.final_item_id = evolving_items_manager.GetFinalItemID(*inst);
|
|
||||||
|
|
||||||
auto r = CharacterEvolvingItemsRepository::InsertOne(*this, e);
|
|
||||||
e.id = r.id;
|
|
||||||
e_results.push_back(e);
|
|
||||||
|
|
||||||
inst->SetEvolveUniqueID(e.id);
|
|
||||||
inst->SetEvolveCharID(e.character_id);
|
|
||||||
inst->SetEvolveItemID(e.item_id);
|
|
||||||
inst->SetEvolveActivated(e.activated);
|
|
||||||
inst->SetEvolveEquipped(e.equipped);
|
|
||||||
inst->SetEvolveCurrentAmount(e.current_amount);
|
|
||||||
inst->CalculateEvolveProgression();
|
|
||||||
inst->SetEvolveFinalItemID(e.final_item_id);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
inst->SetEvolveUniqueID(t->id);
|
|
||||||
inst->SetEvolveCharID(t->character_id);
|
|
||||||
inst->SetEvolveItemID(t->item_id);
|
|
||||||
inst->SetEvolveActivated(t->activated);
|
|
||||||
inst->SetEvolveEquipped(t->equipped);
|
|
||||||
inst->SetEvolveCurrentAmount(t->current_amount);
|
|
||||||
inst->CalculateEvolveProgression();
|
|
||||||
inst->SetEvolveFinalItemID(t->final_item_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int16 put_slot_id;
|
int16 put_slot_id;
|
||||||
if (slot_id >= 8000 && slot_id <= 8999) {
|
if (slot_id >= 8000 && slot_id <= 8999) {
|
||||||
put_slot_id = inv.PushCursor(*inst);
|
put_slot_id = inv->PushCursor(*inst);
|
||||||
}
|
}
|
||||||
else if (slot_id >= 3111 && slot_id <= 3179) {
|
else if (slot_id >= 3111 && slot_id <= 3179) {
|
||||||
// Admins: please report any occurrences of this error
|
// Admins: please report any occurrences of this error
|
||||||
@@ -853,10 +797,10 @@ bool SharedDatabase::GetInventory(Client *c)
|
|||||||
item_id,
|
item_id,
|
||||||
slot_id
|
slot_id
|
||||||
);
|
);
|
||||||
put_slot_id = inv.PushCursor(*inst);
|
put_slot_id = inv->PushCursor(*inst);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
put_slot_id = inv.PutItem(slot_id, *inst);
|
put_slot_id = inv->PutItem(slot_id, *inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
row.guid = inst->GetSerialNumber();
|
row.guid = inst->GetSerialNumber();
|
||||||
@@ -881,8 +825,8 @@ bool SharedDatabase::GetInventory(Client *c)
|
|||||||
"ClientVersion/Expansion conflict during inventory load at zone entry for [{}] (charid: [{}], inver: [{}], gmi: [{}])",
|
"ClientVersion/Expansion conflict during inventory load at zone entry for [{}] (charid: [{}], inver: [{}], gmi: [{}])",
|
||||||
char_name,
|
char_name,
|
||||||
char_id,
|
char_id,
|
||||||
EQ::versions::MobVersionName(inv.InventoryVersion()),
|
EQ::versions::MobVersionName(inv->InventoryVersion()),
|
||||||
(inv.GMInventory() ? "true" : "false")
|
(inv->GMInventory() ? "true" : "false")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -893,7 +837,7 @@ bool SharedDatabase::GetInventory(Client *c)
|
|||||||
EQ::ItemInstance::ClearGUIDMap();
|
EQ::ItemInstance::ClearGUIDMap();
|
||||||
|
|
||||||
// Retrieve shared inventory
|
// Retrieve shared inventory
|
||||||
return GetSharedBank(char_id, &inv, true);
|
return GetSharedBank(char_id, inv, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overloaded: Retrieve character inventory based on account_id and character name (char select)
|
// Overloaded: Retrieve character inventory based on account_id and character name (char select)
|
||||||
|
|||||||
+1
-3
@@ -28,8 +28,6 @@
|
|||||||
#include "fixed_memory_variable_hash_set.h"
|
#include "fixed_memory_variable_hash_set.h"
|
||||||
#include "say_link.h"
|
#include "say_link.h"
|
||||||
#include "repositories/command_subsettings_repository.h"
|
#include "repositories/command_subsettings_repository.h"
|
||||||
#include "repositories/items_evolving_details_repository.h"
|
|
||||||
#include "../common/repositories/character_evolving_items_repository.h"
|
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -105,7 +103,7 @@ public:
|
|||||||
bool GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is_charid);
|
bool GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is_charid);
|
||||||
int32 GetSharedPlatinum(uint32 account_id);
|
int32 GetSharedPlatinum(uint32 account_id);
|
||||||
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
|
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
|
||||||
bool GetInventory(Client* c);
|
bool GetInventory(uint32 char_id, EQ::InventoryProfile *inv);
|
||||||
bool GetInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv); // deprecated
|
bool GetInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv); // deprecated
|
||||||
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
|
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
|
||||||
uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type);
|
uint32 GetItemRecastTimestamp(uint32 char_id, uint32 recast_type);
|
||||||
|
|||||||
+3
-4
@@ -83,8 +83,7 @@ struct ActivityInformation {
|
|||||||
if (zone_ids.empty()) {
|
if (zone_ids.empty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool found_zone = std::any_of(zone_ids.begin(), zone_ids.end(),
|
bool found_zone = std::find(zone_ids.begin(), zone_ids.end(), zone_id) != zone_ids.end();
|
||||||
[zone_id](int id) { return id <= 0 || id == zone_id; });
|
|
||||||
|
|
||||||
return found_zone && (zone_version == version || zone_version == -1);
|
return found_zone && (zone_version == version || zone_version == -1);
|
||||||
}
|
}
|
||||||
@@ -101,7 +100,7 @@ struct ActivityInformation {
|
|||||||
out.WriteInt32(activity_type == TaskActivityType::GiveCash ? 1 : goal_count);
|
out.WriteInt32(activity_type == TaskActivityType::GiveCash ? 1 : goal_count);
|
||||||
out.WriteLengthString(skill_list); // used in SkillOn objective type string, "-1" for none
|
out.WriteLengthString(skill_list); // used in SkillOn objective type string, "-1" for none
|
||||||
out.WriteLengthString(spell_list); // used in CastOn objective type string, "0" for none
|
out.WriteLengthString(spell_list); // used in CastOn objective type string, "0" for none
|
||||||
out.WriteString(zones); // used in ui zone columns and task select "begins in" (may have multiple, invalid id for "Unknown Zone", empty for "ALL")
|
out.WriteString(zones); // used in objective zone column and task select "begins in" (may have multiple, "0" for "unknown zone", empty for "ALL")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -115,7 +114,7 @@ struct ActivityInformation {
|
|||||||
out.WriteString(description_override);
|
out.WriteString(description_override);
|
||||||
|
|
||||||
if (client_version >= EQ::versions::ClientVersion::RoF) {
|
if (client_version >= EQ::versions::ClientVersion::RoF) {
|
||||||
out.WriteString(zones); // target zone version internal id (unused client side)
|
out.WriteString(zones); // serialized again after description (seems unused)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,9 +86,6 @@ struct BenchTimer
|
|||||||
void reset() { start_time = clock::now(); }
|
void reset() { start_time = clock::now(); }
|
||||||
// this is seconds
|
// this is seconds
|
||||||
double elapsed() { return std::chrono::duration<double> (clock::now() - start_time).count(); }
|
double elapsed() { return std::chrono::duration<double> (clock::now() - start_time).count(); }
|
||||||
std::chrono::milliseconds::rep elapsedMilliseconds() { return std::chrono::duration_cast<std::chrono::milliseconds>(clock::now() - start_time).count(); }
|
|
||||||
std::chrono::microseconds::rep elapsedMicroseconds() { return std::chrono::duration_cast<std::chrono::microseconds>(clock::now() - start_time).count(); }
|
|
||||||
std::chrono::nanoseconds::rep elapsedNanoseconds() { return std::chrono::duration_cast<std::chrono::nanoseconds>(clock::now() - start_time).count(); }
|
|
||||||
private:
|
private:
|
||||||
std::chrono::time_point<std::chrono::high_resolution_clock> start_time;
|
std::chrono::time_point<std::chrono::high_resolution_clock> start_time;
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
// Build variables
|
// Build variables
|
||||||
// these get injected during the build pipeline
|
// these get injected during the build pipeline
|
||||||
#define CURRENT_VERSION "22.61.0-dev" // always append -dev to the current version for custom-builds
|
#define CURRENT_VERSION "22.56.3-dev" // always append -dev to the current version for custom-builds
|
||||||
#define LOGIN_VERSION "0.8.0"
|
#define LOGIN_VERSION "0.8.0"
|
||||||
#define COMPILE_DATE __DATE__
|
#define COMPILE_DATE __DATE__
|
||||||
#define COMPILE_TIME __TIME__
|
#define COMPILE_TIME __TIME__
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CURRENT_BINARY_DATABASE_VERSION 9293
|
#define CURRENT_BINARY_DATABASE_VERSION 9284
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9045
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9045
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -676,6 +676,12 @@ int ZoneStore::GetZoneNPCMaximumAggroDistance(uint32 zone_id, int version)
|
|||||||
return z ? z->npc_max_aggro_dist : DEFAULT_ZONE_MAX_AGGRO_DISTANCE;
|
return z ? z->npc_max_aggro_dist : DEFAULT_ZONE_MAX_AGGRO_DISTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 ZoneStore::GetZoneMaximumMovementUpdateRange(uint32 zone_id, int version)
|
||||||
|
{
|
||||||
|
const auto& z = GetZoneVersionWithFallback(zone_id, version);
|
||||||
|
return z ? z->max_movement_update_range : DEFAULT_ZONE_MAX_MOVEMENT_UPDATE_RANGE;
|
||||||
|
}
|
||||||
|
|
||||||
int8 ZoneStore::GetZoneMinimumExpansion(uint32 zone_id, int version)
|
int8 ZoneStore::GetZoneMinimumExpansion(uint32 zone_id, int version)
|
||||||
{
|
{
|
||||||
const auto& z = GetZoneVersionWithFallback(zone_id, version);
|
const auto& z = GetZoneVersionWithFallback(zone_id, version);
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public:
|
|||||||
int GetZoneFastRegenMana(uint32 zone_id, int version = 0);
|
int GetZoneFastRegenMana(uint32 zone_id, int version = 0);
|
||||||
int GetZoneFastRegenEndurance(uint32 zone_id, int version = 0);
|
int GetZoneFastRegenEndurance(uint32 zone_id, int version = 0);
|
||||||
int GetZoneNPCMaximumAggroDistance(uint32 zone_id, int version = 0);
|
int GetZoneNPCMaximumAggroDistance(uint32 zone_id, int version = 0);
|
||||||
|
uint32 GetZoneMaximumMovementUpdateRange(uint32 zone_id, int version = 0);
|
||||||
int8 GetZoneMinimumExpansion(uint32 zone_id, int version = 0);
|
int8 GetZoneMinimumExpansion(uint32 zone_id, int version = 0);
|
||||||
int8 GetZoneMaximumExpansion(uint32 zone_id, int version = 0);
|
int8 GetZoneMaximumExpansion(uint32 zone_id, int version = 0);
|
||||||
const std::string GetZoneContentFlags(uint32 zone_id, int version = 0);
|
const std::string GetZoneContentFlags(uint32 zone_id, int version = 0);
|
||||||
|
|||||||
@@ -251,6 +251,4 @@ private:
|
|||||||
scalar m_value;
|
scalar m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
using ref = reference;
|
|
||||||
|
|
||||||
} // namespace perlbind
|
} // namespace perlbind
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ struct pusher
|
|||||||
++m_pushed;
|
++m_pushed;
|
||||||
}
|
}
|
||||||
void push(const std::string& value) { mPUSHp(value.c_str(), value.size()); ++m_pushed; }
|
void push(const std::string& value) { mPUSHp(value.c_str(), value.size()); ++m_pushed; }
|
||||||
void push(scalar value) { mPUSHs(value.release()); ++m_pushed; }
|
void push(scalar value) { mPUSHs(value.release()); ++m_pushed; };
|
||||||
void push(reference value) { mPUSHs(value.release()); ++m_pushed; }
|
void push(reference value) { mPUSHs(value.release()); ++m_pushed; };
|
||||||
|
|
||||||
void push(array value)
|
void push(array value)
|
||||||
{
|
{
|
||||||
@@ -38,8 +38,7 @@ struct pusher
|
|||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
// mortalizes one reference to array element to avoid copying
|
// mortalizes one reference to array element to avoid copying
|
||||||
SV** sv = av_fetch(static_cast<AV*>(value), i, true);
|
PUSHs(sv_2mortal(SvREFCNT_inc(value[i].sv())));
|
||||||
mPUSHs(SvREFCNT_inc(*sv));
|
|
||||||
}
|
}
|
||||||
m_pushed += count;
|
m_pushed += count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ struct read_as<hash>
|
|||||||
static bool check(PerlInterpreter* my_perl, int i, int ax, int items)
|
static bool check(PerlInterpreter* my_perl, int i, int ax, int items)
|
||||||
{
|
{
|
||||||
int remaining = items - i;
|
int remaining = items - i;
|
||||||
return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) < SVt_PVAV;
|
return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) == SVt_PV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hash get(PerlInterpreter* my_perl, int i, int ax, int items)
|
static hash get(PerlInterpreter* my_perl, int i, int ax, int items)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
constexpr int perlbind_version_major = 1;
|
constexpr int perlbind_version_major = 1;
|
||||||
constexpr int perlbind_version_minor = 1;
|
constexpr int perlbind_version_minor = 0;
|
||||||
constexpr int perlbind_version_patch = 0;
|
constexpr int perlbind_version_patch = 0;
|
||||||
|
|
||||||
constexpr int perlbind_version()
|
constexpr int perlbind_version()
|
||||||
|
|||||||
@@ -7,79 +7,6 @@ extern bool run_server;
|
|||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/misc.h"
|
#include "../common/misc.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
#include "../common/file.h"
|
|
||||||
|
|
||||||
void CheckTitaniumOpcodeFile(const std::string &path) {
|
|
||||||
if (File::Exists(path)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto f = fopen(path.c_str(), "w");
|
|
||||||
if (f) {
|
|
||||||
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
|
||||||
fprintf(f, "OP_SessionReady=0x0001\n");
|
|
||||||
fprintf(f, "OP_Login=0x0002\n");
|
|
||||||
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
|
||||||
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
|
||||||
fprintf(f, "OP_PlayEverquestResponse=0x0021\n");
|
|
||||||
fprintf(f, "OP_ChatMessage=0x0016\n");
|
|
||||||
fprintf(f, "OP_LoginAccepted=0x0017\n");
|
|
||||||
fprintf(f, "OP_ServerListResponse=0x0018\n");
|
|
||||||
fprintf(f, "OP_Poll=0x0029\n");
|
|
||||||
fprintf(f, "OP_EnterChat=0x000f\n");
|
|
||||||
fprintf(f, "OP_PollResponse=0x0011\n");
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckSoDOpcodeFile(const std::string& path) {
|
|
||||||
if (File::Exists(path)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto f = fopen(path.c_str(), "w");
|
|
||||||
if (f) {
|
|
||||||
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
|
||||||
fprintf(f, "OP_SessionReady=0x0001\n");
|
|
||||||
fprintf(f, "OP_Login=0x0002\n");
|
|
||||||
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
|
||||||
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
|
||||||
fprintf(f, "OP_PlayEverquestResponse=0x0022\n");
|
|
||||||
fprintf(f, "OP_ChatMessage=0x0017\n");
|
|
||||||
fprintf(f, "OP_LoginAccepted=0x0018\n");
|
|
||||||
fprintf(f, "OP_ServerListResponse=0x0019\n");
|
|
||||||
fprintf(f, "OP_Poll=0x0029\n");
|
|
||||||
fprintf(f, "OP_LoginExpansionPacketData=0x0031\n");
|
|
||||||
fprintf(f, "OP_EnterChat=0x000f\n");
|
|
||||||
fprintf(f, "OP_PollResponse=0x0011\n");
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckLarionOpcodeFile(const std::string& path) {
|
|
||||||
if (File::Exists(path)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto f = fopen(path.c_str(), "w");
|
|
||||||
if (f) {
|
|
||||||
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
|
||||||
fprintf(f, "OP_SessionReady=0x0001\n");
|
|
||||||
fprintf(f, "OP_Login=0x0002\n");
|
|
||||||
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
|
||||||
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
|
||||||
fprintf(f, "OP_PlayEverquestResponse=0x0022\n");
|
|
||||||
fprintf(f, "OP_ChatMessage=0x0017\n");
|
|
||||||
fprintf(f, "OP_LoginAccepted=0x0018\n");
|
|
||||||
fprintf(f, "OP_ServerListResponse=0x0019\n");
|
|
||||||
fprintf(f, "OP_Poll=0x0029\n");
|
|
||||||
fprintf(f, "OP_EnterChat=0x000f\n");
|
|
||||||
fprintf(f, "OP_PollResponse=0x0011\n");
|
|
||||||
fprintf(f, "OP_SystemFingerprint=0x0016\n");
|
|
||||||
fprintf(f, "OP_ExpansionList=0x0030\n");
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientManager::ClientManager()
|
ClientManager::ClientManager()
|
||||||
{
|
{
|
||||||
@@ -92,12 +19,14 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
std::string opcodes_path = fmt::format(
|
std::string opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetOpcodePath(),
|
path.GetServerPath(),
|
||||||
|
server.config.GetVariableString(
|
||||||
|
"client_configuration",
|
||||||
|
"titanium_opcodes",
|
||||||
"login_opcodes.conf"
|
"login_opcodes.conf"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
CheckTitaniumOpcodeFile(opcodes_path);
|
|
||||||
|
|
||||||
if (!titanium_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!titanium_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for Titanium file [{0}]",
|
"ClientManager fatal error: couldn't load opcodes for Titanium file [{0}]",
|
||||||
@@ -129,12 +58,14 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetOpcodePath(),
|
path.GetServerPath(),
|
||||||
"login_opcodes_sod.conf"
|
server.config.GetVariableString(
|
||||||
|
"client_configuration",
|
||||||
|
"sod_opcodes",
|
||||||
|
"login_opcodes.conf"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
CheckSoDOpcodeFile(opcodes_path);
|
|
||||||
|
|
||||||
if (!sod_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!sod_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for SoD file {0}",
|
"ClientManager fatal error: couldn't load opcodes for SoD file {0}",
|
||||||
@@ -167,12 +98,14 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetOpcodePath(),
|
path.GetServerPath(),
|
||||||
"login_opcodes_larion.conf"
|
server.config.GetVariableString(
|
||||||
|
"client_configuration",
|
||||||
|
"larion_opcodes",
|
||||||
|
"login_opcodes.conf"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
CheckLarionOpcodeFile(opcodes_path);
|
|
||||||
|
|
||||||
if (!larion_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!larion_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for Larion file [{0}]",
|
"ClientManager fatal error: couldn't load opcodes for Larion file [{0}]",
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ WorldServer::WorldServer(std::shared_ptr<EQ::Net::ServertalkServerConnection> wo
|
|||||||
ServerOP_LSAccountUpdate,
|
ServerOP_LSAccountUpdate,
|
||||||
std::bind(&WorldServer::ProcessLSAccountUpdate, this, std::placeholders::_1, std::placeholders::_2)
|
std::bind(&WorldServer::ProcessLSAccountUpdate, this, std::placeholders::_1, std::placeholders::_2)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
m_keepalive = std::make_unique<EQ::Timer>(
|
||||||
|
1000,
|
||||||
|
true,
|
||||||
|
std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldServer::~WorldServer() = default;
|
WorldServer::~WorldServer() = default;
|
||||||
@@ -1301,6 +1307,12 @@ const std::string &WorldServer::GetVersion() const
|
|||||||
return m_version;
|
return m_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldServer::OnKeepAlive(EQ::Timer *t)
|
||||||
|
{
|
||||||
|
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||||
|
m_connection->SendPacket(&pack);
|
||||||
|
}
|
||||||
|
|
||||||
void WorldServer::FormatWorldServerName(char *name, int8 server_list_type)
|
void WorldServer::FormatWorldServerName(char *name, int8 server_list_type)
|
||||||
{
|
{
|
||||||
std::string server_long_name = name;
|
std::string server_long_name = name;
|
||||||
|
|||||||
@@ -187,6 +187,13 @@ private:
|
|||||||
bool m_is_server_logged_in;
|
bool m_is_server_logged_in;
|
||||||
bool m_is_server_trusted;
|
bool m_is_server_trusted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keepalive
|
||||||
|
* @param t
|
||||||
|
*/
|
||||||
|
void OnKeepAlive(EQ::Timer *t);
|
||||||
|
std::unique_ptr<EQ::Timer> m_keepalive;
|
||||||
|
|
||||||
static void FormatWorldServerName(char *name, int8 server_list_type);
|
static void FormatWorldServerName(char *name, int8 server_list_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eqemu-server",
|
"name": "eqemu-server",
|
||||||
"version": "22.61.0",
|
"version": "22.56.3",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/EQEmu/Server.git"
|
"url": "https://github.com/EQEmu/Server.git"
|
||||||
|
|||||||
@@ -33,14 +33,12 @@
|
|||||||
#include "../common/zone_store.h"
|
#include "../common/zone_store.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
#include "../common/evolving_items.h"
|
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PathManager path;
|
PathManager path;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
|||||||
@@ -261,7 +261,6 @@ OP_ItemPacket=0x368e
|
|||||||
OP_ItemLinkResponse=0x70c0
|
OP_ItemLinkResponse=0x70c0
|
||||||
OP_ItemLinkClick=0x4cef
|
OP_ItemLinkClick=0x4cef
|
||||||
OP_ItemPreview=0x6b5c
|
OP_ItemPreview=0x6b5c
|
||||||
OP_ItemPreviewRequest=0x7f80
|
|
||||||
OP_NewSpawn=0x6097
|
OP_NewSpawn=0x6097
|
||||||
OP_Track=0x17e5
|
OP_Track=0x17e5
|
||||||
OP_TrackTarget=0x695e
|
OP_TrackTarget=0x695e
|
||||||
@@ -729,18 +728,3 @@ OP_InitialHPUpdate=0x0000
|
|||||||
#aura related
|
#aura related
|
||||||
OP_UpdateAura=0x1456
|
OP_UpdateAura=0x1456
|
||||||
OP_RemoveTrap=0x71da
|
OP_RemoveTrap=0x71da
|
||||||
|
|
||||||
OP_PickZoneWindow=0x72d8
|
|
||||||
OP_PickZone=0xaaba
|
|
||||||
|
|
||||||
#evolve item related
|
|
||||||
OP_EvolveItem=0x7cfb
|
|
||||||
|
|
||||||
# This is bugged in ROF2
|
|
||||||
# OP_InvokeChangePetNameImmediate is supposed to write DisablePetNameChangeReminder=0 to reset the 'nag reminder'
|
|
||||||
# It actually sets DisableNameChangeReminder=0 (player name change nag reminder). Additionally, clicking the
|
|
||||||
# 'Don't remind me later' button sets DisableNameChangeReminder=1
|
|
||||||
# This can be fixed with a client patch.
|
|
||||||
OP_InvokeChangePetNameImmediate=0x046d
|
|
||||||
OP_InvokeChangePetName=0x4506
|
|
||||||
OP_ChangePetName=0x5dab
|
|
||||||
@@ -10,7 +10,7 @@ require (
|
|||||||
require (
|
require (
|
||||||
github.com/golang/protobuf v1.3.2 // indirect
|
github.com/golang/protobuf v1.3.2 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
golang.org/x/crypto v0.31.0 // indirect
|
golang.org/x/crypto v0.21.0 // indirect
|
||||||
golang.org/x/net v0.23.0 // indirect
|
golang.org/x/net v0.23.0 // indirect
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
google.golang.org/appengine v1.6.7 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
|
|||||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
||||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
||||||
|
|||||||
@@ -1556,7 +1556,7 @@ RoF2 Built May 10 2013 23:30:08
|
|||||||
0x10e0
|
0x10e0
|
||||||
0x7452
|
0x7452
|
||||||
0x6d9f
|
0x6d9f
|
||||||
0x7f80 OP_ItemPreviewRequest
|
0x7f80
|
||||||
0xb07f
|
0xb07f
|
||||||
0x6b5c OP_ItemPreview
|
0x6b5c OP_ItemPreview
|
||||||
0x02b4
|
0x02b4
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ SET(world_headers
|
|||||||
login_server.h
|
login_server.h
|
||||||
login_server_list.h
|
login_server_list.h
|
||||||
queryserv.h
|
queryserv.h
|
||||||
|
race_combos.h
|
||||||
shared_task_manager.h
|
shared_task_manager.h
|
||||||
shared_task_world_messaging.h
|
shared_task_world_messaging.h
|
||||||
sof_char_create_data.h
|
sof_char_create_data.h
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ void WorldserverCLI::DatabaseDump(int argc, char **argv, argh::parser &cmd, std:
|
|||||||
"--compress"
|
"--compress"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EQEmuCommand::ValidateCmdInput(arguments, options, cmd, argc, argv);
|
||||||
|
|
||||||
if (cmd[{"-h", "--help"}]) {
|
if (cmd[{"-h", "--help"}]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EQEmuCommand::ValidateCmdInput(arguments, options, cmd, argc, argv);
|
|
||||||
|
|
||||||
auto s = new DatabaseDumpService();
|
auto s = new DatabaseDumpService();
|
||||||
bool dump_all = cmd[{"-a", "--all"}];
|
bool dump_all = cmd[{"-a", "--all"}];
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,12 @@ void WorldserverCLI::DatabaseUpdates(int argc, char **argv, argh::parser &cmd, s
|
|||||||
{
|
{
|
||||||
description = "Runs database updates manually";
|
description = "Runs database updates manually";
|
||||||
|
|
||||||
std::vector<std::string> options = {
|
|
||||||
"--skip-backup",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (cmd[{"-h", "--help"}]) {
|
if (cmd[{"-h", "--help"}]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseUpdate update;
|
DatabaseUpdate update;
|
||||||
update.SetDatabase(&database)
|
update.SetDatabase(&database)
|
||||||
->SetSkipBackup(cmd[{"--skip-backup"}] )
|
|
||||||
->SetContentDatabase(&content_db)
|
->SetContentDatabase(&content_db)
|
||||||
->CheckDbUpdates();
|
->CheckDbUpdates();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#include <cereal/archives/json.hpp>
|
#include <cereal/archives/json.hpp>
|
||||||
#include <cereal/types/vector.hpp>
|
#include <cereal/types/vector.hpp>
|
||||||
#include <iomanip>
|
|
||||||
#include "../../common/events/player_events.h"
|
#include "../../common/events/player_events.h"
|
||||||
#include "../../common/memory/ksm.hpp"
|
|
||||||
|
|
||||||
void WorldserverCLI::TestCommand(int argc, char **argv, argh::parser &cmd, std::string &description)
|
void WorldserverCLI::TestCommand(int argc, char **argv, argh::parser &cmd, std::string &description)
|
||||||
{
|
{
|
||||||
@@ -12,21 +10,5 @@ void WorldserverCLI::TestCommand(int argc, char **argv, argh::parser &cmd, std::
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* start_marker = KSM::MarkHeapStart();
|
|
||||||
std::cout << "Start marker: " << start_marker << "\n";
|
|
||||||
|
|
||||||
std::vector<std::string> vec = {};
|
|
||||||
for (int i = 0; i < 100000; i++) {
|
|
||||||
vec.push_back("Some random string");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Measure allocated memory size
|
|
||||||
size_t allocated_size = KSM::MeasureHeapUsage(start_marker);
|
|
||||||
// Convert to MB as a float and output with precision
|
|
||||||
double allocated_size_mb = static_cast<double>(allocated_size) / (1024 * 1024);
|
|
||||||
std::cout << std::fixed << std::setprecision(3)
|
|
||||||
<< "Allocated size: " << allocated_size_mb << " MB\n";
|
|
||||||
|
|
||||||
// Mark memory for KSM
|
|
||||||
KSM::MarkMemoryForKSM(start_marker, allocated_size);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+312
-287
@@ -47,6 +47,7 @@
|
|||||||
#include "clientlist.h"
|
#include "clientlist.h"
|
||||||
#include "wguild_mgr.h"
|
#include "wguild_mgr.h"
|
||||||
#include "sof_char_create_data.h"
|
#include "sof_char_create_data.h"
|
||||||
|
#include "race_combos.h"
|
||||||
#include "../common/zone_store.h"
|
#include "../common/zone_store.h"
|
||||||
#include "../common/repositories/account_repository.h"
|
#include "../common/repositories/account_repository.h"
|
||||||
#include "../common/repositories/player_event_logs_repository.h"
|
#include "../common/repositories/player_event_logs_repository.h"
|
||||||
@@ -85,8 +86,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<RaceClassAllocation> character_create_allocations;
|
std::vector<CharCreatePointAllocation> character_create_allocations;
|
||||||
std::vector<RaceClassCombos> character_create_race_class_combos;
|
std::vector<CharCreateCombination> character_create_race_class_combos;
|
||||||
|
|
||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
extern LoginServerList loginserverlist;
|
extern LoginServerList loginserverlist;
|
||||||
@@ -526,39 +527,10 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
|||||||
SendEnterWorld(cle->name());
|
SendEnterWorld(cle->name());
|
||||||
SendPostEnterWorld();
|
SendPostEnterWorld();
|
||||||
if (!is_player_zoning) {
|
if (!is_player_zoning) {
|
||||||
const auto supported_clients = RuleS(World, SupportedClients);
|
|
||||||
bool skip_char_info = false;
|
|
||||||
if (!supported_clients.empty()) {
|
|
||||||
const std::string& name = EQ::versions::ClientVersionName(m_ClientVersion);
|
|
||||||
const auto& clients = Strings::Split(supported_clients, ",");
|
|
||||||
if (std::find(clients.begin(), clients.end(), name) == clients.end()) {
|
|
||||||
SendUnsupportedClientPacket(
|
|
||||||
fmt::format(
|
|
||||||
"Client Not In Supported List [{}]",
|
|
||||||
supported_clients
|
|
||||||
)
|
|
||||||
);
|
|
||||||
skip_char_info = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const auto& custom_files_key = RuleS(World, CustomFilesKey);
|
|
||||||
if (!skip_char_info && !custom_files_key.empty() && cle->Admin() < RuleI(World, CustomFilesAdminLevel)) {
|
|
||||||
// Modified clients can utilize this unused block in login_info to send custom payloads on login
|
|
||||||
// which indicates they are using custom client files with the correct version, based on key payload.
|
|
||||||
const auto client_key = std::string(reinterpret_cast<char*>(login_info->unknown064));
|
|
||||||
if (custom_files_key != client_key) {
|
|
||||||
std::string message = fmt::format("Missing Files [{}]", RuleS(World, CustomFilesUrl) );
|
|
||||||
SendUnsupportedClientPacket(message);
|
|
||||||
skip_char_info = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!skip_char_info) {
|
|
||||||
SendExpansionInfo();
|
SendExpansionInfo();
|
||||||
SendCharInfo();
|
SendCharInfo();
|
||||||
database.LoginIP(cle->AccountID(), long2ip(GetIP()));
|
database.LoginIP(cle->AccountID(), long2ip(GetIP()));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
cle->SetIP(GetIP());
|
cle->SetIP(GetIP());
|
||||||
return true;
|
return true;
|
||||||
@@ -1671,229 +1643,6 @@ void Client::SendApproveWorld()
|
|||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
|
||||||
{
|
|
||||||
PlayerProfile_Struct pp;
|
|
||||||
EQ::InventoryProfile inv;
|
|
||||||
|
|
||||||
pp.SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(EQ::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit)));
|
|
||||||
inv.SetInventoryVersion(EQ::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit));
|
|
||||||
inv.SetGMInventory(false); // character cannot have gm flag at this point
|
|
||||||
|
|
||||||
time_t bday = time(nullptr);
|
|
||||||
in_addr in;
|
|
||||||
|
|
||||||
const uint32 stats_sum = (
|
|
||||||
cc->AGI +
|
|
||||||
cc->CHA +
|
|
||||||
cc->DEX +
|
|
||||||
cc->INT +
|
|
||||||
cc->STA +
|
|
||||||
cc->STR +
|
|
||||||
cc->WIS
|
|
||||||
);
|
|
||||||
|
|
||||||
in.s_addr = GetIP();
|
|
||||||
|
|
||||||
LogInfo(
|
|
||||||
"Character creation request from [{}] LS [{}] [{}] [{}]",
|
|
||||||
GetCLE()->LSName(),
|
|
||||||
GetCLE()->LSID(),
|
|
||||||
inet_ntoa(in),
|
|
||||||
GetPort()
|
|
||||||
);
|
|
||||||
LogInfo("Name [{}]", name);
|
|
||||||
LogInfo(
|
|
||||||
"race [{}] class [{}] gender [{}] deity [{}] start_zone [{}] tutorial [{}]",
|
|
||||||
cc->race,
|
|
||||||
cc->class_,
|
|
||||||
cc->gender,
|
|
||||||
cc->deity,
|
|
||||||
cc->start_zone,
|
|
||||||
cc->tutorial ? "true" : "false"
|
|
||||||
);
|
|
||||||
LogInfo(
|
|
||||||
"AGI [{}] CHA [{}] DEX [{}] INT [{}] STA [{}] STR [{}] WIS [{}] Total [{}]",
|
|
||||||
cc->AGI,
|
|
||||||
cc->CHA,
|
|
||||||
cc->DEX,
|
|
||||||
cc->INT,
|
|
||||||
cc->STA,
|
|
||||||
cc->STR,
|
|
||||||
cc->WIS,
|
|
||||||
stats_sum
|
|
||||||
);
|
|
||||||
LogInfo("Face [{}] Eye Colors [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
|
|
||||||
LogInfo("Hair [{}] Hair Color [{}]", cc->hairstyle, cc->haircolor);
|
|
||||||
LogInfo("Beard [{}] Beard Color [{}]", cc->beard, cc->beardcolor);
|
|
||||||
|
|
||||||
/* Validate the char creation struct */
|
|
||||||
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
|
|
||||||
if (!CheckCharCreateInfoSoF(cc)) {
|
|
||||||
LogInfo("CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!CheckCharCreateInfoTitanium(cc)) {
|
|
||||||
LogInfo("CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert incoming cc_s to the new PlayerProfile_Struct */
|
|
||||||
memset(&pp, 0, sizeof(PlayerProfile_Struct)); // start building the profile
|
|
||||||
|
|
||||||
strn0cpy(pp.name, name, sizeof(pp.name));
|
|
||||||
|
|
||||||
pp.race = cc->race;
|
|
||||||
pp.class_ = cc->class_;
|
|
||||||
pp.gender = cc->gender;
|
|
||||||
pp.deity = cc->deity;
|
|
||||||
pp.STR = cc->STR;
|
|
||||||
pp.STA = cc->STA;
|
|
||||||
pp.AGI = cc->AGI;
|
|
||||||
pp.DEX = cc->DEX;
|
|
||||||
pp.WIS = cc->WIS;
|
|
||||||
pp.INT = cc->INT;
|
|
||||||
pp.CHA = cc->CHA;
|
|
||||||
pp.face = cc->face;
|
|
||||||
pp.eyecolor1 = cc->eyecolor1;
|
|
||||||
pp.eyecolor2 = cc->eyecolor2;
|
|
||||||
pp.hairstyle = cc->hairstyle;
|
|
||||||
pp.haircolor = cc->haircolor;
|
|
||||||
pp.beard = cc->beard;
|
|
||||||
pp.beardcolor = cc->beardcolor;
|
|
||||||
pp.drakkin_heritage = cc->drakkin_heritage;
|
|
||||||
pp.drakkin_tattoo = cc->drakkin_tattoo;
|
|
||||||
pp.drakkin_details = cc->drakkin_details;
|
|
||||||
pp.birthday = bday;
|
|
||||||
pp.lastlogin = bday;
|
|
||||||
pp.level = 1;
|
|
||||||
pp.points = 5;
|
|
||||||
pp.cur_hp = 1000;
|
|
||||||
pp.hunger_level = 6000;
|
|
||||||
pp.thirst_level = 6000;
|
|
||||||
|
|
||||||
/* Set default skills for everybody */
|
|
||||||
pp.skills[EQ::skills::SkillSwimming] = RuleI(Skills, SwimmingStartValue);
|
|
||||||
pp.skills[EQ::skills::SkillSenseHeading] = RuleI(Skills, SenseHeadingStartValue);
|
|
||||||
|
|
||||||
/* Set Racial and Class specific language and skills */
|
|
||||||
SetRacialLanguages(&pp);
|
|
||||||
SetRaceStartingSkills(&pp);
|
|
||||||
SetClassStartingSkills(&pp);
|
|
||||||
SetClassLanguages(&pp);
|
|
||||||
|
|
||||||
memset(pp.spell_book, std::numeric_limits<uint8>::max(), (sizeof(uint32) * EQ::spells::SPELLBOOK_SIZE));
|
|
||||||
memset(pp.mem_spells, std::numeric_limits<uint8>::max(), (sizeof(uint32) * EQ::spells::SPELL_GEM_COUNT));
|
|
||||||
|
|
||||||
for (auto& b : pp.buffs) {
|
|
||||||
b.spellid = std::numeric_limits<uint16>::max();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If server is PVP by default, make all character set to it. */
|
|
||||||
pp.pvp = database.GetServerType() == 1 ? 1 : 0;
|
|
||||||
|
|
||||||
/* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */
|
|
||||||
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
|
|
||||||
LogInfo("Found [SoFStartZoneID] rule setting [{}]", RuleI(World, SoFStartZoneID));
|
|
||||||
if (RuleI(World, SoFStartZoneID) > 0) {
|
|
||||||
pp.zone_id = RuleI(World, SoFStartZoneID);
|
|
||||||
cc->start_zone = pp.zone_id;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LogInfo("Found [TitaniumStartZoneID] rule setting [{}]", RuleI(World, TitaniumStartZoneID));
|
|
||||||
if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */
|
|
||||||
pp.zone_id = RuleI(World, TitaniumStartZoneID);
|
|
||||||
cc->start_zone = pp.zone_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* use normal starting zone logic to either get defaults, or if startzone was set, load that from the db table.*/
|
|
||||||
const bool is_valid_start_zone = content_db.GetStartZone(&pp, cc, m_ClientVersionBit & EQ::versions::maskTitaniumAndEarlier);
|
|
||||||
if (!is_valid_start_zone){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pp.zone_id) {
|
|
||||||
pp.zone_id = Zones::QEYNOS;
|
|
||||||
|
|
||||||
pp.x = pp.y = pp.z = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8 slot_id = 1; slot_id < 5; slot_id++) {
|
|
||||||
pp.binds[slot_id].zone_id = pp.zone_id;
|
|
||||||
pp.binds[slot_id].x = pp.x;
|
|
||||||
pp.binds[slot_id].y = pp.y;
|
|
||||||
pp.binds[slot_id].z = pp.z;
|
|
||||||
pp.binds[slot_id].heading = pp.heading;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Overrides if we have the tutorial flag set! */
|
|
||||||
if (cc->tutorial && RuleB(World, EnableTutorialButton)) {
|
|
||||||
pp.zone_id = RuleI(World, TutorialZoneID);
|
|
||||||
|
|
||||||
auto z = GetZone(pp.zone_id);
|
|
||||||
if (z) {
|
|
||||||
pp.x = z->safe_x;
|
|
||||||
pp.y = z->safe_y;
|
|
||||||
pp.z = z->safe_z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Will either be the same as home or tutorial if enabled. */
|
|
||||||
if (RuleB(World, StartZoneSameAsBindOnCreation)) {
|
|
||||||
pp.binds[0].zone_id = pp.zone_id;
|
|
||||||
pp.binds[0].x = pp.x;
|
|
||||||
pp.binds[0].y = pp.y;
|
|
||||||
pp.binds[0].z = pp.z;
|
|
||||||
pp.binds[0].heading = pp.heading;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetZone(pp.zone_id)) {
|
|
||||||
LogInfo(
|
|
||||||
"Current location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
|
||||||
ZoneName(pp.zone_id),
|
|
||||||
pp.zone_id,
|
|
||||||
pp.x,
|
|
||||||
pp.y,
|
|
||||||
pp.z,
|
|
||||||
pp.heading
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetZone(pp.binds[0].zone_id)) {
|
|
||||||
LogInfo(
|
|
||||||
"Bind location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
|
||||||
ZoneName(pp.binds[0].zone_id),
|
|
||||||
pp.binds[0].zone_id,
|
|
||||||
pp.binds[0].x,
|
|
||||||
pp.binds[0].y,
|
|
||||||
pp.binds[0].z,
|
|
||||||
pp.binds[4].heading
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetZone(pp.binds[4].zone_id)) {
|
|
||||||
LogInfo(
|
|
||||||
"Home location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
|
||||||
ZoneName(pp.binds[4].zone_id),
|
|
||||||
pp.binds[4].zone_id,
|
|
||||||
pp.binds[4].x,
|
|
||||||
pp.binds[4].y,
|
|
||||||
pp.binds[4].z,
|
|
||||||
pp.binds[4].heading
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
|
|
||||||
|
|
||||||
const bool success = StoreCharacter(GetAccountID(), &pp, &inv);
|
|
||||||
|
|
||||||
LogInfo("Character creation {} for [{}]", success ? "succeeded" : "failed", pp.name);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns true if the request is ok, false if there's an error
|
// returns true if the request is ok, false if there's an error
|
||||||
bool CheckCharCreateInfoSoF(CharCreate_Struct* cc)
|
bool CheckCharCreateInfoSoF(CharCreate_Struct* cc)
|
||||||
{
|
{
|
||||||
@@ -1902,7 +1651,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
|||||||
|
|
||||||
LogInfo("Validating char creation info");
|
LogInfo("Validating char creation info");
|
||||||
|
|
||||||
RaceClassCombos class_combo;
|
CharCreateCombination class_combo;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
int combos = character_create_race_class_combos.size();
|
int combos = character_create_race_class_combos.size();
|
||||||
for (int i = 0; i < combos; ++i) {
|
for (int i = 0; i < combos; ++i) {
|
||||||
@@ -1922,7 +1671,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 allocs = character_create_allocations.size();
|
uint32 allocs = character_create_allocations.size();
|
||||||
RaceClassAllocation allocation = {0};
|
CharCreatePointAllocation allocation = { 0 };
|
||||||
found = false;
|
found = false;
|
||||||
for (int i = 0; i < allocs; ++i) {
|
for (int i = 0; i < allocs; ++i) {
|
||||||
if (character_create_allocations[i].Index == class_combo.AllocationIndex) {
|
if (character_create_allocations[i].Index == class_combo.AllocationIndex) {
|
||||||
@@ -2161,6 +1910,313 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
|
|||||||
return Charerrors == 0;
|
return Charerrors == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: these hard coded values should be settable somewhere somehow.
|
||||||
|
//Also they're not 100% accurate so if I don't make them settable somehow
|
||||||
|
//we need to go back and match them to the logic that was ripped out of zone
|
||||||
|
void GetResistsForCharacterCreate(CharCreate_Struct* cc,
|
||||||
|
bool sofAndLater,
|
||||||
|
uint32 &cold_resist,
|
||||||
|
uint32& fire_resist,
|
||||||
|
uint32& magic_resist,
|
||||||
|
uint32& disease_resist,
|
||||||
|
uint32& poison_resist,
|
||||||
|
uint32& corruption_resist)
|
||||||
|
{
|
||||||
|
if (!sofAndLater) {
|
||||||
|
cold_resist = 25;
|
||||||
|
fire_resist = 25;
|
||||||
|
magic_resist = 25;
|
||||||
|
disease_resist = 15;
|
||||||
|
poison_resist = 15;
|
||||||
|
corruption_resist = 15;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CharCreateCombination class_combo;
|
||||||
|
bool found = false;
|
||||||
|
int combos = character_create_race_class_combos.size();
|
||||||
|
for (int i = 0; i < combos; ++i) {
|
||||||
|
if (character_create_race_class_combos[i].Class == cc->class_ &&
|
||||||
|
character_create_race_class_combos[i].Race == cc->race &&
|
||||||
|
character_create_race_class_combos[i].Deity == cc->deity &&
|
||||||
|
character_create_race_class_combos[i].Zone == cc->start_zone) {
|
||||||
|
class_combo = character_create_race_class_combos[i];
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
cold_resist = 25;
|
||||||
|
fire_resist = 25;
|
||||||
|
magic_resist = 25;
|
||||||
|
disease_resist = 15;
|
||||||
|
poison_resist = 15;
|
||||||
|
corruption_resist = 15;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CharCreatePointAllocation allocation;
|
||||||
|
found = false;
|
||||||
|
combos = character_create_allocations.size();
|
||||||
|
for (int i = 0; i < combos; ++i) {
|
||||||
|
if (character_create_allocations[i].Index == class_combo.AllocationIndex) {
|
||||||
|
allocation = character_create_allocations[i];
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
cold_resist = 25;
|
||||||
|
fire_resist = 25;
|
||||||
|
magic_resist = 25;
|
||||||
|
disease_resist = 15;
|
||||||
|
poison_resist = 15;
|
||||||
|
corruption_resist = 15;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cold_resist = allocation.BaseResists[0];
|
||||||
|
fire_resist = allocation.BaseResists[1];
|
||||||
|
magic_resist = allocation.BaseResists[2];
|
||||||
|
disease_resist = allocation.BaseResists[3];
|
||||||
|
poison_resist = allocation.BaseResists[4];
|
||||||
|
corruption_resist = allocation.BaseResists[5];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||||
|
{
|
||||||
|
PlayerProfile_Struct pp;
|
||||||
|
EQ::InventoryProfile inv;
|
||||||
|
|
||||||
|
pp.SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(EQ::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit)));
|
||||||
|
inv.SetInventoryVersion(EQ::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit));
|
||||||
|
inv.SetGMInventory(false); // character cannot have gm flag at this point
|
||||||
|
|
||||||
|
time_t bday = time(nullptr);
|
||||||
|
in_addr in;
|
||||||
|
|
||||||
|
const uint32 stats_sum = (
|
||||||
|
cc->AGI +
|
||||||
|
cc->CHA +
|
||||||
|
cc->DEX +
|
||||||
|
cc->INT +
|
||||||
|
cc->STA +
|
||||||
|
cc->STR +
|
||||||
|
cc->WIS
|
||||||
|
);
|
||||||
|
|
||||||
|
in.s_addr = GetIP();
|
||||||
|
|
||||||
|
LogInfo(
|
||||||
|
"Character creation request from [{}] LS [{}] [{}] [{}]",
|
||||||
|
GetCLE()->LSName(),
|
||||||
|
GetCLE()->LSID(),
|
||||||
|
inet_ntoa(in),
|
||||||
|
GetPort()
|
||||||
|
);
|
||||||
|
LogInfo("Name [{}]", name);
|
||||||
|
LogInfo(
|
||||||
|
"race [{}] class [{}] gender [{}] deity [{}] start_zone [{}] tutorial [{}]",
|
||||||
|
cc->race,
|
||||||
|
cc->class_,
|
||||||
|
cc->gender,
|
||||||
|
cc->deity,
|
||||||
|
cc->start_zone,
|
||||||
|
cc->tutorial ? "true" : "false"
|
||||||
|
);
|
||||||
|
LogInfo(
|
||||||
|
"AGI [{}] CHA [{}] DEX [{}] INT [{}] STA [{}] STR [{}] WIS [{}] Total [{}]",
|
||||||
|
cc->AGI,
|
||||||
|
cc->CHA,
|
||||||
|
cc->DEX,
|
||||||
|
cc->INT,
|
||||||
|
cc->STA,
|
||||||
|
cc->STR,
|
||||||
|
cc->WIS,
|
||||||
|
stats_sum
|
||||||
|
);
|
||||||
|
LogInfo("Face [{}] Eye Colors [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
|
||||||
|
LogInfo("Hair [{}] Hair Color [{}]", cc->hairstyle, cc->haircolor);
|
||||||
|
LogInfo("Beard [{}] Beard Color [{}]", cc->beard, cc->beardcolor);
|
||||||
|
|
||||||
|
/* Validate the char creation struct */
|
||||||
|
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
|
||||||
|
if (!CheckCharCreateInfoSoF(cc)) {
|
||||||
|
LogInfo("CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!CheckCharCreateInfoTitanium(cc)) {
|
||||||
|
LogInfo("CheckCharCreateInfo did not validate the request (bad race/class/stats)");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert incoming cc_s to the new PlayerProfile_Struct */
|
||||||
|
memset(&pp, 0, sizeof(PlayerProfile_Struct)); // start building the profile
|
||||||
|
|
||||||
|
strn0cpy(pp.name, name, sizeof(pp.name));
|
||||||
|
|
||||||
|
pp.race = cc->race;
|
||||||
|
pp.class_ = cc->class_;
|
||||||
|
pp.gender = cc->gender;
|
||||||
|
pp.deity = cc->deity;
|
||||||
|
pp.STR = cc->STR;
|
||||||
|
pp.STA = cc->STA;
|
||||||
|
pp.AGI = cc->AGI;
|
||||||
|
pp.DEX = cc->DEX;
|
||||||
|
pp.WIS = cc->WIS;
|
||||||
|
pp.INT = cc->INT;
|
||||||
|
pp.CHA = cc->CHA;
|
||||||
|
pp.face = cc->face;
|
||||||
|
pp.eyecolor1 = cc->eyecolor1;
|
||||||
|
pp.eyecolor2 = cc->eyecolor2;
|
||||||
|
pp.hairstyle = cc->hairstyle;
|
||||||
|
pp.haircolor = cc->haircolor;
|
||||||
|
pp.beard = cc->beard;
|
||||||
|
pp.beardcolor = cc->beardcolor;
|
||||||
|
pp.drakkin_heritage = cc->drakkin_heritage;
|
||||||
|
pp.drakkin_tattoo = cc->drakkin_tattoo;
|
||||||
|
pp.drakkin_details = cc->drakkin_details;
|
||||||
|
pp.birthday = bday;
|
||||||
|
pp.lastlogin = bday;
|
||||||
|
pp.level = 1;
|
||||||
|
pp.points = 5;
|
||||||
|
pp.cur_hp = 1000;
|
||||||
|
pp.hunger_level = 6000;
|
||||||
|
pp.thirst_level = 6000;
|
||||||
|
|
||||||
|
GetResistsForCharacterCreate(cc,
|
||||||
|
m_ClientVersionBit & EQ::versions::maskSoFAndLater,
|
||||||
|
pp.cold_resist,
|
||||||
|
pp.fire_resist,
|
||||||
|
pp.magic_resist,
|
||||||
|
pp.disease_resist,
|
||||||
|
pp.poison_resist,
|
||||||
|
pp.corruption_resist);
|
||||||
|
|
||||||
|
/* Set default skills for everybody */
|
||||||
|
pp.skills[EQ::skills::SkillSwimming] = RuleI(Skills, SwimmingStartValue);
|
||||||
|
pp.skills[EQ::skills::SkillSenseHeading] = RuleI(Skills, SenseHeadingStartValue);
|
||||||
|
|
||||||
|
/* Set Racial and Class specific language and skills */
|
||||||
|
SetRacialLanguages(&pp);
|
||||||
|
SetRaceStartingSkills(&pp);
|
||||||
|
SetClassStartingSkills(&pp);
|
||||||
|
SetClassLanguages(&pp);
|
||||||
|
|
||||||
|
memset(pp.spell_book, std::numeric_limits<uint8>::max(), (sizeof(uint32) * EQ::spells::SPELLBOOK_SIZE));
|
||||||
|
memset(pp.mem_spells, std::numeric_limits<uint8>::max(), (sizeof(uint32) * EQ::spells::SPELL_GEM_COUNT));
|
||||||
|
|
||||||
|
for (auto& b : pp.buffs) {
|
||||||
|
b.spellid = std::numeric_limits<uint16>::max();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If server is PVP by default, make all character set to it. */
|
||||||
|
pp.pvp = database.GetServerType() == 1 ? 1 : 0;
|
||||||
|
|
||||||
|
/* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */
|
||||||
|
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
|
||||||
|
LogInfo("Found [SoFStartZoneID] rule setting [{}]", RuleI(World, SoFStartZoneID));
|
||||||
|
if (RuleI(World, SoFStartZoneID) > 0) {
|
||||||
|
pp.zone_id = RuleI(World, SoFStartZoneID);
|
||||||
|
cc->start_zone = pp.zone_id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LogInfo("Found [TitaniumStartZoneID] rule setting [{}]", RuleI(World, TitaniumStartZoneID));
|
||||||
|
if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */
|
||||||
|
pp.zone_id = RuleI(World, TitaniumStartZoneID);
|
||||||
|
cc->start_zone = pp.zone_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* use normal starting zone logic to either get defaults, or if startzone was set, load that from the db table.*/
|
||||||
|
const bool is_valid_start_zone = content_db.GetStartZone(&pp, cc, m_ClientVersionBit & EQ::versions::maskTitaniumAndEarlier);
|
||||||
|
if (!is_valid_start_zone){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pp.zone_id) {
|
||||||
|
pp.zone_id = Zones::QEYNOS;
|
||||||
|
|
||||||
|
pp.x = pp.y = pp.z = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint8 slot_id = 1; slot_id < 5; slot_id++) {
|
||||||
|
pp.binds[slot_id].zone_id = pp.zone_id;
|
||||||
|
pp.binds[slot_id].x = pp.x;
|
||||||
|
pp.binds[slot_id].y = pp.y;
|
||||||
|
pp.binds[slot_id].z = pp.z;
|
||||||
|
pp.binds[slot_id].heading = pp.heading;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Overrides if we have the tutorial flag set! */
|
||||||
|
if (cc->tutorial && RuleB(World, EnableTutorialButton)) {
|
||||||
|
pp.zone_id = RuleI(World, TutorialZoneID);
|
||||||
|
|
||||||
|
auto z = GetZone(pp.zone_id);
|
||||||
|
if (z) {
|
||||||
|
pp.x = z->safe_x;
|
||||||
|
pp.y = z->safe_y;
|
||||||
|
pp.z = z->safe_z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Will either be the same as home or tutorial if enabled. */
|
||||||
|
if (RuleB(World, StartZoneSameAsBindOnCreation)) {
|
||||||
|
pp.binds[0].zone_id = pp.zone_id;
|
||||||
|
pp.binds[0].x = pp.x;
|
||||||
|
pp.binds[0].y = pp.y;
|
||||||
|
pp.binds[0].z = pp.z;
|
||||||
|
pp.binds[0].heading = pp.heading;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetZone(pp.zone_id)) {
|
||||||
|
LogInfo(
|
||||||
|
"Current location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
||||||
|
ZoneName(pp.zone_id),
|
||||||
|
pp.zone_id,
|
||||||
|
pp.x,
|
||||||
|
pp.y,
|
||||||
|
pp.z,
|
||||||
|
pp.heading
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetZone(pp.binds[0].zone_id)) {
|
||||||
|
LogInfo(
|
||||||
|
"Bind location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
||||||
|
ZoneName(pp.binds[0].zone_id),
|
||||||
|
pp.binds[0].zone_id,
|
||||||
|
pp.binds[0].x,
|
||||||
|
pp.binds[0].y,
|
||||||
|
pp.binds[0].z,
|
||||||
|
pp.binds[4].heading
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetZone(pp.binds[4].zone_id)) {
|
||||||
|
LogInfo(
|
||||||
|
"Home location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
||||||
|
ZoneName(pp.binds[4].zone_id),
|
||||||
|
pp.binds[4].zone_id,
|
||||||
|
pp.binds[4].x,
|
||||||
|
pp.binds[4].y,
|
||||||
|
pp.binds[4].z,
|
||||||
|
pp.binds[4].heading
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
|
||||||
|
|
||||||
|
const bool success = StoreCharacter(GetAccountID(), &pp, &inv);
|
||||||
|
|
||||||
|
LogInfo("Character creation {} for [{}]", success ? "succeeded" : "failed", pp.name);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp)
|
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp)
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i <= EQ::skills::HIGHEST_SKILL; ++i) {
|
for (uint32 i = 0; i <= EQ::skills::HIGHEST_SKILL; ++i) {
|
||||||
@@ -2482,34 +2538,3 @@ void Client::SendGuildTributeOptInToggle(const GuildTributeMemberToggle *in)
|
|||||||
QueuePacket(outapp);
|
QueuePacket(outapp);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::SendUnsupportedClientPacket(const std::string& message)
|
|
||||||
{
|
|
||||||
EQApplicationPacket packet(OP_SendCharInfo, sizeof(CharacterSelect_Struct) + sizeof(CharacterSelectEntry_Struct));
|
|
||||||
|
|
||||||
unsigned char* buff_ptr = packet.pBuffer;
|
|
||||||
auto cs = (CharacterSelect_Struct*) buff_ptr;
|
|
||||||
|
|
||||||
cs->CharCount = 1;
|
|
||||||
cs->TotalChars = 1;
|
|
||||||
|
|
||||||
buff_ptr += sizeof(CharacterSelect_Struct);
|
|
||||||
|
|
||||||
auto e = (CharacterSelectEntry_Struct*) buff_ptr;
|
|
||||||
|
|
||||||
strcpy(e->Name, message.c_str());
|
|
||||||
|
|
||||||
e->Race = Race::Human;
|
|
||||||
e->Class = Class::Warrior;
|
|
||||||
e->Level = 1;
|
|
||||||
e->ShroudClass = e->Class;
|
|
||||||
e->ShroudRace = e->Race;
|
|
||||||
e->Zone = std::numeric_limits<uint16>::max();
|
|
||||||
e->Instance = 0;
|
|
||||||
e->Gender = Gender::Male;
|
|
||||||
e->GoHome = 0;
|
|
||||||
e->Tutorial = 0;
|
|
||||||
e->Enabled = 0;
|
|
||||||
|
|
||||||
QueuePacket(&packet);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -120,10 +120,6 @@ private:
|
|||||||
EQStreamInterface* eqs;
|
EQStreamInterface* eqs;
|
||||||
bool CanTradeFVNoDropItem();
|
bool CanTradeFVNoDropItem();
|
||||||
void RecordPossibleHack(const std::string& message);
|
void RecordPossibleHack(const std::string& message);
|
||||||
void SendUnsupportedClientPacket(const std::string& message);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
|
|
||||||
bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user