mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 16:28:28 +00:00
Compare commits
93 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da4e9ab95b | |||
| a8fea95eab | |||
| 53610c2f0f | |||
| 9f10c12874 | |||
| a0634adb3c | |||
| a2ed6be1f5 | |||
| c33ac40567 | |||
| 9ee095b354 | |||
| 7ab32af4dc | |||
| 0c301419c2 | |||
| d6a21be25e | |||
| 1d4ba082ad | |||
| 94553501ba | |||
| da824d5178 | |||
| 5a1df38900 | |||
| 8cd7148b29 | |||
| 09e079a45e | |||
| 4bc881da4b | |||
| 0615864d51 | |||
| 3638d157b2 | |||
| d41725e325 | |||
| 88580b69b6 | |||
| f7a6fe595a | |||
| 07d14c2681 | |||
| eac7a73fb6 | |||
| c5715f1f14 | |||
| 3902230fa1 | |||
| 212969f5cd | |||
| de4226fdc9 | |||
| 8b13434197 | |||
| 27274397ec | |||
| 2b79a36014 | |||
| 8cf52294e9 | |||
| 0ef79903f8 | |||
| ab14458f9e | |||
| 5b94e736b3 | |||
| c3b8cc9744 | |||
| 89e3b2c72e | |||
| 23c4aa241b | |||
| acb7584e26 | |||
| a885bd9322 | |||
| 20fe1926e0 | |||
| eb7118754b | |||
| 3611b49f68 | |||
| 511d8a8bb3 | |||
| 1598d2e17b | |||
| 805757ba87 | |||
| eb6ac25540 | |||
| cb634cf57d | |||
| 2f7ca2cdc8 | |||
| 425d24c1f4 | |||
| 875df8e64a | |||
| 7a2d2a0c51 | |||
| 5296202e56 | |||
| e2db8ffea8 | |||
| fa2ab11676 | |||
| 80e8634a48 | |||
| 98c2fa5127 | |||
| 8b8b41dab3 | |||
| 63b1e6b4b4 | |||
| 21b7b6e7ab | |||
| 878a5377ae | |||
| 486c7c44be | |||
| aa4869c6e9 | |||
| 94e1b4edfa | |||
| 4d73b7d641 | |||
| ed4f9b0d30 | |||
| f8837d0926 | |||
| 753d83c499 | |||
| f0108826d3 | |||
| 6ac846c003 | |||
| 44963f3f21 | |||
| 9fd935ef10 | |||
| 6f390c81f9 | |||
| 1bd281c8f2 | |||
| 49cf97ae9c | |||
| 8315240b17 | |||
| 55155ff800 | |||
| ab4e1191ef | |||
| c09fad5a75 | |||
| 8201175c2c | |||
| e88ea24966 | |||
| 02e2f6771c | |||
| 3b399dfac5 | |||
| 9aa0f7c695 | |||
| 3ba113a91d | |||
| b0c951bd6e | |||
| 8a5f885558 | |||
| fd3f5cfd29 | |||
| 74b8cf8bd3 | |||
| 18685748f6 | |||
| da24bf467a | |||
| e948a6815c |
+292
@@ -1,3 +1,295 @@
|
||||
## [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
|
||||
|
||||
@@ -22,6 +22,7 @@ SET(common_sources
|
||||
dbcore.cpp
|
||||
deity.cpp
|
||||
dynamic_zone_base.cpp
|
||||
dynamic_zone_lockout.cpp
|
||||
emu_constants.cpp
|
||||
emu_limits.cpp
|
||||
emu_opcodes.cpp
|
||||
@@ -40,7 +41,6 @@ SET(common_sources
|
||||
events/player_event_logs.cpp
|
||||
events/player_event_discord_formatter.cpp
|
||||
evolving_items.cpp
|
||||
expedition_lockout_timer.cpp
|
||||
extprofile.cpp
|
||||
discord/discord_manager.cpp
|
||||
faction.cpp
|
||||
@@ -213,16 +213,14 @@ SET(repositories
|
||||
repositories/base/base_discovered_items_repository.h
|
||||
repositories/base/base_doors_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_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_base_data_repository.h
|
||||
repositories/base/base_faction_list_repository.h
|
||||
repositories/base/base_faction_list_mod_repository.h
|
||||
repositories/base/base_faction_values_repository.h
|
||||
repositories/base/base_find_location_repository.h
|
||||
repositories/base/base_fishing_repository.h
|
||||
repositories/base/base_forage_repository.h
|
||||
repositories/base/base_friends_repository.h
|
||||
@@ -411,16 +409,14 @@ SET(repositories
|
||||
repositories/discovered_items_repository.h
|
||||
repositories/doors_repository.h
|
||||
repositories/dynamic_zones_repository.h
|
||||
repositories/dynamic_zone_lockouts_repository.h
|
||||
repositories/dynamic_zone_members_repository.h
|
||||
repositories/dynamic_zone_templates_repository.h
|
||||
repositories/expeditions_repository.h
|
||||
repositories/expedition_lockouts_repository.h
|
||||
repositories/faction_association_repository.h
|
||||
repositories/faction_base_data_repository.h
|
||||
repositories/faction_list_repository.h
|
||||
repositories/faction_list_mod_repository.h
|
||||
repositories/faction_values_repository.h
|
||||
repositories/find_location_repository.h
|
||||
repositories/fishing_repository.h
|
||||
repositories/forage_repository.h
|
||||
repositories/friends_repository.h
|
||||
@@ -563,6 +559,7 @@ SET(common_headers
|
||||
discord/discord.h
|
||||
discord/discord_manager.h
|
||||
dynamic_zone_base.h
|
||||
dynamic_zone_lockout.h
|
||||
emu_constants.h
|
||||
emu_limits.h
|
||||
emu_opcodes.h
|
||||
@@ -589,7 +586,6 @@ SET(common_headers
|
||||
events/player_events.h
|
||||
event_sub.h
|
||||
evolving_items.h
|
||||
expedition_lockout_timer.h
|
||||
extprofile.h
|
||||
faction.h
|
||||
file.h
|
||||
@@ -649,6 +645,7 @@ SET(common_headers
|
||||
server_event_scheduler.h
|
||||
serverinfo.h
|
||||
servertalk.h
|
||||
server_reload_types.h
|
||||
shared_tasks.h
|
||||
shareddb.h
|
||||
skills.h
|
||||
|
||||
+1
-1
@@ -245,7 +245,7 @@ uint32 Database::CreateAccount(
|
||||
e.password = password;
|
||||
}
|
||||
|
||||
LogInfo("Account Attempting to be created: [{}:{}] status: {}", loginserver, name, status);
|
||||
LogInfo("Account attempting to be created loginserver [{}] name [{}] status [{}]", loginserver, name, status);
|
||||
|
||||
e = AccountRepository::InsertOne(*this, e);
|
||||
|
||||
|
||||
@@ -596,7 +596,12 @@ void DatabaseDumpService::BuildCredentialsFile()
|
||||
void DatabaseDumpService::RemoveCredentialsFile()
|
||||
{
|
||||
if (File::Exists(CREDENTIALS_FILE)) {
|
||||
std::filesystem::remove(CREDENTIALS_FILE);
|
||||
try {
|
||||
std::filesystem::remove(CREDENTIALS_FILE);
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
LogError("std::filesystem::remove err [{}]", e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6417,7 +6417,7 @@ ADD COLUMN `guid` bigint(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `ornament_hero_mo
|
||||
ADD PRIMARY KEY (`account_id`, `slot_id`);
|
||||
)",
|
||||
.content_schema_update = false,
|
||||
.force_interactive = true
|
||||
.force_interactive = false
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9298,
|
||||
@@ -6481,7 +6481,7 @@ UPDATE `sharedbank` SET `slot_id` = ((`slot_id` - 2531) + 11010) WHERE `slot_id`
|
||||
UPDATE `sharedbank` SET `slot_id` = ((`slot_id` - 2541) + 11210) WHERE `slot_id` BETWEEN 2541 AND 2550; -- Shared Bank Bag 2
|
||||
)",
|
||||
.content_schema_update = false,
|
||||
.force_interactive = true
|
||||
.force_interactive = false
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9299,
|
||||
@@ -6770,7 +6770,186 @@ SET `aliases` =
|
||||
WHERE `command` = 'illusionblock'
|
||||
AND `aliases` NOT LIKE '%ib%';
|
||||
)",
|
||||
}
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9303,
|
||||
.description = "2025_02_13_corpse_slot_fix.sql",
|
||||
.check = "SELECT * FROM `character_corpse_items` WHERE `equip_slot` BETWEEN 251 AND 350",
|
||||
.condition = "not_empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 251) + 4010) WHERE `equip_slot` BETWEEN 251 AND 260; -- Bag 1
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 261) + 4210) WHERE `equip_slot` BETWEEN 261 AND 270; -- Bag 2
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 271) + 4410) WHERE `equip_slot` BETWEEN 271 AND 280; -- Bag 3
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 281) + 4610) WHERE `equip_slot` BETWEEN 281 AND 290; -- Bag 4
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 291) + 4810) WHERE `equip_slot` BETWEEN 291 AND 300; -- Bag 5
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 301) + 5010) WHERE `equip_slot` BETWEEN 301 AND 310; -- Bag 6
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 311) + 5210) WHERE `equip_slot` BETWEEN 311 AND 320; -- Bag 7
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 321) + 5410) WHERE `equip_slot` BETWEEN 321 AND 330; -- Bag 8
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 331) + 5610) WHERE `equip_slot` BETWEEN 331 AND 340; -- Bag 9
|
||||
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 341) + 5810) WHERE `equip_slot` BETWEEN 341 AND 350; -- Bag 10
|
||||
)",
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9304,
|
||||
.description = "2024_12_01_2024_update_guild_bank",
|
||||
.check = "SHOW COLUMNS FROM `guild_bank` LIKE 'augment_one_id'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `guild_bank`
|
||||
DROP INDEX `guildid`,
|
||||
CHANGE COLUMN `guildid` `guild_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `id`,
|
||||
CHANGE COLUMN `itemid` `item_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `slot`,
|
||||
CHANGE COLUMN `whofor` `who_for` VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8_general_ci' AFTER `permissions`,
|
||||
ADD COLUMN `augment_one_id` INT UNSIGNED NULL DEFAULT '0' AFTER `item_id`,
|
||||
ADD COLUMN `augment_two_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_one_id`,
|
||||
ADD COLUMN `augment_three_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_two_id`,
|
||||
ADD COLUMN `augment_four_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_three_id`,
|
||||
ADD COLUMN `augment_five_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_four_id`,
|
||||
ADD COLUMN `augment_six_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_five_id`,
|
||||
CHANGE COLUMN `qty` `quantity` INT(10) NOT NULL DEFAULT '0' AFTER `augment_six_id`;
|
||||
ALTER TABLE `guild_bank`
|
||||
ADD INDEX `guild_id` (`guild_id`);
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9305,
|
||||
.description = "2024_12_01_expedition_dz_merge.sql",
|
||||
.check = "SHOW COLUMNS FROM `dynamic_zones` LIKE 'is_locked'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `dynamic_zones`
|
||||
ADD COLUMN `is_locked` TINYINT NOT NULL DEFAULT '0' AFTER `has_zone_in`,
|
||||
ADD COLUMN `add_replay` TINYINT NOT NULL DEFAULT '1' AFTER `is_locked`;
|
||||
|
||||
ALTER TABLE `expedition_lockouts`
|
||||
CHANGE COLUMN `expedition_id` `dynamic_zone_id` INT(10) UNSIGNED NOT NULL AFTER `id`,
|
||||
DROP INDEX `expedition_id_event_name`,
|
||||
ADD UNIQUE INDEX `dz_id_event_name` (`dynamic_zone_id`, `event_name`) USING BTREE;
|
||||
|
||||
UPDATE expedition_lockouts lockouts
|
||||
INNER JOIN expeditions ON lockouts.dynamic_zone_id = expeditions.id
|
||||
SET lockouts.dynamic_zone_id = expeditions.dynamic_zone_id;
|
||||
|
||||
DROP TABLE `expeditions`;
|
||||
|
||||
RENAME TABLE `expedition_lockouts` TO `dynamic_zone_lockouts`;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9306,
|
||||
.description = "2025_02_16_data_buckets_zone_id_instance_id.sql",
|
||||
.check = "SHOW COLUMNS FROM `data_buckets` LIKE 'zone_id'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
-- ✅ Drop old indexes
|
||||
DROP INDEX IF EXISTS `keys` ON `data_buckets`;
|
||||
DROP INDEX IF EXISTS `idx_npc_expires` ON `data_buckets`;
|
||||
DROP INDEX IF EXISTS `idx_bot_expires` ON `data_buckets`;
|
||||
|
||||
-- Add zone_id, instance_id
|
||||
ALTER TABLE `data_buckets`
|
||||
MODIFY COLUMN `npc_id` int(11) NOT NULL DEFAULT 0 AFTER `character_id`,
|
||||
MODIFY COLUMN `bot_id` int(11) NOT NULL DEFAULT 0 AFTER `npc_id`,
|
||||
ADD COLUMN `zone_id` smallint(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `bot_id`,
|
||||
ADD COLUMN `instance_id` smallint(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `zone_id`;
|
||||
|
||||
ALTER TABLE `data_buckets`
|
||||
MODIFY COLUMN `account_id` bigint(11) UNSIGNED NULL DEFAULT 0 AFTER `expires`,
|
||||
MODIFY COLUMN `character_id` bigint(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `account_id`,
|
||||
MODIFY COLUMN `npc_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `character_id`,
|
||||
MODIFY COLUMN `bot_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `npc_id`;
|
||||
|
||||
-- ✅ Create optimized unique index with `key` first
|
||||
CREATE UNIQUE INDEX `keys` ON data_buckets (`key`, character_id, npc_id, bot_id, account_id, zone_id, instance_id);
|
||||
|
||||
-- ✅ Create indexes for just instance_id (instance deletion)
|
||||
CREATE INDEX idx_instance_id ON data_buckets (instance_id);
|
||||
)",
|
||||
.content_schema_update = false
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9307,
|
||||
.description = "2025_02_17_zone_state_spawns.sql",
|
||||
.check = "SHOW TABLES LIKE 'zone_state_spawns'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
CREATE TABLE `zone_state_spawns` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`zone_id` int(11) unsigned DEFAULT NULL,
|
||||
`instance_id` int(11) unsigned DEFAULT NULL,
|
||||
`is_corpse` tinyint(11) DEFAULT 0,
|
||||
`decay_in_seconds` int(11) DEFAULT 0,
|
||||
`npc_id` int(10) unsigned DEFAULT NULL,
|
||||
`spawn2_id` int(10) unsigned NOT NULL,
|
||||
`spawngroup_id` int(10) unsigned NOT NULL,
|
||||
`x` float NOT NULL,
|
||||
`y` float NOT NULL,
|
||||
`z` float NOT NULL,
|
||||
`heading` float NOT NULL,
|
||||
`respawn_time` int(10) unsigned NOT NULL,
|
||||
`variance` int(10) unsigned NOT NULL,
|
||||
`grid` int(10) unsigned DEFAULT 0,
|
||||
`current_waypoint` int(11) DEFAULT 0,
|
||||
`path_when_zone_idle` smallint(6) DEFAULT 0,
|
||||
`condition_id` smallint(5) unsigned DEFAULT 0,
|
||||
`condition_min_value` smallint(6) DEFAULT 0,
|
||||
`enabled` smallint(6) DEFAULT 1,
|
||||
`anim` smallint(5) unsigned DEFAULT 0,
|
||||
`loot_data` text DEFAULT NULL,
|
||||
`entity_variables` text DEFAULT NULL,
|
||||
`buffs` text DEFAULT NULL,
|
||||
`hp` bigint(20) DEFAULT 0,
|
||||
`mana` bigint(20) DEFAULT 0,
|
||||
`endurance` bigint(20) DEFAULT 0,
|
||||
`created_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4
|
||||
)",
|
||||
.content_schema_update = false
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9308,
|
||||
.description = "2025_add_multivalue_support_to_evolving_subtype.sql",
|
||||
.check = "SHOW COLUMNS FROM `items_evolving_details` LIKE 'sub_type'",
|
||||
.condition = "missing",
|
||||
.match = "varchar(200)",
|
||||
.sql = R"(
|
||||
ALTER TABLE `items_evolving_details`
|
||||
CHANGE COLUMN `sub_type` `sub_type` VARCHAR(200) NULL DEFAULT '0' AFTER `type`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
// this one got missed being added to PEQ dumps so adding it again so it gets added when folks take a new release
|
||||
ManifestEntry{
|
||||
.version = 9309,
|
||||
.description = "2025_03_1_create_pet_names_table_if_not_exist.sql",
|
||||
.check = "SHOW TABLES LIKE 'character_pet_name'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
CREATE TABLE `character_pet_name` (
|
||||
`character_id` INT(11) NOT NULL PRIMARY KEY,
|
||||
`name` VARCHAR(64) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
)",
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9310,
|
||||
.description = "2025_03_7_expand_horse_def.sql",
|
||||
.check = "SHOW COLUMNS FROM `horses` LIKE `helmtexture",
|
||||
.condition = "missing",
|
||||
.match = "TINYINT(2)",
|
||||
.sql = R"(
|
||||
ALTER TABLE `horses`
|
||||
ADD COLUMN `helmtexture` TINYINT(2) NOT NULL DEFAULT -1 AFTER `texture`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
// ManifestEntry{
|
||||
// .version = 9228,
|
||||
|
||||
@@ -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/spawn_condition_values_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 <iomanip>
|
||||
@@ -479,6 +479,10 @@ void Database::DeleteInstance(uint16 instance_id)
|
||||
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", 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)
|
||||
@@ -561,6 +565,10 @@ void Database::PurgeExpiredInstances()
|
||||
DynamicZoneMembersRepository::DeleteByManyInstances(*this, 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));
|
||||
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)
|
||||
|
||||
@@ -139,6 +139,7 @@ namespace DatabaseSchema {
|
||||
"character_pet_buffs",
|
||||
"character_pet_info",
|
||||
"character_pet_inventory",
|
||||
"character_pet_name",
|
||||
"character_peqzone_flags",
|
||||
"character_potionbelt",
|
||||
"character_skills",
|
||||
@@ -311,10 +312,9 @@ namespace DatabaseSchema {
|
||||
"completed_shared_task_members",
|
||||
"completed_shared_tasks",
|
||||
"discord_webhooks",
|
||||
"dynamic_zone_lockouts",
|
||||
"dynamic_zone_members",
|
||||
"dynamic_zones",
|
||||
"expedition_lockouts",
|
||||
"expeditions",
|
||||
"gm_ips",
|
||||
"group_id",
|
||||
"group_leaders",
|
||||
@@ -351,6 +351,7 @@ namespace DatabaseSchema {
|
||||
"shared_task_dynamic_zones",
|
||||
"shared_task_members",
|
||||
"shared_tasks",
|
||||
"zone_state_spawns",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -302,7 +302,9 @@ std::string DBcore::Escape(const std::string& s)
|
||||
|
||||
void DBcore::SetMutex(Mutex *mutex)
|
||||
{
|
||||
safe_delete(m_mutex);
|
||||
if (m_mutex && m_mutex != mutex) {
|
||||
safe_delete(m_mutex);
|
||||
}
|
||||
|
||||
DBcore::m_mutex = mutex;
|
||||
}
|
||||
|
||||
+293
-64
@@ -1,11 +1,13 @@
|
||||
#include "dynamic_zone_base.h"
|
||||
#include "database.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "repositories/instance_list_repository.h"
|
||||
#include "repositories/instance_list_player_repository.h"
|
||||
#include "rulesys.h"
|
||||
#include "servertalk.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)
|
||||
{
|
||||
@@ -93,13 +95,15 @@ void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneIn
|
||||
m_zonein.y = dz_entry.zone_in_y;
|
||||
m_zonein.z = dz_entry.zone_in_z;
|
||||
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
|
||||
m_zone_id = dz_entry.zone;
|
||||
m_zone_version = dz_entry.version;
|
||||
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -119,37 +123,40 @@ void DynamicZoneBase::AddMemberFromRepositoryResult(
|
||||
uint32_t DynamicZoneBase::SaveToDatabase()
|
||||
{
|
||||
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
||||
|
||||
if (m_instance_id != 0)
|
||||
if (m_instance_id == 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;
|
||||
}
|
||||
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)
|
||||
@@ -196,10 +203,9 @@ bool DynamicZoneBase::RemoveMember(const DynamicZoneMember& remove_member)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::SwapMember(
|
||||
const DynamicZoneMember& add_member, const std::string& remove_char_name)
|
||||
bool DynamicZoneBase::SwapMember(const DynamicZoneMember& add_member, const std::string& remove_name)
|
||||
{
|
||||
auto remove_member = GetMemberData(remove_char_name);
|
||||
auto remove_member = GetMemberData(remove_name);
|
||||
if (!add_member.IsValid() || !remove_member.IsValid())
|
||||
{
|
||||
return false;
|
||||
@@ -230,9 +236,18 @@ void DynamicZoneBase::RemoveAllMembers()
|
||||
|
||||
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||
{
|
||||
if (members.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
||||
|
||||
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
|
||||
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
||||
@@ -242,12 +257,12 @@ void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
||||
member_entry.dynamic_zone_id = m_id;
|
||||
member_entry.character_id = member.id;
|
||||
insert_members.emplace_back(member_entry);
|
||||
insert_members.push_back(member_entry);
|
||||
|
||||
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
||||
player_entry.id = static_cast<int>(m_instance_id);
|
||||
player_entry.charid = static_cast<int>(member.id);
|
||||
insert_players.emplace_back(player_entry);
|
||||
InstanceListPlayerRepository::InstanceListPlayer player_entry{};
|
||||
player_entry.id = m_instance_id;
|
||||
player_entry.charid = member.id;
|
||||
insert_players.push_back(player_entry);
|
||||
}
|
||||
|
||||
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
||||
@@ -339,6 +354,44 @@ 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
|
||||
{
|
||||
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
||||
@@ -478,13 +531,13 @@ void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
|
||||
), m_members.end());
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasMember(uint32_t character_id)
|
||||
bool DynamicZoneBase::HasMember(uint32_t character_id) const
|
||||
{
|
||||
return std::any_of(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasMember(const std::string& character_name)
|
||||
bool DynamicZoneBase::HasMember(const std::string& character_name) const
|
||||
{
|
||||
return std::any_of(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) {
|
||||
@@ -590,35 +643,34 @@ std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
||||
}
|
||||
}
|
||||
|
||||
EQ::Net::DynamicPacket DynamicZoneBase::GetSerializedDzPacket()
|
||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerPacket(uint16_t zone_id, uint16_t instance_id)
|
||||
{
|
||||
EQ::Net::DynamicPacket dyn_pack;
|
||||
dyn_pack.PutSerialize(0, *this);
|
||||
std::ostringstream ss = GetSerialized();
|
||||
std::string_view sv = ss.view();
|
||||
|
||||
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_size = sizeof(ServerDzCreate_Struct) + sv.size();
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
||||
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
|
||||
buf->origin_zone_id = origin_zone_id;
|
||||
buf->origin_instance_id = origin_instance_id;
|
||||
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
|
||||
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
|
||||
auto buf = reinterpret_cast<ServerDzCreate_Struct*>(pack->pBuffer);
|
||||
buf->origin_zone_id = zone_id;
|
||||
buf->origin_instance_id = instance_id;
|
||||
buf->dz_id = GetID();
|
||||
buf->cereal_size = static_cast<uint32_t>(sv.size());
|
||||
memcpy(buf->cereal_data, sv.data(), sv.size());
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size)
|
||||
std::ostringstream DynamicZoneBase::GetSerialized()
|
||||
{
|
||||
LogDynamicZonesDetail("Deserializing server dz size [{}]", cereal_size);
|
||||
EQ::Util::MemoryStreamReader ss(cereal_data, cereal_size);
|
||||
std::ostringstream ss;
|
||||
cereal::BinaryOutputArchive archive(ss);
|
||||
archive(*this);
|
||||
return ss;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::Unserialize(std::span<char> buf)
|
||||
{
|
||||
EQ::Util::MemoryStreamReader ss(buf.data(), buf.size());
|
||||
cereal::BinaryInputArchive archive(ss);
|
||||
archive(*this);
|
||||
}
|
||||
@@ -647,3 +699,180 @@ void DynamicZoneBase::LoadTemplate(const DynamicZoneTemplatesRepository::Dynamic
|
||||
m_zonein.z = dz_template.zone_in_z;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
+68
-14
@@ -1,8 +1,8 @@
|
||||
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
||||
#define COMMON_DYNAMIC_ZONE_BASE_H
|
||||
|
||||
#include "dynamic_zone_lockout.h"
|
||||
#include "eq_constants.h"
|
||||
#include "net/packet.h"
|
||||
#include "repositories/dynamic_zones_repository.h"
|
||||
#include "repositories/dynamic_zone_members_repository.h"
|
||||
#include "repositories/dynamic_zone_templates_repository.h"
|
||||
@@ -10,12 +10,40 @@
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Database;
|
||||
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
|
||||
{
|
||||
uint32_t id = 0;
|
||||
@@ -93,6 +121,7 @@ public:
|
||||
const std::string& GetName() const { return m_name; }
|
||||
const std::string& GetUUID() const { return m_uuid; }
|
||||
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 DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
||||
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
||||
@@ -104,31 +133,34 @@ public:
|
||||
uint32_t GetDatabaseMemberCount();
|
||||
DynamicZoneMember GetMemberData(uint32_t character_id);
|
||||
DynamicZoneMember GetMemberData(const std::string& character_name);
|
||||
EQ::Net::DynamicPacket GetSerializedDzPacket();
|
||||
std::vector<uint32_t> GetMemberIds();
|
||||
std::ostringstream GetSerialized();
|
||||
bool HasDatabaseMember(uint32_t character_id);
|
||||
bool HasMember(uint32_t character_id);
|
||||
bool HasMember(const std::string& character_name);
|
||||
bool HasMember(uint32_t character_id) const;
|
||||
bool HasMember(const std::string& character_name) const;
|
||||
bool HasMembers() const { return !m_members.empty(); }
|
||||
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 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 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 RemoveAllMembers();
|
||||
bool RemoveMember(uint32_t character_id);
|
||||
bool RemoveMember(const std::string& character_name);
|
||||
bool RemoveMember(const DynamicZoneMember& remove_member);
|
||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||
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 SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
||||
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 SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
||||
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(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);
|
||||
@@ -136,34 +168,48 @@ public:
|
||||
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
||||
void SetZoneInLocation(const DynamicZoneLocation& location, 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_char_name);
|
||||
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_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:
|
||||
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
||||
virtual uint16_t GetCurrentZoneID() { return 0; }
|
||||
virtual uint16_t GetCurrentInstanceID() const { return 0; }
|
||||
virtual uint16_t GetCurrentZoneID() const { return 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 ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
||||
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
|
||||
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
|
||||
virtual bool ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||
virtual void ProcessRemoveAllMembers() { m_members.clear(); }
|
||||
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
|
||||
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
||||
|
||||
void AddLockout(const DzLockout& lockout, bool members_only = false);
|
||||
void AddInternalMember(const DynamicZoneMember& member);
|
||||
uint32_t Create();
|
||||
uint32_t CreateInstance();
|
||||
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
||||
void RemoveInternalMember(uint32_t character_id);
|
||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||
uint32_t SaveToDatabase();
|
||||
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||
|
||||
std::unique_ptr<ServerPacket> CreateServerDzCreatePacket(uint16_t origin_zone_id, uint16_t origin_instance_id);
|
||||
std::unique_ptr<ServerPacket> CreateServerPacket(uint16_t zone_id, uint16_t instance_id);
|
||||
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
||||
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
|
||||
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> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
||||
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_zone_id = 0;
|
||||
@@ -175,6 +221,8 @@ protected:
|
||||
bool m_never_expires = false;
|
||||
bool m_has_zonein = false;
|
||||
bool m_has_member_statuses = false;
|
||||
bool m_is_locked = false;
|
||||
bool m_add_replay = true;
|
||||
std::string m_name;
|
||||
std::string m_uuid;
|
||||
DynamicZoneMember m_leader;
|
||||
@@ -182,12 +230,15 @@ protected:
|
||||
DynamicZoneLocation m_compass;
|
||||
DynamicZoneLocation m_safereturn;
|
||||
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_expire_time;
|
||||
std::vector<DynamicZoneMember> m_members;
|
||||
std::vector<DzLockout> m_lockouts;
|
||||
|
||||
public:
|
||||
void Unserialize(std::span<char> buf);
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive& archive)
|
||||
{
|
||||
@@ -202,6 +253,8 @@ public:
|
||||
m_never_expires,
|
||||
m_has_zonein,
|
||||
m_has_member_statuses,
|
||||
m_is_locked,
|
||||
m_add_replay,
|
||||
m_name,
|
||||
m_uuid,
|
||||
m_leader,
|
||||
@@ -212,7 +265,8 @@ public:
|
||||
m_duration,
|
||||
m_start_time,
|
||||
m_expire_time,
|
||||
m_members
|
||||
m_members,
|
||||
m_lockouts
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
#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&);
|
||||
@@ -0,0 +1,56 @@
|
||||
#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;
|
||||
};
|
||||
@@ -130,6 +130,8 @@ namespace EQ
|
||||
using RoF2::invtype::MAIL_SIZE;
|
||||
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_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::TRADE_NPC_SIZE;
|
||||
|
||||
@@ -473,7 +473,6 @@ N(OP_SendAATable),
|
||||
N(OP_SendCharInfo),
|
||||
N(OP_SendExpZonein),
|
||||
N(OP_SendFindableNPCs),
|
||||
N(OP_SendFindableLocations),
|
||||
N(OP_SendGuildTributes),
|
||||
N(OP_SendLoginInfo),
|
||||
N(OP_SendMaxCharacters),
|
||||
|
||||
@@ -974,25 +974,6 @@ namespace ZoneBlockedSpellTypes {
|
||||
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 StartZoneIndex {
|
||||
Odus = 0,
|
||||
Qeynos,
|
||||
|
||||
+22
-22
@@ -173,7 +173,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,
|
||||
@@ -200,7 +200,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,
|
||||
@@ -227,7 +227,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_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||
Titanium::invtype::OTHER_SIZE
|
||||
Titanium::INULL, Titanium::INULL, Titanium::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
Titanium::invslot::EQUIPMENT_BITMASK,
|
||||
@@ -254,7 +254,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_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||
SoF::invtype::OTHER_SIZE
|
||||
SoF::INULL, SoF::INULL, SoF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
SoF::invslot::EQUIPMENT_BITMASK,
|
||||
@@ -281,7 +281,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_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||
SoD::invtype::OTHER_SIZE
|
||||
SoD::INULL, SoD::INULL, SoD::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
SoD::invslot::EQUIPMENT_BITMASK,
|
||||
@@ -308,7 +308,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_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
||||
UF::INULL, UF::INULL, UF::INULL,
|
||||
UF::invtype::OTHER_SIZE
|
||||
UF::INULL, UF::INULL, UF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
UF::invslot::EQUIPMENT_BITMASK,
|
||||
@@ -335,7 +335,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_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::OTHER_SIZE
|
||||
RoF::INULL,RoF::INULL,RoF::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
RoF::invslot::EQUIPMENT_BITMASK,
|
||||
@@ -362,7 +362,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_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::OTHER_SIZE
|
||||
RoF2::invtype::GUILD_BANK_MAIN_SIZE,RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE, RoF2::invtype::OTHER_SIZE
|
||||
),
|
||||
|
||||
RoF2::invslot::EQUIPMENT_BITMASK,
|
||||
@@ -389,7 +389,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,
|
||||
@@ -416,7 +416,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,
|
||||
@@ -443,7 +443,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,
|
||||
@@ -470,7 +470,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::invslot::EQUIPMENT_BITMASK,
|
||||
@@ -497,7 +497,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,
|
||||
@@ -524,7 +524,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,
|
||||
@@ -551,7 +551,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,
|
||||
@@ -578,7 +578,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,
|
||||
@@ -605,7 +605,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_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||
Titanium::INULL
|
||||
Titanium::INULL, Titanium::INULL, Titanium::INULL
|
||||
),
|
||||
|
||||
Titanium::INULL,
|
||||
@@ -632,7 +632,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_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||
SoF::INULL
|
||||
SoF::INULL, SoF::INULL, SoF::INULL
|
||||
),
|
||||
|
||||
SoF::INULL,
|
||||
@@ -659,7 +659,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_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||
SoD::INULL
|
||||
SoD::INULL, SoD::INULL, SoD::INULL
|
||||
),
|
||||
|
||||
SoD::INULL,
|
||||
@@ -686,7 +686,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_LIMBO_SIZE, UF::INULL, UF::INULL,
|
||||
UF::INULL, UF::INULL, UF::INULL,
|
||||
UF::INULL
|
||||
UF::INULL, UF::INULL, UF::INULL
|
||||
),
|
||||
|
||||
UF::INULL,
|
||||
@@ -713,7 +713,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_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
||||
RoF::INULL, RoF::INULL, RoF::INULL,
|
||||
RoF::INULL
|
||||
RoF::INULL, RoF::INULL, RoF::INULL
|
||||
),
|
||||
|
||||
RoF::INULL,
|
||||
@@ -740,7 +740,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_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
||||
RoF2::INULL
|
||||
RoF2::INULL, RoF2::INULL, RoF2::INULL
|
||||
),
|
||||
|
||||
RoF2::INULL,
|
||||
|
||||
+3
-3
@@ -87,7 +87,7 @@ namespace EQ
|
||||
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
||||
int16 ViewMODLimbo, AltStorage, Archived;
|
||||
int16 Mail, GuildTrophyTribute, Krono;
|
||||
int16 Other;
|
||||
int16 GuildBankMain,GuildBankDeposit, Other;
|
||||
|
||||
InventoryTypeSize_Struct(
|
||||
int16 Possessions, int16 Bank, int16 SharedBank,
|
||||
@@ -98,7 +98,7 @@ namespace EQ
|
||||
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
||||
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
||||
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
||||
int16 Other
|
||||
int16 GuildBankMain,int16 GuildBankDeposit, int16 Other
|
||||
) :
|
||||
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
||||
Trade(Trade), World(World), Limbo(Limbo),
|
||||
@@ -108,7 +108,7 @@ namespace EQ
|
||||
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
||||
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
||||
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
||||
Other(Other)
|
||||
GuildBankMain(GuildBankMain), GuildBankDeposit(GuildBankDeposit), Other(Other)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
+54
-45
@@ -19,17 +19,17 @@
|
||||
#ifndef EQ_PACKET_STRUCTS_H
|
||||
#define EQ_PACKET_STRUCTS_H
|
||||
|
||||
#include "types.h"
|
||||
#include <list>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <time.h>
|
||||
#include "../common/version.h"
|
||||
#include "emu_constants.h"
|
||||
#include "textures.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 "emu_constants.h"
|
||||
#include "textures.h"
|
||||
#include "types.h"
|
||||
|
||||
static const uint32 BUFF_COUNT = 42;
|
||||
static const uint32 PET_BUFF_COUNT = 30;
|
||||
@@ -47,7 +47,7 @@ static const uint32 ADVANCED_LORE_LENGTH = 8192;
|
||||
*/
|
||||
#pragma pack(1)
|
||||
|
||||
struct LoginInfo_Struct {
|
||||
struct LoginInfo {
|
||||
/*000*/ char login_info[64];
|
||||
/*064*/ uint8 unknown064[124];
|
||||
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
||||
@@ -5529,56 +5529,65 @@ struct GuildBankWithdrawItem_Struct
|
||||
|
||||
struct GuildBankItemUpdate_Struct
|
||||
{
|
||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||
void Init(
|
||||
uint32 inAction,
|
||||
uint32 inUnknown004,
|
||||
uint16 inSlotID,
|
||||
uint16 inArea,
|
||||
uint16 inUnknown012,
|
||||
uint32 inItemID,
|
||||
uint32 inIcon,
|
||||
uint32 inQuantity,
|
||||
uint32 inPermissions,
|
||||
uint32 inAllowMerge,
|
||||
bool inUseable)
|
||||
{
|
||||
Action = inAction;
|
||||
Unknown004 = inUnknown004;
|
||||
SlotID = inSlotID;
|
||||
Area = inArea;
|
||||
Unknown012 = inUnknown012;
|
||||
ItemID = inItemID;
|
||||
Icon = inIcon;
|
||||
Quantity = inQuantity;
|
||||
Permissions = inPermissions;
|
||||
AllowMerge = inAllowMerge;
|
||||
Useable = inUseable;
|
||||
ItemName[0] = '\0';
|
||||
Donator[0] = '\0';
|
||||
WhoFor[0] = '\0';
|
||||
action = inAction;
|
||||
unknown004 = inUnknown004;
|
||||
slot_id = inSlotID;
|
||||
area = inArea;
|
||||
display = inUnknown012;
|
||||
item_id = inItemID;
|
||||
icon_id = inIcon;
|
||||
quantity = inQuantity;
|
||||
permissions = inPermissions;
|
||||
allow_merge = inAllowMerge;
|
||||
is_useable = inUseable;
|
||||
item_name[0] = '\0';
|
||||
donator[0] = '\0';
|
||||
who_for[0] = '\0';
|
||||
};
|
||||
|
||||
/*000*/ uint32 Action;
|
||||
/*004*/ uint32 Unknown004;
|
||||
/*008*/ uint16 SlotID;
|
||||
/*010*/ uint16 Area;
|
||||
/*012*/ uint32 Unknown012;
|
||||
/*016*/ uint32 ItemID;
|
||||
/*020*/ uint32 Icon;
|
||||
/*024*/ uint32 Quantity;
|
||||
/*028*/ uint32 Permissions;
|
||||
/*032*/ uint8 AllowMerge;
|
||||
/*033*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*034*/ char ItemName[64];
|
||||
/*098*/ char Donator[64];
|
||||
/*162*/ char WhoFor[64];
|
||||
/*226*/ uint16 Unknown226;
|
||||
/*000*/ uint32 action;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint16 slot_id;
|
||||
/*010*/ uint16 area;
|
||||
/*012*/ uint32 display;
|
||||
/*016*/ uint32 item_id;
|
||||
/*020*/ uint32 icon_id;
|
||||
/*024*/ uint32 quantity;
|
||||
/*028*/ uint32 permissions;
|
||||
/*032*/ uint8 allow_merge;
|
||||
/*033*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*034*/ char item_name[64];
|
||||
/*098*/ char donator[64];
|
||||
/*162*/ char who_for[64];
|
||||
/*226*/ uint16 unknown226;
|
||||
};
|
||||
|
||||
// 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
|
||||
struct GuildBankItemListEntry_Struct
|
||||
{
|
||||
uint8 vaild;
|
||||
struct GuildBankItemListEntry_Struct {
|
||||
uint8 vaild;
|
||||
uint32 permissions;
|
||||
char whofor[64];
|
||||
char donator[64];
|
||||
char whofor[64];
|
||||
char donator[64];
|
||||
uint32 item_id;
|
||||
uint32 item_icon;
|
||||
uint32 quantity;
|
||||
uint8 allow_merge; // 1 here for non-full stacks
|
||||
uint8 usable;
|
||||
char item_name[64];
|
||||
uint8 allow_merge; // 1 here for non-full stacks
|
||||
uint8 usable;
|
||||
char item_name[64];
|
||||
};
|
||||
|
||||
struct GuildBankClear_Struct
|
||||
|
||||
@@ -614,7 +614,7 @@ void EQEmuLogSys::EnableConsoleLogging()
|
||||
std::copy(std::begin(pre_silence_settings), std::end(pre_silence_settings), std::begin(log_settings));
|
||||
}
|
||||
|
||||
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
||||
{
|
||||
InjectTablesIfNotExist();
|
||||
|
||||
@@ -699,6 +699,10 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
return this;
|
||||
}
|
||||
|
||||
if (silent_load) {
|
||||
SilenceConsoleLogging();
|
||||
}
|
||||
|
||||
LogInfo("Loaded [{}] log categories", categories.size());
|
||||
|
||||
auto webhooks = DiscordWebhooksRepository::GetWhere(*m_database, fmt::format("id < {}", MAX_DISCORD_WEBHOOK_ID));
|
||||
@@ -716,6 +720,10 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
log_settings[Logs::Info].log_to_file = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
|
||||
|
||||
if (silent_load) {
|
||||
SilenceConsoleLogging();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ namespace Logs {
|
||||
BotSpellChecks,
|
||||
BotSpellTypeChecks,
|
||||
NpcHandin,
|
||||
ZoneState,
|
||||
MaxCategoryID /* Don't Remove this */
|
||||
};
|
||||
|
||||
@@ -256,7 +257,8 @@ namespace Logs {
|
||||
"Bot Settings",
|
||||
"Bot Spell Checks",
|
||||
"Bot Spell Type Checks",
|
||||
"NpcHandin"
|
||||
"NpcHandin",
|
||||
"ZoneState"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -277,7 +279,7 @@ public:
|
||||
*/
|
||||
void CloseFileLogs();
|
||||
EQEmuLogSys *LoadLogSettingsDefaults();
|
||||
EQEmuLogSys *LoadLogDatabaseSettings();
|
||||
EQEmuLogSys *LoadLogDatabaseSettings(bool silent_load = false);
|
||||
|
||||
/**
|
||||
* @param directory_name
|
||||
|
||||
@@ -914,6 +914,16 @@
|
||||
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 {\
|
||||
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
|
||||
@@ -81,14 +81,13 @@ void PlayerEventLogs::Init()
|
||||
if (!settings_to_insert.empty()) {
|
||||
PlayerEventLogSettingsRepository::ReplaceMany(*m_database, settings_to_insert);
|
||||
}
|
||||
|
||||
LoadEtlIds();
|
||||
|
||||
|
||||
bool processing_in_world = !RuleB(Logging, PlayerEventsQSProcess) && IsWorld();
|
||||
bool processing_in_qs = RuleB(Logging, PlayerEventsQSProcess) && IsQueryServ();
|
||||
|
||||
// on initial boot process truncation
|
||||
if (processing_in_world || processing_in_qs) {
|
||||
LoadEtlIds();
|
||||
ProcessRetentionTruncation();
|
||||
}
|
||||
}
|
||||
@@ -402,7 +401,7 @@ void PlayerEventLogs::ProcessBatchQueue()
|
||||
r.event_data = "{}"; // Clear event data
|
||||
}
|
||||
else {
|
||||
LogError("Non-Implemented ETL routing [{}]", r.event_type_id);
|
||||
LogPlayerEventsDetail("Non-Implemented ETL routing [{}]", r.event_type_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,9 @@ namespace PlayerEvent {
|
||||
BARTER_TRANSACTION,
|
||||
SPEECH,
|
||||
EVOLVE_ITEM,
|
||||
GUILD_BANK_DEPOSIT,
|
||||
GUILD_BANK_WITHDRAWAL,
|
||||
GUILD_BANK_MOVE_TO_BANK_AREA,
|
||||
MAX // dont remove
|
||||
};
|
||||
|
||||
@@ -129,7 +132,10 @@ namespace PlayerEvent {
|
||||
"Parcel Prune Routine",
|
||||
"Barter Transaction",
|
||||
"Player Speech",
|
||||
"Evolve Item Update"
|
||||
"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
|
||||
@@ -875,8 +881,9 @@ namespace PlayerEvent {
|
||||
uint32 trader_id;
|
||||
std::string trader_name;
|
||||
uint32 price;
|
||||
uint32 charges;
|
||||
uint32 total_cost;
|
||||
uint32 quantity;
|
||||
int32 charges;
|
||||
uint64 total_cost;
|
||||
uint64 player_money_balance;
|
||||
|
||||
|
||||
@@ -896,6 +903,7 @@ namespace PlayerEvent {
|
||||
CEREAL_NVP(trader_id),
|
||||
CEREAL_NVP(trader_name),
|
||||
CEREAL_NVP(price),
|
||||
CEREAL_NVP(quantity),
|
||||
CEREAL_NVP(charges),
|
||||
CEREAL_NVP(total_cost),
|
||||
CEREAL_NVP(player_money_balance)
|
||||
@@ -915,8 +923,9 @@ namespace PlayerEvent {
|
||||
uint32 buyer_id;
|
||||
std::string buyer_name;
|
||||
uint32 price;
|
||||
uint32 charges;
|
||||
uint32 total_cost;
|
||||
uint32 quantity;
|
||||
int32 charges;
|
||||
uint64 total_cost;
|
||||
uint64 player_money_balance;
|
||||
|
||||
|
||||
@@ -936,6 +945,7 @@ namespace PlayerEvent {
|
||||
CEREAL_NVP(buyer_id),
|
||||
CEREAL_NVP(buyer_name),
|
||||
CEREAL_NVP(price),
|
||||
CEREAL_NVP(quantity),
|
||||
CEREAL_NVP(charges),
|
||||
CEREAL_NVP(total_cost),
|
||||
CEREAL_NVP(player_money_balance)
|
||||
@@ -1145,6 +1155,7 @@ namespace PlayerEvent {
|
||||
uint32 augment_5_id;
|
||||
uint32 augment_6_id;
|
||||
uint32 quantity;
|
||||
int32 charges;
|
||||
std::string from_player_name;
|
||||
std::string to_player_name;
|
||||
uint32 sent_date;
|
||||
@@ -1162,6 +1173,7 @@ namespace PlayerEvent {
|
||||
CEREAL_NVP(augment_5_id),
|
||||
CEREAL_NVP(augment_6_id),
|
||||
CEREAL_NVP(quantity),
|
||||
CEREAL_NVP(charges),
|
||||
CEREAL_NVP(from_player_name),
|
||||
CEREAL_NVP(to_player_name),
|
||||
CEREAL_NVP(sent_date)
|
||||
@@ -1274,6 +1286,38 @@ namespace PlayerEvent {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
+12
-13
@@ -39,6 +39,7 @@
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@@ -90,23 +91,21 @@ std::string File::GetCwd()
|
||||
|
||||
FileContentsResult File::GetContents(const std::string &file_name)
|
||||
{
|
||||
std::string error;
|
||||
std::ifstream f;
|
||||
f.open(file_name);
|
||||
std::string line;
|
||||
std::string lines;
|
||||
if (f.is_open()) {
|
||||
while (f) {
|
||||
std::getline(f, line);
|
||||
lines += line + "\n";
|
||||
}
|
||||
std::ifstream f(file_name, std::ios::in | std::ios::binary);
|
||||
if (!f) {
|
||||
return { .error = fmt::format("Couldn't open file [{}]", file_name) };
|
||||
}
|
||||
else {
|
||||
error = fmt::format("Couldn't open file [{}]", file_name);
|
||||
|
||||
constexpr size_t CHUNK_SIZE = 4096; // Read 4KB chunks
|
||||
std::string lines;
|
||||
std::vector<char> buffer(CHUNK_SIZE);
|
||||
|
||||
while (f.read(buffer.data(), CHUNK_SIZE) || f.gcount() > 0) {
|
||||
lines.append(buffer.data(), f.gcount());
|
||||
}
|
||||
|
||||
return FileContentsResult{
|
||||
.contents = lines,
|
||||
.error = error,
|
||||
.error = {}
|
||||
};
|
||||
}
|
||||
|
||||
+28
-26
@@ -547,60 +547,62 @@ uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader)
|
||||
|
||||
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) {
|
||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||
if (!bank_items.empty()) {
|
||||
LogError(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
LogGuilds(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
std::map<uint32, GuildInfo *>::iterator res;
|
||||
res = m_guilds.find(guild_id);
|
||||
if (res != m_guilds.end()) {
|
||||
delete res->second;
|
||||
m_guilds.erase(res);
|
||||
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
||||
//Does this need to be sent to world?
|
||||
}
|
||||
|
||||
auto res = m_guilds.find(guild_id);
|
||||
if (res != m_guilds.end()) {
|
||||
safe_delete(res->second);
|
||||
m_guilds.erase(res);
|
||||
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
||||
// Does this need to be sent to world?
|
||||
}
|
||||
}
|
||||
|
||||
if (db_delete) {
|
||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||
if (!bank_items.empty()) {
|
||||
LogError(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
LogGuilds(
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||
"again.",
|
||||
guild_id,
|
||||
bank_items.size()
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
auto where_filter = fmt::format("guild_id = {}", guild_id);
|
||||
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildsRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildPermissionsRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
||||
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
||||
}
|
||||
|
||||
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildsRepository::DeleteOne(*m_db, guild_id);
|
||||
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildPermissionsRepository::DeleteWhere(*m_db, where_filter);
|
||||
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
||||
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2028,3 +2028,57 @@ int16 EQ::InventoryProfile::_HasEvolvingItem(ItemInstQueue &iqueue, uint64 evolv
|
||||
|
||||
return INVALID_INDEX;
|
||||
}
|
||||
|
||||
|
||||
int16 EQ::InventoryProfile::FindFirstFreeSlotThatFitsItemWithStacking(ItemInstance *item_inst) const
|
||||
{
|
||||
auto item_data = item_inst->GetItem();
|
||||
if (!item_data) {
|
||||
return INVALID_INDEX;
|
||||
}
|
||||
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
auto const inv_item = GetItem(i);
|
||||
if (!inv_item) {
|
||||
// Found available slot in personal inventory
|
||||
// Anything will fit here
|
||||
return i;
|
||||
}
|
||||
|
||||
if (item_data->IsClassBag() && item_inst->IsNoneEmptyContainer()) {
|
||||
// If the inbound item is a bag with items, it cannot be stored within a bag
|
||||
// Move to next potential slot
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inv_item->GetID() == item_data->ID && item_data->Stackable) {
|
||||
if (item_inst->GetCharges() + inv_item->GetCharges() <= item_data->StackSize) {
|
||||
// Found a personal inventory slot that has room for a stackable addition
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
if (inv_item->IsClassBag() && CanItemFitInContainer(item_data, inv_item->GetItem())) {
|
||||
int16 const base_slot_id = CalcSlotId(i, invbag::SLOT_BEGIN);
|
||||
uint8 const bag_size = inv_item->GetItem()->BagSlots;
|
||||
uint8 const item_size = item_data->Size;
|
||||
|
||||
for (uint8 bag_slot = invbag::SLOT_BEGIN; bag_slot < bag_size; bag_slot++) {
|
||||
auto bag_item = GetItem(base_slot_id + bag_slot);
|
||||
if (!bag_item) {
|
||||
// Found available slot within bag that will hold inbound item
|
||||
return base_slot_id + bag_slot;
|
||||
}
|
||||
|
||||
if (bag_item && item_data->Stackable && bag_item->GetID() == item_data->ID) {
|
||||
if (item_inst->GetCharges() + bag_item->GetCharges() <= item_data->StackSize) {
|
||||
// Found a bag slot has room for a stackable addition
|
||||
return base_slot_id + bag_slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
}
|
||||
|
||||
@@ -179,6 +179,7 @@ namespace EQ
|
||||
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 FindFirstFreeSlotThatFitsItem(const EQ::ItemData *inst);
|
||||
int16 FindFirstFreeSlotThatFitsItemWithStacking(ItemInstance *inst) const;
|
||||
|
||||
// Calculate slot_id for an item within a bag
|
||||
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
||||
|
||||
@@ -259,3 +259,76 @@ 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
|
||||
}
|
||||
|
||||
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,6 +37,7 @@ public:
|
||||
int port
|
||||
);
|
||||
static bool IsIPAddress(const std::string &ip_address);
|
||||
static bool IsPortInUse(const std::string& ip, int port);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ struct LootItem {
|
||||
uint16 trivial_max_level;
|
||||
uint16 npc_min_level;
|
||||
uint16 npc_max_level;
|
||||
uint32 lootdrop_id; // required for zone state referencing
|
||||
};
|
||||
|
||||
typedef std::list<LootItem*> LootItems;
|
||||
|
||||
@@ -25,7 +25,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
||||
return;
|
||||
|
||||
if (opcode == ServerOP_UsertoWorldReq) {
|
||||
auto req_in = (UsertoWorldRequest_Struct*)p.Data();
|
||||
auto req_in = (UsertoWorldRequest*)p.Data();
|
||||
|
||||
EQ::Net::DynamicPacket req;
|
||||
size_t i = 0;
|
||||
@@ -45,7 +45,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
||||
}
|
||||
|
||||
if (opcode == ServerOP_LSClientAuth) {
|
||||
auto req_in = (ClientAuth_Struct*)p.Data();
|
||||
auto req_in = (ClientAuth*)p.Data();
|
||||
|
||||
EQ::Net::DynamicPacket req;
|
||||
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.PutUInt8(i, req_in->lsadmin); i += 1;
|
||||
req.PutUInt16(i, req_in->is_world_admin); i += 2;
|
||||
req.PutUInt32(i, req_in->ip); i += 4;
|
||||
req.PutUInt32(i, req_in->ip_address); i += 4;
|
||||
req.PutUInt8(i, req_in->is_client_from_local_network); i += 1;
|
||||
|
||||
EQ::Net::DynamicPacket out;
|
||||
|
||||
+16
-16
@@ -1213,22 +1213,22 @@ namespace RoF
|
||||
case 1: { // GuildBankItemUpdate
|
||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||
eq->Action = 0;
|
||||
OUT(Unknown004);
|
||||
eq->Unknown08 = 0;
|
||||
OUT(SlotID);
|
||||
OUT(Area);
|
||||
OUT(Unknown012);
|
||||
OUT(ItemID);
|
||||
OUT(Icon);
|
||||
OUT(Quantity);
|
||||
OUT(Permissions);
|
||||
OUT(AllowMerge);
|
||||
OUT(Useable);
|
||||
OUT_str(ItemName);
|
||||
OUT_str(Donator);
|
||||
OUT_str(WhoFor);
|
||||
OUT(Unknown226);
|
||||
eq->action = 0;
|
||||
OUT(unknown004);
|
||||
eq->unknown008 = 0;
|
||||
OUT(slot_id);
|
||||
OUT(area);
|
||||
OUT(display);
|
||||
OUT(item_id);
|
||||
OUT(icon_id);
|
||||
OUT(quantity);
|
||||
OUT(permissions);
|
||||
OUT(allow_merge);
|
||||
OUT(is_useable);
|
||||
OUT_str(item_name);
|
||||
OUT_str(donator);
|
||||
OUT_str(who_for);
|
||||
OUT(unknown226);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
+13
-16
@@ -1743,22 +1743,19 @@ namespace RoF2
|
||||
case 1: { // GuildBankItemUpdate
|
||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||
eq->Action = 0;
|
||||
OUT(Unknown004);
|
||||
eq->Unknown08 = 0;
|
||||
OUT(SlotID);
|
||||
OUT(Area);
|
||||
OUT(Unknown012);
|
||||
OUT(ItemID);
|
||||
OUT(Icon);
|
||||
OUT(Quantity);
|
||||
OUT(Permissions);
|
||||
OUT(AllowMerge);
|
||||
OUT(Useable);
|
||||
OUT_str(ItemName);
|
||||
OUT_str(Donator);
|
||||
OUT_str(WhoFor);
|
||||
OUT(Unknown226);
|
||||
eq->action = 0;
|
||||
OUT(display);
|
||||
OUT(slot_id);
|
||||
OUT(area);
|
||||
OUT(item_id);
|
||||
OUT(icon_id);
|
||||
OUT(quantity);
|
||||
OUT(permissions);
|
||||
OUT(allow_merge);
|
||||
OUT(is_useable);
|
||||
OUT_str(item_name);
|
||||
OUT_str(donator);
|
||||
OUT_str(who_for);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -101,6 +101,8 @@ namespace RoF2
|
||||
const int16 MAIL_SIZE = 0;//unknown
|
||||
const int16 GUILD_TROPHY_TRIBUTE_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 TRADE_NPC_SIZE = 4; // defined by implication
|
||||
|
||||
@@ -1965,41 +1965,39 @@ struct GuildBankWithdrawItem_Struct
|
||||
|
||||
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 inUnknown016, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||
{
|
||||
Action = inAction;
|
||||
Unknown004 = inUnknown004;
|
||||
SlotID = inSlotID;
|
||||
Area = inArea;
|
||||
Unknown012 = inUnknown012;
|
||||
ItemID = inItemID;
|
||||
Icon = inIcon;
|
||||
Quantity = inQuantity;
|
||||
Permissions = inPermissions;
|
||||
AllowMerge = inAllowMerge;
|
||||
Useable = inUseable;
|
||||
ItemName[0] = '\0';
|
||||
Donator[0] = '\0';
|
||||
WhoFor[0] = '\0';
|
||||
action = inAction;
|
||||
slot_id = inSlotID;
|
||||
area = inArea;
|
||||
display = inUnknown016;
|
||||
item_id = inItemID;
|
||||
icon_id = inIcon;
|
||||
quantity = inQuantity;
|
||||
permissions = inPermissions;
|
||||
allow_merge = inAllowMerge;
|
||||
is_useable = inUseable;
|
||||
item_name[0] = '\0';
|
||||
donator[0] = '\0';
|
||||
who_for[0] = '\0';
|
||||
};
|
||||
|
||||
/*000*/ uint32 Action;
|
||||
/*004*/ uint32 Unknown004;
|
||||
/*008*/ uint32 Unknown08;
|
||||
/*012*/ uint16 SlotID;
|
||||
/*014*/ uint16 Area;
|
||||
/*016*/ uint32 Unknown012;
|
||||
/*020*/ uint32 ItemID;
|
||||
/*024*/ uint32 Icon;
|
||||
/*028*/ uint32 Quantity;
|
||||
/*032*/ uint32 Permissions;
|
||||
/*036*/ uint8 AllowMerge;
|
||||
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char ItemName[64];
|
||||
/*102*/ char Donator[64];
|
||||
/*166*/ char WhoFor[64];
|
||||
/*230*/ uint16 Unknown226;
|
||||
/*000*/ uint32 action;
|
||||
/*004*/ uint32 not_used004; //disassemble of client did not use this
|
||||
/*008*/ uint32 not_used008; //disassemble of client did not use this
|
||||
/*012*/ uint16 slot_id;
|
||||
/*014*/ uint16 area;
|
||||
/*016*/ uint32 display;
|
||||
/*020*/ uint32 item_id;
|
||||
/*024*/ uint32 icon_id;
|
||||
/*028*/ uint32 quantity;
|
||||
/*032*/ uint32 permissions;
|
||||
/*036*/ uint8 allow_merge;
|
||||
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char item_name[64];
|
||||
/*102*/ char donator[64];
|
||||
/*166*/ char who_for[64];
|
||||
};
|
||||
|
||||
struct GuildBankClear_Struct
|
||||
|
||||
@@ -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,
|
||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||
{
|
||||
Action = inAction;
|
||||
Unknown004 = inUnknown004;
|
||||
SlotID = inSlotID;
|
||||
Area = inArea;
|
||||
Unknown012 = inUnknown012;
|
||||
ItemID = inItemID;
|
||||
Icon = inIcon;
|
||||
Quantity = inQuantity;
|
||||
Permissions = inPermissions;
|
||||
AllowMerge = inAllowMerge;
|
||||
Useable = inUseable;
|
||||
ItemName[0] = '\0';
|
||||
Donator[0] = '\0';
|
||||
WhoFor[0] = '\0';
|
||||
action = inAction;
|
||||
unknown004 = inUnknown004;
|
||||
slot_id = inSlotID;
|
||||
area = inArea;
|
||||
display = inUnknown012;
|
||||
item_id = inItemID;
|
||||
icon_id = inIcon;
|
||||
quantity = inQuantity;
|
||||
permissions = inPermissions;
|
||||
allow_merge = inAllowMerge;
|
||||
is_useable = inUseable;
|
||||
item_name[0] = '\0';
|
||||
donator[0] = '\0';
|
||||
who_for[0] = '\0';
|
||||
};
|
||||
|
||||
/*000*/ uint32 Action;
|
||||
/*004*/ uint32 Unknown004;
|
||||
/*008*/ uint32 Unknown08;
|
||||
/*012*/ uint16 SlotID;
|
||||
/*014*/ uint16 Area;
|
||||
/*016*/ uint32 Unknown012;
|
||||
/*020*/ uint32 ItemID;
|
||||
/*024*/ uint32 Icon;
|
||||
/*028*/ uint32 Quantity;
|
||||
/*032*/ uint32 Permissions;
|
||||
/*036*/ uint8 AllowMerge;
|
||||
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char ItemName[64];
|
||||
/*102*/ char Donator[64];
|
||||
/*166*/ char WhoFor[64];
|
||||
/*230*/ uint16 Unknown226;
|
||||
/*000*/ uint32 action;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ uint16 slot_id;
|
||||
/*014*/ uint16 area;
|
||||
/*016*/ uint32 display;
|
||||
/*020*/ uint32 item_id;
|
||||
/*024*/ uint32 icon_id;
|
||||
/*028*/ uint32 quantity;
|
||||
/*032*/ uint32 permissions;
|
||||
/*036*/ uint8 allow_merge;
|
||||
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||
/*038*/ char item_name[64];
|
||||
/*102*/ char donator[64];
|
||||
/*166*/ char who_for[64];
|
||||
/*230*/ uint16 unknown226;
|
||||
};
|
||||
|
||||
struct GuildBankClear_Struct
|
||||
|
||||
@@ -76,7 +76,7 @@ void PathManager::LoadPaths()
|
||||
constexpr int path_width = 0;
|
||||
constexpr int break_length = 70;
|
||||
|
||||
std::cout << std::endl;
|
||||
LogInfo("Loading server paths");
|
||||
LogInfo("{}", Strings::Repeat("-", break_length));
|
||||
for (const auto& [name, in_path] : paths) {
|
||||
if (!in_path.empty()) {
|
||||
|
||||
@@ -23,10 +23,12 @@ public:
|
||||
std::string key_;
|
||||
std::string value;
|
||||
uint32_t expires;
|
||||
int64_t account_id;
|
||||
int64_t character_id;
|
||||
int64_t npc_id;
|
||||
int64_t bot_id;
|
||||
uint64_t account_id;
|
||||
uint64_t character_id;
|
||||
uint32_t npc_id;
|
||||
uint32_t bot_id;
|
||||
uint16_t zone_id;
|
||||
uint16_t instance_id;
|
||||
|
||||
// cereal
|
||||
template<class Archive>
|
||||
@@ -40,7 +42,9 @@ public:
|
||||
CEREAL_NVP(account_id),
|
||||
CEREAL_NVP(character_id),
|
||||
CEREAL_NVP(npc_id),
|
||||
CEREAL_NVP(bot_id)
|
||||
CEREAL_NVP(bot_id),
|
||||
CEREAL_NVP(zone_id),
|
||||
CEREAL_NVP(instance_id)
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -61,6 +65,8 @@ public:
|
||||
"character_id",
|
||||
"npc_id",
|
||||
"bot_id",
|
||||
"zone_id",
|
||||
"instance_id",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -75,6 +81,8 @@ public:
|
||||
"character_id",
|
||||
"npc_id",
|
||||
"bot_id",
|
||||
"zone_id",
|
||||
"instance_id",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -123,6 +131,8 @@ public:
|
||||
e.character_id = 0;
|
||||
e.npc_id = 0;
|
||||
e.bot_id = 0;
|
||||
e.zone_id = 0;
|
||||
e.instance_id = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -163,10 +173,12 @@ public:
|
||||
e.key_ = row[1] ? row[1] : "";
|
||||
e.value = row[2] ? row[2] : "";
|
||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
||||
e.account_id = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
||||
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
||||
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(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;
|
||||
}
|
||||
@@ -207,6 +219,8 @@ public:
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.character_id));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.npc_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(
|
||||
fmt::format(
|
||||
@@ -236,6 +250,8 @@ public:
|
||||
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.bot_id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -273,6 +289,8 @@ public:
|
||||
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.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) + ")");
|
||||
}
|
||||
@@ -310,10 +328,12 @@ public:
|
||||
e.key_ = row[1] ? row[1] : "";
|
||||
e.value = row[2] ? row[2] : "";
|
||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
||||
e.account_id = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
||||
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
||||
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(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);
|
||||
}
|
||||
@@ -342,10 +362,12 @@ public:
|
||||
e.key_ = row[1] ? row[1] : "";
|
||||
e.value = row[2] ? row[2] : "";
|
||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
||||
e.account_id = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
||||
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
||||
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(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);
|
||||
}
|
||||
@@ -428,6 +450,8 @@ public:
|
||||
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.bot_id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -458,6 +482,8 @@ public:
|
||||
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.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) + ")");
|
||||
}
|
||||
|
||||
+44
-44
@@ -9,18 +9,18 @@
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
#define EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
#ifndef EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||
#define EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseExpeditionLockoutsRepository {
|
||||
class BaseDynamicZoneLockoutsRepository {
|
||||
public:
|
||||
struct ExpeditionLockouts {
|
||||
struct DynamicZoneLockouts {
|
||||
uint32_t id;
|
||||
uint32_t expedition_id;
|
||||
uint32_t dynamic_zone_id;
|
||||
std::string event_name;
|
||||
time_t expire_time;
|
||||
uint32_t duration;
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"expedition_id",
|
||||
"dynamic_zone_id",
|
||||
"event_name",
|
||||
"expire_time",
|
||||
"duration",
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"expedition_id",
|
||||
"dynamic_zone_id",
|
||||
"event_name",
|
||||
"UNIX_TIMESTAMP(expire_time)",
|
||||
"duration",
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("expedition_lockouts");
|
||||
return std::string("dynamic_zone_lockouts");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
@@ -89,12 +89,12 @@ public:
|
||||
);
|
||||
}
|
||||
|
||||
static ExpeditionLockouts NewEntity()
|
||||
static DynamicZoneLockouts NewEntity()
|
||||
{
|
||||
ExpeditionLockouts e{};
|
||||
DynamicZoneLockouts e{};
|
||||
|
||||
e.id = 0;
|
||||
e.expedition_id = 0;
|
||||
e.dynamic_zone_id = 0;
|
||||
e.event_name = "";
|
||||
e.expire_time = std::time(nullptr);
|
||||
e.duration = 0;
|
||||
@@ -103,23 +103,23 @@ public:
|
||||
return e;
|
||||
}
|
||||
|
||||
static ExpeditionLockouts GetExpeditionLockouts(
|
||||
const std::vector<ExpeditionLockouts> &expedition_lockoutss,
|
||||
int expedition_lockouts_id
|
||||
static DynamicZoneLockouts GetDynamicZoneLockouts(
|
||||
const std::vector<DynamicZoneLockouts> &dynamic_zone_lockoutss,
|
||||
int dynamic_zone_lockouts_id
|
||||
)
|
||||
{
|
||||
for (auto &expedition_lockouts : expedition_lockoutss) {
|
||||
if (expedition_lockouts.id == expedition_lockouts_id) {
|
||||
return expedition_lockouts;
|
||||
for (auto &dynamic_zone_lockouts : dynamic_zone_lockoutss) {
|
||||
if (dynamic_zone_lockouts.id == dynamic_zone_lockouts_id) {
|
||||
return dynamic_zone_lockouts;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static ExpeditionLockouts FindOne(
|
||||
static DynamicZoneLockouts FindOne(
|
||||
Database& db,
|
||||
int expedition_lockouts_id
|
||||
int dynamic_zone_lockouts_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
@@ -127,16 +127,16 @@ public:
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
expedition_lockouts_id
|
||||
dynamic_zone_lockouts_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
ExpeditionLockouts e{};
|
||||
DynamicZoneLockouts e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.expedition_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.event_name = row[2] ? row[2] : "";
|
||||
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;
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int expedition_lockouts_id
|
||||
int dynamic_zone_lockouts_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
expedition_lockouts_id
|
||||
dynamic_zone_lockouts_id
|
||||
)
|
||||
);
|
||||
|
||||
@@ -167,14 +167,14 @@ public:
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const ExpeditionLockouts &e
|
||||
const DynamicZoneLockouts &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.expedition_id));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.dynamic_zone_id));
|
||||
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[4] + " = " + std::to_string(e.duration));
|
||||
@@ -193,15 +193,15 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static ExpeditionLockouts InsertOne(
|
||||
static DynamicZoneLockouts InsertOne(
|
||||
Database& db,
|
||||
ExpeditionLockouts e
|
||||
DynamicZoneLockouts e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.expedition_id));
|
||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||
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(std::to_string(e.duration));
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<ExpeditionLockouts> &entries
|
||||
const std::vector<DynamicZoneLockouts> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.expedition_id));
|
||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||
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(std::to_string(e.duration));
|
||||
@@ -258,9 +258,9 @@ public:
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<ExpeditionLockouts> All(Database& db)
|
||||
static std::vector<DynamicZoneLockouts> All(Database& db)
|
||||
{
|
||||
std::vector<ExpeditionLockouts> all_entries;
|
||||
std::vector<DynamicZoneLockouts> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -272,10 +272,10 @@ public:
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ExpeditionLockouts e{};
|
||||
DynamicZoneLockouts e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.expedition_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.event_name = row[2] ? row[2] : "";
|
||||
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;
|
||||
@@ -287,9 +287,9 @@ public:
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<ExpeditionLockouts> GetWhere(Database& db, const std::string &where_filter)
|
||||
static std::vector<DynamicZoneLockouts> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<ExpeditionLockouts> all_entries;
|
||||
std::vector<DynamicZoneLockouts> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -302,10 +302,10 @@ public:
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ExpeditionLockouts e{};
|
||||
DynamicZoneLockouts e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.expedition_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.dynamic_zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.event_name = row[2] ? row[2] : "";
|
||||
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;
|
||||
@@ -379,13 +379,13 @@ public:
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const ExpeditionLockouts &e
|
||||
const DynamicZoneLockouts &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.expedition_id));
|
||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||
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(std::to_string(e.duration));
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<ExpeditionLockouts> &entries
|
||||
const std::vector<DynamicZoneLockouts> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
@@ -413,7 +413,7 @@ public:
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.expedition_id));
|
||||
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||
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(std::to_string(e.duration));
|
||||
@@ -436,4 +436,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
#endif //EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
float zone_in_z;
|
||||
float zone_in_heading;
|
||||
uint8_t has_zone_in;
|
||||
int8_t is_locked;
|
||||
int8_t add_replay;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -75,6 +77,8 @@ public:
|
||||
"zone_in_z",
|
||||
"zone_in_heading",
|
||||
"has_zone_in",
|
||||
"is_locked",
|
||||
"add_replay",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -104,6 +108,8 @@ public:
|
||||
"zone_in_z",
|
||||
"zone_in_heading",
|
||||
"has_zone_in",
|
||||
"is_locked",
|
||||
"add_replay",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -167,6 +173,8 @@ public:
|
||||
e.zone_in_z = 0;
|
||||
e.zone_in_heading = 0;
|
||||
e.has_zone_in = 0;
|
||||
e.is_locked = 0;
|
||||
e.add_replay = 1;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -226,6 +234,8 @@ public:
|
||||
e.zone_in_z = row[20] ? strtof(row[20], 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.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;
|
||||
}
|
||||
@@ -281,6 +291,8 @@ public:
|
||||
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[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(
|
||||
fmt::format(
|
||||
@@ -325,6 +337,8 @@ public:
|
||||
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.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(
|
||||
fmt::format(
|
||||
@@ -377,6 +391,8 @@ public:
|
||||
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.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) + ")");
|
||||
}
|
||||
@@ -433,6 +449,8 @@ public:
|
||||
e.zone_in_z = row[20] ? strtof(row[20], 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.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);
|
||||
}
|
||||
@@ -480,6 +498,8 @@ public:
|
||||
e.zone_in_z = row[20] ? strtof(row[20], 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.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);
|
||||
}
|
||||
@@ -577,6 +597,8 @@ public:
|
||||
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.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(
|
||||
fmt::format(
|
||||
@@ -622,6 +644,8 @@ public:
|
||||
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.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) + ")");
|
||||
}
|
||||
|
||||
@@ -1,415 +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_EXPEDITIONS_REPOSITORY_H
|
||||
#define EQEMU_BASE_EXPEDITIONS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseExpeditionsRepository {
|
||||
public:
|
||||
struct Expeditions {
|
||||
uint32_t id;
|
||||
uint32_t dynamic_zone_id;
|
||||
uint8_t add_replay_on_join;
|
||||
uint8_t is_locked;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"dynamic_zone_id",
|
||||
"add_replay_on_join",
|
||||
"is_locked",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"dynamic_zone_id",
|
||||
"add_replay_on_join",
|
||||
"is_locked",
|
||||
};
|
||||
}
|
||||
|
||||
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("expeditions");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static Expeditions NewEntity()
|
||||
{
|
||||
Expeditions e{};
|
||||
|
||||
e.id = 0;
|
||||
e.dynamic_zone_id = 0;
|
||||
e.add_replay_on_join = 1;
|
||||
e.is_locked = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static Expeditions GetExpeditions(
|
||||
const std::vector<Expeditions> &expeditionss,
|
||||
int expeditions_id
|
||||
)
|
||||
{
|
||||
for (auto &expeditions : expeditionss) {
|
||||
if (expeditions.id == expeditions_id) {
|
||||
return expeditions;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static Expeditions FindOne(
|
||||
Database& db,
|
||||
int expeditions_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
expeditions_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
Expeditions e{};
|
||||
|
||||
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.add_replay_on_join = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.is_locked = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int expeditions_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
expeditions_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const Expeditions &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.dynamic_zone_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.add_replay_on_join));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.is_locked));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static Expeditions InsertOne(
|
||||
Database& db,
|
||||
Expeditions e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
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.add_replay_on_join));
|
||||
v.push_back(std::to_string(e.is_locked));
|
||||
|
||||
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<Expeditions> &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.dynamic_zone_id));
|
||||
v.push_back(std::to_string(e.add_replay_on_join));
|
||||
v.push_back(std::to_string(e.is_locked));
|
||||
|
||||
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<Expeditions> All(Database& db)
|
||||
{
|
||||
std::vector<Expeditions> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Expeditions e{};
|
||||
|
||||
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.add_replay_on_join = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.is_locked = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Expeditions> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<Expeditions> 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) {
|
||||
Expeditions e{};
|
||||
|
||||
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.add_replay_on_join = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.is_locked = row[3] ? static_cast<uint8_t>(strtoul(row[3], 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 Expeditions &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
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.add_replay_on_join));
|
||||
v.push_back(std::to_string(e.is_locked));
|
||||
|
||||
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<Expeditions> &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.dynamic_zone_id));
|
||||
v.push_back(std::to_string(e.add_replay_on_join));
|
||||
v.push_back(std::to_string(e.is_locked));
|
||||
|
||||
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_EXPEDITIONS_REPOSITORY_H
|
||||
@@ -1,511 +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_FIND_LOCATION_REPOSITORY_H
|
||||
#define EQEMU_BASE_FIND_LOCATION_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseFindLocationRepository {
|
||||
public:
|
||||
struct FindLocation {
|
||||
uint32_t id;
|
||||
std::string zone;
|
||||
int32_t version;
|
||||
int8_t min_expansion;
|
||||
int8_t max_expansion;
|
||||
std::string content_flags;
|
||||
std::string content_flags_disabled;
|
||||
int32_t type;
|
||||
int32_t zone_id;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"zone",
|
||||
"version",
|
||||
"min_expansion",
|
||||
"max_expansion",
|
||||
"content_flags",
|
||||
"content_flags_disabled",
|
||||
"type",
|
||||
"zone_id",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"zone",
|
||||
"version",
|
||||
"min_expansion",
|
||||
"max_expansion",
|
||||
"content_flags",
|
||||
"content_flags_disabled",
|
||||
"type",
|
||||
"zone_id",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
};
|
||||
}
|
||||
|
||||
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("find_location");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static FindLocation NewEntity()
|
||||
{
|
||||
FindLocation e{};
|
||||
|
||||
e.id = 0;
|
||||
e.zone = "";
|
||||
e.version = 0;
|
||||
e.min_expansion = -1;
|
||||
e.max_expansion = -1;
|
||||
e.content_flags = "";
|
||||
e.content_flags_disabled = "";
|
||||
e.type = 0;
|
||||
e.zone_id = 0;
|
||||
e.x = 0;
|
||||
e.y = 0;
|
||||
e.z = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static FindLocation GetFindLocation(
|
||||
const std::vector<FindLocation> &find_locations,
|
||||
int find_location_id
|
||||
)
|
||||
{
|
||||
for (auto &find_location : find_locations) {
|
||||
if (find_location.id == find_location_id) {
|
||||
return find_location;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static FindLocation FindOne(
|
||||
Database& db,
|
||||
int find_location_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
find_location_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
FindLocation 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.min_expansion = row[3] ? static_cast<int8_t>(atoi(row[3])) : -1;
|
||||
e.max_expansion = row[4] ? static_cast<int8_t>(atoi(row[4])) : -1;
|
||||
e.content_flags = row[5] ? row[5] : "";
|
||||
e.content_flags_disabled = row[6] ? row[6] : "";
|
||||
e.type = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.zone_id = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.x = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.y = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.z = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int find_location_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
find_location_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const FindLocation &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.min_expansion));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.max_expansion));
|
||||
v.push_back(columns[5] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.type));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.zone_id));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.x));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.y));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.z));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static FindLocation InsertOne(
|
||||
Database& db,
|
||||
FindLocation 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.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) + "'");
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
|
||||
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<FindLocation> &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.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) + "'");
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
|
||||
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<FindLocation> All(Database& db)
|
||||
{
|
||||
std::vector<FindLocation> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
FindLocation 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.min_expansion = row[3] ? static_cast<int8_t>(atoi(row[3])) : -1;
|
||||
e.max_expansion = row[4] ? static_cast<int8_t>(atoi(row[4])) : -1;
|
||||
e.content_flags = row[5] ? row[5] : "";
|
||||
e.content_flags_disabled = row[6] ? row[6] : "";
|
||||
e.type = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.zone_id = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.x = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.y = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.z = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<FindLocation> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<FindLocation> 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) {
|
||||
FindLocation 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.min_expansion = row[3] ? static_cast<int8_t>(atoi(row[3])) : -1;
|
||||
e.max_expansion = row[4] ? static_cast<int8_t>(atoi(row[4])) : -1;
|
||||
e.content_flags = row[5] ? row[5] : "";
|
||||
e.content_flags_disabled = row[6] ? row[6] : "";
|
||||
e.type = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.zone_id = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.x = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.y = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.z = row[11] ? strtof(row[11], nullptr) : 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 FindLocation &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.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) + "'");
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
|
||||
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<FindLocation> &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.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) + "'");
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
|
||||
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_FIND_LOCATION_REPOSITORY_H
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
||||
@@ -16,19 +16,24 @@
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseGuildBankRepository {
|
||||
public:
|
||||
struct GuildBank {
|
||||
uint32_t id;
|
||||
uint32_t guildid;
|
||||
uint32_t guild_id;
|
||||
uint8_t area;
|
||||
uint32_t slot;
|
||||
uint32_t itemid;
|
||||
uint32_t qty;
|
||||
uint32_t item_id;
|
||||
uint32_t augment_one_id;
|
||||
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;
|
||||
uint8_t permissions;
|
||||
std::string whofor;
|
||||
std::string who_for;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -40,14 +45,20 @@ public:
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"guildid",
|
||||
"guild_id",
|
||||
"area",
|
||||
"slot",
|
||||
"itemid",
|
||||
"qty",
|
||||
"item_id",
|
||||
"augment_one_id",
|
||||
"augment_two_id",
|
||||
"augment_three_id",
|
||||
"augment_four_id",
|
||||
"augment_five_id",
|
||||
"augment_six_id",
|
||||
"quantity",
|
||||
"donator",
|
||||
"permissions",
|
||||
"whofor",
|
||||
"who_for",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,14 +66,20 @@ public:
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"guildid",
|
||||
"guild_id",
|
||||
"area",
|
||||
"slot",
|
||||
"itemid",
|
||||
"qty",
|
||||
"item_id",
|
||||
"augment_one_id",
|
||||
"augment_two_id",
|
||||
"augment_three_id",
|
||||
"augment_four_id",
|
||||
"augment_five_id",
|
||||
"augment_six_id",
|
||||
"quantity",
|
||||
"donator",
|
||||
"permissions",
|
||||
"whofor",
|
||||
"who_for",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -103,15 +120,21 @@ public:
|
||||
{
|
||||
GuildBank e{};
|
||||
|
||||
e.id = 0;
|
||||
e.guildid = 0;
|
||||
e.area = 0;
|
||||
e.slot = 0;
|
||||
e.itemid = 0;
|
||||
e.qty = 0;
|
||||
e.donator = "";
|
||||
e.permissions = 0;
|
||||
e.whofor = "";
|
||||
e.id = 0;
|
||||
e.guild_id = 0;
|
||||
e.area = 0;
|
||||
e.slot = 0;
|
||||
e.item_id = 0;
|
||||
e.augment_one_id = 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.permissions = 0;
|
||||
e.who_for = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -148,15 +171,21 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
GuildBank e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.donator = row[6] ? row[6] : "";
|
||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.whofor = row[8] ? row[8] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
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;
|
||||
}
|
||||
@@ -190,14 +219,20 @@ public:
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.guildid));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.guild_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.area));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.slot));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.itemid));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.qty));
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.donator) + "'");
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.permissions));
|
||||
v.push_back(columns[8] + " = '" + Strings::Escape(e.whofor) + "'");
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.augment_one_id));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.augment_two_id));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.augment_three_id));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.augment_four_id));
|
||||
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(
|
||||
fmt::format(
|
||||
@@ -220,14 +255,20 @@ public:
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.guildid));
|
||||
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.itemid));
|
||||
v.push_back(std::to_string(e.qty));
|
||||
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.whofor) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -258,14 +299,20 @@ public:
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.guildid));
|
||||
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.itemid));
|
||||
v.push_back(std::to_string(e.qty));
|
||||
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.whofor) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -299,15 +346,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
GuildBank e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.donator = row[6] ? row[6] : "";
|
||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.whofor = row[8] ? row[8] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
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);
|
||||
}
|
||||
@@ -332,15 +385,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
GuildBank e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.donator = row[6] ? row[6] : "";
|
||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.whofor = row[8] ? row[8] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
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);
|
||||
}
|
||||
@@ -399,6 +458,90 @@ public:
|
||||
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
|
||||
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
int16_t race;
|
||||
int8_t gender;
|
||||
int8_t texture;
|
||||
int8_t helmtexture;
|
||||
float mountspeed;
|
||||
std::string notes;
|
||||
};
|
||||
@@ -41,6 +42,7 @@ public:
|
||||
"race",
|
||||
"gender",
|
||||
"texture",
|
||||
"helmtexture",
|
||||
"mountspeed",
|
||||
"notes",
|
||||
};
|
||||
@@ -54,6 +56,7 @@ public:
|
||||
"race",
|
||||
"gender",
|
||||
"texture",
|
||||
"helmtexture",
|
||||
"mountspeed",
|
||||
"notes",
|
||||
};
|
||||
@@ -96,13 +99,14 @@ public:
|
||||
{
|
||||
Horses e{};
|
||||
|
||||
e.id = 0;
|
||||
e.filename = "";
|
||||
e.race = 216;
|
||||
e.gender = 0;
|
||||
e.texture = 0;
|
||||
e.mountspeed = 0.75;
|
||||
e.notes = "Notes";
|
||||
e.id = 0;
|
||||
e.filename = "";
|
||||
e.race = 216;
|
||||
e.gender = 0;
|
||||
e.texture = 0;
|
||||
e.helmtexture = -1;
|
||||
e.mountspeed = 0.75;
|
||||
e.notes = "Notes";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -139,13 +143,14 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
Horses e{};
|
||||
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.filename = row[1] ? row[1] : "";
|
||||
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.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75;
|
||||
e.notes = row[6] ? row[6] : "Notes";
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.filename = row[1] ? row[1] : "";
|
||||
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.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[6] ? strtof(row[6], nullptr) : 0.75;
|
||||
e.notes = row[7] ? row[7] : "Notes";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -183,8 +188,9 @@ public:
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.race));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.gender));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.texture));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.mountspeed));
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.notes) + "'");
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.helmtexture));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.mountspeed));
|
||||
v.push_back(columns[7] + " = '" + Strings::Escape(e.notes) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -211,6 +217,7 @@ public:
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
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("'" + Strings::Escape(e.notes) + "'");
|
||||
|
||||
@@ -247,6 +254,7 @@ public:
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
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("'" + Strings::Escape(e.notes) + "'");
|
||||
|
||||
@@ -282,13 +290,14 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Horses e{};
|
||||
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.filename = row[1] ? row[1] : "";
|
||||
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.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75;
|
||||
e.notes = row[6] ? row[6] : "Notes";
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.filename = row[1] ? row[1] : "";
|
||||
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.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[6] ? strtof(row[6], nullptr) : 0.75;
|
||||
e.notes = row[7] ? row[7] : "Notes";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -313,13 +322,14 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Horses e{};
|
||||
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.filename = row[1] ? row[1] : "";
|
||||
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.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75;
|
||||
e.notes = row[6] ? row[6] : "Notes";
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.filename = row[1] ? row[1] : "";
|
||||
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.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[6] ? strtof(row[6], nullptr) : 0.75;
|
||||
e.notes = row[7] ? row[7] : "Notes";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -399,6 +409,7 @@ public:
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
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("'" + Strings::Escape(e.notes) + "'");
|
||||
|
||||
@@ -428,6 +439,7 @@ public:
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
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("'" + Strings::Escape(e.notes) + "'");
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
class BaseItemsEvolvingDetailsRepository {
|
||||
public:
|
||||
struct ItemsEvolvingDetails {
|
||||
uint32_t id;
|
||||
uint32_t item_evo_id;
|
||||
uint32_t item_evolve_level;
|
||||
uint32_t item_id;
|
||||
uint32_t type;
|
||||
uint32_t sub_type;
|
||||
int64_t required_amount;
|
||||
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()
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
e.item_evolve_level = 0;
|
||||
e.item_id = 0;
|
||||
e.type = 0;
|
||||
e.sub_type = 0;
|
||||
e.sub_type = "0";
|
||||
e.required_amount = 0;
|
||||
|
||||
return e;
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
e.item_evolve_level = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.type = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.sub_type = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.sub_type = row[5] ? row[5] : "0";
|
||||
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||
|
||||
return e;
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.item_evolve_level));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.type));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.sub_type));
|
||||
v.push_back(columns[5] + " = '" + Strings::Escape(e.sub_type) + "'");
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.required_amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
v.push_back(std::to_string(e.item_evolve_level));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.sub_type));
|
||||
v.push_back("'" + Strings::Escape(e.sub_type) + "'");
|
||||
v.push_back(std::to_string(e.required_amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
v.push_back(std::to_string(e.item_evolve_level));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.sub_type));
|
||||
v.push_back("'" + Strings::Escape(e.sub_type) + "'");
|
||||
v.push_back(std::to_string(e.required_amount));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
e.item_evolve_level = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.type = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.sub_type = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.sub_type = row[5] ? row[5] : "0";
|
||||
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
e.item_evolve_level = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.type = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.sub_type = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.sub_type = row[5] ? row[5] : "0";
|
||||
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -399,7 +399,7 @@ public:
|
||||
v.push_back(std::to_string(e.item_evolve_level));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.sub_type));
|
||||
v.push_back("'" + Strings::Escape(e.sub_type) + "'");
|
||||
v.push_back(std::to_string(e.required_amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
v.push_back(std::to_string(e.item_evolve_level));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.sub_type));
|
||||
v.push_back("'" + Strings::Escape(e.sub_type) + "'");
|
||||
v.push_back(std::to_string(e.required_amount));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
|
||||
@@ -0,0 +1,703 @@
|
||||
/**
|
||||
* 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_ZONE_STATE_SPAWNS_REPOSITORY_H
|
||||
#define EQEMU_BASE_ZONE_STATE_SPAWNS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseZoneStateSpawnsRepository {
|
||||
public:
|
||||
struct ZoneStateSpawns {
|
||||
int64_t id;
|
||||
uint32_t zone_id;
|
||||
uint32_t instance_id;
|
||||
int8_t is_corpse;
|
||||
int32_t decay_in_seconds;
|
||||
uint32_t npc_id;
|
||||
uint32_t spawn2_id;
|
||||
uint32_t spawngroup_id;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float heading;
|
||||
uint32_t respawn_time;
|
||||
uint32_t variance;
|
||||
uint32_t grid;
|
||||
int32_t current_waypoint;
|
||||
int16_t path_when_zone_idle;
|
||||
uint16_t condition_id;
|
||||
int16_t condition_min_value;
|
||||
int16_t enabled;
|
||||
uint16_t anim;
|
||||
std::string loot_data;
|
||||
std::string entity_variables;
|
||||
std::string buffs;
|
||||
int64_t hp;
|
||||
int64_t mana;
|
||||
int64_t endurance;
|
||||
time_t created_at;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"zone_id",
|
||||
"instance_id",
|
||||
"is_corpse",
|
||||
"decay_in_seconds",
|
||||
"npc_id",
|
||||
"spawn2_id",
|
||||
"spawngroup_id",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"heading",
|
||||
"respawn_time",
|
||||
"variance",
|
||||
"grid",
|
||||
"current_waypoint",
|
||||
"path_when_zone_idle",
|
||||
"condition_id",
|
||||
"condition_min_value",
|
||||
"enabled",
|
||||
"anim",
|
||||
"loot_data",
|
||||
"entity_variables",
|
||||
"buffs",
|
||||
"hp",
|
||||
"mana",
|
||||
"endurance",
|
||||
"created_at",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"zone_id",
|
||||
"instance_id",
|
||||
"is_corpse",
|
||||
"decay_in_seconds",
|
||||
"npc_id",
|
||||
"spawn2_id",
|
||||
"spawngroup_id",
|
||||
"x",
|
||||
"y",
|
||||
"z",
|
||||
"heading",
|
||||
"respawn_time",
|
||||
"variance",
|
||||
"grid",
|
||||
"current_waypoint",
|
||||
"path_when_zone_idle",
|
||||
"condition_id",
|
||||
"condition_min_value",
|
||||
"enabled",
|
||||
"anim",
|
||||
"loot_data",
|
||||
"entity_variables",
|
||||
"buffs",
|
||||
"hp",
|
||||
"mana",
|
||||
"endurance",
|
||||
"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("zone_state_spawns");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static ZoneStateSpawns NewEntity()
|
||||
{
|
||||
ZoneStateSpawns e{};
|
||||
|
||||
e.id = 0;
|
||||
e.zone_id = 0;
|
||||
e.instance_id = 0;
|
||||
e.is_corpse = 0;
|
||||
e.decay_in_seconds = 0;
|
||||
e.npc_id = 0;
|
||||
e.spawn2_id = 0;
|
||||
e.spawngroup_id = 0;
|
||||
e.x = 0;
|
||||
e.y = 0;
|
||||
e.z = 0;
|
||||
e.heading = 0;
|
||||
e.respawn_time = 0;
|
||||
e.variance = 0;
|
||||
e.grid = 0;
|
||||
e.current_waypoint = 0;
|
||||
e.path_when_zone_idle = 0;
|
||||
e.condition_id = 0;
|
||||
e.condition_min_value = 0;
|
||||
e.enabled = 1;
|
||||
e.anim = 0;
|
||||
e.loot_data = "";
|
||||
e.entity_variables = "";
|
||||
e.buffs = "";
|
||||
e.hp = 0;
|
||||
e.mana = 0;
|
||||
e.endurance = 0;
|
||||
e.created_at = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static ZoneStateSpawns GetZoneStateSpawns(
|
||||
const std::vector<ZoneStateSpawns> &zone_state_spawnss,
|
||||
int zone_state_spawns_id
|
||||
)
|
||||
{
|
||||
for (auto &zone_state_spawns : zone_state_spawnss) {
|
||||
if (zone_state_spawns.id == zone_state_spawns_id) {
|
||||
return zone_state_spawns;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static ZoneStateSpawns FindOne(
|
||||
Database& db,
|
||||
int zone_state_spawns_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
zone_state_spawns_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
ZoneStateSpawns e{};
|
||||
|
||||
e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0;
|
||||
e.zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.is_corpse = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.decay_in_seconds = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.npc_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.spawn2_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.spawngroup_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 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.heading = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.respawn_time = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.variance = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.grid = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.current_waypoint = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.path_when_zone_idle = row[16] ? static_cast<int16_t>(atoi(row[16])) : 0;
|
||||
e.condition_id = row[17] ? static_cast<uint16_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.condition_min_value = row[18] ? static_cast<int16_t>(atoi(row[18])) : 0;
|
||||
e.enabled = row[19] ? static_cast<int16_t>(atoi(row[19])) : 1;
|
||||
e.anim = row[20] ? static_cast<uint16_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.loot_data = row[21] ? row[21] : "";
|
||||
e.entity_variables = row[22] ? row[22] : "";
|
||||
e.buffs = row[23] ? row[23] : "";
|
||||
e.hp = row[24] ? strtoll(row[24], nullptr, 10) : 0;
|
||||
e.mana = row[25] ? strtoll(row[25], nullptr, 10) : 0;
|
||||
e.endurance = row[26] ? strtoll(row[26], nullptr, 10) : 0;
|
||||
e.created_at = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int zone_state_spawns_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
zone_state_spawns_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const ZoneStateSpawns &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.zone_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.instance_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.is_corpse));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.decay_in_seconds));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.npc_id));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.spawn2_id));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.spawngroup_id));
|
||||
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.heading));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.respawn_time));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.variance));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.grid));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.current_waypoint));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.path_when_zone_idle));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.condition_id));
|
||||
v.push_back(columns[18] + " = " + std::to_string(e.condition_min_value));
|
||||
v.push_back(columns[19] + " = " + std::to_string(e.enabled));
|
||||
v.push_back(columns[20] + " = " + std::to_string(e.anim));
|
||||
v.push_back(columns[21] + " = '" + Strings::Escape(e.loot_data) + "'");
|
||||
v.push_back(columns[22] + " = '" + Strings::Escape(e.entity_variables) + "'");
|
||||
v.push_back(columns[23] + " = '" + Strings::Escape(e.buffs) + "'");
|
||||
v.push_back(columns[24] + " = " + std::to_string(e.hp));
|
||||
v.push_back(columns[25] + " = " + std::to_string(e.mana));
|
||||
v.push_back(columns[26] + " = " + std::to_string(e.endurance));
|
||||
v.push_back(columns[27] + " = 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 ZoneStateSpawns InsertOne(
|
||||
Database& db,
|
||||
ZoneStateSpawns e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.is_corpse));
|
||||
v.push_back(std::to_string(e.decay_in_seconds));
|
||||
v.push_back(std::to_string(e.npc_id));
|
||||
v.push_back(std::to_string(e.spawn2_id));
|
||||
v.push_back(std::to_string(e.spawngroup_id));
|
||||
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.heading));
|
||||
v.push_back(std::to_string(e.respawn_time));
|
||||
v.push_back(std::to_string(e.variance));
|
||||
v.push_back(std::to_string(e.grid));
|
||||
v.push_back(std::to_string(e.current_waypoint));
|
||||
v.push_back(std::to_string(e.path_when_zone_idle));
|
||||
v.push_back(std::to_string(e.condition_id));
|
||||
v.push_back(std::to_string(e.condition_min_value));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.anim));
|
||||
v.push_back("'" + Strings::Escape(e.loot_data) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.buffs) + "'");
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
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<ZoneStateSpawns> &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.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.is_corpse));
|
||||
v.push_back(std::to_string(e.decay_in_seconds));
|
||||
v.push_back(std::to_string(e.npc_id));
|
||||
v.push_back(std::to_string(e.spawn2_id));
|
||||
v.push_back(std::to_string(e.spawngroup_id));
|
||||
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.heading));
|
||||
v.push_back(std::to_string(e.respawn_time));
|
||||
v.push_back(std::to_string(e.variance));
|
||||
v.push_back(std::to_string(e.grid));
|
||||
v.push_back(std::to_string(e.current_waypoint));
|
||||
v.push_back(std::to_string(e.path_when_zone_idle));
|
||||
v.push_back(std::to_string(e.condition_id));
|
||||
v.push_back(std::to_string(e.condition_min_value));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.anim));
|
||||
v.push_back("'" + Strings::Escape(e.loot_data) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.buffs) + "'");
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
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<ZoneStateSpawns> All(Database& db)
|
||||
{
|
||||
std::vector<ZoneStateSpawns> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ZoneStateSpawns e{};
|
||||
|
||||
e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0;
|
||||
e.zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.is_corpse = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.decay_in_seconds = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.npc_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.spawn2_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.spawngroup_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 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.heading = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.respawn_time = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.variance = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.grid = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.current_waypoint = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.path_when_zone_idle = row[16] ? static_cast<int16_t>(atoi(row[16])) : 0;
|
||||
e.condition_id = row[17] ? static_cast<uint16_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.condition_min_value = row[18] ? static_cast<int16_t>(atoi(row[18])) : 0;
|
||||
e.enabled = row[19] ? static_cast<int16_t>(atoi(row[19])) : 1;
|
||||
e.anim = row[20] ? static_cast<uint16_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.loot_data = row[21] ? row[21] : "";
|
||||
e.entity_variables = row[22] ? row[22] : "";
|
||||
e.buffs = row[23] ? row[23] : "";
|
||||
e.hp = row[24] ? strtoll(row[24], nullptr, 10) : 0;
|
||||
e.mana = row[25] ? strtoll(row[25], nullptr, 10) : 0;
|
||||
e.endurance = row[26] ? strtoll(row[26], nullptr, 10) : 0;
|
||||
e.created_at = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<ZoneStateSpawns> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<ZoneStateSpawns> 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) {
|
||||
ZoneStateSpawns e{};
|
||||
|
||||
e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0;
|
||||
e.zone_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.is_corpse = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.decay_in_seconds = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.npc_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.spawn2_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.spawngroup_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 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.heading = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.respawn_time = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.variance = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.grid = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.current_waypoint = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.path_when_zone_idle = row[16] ? static_cast<int16_t>(atoi(row[16])) : 0;
|
||||
e.condition_id = row[17] ? static_cast<uint16_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.condition_min_value = row[18] ? static_cast<int16_t>(atoi(row[18])) : 0;
|
||||
e.enabled = row[19] ? static_cast<int16_t>(atoi(row[19])) : 1;
|
||||
e.anim = row[20] ? static_cast<uint16_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.loot_data = row[21] ? row[21] : "";
|
||||
e.entity_variables = row[22] ? row[22] : "";
|
||||
e.buffs = row[23] ? row[23] : "";
|
||||
e.hp = row[24] ? strtoll(row[24], nullptr, 10) : 0;
|
||||
e.mana = row[25] ? strtoll(row[25], nullptr, 10) : 0;
|
||||
e.endurance = row[26] ? strtoll(row[26], nullptr, 10) : 0;
|
||||
e.created_at = strtoll(row[27] ? row[27] : "-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 ZoneStateSpawns &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.is_corpse));
|
||||
v.push_back(std::to_string(e.decay_in_seconds));
|
||||
v.push_back(std::to_string(e.npc_id));
|
||||
v.push_back(std::to_string(e.spawn2_id));
|
||||
v.push_back(std::to_string(e.spawngroup_id));
|
||||
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.heading));
|
||||
v.push_back(std::to_string(e.respawn_time));
|
||||
v.push_back(std::to_string(e.variance));
|
||||
v.push_back(std::to_string(e.grid));
|
||||
v.push_back(std::to_string(e.current_waypoint));
|
||||
v.push_back(std::to_string(e.path_when_zone_idle));
|
||||
v.push_back(std::to_string(e.condition_id));
|
||||
v.push_back(std::to_string(e.condition_min_value));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.anim));
|
||||
v.push_back("'" + Strings::Escape(e.loot_data) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.buffs) + "'");
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
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<ZoneStateSpawns> &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.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.is_corpse));
|
||||
v.push_back(std::to_string(e.decay_in_seconds));
|
||||
v.push_back(std::to_string(e.npc_id));
|
||||
v.push_back(std::to_string(e.spawn2_id));
|
||||
v.push_back(std::to_string(e.spawngroup_id));
|
||||
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.heading));
|
||||
v.push_back(std::to_string(e.respawn_time));
|
||||
v.push_back(std::to_string(e.variance));
|
||||
v.push_back(std::to_string(e.grid));
|
||||
v.push_back(std::to_string(e.current_waypoint));
|
||||
v.push_back(std::to_string(e.path_when_zone_idle));
|
||||
v.push_back(std::to_string(e.condition_id));
|
||||
v.push_back(std::to_string(e.condition_min_value));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.anim));
|
||||
v.push_back("'" + Strings::Escape(e.loot_data) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.entity_variables) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.buffs) + "'");
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
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_ZONE_STATE_SPAWNS_REPOSITORY_H
|
||||
@@ -2,7 +2,7 @@
|
||||
#define EQEMU_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../expedition_lockout_timer.h"
|
||||
#include "../dynamic_zone_lockout.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_character_expedition_lockouts_repository.h"
|
||||
#include <unordered_map>
|
||||
@@ -47,33 +47,8 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct CharacterExpeditionLockoutsTimeStamp {
|
||||
int id;
|
||||
int character_id;
|
||||
std::string expedition_name;
|
||||
std::string event_name;
|
||||
time_t expire_time;
|
||||
int duration;
|
||||
std::string from_expedition_uuid;
|
||||
};
|
||||
|
||||
static ExpeditionLockoutTimer GetExpeditionLockoutTimerFromEntry(
|
||||
CharacterExpeditionLockoutsTimeStamp&& entry)
|
||||
{
|
||||
ExpeditionLockoutTimer lockout_timer{
|
||||
std::move(entry.from_expedition_uuid),
|
||||
std::move(entry.expedition_name),
|
||||
std::move(entry.event_name),
|
||||
static_cast<uint64_t>(entry.expire_time),
|
||||
static_cast<uint32_t>(entry.duration)
|
||||
};
|
||||
|
||||
return lockout_timer;
|
||||
}
|
||||
|
||||
static std::unordered_map<uint32_t, std::vector<ExpeditionLockoutTimer>> GetManyCharacterLockoutTimers(
|
||||
Database& db, const std::vector<uint32_t>& character_ids,
|
||||
const std::string& expedition_name, const std::string& ordered_event_name)
|
||||
static std::unordered_map<uint32_t, std::vector<DzLockout>> GetLockouts(
|
||||
Database& db, const std::vector<uint32_t>& char_ids, const std::string& expedition)
|
||||
{
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
@@ -84,39 +59,171 @@ public:
|
||||
from_expedition_uuid
|
||||
FROM character_expedition_lockouts
|
||||
WHERE
|
||||
character_id IN ({})
|
||||
character_id IN ({0})
|
||||
AND expire_time > NOW()
|
||||
AND expedition_name = '{}'
|
||||
AND expedition_name = '{1}'
|
||||
ORDER BY
|
||||
FIELD(character_id, {}),
|
||||
FIELD(event_name, '{}') DESC
|
||||
FIELD(character_id, {0}),
|
||||
FIELD(event_name, '{2}') DESC
|
||||
),
|
||||
fmt::join(character_ids, ","),
|
||||
Strings::Escape(expedition_name),
|
||||
fmt::join(character_ids, ","),
|
||||
Strings::Escape(ordered_event_name)
|
||||
fmt::join(char_ids, ","),
|
||||
Strings::Escape(expedition),
|
||||
Strings::Escape(DzLockout::ReplayTimer)
|
||||
));
|
||||
|
||||
std::unordered_map<uint32_t, std::vector<ExpeditionLockoutTimer>> lockouts;
|
||||
std::unordered_map<uint32_t, std::vector<DzLockout>> lockouts;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
CharacterExpeditionLockoutsTimeStamp entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.character_id = std::strtoul(row[col++], nullptr, 10);
|
||||
entry.expire_time = std::strtoull(row[col++], nullptr, 10);
|
||||
entry.duration = std::strtoul(row[col++], nullptr, 10);
|
||||
entry.event_name = row[col++];
|
||||
entry.expedition_name = expedition_name;
|
||||
entry.from_expedition_uuid = row[col++];
|
||||
uint32_t char_id = std::strtoul(row[col++], nullptr, 10);
|
||||
time_t expire_time = std::strtoull(row[col++], nullptr, 10);
|
||||
uint32_t duration = std::strtoul(row[col++], nullptr, 10);
|
||||
std::string event = row[col++];
|
||||
std::string uuid = row[col++];
|
||||
|
||||
auto lockout = GetExpeditionLockoutTimerFromEntry(std::move(entry));
|
||||
lockouts[entry.character_id].emplace_back(std::move(lockout));
|
||||
lockouts[char_id].emplace_back(std::move(uuid), expedition, std::move(event), expire_time, duration);
|
||||
}
|
||||
|
||||
return lockouts;
|
||||
}
|
||||
|
||||
static std::vector<DzLockout> GetLockouts(Database& db, uint32_t char_id)
|
||||
{
|
||||
std::vector<DzLockout> lockouts;
|
||||
|
||||
auto rows = GetWhere(db, fmt::format("character_id = {} AND expire_time > NOW()", char_id));
|
||||
lockouts.reserve(rows.size());
|
||||
|
||||
for (auto& row : rows)
|
||||
{
|
||||
lockouts.emplace_back(
|
||||
std::move(row.from_expedition_uuid),
|
||||
std::move(row.expedition_name),
|
||||
std::move(row.event_name),
|
||||
row.expire_time,
|
||||
row.duration
|
||||
);
|
||||
}
|
||||
|
||||
return lockouts;
|
||||
}
|
||||
|
||||
static std::vector<CharacterExpeditionLockouts> GetLockouts(Database& db, const std::vector<std::string>& names, const std::string& expedition, const std::string& event)
|
||||
{
|
||||
if (names.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
return GetWhere(db, fmt::format(
|
||||
"character_id IN (select id from character_data where name IN ('{}')) AND expire_time > NOW() AND expedition_name = '{}' AND event_name = '{}' LIMIT 1",
|
||||
fmt::join(names, "','"), Strings::Escape(expedition), Strings::Escape(event)));
|
||||
}
|
||||
|
||||
static void InsertLockouts(Database& db, uint32_t char_id, const std::vector<DzLockout>& lockouts)
|
||||
{
|
||||
std::string insert_values;
|
||||
for (const auto& lockout : lockouts)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(insert_values),
|
||||
"({}, FROM_UNIXTIME({}), {}, '{}', '{}', '{}'),",
|
||||
char_id,
|
||||
lockout.GetExpireTime(),
|
||||
lockout.GetDuration(),
|
||||
Strings::Escape(lockout.UUID()),
|
||||
Strings::Escape(lockout.DzName()),
|
||||
Strings::Escape(lockout.Event())
|
||||
);
|
||||
}
|
||||
|
||||
if (!insert_values.empty())
|
||||
{
|
||||
insert_values.pop_back(); // trailing comma
|
||||
|
||||
auto query = fmt::format(SQL(
|
||||
INSERT INTO character_expedition_lockouts
|
||||
(character_id, expire_time, duration, from_expedition_uuid, expedition_name, event_name)
|
||||
VALUES {}
|
||||
ON DUPLICATE KEY UPDATE
|
||||
from_expedition_uuid = VALUES(from_expedition_uuid),
|
||||
expire_time = VALUES(expire_time),
|
||||
duration = VALUES(duration);
|
||||
), insert_values);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
static void InsertLockout(Database& db, const std::vector<uint32_t>& char_ids, const DzLockout& lockout)
|
||||
{
|
||||
std::string insert_values;
|
||||
for (const auto& char_id : char_ids)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(insert_values),
|
||||
"({}, FROM_UNIXTIME({}), {}, '{}', '{}', '{}'),",
|
||||
char_id,
|
||||
lockout.GetExpireTime(),
|
||||
lockout.GetDuration(),
|
||||
Strings::Escape(lockout.UUID()),
|
||||
Strings::Escape(lockout.DzName()),
|
||||
Strings::Escape(lockout.Event())
|
||||
);
|
||||
}
|
||||
|
||||
if (!insert_values.empty())
|
||||
{
|
||||
insert_values.pop_back(); // trailing comma
|
||||
|
||||
auto query = fmt::format(SQL(
|
||||
INSERT INTO character_expedition_lockouts
|
||||
(character_id, expire_time, duration, from_expedition_uuid, expedition_name, event_name)
|
||||
VALUES {}
|
||||
ON DUPLICATE KEY UPDATE
|
||||
from_expedition_uuid = VALUES(from_expedition_uuid),
|
||||
expire_time = VALUES(expire_time),
|
||||
duration = VALUES(duration);
|
||||
), insert_values);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
// inserts a new lockout or updates existing lockout with seconds added to current time
|
||||
static void AddLockoutDuration(Database& db, const std::vector<uint32_t>& char_ids, const DzLockout& lockout, int seconds)
|
||||
{
|
||||
std::string insert_values;
|
||||
for (const auto& char_id : char_ids)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(insert_values),
|
||||
"({}, FROM_UNIXTIME({}), {}, '{}', '{}', '{}'),",
|
||||
char_id,
|
||||
lockout.GetExpireTime(),
|
||||
lockout.GetDuration(),
|
||||
Strings::Escape(lockout.UUID()),
|
||||
Strings::Escape(lockout.DzName()),
|
||||
Strings::Escape(lockout.Event())
|
||||
);
|
||||
}
|
||||
|
||||
if (!insert_values.empty())
|
||||
{
|
||||
insert_values.pop_back(); // trailing comma
|
||||
|
||||
auto query = fmt::format(SQL(
|
||||
INSERT INTO character_expedition_lockouts
|
||||
(character_id, expire_time, duration, from_expedition_uuid, expedition_name, event_name)
|
||||
VALUES {0}
|
||||
ON DUPLICATE KEY UPDATE
|
||||
from_expedition_uuid = VALUES(from_expedition_uuid),
|
||||
expire_time = DATE_ADD(expire_time, INTERVAL {1} SECOND),
|
||||
duration = GREATEST(0, CAST(duration AS SIGNED) + {1});
|
||||
), insert_values, seconds);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef EQEMU_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||
#define EQEMU_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "../dynamic_zone_lockout.h"
|
||||
#include "base/base_dynamic_zone_lockouts_repository.h"
|
||||
|
||||
class DynamicZoneLockoutsRepository: public BaseDynamicZoneLockoutsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* DynamicZoneLockoutsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* DynamicZoneLockoutsRepository::GetWhereNeverExpires()
|
||||
* DynamicZoneLockoutsRepository::GetWhereXAndY()
|
||||
* DynamicZoneLockoutsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
static void InsertLockouts(Database& db, uint32_t dz_id, const std::vector<DzLockout>& lockouts)
|
||||
{
|
||||
std::string insert_values;
|
||||
for (const auto& lockout : lockouts)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(insert_values),
|
||||
"({}, '{}', '{}', FROM_UNIXTIME({}), {}),",
|
||||
dz_id,
|
||||
Strings::Escape(lockout.UUID()),
|
||||
Strings::Escape(lockout.Event()),
|
||||
lockout.GetExpireTime(),
|
||||
lockout.GetDuration()
|
||||
);
|
||||
}
|
||||
|
||||
if (!insert_values.empty())
|
||||
{
|
||||
insert_values.pop_back(); // trailing comma
|
||||
|
||||
auto query = fmt::format(SQL(
|
||||
INSERT INTO dynamic_zone_lockouts
|
||||
(dynamic_zone_id, from_expedition_uuid, event_name, expire_time, duration)
|
||||
VALUES {}
|
||||
ON DUPLICATE KEY UPDATE
|
||||
from_expedition_uuid = VALUES(from_expedition_uuid),
|
||||
expire_time = VALUES(expire_time),
|
||||
duration = VALUES(duration);
|
||||
), insert_values);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
));
|
||||
}
|
||||
|
||||
static std::vector<MemberWithName> GetAllWithNames(Database& db)
|
||||
static std::vector<MemberWithName> AllWithNames(Database& db)
|
||||
{
|
||||
std::vector<MemberWithName> all_entries;
|
||||
|
||||
@@ -146,65 +146,34 @@ public:
|
||||
|
||||
static void RemoveMember(Database& db, uint32_t dynamic_zone_id, uint32_t character_id)
|
||||
{
|
||||
db.QueryDatabase(fmt::format(SQL(
|
||||
DELETE FROM {}
|
||||
WHERE dynamic_zone_id = {} AND character_id = {};
|
||||
),
|
||||
TableName(), dynamic_zone_id, character_id
|
||||
));
|
||||
DeleteWhere(db, fmt::format("dynamic_zone_id = {} AND character_id = {}", dynamic_zone_id, character_id));
|
||||
}
|
||||
|
||||
static void RemoveAllMembers(Database& db, uint32_t dynamic_zone_id)
|
||||
{
|
||||
db.QueryDatabase(fmt::format(SQL(
|
||||
DELETE FROM {}
|
||||
WHERE dynamic_zone_id = {};
|
||||
),
|
||||
TableName(), dynamic_zone_id
|
||||
));
|
||||
DeleteWhere(db, fmt::format("dynamic_zone_id = {}", dynamic_zone_id));
|
||||
}
|
||||
|
||||
static void RemoveAllMembers(Database& db, std::vector<uint32_t> dynamic_zone_ids)
|
||||
static uint32_t InsertOrUpdateMany(Database& db, const std::vector<DynamicZoneMembers>& entries)
|
||||
{
|
||||
if (!dynamic_zone_ids.empty())
|
||||
if (entries.empty())
|
||||
{
|
||||
db.QueryDatabase(fmt::format(SQL(
|
||||
DELETE FROM {}
|
||||
WHERE dynamic_zone_id IN ({});
|
||||
),
|
||||
TableName(), Strings::Join(dynamic_zone_ids, ",")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
static int InsertOrUpdateMany(Database& db,
|
||||
const std::vector<DynamicZoneMembers>& dynamic_zone_members_entries)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &dynamic_zone_members_entry: dynamic_zone_members_entries)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.dynamic_zone_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zone_members_entry.character_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
std::vector<std::string> values;
|
||||
values.reserve(entries.size());
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE id = id;",
|
||||
TableName(),
|
||||
ColumnsRaw(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
values.push_back(fmt::format("({},{},{})", entry.id, entry.dynamic_zone_id, entry.character_id));
|
||||
}
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE id = id;",
|
||||
TableName(), ColumnsRaw(), fmt::join(values, ",")));
|
||||
|
||||
return results.Success() ? results.RowsAffected() : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ public:
|
||||
float zone_in_z;
|
||||
float zone_in_heading;
|
||||
int has_zone_in;
|
||||
int8_t is_locked;
|
||||
int8_t add_replay;
|
||||
int zone;
|
||||
int version;
|
||||
int is_global;
|
||||
@@ -105,6 +107,8 @@ public:
|
||||
dynamic_zones.zone_in_z,
|
||||
dynamic_zones.zone_in_heading,
|
||||
dynamic_zones.has_zone_in,
|
||||
dynamic_zones.is_locked,
|
||||
dynamic_zones.add_replay,
|
||||
instance_list.zone,
|
||||
instance_list.version,
|
||||
instance_list.is_global,
|
||||
@@ -144,6 +148,8 @@ public:
|
||||
entry.zone_in_z = strtof(row[col++], nullptr);
|
||||
entry.zone_in_heading = strtof(row[col++], nullptr);
|
||||
entry.has_zone_in = strtol(row[col++], nullptr, 10) != 0;
|
||||
entry.is_locked = static_cast<int8_t>(strtol(row[col++], nullptr, 10));
|
||||
entry.add_replay = static_cast<int8_t>(strtol(row[col++], nullptr, 10));
|
||||
// from instance_list
|
||||
entry.zone = strtol(row[col++], nullptr, 10);
|
||||
entry.version = strtol(row[col++], nullptr, 10);
|
||||
@@ -244,6 +250,22 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateLocked(Database& db, uint32_t dz_id, bool lock)
|
||||
{
|
||||
if (dz_id != 0)
|
||||
{
|
||||
db.QueryDatabase(fmt::format("UPDATE dynamic_zones SET is_locked = {} WHERE id = {}", lock, dz_id));
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateReplayOnJoin(Database& db, uint32_t dz_id, bool enabled)
|
||||
{
|
||||
if (dz_id != 0)
|
||||
{
|
||||
db.QueryDatabase(fmt::format("UPDATE dynamic_zones SET add_replay = {} WHERE id = {}", enabled, dz_id));
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateSwitchID(Database& db, uint32_t dz_id, int dz_switch_id)
|
||||
{
|
||||
if (dz_id != 0)
|
||||
@@ -351,6 +373,59 @@ public:
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
struct CharacterDz
|
||||
{
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
uint32_t dz_id;
|
||||
};
|
||||
|
||||
// get character ids with possible active dz id by type
|
||||
static std::vector<CharacterDz> GetCharactersWithDz(Database& db, const std::vector<std::string>& names, int type)
|
||||
{
|
||||
if (names.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<CharacterDz> entries;
|
||||
entries.reserve(names.size());
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
character_data.id,
|
||||
character_data.name,
|
||||
MAX(dynamic_zones.id)
|
||||
FROM character_data
|
||||
LEFT JOIN dynamic_zone_members
|
||||
ON character_data.id = dynamic_zone_members.character_id
|
||||
LEFT JOIN dynamic_zones
|
||||
ON dynamic_zone_members.dynamic_zone_id = dynamic_zones.id
|
||||
AND dynamic_zones.`type` = {0}
|
||||
WHERE character_data.name IN ('{1}')
|
||||
GROUP BY character_data.id
|
||||
ORDER BY FIELD(character_data.name, '{1}')
|
||||
),
|
||||
type,
|
||||
fmt::join(names, "','")
|
||||
));
|
||||
|
||||
if (results.Success())
|
||||
{
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
CharacterDz entry{};
|
||||
entry.id = std::strtoul(row[0], nullptr, 10);
|
||||
entry.name = row[1];
|
||||
entry.dz_id = row[2] ? std::strtoul(row[2], nullptr, 10) : 0;
|
||||
|
||||
entries.push_back(std::move(entry));
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_DYNAMIC_ZONES_REPOSITORY_H
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
#ifndef EQEMU_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
#define EQEMU_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_expedition_lockouts_repository.h"
|
||||
|
||||
class ExpeditionLockoutsRepository: public BaseExpeditionLockoutsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* ExpeditionLockoutsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ExpeditionLockoutsRepository::GetWhereNeverExpires()
|
||||
* ExpeditionLockoutsRepository::GetWhereXAndY()
|
||||
* ExpeditionLockoutsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct ExpeditionLockoutsWithTimestamp {
|
||||
uint32_t id;
|
||||
uint32_t expedition_id;
|
||||
std::string event_name;
|
||||
time_t expire_time;
|
||||
int duration;
|
||||
std::string from_expedition_uuid;
|
||||
};
|
||||
|
||||
static std::vector<ExpeditionLockoutsWithTimestamp> GetWithTimestamp(
|
||||
Database& db, const std::vector<uint32_t>& expedition_ids)
|
||||
{
|
||||
if (expedition_ids.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<ExpeditionLockoutsWithTimestamp> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
id,
|
||||
expedition_id,
|
||||
event_name,
|
||||
UNIX_TIMESTAMP(expire_time),
|
||||
duration,
|
||||
from_expedition_uuid
|
||||
FROM expedition_lockouts
|
||||
WHERE expedition_id IN ({})
|
||||
),
|
||||
Strings::Join(expedition_ids, ",")
|
||||
));
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
ExpeditionLockoutsWithTimestamp entry{};
|
||||
|
||||
int col = 0;
|
||||
entry.id = strtoul(row[col++], nullptr, 10);
|
||||
entry.expedition_id = strtoul(row[col++], nullptr, 10);
|
||||
entry.event_name = row[col++];
|
||||
entry.expire_time = strtoull(row[col++], nullptr, 10);
|
||||
entry.duration = strtol(row[col++], nullptr, 10);
|
||||
entry.from_expedition_uuid = row[col++];
|
||||
|
||||
all_entries.emplace_back(std::move(entry));
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
@@ -1,134 +0,0 @@
|
||||
#ifndef EQEMU_EXPEDITIONS_REPOSITORY_H
|
||||
#define EQEMU_EXPEDITIONS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_expeditions_repository.h"
|
||||
|
||||
class ExpeditionsRepository: public BaseExpeditionsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* ExpeditionsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ExpeditionsRepository::GetWhereNeverExpires()
|
||||
* ExpeditionsRepository::GetWhereXAndY()
|
||||
* ExpeditionsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
struct CharacterExpedition
|
||||
{
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
uint32_t expedition_id;
|
||||
};
|
||||
|
||||
static std::vector<CharacterExpedition> GetCharactersWithExpedition(
|
||||
Database& db, const std::vector<std::string>& character_names)
|
||||
{
|
||||
if (character_names.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<CharacterExpedition> entries;
|
||||
|
||||
auto joined_character_names = fmt::format("'{}'", Strings::Join(character_names, "','"));
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
character_data.id,
|
||||
character_data.name,
|
||||
MAX(expeditions.id)
|
||||
FROM character_data
|
||||
LEFT JOIN dynamic_zone_members
|
||||
ON character_data.id = dynamic_zone_members.character_id
|
||||
LEFT JOIN expeditions
|
||||
ON dynamic_zone_members.dynamic_zone_id = expeditions.dynamic_zone_id
|
||||
WHERE character_data.name IN ({})
|
||||
GROUP BY character_data.id
|
||||
ORDER BY FIELD(character_data.name, {})
|
||||
),
|
||||
joined_character_names,
|
||||
joined_character_names
|
||||
));
|
||||
|
||||
if (results.Success())
|
||||
{
|
||||
entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
CharacterExpedition entry{};
|
||||
entry.id = std::strtoul(row[0], nullptr, 10);
|
||||
entry.name = row[1];
|
||||
entry.expedition_id = row[2] ? std::strtoul(row[2], nullptr, 10) : 0;
|
||||
|
||||
entries.emplace_back(std::move(entry));
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static uint32_t GetIDByMemberID(Database& db, uint32_t character_id)
|
||||
{
|
||||
if (character_id == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t expedition_id = 0;
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||
SELECT
|
||||
expeditions.id
|
||||
FROM expeditions
|
||||
INNER JOIN dynamic_zone_members
|
||||
ON expeditions.dynamic_zone_id = dynamic_zone_members.dynamic_zone_id
|
||||
WHERE
|
||||
dynamic_zone_members.character_id = {}
|
||||
),
|
||||
character_id
|
||||
));
|
||||
|
||||
if (results.Success() && results.RowCount() > 0)
|
||||
{
|
||||
auto row = results.begin();
|
||||
expedition_id = std::strtoul(row[0], nullptr, 10);
|
||||
}
|
||||
|
||||
return expedition_id;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_EXPEDITIONS_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_FIND_LOCATION_REPOSITORY_H
|
||||
#define EQEMU_FIND_LOCATION_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_find_location_repository.h"
|
||||
|
||||
class FindLocationRepository: public BaseFindLocationRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* FindLocationRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* FindLocationRepository::GetWhereNeverExpires()
|
||||
* FindLocationRepository::GetWhereXAndY()
|
||||
* FindLocationRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_FIND_LOCATION_REPOSITORY_H
|
||||
@@ -45,33 +45,26 @@ public:
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
static int InsertOrUpdateMany(Database& db,
|
||||
const std::vector<InstanceListPlayer>& instance_list_player_entries)
|
||||
static uint32_t InsertOrUpdateMany(Database& db, const std::vector<InstanceListPlayer>& entries)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &instance_list_player_entry: instance_list_player_entries)
|
||||
if (entries.empty())
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(instance_list_player_entry.id));
|
||||
insert_values.push_back(std::to_string(instance_list_player_entry.charid));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
std::vector<std::string> values;
|
||||
values.reserve(entries.size());
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE id = VALUES(id)",
|
||||
TableName(),
|
||||
ColumnsRaw(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
values.push_back(fmt::format("({},{})", entry.id, entry.charid));
|
||||
}
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE id = VALUES(id)",
|
||||
TableName(), ColumnsRaw(), fmt::join(values, ",")));
|
||||
|
||||
return results.Success() ? results.RowsAffected() : 0;
|
||||
}
|
||||
|
||||
static bool ReplaceOne(Database& db, InstanceListPlayer e)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef EQEMU_ZONE_STATE_SPAWNS_REPOSITORY_H
|
||||
#define EQEMU_ZONE_STATE_SPAWNS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_zone_state_spawns_repository.h"
|
||||
|
||||
class ZoneStateSpawnsRepository: public BaseZoneStateSpawnsRepository {
|
||||
public:
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ZONE_STATE_SPAWNS_REPOSITORY_H
|
||||
+19
-13
@@ -230,6 +230,7 @@ RULE_BOOL(Character, PlayerTradingLoreFeedback, true, "If enabled, during a play
|
||||
RULE_INT(Character, MendAlwaysSucceedValue, 199, "Value at which mend will always succeed its skill check. Default: 199")
|
||||
RULE_BOOL(Character, SneakAlwaysSucceedOver100, false, "When sneak skill is over 100, always succeed sneak/hide. Default: false")
|
||||
RULE_INT(Character, BandolierSwapDelay, 0, "Bandolier swap delay in milliseconds, default is 0")
|
||||
RULE_BOOL(Character, EnableHackedFastCampForGM, false, "Enables hacked fast camp for GM clients, if the GM doesn't have a hacked client they'll camp like normal")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Mercs)
|
||||
@@ -373,6 +374,9 @@ RULE_BOOL(Zone, AllowCrossZoneSpellsOnBots, false, "Set to true to allow cross z
|
||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnMercs, false, "Set to true to allow cross zone spells (cast/remove) to affect mercenaries")
|
||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets")
|
||||
RULE_BOOL(Zone, ZoneShardQuestMenuOnly, false, "Set to true if you only want quests to show the zone shard menu")
|
||||
RULE_BOOL(Zone, StateSaveEntityVariables, true, "Set to true if you want buffs to be saved on shutdown")
|
||||
RULE_BOOL(Zone, StateSaveBuffs, true, "Set to true if you want buffs to be saved on shutdown")
|
||||
RULE_BOOL(Zone, StateSavingOnShutdown, true, "Set to true if you want zones to save state on shutdown (npcs, corpses, loot, entity variables, buffs etc.)")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Map)
|
||||
@@ -527,6 +531,7 @@ RULE_INT(Spells, TargetedAOEMaxTargets, 4, "Max number of targets a Targeted AOE
|
||||
RULE_INT(Spells, PointBlankAOEMaxTargets, 0, "Max number of targets a Point-Blank AOE spell can cast on. Set to 0 for no limit.")
|
||||
RULE_INT(Spells, DefaultAOEMaxTargets, 0, "Max number of targets that an AOE spell which does not meet other descriptions can cast on. Set to 0 for no limit.")
|
||||
RULE_BOOL(Spells, AllowFocusOnSkillDamageSpells, false, "Allow focus effects 185, 459, and 482 to enhance SkillAttack spell effect 193")
|
||||
RULE_STRING(Spells, AlwaysStackSpells, "", "Comma-Seperated list of spell IDs to always stack with every other spell, except themselves.")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Combat)
|
||||
@@ -713,6 +718,7 @@ RULE_INT(Aggro, BardAggroCap, 40, "per song bard aggro cap.")
|
||||
RULE_INT(Aggro, InitialAggroBonus, 100, "Initial Aggro Bonus, Default: 100")
|
||||
RULE_INT(Aggro, InitialPetAggroBonus, 100, "Initial Pet Aggro Bonus, Default 100")
|
||||
RULE_STRING(Aggro, ExcludedFleeAllyFactionIDs, "0|5013|5014|5023|5032", "Common Faction IDs that are excluded from faction checks in EntityList::FleeAllyCount")
|
||||
RULE_BOOL(Aggro, AggroBotPets, false, "If enabled, NPCs will aggro bot pets")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(TaskSystem)
|
||||
@@ -817,11 +823,11 @@ RULE_INT(Bots, MinDelayBetweenInCombatCastAttempts, 500, "The minimum delay in m
|
||||
RULE_INT(Bots, MaxDelayBetweenInCombatCastAttempts, 2000, "The maximum delay in milliseconds between cast attempts while in-combat. This is rolled between the min and max. Default 2500ms.")
|
||||
RULE_INT(Bots, MinDelayBetweenOutCombatCastAttempts, 1000, "The minimum delay in milliseconds between cast attempts while out-of-combat. This is rolled between the min and max. Default 1000ms.")
|
||||
RULE_INT(Bots, MaxDelayBetweenOutCombatCastAttempts, 2500, "The maximum delay in milliseconds between cast attempts while out-of-combat. This is rolled between the min and max. Default 2500ms.")
|
||||
RULE_INT(Bots, MezChance, 35, "35 Default. Chance for a bot to attempt to Mez a target after validating it is eligible.")
|
||||
RULE_INT(Bots, MezChance, 60, "60 Default. Chance for a bot to attempt to Mez a target after validating it is eligible.")
|
||||
RULE_INT(Bots, AEMezChance, 35, "35 Default. Chance for a bot to attempt to AE Mez targets after validating they are eligible.")
|
||||
RULE_INT(Bots, MezSuccessDelay, 3500, "3500 (3.5 sec) Default. Delay between successful Mez attempts.")
|
||||
RULE_INT(Bots, MezSuccessDelay, 2500, "2500 (2.5 sec) Default. Delay between successful Mez attempts.")
|
||||
RULE_INT(Bots, AEMezSuccessDelay, 5000, "5000 (5 sec) Default. Delay between successful AEMez attempts.")
|
||||
RULE_INT(Bots, MezFailDelay, 2000, "2000 (2 sec) Default. Delay between failed Mez attempts.")
|
||||
RULE_INT(Bots, MezFailDelay, 1250, "1250 (1.25 sec) Default. Delay between failed Mez attempts.")
|
||||
RULE_INT(Bots, MezAEFailDelay, 4000, "4000 (4 sec) Default. Delay between failed AEMez attempts.")
|
||||
RULE_INT(Bots, MinGroupHealTargets, 3, "Minimum number of targets in valid range that are required for a group heal to cast. Default 3.")
|
||||
RULE_INT(Bots, MinGroupCureTargets, 3, "Minimum number of targets in valid range that are required for a cure heal to cast. Default 3.")
|
||||
@@ -846,17 +852,15 @@ RULE_BOOL(Bots, BotArcheryConsumesAmmo, true, "Set to false to disable Archery A
|
||||
RULE_BOOL(Bots, BotThrowingConsumesAmmo, true, "Set to false to disable Throwing Ammo Consumption")
|
||||
RULE_INT(Bots, StackSizeMin, 20, "20 Default. -1 to disable and use default max stack size. Minimum stack size to give a bot (Arrows/Throwing).")
|
||||
RULE_INT(Bots, HasOrMayGetAggroThreshold, 90, "90 Default. Percent threshold of total hate where bots will stop casting spells that generate hate if they are set to try to not pull aggro via spells.")
|
||||
RULE_BOOL(Bots, UseFlatNormalMeleeRange, false, "False Default. If true, bots melee distance will be a flat distance set by Bots:NormalMeleeRangeDistance.")
|
||||
RULE_REAL(Bots, NormalMeleeRangeDistance, 0.75, "If UseFlatNormalMeleeRange is enabled, multiplier of the max melee range at which a bot will stand in melee combat. 0.75 Recommended, max melee for all abilities to land.")
|
||||
RULE_REAL(Bots, PercentMinMeleeDistance, 0.75, "Multiplier of the their melee range - Minimum distance from target a bot will stand while in melee combat before trying to adjust. 0.60 Recommended.")
|
||||
RULE_REAL(Bots, MaxDistanceForMelee, 20, "Maximum distance bots will stand for melee. Default 20 to allow all special attacks to land.")
|
||||
RULE_REAL(Bots, TauntNormalMeleeRangeDistance, 0.50, "Multiplier of the max melee range at which a taunting bot will stand in melee combat. 0.50 Recommended, closer than others .")
|
||||
RULE_REAL(Bots, PercentTauntMinMeleeDistance, 0.40, "Multiplier of their melee range - Minimum distance from target a taunting bot will stand while in melee combat before trying to adjust. 0.25 Recommended.")
|
||||
RULE_REAL(Bots, PercentMaxMeleeRangeDistance, 0.95, "Multiplier of the max melee range at which a bot will stand in melee combat. 0.95 Recommended, max melee while disabling special attacks/taunt.")
|
||||
RULE_REAL(Bots, PercentMinMaxMeleeRangeDistance, 0.75, "Multiplier of the closest max melee range at which a bot will stand in melee combat before trying to adjust. 0.75 Recommended, max melee while disabling special attacks/taunt.")
|
||||
RULE_REAL(Bots, LowerMeleeDistanceMultiplier, 0.35, "Closest % of the hit box a melee bot will get to the target. Default 0.35")
|
||||
RULE_REAL(Bots, LowerTauntingMeleeDistanceMultiplier, 0.25, "Closest % of the hit box a taunting melee bot will get to the target. Default 0.25")
|
||||
RULE_REAL(Bots, LowerMaxMeleeRangeDistanceMultiplier, 0.80, "Closest % of the hit box a max melee range melee bot will get to the target. Default 0.80")
|
||||
RULE_REAL(Bots, UpperMeleeDistanceMultiplier, 0.55, "Furthest % of the hit box a melee bot will get from the target. Default 0.55")
|
||||
RULE_REAL(Bots, UpperTauntingMeleeDistanceMultiplier, 0.45, "Furthest % of the hit box a taunting melee bot will get from the target. Default 0.45")
|
||||
RULE_REAL(Bots, UpperMaxMeleeRangeDistanceMultiplier, 0.95, "Furthest % of the hit box a max melee range melee bot will get from the target. Default 0.95")
|
||||
RULE_BOOL(Bots, DisableSpecialAbilitiesAtMaxMelee, true, "If true, when bots are at max melee distance, special abilities including taunt will be disabled. Default True.")
|
||||
RULE_BOOL(Bots, TauntingBotsFollowTopHate, true, "True Default. If true, bots that are taunting will attempt to stick with whoever currently is top hate.")
|
||||
RULE_INT(Bots, DistanceTauntingBotsStickMainHate, 10, "If TauntingBotsFollowTopHate is enabled, this is the distance bots will try to stick to whoever currently is Top Hate.")
|
||||
RULE_BOOL(Bots, DisableSpecialAbilitiesAtMaxMelee, true, "True Default. If true, when bots are at max melee distance, special abilities including taunt will be disabled.")
|
||||
RULE_INT(Bots, MinJitterTimer, 500, "Minimum ms between bot movement jitter checks.")
|
||||
RULE_INT(Bots, MaxJitterTimer, 2500, "Maximum ms between bot movement jitter checks. Set to 0 to disable timer checks.")
|
||||
RULE_BOOL(Bots, PreventBotCampOnFD, true, "True Default. If true, players will not be able to camp bots while feign death.")
|
||||
@@ -1143,6 +1147,7 @@ RULE_BOOL(Items, DisableSpellFocusEffects, false, "Enable this to disable Spell
|
||||
RULE_BOOL(Items, SummonItemAllowInvisibleAugments, false, "Enable this to allow augments to be put in invisible augment slots of items in Client::SummonItem")
|
||||
RULE_BOOL(Items, AugmentItemAllowInvisibleAugments, false, "Enable this to allow augments to be put in invisible augment slots by players")
|
||||
RULE_BOOL(Items, AlwaysReturnHandins, true, "Enable this to always return handins to the player")
|
||||
RULE_BOOL(Items, NPCUseRecommendedLevels, false, "Enable to have NPCs scale item stats by recommended levels")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Parcel)
|
||||
@@ -1158,8 +1163,9 @@ RULE_CATEGORY_END()
|
||||
RULE_CATEGORY(EvolvingItems)
|
||||
RULE_REAL(EvolvingItems, PercentOfSoloExperience, 0.1, "Percentage of solo experience allocated to evolving items that require experience.")
|
||||
RULE_REAL(EvolvingItems, PercentOfGroupExperience, 0.1, "Percentage of group experience allocated to evolving items that require experience.")
|
||||
RULE_REAL(EvolvingItems, PercentOfRaidExperience, 0.1, "Percentage of solo experience allocated to evolving items that require experience.")
|
||||
RULE_REAL(EvolvingItems, PercentOfRaidExperience, 0.1, "Percentage of raid experience allocated to evolving items that require experience.")
|
||||
RULE_INT(EvolvingItems, DelayUponEquipping, 30000, "Delay in ms before an evolving item will earn rewards after equipping. Default is 30000ms or 30s.")
|
||||
RULE_BOOL(EvolvingItems, DestroyAugmentsOnEvolve, false, "If this is enabled, any augments in an item will be destroyed when the item evolves. Otherwise, send augments to the player via the parcel system (requires that the Parcel System be enabled).")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
#undef RULE_CATEGORY
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
#ifndef EQEMU_SERVER_RELOAD_TYPES_H
|
||||
#define EQEMU_SERVER_RELOAD_TYPES_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
namespace ServerReload {
|
||||
enum Type {
|
||||
ReloadTypeNone = 0,
|
||||
AAData,
|
||||
AlternateCurrencies,
|
||||
BaseData,
|
||||
BlockedSpells,
|
||||
Commands,
|
||||
ContentFlags,
|
||||
DataBucketsCache,
|
||||
Doors,
|
||||
DzTemplates,
|
||||
Factions,
|
||||
GroundSpawns,
|
||||
LevelEXPMods,
|
||||
Logs,
|
||||
Loot,
|
||||
Merchants,
|
||||
NPCEmotes,
|
||||
NPCSpells,
|
||||
Objects,
|
||||
Opcodes,
|
||||
PerlExportSettings,
|
||||
Quests,
|
||||
QuestsTimerReset,
|
||||
Rules,
|
||||
SkillCaps,
|
||||
StaticZoneData,
|
||||
Tasks,
|
||||
Titles,
|
||||
Traps,
|
||||
Variables,
|
||||
VeteranRewards,
|
||||
WorldRepop,
|
||||
WorldWithRespawn,
|
||||
ZoneData,
|
||||
ZonePoints,
|
||||
Max
|
||||
};
|
||||
|
||||
static const char *Name[ServerReload::Max] = {
|
||||
"None",
|
||||
"AA Data",
|
||||
"Alternate Currencies",
|
||||
"Base Data",
|
||||
"Blocked Spells",
|
||||
"Commands",
|
||||
"Content Flags",
|
||||
"Data Buckets Cache",
|
||||
"Doors",
|
||||
"DZ Templates",
|
||||
"Factions",
|
||||
"Ground Spawns",
|
||||
"Level EXP Mods",
|
||||
"Logs",
|
||||
"Loot",
|
||||
"Merchants",
|
||||
"NPC Emotes",
|
||||
"NPC Spells",
|
||||
"Objects",
|
||||
"Opcodes",
|
||||
"Perl Event Export Settings",
|
||||
"Quest",
|
||||
"Quests With Timer (Resets timer events)",
|
||||
"Rules",
|
||||
"Skill Caps",
|
||||
"Static Zone Data",
|
||||
"Tasks",
|
||||
"Titles",
|
||||
"Traps",
|
||||
"Variables",
|
||||
"Veteran Rewards",
|
||||
"World Repop",
|
||||
"World Repop Timers (Clear Respawn Timers)",
|
||||
"Zone Data",
|
||||
"Zone Points"
|
||||
};
|
||||
|
||||
inline std::string GetName(int reload_type)
|
||||
{
|
||||
if (reload_type < 0 || reload_type >= ServerReload::Type::Max) {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
return ServerReload::Name[reload_type];
|
||||
}
|
||||
|
||||
// Get a clean name without spaces or special characters
|
||||
inline std::string GetNameClean(int reload_type)
|
||||
{
|
||||
if (reload_type < 0 || reload_type >= ServerReload::Type::Max) {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
// get the name before parentheses
|
||||
std::string name = ServerReload::Name[reload_type];
|
||||
size_t pos = name.find('(');
|
||||
if (pos != std::string::npos) {
|
||||
name = name.substr(0, pos);
|
||||
}
|
||||
|
||||
// Trim leading spaces
|
||||
size_t start = name.find_first_not_of(' ');
|
||||
if (start == std::string::npos) {
|
||||
return ""; // If all spaces, return empty string
|
||||
}
|
||||
|
||||
// Trim trailing spaces
|
||||
size_t end = name.find_last_not_of(' ');
|
||||
|
||||
// Extract trimmed substring
|
||||
return name.substr(start, end - start + 1);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
inline std::vector<ServerReload::Type> GetTypes()
|
||||
{
|
||||
std::vector<ServerReload::Type> types;
|
||||
types.reserve(ServerReload::Type::Max);
|
||||
for (int i = 1; i < ServerReload::Type::Max; i++) {
|
||||
types.push_back(static_cast<ServerReload::Type>(i));
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
struct Request {
|
||||
int type = 0;
|
||||
bool requires_zone_booted = false;
|
||||
int64 reload_at_unix = 0;
|
||||
int32 opt_param = 0;
|
||||
uint32_t zone_server_id = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //EQEMU_SERVER_RELOAD_TYPES_H
|
||||
+90
-110
@@ -170,18 +170,6 @@
|
||||
#define ServerOP_LFPMatches 0x0214
|
||||
#define ServerOP_ClientVersionSummary 0x0215
|
||||
|
||||
// expedition
|
||||
#define ServerOP_ExpeditionCreate 0x0400
|
||||
#define ServerOP_ExpeditionLockout 0x0403
|
||||
#define ServerOP_ExpeditionDzAddPlayer 0x0408
|
||||
#define ServerOP_ExpeditionDzMakeLeader 0x0409
|
||||
#define ServerOP_ExpeditionCharacterLockout 0x040d
|
||||
#define ServerOP_ExpeditionSaveInvite 0x040e
|
||||
#define ServerOP_ExpeditionRequestInvite 0x040f
|
||||
#define ServerOP_ExpeditionReplayOnJoin 0x0410
|
||||
#define ServerOP_ExpeditionLockState 0x0411
|
||||
#define ServerOP_ExpeditionLockoutDuration 0x0414
|
||||
|
||||
// dz
|
||||
#define ServerOP_DzAddRemoveMember 0x0450
|
||||
#define ServerOP_DzRemoveAllMembers 0x0451
|
||||
@@ -199,6 +187,15 @@
|
||||
#define ServerOP_DzDeleted 0x045d
|
||||
#define ServerOP_DzSetSwitchID 0x045e
|
||||
#define ServerOP_DzMovePC 0x045f
|
||||
#define ServerOP_DzLock 0x0460
|
||||
#define ServerOP_DzReplayOnJoin 0x0461
|
||||
#define ServerOP_DzLockout 0x0462
|
||||
#define ServerOP_DzLockoutDuration 0x0463
|
||||
#define ServerOP_DzCharacterLockout 0x0464
|
||||
#define ServerOP_DzAddPlayer 0x0465
|
||||
#define ServerOP_DzSaveInvite 0x0466
|
||||
#define ServerOP_DzRequestInvite 0x0467
|
||||
#define ServerOP_DzMakeLeader 0x0468
|
||||
|
||||
#define ServerOP_LSInfo 0x1000
|
||||
#define ServerOP_LSStatus 0x1001
|
||||
@@ -251,37 +248,7 @@
|
||||
#define ServerOP_UpdateSchedulerEvents 0x4007
|
||||
#define ServerOP_DiscordWebhookMessage 0x4008
|
||||
|
||||
#define ServerOP_ReloadAAData 0x4100
|
||||
#define ServerOP_ReloadAlternateCurrencies 0x4101
|
||||
#define ServerOP_ReloadBlockedSpells 0x4102
|
||||
#define ServerOP_ReloadCommands 0x4103
|
||||
#define ServerOP_ReloadContentFlags 0x4104
|
||||
#define ServerOP_ReloadDoors 0x4105
|
||||
#define ServerOP_ReloadGroundSpawns 0x4106
|
||||
#define ServerOP_ReloadLevelEXPMods 0x4107
|
||||
#define ServerOP_ReloadLogs 0x4108
|
||||
#define ServerOP_ReloadMerchants 0x4109
|
||||
#define ServerOP_ReloadNPCEmotes 0x4110
|
||||
#define ServerOP_ReloadObjects 0x4111
|
||||
#define ServerOP_ReloadOpcodes 0x4112
|
||||
#define ServerOP_ReloadPerlExportSettings 0x4113
|
||||
#define ServerOP_ReloadRules 0x4114
|
||||
#define ServerOP_ReloadStaticZoneData 0x4115
|
||||
#define ServerOP_ReloadTasks 0x4116
|
||||
#define ServerOP_ReloadTitles 0x4117
|
||||
#define ServerOP_ReloadTraps 0x4118
|
||||
#define ServerOP_ReloadVariables 0x4119
|
||||
#define ServerOP_ReloadVeteranRewards 0x4120
|
||||
#define ServerOP_ReloadWorld 0x4121
|
||||
#define ServerOP_ReloadZonePoints 0x4122
|
||||
#define ServerOP_ReloadDzTemplates 0x4123
|
||||
#define ServerOP_ReloadZoneData 0x4124
|
||||
#define ServerOP_ReloadDataBucketsCache 0x4125
|
||||
#define ServerOP_ReloadFactions 0x4126
|
||||
#define ServerOP_ReloadLoot 0x4127
|
||||
#define ServerOP_ReloadBaseData 0x4128
|
||||
#define ServerOP_ReloadSkillCaps 0x4129
|
||||
#define ServerOP_ReloadNPCSpells 0x4130
|
||||
#define ServerOP_ServerReloadRequest 0x4100
|
||||
|
||||
#define ServerOP_CZDialogueWindow 0x4500
|
||||
#define ServerOP_CZLDoNUpdate 0x4501
|
||||
@@ -710,36 +677,53 @@ struct ServerLSPlayerZoneChange_Struct {
|
||||
uint32 to; // 0 = world
|
||||
};
|
||||
|
||||
struct ClientAuth_Struct {
|
||||
struct ClientAuth {
|
||||
uint32 loginserver_account_id; // ID# in login server's db
|
||||
char loginserver_name[64];
|
||||
char account_name[30]; // username in login server's db
|
||||
char key[30]; // the Key the client will present
|
||||
uint8 lsadmin; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
char loginserver_name[64];
|
||||
char account_name[30]; // username in login server's db
|
||||
char key[30]; // the key the client will present
|
||||
uint8 lsadmin; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip_address;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
|
||||
template <class Archive>
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
{
|
||||
ar(loginserver_account_id, loginserver_name, account_name, key, lsadmin, is_world_admin, ip, is_client_from_local_network);
|
||||
ar(
|
||||
loginserver_account_id,
|
||||
loginserver_name,
|
||||
account_name,
|
||||
key,
|
||||
lsadmin,
|
||||
is_world_admin,
|
||||
ip_address,
|
||||
is_client_from_local_network
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
struct ClientAuthLegacy_Struct {
|
||||
struct ClientAuthLegacy {
|
||||
uint32 loginserver_account_id; // ID# in login server's db
|
||||
char loginserver_account_name[30]; // username in login server's db
|
||||
char key[30]; // the Key the client will present
|
||||
uint8 loginserver_admin_level; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
char loginserver_account_name[30]; // username in login server's db
|
||||
char key[30]; // the key the client will present
|
||||
uint8 loginserver_admin_level; // login server admin level
|
||||
int16 is_world_admin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip_address;
|
||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
||||
|
||||
template <class Archive>
|
||||
template<class Archive>
|
||||
void serialize(Archive &ar)
|
||||
{
|
||||
ar(loginserver_account_id, loginserver_account_name, key, loginserver_admin_level, is_world_admin, ip, is_client_from_local_network);
|
||||
ar(
|
||||
loginserver_account_id,
|
||||
loginserver_account_name,
|
||||
key,
|
||||
loginserver_admin_level,
|
||||
is_world_admin,
|
||||
ip_address,
|
||||
is_client_from_local_network
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -867,38 +851,38 @@ struct ServerSyncWorldList_Struct {
|
||||
bool placeholder;
|
||||
};
|
||||
|
||||
struct UsertoWorldRequestLegacy_Struct {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char IPAddr[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldRequest_Struct {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char IPAddr[64];
|
||||
char login[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldResponseLegacy_Struct {
|
||||
struct UsertoWorldRequestLegacy {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char IPAddr[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldRequest {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
uint32 FromID; // appears to be unused today
|
||||
uint32 ToID; // appears to be unused today
|
||||
char IPAddr[64];
|
||||
char login[64];
|
||||
};
|
||||
|
||||
struct UsertoWorldResponseLegacy {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
};
|
||||
|
||||
struct UsertoWorldResponse_Struct {
|
||||
struct UsertoWorldResponse {
|
||||
uint32 lsaccountid;
|
||||
uint32 worldid;
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID;
|
||||
uint32 ToID;
|
||||
char login[64];
|
||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||
uint32 FromID; // appears to be unused today
|
||||
uint32 ToID; // appears to be unused today
|
||||
char login[64];
|
||||
};
|
||||
|
||||
// generic struct to be used for alot of simple zone->world questions
|
||||
@@ -1543,10 +1527,8 @@ struct UCSServerStatus_Struct {
|
||||
};
|
||||
};
|
||||
|
||||
struct ServerExpeditionID_Struct {
|
||||
uint32 expedition_id;
|
||||
uint32 sender_zone_id;
|
||||
uint32 sender_instance_id;
|
||||
struct ServerCharacterID_Struct {
|
||||
uint32_t char_id;
|
||||
};
|
||||
|
||||
struct ServerDzLeaderID_Struct {
|
||||
@@ -1580,45 +1562,42 @@ struct ServerDzMovePC_Struct {
|
||||
uint32 character_id;
|
||||
};
|
||||
|
||||
struct ServerExpeditionLockout_Struct {
|
||||
uint32 expedition_id;
|
||||
struct ServerDzLockout_Struct {
|
||||
uint32 dz_id;
|
||||
uint64 expire_time;
|
||||
uint32 duration;
|
||||
uint32 sender_zone_id;
|
||||
uint16 sender_instance_id;
|
||||
uint8 remove;
|
||||
uint8 members_only;
|
||||
int seconds_adjust;
|
||||
int seconds;
|
||||
char event_name[256];
|
||||
};
|
||||
|
||||
struct ServerExpeditionLockState_Struct {
|
||||
uint32 expedition_id;
|
||||
struct ServerDzLock_Struct {
|
||||
uint32 dz_id;
|
||||
uint32 sender_zone_id;
|
||||
uint16 sender_instance_id;
|
||||
uint8 enabled;
|
||||
bool lock;
|
||||
uint8 lock_msg; // 0: none, 1: closing 2: trial begin
|
||||
uint32 color;
|
||||
};
|
||||
|
||||
struct ServerExpeditionSetting_Struct {
|
||||
uint32 expedition_id;
|
||||
struct ServerDzBool_Struct {
|
||||
uint32 dz_id;
|
||||
uint32 sender_zone_id;
|
||||
uint16 sender_instance_id;
|
||||
uint8 enabled;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
struct ServerExpeditionCharacterLockout_Struct {
|
||||
struct ServerDzCharacterLockout_Struct {
|
||||
uint8 remove;
|
||||
uint32 character_id;
|
||||
uint32 char_id;
|
||||
uint64 expire_time;
|
||||
uint32 duration;
|
||||
char uuid[37];
|
||||
char expedition_name[128];
|
||||
char event_name[256];
|
||||
};
|
||||
|
||||
struct ServerExpeditionCharacterID_Struct {
|
||||
uint32_t character_id;
|
||||
char expedition[128];
|
||||
char event[256];
|
||||
};
|
||||
|
||||
struct ServerDzExpireWarning_Struct {
|
||||
@@ -1627,7 +1606,7 @@ struct ServerDzExpireWarning_Struct {
|
||||
};
|
||||
|
||||
struct ServerDzCommand_Struct {
|
||||
uint32 expedition_id;
|
||||
uint32 dz_id;
|
||||
uint8 is_char_online; // 0: target name is offline, 1: online
|
||||
char requester_name[64];
|
||||
char target_name[64];
|
||||
@@ -1696,11 +1675,12 @@ struct ServerDzSetDuration_Struct {
|
||||
uint32 seconds;
|
||||
};
|
||||
|
||||
struct ServerDzCreateSerialized_Struct {
|
||||
struct ServerDzCreate_Struct {
|
||||
uint16_t origin_zone_id;
|
||||
uint16_t origin_instance_id;
|
||||
uint32_t dz_id;
|
||||
uint32_t cereal_size;
|
||||
char cereal_data[0];
|
||||
char cereal_data[1];
|
||||
};
|
||||
|
||||
struct ServerSendPlayerEvent_Struct {
|
||||
|
||||
+23
-14
@@ -93,7 +93,14 @@ bool IsTargetableAESpell(uint16 spell_id)
|
||||
return false;
|
||||
}
|
||||
|
||||
return spells[spell_id].target_type == ST_AETarget;
|
||||
return (
|
||||
spells[spell_id].target_type == ST_AETarget ||
|
||||
spells[spell_id].target_type == ST_TargetAETap ||
|
||||
spells[spell_id].target_type == ST_AETargetHateList ||
|
||||
spells[spell_id].target_type == ST_TargetAENoPlayersPets ||
|
||||
spells[spell_id].target_type == ST_UndeadAE ||
|
||||
spells[spell_id].target_type == ST_SummonedAE
|
||||
);
|
||||
}
|
||||
|
||||
bool IsSacrificeSpell(uint16 spell_id)
|
||||
@@ -675,17 +682,19 @@ bool IsAnyNukeOrStunSpell(uint16 spell_id) {
|
||||
}
|
||||
|
||||
bool IsAnyAESpell(uint16 spell_id) {
|
||||
return (
|
||||
IsValidSpell(spell_id) &&
|
||||
(
|
||||
IsAEDurationSpell(spell_id) ||
|
||||
IsAESpell(spell_id) ||
|
||||
IsAERainNukeSpell(spell_id) ||
|
||||
IsAERainSpell(spell_id) ||
|
||||
IsPBAESpell(spell_id) ||
|
||||
IsPBAENukeSpell(spell_id)
|
||||
)
|
||||
);
|
||||
if (!IsValidSpell(spell_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
IsTargetableAESpell(spell_id) ||
|
||||
IsAESpell(spell_id) ||
|
||||
IsPBAESpell(spell_id) ||
|
||||
IsAEDurationSpell(spell_id) ||
|
||||
IsAERainNukeSpell(spell_id) ||
|
||||
IsAERainSpell(spell_id) ||
|
||||
IsPBAENukeSpell(spell_id)
|
||||
);
|
||||
}
|
||||
|
||||
bool IsAESpell(uint16 spell_id)
|
||||
@@ -740,8 +749,8 @@ bool IsPBAESpell(uint16 spell_id)
|
||||
|
||||
if (
|
||||
spell.aoe_range > 0 &&
|
||||
spell.target_type == ST_AECaster
|
||||
) {
|
||||
!IsTargetRequiredForSpell(spell_id)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -736,14 +736,15 @@ namespace BotSpellTypes
|
||||
constexpr uint16 DiscUtility = 203;
|
||||
|
||||
constexpr uint16 START = BotSpellTypes::Nuke; // Do not remove or change this
|
||||
constexpr uint16 END = BotSpellTypes::PetResistBuffs; // Do not remove this, increment as needed
|
||||
constexpr uint16 COMMANDED_START = BotSpellTypes::Lull; // Do not remove or change this
|
||||
constexpr uint16 COMMANDED_END = BotSpellTypes::AELull; // Do not remove this, increment as needed
|
||||
constexpr uint16 DISCIPLINE_START = BotSpellTypes::Discipline; // Do not remove or change this
|
||||
constexpr uint16 DISCIPLINE_END = BotSpellTypes::DiscUtility; // Do not remove this, increment as needed
|
||||
constexpr uint16 END = BotSpellTypes::PetResistBuffs; // Do not remove this, increment as needed
|
||||
constexpr uint16 COMMANDED_START = BotSpellTypes::Lull; // Do not remove or change this
|
||||
constexpr uint16 COMMANDED_END = BotSpellTypes::AELull; // Do not remove this, increment as needed
|
||||
constexpr uint16 DISCIPLINE_START = BotSpellTypes::Discipline; // Do not remove or change this
|
||||
constexpr uint16 DISCIPLINE_END = BotSpellTypes::DiscUtility; // Do not remove this, increment as needed
|
||||
constexpr uint16 PARENT_TYPE_END = BotSpellTypes::PreCombatBuffSong; // This is the last ID of the original bot spell types, the rest are considered sub types.
|
||||
}
|
||||
|
||||
static std::map<uint16, std::string> spellType_names = {
|
||||
static std::map<uint16, std::string> spell_type_names = {
|
||||
{ BotSpellTypes::Nuke, "Nuke" },
|
||||
{ BotSpellTypes::RegularHeal, "Regular Heal" },
|
||||
{ BotSpellTypes::Root, "Root" },
|
||||
@@ -818,7 +819,7 @@ static std::map<uint16, std::string> spellType_names = {
|
||||
{ BotSpellTypes::AELull, "AE Lull" }
|
||||
};
|
||||
|
||||
static std::map<uint16, std::string> spellType_shortNames = {
|
||||
static std::map<uint16, std::string> spell_type_short_names = {
|
||||
{ BotSpellTypes::Nuke, "nukes" },
|
||||
{ BotSpellTypes::RegularHeal, "regularheals" },
|
||||
{ BotSpellTypes::Root, "roots" },
|
||||
@@ -900,7 +901,7 @@ const uint32 SPELL_TYPES_INNATE = (SpellType_Nuke | SpellType_Lifetap | SpellTyp
|
||||
// Bot related functions
|
||||
bool IsBotSpellTypeDetrimental (uint16 spell_type);
|
||||
bool IsBotSpellTypeBeneficial (uint16 spell_type);
|
||||
bool IsBotSpellTypeOtherBeneficial(uint16 spell_type);
|
||||
bool BotSpellTypeUsesTargetSettings(uint16 spell_type);
|
||||
bool IsBotSpellTypeInnate (uint16 spell_type);
|
||||
bool IsAEBotSpellType(uint16 spell_type);
|
||||
bool IsGroupBotSpellType(uint16 spell_type);
|
||||
|
||||
@@ -90,7 +90,7 @@ bool IsBotSpellTypeBeneficial(uint16 spell_type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsBotSpellTypeOtherBeneficial(uint16 spell_type) {
|
||||
bool BotSpellTypeUsesTargetSettings(uint16 spell_type) {
|
||||
switch (spell_type) {
|
||||
case BotSpellTypes::RegularHeal:
|
||||
case BotSpellTypes::CompleteHeal:
|
||||
|
||||
@@ -912,3 +912,35 @@ std::string Strings::ZoneTime(const uint8 hours, const uint8 minutes)
|
||||
hours >= 13 ? "PM" : "AM"
|
||||
);
|
||||
}
|
||||
|
||||
std::string Strings::Slugify(const std::string& input, const std::string& separator) {
|
||||
std::string slug;
|
||||
bool last_was_hyphen = false;
|
||||
|
||||
for (char c : input) {
|
||||
if (std::isalnum(c)) {
|
||||
slug += std::tolower(c);
|
||||
last_was_hyphen = false;
|
||||
} else if (c == ' ' || c == '_' || c == '-') {
|
||||
if (!last_was_hyphen && !slug.empty()) {
|
||||
slug += separator;
|
||||
last_was_hyphen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove trailing hyphen if present
|
||||
if (!slug.empty() && slug.back() == '-') {
|
||||
slug.pop_back();
|
||||
}
|
||||
|
||||
return slug;
|
||||
}
|
||||
|
||||
bool Strings::IsValidJson(const std::string &json)
|
||||
{
|
||||
rapidjson::Document doc;
|
||||
rapidjson::ParseResult result = doc.Parse(json.c_str());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <type_traits>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <cereal/external/rapidjson/document.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
// this doesn't appear to affect linux-based systems..need feedback for _WIN64
|
||||
@@ -186,6 +187,9 @@ public:
|
||||
value = strtod(tmp_str.data(), nullptr);
|
||||
return res;
|
||||
}
|
||||
|
||||
static std::string Slugify(const std::string &input, const std::string &separator = "-");
|
||||
static bool IsValidJson(const std::string& json);
|
||||
};
|
||||
|
||||
const std::string StringFormat(const char *format, ...);
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@
|
||||
|
||||
// Build variables
|
||||
// these get injected during the build pipeline
|
||||
#define CURRENT_VERSION "22.62.2-dev" // always append -dev to the current version for custom-builds
|
||||
#define CURRENT_VERSION "23.3.0-dev" // always append -dev to the current version for custom-builds
|
||||
#define LOGIN_VERSION "0.8.0"
|
||||
#define COMPILE_DATE __DATE__
|
||||
#define COMPILE_TIME __TIME__
|
||||
@@ -42,7 +42,7 @@
|
||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9302
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9310
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
|
||||
|
||||
#endif
|
||||
|
||||
@@ -143,7 +143,7 @@ void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Ne
|
||||
packet.ToString()
|
||||
);
|
||||
|
||||
if (packet.Length() < sizeof(UsertoWorldResponseLegacy_Struct)) {
|
||||
if (packet.Length() < sizeof(UsertoWorldResponseLegacy)) {
|
||||
LogError(
|
||||
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
"but was too small. Discarded to avoid buffer overrun"
|
||||
@@ -152,7 +152,7 @@ void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Ne
|
||||
return;
|
||||
}
|
||||
|
||||
auto *res = (UsertoWorldResponseLegacy_Struct *) packet.Data();
|
||||
auto *res = (UsertoWorldResponseLegacy *) packet.Data();
|
||||
|
||||
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
||||
Client *c = server.client_manager->GetClient(res->lsaccountid, "eqemu");
|
||||
@@ -229,7 +229,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
|
||||
packet.ToString()
|
||||
);
|
||||
|
||||
if (packet.Length() < sizeof(UsertoWorldResponse_Struct)) {
|
||||
if (packet.Length() < sizeof(UsertoWorldResponse)) {
|
||||
LogError(
|
||||
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||
"but was too small. Discarded to avoid buffer overrun"
|
||||
@@ -238,7 +238,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
|
||||
return;
|
||||
}
|
||||
|
||||
auto res = (UsertoWorldResponse_Struct *) packet.Data();
|
||||
auto res = (UsertoWorldResponse *) packet.Data();
|
||||
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
||||
|
||||
Client *c = server.client_manager->GetClient(
|
||||
@@ -358,14 +358,12 @@ void WorldServer::ProcessLSAccountUpdate(uint16_t opcode, const EQ::Net::Packet
|
||||
void WorldServer::HandleNewWorldserver(LoginserverNewWorldRequest *req)
|
||||
{
|
||||
if (m_is_server_logged_in) {
|
||||
LogError(
|
||||
"Login server was already marked as logged in, aborting"
|
||||
);
|
||||
LogInfo("Login server was already marked as logged in, returning");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HandleNewWorldserverValidation(req)) {
|
||||
LogError("WorldServer::HandleNewWorldserver failed validation rules");
|
||||
LogError("failed validation rules");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -494,7 +492,7 @@ void WorldServer::HandleWorldserverStatusUpdate(LoginserverWorldStatusUpdate *u)
|
||||
void WorldServer::SendClientAuthToWorld(Client *c)
|
||||
{
|
||||
EQ::Net::DynamicPacket outapp;
|
||||
ClientAuth_Struct a{};
|
||||
ClientAuth a{};
|
||||
|
||||
a.loginserver_account_id = c->GetAccountID();
|
||||
|
||||
@@ -503,7 +501,7 @@ void WorldServer::SendClientAuthToWorld(Client *c)
|
||||
|
||||
a.lsadmin = 0;
|
||||
a.is_world_admin = 0;
|
||||
a.ip = inet_addr(c->GetConnection()->GetRemoteAddr().c_str());
|
||||
a.ip_address = inet_addr(c->GetConnection()->GetRemoteAddr().c_str());
|
||||
strncpy(a.loginserver_name, &c->GetLoginServerName()[0], 64);
|
||||
|
||||
const std::string &client_address(c->GetConnection()->GetRemoteAddr());
|
||||
@@ -521,7 +519,7 @@ void WorldServer::SendClientAuthToWorld(Client *c)
|
||||
}
|
||||
|
||||
struct in_addr ip_addr{};
|
||||
ip_addr.s_addr = a.ip;
|
||||
ip_addr.s_addr = a.ip_address;
|
||||
|
||||
LogInfo(
|
||||
"Client authentication response: world_address [{}] client_address [{}]",
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
std::string m_server_version;
|
||||
bool m_is_server_authorized_to_list;
|
||||
bool m_is_server_logged_in;
|
||||
bool m_is_server_trusted;
|
||||
bool m_is_server_trusted; // this is primarily for worldserver being able to push updates to the loginserver
|
||||
|
||||
static void FormatWorldServerName(char *name, int8 server_list_type);
|
||||
};
|
||||
|
||||
@@ -154,9 +154,9 @@ void WorldServerManager::SendUserLoginToWorldRequest(
|
||||
|
||||
if (iter != m_world_servers.end()) {
|
||||
EQ::Net::DynamicPacket outapp;
|
||||
outapp.Resize(sizeof(UsertoWorldRequest_Struct));
|
||||
outapp.Resize(sizeof(UsertoWorldRequest));
|
||||
|
||||
auto *r = reinterpret_cast<UsertoWorldRequest_Struct *>(outapp.Data());
|
||||
auto *r = reinterpret_cast<UsertoWorldRequest *>(outapp.Data());
|
||||
r->worldid = server_id;
|
||||
r->lsaccountid = client_account_id;
|
||||
strncpy(r->login, client_loginserver.c_str(), 64);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eqemu-server",
|
||||
"version": "22.62.2",
|
||||
"version": "23.3.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/EQEmu/Server.git"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "worldserver.h"
|
||||
#include "../common/events/player_events.h"
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/server_reload_types.h"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <stdarg.h>
|
||||
@@ -72,9 +73,13 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadLogs: {
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
player_event_logs.ReloadSettings();
|
||||
case ServerOP_ServerReloadRequest: {
|
||||
auto o = (ServerReload::Request*) p.Data();
|
||||
if (o->type == ServerReload::Type::Logs) {
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
player_event_logs.ReloadSettings();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ServerOP_QueryServGeneric: {
|
||||
|
||||
+8
-3
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "database.h"
|
||||
#include "../common/discord/discord_manager.h"
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/server_reload_types.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
@@ -75,9 +76,13 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadLogs: {
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
player_event_logs.ReloadSettings();
|
||||
case ServerOP_ServerReloadRequest: {
|
||||
auto o = (ServerReload::Request*) pack->pBuffer;
|
||||
if (o->type == ServerReload::Type::Logs) {
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
player_event_logs.ReloadSettings();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ServerOP_PlayerEvent: {
|
||||
|
||||
@@ -56,8 +56,9 @@ echo "# Running shared_memory"
|
||||
echo "# Running NPC hand-in tests"
|
||||
./bin/zone tests:npc-handins 2>&1 | tee test_output.log
|
||||
./bin/zone tests:npc-handins-multiquest 2>&1 | tee -a test_output.log
|
||||
./bin/zone tests:databuckets 2>&1 | tee -a test_output.log
|
||||
|
||||
if grep -E -q "QueryErr|Error" test_output.log; then
|
||||
if grep -E -q "QueryErr|Error|FAILED" test_output.log; then
|
||||
echo "Error found in test output! Failing build."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -11,8 +11,6 @@ SET(world_sources
|
||||
dynamic_zone_manager.cpp
|
||||
eql_config.cpp
|
||||
eqemu_api_world_data_service.cpp
|
||||
expedition_database.cpp
|
||||
expedition_message.cpp
|
||||
launcher_link.cpp
|
||||
launcher_list.cpp
|
||||
lfplist.cpp
|
||||
@@ -48,8 +46,6 @@ SET(world_headers
|
||||
dynamic_zone_manager.h
|
||||
eql_config.h
|
||||
eqemu_api_world_data_service.h
|
||||
expedition_database.h
|
||||
expedition_message.h
|
||||
launcher_link.h
|
||||
launcher_list.h
|
||||
lfplist.h
|
||||
|
||||
+14
-14
@@ -447,30 +447,30 @@ void Client::SendPostEnterWorld() {
|
||||
|
||||
bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
{
|
||||
if (app->size != sizeof(LoginInfo_Struct)) {
|
||||
if (app->size != sizeof(LoginInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto *login_info = (LoginInfo_Struct *) app->pBuffer;
|
||||
auto *r = (LoginInfo *) app->pBuffer;
|
||||
|
||||
// Quagmire - max len for name is 18, pass 15
|
||||
char name[19] = {0};
|
||||
char password[16] = {0};
|
||||
strn0cpy(name, (char *) login_info->login_info, 18);
|
||||
strn0cpy(password, (char *) &(login_info->login_info[strlen(name) + 1]), 15);
|
||||
strn0cpy(name, (char *) r->login_info, 18);
|
||||
strn0cpy(password, (char *) &(r->login_info[strlen(name) + 1]), 15);
|
||||
|
||||
LogDebug("Receiving Login Info Packet from Client | name [{0}] password [{1}]", name, password);
|
||||
LogDebug("Receiving login info packet from client | name [{}] password [{}]", name, password);
|
||||
|
||||
if (strlen(password) <= 1) {
|
||||
LogInfo("Login without a password");
|
||||
return false;
|
||||
}
|
||||
|
||||
is_player_zoning = (login_info->zoning == 1);
|
||||
is_player_zoning = (r->zoning == 1);
|
||||
|
||||
uint32 id = Strings::ToInt(name);
|
||||
if (id == 0) {
|
||||
LogWarning("Receiving Login Info Packet from Client | account_id is 0 - disconnecting");
|
||||
LogWarning("Receiving login info packet from client | account_id is 0 - disconnecting");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -480,15 +480,15 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
LogClientLogin("Checking authentication id [{}] passed", id);
|
||||
if (!is_player_zoning) {
|
||||
// Track who is in and who is out of the game
|
||||
char *inout= (char *) "";
|
||||
std::string in_out;
|
||||
|
||||
if (cle->GetOnline() == CLE_Status::Never){
|
||||
if (cle->GetOnline() == CLE_Status::Never) {
|
||||
// Desktop -> Char Select
|
||||
inout = (char *) "In";
|
||||
in_out = "in";
|
||||
}
|
||||
else {
|
||||
// Game -> Char Select
|
||||
inout=(char *) "Out";
|
||||
in_out = "out";
|
||||
}
|
||||
|
||||
// Always at Char select at this point.
|
||||
@@ -497,7 +497,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
// Could use a Logging Out Completely message somewhere.
|
||||
cle->SetOnline(CLE_Status::CharSelect);
|
||||
|
||||
LogInfo("Account ({}) Logging({}) to character select :: LSID [{}] ", cle->AccountName(), inout, cle->LSID());
|
||||
LogInfo("Account ({}) Logging ({}) to character select :: LSID [{}] ", cle->AccountName(), in_out, cle->LSID());
|
||||
}
|
||||
else {
|
||||
cle->SetOnline();
|
||||
@@ -545,7 +545,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
if (!skip_char_info && !custom_files_key.empty() && cle->Admin() < RuleI(World, CustomFilesAdminLevel)) {
|
||||
// Modified clients can utilize this unused block in login_info to send custom payloads on login
|
||||
// which indicates they are using custom client files with the correct version, based on key payload.
|
||||
const auto client_key = std::string(reinterpret_cast<char*>(login_info->unknown064));
|
||||
const auto client_key = std::string(reinterpret_cast<char*>(r->unknown064));
|
||||
if (custom_files_key != client_key) {
|
||||
std::string message = fmt::format("Missing Files [{}]", RuleS(World, CustomFilesUrl) );
|
||||
SendUnsupportedClientPacket(message);
|
||||
@@ -1434,7 +1434,7 @@ void Client::EnterWorld(bool TryBootup) {
|
||||
}
|
||||
else {
|
||||
if (TryBootup) {
|
||||
LogInfo("Attempting autobootup of [{}] ([{}]:[{}])", zone_name, zone_id, instance_id);
|
||||
LogInfo("Attempting autobootup of [{}] [{}] [{}]", zone_name, zone_id, instance_id);
|
||||
autobootup_timeout.Start();
|
||||
zone_waiting_for_bootup = zoneserver_list.TriggerBootup(zone_id, instance_id);
|
||||
if (zone_waiting_for_bootup == 0) {
|
||||
|
||||
+159
-182
@@ -1,20 +1,3 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2005 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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 "../common/global_define.h"
|
||||
#include "cliententry.h"
|
||||
#include "clientlist.h"
|
||||
@@ -24,93 +7,86 @@
|
||||
#include "worlddb.h"
|
||||
#include "zoneserver.h"
|
||||
#include "world_config.h"
|
||||
#include "../common/guilds.h"
|
||||
#include "../common/strings.h"
|
||||
|
||||
extern uint32 numplayers;
|
||||
extern LoginServerList loginserverlist;
|
||||
extern ClientList client_list;
|
||||
extern volatile bool RunLoops;
|
||||
extern uint32 numplayers;
|
||||
extern LoginServerList loginserverlist;
|
||||
extern ClientList client_list;
|
||||
extern volatile bool RunLoops;
|
||||
extern SharedTaskManager shared_task_manager;
|
||||
|
||||
/**
|
||||
* @param in_id
|
||||
* @param in_loginserver_id
|
||||
* @param in_loginserver_name
|
||||
* @param in_login_name
|
||||
* @param in_login_key
|
||||
* @param in_is_world_admin
|
||||
* @param ip
|
||||
* @param local
|
||||
*/
|
||||
ClientListEntry::ClientListEntry(
|
||||
uint32 in_id,
|
||||
uint32 in_loginserver_id,
|
||||
const char *in_loginserver_name,
|
||||
const char *in_login_name,
|
||||
const char *in_login_key,
|
||||
int16 in_is_world_admin,
|
||||
uint32 ip,
|
||||
uint32 id,
|
||||
uint32 login_server_id,
|
||||
const char *login_server_name,
|
||||
const char *account_name,
|
||||
const char *login_key,
|
||||
int16 is_world_admin,
|
||||
uint32 ip_address,
|
||||
uint8 local
|
||||
)
|
||||
: id(in_id)
|
||||
: m_id(id)
|
||||
{
|
||||
ClearVars(true);
|
||||
|
||||
LogDebug(
|
||||
"in_id [{0}] in_loginserver_id [{1}] in_loginserver_name [{2}] in_login_name [{3}] in_login_key [{4}] "
|
||||
" in_is_world_admin [{5}] ip [{6}] local [{7}]",
|
||||
in_id,
|
||||
in_loginserver_id,
|
||||
in_loginserver_name,
|
||||
in_login_name,
|
||||
in_login_key,
|
||||
in_is_world_admin,
|
||||
ip,
|
||||
"id [{}] loginserver_id [{}] loginserver_name [{}] login_name [{}] login_key [{}] is_world_admin [{}] ip [{}] local [{}]",
|
||||
id,
|
||||
login_server_id,
|
||||
login_server_name,
|
||||
account_name,
|
||||
login_key,
|
||||
is_world_admin,
|
||||
ip_address,
|
||||
local
|
||||
);
|
||||
|
||||
pIP = ip;
|
||||
pLSID = in_loginserver_id;
|
||||
if (in_loginserver_id > 0) {
|
||||
paccountid = database.GetAccountIDFromLSID(in_loginserver_name, in_loginserver_id, paccountname, &padmin);
|
||||
m_ip_address = ip_address;
|
||||
m_login_server_id = login_server_id;
|
||||
if (login_server_id > 0) {
|
||||
m_account_id = database.GetAccountIDFromLSID(
|
||||
login_server_name,
|
||||
login_server_id,
|
||||
m_account_name,
|
||||
&m_admin
|
||||
);
|
||||
}
|
||||
|
||||
strn0cpy(loginserver_account_name, in_login_name, sizeof(loginserver_account_name));
|
||||
strn0cpy(plskey, in_login_key, sizeof(plskey));
|
||||
strn0cpy(source_loginserver, in_loginserver_name, sizeof(source_loginserver));
|
||||
pworldadmin = in_is_world_admin;
|
||||
plocal = (local == 1);
|
||||
strn0cpy(m_login_account_name, account_name, sizeof(m_login_account_name));
|
||||
strn0cpy(m_key, login_key, sizeof(m_key));
|
||||
strn0cpy(m_source_loginserver, login_server_name, sizeof(m_source_loginserver));
|
||||
|
||||
memset(pLFGComments, 0, 64);
|
||||
m_world_admin = is_world_admin;
|
||||
m_is_local = (local == 1);
|
||||
|
||||
memset(m_lfg_comments, 0, 64);
|
||||
}
|
||||
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
||||
: id(in_id)
|
||||
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer *z, ServerClientList_Struct *scl, CLE_Status online)
|
||||
: m_id(in_id)
|
||||
{
|
||||
ClearVars(true);
|
||||
|
||||
pIP = 0;
|
||||
pLSID = scl->LSAccountID;
|
||||
strn0cpy(loginserver_account_name, scl->name, sizeof(loginserver_account_name));
|
||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
||||
pworldadmin = 0;
|
||||
m_ip_address = 0;
|
||||
m_login_server_id = scl->LSAccountID;
|
||||
strn0cpy(m_login_account_name, scl->name, sizeof(m_login_account_name));
|
||||
strn0cpy(m_key, scl->lskey, sizeof(m_key));
|
||||
m_world_admin = 0;
|
||||
|
||||
paccountid = scl->AccountID;
|
||||
strn0cpy(paccountname, scl->AccountName, sizeof(paccountname));
|
||||
padmin = scl->Admin;
|
||||
m_account_id = scl->AccountID;
|
||||
strn0cpy(m_account_name, scl->AccountName, sizeof(m_account_name));
|
||||
m_admin = scl->Admin;
|
||||
|
||||
pinstance = 0;
|
||||
pLFGFromLevel = 0;
|
||||
pLFGToLevel = 0;
|
||||
pLFGMatchFilter = false;
|
||||
memset(pLFGComments, 0, 64);
|
||||
m_instance = 0;
|
||||
m_lfg_from_level = 0;
|
||||
m_lfg_to_level = 0;
|
||||
m_lfg_match_filter = false;
|
||||
memset(m_lfg_comments, 0, 64);
|
||||
|
||||
if (iOnline >= CLE_Status::Zoning) {
|
||||
Update(iZS, scl, iOnline);
|
||||
if (online >= CLE_Status::Zoning) {
|
||||
Update(z, scl, online);
|
||||
}
|
||||
else {
|
||||
SetOnline(iOnline);
|
||||
SetOnline(online);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,16 +96,16 @@ ClientListEntry::~ClientListEntry()
|
||||
Camp(); // updates zoneserver's numplayers
|
||||
client_list.RemoveCLEReferances(this);
|
||||
}
|
||||
for (auto& elem : tell_queue) {
|
||||
for (auto &elem: m_tell_queue) {
|
||||
safe_delete_array(elem);
|
||||
}
|
||||
tell_queue.clear();
|
||||
m_tell_queue.clear();
|
||||
}
|
||||
|
||||
void ClientListEntry::SetChar(uint32 iCharID, const char *iCharName)
|
||||
{
|
||||
pcharid = iCharID;
|
||||
strn0cpy(pname, iCharName, sizeof(pname));
|
||||
m_char_id = iCharID;
|
||||
strn0cpy(m_char_name, iCharName, sizeof(m_char_name));
|
||||
}
|
||||
|
||||
void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||
@@ -142,20 +118,20 @@ void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||
static_cast<int>(iOnline)
|
||||
);
|
||||
|
||||
if (iOnline >= CLE_Status::Online && pOnline < CLE_Status::Online) {
|
||||
if (iOnline >= CLE_Status::Online && m_online < CLE_Status::Online) {
|
||||
numplayers++;
|
||||
}
|
||||
else if (iOnline < CLE_Status::Online && pOnline >= CLE_Status::Online) {
|
||||
else if (iOnline < CLE_Status::Online && m_online >= CLE_Status::Online) {
|
||||
numplayers--;
|
||||
}
|
||||
if (iOnline != CLE_Status::Online || pOnline < CLE_Status::Online) {
|
||||
pOnline = iOnline;
|
||||
if (iOnline != CLE_Status::Online || m_online < CLE_Status::Online) {
|
||||
m_online = iOnline;
|
||||
}
|
||||
if (iOnline < CLE_Status::Zoning) {
|
||||
Camp();
|
||||
}
|
||||
if (pOnline >= CLE_Status::Online) {
|
||||
stale = 0;
|
||||
if (m_online >= CLE_Status::Online) {
|
||||
m_stale = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,49 +169,49 @@ void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
|
||||
|
||||
void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
||||
{
|
||||
if (pzoneserver != iZS) {
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
if (m_zone_server != iZS) {
|
||||
if (m_zone_server) {
|
||||
m_zone_server->RemovePlayer();
|
||||
LSUpdate(m_zone_server);
|
||||
}
|
||||
if (iZS) {
|
||||
iZS->AddPlayer();
|
||||
LSUpdate(iZS);
|
||||
}
|
||||
}
|
||||
pzoneserver = iZS;
|
||||
pzone = scl->zone;
|
||||
pinstance = scl->instance_id;
|
||||
pcharid = scl->charid;
|
||||
m_zone_server = iZS;
|
||||
m_zone = scl->zone;
|
||||
m_instance = scl->instance_id;
|
||||
m_char_id = scl->charid;
|
||||
|
||||
strcpy(pname, scl->name);
|
||||
if (paccountid == 0) {
|
||||
paccountid = scl->AccountID;
|
||||
strcpy(paccountname, scl->AccountName);
|
||||
strcpy(loginserver_account_name, scl->AccountName);
|
||||
pIP = scl->IP;
|
||||
pLSID = scl->LSAccountID;
|
||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
||||
strcpy(m_char_name, scl->name);
|
||||
if (m_account_id == 0) {
|
||||
m_account_id = scl->AccountID;
|
||||
strcpy(m_account_name, scl->AccountName);
|
||||
strcpy(m_login_account_name, scl->AccountName);
|
||||
m_ip_address = scl->IP;
|
||||
m_login_server_id = scl->LSAccountID;
|
||||
strn0cpy(m_key, scl->lskey, sizeof(m_key));
|
||||
}
|
||||
padmin = scl->Admin;
|
||||
plevel = scl->level;
|
||||
pclass_ = scl->class_;
|
||||
prace = scl->race;
|
||||
panon = scl->anon;
|
||||
ptellsoff = scl->tellsoff;
|
||||
pguild_id = scl->guild_id;
|
||||
pguild_rank = scl->guild_rank;
|
||||
pguild_tribute_opt_in = scl->guild_tribute_opt_in;
|
||||
pLFG = scl->LFG;
|
||||
gm = scl->gm;
|
||||
pClientVersion = scl->ClientVersion;
|
||||
m_admin = scl->Admin;
|
||||
m_level = scl->level;
|
||||
m_class_ = scl->class_;
|
||||
m_race = scl->race;
|
||||
m_anon = scl->anon;
|
||||
m_tells_off = scl->tellsoff;
|
||||
m_guild_id = scl->guild_id;
|
||||
m_guild_rank = scl->guild_rank;
|
||||
m_guild_tribute_opt_in = scl->guild_tribute_opt_in;
|
||||
m_lfg = scl->LFG;
|
||||
m_gm = scl->gm;
|
||||
m_client_version = scl->ClientVersion;
|
||||
|
||||
// Fields from the LFG Window
|
||||
if ((scl->LFGFromLevel != 0) && (scl->LFGToLevel != 0)) {
|
||||
pLFGFromLevel = scl->LFGFromLevel;
|
||||
pLFGToLevel = scl->LFGToLevel;
|
||||
pLFGMatchFilter = scl->LFGMatchFilter;
|
||||
memcpy(pLFGComments, scl->LFGComments, sizeof(pLFGComments));
|
||||
m_lfg_from_level = scl->LFGFromLevel;
|
||||
m_lfg_to_level = scl->LFGToLevel;
|
||||
m_lfg_match_filter = scl->LFGMatchFilter;
|
||||
memcpy(m_lfg_comments, scl->LFGComments, sizeof(m_lfg_comments));
|
||||
}
|
||||
|
||||
SetOnline(iOnline);
|
||||
@@ -243,76 +219,76 @@ void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_
|
||||
|
||||
void ClientListEntry::LeavingZone(ZoneServer *iZS, CLE_Status iOnline)
|
||||
{
|
||||
if (iZS != 0 && iZS != pzoneserver) {
|
||||
if (iZS != 0 && iZS != m_zone_server) {
|
||||
return;
|
||||
}
|
||||
SetOnline(iOnline);
|
||||
|
||||
shared_task_manager.RemoveActiveInvitationByCharacterID(CharID());
|
||||
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
if (m_zone_server) {
|
||||
m_zone_server->RemovePlayer();
|
||||
LSUpdate(m_zone_server);
|
||||
}
|
||||
pzoneserver = 0;
|
||||
pzone = 0;
|
||||
m_zone_server = 0;
|
||||
m_zone = 0;
|
||||
}
|
||||
|
||||
void ClientListEntry::ClearVars(bool iAll)
|
||||
{
|
||||
if (iAll) {
|
||||
pOnline = CLE_Status::Never;
|
||||
stale = 0;
|
||||
m_online = CLE_Status::Never;
|
||||
m_stale = 0;
|
||||
|
||||
pLSID = 0;
|
||||
memset(loginserver_account_name, 0, sizeof(loginserver_account_name));
|
||||
memset(plskey, 0, sizeof(plskey));
|
||||
pworldadmin = 0;
|
||||
m_login_server_id = 0;
|
||||
memset(m_login_account_name, 0, sizeof(m_login_account_name));
|
||||
memset(m_key, 0, sizeof(m_key));
|
||||
m_world_admin = 0;
|
||||
|
||||
paccountid = 0;
|
||||
memset(paccountname, 0, sizeof(paccountname));
|
||||
padmin = AccountStatus::Player;
|
||||
m_account_id = 0;
|
||||
memset(m_account_name, 0, sizeof(m_account_name));
|
||||
m_admin = AccountStatus::Player;
|
||||
}
|
||||
pzoneserver = 0;
|
||||
pzone = 0;
|
||||
pcharid = 0;
|
||||
memset(pname, 0, sizeof(pname));
|
||||
plevel = 0;
|
||||
pclass_ = 0;
|
||||
prace = 0;
|
||||
panon = 0;
|
||||
ptellsoff = 0;
|
||||
pguild_id = GUILD_NONE;
|
||||
pguild_rank = 0;
|
||||
pLFG = 0;
|
||||
gm = 0;
|
||||
pClientVersion = 0;
|
||||
for (auto& elem : tell_queue) {
|
||||
m_zone_server = 0;
|
||||
m_zone = 0;
|
||||
m_char_id = 0;
|
||||
memset(m_char_name, 0, sizeof(m_char_name));
|
||||
m_level = 0;
|
||||
m_class_ = 0;
|
||||
m_race = 0;
|
||||
m_anon = 0;
|
||||
m_tells_off = 0;
|
||||
m_guild_id = GUILD_NONE;
|
||||
m_guild_rank = 0;
|
||||
m_lfg = 0;
|
||||
m_gm = 0;
|
||||
m_client_version = 0;
|
||||
for (auto &elem: m_tell_queue) {
|
||||
safe_delete_array(elem);
|
||||
}
|
||||
tell_queue.clear();
|
||||
m_tell_queue.clear();
|
||||
}
|
||||
|
||||
void ClientListEntry::Camp(ZoneServer *iZS)
|
||||
{
|
||||
if (iZS != 0 && iZS != pzoneserver) {
|
||||
if (iZS != 0 && iZS != m_zone_server) {
|
||||
return;
|
||||
}
|
||||
if (pzoneserver) {
|
||||
pzoneserver->RemovePlayer();
|
||||
LSUpdate(pzoneserver);
|
||||
if (m_zone_server) {
|
||||
m_zone_server->RemovePlayer();
|
||||
LSUpdate(m_zone_server);
|
||||
}
|
||||
|
||||
ClearVars();
|
||||
|
||||
stale = 0;
|
||||
m_stale = 0;
|
||||
}
|
||||
|
||||
bool ClientListEntry::CheckStale()
|
||||
{
|
||||
stale++;
|
||||
if (stale > 20) {
|
||||
if (pOnline > CLE_Status::Offline) {
|
||||
m_stale++;
|
||||
if (m_stale > 20) {
|
||||
if (m_online > CLE_Status::Offline) {
|
||||
SetOnline(CLE_Status::Offline);
|
||||
}
|
||||
|
||||
@@ -324,48 +300,50 @@ bool ClientListEntry::CheckStale()
|
||||
bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_password)
|
||||
{
|
||||
LogDebug(
|
||||
"ls_account_id [{0}] key_password [{1}] plskey [{2}]",
|
||||
"ls_account_id [{}] key_password [{}] key [{}]",
|
||||
loginserver_account_id,
|
||||
key_password,
|
||||
plskey
|
||||
m_key
|
||||
);
|
||||
if (pLSID == loginserver_account_id && strncmp(plskey, key_password, 10) == 0) {
|
||||
|
||||
if (m_login_server_id == loginserver_account_id && strncmp(m_key, key_password, 10) == 0) {
|
||||
LogDebug(
|
||||
"ls_account_id [{0}] key_password [{1}] plskey [{2}] lsid [{3}] paccountid [{4}]",
|
||||
"ls_account_id [{}] key_password [{}] m_key [{}] lsid [{}] m_account_id [{}]",
|
||||
loginserver_account_id,
|
||||
key_password,
|
||||
plskey,
|
||||
m_key,
|
||||
LSID(),
|
||||
paccountid
|
||||
m_account_id
|
||||
);
|
||||
|
||||
if (paccountid == 0 && LSID() > 0) {
|
||||
// create account if it doesn't exist
|
||||
if (m_account_id == 0 && LSID() > 0) {
|
||||
int16 default_account_status = WorldConfig::get()->DefaultStatus;
|
||||
|
||||
paccountid = database.CreateAccount(
|
||||
loginserver_account_name,
|
||||
m_account_id = database.CreateAccount(
|
||||
m_login_account_name,
|
||||
std::string(),
|
||||
default_account_status,
|
||||
source_loginserver,
|
||||
m_source_loginserver,
|
||||
LSID()
|
||||
);
|
||||
|
||||
if (!paccountid) {
|
||||
LogInfo(
|
||||
"Error adding local account for LS login: [{0}:{1}], duplicate name",
|
||||
source_loginserver,
|
||||
loginserver_account_name
|
||||
if (!m_account_id) {
|
||||
LogError(
|
||||
"Error adding local account for LS login [{}] [{}], duplicate name",
|
||||
m_source_loginserver,
|
||||
m_login_account_name
|
||||
);
|
||||
return false;
|
||||
}
|
||||
strn0cpy(paccountname, loginserver_account_name, sizeof(paccountname));
|
||||
padmin = default_account_status;
|
||||
strn0cpy(m_account_name, m_login_account_name, sizeof(m_account_name));
|
||||
m_admin = default_account_status;
|
||||
}
|
||||
std::string lsworldadmin;
|
||||
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
||||
if (Strings::ToInt(lsworldadmin) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
|
||||
padmin = pworldadmin;
|
||||
if (Strings::ToInt(lsworldadmin) == 1 && m_world_admin != 0 &&
|
||||
(m_admin < m_world_admin || m_admin == AccountStatus::Player)) {
|
||||
m_admin = m_world_admin;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -380,8 +358,8 @@ void ClientListEntry::ProcessTellQueue()
|
||||
}
|
||||
|
||||
ServerPacket *pack;
|
||||
auto it = tell_queue.begin();
|
||||
while (it != tell_queue.end()) {
|
||||
auto it = m_tell_queue.begin();
|
||||
while (it != m_tell_queue.end()) {
|
||||
pack = new ServerPacket(
|
||||
ServerOP_ChannelMessage,
|
||||
sizeof(ServerChannelMessage_Struct) + strlen((*it)->message) + 1
|
||||
@@ -390,8 +368,7 @@ void ClientListEntry::ProcessTellQueue()
|
||||
Server()->SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
safe_delete_array(*it);
|
||||
it = tell_queue.erase(it);
|
||||
it = m_tell_queue.erase(it);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+102
-120
@@ -8,8 +8,7 @@
|
||||
#include "../common/rulesys.h"
|
||||
#include <vector>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
Never,
|
||||
Offline,
|
||||
Online,
|
||||
@@ -18,7 +17,7 @@ typedef enum
|
||||
InZone
|
||||
} CLE_Status;
|
||||
|
||||
static const char * CLEStatusString[] = {
|
||||
static const char *CLEStatusString[] = {
|
||||
"Never",
|
||||
"Offline",
|
||||
"Online",
|
||||
@@ -33,150 +32,133 @@ struct ServerClientList_Struct;
|
||||
class ClientListEntry {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param in_loginserver_id
|
||||
* @param in_loginserver_name
|
||||
* @param in_login_name
|
||||
* @param in_login_key
|
||||
* @param in_is_world_admin
|
||||
* @param ip
|
||||
* @param local
|
||||
*/
|
||||
ClientListEntry(
|
||||
uint32 id,
|
||||
uint32 in_loginserver_id,
|
||||
const char *in_loginserver_name,
|
||||
const char *in_login_name,
|
||||
const char *in_login_key,
|
||||
int16 in_is_world_admin = 0,
|
||||
uint32 ip = 0,
|
||||
uint32 login_server_id,
|
||||
const char *login_server_name,
|
||||
const char *account_name,
|
||||
const char *login_key,
|
||||
int16 is_world_admin = 0,
|
||||
uint32 ip_address = 0,
|
||||
uint8 local = 0
|
||||
);
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param iZS
|
||||
* @param scl
|
||||
* @param iOnline
|
||||
*/
|
||||
ClientListEntry(uint32 id, uint32 iAccID, const char* iAccName, MD5& iMD5Pass, int16 iAdmin = AccountStatus::Player);
|
||||
ClientListEntry(uint32 id, ZoneServer* iZS, ServerClientList_Struct* scl, CLE_Status iOnline);
|
||||
ClientListEntry(uint32 id, ZoneServer *z, ServerClientList_Struct *scl, CLE_Status online);
|
||||
~ClientListEntry();
|
||||
bool CheckStale();
|
||||
void Update(ZoneServer* zoneserver, ServerClientList_Struct* scl, CLE_Status iOnline = CLE_Status::InZone);
|
||||
void LSUpdate(ZoneServer* zoneserver);
|
||||
void LSZoneChange(ZoneToZone_Struct* ztz);
|
||||
bool CheckAuth(uint32 loginserver_account_id, const char* key_password);
|
||||
void SetOnline(CLE_Status iOnline = CLE_Status::Online);
|
||||
void SetChar(uint32 iCharID, const char* iCharName);
|
||||
inline CLE_Status Online() { return pOnline; }
|
||||
inline const uint32 GetID() const { return id; }
|
||||
inline const uint32 GetIP() const { return pIP; }
|
||||
inline void SetIP(const uint32& iIP) { pIP = iIP; }
|
||||
inline void KeepAlive() { stale = 0; }
|
||||
inline uint8 GetStaleCounter() const { return stale; }
|
||||
void LeavingZone(ZoneServer* iZS = 0, CLE_Status iOnline = CLE_Status::Offline);
|
||||
void Camp(ZoneServer* iZS = 0);
|
||||
bool CheckStale();
|
||||
void Update(ZoneServer *zoneserver, ServerClientList_Struct *scl, CLE_Status iOnline = CLE_Status::InZone);
|
||||
void LSUpdate(ZoneServer *zoneserver);
|
||||
void LSZoneChange(ZoneToZone_Struct *ztz);
|
||||
bool CheckAuth(uint32 loginserver_account_id, const char *key_password);
|
||||
void SetOnline(CLE_Status iOnline = CLE_Status::Online);
|
||||
void SetChar(uint32 iCharID, const char *iCharName);
|
||||
inline CLE_Status Online() { return m_online; }
|
||||
inline const uint32 GetID() const { return m_id; }
|
||||
inline const uint32 GetIP() const { return m_ip_address; }
|
||||
inline void SetIP(const uint32 &iIP) { m_ip_address = iIP; }
|
||||
inline void KeepAlive() { m_stale = 0; }
|
||||
inline uint8 GetStaleCounter() const { return m_stale; }
|
||||
void LeavingZone(ZoneServer *iZS = 0, CLE_Status iOnline = CLE_Status::Offline);
|
||||
void Camp(ZoneServer *iZS = 0);
|
||||
|
||||
// Login Server stuff
|
||||
inline const char* LoginServer() const { return source_loginserver; }
|
||||
inline uint32 LSID() const { return pLSID; }
|
||||
inline uint32 LSAccountID() const { return pLSID; }
|
||||
inline const char* LSName() const { return loginserver_account_name; }
|
||||
inline int16 WorldAdmin() const { return pworldadmin; }
|
||||
inline const char* GetLSKey() const { return plskey; }
|
||||
inline const CLE_Status GetOnline() const { return pOnline; }
|
||||
inline const char *LoginServer() const { return m_source_loginserver; }
|
||||
inline uint32 LSID() const { return m_login_server_id; }
|
||||
inline uint32 LSAccountID() const { return m_login_server_id; }
|
||||
inline const char *LSName() const { return m_login_account_name; }
|
||||
inline int16 WorldAdmin() const { return m_world_admin; }
|
||||
inline const char *GetLSKey() const { return m_key; }
|
||||
inline const CLE_Status GetOnline() const { return m_online; }
|
||||
|
||||
// Account stuff
|
||||
inline uint32 AccountID() const { return paccountid; }
|
||||
inline const char* AccountName() const { return paccountname; }
|
||||
inline int16 Admin() const { return padmin; }
|
||||
inline void SetAdmin(uint16 iAdmin) { padmin = iAdmin; }
|
||||
inline uint32 AccountID() const { return m_account_id; }
|
||||
inline const char *AccountName() const { return m_account_name; }
|
||||
inline int16 Admin() const { return m_admin; }
|
||||
inline void SetAdmin(uint16 iAdmin) { m_admin = iAdmin; }
|
||||
|
||||
// Character info
|
||||
inline ZoneServer *Server() const { return pzoneserver; }
|
||||
inline void ClearServer() { pzoneserver = 0; }
|
||||
inline uint32 CharID() const { return pcharid; }
|
||||
inline const char *name() const { return pname; }
|
||||
inline uint32 zone() const { return pzone; }
|
||||
inline uint16 instance() const { return pinstance; }
|
||||
inline uint8 level() const { return plevel; }
|
||||
inline uint8 class_() const { return pclass_; }
|
||||
inline uint16 race() const { return prace; }
|
||||
inline uint8 Anon() { return panon; }
|
||||
inline uint8 TellsOff() const { return ptellsoff; }
|
||||
inline uint32 GuildID() const { return pguild_id; }
|
||||
inline uint32 GuildRank() const { return pguild_rank; }
|
||||
inline bool GuildTributeOptIn() const { return pguild_tribute_opt_in; }
|
||||
inline void SetGuild(uint32 guild_id) { pguild_id = guild_id; }
|
||||
inline void SetGuildTributeOptIn(bool opt) { pguild_tribute_opt_in = opt; }
|
||||
inline bool LFG() const { return pLFG; }
|
||||
inline uint8 GetGM() const { return gm; }
|
||||
inline void SetGM(uint8 igm) { gm = igm; }
|
||||
inline void SetZone(uint32 zone) { pzone = zone; }
|
||||
inline bool IsLocalClient() const { return plocal; }
|
||||
inline uint8 GetLFGFromLevel() const { return pLFGFromLevel; }
|
||||
inline uint8 GetLFGToLevel() const { return pLFGToLevel; }
|
||||
inline bool GetLFGMatchFilter() const { return pLFGMatchFilter; }
|
||||
inline const char *GetLFGComments() const { return pLFGComments; }
|
||||
inline uint8 GetClientVersion() { return pClientVersion; }
|
||||
inline ZoneServer *Server() const { return m_zone_server; }
|
||||
inline void ClearServer() { m_zone_server = 0; }
|
||||
inline uint32 CharID() const { return m_char_id; }
|
||||
inline const char *name() const { return m_char_name; }
|
||||
inline uint32 zone() const { return m_zone; }
|
||||
inline uint16 instance() const { return m_instance; }
|
||||
inline uint8 level() const { return m_level; }
|
||||
inline uint8 class_() const { return m_class_; }
|
||||
inline uint16 race() const { return m_race; }
|
||||
inline uint8 Anon() { return m_anon; }
|
||||
inline uint8 TellsOff() const { return m_tells_off; }
|
||||
inline uint32 GuildID() const { return m_guild_id; }
|
||||
inline uint32 GuildRank() const { return m_guild_rank; }
|
||||
inline bool GuildTributeOptIn() const { return m_guild_tribute_opt_in; }
|
||||
inline void SetGuild(uint32 guild_id) { m_guild_id = guild_id; }
|
||||
inline void SetGuildTributeOptIn(bool opt) { m_guild_tribute_opt_in = opt; }
|
||||
inline bool LFG() const { return m_lfg; }
|
||||
inline uint8 GetGM() const { return m_gm; }
|
||||
inline void SetGM(uint8 igm) { m_gm = igm; }
|
||||
inline void SetZone(uint32 zone) { m_zone = zone; }
|
||||
inline bool IsLocalClient() const { return m_is_local; }
|
||||
inline uint8 GetLFGFromLevel() const { return m_lfg_from_level; }
|
||||
inline uint8 GetLFGToLevel() const { return m_lfg_to_level; }
|
||||
inline bool GetLFGMatchFilter() const { return m_lfg_match_filter; }
|
||||
inline const char *GetLFGComments() const { return m_lfg_comments; }
|
||||
inline uint8 GetClientVersion() { return m_client_version; }
|
||||
|
||||
inline bool TellQueueFull() const { return tell_queue.size() >= RuleI(World, TellQueueSize); }
|
||||
inline bool TellQueueEmpty() const { return tell_queue.empty(); }
|
||||
inline void PushToTellQueue(ServerChannelMessage_Struct *scm) { tell_queue.push_back(scm); }
|
||||
inline bool TellQueueFull() const { return m_tell_queue.size() >= RuleI(World, TellQueueSize); }
|
||||
inline bool TellQueueEmpty() const { return m_tell_queue.empty(); }
|
||||
inline void PushToTellQueue(ServerChannelMessage_Struct *scm) { m_tell_queue.push_back(scm); }
|
||||
void ProcessTellQueue();
|
||||
|
||||
void SetPendingExpeditionInvite(ServerPacket* pack) { p_pending_expedition_invite.reset(pack->Copy()); };
|
||||
std::unique_ptr<ServerPacket> GetPendingExpeditionInvite() { return std::move(p_pending_expedition_invite); }
|
||||
void SetPendingDzInvite(ServerPacket *pack) { m_dz_invite.reset(pack->Copy()); };
|
||||
std::unique_ptr<ServerPacket> GetPendingDzInvite() { return std::move(m_dz_invite); }
|
||||
|
||||
private:
|
||||
void ClearVars(bool iAll = false);
|
||||
void ClearVars(bool iAll = false);
|
||||
|
||||
const uint32 id;
|
||||
uint32 pIP;
|
||||
CLE_Status pOnline;
|
||||
uint8 stale;
|
||||
const uint32 m_id;
|
||||
uint32 m_ip_address;
|
||||
CLE_Status m_online;
|
||||
uint8 m_stale;
|
||||
|
||||
// Login Server stuff
|
||||
char source_loginserver[64]{}; //Loginserver we came from.
|
||||
uint32 pLSID;
|
||||
char loginserver_account_name[32]{};
|
||||
char plskey[16]{};
|
||||
int16 pworldadmin; // Login server's suggested admin status setting
|
||||
bool plocal;
|
||||
char m_source_loginserver[64]{}; //Loginserver we came from.
|
||||
uint32 m_login_server_id;
|
||||
char m_login_account_name[32]{};
|
||||
char m_key[16]{};
|
||||
int16 m_world_admin; // Login server's suggested admin status setting
|
||||
bool m_is_local;
|
||||
|
||||
// Account stuff
|
||||
uint32 paccountid;
|
||||
char paccountname[32]{};
|
||||
int16 padmin{};
|
||||
uint32 m_account_id;
|
||||
char m_account_name[32]{};
|
||||
int16 m_admin{};
|
||||
|
||||
// Character info
|
||||
ZoneServer* pzoneserver{};
|
||||
uint32 pzone{};
|
||||
uint16 pinstance{};
|
||||
uint32 pcharid{};
|
||||
char pname[64]{};
|
||||
uint8 plevel{};
|
||||
uint8 pclass_{};
|
||||
uint16 prace{};
|
||||
uint8 panon{};
|
||||
uint8 ptellsoff{};
|
||||
uint32 pguild_id{};
|
||||
uint32 pguild_rank;
|
||||
bool pguild_tribute_opt_in{};
|
||||
bool pLFG{};
|
||||
uint8 gm{};
|
||||
uint8 pClientVersion{};
|
||||
uint8 pLFGFromLevel{};
|
||||
uint8 pLFGToLevel{};
|
||||
bool pLFGMatchFilter{};
|
||||
char pLFGComments[64]{};
|
||||
ZoneServer *m_zone_server{};
|
||||
uint32 m_zone{};
|
||||
uint16 m_instance{};
|
||||
uint32 m_char_id{};
|
||||
char m_char_name[64]{};
|
||||
uint8 m_level{};
|
||||
uint8 m_class_{};
|
||||
uint16 m_race{};
|
||||
uint8 m_anon{};
|
||||
uint8 m_tells_off{};
|
||||
uint32 m_guild_id{};
|
||||
uint32 m_guild_rank;
|
||||
bool m_guild_tribute_opt_in{};
|
||||
bool m_lfg{};
|
||||
uint8 m_gm{};
|
||||
uint8 m_client_version{};
|
||||
uint8 m_lfg_from_level{};
|
||||
uint8 m_lfg_to_level{};
|
||||
bool m_lfg_match_filter{};
|
||||
char m_lfg_comments[64]{};
|
||||
|
||||
// Tell Queue -- really a vector :D
|
||||
std::vector<ServerChannelMessage_Struct *> tell_queue;
|
||||
std::vector<ServerChannelMessage_Struct *> m_tell_queue;
|
||||
|
||||
std::unique_ptr<ServerPacket> p_pending_expedition_invite = nullptr;
|
||||
std::unique_ptr<ServerPacket> m_dz_invite;
|
||||
};
|
||||
|
||||
#endif /*CLIENTENTRY_H_*/
|
||||
|
||||
+30
-9
@@ -331,8 +331,26 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
|
||||
}
|
||||
|
||||
|
||||
void ClientList::CLEAdd(uint32 iLSID, const char *iLoginServerName, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin, uint32 ip, uint8 local) {
|
||||
auto tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginServerName, iLoginName, iLoginKey, iWorldAdmin, ip, local);
|
||||
void ClientList::CLEAdd(
|
||||
uint32 login_server_id,
|
||||
const char *login_server_name,
|
||||
const char *login_name,
|
||||
const char *login_key,
|
||||
int16 world_admin,
|
||||
uint32 ip_address,
|
||||
uint8 is_local
|
||||
)
|
||||
{
|
||||
auto tmp = new ClientListEntry(
|
||||
GetNextCLEID(),
|
||||
login_server_id,
|
||||
login_server_name,
|
||||
login_name,
|
||||
login_key,
|
||||
world_admin,
|
||||
ip_address,
|
||||
is_local
|
||||
);
|
||||
|
||||
clientlist.Append(tmp);
|
||||
}
|
||||
@@ -457,19 +475,19 @@ void ClientList::CLEKeepAlive(uint32 numupdates, uint32* wid) {
|
||||
}
|
||||
}
|
||||
|
||||
ClientListEntry *ClientList::CheckAuth(uint32 iLSID, const char *iKey)
|
||||
ClientListEntry *ClientList::CheckAuth(uint32 loginserver_account_id, const char *key)
|
||||
{
|
||||
LinkedListIterator<ClientListEntry *> iterator(clientlist);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->CheckAuth(iLSID, iKey)) {
|
||||
if (iterator.GetData()->CheckAuth(loginserver_account_id, key)) {
|
||||
return iterator.GetData();
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
|
||||
@@ -1717,13 +1735,13 @@ void ClientList::SendCharacterMessageID(ClientListEntry* character,
|
||||
return;
|
||||
}
|
||||
|
||||
SerializeBuffer serialized_args;
|
||||
SerializeBuffer argbuf;
|
||||
for (const auto& arg : args)
|
||||
{
|
||||
serialized_args.WriteString(arg);
|
||||
argbuf.WriteString(arg);
|
||||
}
|
||||
|
||||
uint32_t args_size = static_cast<uint32_t>(serialized_args.size());
|
||||
uint32_t args_size = static_cast<uint32_t>(argbuf.size());
|
||||
uint32_t pack_size = sizeof(CZClientMessageString_Struct) + args_size;
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_CZClientMessageString, pack_size);
|
||||
auto buf = reinterpret_cast<CZClientMessageString_Struct*>(pack->pBuffer);
|
||||
@@ -1731,7 +1749,10 @@ void ClientList::SendCharacterMessageID(ClientListEntry* character,
|
||||
buf->chat_type = chat_type;
|
||||
strn0cpy(buf->client_name, character->name(), sizeof(buf->client_name));
|
||||
buf->args_size = args_size;
|
||||
memcpy(buf->args, serialized_args.buffer(), serialized_args.size());
|
||||
if (argbuf.size() > 0)
|
||||
{
|
||||
memcpy(buf->args, argbuf.buffer(), argbuf.size());
|
||||
}
|
||||
|
||||
character->Server()->SendPacket(pack.get());
|
||||
}
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
void ClientUpdate(ZoneServer* zoneserver, ServerClientList_Struct* scl);
|
||||
void CLERemoveZSRef(ZoneServer* iZS);
|
||||
ClientListEntry* CheckAuth(uint32 iLSID, const char* iKey);
|
||||
ClientListEntry* CheckAuth(uint32 loginserver_account_id, const char* key);
|
||||
ClientListEntry* FindCharacter(const char* name);
|
||||
ClientListEntry* FindCLEByAccountID(uint32 iAccID);
|
||||
ClientListEntry* FindCLEByCharacterID(uint32 iCharID);
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
void DisconnectByIP(uint32 in_ip);
|
||||
void CLCheckStale();
|
||||
void CLEKeepAlive(uint32 numupdates, uint32* wid);
|
||||
void CLEAdd(uint32 iLSID, const char* iLoginServerName, const char* iLoginName, const char* iLoginKey, int16 iWorldAdmin = AccountStatus::Player, uint32 ip = 0, uint8 local=0);
|
||||
void CLEAdd(uint32 login_server_id, const char* login_server_name, const char* login_name, const char* login_key, int16 world_admin = AccountStatus::Player, uint32 ip_address = 0, uint8 is_local=0);
|
||||
void UpdateClientGuild(uint32 char_id, uint32 guild_id);
|
||||
bool IsAccountInGame(uint32 iLSID);
|
||||
|
||||
|
||||
+1
-5
@@ -911,11 +911,7 @@ void ConsoleReloadWorld(
|
||||
)
|
||||
{
|
||||
connection->SendLine("Reloading World...");
|
||||
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
|
||||
ReloadWorld_Struct *RW = (ReloadWorld_Struct *) pack->pBuffer;
|
||||
RW->global_repop = ReloadWorld::Repop;
|
||||
zoneserver_list.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
zoneserver_list.SendServerReload(ServerReload::Type::WorldRepop, nullptr);
|
||||
}
|
||||
|
||||
auto debounce_reload = std::chrono::system_clock::now();
|
||||
|
||||
+2
-128
@@ -164,132 +164,6 @@ void DynamicZone::SendZonesLeaderChanged()
|
||||
zoneserver_list.SendPacket(pack.get());
|
||||
}
|
||||
|
||||
void DynamicZone::HandleZoneMessage(ServerPacket* pack)
|
||||
{
|
||||
switch (pack->opcode)
|
||||
{
|
||||
case ServerOP_DzCreated:
|
||||
{
|
||||
dynamic_zone_manager.CacheNewDynamicZone(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSetCompass:
|
||||
case ServerOP_DzSetSafeReturn:
|
||||
case ServerOP_DzSetZoneIn:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzLocation_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
if (pack->opcode == ServerOP_DzSetCompass)
|
||||
{
|
||||
dz->SetCompass(buf->zone_id, buf->x, buf->y, buf->z, false);
|
||||
}
|
||||
else if (pack->opcode == ServerOP_DzSetSafeReturn)
|
||||
{
|
||||
dz->SetSafeReturn(buf->zone_id, buf->x, buf->y, buf->z, buf->heading, false);
|
||||
}
|
||||
else if (pack->opcode == ServerOP_DzSetZoneIn)
|
||||
{
|
||||
dz->SetZoneInLocation(buf->x, buf->y, buf->z, buf->heading, false);
|
||||
}
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSetSwitchID:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzSwitchID_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
dz->ProcessSetSwitchID(buf->dz_switch_id);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzAddRemoveMember:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMember_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
auto status = static_cast<DynamicZoneMemberStatus>(buf->character_status);
|
||||
dz->ProcessMemberAddRemove({ buf->character_id, buf->character_name, status }, buf->removed);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSwapMembers:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMemberSwap_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
// we add first in world so new member can be chosen if leader is removed
|
||||
auto status = static_cast<DynamicZoneMemberStatus>(buf->add_character_status);
|
||||
dz->ProcessMemberAddRemove({ buf->add_character_id, buf->add_character_name, status }, false);
|
||||
dz->ProcessMemberAddRemove({ buf->remove_character_id, buf->remove_character_name }, true);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzRemoveAllMembers:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
dz->ProcessRemoveAllMembers();
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSetSecondsRemaining:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzSetDuration_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
dz->SetSecondsRemaining(buf->seconds);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzGetMemberStatuses:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
dz->SendZoneMemberStatuses(buf->sender_zone_id, buf->sender_instance_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzUpdateMemberStatus:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMemberStatus_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz)
|
||||
{
|
||||
auto status = static_cast<DynamicZoneMemberStatus>(buf->status);
|
||||
dz->ProcessMemberStatusChange(buf->character_id, status);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzMovePC:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMovePC_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz && dz->HasMember(buf->character_id))
|
||||
{
|
||||
zoneserver_list.SendPacket(buf->sender_zone_id, buf->sender_instance_id, pack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void DynamicZone::ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed)
|
||||
{
|
||||
DynamicZoneBase::ProcessMemberAddRemove(member, removed);
|
||||
@@ -345,13 +219,13 @@ void DynamicZone::SendZoneMemberStatuses(uint16_t zone_id, uint16_t instance_id)
|
||||
|
||||
void DynamicZone::CacheMemberStatuses()
|
||||
{
|
||||
if (m_has_member_statuses)
|
||||
if (m_has_member_statuses || m_members.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// called when a new dz is cached to fill member statuses
|
||||
std::string zone_name{};
|
||||
std::string zone_name;
|
||||
std::vector<ClientListEntry*> all_clients;
|
||||
all_clients.reserve(client_list.GetClientCount());
|
||||
client_list.GetClients(zone_name.c_str(), all_clients);
|
||||
|
||||
@@ -22,7 +22,6 @@ public:
|
||||
using DynamicZoneBase::DynamicZoneBase; // inherit base constructors
|
||||
|
||||
static DynamicZone* FindDynamicZoneByID(uint32_t dz_id);
|
||||
static void HandleZoneMessage(ServerPacket* pack);
|
||||
|
||||
void SetSecondsRemaining(uint32_t seconds_remaining) override;
|
||||
|
||||
@@ -33,7 +32,7 @@ public:
|
||||
protected:
|
||||
Database& GetDatabase() override;
|
||||
void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed) override;
|
||||
bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status) override;
|
||||
bool ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status) override;
|
||||
bool SendServerPacket(ServerPacket* packet) override;
|
||||
|
||||
private:
|
||||
|
||||
+280
-39
@@ -1,12 +1,14 @@
|
||||
#include "dynamic_zone_manager.h"
|
||||
#include "dynamic_zone.h"
|
||||
#include "cliententry.h"
|
||||
#include "clientlist.h"
|
||||
#include "worlddb.h"
|
||||
#include "zonelist.h"
|
||||
#include "zoneserver.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/repositories/expeditions_repository.h"
|
||||
#include "../common/repositories/expedition_lockouts_repository.h"
|
||||
#include "../common/repositories/dynamic_zone_lockouts_repository.h"
|
||||
|
||||
extern ClientList client_list;
|
||||
extern ZSList zoneserver_list;
|
||||
|
||||
DynamicZoneManager dynamic_zone_manager;
|
||||
@@ -27,6 +29,8 @@ void DynamicZoneManager::PurgeExpiredDynamicZones()
|
||||
{
|
||||
LogDynamicZones("Purging [{}] dynamic zone(s)", dz_ids.size());
|
||||
|
||||
DynamicZoneLockoutsRepository::DeleteWhere(database,
|
||||
fmt::format("dynamic_zone_id IN ({})", fmt::join(dz_ids, ",")));
|
||||
DynamicZoneMembersRepository::DeleteWhere(database,
|
||||
fmt::format("dynamic_zone_id IN ({})", Strings::Join(dz_ids, ",")));
|
||||
DynamicZonesRepository::DeleteWhere(database,
|
||||
@@ -34,8 +38,7 @@ void DynamicZoneManager::PurgeExpiredDynamicZones()
|
||||
}
|
||||
}
|
||||
|
||||
DynamicZone* DynamicZoneManager::CreateNew(
|
||||
DynamicZone& dz_request, const std::vector<DynamicZoneMember>& members)
|
||||
DynamicZone* DynamicZoneManager::TryCreate(DynamicZone& dz_request, const std::vector<DynamicZoneMember>& members)
|
||||
{
|
||||
// this creates a new dz instance and saves it to both db and cache
|
||||
uint32_t dz_id = dz_request.Create();
|
||||
@@ -46,15 +49,12 @@ DynamicZone* DynamicZoneManager::CreateNew(
|
||||
}
|
||||
|
||||
auto dz = std::make_unique<DynamicZone>(dz_request);
|
||||
if (!members.empty())
|
||||
{
|
||||
dz->SaveMembers(members);
|
||||
dz->CacheMemberStatuses();
|
||||
}
|
||||
dz->SaveMembers(members);
|
||||
dz->CacheMemberStatuses();
|
||||
|
||||
LogDynamicZones("Created new dz [{}] for zone [{}]", dz_id, dz_request.GetZoneID());
|
||||
|
||||
auto pack = dz->CreateServerDzCreatePacket(0, 0);
|
||||
auto pack = dz->CreateServerPacket(0, 0);
|
||||
zoneserver_list.SendPacket(pack.get());
|
||||
|
||||
auto inserted = dynamic_zone_cache.emplace(dz_id, std::move(dz));
|
||||
@@ -63,18 +63,17 @@ DynamicZone* DynamicZoneManager::CreateNew(
|
||||
|
||||
void DynamicZoneManager::CacheNewDynamicZone(ServerPacket* pack)
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
|
||||
auto buf = reinterpret_cast<ServerDzCreate_Struct*>(pack->pBuffer);
|
||||
|
||||
auto new_dz = std::make_unique<DynamicZone>();
|
||||
new_dz->LoadSerializedDzPacket(buf->cereal_data, buf->cereal_size);
|
||||
new_dz->Unserialize({ buf->cereal_data, buf->cereal_size });
|
||||
new_dz->CacheMemberStatuses();
|
||||
|
||||
// reserialize with member statuses cached before forwarding (restore origin zone)
|
||||
auto repack = new_dz->CreateServerDzCreatePacket(buf->origin_zone_id, buf->origin_instance_id);
|
||||
auto repack = new_dz->CreateServerPacket(buf->origin_zone_id, buf->origin_instance_id);
|
||||
|
||||
uint32_t dz_id = new_dz->GetID();
|
||||
dynamic_zone_cache.emplace(dz_id, std::move(new_dz));
|
||||
LogDynamicZones("Cached new dynamic zone [{}]", dz_id);
|
||||
dynamic_zone_cache.emplace(buf->dz_id, std::move(new_dz));
|
||||
LogDynamicZones("Cached new dynamic zone [{}]", buf->dz_id);
|
||||
|
||||
zoneserver_list.SendPacket(repack.get());
|
||||
}
|
||||
@@ -83,18 +82,19 @@ void DynamicZoneManager::CacheAllFromDatabase()
|
||||
{
|
||||
BenchTimer bench;
|
||||
|
||||
auto dynamic_zones = DynamicZonesRepository::AllWithInstanceNotExpired(database);
|
||||
auto dynamic_zone_members = DynamicZoneMembersRepository::GetAllWithNames(database);
|
||||
auto dzs = DynamicZonesRepository::AllWithInstanceNotExpired(database);
|
||||
auto members = DynamicZoneMembersRepository::AllWithNames(database);
|
||||
auto lockouts = DynamicZoneLockoutsRepository::All(database);
|
||||
|
||||
dynamic_zone_cache.clear();
|
||||
dynamic_zone_cache.reserve(dynamic_zones.size());
|
||||
dynamic_zone_cache.reserve(dzs.size());
|
||||
|
||||
for (auto& entry : dynamic_zones)
|
||||
for (auto& entry : dzs)
|
||||
{
|
||||
uint32_t dz_id = entry.id;
|
||||
auto dz = std::make_unique<DynamicZone>(std::move(entry));
|
||||
|
||||
for (auto& member : dynamic_zone_members)
|
||||
for (auto& member : members)
|
||||
{
|
||||
if (member.dynamic_zone_id == dz_id)
|
||||
{
|
||||
@@ -102,6 +102,14 @@ void DynamicZoneManager::CacheAllFromDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& lockout : lockouts)
|
||||
{
|
||||
if (lockout.dynamic_zone_id == dz->GetID())
|
||||
{
|
||||
dz->m_lockouts.emplace_back(dz->GetName(), std::move(lockout));
|
||||
}
|
||||
}
|
||||
|
||||
// note leader status won't be updated here until leader is set by owning system (expeditions)
|
||||
dz->CacheMemberStatuses();
|
||||
|
||||
@@ -142,24 +150,10 @@ void DynamicZoneManager::Process()
|
||||
dynamic_zone_cache.erase(dz_id);
|
||||
}
|
||||
|
||||
// need to look up expedition ids until lockouts are moved to dynamic zones
|
||||
std::vector<uint32_t> expedition_ids;
|
||||
auto expeditions = ExpeditionsRepository::GetWhere(database,
|
||||
fmt::format("dynamic_zone_id IN ({})", Strings::Join(dynamic_zone_ids, ",")));
|
||||
|
||||
if (!expeditions.empty())
|
||||
{
|
||||
for (const auto& expedition : expeditions)
|
||||
{
|
||||
expedition_ids.emplace_back(expedition.id);
|
||||
}
|
||||
ExpeditionLockoutsRepository::DeleteWhere(database,
|
||||
fmt::format("expedition_id IN ({})", Strings::Join(expedition_ids, ",")));
|
||||
}
|
||||
|
||||
ExpeditionsRepository::DeleteWhere(database,
|
||||
fmt::format("dynamic_zone_id IN ({})", Strings::Join(dynamic_zone_ids, ",")));
|
||||
DynamicZoneMembersRepository::RemoveAllMembers(database, dynamic_zone_ids);
|
||||
DynamicZoneLockoutsRepository::DeleteWhere(database,
|
||||
fmt::format("dynamic_zone_id IN ({})", fmt::join(dynamic_zone_ids, ",")));
|
||||
DynamicZoneMembersRepository::DeleteWhere(database,
|
||||
fmt::format("dynamic_zone_id IN ({})", fmt::join(dynamic_zone_ids, ",")));
|
||||
DynamicZonesRepository::DeleteWhere(database,
|
||||
fmt::format("id IN ({})", Strings::Join(dynamic_zone_ids, ",")));
|
||||
}
|
||||
@@ -174,3 +168,250 @@ void DynamicZoneManager::LoadTemplates()
|
||||
m_dz_templates[dz_template.id] = dz_template;
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneManager::HandleZoneMessage(ServerPacket* pack)
|
||||
{
|
||||
switch (pack->opcode)
|
||||
{
|
||||
case ServerOP_DzCreated:
|
||||
{
|
||||
CacheNewDynamicZone(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzAddPlayer:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
|
||||
|
||||
ClientListEntry* cle = client_list.FindCharacter(buf->target_name);
|
||||
if (cle && cle->Server())
|
||||
{
|
||||
// continue in the add target's zone
|
||||
buf->is_char_online = true;
|
||||
cle->Server()->SendPacket(pack);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add target not online, return to inviter
|
||||
ClientListEntry* inviter_cle = client_list.FindCharacter(buf->requester_name);
|
||||
if (inviter_cle && inviter_cle->Server())
|
||||
{
|
||||
inviter_cle->Server()->SendPacket(pack);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSaveInvite:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
|
||||
if (ClientListEntry* cle = client_list.FindCharacter(buf->target_name))
|
||||
{
|
||||
// store packet on cle and re-send it when client requests it
|
||||
buf->is_char_online = true;
|
||||
pack->opcode = ServerOP_DzAddPlayer;
|
||||
cle->SetPendingDzInvite(pack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzRequestInvite:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerCharacterID_Struct*>(pack->pBuffer);
|
||||
if (ClientListEntry* cle = client_list.FindCLEByCharacterID(buf->char_id))
|
||||
{
|
||||
auto invite_pack = cle->GetPendingDzInvite();
|
||||
if (invite_pack && cle->Server())
|
||||
{
|
||||
cle->Server()->SendPacket(invite_pack.get());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzMakeLeader:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCommandMakeLeader_Struct*>(pack->pBuffer);
|
||||
|
||||
// notify requester (old leader) and new leader of the result
|
||||
ZoneServer* new_leader_zs = nullptr;
|
||||
ClientListEntry* leader_cle = client_list.FindCharacter(buf->new_leader_name);
|
||||
if (leader_cle && leader_cle->Server())
|
||||
{
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz && dz->GetLeaderID() == buf->requester_id)
|
||||
{
|
||||
buf->is_success = dz->SetNewLeader(leader_cle->CharID());
|
||||
}
|
||||
|
||||
buf->is_online = true;
|
||||
new_leader_zs = leader_cle->Server();
|
||||
new_leader_zs->SendPacket(pack);
|
||||
}
|
||||
|
||||
// if old and new leader are in the same zone only send one message
|
||||
ClientListEntry* requester_cle = client_list.FindCLEByCharacterID(buf->requester_id);
|
||||
if (requester_cle && requester_cle->Server() && requester_cle->Server() != new_leader_zs)
|
||||
{
|
||||
requester_cle->Server()->SendPacket(pack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSetCompass:
|
||||
case ServerOP_DzSetSafeReturn:
|
||||
case ServerOP_DzSetZoneIn:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzLocation_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
if (pack->opcode == ServerOP_DzSetCompass)
|
||||
{
|
||||
dz->SetCompass(buf->zone_id, buf->x, buf->y, buf->z, false);
|
||||
}
|
||||
else if (pack->opcode == ServerOP_DzSetSafeReturn)
|
||||
{
|
||||
dz->SetSafeReturn(buf->zone_id, buf->x, buf->y, buf->z, buf->heading, false);
|
||||
}
|
||||
else if (pack->opcode == ServerOP_DzSetZoneIn)
|
||||
{
|
||||
dz->SetZoneInLocation(buf->x, buf->y, buf->z, buf->heading, false);
|
||||
}
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSetSwitchID:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzSwitchID_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
dz->ProcessSetSwitchID(buf->dz_switch_id);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzAddRemoveMember:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMember_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
auto status = static_cast<DynamicZoneMemberStatus>(buf->character_status);
|
||||
dz->ProcessMemberAddRemove({ buf->character_id, buf->character_name, status }, buf->removed);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSwapMembers:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMemberSwap_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
// we add first in world so new member can be chosen if leader is removed
|
||||
auto status = static_cast<DynamicZoneMemberStatus>(buf->add_character_status);
|
||||
dz->ProcessMemberAddRemove({ buf->add_character_id, buf->add_character_name, status }, false);
|
||||
dz->ProcessMemberAddRemove({ buf->remove_character_id, buf->remove_character_name }, true);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzRemoveAllMembers:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
dz->ProcessRemoveAllMembers();
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzSetSecondsRemaining:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzSetDuration_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
dz->SetSecondsRemaining(buf->seconds);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzGetMemberStatuses:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzID_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
dz->SendZoneMemberStatuses(buf->sender_zone_id, buf->sender_instance_id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzUpdateMemberStatus:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMemberStatus_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
auto status = static_cast<DynamicZoneMemberStatus>(buf->status);
|
||||
dz->ProcessMemberStatusChange(buf->character_id, status);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzMovePC:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzMovePC_Struct*>(pack->pBuffer);
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz && dz->HasMember(buf->character_id))
|
||||
{
|
||||
zoneserver_list.SendPacket(buf->sender_zone_id, buf->sender_instance_id, pack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzLock:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzLock_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
dz->SetLocked(buf->lock);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzReplayOnJoin:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzBool_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
dz->SetReplayOnJoin(buf->enabled);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzLockout:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
DzLockout lockout{ dz->GetUUID(), dz->GetName(), buf->event_name, buf->expire_time, buf->duration };
|
||||
dz->HandleLockoutUpdate(lockout, buf->remove, buf->members_only);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzLockoutDuration:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
||||
if (auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id))
|
||||
{
|
||||
DzLockout lockout{ dz->GetUUID(), dz->GetName(), buf->event_name, buf->expire_time, buf->duration };
|
||||
dz->HandleLockoutDuration(lockout, buf->seconds, buf->members_only, false);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzCharacterLockout:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCharacterLockout_Struct*>(pack->pBuffer);
|
||||
auto cle = client_list.FindCLEByCharacterID(buf->char_id);
|
||||
if (cle && cle->Server())
|
||||
{
|
||||
cle->Server()->SendPacket(pack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ public:
|
||||
|
||||
void CacheAllFromDatabase();
|
||||
void CacheNewDynamicZone(ServerPacket* pack);
|
||||
DynamicZone* CreateNew(DynamicZone& dz_request, const std::vector<DynamicZoneMember>& members);
|
||||
DynamicZone* TryCreate(DynamicZone& dz_request, const std::vector<DynamicZoneMember>& members);
|
||||
void HandleZoneMessage(ServerPacket* pack);
|
||||
void LoadTemplates();
|
||||
void Process();
|
||||
void PurgeExpiredDynamicZones();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "zoneserver.h"
|
||||
#include "zonelist.h"
|
||||
#include "../common/database_schema.h"
|
||||
#include "../common/server_reload_types.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "worlddb.h"
|
||||
#include "wguild_mgr.h"
|
||||
@@ -113,136 +114,47 @@ void callGetClientList(Json::Value &response)
|
||||
client_list.GetClientList(response);
|
||||
}
|
||||
|
||||
|
||||
struct Reload {
|
||||
std::string command{};
|
||||
uint16 opcode;
|
||||
std::string desc{};
|
||||
};
|
||||
|
||||
std::vector<Reload> reload_types = {
|
||||
Reload{.command = "aa", .opcode = ServerOP_ReloadAAData, .desc = "Alternate Advancement"},
|
||||
Reload{.command = "alternate_currencies", .opcode = ServerOP_ReloadAlternateCurrencies, .desc = "Alternate Currencies"},
|
||||
Reload{.command = "base_data", .opcode = ServerOP_ReloadBaseData, .desc = "Base Data"},
|
||||
Reload{.command = "blocked_spells", .opcode = ServerOP_ReloadBlockedSpells, .desc = "Blocked Spells"},
|
||||
Reload{.command = "commands", .opcode = ServerOP_ReloadCommands, .desc = "Commands"},
|
||||
Reload{.command = "content_flags", .opcode = ServerOP_ReloadContentFlags, .desc = "Content Flags"},
|
||||
Reload{.command = "data_buckets_cache", .opcode = ServerOP_ReloadDataBucketsCache, .desc = "Data Buckets Cache"},
|
||||
Reload{.command = "doors", .opcode = ServerOP_ReloadDoors, .desc = "Doors"},
|
||||
Reload{.command = "dztemplates", .opcode = ServerOP_ReloadDzTemplates, .desc = "Dynamic Zone Templates"},
|
||||
Reload{.command = "ground_spawns", .opcode = ServerOP_ReloadGroundSpawns, .desc = "Ground Spawns"},
|
||||
Reload{.command = "level_mods", .opcode = ServerOP_ReloadLevelEXPMods, .desc = "Level Mods"},
|
||||
Reload{.command = "logs", .opcode = ServerOP_ReloadLogs, .desc = "Log Settings"},
|
||||
Reload{.command = "loot", .opcode = ServerOP_ReloadLoot, .desc = "Loot"},
|
||||
Reload{.command = "merchants", .opcode = ServerOP_ReloadMerchants, .desc = "Merchants"},
|
||||
Reload{.command = "npc_emotes", .opcode = ServerOP_ReloadNPCEmotes, .desc = "NPC Emotes"},
|
||||
Reload{.command = "npc_spells", .opcode = ServerOP_ReloadNPCSpells, .desc = "NPC Spells"},
|
||||
Reload{.command = "objects", .opcode = ServerOP_ReloadObjects, .desc = "Objects"},
|
||||
Reload{.command = "opcodes", .opcode = ServerOP_ReloadOpcodes, .desc = "Opcodes"},
|
||||
Reload{.command = "perl_export", .opcode = ServerOP_ReloadPerlExportSettings, .desc = "Perl Event Export Settings"},
|
||||
Reload{.command = "rules", .opcode = ServerOP_ReloadRules, .desc = "Rules"},
|
||||
Reload{.command = "skill_caps", .opcode = ServerOP_ReloadSkillCaps, .desc = "Skill Caps"},
|
||||
Reload{.command = "static", .opcode = ServerOP_ReloadStaticZoneData, .desc = "Static Zone Data"},
|
||||
Reload{.command = "tasks", .opcode = ServerOP_ReloadTasks, .desc = "Tasks"},
|
||||
Reload{.command = "titles", .opcode = ServerOP_ReloadTitles, .desc = "Titles"},
|
||||
Reload{.command = "traps", .opcode = ServerOP_ReloadTraps, .desc = "Traps"},
|
||||
Reload{.command = "variables", .opcode = ServerOP_ReloadVariables, .desc = "Variables"},
|
||||
Reload{.command = "veteran_rewards", .opcode = ServerOP_ReloadVeteranRewards, .desc = "Veteran Rewards"},
|
||||
Reload{.command = "world", .opcode = ServerOP_ReloadWorld, .desc = "World"},
|
||||
Reload{.command = "zone_points", .opcode = ServerOP_ReloadZonePoints, .desc = "Zone Points"},
|
||||
};
|
||||
|
||||
void getReloadTypes(Json::Value &response)
|
||||
{
|
||||
for (auto &c: reload_types) {
|
||||
for (auto &t: ServerReload::GetTypes()) {
|
||||
Json::Value v;
|
||||
|
||||
v["command"] = c.command;
|
||||
v["opcode"] = c.opcode;
|
||||
v["description"] = c.desc;
|
||||
v["command"] = std::to_string(t);
|
||||
v["description"] = ServerReload::GetName(t);
|
||||
response.append(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::string> &args)
|
||||
{
|
||||
std::vector<std::string> commands{};
|
||||
commands.reserve(reload_types.size());
|
||||
for (auto &c: reload_types) {
|
||||
commands.emplace_back(c.command);
|
||||
commands.reserve(ServerReload::GetTypes().size());
|
||||
for (auto &c: ServerReload::GetTypes()) {
|
||||
commands.emplace_back(std::to_string(c));
|
||||
}
|
||||
|
||||
std::string command = !args[1].empty() ? args[1] : "";
|
||||
if (command.empty()) {
|
||||
message(r, fmt::format("Need to provide a type to reload. Example(s) [{}]", Strings::Implode("|", commands)));
|
||||
message(r, fmt::format("Need to provide a type ID to reload. Example(s) [{}]", Strings::Implode("|", commands)));
|
||||
return;
|
||||
}
|
||||
|
||||
ServerPacket *pack = nullptr;
|
||||
|
||||
bool found_command = false;
|
||||
for (auto &c: reload_types) {
|
||||
if (command == c.command) {
|
||||
if (c.command == "world") {
|
||||
uint8 global_repop = ReloadWorld::NoRepop;
|
||||
bool found_command = false;
|
||||
|
||||
if (Strings::IsNumber(args[2])) {
|
||||
global_repop = static_cast<uint8>(Strings::ToUnsignedInt(args[2]));
|
||||
|
||||
if (global_repop > ReloadWorld::ForceRepop) {
|
||||
global_repop = ReloadWorld::ForceRepop;
|
||||
}
|
||||
}
|
||||
|
||||
message(
|
||||
r,
|
||||
fmt::format(
|
||||
"Attempting to reload Quests {}worldwide.",
|
||||
(
|
||||
global_repop ?
|
||||
(
|
||||
global_repop == ReloadWorld::Repop ?
|
||||
"and repop NPCs " :
|
||||
"and forcefully repop NPCs "
|
||||
) :
|
||||
""
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
|
||||
auto RW = (ReloadWorld_Struct *) pack->pBuffer;
|
||||
RW->global_repop = global_repop;
|
||||
}
|
||||
else {
|
||||
pack = new ServerPacket(c.opcode, 0);
|
||||
message(r, fmt::format("Reloading [{}] globally", c.desc));
|
||||
|
||||
if (c.opcode == ServerOP_ReloadLogs) {
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
QSLink.SendPacket(pack);
|
||||
UCSLink.SendPacket(pack);
|
||||
}
|
||||
else if (c.opcode == ServerOP_ReloadRules) {
|
||||
RuleManager::Instance()->LoadRules(&database, RuleManager::Instance()->GetActiveRuleset(), true);
|
||||
}
|
||||
}
|
||||
|
||||
found_command = true;
|
||||
for (auto &t: ServerReload::GetTypes()) {
|
||||
if (std::to_string(t) == command || Strings::ToLower(ServerReload::GetName(t)) == command) {
|
||||
message(r, fmt::format("Reloading [{}] globally", ServerReload::GetName(t)));
|
||||
zoneserver_list.SendServerReload(t, nullptr);
|
||||
}
|
||||
found_command = true;
|
||||
}
|
||||
|
||||
if (!found_command) {
|
||||
message(r, fmt::format("Need to provide a type to reload. Example(s) [{}]", Strings::Implode("|", commands)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pack) {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
}
|
||||
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
void EQEmuApiWorldDataService::message(Json::Value &r, const std::string &message)
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* 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_database.h"
|
||||
#include "worlddb.h"
|
||||
#include "../common/repositories/expeditions_repository.h"
|
||||
#include "../common/repositories/expedition_lockouts_repository.h"
|
||||
#include "../common/repositories/dynamic_zone_members_repository.h"
|
||||
|
||||
void ExpeditionDatabase::PurgeExpiredExpeditions()
|
||||
{
|
||||
std::string query = SQL(
|
||||
SELECT
|
||||
expeditions.id,
|
||||
expeditions.dynamic_zone_id
|
||||
FROM expeditions
|
||||
LEFT JOIN dynamic_zones ON expeditions.dynamic_zone_id = dynamic_zones.id
|
||||
LEFT JOIN instance_list ON dynamic_zones.instance_id = instance_list.id
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT dynamic_zone_id, COUNT(*) member_count
|
||||
FROM dynamic_zone_members
|
||||
GROUP BY dynamic_zone_id
|
||||
) dynamic_zone_members
|
||||
ON dynamic_zone_members.dynamic_zone_id = expeditions.dynamic_zone_id
|
||||
WHERE
|
||||
instance_list.id IS NULL
|
||||
OR dynamic_zone_members.member_count IS NULL
|
||||
OR dynamic_zone_members.member_count = 0
|
||||
OR (instance_list.start_time + instance_list.duration) <= UNIX_TIMESTAMP();
|
||||
);
|
||||
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (results.Success())
|
||||
{
|
||||
std::vector<std::string> expedition_ids;
|
||||
std::vector<uint32_t> dynamic_zone_ids;
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
expedition_ids.emplace_back(row[0]);
|
||||
dynamic_zone_ids.emplace_back(static_cast<uint32_t>(strtoul(row[1], nullptr, 10)));
|
||||
}
|
||||
|
||||
if (!expedition_ids.empty())
|
||||
{
|
||||
ExpeditionsRepository::DeleteWhere(database, fmt::format("id IN ({})", fmt::join(expedition_ids, ",")));
|
||||
ExpeditionLockoutsRepository::DeleteWhere(database, fmt::format("expedition_id IN ({})", fmt::join(expedition_ids, ",")));
|
||||
DynamicZoneMembersRepository::RemoveAllMembers(database, dynamic_zone_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExpeditionDatabase::PurgeExpiredCharacterLockouts()
|
||||
{
|
||||
std::string query = SQL(
|
||||
DELETE FROM character_expedition_lockouts
|
||||
WHERE expire_time <= NOW();
|
||||
);
|
||||
|
||||
database.QueryDatabase(query);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* 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 WORLD_EXPEDITION_DATABASE_H
|
||||
#define WORLD_EXPEDITION_DATABASE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
class Expedition;
|
||||
|
||||
namespace ExpeditionDatabase
|
||||
{
|
||||
void PurgeExpiredExpeditions();
|
||||
void PurgeExpiredCharacterLockouts();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,151 +0,0 @@
|
||||
/**
|
||||
* 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 "dynamic_zone.h"
|
||||
#include "expedition_message.h"
|
||||
#include "cliententry.h"
|
||||
#include "clientlist.h"
|
||||
#include "zonelist.h"
|
||||
#include "zoneserver.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include <algorithm>
|
||||
|
||||
extern ClientList client_list;
|
||||
extern ZSList zoneserver_list;
|
||||
|
||||
void ExpeditionMessage::HandleZoneMessage(ServerPacket* pack)
|
||||
{
|
||||
switch (pack->opcode)
|
||||
{
|
||||
case ServerOP_ExpeditionCreate:
|
||||
{
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ExpeditionDzAddPlayer:
|
||||
{
|
||||
ExpeditionMessage::AddPlayer(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ExpeditionDzMakeLeader:
|
||||
{
|
||||
ExpeditionMessage::MakeLeader(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ExpeditionCharacterLockout:
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerExpeditionCharacterLockout_Struct*>(pack->pBuffer);
|
||||
auto cle = client_list.FindCLEByCharacterID(buf->character_id);
|
||||
if (cle && cle->Server())
|
||||
{
|
||||
cle->Server()->SendPacket(pack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_ExpeditionSaveInvite:
|
||||
{
|
||||
ExpeditionMessage::SaveInvite(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ExpeditionRequestInvite:
|
||||
{
|
||||
ExpeditionMessage::RequestInvite(pack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExpeditionMessage::AddPlayer(ServerPacket* pack)
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
|
||||
|
||||
ClientListEntry* invited_cle = client_list.FindCharacter(buf->target_name);
|
||||
if (invited_cle && invited_cle->Server())
|
||||
{
|
||||
// continue in the add target's zone
|
||||
buf->is_char_online = true;
|
||||
invited_cle->Server()->SendPacket(pack);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add target not online, return to inviter
|
||||
ClientListEntry* inviter_cle = client_list.FindCharacter(buf->requester_name);
|
||||
if (inviter_cle && inviter_cle->Server())
|
||||
{
|
||||
inviter_cle->Server()->SendPacket(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExpeditionMessage::MakeLeader(ServerPacket* pack)
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCommandMakeLeader_Struct*>(pack->pBuffer);
|
||||
|
||||
// notify requester (old leader) and new leader of the result
|
||||
ZoneServer* new_leader_zs = nullptr;
|
||||
ClientListEntry* new_leader_cle = client_list.FindCharacter(buf->new_leader_name);
|
||||
if (new_leader_cle && new_leader_cle->Server())
|
||||
{
|
||||
auto dz = DynamicZone::FindDynamicZoneByID(buf->dz_id);
|
||||
if (dz && dz->GetLeaderID() == buf->requester_id)
|
||||
{
|
||||
buf->is_success = dz->SetNewLeader(new_leader_cle->CharID());
|
||||
}
|
||||
|
||||
buf->is_online = true;
|
||||
new_leader_zs = new_leader_cle->Server();
|
||||
new_leader_zs->SendPacket(pack);
|
||||
}
|
||||
|
||||
// if old and new leader are in the same zone only send one message
|
||||
ClientListEntry* requester_cle = client_list.FindCLEByCharacterID(buf->requester_id);
|
||||
if (requester_cle && requester_cle->Server() && requester_cle->Server() != new_leader_zs)
|
||||
{
|
||||
requester_cle->Server()->SendPacket(pack);
|
||||
}
|
||||
}
|
||||
|
||||
void ExpeditionMessage::SaveInvite(ServerPacket* pack)
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
|
||||
|
||||
ClientListEntry* invited_cle = client_list.FindCharacter(buf->target_name);
|
||||
if (invited_cle)
|
||||
{
|
||||
// store packet on cle and re-send it when client requests it
|
||||
buf->is_char_online = true;
|
||||
pack->opcode = ServerOP_ExpeditionDzAddPlayer;
|
||||
invited_cle->SetPendingExpeditionInvite(pack);
|
||||
}
|
||||
}
|
||||
|
||||
void ExpeditionMessage::RequestInvite(ServerPacket* pack)
|
||||
{
|
||||
auto buf = reinterpret_cast<ServerExpeditionCharacterID_Struct*>(pack->pBuffer);
|
||||
ClientListEntry* cle = client_list.FindCLEByCharacterID(buf->character_id);
|
||||
if (cle)
|
||||
{
|
||||
auto invite_pack = cle->GetPendingExpeditionInvite();
|
||||
if (invite_pack && cle->Server())
|
||||
{
|
||||
cle->Server()->SendPacket(invite_pack.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* 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 WORLD_EXPEDITION_MESSAGE_H
|
||||
#define WORLD_EXPEDITION_MESSAGE_H
|
||||
|
||||
class ServerPacket;
|
||||
|
||||
namespace ExpeditionMessage
|
||||
{
|
||||
void AddPlayer(ServerPacket* pack);
|
||||
void HandleZoneMessage(ServerPacket* pack);
|
||||
void MakeLeader(ServerPacket* pack);
|
||||
void RequestInvite(ServerPacket* pack);
|
||||
void SaveInvite(ServerPacket* pack);
|
||||
};
|
||||
|
||||
#endif
|
||||
+40
-40
@@ -46,8 +46,8 @@ void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p)
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
UsertoWorldRequestLegacy_Struct *utwr = (UsertoWorldRequestLegacy_Struct *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
|
||||
UsertoWorldRequestLegacy *utwr = (UsertoWorldRequestLegacy *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
|
||||
int16 status = database.GetAccountStatus(id);
|
||||
|
||||
LogDebug(
|
||||
@@ -63,11 +63,11 @@ void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p)
|
||||
|
||||
ServerPacket outpack;
|
||||
outpack.opcode = ServerOP_UsertoWorldRespLeg;
|
||||
outpack.size = sizeof(UsertoWorldResponseLegacy_Struct);
|
||||
outpack.size = sizeof(UsertoWorldResponseLegacy);
|
||||
outpack.pBuffer = new uchar[outpack.size];
|
||||
memset(outpack.pBuffer, 0, outpack.size);
|
||||
|
||||
UsertoWorldResponseLegacy_Struct *utwrs = (UsertoWorldResponseLegacy_Struct *) outpack.pBuffer;
|
||||
UsertoWorldResponseLegacy *utwrs = (UsertoWorldResponseLegacy *) outpack.pBuffer;
|
||||
utwrs->lsaccountid = utwr->lsaccountid;
|
||||
utwrs->ToID = utwr->FromID;
|
||||
utwrs->worldid = utwr->worldid;
|
||||
@@ -126,8 +126,8 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
|
||||
const WorldConfig *Config = WorldConfig::get();
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
UsertoWorldRequest_Struct *utwr = (UsertoWorldRequest_Struct *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
|
||||
UsertoWorldRequest *utwr = (UsertoWorldRequest *) p.Data();
|
||||
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
|
||||
int16 status = database.GetAccountStatus(id);
|
||||
|
||||
LogDebug(
|
||||
@@ -143,11 +143,11 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
|
||||
|
||||
ServerPacket outpack;
|
||||
outpack.opcode = ServerOP_UsertoWorldResp;
|
||||
outpack.size = sizeof(UsertoWorldResponse_Struct);
|
||||
outpack.size = sizeof(UsertoWorldResponse);
|
||||
outpack.pBuffer = new uchar[outpack.size];
|
||||
memset(outpack.pBuffer, 0, outpack.size);
|
||||
|
||||
UsertoWorldResponse_Struct *utwrs = (UsertoWorldResponse_Struct *) outpack.pBuffer;
|
||||
UsertoWorldResponse *utwrs = (UsertoWorldResponse *) outpack.pBuffer;
|
||||
utwrs->lsaccountid = utwr->lsaccountid;
|
||||
utwrs->ToID = utwr->FromID;
|
||||
strn0cpy(utwrs->login, utwr->login, 64);
|
||||
@@ -208,27 +208,27 @@ void LoginServer::ProcessLSClientAuthLegacy(uint16_t opcode, EQ::Net::Packet &p)
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
try {
|
||||
auto client_authentication_request = p.GetSerialize<ClientAuthLegacy_Struct>(0);
|
||||
auto r = p.GetSerialize<ClientAuthLegacy>(0);
|
||||
|
||||
LogDebug(
|
||||
"Processing Loginserver Auth Legacy | account_id [{0}] account_name [{1}] key [{2}] admin [{3}] ip [{4}] "
|
||||
"local_network [{5}]",
|
||||
client_authentication_request.loginserver_account_id,
|
||||
client_authentication_request.loginserver_account_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
"Processing Loginserver Auth Legacy | account_id [{}] account_name [{}] key [{}] admin [{}] ip [{}] "
|
||||
"local_network [{}]",
|
||||
r.loginserver_account_id,
|
||||
r.loginserver_account_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
|
||||
client_list.CLEAdd(
|
||||
client_authentication_request.loginserver_account_id,
|
||||
r.loginserver_account_id,
|
||||
"eqemu",
|
||||
client_authentication_request.loginserver_account_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
r.loginserver_account_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
}
|
||||
catch (std::exception &ex) {
|
||||
@@ -242,28 +242,28 @@ void LoginServer::ProcessLSClientAuth(uint16_t opcode, EQ::Net::Packet &p)
|
||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||
|
||||
try {
|
||||
auto client_authentication_request = p.GetSerialize<ClientAuth_Struct>(0);
|
||||
auto r = p.GetSerialize<ClientAuth>(0);
|
||||
|
||||
LogDebug(
|
||||
"Processing Loginserver Auth | account_id [{0}] account_name [{1}] loginserver_name [{2}] key [{3}] "
|
||||
"admin [{4}] ip [{5}] local_network [{6}]",
|
||||
client_authentication_request.loginserver_account_id,
|
||||
client_authentication_request.account_name,
|
||||
client_authentication_request.loginserver_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
"Processing Loginserver Auth | account_id [{}] account_name [{}] loginserver_name [{}] key [{}] "
|
||||
"admin [{}] ip [{}] local_network [{}]",
|
||||
r.loginserver_account_id,
|
||||
r.account_name,
|
||||
r.loginserver_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
|
||||
client_list.CLEAdd(
|
||||
client_authentication_request.loginserver_account_id,
|
||||
client_authentication_request.loginserver_name,
|
||||
client_authentication_request.account_name,
|
||||
client_authentication_request.key,
|
||||
client_authentication_request.is_world_admin,
|
||||
client_authentication_request.ip,
|
||||
client_authentication_request.is_client_from_local_network
|
||||
r.loginserver_account_id,
|
||||
r.loginserver_name,
|
||||
r.account_name,
|
||||
r.key,
|
||||
r.is_world_admin,
|
||||
r.ip_address,
|
||||
r.is_client_from_local_network
|
||||
);
|
||||
}
|
||||
catch (std::exception &ex) {
|
||||
|
||||
+8
-2
@@ -76,10 +76,10 @@
|
||||
#include "web_interface.h"
|
||||
#include "console.h"
|
||||
#include "dynamic_zone_manager.h"
|
||||
#include "expedition_database.h"
|
||||
|
||||
#include "world_server_cli.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
#include "../common/repositories/character_expedition_lockouts_repository.h"
|
||||
#include "../common/repositories/character_task_timers_repository.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "world_event_scheduler.h"
|
||||
@@ -89,6 +89,7 @@
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/skill_caps.h"
|
||||
#include "../common/repositories/character_parcels_repository.h"
|
||||
#include "../common/ip_util.h"
|
||||
|
||||
SkillCaps skill_caps;
|
||||
ZoneStore zone_store;
|
||||
@@ -188,6 +189,11 @@ int main(int argc, char **argv)
|
||||
launcher_list.LoadList();
|
||||
zoneserver_list.Init();
|
||||
|
||||
if (IpUtil::IsPortInUse(Config->WorldIP, Config->WorldTCPPort)) {
|
||||
LogError("World port [{}] already in use", Config->WorldTCPPort);
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::unique_ptr<EQ::Net::ConsoleServer> console;
|
||||
if (Config->TelnetEnabled) {
|
||||
LogInfo("Console (TCP) listener started on [{}:{}]", Config->TelnetIP, Config->TelnetTCPPort);
|
||||
@@ -449,7 +455,7 @@ int main(int argc, char **argv)
|
||||
if (PurgeInstanceTimer.Check()) {
|
||||
database.PurgeExpiredInstances();
|
||||
database.PurgeAllDeletedDataBuckets();
|
||||
ExpeditionDatabase::PurgeExpiredCharacterLockouts();
|
||||
CharacterExpeditionLockoutsRepository::DeleteWhere(database, "expire_time <= NOW()");
|
||||
CharacterTaskTimersRepository::DeleteWhere(database, "expire_time <= NOW()");
|
||||
}
|
||||
|
||||
|
||||
@@ -1172,7 +1172,7 @@ void SharedTaskManager::CreateDynamicZone(SharedTask *shared_task, DynamicZone &
|
||||
}
|
||||
}
|
||||
|
||||
auto new_dz = dynamic_zone_manager.CreateNew(dz_request, dz_members);
|
||||
auto new_dz = dynamic_zone_manager.TryCreate(dz_request, dz_members);
|
||||
if (new_dz) {
|
||||
auto shared_task_dz = SharedTaskDynamicZonesRepository::NewEntity();
|
||||
shared_task_dz.shared_task_id = shared_task->GetDbSharedTask().id;
|
||||
|
||||
@@ -283,7 +283,7 @@ void SharedTaskWorldMessaging::HandleZoneMessage(ServerPacket *pack)
|
||||
auto t = shared_task_manager.FindSharedTaskByTaskIdAndCharacterId(buf->task_id, buf->source_character_id);
|
||||
if (t) {
|
||||
DynamicZone dz;
|
||||
dz.LoadSerializedDzPacket(buf->cereal_data, buf->cereal_size);
|
||||
dz.Unserialize({ buf->cereal_data, buf->cereal_size });
|
||||
|
||||
shared_task_manager.CreateDynamicZone(t, dz);
|
||||
}
|
||||
|
||||
+10
-4
@@ -5,12 +5,12 @@
|
||||
#include "../common/http/uri.h"
|
||||
#include "../common/net/console_server.h"
|
||||
#include "../common/net/servertalk_server.h"
|
||||
#include "../common/repositories/character_expedition_lockouts_repository.h"
|
||||
#include "../common/repositories/character_task_timers_repository.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/strings.h"
|
||||
#include "adventure_manager.h"
|
||||
#include "dynamic_zone_manager.h"
|
||||
#include "expedition_database.h"
|
||||
#include "login_server_list.h"
|
||||
#include "shared_task_manager.h"
|
||||
#include "ucs.h"
|
||||
@@ -101,6 +101,13 @@ bool WorldBoot::HandleCommandInput(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
// check if we ran a valid command, this whole CLI handler needs to be improved at a later time
|
||||
std::string arg1 = argc >= 2 ? argv[1] : "";
|
||||
if (argc >= 2 && !Strings::Contains(arg1, ":")) {
|
||||
std::cout << "Invalid command, use --help to see available commands" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -367,9 +374,8 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
LogInfo("Purging expired dynamic zones and members");
|
||||
dynamic_zone_manager.PurgeExpiredDynamicZones();
|
||||
|
||||
LogInfo("Purging expired expeditions");
|
||||
ExpeditionDatabase::PurgeExpiredExpeditions();
|
||||
ExpeditionDatabase::PurgeExpiredCharacterLockouts();
|
||||
LogInfo("Purging expired character expedition lockouts");
|
||||
CharacterExpeditionLockoutsRepository::DeleteWhere(database, "expire_time <= NOW()");
|
||||
|
||||
LogInfo("Purging expired character task timers");
|
||||
CharacterTaskTimersRepository::DeleteWhere(database, "expire_time <= NOW()");
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <string>
|
||||
#include "../common/types.h"
|
||||
#include "../common/discord/discord.h"
|
||||
#include "ucs.h"
|
||||
|
||||
extern UCSConnection UCSLink;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "../common/servertalk.h"
|
||||
#include <ctime>
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/server_reload_types.h"
|
||||
|
||||
void WorldEventScheduler::Process(ZSList *zs_list)
|
||||
{
|
||||
@@ -55,11 +56,7 @@ void WorldEventScheduler::Process(ZSList *zs_list)
|
||||
if (e.event_type == ServerEvents::EVENT_TYPE_RELOAD_WORLD) {
|
||||
LogScheduler("Sending reload world event [{}]", e.event_data.c_str());
|
||||
|
||||
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
|
||||
auto *reload_world = (ReloadWorld_Struct *) pack->pBuffer;
|
||||
reload_world->global_repop = ReloadWorld::Repop;
|
||||
zs_list->SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
zs_list->SendServerReload(ServerReload::Type::WorldRepop, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,6 @@ WorldDatabase content_db;
|
||||
extern std::vector<RaceClassAllocation> character_create_allocations;
|
||||
extern std::vector<RaceClassCombos> character_create_race_class_combos;
|
||||
|
||||
|
||||
/**
|
||||
* @param account_id
|
||||
* @param out_app
|
||||
* @param client_version_bit
|
||||
*/
|
||||
void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **out_app, uint32 client_version_bit)
|
||||
{
|
||||
EQ::versions::ClientVersion
|
||||
|
||||
@@ -28,10 +28,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/event_sub.h"
|
||||
#include "web_interface.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/patches/patches.h"
|
||||
#include "../common/skill_caps.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
#include "world_boot.h"
|
||||
#include "shared_task_manager.h"
|
||||
#include "dynamic_zone_manager.h"
|
||||
#include "ucs.h"
|
||||
|
||||
extern uint32 numzones;
|
||||
extern EQ::Random emu_random;
|
||||
extern WebInterfaceList web_interface;
|
||||
extern SharedTaskManager shared_task_manager;
|
||||
volatile bool UCSServerAvailable_ = false;
|
||||
void CatchSignal(int sig_num);
|
||||
|
||||
@@ -861,3 +870,77 @@ bool ZSList::SendPacketToBootedZones(ServerPacket* pack)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ZSList::SendServerReload(ServerReload::Type type, uchar *packet)
|
||||
{
|
||||
static auto pack = ServerPacket(ServerOP_ServerReloadRequest, sizeof(ServerReload::Request));
|
||||
auto r = (ServerReload::Request *) pack.pBuffer;
|
||||
|
||||
// Copy the packet data if it exists
|
||||
if (packet) {
|
||||
memcpy(pack.pBuffer, packet, sizeof(ServerReload::Request));
|
||||
}
|
||||
|
||||
r->type = type;
|
||||
r->requires_zone_booted = true;
|
||||
|
||||
LogInfo("Sending reload to all zones for type [{}]", ServerReload::GetName(type));
|
||||
|
||||
static const std::unordered_set<ServerReload::Type> no_zone_boot_required = {
|
||||
ServerReload::Type::Opcodes,
|
||||
ServerReload::Type::Rules,
|
||||
ServerReload::Type::ContentFlags,
|
||||
ServerReload::Type::Logs,
|
||||
ServerReload::Type::Commands,
|
||||
ServerReload::Type::PerlExportSettings,
|
||||
ServerReload::Type::DataBucketsCache,
|
||||
ServerReload::Type::WorldRepop,
|
||||
ServerReload::Type::WorldWithRespawn
|
||||
};
|
||||
|
||||
// Set requires_zone_booted flag before executing reload logic
|
||||
if (no_zone_boot_required.contains(type)) {
|
||||
r->requires_zone_booted = false;
|
||||
}
|
||||
|
||||
// reload at the world level
|
||||
if (type == ServerReload::Type::Opcodes) {
|
||||
ReloadAllPatches();
|
||||
} else if (type == ServerReload::Type::Rules) {
|
||||
RuleManager::Instance()->LoadRules(&database, RuleManager::Instance()->GetActiveRuleset(), true);
|
||||
} else if (type == ServerReload::Type::SkillCaps) {
|
||||
skill_caps.ReloadSkillCaps();
|
||||
} else if (type == ServerReload::Type::ContentFlags) {
|
||||
content_service.SetExpansionContext()->ReloadContentFlags();
|
||||
} else if (type == ServerReload::Type::Logs) {
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
player_event_logs.ReloadSettings();
|
||||
UCSLink.SendPacket(&pack);
|
||||
} else if (type == ServerReload::Type::Tasks) {
|
||||
shared_task_manager.LoadTaskData();
|
||||
} else if (type == ServerReload::Type::DzTemplates) {
|
||||
dynamic_zone_manager.LoadTemplates();
|
||||
}
|
||||
|
||||
// Send the packet to all zones with staggered delays
|
||||
// to prevent all zones from reloading at the same time
|
||||
// and causing a massive spike in CPU usage
|
||||
// This is especially important for large servers
|
||||
// with many zones
|
||||
// we reload 10 zones every second
|
||||
int counter = 0;
|
||||
|
||||
for (auto &z: zone_server_list) {
|
||||
bool is_local = r->zone_server_id != 0;
|
||||
|
||||
// if the zone reload is local to a specific zone
|
||||
if (r->zone_server_id != 0 && r->zone_server_id != z->GetID()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if the reload is local, we don't need to stagger the reloads
|
||||
r->reload_at_unix = is_local ? 0 : (std::time(nullptr) + 1) + (counter / 10);
|
||||
z->SendPacket(&pack);
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "../common/eqtime.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/event/timer.h"
|
||||
#include "../common/server_reload_types.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <deque>
|
||||
@@ -69,6 +70,7 @@ public:
|
||||
ZoneServer* FindByZoneID(uint32 ZoneID);
|
||||
|
||||
const std::list<std::unique_ptr<ZoneServer>> &getZoneServerList() const;
|
||||
void SendServerReload(ServerReload::Type type, uchar *packet = nullptr);
|
||||
|
||||
private:
|
||||
void OnTick(EQ::Timer *t);
|
||||
|
||||
+14
-75
@@ -39,7 +39,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/zone_store.h"
|
||||
#include "dynamic_zone.h"
|
||||
#include "dynamic_zone_manager.h"
|
||||
#include "expedition_message.h"
|
||||
#include "shared_task_world_messaging.h"
|
||||
#include "../common/shared_tasks.h"
|
||||
#include "shared_task_manager.h"
|
||||
@@ -50,6 +49,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../zone/data_bucket.h"
|
||||
#include "../common/repositories/guild_tributes_repository.h"
|
||||
#include "../common/skill_caps.h"
|
||||
#include "../common/server_reload_types.h"
|
||||
|
||||
extern ClientList client_list;
|
||||
extern GroupLFPList LFPGroupList;
|
||||
@@ -1357,11 +1357,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
QSLink.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadOpcodes: {
|
||||
ReloadAllPatches();
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_CZDialogueWindow:
|
||||
case ServerOP_CZLDoNUpdate:
|
||||
case ServerOP_CZMarquee:
|
||||
@@ -1375,10 +1370,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
case ServerOP_Consent:
|
||||
case ServerOP_DepopAllPlayersCorpses:
|
||||
case ServerOP_DepopPlayerCorpse:
|
||||
case ServerOP_ExpeditionLockState:
|
||||
case ServerOP_ExpeditionLockout:
|
||||
case ServerOP_ExpeditionLockoutDuration:
|
||||
case ServerOP_ExpeditionReplayOnJoin:
|
||||
case ServerOP_GuildRankUpdate:
|
||||
case ServerOP_ItemStatus:
|
||||
case ServerOP_KickPlayer:
|
||||
@@ -1389,30 +1380,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
case ServerOP_RaidGroupSay:
|
||||
case ServerOP_RaidSay:
|
||||
case ServerOP_RefreshCensorship:
|
||||
case ServerOP_ReloadAAData:
|
||||
case ServerOP_ReloadAlternateCurrencies:
|
||||
case ServerOP_ReloadBaseData:
|
||||
case ServerOP_ReloadBlockedSpells:
|
||||
case ServerOP_ReloadCommands:
|
||||
case ServerOP_ReloadDoors:
|
||||
case ServerOP_ReloadDataBucketsCache:
|
||||
case ServerOP_ReloadFactions:
|
||||
case ServerOP_ReloadGroundSpawns:
|
||||
case ServerOP_ReloadLevelEXPMods:
|
||||
case ServerOP_ReloadMerchants:
|
||||
case ServerOP_ReloadNPCEmotes:
|
||||
case ServerOP_ReloadNPCSpells:
|
||||
case ServerOP_ReloadObjects:
|
||||
case ServerOP_ReloadPerlExportSettings:
|
||||
case ServerOP_ReloadStaticZoneData:
|
||||
case ServerOP_ReloadTitles:
|
||||
case ServerOP_ReloadTraps:
|
||||
case ServerOP_ReloadVariables:
|
||||
case ServerOP_ReloadVeteranRewards:
|
||||
case ServerOP_ReloadWorld:
|
||||
case ServerOP_ReloadZonePoints:
|
||||
case ServerOP_ReloadZoneData:
|
||||
case ServerOP_ReloadLoot:
|
||||
case ServerOP_RezzPlayerAccept:
|
||||
case ServerOP_SpawnStatusChange:
|
||||
case ServerOP_TraderMessaging:
|
||||
@@ -1430,14 +1397,9 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadSkillCaps: {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
skill_caps.ReloadSkillCaps();
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadRules: {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
RuleManager::Instance()->LoadRules(&database, "default", true);
|
||||
case ServerOP_ServerReloadRequest: {
|
||||
auto o = (ServerReload::Request*) pack->pBuffer;
|
||||
zoneserver_list.SendServerReload((ServerReload::Type) o->type, pack->pBuffer);
|
||||
break;
|
||||
}
|
||||
case ServerOP_IsOwnerOnline: {
|
||||
@@ -1465,29 +1427,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadContentFlags: {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
content_service.SetExpansionContext()->ReloadContentFlags();
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadLogs: {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
QSLink.SendPacket(pack);
|
||||
UCSLink.SendPacket(pack);
|
||||
LogSys.LoadLogDatabaseSettings();
|
||||
player_event_logs.ReloadSettings();
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadTasks: {
|
||||
shared_task_manager.LoadTaskData();
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadDzTemplates: {
|
||||
dynamic_zone_manager.LoadTemplates();
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ChangeSharedMem: {
|
||||
auto hotfix_name = std::string((char*) pack->pBuffer);
|
||||
|
||||
@@ -1532,16 +1471,11 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
SharedTaskWorldMessaging::HandleZoneMessage(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ExpeditionCreate:
|
||||
case ServerOP_ExpeditionDzAddPlayer:
|
||||
case ServerOP_ExpeditionDzMakeLeader:
|
||||
case ServerOP_ExpeditionCharacterLockout:
|
||||
case ServerOP_ExpeditionSaveInvite:
|
||||
case ServerOP_ExpeditionRequestInvite: {
|
||||
ExpeditionMessage::HandleZoneMessage(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_DzCreated:
|
||||
case ServerOP_DzAddPlayer:
|
||||
case ServerOP_DzSaveInvite:
|
||||
case ServerOP_DzRequestInvite:
|
||||
case ServerOP_DzMakeLeader:
|
||||
case ServerOP_DzAddRemoveMember:
|
||||
case ServerOP_DzSwapMembers:
|
||||
case ServerOP_DzRemoveAllMembers:
|
||||
@@ -1552,8 +1486,13 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
case ServerOP_DzSetZoneIn:
|
||||
case ServerOP_DzSetSwitchID:
|
||||
case ServerOP_DzMovePC:
|
||||
case ServerOP_DzLock:
|
||||
case ServerOP_DzReplayOnJoin:
|
||||
case ServerOP_DzLockout:
|
||||
case ServerOP_DzLockoutDuration:
|
||||
case ServerOP_DzCharacterLockout:
|
||||
case ServerOP_DzUpdateMemberStatus: {
|
||||
DynamicZone::HandleZoneMessage(pack);
|
||||
dynamic_zone_manager.HandleZoneMessage(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_GuildTributeUpdate: {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user