mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cdd95e3023 | |||
| 032cf4f71e | |||
| 1354f73771 | |||
| 17e922b026 | |||
| d9c17511fd |
@@ -68,4 +68,3 @@ compile_flags.txt
|
|||||||
|
|
||||||
# CMake Files
|
# CMake Files
|
||||||
cmake-build-relwithdebinfo/*
|
cmake-build-relwithdebinfo/*
|
||||||
skill-caps.diff
|
|
||||||
|
|||||||
-492
@@ -1,495 +1,3 @@
|
|||||||
## [23.3.4] 3/14/2025
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Add check for simultaneous direct vendor and parcel Trader/Buyer Purchase ([#4778](https://github.com/EQEmu/Server/pull/4778)) @neckkola 2025-03-14
|
|
||||||
* Fix for rare circumstance where NPC's would have 0 health on restore @Akkadius
|
|
||||||
|
|
||||||
## [23.3.3] 3/13/2025
|
|
||||||
|
|
||||||
### Database
|
|
||||||
|
|
||||||
* Add indexes for data_buckets and zone_state_spawns ([#4771](https://github.com/EQEmu/Server/pull/4771)) @Akkadius 2025-03-11
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Update GuildBank to correctly handle items with charges equal to zero ([#4774](https://github.com/EQEmu/Server/pull/4774)) @neckkola 2025-03-13
|
|
||||||
|
|
||||||
### Networking
|
|
||||||
|
|
||||||
* Fix "port in use" error ([#4772](https://github.com/EQEmu/Server/pull/4772)) @Akkadius 2025-03-12
|
|
||||||
|
|
||||||
### Zone
|
|
||||||
|
|
||||||
* Zone State Improvements Part 3 ([#4773](https://github.com/EQEmu/Server/pull/4773)) @Akkadius 2025-03-13
|
|
||||||
|
|
||||||
## [23.3.2] 3/11/2025
|
|
||||||
|
|
||||||
### DynamicZones
|
|
||||||
|
|
||||||
* Bulk request dz member statuses on zone boot ([#4769](https://github.com/EQEmu/Server/pull/4769)) @hgtw 2025-03-11
|
|
||||||
|
|
||||||
### Zone
|
|
||||||
|
|
||||||
* Zone State Improvements (Continued) ([#4768](https://github.com/EQEmu/Server/pull/4768)) @Akkadius 2025-03-11
|
|
||||||
|
|
||||||
## [23.3.0] 3/8/2025
|
|
||||||
|
|
||||||
### Bots
|
|
||||||
|
|
||||||
* Fix buffs not overwriting lesser buffs ([#4756](https://github.com/EQEmu/Server/pull/4756)) @nytmyr 2025-03-06
|
|
||||||
* Fix taunting bots positioning ([#4754](https://github.com/EQEmu/Server/pull/4754)) @nytmyr 2025-03-06
|
|
||||||
* Move commanded spell map to zone ([#4755](https://github.com/EQEmu/Server/pull/4755)) @nytmyr 2025-03-06
|
|
||||||
|
|
||||||
### Code
|
|
||||||
|
|
||||||
* Fix typo in GM tradeskill combine message ([#4762](https://github.com/EQEmu/Server/pull/4762)) @nytmyr 2025-03-08
|
|
||||||
|
|
||||||
### Crash
|
|
||||||
|
|
||||||
* Bot aura crash fix ([#4752](https://github.com/EQEmu/Server/pull/4752)) @nytmyr 2025-03-06
|
|
||||||
|
|
||||||
### Databuckets
|
|
||||||
|
|
||||||
* Nested Databuckets Protections and Improvements ([#4748](https://github.com/EQEmu/Server/pull/4748)) @Akkadius 2025-03-04
|
|
||||||
|
|
||||||
### Feature
|
|
||||||
|
|
||||||
* Add Rule for dealing with augments when an item evolves ([#4758](https://github.com/EQEmu/Server/pull/4758)) @neckkola 2025-03-08
|
|
||||||
* Allow assigning Helm Texture independently of Body Texture for Horses ([#4759](https://github.com/EQEmu/Server/pull/4759)) @catapultam-habeo 2025-03-08
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Add crash checks for certain PlayerEventLogs ([#4761](https://github.com/EQEmu/Server/pull/4761)) @neckkola 2025-03-07
|
|
||||||
* Correct incorrectly calculated stat caps with Heroic Stats ([#4760](https://github.com/EQEmu/Server/pull/4760)) @catapultam-habeo 2025-03-08
|
|
||||||
* Fix sigabort crash from invalid JSON @Akkadius 2025-03-03
|
|
||||||
* Forgot to push up some changes for test output @Akkadius 2025-03-04
|
|
||||||
* Parcel Delivery Updates for two edge cases ([#4753](https://github.com/EQEmu/Server/pull/4753)) @neckkola 2025-03-06
|
|
||||||
* Remove one port check in world @Akkadius 2025-03-03
|
|
||||||
* Zero out currentnpcid whenever spawn is reset. ([#4763](https://github.com/EQEmu/Server/pull/4763)) @zimp-wow 2025-03-08
|
|
||||||
|
|
||||||
### Logging
|
|
||||||
|
|
||||||
* Convert JSON Error to Data Buckets Logging Category ([#4747](https://github.com/EQEmu/Server/pull/4747)) @Kinglykrab 2025-03-04
|
|
||||||
|
|
||||||
### Pets
|
|
||||||
|
|
||||||
* Fix renamed pets loading as blank names ([#4751](https://github.com/EQEmu/Server/pull/4751)) @nytmyr 2025-03-05
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
* Fix EvolvingItems:PercentOfRaidExperience Description ([#4757](https://github.com/EQEmu/Server/pull/4757)) @Kinglykrab 2025-03-07
|
|
||||||
|
|
||||||
### Tests
|
|
||||||
|
|
||||||
* Cleanup Hand-in Tests ([#4749](https://github.com/EQEmu/Server/pull/4749)) @Akkadius 2025-03-04
|
|
||||||
|
|
||||||
### Zone
|
|
||||||
|
|
||||||
* Make zone controller less likely to be visible, immune to all forms of combat ([#4750](https://github.com/EQEmu/Server/pull/4750)) @Akkadius 2025-03-06
|
|
||||||
* State Save Improvements ([#4765](https://github.com/EQEmu/Server/pull/4765)) @Akkadius 2025-03-08
|
|
||||||
|
|
||||||
## [23.2.0] 3/3/2025
|
|
||||||
|
|
||||||
### Crash
|
|
||||||
|
|
||||||
* Database SetMutex crash fix ([#4741](https://github.com/EQEmu/Server/pull/4741)) @Akkadius 2025-03-03
|
|
||||||
* Fix Aura process crash with bots ([#4743](https://github.com/EQEmu/Server/pull/4743)) @Akkadius 2025-03-03
|
|
||||||
* Fix crash in add loot code path ([#4745](https://github.com/EQEmu/Server/pull/4745)) @Akkadius 2025-03-03
|
|
||||||
* Fix world repop crash ([#4742](https://github.com/EQEmu/Server/pull/4742)) @Akkadius 2025-03-03
|
|
||||||
* Potential crash fix in scan close mobs ([#4744](https://github.com/EQEmu/Server/pull/4744)) @Akkadius 2025-03-03
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Cleanup zone buckets on instance purge. ([#4739](https://github.com/EQEmu/Server/pull/4739)) @zimp-wow 2025-03-02
|
|
||||||
* Fix an error causing Endurance Regen to not be applied by items. ([#4738](https://github.com/EQEmu/Server/pull/4738)) @catapultam-habeo 2025-03-02
|
|
||||||
|
|
||||||
### World
|
|
||||||
|
|
||||||
* Check if port in use to avoid double booting mistakes ([#4740](https://github.com/EQEmu/Server/pull/4740)) @Akkadius 2025-03-03
|
|
||||||
|
|
||||||
## [23.1.0] 3/1/2025
|
|
||||||
|
|
||||||
### Bots
|
|
||||||
|
|
||||||
* Fix unresponsive bots in groups upon group wipe ([#4712](https://github.com/EQEmu/Server/pull/4712)) @nytmyr 2025-02-28
|
|
||||||
|
|
||||||
### Code
|
|
||||||
|
|
||||||
* More login <-> world code cleanup ([#4724](https://github.com/EQEmu/Server/pull/4724)) @Akkadius 2025-02-28
|
|
||||||
|
|
||||||
### Crash
|
|
||||||
|
|
||||||
* Check for directory existence before traversing in CheckForCompatibleQuestPlugins ([#4730](https://github.com/EQEmu/Server/pull/4730)) @Akkadius 2025-03-02
|
|
||||||
* Fix filesystem crash / exception in DatabaseDumpService::RemoveCredentialsFile() ([#4731](https://github.com/EQEmu/Server/pull/4731)) @Akkadius 2025-03-01
|
|
||||||
* Fix large file size crash in File::GetContents for windows ([#4735](https://github.com/EQEmu/Server/pull/4735)) @Akkadius 2025-03-02
|
|
||||||
* Fix reload concurrency crash when ran from Spire ([#4733](https://github.com/EQEmu/Server/pull/4733)) @Akkadius 2025-03-02
|
|
||||||
* Validate item in SE_SummonItemIntoBag ([#4734](https://github.com/EQEmu/Server/pull/4734)) @Akkadius 2025-03-02
|
|
||||||
* World CLI validation ([#4728](https://github.com/EQEmu/Server/pull/4728)) @Akkadius 2025-03-01
|
|
||||||
|
|
||||||
### Database
|
|
||||||
|
|
||||||
* Remove force_interactive from big bag updates ([#4727](https://github.com/EQEmu/Server/pull/4727)) @Akkadius 2025-03-01
|
|
||||||
|
|
||||||
### Feature
|
|
||||||
|
|
||||||
* Add a rule for spells to bypass stacking rules ([#4716](https://github.com/EQEmu/Server/pull/4716)) @catapultam-habeo 2025-02-28
|
|
||||||
* Evolving items Additions ([#4725](https://github.com/EQEmu/Server/pull/4725)) @neckkola 2025-03-01
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Add character_pet_name to player tables schema @Akkadius 2025-03-02
|
|
||||||
* Add client packets to questmanager:setguild ([#4732](https://github.com/EQEmu/Server/pull/4732)) @neckkola 2025-03-01
|
|
||||||
* Clear m_completed_shared_tasks before reloading @Akkadius 2025-02-24
|
|
||||||
* Fix AA Reset Error Message ([#4720](https://github.com/EQEmu/Server/pull/4720)) @Kinglykrab 2025-02-28
|
|
||||||
* Fix Issue with Suffixes/Prefixes ([#4723](https://github.com/EQEmu/Server/pull/4723)) @Kinglykrab 2025-02-28
|
|
||||||
* Fix Trading Items to Bot Pets ([#4721](https://github.com/EQEmu/Server/pull/4721)) @MortimerGreenwald 2025-02-28
|
|
||||||
* Refactor ApplyItemBonuses to fix double-counting of ATK and recommended levels not correctly applying ([#4713](https://github.com/EQEmu/Server/pull/4713)) @catapultam-habeo 2025-03-01
|
|
||||||
|
|
||||||
### Loginserver
|
|
||||||
|
|
||||||
* Minor cleanup ([#4729](https://github.com/EQEmu/Server/pull/4729)) @Akkadius 2025-03-01
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add Key Ring Methods to Perl and Lua ([#4719](https://github.com/EQEmu/Server/pull/4719)) @Kinglykrab 2025-02-28
|
|
||||||
* Implement eq.handin() and quest::handin() ([#4718](https://github.com/EQEmu/Server/pull/4718)) @Akkadius 2025-02-28
|
|
||||||
|
|
||||||
### Tasks
|
|
||||||
|
|
||||||
* Extend IsTaskCompleted to also be aware of shared task completion ([#4714](https://github.com/EQEmu/Server/pull/4714)) @Akkadius 2025-02-24
|
|
||||||
|
|
||||||
### Zone
|
|
||||||
|
|
||||||
* Implement Zone State Saving on Shutdown ([#4715](https://github.com/EQEmu/Server/pull/4715)) @Akkadius 2025-02-28
|
|
||||||
|
|
||||||
### Zone State
|
|
||||||
|
|
||||||
* Wrap all serialization/deserialization in try/catch ([#4726](https://github.com/EQEmu/Server/pull/4726)) @Akkadius 2025-03-01
|
|
||||||
|
|
||||||
## [23.0.2] 2/21/2025
|
|
||||||
|
|
||||||
### Bots
|
|
||||||
|
|
||||||
* Add checks to ensure bots and pets do not engage on ^pull ([#4708](https://github.com/EQEmu/Server/pull/4708)) @nytmyr 2025-02-22
|
|
||||||
* Improve positioning ([#4709](https://github.com/EQEmu/Server/pull/4709)) @nytmyr 2025-02-22
|
|
||||||
* Prevent medding in combat if any mob has bot targeted ([#4707](https://github.com/EQEmu/Server/pull/4707)) @nytmyr 2025-02-22
|
|
||||||
|
|
||||||
### Client Mod
|
|
||||||
|
|
||||||
* Adds a hacked fast camp rule for GMs ([#4697](https://github.com/EQEmu/Server/pull/4697)) @KimLS 2025-02-20
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Fix Lua Zone ID Exports ([#4700](https://github.com/EQEmu/Server/pull/4700)) @Kinglykrab 2025-02-22
|
|
||||||
* Fix bad Mob reference in QuestManager::resumetimer() ([#4710](https://github.com/EQEmu/Server/pull/4710)) @zimp-wow 2025-02-22
|
|
||||||
* Fix cursor load on zone ([#4704](https://github.com/EQEmu/Server/pull/4704)) @nytmyr 2025-02-22
|
|
||||||
* Fix infinite loop in QuestManager::stoptimer() ([#4703](https://github.com/EQEmu/Server/pull/4703)) @zimp-wow 2025-02-21
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add GetSpawn() to Perl and Lua ([#4702](https://github.com/EQEmu/Server/pull/4702)) @Kinglykrab 2025-02-22
|
|
||||||
|
|
||||||
## [23.0.1] 2/20/2025
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Player event ordering merge fix ([#4699](https://github.com/EQEmu/Server/pull/4699)) @Akkadius 2025-02-20
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add DisableRespawnTimers to Perl and Lua ([#4691](https://github.com/EQEmu/Server/pull/4691)) @Kinglykrab 2025-02-20
|
|
||||||
|
|
||||||
## [23.0.0] 2/19/2025
|
|
||||||
|
|
||||||
### Bots
|
|
||||||
|
|
||||||
* Add AEHateLine to HateLine ParentType ([#4678](https://github.com/EQEmu/Server/pull/4678)) @nytmyr 2025-02-15
|
|
||||||
* Add IsInRaidOrGroup checks to ^attack and ^pull ([#4654](https://github.com/EQEmu/Server/pull/4654)) @nytmyr 2025-02-07
|
|
||||||
* Add missing stance options ([#4681](https://github.com/EQEmu/Server/pull/4681)) @nytmyr 2025-02-15
|
|
||||||
* Bot Overhaul ([#4580](https://github.com/EQEmu/Server/pull/4580)) @nytmyr 2025-02-03
|
|
||||||
* Command Cleanup ([#4676](https://github.com/EQEmu/Server/pull/4676)) @nytmyr 2025-02-15
|
|
||||||
* Correct camp count on ^camp ([#4650](https://github.com/EQEmu/Server/pull/4650)) @nytmyr 2025-02-06
|
|
||||||
* Correct helper message for forced casts ([#4656](https://github.com/EQEmu/Server/pull/4656)) @nytmyr 2025-02-07
|
|
||||||
* Crash fixes related to GetNumberNeedingHealedInGroup ([#4684](https://github.com/EQEmu/Server/pull/4684)) @nytmyr 2025-02-15
|
|
||||||
* Fix AE range calculation ([#4683](https://github.com/EQEmu/Server/pull/4683)) @nytmyr 2025-02-15
|
|
||||||
* Fix Bards not casting ([#4638](https://github.com/EQEmu/Server/pull/4638)) @nytmyr 2025-02-03
|
|
||||||
* Fix a couple potential crashes with GetNumberNeedingHealedInGroup ([#4652](https://github.com/EQEmu/Server/pull/4652)) @nytmyr 2025-02-07
|
|
||||||
* Fix crash related to GetTempSpellType() ([#4649](https://github.com/EQEmu/Server/pull/4649)) @nytmyr 2025-02-06
|
|
||||||
* Fix pets causing aggro ([#4677](https://github.com/EQEmu/Server/pull/4677)) @nytmyr 2025-02-15
|
|
||||||
* Fix spell priority commands ([#4660](https://github.com/EQEmu/Server/pull/4660)) @nytmyr 2025-02-08
|
|
||||||
* Fix typo in positioning ([#4659](https://github.com/EQEmu/Server/pull/4659)) @nytmyr 2025-02-08
|
|
||||||
* Move BotGetSpellsByType to cache ([#4655](https://github.com/EQEmu/Server/pull/4655)) @nytmyr 2025-02-07
|
|
||||||
* Prevents casting on ineligible targets due to target type, stacking, etc. ([#4680](https://github.com/EQEmu/Server/pull/4680)) @nytmyr 2025-02-15
|
|
||||||
* Sanity checks for spell type updates ([#4641](https://github.com/EQEmu/Server/pull/4641)) @nytmyr 2025-02-05
|
|
||||||
|
|
||||||
### Bug
|
|
||||||
|
|
||||||
* Item Purchase Offset when multiple buyers are buying at the same time. ([#4628](https://github.com/EQEmu/Server/pull/4628)) @fryguy503 2025-02-06
|
|
||||||
|
|
||||||
### CI
|
|
||||||
|
|
||||||
* Fix database race condition ([#4646](https://github.com/EQEmu/Server/pull/4646)) @Akkadius 2025-02-06
|
|
||||||
|
|
||||||
### Client Mod
|
|
||||||
|
|
||||||
* Adds a hacked fast camp rule for GMs ([#4697](https://github.com/EQEmu/Server/pull/4697)) @KimLS 2025-02-20
|
|
||||||
|
|
||||||
### Code
|
|
||||||
|
|
||||||
* Bot RaidGroupSay ([#4653](https://github.com/EQEmu/Server/pull/4653)) @nytmyr 2025-02-07
|
|
||||||
* Cleanup logic in cursor bag check ([#4642](https://github.com/EQEmu/Server/pull/4642)) @nytmyr 2025-02-04
|
|
||||||
* Use Repositories for Titles ([#4608](https://github.com/EQEmu/Server/pull/4608)) @Kinglykrab 2025-02-07
|
|
||||||
|
|
||||||
### Commands
|
|
||||||
|
|
||||||
* Fix #goto not accepting proper heading ([#4685](https://github.com/EQEmu/Server/pull/4685)) @nytmyr 2025-02-15
|
|
||||||
* Fix Illusion Block ([#4666](https://github.com/EQEmu/Server/pull/4666)) @nytmyr 2025-02-12
|
|
||||||
|
|
||||||
### Crash
|
|
||||||
|
|
||||||
* Fix raid/group crash regression ([#4671](https://github.com/EQEmu/Server/pull/4671)) @Akkadius 2025-02-12
|
|
||||||
* Fix zone crash caused by NPC::MoveTo ([#4639](https://github.com/EQEmu/Server/pull/4639)) @catapultam-habeo 2025-02-03
|
|
||||||
|
|
||||||
### Databuckets
|
|
||||||
|
|
||||||
* Add Zone Scoped Databuckets ([#4690](https://github.com/EQEmu/Server/pull/4690)) @Akkadius 2025-02-18
|
|
||||||
|
|
||||||
### Expeditions
|
|
||||||
|
|
||||||
* Move expedition code into DynamicZone ([#4672](https://github.com/EQEmu/Server/pull/4672)) @hgtw 2025-02-16
|
|
||||||
|
|
||||||
### Feature
|
|
||||||
|
|
||||||
* Add Support for Tradeskill Recipe Inspect ([#4648](https://github.com/EQEmu/Server/pull/4648)) @Kinglykrab 2025-02-06
|
|
||||||
* Add rule to allow /changepetname to function without being enabled by scripts. @catapultam-habeo 2025-02-05
|
|
||||||
* GuildBank Updates ([#4674](https://github.com/EQEmu/Server/pull/4674)) @neckkola 2025-02-15
|
|
||||||
* Implement Big Bags ([#4606](https://github.com/EQEmu/Server/pull/4606)) @Kinglykrab 2025-02-03
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* #rq and #reload quest alias ([#4694](https://github.com/EQEmu/Server/pull/4694)) @Akkadius 2025-02-18
|
|
||||||
* Always spawn zone controller first ([#4669](https://github.com/EQEmu/Server/pull/4669)) @Akkadius 2025-02-12
|
|
||||||
* Big Bag Cleanup ([#4643](https://github.com/EQEmu/Server/pull/4643)) @fryguy503 2025-02-05
|
|
||||||
* Big Bag additional fixes ([#4644](https://github.com/EQEmu/Server/pull/4644)) @fryguy503 2025-02-05
|
|
||||||
* Change logging level for no items found in a bazaar search to reduce spam logs. ([#4675](https://github.com/EQEmu/Server/pull/4675)) @neckkola 2025-02-13
|
|
||||||
* Find Zone - Expansion Settings ([#4692](https://github.com/EQEmu/Server/pull/4692)) @MortimerGreenwald 2025-02-18
|
|
||||||
* Fix Beastlord Warder Size Modifier ([#4665](https://github.com/EQEmu/Server/pull/4665)) @Kinglykrab 2025-02-12
|
|
||||||
* Fix CI since hand-ins are merged @Akkadius 2025-02-03
|
|
||||||
* Fix Illusion Fade Texture Bug ([#4673](https://github.com/EQEmu/Server/pull/4673)) @Kinglykrab 2025-02-14
|
|
||||||
* Fix Item Discovery ([#4663](https://github.com/EQEmu/Server/pull/4663)) @Kinglykrab 2025-02-10
|
|
||||||
* Fix ST_GroupNoPets and ST_GroupClientAndPet ([#4667](https://github.com/EQEmu/Server/pull/4667)) @nytmyr 2025-02-10
|
|
||||||
* Fix SendStatsWindow Mod2 Value Display ([#4658](https://github.com/EQEmu/Server/pull/4658)) @Kinglykrab 2025-02-07
|
|
||||||
* Fix Tradeskill Queries ([#4661](https://github.com/EQEmu/Server/pull/4661)) @Kinglykrab 2025-02-09
|
|
||||||
* Fix error in update manifest ([#4637](https://github.com/EQEmu/Server/pull/4637)) @nytmyr 2025-02-03
|
|
||||||
* Fix issue with getting an unset nested databucket ([#4693](https://github.com/EQEmu/Server/pull/4693)) @Akkadius 2025-02-19
|
|
||||||
* Fix non-error in player_event_logs ([#4695](https://github.com/EQEmu/Server/pull/4695)) @Akkadius 2025-02-18
|
|
||||||
* GMMove Update Edge Case With Clients ([#4686](https://github.com/EQEmu/Server/pull/4686)) @Akkadius 2025-02-15
|
|
||||||
* Item Handins to Pets ([#4687](https://github.com/EQEmu/Server/pull/4687)) @Akkadius 2025-02-15
|
|
||||||
* Parcel Delivery Updates ([#4688](https://github.com/EQEmu/Server/pull/4688)) @neckkola 2025-02-16
|
|
||||||
* Prevent zone from loading ETL ID's on bootup ([#4696](https://github.com/EQEmu/Server/pull/4696)) @Akkadius 2025-02-18
|
|
||||||
* Update pre big bag corpse slot_id's to support big bags ([#4679](https://github.com/EQEmu/Server/pull/4679)) @nytmyr 2025-02-15
|
|
||||||
|
|
||||||
### Inventory
|
|
||||||
|
|
||||||
* Fix cursor bag saving to invalid slot_ids ([#4640](https://github.com/EQEmu/Server/pull/4640)) @nytmyr 2025-02-04
|
|
||||||
|
|
||||||
### Items
|
|
||||||
|
|
||||||
* Overhaul Item Hand-in System ([#4593](https://github.com/EQEmu/Server/pull/4593)) @Akkadius 2025-02-03
|
|
||||||
|
|
||||||
### Loginserver
|
|
||||||
|
|
||||||
* Fix iterator crash ([#4670](https://github.com/EQEmu/Server/pull/4670)) @Akkadius 2025-02-12
|
|
||||||
* Modernize codebase ([#4647](https://github.com/EQEmu/Server/pull/4647)) @Akkadius 2025-02-06
|
|
||||||
|
|
||||||
### NPC Handins
|
|
||||||
|
|
||||||
* Fix MultiQuest Handins ([#4651](https://github.com/EQEmu/Server/pull/4651)) @Akkadius 2025-02-07
|
|
||||||
|
|
||||||
### Performance
|
|
||||||
|
|
||||||
* Server Reload Overhaul ([#4689](https://github.com/EQEmu/Server/pull/4689)) @Akkadius 2025-02-18
|
|
||||||
|
|
||||||
### Player Event Logs
|
|
||||||
|
|
||||||
* Migrate and Deprecate QS Legacy Logging ([#4542](https://github.com/EQEmu/Server/pull/4542)) @neckkola 2025-02-05
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add Bandolier Methods ([#4635](https://github.com/EQEmu/Server/pull/4635)) @Kinglykrab 2025-02-03
|
|
||||||
* Add Potion Belt Methods ([#4634](https://github.com/EQEmu/Server/pull/4634)) @Kinglykrab 2025-02-04
|
|
||||||
* Add Zone Support to Perl and Lua ([#4662](https://github.com/EQEmu/Server/pull/4662)) @Kinglykrab 2025-02-09
|
|
||||||
|
|
||||||
### Spells
|
|
||||||
|
|
||||||
* Add all types to checks for max_targets_allowed rule for AEs ([#4682](https://github.com/EQEmu/Server/pull/4682)) @nytmyr 2025-02-15
|
|
||||||
|
|
||||||
## [22.62.2] 2/1/2025
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Add price change check to the Bazaar Search Window purchase mechanics ([#4632](https://github.com/EQEmu/Server/pull/4632)) @neckkola 2025-02-01
|
|
||||||
* NewBazaar Search Consumables ([#4631](https://github.com/EQEmu/Server/pull/4631)) @neckkola 2025-02-01
|
|
||||||
* Update the shard bazaar search feature ([#4630](https://github.com/EQEmu/Server/pull/4630)) @neckkola 2025-02-01
|
|
||||||
|
|
||||||
### Memory Leak
|
|
||||||
|
|
||||||
* Revert " Change raw pointer to unique_ptr to avoid potential leak in dbg stream " ([#4616](https://github.com/EQEmu/Server/pull/4616)) @Akkadius 2025-01-27
|
|
||||||
|
|
||||||
### Performance
|
|
||||||
|
|
||||||
* Significantly Improve Client Network Resends ([#4629](https://github.com/EQEmu/Server/pull/4629)) @Akkadius 2025-02-01
|
|
||||||
|
|
||||||
## [22.62.1] 1/27/2025
|
|
||||||
|
|
||||||
### Memory Leak
|
|
||||||
|
|
||||||
* Revert "Change raw pointer to unique_ptr to avoid potential leak in dbg stream" ([#4616](https://github.com/EQEmu/Server/pull/4616)) @Akkadius 2025-01-27
|
|
||||||
|
|
||||||
### Performance
|
|
||||||
|
|
||||||
* Re-use ClientUpdate packet memory ([#4619](https://github.com/EQEmu/Server/pull/4619)) @Akkadius 2025-01-27
|
|
||||||
* Re-use OP_Animation packet ([#4621](https://github.com/EQEmu/Server/pull/4621)) @Akkadius 2025-01-27
|
|
||||||
* Re-use OP_Damage packet memory ([#4625](https://github.com/EQEmu/Server/pull/4625)) @Akkadius 2025-01-27
|
|
||||||
* Re-use OP_HPUpdate packet memory ([#4622](https://github.com/EQEmu/Server/pull/4622)) @Akkadius 2025-01-27
|
|
||||||
* Re-use OP_PlayerStateAdd packet memory ([#4626](https://github.com/EQEmu/Server/pull/4626)) @Akkadius 2025-01-27
|
|
||||||
* Re-use OP_SendFindableNPCs packet memory ([#4623](https://github.com/EQEmu/Server/pull/4623)) @Akkadius 2025-01-27
|
|
||||||
|
|
||||||
### Repop
|
|
||||||
|
|
||||||
* Make #repop instant ([#4620](https://github.com/EQEmu/Server/pull/4620)) @Akkadius 2025-01-27
|
|
||||||
|
|
||||||
## [22.62.0] 1/26/2025
|
|
||||||
|
|
||||||
### Bazaar
|
|
||||||
|
|
||||||
* Improve Bazaar Search Performance ([#4615](https://github.com/EQEmu/Server/pull/4615)) @neckkola 2025-01-27
|
|
||||||
|
|
||||||
### CLI
|
|
||||||
|
|
||||||
* Add --skip-backup to world database:updates ([#4605](https://github.com/EQEmu/Server/pull/4605)) @Akkadius 2025-01-22
|
|
||||||
|
|
||||||
### Database
|
|
||||||
|
|
||||||
* Change npc_types walkspeed to be of type float ([#4589](https://github.com/EQEmu/Server/pull/4589)) @Akkadius 2025-01-07
|
|
||||||
|
|
||||||
### Databuckets
|
|
||||||
|
|
||||||
* Add Account Scoped Databuckets ([#4603](https://github.com/EQEmu/Server/pull/4603)) @Akkadius 2025-01-21
|
|
||||||
* Implement Nested Databuckets ([#4604](https://github.com/EQEmu/Server/pull/4604)) @Akkadius 2025-01-27
|
|
||||||
|
|
||||||
### Feature
|
|
||||||
|
|
||||||
* Add Alternate Bazaar Search Approach ([#4600](https://github.com/EQEmu/Server/pull/4600)) @neckkola 2025-01-20
|
|
||||||
* Add Support for Item Previews ([#4599](https://github.com/EQEmu/Server/pull/4599)) @Kinglykrab 2025-01-20
|
|
||||||
* Evolving Item Support for RoF2 ([#4496](https://github.com/EQEmu/Server/pull/4496)) @neckkola 2025-01-20
|
|
||||||
* Implement Custom Pet Names ([#4594](https://github.com/EQEmu/Server/pull/4594)) @catapultam-habeo 2025-01-22
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
* Add Bazaar BulkSendTrader Limit for RoF2 ([#4590](https://github.com/EQEmu/Server/pull/4590)) @neckkola 2025-01-08
|
|
||||||
* CLI help menu from parsing correctly in World @Akkadius 2025-01-22
|
|
||||||
* Delete later in RemoveItem second case @Akkadius 2025-01-25
|
|
||||||
* Fix query error in character_evolving_items @Akkadius 2025-01-21
|
|
||||||
* Repair a memory leak in #summonitem ([#4591](https://github.com/EQEmu/Server/pull/4591)) @neckkola 2025-01-08
|
|
||||||
* Repair an incorrect safe_delete call memory leak. ([#4588](https://github.com/EQEmu/Server/pull/4588)) @neckkola 2025-01-07
|
|
||||||
* Repair levers opening the Evolving XP Transfer Window ([#4607](https://github.com/EQEmu/Server/pull/4607)) @neckkola 2025-01-23
|
|
||||||
* Update a few Bazaar RoF2 routines for memory leaks ([#4592](https://github.com/EQEmu/Server/pull/4592)) @neckkola 2025-01-08
|
|
||||||
* Update database version to match manifest @Akkadius 2025-01-21
|
|
||||||
* Update trader add/remove packets to limits for RoF2 ([#4595](https://github.com/EQEmu/Server/pull/4595)) @neckkola 2025-01-19
|
|
||||||
|
|
||||||
### Linux
|
|
||||||
|
|
||||||
* Implement KSM Kernel Samepage Merging with Maps ([#4601](https://github.com/EQEmu/Server/pull/4601)) @Akkadius 2025-01-21
|
|
||||||
|
|
||||||
### Memory Leak
|
|
||||||
|
|
||||||
* Change raw pointer to unique_ptr to avoid potential leak in dbg stream ([#4616](https://github.com/EQEmu/Server/pull/4616)) @KimLS 2025-01-27
|
|
||||||
* Fix leak in BuyTraderItemOutsideBazaar ([#4609](https://github.com/EQEmu/Server/pull/4609)) @Akkadius 2025-01-24
|
|
||||||
* Fix leak in Client::RemoveDuplicateLore ([#4614](https://github.com/EQEmu/Server/pull/4614)) @Akkadius 2025-01-24
|
|
||||||
* Fix leak in NPC::RemoveItem ([#4611](https://github.com/EQEmu/Server/pull/4611)) @Akkadius 2025-01-24
|
|
||||||
* Fix leak in QuestManager::varlink ([#4610](https://github.com/EQEmu/Server/pull/4610)) @Akkadius 2025-01-24
|
|
||||||
* Fix leaks in Client::Handle_OP_AugmentItem ([#4612](https://github.com/EQEmu/Server/pull/4612)) @Akkadius 2025-01-24
|
|
||||||
* Fix memory leak in Client::Handle_OP_MoveMultipleItems ([#4613](https://github.com/EQEmu/Server/pull/4613)) @Akkadius 2025-01-24
|
|
||||||
|
|
||||||
### Performance
|
|
||||||
|
|
||||||
* Client / NPC Position Update Optimizations ([#4602](https://github.com/EQEmu/Server/pull/4602)) @Akkadius 2025-01-21
|
|
||||||
|
|
||||||
### Quest API
|
|
||||||
|
|
||||||
* Add SetAAEXPPercentage to Perl/Lua ([#4597](https://github.com/EQEmu/Server/pull/4597)) @Kinglykrab 2025-01-19
|
|
||||||
|
|
||||||
### Zone
|
|
||||||
|
|
||||||
* Implement zone player count sharding ([#4536](https://github.com/EQEmu/Server/pull/4536)) @Akkadius 2025-01-08
|
|
||||||
|
|
||||||
## [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
|
## [22.60.0] 11/25/2024
|
||||||
|
|
||||||
### Bazaar
|
### Bazaar
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
+6
-37
@@ -22,7 +22,6 @@ SET(common_sources
|
|||||||
dbcore.cpp
|
dbcore.cpp
|
||||||
deity.cpp
|
deity.cpp
|
||||||
dynamic_zone_base.cpp
|
dynamic_zone_base.cpp
|
||||||
dynamic_zone_lockout.cpp
|
|
||||||
emu_constants.cpp
|
emu_constants.cpp
|
||||||
emu_limits.cpp
|
emu_limits.cpp
|
||||||
emu_opcodes.cpp
|
emu_opcodes.cpp
|
||||||
@@ -40,7 +39,7 @@ 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
|
||||||
extprofile.cpp
|
extprofile.cpp
|
||||||
discord/discord_manager.cpp
|
discord/discord_manager.cpp
|
||||||
faction.cpp
|
faction.cpp
|
||||||
@@ -89,7 +88,6 @@ SET(common_sources
|
|||||||
skills.cpp
|
skills.cpp
|
||||||
skill_caps.cpp
|
skill_caps.cpp
|
||||||
spdat.cpp
|
spdat.cpp
|
||||||
spdat_bot.cpp
|
|
||||||
strings.cpp
|
strings.cpp
|
||||||
struct_strategy.cpp
|
struct_strategy.cpp
|
||||||
textures.cpp
|
textures.cpp
|
||||||
@@ -99,7 +97,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
|
||||||
@@ -175,7 +172,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
|
||||||
@@ -213,9 +209,10 @@ SET(repositories
|
|||||||
repositories/base/base_discovered_items_repository.h
|
repositories/base/base_discovered_items_repository.h
|
||||||
repositories/base/base_doors_repository.h
|
repositories/base/base_doors_repository.h
|
||||||
repositories/base/base_dynamic_zones_repository.h
|
repositories/base/base_dynamic_zones_repository.h
|
||||||
repositories/base/base_dynamic_zone_lockouts_repository.h
|
|
||||||
repositories/base/base_dynamic_zone_members_repository.h
|
repositories/base/base_dynamic_zone_members_repository.h
|
||||||
repositories/base/base_dynamic_zone_templates_repository.h
|
repositories/base/base_dynamic_zone_templates_repository.h
|
||||||
|
repositories/base/base_expeditions_repository.h
|
||||||
|
repositories/base/base_expedition_lockouts_repository.h
|
||||||
repositories/base/base_faction_association_repository.h
|
repositories/base/base_faction_association_repository.h
|
||||||
repositories/base/base_faction_base_data_repository.h
|
repositories/base/base_faction_base_data_repository.h
|
||||||
repositories/base/base_faction_list_repository.h
|
repositories/base/base_faction_list_repository.h
|
||||||
@@ -243,7 +240,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
|
||||||
@@ -281,20 +277,8 @@ SET(repositories
|
|||||||
repositories/base/base_pets_equipmentset_repository.h
|
repositories/base/base_pets_equipmentset_repository.h
|
||||||
repositories/base/base_pets_equipmentset_entries_repository.h
|
repositories/base/base_pets_equipmentset_entries_repository.h
|
||||||
repositories/base/base_player_titlesets_repository.h
|
repositories/base/base_player_titlesets_repository.h
|
||||||
repositories/base/base_player_event_aa_purchase_repository.h
|
|
||||||
repositories/base/base_player_event_killed_npc_repository.h
|
|
||||||
repositories/base/base_player_event_killed_named_npc_repository.h
|
|
||||||
repositories/base/base_player_event_killed_raid_npc_repository.h
|
|
||||||
repositories/base/base_player_event_log_settings_repository.h
|
repositories/base/base_player_event_log_settings_repository.h
|
||||||
repositories/base/base_player_event_logs_repository.h
|
repositories/base/base_player_event_logs_repository.h
|
||||||
repositories/base/base_player_event_loot_items_repository.h
|
|
||||||
repositories/base/base_player_event_merchant_purchase_repository.h
|
|
||||||
repositories/base/base_player_event_merchant_sell_repository.h
|
|
||||||
repositories/base/base_player_event_npc_handin_repository.h
|
|
||||||
repositories/base/base_player_event_npc_handin_entries_repository.h
|
|
||||||
repositories/base/base_player_event_speech_repository.h
|
|
||||||
repositories/base/base_player_event_trade_repository.h
|
|
||||||
repositories/base/base_player_event_trade_entries_repository.h
|
|
||||||
repositories/base/base_quest_globals_repository.h
|
repositories/base/base_quest_globals_repository.h
|
||||||
repositories/base/base_raid_details_repository.h
|
repositories/base/base_raid_details_repository.h
|
||||||
repositories/base/base_raid_members_repository.h
|
repositories/base/base_raid_members_repository.h
|
||||||
@@ -371,7 +355,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
|
||||||
@@ -409,9 +392,10 @@ SET(repositories
|
|||||||
repositories/discovered_items_repository.h
|
repositories/discovered_items_repository.h
|
||||||
repositories/doors_repository.h
|
repositories/doors_repository.h
|
||||||
repositories/dynamic_zones_repository.h
|
repositories/dynamic_zones_repository.h
|
||||||
repositories/dynamic_zone_lockouts_repository.h
|
|
||||||
repositories/dynamic_zone_members_repository.h
|
repositories/dynamic_zone_members_repository.h
|
||||||
repositories/dynamic_zone_templates_repository.h
|
repositories/dynamic_zone_templates_repository.h
|
||||||
|
repositories/expeditions_repository.h
|
||||||
|
repositories/expedition_lockouts_repository.h
|
||||||
repositories/faction_association_repository.h
|
repositories/faction_association_repository.h
|
||||||
repositories/faction_base_data_repository.h
|
repositories/faction_base_data_repository.h
|
||||||
repositories/faction_list_repository.h
|
repositories/faction_list_repository.h
|
||||||
@@ -439,7 +423,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
|
||||||
@@ -477,20 +460,8 @@ SET(repositories
|
|||||||
repositories/pets_equipmentset_repository.h
|
repositories/pets_equipmentset_repository.h
|
||||||
repositories/pets_equipmentset_entries_repository.h
|
repositories/pets_equipmentset_entries_repository.h
|
||||||
repositories/player_titlesets_repository.h
|
repositories/player_titlesets_repository.h
|
||||||
repositories/player_event_aa_purchase_repository.h
|
|
||||||
repositories/player_event_killed_npc_repository.h
|
|
||||||
repositories/player_event_killed_named_npc_repository.h
|
|
||||||
repositories/player_event_killed_raid_npc_repository.h
|
|
||||||
repositories/player_event_log_settings_repository.h
|
repositories/player_event_log_settings_repository.h
|
||||||
repositories/player_event_logs_repository.h
|
repositories/player_event_logs_repository.h
|
||||||
repositories/player_event_loot_items_repository.h
|
|
||||||
repositories/player_event_merchant_purchase_repository.h
|
|
||||||
repositories/player_event_merchant_sell_repository.h
|
|
||||||
repositories/player_event_npc_handin_repository.h
|
|
||||||
repositories/player_event_npc_handin_entries_repository.h
|
|
||||||
repositories/player_event_speech_repository.h
|
|
||||||
repositories/player_event_trade_repository.h
|
|
||||||
repositories/player_event_trade_entries_repository.h
|
|
||||||
repositories/quest_globals_repository.h
|
repositories/quest_globals_repository.h
|
||||||
repositories/raid_details_repository.h
|
repositories/raid_details_repository.h
|
||||||
repositories/raid_members_repository.h
|
repositories/raid_members_repository.h
|
||||||
@@ -559,7 +530,6 @@ SET(common_headers
|
|||||||
discord/discord.h
|
discord/discord.h
|
||||||
discord/discord_manager.h
|
discord/discord_manager.h
|
||||||
dynamic_zone_base.h
|
dynamic_zone_base.h
|
||||||
dynamic_zone_lockout.h
|
|
||||||
emu_constants.h
|
emu_constants.h
|
||||||
emu_limits.h
|
emu_limits.h
|
||||||
emu_opcodes.h
|
emu_opcodes.h
|
||||||
@@ -585,7 +555,7 @@ 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
|
||||||
extprofile.h
|
extprofile.h
|
||||||
faction.h
|
faction.h
|
||||||
file.h
|
file.h
|
||||||
@@ -645,7 +615,6 @@ SET(common_headers
|
|||||||
server_event_scheduler.h
|
server_event_scheduler.h
|
||||||
serverinfo.h
|
serverinfo.h
|
||||||
servertalk.h
|
servertalk.h
|
||||||
server_reload_types.h
|
|
||||||
shared_tasks.h
|
shared_tasks.h
|
||||||
shareddb.h
|
shareddb.h
|
||||||
skills.h
|
skills.h
|
||||||
|
|||||||
+279
-252
@@ -6,17 +6,15 @@
|
|||||||
|
|
||||||
std::vector<BazaarSearchResultsFromDB_Struct>
|
std::vector<BazaarSearchResultsFromDB_Struct>
|
||||||
Bazaar::GetSearchResults(
|
Bazaar::GetSearchResults(
|
||||||
Database &db,
|
SharedDatabase &db,
|
||||||
Database &content_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,
|
||||||
@@ -28,11 +26,175 @@ 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
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static std::map<uint8, uint32> item_slot_searches_new = {
|
std::string search_criteria_trader("TRUE ");
|
||||||
|
|
||||||
|
if (search.search_scope == NonRoFBazaarSearchScope) {
|
||||||
|
search_criteria_trader.append(
|
||||||
|
fmt::format(
|
||||||
|
" AND trader.char_entity_id = {} AND trader.char_zone_id = {}",
|
||||||
|
search.trader_entity_id,
|
||||||
|
Zones::BAZAAR
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (search.search_scope == Local_Scope) {
|
||||||
|
search_criteria_trader.append(fmt::format(" AND trader.char_zone_id = {}", char_zone_id));
|
||||||
|
}
|
||||||
|
else if (search.trader_id > 0) {
|
||||||
|
search_criteria_trader.append(fmt::format(" AND trader.char_id = {}", search.trader_id));
|
||||||
|
}
|
||||||
|
if (search.min_cost != 0) {
|
||||||
|
search_criteria_trader.append(fmt::format(" AND trader.item_cost >= {}", search.min_cost * 1000));
|
||||||
|
}
|
||||||
|
if (search.max_cost != 0) {
|
||||||
|
search_criteria_trader.append(fmt::format(" AND trader.item_cost <= {}", (uint64) search.max_cost * 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
// not yet implemented
|
||||||
|
// if (search.prestige != 0) {
|
||||||
|
// 0xffffffff prestige only, 0xfffffffe non-prestige, 0 all
|
||||||
|
// search_criteria.append(fmt::format(" AND items.type = {} ", search.prestige));
|
||||||
|
// }
|
||||||
|
|
||||||
|
std::string query = fmt::format(
|
||||||
|
"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, "
|
||||||
|
"aug_slot_1, aug_slot_2, aug_slot_3, aug_slot_4, aug_slot_5, aug_slot_6 "
|
||||||
|
"FROM trader, character_data "
|
||||||
|
"WHERE {} AND trader.char_id = character_data.id "
|
||||||
|
"GROUP BY trader.item_sn, trader.item_charges, trader.char_id",
|
||||||
|
search_criteria_trader.c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
std::vector<BazaarSearchResultsFromDB_Struct> all_entries;
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(query);
|
||||||
|
|
||||||
|
if (!results.Success()) {
|
||||||
|
return all_entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ItemSearchType {
|
||||||
|
EQ::item::ItemType type;
|
||||||
|
bool condition;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AddititiveSearchCriteria {
|
||||||
|
bool should_check;
|
||||||
|
bool condition;
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto row: results) {
|
||||||
|
BazaarSearchResultsFromDB_Struct r{};
|
||||||
|
|
||||||
|
r.item_id = Strings::ToInt(row[2]);
|
||||||
|
r.charges = Strings::ToInt(row[4]);
|
||||||
|
|
||||||
|
auto item = db.GetItem(r.item_id);
|
||||||
|
if (!item) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 aug_slot_1 = Strings::ToUnsignedInt(row[11]);
|
||||||
|
uint32 aug_slot_2 = Strings::ToUnsignedInt(row[12]);
|
||||||
|
uint32 aug_slot_3 = Strings::ToUnsignedInt(row[13]);
|
||||||
|
uint32 aug_slot_4 = Strings::ToUnsignedInt(row[14]);
|
||||||
|
uint32 aug_slot_5 = Strings::ToUnsignedInt(row[15]);
|
||||||
|
uint32 aug_slot_6 = Strings::ToUnsignedInt(row[16]);
|
||||||
|
|
||||||
|
std::unique_ptr<EQ::ItemInstance> inst(
|
||||||
|
db.CreateItem(
|
||||||
|
item,
|
||||||
|
r.charges,
|
||||||
|
aug_slot_1,
|
||||||
|
aug_slot_2,
|
||||||
|
aug_slot_3,
|
||||||
|
aug_slot_4,
|
||||||
|
aug_slot_5,
|
||||||
|
aug_slot_6
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!inst->GetItem()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
r.count = Strings::ToInt(row[0]);
|
||||||
|
r.trader_id = Strings::ToInt(row[1]);
|
||||||
|
r.serial_number = Strings::ToInt(row[3]);
|
||||||
|
r.cost = Strings::ToInt(row[5]);
|
||||||
|
r.slot_id = Strings::ToInt(row[6]);
|
||||||
|
r.sum_charges = Strings::ToInt(row[7]);
|
||||||
|
r.stackable = item->Stackable;
|
||||||
|
r.icon_id = item->Icon;
|
||||||
|
r.trader_zone_id = Strings::ToInt(row[8]);
|
||||||
|
r.trader_entity_id = Strings::ToInt(row[9]);
|
||||||
|
r.serial_number_RoF = fmt::format("{:016}\0", Strings::ToInt(row[3]));
|
||||||
|
r.item_name = fmt::format("{:.63}\0", item->Name);
|
||||||
|
r.trader_name = fmt::format("{:.63}\0", std::string(row[10]).c_str());
|
||||||
|
|
||||||
|
LogTradingDetail(
|
||||||
|
"Searching against item [{}] ({}) for trader [{}]",
|
||||||
|
item->Name,
|
||||||
|
item->ID,
|
||||||
|
r.trader_name
|
||||||
|
);
|
||||||
|
|
||||||
|
// item stat searches
|
||||||
|
std::map<uint32, uint32> item_stat_searches = {
|
||||||
|
|
||||||
|
{STAT_AC, inst->GetItemArmorClass(true)},
|
||||||
|
{STAT_AGI, static_cast<uint32>(inst->GetItemAgi(true))},
|
||||||
|
{STAT_CHA, static_cast<uint32>(inst->GetItemCha(true))},
|
||||||
|
{STAT_DEX, static_cast<uint32>(inst->GetItemDex(true))},
|
||||||
|
{STAT_INT, static_cast<uint32>(inst->GetItemInt(true))},
|
||||||
|
{STAT_STA, static_cast<uint32>(inst->GetItemSta(true))},
|
||||||
|
{STAT_STR, static_cast<uint32>(inst->GetItemStr(true))},
|
||||||
|
{STAT_WIS, static_cast<uint32>(inst->GetItemWis(true))},
|
||||||
|
{STAT_COLD, static_cast<uint32>(inst->GetItemCR(true))},
|
||||||
|
{STAT_DISEASE, static_cast<uint32>(inst->GetItemDR(true))},
|
||||||
|
{STAT_FIRE, static_cast<uint32>(inst->GetItemFR(true))},
|
||||||
|
{STAT_MAGIC, static_cast<uint32>(inst->GetItemMR(true))},
|
||||||
|
{STAT_POISON, static_cast<uint32>(inst->GetItemPR(true))},
|
||||||
|
{STAT_HP, static_cast<uint32>(inst->GetItemHP(true))},
|
||||||
|
{STAT_MANA, static_cast<uint32>(inst->GetItemMana(true))},
|
||||||
|
{STAT_ENDURANCE, static_cast<uint32>(inst->GetItemEndur(true))},
|
||||||
|
{STAT_ATTACK, static_cast<uint32>(inst->GetItemAttack(true))},
|
||||||
|
{STAT_HP_REGEN, static_cast<uint32>(inst->GetItemRegen(true))},
|
||||||
|
{STAT_MANA_REGEN, static_cast<uint32>(inst->GetItemManaRegen(true))},
|
||||||
|
{STAT_HASTE, static_cast<uint32>(inst->GetItemHaste(true))},
|
||||||
|
{STAT_DAMAGE_SHIELD, static_cast<uint32>(inst->GetItemDamageShield(true))},
|
||||||
|
{STAT_DS_MITIGATION, static_cast<uint32>(inst->GetItemDSMitigation(true))},
|
||||||
|
{STAT_HEAL_AMOUNT, static_cast<uint32>(inst->GetItemHealAmt(true))},
|
||||||
|
{STAT_SPELL_DAMAGE, static_cast<uint32>(inst->GetItemSpellDamage(true))},
|
||||||
|
{STAT_CLAIRVOYANCE, static_cast<uint32>(inst->GetItemClairvoyance(true))},
|
||||||
|
{STAT_HEROIC_AGILITY, static_cast<uint32>(inst->GetItemHeroicAgi(true))},
|
||||||
|
{STAT_HEROIC_CHARISMA, static_cast<uint32>(inst->GetItemHeroicCha(true))},
|
||||||
|
{STAT_HEROIC_DEXTERITY, static_cast<uint32>(inst->GetItemHeroicDex(true))},
|
||||||
|
{STAT_HEROIC_INTELLIGENCE, static_cast<uint32>(inst->GetItemHeroicInt(true))},
|
||||||
|
{STAT_HEROIC_STAMINA, static_cast<uint32>(inst->GetItemHeroicSta(true))},
|
||||||
|
{STAT_HEROIC_STRENGTH, static_cast<uint32>(inst->GetItemHeroicStr(true))},
|
||||||
|
{STAT_HEROIC_WISDOM, static_cast<uint32>(inst->GetItemHeroicWis(true))},
|
||||||
|
{STAT_BASH, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillBash, true))},
|
||||||
|
{STAT_BACKSTAB, static_cast<uint32>(inst->GetItemBackstabDamage(true))},
|
||||||
|
{STAT_DRAGON_PUNCH, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillDragonPunch, true))},
|
||||||
|
{STAT_EAGLE_STRIKE, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillEagleStrike, true))},
|
||||||
|
{STAT_FLYING_KICK, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillFlyingKick, true))},
|
||||||
|
{STAT_KICK, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillKick, true))},
|
||||||
|
{STAT_ROUND_KICK, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillRoundKick, true))},
|
||||||
|
{STAT_TIGER_CLAW, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillTigerClaw, true))},
|
||||||
|
{STAT_FRENZY, static_cast<uint32>(inst->GetItemSkillsStat(EQ::skills::SkillFrenzy, true))},
|
||||||
|
};
|
||||||
|
|
||||||
|
r.item_stat = item_stat_searches.contains(search.item_stat) ? item_stat_searches[search.item_stat] : 0;
|
||||||
|
if (item_stat_searches.contains(search.item_stat) && item_stat_searches[search.item_stat] <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::map<uint8, uint32> item_slot_searches = {
|
||||||
{EQ::invslot::slotCharm, 1},
|
{EQ::invslot::slotCharm, 1},
|
||||||
{EQ::invslot::slotEar1, 2},
|
{EQ::invslot::slotEar1, 2},
|
||||||
{EQ::invslot::slotHead, 4},
|
{EQ::invslot::slotHead, 4},
|
||||||
@@ -58,268 +220,133 @@ Bazaar::GetSearchResults(
|
|||||||
{EQ::invslot::slotAmmo, 4194304},
|
{EQ::invslot::slotAmmo, 4194304},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ItemSearchType {
|
auto GetEquipmentSlotBit = [&](uint32 slot) -> uint32 {
|
||||||
EQ::item::ItemType type;
|
return item_slot_searches.contains(slot) ? item_slot_searches[slot] : 0;
|
||||||
std::string condition;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<ItemSearchType> item_search_types_new = {
|
auto FindItemAugSlot = [&]() -> bool {
|
||||||
{EQ::item::ItemType::ItemTypeBook, " AND (items.itemclass = 2 or items.itemclass = 31)"},
|
for (auto const &s: inst->GetItem()->AugSlotType) {
|
||||||
{EQ::item::ItemType::ItemTypeContainer, " AND (items.itemclass = 1 or items.itemclass = 67)"},
|
return s == search.augment;
|
||||||
{EQ::item::ItemType::ItemTypeAllEffects, " AND (items.scrolleffect > 0 && items.scrolleffect < 65000)"},
|
}
|
||||||
{EQ::item::ItemType::ItemTypeUnknown9, " AND items.worneffect = 998"},
|
return false;
|
||||||
{EQ::item::ItemType::ItemTypeUnknown10, " AND (items.worneffect >= 1298 && items.worneffect <= 1307)"},
|
|
||||||
{EQ::item::ItemType::ItemTypeFocusEffect, " AND items.focuseffect > 0"},
|
|
||||||
{EQ::item::ItemType::ItemTypeArmor, " AND items.itemtype = 10"},
|
|
||||||
{EQ::item::ItemType::ItemType1HBlunt, " AND items.itemtype = 3"},
|
|
||||||
{EQ::item::ItemType::ItemType1HPiercing, " AND items.itemtype = 2"},
|
|
||||||
{EQ::item::ItemType::ItemType1HSlash, " AND items.itemtype = 0"},
|
|
||||||
{EQ::item::ItemType::ItemType2HBlunt, " AND items.itemtype = 4"},
|
|
||||||
{EQ::item::ItemType::ItemType2HSlash, " AND items.itemtype = 1"},
|
|
||||||
{EQ::item::ItemType::ItemTypeBow, " AND items.itemtype = 5"},
|
|
||||||
{EQ::item::ItemType::ItemTypeShield, " AND items.itemtype = 8"},
|
|
||||||
{EQ::item::ItemType::ItemTypeMisc, " AND items.itemtype = 11"},
|
|
||||||
{EQ::item::ItemType::ItemTypeFood, " AND items.itemtype = 14"},
|
|
||||||
{EQ::item::ItemType::ItemTypeDrink, " AND items.itemtype = 15"},
|
|
||||||
{EQ::item::ItemType::ItemTypeLight, " AND items.itemtype = 16"},
|
|
||||||
{EQ::item::ItemType::ItemTypeCombinable, " AND items.itemtype = 17"},
|
|
||||||
{EQ::item::ItemType::ItemTypeBandage, " AND items.itemtype = 18"},
|
|
||||||
{EQ::item::ItemType::ItemTypeSmallThrowing, " AND (items.itemtype = 19 OR items.itemtype = 7)"},
|
|
||||||
{EQ::item::ItemType::ItemTypeSpell, " AND items.itemtype = 20"},
|
|
||||||
{EQ::item::ItemType::ItemTypePotion, " AND items.itemtype = 21"},
|
|
||||||
{EQ::item::ItemType::ItemTypeBrassInstrument, " AND items.itemtype = 25"},
|
|
||||||
{EQ::item::ItemType::ItemTypeWindInstrument, " AND items.itemtype = 23"},
|
|
||||||
{EQ::item::ItemType::ItemTypeStringedInstrument, " AND items.itemtype = 24"},
|
|
||||||
{EQ::item::ItemType::ItemTypePercussionInstrument, " AND items.itemtype = 26"},
|
|
||||||
{EQ::item::ItemType::ItemTypeArrow, " AND items.itemtype = 27"},
|
|
||||||
{EQ::item::ItemType::ItemTypeJewelry, " AND items.itemtype = 29"},
|
|
||||||
{EQ::item::ItemType::ItemTypeNote, " AND items.itemtype = 32"},
|
|
||||||
{EQ::item::ItemType::ItemTypeKey, " AND items.itemtype = 33"},
|
|
||||||
{EQ::item::ItemType::ItemType2HPiercing, " AND items.itemtype = 35"},
|
|
||||||
{EQ::item::ItemType::ItemTypeAlcohol, " AND items.itemtype = 38"},
|
|
||||||
{EQ::item::ItemType::ItemTypeMartial, " AND items.itemtype = 45"},
|
|
||||||
{EQ::item::ItemType::ItemTypeAugmentation, " AND items.itemtype = 54"},
|
|
||||||
{EQ::item::ItemType::ItemTypeAlternateAbility, " AND items.itemtype = 57"},
|
|
||||||
{EQ::item::ItemType::ItemTypeCount, " AND items.itemtype = 65"},
|
|
||||||
{EQ::item::ItemType::ItemTypeCollectible, " AND items.itemtype = 66"}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// item stat searches
|
// item type searches
|
||||||
struct ItemStatSearch {
|
std::vector<ItemSearchType> item_search_types = {
|
||||||
std::string query_string;
|
{EQ::item::ItemType::ItemTypeAll, true},
|
||||||
EQ::skills::SkillType skill_type;
|
{EQ::item::ItemType::ItemTypeBook, item->ItemClass == EQ::item::ItemType::ItemTypeBook},
|
||||||
|
{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::ItemTypeUnknown9, item->Worn.Effect == 998},
|
||||||
|
{EQ::item::ItemType::ItemTypeUnknown10, item->Worn.Effect >= 1298 && item->Worn.Effect <= 1307},
|
||||||
|
{EQ::item::ItemType::ItemTypeFocusEffect, item->Focus.Effect > 0},
|
||||||
|
{EQ::item::ItemType::ItemTypeArmor, item->ItemType == EQ::item::ItemType::ItemTypeArmor},
|
||||||
|
{EQ::item::ItemType::ItemType1HBlunt, item->ItemType == EQ::item::ItemType::ItemType1HBlunt},
|
||||||
|
{EQ::item::ItemType::ItemType1HPiercing, item->ItemType == EQ::item::ItemType::ItemType1HPiercing},
|
||||||
|
{EQ::item::ItemType::ItemType1HSlash, item->ItemType == EQ::item::ItemType::ItemType1HSlash},
|
||||||
|
{EQ::item::ItemType::ItemType2HBlunt, item->ItemType == EQ::item::ItemType::ItemType2HBlunt},
|
||||||
|
{EQ::item::ItemType::ItemType2HSlash, item->ItemType == EQ::item::ItemType::ItemType2HSlash},
|
||||||
|
{EQ::item::ItemType::ItemTypeBow, item->ItemType == EQ::item::ItemType::ItemTypeBow},
|
||||||
|
{EQ::item::ItemType::ItemTypeShield, item->ItemType == EQ::item::ItemType::ItemTypeShield},
|
||||||
|
{EQ::item::ItemType::ItemTypeMisc, item->ItemType == EQ::item::ItemType::ItemTypeMisc},
|
||||||
|
{EQ::item::ItemType::ItemTypeFood, item->ItemType == EQ::item::ItemType::ItemTypeFood},
|
||||||
|
{EQ::item::ItemType::ItemTypeDrink, item->ItemType == EQ::item::ItemType::ItemTypeDrink},
|
||||||
|
{EQ::item::ItemType::ItemTypeLight, item->ItemType == EQ::item::ItemType::ItemTypeLight},
|
||||||
|
{EQ::item::ItemType::ItemTypeCombinable, item->ItemType == EQ::item::ItemType::ItemTypeCombinable},
|
||||||
|
{EQ::item::ItemType::ItemTypeBandage, item->ItemType == EQ::item::ItemType::ItemTypeBandage},
|
||||||
|
{EQ::item::ItemType::ItemTypeSmallThrowing, item->ItemType == EQ::item::ItemType::ItemTypeSmallThrowing ||
|
||||||
|
item->ItemType == EQ::item::ItemType::ItemTypeLargeThrowing},
|
||||||
|
{EQ::item::ItemType::ItemTypeSpell, item->ItemType == EQ::item::ItemType::ItemTypeSpell},
|
||||||
|
{EQ::item::ItemType::ItemTypePotion, item->ItemType == EQ::item::ItemType::ItemTypePotion},
|
||||||
|
{EQ::item::ItemType::ItemTypeBrassInstrument, item->ItemType == EQ::item::ItemType::ItemTypeBrassInstrument},
|
||||||
|
{EQ::item::ItemType::ItemTypeWindInstrument, item->ItemType == EQ::item::ItemType::ItemTypeWindInstrument},
|
||||||
|
{EQ::item::ItemType::ItemTypeStringedInstrument, item->ItemType == EQ::item::ItemType::ItemTypeStringedInstrument},
|
||||||
|
{EQ::item::ItemType::ItemTypePercussionInstrument, item->ItemType == EQ::item::ItemType::ItemTypePercussionInstrument},
|
||||||
|
{EQ::item::ItemType::ItemTypeArrow, item->ItemType == EQ::item::ItemType::ItemTypeArrow},
|
||||||
|
{EQ::item::ItemType::ItemTypeJewelry, item->ItemType == EQ::item::ItemType::ItemTypeJewelry},
|
||||||
|
{EQ::item::ItemType::ItemTypeNote, item->ItemType == EQ::item::ItemType::ItemTypeNote},
|
||||||
|
{EQ::item::ItemType::ItemTypeKey, item->ItemType == EQ::item::ItemType::ItemTypeKey},
|
||||||
|
{EQ::item::ItemType::ItemType2HPiercing, item->ItemType == EQ::item::ItemType::ItemType2HPiercing},
|
||||||
|
{EQ::item::ItemType::ItemTypeAlcohol, item->ItemType == EQ::item::ItemType::ItemTypeAlcohol},
|
||||||
|
{EQ::item::ItemType::ItemTypeMartial, item->ItemType == EQ::item::ItemType::ItemTypeMartial},
|
||||||
|
{EQ::item::ItemType::ItemTypeAugmentation, item->ItemType == EQ::item::ItemType::ItemTypeAugmentation},
|
||||||
|
{EQ::item::ItemType::ItemTypeAlternateAbility, item->ItemType == EQ::item::ItemType::ItemTypeAlternateAbility},
|
||||||
|
{EQ::item::ItemType::ItemTypeCount, item->ItemType == EQ::item::ItemType::ItemTypeCount},
|
||||||
|
{EQ::item::ItemType::ItemTypeCollectible, item->ItemType == EQ::item::ItemType::ItemTypeCollectible}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::map<uint32, ItemStatSearch> item_stat_searches_new = {
|
bool met_filter = false;
|
||||||
{STAT_AC, {" items.ac" , static_cast<EQ::skills::SkillType>(0)} },
|
bool has_filter = false;
|
||||||
{STAT_AGI, {" items.aagi", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_CHA, {" items.acha", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_DEX, {" items.adex", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_INT, {" items.aint", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_STA, {" items.asta", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_STR, {" items.astr", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_WIS, {" items.awis", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_COLD, {" items.cr", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_DISEASE, {" items.dr", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_FIRE, {" items.fr", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_MAGIC, {" items.mr", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_POISON, {" items.pr", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HP, {" items.hp", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_MANA, {" items.mana", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_ENDURANCE, {" items.endur", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_ATTACK, {" items.attack", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HP_REGEN, {" items.regen", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_MANA_REGEN, {" items.manaregen", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HASTE, {" items.haste", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_DAMAGE_SHIELD, {" items.damageshield", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_DS_MITIGATION, {" items.dsmitigation", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEAL_AMOUNT, {" items.healamt", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_SPELL_DAMAGE, {" items.spelldmg", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_CLAIRVOYANCE, {" items.clairvoyance", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEROIC_AGILITY, {" items.heroic_agi", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEROIC_CHARISMA, {" items.heroic_cha", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEROIC_DEXTERITY, {" items.heroic_dex", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEROIC_INTELLIGENCE, {" items.heroic_int", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEROIC_STAMINA, {" items.heroic_sta", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEROIC_STRENGTH, {" items.heroic_str", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_HEROIC_WISDOM, {" items.heroic_wis", static_cast<EQ::skills::SkillType>(0)} },
|
|
||||||
{STAT_BASH, {" items.skillmodvalue", EQ::skills::SkillBash} },
|
|
||||||
{STAT_BACKSTAB, {" items.backstabdmg", EQ::skills::SkillBackstab} },
|
|
||||||
{STAT_DRAGON_PUNCH, {" items.skillmodvalue", EQ::skills::SkillDragonPunch} },
|
|
||||||
{STAT_EAGLE_STRIKE, {" items.skillmodvalue", EQ::skills::SkillEagleStrike} },
|
|
||||||
{STAT_FLYING_KICK, {" items.skillmodvalue", EQ::skills::SkillFlyingKick} },
|
|
||||||
{STAT_KICK, {" items.skillmodvalue", EQ::skills::SkillKick} },
|
|
||||||
{STAT_ROUND_KICK, {" items.skillmodvalue", EQ::skills::SkillRoundKick} },
|
|
||||||
{STAT_TIGER_CLAW, {" items.skillmodvalue", EQ::skills::SkillTigerClaw} },
|
|
||||||
{STAT_FRENZY, {" items.skillmodvalue", EQ::skills::SkillFrenzy} },
|
|
||||||
};
|
|
||||||
|
|
||||||
bool convert = false;
|
for (auto &i: item_search_types) {
|
||||||
std::string search_criteria_trader("TRUE");
|
if (i.type == search.type) {
|
||||||
std::string field_criteria_items("FALSE");
|
has_filter = true;
|
||||||
std::string where_criteria_items(" TRUE ");
|
if (i.condition) {
|
||||||
|
LogTradingDetail("Item [{}] met search criteria for type [{}]", item->Name, uint8(i.type));
|
||||||
if (search.search_scope == NonRoFBazaarSearchScope) {
|
met_filter = true;
|
||||||
search_criteria_trader.append(
|
|
||||||
fmt::format(
|
|
||||||
" AND trader.char_entity_id = {} AND trader.char_zone_id = {} AND trader.char_zone_instance_id = {}",
|
|
||||||
search.trader_entity_id,
|
|
||||||
Zones::BAZAAR,
|
|
||||||
char_zone_instance_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (search.search_scope == Local_Scope) {
|
|
||||||
search_criteria_trader.append(fmt::format(
|
|
||||||
" AND trader.char_zone_id = {} AND trader.char_zone_instance_id = {}",
|
|
||||||
char_zone_id,
|
|
||||||
char_zone_instance_id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
search_criteria_trader.append(fmt::format(" AND trader.char_id = {}", search.trader_id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.min_cost != 0) {
|
|
||||||
search_criteria_trader.append(fmt::format(" AND trader.item_cost >= {}", search.min_cost * 1000));
|
|
||||||
}
|
|
||||||
if (search.max_cost != 0) {
|
|
||||||
search_criteria_trader.append(fmt::format(" AND trader.item_cost <= {}", (uint64) search.max_cost * 1000));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.slot != std::numeric_limits<uint32>::max()) {
|
|
||||||
if (item_slot_searches_new.contains(search.slot)) {
|
|
||||||
where_criteria_items.append(
|
|
||||||
fmt::format(" AND items.slots & {0} = {0}", item_slot_searches_new[search.slot]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.type != std::numeric_limits<uint32>::max()) {
|
|
||||||
for (auto const &[type, condition]: item_search_types_new) {
|
|
||||||
if (type == search.type) {
|
|
||||||
where_criteria_items.append(condition);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (has_filter && !met_filter) {
|
||||||
if (search.race != std::numeric_limits<uint32>::max()) {
|
|
||||||
where_criteria_items.append(
|
|
||||||
fmt::format(" AND items.races & {0} = {0}", GetPlayerRaceBit(GetRaceIDFromPlayerRaceValue(search.race))));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search._class != std::numeric_limits<uint32>::max()) {
|
|
||||||
where_criteria_items.append(fmt::format(" AND items.classes & {0} = {0}", GetPlayerClassBit(search._class)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.item_stat != std::numeric_limits<uint32>::max()) {
|
|
||||||
if (item_stat_searches_new.contains(search.item_stat)) {
|
|
||||||
field_criteria_items = fmt::format("{}", item_stat_searches_new[search.item_stat].query_string);
|
|
||||||
if (item_stat_searches_new[search.item_stat].skill_type) {
|
|
||||||
where_criteria_items.append(
|
|
||||||
fmt::format(" AND items.skillmodtype = {} ", item_stat_searches_new[search.item_stat].skill_type));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
where_criteria_items.append(
|
|
||||||
fmt::format(" AND {} > 0 ", item_stat_searches_new[search.item_stat].query_string));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.augment) {
|
|
||||||
where_criteria_items.append(fmt::format(
|
|
||||||
" AND (items.augslot1type = {0} OR "
|
|
||||||
"items.augslot2type = {0} OR "
|
|
||||||
"items.augslot3type = {0} OR "
|
|
||||||
"items.augslot4type = {0} OR "
|
|
||||||
"items.augslot5type = {0} OR "
|
|
||||||
"items.augslot6type = {0})",
|
|
||||||
search.augment)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.min_level != 1) {
|
|
||||||
where_criteria_items.append(fmt::format(" AND items.reclevel >= {}", search.min_level));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search.max_level != 100) {
|
|
||||||
where_criteria_items.append(fmt::format(" AND items.reclevel <= {}", search.max_level));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<BazaarSearchResultsFromDB_Struct> all_entries;
|
|
||||||
std::vector<std::string> trader_items_ids{};
|
|
||||||
|
|
||||||
auto const trader_results = TraderRepository::GetBazaarTraderDetails(db, search_criteria_trader);
|
|
||||||
if (trader_results.empty()) {
|
|
||||||
LogTradingDetail("Bazaar - No traders found in bazaar search.");
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto const &i: trader_results) {
|
|
||||||
trader_items_ids.push_back(std::to_string(i.trader.item_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
auto const item_results = ItemsRepository::GetItemsForBazaarSearch(
|
|
||||||
content_db,
|
|
||||||
trader_items_ids,
|
|
||||||
std::string(search.item_name),
|
|
||||||
field_criteria_items,
|
|
||||||
where_criteria_items
|
|
||||||
);
|
|
||||||
|
|
||||||
if (item_results.empty()) {
|
|
||||||
LogTradingDetail("Bazaar - No items found in bazaar search.");
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
all_entries.reserve(trader_results.size());
|
|
||||||
|
|
||||||
for (auto const& t:trader_results) {
|
|
||||||
if (!item_results.contains(t.trader.item_id)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BazaarSearchResultsFromDB_Struct r{};
|
// TODO: Add catch-all item type filter for specific item types
|
||||||
r.count = 1;
|
|
||||||
r.trader_id = t.trader.char_id;
|
|
||||||
r.serial_number = t.trader.item_sn;
|
|
||||||
r.cost = t.trader.item_cost;
|
|
||||||
r.slot_id = t.trader.slot_id;
|
|
||||||
r.charges = t.trader.item_charges;
|
|
||||||
r.stackable = item_results.at(t.trader.item_id).stackable;
|
|
||||||
r.icon_id = item_results.at(t.trader.item_id).icon;
|
|
||||||
r.trader_zone_id = t.trader.char_zone_id;
|
|
||||||
r.trader_zone_instance_id = t.trader.char_zone_instance_id;
|
|
||||||
r.trader_entity_id = t.trader.char_entity_id;
|
|
||||||
r.serial_number_RoF = fmt::format("{:016}\0", t.trader.item_sn);
|
|
||||||
r.item_name = fmt::format("{:.63}\0", item_results.at(t.trader.item_id).name);
|
|
||||||
r.trader_name = fmt::format("{:.63}\0", t.trader_name);
|
|
||||||
r.item_stat = item_results.at(t.trader.item_id).stats;
|
|
||||||
|
|
||||||
if (RuleB(Bazaar, UseAlternateBazaarSearch)) {
|
// item additive searches
|
||||||
if (convert ||
|
std::vector<AddititiveSearchCriteria> item_additive_searches = {
|
||||||
char_zone_id != Zones::BAZAAR ||
|
{
|
||||||
(char_zone_id == Zones::BAZAAR && r.trader_zone_instance_id != char_zone_instance_id)
|
.should_check = search.min_level != 1 && inst->GetItemRequiredLevel(true) > 0,
|
||||||
) {
|
.condition = inst->GetItemRequiredLevel(true) >= search.min_level
|
||||||
r.trader_id = TraderRepository::TRADER_CONVERT_ID + r.trader_zone_instance_id;
|
},
|
||||||
|
{
|
||||||
|
.should_check = search.max_level != 1 && inst->GetItemRequiredLevel(true) > 0,
|
||||||
|
.condition = inst->GetItemRequiredLevel(true) <= search.max_level
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.should_check = !std::string(search.item_name).empty(),
|
||||||
|
.condition = Strings::ContainsLower(item->Name, search.item_name)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.should_check = search._class != 0xFFFFFFFF,
|
||||||
|
.condition = static_cast<bool>(item->Classes & GetPlayerClassBit(search._class))
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.should_check = search.race != 0xFFFFFFFF,
|
||||||
|
.condition = static_cast<bool>(item->Races & GetPlayerRaceBit(GetRaceIDFromPlayerRaceValue(search.race)))
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.should_check = search.augment != 0,
|
||||||
|
.condition = FindItemAugSlot()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.should_check = search.slot != 0xFFFFFFFF,
|
||||||
|
.condition = static_cast<bool>(item->Slots & GetEquipmentSlotBit(search.slot))
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
bool should_add = true;
|
||||||
|
|
||||||
|
for (auto &i: item_additive_searches) {
|
||||||
|
LogTradingDetail(
|
||||||
|
"Checking item [{}] for search criteria - should_check [{}] condition [{}]",
|
||||||
|
item->Name,
|
||||||
|
i.should_check,
|
||||||
|
i.condition
|
||||||
|
);
|
||||||
|
if (i.should_check && !i.condition) {
|
||||||
|
should_add = false;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!should_add) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogTradingDetail("Found item [{}] meeting search criteria.", r.item_name);
|
||||||
all_entries.push_back(r);
|
all_entries.push_back(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -3,13 +3,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "shareddb.h"
|
#include "shareddb.h"
|
||||||
#include "../../common/item_instance.h"
|
|
||||||
|
|
||||||
class Bazaar {
|
class Bazaar {
|
||||||
public:
|
public:
|
||||||
static std::vector<BazaarSearchResultsFromDB_Struct>
|
static std::vector<BazaarSearchResultsFromDB_Struct>
|
||||||
GetSearchResults(Database &content_db, Database &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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -131,8 +131,6 @@ static std::map<uint8, std::string> class_names = {
|
|||||||
#define ARMOR_TYPE_LAST ARMOR_TYPE_PLATE
|
#define ARMOR_TYPE_LAST ARMOR_TYPE_PLATE
|
||||||
#define ARMOR_TYPE_COUNT 5
|
#define ARMOR_TYPE_COUNT 5
|
||||||
|
|
||||||
#define BOT_CLASS_BASE_ID_PREFIX 3000
|
|
||||||
|
|
||||||
|
|
||||||
const char* GetClassIDName(uint8 class_id, uint8 level = 0);
|
const char* GetClassIDName(uint8 class_id, uint8 level = 0);
|
||||||
|
|
||||||
|
|||||||
@@ -294,8 +294,6 @@ void print_trace()
|
|||||||
SendCrashReport(crash_report);
|
SendCrashReport(crash_report);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-80
@@ -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
|
||||||
@@ -245,7 +244,7 @@ uint32 Database::CreateAccount(
|
|||||||
e.password = password;
|
e.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo("Account attempting to be created loginserver [{}] name [{}] status [{}]", loginserver, name, status);
|
LogInfo("Account Attempting to be created: [{}:{}] status: {}", loginserver, name, status);
|
||||||
|
|
||||||
e = AccountRepository::InsertOne(*this, e);
|
e = AccountRepository::InsertOne(*this, e);
|
||||||
|
|
||||||
@@ -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;
|
||||||
@@ -1867,35 +1860,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 +1868,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 +1918,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 +1950,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 +1959,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2157,12 +2102,12 @@ void Database::PurgeCharacterParcels()
|
|||||||
for (auto const &r: results) {
|
for (auto const &r: results) {
|
||||||
pd.from_name = r.from_name;
|
pd.from_name = r.from_name;
|
||||||
pd.item_id = r.item_id;
|
pd.item_id = r.item_id;
|
||||||
pd.augment_1_id = r.aug_slot_1;
|
pd.aug_slot_1 = r.aug_slot_1;
|
||||||
pd.augment_2_id = r.aug_slot_2;
|
pd.aug_slot_2 = r.aug_slot_2;
|
||||||
pd.augment_3_id = r.aug_slot_3;
|
pd.aug_slot_3 = r.aug_slot_3;
|
||||||
pd.augment_4_id = r.aug_slot_4;
|
pd.aug_slot_4 = r.aug_slot_4;
|
||||||
pd.augment_5_id = r.aug_slot_5;
|
pd.aug_slot_5 = r.aug_slot_5;
|
||||||
pd.augment_6_id = r.aug_slot_6;
|
pd.aug_slot_6 = r.aug_slot_6;
|
||||||
pd.note = r.note;
|
pd.note = r.note;
|
||||||
pd.quantity = r.quantity;
|
pd.quantity = r.quantity;
|
||||||
pd.sent_date = r.sent_date;
|
pd.sent_date = r.sent_date;
|
||||||
@@ -2202,20 +2147,3 @@ void Database::ClearBuyerDetails()
|
|||||||
{
|
{
|
||||||
BuyerRepository::DeleteBuyer(*this, 0);
|
BuyerRepository::DeleteBuyer(*this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Database::GetNextTableId(const std::string &table_name)
|
|
||||||
{
|
|
||||||
auto results = QueryDatabase(fmt::format("SHOW TABLE STATUS LIKE '{}'", table_name));
|
|
||||||
|
|
||||||
for (auto row: results) {
|
|
||||||
for (int row_index = 0; row_index < results.ColumnCount(); row_index++) {
|
|
||||||
std::string field_name = Strings::ToLower(results.FieldName(row_index));
|
|
||||||
if (field_name == "auto_increment") {
|
|
||||||
std::string value = row[row_index] ? row[row_index] : "null";
|
|
||||||
return Strings::ToUnsignedBigInt(value, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -274,8 +274,6 @@ public:
|
|||||||
void Encode(std::string &in);
|
void Encode(std::string &in);
|
||||||
void Decode(std::string &in);
|
void Decode(std::string &in);
|
||||||
|
|
||||||
uint64_t GetNextTableId(const std::string& table_name);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex Mvarcache;
|
Mutex Mvarcache;
|
||||||
VarCache_Struct varcache;
|
VarCache_Struct varcache;
|
||||||
|
|||||||
@@ -136,6 +136,11 @@ std::string DatabaseDumpService::GetLoginTableList()
|
|||||||
return Strings::Join(DatabaseSchema::GetLoginTables(), " ");
|
return Strings::Join(DatabaseSchema::GetLoginTables(), " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string DatabaseDumpService::GetQueryServTables()
|
||||||
|
{
|
||||||
|
return Strings::Join(DatabaseSchema::GetQueryServerTables(), " ");
|
||||||
|
}
|
||||||
|
|
||||||
std::string DatabaseDumpService::GetSystemTablesList()
|
std::string DatabaseDumpService::GetSystemTablesList()
|
||||||
{
|
{
|
||||||
auto system_tables = DatabaseSchema::GetServerTables();
|
auto system_tables = DatabaseSchema::GetServerTables();
|
||||||
@@ -267,6 +272,11 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
tables_to_dump += GetLoginTableList() + " ";
|
tables_to_dump += GetLoginTableList() + " ";
|
||||||
dump_descriptor += "-login";
|
dump_descriptor += "-login";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsDumpQueryServerTables()) {
|
||||||
|
tables_to_dump += GetQueryServTables();
|
||||||
|
dump_descriptor += "-queryserv";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDumpStaticInstanceData()) {
|
if (IsDumpStaticInstanceData()) {
|
||||||
@@ -391,6 +401,7 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
// LogDebug("[{}] dump-to-console", IsDumpOutputToConsole());
|
// LogDebug("[{}] dump-to-console", IsDumpOutputToConsole());
|
||||||
// LogDebug("[{}] dump-path", GetSetDumpPath());
|
// LogDebug("[{}] dump-path", GetSetDumpPath());
|
||||||
// LogDebug("[{}] compression", (IsDumpWithCompression() ? "true" : "false"));
|
// LogDebug("[{}] compression", (IsDumpWithCompression() ? "true" : "false"));
|
||||||
|
// LogDebug("[{}] query-serv", (IsDumpQueryServerTables() ? "true" : "false"));
|
||||||
// LogDebug("[{}] has-compression-binary", (HasCompressionBinary() ? "true" : "false"));
|
// LogDebug("[{}] has-compression-binary", (HasCompressionBinary() ? "true" : "false"));
|
||||||
// LogDebug("[{}] content", (IsDumpContentTables() ? "true" : "false"));
|
// LogDebug("[{}] content", (IsDumpContentTables() ? "true" : "false"));
|
||||||
// LogDebug("[{}] no-data", (IsDumpWithNoData() ? "true" : "false"));
|
// LogDebug("[{}] no-data", (IsDumpWithNoData() ? "true" : "false"));
|
||||||
@@ -500,6 +511,16 @@ const std::string &DatabaseDumpService::GetDumpFileName() const
|
|||||||
return dump_file_name;
|
return dump_file_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DatabaseDumpService::IsDumpQueryServerTables() const
|
||||||
|
{
|
||||||
|
return dump_query_server_tables;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DatabaseDumpService::SetDumpQueryServerTables(bool dump_query_server_tables)
|
||||||
|
{
|
||||||
|
DatabaseDumpService::dump_query_server_tables = dump_query_server_tables;
|
||||||
|
}
|
||||||
|
|
||||||
bool DatabaseDumpService::IsDumpOutputToConsole() const
|
bool DatabaseDumpService::IsDumpOutputToConsole() const
|
||||||
{
|
{
|
||||||
return dump_output_to_console;
|
return dump_output_to_console;
|
||||||
@@ -596,13 +617,8 @@ void DatabaseDumpService::BuildCredentialsFile()
|
|||||||
void DatabaseDumpService::RemoveCredentialsFile()
|
void DatabaseDumpService::RemoveCredentialsFile()
|
||||||
{
|
{
|
||||||
if (File::Exists(CREDENTIALS_FILE)) {
|
if (File::Exists(CREDENTIALS_FILE)) {
|
||||||
try {
|
|
||||||
std::filesystem::remove(CREDENTIALS_FILE);
|
std::filesystem::remove(CREDENTIALS_FILE);
|
||||||
}
|
}
|
||||||
catch (std::exception &e) {
|
|
||||||
LogError("std::filesystem::remove err [{}]", e.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseDumpService::IsDumpStaticInstanceData()
|
bool DatabaseDumpService::IsDumpStaticInstanceData()
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ public:
|
|||||||
void SetDumpPath(const std::string &dump_path);
|
void SetDumpPath(const std::string &dump_path);
|
||||||
const std::string &GetDumpFileName() const;
|
const std::string &GetDumpFileName() const;
|
||||||
void SetDumpFileName(const std::string &dump_file_name);
|
void SetDumpFileName(const std::string &dump_file_name);
|
||||||
|
bool IsDumpQueryServerTables() const;
|
||||||
|
void SetDumpQueryServerTables(bool dump_query_server_tables);
|
||||||
bool IsDumpOutputToConsole() const;
|
bool IsDumpOutputToConsole() const;
|
||||||
void SetDumpOutputToConsole(bool dump_output_to_console);
|
void SetDumpOutputToConsole(bool dump_output_to_console);
|
||||||
bool IsDumpDropTableSyntaxOnly() const;
|
bool IsDumpDropTableSyntaxOnly() const;
|
||||||
@@ -94,6 +96,7 @@ private:
|
|||||||
bool HasCompressionBinary();
|
bool HasCompressionBinary();
|
||||||
std::string GetDumpFileNameWithPath();
|
std::string GetDumpFileNameWithPath();
|
||||||
std::string GetSetDumpPath();
|
std::string GetSetDumpPath();
|
||||||
|
std::string GetQueryServTables();
|
||||||
void RemoveSqlBackup();
|
void RemoveSqlBackup();
|
||||||
void BuildCredentialsFile();
|
void BuildCredentialsFile();
|
||||||
void RemoveCredentialsFile();
|
void RemoveCredentialsFile();
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
if (version_low != version_high) {
|
if (version_low != version_high) {
|
||||||
|
|
||||||
LogSys.DisableMySQLErrorLogs();
|
LogSys.DisableMySQLErrorLogs();
|
||||||
bool force_interactive = false;
|
|
||||||
for (int version = version_low + 1; version <= version_high; ++version) {
|
for (int version = version_low + 1; version <= version_high; ++version) {
|
||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
if (e.version == version) {
|
if (e.version == version) {
|
||||||
@@ -164,20 +163,13 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
prefix,
|
prefix,
|
||||||
e.description
|
e.description
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!has_migration && e.force_interactive) {
|
|
||||||
force_interactive = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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();
|
||||||
@@ -192,42 +184,6 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force_interactive && !std::getenv("FORCE_INTERACTIVE")) {
|
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
|
||||||
LogInfo("Some migrations require user input. Running interactively");
|
|
||||||
LogInfo("This is usually due to a major change that could cause data loss");
|
|
||||||
LogInfo("Your server is automatically backed up before these updates are applied");
|
|
||||||
LogInfo("but you should also make sure you take a backup prior to running this update");
|
|
||||||
LogInfo("Would you like to run this update? [y/n] (Timeout 60s)");
|
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
|
||||||
|
|
||||||
// user input
|
|
||||||
std::string input;
|
|
||||||
bool gave_input = false;
|
|
||||||
time_t start_time = time(nullptr);
|
|
||||||
time_t wait_time_seconds = 60;
|
|
||||||
|
|
||||||
// spawn a concurrent thread that waits for input from std::cin
|
|
||||||
std::thread t1(
|
|
||||||
[&]() {
|
|
||||||
std::cin >> input;
|
|
||||||
gave_input = true;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
t1.detach();
|
|
||||||
|
|
||||||
// check the inputReceived flag once every 50ms for 10 seconds
|
|
||||||
while (time(nullptr) < start_time + wait_time_seconds && !gave_input) {
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
|
||||||
}
|
|
||||||
|
|
||||||
// prompt for user skip
|
|
||||||
if (Strings::Trim(input) != "y") {
|
|
||||||
LogInfo("Exiting due to user input");
|
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &m: missing_migrations) {
|
for (auto &m: missing_migrations) {
|
||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
if (e.version == m) {
|
if (e.version == m) {
|
||||||
@@ -315,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));
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ struct ManifestEntry {
|
|||||||
std::string match{}; // match field that is not always used, but works in conjunction with "condition" values [missing|match|contains]
|
std::string match{}; // match field that is not always used, but works in conjunction with "condition" values [missing|match|contains]
|
||||||
std::string sql{}; // the SQL DDL that gets ran when the condition is true
|
std::string sql{}; // the SQL DDL that gets ran when the condition is true
|
||||||
bool content_schema_update{}; // if true, this migration is a content schema update and should be ran against the content database
|
bool content_schema_update{}; // if true, this migration is a content schema update and should be ran against the content database
|
||||||
bool force_interactive; // if true, this migration will always be run interactively
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DatabaseVersion {
|
struct DatabaseVersion {
|
||||||
@@ -30,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
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "../common/repositories/respawn_times_repository.h"
|
#include "../common/repositories/respawn_times_repository.h"
|
||||||
#include "../common/repositories/spawn_condition_values_repository.h"
|
#include "../common/repositories/spawn_condition_values_repository.h"
|
||||||
#include "repositories/spawn2_disabled_repository.h"
|
#include "repositories/spawn2_disabled_repository.h"
|
||||||
#include "repositories/data_buckets_repository.h"
|
|
||||||
#include "repositories/zone_state_spawns_repository.h"
|
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@@ -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,18 +469,16 @@ 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);
|
||||||
DataBucketsRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
|
||||||
if (RuleB(Zone, StateSavingOnShutdown)) {
|
|
||||||
ZoneStateSpawnsRepository::DeleteWhere(*this, fmt::format("`instance_id` = {}", instance_id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id)
|
void Database::FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id)
|
||||||
@@ -565,10 +561,6 @@ void Database::PurgeExpiredInstances()
|
|||||||
DynamicZoneMembersRepository::DeleteByManyInstances(*this, imploded_instance_ids);
|
DynamicZoneMembersRepository::DeleteByManyInstances(*this, imploded_instance_ids);
|
||||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
||||||
Spawn2DisabledRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
Spawn2DisabledRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
||||||
DataBucketsRepository::DeleteWhere(*this, fmt::format("instance_id != 0 and instance_id IN ({})", imploded_instance_ids));
|
|
||||||
if (RuleB(Zone, StateSavingOnShutdown)) {
|
|
||||||
ZoneStateSpawnsRepository::DeleteWhere(*this, fmt::format("`instance_id` IN ({})", imploded_instance_ids));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
||||||
|
|||||||
+28
-21
@@ -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",
|
||||||
@@ -139,7 +136,6 @@ namespace DatabaseSchema {
|
|||||||
"character_pet_buffs",
|
"character_pet_buffs",
|
||||||
"character_pet_info",
|
"character_pet_info",
|
||||||
"character_pet_inventory",
|
"character_pet_inventory",
|
||||||
"character_pet_name",
|
|
||||||
"character_peqzone_flags",
|
"character_peqzone_flags",
|
||||||
"character_potionbelt",
|
"character_potionbelt",
|
||||||
"character_skills",
|
"character_skills",
|
||||||
@@ -216,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",
|
||||||
@@ -292,6 +287,32 @@ namespace DatabaseSchema {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets QueryServer tables
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static std::vector<std::string> GetQueryServerTables()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"qs_merchant_transaction_record",
|
||||||
|
"qs_merchant_transaction_record_entries",
|
||||||
|
"qs_player_aa_rate_hourly",
|
||||||
|
"qs_player_delete_record",
|
||||||
|
"qs_player_delete_record_entries",
|
||||||
|
"qs_player_events",
|
||||||
|
"qs_player_handin_record",
|
||||||
|
"qs_player_handin_record_entries",
|
||||||
|
"qs_player_move_record",
|
||||||
|
"qs_player_move_record_entries",
|
||||||
|
"qs_player_npc_kill_record",
|
||||||
|
"qs_player_npc_kill_record_entries",
|
||||||
|
"qs_player_speech",
|
||||||
|
"qs_player_trade_record",
|
||||||
|
"qs_player_trade_record_entries",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets state tables
|
* Gets state tables
|
||||||
* Tables that keep track of server state
|
* Tables that keep track of server state
|
||||||
@@ -312,9 +333,10 @@ namespace DatabaseSchema {
|
|||||||
"completed_shared_task_members",
|
"completed_shared_task_members",
|
||||||
"completed_shared_tasks",
|
"completed_shared_tasks",
|
||||||
"discord_webhooks",
|
"discord_webhooks",
|
||||||
"dynamic_zone_lockouts",
|
|
||||||
"dynamic_zone_members",
|
"dynamic_zone_members",
|
||||||
"dynamic_zones",
|
"dynamic_zones",
|
||||||
|
"expedition_lockouts",
|
||||||
|
"expeditions",
|
||||||
"gm_ips",
|
"gm_ips",
|
||||||
"group_id",
|
"group_id",
|
||||||
"group_leaders",
|
"group_leaders",
|
||||||
@@ -333,25 +355,12 @@ namespace DatabaseSchema {
|
|||||||
"saylink",
|
"saylink",
|
||||||
"server_scheduled_events",
|
"server_scheduled_events",
|
||||||
"spawn2_disabled",
|
"spawn2_disabled",
|
||||||
"player_event_aa_purchase",
|
|
||||||
"player_event_killed_npc",
|
|
||||||
"player_event_killed_named_npc",
|
|
||||||
"player_event_killed_raid_npc",
|
|
||||||
"player_event_log_settings",
|
"player_event_log_settings",
|
||||||
"player_event_logs",
|
"player_event_logs",
|
||||||
"player_event_loot_items",
|
|
||||||
"player_event_merchant_purchase",
|
|
||||||
"player_event_merchant_sell",
|
|
||||||
"player_event_npc_handin",
|
|
||||||
"player_event_npc_handin_entries",
|
|
||||||
"player_event_speech",
|
|
||||||
"player_event_trade",
|
|
||||||
"player_event_trade_entries",
|
|
||||||
"shared_task_activity_state",
|
"shared_task_activity_state",
|
||||||
"shared_task_dynamic_zones",
|
"shared_task_dynamic_zones",
|
||||||
"shared_task_members",
|
"shared_task_members",
|
||||||
"shared_tasks",
|
"shared_tasks",
|
||||||
"zone_state_spawns",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +402,6 @@ namespace DatabaseSchema {
|
|||||||
static std::vector<std::string> GetBotTables()
|
static std::vector<std::string> GetBotTables()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"bot_blocked_buffs",
|
|
||||||
"bot_buffs",
|
"bot_buffs",
|
||||||
"bot_command_settings",
|
"bot_command_settings",
|
||||||
"bot_create_combinations",
|
"bot_create_combinations",
|
||||||
@@ -407,7 +415,6 @@ namespace DatabaseSchema {
|
|||||||
"bot_pet_buffs",
|
"bot_pet_buffs",
|
||||||
"bot_pet_inventories",
|
"bot_pet_inventories",
|
||||||
"bot_pets",
|
"bot_pets",
|
||||||
"bot_settings",
|
|
||||||
"bot_spell_casting_chances",
|
"bot_spell_casting_chances",
|
||||||
"bot_spell_settings",
|
"bot_spell_settings",
|
||||||
"bot_spells_entries",
|
"bot_spells_entries",
|
||||||
|
|||||||
@@ -302,9 +302,7 @@ std::string DBcore::Escape(const std::string& s)
|
|||||||
|
|
||||||
void DBcore::SetMutex(Mutex *mutex)
|
void DBcore::SetMutex(Mutex *mutex)
|
||||||
{
|
{
|
||||||
if (m_mutex && m_mutex != mutex) {
|
|
||||||
safe_delete(m_mutex);
|
safe_delete(m_mutex);
|
||||||
}
|
|
||||||
|
|
||||||
DBcore::m_mutex = mutex;
|
DBcore::m_mutex = mutex;
|
||||||
}
|
}
|
||||||
|
|||||||
+64
-293
@@ -1,13 +1,11 @@
|
|||||||
#include "dynamic_zone_base.h"
|
#include "dynamic_zone_base.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "eqemu_logsys.h"
|
#include "eqemu_logsys.h"
|
||||||
|
#include "repositories/instance_list_repository.h"
|
||||||
|
#include "repositories/instance_list_player_repository.h"
|
||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "servertalk.h"
|
#include "servertalk.h"
|
||||||
#include "util/uuid.h"
|
#include "util/uuid.h"
|
||||||
#include "repositories/character_expedition_lockouts_repository.h"
|
|
||||||
#include "repositories/dynamic_zone_lockouts_repository.h"
|
|
||||||
#include "repositories/instance_list_repository.h"
|
|
||||||
#include "repositories/instance_list_player_repository.h"
|
|
||||||
|
|
||||||
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
||||||
{
|
{
|
||||||
@@ -95,15 +93,13 @@ void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneIn
|
|||||||
m_zonein.y = dz_entry.zone_in_y;
|
m_zonein.y = dz_entry.zone_in_y;
|
||||||
m_zonein.z = dz_entry.zone_in_z;
|
m_zonein.z = dz_entry.zone_in_z;
|
||||||
m_zonein.heading = dz_entry.zone_in_heading;
|
m_zonein.heading = dz_entry.zone_in_heading;
|
||||||
m_has_zonein = dz_entry.has_zone_in != 0;
|
m_has_zonein = (dz_entry.has_zone_in != 0);
|
||||||
m_is_locked = dz_entry.is_locked;
|
|
||||||
m_add_replay = dz_entry.add_replay;
|
|
||||||
// instance_list portion
|
// instance_list portion
|
||||||
m_zone_id = dz_entry.zone;
|
m_zone_id = dz_entry.zone;
|
||||||
m_zone_version = dz_entry.version;
|
m_zone_version = dz_entry.version;
|
||||||
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
||||||
m_duration = std::chrono::seconds(dz_entry.duration);
|
m_duration = std::chrono::seconds(dz_entry.duration);
|
||||||
m_never_expires = dz_entry.never_expires != 0;
|
m_never_expires = (dz_entry.never_expires != 0);
|
||||||
m_expire_time = m_start_time + m_duration;
|
m_expire_time = m_start_time + m_duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,40 +119,37 @@ void DynamicZoneBase::AddMemberFromRepositoryResult(
|
|||||||
uint32_t DynamicZoneBase::SaveToDatabase()
|
uint32_t DynamicZoneBase::SaveToDatabase()
|
||||||
{
|
{
|
||||||
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
||||||
if (m_instance_id == 0)
|
|
||||||
|
if (m_instance_id != 0)
|
||||||
{
|
{
|
||||||
return 0;
|
auto insert_dz = DynamicZonesRepository::NewEntity();
|
||||||
|
insert_dz.uuid = m_uuid;
|
||||||
|
insert_dz.name = m_name;
|
||||||
|
insert_dz.leader_id = m_leader.id;
|
||||||
|
insert_dz.min_players = m_min_players;
|
||||||
|
insert_dz.max_players = m_max_players;
|
||||||
|
insert_dz.instance_id = m_instance_id,
|
||||||
|
insert_dz.type = static_cast<int>(m_type);
|
||||||
|
insert_dz.dz_switch_id = m_dz_switch_id;
|
||||||
|
insert_dz.compass_zone_id = m_compass.zone_id;
|
||||||
|
insert_dz.compass_x = m_compass.x;
|
||||||
|
insert_dz.compass_y = m_compass.y;
|
||||||
|
insert_dz.compass_z = m_compass.z;
|
||||||
|
insert_dz.safe_return_zone_id = m_safereturn.zone_id;
|
||||||
|
insert_dz.safe_return_x = m_safereturn.x;
|
||||||
|
insert_dz.safe_return_y = m_safereturn.y;
|
||||||
|
insert_dz.safe_return_z = m_safereturn.z;
|
||||||
|
insert_dz.safe_return_heading = m_safereturn.heading;
|
||||||
|
insert_dz.zone_in_x = m_zonein.x;
|
||||||
|
insert_dz.zone_in_y = m_zonein.y;
|
||||||
|
insert_dz.zone_in_z = m_zonein.z;
|
||||||
|
insert_dz.zone_in_heading = m_zonein.heading;
|
||||||
|
insert_dz.has_zone_in = m_has_zonein;
|
||||||
|
|
||||||
|
auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
|
||||||
|
return inserted_dz.id;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
auto dz = DynamicZonesRepository::NewEntity();
|
|
||||||
dz.uuid = m_uuid;
|
|
||||||
dz.name = m_name;
|
|
||||||
dz.leader_id = m_leader.id;
|
|
||||||
dz.min_players = m_min_players;
|
|
||||||
dz.max_players = m_max_players;
|
|
||||||
dz.instance_id = static_cast<int32_t>(m_instance_id),
|
|
||||||
dz.type = static_cast<uint8_t>(m_type);
|
|
||||||
dz.dz_switch_id = m_dz_switch_id;
|
|
||||||
dz.compass_zone_id = m_compass.zone_id;
|
|
||||||
dz.compass_x = m_compass.x;
|
|
||||||
dz.compass_y = m_compass.y;
|
|
||||||
dz.compass_z = m_compass.z;
|
|
||||||
dz.safe_return_zone_id = m_safereturn.zone_id;
|
|
||||||
dz.safe_return_x = m_safereturn.x;
|
|
||||||
dz.safe_return_y = m_safereturn.y;
|
|
||||||
dz.safe_return_z = m_safereturn.z;
|
|
||||||
dz.safe_return_heading = m_safereturn.heading;
|
|
||||||
dz.zone_in_x = m_zonein.x;
|
|
||||||
dz.zone_in_y = m_zonein.y;
|
|
||||||
dz.zone_in_z = m_zonein.z;
|
|
||||||
dz.zone_in_heading = m_zonein.heading;
|
|
||||||
dz.has_zone_in = static_cast<uint8_t>(m_has_zonein);
|
|
||||||
dz.is_locked = static_cast<int8_t>(m_is_locked);
|
|
||||||
dz.add_replay = static_cast<int8_t>(m_add_replay);
|
|
||||||
|
|
||||||
dz = DynamicZonesRepository::InsertOne(GetDatabase(), std::move(dz));
|
|
||||||
|
|
||||||
return dz.id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
|
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
|
||||||
@@ -203,9 +196,10 @@ bool DynamicZoneBase::RemoveMember(const DynamicZoneMember& remove_member)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::SwapMember(const DynamicZoneMember& add_member, const std::string& remove_name)
|
bool DynamicZoneBase::SwapMember(
|
||||||
|
const DynamicZoneMember& add_member, const std::string& remove_char_name)
|
||||||
{
|
{
|
||||||
auto remove_member = GetMemberData(remove_name);
|
auto remove_member = GetMemberData(remove_char_name);
|
||||||
if (!add_member.IsValid() || !remove_member.IsValid())
|
if (!add_member.IsValid() || !remove_member.IsValid())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -236,18 +230,9 @@ void DynamicZoneBase::RemoveAllMembers()
|
|||||||
|
|
||||||
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||||
{
|
{
|
||||||
if (members.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
||||||
|
|
||||||
m_members = members;
|
m_members = members;
|
||||||
if (m_members.size() > m_max_players)
|
|
||||||
{
|
|
||||||
m_members.resize(m_max_players);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the lower level instance_list_players needs to be kept updated as well
|
// the lower level instance_list_players needs to be kept updated as well
|
||||||
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
||||||
@@ -257,12 +242,12 @@ void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
|||||||
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
||||||
member_entry.dynamic_zone_id = m_id;
|
member_entry.dynamic_zone_id = m_id;
|
||||||
member_entry.character_id = member.id;
|
member_entry.character_id = member.id;
|
||||||
insert_members.push_back(member_entry);
|
insert_members.emplace_back(member_entry);
|
||||||
|
|
||||||
InstanceListPlayerRepository::InstanceListPlayer player_entry{};
|
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
||||||
player_entry.id = m_instance_id;
|
player_entry.id = static_cast<int>(m_instance_id);
|
||||||
player_entry.charid = member.id;
|
player_entry.charid = static_cast<int>(member.id);
|
||||||
insert_players.push_back(player_entry);
|
insert_players.emplace_back(player_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
||||||
@@ -354,44 +339,6 @@ void DynamicZoneBase::SetLeader(const DynamicZoneMember& new_leader, bool update
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicZoneBase::SetLocked(bool lock, bool update_db, DzLockMsg lock_msg, uint32_t color)
|
|
||||||
{
|
|
||||||
m_is_locked = lock;
|
|
||||||
|
|
||||||
if (update_db)
|
|
||||||
{
|
|
||||||
DynamicZonesRepository::UpdateLocked(GetDatabase(), m_id, lock);
|
|
||||||
|
|
||||||
ServerPacket pack(ServerOP_DzLock, sizeof(ServerDzLock_Struct));
|
|
||||||
auto buf = reinterpret_cast<ServerDzLock_Struct*>(pack.pBuffer);
|
|
||||||
buf->dz_id = GetID();
|
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
buf->lock = m_is_locked;
|
|
||||||
buf->lock_msg = static_cast<uint8_t>(lock_msg);
|
|
||||||
buf->color = color;
|
|
||||||
SendServerPacket(&pack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::SetReplayOnJoin(bool enabled, bool update_db)
|
|
||||||
{
|
|
||||||
m_add_replay = enabled;
|
|
||||||
|
|
||||||
if (update_db)
|
|
||||||
{
|
|
||||||
DynamicZonesRepository::UpdateReplayOnJoin(GetDatabase(), m_id, enabled);
|
|
||||||
|
|
||||||
ServerPacket pack(ServerOP_DzReplayOnJoin, sizeof(ServerDzBool_Struct));
|
|
||||||
auto buf = reinterpret_cast<ServerDzBool_Struct*>(pack.pBuffer);
|
|
||||||
buf->dz_id = GetID();
|
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
buf->enabled = enabled;
|
|
||||||
SendServerPacket(&pack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
||||||
{
|
{
|
||||||
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
||||||
@@ -531,13 +478,13 @@ void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
|
|||||||
), m_members.end());
|
), m_members.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::HasMember(uint32_t character_id) const
|
bool DynamicZoneBase::HasMember(uint32_t character_id)
|
||||||
{
|
{
|
||||||
return std::any_of(m_members.begin(), m_members.end(),
|
return std::any_of(m_members.begin(), m_members.end(),
|
||||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::HasMember(const std::string& character_name) const
|
bool DynamicZoneBase::HasMember(const std::string& character_name)
|
||||||
{
|
{
|
||||||
return std::any_of(m_members.begin(), m_members.end(),
|
return std::any_of(m_members.begin(), m_members.end(),
|
||||||
[&](const DynamicZoneMember& member) {
|
[&](const DynamicZoneMember& member) {
|
||||||
@@ -643,34 +590,35 @@ std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerPacket(uint16_t zone_id, uint16_t instance_id)
|
EQ::Net::DynamicPacket DynamicZoneBase::GetSerializedDzPacket()
|
||||||
{
|
{
|
||||||
std::ostringstream ss = GetSerialized();
|
EQ::Net::DynamicPacket dyn_pack;
|
||||||
std::string_view sv = ss.view();
|
dyn_pack.PutSerialize(0, *this);
|
||||||
|
|
||||||
auto pack_size = sizeof(ServerDzCreate_Struct) + sv.size();
|
LogDynamicZonesDetail("Serialized server dz size [{}]", dyn_pack.Length());
|
||||||
|
return dyn_pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzCreatePacket(
|
||||||
|
uint16_t origin_zone_id, uint16_t origin_instance_id)
|
||||||
|
{
|
||||||
|
EQ::Net::DynamicPacket dyn_pack = GetSerializedDzPacket();
|
||||||
|
|
||||||
|
auto pack_size = sizeof(ServerDzCreateSerialized_Struct) + dyn_pack.Length();
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
||||||
auto buf = reinterpret_cast<ServerDzCreate_Struct*>(pack->pBuffer);
|
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
|
||||||
buf->origin_zone_id = zone_id;
|
buf->origin_zone_id = origin_zone_id;
|
||||||
buf->origin_instance_id = instance_id;
|
buf->origin_instance_id = origin_instance_id;
|
||||||
buf->dz_id = GetID();
|
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
|
||||||
buf->cereal_size = static_cast<uint32_t>(sv.size());
|
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
|
||||||
memcpy(buf->cereal_data, sv.data(), sv.size());
|
|
||||||
|
|
||||||
return pack;
|
return pack;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream DynamicZoneBase::GetSerialized()
|
void DynamicZoneBase::LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size)
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
LogDynamicZonesDetail("Deserializing server dz size [{}]", cereal_size);
|
||||||
cereal::BinaryOutputArchive archive(ss);
|
EQ::Util::MemoryStreamReader ss(cereal_data, cereal_size);
|
||||||
archive(*this);
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::Unserialize(std::span<char> buf)
|
|
||||||
{
|
|
||||||
EQ::Util::MemoryStreamReader ss(buf.data(), buf.size());
|
|
||||||
cereal::BinaryInputArchive archive(ss);
|
cereal::BinaryInputArchive archive(ss);
|
||||||
archive(*this);
|
archive(*this);
|
||||||
}
|
}
|
||||||
@@ -699,180 +647,3 @@ void DynamicZoneBase::LoadTemplate(const DynamicZoneTemplatesRepository::Dynamic
|
|||||||
m_zonein.z = dz_template.zone_in_z;
|
m_zonein.z = dz_template.zone_in_z;
|
||||||
m_zonein.heading = dz_template.zone_in_h;
|
m_zonein.heading = dz_template.zone_in_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint32_t> DynamicZoneBase::GetMemberIds()
|
|
||||||
{
|
|
||||||
std::vector<uint32_t> ids;
|
|
||||||
ids.reserve(m_members.size());
|
|
||||||
for (const auto& member : m_members)
|
|
||||||
{
|
|
||||||
ids.push_back(member.id);
|
|
||||||
}
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicZoneBase::HasLockout(const std::string& event)
|
|
||||||
{
|
|
||||||
return std::ranges::any_of(m_lockouts, [&](const auto& l) { return l.IsEvent(event); });
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DynamicZoneBase::HasReplayLockout()
|
|
||||||
{
|
|
||||||
return HasLockout(DzLockout::ReplayTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::AddLockout(const std::string& event, uint32_t seconds)
|
|
||||||
{
|
|
||||||
auto lockout = DzLockout::Create(m_name, event, seconds, m_uuid);
|
|
||||||
AddLockout(lockout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::AddLockout(const DzLockout& lockout, bool members_only)
|
|
||||||
{
|
|
||||||
if (!members_only)
|
|
||||||
{
|
|
||||||
DynamicZoneLockoutsRepository::InsertLockouts(GetDatabase(), GetID(), { lockout });
|
|
||||||
}
|
|
||||||
|
|
||||||
CharacterExpeditionLockoutsRepository::InsertLockout(GetDatabase(), GetMemberIds(), lockout);
|
|
||||||
|
|
||||||
HandleLockoutUpdate(lockout, false, members_only);
|
|
||||||
SendServerPacket(CreateLockoutPacket(lockout, false, members_only).get());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::AddLockoutDuration(const std::string& event, int seconds, bool members_only)
|
|
||||||
{
|
|
||||||
auto lockout = DzLockout::Create(m_name, event, std::max(0, seconds), m_uuid);
|
|
||||||
|
|
||||||
// lockout has unsigned duration, pass original seconds to support reducing existing timers
|
|
||||||
int secs = static_cast<int>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
|
||||||
CharacterExpeditionLockoutsRepository::AddLockoutDuration(GetDatabase(), GetMemberIds(), lockout, secs);
|
|
||||||
|
|
||||||
HandleLockoutDuration(lockout, seconds, members_only, true);
|
|
||||||
SendServerPacket(CreateLockoutDurationPacket(lockout, seconds, members_only).get());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::UpdateLockoutDuration(const std::string& event, uint32_t seconds, bool members_only)
|
|
||||||
{
|
|
||||||
// some live expeditions update existing lockout timers during progression
|
|
||||||
auto it = std::ranges::find_if(m_lockouts, [&](const auto& l) { return l.IsEvent(event); });
|
|
||||||
if (it != m_lockouts.end())
|
|
||||||
{
|
|
||||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
|
||||||
DzLockout lockout(m_uuid, m_name, event, it->GetStartTime() + seconds, seconds);
|
|
||||||
AddLockout(lockout, members_only);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::RemoveLockout(const std::string& event)
|
|
||||||
{
|
|
||||||
DynamicZoneLockoutsRepository::DeleteWhere(GetDatabase(), fmt::format(
|
|
||||||
"dynamic_zone_id = {} AND event_name = '{}'", GetID(), Strings::Escape(event)));
|
|
||||||
|
|
||||||
CharacterExpeditionLockoutsRepository::DeleteWhere(GetDatabase(), fmt::format(
|
|
||||||
"character_id IN ({}) AND expedition_name = '{}' AND event_name = '{}'",
|
|
||||||
fmt::join(GetMemberIds(), ","), Strings::Escape(m_name), Strings::Escape(event)));
|
|
||||||
|
|
||||||
DzLockout lockout{m_uuid, m_name, event, 0, 0};
|
|
||||||
HandleLockoutUpdate(lockout, true, false);
|
|
||||||
SendServerPacket(CreateLockoutPacket(lockout, true).get());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::HandleLockoutUpdate(const DzLockout& lockout, bool remove, bool members_only)
|
|
||||||
{
|
|
||||||
if (!members_only)
|
|
||||||
{
|
|
||||||
std::erase_if(m_lockouts, [&](const auto& l) { return l.IsEvent(lockout.Event()); });
|
|
||||||
if (!remove)
|
|
||||||
{
|
|
||||||
m_lockouts.push_back(lockout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::HandleLockoutDuration(const DzLockout& lockout, int seconds, bool members_only, bool insert_db)
|
|
||||||
{
|
|
||||||
if (!members_only)
|
|
||||||
{
|
|
||||||
auto it = std::ranges::find_if(m_lockouts, [&](const auto& l) { return l.IsEvent(lockout.Event()); });
|
|
||||||
if (it != m_lockouts.end())
|
|
||||||
{
|
|
||||||
it->AddLockoutTime(seconds);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
it = m_lockouts.insert(m_lockouts.end(), lockout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (insert_db)
|
|
||||||
{
|
|
||||||
DynamicZoneLockoutsRepository::InsertLockouts(GetDatabase(), GetID(), { *it });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateLockoutPacket(const DzLockout& lockout, bool remove, bool members_only) const
|
|
||||||
{
|
|
||||||
uint32_t pack_size = sizeof(ServerDzLockout_Struct);
|
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzLockout, pack_size);
|
|
||||||
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
|
||||||
buf->dz_id = GetID();
|
|
||||||
buf->expire_time = lockout.GetExpireTime();
|
|
||||||
buf->duration = lockout.GetDuration();
|
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
buf->remove = remove;
|
|
||||||
buf->members_only = members_only;
|
|
||||||
strn0cpy(buf->event_name, lockout.Event().c_str(), sizeof(buf->event_name));
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateLockoutDurationPacket(const DzLockout& lockout, int seconds, bool members_only) const
|
|
||||||
{
|
|
||||||
uint32_t pack_size = sizeof(ServerDzLockout_Struct);
|
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzLockoutDuration, pack_size);
|
|
||||||
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
|
||||||
buf->dz_id = GetID();
|
|
||||||
buf->expire_time = lockout.GetExpireTime();
|
|
||||||
buf->duration = lockout.GetDuration();
|
|
||||||
buf->sender_zone_id = GetCurrentZoneID();
|
|
||||||
buf->sender_instance_id = GetCurrentInstanceID();
|
|
||||||
buf->members_only = members_only;
|
|
||||||
buf->seconds = seconds;
|
|
||||||
strn0cpy(buf->event_name, lockout.Event().c_str(), sizeof(buf->event_name));
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DynamicZoneBase::SyncCharacterLockouts(uint32_t char_id, std::vector<DzLockout>& lockouts)
|
|
||||||
{
|
|
||||||
// adds missing event lockouts to client for this expedition and updates
|
|
||||||
// client timers that are both shorter and from another expedition
|
|
||||||
bool modified = false;
|
|
||||||
|
|
||||||
for (const auto& lockout : m_lockouts)
|
|
||||||
{
|
|
||||||
if (lockout.IsReplay() || lockout.IsExpired() || lockout.UUID() != m_uuid)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto it = std::find_if(lockouts.begin(), lockouts.end(), [&](const DzLockout& l) { return l.IsSame(lockout); });
|
|
||||||
if (it == lockouts.end())
|
|
||||||
{
|
|
||||||
modified = true;
|
|
||||||
lockouts.push_back(lockout); // insert missing
|
|
||||||
}
|
|
||||||
else if (it->GetSecondsRemaining() < lockout.GetSecondsRemaining() && it->UUID() != m_uuid)
|
|
||||||
{
|
|
||||||
// only update lockout timer not uuid so loot event apis still work
|
|
||||||
modified = true;
|
|
||||||
it->SetDuration(lockout.GetDuration());
|
|
||||||
it->SetExpireTime(lockout.GetExpireTime());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modified)
|
|
||||||
{
|
|
||||||
CharacterExpeditionLockoutsRepository::InsertLockouts(GetDatabase(), char_id, lockouts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+14
-68
@@ -1,8 +1,8 @@
|
|||||||
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
||||||
#define COMMON_DYNAMIC_ZONE_BASE_H
|
#define COMMON_DYNAMIC_ZONE_BASE_H
|
||||||
|
|
||||||
#include "dynamic_zone_lockout.h"
|
|
||||||
#include "eq_constants.h"
|
#include "eq_constants.h"
|
||||||
|
#include "net/packet.h"
|
||||||
#include "repositories/dynamic_zones_repository.h"
|
#include "repositories/dynamic_zones_repository.h"
|
||||||
#include "repositories/dynamic_zone_members_repository.h"
|
#include "repositories/dynamic_zone_members_repository.h"
|
||||||
#include "repositories/dynamic_zone_templates_repository.h"
|
#include "repositories/dynamic_zone_templates_repository.h"
|
||||||
@@ -10,40 +10,12 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <span>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class ServerPacket;
|
class ServerPacket;
|
||||||
|
|
||||||
// message string 8312 added in September 08 2020 Test patch (used by both dz and shared tasks)
|
|
||||||
inline constexpr char DzNotAllAdded[] = "Not all players in your {0} were added to the {1}. The {1} can take a maximum of {2} players, and your {0} has {3}.";
|
|
||||||
|
|
||||||
enum class DzLockMsg : uint8_t
|
|
||||||
{
|
|
||||||
None = 0, Close, Begin
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class DynamicZoneType
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Expedition,
|
|
||||||
Tutorial,
|
|
||||||
Task,
|
|
||||||
Mission, // Shared Task
|
|
||||||
Quest
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class DynamicZoneMemberStatus
|
|
||||||
{
|
|
||||||
Unknown = 0,
|
|
||||||
Online,
|
|
||||||
Offline,
|
|
||||||
InDynamicZone,
|
|
||||||
LinkDead
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DynamicZoneMember
|
struct DynamicZoneMember
|
||||||
{
|
{
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
@@ -121,7 +93,6 @@ public:
|
|||||||
const std::string& GetName() const { return m_name; }
|
const std::string& GetName() const { return m_name; }
|
||||||
const std::string& GetUUID() const { return m_uuid; }
|
const std::string& GetUUID() const { return m_uuid; }
|
||||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||||
const std::vector<DzLockout>& GetLockouts() const { return m_lockouts; }
|
|
||||||
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
||||||
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
||||||
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
||||||
@@ -133,34 +104,31 @@ public:
|
|||||||
uint32_t GetDatabaseMemberCount();
|
uint32_t GetDatabaseMemberCount();
|
||||||
DynamicZoneMember GetMemberData(uint32_t character_id);
|
DynamicZoneMember GetMemberData(uint32_t character_id);
|
||||||
DynamicZoneMember GetMemberData(const std::string& character_name);
|
DynamicZoneMember GetMemberData(const std::string& character_name);
|
||||||
std::vector<uint32_t> GetMemberIds();
|
EQ::Net::DynamicPacket GetSerializedDzPacket();
|
||||||
std::ostringstream GetSerialized();
|
|
||||||
bool HasDatabaseMember(uint32_t character_id);
|
bool HasDatabaseMember(uint32_t character_id);
|
||||||
bool HasMember(uint32_t character_id) const;
|
bool HasMember(uint32_t character_id);
|
||||||
bool HasMember(const std::string& character_name) const;
|
bool HasMember(const std::string& character_name);
|
||||||
bool HasMembers() const { return !m_members.empty(); }
|
bool HasMembers() const { return !m_members.empty(); }
|
||||||
bool HasZoneInLocation() const { return m_has_zonein; }
|
bool HasZoneInLocation() const { return m_has_zonein; }
|
||||||
bool IsExpedition() const { return m_type == DynamicZoneType::Expedition; }
|
|
||||||
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
||||||
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
||||||
bool IsLocked() const { return m_is_locked; }
|
|
||||||
bool IsValid() const { return m_instance_id != 0; }
|
bool IsValid() const { return m_instance_id != 0; }
|
||||||
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
||||||
|
void LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size);
|
||||||
void LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template);
|
void LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template);
|
||||||
void RemoveAllMembers();
|
void RemoveAllMembers();
|
||||||
bool RemoveMember(uint32_t character_id);
|
bool RemoveMember(uint32_t character_id);
|
||||||
bool RemoveMember(const std::string& character_name);
|
bool RemoveMember(const std::string& character_name);
|
||||||
bool RemoveMember(const DynamicZoneMember& remove_member);
|
bool RemoveMember(const DynamicZoneMember& remove_member);
|
||||||
|
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||||
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
||||||
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
||||||
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
|
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
|
||||||
void SetLocked(bool lock, bool update_db = false, DzLockMsg lock_msg = DzLockMsg::None, uint32_t color = Chat::Yellow);
|
|
||||||
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
||||||
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
||||||
void SetName(const std::string& name) { m_name = name; }
|
void SetName(const std::string& name) { m_name = name; }
|
||||||
void SetReplayOnJoin(bool enabled, bool update_db = false);
|
|
||||||
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
||||||
void SetSwitchID(int dz_switch_id, bool update_db = false);
|
void SetSwitchID(int dz_switch_id, bool update_db = false);
|
||||||
@@ -168,48 +136,34 @@ public:
|
|||||||
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
||||||
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
||||||
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_name);
|
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_char_name);
|
||||||
|
|
||||||
void AddLockout(const std::string& event, uint32_t seconds);
|
|
||||||
void AddLockoutDuration(const std::string& event, int seconds, bool members_only = true);
|
|
||||||
bool HasLockout(const std::string& event);
|
|
||||||
bool HasReplayLockout();
|
|
||||||
void RemoveLockout(const std::string& event);
|
|
||||||
void SyncCharacterLockouts(uint32_t char_id, std::vector<DzLockout>& lockouts);
|
|
||||||
void UpdateLockoutDuration(const std::string& event, uint32_t seconds, bool members_only = true);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual uint16_t GetCurrentInstanceID() const { return 0; }
|
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
||||||
virtual uint16_t GetCurrentZoneID() const { return 0; }
|
virtual uint16_t GetCurrentZoneID() { return 0; }
|
||||||
virtual Database& GetDatabase() = 0;
|
virtual Database& GetDatabase() = 0;
|
||||||
virtual void HandleLockoutDuration(const DzLockout& lockout, int seconds, bool members_only, bool insert_db);
|
|
||||||
virtual void HandleLockoutUpdate(const DzLockout& lockout, bool remove, bool members_only);
|
|
||||||
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
||||||
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
||||||
virtual bool ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status);
|
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
|
||||||
virtual void ProcessRemoveAllMembers() { m_members.clear(); }
|
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
|
||||||
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
|
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
|
||||||
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
||||||
|
|
||||||
void AddLockout(const DzLockout& lockout, bool members_only = false);
|
|
||||||
void AddInternalMember(const DynamicZoneMember& member);
|
void AddInternalMember(const DynamicZoneMember& member);
|
||||||
uint32_t Create();
|
uint32_t Create();
|
||||||
uint32_t CreateInstance();
|
uint32_t CreateInstance();
|
||||||
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
||||||
void RemoveInternalMember(uint32_t character_id);
|
void RemoveInternalMember(uint32_t character_id);
|
||||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
|
||||||
uint32_t SaveToDatabase();
|
uint32_t SaveToDatabase();
|
||||||
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> CreateServerPacket(uint16_t zone_id, uint16_t instance_id);
|
std::unique_ptr<ServerPacket> CreateServerDzCreatePacket(uint16_t origin_zone_id, uint16_t origin_instance_id);
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
|
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
|
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
|
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
||||||
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
|
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
|
||||||
std::unique_ptr<ServerPacket> CreateLockoutPacket(const DzLockout& lockout, bool remove, bool members_only = false) const;
|
|
||||||
std::unique_ptr<ServerPacket> CreateLockoutDurationPacket(const DzLockout& lockout, int seconds, bool members_only = false) const;
|
|
||||||
|
|
||||||
uint32_t m_id = 0;
|
uint32_t m_id = 0;
|
||||||
uint32_t m_zone_id = 0;
|
uint32_t m_zone_id = 0;
|
||||||
@@ -221,8 +175,6 @@ protected:
|
|||||||
bool m_never_expires = false;
|
bool m_never_expires = false;
|
||||||
bool m_has_zonein = false;
|
bool m_has_zonein = false;
|
||||||
bool m_has_member_statuses = false;
|
bool m_has_member_statuses = false;
|
||||||
bool m_is_locked = false;
|
|
||||||
bool m_add_replay = true;
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
std::string m_uuid;
|
std::string m_uuid;
|
||||||
DynamicZoneMember m_leader;
|
DynamicZoneMember m_leader;
|
||||||
@@ -230,15 +182,12 @@ protected:
|
|||||||
DynamicZoneLocation m_compass;
|
DynamicZoneLocation m_compass;
|
||||||
DynamicZoneLocation m_safereturn;
|
DynamicZoneLocation m_safereturn;
|
||||||
DynamicZoneLocation m_zonein;
|
DynamicZoneLocation m_zonein;
|
||||||
std::chrono::seconds m_duration = {};
|
std::chrono::seconds m_duration;
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||||
std::vector<DynamicZoneMember> m_members;
|
std::vector<DynamicZoneMember> m_members;
|
||||||
std::vector<DzLockout> m_lockouts;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Unserialize(std::span<char> buf);
|
|
||||||
|
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
void serialize(Archive& archive)
|
void serialize(Archive& archive)
|
||||||
{
|
{
|
||||||
@@ -253,8 +202,6 @@ public:
|
|||||||
m_never_expires,
|
m_never_expires,
|
||||||
m_has_zonein,
|
m_has_zonein,
|
||||||
m_has_member_statuses,
|
m_has_member_statuses,
|
||||||
m_is_locked,
|
|
||||||
m_add_replay,
|
|
||||||
m_name,
|
m_name,
|
||||||
m_uuid,
|
m_uuid,
|
||||||
m_leader,
|
m_leader,
|
||||||
@@ -265,8 +212,7 @@ public:
|
|||||||
m_duration,
|
m_duration,
|
||||||
m_start_time,
|
m_start_time,
|
||||||
m_expire_time,
|
m_expire_time,
|
||||||
m_members,
|
m_members
|
||||||
m_lockouts
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
#include "dynamic_zone_lockout.h"
|
|
||||||
#include "strings.h"
|
|
||||||
#include "rulesys.h"
|
|
||||||
#include "util/uuid.h"
|
|
||||||
#include <fmt/format.h>
|
|
||||||
#include <cereal/types/chrono.hpp>
|
|
||||||
|
|
||||||
DzLockout::DzLockout(std::string uuid, std::string expedition, std::string event, uint64_t expire_time, uint32_t duration)
|
|
||||||
: m_uuid(std::move(uuid))
|
|
||||||
, m_name(std::move(expedition))
|
|
||||||
, m_event(std::move(event))
|
|
||||||
, m_expire_time(std::chrono::system_clock::from_time_t(expire_time))
|
|
||||||
, m_duration(duration)
|
|
||||||
{
|
|
||||||
m_is_replay = m_event == ReplayTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
DzLockout::DzLockout(std::string_view name, BaseDynamicZoneLockoutsRepository::DynamicZoneLockouts&& lockout)
|
|
||||||
: m_uuid(std::move(lockout.from_expedition_uuid))
|
|
||||||
, m_name(name)
|
|
||||||
, m_event(std::move(lockout.event_name))
|
|
||||||
, m_expire_time(std::chrono::system_clock::from_time_t(lockout.expire_time))
|
|
||||||
, m_duration(lockout.duration)
|
|
||||||
{
|
|
||||||
m_is_replay = m_event == ReplayTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
DzLockout DzLockout::Create(const std::string& expedition, const std::string& event, uint32_t seconds, std::string uuid)
|
|
||||||
{
|
|
||||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
|
||||||
|
|
||||||
if (uuid.empty())
|
|
||||||
{
|
|
||||||
uuid = EQ::Util::UUID::Generate().ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
DzLockout lockout{uuid, expedition, event, 0, seconds};
|
|
||||||
lockout.Reset(); // sets expire time
|
|
||||||
return lockout;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t DzLockout::GetSecondsRemaining() const
|
|
||||||
{
|
|
||||||
auto now = std::chrono::system_clock::now();
|
|
||||||
if (m_expire_time > now)
|
|
||||||
{
|
|
||||||
auto remaining = m_expire_time - now;
|
|
||||||
return static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(remaining).count());
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DzLockout::TimeStrings DzLockout::GetTimeRemainingStrs() const
|
|
||||||
{
|
|
||||||
auto seconds = GetSecondsRemaining();
|
|
||||||
return DzLockout::TimeStrings{
|
|
||||||
fmt::format_int(seconds / 86400).str(), // days
|
|
||||||
fmt::format_int(seconds / 3600 % 24).str(), // hours
|
|
||||||
fmt::format_int(seconds / 60 % 60).str(), // minutes
|
|
||||||
fmt::format_int(seconds % 60).str() // seconds
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DzLockout::IsSame(const DzLockout& other) const
|
|
||||||
{
|
|
||||||
return other.IsSame(m_name, m_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DzLockout::IsSame(const std::string& expedition, const std::string& event) const
|
|
||||||
{
|
|
||||||
return m_name == expedition && m_event == event;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DzLockout::AddLockoutTime(int seconds)
|
|
||||||
{
|
|
||||||
seconds = static_cast<int>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
|
||||||
|
|
||||||
auto new_duration = std::max(0, static_cast<int>(m_duration.count()) + seconds);
|
|
||||||
|
|
||||||
auto start_time = m_expire_time - m_duration;
|
|
||||||
m_duration = std::chrono::seconds(new_duration);
|
|
||||||
m_expire_time = start_time + m_duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void DzLockout::serialize(T& archive)
|
|
||||||
{
|
|
||||||
archive(m_is_replay, m_uuid, m_name, m_event, m_duration, m_expire_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
template void DzLockout::serialize(cereal::BinaryOutputArchive&);
|
|
||||||
template void DzLockout::serialize(cereal::BinaryInputArchive&);
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <string>
|
|
||||||
#include "repositories/base/base_dynamic_zone_lockouts_repository.h"
|
|
||||||
|
|
||||||
class DzLockout
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DzLockout() = default;
|
|
||||||
DzLockout(std::string uuid, std::string expedition, std::string event, uint64_t expire_time, uint32_t duration);
|
|
||||||
DzLockout(std::string_view name, BaseDynamicZoneLockoutsRepository::DynamicZoneLockouts&& lockout);
|
|
||||||
|
|
||||||
static constexpr char ReplayTimer[] = "Replay Timer";
|
|
||||||
|
|
||||||
static DzLockout Create(const std::string& expedition, const std::string& event, uint32_t seconds, std::string uuid = {});
|
|
||||||
|
|
||||||
struct TimeStrings
|
|
||||||
{
|
|
||||||
std::string days;
|
|
||||||
std::string hours;
|
|
||||||
std::string mins;
|
|
||||||
std::string secs;
|
|
||||||
};
|
|
||||||
|
|
||||||
void AddLockoutTime(int seconds);
|
|
||||||
uint32_t GetDuration() const { return static_cast<uint32_t>(m_duration.count()); }
|
|
||||||
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
|
||||||
uint64_t GetStartTime() const { return std::chrono::system_clock::to_time_t(m_expire_time - m_duration); }
|
|
||||||
uint32_t GetSecondsRemaining() const;
|
|
||||||
TimeStrings GetTimeRemainingStrs() const;
|
|
||||||
const std::string& DzName() const { return m_name; }
|
|
||||||
const std::string& Event() const { return m_event; }
|
|
||||||
const std::string& UUID() const { return m_uuid; }
|
|
||||||
bool IsEvent(std::string_view event) const { return m_event == event; }
|
|
||||||
bool IsExpired() const { return GetSecondsRemaining() == 0; }
|
|
||||||
bool IsReplay() const { return m_is_replay; }
|
|
||||||
bool IsSame(const DzLockout& other) const;
|
|
||||||
bool IsSame(const std::string& expedition, const std::string& event) const;
|
|
||||||
bool IsUUID(const std::string& uuid) const { return uuid == m_uuid; }
|
|
||||||
void Reset() { m_expire_time = std::chrono::system_clock::now() + m_duration; }
|
|
||||||
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
|
||||||
void SetExpireTime(uint64_t expire_time) { m_expire_time = std::chrono::system_clock::from_time_t(expire_time); }
|
|
||||||
void SetUUID(const std::string& uuid) { m_uuid = uuid; }
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void serialize(T& archive);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_is_replay = false;
|
|
||||||
std::string m_uuid; // dz received in
|
|
||||||
std::string m_name;
|
|
||||||
std::string m_event;
|
|
||||||
std::chrono::seconds m_duration = {};
|
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
|
||||||
};
|
|
||||||
+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();
|
|
||||||
}
|
|
||||||
|
|||||||
+28
-58
@@ -130,11 +130,9 @@ namespace EQ
|
|||||||
using RoF2::invtype::MAIL_SIZE;
|
using RoF2::invtype::MAIL_SIZE;
|
||||||
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
||||||
using RoF2::invtype::KRONO_SIZE;
|
using RoF2::invtype::KRONO_SIZE;
|
||||||
using RoF2::invtype::GUILD_BANK_MAIN_SIZE;
|
|
||||||
using RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE;
|
|
||||||
using RoF2::invtype::OTHER_SIZE;
|
using RoF2::invtype::OTHER_SIZE;
|
||||||
|
|
||||||
using RoF2::invtype::TRADE_NPC_SIZE;
|
using Titanium::invtype::TRADE_NPC_SIZE;
|
||||||
|
|
||||||
using RoF2::invtype::TYPE_INVALID;
|
using RoF2::invtype::TYPE_INVALID;
|
||||||
using RoF2::invtype::TYPE_BEGIN;
|
using RoF2::invtype::TYPE_BEGIN;
|
||||||
@@ -161,7 +159,7 @@ namespace EQ
|
|||||||
using RoF2::invslot::SLOT_INVALID;
|
using RoF2::invslot::SLOT_INVALID;
|
||||||
using RoF2::invslot::SLOT_BEGIN;
|
using RoF2::invslot::SLOT_BEGIN;
|
||||||
|
|
||||||
using RoF2::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE;
|
using Titanium::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE;
|
||||||
|
|
||||||
const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value)
|
const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value)
|
||||||
|
|
||||||
@@ -181,25 +179,25 @@ namespace EQ
|
|||||||
using RoF2::invslot::BONUS_STAT_END;
|
using RoF2::invslot::BONUS_STAT_END;
|
||||||
using RoF2::invslot::BONUS_SKILL_END;
|
using RoF2::invslot::BONUS_SKILL_END;
|
||||||
|
|
||||||
using RoF2::invslot::BANK_BEGIN;
|
using Titanium::invslot::BANK_BEGIN;
|
||||||
using RoF2::invslot::BANK_END;
|
using SoF::invslot::BANK_END;
|
||||||
|
|
||||||
using RoF2::invslot::SHARED_BANK_BEGIN;
|
using Titanium::invslot::SHARED_BANK_BEGIN;
|
||||||
using RoF2::invslot::SHARED_BANK_END;
|
using Titanium::invslot::SHARED_BANK_END;
|
||||||
|
|
||||||
using RoF2::invslot::TRADE_BEGIN;
|
using Titanium::invslot::TRADE_BEGIN;
|
||||||
using RoF2::invslot::TRADE_END;
|
using Titanium::invslot::TRADE_END;
|
||||||
|
|
||||||
using RoF2::invslot::TRADE_NPC_END;
|
using Titanium::invslot::TRADE_NPC_END;
|
||||||
|
|
||||||
using RoF2::invslot::WORLD_BEGIN;
|
using Titanium::invslot::WORLD_BEGIN;
|
||||||
using RoF2::invslot::WORLD_END;
|
using Titanium::invslot::WORLD_END;
|
||||||
|
|
||||||
using RoF2::invslot::TRIBUTE_BEGIN;
|
using Titanium::invslot::TRIBUTE_BEGIN;
|
||||||
using RoF2::invslot::TRIBUTE_END;
|
using Titanium::invslot::TRIBUTE_END;
|
||||||
|
|
||||||
using RoF2::invslot::GUILD_TRIBUTE_BEGIN;
|
using Titanium::invslot::GUILD_TRIBUTE_BEGIN;
|
||||||
using RoF2::invslot::GUILD_TRIBUTE_END;
|
using Titanium::invslot::GUILD_TRIBUTE_END;
|
||||||
|
|
||||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||||
const int16 CORPSE_END = CORPSE_BEGIN + invslot::slotCursor;
|
const int16 CORPSE_END = CORPSE_BEGIN + invslot::slotCursor;
|
||||||
@@ -216,40 +214,38 @@ namespace EQ
|
|||||||
} // namespace invslot
|
} // namespace invslot
|
||||||
|
|
||||||
namespace invbag {
|
namespace invbag {
|
||||||
using RoF2::invbag::SLOT_INVALID;
|
using Titanium::invbag::SLOT_INVALID;
|
||||||
using RoF2::invbag::SLOT_BEGIN;
|
using Titanium::invbag::SLOT_BEGIN;
|
||||||
using RoF2::invbag::SLOT_END;
|
using Titanium::invbag::SLOT_END;
|
||||||
using RoF2::invbag::SLOT_COUNT;
|
using Titanium::invbag::SLOT_COUNT;
|
||||||
|
|
||||||
using RoF2::invslot::WORLD_END;
|
using Titanium::invbag::GENERAL_BAGS_BEGIN;
|
||||||
|
|
||||||
const int16 GENERAL_BAGS_BEGIN = WORLD_END + 1;
|
|
||||||
const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT;
|
const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT;
|
||||||
const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1;
|
const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
const int16 GENERAL_BAGS_8_COUNT = 8 * SLOT_COUNT;
|
const int16 GENERAL_BAGS_8_COUNT = 8 * SLOT_COUNT;
|
||||||
const int16 GENERAL_BAGS_8_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_8_COUNT) - 1;
|
const int16 GENERAL_BAGS_8_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_8_COUNT) - 1;
|
||||||
|
|
||||||
const int16 CURSOR_BAG_BEGIN = GENERAL_BAGS_END + 1;
|
const int16 CURSOR_BAG_BEGIN = 351;
|
||||||
const int16 CURSOR_BAG_COUNT = SLOT_COUNT;
|
const int16 CURSOR_BAG_COUNT = SLOT_COUNT;
|
||||||
const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1;
|
const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1;
|
||||||
|
|
||||||
const int16 BANK_BAGS_BEGIN = CURSOR_BAG_END + 1;
|
using Titanium::invbag::BANK_BAGS_BEGIN;
|
||||||
const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT);
|
const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT);
|
||||||
const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1;
|
const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
const int16 BANK_BAGS_16_COUNT = 16 * SLOT_COUNT;
|
const int16 BANK_BAGS_16_COUNT = 16 * SLOT_COUNT;
|
||||||
const int16 BANK_BAGS_16_END = (BANK_BAGS_BEGIN + BANK_BAGS_16_COUNT) - 1;
|
const int16 BANK_BAGS_16_END = (BANK_BAGS_BEGIN + BANK_BAGS_16_COUNT) - 1;
|
||||||
|
|
||||||
const int16 SHARED_BANK_BAGS_BEGIN = BANK_BAGS_END + 1;
|
using Titanium::invbag::SHARED_BANK_BAGS_BEGIN;
|
||||||
const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT;
|
const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT;
|
||||||
const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1;
|
const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
const int16 TRADE_BAGS_BEGIN = SHARED_BANK_BAGS_END + 1;
|
using Titanium::invbag::TRADE_BAGS_BEGIN;
|
||||||
const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT;
|
const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT;
|
||||||
const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1;
|
const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
using RoF2::invbag::GetInvBagIndexName;
|
using Titanium::invbag::GetInvBagIndexName;
|
||||||
|
|
||||||
} // namespace invbag
|
} // namespace invbag
|
||||||
|
|
||||||
@@ -356,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);
|
||||||
|
|
||||||
@@ -752,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;
|
||||||
|
|||||||
+1
-8
@@ -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),
|
||||||
@@ -472,6 +465,7 @@ N(OP_SendAAStats),
|
|||||||
N(OP_SendAATable),
|
N(OP_SendAATable),
|
||||||
N(OP_SendCharInfo),
|
N(OP_SendCharInfo),
|
||||||
N(OP_SendExpZonein),
|
N(OP_SendExpZonein),
|
||||||
|
N(OP_SendFindableLocations),
|
||||||
N(OP_SendFindableNPCs),
|
N(OP_SendFindableNPCs),
|
||||||
N(OP_SendGuildTributes),
|
N(OP_SendGuildTributes),
|
||||||
N(OP_SendLoginInfo),
|
N(OP_SendLoginInfo),
|
||||||
@@ -574,7 +568,6 @@ N(OP_TradeRequestAck),
|
|||||||
N(OP_TraderItemUpdate),
|
N(OP_TraderItemUpdate),
|
||||||
N(OP_TraderShop),
|
N(OP_TraderShop),
|
||||||
N(OP_TradeSkillCombine),
|
N(OP_TradeSkillCombine),
|
||||||
N(OP_TradeSkillRecipeInspect),
|
|
||||||
N(OP_Translocate),
|
N(OP_Translocate),
|
||||||
N(OP_TributeInfo),
|
N(OP_TributeInfo),
|
||||||
N(OP_TributeItem),
|
N(OP_TributeItem),
|
||||||
|
|||||||
+37
-1
@@ -974,6 +974,43 @@ namespace ZoneBlockedSpellTypes {
|
|||||||
const uint8 Region = 2;
|
const uint8 Region = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class DynamicZoneType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Expedition,
|
||||||
|
Tutorial,
|
||||||
|
Task,
|
||||||
|
Mission, // Shared Task
|
||||||
|
Quest
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DynamicZoneMemberStatus : uint8_t
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
Online,
|
||||||
|
Offline,
|
||||||
|
InDynamicZone,
|
||||||
|
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,
|
||||||
@@ -1095,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*/
|
||||||
|
|||||||
+28
-36
@@ -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
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -173,7 +165,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL
|
ClientUnknown::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
ClientUnknown::INULL,
|
ClientUnknown::INULL,
|
||||||
@@ -200,7 +192,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||||
Client62::INULL, Client62::INULL, Client62::INULL
|
Client62::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
Client62::INULL,
|
Client62::INULL,
|
||||||
@@ -227,7 +219,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::invtype::OTHER_SIZE
|
Titanium::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
Titanium::invslot::EQUIPMENT_BITMASK,
|
Titanium::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -254,7 +246,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
||||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||||
SoF::INULL, SoF::INULL, SoF::invtype::OTHER_SIZE
|
SoF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
SoF::invslot::EQUIPMENT_BITMASK,
|
SoF::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -281,7 +273,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
||||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||||
SoD::INULL, SoD::INULL, SoD::invtype::OTHER_SIZE
|
SoD::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
SoD::invslot::EQUIPMENT_BITMASK,
|
SoD::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -308,7 +300,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
||||||
UF::INULL, UF::INULL, UF::INULL,
|
UF::INULL, UF::INULL, UF::INULL,
|
||||||
UF::INULL, UF::INULL, UF::invtype::OTHER_SIZE
|
UF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
UF::invslot::EQUIPMENT_BITMASK,
|
UF::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -335,7 +327,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::invtype::ALT_STORAGE_SIZE, RoF::invtype::ARCHIVED_SIZE,
|
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::invtype::ALT_STORAGE_SIZE, RoF::invtype::ARCHIVED_SIZE,
|
||||||
RoF::invtype::MAIL_SIZE, RoF::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF::INULL,
|
RoF::invtype::MAIL_SIZE, RoF::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF::INULL,
|
||||||
RoF::INULL,RoF::INULL,RoF::invtype::OTHER_SIZE
|
RoF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF::invslot::EQUIPMENT_BITMASK,
|
RoF::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -362,7 +354,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
||||||
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
||||||
RoF2::invtype::GUILD_BANK_MAIN_SIZE,RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE, RoF2::invtype::OTHER_SIZE
|
RoF2::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF2::invslot::EQUIPMENT_BITMASK,
|
RoF2::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -389,7 +381,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,EntityLimits::NPC::INULL
|
EntityLimits::NPC::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL,
|
||||||
@@ -416,7 +408,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL
|
EntityLimits::NPCMerchant::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL,
|
||||||
@@ -443,7 +435,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL
|
EntityLimits::Merc::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL,
|
||||||
@@ -470,7 +462,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL
|
EntityLimits::Bot::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -497,7 +489,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL
|
EntityLimits::ClientPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL,
|
||||||
@@ -524,7 +516,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL
|
EntityLimits::NPCPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL,
|
||||||
@@ -551,7 +543,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL
|
EntityLimits::MercPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL,
|
||||||
@@ -578,7 +570,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL
|
EntityLimits::BotPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL,
|
||||||
@@ -605,7 +597,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::INULL
|
Titanium::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
Titanium::INULL,
|
Titanium::INULL,
|
||||||
@@ -632,7 +624,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
||||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||||
SoF::INULL, SoF::INULL, SoF::INULL
|
SoF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
SoF::INULL,
|
SoF::INULL,
|
||||||
@@ -659,7 +651,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
||||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||||
SoD::INULL, SoD::INULL, SoD::INULL
|
SoD::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
SoD::INULL,
|
SoD::INULL,
|
||||||
@@ -686,7 +678,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::INULL, UF::INULL,
|
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::INULL, UF::INULL,
|
||||||
UF::INULL, UF::INULL, UF::INULL,
|
UF::INULL, UF::INULL, UF::INULL,
|
||||||
UF::INULL, UF::INULL, UF::INULL
|
UF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
UF::INULL,
|
UF::INULL,
|
||||||
@@ -713,7 +705,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
||||||
RoF::INULL, RoF::INULL, RoF::INULL,
|
RoF::INULL, RoF::INULL, RoF::INULL,
|
||||||
RoF::INULL, RoF::INULL, RoF::INULL
|
RoF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF::INULL,
|
RoF::INULL,
|
||||||
@@ -740,7 +732,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
||||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
||||||
RoF2::INULL, RoF2::INULL, RoF2::INULL
|
RoF2::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF2::INULL,
|
RoF2::INULL,
|
||||||
|
|||||||
+5
-8
@@ -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)
|
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,7 +84,7 @@ namespace EQ
|
|||||||
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
||||||
int16 ViewMODLimbo, AltStorage, Archived;
|
int16 ViewMODLimbo, AltStorage, Archived;
|
||||||
int16 Mail, GuildTrophyTribute, Krono;
|
int16 Mail, GuildTrophyTribute, Krono;
|
||||||
int16 GuildBankMain,GuildBankDeposit, Other;
|
int16 Other;
|
||||||
|
|
||||||
InventoryTypeSize_Struct(
|
InventoryTypeSize_Struct(
|
||||||
int16 Possessions, int16 Bank, int16 SharedBank,
|
int16 Possessions, int16 Bank, int16 SharedBank,
|
||||||
@@ -98,7 +95,7 @@ namespace EQ
|
|||||||
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
||||||
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
||||||
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
||||||
int16 GuildBankMain,int16 GuildBankDeposit, int16 Other
|
int16 Other
|
||||||
) :
|
) :
|
||||||
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
||||||
Trade(Trade), World(World), Limbo(Limbo),
|
Trade(Trade), World(World), Limbo(Limbo),
|
||||||
@@ -108,7 +105,7 @@ namespace EQ
|
|||||||
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
||||||
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
||||||
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
||||||
GuildBankMain(GuildBankMain), GuildBankDeposit(GuildBankDeposit), Other(Other)
|
Other(Other)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+66
-155
@@ -19,17 +19,17 @@
|
|||||||
#ifndef EQ_PACKET_STRUCTS_H
|
#ifndef EQ_PACKET_STRUCTS_H
|
||||||
#define EQ_PACKET_STRUCTS_H
|
#define EQ_PACKET_STRUCTS_H
|
||||||
|
|
||||||
#include <list>
|
#include "types.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <list>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "../cereal/include/cereal/archives/binary.hpp"
|
|
||||||
#include "../cereal/include/cereal/types/string.hpp"
|
|
||||||
#include "../cereal/include/cereal/types/vector.hpp"
|
|
||||||
#include "../common/version.h"
|
#include "../common/version.h"
|
||||||
#include "emu_constants.h"
|
#include "emu_constants.h"
|
||||||
#include "textures.h"
|
#include "textures.h"
|
||||||
#include "types.h"
|
#include "../cereal/include/cereal/archives/binary.hpp"
|
||||||
|
#include "../cereal/include/cereal/types/string.hpp"
|
||||||
|
#include "../cereal/include/cereal/types/vector.hpp"
|
||||||
|
|
||||||
static const uint32 BUFF_COUNT = 42;
|
static const uint32 BUFF_COUNT = 42;
|
||||||
static const uint32 PET_BUFF_COUNT = 30;
|
static const uint32 PET_BUFF_COUNT = 30;
|
||||||
@@ -47,7 +47,7 @@ static const uint32 ADVANCED_LORE_LENGTH = 8192;
|
|||||||
*/
|
*/
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
struct LoginInfo {
|
struct LoginInfo_Struct {
|
||||||
/*000*/ char login_info[64];
|
/*000*/ char login_info[64];
|
||||||
/*064*/ uint8 unknown064[124];
|
/*064*/ uint8 unknown064[124];
|
||||||
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
||||||
@@ -3742,8 +3742,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];
|
||||||
@@ -4283,10 +4282,6 @@ struct NewCombine_Struct {
|
|||||||
/*04*/
|
/*04*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TradeSkillRecipeInspect_Struct {
|
|
||||||
uint32 recipe_id;
|
|
||||||
uint32 padding[17]; // unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
//client requesting favorite recipies
|
//client requesting favorite recipies
|
||||||
struct TradeskillFavorites_Struct {
|
struct TradeskillFavorites_Struct {
|
||||||
@@ -4405,11 +4400,6 @@ struct FindPerson_Point {
|
|||||||
float z;
|
float z;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FindPersonRequest_Struct {
|
|
||||||
uint32 npc_id;
|
|
||||||
FindPerson_Point client_pos;
|
|
||||||
};
|
|
||||||
|
|
||||||
//variable length packet of points
|
//variable length packet of points
|
||||||
struct FindPersonResult_Struct {
|
struct FindPersonResult_Struct {
|
||||||
FindPerson_Point dest;
|
FindPerson_Point dest;
|
||||||
@@ -5529,55 +5519,46 @@ struct GuildBankWithdrawItem_Struct
|
|||||||
|
|
||||||
struct GuildBankItemUpdate_Struct
|
struct GuildBankItemUpdate_Struct
|
||||||
{
|
{
|
||||||
void Init(
|
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||||
uint32 inAction,
|
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||||
uint32 inUnknown004,
|
|
||||||
uint16 inSlotID,
|
|
||||||
uint16 inArea,
|
|
||||||
uint16 inUnknown012,
|
|
||||||
uint32 inItemID,
|
|
||||||
uint32 inIcon,
|
|
||||||
uint32 inQuantity,
|
|
||||||
uint32 inPermissions,
|
|
||||||
uint32 inAllowMerge,
|
|
||||||
bool inUseable)
|
|
||||||
{
|
{
|
||||||
action = inAction;
|
Action = inAction;
|
||||||
unknown004 = inUnknown004;
|
Unknown004 = inUnknown004;
|
||||||
slot_id = inSlotID;
|
SlotID = inSlotID;
|
||||||
area = inArea;
|
Area = inArea;
|
||||||
display = inUnknown012;
|
Unknown012 = inUnknown012;
|
||||||
item_id = inItemID;
|
ItemID = inItemID;
|
||||||
icon_id = inIcon;
|
Icon = inIcon;
|
||||||
quantity = inQuantity;
|
Quantity = inQuantity;
|
||||||
permissions = inPermissions;
|
Permissions = inPermissions;
|
||||||
allow_merge = inAllowMerge;
|
AllowMerge = inAllowMerge;
|
||||||
is_useable = inUseable;
|
Useable = inUseable;
|
||||||
item_name[0] = '\0';
|
ItemName[0] = '\0';
|
||||||
donator[0] = '\0';
|
Donator[0] = '\0';
|
||||||
who_for[0] = '\0';
|
WhoFor[0] = '\0';
|
||||||
};
|
};
|
||||||
|
|
||||||
/*000*/ uint32 action;
|
/*000*/ uint32 Action;
|
||||||
/*004*/ uint32 unknown004;
|
/*004*/ uint32 Unknown004;
|
||||||
/*008*/ uint16 slot_id;
|
/*008*/ uint16 SlotID;
|
||||||
/*010*/ uint16 area;
|
/*010*/ uint16 Area;
|
||||||
/*012*/ uint32 display;
|
/*012*/ uint32 Unknown012;
|
||||||
/*016*/ uint32 item_id;
|
/*016*/ uint32 ItemID;
|
||||||
/*020*/ uint32 icon_id;
|
/*020*/ uint32 Icon;
|
||||||
/*024*/ uint32 quantity;
|
/*024*/ uint32 Quantity;
|
||||||
/*028*/ uint32 permissions;
|
/*028*/ uint32 Permissions;
|
||||||
/*032*/ uint8 allow_merge;
|
/*032*/ uint8 AllowMerge;
|
||||||
/*033*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
/*033*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||||
/*034*/ char item_name[64];
|
/*034*/ char ItemName[64];
|
||||||
/*098*/ char donator[64];
|
/*098*/ char Donator[64];
|
||||||
/*162*/ char who_for[64];
|
/*162*/ char WhoFor[64];
|
||||||
/*226*/ uint16 unknown226;
|
/*226*/ uint16 Unknown226;
|
||||||
};
|
};
|
||||||
|
|
||||||
// newer clients (RoF+) send a list that contains 240 entries
|
// newer clients (RoF+) send a list that contains 240 entries
|
||||||
// The packets don't actually use all 64 chars in the strings, but we'll just overallocate for these
|
// The packets don't actually use all 64 chars in the strings, but we'll just overallocate for these
|
||||||
struct GuildBankItemListEntry_Struct {
|
struct GuildBankItemListEntry_Struct
|
||||||
|
{
|
||||||
uint8 vaild;
|
uint8 vaild;
|
||||||
uint32 permissions;
|
uint32 permissions;
|
||||||
char whofor[64];
|
char whofor[64];
|
||||||
@@ -5832,21 +5813,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
|
||||||
{
|
{
|
||||||
@@ -6376,7 +6342,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
|
||||||
};
|
};
|
||||||
@@ -6416,7 +6381,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;
|
||||||
@@ -6438,7 +6402,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),
|
||||||
@@ -6468,88 +6431,36 @@ struct BuylineItemDetails_Struct {
|
|||||||
uint32 item_quantity;
|
uint32 item_quantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PickZoneEntry_Struct {
|
/* Taken from libeq */
|
||||||
int16 zone_id;
|
enum FindLocationType : uint32 {
|
||||||
int16 unknown;
|
LocationUnknown,
|
||||||
int32 player_count;
|
LocationPlayer,
|
||||||
int32 instance_id;
|
LocationPOI,
|
||||||
|
LocationRealEstateItem,
|
||||||
|
LocationRealEstatePlot,
|
||||||
|
LocationMapPoint,
|
||||||
|
LocationSwitch,
|
||||||
|
LocationLocation
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PickZoneWindow_Struct {
|
//For reference
|
||||||
char padding000[64];
|
struct FindableLocation_Struct {
|
||||||
int64 session_id;
|
/*00*/ FindLocationType type;
|
||||||
int8 option_count;
|
/*04*/ int32 id;
|
||||||
char padding073[23];
|
/*08*/ int32 sub_id;
|
||||||
PickZoneEntry_Struct entries[10];
|
/*12*/ int32 zone_id;
|
||||||
|
/*16*/ int32 zone_point_identifier;
|
||||||
|
/*20*/ float y;
|
||||||
|
/*24*/ float x;
|
||||||
|
/*28*/ float z;
|
||||||
|
/*32*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PickZone_Struct {
|
struct FindPersonRequest_Struct {
|
||||||
int64 session_id;
|
FindLocationType type;
|
||||||
int32 selection_id;
|
int32 id;
|
||||||
};
|
FindPerson_Point client_pos;
|
||||||
|
FindPerson_Point target_pos;
|
||||||
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
|
||||||
|
|||||||
@@ -147,8 +147,6 @@ void EQEmuConfig::parse_config()
|
|||||||
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
||||||
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
||||||
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
||||||
QSHost = _root["server"]["queryserver"].get("host", "localhost").asString();
|
|
||||||
QSPort = Strings::ToUnsignedInt(_root["server"]["queryserver"].get("port", "9500").asString());
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zones
|
* Zones
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ class EQEmuConfig
|
|||||||
std::string QSDatabasePassword;
|
std::string QSDatabasePassword;
|
||||||
std::string QSDatabaseDB;
|
std::string QSDatabaseDB;
|
||||||
uint16 QSDatabasePort;
|
uint16 QSDatabasePort;
|
||||||
std::string QSHost;
|
|
||||||
int QSPort;
|
|
||||||
|
|
||||||
// From <files/>
|
// From <files/>
|
||||||
std::string SpellsFile;
|
std::string SpellsFile;
|
||||||
@@ -139,9 +137,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()
|
||||||
|
|||||||
+1
-21
@@ -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);
|
||||||
@@ -105,8 +102,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
|||||||
log_settings[Logs::QuestErrors].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::QuestErrors].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::EqTime].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::EqTime].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::EqTime].log_to_gmsay = static_cast<uint8>(Logs::General);
|
log_settings[Logs::EqTime].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::NpcHandin].log_to_console = static_cast<uint8>(Logs::General);
|
|
||||||
log_settings[Logs::NpcHandin].log_to_gmsay = static_cast<uint8>(Logs::General);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC 5424
|
* RFC 5424
|
||||||
@@ -537,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...
|
||||||
*/
|
*/
|
||||||
@@ -601,8 +591,6 @@ void EQEmuLogSys::SilenceConsoleLogging()
|
|||||||
log_settings[log_index].is_category_enabled = 0;
|
log_settings[log_index].is_category_enabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::MySQLError);
|
|
||||||
log_settings[Logs::Error].log_to_console = static_cast<uint8>(Logs::Error);
|
|
||||||
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +602,7 @@ void EQEmuLogSys::EnableConsoleLogging()
|
|||||||
std::copy(std::begin(pre_silence_settings), std::end(pre_silence_settings), std::begin(log_settings));
|
std::copy(std::begin(pre_silence_settings), std::end(pre_silence_settings), std::begin(log_settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||||
{
|
{
|
||||||
InjectTablesIfNotExist();
|
InjectTablesIfNotExist();
|
||||||
|
|
||||||
@@ -699,10 +687,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (silent_load) {
|
|
||||||
SilenceConsoleLogging();
|
|
||||||
}
|
|
||||||
|
|
||||||
LogInfo("Loaded [{}] log categories", categories.size());
|
LogInfo("Loaded [{}] log categories", categories.size());
|
||||||
|
|
||||||
auto webhooks = DiscordWebhooksRepository::GetWhere(*m_database, fmt::format("id < {}", MAX_DISCORD_WEBHOOK_ID));
|
auto webhooks = DiscordWebhooksRepository::GetWhere(*m_database, fmt::format("id < {}", MAX_DISCORD_WEBHOOK_ID));
|
||||||
@@ -720,10 +704,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
|||||||
log_settings[Logs::Info].log_to_file = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Info].log_to_file = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
|
|
||||||
if (silent_load) {
|
|
||||||
SilenceConsoleLogging();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-18
@@ -142,14 +142,6 @@ namespace Logs {
|
|||||||
EqTime,
|
EqTime,
|
||||||
Corpses,
|
Corpses,
|
||||||
XTargets,
|
XTargets,
|
||||||
EvolveItem,
|
|
||||||
PositionUpdate,
|
|
||||||
KSM,
|
|
||||||
BotSettings,
|
|
||||||
BotSpellChecks,
|
|
||||||
BotSpellTypeChecks,
|
|
||||||
NpcHandin,
|
|
||||||
ZoneState,
|
|
||||||
MaxCategoryID /* Don't Remove this */
|
MaxCategoryID /* Don't Remove this */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -250,15 +242,7 @@ namespace Logs {
|
|||||||
"Zoning",
|
"Zoning",
|
||||||
"EqTime",
|
"EqTime",
|
||||||
"Corpses",
|
"Corpses",
|
||||||
"XTargets",
|
"XTargets"
|
||||||
"EvolveItem",
|
|
||||||
"PositionUpdate",
|
|
||||||
"KSM", // Kernel Samepage Merging
|
|
||||||
"Bot Settings",
|
|
||||||
"Bot Spell Checks",
|
|
||||||
"Bot Spell Type Checks",
|
|
||||||
"NpcHandin",
|
|
||||||
"ZoneState"
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +263,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void CloseFileLogs();
|
void CloseFileLogs();
|
||||||
EQEmuLogSys *LoadLogSettingsDefaults();
|
EQEmuLogSys *LoadLogSettingsDefaults();
|
||||||
EQEmuLogSys *LoadLogDatabaseSettings(bool silent_load = false);
|
EQEmuLogSys *LoadLogDatabaseSettings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param directory_name
|
* @param directory_name
|
||||||
|
|||||||
@@ -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,76 +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 LogBotSettings(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::BotSettings))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::BotSettings, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogBotSettingsDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::BotSettings))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::BotSettings, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogBotSpellChecks(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::BotSpellChecks))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::BotSpellChecks, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogBotSpellChecksDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::BotSpellChecks))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::BotSpellChecks, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogBotSpellTypeChecks(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::BotSpellTypeChecks))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::BotSpellTypeChecks, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogBotSpellTypeChecksDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::BotSpellTypeChecks))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::BotSpellTypeChecks, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogNpcHandin(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::NpcHandin))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::NpcHandin, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogNpcHandinDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::NpcHandin))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::NpcHandin, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogZoneState(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::General, Logs::ZoneState))\
|
|
||||||
OutF(LogSys, Logs::General, Logs::ZoneState, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define LogZoneStateDetail(message, ...) do {\
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::ZoneState))\
|
|
||||||
OutF(LogSys, Logs::Detail, Logs::ZoneState, __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__);\
|
||||||
|
|||||||
@@ -714,18 +714,6 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
|
|||||||
h.charges > 1 ? fmt::format(" Charges: {}", h.charges) : "",
|
h.charges > 1 ? fmt::format(" Charges: {}", h.charges) : "",
|
||||||
h.attuned ? " (Attuned)" : ""
|
h.attuned ? " (Attuned)" : ""
|
||||||
);
|
);
|
||||||
|
|
||||||
for (int i = 0; i < h.augment_ids.size(); i++) {
|
|
||||||
if (!Strings::EqualFold(h.augment_names[i], "None")) {
|
|
||||||
const uint8 slot_id = (i + 1);
|
|
||||||
handin_items_info += fmt::format(
|
|
||||||
"Augment {}: {} ({})\n",
|
|
||||||
slot_id,
|
|
||||||
h.augment_names[i],
|
|
||||||
h.augment_ids[i]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -739,18 +727,6 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
|
|||||||
r.charges > 1 ? fmt::format(" Charges: {}", r.charges) : "",
|
r.charges > 1 ? fmt::format(" Charges: {}", r.charges) : "",
|
||||||
r.attuned ? " (Attuned)" : ""
|
r.attuned ? " (Attuned)" : ""
|
||||||
);
|
);
|
||||||
|
|
||||||
for (int i = 0; i < r.augment_ids.size(); i++) {
|
|
||||||
if (!Strings::EqualFold(r.augment_names[i], "None")) {
|
|
||||||
const uint8 slot_id = (i + 1);
|
|
||||||
return_items_info += fmt::format(
|
|
||||||
"Augment {}: {} ({})\n",
|
|
||||||
slot_id,
|
|
||||||
r.augment_names[i],
|
|
||||||
r.augment_ids[i]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1081,51 +1057,51 @@ std::string PlayerEventDiscordFormatter::FormatTradeEvent(
|
|||||||
if (!e.character_1_give_items.empty()) {
|
if (!e.character_1_give_items.empty()) {
|
||||||
for (const auto &i: e.character_1_give_items) {
|
for (const auto &i: e.character_1_give_items) {
|
||||||
std::string augment_info;
|
std::string augment_info;
|
||||||
if (i.augment_1_id > 0) {
|
if (i.aug_1_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 1: {} ({})",
|
"Augment 1: {} ({})",
|
||||||
i.augment_1_name,
|
i.aug_1_item_name,
|
||||||
i.augment_1_id
|
i.aug_1_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_2_id > 0) {
|
if (i.aug_2_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 2: {} ({})",
|
"Augment 2: {} ({})",
|
||||||
i.augment_2_name,
|
i.aug_2_item_name,
|
||||||
i.augment_2_id
|
i.aug_2_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_3_id > 0) {
|
if (i.aug_3_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 3: {} ({})",
|
"Augment 3: {} ({})",
|
||||||
i.augment_3_name,
|
i.aug_3_item_name,
|
||||||
i.augment_3_id
|
i.aug_3_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_4_id > 0) {
|
if (i.aug_4_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 4: {} ({})\n",
|
"Augment 4: {} ({})\n",
|
||||||
i.augment_4_name,
|
i.aug_4_item_name,
|
||||||
i.augment_4_id
|
i.aug_4_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_5_id > 0) {
|
if (i.aug_5_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 5: {} ({})\n",
|
"Augment 5: {} ({})\n",
|
||||||
i.augment_5_name,
|
i.aug_5_item_name,
|
||||||
i.augment_5_id
|
i.aug_5_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_6_id > 0) {
|
if (i.aug_6_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 6: {} ({})",
|
"Augment 6: {} ({})",
|
||||||
i.augment_6_name,
|
i.aug_6_item_name,
|
||||||
i.augment_6_id
|
i.aug_6_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1146,51 +1122,51 @@ std::string PlayerEventDiscordFormatter::FormatTradeEvent(
|
|||||||
if (!e.character_2_give_items.empty()) {
|
if (!e.character_2_give_items.empty()) {
|
||||||
for (const auto &i: e.character_2_give_items) {
|
for (const auto &i: e.character_2_give_items) {
|
||||||
std::string augment_info;
|
std::string augment_info;
|
||||||
if (i.augment_1_id > 0) {
|
if (i.aug_1_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 1: {} ({})",
|
"Augment 1: {} ({})",
|
||||||
i.augment_1_name,
|
i.aug_1_item_name,
|
||||||
i.augment_1_id
|
i.aug_1_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_2_id > 0) {
|
if (i.aug_2_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 2: {} ({})",
|
"Augment 2: {} ({})",
|
||||||
i.augment_2_name,
|
i.aug_2_item_name,
|
||||||
i.augment_2_id
|
i.aug_2_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_3_id > 0) {
|
if (i.aug_3_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 3: {} ({})",
|
"Augment 3: {} ({})",
|
||||||
i.augment_3_name,
|
i.aug_3_item_name,
|
||||||
i.augment_3_id
|
i.aug_3_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_4_id > 0) {
|
if (i.aug_4_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 4: {} ({})\n",
|
"Augment 4: {} ({})\n",
|
||||||
i.augment_4_name,
|
i.aug_4_item_name,
|
||||||
i.augment_4_id
|
i.aug_4_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_5_id > 0) {
|
if (i.aug_5_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 5: {} ({})\n",
|
"Augment 5: {} ({})\n",
|
||||||
i.augment_5_name,
|
i.aug_5_item_name,
|
||||||
i.augment_5_id
|
i.aug_5_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.augment_6_id > 0) {
|
if (i.aug_6_item_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 6: {} ({})",
|
"Augment 6: {} ({})",
|
||||||
i.augment_6_name,
|
i.aug_6_item_name,
|
||||||
i.augment_6_id
|
i.aug_6_item_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,14 @@
|
|||||||
#include "player_event_logs.h"
|
|
||||||
#include <cereal/archives/json.hpp>
|
#include <cereal/archives/json.hpp>
|
||||||
|
#include "player_event_logs.h"
|
||||||
|
#include "player_event_discord_formatter.h"
|
||||||
#include "../platform.h"
|
#include "../platform.h"
|
||||||
#include "../rulesys.h"
|
#include "../rulesys.h"
|
||||||
#include "player_event_discord_formatter.h"
|
|
||||||
#include "../repositories/player_event_loot_items_repository.h"
|
|
||||||
#include "../repositories/player_event_merchant_sell_repository.h"
|
|
||||||
#include "../repositories/player_event_merchant_purchase_repository.h"
|
|
||||||
#include "../repositories/player_event_npc_handin_repository.h"
|
|
||||||
#include "../repositories/player_event_npc_handin_entries_repository.h"
|
|
||||||
|
|
||||||
const uint32 PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL = 60 * 60 * 1000; // 1 hour
|
const uint32 PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL = 60 * 60 * 1000; // 1 hour
|
||||||
|
|
||||||
// general initialization routine
|
// general initialization routine
|
||||||
void PlayerEventLogs::Init()
|
void PlayerEventLogs::Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_process_batch_events_timer.SetTimer(RuleI(Logging, BatchPlayerEventProcessIntervalSeconds) * 1000);
|
m_process_batch_events_timer.SetTimer(RuleI(Logging, BatchPlayerEventProcessIntervalSeconds) * 1000);
|
||||||
m_process_retention_truncation_timer.SetTimer(PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL);
|
m_process_retention_truncation_timer.SetTimer(PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL);
|
||||||
|
|
||||||
@@ -28,7 +21,6 @@ void PlayerEventLogs::Init()
|
|||||||
m_settings[i].event_enabled = 1;
|
m_settings[i].event_enabled = 1;
|
||||||
m_settings[i].retention_days = 0;
|
m_settings[i].retention_days = 0;
|
||||||
m_settings[i].discord_webhook_id = 0;
|
m_settings[i].discord_webhook_id = 0;
|
||||||
m_settings[i].etl_enabled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSettingsDefaults();
|
SetSettingsDefaults();
|
||||||
@@ -73,7 +65,6 @@ void PlayerEventLogs::Init()
|
|||||||
c.event_name = PlayerEvent::EventName[i];
|
c.event_name = PlayerEvent::EventName[i];
|
||||||
c.event_enabled = m_settings[i].event_enabled;
|
c.event_enabled = m_settings[i].event_enabled;
|
||||||
c.retention_days = m_settings[i].retention_days;
|
c.retention_days = m_settings[i].retention_days;
|
||||||
c.etl_enabled = false;
|
|
||||||
settings_to_insert.emplace_back(c);
|
settings_to_insert.emplace_back(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +78,6 @@ void PlayerEventLogs::Init()
|
|||||||
|
|
||||||
// on initial boot process truncation
|
// on initial boot process truncation
|
||||||
if (processing_in_world || processing_in_qs) {
|
if (processing_in_world || processing_in_qs) {
|
||||||
LoadEtlIds();
|
|
||||||
ProcessRetentionTruncation();
|
ProcessRetentionTruncation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,319 +121,23 @@ void PlayerEventLogs::ProcessBatchQueue()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::map<uint32, uint32> counter{};
|
|
||||||
counter.clear();
|
|
||||||
for (auto const &e: m_record_batch_queue) {
|
|
||||||
counter[e.event_type_id]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
BenchTimer benchmark;
|
BenchTimer benchmark;
|
||||||
|
|
||||||
EtlQueues etl_queues{};
|
|
||||||
for (const auto &[type, count]: counter) {
|
|
||||||
if (count > 0) {
|
|
||||||
switch (type) {
|
|
||||||
case PlayerEvent::TRADE:
|
|
||||||
etl_queues.trade.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::SPEECH:
|
|
||||||
etl_queues.speech.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::LOOT_ITEM:
|
|
||||||
etl_queues.loot_items.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::KILLED_NPC:
|
|
||||||
etl_queues.killed_npc.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::NPC_HANDIN:
|
|
||||||
etl_queues.npc_handin.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::AA_PURCHASE:
|
|
||||||
etl_queues.aa_purchase.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::MERCHANT_SELL:
|
|
||||||
etl_queues.merchant_sell.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::KILLED_RAID_NPC:
|
|
||||||
etl_queues.killed_raid_npc.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::KILLED_NAMED_NPC:
|
|
||||||
etl_queues.killed_named_npc.reserve(count);
|
|
||||||
break;
|
|
||||||
case PlayerEvent::MERCHANT_PURCHASE:
|
|
||||||
etl_queues.merchant_purchase.reserve(count);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper to deserialize event data
|
|
||||||
auto Deserialize = [](const std::string &data, auto &out) {
|
|
||||||
std::stringstream ss(data);
|
|
||||||
cereal::JSONInputArchive ar(ss);
|
|
||||||
out.serialize(ar);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper to assign ETL table ID
|
|
||||||
auto AssignEtlId = [&](
|
|
||||||
PlayerEventLogsRepository::PlayerEventLogs &r,
|
|
||||||
PlayerEvent::EventType type
|
|
||||||
) {
|
|
||||||
if (m_etl_settings.contains(type)) {
|
|
||||||
r.etl_table_id = m_etl_settings.at(type).next_id++;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Define event processors
|
|
||||||
std::unordered_map<PlayerEvent::EventType, std::function<void(PlayerEventLogsRepository::PlayerEventLogs &)>> event_processors = {
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::LOOT_ITEM, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::LootItemEvent in{};
|
|
||||||
PlayerEventLootItemsRepository::PlayerEventLootItems out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.charges = in.charges;
|
|
||||||
out.corpse_name = in.corpse_name;
|
|
||||||
out.item_id = in.item_id;
|
|
||||||
out.item_name = in.item_name;
|
|
||||||
out.augment_1_id = in.augment_1_id;
|
|
||||||
out.augment_2_id = in.augment_2_id;
|
|
||||||
out.augment_3_id = in.augment_3_id;
|
|
||||||
out.augment_4_id = in.augment_4_id;
|
|
||||||
out.augment_5_id = in.augment_5_id;
|
|
||||||
out.augment_6_id = in.augment_6_id;
|
|
||||||
out.npc_id = in.npc_id;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::LOOT_ITEM);
|
|
||||||
etl_queues.loot_items.push_back(out);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::MERCHANT_SELL, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::MerchantSellEvent in{};
|
|
||||||
PlayerEventMerchantSellRepository::PlayerEventMerchantSell out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.npc_id = in.npc_id;
|
|
||||||
out.merchant_name = in.merchant_name;
|
|
||||||
out.merchant_type = in.merchant_type;
|
|
||||||
out.item_id = in.item_id;
|
|
||||||
out.item_name = in.item_name;
|
|
||||||
out.charges = in.charges;
|
|
||||||
out.cost = in.cost;
|
|
||||||
out.alternate_currency_id = in.alternate_currency_id;
|
|
||||||
out.player_money_balance = in.player_money_balance;
|
|
||||||
out.player_currency_balance = in.player_currency_balance;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::MERCHANT_SELL);
|
|
||||||
etl_queues.merchant_sell.push_back(out);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::MERCHANT_PURCHASE, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::MerchantPurchaseEvent in{};
|
|
||||||
PlayerEventMerchantPurchaseRepository::PlayerEventMerchantPurchase out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.npc_id = in.npc_id;
|
|
||||||
out.merchant_name = in.merchant_name;
|
|
||||||
out.merchant_type = in.merchant_type;
|
|
||||||
out.item_id = in.item_id;
|
|
||||||
out.item_name = in.item_name;
|
|
||||||
out.charges = in.charges;
|
|
||||||
out.cost = in.cost;
|
|
||||||
out.alternate_currency_id = in.alternate_currency_id;
|
|
||||||
out.player_money_balance = in.player_money_balance;
|
|
||||||
out.player_currency_balance = in.player_currency_balance;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::MERCHANT_PURCHASE);
|
|
||||||
etl_queues.merchant_purchase.push_back(out);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::NPC_HANDIN, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::HandinEvent in{};
|
|
||||||
PlayerEventNpcHandinRepository::PlayerEventNpcHandin out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.npc_id = in.npc_id;
|
|
||||||
out.npc_name = in.npc_name;
|
|
||||||
out.handin_copper = in.handin_money.copper;
|
|
||||||
out.handin_silver = in.handin_money.silver;
|
|
||||||
out.handin_gold = in.handin_money.gold;
|
|
||||||
out.handin_platinum = in.handin_money.platinum;
|
|
||||||
out.return_copper = in.return_money.copper;
|
|
||||||
out.return_silver = in.return_money.silver;
|
|
||||||
out.return_gold = in.return_money.gold;
|
|
||||||
out.return_platinum = in.return_money.platinum;
|
|
||||||
out.is_quest_handin = in.is_quest_handin;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::NPC_HANDIN);
|
|
||||||
etl_queues.npc_handin.push_back(out);
|
|
||||||
|
|
||||||
for (const auto &i: in.handin_items) {
|
|
||||||
PlayerEventNpcHandinEntriesRepository::PlayerEventNpcHandinEntries entry{};
|
|
||||||
entry.player_event_npc_handin_id = r.etl_table_id;
|
|
||||||
entry.item_id = i.item_id;
|
|
||||||
entry.charges = i.charges;
|
|
||||||
entry.type = 1;
|
|
||||||
etl_queues.npc_handin_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
for (const auto &i: in.return_items) {
|
|
||||||
PlayerEventNpcHandinEntriesRepository::PlayerEventNpcHandinEntries entry{};
|
|
||||||
entry.player_event_npc_handin_id = r.etl_table_id;
|
|
||||||
entry.item_id = i.item_id;
|
|
||||||
entry.charges = i.charges;
|
|
||||||
entry.type = 2;
|
|
||||||
etl_queues.npc_handin_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::TRADE, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::TradeEvent in{};
|
|
||||||
PlayerEventTradeRepository::PlayerEventTrade out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.char1_id = in.character_1_id;
|
|
||||||
out.char2_id = in.character_2_id;
|
|
||||||
out.char1_copper = in.character_1_give_money.copper;
|
|
||||||
out.char1_silver = in.character_1_give_money.silver;
|
|
||||||
out.char1_gold = in.character_1_give_money.gold;
|
|
||||||
out.char1_platinum = in.character_1_give_money.platinum;
|
|
||||||
out.char2_copper = in.character_2_give_money.copper;
|
|
||||||
out.char2_silver = in.character_2_give_money.silver;
|
|
||||||
out.char2_gold = in.character_2_give_money.gold;
|
|
||||||
out.char2_platinum = in.character_2_give_money.platinum;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::TRADE);
|
|
||||||
etl_queues.trade.push_back(out);
|
|
||||||
|
|
||||||
for (const auto &i: in.character_1_give_items) {
|
|
||||||
PlayerEventTradeEntriesRepository::PlayerEventTradeEntries entry{};
|
|
||||||
entry.player_event_trade_id = r.etl_table_id;
|
|
||||||
entry.char_id = in.character_1_id;
|
|
||||||
entry.item_id = i.item_id;
|
|
||||||
entry.charges = i.charges;
|
|
||||||
entry.slot = i.slot;
|
|
||||||
etl_queues.trade_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
for (const auto &i: in.character_2_give_items) {
|
|
||||||
PlayerEventTradeEntriesRepository::PlayerEventTradeEntries entry{};
|
|
||||||
entry.player_event_trade_id = r.etl_table_id;
|
|
||||||
entry.char_id = in.character_2_id;
|
|
||||||
entry.item_id = i.item_id;
|
|
||||||
entry.charges = i.charges;
|
|
||||||
entry.slot = i.slot;
|
|
||||||
etl_queues.trade_entries.push_back(entry);
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::SPEECH, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::PlayerSpeech in{};
|
|
||||||
PlayerEventSpeechRepository::PlayerEventSpeech out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.from_char_id = in.from;
|
|
||||||
out.to_char_id = in.to;
|
|
||||||
out.type = in.type;
|
|
||||||
out.min_status = in.min_status;
|
|
||||||
out.message = in.message;
|
|
||||||
out.guild_id = in.guild_id;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::SPEECH);
|
|
||||||
etl_queues.speech.push_back(out);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::KILLED_NPC, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::KilledNPCEvent in{};
|
|
||||||
PlayerEventKilledNpcRepository::PlayerEventKilledNpc out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.npc_id = in.npc_id;
|
|
||||||
out.npc_name = in.npc_name;
|
|
||||||
out.combat_time_seconds = in.combat_time_seconds;
|
|
||||||
out.total_damage_per_second_taken = in.total_damage_per_second_taken;
|
|
||||||
out.total_heal_per_second_taken = in.total_heal_per_second_taken;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::KILLED_NPC);
|
|
||||||
etl_queues.killed_npc.push_back(out);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::EventType::AA_PURCHASE, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
|
||||||
PlayerEvent::AAPurchasedEvent in{};
|
|
||||||
PlayerEventAaPurchaseRepository::PlayerEventAaPurchase out{};
|
|
||||||
Deserialize(r.event_data, in);
|
|
||||||
|
|
||||||
out.aa_ability_id = in.aa_id;
|
|
||||||
out.cost = in.aa_cost;
|
|
||||||
out.previous_id = in.aa_previous_id;
|
|
||||||
out.next_id = in.aa_next_id;
|
|
||||||
out.created_at = r.created_at;
|
|
||||||
|
|
||||||
AssignEtlId(r, PlayerEvent::EventType::AA_PURCHASE);
|
|
||||||
etl_queues.aa_purchase.push_back(out);
|
|
||||||
}},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Process the batch queue
|
|
||||||
for (auto &r: m_record_batch_queue) {
|
|
||||||
if (m_settings[r.event_type_id].etl_enabled) {
|
|
||||||
auto it = event_processors.find(static_cast<PlayerEvent::EventType>(r.event_type_id));
|
|
||||||
if (it != event_processors.end()) {
|
|
||||||
it->second(r); // Call the appropriate lambda
|
|
||||||
r.event_data = "{}"; // Clear event data
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LogPlayerEventsDetail("Non-Implemented ETL routing [{}]", r.event_type_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper to flush and clear queues
|
|
||||||
auto flush_queue = [&](auto insert_many, auto &queue) {
|
|
||||||
if (!queue.empty()) {
|
|
||||||
insert_many(*m_database, queue);
|
|
||||||
queue.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// flush many
|
// flush many
|
||||||
PlayerEventLogsRepository::InsertMany(*m_database, m_record_batch_queue);
|
PlayerEventLogsRepository::InsertMany(*m_database, m_record_batch_queue);
|
||||||
|
LogPlayerEventsDetail(
|
||||||
// flush etl queues
|
|
||||||
flush_queue(PlayerEventLootItemsRepository::InsertMany, etl_queues.loot_items);
|
|
||||||
flush_queue(PlayerEventMerchantSellRepository::InsertMany, etl_queues.merchant_sell);
|
|
||||||
flush_queue(PlayerEventMerchantPurchaseRepository::InsertMany, etl_queues.merchant_purchase);
|
|
||||||
flush_queue(PlayerEventNpcHandinRepository::InsertMany, etl_queues.npc_handin);
|
|
||||||
flush_queue(PlayerEventNpcHandinEntriesRepository::InsertMany, etl_queues.npc_handin_entries);
|
|
||||||
flush_queue(PlayerEventTradeRepository::InsertMany, etl_queues.trade);
|
|
||||||
flush_queue(PlayerEventTradeEntriesRepository::InsertMany, etl_queues.trade_entries);
|
|
||||||
flush_queue(PlayerEventSpeechRepository::InsertMany, etl_queues.speech);
|
|
||||||
flush_queue(PlayerEventKilledNpcRepository::InsertMany, etl_queues.killed_npc);
|
|
||||||
flush_queue(PlayerEventKilledNamedNpcRepository::InsertMany, etl_queues.killed_named_npc);
|
|
||||||
flush_queue(PlayerEventKilledRaidNpcRepository::InsertMany, etl_queues.killed_raid_npc);
|
|
||||||
flush_queue(PlayerEventAaPurchaseRepository::InsertMany, etl_queues.aa_purchase);
|
|
||||||
|
|
||||||
LogPlayerEvents(
|
|
||||||
"Processing batch player event log queue of [{}] took [{}]",
|
"Processing batch player event log queue of [{}] took [{}]",
|
||||||
m_record_batch_queue.size(),
|
m_record_batch_queue.size(),
|
||||||
benchmark.elapsed()
|
benchmark.elapsed()
|
||||||
);
|
);
|
||||||
|
|
||||||
// empty
|
// empty
|
||||||
m_record_batch_queue.clear();
|
m_record_batch_queue = {};
|
||||||
m_batch_queue_lock.unlock();
|
m_batch_queue_lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// adds a player event to the queue
|
// adds a player event to the queue
|
||||||
void PlayerEventLogs::AddToQueue(PlayerEventLogsRepository::PlayerEventLogs &log)
|
void PlayerEventLogs::AddToQueue(const PlayerEventLogsRepository::PlayerEventLogs &log)
|
||||||
{
|
{
|
||||||
m_batch_queue_lock.lock();
|
m_batch_queue_lock.lock();
|
||||||
m_record_batch_queue.emplace_back(log);
|
m_record_batch_queue.emplace_back(log);
|
||||||
@@ -894,7 +588,7 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
LogPlayerEventsDetail(
|
LogInfo(
|
||||||
"Player event [{}] ({}) Discord formatter not implemented",
|
"Player event [{}] ({}) Discord formatter not implemented",
|
||||||
e.player_event_log.event_type_name,
|
e.player_event_log.event_type_name,
|
||||||
e.player_event_log.event_type_id
|
e.player_event_log.event_type_id
|
||||||
@@ -908,8 +602,7 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
|
|||||||
// general process function, used in world or QS depending on rule Logging:PlayerEventsQSProcess
|
// general process function, used in world or QS depending on rule Logging:PlayerEventsQSProcess
|
||||||
void PlayerEventLogs::Process()
|
void PlayerEventLogs::Process()
|
||||||
{
|
{
|
||||||
if (m_process_batch_events_timer.Check() ||
|
if (m_process_batch_events_timer.Check() || m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) {
|
||||||
m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) {
|
|
||||||
ProcessBatchQueue();
|
ProcessBatchQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,117 +613,31 @@ void PlayerEventLogs::Process()
|
|||||||
|
|
||||||
void PlayerEventLogs::ProcessRetentionTruncation()
|
void PlayerEventLogs::ProcessRetentionTruncation()
|
||||||
{
|
{
|
||||||
LogPlayerEventsDetail("Running truncation");
|
LogPlayerEvents("Running truncation");
|
||||||
|
|
||||||
// Map of repository-specific deletion functions
|
|
||||||
std::unordered_map<PlayerEvent::EventType, std::function<uint32(const std::string &)>> repository_deleters = {
|
|
||||||
{
|
|
||||||
PlayerEvent::LOOT_ITEM, [&](const std::string &condition) {
|
|
||||||
return PlayerEventLootItemsRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::MERCHANT_SELL, [&](const std::string &condition) {
|
|
||||||
return PlayerEventMerchantSellRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::MERCHANT_PURCHASE, [&](const std::string &condition) {
|
|
||||||
return PlayerEventMerchantPurchaseRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::NPC_HANDIN, [&](const std::string &condition) {
|
|
||||||
uint32 deleted_count = PlayerEventNpcHandinRepository::DeleteWhere(*m_database, condition);
|
|
||||||
deleted_count += PlayerEventNpcHandinEntriesRepository::DeleteWhere(*m_database, condition);
|
|
||||||
return deleted_count;
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::TRADE, [&](const std::string &condition) {
|
|
||||||
uint32 deleted_count = PlayerEventTradeRepository::DeleteWhere(*m_database, condition);
|
|
||||||
deleted_count += PlayerEventTradeEntriesRepository::DeleteWhere(*m_database, condition);
|
|
||||||
return deleted_count;
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::SPEECH, [&](const std::string &condition) {
|
|
||||||
return PlayerEventSpeechRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::KILLED_NPC, [&](const std::string &condition) {
|
|
||||||
return PlayerEventKilledNpcRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::KILLED_NAMED_NPC, [&](const std::string &condition) {
|
|
||||||
return PlayerEventKilledNamedNpcRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::KILLED_RAID_NPC, [&](const std::string &condition) {
|
|
||||||
return PlayerEventKilledRaidNpcRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}},
|
|
||||||
{
|
|
||||||
PlayerEvent::AA_PURCHASE, [&](const std::string &condition) {
|
|
||||||
return PlayerEventAaPurchaseRepository::DeleteWhere(*m_database, condition);
|
|
||||||
}}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Group event types by retention interval
|
|
||||||
std::unordered_map<int, std::vector<int>> retention_groups;
|
|
||||||
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
||||||
if (m_settings[i].retention_days > 0) {
|
if (m_settings[i].retention_days > 0) {
|
||||||
retention_groups[m_settings[i].retention_days].push_back(i);
|
int deleted_count = PlayerEventLogsRepository::DeleteWhere(
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto &[retention_days, event_types]: retention_groups) {
|
|
||||||
std::string condition = fmt::format(
|
|
||||||
"created_at < (NOW() - INTERVAL {} DAY)",
|
|
||||||
retention_days
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle ETL deletions for each event type in the group
|
|
||||||
uint32 total_deleted_count = 0;
|
|
||||||
for (int event_type_id: event_types) {
|
|
||||||
if (m_settings[event_type_id].etl_enabled) {
|
|
||||||
auto it = repository_deleters.find(static_cast<PlayerEvent::EventType>(m_settings[event_type_id].id));
|
|
||||||
if (it != repository_deleters.end()) {
|
|
||||||
total_deleted_count += it->second(condition);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LogError("Non-Implemented ETL Event Type [{}]", static_cast<uint32>(m_settings[event_type_id].id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (total_deleted_count > 0) {
|
|
||||||
LogInfo(
|
|
||||||
"Truncated [{}] ETL events older than [{}] days",
|
|
||||||
total_deleted_count,
|
|
||||||
retention_days
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Batch deletion for player_event_logs
|
|
||||||
std::string event_type_ids = fmt::format(
|
|
||||||
"({})",
|
|
||||||
fmt::join(event_types, ", ")
|
|
||||||
);
|
|
||||||
|
|
||||||
uint32 deleted_count = PlayerEventLogsRepository::DeleteWhere(
|
|
||||||
*m_database,
|
*m_database,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"event_type_id IN {} AND {}",
|
"event_type_id = {} AND created_at < (NOW() - INTERVAL {} DAY)",
|
||||||
event_type_ids,
|
i,
|
||||||
condition
|
m_settings[i].retention_days
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (deleted_count > 0) {
|
if (deleted_count > 0) {
|
||||||
LogInfo(
|
LogInfo(
|
||||||
"Truncated [{}] events of types [{}] older than [{}] days",
|
"Truncated [{}] events of type [{}] ({}) older than [{}] days",
|
||||||
deleted_count,
|
deleted_count,
|
||||||
event_type_ids,
|
PlayerEvent::EventName[i],
|
||||||
retention_days
|
i,
|
||||||
|
m_settings[i].retention_days
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerEventLogs::ReloadSettings()
|
void PlayerEventLogs::ReloadSettings()
|
||||||
{
|
{
|
||||||
@@ -1100,144 +707,8 @@ 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;
|
|
||||||
m_settings[PlayerEvent::SPEECH].event_enabled = 0;
|
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerEventLogs::LoadEtlIds()
|
|
||||||
{
|
|
||||||
auto e = [&](auto p) -> bool {
|
|
||||||
for (PlayerEventLogSettingsRepository::PlayerEventLogSettings const &c: m_settings) {
|
|
||||||
if (c.id == p) {
|
|
||||||
return c.etl_enabled ? true : false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
m_etl_settings.clear();
|
|
||||||
m_etl_settings = {
|
|
||||||
{
|
|
||||||
PlayerEvent::LOOT_ITEM,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::LOOT_ITEM),
|
|
||||||
.table_name = "player_event_loot_items",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventLootItemsRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::MERCHANT_SELL,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::MERCHANT_SELL),
|
|
||||||
.table_name = "player_event_merchant_sell",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventMerchantSellRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::MERCHANT_PURCHASE,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::MERCHANT_PURCHASE),
|
|
||||||
.table_name = "player_event_merchant_purchase",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventMerchantPurchaseRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::NPC_HANDIN,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::NPC_HANDIN),
|
|
||||||
.table_name = "player_event_npc_handin",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventNpcHandinRepository::TableName()))
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::TRADE,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::TRADE),
|
|
||||||
.table_name = "player_event_trade",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventTradeRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::SPEECH,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::SPEECH),
|
|
||||||
.table_name = "player_event_speech",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventSpeechRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::KILLED_NPC,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::KILLED_NPC),
|
|
||||||
.table_name = "player_event_killed_npc",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventKilledNpcRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::KILLED_NAMED_NPC,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::KILLED_NAMED_NPC),
|
|
||||||
.table_name = "player_event_killed_named_npc",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventKilledNamedNpcRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::KILLED_RAID_NPC,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::KILLED_RAID_NPC),
|
|
||||||
.table_name = "player_event_killed_raid_npc",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventKilledRaidNpcRepository::TableName()))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PlayerEvent::AA_PURCHASE,
|
|
||||||
{
|
|
||||||
.enabled = e(PlayerEvent::AA_PURCHASE),
|
|
||||||
.table_name = "player_event_aa_purchase",
|
|
||||||
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventAaPurchaseRepository::TableName()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto &e: m_etl_settings) {
|
|
||||||
LogPlayerEventsDetail(
|
|
||||||
"ETL Settings [{}] Enabled [{}] Table [{}] NextId [{}]",
|
|
||||||
PlayerEvent::EventName[e.first],
|
|
||||||
e.second.enabled,
|
|
||||||
e.second.table_name,
|
|
||||||
e.second.next_id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PlayerEventLogs::LoadDatabaseConnection()
|
|
||||||
{
|
|
||||||
const auto c = EQEmuConfig::get();
|
|
||||||
|
|
||||||
LogInfo(
|
|
||||||
"Connecting to MySQL for PlayerEvents [{}]@[{}]:[{}]",
|
|
||||||
c->DatabaseUsername.c_str(),
|
|
||||||
c->DatabaseHost.c_str(),
|
|
||||||
c->DatabasePort
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!player_event_database.Connect(
|
|
||||||
c->DatabaseHost.c_str(),
|
|
||||||
c->DatabaseUsername.c_str(),
|
|
||||||
c->DatabasePassword.c_str(),
|
|
||||||
c->DatabaseDB.c_str(),
|
|
||||||
c->DatabasePort
|
|
||||||
)) {
|
|
||||||
LogError("Cannot continue without a database connection for player events.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetDatabase(&player_event_database);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,38 +1,19 @@
|
|||||||
#ifndef EQEMU_PLAYER_EVENT_LOGS_H
|
#ifndef EQEMU_PLAYER_EVENT_LOGS_H
|
||||||
#define EQEMU_PLAYER_EVENT_LOGS_H
|
#define EQEMU_PLAYER_EVENT_LOGS_H
|
||||||
|
|
||||||
|
#include "../repositories/player_event_log_settings_repository.h"
|
||||||
|
#include "player_events.h"
|
||||||
|
#include "../servertalk.h"
|
||||||
|
#include "../repositories/player_event_logs_repository.h"
|
||||||
|
#include "../timer.h"
|
||||||
|
#include "../json/json_archive_single_line.h"
|
||||||
#include <cereal/archives/json.hpp>
|
#include <cereal/archives/json.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "../json/json_archive_single_line.h"
|
|
||||||
#include "../servertalk.h"
|
|
||||||
#include "../timer.h"
|
|
||||||
#include "../eqemu_config.h"
|
|
||||||
|
|
||||||
#include "../repositories/player_event_log_settings_repository.h"
|
|
||||||
#include "../repositories/player_event_logs_repository.h"
|
|
||||||
#include "../repositories/player_event_loot_items_repository.h"
|
|
||||||
#include "../repositories/player_event_merchant_purchase_repository.h"
|
|
||||||
#include "../repositories/player_event_merchant_sell_repository.h"
|
|
||||||
#include "../repositories/player_event_npc_handin_repository.h"
|
|
||||||
#include "../repositories/player_event_npc_handin_entries_repository.h"
|
|
||||||
#include "../repositories/player_event_trade_repository.h"
|
|
||||||
#include "../repositories/player_event_trade_entries_repository.h"
|
|
||||||
#include "../repositories/player_event_speech_repository.h"
|
|
||||||
#include "../repositories/player_event_killed_npc_repository.h"
|
|
||||||
#include "../repositories/player_event_killed_named_npc_repository.h"
|
|
||||||
#include "../repositories/player_event_killed_raid_npc_repository.h"
|
|
||||||
#include "../repositories/player_event_aa_purchase_repository.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PlayerEventLogs {
|
class PlayerEventLogs {
|
||||||
public:
|
public:
|
||||||
Database player_event_database{};
|
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
bool LoadDatabaseConnection();
|
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
void LoadEtlIds();
|
|
||||||
PlayerEventLogs *SetDatabase(Database *db);
|
PlayerEventLogs *SetDatabase(Database *db);
|
||||||
bool ValidateDatabaseConnection();
|
bool ValidateDatabaseConnection();
|
||||||
bool IsEventEnabled(PlayerEvent::EventType event);
|
bool IsEventEnabled(PlayerEvent::EventType event);
|
||||||
@@ -40,7 +21,7 @@ public:
|
|||||||
void Process();
|
void Process();
|
||||||
|
|
||||||
// batch queue
|
// batch queue
|
||||||
void AddToQueue(PlayerEventLogsRepository::PlayerEventLogs &logs);
|
void AddToQueue(const PlayerEventLogsRepository::PlayerEventLogs &logs);
|
||||||
|
|
||||||
// main event record generic function
|
// main event record generic function
|
||||||
// can ingest any struct event types
|
// can ingest any struct event types
|
||||||
@@ -78,29 +59,7 @@ public:
|
|||||||
std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
|
std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
|
||||||
|
|
||||||
static std::string GetDiscordPayloadFromEvent(const PlayerEvent::PlayerEventContainer &e);
|
static std::string GetDiscordPayloadFromEvent(const PlayerEvent::PlayerEventContainer &e);
|
||||||
|
|
||||||
struct EtlQueues {
|
|
||||||
std::vector<PlayerEventLootItemsRepository::PlayerEventLootItems> loot_items;
|
|
||||||
std::vector<PlayerEventMerchantPurchaseRepository::PlayerEventMerchantPurchase> merchant_purchase;
|
|
||||||
std::vector<PlayerEventMerchantSellRepository::PlayerEventMerchantSell> merchant_sell;
|
|
||||||
std::vector<PlayerEventNpcHandinRepository::PlayerEventNpcHandin> npc_handin;
|
|
||||||
std::vector<PlayerEventNpcHandinEntriesRepository::PlayerEventNpcHandinEntries> npc_handin_entries;
|
|
||||||
std::vector<PlayerEventTradeRepository::PlayerEventTrade> trade;
|
|
||||||
std::vector<PlayerEventTradeEntriesRepository::PlayerEventTradeEntries> trade_entries;
|
|
||||||
std::vector<PlayerEventSpeechRepository::PlayerEventSpeech> speech;
|
|
||||||
std::vector<PlayerEventKilledNpcRepository::PlayerEventKilledNpc> killed_npc;
|
|
||||||
std::vector<PlayerEventKilledNamedNpcRepository::PlayerEventKilledNamedNpc> killed_named_npc;
|
|
||||||
std::vector<PlayerEventKilledRaidNpcRepository::PlayerEventKilledRaidNpc> killed_raid_npc;
|
|
||||||
std::vector<PlayerEventAaPurchaseRepository::PlayerEventAaPurchase> aa_purchase;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct EtlSettings {
|
|
||||||
bool enabled;
|
|
||||||
std::string table_name;
|
|
||||||
int64 next_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
Database *m_database; // reference to database
|
Database *m_database; // reference to database
|
||||||
PlayerEventLogSettingsRepository::PlayerEventLogSettings m_settings[PlayerEvent::EventType::MAX]{};
|
PlayerEventLogSettingsRepository::PlayerEventLogSettings m_settings[PlayerEvent::EventType::MAX]{};
|
||||||
|
|
||||||
@@ -110,8 +69,6 @@ private:
|
|||||||
static std::unique_ptr<ServerPacket>
|
static std::unique_ptr<ServerPacket>
|
||||||
BuildPlayerEventPacket(const PlayerEvent::PlayerEventContainer &e);
|
BuildPlayerEventPacket(const PlayerEvent::PlayerEventContainer &e);
|
||||||
|
|
||||||
std::map<PlayerEvent::EventType, EtlSettings> m_etl_settings{};
|
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
Timer m_process_batch_events_timer; // events processing timer
|
Timer m_process_batch_events_timer; // events processing timer
|
||||||
Timer m_process_retention_truncation_timer; // timer for truncating events based on retention settings
|
Timer m_process_retention_truncation_timer; // timer for truncating events based on retention settings
|
||||||
@@ -121,9 +78,6 @@ private:
|
|||||||
void ProcessBatchQueue();
|
void ProcessBatchQueue();
|
||||||
void ProcessRetentionTruncation();
|
void ProcessRetentionTruncation();
|
||||||
void SetSettingsDefaults();
|
void SetSettingsDefaults();
|
||||||
|
|
||||||
public:
|
|
||||||
std::map<PlayerEvent::EventType, EtlSettings> &GetEtlSettings() { return m_etl_settings;}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PlayerEventLogs player_event_logs;
|
extern PlayerEventLogs player_event_logs;
|
||||||
|
|||||||
+93
-318
@@ -4,7 +4,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cereal/cereal.hpp>
|
#include <cereal/cereal.hpp>
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "../rulesys.h"
|
|
||||||
#include "../repositories/player_event_logs_repository.h"
|
#include "../repositories/player_event_logs_repository.h"
|
||||||
|
|
||||||
namespace PlayerEvent {
|
namespace PlayerEvent {
|
||||||
@@ -63,11 +62,6 @@ namespace PlayerEvent {
|
|||||||
PARCEL_RETRIEVE,
|
PARCEL_RETRIEVE,
|
||||||
PARCEL_DELETE,
|
PARCEL_DELETE,
|
||||||
BARTER_TRANSACTION,
|
BARTER_TRANSACTION,
|
||||||
SPEECH,
|
|
||||||
EVOLVE_ITEM,
|
|
||||||
GUILD_BANK_DEPOSIT,
|
|
||||||
GUILD_BANK_WITHDRAWAL,
|
|
||||||
GUILD_BANK_MOVE_TO_BANK_AREA,
|
|
||||||
MAX // dont remove
|
MAX // dont remove
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -130,12 +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"
|
||||||
"Player Speech",
|
|
||||||
"Evolve Item Update",
|
|
||||||
"Guild Bank Item Deposit",
|
|
||||||
"Guild Bank Item Withdrawal",
|
|
||||||
"Guild Bank Move From Deposit Area to Bank Area"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Generic struct used by all events
|
// Generic struct used by all events
|
||||||
@@ -215,12 +204,12 @@ namespace PlayerEvent {
|
|||||||
std::string item_name;
|
std::string item_name;
|
||||||
uint16 to_slot;
|
uint16 to_slot;
|
||||||
int16 charges;
|
int16 charges;
|
||||||
uint32 augment_1_id;
|
uint32 aug1;
|
||||||
uint32 augment_2_id;
|
uint32 aug2;
|
||||||
uint32 augment_3_id;
|
uint32 aug3;
|
||||||
uint32 augment_4_id;
|
uint32 aug4;
|
||||||
uint32 augment_5_id;
|
uint32 aug5;
|
||||||
uint32 augment_6_id;
|
uint32 aug6;
|
||||||
bool attuned;
|
bool attuned;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
@@ -232,57 +221,56 @@ namespace PlayerEvent {
|
|||||||
CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
CEREAL_NVP(to_slot),
|
CEREAL_NVP(to_slot),
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(augment_1_id),
|
CEREAL_NVP(aug1),
|
||||||
CEREAL_NVP(augment_2_id),
|
CEREAL_NVP(aug2),
|
||||||
CEREAL_NVP(augment_3_id),
|
CEREAL_NVP(aug3),
|
||||||
CEREAL_NVP(augment_4_id),
|
CEREAL_NVP(aug4),
|
||||||
CEREAL_NVP(augment_5_id),
|
CEREAL_NVP(aug5),
|
||||||
CEREAL_NVP(augment_6_id),
|
CEREAL_NVP(aug6),
|
||||||
CEREAL_NVP(attuned)
|
CEREAL_NVP(attuned)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// used in Trade event
|
// used in Trade event
|
||||||
// struct TradeItem {
|
struct TradeItem {
|
||||||
// int64 item_id;
|
int64 item_id;
|
||||||
// std::string item_name;
|
std::string item_name;
|
||||||
// int32 slot;
|
int32 slot;
|
||||||
//
|
|
||||||
// // cereal
|
// cereal
|
||||||
// template<class Archive>
|
template<class Archive>
|
||||||
// void serialize(Archive &ar)
|
void serialize(Archive &ar)
|
||||||
// {
|
{
|
||||||
// ar(
|
ar(
|
||||||
// CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
// CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
// CEREAL_NVP(slot)
|
CEREAL_NVP(slot)
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
// used in Trade event
|
// used in Trade event
|
||||||
class TradeItemEntry {
|
class TradeItemEntry {
|
||||||
public:
|
public:
|
||||||
uint16 slot;
|
uint16 slot;
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
std::string augment_1_name;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
std::string augment_2_name;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
std::string augment_3_name;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
std::string augment_4_name;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
std::string augment_5_name;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
std::string augment_6_name;
|
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
uint16 charges;
|
uint16 charges;
|
||||||
|
uint32 aug_1_item_id;
|
||||||
|
std::string aug_1_item_name;
|
||||||
|
uint32 aug_2_item_id;
|
||||||
|
std::string aug_2_item_name;
|
||||||
|
uint32 aug_3_item_id;
|
||||||
|
std::string aug_3_item_name;
|
||||||
|
uint32 aug_4_item_id;
|
||||||
|
std::string aug_4_item_name;
|
||||||
|
uint32 aug_5_item_id;
|
||||||
|
std::string aug_5_item_name;
|
||||||
|
uint32 aug_6_item_id;
|
||||||
|
std::string aug_6_item_name;
|
||||||
bool in_bag;
|
bool in_bag;
|
||||||
|
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
void serialize(Archive &ar)
|
void serialize(Archive &ar)
|
||||||
@@ -290,20 +278,12 @@ namespace PlayerEvent {
|
|||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(slot),
|
CEREAL_NVP(slot),
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_1_name),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_2_name),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_1_name),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_4_name),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_5_name),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(augment_6_name),
|
|
||||||
CEREAL_NVP(item_name),
|
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
|
CEREAL_NVP(aug_1_item_id),
|
||||||
|
CEREAL_NVP(aug_2_item_id),
|
||||||
|
CEREAL_NVP(aug_3_item_id),
|
||||||
|
CEREAL_NVP(aug_4_item_id),
|
||||||
|
CEREAL_NVP(aug_5_item_id),
|
||||||
CEREAL_NVP(in_bag)
|
CEREAL_NVP(in_bag)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -436,12 +416,6 @@ namespace PlayerEvent {
|
|||||||
|
|
||||||
struct ForageSuccessEvent {
|
struct ForageSuccessEvent {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
@@ -450,12 +424,6 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(item_name)
|
CEREAL_NVP(item_name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -463,12 +431,6 @@ namespace PlayerEvent {
|
|||||||
|
|
||||||
struct FishSuccessEvent {
|
struct FishSuccessEvent {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
@@ -477,12 +439,6 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(item_name)
|
CEREAL_NVP(item_name)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -492,13 +448,6 @@ namespace PlayerEvent {
|
|||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
int16 charges;
|
int16 charges;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
bool attuned;
|
|
||||||
std::string reason;
|
std::string reason;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
@@ -508,15 +457,8 @@ namespace PlayerEvent {
|
|||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(reason),
|
||||||
CEREAL_NVP(augment_1_id),
|
CEREAL_NVP(charges)
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(attuned),
|
|
||||||
CEREAL_NVP(reason)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -559,12 +501,6 @@ namespace PlayerEvent {
|
|||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
int16 charges;
|
int16 charges;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
uint32 npc_id;
|
uint32 npc_id;
|
||||||
std::string corpse_name;
|
std::string corpse_name;
|
||||||
|
|
||||||
@@ -576,12 +512,6 @@ namespace PlayerEvent {
|
|||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(npc_id),
|
CEREAL_NVP(npc_id),
|
||||||
CEREAL_NVP(corpse_name)
|
CEREAL_NVP(corpse_name)
|
||||||
);
|
);
|
||||||
@@ -794,12 +724,6 @@ namespace PlayerEvent {
|
|||||||
|
|
||||||
struct DroppedItemEvent {
|
struct DroppedItemEvent {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
int16 slot_id;
|
int16 slot_id;
|
||||||
uint32 charges;
|
uint32 charges;
|
||||||
@@ -810,12 +734,6 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
CEREAL_NVP(slot_id),
|
CEREAL_NVP(slot_id),
|
||||||
CEREAL_NVP(charges)
|
CEREAL_NVP(charges)
|
||||||
@@ -871,19 +789,12 @@ namespace PlayerEvent {
|
|||||||
|
|
||||||
struct TraderPurchaseEvent {
|
struct TraderPurchaseEvent {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
uint32 trader_id;
|
uint32 trader_id;
|
||||||
std::string trader_name;
|
std::string trader_name;
|
||||||
uint32 price;
|
uint32 price;
|
||||||
uint32 quantity;
|
uint32 charges;
|
||||||
int32 charges;
|
uint32 total_cost;
|
||||||
uint64 total_cost;
|
|
||||||
uint64 player_money_balance;
|
uint64 player_money_balance;
|
||||||
|
|
||||||
|
|
||||||
@@ -893,17 +804,10 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
CEREAL_NVP(trader_id),
|
CEREAL_NVP(trader_id),
|
||||||
CEREAL_NVP(trader_name),
|
CEREAL_NVP(trader_name),
|
||||||
CEREAL_NVP(price),
|
CEREAL_NVP(price),
|
||||||
CEREAL_NVP(quantity),
|
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(total_cost),
|
CEREAL_NVP(total_cost),
|
||||||
CEREAL_NVP(player_money_balance)
|
CEREAL_NVP(player_money_balance)
|
||||||
@@ -913,19 +817,12 @@ namespace PlayerEvent {
|
|||||||
|
|
||||||
struct TraderSellEvent {
|
struct TraderSellEvent {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
uint32 buyer_id;
|
uint32 buyer_id;
|
||||||
std::string buyer_name;
|
std::string buyer_name;
|
||||||
uint32 price;
|
uint32 price;
|
||||||
uint32 quantity;
|
uint32 charges;
|
||||||
int32 charges;
|
uint32 total_cost;
|
||||||
uint64 total_cost;
|
|
||||||
uint64 player_money_balance;
|
uint64 player_money_balance;
|
||||||
|
|
||||||
|
|
||||||
@@ -935,17 +832,10 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(item_name),
|
CEREAL_NVP(item_name),
|
||||||
CEREAL_NVP(buyer_id),
|
CEREAL_NVP(buyer_id),
|
||||||
CEREAL_NVP(buyer_name),
|
CEREAL_NVP(buyer_name),
|
||||||
CEREAL_NVP(price),
|
CEREAL_NVP(price),
|
||||||
CEREAL_NVP(quantity),
|
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(total_cost),
|
CEREAL_NVP(total_cost),
|
||||||
CEREAL_NVP(player_money_balance)
|
CEREAL_NVP(player_money_balance)
|
||||||
@@ -1073,14 +963,6 @@ namespace PlayerEvent {
|
|||||||
|
|
||||||
struct GuildTributeDonateItem {
|
struct GuildTributeDonateItem {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
int16 charges;
|
|
||||||
bool attuned;
|
|
||||||
uint32 guild_favor;
|
uint32 guild_favor;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
@@ -1089,12 +971,6 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(guild_favor)
|
CEREAL_NVP(guild_favor)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1117,15 +993,15 @@ namespace PlayerEvent {
|
|||||||
|
|
||||||
struct ParcelRetrieve {
|
struct ParcelRetrieve {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
uint32 quantity;
|
uint32 quantity;
|
||||||
std::string from_player_name;
|
std::string from_player_name;
|
||||||
uint32 sent_date;
|
uint32 sent_date;
|
||||||
|
uint32 aug_slot_1;
|
||||||
|
uint32 aug_slot_2;
|
||||||
|
uint32 aug_slot_3;
|
||||||
|
uint32 aug_slot_4;
|
||||||
|
uint32 aug_slot_5;
|
||||||
|
uint32 aug_slot_6;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
@@ -1133,32 +1009,31 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(quantity),
|
CEREAL_NVP(quantity),
|
||||||
CEREAL_NVP(from_player_name),
|
CEREAL_NVP(from_player_name),
|
||||||
CEREAL_NVP(sent_date)
|
CEREAL_NVP(sent_date),
|
||||||
|
CEREAL_NVP(aug_slot_1),
|
||||||
|
CEREAL_NVP(aug_slot_2),
|
||||||
|
CEREAL_NVP(aug_slot_3),
|
||||||
|
CEREAL_NVP(aug_slot_4),
|
||||||
|
CEREAL_NVP(aug_slot_5),
|
||||||
|
CEREAL_NVP(aug_slot_6)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ParcelSend {
|
struct ParcelSend {
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
uint32 quantity;
|
uint32 quantity;
|
||||||
int32 charges;
|
|
||||||
std::string from_player_name;
|
std::string from_player_name;
|
||||||
std::string to_player_name;
|
std::string to_player_name;
|
||||||
uint32 sent_date;
|
uint32 sent_date;
|
||||||
|
uint32 aug_slot_1;
|
||||||
|
uint32 aug_slot_2;
|
||||||
|
uint32 aug_slot_3;
|
||||||
|
uint32 aug_slot_4;
|
||||||
|
uint32 aug_slot_5;
|
||||||
|
uint32 aug_slot_6;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
@@ -1166,34 +1041,33 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(quantity),
|
CEREAL_NVP(quantity),
|
||||||
CEREAL_NVP(charges),
|
|
||||||
CEREAL_NVP(from_player_name),
|
CEREAL_NVP(from_player_name),
|
||||||
CEREAL_NVP(to_player_name),
|
CEREAL_NVP(to_player_name),
|
||||||
CEREAL_NVP(sent_date)
|
CEREAL_NVP(sent_date),
|
||||||
|
CEREAL_NVP(aug_slot_1),
|
||||||
|
CEREAL_NVP(aug_slot_2),
|
||||||
|
CEREAL_NVP(aug_slot_3),
|
||||||
|
CEREAL_NVP(aug_slot_4),
|
||||||
|
CEREAL_NVP(aug_slot_5),
|
||||||
|
CEREAL_NVP(aug_slot_6)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ParcelDelete {
|
struct ParcelDelete {
|
||||||
uint32 char_id;
|
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 augment_1_id;
|
|
||||||
uint32 augment_2_id;
|
|
||||||
uint32 augment_3_id;
|
|
||||||
uint32 augment_4_id;
|
|
||||||
uint32 augment_5_id;
|
|
||||||
uint32 augment_6_id;
|
|
||||||
uint32 quantity;
|
uint32 quantity;
|
||||||
uint32 sent_date;
|
uint32 char_id;
|
||||||
std::string from_name;
|
std::string from_name;
|
||||||
std::string note;
|
std::string note;
|
||||||
|
uint32 sent_date;
|
||||||
|
uint32 aug_slot_1;
|
||||||
|
uint32 aug_slot_2;
|
||||||
|
uint32 aug_slot_3;
|
||||||
|
uint32 aug_slot_4;
|
||||||
|
uint32 aug_slot_5;
|
||||||
|
uint32 aug_slot_6;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
@@ -1201,17 +1075,17 @@ namespace PlayerEvent {
|
|||||||
{
|
{
|
||||||
ar(
|
ar(
|
||||||
CEREAL_NVP(item_id),
|
CEREAL_NVP(item_id),
|
||||||
CEREAL_NVP(augment_1_id),
|
|
||||||
CEREAL_NVP(augment_2_id),
|
|
||||||
CEREAL_NVP(augment_3_id),
|
|
||||||
CEREAL_NVP(augment_4_id),
|
|
||||||
CEREAL_NVP(augment_5_id),
|
|
||||||
CEREAL_NVP(augment_6_id),
|
|
||||||
CEREAL_NVP(quantity),
|
CEREAL_NVP(quantity),
|
||||||
CEREAL_NVP(char_id),
|
CEREAL_NVP(char_id),
|
||||||
CEREAL_NVP(from_name),
|
CEREAL_NVP(from_name),
|
||||||
CEREAL_NVP(note),
|
CEREAL_NVP(note),
|
||||||
CEREAL_NVP(sent_date)
|
CEREAL_NVP(sent_date),
|
||||||
|
CEREAL_NVP(aug_slot_1),
|
||||||
|
CEREAL_NVP(aug_slot_2),
|
||||||
|
CEREAL_NVP(aug_slot_3),
|
||||||
|
CEREAL_NVP(aug_slot_4),
|
||||||
|
CEREAL_NVP(aug_slot_5),
|
||||||
|
CEREAL_NVP(aug_slot_6)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1241,99 +1115,12 @@ 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)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PlayerSpeech {
|
|
||||||
std::string to;
|
|
||||||
std::string from;
|
|
||||||
uint32 guild_id;
|
|
||||||
int16 min_status;
|
|
||||||
uint32 type;
|
|
||||||
std::string message;
|
|
||||||
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive &ar)
|
|
||||||
{
|
|
||||||
ar(
|
|
||||||
CEREAL_NVP(to),
|
|
||||||
CEREAL_NVP(from),
|
|
||||||
CEREAL_NVP(guild_id),
|
|
||||||
CEREAL_NVP(min_status),
|
|
||||||
CEREAL_NVP(type),
|
|
||||||
CEREAL_NVP(message)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GuildBankTransaction {
|
|
||||||
uint32 char_id;
|
|
||||||
uint32 guild_id;
|
|
||||||
uint32 item_id;
|
|
||||||
uint32 aug_slot_one;
|
|
||||||
uint32 aug_slot_two;
|
|
||||||
uint32 aug_slot_three;
|
|
||||||
uint32 aug_slot_four;
|
|
||||||
uint32 aug_slot_five;
|
|
||||||
uint32 aug_slot_six;
|
|
||||||
uint32 quantity;
|
|
||||||
uint32 permission;
|
|
||||||
|
|
||||||
// cereal
|
|
||||||
template<class Archive>
|
|
||||||
void serialize(Archive &ar)
|
|
||||||
{
|
|
||||||
ar(
|
|
||||||
CEREAL_NVP(char_id),
|
|
||||||
CEREAL_NVP(guild_id),
|
|
||||||
CEREAL_NVP(item_id),
|
|
||||||
CEREAL_NVP(aug_slot_one),
|
|
||||||
CEREAL_NVP(aug_slot_two),
|
|
||||||
CEREAL_NVP(aug_slot_three),
|
|
||||||
CEREAL_NVP(aug_slot_four),
|
|
||||||
CEREAL_NVP(aug_slot_five),
|
|
||||||
CEREAL_NVP(aug_slot_six),
|
|
||||||
CEREAL_NVP(quantity)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //EQEMU_PLAYER_EVENTS_H
|
#endif //EQEMU_PLAYER_EVENTS_H
|
||||||
|
|
||||||
#define RecordPlayerEventLog(event_type, event_data) do {\
|
#define RecordPlayerEventLog(event_type, event_data) do {\
|
||||||
if (player_event_logs.IsEventEnabled(event_type)) {\
|
if (player_event_logs.IsEventEnabled(event_type)) {\
|
||||||
if (RuleB(Logging, PlayerEventsQSProcess)) {\
|
|
||||||
QServ->SendPacket(\
|
|
||||||
player_event_logs.RecordEvent(\
|
|
||||||
event_type,\
|
|
||||||
GetPlayerEvent(),\
|
|
||||||
event_data\
|
|
||||||
).get()\
|
|
||||||
);\
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
worldserver.SendPacket(\
|
worldserver.SendPacket(\
|
||||||
player_event_logs.RecordEvent(\
|
player_event_logs.RecordEvent(\
|
||||||
event_type,\
|
event_type,\
|
||||||
@@ -1342,21 +1129,10 @@ namespace PlayerEvent {
|
|||||||
).get()\
|
).get()\
|
||||||
);\
|
);\
|
||||||
}\
|
}\
|
||||||
}\
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RecordPlayerEventLogWithClient(c, event_type, event_data) do {\
|
#define RecordPlayerEventLogWithClient(c, event_type, event_data) do {\
|
||||||
if (player_event_logs.IsEventEnabled(event_type)) {\
|
if (player_event_logs.IsEventEnabled(event_type)) {\
|
||||||
if (RuleB(Logging, PlayerEventsQSProcess)) {\
|
|
||||||
QServ->SendPacket(\
|
|
||||||
player_event_logs.RecordEvent(\
|
|
||||||
event_type,\
|
|
||||||
(c)->GetPlayerEvent(),\
|
|
||||||
event_data\
|
|
||||||
).get()\
|
|
||||||
);\
|
|
||||||
}\
|
|
||||||
else {\
|
|
||||||
worldserver.SendPacket(\
|
worldserver.SendPacket(\
|
||||||
player_event_logs.RecordEvent(\
|
player_event_logs.RecordEvent(\
|
||||||
event_type,\
|
event_type,\
|
||||||
@@ -1365,5 +1141,4 @@ namespace PlayerEvent {
|
|||||||
).get()\
|
).get()\
|
||||||
);\
|
);\
|
||||||
}\
|
}\
|
||||||
}\
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/**
|
||||||
|
* EQEmulator: Everquest Server Emulator
|
||||||
|
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
|
* are required to give you total support for your newly bought product;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "expedition_lockout_timer.h"
|
||||||
|
#include "../common/strings.h"
|
||||||
|
#include "../common/rulesys.h"
|
||||||
|
#include "../common/util/uuid.h"
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
const char* const DZ_REPLAY_TIMER_NAME = "Replay Timer"; // see December 14, 2016 patch notes
|
||||||
|
|
||||||
|
ExpeditionLockoutTimer::ExpeditionLockoutTimer(
|
||||||
|
std::string expedition_uuid, std::string expedition_name,
|
||||||
|
std::string event_name, uint64_t expire_time, uint32_t duration
|
||||||
|
) :
|
||||||
|
m_expedition_uuid{std::move(expedition_uuid)},
|
||||||
|
m_expedition_name{std::move(expedition_name)},
|
||||||
|
m_event_name{std::move(event_name)},
|
||||||
|
m_expire_time(std::chrono::system_clock::from_time_t(expire_time)),
|
||||||
|
m_duration(duration)
|
||||||
|
{
|
||||||
|
if (m_event_name == DZ_REPLAY_TIMER_NAME)
|
||||||
|
{
|
||||||
|
m_is_replay_timer = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExpeditionLockoutTimer ExpeditionLockoutTimer::CreateLockout(
|
||||||
|
const std::string& expedition_name, const std::string& event_name, uint32_t seconds, std::string uuid)
|
||||||
|
{
|
||||||
|
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
|
||||||
|
if (uuid.empty())
|
||||||
|
{
|
||||||
|
uuid = EQ::Util::UUID::Generate().ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
ExpeditionLockoutTimer lockout{uuid, expedition_name, event_name, 0, seconds};
|
||||||
|
lockout.Reset(); // sets expire time
|
||||||
|
return lockout;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t ExpeditionLockoutTimer::GetSecondsRemaining() const
|
||||||
|
{
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
if (m_expire_time > now)
|
||||||
|
{
|
||||||
|
auto remaining = m_expire_time - now;
|
||||||
|
return static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(remaining).count());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExpeditionLockoutTimer::DaysHoursMinutes ExpeditionLockoutTimer::GetDaysHoursMinutesRemaining() const
|
||||||
|
{
|
||||||
|
auto seconds = GetSecondsRemaining();
|
||||||
|
return ExpeditionLockoutTimer::DaysHoursMinutes{
|
||||||
|
fmt::format_int(seconds / 86400).str(), // days
|
||||||
|
fmt::format_int((seconds / 3600) % 24).str(), // hours
|
||||||
|
fmt::format_int((seconds / 60) % 60).str() // minutes
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExpeditionLockoutTimer::IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const
|
||||||
|
{
|
||||||
|
return compare_lockout.IsSameLockout(GetExpeditionName(), GetEventName());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExpeditionLockoutTimer::IsSameLockout(
|
||||||
|
const std::string& expedition_name, const std::string& event_name) const
|
||||||
|
{
|
||||||
|
return GetExpeditionName() == expedition_name && GetEventName() == event_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExpeditionLockoutTimer::AddLockoutTime(int seconds)
|
||||||
|
{
|
||||||
|
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
|
||||||
|
auto new_duration = std::max(0, static_cast<int>(m_duration.count()) + seconds);
|
||||||
|
|
||||||
|
auto start_time = m_expire_time - m_duration;
|
||||||
|
m_duration = std::chrono::seconds(new_duration);
|
||||||
|
m_expire_time = start_time + m_duration;
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* EQEmulator: Everquest Server Emulator
|
||||||
|
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
|
* are required to give you total support for your newly bought product;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EXPEDITION_LOCKOUT_TIMER_H
|
||||||
|
#define EXPEDITION_LOCKOUT_TIMER_H
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
extern const char* const DZ_REPLAY_TIMER_NAME;
|
||||||
|
|
||||||
|
class ExpeditionLockoutTimer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ExpeditionLockoutTimer() = default;
|
||||||
|
ExpeditionLockoutTimer(
|
||||||
|
std::string expedition_uuid, std::string expedition_name,
|
||||||
|
std::string event_name, uint64_t expire_time, uint32_t duration);
|
||||||
|
|
||||||
|
static ExpeditionLockoutTimer CreateLockout(
|
||||||
|
const std::string& expedition_name, const std::string& event_name,
|
||||||
|
uint32_t seconds, std::string uuid = {});
|
||||||
|
|
||||||
|
struct DaysHoursMinutes
|
||||||
|
{
|
||||||
|
std::string days;
|
||||||
|
std::string hours;
|
||||||
|
std::string mins;
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddLockoutTime(int seconds);
|
||||||
|
uint32_t GetDuration() const { return static_cast<uint32_t>(m_duration.count()); }
|
||||||
|
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
||||||
|
uint64_t GetStartTime() const { return std::chrono::system_clock::to_time_t(m_expire_time - m_duration); }
|
||||||
|
uint32_t GetSecondsRemaining() const;
|
||||||
|
DaysHoursMinutes GetDaysHoursMinutesRemaining() const;
|
||||||
|
const std::string& GetExpeditionName() const { return m_expedition_name; }
|
||||||
|
const std::string& GetExpeditionUUID() const { return m_expedition_uuid; }
|
||||||
|
const std::string& GetEventName() const { return m_event_name; }
|
||||||
|
bool IsExpired() const { return GetSecondsRemaining() == 0; }
|
||||||
|
bool IsFromExpedition(const std::string& uuid) const { return uuid == m_expedition_uuid; }
|
||||||
|
bool IsReplayTimer() const { return m_is_replay_timer; }
|
||||||
|
bool IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const;
|
||||||
|
bool IsSameLockout(const std::string& expedition_name, const std::string& event_name) const;
|
||||||
|
void Reset() { m_expire_time = std::chrono::system_clock::now() + m_duration; }
|
||||||
|
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
||||||
|
void SetExpireTime(uint64_t expire_time) { m_expire_time = std::chrono::system_clock::from_time_t(expire_time); }
|
||||||
|
void SetUUID(const std::string& uuid) { m_expedition_uuid = uuid; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_is_replay_timer = false;
|
||||||
|
std::string m_expedition_uuid; // expedition received in
|
||||||
|
std::string m_expedition_name;
|
||||||
|
std::string m_event_name;
|
||||||
|
std::chrono::seconds m_duration;
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
+13
-12
@@ -39,7 +39,6 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
@@ -91,21 +90,23 @@ std::string File::GetCwd()
|
|||||||
|
|
||||||
FileContentsResult File::GetContents(const std::string &file_name)
|
FileContentsResult File::GetContents(const std::string &file_name)
|
||||||
{
|
{
|
||||||
std::ifstream f(file_name, std::ios::in | std::ios::binary);
|
std::string error;
|
||||||
if (!f) {
|
std::ifstream f;
|
||||||
return { .error = fmt::format("Couldn't open file [{}]", file_name) };
|
f.open(file_name);
|
||||||
}
|
std::string line;
|
||||||
|
|
||||||
constexpr size_t CHUNK_SIZE = 4096; // Read 4KB chunks
|
|
||||||
std::string lines;
|
std::string lines;
|
||||||
std::vector<char> buffer(CHUNK_SIZE);
|
if (f.is_open()) {
|
||||||
|
while (f) {
|
||||||
while (f.read(buffer.data(), CHUNK_SIZE) || f.gcount() > 0) {
|
std::getline(f, line);
|
||||||
lines.append(buffer.data(), f.gcount());
|
lines += line + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error = fmt::format("Couldn't open file [{}]", file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileContentsResult{
|
return FileContentsResult{
|
||||||
.contents = lines,
|
.contents = lines,
|
||||||
.error = {}
|
.error = error,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-18
@@ -547,54 +547,52 @@ uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader)
|
|||||||
|
|
||||||
bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, bool db_delete)
|
bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, bool db_delete)
|
||||||
{
|
{
|
||||||
auto const where_filter = fmt::format("guild_id = {}", guild_id);
|
|
||||||
auto const bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
|
||||||
|
|
||||||
if (local_delete) {
|
if (local_delete) {
|
||||||
|
auto where_filter = fmt::format("guildid = {}", guild_id);
|
||||||
|
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||||
if (!bank_items.empty()) {
|
if (!bank_items.empty()) {
|
||||||
LogError(
|
LogError(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||||
"again.",
|
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
LogGuilds(
|
LogGuilds(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||||
"again.",
|
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
auto res = m_guilds.find(guild_id);
|
std::map<uint32, GuildInfo *>::iterator res;
|
||||||
|
res = m_guilds.find(guild_id);
|
||||||
if (res != m_guilds.end()) {
|
if (res != m_guilds.end()) {
|
||||||
safe_delete(res->second);
|
delete res->second;
|
||||||
m_guilds.erase(res);
|
m_guilds.erase(res);
|
||||||
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
||||||
//Does this need to be sent to world?
|
//Does this need to be sent to world?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (db_delete) {
|
if (db_delete) {
|
||||||
|
auto where_filter = fmt::format("guildid = {}", guild_id);
|
||||||
|
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||||
if (!bank_items.empty()) {
|
if (!bank_items.empty()) {
|
||||||
LogError(
|
LogError(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||||
"again.",
|
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
LogGuilds(
|
LogGuilds(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||||
"again.",
|
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
auto where_filter = fmt::format("guild_id = {}", guild_id);
|
||||||
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
||||||
GuildsRepository::DeleteOne(*m_db, guild_id);
|
GuildsRepository::DeleteOne(*m_db, guild_id);
|
||||||
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
||||||
@@ -602,7 +600,7 @@ bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, b
|
|||||||
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
||||||
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+455
-729
File diff suppressed because it is too large
Load Diff
+11
-14
@@ -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);
|
||||||
@@ -178,8 +176,8 @@ namespace EQ
|
|||||||
// Locate an available inventory slot
|
// Locate an available inventory slot
|
||||||
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
|
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
|
||||||
int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = invslot::GENERAL_BEGIN, uint8 bag_start = invbag::SLOT_BEGIN);
|
int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = invslot::GENERAL_BEGIN, uint8 bag_start = invbag::SLOT_BEGIN);
|
||||||
|
std::vector<int16> FindAllFreeSlotsThatFitItem(const EQ::ItemData *inst);
|
||||||
int16 FindFirstFreeSlotThatFitsItem(const EQ::ItemData *inst);
|
int16 FindFirstFreeSlotThatFitsItem(const EQ::ItemData *inst);
|
||||||
int16 FindFirstFreeSlotThatFitsItemWithStacking(ItemInstance *inst) const;
|
|
||||||
|
|
||||||
// Calculate slot_id for an item within a bag
|
// Calculate slot_id for an item within a bag
|
||||||
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
||||||
@@ -201,25 +199,26 @@ namespace EQ
|
|||||||
|
|
||||||
uint8 FindBrightestLightType();
|
uint8 FindBrightestLightType();
|
||||||
|
|
||||||
|
void dumpEntireInventory();
|
||||||
|
void dumpWornItems();
|
||||||
|
void dumpInventory();
|
||||||
|
void dumpBankItems();
|
||||||
|
void dumpSharedBankItems();
|
||||||
|
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, const std::string& value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, const std::string& value);
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, int value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, int value);
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, float value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, float value);
|
||||||
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
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
int GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst);
|
int GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst);
|
||||||
|
void dumpItemCollection(const std::map<int16, ItemInstance*> &collection);
|
||||||
|
void dumpBagContents(ItemInstance *inst, std::map<int16, ItemInstance*>::const_iterator *it);
|
||||||
|
|
||||||
// Retrieves item within an inventory bucket
|
// Retrieves item within an inventory bucket
|
||||||
ItemInstance* _GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const;
|
ItemInstance* _GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const;
|
||||||
@@ -234,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
|
||||||
|
|||||||
@@ -259,84 +259,3 @@ bool IpUtil::IsIPAddress(const std::string &ip_address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <winsock2.h>
|
|
||||||
#pragma comment(lib, "ws2_32.lib") // Link against Winsock library
|
|
||||||
#else
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <ws2tcpip.h> // For inet_pton
|
|
||||||
#pragma comment(lib, "ws2_32.lib") // Link against Winsock library
|
|
||||||
#else
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h> // For inet_pton
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool IpUtil::IsPortInUse(const std::string& ip, int port) {
|
|
||||||
bool in_use = false;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
WSADATA wsaData;
|
|
||||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
|
||||||
std::cerr << "WSAStartup failed\n";
|
|
||||||
return true; // Assume in use on failure
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
|
||||||
if (sock < 0) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
return true; // Assume in use on failure
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
int opt = 1;
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&opt, sizeof(opt)); // Windows-specific
|
|
||||||
#else
|
|
||||||
int opt = 1;
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); // Linux/macOS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sockaddr_in addr{};
|
|
||||||
addr.sin_family = AF_INET;
|
|
||||||
addr.sin_port = htons(port);
|
|
||||||
|
|
||||||
// Convert IP address from string to binary format
|
|
||||||
if (inet_pton(AF_INET, ip.c_str(), &addr.sin_addr) <= 0) {
|
|
||||||
std::cerr << "Invalid IP address format: " << ip << std::endl;
|
|
||||||
#ifdef _WIN32
|
|
||||||
closesocket(sock);
|
|
||||||
WSACleanup();
|
|
||||||
#else
|
|
||||||
close(sock);
|
|
||||||
#endif
|
|
||||||
return true; // Assume in use on failure
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bind(sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
|
|
||||||
in_use = true; // Bind failed, port is in use
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
closesocket(sock);
|
|
||||||
WSACleanup();
|
|
||||||
#else
|
|
||||||
close(sock);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return in_use;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public:
|
|||||||
int port
|
int port
|
||||||
);
|
);
|
||||||
static bool IsIPAddress(const std::string &ip_address);
|
static bool IsIPAddress(const std::string &ip_address);
|
||||||
static bool IsPortInUse(const std::string& ip, int port);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -220,34 +220,6 @@ bool EQ::ItemData::IsType1HWeapon() const
|
|||||||
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing) || (ItemType == item::ItemTypeMartial));
|
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing) || (ItemType == item::ItemTypeMartial));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQ::ItemData::IsPetUsable() const
|
|
||||||
{
|
|
||||||
if (ItemClass == item::ItemClassBag) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it's a misc item and has slots, it's wearable
|
|
||||||
// this item type is conflated with many other item types
|
|
||||||
if (ItemClass == item::ItemTypeMisc && Slots != 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (ItemType) {
|
|
||||||
case item::ItemType1HBlunt:
|
|
||||||
case item::ItemType1HSlash:
|
|
||||||
case item::ItemType1HPiercing:
|
|
||||||
case item::ItemType2HBlunt:
|
|
||||||
case item::ItemType2HSlash:
|
|
||||||
case item::ItemTypeMartial:
|
|
||||||
case item::ItemTypeShield:
|
|
||||||
case item::ItemTypeArmor:
|
|
||||||
case item::ItemTypeJewelry:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EQ::ItemData::IsType2HWeapon() const
|
bool EQ::ItemData::IsType2HWeapon() const
|
||||||
{
|
{
|
||||||
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
|
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
|
||||||
|
|||||||
@@ -550,7 +550,6 @@ namespace EQ
|
|||||||
bool IsType1HWeapon() const;
|
bool IsType1HWeapon() const;
|
||||||
bool IsType2HWeapon() const;
|
bool IsType2HWeapon() const;
|
||||||
bool IsTypeShield() const;
|
bool IsTypeShield() const;
|
||||||
bool IsPetUsable() const;
|
|
||||||
bool IsQuestItem() const;
|
bool IsQuestItem() const;
|
||||||
|
|
||||||
static bool CheckLoreConflict(const ItemData* l_item, const ItemData* r_item);
|
static bool CheckLoreConflict(const ItemData* l_item, const ItemData* r_item);
|
||||||
|
|||||||
+50
-67
@@ -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);
|
||||||
@@ -1785,18 +1806,6 @@ std::vector<uint32> EQ::ItemInstance::GetAugmentIDs() const
|
|||||||
return augments;
|
return augments;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> EQ::ItemInstance::GetAugmentNames() const
|
|
||||||
{
|
|
||||||
std::vector<std::string> augment_names;
|
|
||||||
|
|
||||||
for (uint8 slot_id = invaug::SOCKET_BEGIN; slot_id <= invaug::SOCKET_END; slot_id++) {
|
|
||||||
const auto augment = GetAugment(slot_id);
|
|
||||||
augment_names.push_back(augment ? augment->GetItem()->Name : "None");
|
|
||||||
}
|
|
||||||
|
|
||||||
return augment_names;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EQ::ItemInstance::GetItemRegen(bool augments) const
|
int EQ::ItemInstance::GetItemRegen(bool augments) const
|
||||||
{
|
{
|
||||||
int stat = 0;
|
int stat = 0;
|
||||||
@@ -1942,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
-35
@@ -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();
|
||||||
|
|
||||||
@@ -305,38 +309,9 @@ namespace EQ
|
|||||||
int GetItemSkillsStat(EQ::skills::SkillType skill, bool augments = false) const;
|
int GetItemSkillsStat(EQ::skills::SkillType skill, bool augments = false) const;
|
||||||
uint32 GetItemGuildFavor() const;
|
uint32 GetItemGuildFavor() const;
|
||||||
std::vector<uint32> GetAugmentIDs() const;
|
std::vector<uint32> GetAugmentIDs() const;
|
||||||
std::vector<std::string> GetAugmentNames() const;
|
|
||||||
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
|
||||||
@@ -360,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};
|
||||||
@@ -368,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*/
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ struct LootItem {
|
|||||||
uint16 trivial_max_level;
|
uint16 trivial_max_level;
|
||||||
uint16 npc_min_level;
|
uint16 npc_min_level;
|
||||||
uint16 npc_max_level;
|
uint16 npc_max_level;
|
||||||
uint32 lootdrop_id; // required for zone state referencing
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<LootItem*> LootItems;
|
typedef std::list<LootItem*> LootItems;
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -1091,81 +1091,20 @@ void EQ::Net::DaybreakConnection::ProcessResend()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// observed client receive window is 300 packets, 140KB
|
|
||||||
constexpr size_t MAX_CLIENT_RECV_PACKETS_PER_WINDOW = 300;
|
|
||||||
constexpr size_t MAX_CLIENT_RECV_BYTES_PER_WINDOW = 140 * 1024;
|
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
||||||
{
|
{
|
||||||
if (m_status == DbProtocolStatus::StatusDisconnected) {
|
if (m_status == DbProtocolStatus::StatusDisconnected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_streams[stream].sent_packets.empty()) {
|
auto resends = 0;
|
||||||
return;
|
auto now = Clock::now();
|
||||||
}
|
|
||||||
|
|
||||||
m_resend_packets_sent = 0;
|
|
||||||
m_resend_bytes_sent = 0;
|
|
||||||
|
|
||||||
auto now = Clock::now(); // Current time
|
|
||||||
auto s = &m_streams[stream];
|
auto s = &m_streams[stream];
|
||||||
|
for (auto &entry : s->sent_packets) {
|
||||||
// Get a reference resend delay (assume first packet represents the typical case)
|
auto time_since_last_send = std::chrono::duration_cast<std::chrono::milliseconds>(now - entry.second.last_sent);
|
||||||
if (!s->sent_packets.empty()) {
|
if (entry.second.times_resent == 0) {
|
||||||
// Check if the first packet has timed out
|
if ((size_t)time_since_last_send.count() > entry.second.resend_delay) {
|
||||||
auto &first_packet = s->sent_packets.begin()->second;
|
auto &p = entry.second.packet;
|
||||||
auto time_since_first_sent = std::chrono::duration_cast<std::chrono::milliseconds>(now - first_packet.first_sent).count();
|
|
||||||
|
|
||||||
// make sure that the first_packet in the list first_sent time is within the resend_delay and now
|
|
||||||
// if it is not, then we need to resend all packets in the list
|
|
||||||
if (time_since_first_sent <= first_packet.resend_delay && !m_acked_since_last_resend) {
|
|
||||||
LogNetcodeDetail(
|
|
||||||
"Not resending packets for stream [{}] time since first sent [{}] resend delay [{}] m_acked_since_last_resend [{}]",
|
|
||||||
stream,
|
|
||||||
time_since_first_sent,
|
|
||||||
first_packet.resend_delay,
|
|
||||||
m_acked_since_last_resend
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time_since_first_sent >= m_owner->m_options.resend_timeout) {
|
|
||||||
Close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::Netcode)) {
|
|
||||||
size_t total_size = 0;
|
|
||||||
for (auto &e: s->sent_packets) {
|
|
||||||
total_size += e.second.packet.Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
LogNetcodeDetail(
|
|
||||||
"Resending packets for stream [{}] packet count [{}] total packet size [{}] m_acked_since_last_resend [{}]",
|
|
||||||
stream,
|
|
||||||
s->sent_packets.size(),
|
|
||||||
total_size,
|
|
||||||
m_acked_since_last_resend
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &e: s->sent_packets) {
|
|
||||||
if (m_resend_packets_sent >= MAX_CLIENT_RECV_PACKETS_PER_WINDOW ||
|
|
||||||
m_resend_bytes_sent >= MAX_CLIENT_RECV_BYTES_PER_WINDOW) {
|
|
||||||
LogNetcodeDetail(
|
|
||||||
"Stopping resend because we hit thresholds m_resend_packets_sent [{}] max [{}] m_resend_bytes_sent [{}] max [{}]",
|
|
||||||
m_resend_packets_sent,
|
|
||||||
MAX_CLIENT_RECV_PACKETS_PER_WINDOW,
|
|
||||||
m_resend_bytes_sent,
|
|
||||||
MAX_CLIENT_RECV_BYTES_PER_WINDOW
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto &sp = e.second;
|
|
||||||
auto &p = sp.packet;
|
|
||||||
if (p.Length() >= DaybreakHeader::size()) {
|
if (p.Length() >= DaybreakHeader::size()) {
|
||||||
if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) {
|
if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) {
|
||||||
m_stats.resent_fragments++;
|
m_stats.resent_fragments++;
|
||||||
@@ -1179,21 +1118,43 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
|||||||
}
|
}
|
||||||
m_stats.resent_packets++;
|
m_stats.resent_packets++;
|
||||||
|
|
||||||
// Resend the packet
|
|
||||||
InternalBufferedSend(p);
|
InternalBufferedSend(p);
|
||||||
|
entry.second.last_sent = now;
|
||||||
m_resend_packets_sent++;
|
entry.second.times_resent++;
|
||||||
m_resend_bytes_sent += p.Length();
|
entry.second.resend_delay = EQ::Clamp(entry.second.resend_delay * 2, m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_max);
|
||||||
sp.last_sent = now;
|
resends++;
|
||||||
sp.times_resent++;
|
}
|
||||||
sp.resend_delay = EQ::Clamp(
|
}
|
||||||
sp.resend_delay * 2,
|
else {
|
||||||
m_owner->m_options.resend_delay_min,
|
auto time_since_first_sent = std::chrono::duration_cast<std::chrono::milliseconds>(now - entry.second.first_sent);
|
||||||
m_owner->m_options.resend_delay_max
|
if (time_since_first_sent.count() >= m_owner->m_options.resend_timeout) {
|
||||||
);
|
Close();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_acked_since_last_resend = false;
|
if ((size_t)time_since_last_send.count() > entry.second.resend_delay) {
|
||||||
|
auto &p = entry.second.packet;
|
||||||
|
if (p.Length() >= DaybreakHeader::size()) {
|
||||||
|
if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) {
|
||||||
|
m_stats.resent_fragments++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_stats.resent_full++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_stats.resent_full++;
|
||||||
|
}
|
||||||
|
m_stats.resent_packets++;
|
||||||
|
|
||||||
|
InternalBufferedSend(p);
|
||||||
|
entry.second.last_sent = now;
|
||||||
|
entry.second.times_resent++;
|
||||||
|
entry.second.resend_delay = EQ::Clamp(entry.second.resend_delay * 2, m_owner->m_options.resend_delay_min, m_owner->m_options.resend_delay_max);
|
||||||
|
resends++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
||||||
@@ -1214,7 +1175,6 @@ void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
|||||||
m_rolling_ping = (m_rolling_ping * 2 + round_time) / 3;
|
m_rolling_ping = (m_rolling_ping * 2 + round_time) / 3;
|
||||||
|
|
||||||
iter = s->sent_packets.erase(iter);
|
iter = s->sent_packets.erase(iter);
|
||||||
m_acked_since_last_resend = true;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
++iter;
|
++iter;
|
||||||
|
|||||||
@@ -181,11 +181,6 @@ namespace EQ
|
|||||||
Timestamp m_close_time;
|
Timestamp m_close_time;
|
||||||
double m_outgoing_budget;
|
double m_outgoing_budget;
|
||||||
|
|
||||||
// resend tracking
|
|
||||||
size_t m_resend_packets_sent = 0;
|
|
||||||
size_t m_resend_bytes_sent = 0;
|
|
||||||
bool m_acked_since_last_resend = false;
|
|
||||||
|
|
||||||
struct DaybreakSentPacket
|
struct DaybreakSentPacket
|
||||||
{
|
{
|
||||||
DynamicPacket packet;
|
DynamicPacket packet;
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ namespace EQ
|
|||||||
bool Connected() const { return m_connecting != true; }
|
bool Connected() const { return m_connecting != true; }
|
||||||
|
|
||||||
std::shared_ptr<EQ::Net::TCPConnection> Handle() { return m_connection; }
|
std::shared_ptr<EQ::Net::TCPConnection> Handle() { return m_connection; }
|
||||||
|
|
||||||
const std::unique_ptr<EQ::Timer> &GetTimer() const { return m_timer; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Connect();
|
void Connect();
|
||||||
void ProcessData(EQ::Net::TCPConnection *c, const unsigned char *data, size_t length);
|
void ProcessData(EQ::Net::TCPConnection *c, const unsigned char *data, size_t length);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (opcode == ServerOP_UsertoWorldReq) {
|
if (opcode == ServerOP_UsertoWorldReq) {
|
||||||
auto req_in = (UsertoWorldRequest*)p.Data();
|
auto req_in = (UsertoWorldRequest_Struct*)p.Data();
|
||||||
|
|
||||||
EQ::Net::DynamicPacket req;
|
EQ::Net::DynamicPacket req;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@@ -45,7 +45,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opcode == ServerOP_LSClientAuth) {
|
if (opcode == ServerOP_LSClientAuth) {
|
||||||
auto req_in = (ClientAuth*)p.Data();
|
auto req_in = (ClientAuth_Struct*)p.Data();
|
||||||
|
|
||||||
EQ::Net::DynamicPacket req;
|
EQ::Net::DynamicPacket req;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@@ -54,7 +54,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
|||||||
req.PutData(i, req_in->key, 30); i += 30;
|
req.PutData(i, req_in->key, 30); i += 30;
|
||||||
req.PutUInt8(i, req_in->lsadmin); i += 1;
|
req.PutUInt8(i, req_in->lsadmin); i += 1;
|
||||||
req.PutUInt16(i, req_in->is_world_admin); i += 2;
|
req.PutUInt16(i, req_in->is_world_admin); i += 2;
|
||||||
req.PutUInt32(i, req_in->ip_address); i += 4;
|
req.PutUInt32(i, req_in->ip); i += 4;
|
||||||
req.PutUInt8(i, req_in->is_client_from_local_network); i += 1;
|
req.PutUInt8(i, req_in->is_client_from_local_network); i += 1;
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
EQ::Net::DynamicPacket out;
|
||||||
@@ -123,7 +123,7 @@ void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
|
|||||||
{
|
{
|
||||||
size_t current = 0;
|
size_t current = 0;
|
||||||
size_t total = m_buffer.size();
|
size_t total = m_buffer.size();
|
||||||
constexpr size_t ls_info_size = sizeof(LoginserverNewWorldRequest);
|
constexpr size_t ls_info_size = sizeof(ServerNewLSInfo_Struct);
|
||||||
|
|
||||||
while (current < total) {
|
while (current < total) {
|
||||||
auto left = total - current;
|
auto left = total - current;
|
||||||
@@ -138,7 +138,7 @@ void EQ::Net::ServertalkServerConnection::ProcessReadBuffer()
|
|||||||
//this creates a small edge case where the exact size of a
|
//this creates a small edge case where the exact size of a
|
||||||
//packet from the modern protocol can't be "43061256"
|
//packet from the modern protocol can't be "43061256"
|
||||||
//so in send we pad it one byte if that's the case
|
//so in send we pad it one byte if that's the case
|
||||||
if (leg_opcode == ServerOP_NewLSInfo && leg_size == sizeof(LoginserverNewWorldRequest)) {
|
if (leg_opcode == ServerOP_NewLSInfo && leg_size == sizeof(ServerNewLSInfo_Struct)) {
|
||||||
m_legacy_mode = true;
|
m_legacy_mode = true;
|
||||||
m_identifier = "World";
|
m_identifier = "World";
|
||||||
m_parent->ConnectionIdentified(this);
|
m_parent->ConnectionIdentified(this);
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ IN(OP_RecipeDetails, uint32);
|
|||||||
//there is also a complicated OP_RecipeDetails reply struct OUT
|
//there is also a complicated OP_RecipeDetails reply struct OUT
|
||||||
IN(OP_RecipeAutoCombine, RecipeAutoCombine_Struct);
|
IN(OP_RecipeAutoCombine, RecipeAutoCombine_Struct);
|
||||||
IN(OP_TradeSkillCombine, NewCombine_Struct);
|
IN(OP_TradeSkillCombine, NewCombine_Struct);
|
||||||
IN(OP_TradeSkillRecipeInspect, TradeSkillRecipeInspect_Struct);
|
|
||||||
IN(OP_ItemName, ItemNamePacket_Struct);
|
IN(OP_ItemName, ItemNamePacket_Struct);
|
||||||
IN(OP_AugmentItem, AugmentItem_Struct);
|
IN(OP_AugmentItem, AugmentItem_Struct);
|
||||||
IN(OP_ClickDoor, ClickDoor_Struct);
|
IN(OP_ClickDoor, ClickDoor_Struct);
|
||||||
@@ -251,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);
|
||||||
|
|||||||
+22
-25
@@ -1213,22 +1213,22 @@ namespace RoF
|
|||||||
case 1: { // GuildBankItemUpdate
|
case 1: { // GuildBankItemUpdate
|
||||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||||
eq->action = 0;
|
eq->Action = 0;
|
||||||
OUT(unknown004);
|
OUT(Unknown004);
|
||||||
eq->unknown008 = 0;
|
eq->Unknown08 = 0;
|
||||||
OUT(slot_id);
|
OUT(SlotID);
|
||||||
OUT(area);
|
OUT(Area);
|
||||||
OUT(display);
|
OUT(Unknown012);
|
||||||
OUT(item_id);
|
OUT(ItemID);
|
||||||
OUT(icon_id);
|
OUT(Icon);
|
||||||
OUT(quantity);
|
OUT(Quantity);
|
||||||
OUT(permissions);
|
OUT(Permissions);
|
||||||
OUT(allow_merge);
|
OUT(AllowMerge);
|
||||||
OUT(is_useable);
|
OUT(Useable);
|
||||||
OUT_str(item_name);
|
OUT_str(ItemName);
|
||||||
OUT_str(donator);
|
OUT_str(Donator);
|
||||||
OUT_str(who_for);
|
OUT_str(WhoFor);
|
||||||
OUT(unknown226);
|
OUT(Unknown226);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -4538,10 +4538,14 @@ namespace RoF
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
IN(type)
|
||||||
|
IN(id);
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
IN(target_pos.x);
|
||||||
|
IN(target_pos.y);
|
||||||
|
IN(target_pos.z);
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
}
|
}
|
||||||
@@ -5188,14 +5192,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;
|
||||||
|
|||||||
+50
-148
@@ -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);
|
||||||
@@ -1743,19 +1682,22 @@ namespace RoF2
|
|||||||
case 1: { // GuildBankItemUpdate
|
case 1: { // GuildBankItemUpdate
|
||||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||||
eq->action = 0;
|
eq->Action = 0;
|
||||||
OUT(display);
|
OUT(Unknown004);
|
||||||
OUT(slot_id);
|
eq->Unknown08 = 0;
|
||||||
OUT(area);
|
OUT(SlotID);
|
||||||
OUT(item_id);
|
OUT(Area);
|
||||||
OUT(icon_id);
|
OUT(Unknown012);
|
||||||
OUT(quantity);
|
OUT(ItemID);
|
||||||
OUT(permissions);
|
OUT(Icon);
|
||||||
OUT(allow_merge);
|
OUT(Quantity);
|
||||||
OUT(is_useable);
|
OUT(Permissions);
|
||||||
OUT_str(item_name);
|
OUT(AllowMerge);
|
||||||
OUT_str(donator);
|
OUT(Useable);
|
||||||
OUT_str(who_for);
|
OUT_str(ItemName);
|
||||||
|
OUT_str(Donator);
|
||||||
|
OUT_str(WhoFor);
|
||||||
|
OUT(Unknown226);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -1901,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)
|
||||||
@@ -2102,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);
|
||||||
@@ -5602,10 +5517,14 @@ namespace RoF2
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
IN(type)
|
||||||
|
IN(id);
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
IN(target_pos.x);
|
||||||
|
IN(target_pos.y);
|
||||||
|
IN(target_pos.z);
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
}
|
}
|
||||||
@@ -6303,11 +6222,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);
|
||||||
@@ -6448,18 +6362,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{};
|
||||||
@@ -6481,11 +6386,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
|
||||||
@@ -6499,15 +6399,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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6881,13 +6784,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));
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace RoF2
|
|||||||
const int16 TRIBUTE_SIZE = 5;
|
const int16 TRIBUTE_SIZE = 5;
|
||||||
const int16 TROPHY_TRIBUTE_SIZE = 0;//unknown
|
const int16 TROPHY_TRIBUTE_SIZE = 0;//unknown
|
||||||
const int16 GUILD_TRIBUTE_SIZE = 2;//unverified
|
const int16 GUILD_TRIBUTE_SIZE = 2;//unverified
|
||||||
const int16 MERCHANT_SIZE = 500;
|
const int16 MERCHANT_SIZE = 200;
|
||||||
const int16 DELETED_SIZE = 0;//unknown - "Recovery Tab"
|
const int16 DELETED_SIZE = 0;//unknown - "Recovery Tab"
|
||||||
const int16 CORPSE_SIZE = POSSESSIONS_SIZE;
|
const int16 CORPSE_SIZE = POSSESSIONS_SIZE;
|
||||||
const int16 BAZAAR_SIZE = 200;
|
const int16 BAZAAR_SIZE = 200;
|
||||||
@@ -101,8 +101,6 @@ namespace RoF2
|
|||||||
const int16 MAIL_SIZE = 0;//unknown
|
const int16 MAIL_SIZE = 0;//unknown
|
||||||
const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown
|
const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown
|
||||||
const int16 KRONO_SIZE = 0;//unknown
|
const int16 KRONO_SIZE = 0;//unknown
|
||||||
const int16 GUILD_BANK_MAIN_SIZE = 200;
|
|
||||||
const int16 GUILD_BANK_DEPOSIT_SIZE = 40;
|
|
||||||
const int16 OTHER_SIZE = 0;//unknown
|
const int16 OTHER_SIZE = 0;//unknown
|
||||||
|
|
||||||
const int16 TRADE_NPC_SIZE = 4; // defined by implication
|
const int16 TRADE_NPC_SIZE = 4; // defined by implication
|
||||||
@@ -164,30 +162,9 @@ namespace RoF2
|
|||||||
} // namespace enum_
|
} // namespace enum_
|
||||||
using namespace enum_;
|
using namespace enum_;
|
||||||
|
|
||||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
|
||||||
const int16 SLOT_INVALID = IINVALID;
|
const int16 SLOT_INVALID = IINVALID;
|
||||||
const int16 SLOT_BEGIN = INULL;
|
const int16 SLOT_BEGIN = INULL;
|
||||||
|
|
||||||
const int16 BANK_BEGIN = 2000;
|
|
||||||
const int16 BANK_END = (BANK_BEGIN + invtype::BANK_SIZE) - 1;
|
|
||||||
|
|
||||||
const int16 SHARED_BANK_BEGIN = 2500;
|
|
||||||
const int16 SHARED_BANK_END = (SHARED_BANK_BEGIN + invtype::SHARED_BANK_SIZE) - 1;
|
|
||||||
|
|
||||||
const int16 TRADE_BEGIN = 3000;
|
|
||||||
const int16 TRADE_END = (TRADE_BEGIN + invtype::TRADE_SIZE) - 1;
|
|
||||||
|
|
||||||
const int16 TRADE_NPC_END = (TRADE_BEGIN + invtype::TRADE_NPC_SIZE) - 1; // defined by implication
|
|
||||||
|
|
||||||
const int16 WORLD_BEGIN = 4000;
|
|
||||||
const int16 WORLD_END = (WORLD_BEGIN + invtype::WORLD_SIZE) - 1;
|
|
||||||
|
|
||||||
const int16 TRIBUTE_BEGIN = 400;
|
|
||||||
const int16 TRIBUTE_END = (TRIBUTE_BEGIN + invtype::TRIBUTE_SIZE) - 1;
|
|
||||||
|
|
||||||
const int16 GUILD_TRIBUTE_BEGIN = 450;
|
|
||||||
const int16 GUILD_TRIBUTE_END = (GUILD_TRIBUTE_BEGIN + invtype::GUILD_TRIBUTE_SIZE) - 1;
|
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
const int16 POSSESSIONS_BEGIN = slotCharm;
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
const int16 POSSESSIONS_END = slotCursor;
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
||||||
@@ -222,21 +199,10 @@ namespace RoF2
|
|||||||
namespace invbag {
|
namespace invbag {
|
||||||
inline EQ::versions::ClientVersion GetInvBagRef() { return EQ::versions::ClientVersion::RoF2; }
|
inline EQ::versions::ClientVersion GetInvBagRef() { return EQ::versions::ClientVersion::RoF2; }
|
||||||
|
|
||||||
const int16 SLOT_TRADESKILL_EXPERIMENT_COMBINE = 1000;
|
|
||||||
const int16 SLOT_INVALID = IINVALID;
|
const int16 SLOT_INVALID = IINVALID;
|
||||||
const int16 SLOT_BEGIN = INULL;
|
const int16 SLOT_BEGIN = INULL;
|
||||||
const int16 SLOT_COUNT = 200;
|
const int16 SLOT_END = 9; //254;
|
||||||
const int16 SLOT_END = SLOT_COUNT - 1;
|
const int16 SLOT_COUNT = 10; //255; // server Size will be 255..unsure what actual client is (test)
|
||||||
|
|
||||||
const int16 GENERAL_BAGS_BEGIN = 251;
|
|
||||||
|
|
||||||
const int16 CURSOR_BAG_BEGIN = 351;
|
|
||||||
|
|
||||||
const int16 BANK_BAGS_BEGIN = 2031;
|
|
||||||
|
|
||||||
const int16 SHARED_BANK_BAGS_BEGIN = 2531;
|
|
||||||
|
|
||||||
const int16 TRADE_BAGS_BEGIN = 3031;
|
|
||||||
|
|
||||||
const char* GetInvBagIndexName(int16 bag_index);
|
const char* GetInvBagIndexName(int16 bag_index);
|
||||||
|
|
||||||
@@ -306,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)
|
||||||
|
|||||||
@@ -1965,39 +1965,41 @@ struct GuildBankWithdrawItem_Struct
|
|||||||
|
|
||||||
struct GuildBankItemUpdate_Struct
|
struct GuildBankItemUpdate_Struct
|
||||||
{
|
{
|
||||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown016, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||||
{
|
{
|
||||||
action = inAction;
|
Action = inAction;
|
||||||
slot_id = inSlotID;
|
Unknown004 = inUnknown004;
|
||||||
area = inArea;
|
SlotID = inSlotID;
|
||||||
display = inUnknown016;
|
Area = inArea;
|
||||||
item_id = inItemID;
|
Unknown012 = inUnknown012;
|
||||||
icon_id = inIcon;
|
ItemID = inItemID;
|
||||||
quantity = inQuantity;
|
Icon = inIcon;
|
||||||
permissions = inPermissions;
|
Quantity = inQuantity;
|
||||||
allow_merge = inAllowMerge;
|
Permissions = inPermissions;
|
||||||
is_useable = inUseable;
|
AllowMerge = inAllowMerge;
|
||||||
item_name[0] = '\0';
|
Useable = inUseable;
|
||||||
donator[0] = '\0';
|
ItemName[0] = '\0';
|
||||||
who_for[0] = '\0';
|
Donator[0] = '\0';
|
||||||
|
WhoFor[0] = '\0';
|
||||||
};
|
};
|
||||||
|
|
||||||
/*000*/ uint32 action;
|
/*000*/ uint32 Action;
|
||||||
/*004*/ uint32 not_used004; //disassemble of client did not use this
|
/*004*/ uint32 Unknown004;
|
||||||
/*008*/ uint32 not_used008; //disassemble of client did not use this
|
/*008*/ uint32 Unknown08;
|
||||||
/*012*/ uint16 slot_id;
|
/*012*/ uint16 SlotID;
|
||||||
/*014*/ uint16 area;
|
/*014*/ uint16 Area;
|
||||||
/*016*/ uint32 display;
|
/*016*/ uint32 Unknown012;
|
||||||
/*020*/ uint32 item_id;
|
/*020*/ uint32 ItemID;
|
||||||
/*024*/ uint32 icon_id;
|
/*024*/ uint32 Icon;
|
||||||
/*028*/ uint32 quantity;
|
/*028*/ uint32 Quantity;
|
||||||
/*032*/ uint32 permissions;
|
/*032*/ uint32 Permissions;
|
||||||
/*036*/ uint8 allow_merge;
|
/*036*/ uint8 AllowMerge;
|
||||||
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||||
/*038*/ char item_name[64];
|
/*038*/ char ItemName[64];
|
||||||
/*102*/ char donator[64];
|
/*102*/ char Donator[64];
|
||||||
/*166*/ char who_for[64];
|
/*166*/ char WhoFor[64];
|
||||||
|
/*230*/ uint16 Unknown226;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuildBankClear_Struct
|
struct GuildBankClear_Struct
|
||||||
@@ -3117,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 {
|
||||||
@@ -3933,11 +3934,6 @@ struct NewCombine_Struct
|
|||||||
/*24*/
|
/*24*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TradeSkillRecipeInspect_Struct {
|
|
||||||
uint32 recipe_id;
|
|
||||||
uint32 padding[17];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//client requesting favorite recipies
|
//client requesting favorite recipies
|
||||||
struct TradeskillFavorites_Struct {
|
struct TradeskillFavorites_Struct {
|
||||||
@@ -4020,14 +4016,13 @@ struct FindPerson_Point {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FindPersonRequest_Struct {
|
struct FindPersonRequest_Struct {
|
||||||
/*00*/ uint32 unknown00;
|
/*00*/ FindLocationType type;
|
||||||
/*04*/ uint32 npc_id;
|
/*04*/ int32 id;
|
||||||
/*08*/ uint32 unknown08;
|
/*08*/ int32 unknown08;
|
||||||
/*12*/ uint32 unknown12;
|
/*12*/ int32 unknown12;
|
||||||
/*16*/ FindPerson_Point client_pos;
|
/*16*/ FindPerson_Point client_pos;
|
||||||
/*28*/ uint32 unknown28;
|
/*28*/ FindPerson_Point target_pos;
|
||||||
/*32*/ uint32 unknown32;
|
/*40*/
|
||||||
/*36*/ uint32 unknown36;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//variable length packet of points
|
//variable length packet of points
|
||||||
@@ -4749,12 +4744,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];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5428,32 +5426,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*/
|
||||||
|
|||||||
@@ -1946,38 +1946,38 @@ struct GuildBankItemUpdate_Struct
|
|||||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||||
{
|
{
|
||||||
action = inAction;
|
Action = inAction;
|
||||||
unknown004 = inUnknown004;
|
Unknown004 = inUnknown004;
|
||||||
slot_id = inSlotID;
|
SlotID = inSlotID;
|
||||||
area = inArea;
|
Area = inArea;
|
||||||
display = inUnknown012;
|
Unknown012 = inUnknown012;
|
||||||
item_id = inItemID;
|
ItemID = inItemID;
|
||||||
icon_id = inIcon;
|
Icon = inIcon;
|
||||||
quantity = inQuantity;
|
Quantity = inQuantity;
|
||||||
permissions = inPermissions;
|
Permissions = inPermissions;
|
||||||
allow_merge = inAllowMerge;
|
AllowMerge = inAllowMerge;
|
||||||
is_useable = inUseable;
|
Useable = inUseable;
|
||||||
item_name[0] = '\0';
|
ItemName[0] = '\0';
|
||||||
donator[0] = '\0';
|
Donator[0] = '\0';
|
||||||
who_for[0] = '\0';
|
WhoFor[0] = '\0';
|
||||||
};
|
};
|
||||||
|
|
||||||
/*000*/ uint32 action;
|
/*000*/ uint32 Action;
|
||||||
/*004*/ uint32 unknown004;
|
/*004*/ uint32 Unknown004;
|
||||||
/*008*/ uint32 unknown008;
|
/*008*/ uint32 Unknown08;
|
||||||
/*012*/ uint16 slot_id;
|
/*012*/ uint16 SlotID;
|
||||||
/*014*/ uint16 area;
|
/*014*/ uint16 Area;
|
||||||
/*016*/ uint32 display;
|
/*016*/ uint32 Unknown012;
|
||||||
/*020*/ uint32 item_id;
|
/*020*/ uint32 ItemID;
|
||||||
/*024*/ uint32 icon_id;
|
/*024*/ uint32 Icon;
|
||||||
/*028*/ uint32 quantity;
|
/*028*/ uint32 Quantity;
|
||||||
/*032*/ uint32 permissions;
|
/*032*/ uint32 Permissions;
|
||||||
/*036*/ uint8 allow_merge;
|
/*036*/ uint8 AllowMerge;
|
||||||
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||||
/*038*/ char item_name[64];
|
/*038*/ char ItemName[64];
|
||||||
/*102*/ char donator[64];
|
/*102*/ char Donator[64];
|
||||||
/*166*/ char who_for[64];
|
/*166*/ char WhoFor[64];
|
||||||
/*230*/ uint16 unknown226;
|
/*230*/ uint16 Unknown226;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuildBankClear_Struct
|
struct GuildBankClear_Struct
|
||||||
@@ -3779,14 +3779,13 @@ struct FindPerson_Point {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FindPersonRequest_Struct {
|
struct FindPersonRequest_Struct {
|
||||||
/*00*/ uint32 unknown00;
|
/*00*/ FindLocationType type;
|
||||||
/*04*/ uint32 npc_id;
|
/*04*/ int32 id;
|
||||||
/*08*/ uint32 unknown08;
|
/*08*/ int32 unknown08;
|
||||||
/*12*/ uint32 unknown12;
|
/*12*/ int32 unknown12;
|
||||||
/*16*/ FindPerson_Point client_pos;
|
/*16*/ FindPerson_Point client_pos;
|
||||||
/*28*/ uint32 unknown28;
|
/*28*/ FindPerson_Point target_pos;
|
||||||
/*32*/ uint32 unknown32;
|
/*40*/
|
||||||
/*36*/ uint32 unknown36;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//variable length packet of points
|
//variable length packet of points
|
||||||
|
|||||||
@@ -3150,7 +3150,8 @@ namespace SoD
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
|||||||
@@ -2605,7 +2605,8 @@ namespace SoF
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
|||||||
@@ -3327,6 +3327,20 @@ namespace Titanium
|
|||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECODE(OP_FindPersonRequest)
|
||||||
|
{
|
||||||
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
|
IN(client_pos.x);
|
||||||
|
IN(client_pos.y);
|
||||||
|
IN(client_pos.z);
|
||||||
|
|
||||||
|
FINISH_DIRECT_DECODE();
|
||||||
|
}
|
||||||
|
|
||||||
// file scope helper methods
|
// file scope helper methods
|
||||||
void SerializeItem(EQ::OutBuffer& ob, const EQ::ItemInstance *inst, int16 slot_id_in, uint8 depth) {
|
void SerializeItem(EQ::OutBuffer& ob, const EQ::ItemInstance *inst, int16 slot_id_in, uint8 depth) {
|
||||||
const char *protection = "\\\\\\\\\\";
|
const char *protection = "\\\\\\\\\\";
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ D(OP_TradeSkillCombine)
|
|||||||
D(OP_TributeItem)
|
D(OP_TributeItem)
|
||||||
D(OP_WearChange)
|
D(OP_WearChange)
|
||||||
D(OP_WhoAllRequest)
|
D(OP_WhoAllRequest)
|
||||||
|
D(OP_FindPersonRequest)
|
||||||
|
|
||||||
#undef E
|
#undef E
|
||||||
#undef D
|
#undef D
|
||||||
|
|||||||
@@ -2463,25 +2463,25 @@ struct WhoAllReturnStruct {
|
|||||||
struct BeginTrader_Struct {
|
struct BeginTrader_Struct {
|
||||||
uint32 action;
|
uint32 action;
|
||||||
uint32 unknown04;
|
uint32 unknown04;
|
||||||
uint64 serial_number[EQ::invtype::BAZAAR_SIZE];
|
uint64 serial_number[80];
|
||||||
uint32 cost[EQ::invtype::BAZAAR_SIZE];
|
uint32 cost[80];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Trader_Struct {
|
struct Trader_Struct {
|
||||||
uint32 action;
|
uint32 action;
|
||||||
uint32 unknown004;
|
uint32 unknown004;
|
||||||
uint64 item_id[EQ::invtype::BAZAAR_SIZE];
|
uint64 item_id[80];
|
||||||
uint32 item_cost[EQ::invtype::BAZAAR_SIZE];
|
uint32 item_cost[80];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClickTrader_Struct {
|
struct ClickTrader_Struct {
|
||||||
uint32 code;
|
uint32 code;
|
||||||
uint32 unknown[161];//damn soe this is totally pointless :/ but at least your finally using memset! Good job :) -LE
|
uint32 unknown[161];//damn soe this is totally pointless :/ but at least your finally using memset! Good job :) -LE
|
||||||
uint32 itemcost[EQ::invtype::BAZAAR_SIZE];
|
uint32 itemcost[80];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GetItems_Struct{
|
struct GetItems_Struct{
|
||||||
uint32 items[EQ::invtype::BAZAAR_SIZE];
|
uint32 items[80];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BecomeTrader_Struct {
|
struct BecomeTrader_Struct {
|
||||||
|
|||||||
@@ -3982,7 +3982,8 @@ namespace UF
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
|||||||
+66
-52
@@ -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,66 @@ 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;
|
|
||||||
|
|
||||||
LogInfo("Loading server paths");
|
|
||||||
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// patches
|
||||||
|
if (File::Exists(fs::path{ m_server_path + "/" + c->OpcodeDir }.string())) {
|
||||||
|
m_opcode_path = fs::relative(fs::path{ m_server_path + "/" + c->OpcodeDir }).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("opcode path [{}]", m_opcode_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
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,13 @@ public:
|
|||||||
int16_t poison;
|
int16_t poison;
|
||||||
int16_t disease;
|
int16_t disease;
|
||||||
int16_t corruption;
|
int16_t corruption;
|
||||||
|
uint32_t show_helm;
|
||||||
|
uint32_t follow_distance;
|
||||||
|
uint8_t stop_melee_level;
|
||||||
|
int32_t expansion_bitmask;
|
||||||
|
uint8_t enforce_spell_settings;
|
||||||
|
uint8_t archery_setting;
|
||||||
|
uint32_t caster_range;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -119,6 +126,13 @@ public:
|
|||||||
"poison",
|
"poison",
|
||||||
"disease",
|
"disease",
|
||||||
"corruption",
|
"corruption",
|
||||||
|
"show_helm",
|
||||||
|
"follow_distance",
|
||||||
|
"stop_melee_level",
|
||||||
|
"expansion_bitmask",
|
||||||
|
"enforce_spell_settings",
|
||||||
|
"archery_setting",
|
||||||
|
"caster_range",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +184,13 @@ public:
|
|||||||
"poison",
|
"poison",
|
||||||
"disease",
|
"disease",
|
||||||
"corruption",
|
"corruption",
|
||||||
|
"show_helm",
|
||||||
|
"follow_distance",
|
||||||
|
"stop_melee_level",
|
||||||
|
"expansion_bitmask",
|
||||||
|
"enforce_spell_settings",
|
||||||
|
"archery_setting",
|
||||||
|
"caster_range",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +276,13 @@ public:
|
|||||||
e.poison = 0;
|
e.poison = 0;
|
||||||
e.disease = 0;
|
e.disease = 0;
|
||||||
e.corruption = 0;
|
e.corruption = 0;
|
||||||
|
e.show_helm = 0;
|
||||||
|
e.follow_distance = 200;
|
||||||
|
e.stop_melee_level = 255;
|
||||||
|
e.expansion_bitmask = -1;
|
||||||
|
e.enforce_spell_settings = 0;
|
||||||
|
e.archery_setting = 0;
|
||||||
|
e.caster_range = 300;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -337,6 +364,13 @@ public:
|
|||||||
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
|
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
|
||||||
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
|
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
|
||||||
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0;
|
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0;
|
||||||
|
e.show_helm = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||||
|
e.follow_distance = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 200;
|
||||||
|
e.stop_melee_level = row[47] ? static_cast<uint8_t>(strtoul(row[47], nullptr, 10)) : 255;
|
||||||
|
e.expansion_bitmask = row[48] ? static_cast<int32_t>(atoi(row[48])) : -1;
|
||||||
|
e.enforce_spell_settings = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0;
|
||||||
|
e.archery_setting = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0;
|
||||||
|
e.caster_range = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 300;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -349,25 +383,14 @@ public:
|
|||||||
int bot_data_id
|
int bot_data_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::string query;
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
if (RuleB(Bots, BotSoftDeletes)) {
|
|
||||||
query = fmt::format(
|
|
||||||
"UPDATE {} SET name = SUBSTRING(CONCAT(name, '-deleted-', UNIX_TIMESTAMP()), 1, 64) WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
bot_data_id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
query = fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
"DELETE FROM {} WHERE {} = {}",
|
||||||
TableName(),
|
TableName(),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
bot_data_id
|
bot_data_id
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
auto results = db.QueryDatabase(query);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
}
|
}
|
||||||
@@ -425,6 +448,13 @@ public:
|
|||||||
v.push_back(columns[42] + " = " + std::to_string(e.poison));
|
v.push_back(columns[42] + " = " + std::to_string(e.poison));
|
||||||
v.push_back(columns[43] + " = " + std::to_string(e.disease));
|
v.push_back(columns[43] + " = " + std::to_string(e.disease));
|
||||||
v.push_back(columns[44] + " = " + std::to_string(e.corruption));
|
v.push_back(columns[44] + " = " + std::to_string(e.corruption));
|
||||||
|
v.push_back(columns[45] + " = " + std::to_string(e.show_helm));
|
||||||
|
v.push_back(columns[46] + " = " + std::to_string(e.follow_distance));
|
||||||
|
v.push_back(columns[47] + " = " + std::to_string(e.stop_melee_level));
|
||||||
|
v.push_back(columns[48] + " = " + std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(columns[49] + " = " + std::to_string(e.enforce_spell_settings));
|
||||||
|
v.push_back(columns[50] + " = " + std::to_string(e.archery_setting));
|
||||||
|
v.push_back(columns[51] + " = " + std::to_string(e.caster_range));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -491,6 +521,13 @@ public:
|
|||||||
v.push_back(std::to_string(e.poison));
|
v.push_back(std::to_string(e.poison));
|
||||||
v.push_back(std::to_string(e.disease));
|
v.push_back(std::to_string(e.disease));
|
||||||
v.push_back(std::to_string(e.corruption));
|
v.push_back(std::to_string(e.corruption));
|
||||||
|
v.push_back(std::to_string(e.show_helm));
|
||||||
|
v.push_back(std::to_string(e.follow_distance));
|
||||||
|
v.push_back(std::to_string(e.stop_melee_level));
|
||||||
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
|
v.push_back(std::to_string(e.archery_setting));
|
||||||
|
v.push_back(std::to_string(e.caster_range));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -565,6 +602,13 @@ public:
|
|||||||
v.push_back(std::to_string(e.poison));
|
v.push_back(std::to_string(e.poison));
|
||||||
v.push_back(std::to_string(e.disease));
|
v.push_back(std::to_string(e.disease));
|
||||||
v.push_back(std::to_string(e.corruption));
|
v.push_back(std::to_string(e.corruption));
|
||||||
|
v.push_back(std::to_string(e.show_helm));
|
||||||
|
v.push_back(std::to_string(e.follow_distance));
|
||||||
|
v.push_back(std::to_string(e.stop_melee_level));
|
||||||
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
|
v.push_back(std::to_string(e.archery_setting));
|
||||||
|
v.push_back(std::to_string(e.caster_range));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -643,6 +687,13 @@ public:
|
|||||||
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
|
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
|
||||||
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
|
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
|
||||||
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0;
|
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0;
|
||||||
|
e.show_helm = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||||
|
e.follow_distance = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 200;
|
||||||
|
e.stop_melee_level = row[47] ? static_cast<uint8_t>(strtoul(row[47], nullptr, 10)) : 255;
|
||||||
|
e.expansion_bitmask = row[48] ? static_cast<int32_t>(atoi(row[48])) : -1;
|
||||||
|
e.enforce_spell_settings = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0;
|
||||||
|
e.archery_setting = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0;
|
||||||
|
e.caster_range = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 300;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -712,6 +763,13 @@ public:
|
|||||||
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
|
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
|
||||||
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
|
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
|
||||||
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0;
|
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0;
|
||||||
|
e.show_helm = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||||
|
e.follow_distance = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 200;
|
||||||
|
e.stop_melee_level = row[47] ? static_cast<uint8_t>(strtoul(row[47], nullptr, 10)) : 255;
|
||||||
|
e.expansion_bitmask = row[48] ? static_cast<int32_t>(atoi(row[48])) : -1;
|
||||||
|
e.enforce_spell_settings = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0;
|
||||||
|
e.archery_setting = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0;
|
||||||
|
e.caster_range = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 300;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -831,6 +889,13 @@ public:
|
|||||||
v.push_back(std::to_string(e.poison));
|
v.push_back(std::to_string(e.poison));
|
||||||
v.push_back(std::to_string(e.disease));
|
v.push_back(std::to_string(e.disease));
|
||||||
v.push_back(std::to_string(e.corruption));
|
v.push_back(std::to_string(e.corruption));
|
||||||
|
v.push_back(std::to_string(e.show_helm));
|
||||||
|
v.push_back(std::to_string(e.follow_distance));
|
||||||
|
v.push_back(std::to_string(e.stop_melee_level));
|
||||||
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
|
v.push_back(std::to_string(e.archery_setting));
|
||||||
|
v.push_back(std::to_string(e.caster_range));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -898,6 +963,13 @@ public:
|
|||||||
v.push_back(std::to_string(e.poison));
|
v.push_back(std::to_string(e.poison));
|
||||||
v.push_back(std::to_string(e.disease));
|
v.push_back(std::to_string(e.disease));
|
||||||
v.push_back(std::to_string(e.corruption));
|
v.push_back(std::to_string(e.corruption));
|
||||||
|
v.push_back(std::to_string(e.show_helm));
|
||||||
|
v.push_back(std::to_string(e.follow_distance));
|
||||||
|
v.push_back(std::to_string(e.stop_melee_level));
|
||||||
|
v.push_back(std::to_string(e.expansion_bitmask));
|
||||||
|
v.push_back(std::to_string(e.enforce_spell_settings));
|
||||||
|
v.push_back(std::to_string(e.archery_setting));
|
||||||
|
v.push_back(std::to_string(e.caster_range));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,464 +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_BOT_SETTINGS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_BOT_SETTINGS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BaseBotSettingsRepository {
|
|
||||||
public:
|
|
||||||
struct BotSettings {
|
|
||||||
uint32_t character_id;
|
|
||||||
uint32_t bot_id;
|
|
||||||
uint8_t stance;
|
|
||||||
uint16_t setting_id;
|
|
||||||
uint8_t setting_type;
|
|
||||||
int32_t value;
|
|
||||||
std::string category_name;
|
|
||||||
std::string setting_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("character_id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"character_id",
|
|
||||||
"bot_id",
|
|
||||||
"stance",
|
|
||||||
"setting_id",
|
|
||||||
"setting_type",
|
|
||||||
"value",
|
|
||||||
"category_name",
|
|
||||||
"setting_name",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"character_id",
|
|
||||||
"bot_id",
|
|
||||||
"stance",
|
|
||||||
"setting_id",
|
|
||||||
"setting_type",
|
|
||||||
"value",
|
|
||||||
"category_name",
|
|
||||||
"setting_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("bot_settings");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static BotSettings NewEntity()
|
|
||||||
{
|
|
||||||
BotSettings e{};
|
|
||||||
|
|
||||||
e.character_id = 0;
|
|
||||||
e.bot_id = 0;
|
|
||||||
e.stance = 0;
|
|
||||||
e.setting_id = 0;
|
|
||||||
e.setting_type = 0;
|
|
||||||
e.value = 0;
|
|
||||||
e.category_name = "";
|
|
||||||
e.setting_name = "";
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BotSettings GetBotSettings(
|
|
||||||
const std::vector<BotSettings> &bot_settingss,
|
|
||||||
int bot_settings_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &bot_settings : bot_settingss) {
|
|
||||||
if (bot_settings.character_id == bot_settings_id) {
|
|
||||||
return bot_settings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static BotSettings FindOne(
|
|
||||||
Database& db,
|
|
||||||
int bot_settings_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
bot_settings_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
BotSettings e{};
|
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
|
||||||
e.bot_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.stance = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.setting_id = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.setting_type = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.value = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
|
||||||
e.category_name = row[6] ? row[6] : "";
|
|
||||||
e.setting_name = row[7] ? row[7] : "";
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int bot_settings_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
bot_settings_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const BotSettings &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] + " = " + std::to_string(e.bot_id));
|
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.stance));
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.setting_id));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.setting_type));
|
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.value));
|
|
||||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.category_name) + "'");
|
|
||||||
v.push_back(columns[7] + " = '" + Strings::Escape(e.setting_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 BotSettings InsertOne(
|
|
||||||
Database& db,
|
|
||||||
BotSettings e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back(std::to_string(e.bot_id));
|
|
||||||
v.push_back(std::to_string(e.stance));
|
|
||||||
v.push_back(std::to_string(e.setting_id));
|
|
||||||
v.push_back(std::to_string(e.setting_type));
|
|
||||||
v.push_back(std::to_string(e.value));
|
|
||||||
v.push_back("'" + Strings::Escape(e.category_name) + "'");
|
|
||||||
v.push_back("'" + Strings::Escape(e.setting_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<BotSettings> &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(std::to_string(e.bot_id));
|
|
||||||
v.push_back(std::to_string(e.stance));
|
|
||||||
v.push_back(std::to_string(e.setting_id));
|
|
||||||
v.push_back(std::to_string(e.setting_type));
|
|
||||||
v.push_back(std::to_string(e.value));
|
|
||||||
v.push_back("'" + Strings::Escape(e.category_name) + "'");
|
|
||||||
v.push_back("'" + Strings::Escape(e.setting_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<BotSettings> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<BotSettings> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
BotSettings e{};
|
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
|
||||||
e.bot_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.stance = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.setting_id = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.setting_type = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.value = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
|
||||||
e.category_name = row[6] ? row[6] : "";
|
|
||||||
e.setting_name = row[7] ? row[7] : "";
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<BotSettings> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<BotSettings> 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) {
|
|
||||||
BotSettings e{};
|
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
|
||||||
e.bot_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.stance = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
|
||||||
e.setting_id = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.setting_type = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.value = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
|
||||||
e.category_name = row[6] ? row[6] : "";
|
|
||||||
e.setting_name = row[7] ? row[7] : "";
|
|
||||||
|
|
||||||
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 BotSettings &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
|
||||||
v.push_back(std::to_string(e.bot_id));
|
|
||||||
v.push_back(std::to_string(e.stance));
|
|
||||||
v.push_back(std::to_string(e.setting_id));
|
|
||||||
v.push_back(std::to_string(e.setting_type));
|
|
||||||
v.push_back(std::to_string(e.value));
|
|
||||||
v.push_back("'" + Strings::Escape(e.category_name) + "'");
|
|
||||||
v.push_back("'" + Strings::Escape(e.setting_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<BotSettings> &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(std::to_string(e.bot_id));
|
|
||||||
v.push_back(std::to_string(e.stance));
|
|
||||||
v.push_back(std::to_string(e.setting_id));
|
|
||||||
v.push_back(std::to_string(e.setting_type));
|
|
||||||
v.push_back(std::to_string(e.value));
|
|
||||||
v.push_back("'" + Strings::Escape(e.category_name) + "'");
|
|
||||||
v.push_back("'" + Strings::Escape(e.setting_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_BOT_SETTINGS_REPOSITORY_H
|
|
||||||
@@ -123,7 +123,6 @@ 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;
|
||||||
uint8_t illusion_block;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -238,7 +237,6 @@ public:
|
|||||||
"aa_points_old",
|
"aa_points_old",
|
||||||
"e_last_invsnapshot",
|
"e_last_invsnapshot",
|
||||||
"deleted_at",
|
"deleted_at",
|
||||||
"illusion_block",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +347,6 @@ public:
|
|||||||
"aa_points_old",
|
"aa_points_old",
|
||||||
"e_last_invsnapshot",
|
"e_last_invsnapshot",
|
||||||
"UNIX_TIMESTAMP(deleted_at)",
|
"UNIX_TIMESTAMP(deleted_at)",
|
||||||
"illusion_block",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +491,6 @@ 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.illusion_block = 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -635,7 +631,6 @@ 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.illusion_block = row[104] ? static_cast<uint8_t>(strtoul(row[104], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -772,7 +767,6 @@ 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.illusion_block));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -898,7 +892,6 @@ 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.illusion_block));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1032,7 +1025,6 @@ 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.illusion_block));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -1170,7 +1162,6 @@ 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.illusion_block = row[104] ? static_cast<uint8_t>(strtoul(row[104], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1299,7 +1290,6 @@ 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.illusion_block = row[104] ? static_cast<uint8_t>(strtoul(row[104], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1478,7 +1468,6 @@ 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.illusion_block));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1605,7 +1594,6 @@ 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.illusion_block));
|
|
||||||
|
|
||||||
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,12 +23,9 @@ public:
|
|||||||
std::string key_;
|
std::string key_;
|
||||||
std::string value;
|
std::string value;
|
||||||
uint32_t expires;
|
uint32_t expires;
|
||||||
uint64_t account_id;
|
int64_t character_id;
|
||||||
uint64_t character_id;
|
int64_t npc_id;
|
||||||
uint32_t npc_id;
|
int64_t bot_id;
|
||||||
uint32_t bot_id;
|
|
||||||
uint16_t zone_id;
|
|
||||||
uint16_t instance_id;
|
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
@@ -39,12 +36,9 @@ 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)
|
||||||
CEREAL_NVP(zone_id),
|
|
||||||
CEREAL_NVP(instance_id)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -61,12 +55,9 @@ public:
|
|||||||
"`key`",
|
"`key`",
|
||||||
"value",
|
"value",
|
||||||
"expires",
|
"expires",
|
||||||
"account_id",
|
|
||||||
"character_id",
|
"character_id",
|
||||||
"npc_id",
|
"npc_id",
|
||||||
"bot_id",
|
"bot_id",
|
||||||
"zone_id",
|
|
||||||
"instance_id",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,12 +68,9 @@ public:
|
|||||||
"`key`",
|
"`key`",
|
||||||
"value",
|
"value",
|
||||||
"expires",
|
"expires",
|
||||||
"account_id",
|
|
||||||
"character_id",
|
"character_id",
|
||||||
"npc_id",
|
"npc_id",
|
||||||
"bot_id",
|
"bot_id",
|
||||||
"zone_id",
|
|
||||||
"instance_id",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,12 +115,9 @@ 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;
|
||||||
e.zone_id = 0;
|
|
||||||
e.instance_id = 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -173,12 +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] ? strtoull(row[4], nullptr, 10) : 0;
|
e.character_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
e.npc_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.bot_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
e.bot_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.zone_id = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
|
|
||||||
e.instance_id = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -215,12 +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));
|
|
||||||
v.push_back(columns[8] + " = " + std::to_string(e.zone_id));
|
|
||||||
v.push_back(columns[9] + " = " + std::to_string(e.instance_id));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -246,12 +225,9 @@ 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));
|
||||||
v.push_back(std::to_string(e.zone_id));
|
|
||||||
v.push_back(std::to_string(e.instance_id));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -285,12 +261,9 @@ 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));
|
||||||
v.push_back(std::to_string(e.zone_id));
|
|
||||||
v.push_back(std::to_string(e.instance_id));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -328,12 +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] ? strtoull(row[4], nullptr, 10) : 0;
|
e.character_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
e.npc_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.bot_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
e.bot_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.zone_id = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
|
|
||||||
e.instance_id = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -362,12 +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] ? strtoull(row[4], nullptr, 10) : 0;
|
e.character_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
e.npc_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.bot_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
e.bot_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.zone_id = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
|
|
||||||
e.instance_id = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -446,12 +413,9 @@ 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));
|
||||||
v.push_back(std::to_string(e.zone_id));
|
|
||||||
v.push_back(std::to_string(e.instance_id));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -478,12 +442,9 @@ 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));
|
||||||
v.push_back(std::to_string(e.zone_id));
|
|
||||||
v.push_back(std::to_string(e.instance_id));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public:
|
|||||||
float zone_in_z;
|
float zone_in_z;
|
||||||
float zone_in_heading;
|
float zone_in_heading;
|
||||||
uint8_t has_zone_in;
|
uint8_t has_zone_in;
|
||||||
int8_t is_locked;
|
|
||||||
int8_t add_replay;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -77,8 +75,6 @@ public:
|
|||||||
"zone_in_z",
|
"zone_in_z",
|
||||||
"zone_in_heading",
|
"zone_in_heading",
|
||||||
"has_zone_in",
|
"has_zone_in",
|
||||||
"is_locked",
|
|
||||||
"add_replay",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,8 +104,6 @@ public:
|
|||||||
"zone_in_z",
|
"zone_in_z",
|
||||||
"zone_in_heading",
|
"zone_in_heading",
|
||||||
"has_zone_in",
|
"has_zone_in",
|
||||||
"is_locked",
|
|
||||||
"add_replay",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,8 +167,6 @@ public:
|
|||||||
e.zone_in_z = 0;
|
e.zone_in_z = 0;
|
||||||
e.zone_in_heading = 0;
|
e.zone_in_heading = 0;
|
||||||
e.has_zone_in = 0;
|
e.has_zone_in = 0;
|
||||||
e.is_locked = 0;
|
|
||||||
e.add_replay = 1;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -234,8 +226,6 @@ public:
|
|||||||
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
||||||
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
||||||
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||||
e.is_locked = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
|
||||||
e.add_replay = row[24] ? static_cast<int8_t>(atoi(row[24])) : 1;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -291,8 +281,6 @@ public:
|
|||||||
v.push_back(columns[20] + " = " + std::to_string(e.zone_in_z));
|
v.push_back(columns[20] + " = " + std::to_string(e.zone_in_z));
|
||||||
v.push_back(columns[21] + " = " + std::to_string(e.zone_in_heading));
|
v.push_back(columns[21] + " = " + std::to_string(e.zone_in_heading));
|
||||||
v.push_back(columns[22] + " = " + std::to_string(e.has_zone_in));
|
v.push_back(columns[22] + " = " + std::to_string(e.has_zone_in));
|
||||||
v.push_back(columns[23] + " = " + std::to_string(e.is_locked));
|
|
||||||
v.push_back(columns[24] + " = " + std::to_string(e.add_replay));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -337,8 +325,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
v.push_back(std::to_string(e.is_locked));
|
|
||||||
v.push_back(std::to_string(e.add_replay));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -391,8 +377,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
v.push_back(std::to_string(e.is_locked));
|
|
||||||
v.push_back(std::to_string(e.add_replay));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -449,8 +433,6 @@ public:
|
|||||||
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
||||||
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
||||||
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||||
e.is_locked = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
|
||||||
e.add_replay = row[24] ? static_cast<int8_t>(atoi(row[24])) : 1;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -498,8 +480,6 @@ public:
|
|||||||
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
||||||
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
||||||
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||||
e.is_locked = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
|
||||||
e.add_replay = row[24] ? static_cast<int8_t>(atoi(row[24])) : 1;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -597,8 +577,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
v.push_back(std::to_string(e.is_locked));
|
|
||||||
v.push_back(std::to_string(e.add_replay));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -644,8 +622,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
v.push_back(std::to_string(e.is_locked));
|
|
||||||
v.push_back(std::to_string(e.add_replay));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
+44
-44
@@ -9,18 +9,18 @@
|
|||||||
* @docs https://docs.eqemu.io/developer/repositories
|
* @docs https://docs.eqemu.io/developer/repositories
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
#ifndef EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||||
#define EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
#define EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||||
|
|
||||||
#include "../../database.h"
|
#include "../../database.h"
|
||||||
#include "../../strings.h"
|
#include "../../strings.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
class BaseDynamicZoneLockoutsRepository {
|
class BaseExpeditionLockoutsRepository {
|
||||||
public:
|
public:
|
||||||
struct DynamicZoneLockouts {
|
struct ExpeditionLockouts {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t dynamic_zone_id;
|
uint32_t expedition_id;
|
||||||
std::string event_name;
|
std::string event_name;
|
||||||
time_t expire_time;
|
time_t expire_time;
|
||||||
uint32_t duration;
|
uint32_t duration;
|
||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"dynamic_zone_id",
|
"expedition_id",
|
||||||
"event_name",
|
"event_name",
|
||||||
"expire_time",
|
"expire_time",
|
||||||
"duration",
|
"duration",
|
||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"dynamic_zone_id",
|
"expedition_id",
|
||||||
"event_name",
|
"event_name",
|
||||||
"UNIX_TIMESTAMP(expire_time)",
|
"UNIX_TIMESTAMP(expire_time)",
|
||||||
"duration",
|
"duration",
|
||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
static std::string TableName()
|
static std::string TableName()
|
||||||
{
|
{
|
||||||
return std::string("dynamic_zone_lockouts");
|
return std::string("expedition_lockouts");
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string BaseSelect()
|
static std::string BaseSelect()
|
||||||
@@ -89,12 +89,12 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DynamicZoneLockouts NewEntity()
|
static ExpeditionLockouts NewEntity()
|
||||||
{
|
{
|
||||||
DynamicZoneLockouts e{};
|
ExpeditionLockouts e{};
|
||||||
|
|
||||||
e.id = 0;
|
e.id = 0;
|
||||||
e.dynamic_zone_id = 0;
|
e.expedition_id = 0;
|
||||||
e.event_name = "";
|
e.event_name = "";
|
||||||
e.expire_time = std::time(nullptr);
|
e.expire_time = std::time(nullptr);
|
||||||
e.duration = 0;
|
e.duration = 0;
|
||||||
@@ -103,23 +103,23 @@ public:
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DynamicZoneLockouts GetDynamicZoneLockouts(
|
static ExpeditionLockouts GetExpeditionLockouts(
|
||||||
const std::vector<DynamicZoneLockouts> &dynamic_zone_lockoutss,
|
const std::vector<ExpeditionLockouts> &expedition_lockoutss,
|
||||||
int dynamic_zone_lockouts_id
|
int expedition_lockouts_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
for (auto &dynamic_zone_lockouts : dynamic_zone_lockoutss) {
|
for (auto &expedition_lockouts : expedition_lockoutss) {
|
||||||
if (dynamic_zone_lockouts.id == dynamic_zone_lockouts_id) {
|
if (expedition_lockouts.id == expedition_lockouts_id) {
|
||||||
return dynamic_zone_lockouts;
|
return expedition_lockouts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewEntity();
|
return NewEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DynamicZoneLockouts FindOne(
|
static ExpeditionLockouts FindOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
int dynamic_zone_lockouts_id
|
int expedition_lockouts_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -127,16 +127,16 @@ public:
|
|||||||
"{} WHERE {} = {} LIMIT 1",
|
"{} WHERE {} = {} LIMIT 1",
|
||||||
BaseSelect(),
|
BaseSelect(),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
dynamic_zone_lockouts_id
|
expedition_lockouts_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
DynamicZoneLockouts e{};
|
ExpeditionLockouts e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.expedition_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.event_name = row[2] ? row[2] : "";
|
e.event_name = row[2] ? row[2] : "";
|
||||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||||
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
@@ -150,7 +150,7 @@ public:
|
|||||||
|
|
||||||
static int DeleteOne(
|
static int DeleteOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
int dynamic_zone_lockouts_id
|
int expedition_lockouts_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
"DELETE FROM {} WHERE {} = {}",
|
"DELETE FROM {} WHERE {} = {}",
|
||||||
TableName(),
|
TableName(),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
dynamic_zone_lockouts_id
|
expedition_lockouts_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -167,14 +167,14 @@ public:
|
|||||||
|
|
||||||
static int UpdateOne(
|
static int UpdateOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
const DynamicZoneLockouts &e
|
const ExpeditionLockouts &e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.dynamic_zone_id));
|
v.push_back(columns[1] + " = " + std::to_string(e.expedition_id));
|
||||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.event_name) + "'");
|
v.push_back(columns[2] + " = '" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.duration));
|
v.push_back(columns[4] + " = " + std::to_string(e.duration));
|
||||||
@@ -193,15 +193,15 @@ public:
|
|||||||
return (results.Success() ? results.RowsAffected() : 0);
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DynamicZoneLockouts InsertOne(
|
static ExpeditionLockouts InsertOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
DynamicZoneLockouts e
|
ExpeditionLockouts e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
v.push_back(std::to_string(e.expedition_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -227,7 +227,7 @@ public:
|
|||||||
|
|
||||||
static int InsertMany(
|
static int InsertMany(
|
||||||
Database& db,
|
Database& db,
|
||||||
const std::vector<DynamicZoneLockouts> &entries
|
const std::vector<ExpeditionLockouts> &entries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_chunks;
|
std::vector<std::string> insert_chunks;
|
||||||
@@ -236,7 +236,7 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
v.push_back(std::to_string(e.expedition_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -258,9 +258,9 @@ public:
|
|||||||
return (results.Success() ? results.RowsAffected() : 0);
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<DynamicZoneLockouts> All(Database& db)
|
static std::vector<ExpeditionLockouts> All(Database& db)
|
||||||
{
|
{
|
||||||
std::vector<DynamicZoneLockouts> all_entries;
|
std::vector<ExpeditionLockouts> all_entries;
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -272,10 +272,10 @@ public:
|
|||||||
all_entries.reserve(results.RowCount());
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
DynamicZoneLockouts e{};
|
ExpeditionLockouts e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.expedition_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.event_name = row[2] ? row[2] : "";
|
e.event_name = row[2] ? row[2] : "";
|
||||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||||
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
@@ -287,9 +287,9 @@ public:
|
|||||||
return all_entries;
|
return all_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<DynamicZoneLockouts> GetWhere(Database& db, const std::string &where_filter)
|
static std::vector<ExpeditionLockouts> GetWhere(Database& db, const std::string &where_filter)
|
||||||
{
|
{
|
||||||
std::vector<DynamicZoneLockouts> all_entries;
|
std::vector<ExpeditionLockouts> all_entries;
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -302,10 +302,10 @@ public:
|
|||||||
all_entries.reserve(results.RowCount());
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
DynamicZoneLockouts e{};
|
ExpeditionLockouts e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.expedition_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.event_name = row[2] ? row[2] : "";
|
e.event_name = row[2] ? row[2] : "";
|
||||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||||
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
@@ -379,13 +379,13 @@ public:
|
|||||||
|
|
||||||
static int ReplaceOne(
|
static int ReplaceOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
const DynamicZoneLockouts &e
|
const ExpeditionLockouts &e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
v.push_back(std::to_string(e.expedition_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -404,7 +404,7 @@ public:
|
|||||||
|
|
||||||
static int ReplaceMany(
|
static int ReplaceMany(
|
||||||
Database& db,
|
Database& db,
|
||||||
const std::vector<DynamicZoneLockouts> &entries
|
const std::vector<ExpeditionLockouts> &entries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_chunks;
|
std::vector<std::string> insert_chunks;
|
||||||
@@ -413,7 +413,7 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
v.push_back(std::to_string(e.expedition_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -436,4 +436,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
#endif //EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||||
+82
-83
@@ -9,44 +9,44 @@
|
|||||||
* @docs https://docs.eqemu.io/developer/repositories
|
* @docs https://docs.eqemu.io/developer/repositories
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_BOT_BLOCKED_BUFFS_REPOSITORY_H
|
#ifndef EQEMU_BASE_EXPEDITIONS_REPOSITORY_H
|
||||||
#define EQEMU_BASE_BOT_BLOCKED_BUFFS_REPOSITORY_H
|
#define EQEMU_BASE_EXPEDITIONS_REPOSITORY_H
|
||||||
|
|
||||||
#include "../../database.h"
|
#include "../../database.h"
|
||||||
#include "../../strings.h"
|
#include "../../strings.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
class BaseBotBlockedBuffsRepository {
|
class BaseExpeditionsRepository {
|
||||||
public:
|
public:
|
||||||
struct BotBlockedBuffs {
|
struct Expeditions {
|
||||||
uint32_t bot_id;
|
uint32_t id;
|
||||||
uint32_t spell_id;
|
uint32_t dynamic_zone_id;
|
||||||
uint8_t blocked;
|
uint8_t add_replay_on_join;
|
||||||
uint8_t blocked_pet;
|
uint8_t is_locked;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
{
|
{
|
||||||
return std::string("bot_id");
|
return std::string("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
static std::vector<std::string> Columns()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"bot_id",
|
"id",
|
||||||
"spell_id",
|
"dynamic_zone_id",
|
||||||
"blocked",
|
"add_replay_on_join",
|
||||||
"blocked_pet",
|
"is_locked",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
static std::vector<std::string> SelectColumns()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"bot_id",
|
"id",
|
||||||
"spell_id",
|
"dynamic_zone_id",
|
||||||
"blocked",
|
"add_replay_on_join",
|
||||||
"blocked_pet",
|
"is_locked",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
|
|
||||||
static std::string TableName()
|
static std::string TableName()
|
||||||
{
|
{
|
||||||
return std::string("bot_blocked_buffs");
|
return std::string("expeditions");
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string BaseSelect()
|
static std::string BaseSelect()
|
||||||
@@ -83,35 +83,35 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BotBlockedBuffs NewEntity()
|
static Expeditions NewEntity()
|
||||||
{
|
{
|
||||||
BotBlockedBuffs e{};
|
Expeditions e{};
|
||||||
|
|
||||||
e.bot_id = 0;
|
e.id = 0;
|
||||||
e.spell_id = 0;
|
e.dynamic_zone_id = 0;
|
||||||
e.blocked = 0;
|
e.add_replay_on_join = 1;
|
||||||
e.blocked_pet = 0;
|
e.is_locked = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BotBlockedBuffs GetBotBlockedBuffs(
|
static Expeditions GetExpeditions(
|
||||||
const std::vector<BotBlockedBuffs> &bot_blocked_buffss,
|
const std::vector<Expeditions> &expeditionss,
|
||||||
int bot_blocked_buffs_id
|
int expeditions_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
for (auto &bot_blocked_buffs : bot_blocked_buffss) {
|
for (auto &expeditions : expeditionss) {
|
||||||
if (bot_blocked_buffs.bot_id == bot_blocked_buffs_id) {
|
if (expeditions.id == expeditions_id) {
|
||||||
return bot_blocked_buffs;
|
return expeditions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewEntity();
|
return NewEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
static BotBlockedBuffs FindOne(
|
static Expeditions FindOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
int bot_blocked_buffs_id
|
int expeditions_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -119,18 +119,18 @@ public:
|
|||||||
"{} WHERE {} = {} LIMIT 1",
|
"{} WHERE {} = {} LIMIT 1",
|
||||||
BaseSelect(),
|
BaseSelect(),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
bot_blocked_buffs_id
|
expeditions_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
BotBlockedBuffs e{};
|
Expeditions e{};
|
||||||
|
|
||||||
e.bot_id = row[0] ? static_cast<uint32_t>(atoi(row[0])) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.spell_id = row[1] ? static_cast<uint32_t>(atoi(row[1])) : 0;
|
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.blocked = row[2] ? static_cast<uint8_t>(atoi(row[2])) : 0;
|
e.add_replay_on_join = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||||
e.blocked_pet = row[3] ? static_cast<uint8_t>(atoi(row[3])) : 0;
|
e.is_locked = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
|
|
||||||
static int DeleteOne(
|
static int DeleteOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
int bot_blocked_buffs_id
|
int expeditions_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -148,7 +148,7 @@ public:
|
|||||||
"DELETE FROM {} WHERE {} = {}",
|
"DELETE FROM {} WHERE {} = {}",
|
||||||
TableName(),
|
TableName(),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
bot_blocked_buffs_id
|
expeditions_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -157,17 +157,16 @@ public:
|
|||||||
|
|
||||||
static int UpdateOne(
|
static int UpdateOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
const BotBlockedBuffs &e
|
const Expeditions &e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
v.push_back(columns[0] + " = " + std::to_string(e.bot_id));
|
v.push_back(columns[1] + " = " + std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.spell_id));
|
v.push_back(columns[2] + " = " + std::to_string(e.add_replay_on_join));
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.blocked));
|
v.push_back(columns[3] + " = " + std::to_string(e.is_locked));
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.blocked_pet));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -175,24 +174,24 @@ public:
|
|||||||
TableName(),
|
TableName(),
|
||||||
Strings::Implode(", ", v),
|
Strings::Implode(", ", v),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
e.bot_id
|
e.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BotBlockedBuffs InsertOne(
|
static Expeditions InsertOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
BotBlockedBuffs e
|
Expeditions e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.spell_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back(std::to_string(e.blocked));
|
v.push_back(std::to_string(e.add_replay_on_join));
|
||||||
v.push_back(std::to_string(e.blocked_pet));
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -203,7 +202,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (results.Success()) {
|
if (results.Success()) {
|
||||||
e.bot_id = results.LastInsertedID();
|
e.id = results.LastInsertedID();
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +213,7 @@ public:
|
|||||||
|
|
||||||
static int InsertMany(
|
static int InsertMany(
|
||||||
Database& db,
|
Database& db,
|
||||||
const std::vector<BotBlockedBuffs> &entries
|
const std::vector<Expeditions> &entries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_chunks;
|
std::vector<std::string> insert_chunks;
|
||||||
@@ -222,10 +221,10 @@ public:
|
|||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.spell_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back(std::to_string(e.blocked));
|
v.push_back(std::to_string(e.add_replay_on_join));
|
||||||
v.push_back(std::to_string(e.blocked_pet));
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -243,9 +242,9 @@ public:
|
|||||||
return (results.Success() ? results.RowsAffected() : 0);
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<BotBlockedBuffs> All(Database& db)
|
static std::vector<Expeditions> All(Database& db)
|
||||||
{
|
{
|
||||||
std::vector<BotBlockedBuffs> all_entries;
|
std::vector<Expeditions> all_entries;
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -257,12 +256,12 @@ public:
|
|||||||
all_entries.reserve(results.RowCount());
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
BotBlockedBuffs e{};
|
Expeditions e{};
|
||||||
|
|
||||||
e.bot_id = row[0] ? static_cast<uint32_t>(atoi(row[0])) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.spell_id = row[1] ? static_cast<uint32_t>(atoi(row[1])) : 0;
|
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.blocked = row[2] ? static_cast<uint8_t>(atoi(row[2])) : 0;
|
e.add_replay_on_join = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||||
e.blocked_pet = row[3] ? static_cast<uint8_t>(atoi(row[3])) : 0;
|
e.is_locked = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -270,9 +269,9 @@ public:
|
|||||||
return all_entries;
|
return all_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<BotBlockedBuffs> GetWhere(Database& db, const std::string &where_filter)
|
static std::vector<Expeditions> GetWhere(Database& db, const std::string &where_filter)
|
||||||
{
|
{
|
||||||
std::vector<BotBlockedBuffs> all_entries;
|
std::vector<Expeditions> all_entries;
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -285,12 +284,12 @@ public:
|
|||||||
all_entries.reserve(results.RowCount());
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
BotBlockedBuffs e{};
|
Expeditions e{};
|
||||||
|
|
||||||
e.bot_id = row[0] ? static_cast<uint32_t>(atoi(row[0])) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.spell_id = row[1] ? static_cast<uint32_t>(atoi(row[1])) : 0;
|
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.blocked = row[2] ? static_cast<uint8_t>(atoi(row[2])) : 0;
|
e.add_replay_on_join = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||||
e.blocked_pet = row[3] ? static_cast<uint8_t>(atoi(row[3])) : 0;
|
e.is_locked = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -360,15 +359,15 @@ public:
|
|||||||
|
|
||||||
static int ReplaceOne(
|
static int ReplaceOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
const BotBlockedBuffs &e
|
const Expeditions &e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.spell_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back(std::to_string(e.blocked));
|
v.push_back(std::to_string(e.add_replay_on_join));
|
||||||
v.push_back(std::to_string(e.blocked_pet));
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -383,7 +382,7 @@ public:
|
|||||||
|
|
||||||
static int ReplaceMany(
|
static int ReplaceMany(
|
||||||
Database& db,
|
Database& db,
|
||||||
const std::vector<BotBlockedBuffs> &entries
|
const std::vector<Expeditions> &entries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_chunks;
|
std::vector<std::string> insert_chunks;
|
||||||
@@ -391,10 +390,10 @@ public:
|
|||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.spell_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back(std::to_string(e.blocked));
|
v.push_back(std::to_string(e.add_replay_on_join));
|
||||||
v.push_back(std::to_string(e.blocked_pet));
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -413,4 +412,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_BASE_BOT_BLOCKED_BUFFS_REPOSITORY_H
|
#endif //EQEMU_BASE_EXPEDITIONS_REPOSITORY_H
|
||||||
@@ -0,0 +1,547 @@
|
|||||||
|
/**
|
||||||
|
* 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_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
|
#define EQEMU_BASE_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
|
|
||||||
|
#include "../../database.h"
|
||||||
|
#include "../../strings.h"
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
class BaseFindableLocationRepository {
|
||||||
|
public:
|
||||||
|
struct FindableLocation {
|
||||||
|
uint32_t id;
|
||||||
|
std::string zone;
|
||||||
|
int32_t version;
|
||||||
|
int32_t findable_id;
|
||||||
|
int32_t findable_sub_id;
|
||||||
|
int32_t type;
|
||||||
|
int32_t zone_id;
|
||||||
|
int32_t zone_id_index;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
int8_t min_expansion;
|
||||||
|
int8_t max_expansion;
|
||||||
|
std::string content_flags;
|
||||||
|
std::string content_flags_disabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::string PrimaryKey()
|
||||||
|
{
|
||||||
|
return std::string("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<std::string> Columns()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"id",
|
||||||
|
"zone",
|
||||||
|
"version",
|
||||||
|
"findable_id",
|
||||||
|
"findable_sub_id",
|
||||||
|
"type",
|
||||||
|
"zone_id",
|
||||||
|
"zone_id_index",
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"z",
|
||||||
|
"min_expansion",
|
||||||
|
"max_expansion",
|
||||||
|
"content_flags",
|
||||||
|
"content_flags_disabled",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<std::string> SelectColumns()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"id",
|
||||||
|
"zone",
|
||||||
|
"version",
|
||||||
|
"findable_id",
|
||||||
|
"findable_sub_id",
|
||||||
|
"type",
|
||||||
|
"zone_id",
|
||||||
|
"zone_id_index",
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"z",
|
||||||
|
"min_expansion",
|
||||||
|
"max_expansion",
|
||||||
|
"content_flags",
|
||||||
|
"content_flags_disabled",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
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("findable_location");
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string BaseSelect()
|
||||||
|
{
|
||||||
|
return fmt::format(
|
||||||
|
"SELECT {} FROM {}",
|
||||||
|
SelectColumnsRaw(),
|
||||||
|
TableName()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string BaseInsert()
|
||||||
|
{
|
||||||
|
return fmt::format(
|
||||||
|
"INSERT INTO {} ({}) ",
|
||||||
|
TableName(),
|
||||||
|
ColumnsRaw()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation NewEntity()
|
||||||
|
{
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = 0;
|
||||||
|
e.zone = "";
|
||||||
|
e.version = 0;
|
||||||
|
e.findable_id = 0;
|
||||||
|
e.findable_sub_id = 0;
|
||||||
|
e.type = 0;
|
||||||
|
e.zone_id = 0;
|
||||||
|
e.zone_id_index = 0;
|
||||||
|
e.x = 0;
|
||||||
|
e.y = 0;
|
||||||
|
e.z = 0;
|
||||||
|
e.min_expansion = -1;
|
||||||
|
e.max_expansion = -1;
|
||||||
|
e.content_flags = "";
|
||||||
|
e.content_flags_disabled = "";
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation GetFindableLocation(
|
||||||
|
const std::vector<FindableLocation> &findable_locations,
|
||||||
|
int findable_location_id
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (auto &findable_location : findable_locations) {
|
||||||
|
if (findable_location.id == findable_location_id) {
|
||||||
|
return findable_location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation FindOne(
|
||||||
|
Database& db,
|
||||||
|
int findable_location_id
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} WHERE {} = {} LIMIT 1",
|
||||||
|
BaseSelect(),
|
||||||
|
PrimaryKey(),
|
||||||
|
findable_location_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
if (results.RowCount() == 1) {
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
|
e.zone = row[1] ? row[1] : "";
|
||||||
|
e.version = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||||
|
e.findable_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
|
e.findable_sub_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
|
e.type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||||
|
e.zone_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||||
|
e.zone_id_index = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||||
|
e.x = row[8] ? strtof(row[8], nullptr) : 0;
|
||||||
|
e.y = row[9] ? strtof(row[9], nullptr) : 0;
|
||||||
|
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||||
|
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||||
|
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||||
|
e.content_flags = row[13] ? row[13] : "";
|
||||||
|
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
static int DeleteOne(
|
||||||
|
Database& db,
|
||||||
|
int findable_location_id
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"DELETE FROM {} WHERE {} = {}",
|
||||||
|
TableName(),
|
||||||
|
PrimaryKey(),
|
||||||
|
findable_location_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int UpdateOne(
|
||||||
|
Database& db,
|
||||||
|
const FindableLocation &e
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
auto columns = Columns();
|
||||||
|
|
||||||
|
v.push_back(columns[1] + " = '" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(columns[2] + " = " + std::to_string(e.version));
|
||||||
|
v.push_back(columns[3] + " = " + std::to_string(e.findable_id));
|
||||||
|
v.push_back(columns[4] + " = " + std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(columns[5] + " = " + std::to_string(e.type));
|
||||||
|
v.push_back(columns[6] + " = " + std::to_string(e.zone_id));
|
||||||
|
v.push_back(columns[7] + " = " + std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(columns[8] + " = " + std::to_string(e.x));
|
||||||
|
v.push_back(columns[9] + " = " + std::to_string(e.y));
|
||||||
|
v.push_back(columns[10] + " = " + std::to_string(e.z));
|
||||||
|
v.push_back(columns[11] + " = " + std::to_string(e.min_expansion));
|
||||||
|
v.push_back(columns[12] + " = " + std::to_string(e.max_expansion));
|
||||||
|
v.push_back(columns[13] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back(columns[14] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"UPDATE {} SET {} WHERE {} = {}",
|
||||||
|
TableName(),
|
||||||
|
Strings::Implode(", ", v),
|
||||||
|
PrimaryKey(),
|
||||||
|
e.id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation InsertOne(
|
||||||
|
Database& db,
|
||||||
|
FindableLocation e
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
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<FindableLocation> &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("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
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<FindableLocation> All(Database& db)
|
||||||
|
{
|
||||||
|
std::vector<FindableLocation> all_entries;
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{}",
|
||||||
|
BaseSelect()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
|
e.zone = row[1] ? row[1] : "";
|
||||||
|
e.version = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||||
|
e.findable_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
|
e.findable_sub_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
|
e.type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||||
|
e.zone_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||||
|
e.zone_id_index = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||||
|
e.x = row[8] ? strtof(row[8], nullptr) : 0;
|
||||||
|
e.y = row[9] ? strtof(row[9], nullptr) : 0;
|
||||||
|
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||||
|
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||||
|
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||||
|
e.content_flags = row[13] ? row[13] : "";
|
||||||
|
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||||
|
|
||||||
|
all_entries.push_back(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return all_entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<FindableLocation> GetWhere(Database& db, const std::string &where_filter)
|
||||||
|
{
|
||||||
|
std::vector<FindableLocation> 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) {
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
|
e.zone = row[1] ? row[1] : "";
|
||||||
|
e.version = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||||
|
e.findable_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
|
e.findable_sub_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
|
e.type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||||
|
e.zone_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||||
|
e.zone_id_index = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||||
|
e.x = row[8] ? strtof(row[8], nullptr) : 0;
|
||||||
|
e.y = row[9] ? strtof(row[9], nullptr) : 0;
|
||||||
|
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||||
|
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||||
|
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||||
|
e.content_flags = row[13] ? row[13] : "";
|
||||||
|
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||||
|
|
||||||
|
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 FindableLocation &e
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
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<FindableLocation> &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("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
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_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* Any modifications to base repositories are to be made by the generator only
|
* Any modifications to base repositories are to be made by the generator only
|
||||||
*
|
*
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||||
* @docs https://docs.eqemu.io/developer/repositories
|
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
#ifndef EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
||||||
@@ -16,24 +16,19 @@
|
|||||||
#include "../../strings.h"
|
#include "../../strings.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
|
||||||
class BaseGuildBankRepository {
|
class BaseGuildBankRepository {
|
||||||
public:
|
public:
|
||||||
struct GuildBank {
|
struct GuildBank {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t guild_id;
|
uint32_t guildid;
|
||||||
uint8_t area;
|
uint8_t area;
|
||||||
uint32_t slot;
|
uint32_t slot;
|
||||||
uint32_t item_id;
|
uint32_t itemid;
|
||||||
uint32_t augment_one_id;
|
uint32_t qty;
|
||||||
uint32_t augment_two_id;
|
|
||||||
uint32_t augment_three_id;
|
|
||||||
uint32_t augment_four_id;
|
|
||||||
uint32_t augment_five_id;
|
|
||||||
uint32_t augment_six_id;
|
|
||||||
int32_t quantity;
|
|
||||||
std::string donator;
|
std::string donator;
|
||||||
uint8_t permissions;
|
uint8_t permissions;
|
||||||
std::string who_for;
|
std::string whofor;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -45,20 +40,14 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"guild_id",
|
"guildid",
|
||||||
"area",
|
"area",
|
||||||
"slot",
|
"slot",
|
||||||
"item_id",
|
"itemid",
|
||||||
"augment_one_id",
|
"qty",
|
||||||
"augment_two_id",
|
|
||||||
"augment_three_id",
|
|
||||||
"augment_four_id",
|
|
||||||
"augment_five_id",
|
|
||||||
"augment_six_id",
|
|
||||||
"quantity",
|
|
||||||
"donator",
|
"donator",
|
||||||
"permissions",
|
"permissions",
|
||||||
"who_for",
|
"whofor",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,20 +55,14 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"guild_id",
|
"guildid",
|
||||||
"area",
|
"area",
|
||||||
"slot",
|
"slot",
|
||||||
"item_id",
|
"itemid",
|
||||||
"augment_one_id",
|
"qty",
|
||||||
"augment_two_id",
|
|
||||||
"augment_three_id",
|
|
||||||
"augment_four_id",
|
|
||||||
"augment_five_id",
|
|
||||||
"augment_six_id",
|
|
||||||
"quantity",
|
|
||||||
"donator",
|
"donator",
|
||||||
"permissions",
|
"permissions",
|
||||||
"who_for",
|
"whofor",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,20 +104,14 @@ public:
|
|||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = 0;
|
e.id = 0;
|
||||||
e.guild_id = 0;
|
e.guildid = 0;
|
||||||
e.area = 0;
|
e.area = 0;
|
||||||
e.slot = 0;
|
e.slot = 0;
|
||||||
e.item_id = 0;
|
e.itemid = 0;
|
||||||
e.augment_one_id = 0;
|
e.qty = 0;
|
||||||
e.augment_two_id = 0;
|
|
||||||
e.augment_three_id = 0;
|
|
||||||
e.augment_four_id = 0;
|
|
||||||
e.augment_five_id = 0;
|
|
||||||
e.augment_six_id = 0;
|
|
||||||
e.quantity = 0;
|
|
||||||
e.donator = "";
|
e.donator = "";
|
||||||
e.permissions = 0;
|
e.permissions = 0;
|
||||||
e.who_for = "";
|
e.whofor = "";
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -171,21 +148,15 @@ public:
|
|||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.donator = row[6] ? row[6] : "";
|
||||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.whofor = row[8] ? row[8] : "";
|
||||||
e.augment_five_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
e.augment_six_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
|
||||||
e.quantity = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
|
||||||
e.donator = row[12] ? row[12] : "";
|
|
||||||
e.permissions = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
|
||||||
e.who_for = row[14] ? row[14] : "";
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -219,20 +190,14 @@ public:
|
|||||||
|
|
||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.guild_id));
|
v.push_back(columns[1] + " = " + std::to_string(e.guildid));
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.area));
|
v.push_back(columns[2] + " = " + std::to_string(e.area));
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.slot));
|
v.push_back(columns[3] + " = " + std::to_string(e.slot));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.item_id));
|
v.push_back(columns[4] + " = " + std::to_string(e.itemid));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.augment_one_id));
|
v.push_back(columns[5] + " = " + std::to_string(e.qty));
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.augment_two_id));
|
v.push_back(columns[6] + " = '" + Strings::Escape(e.donator) + "'");
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.augment_three_id));
|
v.push_back(columns[7] + " = " + std::to_string(e.permissions));
|
||||||
v.push_back(columns[8] + " = " + std::to_string(e.augment_four_id));
|
v.push_back(columns[8] + " = '" + Strings::Escape(e.whofor) + "'");
|
||||||
v.push_back(columns[9] + " = " + std::to_string(e.augment_five_id));
|
|
||||||
v.push_back(columns[10] + " = " + std::to_string(e.augment_six_id));
|
|
||||||
v.push_back(columns[11] + " = " + std::to_string(e.quantity));
|
|
||||||
v.push_back(columns[12] + " = '" + Strings::Escape(e.donator) + "'");
|
|
||||||
v.push_back(columns[13] + " = " + std::to_string(e.permissions));
|
|
||||||
v.push_back(columns[14] + " = '" + Strings::Escape(e.who_for) + "'");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -255,20 +220,14 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.guild_id));
|
v.push_back(std::to_string(e.guildid));
|
||||||
v.push_back(std::to_string(e.area));
|
v.push_back(std::to_string(e.area));
|
||||||
v.push_back(std::to_string(e.slot));
|
v.push_back(std::to_string(e.slot));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.itemid));
|
||||||
v.push_back(std::to_string(e.augment_one_id));
|
v.push_back(std::to_string(e.qty));
|
||||||
v.push_back(std::to_string(e.augment_two_id));
|
|
||||||
v.push_back(std::to_string(e.augment_three_id));
|
|
||||||
v.push_back(std::to_string(e.augment_four_id));
|
|
||||||
v.push_back(std::to_string(e.augment_five_id));
|
|
||||||
v.push_back(std::to_string(e.augment_six_id));
|
|
||||||
v.push_back(std::to_string(e.quantity));
|
|
||||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||||
v.push_back(std::to_string(e.permissions));
|
v.push_back(std::to_string(e.permissions));
|
||||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
v.push_back("'" + Strings::Escape(e.whofor) + "'");
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -299,20 +258,14 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.guild_id));
|
v.push_back(std::to_string(e.guildid));
|
||||||
v.push_back(std::to_string(e.area));
|
v.push_back(std::to_string(e.area));
|
||||||
v.push_back(std::to_string(e.slot));
|
v.push_back(std::to_string(e.slot));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.itemid));
|
||||||
v.push_back(std::to_string(e.augment_one_id));
|
v.push_back(std::to_string(e.qty));
|
||||||
v.push_back(std::to_string(e.augment_two_id));
|
|
||||||
v.push_back(std::to_string(e.augment_three_id));
|
|
||||||
v.push_back(std::to_string(e.augment_four_id));
|
|
||||||
v.push_back(std::to_string(e.augment_five_id));
|
|
||||||
v.push_back(std::to_string(e.augment_six_id));
|
|
||||||
v.push_back(std::to_string(e.quantity));
|
|
||||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||||
v.push_back(std::to_string(e.permissions));
|
v.push_back(std::to_string(e.permissions));
|
||||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
v.push_back("'" + Strings::Escape(e.whofor) + "'");
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -346,21 +299,15 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.donator = row[6] ? row[6] : "";
|
||||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.whofor = row[8] ? row[8] : "";
|
||||||
e.augment_five_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
e.augment_six_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
|
||||||
e.quantity = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
|
||||||
e.donator = row[12] ? row[12] : "";
|
|
||||||
e.permissions = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
|
||||||
e.who_for = row[14] ? row[14] : "";
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -385,21 +332,15 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.donator = row[6] ? row[6] : "";
|
||||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.whofor = row[8] ? row[8] : "";
|
||||||
e.augment_five_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
e.augment_six_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
|
||||||
e.quantity = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
|
||||||
e.donator = row[12] ? row[12] : "";
|
|
||||||
e.permissions = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
|
||||||
e.who_for = row[14] ? row[14] : "";
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -458,90 +399,6 @@ public:
|
|||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
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 GuildBank &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.guild_id));
|
|
||||||
v.push_back(std::to_string(e.area));
|
|
||||||
v.push_back(std::to_string(e.slot));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.augment_one_id));
|
|
||||||
v.push_back(std::to_string(e.augment_two_id));
|
|
||||||
v.push_back(std::to_string(e.augment_three_id));
|
|
||||||
v.push_back(std::to_string(e.augment_four_id));
|
|
||||||
v.push_back(std::to_string(e.augment_five_id));
|
|
||||||
v.push_back(std::to_string(e.augment_six_id));
|
|
||||||
v.push_back(std::to_string(e.quantity));
|
|
||||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
|
||||||
v.push_back(std::to_string(e.permissions));
|
|
||||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
|
||||||
|
|
||||||
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<GuildBank> &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.guild_id));
|
|
||||||
v.push_back(std::to_string(e.area));
|
|
||||||
v.push_back(std::to_string(e.slot));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back(std::to_string(e.augment_one_id));
|
|
||||||
v.push_back(std::to_string(e.augment_two_id));
|
|
||||||
v.push_back(std::to_string(e.augment_three_id));
|
|
||||||
v.push_back(std::to_string(e.augment_four_id));
|
|
||||||
v.push_back(std::to_string(e.augment_five_id));
|
|
||||||
v.push_back(std::to_string(e.augment_six_id));
|
|
||||||
v.push_back(std::to_string(e.quantity));
|
|
||||||
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
|
||||||
v.push_back(std::to_string(e.permissions));
|
|
||||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
|
||||||
|
|
||||||
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_GUILD_BANK_REPOSITORY_H
|
#endif //EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ public:
|
|||||||
int16_t race;
|
int16_t race;
|
||||||
int8_t gender;
|
int8_t gender;
|
||||||
int8_t texture;
|
int8_t texture;
|
||||||
int8_t helmtexture;
|
|
||||||
float mountspeed;
|
float mountspeed;
|
||||||
std::string notes;
|
std::string notes;
|
||||||
};
|
};
|
||||||
@@ -42,7 +41,6 @@ public:
|
|||||||
"race",
|
"race",
|
||||||
"gender",
|
"gender",
|
||||||
"texture",
|
"texture",
|
||||||
"helmtexture",
|
|
||||||
"mountspeed",
|
"mountspeed",
|
||||||
"notes",
|
"notes",
|
||||||
};
|
};
|
||||||
@@ -56,7 +54,6 @@ public:
|
|||||||
"race",
|
"race",
|
||||||
"gender",
|
"gender",
|
||||||
"texture",
|
"texture",
|
||||||
"helmtexture",
|
|
||||||
"mountspeed",
|
"mountspeed",
|
||||||
"notes",
|
"notes",
|
||||||
};
|
};
|
||||||
@@ -104,7 +101,6 @@ public:
|
|||||||
e.race = 216;
|
e.race = 216;
|
||||||
e.gender = 0;
|
e.gender = 0;
|
||||||
e.texture = 0;
|
e.texture = 0;
|
||||||
e.helmtexture = -1;
|
|
||||||
e.mountspeed = 0.75;
|
e.mountspeed = 0.75;
|
||||||
e.notes = "Notes";
|
e.notes = "Notes";
|
||||||
|
|
||||||
@@ -148,9 +144,8 @@ public:
|
|||||||
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
|
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
|
||||||
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||||
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||||
e.helmtexture = row[5] ? static_cast<int8_t>(atoi(row[5])) : -1;
|
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75;
|
||||||
e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75;
|
e.notes = row[6] ? row[6] : "Notes";
|
||||||
e.notes = row[7] ? row[7] : "Notes";
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -188,9 +183,8 @@ public:
|
|||||||
v.push_back(columns[2] + " = " + std::to_string(e.race));
|
v.push_back(columns[2] + " = " + std::to_string(e.race));
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.gender));
|
v.push_back(columns[3] + " = " + std::to_string(e.gender));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.texture));
|
v.push_back(columns[4] + " = " + std::to_string(e.texture));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.helmtexture));
|
v.push_back(columns[5] + " = " + std::to_string(e.mountspeed));
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.mountspeed));
|
v.push_back(columns[6] + " = '" + Strings::Escape(e.notes) + "'");
|
||||||
v.push_back(columns[7] + " = '" + Strings::Escape(e.notes) + "'");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -217,7 +211,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.race));
|
v.push_back(std::to_string(e.race));
|
||||||
v.push_back(std::to_string(e.gender));
|
v.push_back(std::to_string(e.gender));
|
||||||
v.push_back(std::to_string(e.texture));
|
v.push_back(std::to_string(e.texture));
|
||||||
v.push_back(std::to_string(e.helmtexture));
|
|
||||||
v.push_back(std::to_string(e.mountspeed));
|
v.push_back(std::to_string(e.mountspeed));
|
||||||
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
||||||
|
|
||||||
@@ -254,7 +247,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.race));
|
v.push_back(std::to_string(e.race));
|
||||||
v.push_back(std::to_string(e.gender));
|
v.push_back(std::to_string(e.gender));
|
||||||
v.push_back(std::to_string(e.texture));
|
v.push_back(std::to_string(e.texture));
|
||||||
v.push_back(std::to_string(e.helmtexture));
|
|
||||||
v.push_back(std::to_string(e.mountspeed));
|
v.push_back(std::to_string(e.mountspeed));
|
||||||
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
||||||
|
|
||||||
@@ -295,9 +287,8 @@ public:
|
|||||||
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
|
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
|
||||||
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||||
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||||
e.helmtexture = row[5] ? static_cast<int8_t>(atoi(row[5])) : -1;
|
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75;
|
||||||
e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75;
|
e.notes = row[6] ? row[6] : "Notes";
|
||||||
e.notes = row[7] ? row[7] : "Notes";
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -327,9 +318,8 @@ public:
|
|||||||
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
|
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
|
||||||
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||||
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||||
e.helmtexture = row[5] ? static_cast<int8_t>(atoi(row[5])) : -1;
|
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75;
|
||||||
e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75;
|
e.notes = row[6] ? row[6] : "Notes";
|
||||||
e.notes = row[7] ? row[7] : "Notes";
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -409,7 +399,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.race));
|
v.push_back(std::to_string(e.race));
|
||||||
v.push_back(std::to_string(e.gender));
|
v.push_back(std::to_string(e.gender));
|
||||||
v.push_back(std::to_string(e.texture));
|
v.push_back(std::to_string(e.texture));
|
||||||
v.push_back(std::to_string(e.helmtexture));
|
|
||||||
v.push_back(std::to_string(e.mountspeed));
|
v.push_back(std::to_string(e.mountspeed));
|
||||||
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
||||||
|
|
||||||
@@ -439,7 +428,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.race));
|
v.push_back(std::to_string(e.race));
|
||||||
v.push_back(std::to_string(e.gender));
|
v.push_back(std::to_string(e.gender));
|
||||||
v.push_back(std::to_string(e.texture));
|
v.push_back(std::to_string(e.texture));
|
||||||
v.push_back(std::to_string(e.helmtexture));
|
|
||||||
v.push_back(std::to_string(e.mountspeed));
|
v.push_back(std::to_string(e.mountspeed));
|
||||||
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
v.push_back("'" + Strings::Escape(e.notes) + "'");
|
||||||
|
|
||||||
|
|||||||
@@ -19,48 +19,48 @@
|
|||||||
class BaseInventoryRepository {
|
class BaseInventoryRepository {
|
||||||
public:
|
public:
|
||||||
struct Inventory {
|
struct Inventory {
|
||||||
uint32_t character_id;
|
uint32_t charid;
|
||||||
uint32_t slot_id;
|
uint32_t slotid;
|
||||||
uint32_t item_id;
|
uint32_t itemid;
|
||||||
uint16_t charges;
|
uint16_t charges;
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
uint32_t augment_one;
|
uint32_t augslot1;
|
||||||
uint32_t augment_two;
|
uint32_t augslot2;
|
||||||
uint32_t augment_three;
|
uint32_t augslot3;
|
||||||
uint32_t augment_four;
|
uint32_t augslot4;
|
||||||
uint32_t augment_five;
|
uint32_t augslot5;
|
||||||
uint32_t augment_six;
|
int32_t augslot6;
|
||||||
uint8_t instnodrop;
|
uint8_t instnodrop;
|
||||||
std::string custom_data;
|
std::string custom_data;
|
||||||
uint32_t ornament_icon;
|
uint32_t ornamenticon;
|
||||||
uint32_t ornament_idfile;
|
uint32_t ornamentidfile;
|
||||||
int32_t ornament_hero_model;
|
int32_t ornament_hero_model;
|
||||||
uint64_t guid;
|
uint64_t guid;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
{
|
{
|
||||||
return std::string("character_id");
|
return std::string("charid");
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
static std::vector<std::string> Columns()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"character_id",
|
"charid",
|
||||||
"slot_id",
|
"slotid",
|
||||||
"item_id",
|
"itemid",
|
||||||
"charges",
|
"charges",
|
||||||
"color",
|
"color",
|
||||||
"augment_one",
|
"augslot1",
|
||||||
"augment_two",
|
"augslot2",
|
||||||
"augment_three",
|
"augslot3",
|
||||||
"augment_four",
|
"augslot4",
|
||||||
"augment_five",
|
"augslot5",
|
||||||
"augment_six",
|
"augslot6",
|
||||||
"instnodrop",
|
"instnodrop",
|
||||||
"custom_data",
|
"custom_data",
|
||||||
"ornament_icon",
|
"ornamenticon",
|
||||||
"ornament_idfile",
|
"ornamentidfile",
|
||||||
"ornament_hero_model",
|
"ornament_hero_model",
|
||||||
"guid",
|
"guid",
|
||||||
};
|
};
|
||||||
@@ -69,21 +69,21 @@ public:
|
|||||||
static std::vector<std::string> SelectColumns()
|
static std::vector<std::string> SelectColumns()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"character_id",
|
"charid",
|
||||||
"slot_id",
|
"slotid",
|
||||||
"item_id",
|
"itemid",
|
||||||
"charges",
|
"charges",
|
||||||
"color",
|
"color",
|
||||||
"augment_one",
|
"augslot1",
|
||||||
"augment_two",
|
"augslot2",
|
||||||
"augment_three",
|
"augslot3",
|
||||||
"augment_four",
|
"augslot4",
|
||||||
"augment_five",
|
"augslot5",
|
||||||
"augment_six",
|
"augslot6",
|
||||||
"instnodrop",
|
"instnodrop",
|
||||||
"custom_data",
|
"custom_data",
|
||||||
"ornament_icon",
|
"ornamenticon",
|
||||||
"ornament_idfile",
|
"ornamentidfile",
|
||||||
"ornament_hero_model",
|
"ornament_hero_model",
|
||||||
"guid",
|
"guid",
|
||||||
};
|
};
|
||||||
@@ -126,21 +126,21 @@ public:
|
|||||||
{
|
{
|
||||||
Inventory e{};
|
Inventory e{};
|
||||||
|
|
||||||
e.character_id = 0;
|
e.charid = 0;
|
||||||
e.slot_id = 0;
|
e.slotid = 0;
|
||||||
e.item_id = 0;
|
e.itemid = 0;
|
||||||
e.charges = 0;
|
e.charges = 0;
|
||||||
e.color = 0;
|
e.color = 0;
|
||||||
e.augment_one = 0;
|
e.augslot1 = 0;
|
||||||
e.augment_two = 0;
|
e.augslot2 = 0;
|
||||||
e.augment_three = 0;
|
e.augslot3 = 0;
|
||||||
e.augment_four = 0;
|
e.augslot4 = 0;
|
||||||
e.augment_five = 0;
|
e.augslot5 = 0;
|
||||||
e.augment_six = 0;
|
e.augslot6 = 0;
|
||||||
e.instnodrop = 0;
|
e.instnodrop = 0;
|
||||||
e.custom_data = "";
|
e.custom_data = "";
|
||||||
e.ornament_icon = 0;
|
e.ornamenticon = 0;
|
||||||
e.ornament_idfile = 0;
|
e.ornamentidfile = 0;
|
||||||
e.ornament_hero_model = 0;
|
e.ornament_hero_model = 0;
|
||||||
e.guid = 0;
|
e.guid = 0;
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
for (auto &inventory : inventorys) {
|
for (auto &inventory : inventorys) {
|
||||||
if (inventory.character_id == inventory_id) {
|
if (inventory.charid == inventory_id) {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,21 +179,21 @@ public:
|
|||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
Inventory e{};
|
Inventory e{};
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.slot_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.slotid = 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.itemid = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.color = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.color = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
e.augment_one = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
e.augslot1 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||||
e.augment_two = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.augslot2 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.augment_three = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.augslot3 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.augment_four = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.augslot4 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
e.augment_five = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
e.augslot5 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||||
e.augment_six = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
e.augslot6 = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||||
e.instnodrop = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
e.instnodrop = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||||
e.custom_data = row[12] ? row[12] : "";
|
e.custom_data = row[12] ? row[12] : "";
|
||||||
e.ornament_icon = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.ornamenticon = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.ornament_idfile = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.ornamentidfile = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
e.ornament_hero_model = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
e.ornament_hero_model = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||||
e.guid = row[16] ? strtoull(row[16], nullptr, 10) : 0;
|
e.guid = row[16] ? strtoull(row[16], nullptr, 10) : 0;
|
||||||
|
|
||||||
@@ -229,21 +229,21 @@ public:
|
|||||||
|
|
||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
v.push_back(columns[0] + " = " + std::to_string(e.character_id));
|
v.push_back(columns[0] + " = " + std::to_string(e.charid));
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.slot_id));
|
v.push_back(columns[1] + " = " + std::to_string(e.slotid));
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.item_id));
|
v.push_back(columns[2] + " = " + std::to_string(e.itemid));
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.charges));
|
v.push_back(columns[3] + " = " + std::to_string(e.charges));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.color));
|
v.push_back(columns[4] + " = " + std::to_string(e.color));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.augment_one));
|
v.push_back(columns[5] + " = " + std::to_string(e.augslot1));
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.augment_two));
|
v.push_back(columns[6] + " = " + std::to_string(e.augslot2));
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.augment_three));
|
v.push_back(columns[7] + " = " + std::to_string(e.augslot3));
|
||||||
v.push_back(columns[8] + " = " + std::to_string(e.augment_four));
|
v.push_back(columns[8] + " = " + std::to_string(e.augslot4));
|
||||||
v.push_back(columns[9] + " = " + std::to_string(e.augment_five));
|
v.push_back(columns[9] + " = " + std::to_string(e.augslot5));
|
||||||
v.push_back(columns[10] + " = " + std::to_string(e.augment_six));
|
v.push_back(columns[10] + " = " + std::to_string(e.augslot6));
|
||||||
v.push_back(columns[11] + " = " + std::to_string(e.instnodrop));
|
v.push_back(columns[11] + " = " + std::to_string(e.instnodrop));
|
||||||
v.push_back(columns[12] + " = '" + Strings::Escape(e.custom_data) + "'");
|
v.push_back(columns[12] + " = '" + Strings::Escape(e.custom_data) + "'");
|
||||||
v.push_back(columns[13] + " = " + std::to_string(e.ornament_icon));
|
v.push_back(columns[13] + " = " + std::to_string(e.ornamenticon));
|
||||||
v.push_back(columns[14] + " = " + std::to_string(e.ornament_idfile));
|
v.push_back(columns[14] + " = " + std::to_string(e.ornamentidfile));
|
||||||
v.push_back(columns[15] + " = " + std::to_string(e.ornament_hero_model));
|
v.push_back(columns[15] + " = " + std::to_string(e.ornament_hero_model));
|
||||||
v.push_back(columns[16] + " = " + std::to_string(e.guid));
|
v.push_back(columns[16] + " = " + std::to_string(e.guid));
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ public:
|
|||||||
TableName(),
|
TableName(),
|
||||||
Strings::Implode(", ", v),
|
Strings::Implode(", ", v),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
e.character_id
|
e.charid
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -267,21 +267,21 @@ public:
|
|||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.charid));
|
||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slotid));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.itemid));
|
||||||
v.push_back(std::to_string(e.charges));
|
v.push_back(std::to_string(e.charges));
|
||||||
v.push_back(std::to_string(e.color));
|
v.push_back(std::to_string(e.color));
|
||||||
v.push_back(std::to_string(e.augment_one));
|
v.push_back(std::to_string(e.augslot1));
|
||||||
v.push_back(std::to_string(e.augment_two));
|
v.push_back(std::to_string(e.augslot2));
|
||||||
v.push_back(std::to_string(e.augment_three));
|
v.push_back(std::to_string(e.augslot3));
|
||||||
v.push_back(std::to_string(e.augment_four));
|
v.push_back(std::to_string(e.augslot4));
|
||||||
v.push_back(std::to_string(e.augment_five));
|
v.push_back(std::to_string(e.augslot5));
|
||||||
v.push_back(std::to_string(e.augment_six));
|
v.push_back(std::to_string(e.augslot6));
|
||||||
v.push_back(std::to_string(e.instnodrop));
|
v.push_back(std::to_string(e.instnodrop));
|
||||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||||
v.push_back(std::to_string(e.ornament_icon));
|
v.push_back(std::to_string(e.ornamenticon));
|
||||||
v.push_back(std::to_string(e.ornament_idfile));
|
v.push_back(std::to_string(e.ornamentidfile));
|
||||||
v.push_back(std::to_string(e.ornament_hero_model));
|
v.push_back(std::to_string(e.ornament_hero_model));
|
||||||
v.push_back(std::to_string(e.guid));
|
v.push_back(std::to_string(e.guid));
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (results.Success()) {
|
if (results.Success()) {
|
||||||
e.character_id = results.LastInsertedID();
|
e.charid = results.LastInsertedID();
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,21 +313,21 @@ public:
|
|||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.charid));
|
||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slotid));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.itemid));
|
||||||
v.push_back(std::to_string(e.charges));
|
v.push_back(std::to_string(e.charges));
|
||||||
v.push_back(std::to_string(e.color));
|
v.push_back(std::to_string(e.color));
|
||||||
v.push_back(std::to_string(e.augment_one));
|
v.push_back(std::to_string(e.augslot1));
|
||||||
v.push_back(std::to_string(e.augment_two));
|
v.push_back(std::to_string(e.augslot2));
|
||||||
v.push_back(std::to_string(e.augment_three));
|
v.push_back(std::to_string(e.augslot3));
|
||||||
v.push_back(std::to_string(e.augment_four));
|
v.push_back(std::to_string(e.augslot4));
|
||||||
v.push_back(std::to_string(e.augment_five));
|
v.push_back(std::to_string(e.augslot5));
|
||||||
v.push_back(std::to_string(e.augment_six));
|
v.push_back(std::to_string(e.augslot6));
|
||||||
v.push_back(std::to_string(e.instnodrop));
|
v.push_back(std::to_string(e.instnodrop));
|
||||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||||
v.push_back(std::to_string(e.ornament_icon));
|
v.push_back(std::to_string(e.ornamenticon));
|
||||||
v.push_back(std::to_string(e.ornament_idfile));
|
v.push_back(std::to_string(e.ornamentidfile));
|
||||||
v.push_back(std::to_string(e.ornament_hero_model));
|
v.push_back(std::to_string(e.ornament_hero_model));
|
||||||
v.push_back(std::to_string(e.guid));
|
v.push_back(std::to_string(e.guid));
|
||||||
|
|
||||||
@@ -363,21 +363,21 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
Inventory e{};
|
Inventory e{};
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.slot_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.slotid = 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.itemid = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.color = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.color = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
e.augment_one = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
e.augslot1 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||||
e.augment_two = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.augslot2 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.augment_three = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.augslot3 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.augment_four = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.augslot4 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
e.augment_five = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
e.augslot5 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||||
e.augment_six = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
e.augslot6 = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||||
e.instnodrop = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
e.instnodrop = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||||
e.custom_data = row[12] ? row[12] : "";
|
e.custom_data = row[12] ? row[12] : "";
|
||||||
e.ornament_icon = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.ornamenticon = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.ornament_idfile = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.ornamentidfile = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
e.ornament_hero_model = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
e.ornament_hero_model = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||||
e.guid = row[16] ? strtoull(row[16], nullptr, 10) : 0;
|
e.guid = row[16] ? strtoull(row[16], nullptr, 10) : 0;
|
||||||
|
|
||||||
@@ -404,21 +404,21 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
Inventory e{};
|
Inventory e{};
|
||||||
|
|
||||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.slot_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
e.slotid = 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.itemid = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.color = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.color = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
e.augment_one = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
e.augslot1 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||||
e.augment_two = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.augslot2 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.augment_three = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
e.augslot3 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.augment_four = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
e.augslot4 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
e.augment_five = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
e.augslot5 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||||
e.augment_six = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
e.augslot6 = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||||
e.instnodrop = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
e.instnodrop = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||||
e.custom_data = row[12] ? row[12] : "";
|
e.custom_data = row[12] ? row[12] : "";
|
||||||
e.ornament_icon = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
e.ornamenticon = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||||
e.ornament_idfile = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
e.ornamentidfile = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||||
e.ornament_hero_model = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
e.ornament_hero_model = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||||
e.guid = row[16] ? strtoull(row[16], nullptr, 10) : 0;
|
e.guid = row[16] ? strtoull(row[16], nullptr, 10) : 0;
|
||||||
|
|
||||||
@@ -495,21 +495,21 @@ public:
|
|||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.charid));
|
||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slotid));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.itemid));
|
||||||
v.push_back(std::to_string(e.charges));
|
v.push_back(std::to_string(e.charges));
|
||||||
v.push_back(std::to_string(e.color));
|
v.push_back(std::to_string(e.color));
|
||||||
v.push_back(std::to_string(e.augment_one));
|
v.push_back(std::to_string(e.augslot1));
|
||||||
v.push_back(std::to_string(e.augment_two));
|
v.push_back(std::to_string(e.augslot2));
|
||||||
v.push_back(std::to_string(e.augment_three));
|
v.push_back(std::to_string(e.augslot3));
|
||||||
v.push_back(std::to_string(e.augment_four));
|
v.push_back(std::to_string(e.augslot4));
|
||||||
v.push_back(std::to_string(e.augment_five));
|
v.push_back(std::to_string(e.augslot5));
|
||||||
v.push_back(std::to_string(e.augment_six));
|
v.push_back(std::to_string(e.augslot6));
|
||||||
v.push_back(std::to_string(e.instnodrop));
|
v.push_back(std::to_string(e.instnodrop));
|
||||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||||
v.push_back(std::to_string(e.ornament_icon));
|
v.push_back(std::to_string(e.ornamenticon));
|
||||||
v.push_back(std::to_string(e.ornament_idfile));
|
v.push_back(std::to_string(e.ornamentidfile));
|
||||||
v.push_back(std::to_string(e.ornament_hero_model));
|
v.push_back(std::to_string(e.ornament_hero_model));
|
||||||
v.push_back(std::to_string(e.guid));
|
v.push_back(std::to_string(e.guid));
|
||||||
|
|
||||||
@@ -534,21 +534,21 @@ public:
|
|||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.charid));
|
||||||
v.push_back(std::to_string(e.slot_id));
|
v.push_back(std::to_string(e.slotid));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.itemid));
|
||||||
v.push_back(std::to_string(e.charges));
|
v.push_back(std::to_string(e.charges));
|
||||||
v.push_back(std::to_string(e.color));
|
v.push_back(std::to_string(e.color));
|
||||||
v.push_back(std::to_string(e.augment_one));
|
v.push_back(std::to_string(e.augslot1));
|
||||||
v.push_back(std::to_string(e.augment_two));
|
v.push_back(std::to_string(e.augslot2));
|
||||||
v.push_back(std::to_string(e.augment_three));
|
v.push_back(std::to_string(e.augslot3));
|
||||||
v.push_back(std::to_string(e.augment_four));
|
v.push_back(std::to_string(e.augslot4));
|
||||||
v.push_back(std::to_string(e.augment_five));
|
v.push_back(std::to_string(e.augslot5));
|
||||||
v.push_back(std::to_string(e.augment_six));
|
v.push_back(std::to_string(e.augslot6));
|
||||||
v.push_back(std::to_string(e.instnodrop));
|
v.push_back(std::to_string(e.instnodrop));
|
||||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||||
v.push_back(std::to_string(e.ornament_icon));
|
v.push_back(std::to_string(e.ornamenticon));
|
||||||
v.push_back(std::to_string(e.ornament_idfile));
|
v.push_back(std::to_string(e.ornamentidfile));
|
||||||
v.push_back(std::to_string(e.ornament_hero_model));
|
v.push_back(std::to_string(e.ornament_hero_model));
|
||||||
v.push_back(std::to_string(e.guid));
|
v.push_back(std::to_string(e.guid));
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
|
||||||
std::string 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] ? row[5] : "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] + " = '" + Strings::Escape(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("'" + Strings::Escape(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("'" + Strings::Escape(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] ? row[5] : "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] ? row[5] : "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("'" + Strings::Escape(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("'" + Strings::Escape(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
|
|
||||||
@@ -123,7 +123,7 @@ public:
|
|||||||
int8_t legtexture;
|
int8_t legtexture;
|
||||||
int8_t feettexture;
|
int8_t feettexture;
|
||||||
int8_t light;
|
int8_t light;
|
||||||
float walkspeed;
|
int8_t walkspeed;
|
||||||
int32_t peqid;
|
int32_t peqid;
|
||||||
int8_t unique_;
|
int8_t unique_;
|
||||||
int8_t fixed;
|
int8_t fixed;
|
||||||
@@ -148,7 +148,6 @@ public:
|
|||||||
int32_t faction_amount;
|
int32_t faction_amount;
|
||||||
uint8_t keeps_sold_items;
|
uint8_t keeps_sold_items;
|
||||||
uint8_t is_parcel_merchant;
|
uint8_t is_parcel_merchant;
|
||||||
uint8_t multiquest_enabled;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -288,7 +287,6 @@ public:
|
|||||||
"faction_amount",
|
"faction_amount",
|
||||||
"keeps_sold_items",
|
"keeps_sold_items",
|
||||||
"is_parcel_merchant",
|
"is_parcel_merchant",
|
||||||
"multiquest_enabled",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,7 +422,6 @@ public:
|
|||||||
"faction_amount",
|
"faction_amount",
|
||||||
"keeps_sold_items",
|
"keeps_sold_items",
|
||||||
"is_parcel_merchant",
|
"is_parcel_merchant",
|
||||||
"multiquest_enabled",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +591,6 @@ public:
|
|||||||
e.faction_amount = 0;
|
e.faction_amount = 0;
|
||||||
e.keeps_sold_items = 1;
|
e.keeps_sold_items = 1;
|
||||||
e.is_parcel_merchant = 0;
|
e.is_parcel_merchant = 0;
|
||||||
e.multiquest_enabled = 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -735,7 +731,7 @@ public:
|
|||||||
e.legtexture = row[101] ? static_cast<int8_t>(atoi(row[101])) : 0;
|
e.legtexture = row[101] ? static_cast<int8_t>(atoi(row[101])) : 0;
|
||||||
e.feettexture = row[102] ? static_cast<int8_t>(atoi(row[102])) : 0;
|
e.feettexture = row[102] ? static_cast<int8_t>(atoi(row[102])) : 0;
|
||||||
e.light = row[103] ? static_cast<int8_t>(atoi(row[103])) : 0;
|
e.light = row[103] ? static_cast<int8_t>(atoi(row[103])) : 0;
|
||||||
e.walkspeed = row[104] ? strtof(row[104], nullptr) : 0;
|
e.walkspeed = row[104] ? static_cast<int8_t>(atoi(row[104])) : 0;
|
||||||
e.peqid = row[105] ? static_cast<int32_t>(atoi(row[105])) : 0;
|
e.peqid = row[105] ? static_cast<int32_t>(atoi(row[105])) : 0;
|
||||||
e.unique_ = row[106] ? static_cast<int8_t>(atoi(row[106])) : 0;
|
e.unique_ = row[106] ? static_cast<int8_t>(atoi(row[106])) : 0;
|
||||||
e.fixed = row[107] ? static_cast<int8_t>(atoi(row[107])) : 0;
|
e.fixed = row[107] ? static_cast<int8_t>(atoi(row[107])) : 0;
|
||||||
@@ -760,7 +756,6 @@ public:
|
|||||||
e.faction_amount = row[126] ? static_cast<int32_t>(atoi(row[126])) : 0;
|
e.faction_amount = row[126] ? static_cast<int32_t>(atoi(row[126])) : 0;
|
||||||
e.keeps_sold_items = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 1;
|
e.keeps_sold_items = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 1;
|
||||||
e.is_parcel_merchant = row[128] ? static_cast<uint8_t>(strtoul(row[128], nullptr, 10)) : 0;
|
e.is_parcel_merchant = row[128] ? static_cast<uint8_t>(strtoul(row[128], nullptr, 10)) : 0;
|
||||||
e.multiquest_enabled = row[129] ? static_cast<uint8_t>(strtoul(row[129], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -922,7 +917,6 @@ public:
|
|||||||
v.push_back(columns[126] + " = " + std::to_string(e.faction_amount));
|
v.push_back(columns[126] + " = " + std::to_string(e.faction_amount));
|
||||||
v.push_back(columns[127] + " = " + std::to_string(e.keeps_sold_items));
|
v.push_back(columns[127] + " = " + std::to_string(e.keeps_sold_items));
|
||||||
v.push_back(columns[128] + " = " + std::to_string(e.is_parcel_merchant));
|
v.push_back(columns[128] + " = " + std::to_string(e.is_parcel_merchant));
|
||||||
v.push_back(columns[129] + " = " + std::to_string(e.multiquest_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1073,7 +1067,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.faction_amount));
|
v.push_back(std::to_string(e.faction_amount));
|
||||||
v.push_back(std::to_string(e.keeps_sold_items));
|
v.push_back(std::to_string(e.keeps_sold_items));
|
||||||
v.push_back(std::to_string(e.is_parcel_merchant));
|
v.push_back(std::to_string(e.is_parcel_merchant));
|
||||||
v.push_back(std::to_string(e.multiquest_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1232,7 +1225,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.faction_amount));
|
v.push_back(std::to_string(e.faction_amount));
|
||||||
v.push_back(std::to_string(e.keeps_sold_items));
|
v.push_back(std::to_string(e.keeps_sold_items));
|
||||||
v.push_back(std::to_string(e.is_parcel_merchant));
|
v.push_back(std::to_string(e.is_parcel_merchant));
|
||||||
v.push_back(std::to_string(e.multiquest_enabled));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -1370,7 +1362,7 @@ public:
|
|||||||
e.legtexture = row[101] ? static_cast<int8_t>(atoi(row[101])) : 0;
|
e.legtexture = row[101] ? static_cast<int8_t>(atoi(row[101])) : 0;
|
||||||
e.feettexture = row[102] ? static_cast<int8_t>(atoi(row[102])) : 0;
|
e.feettexture = row[102] ? static_cast<int8_t>(atoi(row[102])) : 0;
|
||||||
e.light = row[103] ? static_cast<int8_t>(atoi(row[103])) : 0;
|
e.light = row[103] ? static_cast<int8_t>(atoi(row[103])) : 0;
|
||||||
e.walkspeed = row[104] ? strtof(row[104], nullptr) : 0;
|
e.walkspeed = row[104] ? static_cast<int8_t>(atoi(row[104])) : 0;
|
||||||
e.peqid = row[105] ? static_cast<int32_t>(atoi(row[105])) : 0;
|
e.peqid = row[105] ? static_cast<int32_t>(atoi(row[105])) : 0;
|
||||||
e.unique_ = row[106] ? static_cast<int8_t>(atoi(row[106])) : 0;
|
e.unique_ = row[106] ? static_cast<int8_t>(atoi(row[106])) : 0;
|
||||||
e.fixed = row[107] ? static_cast<int8_t>(atoi(row[107])) : 0;
|
e.fixed = row[107] ? static_cast<int8_t>(atoi(row[107])) : 0;
|
||||||
@@ -1395,7 +1387,6 @@ public:
|
|||||||
e.faction_amount = row[126] ? static_cast<int32_t>(atoi(row[126])) : 0;
|
e.faction_amount = row[126] ? static_cast<int32_t>(atoi(row[126])) : 0;
|
||||||
e.keeps_sold_items = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 1;
|
e.keeps_sold_items = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 1;
|
||||||
e.is_parcel_merchant = row[128] ? static_cast<uint8_t>(strtoul(row[128], nullptr, 10)) : 0;
|
e.is_parcel_merchant = row[128] ? static_cast<uint8_t>(strtoul(row[128], nullptr, 10)) : 0;
|
||||||
e.multiquest_enabled = row[129] ? static_cast<uint8_t>(strtoul(row[129], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1524,7 +1515,7 @@ public:
|
|||||||
e.legtexture = row[101] ? static_cast<int8_t>(atoi(row[101])) : 0;
|
e.legtexture = row[101] ? static_cast<int8_t>(atoi(row[101])) : 0;
|
||||||
e.feettexture = row[102] ? static_cast<int8_t>(atoi(row[102])) : 0;
|
e.feettexture = row[102] ? static_cast<int8_t>(atoi(row[102])) : 0;
|
||||||
e.light = row[103] ? static_cast<int8_t>(atoi(row[103])) : 0;
|
e.light = row[103] ? static_cast<int8_t>(atoi(row[103])) : 0;
|
||||||
e.walkspeed = row[104] ? strtof(row[104], nullptr) : 0;
|
e.walkspeed = row[104] ? static_cast<int8_t>(atoi(row[104])) : 0;
|
||||||
e.peqid = row[105] ? static_cast<int32_t>(atoi(row[105])) : 0;
|
e.peqid = row[105] ? static_cast<int32_t>(atoi(row[105])) : 0;
|
||||||
e.unique_ = row[106] ? static_cast<int8_t>(atoi(row[106])) : 0;
|
e.unique_ = row[106] ? static_cast<int8_t>(atoi(row[106])) : 0;
|
||||||
e.fixed = row[107] ? static_cast<int8_t>(atoi(row[107])) : 0;
|
e.fixed = row[107] ? static_cast<int8_t>(atoi(row[107])) : 0;
|
||||||
@@ -1549,7 +1540,6 @@ public:
|
|||||||
e.faction_amount = row[126] ? static_cast<int32_t>(atoi(row[126])) : 0;
|
e.faction_amount = row[126] ? static_cast<int32_t>(atoi(row[126])) : 0;
|
||||||
e.keeps_sold_items = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 1;
|
e.keeps_sold_items = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 1;
|
||||||
e.is_parcel_merchant = row[128] ? static_cast<uint8_t>(strtoul(row[128], nullptr, 10)) : 0;
|
e.is_parcel_merchant = row[128] ? static_cast<uint8_t>(strtoul(row[128], nullptr, 10)) : 0;
|
||||||
e.multiquest_enabled = row[129] ? static_cast<uint8_t>(strtoul(row[129], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -1753,7 +1743,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.faction_amount));
|
v.push_back(std::to_string(e.faction_amount));
|
||||||
v.push_back(std::to_string(e.keeps_sold_items));
|
v.push_back(std::to_string(e.keeps_sold_items));
|
||||||
v.push_back(std::to_string(e.is_parcel_merchant));
|
v.push_back(std::to_string(e.is_parcel_merchant));
|
||||||
v.push_back(std::to_string(e.multiquest_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -1905,7 +1894,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.faction_amount));
|
v.push_back(std::to_string(e.faction_amount));
|
||||||
v.push_back(std::to_string(e.keeps_sold_items));
|
v.push_back(std::to_string(e.keeps_sold_items));
|
||||||
v.push_back(std::to_string(e.is_parcel_merchant));
|
v.push_back(std::to_string(e.is_parcel_merchant));
|
||||||
v.push_back(std::to_string(e.multiquest_enabled));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,6 @@ public:
|
|||||||
e.texture = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
e.texture = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.helm_texture = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.helm_texture = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.gender = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 2;
|
e.gender = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 2;
|
||||||
e.size_modifier = row[5] ? (strtof(row[5], nullptr) > 0.0f ? strtof(row[5], nullptr) : 1) : 1;
|
|
||||||
e.face = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.face = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
@@ -288,7 +287,6 @@ public:
|
|||||||
e.texture = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
e.texture = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.helm_texture = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.helm_texture = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.gender = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 2;
|
e.gender = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 2;
|
||||||
e.size_modifier = row[5] ? (strtof(row[5], nullptr) > 0.0f ? strtof(row[5], nullptr) : 1) : 1;
|
|
||||||
e.face = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.face = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
@@ -319,7 +317,6 @@ public:
|
|||||||
e.texture = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
e.texture = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.helm_texture = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.helm_texture = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.gender = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 2;
|
e.gender = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 2;
|
||||||
e.size_modifier = row[5] ? (strtof(row[5], nullptr) > 0.0f ? strtof(row[5], nullptr) : 1) : 1;
|
|
||||||
e.face = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 0;
|
e.face = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
|
|||||||
@@ -1,439 +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_PLAYER_EVENT_AA_PURCHASE_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_PLAYER_EVENT_AA_PURCHASE_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BasePlayerEventAaPurchaseRepository {
|
|
||||||
public:
|
|
||||||
struct PlayerEventAaPurchase {
|
|
||||||
uint64_t id;
|
|
||||||
int32_t aa_ability_id;
|
|
||||||
int32_t cost;
|
|
||||||
int32_t previous_id;
|
|
||||||
int32_t next_id;
|
|
||||||
time_t created_at;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"aa_ability_id",
|
|
||||||
"cost",
|
|
||||||
"previous_id",
|
|
||||||
"next_id",
|
|
||||||
"created_at",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"aa_ability_id",
|
|
||||||
"cost",
|
|
||||||
"previous_id",
|
|
||||||
"next_id",
|
|
||||||
"UNIX_TIMESTAMP(created_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("player_event_aa_purchase");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventAaPurchase NewEntity()
|
|
||||||
{
|
|
||||||
PlayerEventAaPurchase e{};
|
|
||||||
|
|
||||||
e.id = 0;
|
|
||||||
e.aa_ability_id = 0;
|
|
||||||
e.cost = 0;
|
|
||||||
e.previous_id = 0;
|
|
||||||
e.next_id = 0;
|
|
||||||
e.created_at = 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventAaPurchase GetPlayerEventAaPurchase(
|
|
||||||
const std::vector<PlayerEventAaPurchase> &player_event_aa_purchases,
|
|
||||||
int player_event_aa_purchase_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &player_event_aa_purchase : player_event_aa_purchases) {
|
|
||||||
if (player_event_aa_purchase.id == player_event_aa_purchase_id) {
|
|
||||||
return player_event_aa_purchase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventAaPurchase FindOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_aa_purchase_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_aa_purchase_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
PlayerEventAaPurchase e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.aa_ability_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
|
||||||
e.cost = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
|
||||||
e.previous_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
|
||||||
e.next_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
|
||||||
e.created_at = strtoll(row[5] ? row[5] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_aa_purchase_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_aa_purchase_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const PlayerEventAaPurchase &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.aa_ability_id));
|
|
||||||
v.push_back(columns[2] + " = " + std::to_string(e.cost));
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.previous_id));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.next_id));
|
|
||||||
v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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 PlayerEventAaPurchase InsertOne(
|
|
||||||
Database& db,
|
|
||||||
PlayerEventAaPurchase e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.aa_ability_id));
|
|
||||||
v.push_back(std::to_string(e.cost));
|
|
||||||
v.push_back(std::to_string(e.previous_id));
|
|
||||||
v.push_back(std::to_string(e.next_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventAaPurchase> &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.aa_ability_id));
|
|
||||||
v.push_back(std::to_string(e.cost));
|
|
||||||
v.push_back(std::to_string(e.previous_id));
|
|
||||||
v.push_back(std::to_string(e.next_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventAaPurchase> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventAaPurchase> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
PlayerEventAaPurchase e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.aa_ability_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
|
||||||
e.cost = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
|
||||||
e.previous_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
|
||||||
e.next_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
|
||||||
e.created_at = strtoll(row[5] ? row[5] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<PlayerEventAaPurchase> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventAaPurchase> 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) {
|
|
||||||
PlayerEventAaPurchase e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.aa_ability_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
|
||||||
e.cost = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
|
||||||
e.previous_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
|
||||||
e.next_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
|
||||||
e.created_at = strtoll(row[5] ? row[5] : "-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 PlayerEventAaPurchase &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.aa_ability_id));
|
|
||||||
v.push_back(std::to_string(e.cost));
|
|
||||||
v.push_back(std::to_string(e.previous_id));
|
|
||||||
v.push_back(std::to_string(e.next_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventAaPurchase> &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.aa_ability_id));
|
|
||||||
v.push_back(std::to_string(e.cost));
|
|
||||||
v.push_back(std::to_string(e.previous_id));
|
|
||||||
v.push_back(std::to_string(e.next_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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_PLAYER_EVENT_AA_PURCHASE_REPOSITORY_H
|
|
||||||
@@ -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_PLAYER_EVENT_KILLED_NAMED_NPC_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_PLAYER_EVENT_KILLED_NAMED_NPC_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BasePlayerEventKilledNamedNpcRepository {
|
|
||||||
public:
|
|
||||||
struct PlayerEventKilledNamedNpc {
|
|
||||||
uint64_t id;
|
|
||||||
uint32_t npc_id;
|
|
||||||
std::string npc_name;
|
|
||||||
uint32_t combat_time_seconds;
|
|
||||||
uint64_t total_damage_per_second_taken;
|
|
||||||
uint64_t total_heal_per_second_taken;
|
|
||||||
time_t created_at;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"npc_id",
|
|
||||||
"npc_name",
|
|
||||||
"combat_time_seconds",
|
|
||||||
"total_damage_per_second_taken",
|
|
||||||
"total_heal_per_second_taken",
|
|
||||||
"created_at",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"npc_id",
|
|
||||||
"npc_name",
|
|
||||||
"combat_time_seconds",
|
|
||||||
"total_damage_per_second_taken",
|
|
||||||
"total_heal_per_second_taken",
|
|
||||||
"UNIX_TIMESTAMP(created_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("player_event_killed_named_npc");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledNamedNpc NewEntity()
|
|
||||||
{
|
|
||||||
PlayerEventKilledNamedNpc e{};
|
|
||||||
|
|
||||||
e.id = 0;
|
|
||||||
e.npc_id = 0;
|
|
||||||
e.npc_name = "";
|
|
||||||
e.combat_time_seconds = 0;
|
|
||||||
e.total_damage_per_second_taken = 0;
|
|
||||||
e.total_heal_per_second_taken = 0;
|
|
||||||
e.created_at = 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledNamedNpc GetPlayerEventKilledNamedNpc(
|
|
||||||
const std::vector<PlayerEventKilledNamedNpc> &player_event_killed_named_npcs,
|
|
||||||
int player_event_killed_named_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &player_event_killed_named_npc : player_event_killed_named_npcs) {
|
|
||||||
if (player_event_killed_named_npc.id == player_event_killed_named_npc_id) {
|
|
||||||
return player_event_killed_named_npc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledNamedNpc FindOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_killed_named_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_killed_named_npc_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
PlayerEventKilledNamedNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_killed_named_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_killed_named_npc_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const PlayerEventKilledNamedNpc &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.npc_id));
|
|
||||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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 PlayerEventKilledNamedNpc InsertOne(
|
|
||||||
Database& db,
|
|
||||||
PlayerEventKilledNamedNpc e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledNamedNpc> &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.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledNamedNpc> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventKilledNamedNpc> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
PlayerEventKilledNamedNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<PlayerEventKilledNamedNpc> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventKilledNamedNpc> 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) {
|
|
||||||
PlayerEventKilledNamedNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-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 PlayerEventKilledNamedNpc &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledNamedNpc> &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.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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_PLAYER_EVENT_KILLED_NAMED_NPC_REPOSITORY_H
|
|
||||||
@@ -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_PLAYER_EVENT_KILLED_NPC_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_PLAYER_EVENT_KILLED_NPC_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BasePlayerEventKilledNpcRepository {
|
|
||||||
public:
|
|
||||||
struct PlayerEventKilledNpc {
|
|
||||||
uint64_t id;
|
|
||||||
uint32_t npc_id;
|
|
||||||
std::string npc_name;
|
|
||||||
uint32_t combat_time_seconds;
|
|
||||||
uint64_t total_damage_per_second_taken;
|
|
||||||
uint64_t total_heal_per_second_taken;
|
|
||||||
time_t created_at;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"npc_id",
|
|
||||||
"npc_name",
|
|
||||||
"combat_time_seconds",
|
|
||||||
"total_damage_per_second_taken",
|
|
||||||
"total_heal_per_second_taken",
|
|
||||||
"created_at",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"npc_id",
|
|
||||||
"npc_name",
|
|
||||||
"combat_time_seconds",
|
|
||||||
"total_damage_per_second_taken",
|
|
||||||
"total_heal_per_second_taken",
|
|
||||||
"UNIX_TIMESTAMP(created_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("player_event_killed_npc");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledNpc NewEntity()
|
|
||||||
{
|
|
||||||
PlayerEventKilledNpc e{};
|
|
||||||
|
|
||||||
e.id = 0;
|
|
||||||
e.npc_id = 0;
|
|
||||||
e.npc_name = "";
|
|
||||||
e.combat_time_seconds = 0;
|
|
||||||
e.total_damage_per_second_taken = 0;
|
|
||||||
e.total_heal_per_second_taken = 0;
|
|
||||||
e.created_at = 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledNpc GetPlayerEventKilledNpc(
|
|
||||||
const std::vector<PlayerEventKilledNpc> &player_event_killed_npcs,
|
|
||||||
int player_event_killed_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &player_event_killed_npc : player_event_killed_npcs) {
|
|
||||||
if (player_event_killed_npc.id == player_event_killed_npc_id) {
|
|
||||||
return player_event_killed_npc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledNpc FindOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_killed_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_killed_npc_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
PlayerEventKilledNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_killed_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_killed_npc_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const PlayerEventKilledNpc &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.npc_id));
|
|
||||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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 PlayerEventKilledNpc InsertOne(
|
|
||||||
Database& db,
|
|
||||||
PlayerEventKilledNpc e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledNpc> &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.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledNpc> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventKilledNpc> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
PlayerEventKilledNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<PlayerEventKilledNpc> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventKilledNpc> 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) {
|
|
||||||
PlayerEventKilledNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-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 PlayerEventKilledNpc &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledNpc> &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.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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_PLAYER_EVENT_KILLED_NPC_REPOSITORY_H
|
|
||||||
@@ -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_PLAYER_EVENT_KILLED_RAID_NPC_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_PLAYER_EVENT_KILLED_RAID_NPC_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BasePlayerEventKilledRaidNpcRepository {
|
|
||||||
public:
|
|
||||||
struct PlayerEventKilledRaidNpc {
|
|
||||||
uint64_t id;
|
|
||||||
uint32_t npc_id;
|
|
||||||
std::string npc_name;
|
|
||||||
uint32_t combat_time_seconds;
|
|
||||||
uint64_t total_damage_per_second_taken;
|
|
||||||
uint64_t total_heal_per_second_taken;
|
|
||||||
time_t created_at;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"npc_id",
|
|
||||||
"npc_name",
|
|
||||||
"combat_time_seconds",
|
|
||||||
"total_damage_per_second_taken",
|
|
||||||
"total_heal_per_second_taken",
|
|
||||||
"created_at",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"npc_id",
|
|
||||||
"npc_name",
|
|
||||||
"combat_time_seconds",
|
|
||||||
"total_damage_per_second_taken",
|
|
||||||
"total_heal_per_second_taken",
|
|
||||||
"UNIX_TIMESTAMP(created_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("player_event_killed_raid_npc");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledRaidNpc NewEntity()
|
|
||||||
{
|
|
||||||
PlayerEventKilledRaidNpc e{};
|
|
||||||
|
|
||||||
e.id = 0;
|
|
||||||
e.npc_id = 0;
|
|
||||||
e.npc_name = "";
|
|
||||||
e.combat_time_seconds = 0;
|
|
||||||
e.total_damage_per_second_taken = 0;
|
|
||||||
e.total_heal_per_second_taken = 0;
|
|
||||||
e.created_at = 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledRaidNpc GetPlayerEventKilledRaidNpc(
|
|
||||||
const std::vector<PlayerEventKilledRaidNpc> &player_event_killed_raid_npcs,
|
|
||||||
int player_event_killed_raid_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &player_event_killed_raid_npc : player_event_killed_raid_npcs) {
|
|
||||||
if (player_event_killed_raid_npc.id == player_event_killed_raid_npc_id) {
|
|
||||||
return player_event_killed_raid_npc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventKilledRaidNpc FindOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_killed_raid_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_killed_raid_npc_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
PlayerEventKilledRaidNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_killed_raid_npc_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_killed_raid_npc_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const PlayerEventKilledRaidNpc &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.npc_id));
|
|
||||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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 PlayerEventKilledRaidNpc InsertOne(
|
|
||||||
Database& db,
|
|
||||||
PlayerEventKilledRaidNpc e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledRaidNpc> &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.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledRaidNpc> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventKilledRaidNpc> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
PlayerEventKilledRaidNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<PlayerEventKilledRaidNpc> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventKilledRaidNpc> 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) {
|
|
||||||
PlayerEventKilledRaidNpc e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.npc_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.npc_name = row[2] ? row[2] : "";
|
|
||||||
e.combat_time_seconds = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
|
||||||
e.total_damage_per_second_taken = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
|
||||||
e.total_heal_per_second_taken = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
|
||||||
e.created_at = strtoll(row[6] ? row[6] : "-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 PlayerEventKilledRaidNpc &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventKilledRaidNpc> &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.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.npc_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.combat_time_seconds));
|
|
||||||
v.push_back(std::to_string(e.total_damage_per_second_taken));
|
|
||||||
v.push_back(std::to_string(e.total_heal_per_second_taken));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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_PLAYER_EVENT_KILLED_RAID_NPC_REPOSITORY_H
|
|
||||||
@@ -24,7 +24,6 @@ public:
|
|||||||
int8_t event_enabled;
|
int8_t event_enabled;
|
||||||
int32_t retention_days;
|
int32_t retention_days;
|
||||||
int32_t discord_webhook_id;
|
int32_t discord_webhook_id;
|
||||||
uint8_t etl_enabled;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -40,7 +39,6 @@ public:
|
|||||||
"event_enabled",
|
"event_enabled",
|
||||||
"retention_days",
|
"retention_days",
|
||||||
"discord_webhook_id",
|
"discord_webhook_id",
|
||||||
"etl_enabled",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +50,6 @@ public:
|
|||||||
"event_enabled",
|
"event_enabled",
|
||||||
"retention_days",
|
"retention_days",
|
||||||
"discord_webhook_id",
|
"discord_webhook_id",
|
||||||
"etl_enabled",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +95,6 @@ public:
|
|||||||
e.event_enabled = 0;
|
e.event_enabled = 0;
|
||||||
e.retention_days = 0;
|
e.retention_days = 0;
|
||||||
e.discord_webhook_id = 0;
|
e.discord_webhook_id = 0;
|
||||||
e.etl_enabled = 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -140,7 +136,6 @@ public:
|
|||||||
e.event_enabled = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
e.event_enabled = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
||||||
e.retention_days = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
e.retention_days = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
e.discord_webhook_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
e.discord_webhook_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
e.etl_enabled = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -179,7 +174,6 @@ public:
|
|||||||
v.push_back(columns[2] + " = " + std::to_string(e.event_enabled));
|
v.push_back(columns[2] + " = " + std::to_string(e.event_enabled));
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.retention_days));
|
v.push_back(columns[3] + " = " + std::to_string(e.retention_days));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.discord_webhook_id));
|
v.push_back(columns[4] + " = " + std::to_string(e.discord_webhook_id));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.etl_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -206,7 +200,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_enabled));
|
v.push_back(std::to_string(e.event_enabled));
|
||||||
v.push_back(std::to_string(e.retention_days));
|
v.push_back(std::to_string(e.retention_days));
|
||||||
v.push_back(std::to_string(e.discord_webhook_id));
|
v.push_back(std::to_string(e.discord_webhook_id));
|
||||||
v.push_back(std::to_string(e.etl_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -241,7 +234,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_enabled));
|
v.push_back(std::to_string(e.event_enabled));
|
||||||
v.push_back(std::to_string(e.retention_days));
|
v.push_back(std::to_string(e.retention_days));
|
||||||
v.push_back(std::to_string(e.discord_webhook_id));
|
v.push_back(std::to_string(e.discord_webhook_id));
|
||||||
v.push_back(std::to_string(e.etl_enabled));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -280,7 +272,6 @@ public:
|
|||||||
e.event_enabled = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
e.event_enabled = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
||||||
e.retention_days = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
e.retention_days = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
e.discord_webhook_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
e.discord_webhook_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
e.etl_enabled = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -310,7 +301,6 @@ public:
|
|||||||
e.event_enabled = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
e.event_enabled = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
||||||
e.retention_days = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
e.retention_days = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
e.discord_webhook_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
e.discord_webhook_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
e.etl_enabled = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -390,7 +380,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_enabled));
|
v.push_back(std::to_string(e.event_enabled));
|
||||||
v.push_back(std::to_string(e.retention_days));
|
v.push_back(std::to_string(e.retention_days));
|
||||||
v.push_back(std::to_string(e.discord_webhook_id));
|
v.push_back(std::to_string(e.discord_webhook_id));
|
||||||
v.push_back(std::to_string(e.etl_enabled));
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -418,7 +407,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_enabled));
|
v.push_back(std::to_string(e.event_enabled));
|
||||||
v.push_back(std::to_string(e.retention_days));
|
v.push_back(std::to_string(e.retention_days));
|
||||||
v.push_back(std::to_string(e.discord_webhook_id));
|
v.push_back(std::to_string(e.discord_webhook_id));
|
||||||
v.push_back(std::to_string(e.etl_enabled));
|
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public:
|
|||||||
int32_t event_type_id;
|
int32_t event_type_id;
|
||||||
std::string event_type_name;
|
std::string event_type_name;
|
||||||
std::string event_data;
|
std::string event_data;
|
||||||
int64_t etl_table_id;
|
|
||||||
time_t created_at;
|
time_t created_at;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
@@ -51,7 +50,6 @@ public:
|
|||||||
CEREAL_NVP(event_type_id),
|
CEREAL_NVP(event_type_id),
|
||||||
CEREAL_NVP(event_type_name),
|
CEREAL_NVP(event_type_name),
|
||||||
CEREAL_NVP(event_data),
|
CEREAL_NVP(event_data),
|
||||||
CEREAL_NVP(etl_table_id),
|
|
||||||
CEREAL_NVP(created_at)
|
CEREAL_NVP(created_at)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -77,7 +75,6 @@ public:
|
|||||||
"event_type_id",
|
"event_type_id",
|
||||||
"event_type_name",
|
"event_type_name",
|
||||||
"event_data",
|
"event_data",
|
||||||
"etl_table_id",
|
|
||||||
"created_at",
|
"created_at",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -97,7 +94,6 @@ public:
|
|||||||
"event_type_id",
|
"event_type_id",
|
||||||
"event_type_name",
|
"event_type_name",
|
||||||
"event_data",
|
"event_data",
|
||||||
"etl_table_id",
|
|
||||||
"UNIX_TIMESTAMP(created_at)",
|
"UNIX_TIMESTAMP(created_at)",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -151,7 +147,6 @@ public:
|
|||||||
e.event_type_id = 0;
|
e.event_type_id = 0;
|
||||||
e.event_type_name = "";
|
e.event_type_name = "";
|
||||||
e.event_data = "";
|
e.event_data = "";
|
||||||
e.etl_table_id = 0;
|
|
||||||
e.created_at = 0;
|
e.created_at = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
@@ -201,8 +196,7 @@ public:
|
|||||||
e.event_type_id = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
e.event_type_id = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||||
e.event_type_name = row[10] ? row[10] : "";
|
e.event_type_name = row[10] ? row[10] : "";
|
||||||
e.event_data = row[11] ? row[11] : "";
|
e.event_data = row[11] ? row[11] : "";
|
||||||
e.etl_table_id = row[12] ? strtoll(row[12], nullptr, 10) : 0;
|
e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10);
|
||||||
e.created_at = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -247,8 +241,7 @@ public:
|
|||||||
v.push_back(columns[9] + " = " + std::to_string(e.event_type_id));
|
v.push_back(columns[9] + " = " + std::to_string(e.event_type_id));
|
||||||
v.push_back(columns[10] + " = '" + Strings::Escape(e.event_type_name) + "'");
|
v.push_back(columns[10] + " = '" + Strings::Escape(e.event_type_name) + "'");
|
||||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.event_data) + "'");
|
v.push_back(columns[11] + " = '" + Strings::Escape(e.event_data) + "'");
|
||||||
v.push_back(columns[12] + " = " + std::to_string(e.etl_table_id));
|
v.push_back(columns[12] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||||
v.push_back(columns[13] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -282,7 +275,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_type_id));
|
v.push_back(std::to_string(e.event_type_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
||||||
v.push_back(std::to_string(e.etl_table_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -325,7 +317,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_type_id));
|
v.push_back(std::to_string(e.event_type_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
||||||
v.push_back(std::to_string(e.etl_table_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
@@ -372,8 +363,7 @@ public:
|
|||||||
e.event_type_id = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
e.event_type_id = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||||
e.event_type_name = row[10] ? row[10] : "";
|
e.event_type_name = row[10] ? row[10] : "";
|
||||||
e.event_data = row[11] ? row[11] : "";
|
e.event_data = row[11] ? row[11] : "";
|
||||||
e.etl_table_id = row[12] ? strtoll(row[12], nullptr, 10) : 0;
|
e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10);
|
||||||
e.created_at = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -410,8 +400,7 @@ public:
|
|||||||
e.event_type_id = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
e.event_type_id = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||||
e.event_type_name = row[10] ? row[10] : "";
|
e.event_type_name = row[10] ? row[10] : "";
|
||||||
e.event_data = row[11] ? row[11] : "";
|
e.event_data = row[11] ? row[11] : "";
|
||||||
e.etl_table_id = row[12] ? strtoll(row[12], nullptr, 10) : 0;
|
e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10);
|
||||||
e.created_at = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -498,7 +487,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_type_id));
|
v.push_back(std::to_string(e.event_type_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
||||||
v.push_back(std::to_string(e.etl_table_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -534,7 +522,6 @@ public:
|
|||||||
v.push_back(std::to_string(e.event_type_id));
|
v.push_back(std::to_string(e.event_type_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_type_name) + "'");
|
||||||
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
v.push_back("'" + Strings::Escape(e.event_data) + "'");
|
||||||
v.push_back(std::to_string(e.etl_table_id));
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
|
|||||||
@@ -1,523 +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_PLAYER_EVENT_LOOT_ITEMS_REPOSITORY_H
|
|
||||||
#define EQEMU_BASE_PLAYER_EVENT_LOOT_ITEMS_REPOSITORY_H
|
|
||||||
|
|
||||||
#include "../../database.h"
|
|
||||||
#include "../../strings.h"
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
class BasePlayerEventLootItemsRepository {
|
|
||||||
public:
|
|
||||||
struct PlayerEventLootItems {
|
|
||||||
uint64_t id;
|
|
||||||
uint32_t item_id;
|
|
||||||
std::string item_name;
|
|
||||||
int32_t charges;
|
|
||||||
uint32_t augment_1_id;
|
|
||||||
uint32_t augment_2_id;
|
|
||||||
uint32_t augment_3_id;
|
|
||||||
uint32_t augment_4_id;
|
|
||||||
uint32_t augment_5_id;
|
|
||||||
uint32_t augment_6_id;
|
|
||||||
uint32_t npc_id;
|
|
||||||
std::string corpse_name;
|
|
||||||
time_t created_at;
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
|
||||||
{
|
|
||||||
return std::string("id");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> Columns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"item_id",
|
|
||||||
"item_name",
|
|
||||||
"charges",
|
|
||||||
"augment_1_id",
|
|
||||||
"augment_2_id",
|
|
||||||
"augment_3_id",
|
|
||||||
"augment_4_id",
|
|
||||||
"augment_5_id",
|
|
||||||
"augment_6_id",
|
|
||||||
"npc_id",
|
|
||||||
"corpse_name",
|
|
||||||
"created_at",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<std::string> SelectColumns()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id",
|
|
||||||
"item_id",
|
|
||||||
"item_name",
|
|
||||||
"charges",
|
|
||||||
"augment_1_id",
|
|
||||||
"augment_2_id",
|
|
||||||
"augment_3_id",
|
|
||||||
"augment_4_id",
|
|
||||||
"augment_5_id",
|
|
||||||
"augment_6_id",
|
|
||||||
"npc_id",
|
|
||||||
"corpse_name",
|
|
||||||
"UNIX_TIMESTAMP(created_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("player_event_loot_items");
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseSelect()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"SELECT {} FROM {}",
|
|
||||||
SelectColumnsRaw(),
|
|
||||||
TableName()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BaseInsert()
|
|
||||||
{
|
|
||||||
return fmt::format(
|
|
||||||
"INSERT INTO {} ({}) ",
|
|
||||||
TableName(),
|
|
||||||
ColumnsRaw()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventLootItems NewEntity()
|
|
||||||
{
|
|
||||||
PlayerEventLootItems e{};
|
|
||||||
|
|
||||||
e.id = 0;
|
|
||||||
e.item_id = 0;
|
|
||||||
e.item_name = "";
|
|
||||||
e.charges = 0;
|
|
||||||
e.augment_1_id = 0;
|
|
||||||
e.augment_2_id = 0;
|
|
||||||
e.augment_3_id = 0;
|
|
||||||
e.augment_4_id = 0;
|
|
||||||
e.augment_5_id = 0;
|
|
||||||
e.augment_6_id = 0;
|
|
||||||
e.npc_id = 0;
|
|
||||||
e.corpse_name = "";
|
|
||||||
e.created_at = 0;
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventLootItems GetPlayerEventLootItems(
|
|
||||||
const std::vector<PlayerEventLootItems> &player_event_loot_itemss,
|
|
||||||
int player_event_loot_items_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
for (auto &player_event_loot_items : player_event_loot_itemss) {
|
|
||||||
if (player_event_loot_items.id == player_event_loot_items_id) {
|
|
||||||
return player_event_loot_items;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static PlayerEventLootItems FindOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_loot_items_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{} WHERE {} = {} LIMIT 1",
|
|
||||||
BaseSelect(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_loot_items_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
if (results.RowCount() == 1) {
|
|
||||||
PlayerEventLootItems e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.item_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_name = row[2] ? row[2] : "";
|
|
||||||
e.charges = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
|
||||||
e.augment_1_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.augment_2_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
e.augment_3_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
|
||||||
e.augment_4_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.augment_5_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
|
||||||
e.augment_6_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
e.npc_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
|
||||||
e.corpse_name = row[11] ? row[11] : "";
|
|
||||||
e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
static int DeleteOne(
|
|
||||||
Database& db,
|
|
||||||
int player_event_loot_items_id
|
|
||||||
)
|
|
||||||
{
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"DELETE FROM {} WHERE {} = {}",
|
|
||||||
TableName(),
|
|
||||||
PrimaryKey(),
|
|
||||||
player_event_loot_items_id
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return (results.Success() ? results.RowsAffected() : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateOne(
|
|
||||||
Database& db,
|
|
||||||
const PlayerEventLootItems &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
auto columns = Columns();
|
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.item_id));
|
|
||||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.item_name) + "'");
|
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.charges));
|
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.augment_1_id));
|
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.augment_2_id));
|
|
||||||
v.push_back(columns[6] + " = " + std::to_string(e.augment_3_id));
|
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.augment_4_id));
|
|
||||||
v.push_back(columns[8] + " = " + std::to_string(e.augment_5_id));
|
|
||||||
v.push_back(columns[9] + " = " + std::to_string(e.augment_6_id));
|
|
||||||
v.push_back(columns[10] + " = " + std::to_string(e.npc_id));
|
|
||||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.corpse_name) + "'");
|
|
||||||
v.push_back(columns[12] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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 PlayerEventLootItems InsertOne(
|
|
||||||
Database& db,
|
|
||||||
PlayerEventLootItems e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.item_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.charges));
|
|
||||||
v.push_back(std::to_string(e.augment_1_id));
|
|
||||||
v.push_back(std::to_string(e.augment_2_id));
|
|
||||||
v.push_back(std::to_string(e.augment_3_id));
|
|
||||||
v.push_back(std::to_string(e.augment_4_id));
|
|
||||||
v.push_back(std::to_string(e.augment_5_id));
|
|
||||||
v.push_back(std::to_string(e.augment_6_id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.corpse_name) + "'");
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventLootItems> &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_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.item_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.charges));
|
|
||||||
v.push_back(std::to_string(e.augment_1_id));
|
|
||||||
v.push_back(std::to_string(e.augment_2_id));
|
|
||||||
v.push_back(std::to_string(e.augment_3_id));
|
|
||||||
v.push_back(std::to_string(e.augment_4_id));
|
|
||||||
v.push_back(std::to_string(e.augment_5_id));
|
|
||||||
v.push_back(std::to_string(e.augment_6_id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.corpse_name) + "'");
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventLootItems> All(Database& db)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventLootItems> all_entries;
|
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
|
||||||
fmt::format(
|
|
||||||
"{}",
|
|
||||||
BaseSelect()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
all_entries.reserve(results.RowCount());
|
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
|
||||||
PlayerEventLootItems e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.item_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_name = row[2] ? row[2] : "";
|
|
||||||
e.charges = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
|
||||||
e.augment_1_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.augment_2_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
e.augment_3_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
|
||||||
e.augment_4_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.augment_5_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
|
||||||
e.augment_6_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
e.npc_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
|
||||||
e.corpse_name = row[11] ? row[11] : "";
|
|
||||||
e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10);
|
|
||||||
|
|
||||||
all_entries.push_back(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all_entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<PlayerEventLootItems> GetWhere(Database& db, const std::string &where_filter)
|
|
||||||
{
|
|
||||||
std::vector<PlayerEventLootItems> 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) {
|
|
||||||
PlayerEventLootItems e{};
|
|
||||||
|
|
||||||
e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0;
|
|
||||||
e.item_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
|
||||||
e.item_name = row[2] ? row[2] : "";
|
|
||||||
e.charges = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
|
||||||
e.augment_1_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
|
||||||
e.augment_2_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
|
||||||
e.augment_3_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
|
||||||
e.augment_4_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
|
||||||
e.augment_5_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
|
||||||
e.augment_6_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
|
||||||
e.npc_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
|
||||||
e.corpse_name = row[11] ? row[11] : "";
|
|
||||||
e.created_at = strtoll(row[12] ? row[12] : "-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 PlayerEventLootItems &e
|
|
||||||
)
|
|
||||||
{
|
|
||||||
std::vector<std::string> v;
|
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
|
||||||
v.push_back(std::to_string(e.item_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.item_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.charges));
|
|
||||||
v.push_back(std::to_string(e.augment_1_id));
|
|
||||||
v.push_back(std::to_string(e.augment_2_id));
|
|
||||||
v.push_back(std::to_string(e.augment_3_id));
|
|
||||||
v.push_back(std::to_string(e.augment_4_id));
|
|
||||||
v.push_back(std::to_string(e.augment_5_id));
|
|
||||||
v.push_back(std::to_string(e.augment_6_id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.corpse_name) + "'");
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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<PlayerEventLootItems> &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_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.item_name) + "'");
|
|
||||||
v.push_back(std::to_string(e.charges));
|
|
||||||
v.push_back(std::to_string(e.augment_1_id));
|
|
||||||
v.push_back(std::to_string(e.augment_2_id));
|
|
||||||
v.push_back(std::to_string(e.augment_3_id));
|
|
||||||
v.push_back(std::to_string(e.augment_4_id));
|
|
||||||
v.push_back(std::to_string(e.augment_5_id));
|
|
||||||
v.push_back(std::to_string(e.augment_6_id));
|
|
||||||
v.push_back(std::to_string(e.npc_id));
|
|
||||||
v.push_back("'" + Strings::Escape(e.corpse_name) + "'");
|
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_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_PLAYER_EVENT_LOOT_ITEMS_REPOSITORY_H
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user