mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
+217
@@ -1,3 +1,220 @@
|
|||||||
|
## [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
|
## [22.62.2] 2/1/2025
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ SET(common_sources
|
|||||||
dbcore.cpp
|
dbcore.cpp
|
||||||
deity.cpp
|
deity.cpp
|
||||||
dynamic_zone_base.cpp
|
dynamic_zone_base.cpp
|
||||||
|
dynamic_zone_lockout.cpp
|
||||||
emu_constants.cpp
|
emu_constants.cpp
|
||||||
emu_limits.cpp
|
emu_limits.cpp
|
||||||
emu_opcodes.cpp
|
emu_opcodes.cpp
|
||||||
@@ -40,7 +41,6 @@ SET(common_sources
|
|||||||
events/player_event_logs.cpp
|
events/player_event_logs.cpp
|
||||||
events/player_event_discord_formatter.cpp
|
events/player_event_discord_formatter.cpp
|
||||||
evolving_items.cpp
|
evolving_items.cpp
|
||||||
expedition_lockout_timer.cpp
|
|
||||||
extprofile.cpp
|
extprofile.cpp
|
||||||
discord/discord_manager.cpp
|
discord/discord_manager.cpp
|
||||||
faction.cpp
|
faction.cpp
|
||||||
@@ -213,16 +213,14 @@ SET(repositories
|
|||||||
repositories/base/base_discovered_items_repository.h
|
repositories/base/base_discovered_items_repository.h
|
||||||
repositories/base/base_doors_repository.h
|
repositories/base/base_doors_repository.h
|
||||||
repositories/base/base_dynamic_zones_repository.h
|
repositories/base/base_dynamic_zones_repository.h
|
||||||
|
repositories/base/base_dynamic_zone_lockouts_repository.h
|
||||||
repositories/base/base_dynamic_zone_members_repository.h
|
repositories/base/base_dynamic_zone_members_repository.h
|
||||||
repositories/base/base_dynamic_zone_templates_repository.h
|
repositories/base/base_dynamic_zone_templates_repository.h
|
||||||
repositories/base/base_expeditions_repository.h
|
|
||||||
repositories/base/base_expedition_lockouts_repository.h
|
|
||||||
repositories/base/base_faction_association_repository.h
|
repositories/base/base_faction_association_repository.h
|
||||||
repositories/base/base_faction_base_data_repository.h
|
repositories/base/base_faction_base_data_repository.h
|
||||||
repositories/base/base_faction_list_repository.h
|
repositories/base/base_faction_list_repository.h
|
||||||
repositories/base/base_faction_list_mod_repository.h
|
repositories/base/base_faction_list_mod_repository.h
|
||||||
repositories/base/base_faction_values_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_fishing_repository.h
|
||||||
repositories/base/base_forage_repository.h
|
repositories/base/base_forage_repository.h
|
||||||
repositories/base/base_friends_repository.h
|
repositories/base/base_friends_repository.h
|
||||||
@@ -411,16 +409,14 @@ SET(repositories
|
|||||||
repositories/discovered_items_repository.h
|
repositories/discovered_items_repository.h
|
||||||
repositories/doors_repository.h
|
repositories/doors_repository.h
|
||||||
repositories/dynamic_zones_repository.h
|
repositories/dynamic_zones_repository.h
|
||||||
|
repositories/dynamic_zone_lockouts_repository.h
|
||||||
repositories/dynamic_zone_members_repository.h
|
repositories/dynamic_zone_members_repository.h
|
||||||
repositories/dynamic_zone_templates_repository.h
|
repositories/dynamic_zone_templates_repository.h
|
||||||
repositories/expeditions_repository.h
|
|
||||||
repositories/expedition_lockouts_repository.h
|
|
||||||
repositories/faction_association_repository.h
|
repositories/faction_association_repository.h
|
||||||
repositories/faction_base_data_repository.h
|
repositories/faction_base_data_repository.h
|
||||||
repositories/faction_list_repository.h
|
repositories/faction_list_repository.h
|
||||||
repositories/faction_list_mod_repository.h
|
repositories/faction_list_mod_repository.h
|
||||||
repositories/faction_values_repository.h
|
repositories/faction_values_repository.h
|
||||||
repositories/find_location_repository.h
|
|
||||||
repositories/fishing_repository.h
|
repositories/fishing_repository.h
|
||||||
repositories/forage_repository.h
|
repositories/forage_repository.h
|
||||||
repositories/friends_repository.h
|
repositories/friends_repository.h
|
||||||
@@ -563,6 +559,7 @@ SET(common_headers
|
|||||||
discord/discord.h
|
discord/discord.h
|
||||||
discord/discord_manager.h
|
discord/discord_manager.h
|
||||||
dynamic_zone_base.h
|
dynamic_zone_base.h
|
||||||
|
dynamic_zone_lockout.h
|
||||||
emu_constants.h
|
emu_constants.h
|
||||||
emu_limits.h
|
emu_limits.h
|
||||||
emu_opcodes.h
|
emu_opcodes.h
|
||||||
@@ -589,7 +586,6 @@ SET(common_headers
|
|||||||
events/player_events.h
|
events/player_events.h
|
||||||
event_sub.h
|
event_sub.h
|
||||||
evolving_items.h
|
evolving_items.h
|
||||||
expedition_lockout_timer.h
|
|
||||||
extprofile.h
|
extprofile.h
|
||||||
faction.h
|
faction.h
|
||||||
file.h
|
file.h
|
||||||
@@ -649,6 +645,7 @@ SET(common_headers
|
|||||||
server_event_scheduler.h
|
server_event_scheduler.h
|
||||||
serverinfo.h
|
serverinfo.h
|
||||||
servertalk.h
|
servertalk.h
|
||||||
|
server_reload_types.h
|
||||||
shared_tasks.h
|
shared_tasks.h
|
||||||
shareddb.h
|
shareddb.h
|
||||||
skills.h
|
skills.h
|
||||||
|
|||||||
+1
-1
@@ -245,7 +245,7 @@ uint32 Database::CreateAccount(
|
|||||||
e.password = password;
|
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);
|
e = AccountRepository::InsertOne(*this, e);
|
||||||
|
|
||||||
|
|||||||
@@ -596,7 +596,12 @@ void DatabaseDumpService::BuildCredentialsFile()
|
|||||||
void DatabaseDumpService::RemoveCredentialsFile()
|
void DatabaseDumpService::RemoveCredentialsFile()
|
||||||
{
|
{
|
||||||
if (File::Exists(CREDENTIALS_FILE)) {
|
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`);
|
ADD PRIMARY KEY (`account_id`, `slot_id`);
|
||||||
)",
|
)",
|
||||||
.content_schema_update = false,
|
.content_schema_update = false,
|
||||||
.force_interactive = true
|
.force_interactive = false
|
||||||
},
|
},
|
||||||
ManifestEntry{
|
ManifestEntry{
|
||||||
.version = 9298,
|
.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
|
UPDATE `sharedbank` SET `slot_id` = ((`slot_id` - 2541) + 11210) WHERE `slot_id` BETWEEN 2541 AND 2550; -- Shared Bank Bag 2
|
||||||
)",
|
)",
|
||||||
.content_schema_update = false,
|
.content_schema_update = false,
|
||||||
.force_interactive = true
|
.force_interactive = false
|
||||||
},
|
},
|
||||||
ManifestEntry{
|
ManifestEntry{
|
||||||
.version = 9299,
|
.version = 9299,
|
||||||
@@ -6770,7 +6770,174 @@ SET `aliases` =
|
|||||||
WHERE `command` = 'illusionblock'
|
WHERE `command` = 'illusionblock'
|
||||||
AND `aliases` NOT LIKE '%ib%';
|
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;
|
||||||
|
)",
|
||||||
|
},
|
||||||
// -- template; copy/paste this when you need to create a new entry
|
// -- template; copy/paste this when you need to create a new entry
|
||||||
// ManifestEntry{
|
// ManifestEntry{
|
||||||
// .version = 9228,
|
// .version = 9228,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "../common/repositories/respawn_times_repository.h"
|
#include "../common/repositories/respawn_times_repository.h"
|
||||||
#include "../common/repositories/spawn_condition_values_repository.h"
|
#include "../common/repositories/spawn_condition_values_repository.h"
|
||||||
#include "repositories/spawn2_disabled_repository.h"
|
#include "repositories/spawn2_disabled_repository.h"
|
||||||
|
#include "repositories/data_buckets_repository.h"
|
||||||
|
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
|
||||||
@@ -479,6 +479,7 @@ void Database::DeleteInstance(uint16 instance_id)
|
|||||||
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
||||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||||
CharacterCorpsesRepository::BuryInstance(*this, instance_id);
|
CharacterCorpsesRepository::BuryInstance(*this, instance_id);
|
||||||
|
DataBucketsRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id)
|
void Database::FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id)
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ namespace DatabaseSchema {
|
|||||||
"character_pet_buffs",
|
"character_pet_buffs",
|
||||||
"character_pet_info",
|
"character_pet_info",
|
||||||
"character_pet_inventory",
|
"character_pet_inventory",
|
||||||
|
"character_pet_name",
|
||||||
"character_peqzone_flags",
|
"character_peqzone_flags",
|
||||||
"character_potionbelt",
|
"character_potionbelt",
|
||||||
"character_skills",
|
"character_skills",
|
||||||
@@ -311,10 +312,9 @@ namespace DatabaseSchema {
|
|||||||
"completed_shared_task_members",
|
"completed_shared_task_members",
|
||||||
"completed_shared_tasks",
|
"completed_shared_tasks",
|
||||||
"discord_webhooks",
|
"discord_webhooks",
|
||||||
|
"dynamic_zone_lockouts",
|
||||||
"dynamic_zone_members",
|
"dynamic_zone_members",
|
||||||
"dynamic_zones",
|
"dynamic_zones",
|
||||||
"expedition_lockouts",
|
|
||||||
"expeditions",
|
|
||||||
"gm_ips",
|
"gm_ips",
|
||||||
"group_id",
|
"group_id",
|
||||||
"group_leaders",
|
"group_leaders",
|
||||||
@@ -351,6 +351,7 @@ namespace DatabaseSchema {
|
|||||||
"shared_task_dynamic_zones",
|
"shared_task_dynamic_zones",
|
||||||
"shared_task_members",
|
"shared_task_members",
|
||||||
"shared_tasks",
|
"shared_tasks",
|
||||||
|
"zone_state_spawns",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+293
-64
@@ -1,11 +1,13 @@
|
|||||||
#include "dynamic_zone_base.h"
|
#include "dynamic_zone_base.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "eqemu_logsys.h"
|
#include "eqemu_logsys.h"
|
||||||
#include "repositories/instance_list_repository.h"
|
|
||||||
#include "repositories/instance_list_player_repository.h"
|
|
||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "servertalk.h"
|
#include "servertalk.h"
|
||||||
#include "util/uuid.h"
|
#include "util/uuid.h"
|
||||||
|
#include "repositories/character_expedition_lockouts_repository.h"
|
||||||
|
#include "repositories/dynamic_zone_lockouts_repository.h"
|
||||||
|
#include "repositories/instance_list_repository.h"
|
||||||
|
#include "repositories/instance_list_player_repository.h"
|
||||||
|
|
||||||
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
||||||
{
|
{
|
||||||
@@ -93,13 +95,15 @@ void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneIn
|
|||||||
m_zonein.y = dz_entry.zone_in_y;
|
m_zonein.y = dz_entry.zone_in_y;
|
||||||
m_zonein.z = dz_entry.zone_in_z;
|
m_zonein.z = dz_entry.zone_in_z;
|
||||||
m_zonein.heading = dz_entry.zone_in_heading;
|
m_zonein.heading = dz_entry.zone_in_heading;
|
||||||
m_has_zonein = (dz_entry.has_zone_in != 0);
|
m_has_zonein = dz_entry.has_zone_in != 0;
|
||||||
|
m_is_locked = dz_entry.is_locked;
|
||||||
|
m_add_replay = dz_entry.add_replay;
|
||||||
// instance_list portion
|
// instance_list portion
|
||||||
m_zone_id = dz_entry.zone;
|
m_zone_id = dz_entry.zone;
|
||||||
m_zone_version = dz_entry.version;
|
m_zone_version = dz_entry.version;
|
||||||
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
||||||
m_duration = std::chrono::seconds(dz_entry.duration);
|
m_duration = std::chrono::seconds(dz_entry.duration);
|
||||||
m_never_expires = (dz_entry.never_expires != 0);
|
m_never_expires = dz_entry.never_expires != 0;
|
||||||
m_expire_time = m_start_time + m_duration;
|
m_expire_time = m_start_time + m_duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,37 +123,40 @@ void DynamicZoneBase::AddMemberFromRepositoryResult(
|
|||||||
uint32_t DynamicZoneBase::SaveToDatabase()
|
uint32_t DynamicZoneBase::SaveToDatabase()
|
||||||
{
|
{
|
||||||
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
||||||
|
if (m_instance_id == 0)
|
||||||
if (m_instance_id != 0)
|
|
||||||
{
|
{
|
||||||
auto insert_dz = DynamicZonesRepository::NewEntity();
|
return 0;
|
||||||
insert_dz.uuid = m_uuid;
|
|
||||||
insert_dz.name = m_name;
|
|
||||||
insert_dz.leader_id = m_leader.id;
|
|
||||||
insert_dz.min_players = m_min_players;
|
|
||||||
insert_dz.max_players = m_max_players;
|
|
||||||
insert_dz.instance_id = m_instance_id,
|
|
||||||
insert_dz.type = static_cast<int>(m_type);
|
|
||||||
insert_dz.dz_switch_id = m_dz_switch_id;
|
|
||||||
insert_dz.compass_zone_id = m_compass.zone_id;
|
|
||||||
insert_dz.compass_x = m_compass.x;
|
|
||||||
insert_dz.compass_y = m_compass.y;
|
|
||||||
insert_dz.compass_z = m_compass.z;
|
|
||||||
insert_dz.safe_return_zone_id = m_safereturn.zone_id;
|
|
||||||
insert_dz.safe_return_x = m_safereturn.x;
|
|
||||||
insert_dz.safe_return_y = m_safereturn.y;
|
|
||||||
insert_dz.safe_return_z = m_safereturn.z;
|
|
||||||
insert_dz.safe_return_heading = m_safereturn.heading;
|
|
||||||
insert_dz.zone_in_x = m_zonein.x;
|
|
||||||
insert_dz.zone_in_y = m_zonein.y;
|
|
||||||
insert_dz.zone_in_z = m_zonein.z;
|
|
||||||
insert_dz.zone_in_heading = m_zonein.heading;
|
|
||||||
insert_dz.has_zone_in = m_has_zonein;
|
|
||||||
|
|
||||||
auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
|
|
||||||
return inserted_dz.id;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
auto dz = DynamicZonesRepository::NewEntity();
|
||||||
|
dz.uuid = m_uuid;
|
||||||
|
dz.name = m_name;
|
||||||
|
dz.leader_id = m_leader.id;
|
||||||
|
dz.min_players = m_min_players;
|
||||||
|
dz.max_players = m_max_players;
|
||||||
|
dz.instance_id = static_cast<int32_t>(m_instance_id),
|
||||||
|
dz.type = static_cast<uint8_t>(m_type);
|
||||||
|
dz.dz_switch_id = m_dz_switch_id;
|
||||||
|
dz.compass_zone_id = m_compass.zone_id;
|
||||||
|
dz.compass_x = m_compass.x;
|
||||||
|
dz.compass_y = m_compass.y;
|
||||||
|
dz.compass_z = m_compass.z;
|
||||||
|
dz.safe_return_zone_id = m_safereturn.zone_id;
|
||||||
|
dz.safe_return_x = m_safereturn.x;
|
||||||
|
dz.safe_return_y = m_safereturn.y;
|
||||||
|
dz.safe_return_z = m_safereturn.z;
|
||||||
|
dz.safe_return_heading = m_safereturn.heading;
|
||||||
|
dz.zone_in_x = m_zonein.x;
|
||||||
|
dz.zone_in_y = m_zonein.y;
|
||||||
|
dz.zone_in_z = m_zonein.z;
|
||||||
|
dz.zone_in_heading = m_zonein.heading;
|
||||||
|
dz.has_zone_in = static_cast<uint8_t>(m_has_zonein);
|
||||||
|
dz.is_locked = static_cast<int8_t>(m_is_locked);
|
||||||
|
dz.add_replay = static_cast<int8_t>(m_add_replay);
|
||||||
|
|
||||||
|
dz = DynamicZonesRepository::InsertOne(GetDatabase(), std::move(dz));
|
||||||
|
|
||||||
|
return dz.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
|
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
|
||||||
@@ -196,10 +203,9 @@ bool DynamicZoneBase::RemoveMember(const DynamicZoneMember& remove_member)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::SwapMember(
|
bool DynamicZoneBase::SwapMember(const DynamicZoneMember& add_member, const std::string& remove_name)
|
||||||
const DynamicZoneMember& add_member, const std::string& remove_char_name)
|
|
||||||
{
|
{
|
||||||
auto remove_member = GetMemberData(remove_char_name);
|
auto remove_member = GetMemberData(remove_name);
|
||||||
if (!add_member.IsValid() || !remove_member.IsValid())
|
if (!add_member.IsValid() || !remove_member.IsValid())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -230,9 +236,18 @@ void DynamicZoneBase::RemoveAllMembers()
|
|||||||
|
|
||||||
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||||
{
|
{
|
||||||
|
if (members.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
||||||
|
|
||||||
m_members = members;
|
m_members = members;
|
||||||
|
if (m_members.size() > m_max_players)
|
||||||
|
{
|
||||||
|
m_members.resize(m_max_players);
|
||||||
|
}
|
||||||
|
|
||||||
// the lower level instance_list_players needs to be kept updated as well
|
// the lower level instance_list_players needs to be kept updated as well
|
||||||
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
||||||
@@ -242,12 +257,12 @@ void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
|||||||
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
||||||
member_entry.dynamic_zone_id = m_id;
|
member_entry.dynamic_zone_id = m_id;
|
||||||
member_entry.character_id = member.id;
|
member_entry.character_id = member.id;
|
||||||
insert_members.emplace_back(member_entry);
|
insert_members.push_back(member_entry);
|
||||||
|
|
||||||
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
InstanceListPlayerRepository::InstanceListPlayer player_entry{};
|
||||||
player_entry.id = static_cast<int>(m_instance_id);
|
player_entry.id = m_instance_id;
|
||||||
player_entry.charid = static_cast<int>(member.id);
|
player_entry.charid = member.id;
|
||||||
insert_players.emplace_back(player_entry);
|
insert_players.push_back(player_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
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
|
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
||||||
{
|
{
|
||||||
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
||||||
@@ -478,13 +531,13 @@ void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
|
|||||||
), m_members.end());
|
), 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(),
|
return std::any_of(m_members.begin(), m_members.end(),
|
||||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::HasMember(const std::string& character_name)
|
bool DynamicZoneBase::HasMember(const std::string& character_name) const
|
||||||
{
|
{
|
||||||
return std::any_of(m_members.begin(), m_members.end(),
|
return std::any_of(m_members.begin(), m_members.end(),
|
||||||
[&](const DynamicZoneMember& member) {
|
[&](const DynamicZoneMember& member) {
|
||||||
@@ -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;
|
std::ostringstream ss = GetSerialized();
|
||||||
dyn_pack.PutSerialize(0, *this);
|
std::string_view sv = ss.view();
|
||||||
|
|
||||||
LogDynamicZonesDetail("Serialized server dz size [{}]", dyn_pack.Length());
|
auto pack_size = sizeof(ServerDzCreate_Struct) + sv.size();
|
||||||
return dyn_pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzCreatePacket(
|
|
||||||
uint16_t origin_zone_id, uint16_t origin_instance_id)
|
|
||||||
{
|
|
||||||
EQ::Net::DynamicPacket dyn_pack = GetSerializedDzPacket();
|
|
||||||
|
|
||||||
auto pack_size = sizeof(ServerDzCreateSerialized_Struct) + dyn_pack.Length();
|
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
||||||
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
|
auto buf = reinterpret_cast<ServerDzCreate_Struct*>(pack->pBuffer);
|
||||||
buf->origin_zone_id = origin_zone_id;
|
buf->origin_zone_id = zone_id;
|
||||||
buf->origin_instance_id = origin_instance_id;
|
buf->origin_instance_id = instance_id;
|
||||||
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
|
buf->dz_id = GetID();
|
||||||
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
|
buf->cereal_size = static_cast<uint32_t>(sv.size());
|
||||||
|
memcpy(buf->cereal_data, sv.data(), sv.size());
|
||||||
|
|
||||||
return pack;
|
return pack;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicZoneBase::LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size)
|
std::ostringstream DynamicZoneBase::GetSerialized()
|
||||||
{
|
{
|
||||||
LogDynamicZonesDetail("Deserializing server dz size [{}]", cereal_size);
|
std::ostringstream ss;
|
||||||
EQ::Util::MemoryStreamReader ss(cereal_data, cereal_size);
|
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);
|
cereal::BinaryInputArchive archive(ss);
|
||||||
archive(*this);
|
archive(*this);
|
||||||
}
|
}
|
||||||
@@ -647,3 +699,180 @@ void DynamicZoneBase::LoadTemplate(const DynamicZoneTemplatesRepository::Dynamic
|
|||||||
m_zonein.z = dz_template.zone_in_z;
|
m_zonein.z = dz_template.zone_in_z;
|
||||||
m_zonein.heading = dz_template.zone_in_h;
|
m_zonein.heading = dz_template.zone_in_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<uint32_t> DynamicZoneBase::GetMemberIds()
|
||||||
|
{
|
||||||
|
std::vector<uint32_t> ids;
|
||||||
|
ids.reserve(m_members.size());
|
||||||
|
for (const auto& member : m_members)
|
||||||
|
{
|
||||||
|
ids.push_back(member.id);
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DynamicZoneBase::HasLockout(const std::string& event)
|
||||||
|
{
|
||||||
|
return std::ranges::any_of(m_lockouts, [&](const auto& l) { return l.IsEvent(event); });
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DynamicZoneBase::HasReplayLockout()
|
||||||
|
{
|
||||||
|
return HasLockout(DzLockout::ReplayTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::AddLockout(const std::string& event, uint32_t seconds)
|
||||||
|
{
|
||||||
|
auto lockout = DzLockout::Create(m_name, event, seconds, m_uuid);
|
||||||
|
AddLockout(lockout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::AddLockout(const DzLockout& lockout, bool members_only)
|
||||||
|
{
|
||||||
|
if (!members_only)
|
||||||
|
{
|
||||||
|
DynamicZoneLockoutsRepository::InsertLockouts(GetDatabase(), GetID(), { lockout });
|
||||||
|
}
|
||||||
|
|
||||||
|
CharacterExpeditionLockoutsRepository::InsertLockout(GetDatabase(), GetMemberIds(), lockout);
|
||||||
|
|
||||||
|
HandleLockoutUpdate(lockout, false, members_only);
|
||||||
|
SendServerPacket(CreateLockoutPacket(lockout, false, members_only).get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::AddLockoutDuration(const std::string& event, int seconds, bool members_only)
|
||||||
|
{
|
||||||
|
auto lockout = DzLockout::Create(m_name, event, std::max(0, seconds), m_uuid);
|
||||||
|
|
||||||
|
// lockout has unsigned duration, pass original seconds to support reducing existing timers
|
||||||
|
int secs = static_cast<int>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
CharacterExpeditionLockoutsRepository::AddLockoutDuration(GetDatabase(), GetMemberIds(), lockout, secs);
|
||||||
|
|
||||||
|
HandleLockoutDuration(lockout, seconds, members_only, true);
|
||||||
|
SendServerPacket(CreateLockoutDurationPacket(lockout, seconds, members_only).get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::UpdateLockoutDuration(const std::string& event, uint32_t seconds, bool members_only)
|
||||||
|
{
|
||||||
|
// some live expeditions update existing lockout timers during progression
|
||||||
|
auto it = std::ranges::find_if(m_lockouts, [&](const auto& l) { return l.IsEvent(event); });
|
||||||
|
if (it != m_lockouts.end())
|
||||||
|
{
|
||||||
|
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
DzLockout lockout(m_uuid, m_name, event, it->GetStartTime() + seconds, seconds);
|
||||||
|
AddLockout(lockout, members_only);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::RemoveLockout(const std::string& event)
|
||||||
|
{
|
||||||
|
DynamicZoneLockoutsRepository::DeleteWhere(GetDatabase(), fmt::format(
|
||||||
|
"dynamic_zone_id = {} AND event_name = '{}'", GetID(), Strings::Escape(event)));
|
||||||
|
|
||||||
|
CharacterExpeditionLockoutsRepository::DeleteWhere(GetDatabase(), fmt::format(
|
||||||
|
"character_id IN ({}) AND expedition_name = '{}' AND event_name = '{}'",
|
||||||
|
fmt::join(GetMemberIds(), ","), Strings::Escape(m_name), Strings::Escape(event)));
|
||||||
|
|
||||||
|
DzLockout lockout{m_uuid, m_name, event, 0, 0};
|
||||||
|
HandleLockoutUpdate(lockout, true, false);
|
||||||
|
SendServerPacket(CreateLockoutPacket(lockout, true).get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::HandleLockoutUpdate(const DzLockout& lockout, bool remove, bool members_only)
|
||||||
|
{
|
||||||
|
if (!members_only)
|
||||||
|
{
|
||||||
|
std::erase_if(m_lockouts, [&](const auto& l) { return l.IsEvent(lockout.Event()); });
|
||||||
|
if (!remove)
|
||||||
|
{
|
||||||
|
m_lockouts.push_back(lockout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::HandleLockoutDuration(const DzLockout& lockout, int seconds, bool members_only, bool insert_db)
|
||||||
|
{
|
||||||
|
if (!members_only)
|
||||||
|
{
|
||||||
|
auto it = std::ranges::find_if(m_lockouts, [&](const auto& l) { return l.IsEvent(lockout.Event()); });
|
||||||
|
if (it != m_lockouts.end())
|
||||||
|
{
|
||||||
|
it->AddLockoutTime(seconds);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
it = m_lockouts.insert(m_lockouts.end(), lockout);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insert_db)
|
||||||
|
{
|
||||||
|
DynamicZoneLockoutsRepository::InsertLockouts(GetDatabase(), GetID(), { *it });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateLockoutPacket(const DzLockout& lockout, bool remove, bool members_only) const
|
||||||
|
{
|
||||||
|
uint32_t pack_size = sizeof(ServerDzLockout_Struct);
|
||||||
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzLockout, pack_size);
|
||||||
|
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
||||||
|
buf->dz_id = GetID();
|
||||||
|
buf->expire_time = lockout.GetExpireTime();
|
||||||
|
buf->duration = lockout.GetDuration();
|
||||||
|
buf->sender_zone_id = GetCurrentZoneID();
|
||||||
|
buf->sender_instance_id = GetCurrentInstanceID();
|
||||||
|
buf->remove = remove;
|
||||||
|
buf->members_only = members_only;
|
||||||
|
strn0cpy(buf->event_name, lockout.Event().c_str(), sizeof(buf->event_name));
|
||||||
|
return pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateLockoutDurationPacket(const DzLockout& lockout, int seconds, bool members_only) const
|
||||||
|
{
|
||||||
|
uint32_t pack_size = sizeof(ServerDzLockout_Struct);
|
||||||
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzLockoutDuration, pack_size);
|
||||||
|
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
||||||
|
buf->dz_id = GetID();
|
||||||
|
buf->expire_time = lockout.GetExpireTime();
|
||||||
|
buf->duration = lockout.GetDuration();
|
||||||
|
buf->sender_zone_id = GetCurrentZoneID();
|
||||||
|
buf->sender_instance_id = GetCurrentInstanceID();
|
||||||
|
buf->members_only = members_only;
|
||||||
|
buf->seconds = seconds;
|
||||||
|
strn0cpy(buf->event_name, lockout.Event().c_str(), sizeof(buf->event_name));
|
||||||
|
return pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::SyncCharacterLockouts(uint32_t char_id, std::vector<DzLockout>& lockouts)
|
||||||
|
{
|
||||||
|
// adds missing event lockouts to client for this expedition and updates
|
||||||
|
// client timers that are both shorter and from another expedition
|
||||||
|
bool modified = false;
|
||||||
|
|
||||||
|
for (const auto& lockout : m_lockouts)
|
||||||
|
{
|
||||||
|
if (lockout.IsReplay() || lockout.IsExpired() || lockout.UUID() != m_uuid)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto it = std::find_if(lockouts.begin(), lockouts.end(), [&](const DzLockout& l) { return l.IsSame(lockout); });
|
||||||
|
if (it == lockouts.end())
|
||||||
|
{
|
||||||
|
modified = true;
|
||||||
|
lockouts.push_back(lockout); // insert missing
|
||||||
|
}
|
||||||
|
else if (it->GetSecondsRemaining() < lockout.GetSecondsRemaining() && it->UUID() != m_uuid)
|
||||||
|
{
|
||||||
|
// only update lockout timer not uuid so loot event apis still work
|
||||||
|
modified = true;
|
||||||
|
it->SetDuration(lockout.GetDuration());
|
||||||
|
it->SetExpireTime(lockout.GetExpireTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modified)
|
||||||
|
{
|
||||||
|
CharacterExpeditionLockoutsRepository::InsertLockouts(GetDatabase(), char_id, lockouts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+68
-14
@@ -1,8 +1,8 @@
|
|||||||
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
||||||
#define COMMON_DYNAMIC_ZONE_BASE_H
|
#define COMMON_DYNAMIC_ZONE_BASE_H
|
||||||
|
|
||||||
|
#include "dynamic_zone_lockout.h"
|
||||||
#include "eq_constants.h"
|
#include "eq_constants.h"
|
||||||
#include "net/packet.h"
|
|
||||||
#include "repositories/dynamic_zones_repository.h"
|
#include "repositories/dynamic_zones_repository.h"
|
||||||
#include "repositories/dynamic_zone_members_repository.h"
|
#include "repositories/dynamic_zone_members_repository.h"
|
||||||
#include "repositories/dynamic_zone_templates_repository.h"
|
#include "repositories/dynamic_zone_templates_repository.h"
|
||||||
@@ -10,12 +10,40 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class ServerPacket;
|
class ServerPacket;
|
||||||
|
|
||||||
|
// message string 8312 added in September 08 2020 Test patch (used by both dz and shared tasks)
|
||||||
|
inline constexpr char DzNotAllAdded[] = "Not all players in your {0} were added to the {1}. The {1} can take a maximum of {2} players, and your {0} has {3}.";
|
||||||
|
|
||||||
|
enum class DzLockMsg : uint8_t
|
||||||
|
{
|
||||||
|
None = 0, Close, Begin
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DynamicZoneType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Expedition,
|
||||||
|
Tutorial,
|
||||||
|
Task,
|
||||||
|
Mission, // Shared Task
|
||||||
|
Quest
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DynamicZoneMemberStatus
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
Online,
|
||||||
|
Offline,
|
||||||
|
InDynamicZone,
|
||||||
|
LinkDead
|
||||||
|
};
|
||||||
|
|
||||||
struct DynamicZoneMember
|
struct DynamicZoneMember
|
||||||
{
|
{
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
@@ -93,6 +121,7 @@ public:
|
|||||||
const std::string& GetName() const { return m_name; }
|
const std::string& GetName() const { return m_name; }
|
||||||
const std::string& GetUUID() const { return m_uuid; }
|
const std::string& GetUUID() const { return m_uuid; }
|
||||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||||
|
const std::vector<DzLockout>& GetLockouts() const { return m_lockouts; }
|
||||||
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
||||||
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
||||||
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
||||||
@@ -104,31 +133,34 @@ public:
|
|||||||
uint32_t GetDatabaseMemberCount();
|
uint32_t GetDatabaseMemberCount();
|
||||||
DynamicZoneMember GetMemberData(uint32_t character_id);
|
DynamicZoneMember GetMemberData(uint32_t character_id);
|
||||||
DynamicZoneMember GetMemberData(const std::string& character_name);
|
DynamicZoneMember GetMemberData(const std::string& character_name);
|
||||||
EQ::Net::DynamicPacket GetSerializedDzPacket();
|
std::vector<uint32_t> GetMemberIds();
|
||||||
|
std::ostringstream GetSerialized();
|
||||||
bool HasDatabaseMember(uint32_t character_id);
|
bool HasDatabaseMember(uint32_t character_id);
|
||||||
bool HasMember(uint32_t character_id);
|
bool HasMember(uint32_t character_id) const;
|
||||||
bool HasMember(const std::string& character_name);
|
bool HasMember(const std::string& character_name) const;
|
||||||
bool HasMembers() const { return !m_members.empty(); }
|
bool HasMembers() const { return !m_members.empty(); }
|
||||||
bool HasZoneInLocation() const { return m_has_zonein; }
|
bool HasZoneInLocation() const { return m_has_zonein; }
|
||||||
|
bool IsExpedition() const { return m_type == DynamicZoneType::Expedition; }
|
||||||
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
||||||
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
||||||
|
bool IsLocked() const { return m_is_locked; }
|
||||||
bool IsValid() const { return m_instance_id != 0; }
|
bool IsValid() const { return m_instance_id != 0; }
|
||||||
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
||||||
void LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size);
|
|
||||||
void LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template);
|
void LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template);
|
||||||
void RemoveAllMembers();
|
void RemoveAllMembers();
|
||||||
bool RemoveMember(uint32_t character_id);
|
bool RemoveMember(uint32_t character_id);
|
||||||
bool RemoveMember(const std::string& character_name);
|
bool RemoveMember(const std::string& character_name);
|
||||||
bool RemoveMember(const DynamicZoneMember& remove_member);
|
bool RemoveMember(const DynamicZoneMember& remove_member);
|
||||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
|
||||||
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
||||||
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
||||||
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
|
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
|
||||||
|
void SetLocked(bool lock, bool update_db = false, DzLockMsg lock_msg = DzLockMsg::None, uint32_t color = Chat::Yellow);
|
||||||
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
||||||
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
||||||
void SetName(const std::string& name) { m_name = name; }
|
void SetName(const std::string& name) { m_name = name; }
|
||||||
|
void SetReplayOnJoin(bool enabled, bool update_db = false);
|
||||||
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
||||||
void SetSwitchID(int dz_switch_id, bool update_db = false);
|
void SetSwitchID(int dz_switch_id, bool update_db = false);
|
||||||
@@ -136,34 +168,48 @@ public:
|
|||||||
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
||||||
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
||||||
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_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:
|
protected:
|
||||||
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
virtual uint16_t GetCurrentInstanceID() const { return 0; }
|
||||||
virtual uint16_t GetCurrentZoneID() { return 0; }
|
virtual uint16_t GetCurrentZoneID() const { return 0; }
|
||||||
virtual Database& GetDatabase() = 0;
|
virtual Database& GetDatabase() = 0;
|
||||||
|
virtual void HandleLockoutDuration(const DzLockout& lockout, int seconds, bool members_only, bool insert_db);
|
||||||
|
virtual void HandleLockoutUpdate(const DzLockout& lockout, bool remove, bool members_only);
|
||||||
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
||||||
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
||||||
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
|
virtual bool ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
|
virtual void ProcessRemoveAllMembers() { m_members.clear(); }
|
||||||
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
|
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
|
||||||
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
||||||
|
|
||||||
|
void AddLockout(const DzLockout& lockout, bool members_only = false);
|
||||||
void AddInternalMember(const DynamicZoneMember& member);
|
void AddInternalMember(const DynamicZoneMember& member);
|
||||||
uint32_t Create();
|
uint32_t Create();
|
||||||
uint32_t CreateInstance();
|
uint32_t CreateInstance();
|
||||||
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
||||||
void RemoveInternalMember(uint32_t character_id);
|
void RemoveInternalMember(uint32_t character_id);
|
||||||
|
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||||
uint32_t SaveToDatabase();
|
uint32_t SaveToDatabase();
|
||||||
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> 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> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
|
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
|
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
|
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
||||||
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
|
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
|
||||||
|
std::unique_ptr<ServerPacket> CreateLockoutPacket(const DzLockout& lockout, bool remove, bool members_only = false) const;
|
||||||
|
std::unique_ptr<ServerPacket> CreateLockoutDurationPacket(const DzLockout& lockout, int seconds, bool members_only = false) const;
|
||||||
|
|
||||||
uint32_t m_id = 0;
|
uint32_t m_id = 0;
|
||||||
uint32_t m_zone_id = 0;
|
uint32_t m_zone_id = 0;
|
||||||
@@ -175,6 +221,8 @@ protected:
|
|||||||
bool m_never_expires = false;
|
bool m_never_expires = false;
|
||||||
bool m_has_zonein = false;
|
bool m_has_zonein = false;
|
||||||
bool m_has_member_statuses = false;
|
bool m_has_member_statuses = false;
|
||||||
|
bool m_is_locked = false;
|
||||||
|
bool m_add_replay = true;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
std::string m_uuid;
|
std::string m_uuid;
|
||||||
DynamicZoneMember m_leader;
|
DynamicZoneMember m_leader;
|
||||||
@@ -182,12 +230,15 @@ protected:
|
|||||||
DynamicZoneLocation m_compass;
|
DynamicZoneLocation m_compass;
|
||||||
DynamicZoneLocation m_safereturn;
|
DynamicZoneLocation m_safereturn;
|
||||||
DynamicZoneLocation m_zonein;
|
DynamicZoneLocation m_zonein;
|
||||||
std::chrono::seconds m_duration;
|
std::chrono::seconds m_duration = {};
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||||
std::vector<DynamicZoneMember> m_members;
|
std::vector<DynamicZoneMember> m_members;
|
||||||
|
std::vector<DzLockout> m_lockouts;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void Unserialize(std::span<char> buf);
|
||||||
|
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
void serialize(Archive& archive)
|
void serialize(Archive& archive)
|
||||||
{
|
{
|
||||||
@@ -202,6 +253,8 @@ public:
|
|||||||
m_never_expires,
|
m_never_expires,
|
||||||
m_has_zonein,
|
m_has_zonein,
|
||||||
m_has_member_statuses,
|
m_has_member_statuses,
|
||||||
|
m_is_locked,
|
||||||
|
m_add_replay,
|
||||||
m_name,
|
m_name,
|
||||||
m_uuid,
|
m_uuid,
|
||||||
m_leader,
|
m_leader,
|
||||||
@@ -212,7 +265,8 @@ public:
|
|||||||
m_duration,
|
m_duration,
|
||||||
m_start_time,
|
m_start_time,
|
||||||
m_expire_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::MAIL_SIZE;
|
||||||
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
||||||
using RoF2::invtype::KRONO_SIZE;
|
using RoF2::invtype::KRONO_SIZE;
|
||||||
|
using RoF2::invtype::GUILD_BANK_MAIN_SIZE;
|
||||||
|
using RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE;
|
||||||
using RoF2::invtype::OTHER_SIZE;
|
using RoF2::invtype::OTHER_SIZE;
|
||||||
|
|
||||||
using RoF2::invtype::TRADE_NPC_SIZE;
|
using RoF2::invtype::TRADE_NPC_SIZE;
|
||||||
|
|||||||
@@ -473,7 +473,6 @@ N(OP_SendAATable),
|
|||||||
N(OP_SendCharInfo),
|
N(OP_SendCharInfo),
|
||||||
N(OP_SendExpZonein),
|
N(OP_SendExpZonein),
|
||||||
N(OP_SendFindableNPCs),
|
N(OP_SendFindableNPCs),
|
||||||
N(OP_SendFindableLocations),
|
|
||||||
N(OP_SendGuildTributes),
|
N(OP_SendGuildTributes),
|
||||||
N(OP_SendLoginInfo),
|
N(OP_SendLoginInfo),
|
||||||
N(OP_SendMaxCharacters),
|
N(OP_SendMaxCharacters),
|
||||||
|
|||||||
@@ -974,25 +974,6 @@ namespace ZoneBlockedSpellTypes {
|
|||||||
const uint8 Region = 2;
|
const uint8 Region = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DynamicZoneType
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Expedition,
|
|
||||||
Tutorial,
|
|
||||||
Task,
|
|
||||||
Mission, // Shared Task
|
|
||||||
Quest
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class DynamicZoneMemberStatus : uint8_t
|
|
||||||
{
|
|
||||||
Unknown = 0,
|
|
||||||
Online,
|
|
||||||
Offline,
|
|
||||||
InDynamicZone,
|
|
||||||
LinkDead
|
|
||||||
};
|
|
||||||
|
|
||||||
enum StartZoneIndex {
|
enum StartZoneIndex {
|
||||||
Odus = 0,
|
Odus = 0,
|
||||||
Qeynos,
|
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, 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, 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_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::invtype::OTHER_SIZE
|
Titanium::INULL, Titanium::INULL, Titanium::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
Titanium::invslot::EQUIPMENT_BITMASK,
|
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_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
||||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||||
SoF::invtype::OTHER_SIZE
|
SoF::INULL, SoF::INULL, SoF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
SoF::invslot::EQUIPMENT_BITMASK,
|
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_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
||||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||||
SoD::invtype::OTHER_SIZE
|
SoD::INULL, SoD::INULL, SoD::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
SoD::invslot::EQUIPMENT_BITMASK,
|
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_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
||||||
UF::INULL, UF::INULL, UF::INULL,
|
UF::INULL, UF::INULL, UF::INULL,
|
||||||
UF::invtype::OTHER_SIZE
|
UF::INULL, UF::INULL, UF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
UF::invslot::EQUIPMENT_BITMASK,
|
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_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::invtype::ALT_STORAGE_SIZE, RoF::invtype::ARCHIVED_SIZE,
|
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::invtype::ALT_STORAGE_SIZE, RoF::invtype::ARCHIVED_SIZE,
|
||||||
RoF::invtype::MAIL_SIZE, RoF::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF::INULL,
|
RoF::invtype::MAIL_SIZE, RoF::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF::INULL,
|
||||||
RoF::invtype::OTHER_SIZE
|
RoF::INULL,RoF::INULL,RoF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF::invslot::EQUIPMENT_BITMASK,
|
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_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
||||||
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
||||||
RoF2::invtype::OTHER_SIZE
|
RoF2::invtype::GUILD_BANK_MAIN_SIZE,RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE, RoF2::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF2::invslot::EQUIPMENT_BITMASK,
|
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, 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, 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, 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::INULL, EntityLimits::Bot::INULL,
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||||
EntityLimits::Bot::INULL
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -497,7 +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, 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, 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, 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, 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_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::INULL
|
Titanium::INULL, Titanium::INULL, Titanium::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
Titanium::INULL,
|
Titanium::INULL,
|
||||||
@@ -632,7 +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_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
||||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||||
SoF::INULL
|
SoF::INULL, SoF::INULL, SoF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
SoF::INULL,
|
SoF::INULL,
|
||||||
@@ -659,7 +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_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
||||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||||
SoD::INULL
|
SoD::INULL, SoD::INULL, SoD::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
SoD::INULL,
|
SoD::INULL,
|
||||||
@@ -686,7 +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_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::INULL, UF::INULL,
|
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::INULL, UF::INULL,
|
||||||
UF::INULL, UF::INULL, UF::INULL,
|
UF::INULL, UF::INULL, UF::INULL,
|
||||||
UF::INULL
|
UF::INULL, UF::INULL, UF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
UF::INULL,
|
UF::INULL,
|
||||||
@@ -713,7 +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_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
||||||
RoF::INULL, RoF::INULL, RoF::INULL,
|
RoF::INULL, RoF::INULL, RoF::INULL,
|
||||||
RoF::INULL
|
RoF::INULL, RoF::INULL, RoF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF::INULL,
|
RoF::INULL,
|
||||||
@@ -740,7 +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_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
||||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
||||||
RoF2::INULL
|
RoF2::INULL, RoF2::INULL, RoF2::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF2::INULL,
|
RoF2::INULL,
|
||||||
|
|||||||
+3
-3
@@ -87,7 +87,7 @@ namespace EQ
|
|||||||
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
||||||
int16 ViewMODLimbo, AltStorage, Archived;
|
int16 ViewMODLimbo, AltStorage, Archived;
|
||||||
int16 Mail, GuildTrophyTribute, Krono;
|
int16 Mail, GuildTrophyTribute, Krono;
|
||||||
int16 Other;
|
int16 GuildBankMain,GuildBankDeposit, Other;
|
||||||
|
|
||||||
InventoryTypeSize_Struct(
|
InventoryTypeSize_Struct(
|
||||||
int16 Possessions, int16 Bank, int16 SharedBank,
|
int16 Possessions, int16 Bank, int16 SharedBank,
|
||||||
@@ -98,7 +98,7 @@ namespace EQ
|
|||||||
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
||||||
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
||||||
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
||||||
int16 Other
|
int16 GuildBankMain,int16 GuildBankDeposit, int16 Other
|
||||||
) :
|
) :
|
||||||
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
||||||
Trade(Trade), World(World), Limbo(Limbo),
|
Trade(Trade), World(World), Limbo(Limbo),
|
||||||
@@ -108,7 +108,7 @@ namespace EQ
|
|||||||
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
||||||
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
||||||
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
||||||
Other(Other)
|
GuildBankMain(GuildBankMain), GuildBankDeposit(GuildBankDeposit), Other(Other)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+54
-45
@@ -19,17 +19,17 @@
|
|||||||
#ifndef EQ_PACKET_STRUCTS_H
|
#ifndef EQ_PACKET_STRUCTS_H
|
||||||
#define EQ_PACKET_STRUCTS_H
|
#define EQ_PACKET_STRUCTS_H
|
||||||
|
|
||||||
#include "types.h"
|
#include <list>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
|
||||||
#include <time.h>
|
#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/archives/binary.hpp"
|
||||||
#include "../cereal/include/cereal/types/string.hpp"
|
#include "../cereal/include/cereal/types/string.hpp"
|
||||||
#include "../cereal/include/cereal/types/vector.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 BUFF_COUNT = 42;
|
||||||
static const uint32 PET_BUFF_COUNT = 30;
|
static const uint32 PET_BUFF_COUNT = 30;
|
||||||
@@ -47,7 +47,7 @@ static const uint32 ADVANCED_LORE_LENGTH = 8192;
|
|||||||
*/
|
*/
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
struct LoginInfo_Struct {
|
struct LoginInfo {
|
||||||
/*000*/ char login_info[64];
|
/*000*/ char login_info[64];
|
||||||
/*064*/ uint8 unknown064[124];
|
/*064*/ uint8 unknown064[124];
|
||||||
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
||||||
@@ -5529,56 +5529,65 @@ struct GuildBankWithdrawItem_Struct
|
|||||||
|
|
||||||
struct GuildBankItemUpdate_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 inPermissions, uint32 inAllowMerge, bool inUseable)
|
uint32 inAction,
|
||||||
|
uint32 inUnknown004,
|
||||||
|
uint16 inSlotID,
|
||||||
|
uint16 inArea,
|
||||||
|
uint16 inUnknown012,
|
||||||
|
uint32 inItemID,
|
||||||
|
uint32 inIcon,
|
||||||
|
uint32 inQuantity,
|
||||||
|
uint32 inPermissions,
|
||||||
|
uint32 inAllowMerge,
|
||||||
|
bool inUseable)
|
||||||
{
|
{
|
||||||
Action = inAction;
|
action = inAction;
|
||||||
Unknown004 = inUnknown004;
|
unknown004 = inUnknown004;
|
||||||
SlotID = inSlotID;
|
slot_id = inSlotID;
|
||||||
Area = inArea;
|
area = inArea;
|
||||||
Unknown012 = inUnknown012;
|
display = inUnknown012;
|
||||||
ItemID = inItemID;
|
item_id = inItemID;
|
||||||
Icon = inIcon;
|
icon_id = inIcon;
|
||||||
Quantity = inQuantity;
|
quantity = inQuantity;
|
||||||
Permissions = inPermissions;
|
permissions = inPermissions;
|
||||||
AllowMerge = inAllowMerge;
|
allow_merge = inAllowMerge;
|
||||||
Useable = inUseable;
|
is_useable = inUseable;
|
||||||
ItemName[0] = '\0';
|
item_name[0] = '\0';
|
||||||
Donator[0] = '\0';
|
donator[0] = '\0';
|
||||||
WhoFor[0] = '\0';
|
who_for[0] = '\0';
|
||||||
};
|
};
|
||||||
|
|
||||||
/*000*/ uint32 Action;
|
/*000*/ uint32 action;
|
||||||
/*004*/ uint32 Unknown004;
|
/*004*/ uint32 unknown004;
|
||||||
/*008*/ uint16 SlotID;
|
/*008*/ uint16 slot_id;
|
||||||
/*010*/ uint16 Area;
|
/*010*/ uint16 area;
|
||||||
/*012*/ uint32 Unknown012;
|
/*012*/ uint32 display;
|
||||||
/*016*/ uint32 ItemID;
|
/*016*/ uint32 item_id;
|
||||||
/*020*/ uint32 Icon;
|
/*020*/ uint32 icon_id;
|
||||||
/*024*/ uint32 Quantity;
|
/*024*/ uint32 quantity;
|
||||||
/*028*/ uint32 Permissions;
|
/*028*/ uint32 permissions;
|
||||||
/*032*/ uint8 AllowMerge;
|
/*032*/ uint8 allow_merge;
|
||||||
/*033*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
/*033*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||||
/*034*/ char ItemName[64];
|
/*034*/ char item_name[64];
|
||||||
/*098*/ char Donator[64];
|
/*098*/ char donator[64];
|
||||||
/*162*/ char WhoFor[64];
|
/*162*/ char who_for[64];
|
||||||
/*226*/ uint16 Unknown226;
|
/*226*/ uint16 unknown226;
|
||||||
};
|
};
|
||||||
|
|
||||||
// newer clients (RoF+) send a list that contains 240 entries
|
// newer clients (RoF+) send a list that contains 240 entries
|
||||||
// The packets don't actually use all 64 chars in the strings, but we'll just overallocate for these
|
// The packets don't actually use all 64 chars in the strings, but we'll just overallocate for these
|
||||||
struct GuildBankItemListEntry_Struct
|
struct GuildBankItemListEntry_Struct {
|
||||||
{
|
uint8 vaild;
|
||||||
uint8 vaild;
|
|
||||||
uint32 permissions;
|
uint32 permissions;
|
||||||
char whofor[64];
|
char whofor[64];
|
||||||
char donator[64];
|
char donator[64];
|
||||||
uint32 item_id;
|
uint32 item_id;
|
||||||
uint32 item_icon;
|
uint32 item_icon;
|
||||||
uint32 quantity;
|
uint32 quantity;
|
||||||
uint8 allow_merge; // 1 here for non-full stacks
|
uint8 allow_merge; // 1 here for non-full stacks
|
||||||
uint8 usable;
|
uint8 usable;
|
||||||
char item_name[64];
|
char item_name[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuildBankClear_Struct
|
struct GuildBankClear_Struct
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ namespace Logs {
|
|||||||
BotSpellChecks,
|
BotSpellChecks,
|
||||||
BotSpellTypeChecks,
|
BotSpellTypeChecks,
|
||||||
NpcHandin,
|
NpcHandin,
|
||||||
|
ZoneState,
|
||||||
MaxCategoryID /* Don't Remove this */
|
MaxCategoryID /* Don't Remove this */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -256,7 +257,8 @@ namespace Logs {
|
|||||||
"Bot Settings",
|
"Bot Settings",
|
||||||
"Bot Spell Checks",
|
"Bot Spell Checks",
|
||||||
"Bot Spell Type Checks",
|
"Bot Spell Type Checks",
|
||||||
"NpcHandin"
|
"NpcHandin",
|
||||||
|
"ZoneState"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -914,6 +914,16 @@
|
|||||||
OutF(LogSys, Logs::Detail, Logs::NpcHandin, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
OutF(LogSys, Logs::Detail, Logs::NpcHandin, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define LogZoneState(message, ...) do {\
|
||||||
|
if (LogSys.IsLogEnabled(Logs::General, Logs::ZoneState))\
|
||||||
|
OutF(LogSys, Logs::General, Logs::ZoneState, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define LogZoneStateDetail(message, ...) do {\
|
||||||
|
if (LogSys.IsLogEnabled(Logs::Detail, Logs::ZoneState))\
|
||||||
|
OutF(LogSys, Logs::Detail, Logs::ZoneState, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define Log(debug_level, log_category, message, ...) do {\
|
#define Log(debug_level, log_category, message, ...) do {\
|
||||||
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
||||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||||
|
|||||||
@@ -82,13 +82,12 @@ void PlayerEventLogs::Init()
|
|||||||
PlayerEventLogSettingsRepository::ReplaceMany(*m_database, settings_to_insert);
|
PlayerEventLogSettingsRepository::ReplaceMany(*m_database, settings_to_insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadEtlIds();
|
|
||||||
|
|
||||||
bool processing_in_world = !RuleB(Logging, PlayerEventsQSProcess) && IsWorld();
|
bool processing_in_world = !RuleB(Logging, PlayerEventsQSProcess) && IsWorld();
|
||||||
bool processing_in_qs = RuleB(Logging, PlayerEventsQSProcess) && IsQueryServ();
|
bool processing_in_qs = RuleB(Logging, PlayerEventsQSProcess) && IsQueryServ();
|
||||||
|
|
||||||
// on initial boot process truncation
|
// on initial boot process truncation
|
||||||
if (processing_in_world || processing_in_qs) {
|
if (processing_in_world || processing_in_qs) {
|
||||||
|
LoadEtlIds();
|
||||||
ProcessRetentionTruncation();
|
ProcessRetentionTruncation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,7 +401,7 @@ void PlayerEventLogs::ProcessBatchQueue()
|
|||||||
r.event_data = "{}"; // Clear event data
|
r.event_data = "{}"; // Clear event data
|
||||||
}
|
}
|
||||||
else {
|
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,
|
BARTER_TRANSACTION,
|
||||||
SPEECH,
|
SPEECH,
|
||||||
EVOLVE_ITEM,
|
EVOLVE_ITEM,
|
||||||
|
GUILD_BANK_DEPOSIT,
|
||||||
|
GUILD_BANK_WITHDRAWAL,
|
||||||
|
GUILD_BANK_MOVE_TO_BANK_AREA,
|
||||||
MAX // dont remove
|
MAX // dont remove
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,7 +132,10 @@ namespace PlayerEvent {
|
|||||||
"Parcel Prune Routine",
|
"Parcel Prune Routine",
|
||||||
"Barter Transaction",
|
"Barter Transaction",
|
||||||
"Player Speech",
|
"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
|
// Generic struct used by all events
|
||||||
@@ -875,8 +881,9 @@ namespace PlayerEvent {
|
|||||||
uint32 trader_id;
|
uint32 trader_id;
|
||||||
std::string trader_name;
|
std::string trader_name;
|
||||||
uint32 price;
|
uint32 price;
|
||||||
uint32 charges;
|
uint32 quantity;
|
||||||
uint32 total_cost;
|
int32 charges;
|
||||||
|
uint64 total_cost;
|
||||||
uint64 player_money_balance;
|
uint64 player_money_balance;
|
||||||
|
|
||||||
|
|
||||||
@@ -896,6 +903,7 @@ namespace PlayerEvent {
|
|||||||
CEREAL_NVP(trader_id),
|
CEREAL_NVP(trader_id),
|
||||||
CEREAL_NVP(trader_name),
|
CEREAL_NVP(trader_name),
|
||||||
CEREAL_NVP(price),
|
CEREAL_NVP(price),
|
||||||
|
CEREAL_NVP(quantity),
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(total_cost),
|
CEREAL_NVP(total_cost),
|
||||||
CEREAL_NVP(player_money_balance)
|
CEREAL_NVP(player_money_balance)
|
||||||
@@ -915,8 +923,9 @@ namespace PlayerEvent {
|
|||||||
uint32 buyer_id;
|
uint32 buyer_id;
|
||||||
std::string buyer_name;
|
std::string buyer_name;
|
||||||
uint32 price;
|
uint32 price;
|
||||||
uint32 charges;
|
uint32 quantity;
|
||||||
uint32 total_cost;
|
int32 charges;
|
||||||
|
uint64 total_cost;
|
||||||
uint64 player_money_balance;
|
uint64 player_money_balance;
|
||||||
|
|
||||||
|
|
||||||
@@ -936,6 +945,7 @@ namespace PlayerEvent {
|
|||||||
CEREAL_NVP(buyer_id),
|
CEREAL_NVP(buyer_id),
|
||||||
CEREAL_NVP(buyer_name),
|
CEREAL_NVP(buyer_name),
|
||||||
CEREAL_NVP(price),
|
CEREAL_NVP(price),
|
||||||
|
CEREAL_NVP(quantity),
|
||||||
CEREAL_NVP(charges),
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(total_cost),
|
CEREAL_NVP(total_cost),
|
||||||
CEREAL_NVP(player_money_balance)
|
CEREAL_NVP(player_money_balance)
|
||||||
@@ -1145,6 +1155,7 @@ namespace PlayerEvent {
|
|||||||
uint32 augment_5_id;
|
uint32 augment_5_id;
|
||||||
uint32 augment_6_id;
|
uint32 augment_6_id;
|
||||||
uint32 quantity;
|
uint32 quantity;
|
||||||
|
int32 charges;
|
||||||
std::string from_player_name;
|
std::string from_player_name;
|
||||||
std::string to_player_name;
|
std::string to_player_name;
|
||||||
uint32 sent_date;
|
uint32 sent_date;
|
||||||
@@ -1162,6 +1173,7 @@ namespace PlayerEvent {
|
|||||||
CEREAL_NVP(augment_5_id),
|
CEREAL_NVP(augment_5_id),
|
||||||
CEREAL_NVP(augment_6_id),
|
CEREAL_NVP(augment_6_id),
|
||||||
CEREAL_NVP(quantity),
|
CEREAL_NVP(quantity),
|
||||||
|
CEREAL_NVP(charges),
|
||||||
CEREAL_NVP(from_player_name),
|
CEREAL_NVP(from_player_name),
|
||||||
CEREAL_NVP(to_player_name),
|
CEREAL_NVP(to_player_name),
|
||||||
CEREAL_NVP(sent_date)
|
CEREAL_NVP(sent_date)
|
||||||
@@ -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
|
#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 <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
@@ -90,23 +91,21 @@ std::string File::GetCwd()
|
|||||||
|
|
||||||
FileContentsResult File::GetContents(const std::string &file_name)
|
FileContentsResult File::GetContents(const std::string &file_name)
|
||||||
{
|
{
|
||||||
std::string error;
|
std::ifstream f(file_name, std::ios::in | std::ios::binary);
|
||||||
std::ifstream f;
|
if (!f) {
|
||||||
f.open(file_name);
|
return { .error = fmt::format("Couldn't open file [{}]", file_name) };
|
||||||
std::string line;
|
|
||||||
std::string lines;
|
|
||||||
if (f.is_open()) {
|
|
||||||
while (f) {
|
|
||||||
std::getline(f, line);
|
|
||||||
lines += line + "\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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{
|
return FileContentsResult{
|
||||||
.contents = lines,
|
.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)
|
bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, bool db_delete)
|
||||||
{
|
{
|
||||||
|
auto const where_filter = fmt::format("guild_id = {}", guild_id);
|
||||||
|
auto const bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||||
|
|
||||||
if (local_delete) {
|
if (local_delete) {
|
||||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
|
||||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
|
||||||
if (!bank_items.empty()) {
|
if (!bank_items.empty()) {
|
||||||
LogError(
|
LogError(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
LogGuilds(
|
LogGuilds(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
std::map<uint32, GuildInfo *>::iterator res;
|
auto res = m_guilds.find(guild_id);
|
||||||
res = m_guilds.find(guild_id);
|
if (res != m_guilds.end()) {
|
||||||
if (res != m_guilds.end()) {
|
safe_delete(res->second);
|
||||||
delete res->second;
|
m_guilds.erase(res);
|
||||||
m_guilds.erase(res);
|
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
||||||
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
// Does this need to be sent to world?
|
||||||
//Does this need to be sent to world?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db_delete) {
|
if (db_delete) {
|
||||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
|
||||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
|
||||||
if (!bank_items.empty()) {
|
if (!bank_items.empty()) {
|
||||||
LogError(
|
LogError(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
LogGuilds(
|
LogGuilds(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
auto where_filter = fmt::format("guild_id = {}", guild_id);
|
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
||||||
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
GuildsRepository::DeleteOne(*m_db, guild_id);
|
||||||
GuildsRepository::DeleteOne(*m_db, guild_id);
|
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
||||||
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
GuildPermissionsRepository::DeleteWhere(*m_db, where_filter);
|
||||||
GuildPermissionsRepository::DeleteWhere(*m_db, where_filter);
|
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
||||||
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
||||||
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2028,3 +2028,57 @@ int16 EQ::InventoryProfile::_HasEvolvingItem(ItemInstQueue &iqueue, uint64 evolv
|
|||||||
|
|
||||||
return INVALID_INDEX;
|
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 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
|
||||||
int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = invslot::GENERAL_BEGIN, uint8 bag_start = invbag::SLOT_BEGIN);
|
int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = invslot::GENERAL_BEGIN, uint8 bag_start = invbag::SLOT_BEGIN);
|
||||||
int16 FindFirstFreeSlotThatFitsItem(const EQ::ItemData *inst);
|
int16 FindFirstFreeSlotThatFitsItem(const EQ::ItemData *inst);
|
||||||
|
int16 FindFirstFreeSlotThatFitsItemWithStacking(ItemInstance *inst) const;
|
||||||
|
|
||||||
// Calculate slot_id for an item within a bag
|
// Calculate slot_id for an item within a bag
|
||||||
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ struct LootItem {
|
|||||||
uint16 trivial_max_level;
|
uint16 trivial_max_level;
|
||||||
uint16 npc_min_level;
|
uint16 npc_min_level;
|
||||||
uint16 npc_max_level;
|
uint16 npc_max_level;
|
||||||
|
uint32 lootdrop_id; // required for zone state referencing
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<LootItem*> LootItems;
|
typedef std::list<LootItem*> LootItems;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (opcode == ServerOP_UsertoWorldReq) {
|
if (opcode == ServerOP_UsertoWorldReq) {
|
||||||
auto req_in = (UsertoWorldRequest_Struct*)p.Data();
|
auto req_in = (UsertoWorldRequest*)p.Data();
|
||||||
|
|
||||||
EQ::Net::DynamicPacket req;
|
EQ::Net::DynamicPacket req;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@@ -45,7 +45,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opcode == ServerOP_LSClientAuth) {
|
if (opcode == ServerOP_LSClientAuth) {
|
||||||
auto req_in = (ClientAuth_Struct*)p.Data();
|
auto req_in = (ClientAuth*)p.Data();
|
||||||
|
|
||||||
EQ::Net::DynamicPacket req;
|
EQ::Net::DynamicPacket req;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@@ -54,7 +54,7 @@ void EQ::Net::ServertalkServerConnection::Send(uint16_t opcode, EQ::Net::Packet
|
|||||||
req.PutData(i, req_in->key, 30); i += 30;
|
req.PutData(i, req_in->key, 30); i += 30;
|
||||||
req.PutUInt8(i, req_in->lsadmin); i += 1;
|
req.PutUInt8(i, req_in->lsadmin); i += 1;
|
||||||
req.PutUInt16(i, req_in->is_world_admin); i += 2;
|
req.PutUInt16(i, req_in->is_world_admin); i += 2;
|
||||||
req.PutUInt32(i, req_in->ip); i += 4;
|
req.PutUInt32(i, req_in->ip_address); i += 4;
|
||||||
req.PutUInt8(i, req_in->is_client_from_local_network); i += 1;
|
req.PutUInt8(i, req_in->is_client_from_local_network); i += 1;
|
||||||
|
|
||||||
EQ::Net::DynamicPacket out;
|
EQ::Net::DynamicPacket out;
|
||||||
|
|||||||
+16
-16
@@ -1213,22 +1213,22 @@ namespace RoF
|
|||||||
case 1: { // GuildBankItemUpdate
|
case 1: { // GuildBankItemUpdate
|
||||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||||
eq->Action = 0;
|
eq->action = 0;
|
||||||
OUT(Unknown004);
|
OUT(unknown004);
|
||||||
eq->Unknown08 = 0;
|
eq->unknown008 = 0;
|
||||||
OUT(SlotID);
|
OUT(slot_id);
|
||||||
OUT(Area);
|
OUT(area);
|
||||||
OUT(Unknown012);
|
OUT(display);
|
||||||
OUT(ItemID);
|
OUT(item_id);
|
||||||
OUT(Icon);
|
OUT(icon_id);
|
||||||
OUT(Quantity);
|
OUT(quantity);
|
||||||
OUT(Permissions);
|
OUT(permissions);
|
||||||
OUT(AllowMerge);
|
OUT(allow_merge);
|
||||||
OUT(Useable);
|
OUT(is_useable);
|
||||||
OUT_str(ItemName);
|
OUT_str(item_name);
|
||||||
OUT_str(Donator);
|
OUT_str(donator);
|
||||||
OUT_str(WhoFor);
|
OUT_str(who_for);
|
||||||
OUT(Unknown226);
|
OUT(unknown226);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
+13
-16
@@ -1743,22 +1743,19 @@ namespace RoF2
|
|||||||
case 1: { // GuildBankItemUpdate
|
case 1: { // GuildBankItemUpdate
|
||||||
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
auto emu = (GuildBankItemUpdate_Struct *)in->pBuffer;
|
||||||
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
auto eq = (structs::GuildBankItemUpdate_Struct *)outapp->pBuffer;
|
||||||
eq->Action = 0;
|
eq->action = 0;
|
||||||
OUT(Unknown004);
|
OUT(display);
|
||||||
eq->Unknown08 = 0;
|
OUT(slot_id);
|
||||||
OUT(SlotID);
|
OUT(area);
|
||||||
OUT(Area);
|
OUT(item_id);
|
||||||
OUT(Unknown012);
|
OUT(icon_id);
|
||||||
OUT(ItemID);
|
OUT(quantity);
|
||||||
OUT(Icon);
|
OUT(permissions);
|
||||||
OUT(Quantity);
|
OUT(allow_merge);
|
||||||
OUT(Permissions);
|
OUT(is_useable);
|
||||||
OUT(AllowMerge);
|
OUT_str(item_name);
|
||||||
OUT(Useable);
|
OUT_str(donator);
|
||||||
OUT_str(ItemName);
|
OUT_str(who_for);
|
||||||
OUT_str(Donator);
|
|
||||||
OUT_str(WhoFor);
|
|
||||||
OUT(Unknown226);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ namespace RoF2
|
|||||||
const int16 MAIL_SIZE = 0;//unknown
|
const int16 MAIL_SIZE = 0;//unknown
|
||||||
const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown
|
const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown
|
||||||
const int16 KRONO_SIZE = 0;//unknown
|
const int16 KRONO_SIZE = 0;//unknown
|
||||||
|
const int16 GUILD_BANK_MAIN_SIZE = 200;
|
||||||
|
const int16 GUILD_BANK_DEPOSIT_SIZE = 40;
|
||||||
const int16 OTHER_SIZE = 0;//unknown
|
const int16 OTHER_SIZE = 0;//unknown
|
||||||
|
|
||||||
const int16 TRADE_NPC_SIZE = 4; // defined by implication
|
const int16 TRADE_NPC_SIZE = 4; // defined by implication
|
||||||
|
|||||||
@@ -1965,41 +1965,39 @@ struct GuildBankWithdrawItem_Struct
|
|||||||
|
|
||||||
struct GuildBankItemUpdate_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)
|
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||||
{
|
{
|
||||||
Action = inAction;
|
action = inAction;
|
||||||
Unknown004 = inUnknown004;
|
slot_id = inSlotID;
|
||||||
SlotID = inSlotID;
|
area = inArea;
|
||||||
Area = inArea;
|
display = inUnknown016;
|
||||||
Unknown012 = inUnknown012;
|
item_id = inItemID;
|
||||||
ItemID = inItemID;
|
icon_id = inIcon;
|
||||||
Icon = inIcon;
|
quantity = inQuantity;
|
||||||
Quantity = inQuantity;
|
permissions = inPermissions;
|
||||||
Permissions = inPermissions;
|
allow_merge = inAllowMerge;
|
||||||
AllowMerge = inAllowMerge;
|
is_useable = inUseable;
|
||||||
Useable = inUseable;
|
item_name[0] = '\0';
|
||||||
ItemName[0] = '\0';
|
donator[0] = '\0';
|
||||||
Donator[0] = '\0';
|
who_for[0] = '\0';
|
||||||
WhoFor[0] = '\0';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*000*/ uint32 Action;
|
/*000*/ uint32 action;
|
||||||
/*004*/ uint32 Unknown004;
|
/*004*/ uint32 not_used004; //disassemble of client did not use this
|
||||||
/*008*/ uint32 Unknown08;
|
/*008*/ uint32 not_used008; //disassemble of client did not use this
|
||||||
/*012*/ uint16 SlotID;
|
/*012*/ uint16 slot_id;
|
||||||
/*014*/ uint16 Area;
|
/*014*/ uint16 area;
|
||||||
/*016*/ uint32 Unknown012;
|
/*016*/ uint32 display;
|
||||||
/*020*/ uint32 ItemID;
|
/*020*/ uint32 item_id;
|
||||||
/*024*/ uint32 Icon;
|
/*024*/ uint32 icon_id;
|
||||||
/*028*/ uint32 Quantity;
|
/*028*/ uint32 quantity;
|
||||||
/*032*/ uint32 Permissions;
|
/*032*/ uint32 permissions;
|
||||||
/*036*/ uint8 AllowMerge;
|
/*036*/ uint8 allow_merge;
|
||||||
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||||
/*038*/ char ItemName[64];
|
/*038*/ char item_name[64];
|
||||||
/*102*/ char Donator[64];
|
/*102*/ char donator[64];
|
||||||
/*166*/ char WhoFor[64];
|
/*166*/ char who_for[64];
|
||||||
/*230*/ uint16 Unknown226;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuildBankClear_Struct
|
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,
|
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
||||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
||||||
{
|
{
|
||||||
Action = inAction;
|
action = inAction;
|
||||||
Unknown004 = inUnknown004;
|
unknown004 = inUnknown004;
|
||||||
SlotID = inSlotID;
|
slot_id = inSlotID;
|
||||||
Area = inArea;
|
area = inArea;
|
||||||
Unknown012 = inUnknown012;
|
display = inUnknown012;
|
||||||
ItemID = inItemID;
|
item_id = inItemID;
|
||||||
Icon = inIcon;
|
icon_id = inIcon;
|
||||||
Quantity = inQuantity;
|
quantity = inQuantity;
|
||||||
Permissions = inPermissions;
|
permissions = inPermissions;
|
||||||
AllowMerge = inAllowMerge;
|
allow_merge = inAllowMerge;
|
||||||
Useable = inUseable;
|
is_useable = inUseable;
|
||||||
ItemName[0] = '\0';
|
item_name[0] = '\0';
|
||||||
Donator[0] = '\0';
|
donator[0] = '\0';
|
||||||
WhoFor[0] = '\0';
|
who_for[0] = '\0';
|
||||||
};
|
};
|
||||||
|
|
||||||
/*000*/ uint32 Action;
|
/*000*/ uint32 action;
|
||||||
/*004*/ uint32 Unknown004;
|
/*004*/ uint32 unknown004;
|
||||||
/*008*/ uint32 Unknown08;
|
/*008*/ uint32 unknown008;
|
||||||
/*012*/ uint16 SlotID;
|
/*012*/ uint16 slot_id;
|
||||||
/*014*/ uint16 Area;
|
/*014*/ uint16 area;
|
||||||
/*016*/ uint32 Unknown012;
|
/*016*/ uint32 display;
|
||||||
/*020*/ uint32 ItemID;
|
/*020*/ uint32 item_id;
|
||||||
/*024*/ uint32 Icon;
|
/*024*/ uint32 icon_id;
|
||||||
/*028*/ uint32 Quantity;
|
/*028*/ uint32 quantity;
|
||||||
/*032*/ uint32 Permissions;
|
/*032*/ uint32 permissions;
|
||||||
/*036*/ uint8 AllowMerge;
|
/*036*/ uint8 allow_merge;
|
||||||
/*037*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
/*037*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||||
/*038*/ char ItemName[64];
|
/*038*/ char item_name[64];
|
||||||
/*102*/ char Donator[64];
|
/*102*/ char donator[64];
|
||||||
/*166*/ char WhoFor[64];
|
/*166*/ char who_for[64];
|
||||||
/*230*/ uint16 Unknown226;
|
/*230*/ uint16 unknown226;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuildBankClear_Struct
|
struct GuildBankClear_Struct
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void PathManager::LoadPaths()
|
|||||||
constexpr int path_width = 0;
|
constexpr int path_width = 0;
|
||||||
constexpr int break_length = 70;
|
constexpr int break_length = 70;
|
||||||
|
|
||||||
std::cout << std::endl;
|
LogInfo("Loading server paths");
|
||||||
LogInfo("{}", Strings::Repeat("-", break_length));
|
LogInfo("{}", Strings::Repeat("-", break_length));
|
||||||
for (const auto& [name, in_path] : paths) {
|
for (const auto& [name, in_path] : paths) {
|
||||||
if (!in_path.empty()) {
|
if (!in_path.empty()) {
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ public:
|
|||||||
std::string key_;
|
std::string key_;
|
||||||
std::string value;
|
std::string value;
|
||||||
uint32_t expires;
|
uint32_t expires;
|
||||||
int64_t account_id;
|
uint64_t account_id;
|
||||||
int64_t character_id;
|
uint64_t character_id;
|
||||||
int64_t npc_id;
|
uint32_t npc_id;
|
||||||
int64_t bot_id;
|
uint32_t bot_id;
|
||||||
|
uint16_t zone_id;
|
||||||
|
uint16_t instance_id;
|
||||||
|
|
||||||
// cereal
|
// cereal
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
@@ -40,7 +42,9 @@ public:
|
|||||||
CEREAL_NVP(account_id),
|
CEREAL_NVP(account_id),
|
||||||
CEREAL_NVP(character_id),
|
CEREAL_NVP(character_id),
|
||||||
CEREAL_NVP(npc_id),
|
CEREAL_NVP(npc_id),
|
||||||
CEREAL_NVP(bot_id)
|
CEREAL_NVP(bot_id),
|
||||||
|
CEREAL_NVP(zone_id),
|
||||||
|
CEREAL_NVP(instance_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -61,6 +65,8 @@ public:
|
|||||||
"character_id",
|
"character_id",
|
||||||
"npc_id",
|
"npc_id",
|
||||||
"bot_id",
|
"bot_id",
|
||||||
|
"zone_id",
|
||||||
|
"instance_id",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +81,8 @@ public:
|
|||||||
"character_id",
|
"character_id",
|
||||||
"npc_id",
|
"npc_id",
|
||||||
"bot_id",
|
"bot_id",
|
||||||
|
"zone_id",
|
||||||
|
"instance_id",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,6 +131,8 @@ public:
|
|||||||
e.character_id = 0;
|
e.character_id = 0;
|
||||||
e.npc_id = 0;
|
e.npc_id = 0;
|
||||||
e.bot_id = 0;
|
e.bot_id = 0;
|
||||||
|
e.zone_id = 0;
|
||||||
|
e.instance_id = 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -163,10 +173,12 @@ public:
|
|||||||
e.key_ = row[1] ? row[1] : "";
|
e.key_ = row[1] ? row[1] : "";
|
||||||
e.value = row[2] ? row[2] : "";
|
e.value = row[2] ? row[2] : "";
|
||||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
e.account_id = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
e.bot_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
|
e.zone_id = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
|
e.instance_id = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -207,6 +219,8 @@ public:
|
|||||||
v.push_back(columns[5] + " = " + std::to_string(e.character_id));
|
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[6] + " = " + std::to_string(e.npc_id));
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.bot_id));
|
v.push_back(columns[7] + " = " + std::to_string(e.bot_id));
|
||||||
|
v.push_back(columns[8] + " = " + std::to_string(e.zone_id));
|
||||||
|
v.push_back(columns[9] + " = " + std::to_string(e.instance_id));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -236,6 +250,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.instance_id));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -273,6 +289,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.instance_id));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -310,10 +328,12 @@ public:
|
|||||||
e.key_ = row[1] ? row[1] : "";
|
e.key_ = row[1] ? row[1] : "";
|
||||||
e.value = row[2] ? row[2] : "";
|
e.value = row[2] ? row[2] : "";
|
||||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
e.account_id = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
e.bot_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
|
e.zone_id = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
|
e.instance_id = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -342,10 +362,12 @@ public:
|
|||||||
e.key_ = row[1] ? row[1] : "";
|
e.key_ = row[1] ? row[1] : "";
|
||||||
e.value = row[2] ? row[2] : "";
|
e.value = row[2] ? row[2] : "";
|
||||||
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
e.expires = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.account_id = row[4] ? strtoll(row[4], nullptr, 10) : 0;
|
e.account_id = row[4] ? strtoull(row[4], nullptr, 10) : 0;
|
||||||
e.character_id = row[5] ? strtoll(row[5], nullptr, 10) : 0;
|
e.character_id = row[5] ? strtoull(row[5], nullptr, 10) : 0;
|
||||||
e.npc_id = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
e.npc_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.bot_id = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
e.bot_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
|
e.zone_id = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||||
|
e.instance_id = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -428,6 +450,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.instance_id));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -458,6 +482,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.character_id));
|
v.push_back(std::to_string(e.character_id));
|
||||||
v.push_back(std::to_string(e.npc_id));
|
v.push_back(std::to_string(e.npc_id));
|
||||||
v.push_back(std::to_string(e.bot_id));
|
v.push_back(std::to_string(e.bot_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.instance_id));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
+44
-44
@@ -9,18 +9,18 @@
|
|||||||
* @docs https://docs.eqemu.io/developer/repositories
|
* @docs https://docs.eqemu.io/developer/repositories
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
#ifndef EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||||
#define EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
#define EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||||
|
|
||||||
#include "../../database.h"
|
#include "../../database.h"
|
||||||
#include "../../strings.h"
|
#include "../../strings.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
class BaseExpeditionLockoutsRepository {
|
class BaseDynamicZoneLockoutsRepository {
|
||||||
public:
|
public:
|
||||||
struct ExpeditionLockouts {
|
struct DynamicZoneLockouts {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t expedition_id;
|
uint32_t dynamic_zone_id;
|
||||||
std::string event_name;
|
std::string event_name;
|
||||||
time_t expire_time;
|
time_t expire_time;
|
||||||
uint32_t duration;
|
uint32_t duration;
|
||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"expedition_id",
|
"dynamic_zone_id",
|
||||||
"event_name",
|
"event_name",
|
||||||
"expire_time",
|
"expire_time",
|
||||||
"duration",
|
"duration",
|
||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"expedition_id",
|
"dynamic_zone_id",
|
||||||
"event_name",
|
"event_name",
|
||||||
"UNIX_TIMESTAMP(expire_time)",
|
"UNIX_TIMESTAMP(expire_time)",
|
||||||
"duration",
|
"duration",
|
||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
static std::string TableName()
|
static std::string TableName()
|
||||||
{
|
{
|
||||||
return std::string("expedition_lockouts");
|
return std::string("dynamic_zone_lockouts");
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string BaseSelect()
|
static std::string BaseSelect()
|
||||||
@@ -89,12 +89,12 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ExpeditionLockouts NewEntity()
|
static DynamicZoneLockouts NewEntity()
|
||||||
{
|
{
|
||||||
ExpeditionLockouts e{};
|
DynamicZoneLockouts e{};
|
||||||
|
|
||||||
e.id = 0;
|
e.id = 0;
|
||||||
e.expedition_id = 0;
|
e.dynamic_zone_id = 0;
|
||||||
e.event_name = "";
|
e.event_name = "";
|
||||||
e.expire_time = std::time(nullptr);
|
e.expire_time = std::time(nullptr);
|
||||||
e.duration = 0;
|
e.duration = 0;
|
||||||
@@ -103,23 +103,23 @@ public:
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ExpeditionLockouts GetExpeditionLockouts(
|
static DynamicZoneLockouts GetDynamicZoneLockouts(
|
||||||
const std::vector<ExpeditionLockouts> &expedition_lockoutss,
|
const std::vector<DynamicZoneLockouts> &dynamic_zone_lockoutss,
|
||||||
int expedition_lockouts_id
|
int dynamic_zone_lockouts_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
for (auto &expedition_lockouts : expedition_lockoutss) {
|
for (auto &dynamic_zone_lockouts : dynamic_zone_lockoutss) {
|
||||||
if (expedition_lockouts.id == expedition_lockouts_id) {
|
if (dynamic_zone_lockouts.id == dynamic_zone_lockouts_id) {
|
||||||
return expedition_lockouts;
|
return dynamic_zone_lockouts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewEntity();
|
return NewEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ExpeditionLockouts FindOne(
|
static DynamicZoneLockouts FindOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
int expedition_lockouts_id
|
int dynamic_zone_lockouts_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -127,16 +127,16 @@ public:
|
|||||||
"{} WHERE {} = {} LIMIT 1",
|
"{} WHERE {} = {} LIMIT 1",
|
||||||
BaseSelect(),
|
BaseSelect(),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
expedition_lockouts_id
|
dynamic_zone_lockouts_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
ExpeditionLockouts e{};
|
DynamicZoneLockouts e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.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.event_name = row[2] ? row[2] : "";
|
||||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||||
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
@@ -150,7 +150,7 @@ public:
|
|||||||
|
|
||||||
static int DeleteOne(
|
static int DeleteOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
int expedition_lockouts_id
|
int dynamic_zone_lockouts_id
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
"DELETE FROM {} WHERE {} = {}",
|
"DELETE FROM {} WHERE {} = {}",
|
||||||
TableName(),
|
TableName(),
|
||||||
PrimaryKey(),
|
PrimaryKey(),
|
||||||
expedition_lockouts_id
|
dynamic_zone_lockouts_id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -167,14 +167,14 @@ public:
|
|||||||
|
|
||||||
static int UpdateOne(
|
static int UpdateOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
const ExpeditionLockouts &e
|
const DynamicZoneLockouts &e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
auto columns = Columns();
|
auto columns = Columns();
|
||||||
|
|
||||||
v.push_back(columns[1] + " = " + std::to_string(e.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[2] + " = '" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.duration));
|
v.push_back(columns[4] + " = " + std::to_string(e.duration));
|
||||||
@@ -193,15 +193,15 @@ public:
|
|||||||
return (results.Success() ? results.RowsAffected() : 0);
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ExpeditionLockouts InsertOne(
|
static DynamicZoneLockouts InsertOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
ExpeditionLockouts e
|
DynamicZoneLockouts e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.expedition_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -227,7 +227,7 @@ public:
|
|||||||
|
|
||||||
static int InsertMany(
|
static int InsertMany(
|
||||||
Database& db,
|
Database& db,
|
||||||
const std::vector<ExpeditionLockouts> &entries
|
const std::vector<DynamicZoneLockouts> &entries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_chunks;
|
std::vector<std::string> insert_chunks;
|
||||||
@@ -236,7 +236,7 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.expedition_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -258,9 +258,9 @@ public:
|
|||||||
return (results.Success() ? results.RowsAffected() : 0);
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<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(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -272,10 +272,10 @@ public:
|
|||||||
all_entries.reserve(results.RowCount());
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
ExpeditionLockouts e{};
|
DynamicZoneLockouts e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.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.event_name = row[2] ? row[2] : "";
|
||||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||||
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
@@ -287,9 +287,9 @@ public:
|
|||||||
return all_entries;
|
return all_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<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(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -302,10 +302,10 @@ public:
|
|||||||
all_entries.reserve(results.RowCount());
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
ExpeditionLockouts e{};
|
DynamicZoneLockouts e{};
|
||||||
|
|
||||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.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.event_name = row[2] ? row[2] : "";
|
||||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||||
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
e.duration = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
@@ -379,13 +379,13 @@ public:
|
|||||||
|
|
||||||
static int ReplaceOne(
|
static int ReplaceOne(
|
||||||
Database& db,
|
Database& db,
|
||||||
const ExpeditionLockouts &e
|
const DynamicZoneLockouts &e
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.expedition_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -404,7 +404,7 @@ public:
|
|||||||
|
|
||||||
static int ReplaceMany(
|
static int ReplaceMany(
|
||||||
Database& db,
|
Database& db,
|
||||||
const std::vector<ExpeditionLockouts> &entries
|
const std::vector<DynamicZoneLockouts> &entries
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_chunks;
|
std::vector<std::string> insert_chunks;
|
||||||
@@ -413,7 +413,7 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.expedition_id));
|
v.push_back(std::to_string(e.dynamic_zone_id));
|
||||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||||
v.push_back(std::to_string(e.duration));
|
v.push_back(std::to_string(e.duration));
|
||||||
@@ -436,4 +436,4 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
#endif //EQEMU_BASE_DYNAMIC_ZONE_LOCKOUTS_REPOSITORY_H
|
||||||
@@ -42,6 +42,8 @@ public:
|
|||||||
float zone_in_z;
|
float zone_in_z;
|
||||||
float zone_in_heading;
|
float zone_in_heading;
|
||||||
uint8_t has_zone_in;
|
uint8_t has_zone_in;
|
||||||
|
int8_t is_locked;
|
||||||
|
int8_t add_replay;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -75,6 +77,8 @@ public:
|
|||||||
"zone_in_z",
|
"zone_in_z",
|
||||||
"zone_in_heading",
|
"zone_in_heading",
|
||||||
"has_zone_in",
|
"has_zone_in",
|
||||||
|
"is_locked",
|
||||||
|
"add_replay",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +108,8 @@ public:
|
|||||||
"zone_in_z",
|
"zone_in_z",
|
||||||
"zone_in_heading",
|
"zone_in_heading",
|
||||||
"has_zone_in",
|
"has_zone_in",
|
||||||
|
"is_locked",
|
||||||
|
"add_replay",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +173,8 @@ public:
|
|||||||
e.zone_in_z = 0;
|
e.zone_in_z = 0;
|
||||||
e.zone_in_heading = 0;
|
e.zone_in_heading = 0;
|
||||||
e.has_zone_in = 0;
|
e.has_zone_in = 0;
|
||||||
|
e.is_locked = 0;
|
||||||
|
e.add_replay = 1;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -226,6 +234,8 @@ public:
|
|||||||
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
||||||
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
||||||
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||||
|
e.is_locked = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
||||||
|
e.add_replay = row[24] ? static_cast<int8_t>(atoi(row[24])) : 1;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -281,6 +291,8 @@ public:
|
|||||||
v.push_back(columns[20] + " = " + std::to_string(e.zone_in_z));
|
v.push_back(columns[20] + " = " + std::to_string(e.zone_in_z));
|
||||||
v.push_back(columns[21] + " = " + std::to_string(e.zone_in_heading));
|
v.push_back(columns[21] + " = " + std::to_string(e.zone_in_heading));
|
||||||
v.push_back(columns[22] + " = " + std::to_string(e.has_zone_in));
|
v.push_back(columns[22] + " = " + std::to_string(e.has_zone_in));
|
||||||
|
v.push_back(columns[23] + " = " + std::to_string(e.is_locked));
|
||||||
|
v.push_back(columns[24] + " = " + std::to_string(e.add_replay));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -325,6 +337,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
v.push_back(std::to_string(e.add_replay));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -377,6 +391,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
v.push_back(std::to_string(e.add_replay));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -433,6 +449,8 @@ public:
|
|||||||
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
||||||
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
||||||
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||||
|
e.is_locked = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
||||||
|
e.add_replay = row[24] ? static_cast<int8_t>(atoi(row[24])) : 1;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -480,6 +498,8 @@ public:
|
|||||||
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0;
|
||||||
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
e.zone_in_heading = row[21] ? strtof(row[21], nullptr) : 0;
|
||||||
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
e.has_zone_in = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||||
|
e.is_locked = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
||||||
|
e.add_replay = row[24] ? static_cast<int8_t>(atoi(row[24])) : 1;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -577,6 +597,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
v.push_back(std::to_string(e.add_replay));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -622,6 +644,8 @@ public:
|
|||||||
v.push_back(std::to_string(e.zone_in_z));
|
v.push_back(std::to_string(e.zone_in_z));
|
||||||
v.push_back(std::to_string(e.zone_in_heading));
|
v.push_back(std::to_string(e.zone_in_heading));
|
||||||
v.push_back(std::to_string(e.has_zone_in));
|
v.push_back(std::to_string(e.has_zone_in));
|
||||||
|
v.push_back(std::to_string(e.is_locked));
|
||||||
|
v.push_back(std::to_string(e.add_replay));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* Any modifications to base repositories are to be made by the generator only
|
||||||
*
|
*
|
||||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
* @docs https://docs.eqemu.io/developer/repositories
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
#ifndef EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
||||||
@@ -16,19 +16,24 @@
|
|||||||
#include "../../strings.h"
|
#include "../../strings.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
|
||||||
class BaseGuildBankRepository {
|
class BaseGuildBankRepository {
|
||||||
public:
|
public:
|
||||||
struct GuildBank {
|
struct GuildBank {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t guildid;
|
uint32_t guild_id;
|
||||||
uint8_t area;
|
uint8_t area;
|
||||||
uint32_t slot;
|
uint32_t slot;
|
||||||
uint32_t itemid;
|
uint32_t item_id;
|
||||||
uint32_t qty;
|
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;
|
std::string donator;
|
||||||
uint8_t permissions;
|
uint8_t permissions;
|
||||||
std::string whofor;
|
std::string who_for;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -40,14 +45,20 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"guildid",
|
"guild_id",
|
||||||
"area",
|
"area",
|
||||||
"slot",
|
"slot",
|
||||||
"itemid",
|
"item_id",
|
||||||
"qty",
|
"augment_one_id",
|
||||||
|
"augment_two_id",
|
||||||
|
"augment_three_id",
|
||||||
|
"augment_four_id",
|
||||||
|
"augment_five_id",
|
||||||
|
"augment_six_id",
|
||||||
|
"quantity",
|
||||||
"donator",
|
"donator",
|
||||||
"permissions",
|
"permissions",
|
||||||
"whofor",
|
"who_for",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,14 +66,20 @@ public:
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"id",
|
"id",
|
||||||
"guildid",
|
"guild_id",
|
||||||
"area",
|
"area",
|
||||||
"slot",
|
"slot",
|
||||||
"itemid",
|
"item_id",
|
||||||
"qty",
|
"augment_one_id",
|
||||||
|
"augment_two_id",
|
||||||
|
"augment_three_id",
|
||||||
|
"augment_four_id",
|
||||||
|
"augment_five_id",
|
||||||
|
"augment_six_id",
|
||||||
|
"quantity",
|
||||||
"donator",
|
"donator",
|
||||||
"permissions",
|
"permissions",
|
||||||
"whofor",
|
"who_for",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,15 +120,21 @@ public:
|
|||||||
{
|
{
|
||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = 0;
|
e.id = 0;
|
||||||
e.guildid = 0;
|
e.guild_id = 0;
|
||||||
e.area = 0;
|
e.area = 0;
|
||||||
e.slot = 0;
|
e.slot = 0;
|
||||||
e.itemid = 0;
|
e.item_id = 0;
|
||||||
e.qty = 0;
|
e.augment_one_id = 0;
|
||||||
e.donator = "";
|
e.augment_two_id = 0;
|
||||||
e.permissions = 0;
|
e.augment_three_id = 0;
|
||||||
e.whofor = "";
|
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;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -148,15 +171,21 @@ public:
|
|||||||
if (results.RowCount() == 1) {
|
if (results.RowCount() == 1) {
|
||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||||
e.donator = row[6] ? row[6] : "";
|
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.whofor = row[8] ? row[8] : "";
|
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;
|
return e;
|
||||||
}
|
}
|
||||||
@@ -190,14 +219,20 @@ public:
|
|||||||
|
|
||||||
auto columns = Columns();
|
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[2] + " = " + std::to_string(e.area));
|
||||||
v.push_back(columns[3] + " = " + std::to_string(e.slot));
|
v.push_back(columns[3] + " = " + std::to_string(e.slot));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.itemid));
|
v.push_back(columns[4] + " = " + std::to_string(e.item_id));
|
||||||
v.push_back(columns[5] + " = " + std::to_string(e.qty));
|
v.push_back(columns[5] + " = " + std::to_string(e.augment_one_id));
|
||||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.donator) + "'");
|
v.push_back(columns[6] + " = " + std::to_string(e.augment_two_id));
|
||||||
v.push_back(columns[7] + " = " + std::to_string(e.permissions));
|
v.push_back(columns[7] + " = " + std::to_string(e.augment_three_id));
|
||||||
v.push_back(columns[8] + " = '" + Strings::Escape(e.whofor) + "'");
|
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(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -220,14 +255,20 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.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.area));
|
||||||
v.push_back(std::to_string(e.slot));
|
v.push_back(std::to_string(e.slot));
|
||||||
v.push_back(std::to_string(e.itemid));
|
v.push_back(std::to_string(e.item_id));
|
||||||
v.push_back(std::to_string(e.qty));
|
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("'" + Strings::Escape(e.donator) + "'");
|
||||||
v.push_back(std::to_string(e.permissions));
|
v.push_back(std::to_string(e.permissions));
|
||||||
v.push_back("'" + Strings::Escape(e.whofor) + "'");
|
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
auto results = db.QueryDatabase(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@@ -258,14 +299,20 @@ public:
|
|||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
|
|
||||||
v.push_back(std::to_string(e.id));
|
v.push_back(std::to_string(e.id));
|
||||||
v.push_back(std::to_string(e.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.area));
|
||||||
v.push_back(std::to_string(e.slot));
|
v.push_back(std::to_string(e.slot));
|
||||||
v.push_back(std::to_string(e.itemid));
|
v.push_back(std::to_string(e.item_id));
|
||||||
v.push_back(std::to_string(e.qty));
|
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("'" + Strings::Escape(e.donator) + "'");
|
||||||
v.push_back(std::to_string(e.permissions));
|
v.push_back(std::to_string(e.permissions));
|
||||||
v.push_back("'" + Strings::Escape(e.whofor) + "'");
|
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
}
|
}
|
||||||
@@ -299,15 +346,21 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||||
e.donator = row[6] ? row[6] : "";
|
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.whofor = row[8] ? row[8] : "";
|
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);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -332,15 +385,21 @@ public:
|
|||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
GuildBank e{};
|
GuildBank e{};
|
||||||
|
|
||||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
e.guildid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
e.guild_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||||
e.area = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
e.area = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||||
e.slot = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
e.slot = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||||
e.itemid = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
e.item_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||||
e.qty = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
e.augment_one_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||||
e.donator = row[6] ? row[6] : "";
|
e.augment_two_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||||
e.permissions = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
e.augment_three_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||||
e.whofor = row[8] ? row[8] : "";
|
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);
|
all_entries.push_back(e);
|
||||||
}
|
}
|
||||||
@@ -399,6 +458,90 @@ public:
|
|||||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string BaseReplace()
|
||||||
|
{
|
||||||
|
return fmt::format(
|
||||||
|
"REPLACE INTO {} ({}) ",
|
||||||
|
TableName(),
|
||||||
|
ColumnsRaw()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ReplaceOne(
|
||||||
|
Database& db,
|
||||||
|
const GuildBank &e
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back(std::to_string(e.guild_id));
|
||||||
|
v.push_back(std::to_string(e.area));
|
||||||
|
v.push_back(std::to_string(e.slot));
|
||||||
|
v.push_back(std::to_string(e.item_id));
|
||||||
|
v.push_back(std::to_string(e.augment_one_id));
|
||||||
|
v.push_back(std::to_string(e.augment_two_id));
|
||||||
|
v.push_back(std::to_string(e.augment_three_id));
|
||||||
|
v.push_back(std::to_string(e.augment_four_id));
|
||||||
|
v.push_back(std::to_string(e.augment_five_id));
|
||||||
|
v.push_back(std::to_string(e.augment_six_id));
|
||||||
|
v.push_back(std::to_string(e.quantity));
|
||||||
|
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||||
|
v.push_back(std::to_string(e.permissions));
|
||||||
|
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} VALUES ({})",
|
||||||
|
BaseReplace(),
|
||||||
|
Strings::Implode(",", v)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ReplaceMany(
|
||||||
|
Database& db,
|
||||||
|
const std::vector<GuildBank> &entries
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> insert_chunks;
|
||||||
|
|
||||||
|
for (auto &e: entries) {
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back(std::to_string(e.guild_id));
|
||||||
|
v.push_back(std::to_string(e.area));
|
||||||
|
v.push_back(std::to_string(e.slot));
|
||||||
|
v.push_back(std::to_string(e.item_id));
|
||||||
|
v.push_back(std::to_string(e.augment_one_id));
|
||||||
|
v.push_back(std::to_string(e.augment_two_id));
|
||||||
|
v.push_back(std::to_string(e.augment_three_id));
|
||||||
|
v.push_back(std::to_string(e.augment_four_id));
|
||||||
|
v.push_back(std::to_string(e.augment_five_id));
|
||||||
|
v.push_back(std::to_string(e.augment_six_id));
|
||||||
|
v.push_back(std::to_string(e.quantity));
|
||||||
|
v.push_back("'" + Strings::Escape(e.donator) + "'");
|
||||||
|
v.push_back(std::to_string(e.permissions));
|
||||||
|
v.push_back("'" + Strings::Escape(e.who_for) + "'");
|
||||||
|
|
||||||
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} VALUES {}",
|
||||||
|
BaseReplace(),
|
||||||
|
Strings::Implode(",", insert_chunks)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
#endif //EQEMU_BASE_GUILD_BANK_REPOSITORY_H
|
||||||
|
|||||||
@@ -19,13 +19,13 @@
|
|||||||
class BaseItemsEvolvingDetailsRepository {
|
class BaseItemsEvolvingDetailsRepository {
|
||||||
public:
|
public:
|
||||||
struct ItemsEvolvingDetails {
|
struct ItemsEvolvingDetails {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t item_evo_id;
|
uint32_t item_evo_id;
|
||||||
uint32_t item_evolve_level;
|
uint32_t item_evolve_level;
|
||||||
uint32_t item_id;
|
uint32_t item_id;
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t sub_type;
|
std::string sub_type;
|
||||||
int64_t required_amount;
|
int64_t required_amount;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string PrimaryKey()
|
static std::string PrimaryKey()
|
||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
e.item_evolve_level = 0;
|
e.item_evolve_level = 0;
|
||||||
e.item_id = 0;
|
e.item_id = 0;
|
||||||
e.type = 0;
|
e.type = 0;
|
||||||
e.sub_type = 0;
|
e.sub_type = "0";
|
||||||
e.required_amount = 0;
|
e.required_amount = 0;
|
||||||
|
|
||||||
return e;
|
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_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.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.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;
|
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
@@ -183,7 +183,7 @@ public:
|
|||||||
v.push_back(columns[2] + " = " + std::to_string(e.item_evolve_level));
|
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[3] + " = " + std::to_string(e.item_id));
|
||||||
v.push_back(columns[4] + " = " + std::to_string(e.type));
|
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));
|
v.push_back(columns[6] + " = " + std::to_string(e.required_amount));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
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_evolve_level));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.item_id));
|
||||||
v.push_back(std::to_string(e.type));
|
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));
|
v.push_back(std::to_string(e.required_amount));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
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_evolve_level));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.item_id));
|
||||||
v.push_back(std::to_string(e.type));
|
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));
|
v.push_back(std::to_string(e.required_amount));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
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_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.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.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;
|
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
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_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.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.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;
|
e.required_amount = row[6] ? strtoll(row[6], nullptr, 10) : 0;
|
||||||
|
|
||||||
all_entries.push_back(e);
|
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_evolve_level));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.item_id));
|
||||||
v.push_back(std::to_string(e.type));
|
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));
|
v.push_back(std::to_string(e.required_amount));
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
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_evolve_level));
|
||||||
v.push_back(std::to_string(e.item_id));
|
v.push_back(std::to_string(e.item_id));
|
||||||
v.push_back(std::to_string(e.type));
|
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));
|
v.push_back(std::to_string(e.required_amount));
|
||||||
|
|
||||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
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
|
#define EQEMU_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||||
|
|
||||||
#include "../database.h"
|
#include "../database.h"
|
||||||
#include "../expedition_lockout_timer.h"
|
#include "../dynamic_zone_lockout.h"
|
||||||
#include "../strings.h"
|
#include "../strings.h"
|
||||||
#include "base/base_character_expedition_lockouts_repository.h"
|
#include "base/base_character_expedition_lockouts_repository.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@@ -47,33 +47,8 @@ public:
|
|||||||
|
|
||||||
// Custom extended repository methods here
|
// Custom extended repository methods here
|
||||||
|
|
||||||
struct CharacterExpeditionLockoutsTimeStamp {
|
static std::unordered_map<uint32_t, std::vector<DzLockout>> GetLockouts(
|
||||||
int id;
|
Database& db, const std::vector<uint32_t>& char_ids, const std::string& expedition)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
auto results = db.QueryDatabase(fmt::format(SQL(
|
auto results = db.QueryDatabase(fmt::format(SQL(
|
||||||
SELECT
|
SELECT
|
||||||
@@ -84,39 +59,171 @@ public:
|
|||||||
from_expedition_uuid
|
from_expedition_uuid
|
||||||
FROM character_expedition_lockouts
|
FROM character_expedition_lockouts
|
||||||
WHERE
|
WHERE
|
||||||
character_id IN ({})
|
character_id IN ({0})
|
||||||
AND expire_time > NOW()
|
AND expire_time > NOW()
|
||||||
AND expedition_name = '{}'
|
AND expedition_name = '{1}'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
FIELD(character_id, {}),
|
FIELD(character_id, {0}),
|
||||||
FIELD(event_name, '{}') DESC
|
FIELD(event_name, '{2}') DESC
|
||||||
),
|
),
|
||||||
fmt::join(character_ids, ","),
|
fmt::join(char_ids, ","),
|
||||||
Strings::Escape(expedition_name),
|
Strings::Escape(expedition),
|
||||||
fmt::join(character_ids, ","),
|
Strings::Escape(DzLockout::ReplayTimer)
|
||||||
Strings::Escape(ordered_event_name)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
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)
|
for (auto row = results.begin(); row != results.end(); ++row)
|
||||||
{
|
{
|
||||||
CharacterExpeditionLockoutsTimeStamp entry{};
|
|
||||||
|
|
||||||
int col = 0;
|
int col = 0;
|
||||||
entry.character_id = std::strtoul(row[col++], nullptr, 10);
|
uint32_t char_id = std::strtoul(row[col++], nullptr, 10);
|
||||||
entry.expire_time = std::strtoull(row[col++], nullptr, 10);
|
time_t expire_time = std::strtoull(row[col++], nullptr, 10);
|
||||||
entry.duration = std::strtoul(row[col++], nullptr, 10);
|
uint32_t duration = std::strtoul(row[col++], nullptr, 10);
|
||||||
entry.event_name = row[col++];
|
std::string event = row[col++];
|
||||||
entry.expedition_name = expedition_name;
|
std::string uuid = row[col++];
|
||||||
entry.from_expedition_uuid = row[col++];
|
|
||||||
|
|
||||||
auto lockout = GetExpeditionLockoutTimerFromEntry(std::move(entry));
|
lockouts[char_id].emplace_back(std::move(uuid), expedition, std::move(event), expire_time, duration);
|
||||||
lockouts[entry.character_id].emplace_back(std::move(lockout));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return lockouts;
|
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
|
#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;
|
std::vector<MemberWithName> all_entries;
|
||||||
|
|
||||||
@@ -146,65 +146,34 @@ public:
|
|||||||
|
|
||||||
static void RemoveMember(Database& db, uint32_t dynamic_zone_id, uint32_t character_id)
|
static void RemoveMember(Database& db, uint32_t dynamic_zone_id, uint32_t character_id)
|
||||||
{
|
{
|
||||||
db.QueryDatabase(fmt::format(SQL(
|
DeleteWhere(db, fmt::format("dynamic_zone_id = {} AND character_id = {}", dynamic_zone_id, character_id));
|
||||||
DELETE FROM {}
|
|
||||||
WHERE dynamic_zone_id = {} AND character_id = {};
|
|
||||||
),
|
|
||||||
TableName(), dynamic_zone_id, character_id
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RemoveAllMembers(Database& db, uint32_t dynamic_zone_id)
|
static void RemoveAllMembers(Database& db, uint32_t dynamic_zone_id)
|
||||||
{
|
{
|
||||||
db.QueryDatabase(fmt::format(SQL(
|
DeleteWhere(db, fmt::format("dynamic_zone_id = {}", dynamic_zone_id));
|
||||||
DELETE FROM {}
|
|
||||||
WHERE dynamic_zone_id = {};
|
|
||||||
),
|
|
||||||
TableName(), 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(
|
return 0;
|
||||||
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) + ")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> insert_values;
|
std::vector<std::string> values;
|
||||||
|
values.reserve(entries.size());
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
for (const auto& entry : entries)
|
||||||
fmt::format(
|
{
|
||||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE id = id;",
|
values.push_back(fmt::format("({},{},{})", entry.id, entry.dynamic_zone_id, entry.character_id));
|
||||||
TableName(),
|
}
|
||||||
ColumnsRaw(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
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_z;
|
||||||
float zone_in_heading;
|
float zone_in_heading;
|
||||||
int has_zone_in;
|
int has_zone_in;
|
||||||
|
int8_t is_locked;
|
||||||
|
int8_t add_replay;
|
||||||
int zone;
|
int zone;
|
||||||
int version;
|
int version;
|
||||||
int is_global;
|
int is_global;
|
||||||
@@ -105,6 +107,8 @@ public:
|
|||||||
dynamic_zones.zone_in_z,
|
dynamic_zones.zone_in_z,
|
||||||
dynamic_zones.zone_in_heading,
|
dynamic_zones.zone_in_heading,
|
||||||
dynamic_zones.has_zone_in,
|
dynamic_zones.has_zone_in,
|
||||||
|
dynamic_zones.is_locked,
|
||||||
|
dynamic_zones.add_replay,
|
||||||
instance_list.zone,
|
instance_list.zone,
|
||||||
instance_list.version,
|
instance_list.version,
|
||||||
instance_list.is_global,
|
instance_list.is_global,
|
||||||
@@ -144,6 +148,8 @@ public:
|
|||||||
entry.zone_in_z = strtof(row[col++], nullptr);
|
entry.zone_in_z = strtof(row[col++], nullptr);
|
||||||
entry.zone_in_heading = strtof(row[col++], nullptr);
|
entry.zone_in_heading = strtof(row[col++], nullptr);
|
||||||
entry.has_zone_in = strtol(row[col++], nullptr, 10) != 0;
|
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
|
// from instance_list
|
||||||
entry.zone = strtol(row[col++], nullptr, 10);
|
entry.zone = strtol(row[col++], nullptr, 10);
|
||||||
entry.version = 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)
|
static void UpdateSwitchID(Database& db, uint32_t dz_id, int dz_switch_id)
|
||||||
{
|
{
|
||||||
if (dz_id != 0)
|
if (dz_id != 0)
|
||||||
@@ -351,6 +373,59 @@ public:
|
|||||||
|
|
||||||
return all_entries;
|
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
|
#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
|
// Custom extended repository methods here
|
||||||
|
|
||||||
static int InsertOrUpdateMany(Database& db,
|
static uint32_t InsertOrUpdateMany(Database& db, const std::vector<InstanceListPlayer>& entries)
|
||||||
const std::vector<InstanceListPlayer>& instance_list_player_entries)
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_chunks;
|
if (entries.empty())
|
||||||
|
|
||||||
for (auto &instance_list_player_entry: instance_list_player_entries)
|
|
||||||
{
|
{
|
||||||
std::vector<std::string> insert_values;
|
return 0;
|
||||||
|
|
||||||
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) + ")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> insert_values;
|
std::vector<std::string> values;
|
||||||
|
values.reserve(entries.size());
|
||||||
|
|
||||||
auto results = db.QueryDatabase(
|
for (const auto& entry : entries)
|
||||||
fmt::format(
|
{
|
||||||
"INSERT INTO {} ({}) VALUES {} ON DUPLICATE KEY UPDATE id = VALUES(id)",
|
values.push_back(fmt::format("({},{})", entry.id, entry.charid));
|
||||||
TableName(),
|
}
|
||||||
ColumnsRaw(),
|
|
||||||
Strings::Implode(",", insert_chunks)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
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)
|
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
|
||||||
+8
-3
@@ -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_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_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_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_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Mercs)
|
RULE_CATEGORY(Mercs)
|
||||||
@@ -373,6 +374,7 @@ 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, AllowCrossZoneSpellsOnMercs, false, "Set to true to allow cross zone spells (cast/remove) to affect mercenaries")
|
||||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets")
|
RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets")
|
||||||
RULE_BOOL(Zone, ZoneShardQuestMenuOnly, false, "Set to true if you only want quests to show the zone shard menu")
|
RULE_BOOL(Zone, ZoneShardQuestMenuOnly, false, "Set to true if you only want quests to show the zone shard menu")
|
||||||
|
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_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Map)
|
RULE_CATEGORY(Map)
|
||||||
@@ -527,6 +529,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, PointBlankAOEMaxTargets, 0, "Max number of targets a Point-Blank AOE spell can cast on. Set to 0 for no limit.")
|
||||||
RULE_INT(Spells, DefaultAOEMaxTargets, 0, "Max number of targets that an AOE spell which does not meet other descriptions can cast on. Set to 0 for no limit.")
|
RULE_INT(Spells, DefaultAOEMaxTargets, 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_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_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Combat)
|
RULE_CATEGORY(Combat)
|
||||||
@@ -713,6 +716,7 @@ RULE_INT(Aggro, BardAggroCap, 40, "per song bard aggro cap.")
|
|||||||
RULE_INT(Aggro, InitialAggroBonus, 100, "Initial Aggro Bonus, Default: 100")
|
RULE_INT(Aggro, InitialAggroBonus, 100, "Initial Aggro Bonus, Default: 100")
|
||||||
RULE_INT(Aggro, InitialPetAggroBonus, 100, "Initial Pet 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_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_END()
|
||||||
|
|
||||||
RULE_CATEGORY(TaskSystem)
|
RULE_CATEGORY(TaskSystem)
|
||||||
@@ -817,11 +821,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, 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, 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, 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, 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, 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, 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, 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.")
|
RULE_INT(Bots, MinGroupCureTargets, 3, "Minimum number of targets in valid range that are required for a cure heal to cast. Default 3.")
|
||||||
@@ -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, 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, 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, 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_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Parcel)
|
RULE_CATEGORY(Parcel)
|
||||||
|
|||||||
@@ -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_LFPMatches 0x0214
|
||||||
#define ServerOP_ClientVersionSummary 0x0215
|
#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
|
// dz
|
||||||
#define ServerOP_DzAddRemoveMember 0x0450
|
#define ServerOP_DzAddRemoveMember 0x0450
|
||||||
#define ServerOP_DzRemoveAllMembers 0x0451
|
#define ServerOP_DzRemoveAllMembers 0x0451
|
||||||
@@ -199,6 +187,15 @@
|
|||||||
#define ServerOP_DzDeleted 0x045d
|
#define ServerOP_DzDeleted 0x045d
|
||||||
#define ServerOP_DzSetSwitchID 0x045e
|
#define ServerOP_DzSetSwitchID 0x045e
|
||||||
#define ServerOP_DzMovePC 0x045f
|
#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_LSInfo 0x1000
|
||||||
#define ServerOP_LSStatus 0x1001
|
#define ServerOP_LSStatus 0x1001
|
||||||
@@ -251,37 +248,7 @@
|
|||||||
#define ServerOP_UpdateSchedulerEvents 0x4007
|
#define ServerOP_UpdateSchedulerEvents 0x4007
|
||||||
#define ServerOP_DiscordWebhookMessage 0x4008
|
#define ServerOP_DiscordWebhookMessage 0x4008
|
||||||
|
|
||||||
#define ServerOP_ReloadAAData 0x4100
|
#define ServerOP_ServerReloadRequest 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_CZDialogueWindow 0x4500
|
#define ServerOP_CZDialogueWindow 0x4500
|
||||||
#define ServerOP_CZLDoNUpdate 0x4501
|
#define ServerOP_CZLDoNUpdate 0x4501
|
||||||
@@ -710,36 +677,53 @@ struct ServerLSPlayerZoneChange_Struct {
|
|||||||
uint32 to; // 0 = world
|
uint32 to; // 0 = world
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClientAuth_Struct {
|
struct ClientAuth {
|
||||||
uint32 loginserver_account_id; // ID# in login server's db
|
uint32 loginserver_account_id; // ID# in login server's db
|
||||||
char loginserver_name[64];
|
char loginserver_name[64];
|
||||||
char account_name[30]; // username in login server's db
|
char account_name[30]; // username in login server's db
|
||||||
char key[30]; // the Key the client will present
|
char key[30]; // the key the client will present
|
||||||
uint8 lsadmin; // login server admin level
|
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
|
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;
|
uint32 ip_address;
|
||||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
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)
|
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
|
uint32 loginserver_account_id; // ID# in login server's db
|
||||||
char loginserver_account_name[30]; // username 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
|
char key[30]; // the key the client will present
|
||||||
uint8 loginserver_admin_level; // login server admin level
|
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
|
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;
|
uint32 ip_address;
|
||||||
uint8 is_client_from_local_network; // 1 if the client is from the local network
|
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)
|
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;
|
bool placeholder;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UsertoWorldRequestLegacy_Struct {
|
struct UsertoWorldRequestLegacy {
|
||||||
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 {
|
|
||||||
uint32 lsaccountid;
|
uint32 lsaccountid;
|
||||||
uint32 worldid;
|
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 FromID;
|
||||||
uint32 ToID;
|
uint32 ToID;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UsertoWorldResponse_Struct {
|
struct UsertoWorldResponse {
|
||||||
uint32 lsaccountid;
|
uint32 lsaccountid;
|
||||||
uint32 worldid;
|
uint32 worldid;
|
||||||
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
int8 response; // -3) World Full, -2) Banned, -1) Suspended, 0) Denied, 1) Allowed
|
||||||
uint32 FromID;
|
uint32 FromID; // appears to be unused today
|
||||||
uint32 ToID;
|
uint32 ToID; // appears to be unused today
|
||||||
char login[64];
|
char login[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
// generic struct to be used for alot of simple zone->world questions
|
// generic struct to be used for alot of simple zone->world questions
|
||||||
@@ -1543,10 +1527,8 @@ struct UCSServerStatus_Struct {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerExpeditionID_Struct {
|
struct ServerCharacterID_Struct {
|
||||||
uint32 expedition_id;
|
uint32_t char_id;
|
||||||
uint32 sender_zone_id;
|
|
||||||
uint32 sender_instance_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerDzLeaderID_Struct {
|
struct ServerDzLeaderID_Struct {
|
||||||
@@ -1580,45 +1562,42 @@ struct ServerDzMovePC_Struct {
|
|||||||
uint32 character_id;
|
uint32 character_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerExpeditionLockout_Struct {
|
struct ServerDzLockout_Struct {
|
||||||
uint32 expedition_id;
|
uint32 dz_id;
|
||||||
uint64 expire_time;
|
uint64 expire_time;
|
||||||
uint32 duration;
|
uint32 duration;
|
||||||
uint32 sender_zone_id;
|
uint32 sender_zone_id;
|
||||||
uint16 sender_instance_id;
|
uint16 sender_instance_id;
|
||||||
uint8 remove;
|
uint8 remove;
|
||||||
uint8 members_only;
|
uint8 members_only;
|
||||||
int seconds_adjust;
|
int seconds;
|
||||||
char event_name[256];
|
char event_name[256];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerExpeditionLockState_Struct {
|
struct ServerDzLock_Struct {
|
||||||
uint32 expedition_id;
|
uint32 dz_id;
|
||||||
uint32 sender_zone_id;
|
uint32 sender_zone_id;
|
||||||
uint16 sender_instance_id;
|
uint16 sender_instance_id;
|
||||||
uint8 enabled;
|
bool lock;
|
||||||
uint8 lock_msg; // 0: none, 1: closing 2: trial begin
|
uint8 lock_msg; // 0: none, 1: closing 2: trial begin
|
||||||
|
uint32 color;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerExpeditionSetting_Struct {
|
struct ServerDzBool_Struct {
|
||||||
uint32 expedition_id;
|
uint32 dz_id;
|
||||||
uint32 sender_zone_id;
|
uint32 sender_zone_id;
|
||||||
uint16 sender_instance_id;
|
uint16 sender_instance_id;
|
||||||
uint8 enabled;
|
bool enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerExpeditionCharacterLockout_Struct {
|
struct ServerDzCharacterLockout_Struct {
|
||||||
uint8 remove;
|
uint8 remove;
|
||||||
uint32 character_id;
|
uint32 char_id;
|
||||||
uint64 expire_time;
|
uint64 expire_time;
|
||||||
uint32 duration;
|
uint32 duration;
|
||||||
char uuid[37];
|
char uuid[37];
|
||||||
char expedition_name[128];
|
char expedition[128];
|
||||||
char event_name[256];
|
char event[256];
|
||||||
};
|
|
||||||
|
|
||||||
struct ServerExpeditionCharacterID_Struct {
|
|
||||||
uint32_t character_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerDzExpireWarning_Struct {
|
struct ServerDzExpireWarning_Struct {
|
||||||
@@ -1627,7 +1606,7 @@ struct ServerDzExpireWarning_Struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ServerDzCommand_Struct {
|
struct ServerDzCommand_Struct {
|
||||||
uint32 expedition_id;
|
uint32 dz_id;
|
||||||
uint8 is_char_online; // 0: target name is offline, 1: online
|
uint8 is_char_online; // 0: target name is offline, 1: online
|
||||||
char requester_name[64];
|
char requester_name[64];
|
||||||
char target_name[64];
|
char target_name[64];
|
||||||
@@ -1696,11 +1675,12 @@ struct ServerDzSetDuration_Struct {
|
|||||||
uint32 seconds;
|
uint32 seconds;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerDzCreateSerialized_Struct {
|
struct ServerDzCreate_Struct {
|
||||||
uint16_t origin_zone_id;
|
uint16_t origin_zone_id;
|
||||||
uint16_t origin_instance_id;
|
uint16_t origin_instance_id;
|
||||||
|
uint32_t dz_id;
|
||||||
uint32_t cereal_size;
|
uint32_t cereal_size;
|
||||||
char cereal_data[0];
|
char cereal_data[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerSendPlayerEvent_Struct {
|
struct ServerSendPlayerEvent_Struct {
|
||||||
|
|||||||
+23
-14
@@ -93,7 +93,14 @@ bool IsTargetableAESpell(uint16 spell_id)
|
|||||||
return false;
|
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)
|
bool IsSacrificeSpell(uint16 spell_id)
|
||||||
@@ -675,17 +682,19 @@ bool IsAnyNukeOrStunSpell(uint16 spell_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsAnyAESpell(uint16 spell_id) {
|
bool IsAnyAESpell(uint16 spell_id) {
|
||||||
return (
|
if (!IsValidSpell(spell_id)) {
|
||||||
IsValidSpell(spell_id) &&
|
return false;
|
||||||
(
|
}
|
||||||
IsAEDurationSpell(spell_id) ||
|
|
||||||
IsAESpell(spell_id) ||
|
return (
|
||||||
IsAERainNukeSpell(spell_id) ||
|
IsTargetableAESpell(spell_id) ||
|
||||||
IsAERainSpell(spell_id) ||
|
IsAESpell(spell_id) ||
|
||||||
IsPBAESpell(spell_id) ||
|
IsPBAESpell(spell_id) ||
|
||||||
IsPBAENukeSpell(spell_id)
|
IsAEDurationSpell(spell_id) ||
|
||||||
)
|
IsAERainNukeSpell(spell_id) ||
|
||||||
);
|
IsAERainSpell(spell_id) ||
|
||||||
|
IsPBAENukeSpell(spell_id)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsAESpell(uint16 spell_id)
|
bool IsAESpell(uint16 spell_id)
|
||||||
@@ -740,8 +749,8 @@ bool IsPBAESpell(uint16 spell_id)
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
spell.aoe_range > 0 &&
|
spell.aoe_range > 0 &&
|
||||||
spell.target_type == ST_AECaster
|
!IsTargetRequiredForSpell(spell_id)
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -743,7 +743,7 @@ namespace BotSpellTypes
|
|||||||
constexpr uint16 DISCIPLINE_END = BotSpellTypes::DiscUtility; // Do not remove this, increment as needed
|
constexpr uint16 DISCIPLINE_END = BotSpellTypes::DiscUtility; // Do not remove this, increment as needed
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::map<uint16, std::string> spellType_names = {
|
static std::map<uint16, std::string> spell_type_names = {
|
||||||
{ BotSpellTypes::Nuke, "Nuke" },
|
{ BotSpellTypes::Nuke, "Nuke" },
|
||||||
{ BotSpellTypes::RegularHeal, "Regular Heal" },
|
{ BotSpellTypes::RegularHeal, "Regular Heal" },
|
||||||
{ BotSpellTypes::Root, "Root" },
|
{ BotSpellTypes::Root, "Root" },
|
||||||
@@ -818,7 +818,7 @@ static std::map<uint16, std::string> spellType_names = {
|
|||||||
{ BotSpellTypes::AELull, "AE Lull" }
|
{ 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::Nuke, "nukes" },
|
||||||
{ BotSpellTypes::RegularHeal, "regularheals" },
|
{ BotSpellTypes::RegularHeal, "regularheals" },
|
||||||
{ BotSpellTypes::Root, "roots" },
|
{ BotSpellTypes::Root, "roots" },
|
||||||
@@ -900,7 +900,7 @@ const uint32 SPELL_TYPES_INNATE = (SpellType_Nuke | SpellType_Lifetap | SpellTyp
|
|||||||
// Bot related functions
|
// Bot related functions
|
||||||
bool IsBotSpellTypeDetrimental (uint16 spell_type);
|
bool IsBotSpellTypeDetrimental (uint16 spell_type);
|
||||||
bool IsBotSpellTypeBeneficial (uint16 spell_type);
|
bool IsBotSpellTypeBeneficial (uint16 spell_type);
|
||||||
bool IsBotSpellTypeOtherBeneficial(uint16 spell_type);
|
bool BotSpellTypeUsesTargetSettings(uint16 spell_type);
|
||||||
bool IsBotSpellTypeInnate (uint16 spell_type);
|
bool IsBotSpellTypeInnate (uint16 spell_type);
|
||||||
bool IsAEBotSpellType(uint16 spell_type);
|
bool IsAEBotSpellType(uint16 spell_type);
|
||||||
bool IsGroupBotSpellType(uint16 spell_type);
|
bool IsGroupBotSpellType(uint16 spell_type);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ bool IsBotSpellTypeBeneficial(uint16 spell_type) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsBotSpellTypeOtherBeneficial(uint16 spell_type) {
|
bool BotSpellTypeUsesTargetSettings(uint16 spell_type) {
|
||||||
switch (spell_type) {
|
switch (spell_type) {
|
||||||
case BotSpellTypes::RegularHeal:
|
case BotSpellTypes::RegularHeal:
|
||||||
case BotSpellTypes::CompleteHeal:
|
case BotSpellTypes::CompleteHeal:
|
||||||
|
|||||||
@@ -912,3 +912,27 @@ std::string Strings::ZoneTime(const uint8 hours, const uint8 minutes)
|
|||||||
hours >= 13 ? "PM" : "AM"
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -186,6 +186,8 @@ public:
|
|||||||
value = strtod(tmp_str.data(), nullptr);
|
value = strtod(tmp_str.data(), nullptr);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string Slugify(const std::string &input, const std::string &separator = "-");
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string StringFormat(const char *format, ...);
|
const std::string StringFormat(const char *format, ...);
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
// Build variables
|
// Build variables
|
||||||
// these get injected during the build pipeline
|
// these get injected during the build pipeline
|
||||||
#define CURRENT_VERSION "22.62.2-dev" // always append -dev to the current version for custom-builds
|
#define CURRENT_VERSION "23.1.0-dev" // always append -dev to the current version for custom-builds
|
||||||
#define LOGIN_VERSION "0.8.0"
|
#define LOGIN_VERSION "0.8.0"
|
||||||
#define COMPILE_DATE __DATE__
|
#define COMPILE_DATE __DATE__
|
||||||
#define COMPILE_TIME __TIME__
|
#define COMPILE_TIME __TIME__
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CURRENT_BINARY_DATABASE_VERSION 9302
|
#define CURRENT_BINARY_DATABASE_VERSION 9309
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Ne
|
|||||||
packet.ToString()
|
packet.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (packet.Length() < sizeof(UsertoWorldResponseLegacy_Struct)) {
|
if (packet.Length() < sizeof(UsertoWorldResponseLegacy)) {
|
||||||
LogError(
|
LogError(
|
||||||
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||||
"but was too small. Discarded to avoid buffer overrun"
|
"but was too small. Discarded to avoid buffer overrun"
|
||||||
@@ -152,7 +152,7 @@ void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Ne
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *res = (UsertoWorldResponseLegacy_Struct *) packet.Data();
|
auto *res = (UsertoWorldResponseLegacy *) packet.Data();
|
||||||
|
|
||||||
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
||||||
Client *c = server.client_manager->GetClient(res->lsaccountid, "eqemu");
|
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()
|
packet.ToString()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (packet.Length() < sizeof(UsertoWorldResponse_Struct)) {
|
if (packet.Length() < sizeof(UsertoWorldResponse)) {
|
||||||
LogError(
|
LogError(
|
||||||
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
"Received application packet from server that had opcode ServerOP_UsertoWorldResp, "
|
||||||
"but was too small. Discarded to avoid buffer overrun"
|
"but was too small. Discarded to avoid buffer overrun"
|
||||||
@@ -238,7 +238,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto res = (UsertoWorldResponse_Struct *) packet.Data();
|
auto res = (UsertoWorldResponse *) packet.Data();
|
||||||
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
LogDebug("Trying to find client with user id of [{}]", res->lsaccountid);
|
||||||
|
|
||||||
Client *c = server.client_manager->GetClient(
|
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)
|
void WorldServer::HandleNewWorldserver(LoginserverNewWorldRequest *req)
|
||||||
{
|
{
|
||||||
if (m_is_server_logged_in) {
|
if (m_is_server_logged_in) {
|
||||||
LogError(
|
LogInfo("Login server was already marked as logged in, returning");
|
||||||
"Login server was already marked as logged in, aborting"
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HandleNewWorldserverValidation(req)) {
|
if (!HandleNewWorldserverValidation(req)) {
|
||||||
LogError("WorldServer::HandleNewWorldserver failed validation rules");
|
LogError("failed validation rules");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +492,7 @@ void WorldServer::HandleWorldserverStatusUpdate(LoginserverWorldStatusUpdate *u)
|
|||||||
void WorldServer::SendClientAuthToWorld(Client *c)
|
void WorldServer::SendClientAuthToWorld(Client *c)
|
||||||
{
|
{
|
||||||
EQ::Net::DynamicPacket outapp;
|
EQ::Net::DynamicPacket outapp;
|
||||||
ClientAuth_Struct a{};
|
ClientAuth a{};
|
||||||
|
|
||||||
a.loginserver_account_id = c->GetAccountID();
|
a.loginserver_account_id = c->GetAccountID();
|
||||||
|
|
||||||
@@ -503,7 +501,7 @@ void WorldServer::SendClientAuthToWorld(Client *c)
|
|||||||
|
|
||||||
a.lsadmin = 0;
|
a.lsadmin = 0;
|
||||||
a.is_world_admin = 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);
|
strncpy(a.loginserver_name, &c->GetLoginServerName()[0], 64);
|
||||||
|
|
||||||
const std::string &client_address(c->GetConnection()->GetRemoteAddr());
|
const std::string &client_address(c->GetConnection()->GetRemoteAddr());
|
||||||
@@ -521,7 +519,7 @@ void WorldServer::SendClientAuthToWorld(Client *c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct in_addr ip_addr{};
|
struct in_addr ip_addr{};
|
||||||
ip_addr.s_addr = a.ip;
|
ip_addr.s_addr = a.ip_address;
|
||||||
|
|
||||||
LogInfo(
|
LogInfo(
|
||||||
"Client authentication response: world_address [{}] client_address [{}]",
|
"Client authentication response: world_address [{}] client_address [{}]",
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ private:
|
|||||||
std::string m_server_version;
|
std::string m_server_version;
|
||||||
bool m_is_server_authorized_to_list;
|
bool m_is_server_authorized_to_list;
|
||||||
bool m_is_server_logged_in;
|
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);
|
static void FormatWorldServerName(char *name, int8 server_list_type);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -154,9 +154,9 @@ void WorldServerManager::SendUserLoginToWorldRequest(
|
|||||||
|
|
||||||
if (iter != m_world_servers.end()) {
|
if (iter != m_world_servers.end()) {
|
||||||
EQ::Net::DynamicPacket outapp;
|
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->worldid = server_id;
|
||||||
r->lsaccountid = client_account_id;
|
r->lsaccountid = client_account_id;
|
||||||
strncpy(r->login, client_loginserver.c_str(), 64);
|
strncpy(r->login, client_loginserver.c_str(), 64);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eqemu-server",
|
"name": "eqemu-server",
|
||||||
"version": "22.62.2",
|
"version": "23.1.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/EQEmu/Server.git"
|
"url": "https://github.com/EQEmu/Server.git"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
#include "../common/events/player_events.h"
|
#include "../common/events/player_events.h"
|
||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
|
#include "../common/server_reload_types.h"
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -72,9 +73,13 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
case 0: {
|
case 0: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_ReloadLogs: {
|
case ServerOP_ServerReloadRequest: {
|
||||||
LogSys.LoadLogDatabaseSettings();
|
auto o = (ServerReload::Request*) p.Data();
|
||||||
player_event_logs.ReloadSettings();
|
if (o->type == ServerReload::Type::Logs) {
|
||||||
|
LogSys.LoadLogDatabaseSettings();
|
||||||
|
player_event_logs.ReloadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_QueryServGeneric: {
|
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 "database.h"
|
||||||
#include "../common/discord/discord_manager.h"
|
#include "../common/discord/discord_manager.h"
|
||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
|
#include "../common/server_reload_types.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -75,9 +76,13 @@ void WorldServer::ProcessMessage(uint16 opcode, EQ::Net::Packet &p)
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_ReloadLogs: {
|
case ServerOP_ServerReloadRequest: {
|
||||||
LogSys.LoadLogDatabaseSettings();
|
auto o = (ServerReload::Request*) pack->pBuffer;
|
||||||
player_event_logs.ReloadSettings();
|
if (o->type == ServerReload::Type::Logs) {
|
||||||
|
LogSys.LoadLogDatabaseSettings();
|
||||||
|
player_event_logs.ReloadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_PlayerEvent: {
|
case ServerOP_PlayerEvent: {
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ SET(world_sources
|
|||||||
dynamic_zone_manager.cpp
|
dynamic_zone_manager.cpp
|
||||||
eql_config.cpp
|
eql_config.cpp
|
||||||
eqemu_api_world_data_service.cpp
|
eqemu_api_world_data_service.cpp
|
||||||
expedition_database.cpp
|
|
||||||
expedition_message.cpp
|
|
||||||
launcher_link.cpp
|
launcher_link.cpp
|
||||||
launcher_list.cpp
|
launcher_list.cpp
|
||||||
lfplist.cpp
|
lfplist.cpp
|
||||||
@@ -48,8 +46,6 @@ SET(world_headers
|
|||||||
dynamic_zone_manager.h
|
dynamic_zone_manager.h
|
||||||
eql_config.h
|
eql_config.h
|
||||||
eqemu_api_world_data_service.h
|
eqemu_api_world_data_service.h
|
||||||
expedition_database.h
|
|
||||||
expedition_message.h
|
|
||||||
launcher_link.h
|
launcher_link.h
|
||||||
launcher_list.h
|
launcher_list.h
|
||||||
lfplist.h
|
lfplist.h
|
||||||
|
|||||||
+14
-14
@@ -447,30 +447,30 @@ void Client::SendPostEnterWorld() {
|
|||||||
|
|
||||||
bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if (app->size != sizeof(LoginInfo_Struct)) {
|
if (app->size != sizeof(LoginInfo)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *login_info = (LoginInfo_Struct *) app->pBuffer;
|
auto *r = (LoginInfo *) app->pBuffer;
|
||||||
|
|
||||||
// Quagmire - max len for name is 18, pass 15
|
// Quagmire - max len for name is 18, pass 15
|
||||||
char name[19] = {0};
|
char name[19] = {0};
|
||||||
char password[16] = {0};
|
char password[16] = {0};
|
||||||
strn0cpy(name, (char *) login_info->login_info, 18);
|
strn0cpy(name, (char *) r->login_info, 18);
|
||||||
strn0cpy(password, (char *) &(login_info->login_info[strlen(name) + 1]), 15);
|
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) {
|
if (strlen(password) <= 1) {
|
||||||
LogInfo("Login without a password");
|
LogInfo("Login without a password");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_player_zoning = (login_info->zoning == 1);
|
is_player_zoning = (r->zoning == 1);
|
||||||
|
|
||||||
uint32 id = Strings::ToInt(name);
|
uint32 id = Strings::ToInt(name);
|
||||||
if (id == 0) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,15 +480,15 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
|||||||
LogClientLogin("Checking authentication id [{}] passed", id);
|
LogClientLogin("Checking authentication id [{}] passed", id);
|
||||||
if (!is_player_zoning) {
|
if (!is_player_zoning) {
|
||||||
// Track who is in and who is out of the game
|
// 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
|
// Desktop -> Char Select
|
||||||
inout = (char *) "In";
|
in_out = "in";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Game -> Char Select
|
// Game -> Char Select
|
||||||
inout=(char *) "Out";
|
in_out = "out";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always at Char select at this point.
|
// 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.
|
// Could use a Logging Out Completely message somewhere.
|
||||||
cle->SetOnline(CLE_Status::CharSelect);
|
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 {
|
else {
|
||||||
cle->SetOnline();
|
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)) {
|
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
|
// 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.
|
// 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) {
|
if (custom_files_key != client_key) {
|
||||||
std::string message = fmt::format("Missing Files [{}]", RuleS(World, CustomFilesUrl) );
|
std::string message = fmt::format("Missing Files [{}]", RuleS(World, CustomFilesUrl) );
|
||||||
SendUnsupportedClientPacket(message);
|
SendUnsupportedClientPacket(message);
|
||||||
@@ -1434,7 +1434,7 @@ void Client::EnterWorld(bool TryBootup) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (TryBootup) {
|
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();
|
autobootup_timeout.Start();
|
||||||
zone_waiting_for_bootup = zoneserver_list.TriggerBootup(zone_id, instance_id);
|
zone_waiting_for_bootup = zoneserver_list.TriggerBootup(zone_id, instance_id);
|
||||||
if (zone_waiting_for_bootup == 0) {
|
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 "../common/global_define.h"
|
||||||
#include "cliententry.h"
|
#include "cliententry.h"
|
||||||
#include "clientlist.h"
|
#include "clientlist.h"
|
||||||
@@ -24,93 +7,86 @@
|
|||||||
#include "worlddb.h"
|
#include "worlddb.h"
|
||||||
#include "zoneserver.h"
|
#include "zoneserver.h"
|
||||||
#include "world_config.h"
|
#include "world_config.h"
|
||||||
#include "../common/guilds.h"
|
|
||||||
#include "../common/strings.h"
|
|
||||||
|
|
||||||
extern uint32 numplayers;
|
extern uint32 numplayers;
|
||||||
extern LoginServerList loginserverlist;
|
extern LoginServerList loginserverlist;
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern volatile bool RunLoops;
|
extern volatile bool RunLoops;
|
||||||
extern SharedTaskManager shared_task_manager;
|
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(
|
ClientListEntry::ClientListEntry(
|
||||||
uint32 in_id,
|
uint32 id,
|
||||||
uint32 in_loginserver_id,
|
uint32 login_server_id,
|
||||||
const char *in_loginserver_name,
|
const char *login_server_name,
|
||||||
const char *in_login_name,
|
const char *account_name,
|
||||||
const char *in_login_key,
|
const char *login_key,
|
||||||
int16 in_is_world_admin,
|
int16 is_world_admin,
|
||||||
uint32 ip,
|
uint32 ip_address,
|
||||||
uint8 local
|
uint8 local
|
||||||
)
|
)
|
||||||
: id(in_id)
|
: m_id(id)
|
||||||
{
|
{
|
||||||
ClearVars(true);
|
ClearVars(true);
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
"in_id [{0}] in_loginserver_id [{1}] in_loginserver_name [{2}] in_login_name [{3}] in_login_key [{4}] "
|
"id [{}] loginserver_id [{}] loginserver_name [{}] login_name [{}] login_key [{}] is_world_admin [{}] ip [{}] local [{}]",
|
||||||
" in_is_world_admin [{5}] ip [{6}] local [{7}]",
|
id,
|
||||||
in_id,
|
login_server_id,
|
||||||
in_loginserver_id,
|
login_server_name,
|
||||||
in_loginserver_name,
|
account_name,
|
||||||
in_login_name,
|
login_key,
|
||||||
in_login_key,
|
is_world_admin,
|
||||||
in_is_world_admin,
|
ip_address,
|
||||||
ip,
|
|
||||||
local
|
local
|
||||||
);
|
);
|
||||||
|
|
||||||
pIP = ip;
|
m_ip_address = ip_address;
|
||||||
pLSID = in_loginserver_id;
|
m_login_server_id = login_server_id;
|
||||||
if (in_loginserver_id > 0) {
|
if (login_server_id > 0) {
|
||||||
paccountid = database.GetAccountIDFromLSID(in_loginserver_name, in_loginserver_id, paccountname, &padmin);
|
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(m_login_account_name, account_name, sizeof(m_login_account_name));
|
||||||
strn0cpy(plskey, in_login_key, sizeof(plskey));
|
strn0cpy(m_key, login_key, sizeof(m_key));
|
||||||
strn0cpy(source_loginserver, in_loginserver_name, sizeof(source_loginserver));
|
strn0cpy(m_source_loginserver, login_server_name, sizeof(m_source_loginserver));
|
||||||
pworldadmin = in_is_world_admin;
|
|
||||||
plocal = (local == 1);
|
|
||||||
|
|
||||||
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)
|
ClientListEntry::ClientListEntry(uint32 in_id, ZoneServer *z, ServerClientList_Struct *scl, CLE_Status online)
|
||||||
: id(in_id)
|
: m_id(in_id)
|
||||||
{
|
{
|
||||||
ClearVars(true);
|
ClearVars(true);
|
||||||
|
|
||||||
pIP = 0;
|
m_ip_address = 0;
|
||||||
pLSID = scl->LSAccountID;
|
m_login_server_id = scl->LSAccountID;
|
||||||
strn0cpy(loginserver_account_name, scl->name, sizeof(loginserver_account_name));
|
strn0cpy(m_login_account_name, scl->name, sizeof(m_login_account_name));
|
||||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
strn0cpy(m_key, scl->lskey, sizeof(m_key));
|
||||||
pworldadmin = 0;
|
m_world_admin = 0;
|
||||||
|
|
||||||
paccountid = scl->AccountID;
|
m_account_id = scl->AccountID;
|
||||||
strn0cpy(paccountname, scl->AccountName, sizeof(paccountname));
|
strn0cpy(m_account_name, scl->AccountName, sizeof(m_account_name));
|
||||||
padmin = scl->Admin;
|
m_admin = scl->Admin;
|
||||||
|
|
||||||
pinstance = 0;
|
m_instance = 0;
|
||||||
pLFGFromLevel = 0;
|
m_lfg_from_level = 0;
|
||||||
pLFGToLevel = 0;
|
m_lfg_to_level = 0;
|
||||||
pLFGMatchFilter = false;
|
m_lfg_match_filter = false;
|
||||||
memset(pLFGComments, 0, 64);
|
memset(m_lfg_comments, 0, 64);
|
||||||
|
|
||||||
if (iOnline >= CLE_Status::Zoning) {
|
if (online >= CLE_Status::Zoning) {
|
||||||
Update(iZS, scl, iOnline);
|
Update(z, scl, online);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SetOnline(iOnline);
|
SetOnline(online);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,16 +96,16 @@ ClientListEntry::~ClientListEntry()
|
|||||||
Camp(); // updates zoneserver's numplayers
|
Camp(); // updates zoneserver's numplayers
|
||||||
client_list.RemoveCLEReferances(this);
|
client_list.RemoveCLEReferances(this);
|
||||||
}
|
}
|
||||||
for (auto& elem : tell_queue) {
|
for (auto &elem: m_tell_queue) {
|
||||||
safe_delete_array(elem);
|
safe_delete_array(elem);
|
||||||
}
|
}
|
||||||
tell_queue.clear();
|
m_tell_queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientListEntry::SetChar(uint32 iCharID, const char *iCharName)
|
void ClientListEntry::SetChar(uint32 iCharID, const char *iCharName)
|
||||||
{
|
{
|
||||||
pcharid = iCharID;
|
m_char_id = iCharID;
|
||||||
strn0cpy(pname, iCharName, sizeof(pname));
|
strn0cpy(m_char_name, iCharName, sizeof(m_char_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientListEntry::SetOnline(CLE_Status iOnline)
|
void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||||
@@ -142,20 +118,20 @@ void ClientListEntry::SetOnline(CLE_Status iOnline)
|
|||||||
static_cast<int>(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++;
|
numplayers++;
|
||||||
}
|
}
|
||||||
else if (iOnline < CLE_Status::Online && pOnline >= CLE_Status::Online) {
|
else if (iOnline < CLE_Status::Online && m_online >= CLE_Status::Online) {
|
||||||
numplayers--;
|
numplayers--;
|
||||||
}
|
}
|
||||||
if (iOnline != CLE_Status::Online || pOnline < CLE_Status::Online) {
|
if (iOnline != CLE_Status::Online || m_online < CLE_Status::Online) {
|
||||||
pOnline = iOnline;
|
m_online = iOnline;
|
||||||
}
|
}
|
||||||
if (iOnline < CLE_Status::Zoning) {
|
if (iOnline < CLE_Status::Zoning) {
|
||||||
Camp();
|
Camp();
|
||||||
}
|
}
|
||||||
if (pOnline >= CLE_Status::Online) {
|
if (m_online >= CLE_Status::Online) {
|
||||||
stale = 0;
|
m_stale = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,49 +169,49 @@ void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
|
|||||||
|
|
||||||
void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_Status iOnline)
|
||||||
{
|
{
|
||||||
if (pzoneserver != iZS) {
|
if (m_zone_server != iZS) {
|
||||||
if (pzoneserver) {
|
if (m_zone_server) {
|
||||||
pzoneserver->RemovePlayer();
|
m_zone_server->RemovePlayer();
|
||||||
LSUpdate(pzoneserver);
|
LSUpdate(m_zone_server);
|
||||||
}
|
}
|
||||||
if (iZS) {
|
if (iZS) {
|
||||||
iZS->AddPlayer();
|
iZS->AddPlayer();
|
||||||
LSUpdate(iZS);
|
LSUpdate(iZS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pzoneserver = iZS;
|
m_zone_server = iZS;
|
||||||
pzone = scl->zone;
|
m_zone = scl->zone;
|
||||||
pinstance = scl->instance_id;
|
m_instance = scl->instance_id;
|
||||||
pcharid = scl->charid;
|
m_char_id = scl->charid;
|
||||||
|
|
||||||
strcpy(pname, scl->name);
|
strcpy(m_char_name, scl->name);
|
||||||
if (paccountid == 0) {
|
if (m_account_id == 0) {
|
||||||
paccountid = scl->AccountID;
|
m_account_id = scl->AccountID;
|
||||||
strcpy(paccountname, scl->AccountName);
|
strcpy(m_account_name, scl->AccountName);
|
||||||
strcpy(loginserver_account_name, scl->AccountName);
|
strcpy(m_login_account_name, scl->AccountName);
|
||||||
pIP = scl->IP;
|
m_ip_address = scl->IP;
|
||||||
pLSID = scl->LSAccountID;
|
m_login_server_id = scl->LSAccountID;
|
||||||
strn0cpy(plskey, scl->lskey, sizeof(plskey));
|
strn0cpy(m_key, scl->lskey, sizeof(m_key));
|
||||||
}
|
}
|
||||||
padmin = scl->Admin;
|
m_admin = scl->Admin;
|
||||||
plevel = scl->level;
|
m_level = scl->level;
|
||||||
pclass_ = scl->class_;
|
m_class_ = scl->class_;
|
||||||
prace = scl->race;
|
m_race = scl->race;
|
||||||
panon = scl->anon;
|
m_anon = scl->anon;
|
||||||
ptellsoff = scl->tellsoff;
|
m_tells_off = scl->tellsoff;
|
||||||
pguild_id = scl->guild_id;
|
m_guild_id = scl->guild_id;
|
||||||
pguild_rank = scl->guild_rank;
|
m_guild_rank = scl->guild_rank;
|
||||||
pguild_tribute_opt_in = scl->guild_tribute_opt_in;
|
m_guild_tribute_opt_in = scl->guild_tribute_opt_in;
|
||||||
pLFG = scl->LFG;
|
m_lfg = scl->LFG;
|
||||||
gm = scl->gm;
|
m_gm = scl->gm;
|
||||||
pClientVersion = scl->ClientVersion;
|
m_client_version = scl->ClientVersion;
|
||||||
|
|
||||||
// Fields from the LFG Window
|
// Fields from the LFG Window
|
||||||
if ((scl->LFGFromLevel != 0) && (scl->LFGToLevel != 0)) {
|
if ((scl->LFGFromLevel != 0) && (scl->LFGToLevel != 0)) {
|
||||||
pLFGFromLevel = scl->LFGFromLevel;
|
m_lfg_from_level = scl->LFGFromLevel;
|
||||||
pLFGToLevel = scl->LFGToLevel;
|
m_lfg_to_level = scl->LFGToLevel;
|
||||||
pLFGMatchFilter = scl->LFGMatchFilter;
|
m_lfg_match_filter = scl->LFGMatchFilter;
|
||||||
memcpy(pLFGComments, scl->LFGComments, sizeof(pLFGComments));
|
memcpy(m_lfg_comments, scl->LFGComments, sizeof(m_lfg_comments));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetOnline(iOnline);
|
SetOnline(iOnline);
|
||||||
@@ -243,76 +219,76 @@ void ClientListEntry::Update(ZoneServer *iZS, ServerClientList_Struct *scl, CLE_
|
|||||||
|
|
||||||
void ClientListEntry::LeavingZone(ZoneServer *iZS, CLE_Status iOnline)
|
void ClientListEntry::LeavingZone(ZoneServer *iZS, CLE_Status iOnline)
|
||||||
{
|
{
|
||||||
if (iZS != 0 && iZS != pzoneserver) {
|
if (iZS != 0 && iZS != m_zone_server) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetOnline(iOnline);
|
SetOnline(iOnline);
|
||||||
|
|
||||||
shared_task_manager.RemoveActiveInvitationByCharacterID(CharID());
|
shared_task_manager.RemoveActiveInvitationByCharacterID(CharID());
|
||||||
|
|
||||||
if (pzoneserver) {
|
if (m_zone_server) {
|
||||||
pzoneserver->RemovePlayer();
|
m_zone_server->RemovePlayer();
|
||||||
LSUpdate(pzoneserver);
|
LSUpdate(m_zone_server);
|
||||||
}
|
}
|
||||||
pzoneserver = 0;
|
m_zone_server = 0;
|
||||||
pzone = 0;
|
m_zone = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientListEntry::ClearVars(bool iAll)
|
void ClientListEntry::ClearVars(bool iAll)
|
||||||
{
|
{
|
||||||
if (iAll) {
|
if (iAll) {
|
||||||
pOnline = CLE_Status::Never;
|
m_online = CLE_Status::Never;
|
||||||
stale = 0;
|
m_stale = 0;
|
||||||
|
|
||||||
pLSID = 0;
|
m_login_server_id = 0;
|
||||||
memset(loginserver_account_name, 0, sizeof(loginserver_account_name));
|
memset(m_login_account_name, 0, sizeof(m_login_account_name));
|
||||||
memset(plskey, 0, sizeof(plskey));
|
memset(m_key, 0, sizeof(m_key));
|
||||||
pworldadmin = 0;
|
m_world_admin = 0;
|
||||||
|
|
||||||
paccountid = 0;
|
m_account_id = 0;
|
||||||
memset(paccountname, 0, sizeof(paccountname));
|
memset(m_account_name, 0, sizeof(m_account_name));
|
||||||
padmin = AccountStatus::Player;
|
m_admin = AccountStatus::Player;
|
||||||
}
|
}
|
||||||
pzoneserver = 0;
|
m_zone_server = 0;
|
||||||
pzone = 0;
|
m_zone = 0;
|
||||||
pcharid = 0;
|
m_char_id = 0;
|
||||||
memset(pname, 0, sizeof(pname));
|
memset(m_char_name, 0, sizeof(m_char_name));
|
||||||
plevel = 0;
|
m_level = 0;
|
||||||
pclass_ = 0;
|
m_class_ = 0;
|
||||||
prace = 0;
|
m_race = 0;
|
||||||
panon = 0;
|
m_anon = 0;
|
||||||
ptellsoff = 0;
|
m_tells_off = 0;
|
||||||
pguild_id = GUILD_NONE;
|
m_guild_id = GUILD_NONE;
|
||||||
pguild_rank = 0;
|
m_guild_rank = 0;
|
||||||
pLFG = 0;
|
m_lfg = 0;
|
||||||
gm = 0;
|
m_gm = 0;
|
||||||
pClientVersion = 0;
|
m_client_version = 0;
|
||||||
for (auto& elem : tell_queue) {
|
for (auto &elem: m_tell_queue) {
|
||||||
safe_delete_array(elem);
|
safe_delete_array(elem);
|
||||||
}
|
}
|
||||||
tell_queue.clear();
|
m_tell_queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientListEntry::Camp(ZoneServer *iZS)
|
void ClientListEntry::Camp(ZoneServer *iZS)
|
||||||
{
|
{
|
||||||
if (iZS != 0 && iZS != pzoneserver) {
|
if (iZS != 0 && iZS != m_zone_server) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pzoneserver) {
|
if (m_zone_server) {
|
||||||
pzoneserver->RemovePlayer();
|
m_zone_server->RemovePlayer();
|
||||||
LSUpdate(pzoneserver);
|
LSUpdate(m_zone_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearVars();
|
ClearVars();
|
||||||
|
|
||||||
stale = 0;
|
m_stale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClientListEntry::CheckStale()
|
bool ClientListEntry::CheckStale()
|
||||||
{
|
{
|
||||||
stale++;
|
m_stale++;
|
||||||
if (stale > 20) {
|
if (m_stale > 20) {
|
||||||
if (pOnline > CLE_Status::Offline) {
|
if (m_online > CLE_Status::Offline) {
|
||||||
SetOnline(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)
|
bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_password)
|
||||||
{
|
{
|
||||||
LogDebug(
|
LogDebug(
|
||||||
"ls_account_id [{0}] key_password [{1}] plskey [{2}]",
|
"ls_account_id [{}] key_password [{}] key [{}]",
|
||||||
loginserver_account_id,
|
loginserver_account_id,
|
||||||
key_password,
|
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(
|
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,
|
loginserver_account_id,
|
||||||
key_password,
|
key_password,
|
||||||
plskey,
|
m_key,
|
||||||
LSID(),
|
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;
|
int16 default_account_status = WorldConfig::get()->DefaultStatus;
|
||||||
|
|
||||||
paccountid = database.CreateAccount(
|
m_account_id = database.CreateAccount(
|
||||||
loginserver_account_name,
|
m_login_account_name,
|
||||||
std::string(),
|
std::string(),
|
||||||
default_account_status,
|
default_account_status,
|
||||||
source_loginserver,
|
m_source_loginserver,
|
||||||
LSID()
|
LSID()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!paccountid) {
|
if (!m_account_id) {
|
||||||
LogInfo(
|
LogError(
|
||||||
"Error adding local account for LS login: [{0}:{1}], duplicate name",
|
"Error adding local account for LS login [{}] [{}], duplicate name",
|
||||||
source_loginserver,
|
m_source_loginserver,
|
||||||
loginserver_account_name
|
m_login_account_name
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
strn0cpy(paccountname, loginserver_account_name, sizeof(paccountname));
|
strn0cpy(m_account_name, m_login_account_name, sizeof(m_account_name));
|
||||||
padmin = default_account_status;
|
m_admin = default_account_status;
|
||||||
}
|
}
|
||||||
std::string lsworldadmin;
|
std::string lsworldadmin;
|
||||||
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
if (database.GetVariable("honorlsworldadmin", lsworldadmin)) {
|
||||||
if (Strings::ToInt(lsworldadmin) == 1 && pworldadmin != 0 && (padmin < pworldadmin || padmin == AccountStatus::Player)) {
|
if (Strings::ToInt(lsworldadmin) == 1 && m_world_admin != 0 &&
|
||||||
padmin = pworldadmin;
|
(m_admin < m_world_admin || m_admin == AccountStatus::Player)) {
|
||||||
|
m_admin = m_world_admin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -380,8 +358,8 @@ void ClientListEntry::ProcessTellQueue()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ServerPacket *pack;
|
ServerPacket *pack;
|
||||||
auto it = tell_queue.begin();
|
auto it = m_tell_queue.begin();
|
||||||
while (it != tell_queue.end()) {
|
while (it != m_tell_queue.end()) {
|
||||||
pack = new ServerPacket(
|
pack = new ServerPacket(
|
||||||
ServerOP_ChannelMessage,
|
ServerOP_ChannelMessage,
|
||||||
sizeof(ServerChannelMessage_Struct) + strlen((*it)->message) + 1
|
sizeof(ServerChannelMessage_Struct) + strlen((*it)->message) + 1
|
||||||
@@ -390,8 +368,7 @@ void ClientListEntry::ProcessTellQueue()
|
|||||||
Server()->SendPacket(pack);
|
Server()->SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
safe_delete_array(*it);
|
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 "../common/rulesys.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
Never,
|
Never,
|
||||||
Offline,
|
Offline,
|
||||||
Online,
|
Online,
|
||||||
@@ -18,7 +17,7 @@ typedef enum
|
|||||||
InZone
|
InZone
|
||||||
} CLE_Status;
|
} CLE_Status;
|
||||||
|
|
||||||
static const char * CLEStatusString[] = {
|
static const char *CLEStatusString[] = {
|
||||||
"Never",
|
"Never",
|
||||||
"Offline",
|
"Offline",
|
||||||
"Online",
|
"Online",
|
||||||
@@ -33,150 +32,133 @@ struct ServerClientList_Struct;
|
|||||||
class ClientListEntry {
|
class ClientListEntry {
|
||||||
public:
|
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(
|
ClientListEntry(
|
||||||
uint32 id,
|
uint32 id,
|
||||||
uint32 in_loginserver_id,
|
uint32 login_server_id,
|
||||||
const char *in_loginserver_name,
|
const char *login_server_name,
|
||||||
const char *in_login_name,
|
const char *account_name,
|
||||||
const char *in_login_key,
|
const char *login_key,
|
||||||
int16 in_is_world_admin = 0,
|
int16 is_world_admin = 0,
|
||||||
uint32 ip = 0,
|
uint32 ip_address = 0,
|
||||||
uint8 local = 0
|
uint8 local = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
ClientListEntry(uint32 id, ZoneServer *z, ServerClientList_Struct *scl, CLE_Status online);
|
||||||
* @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();
|
~ClientListEntry();
|
||||||
bool CheckStale();
|
bool CheckStale();
|
||||||
void Update(ZoneServer* zoneserver, ServerClientList_Struct* scl, CLE_Status iOnline = CLE_Status::InZone);
|
void Update(ZoneServer *zoneserver, ServerClientList_Struct *scl, CLE_Status iOnline = CLE_Status::InZone);
|
||||||
void LSUpdate(ZoneServer* zoneserver);
|
void LSUpdate(ZoneServer *zoneserver);
|
||||||
void LSZoneChange(ZoneToZone_Struct* ztz);
|
void LSZoneChange(ZoneToZone_Struct *ztz);
|
||||||
bool CheckAuth(uint32 loginserver_account_id, const char* key_password);
|
bool CheckAuth(uint32 loginserver_account_id, const char *key_password);
|
||||||
void SetOnline(CLE_Status iOnline = CLE_Status::Online);
|
void SetOnline(CLE_Status iOnline = CLE_Status::Online);
|
||||||
void SetChar(uint32 iCharID, const char* iCharName);
|
void SetChar(uint32 iCharID, const char *iCharName);
|
||||||
inline CLE_Status Online() { return pOnline; }
|
inline CLE_Status Online() { return m_online; }
|
||||||
inline const uint32 GetID() const { return id; }
|
inline const uint32 GetID() const { return m_id; }
|
||||||
inline const uint32 GetIP() const { return pIP; }
|
inline const uint32 GetIP() const { return m_ip_address; }
|
||||||
inline void SetIP(const uint32& iIP) { pIP = iIP; }
|
inline void SetIP(const uint32 &iIP) { m_ip_address = iIP; }
|
||||||
inline void KeepAlive() { stale = 0; }
|
inline void KeepAlive() { m_stale = 0; }
|
||||||
inline uint8 GetStaleCounter() const { return stale; }
|
inline uint8 GetStaleCounter() const { return m_stale; }
|
||||||
void LeavingZone(ZoneServer* iZS = 0, CLE_Status iOnline = CLE_Status::Offline);
|
void LeavingZone(ZoneServer *iZS = 0, CLE_Status iOnline = CLE_Status::Offline);
|
||||||
void Camp(ZoneServer* iZS = 0);
|
void Camp(ZoneServer *iZS = 0);
|
||||||
|
|
||||||
// Login Server stuff
|
// Login Server stuff
|
||||||
inline const char* LoginServer() const { return source_loginserver; }
|
inline const char *LoginServer() const { return m_source_loginserver; }
|
||||||
inline uint32 LSID() const { return pLSID; }
|
inline uint32 LSID() const { return m_login_server_id; }
|
||||||
inline uint32 LSAccountID() const { return pLSID; }
|
inline uint32 LSAccountID() const { return m_login_server_id; }
|
||||||
inline const char* LSName() const { return loginserver_account_name; }
|
inline const char *LSName() const { return m_login_account_name; }
|
||||||
inline int16 WorldAdmin() const { return pworldadmin; }
|
inline int16 WorldAdmin() const { return m_world_admin; }
|
||||||
inline const char* GetLSKey() const { return plskey; }
|
inline const char *GetLSKey() const { return m_key; }
|
||||||
inline const CLE_Status GetOnline() const { return pOnline; }
|
inline const CLE_Status GetOnline() const { return m_online; }
|
||||||
|
|
||||||
// Account stuff
|
// Account stuff
|
||||||
inline uint32 AccountID() const { return paccountid; }
|
inline uint32 AccountID() const { return m_account_id; }
|
||||||
inline const char* AccountName() const { return paccountname; }
|
inline const char *AccountName() const { return m_account_name; }
|
||||||
inline int16 Admin() const { return padmin; }
|
inline int16 Admin() const { return m_admin; }
|
||||||
inline void SetAdmin(uint16 iAdmin) { padmin = iAdmin; }
|
inline void SetAdmin(uint16 iAdmin) { m_admin = iAdmin; }
|
||||||
|
|
||||||
// Character info
|
// Character info
|
||||||
inline ZoneServer *Server() const { return pzoneserver; }
|
inline ZoneServer *Server() const { return m_zone_server; }
|
||||||
inline void ClearServer() { pzoneserver = 0; }
|
inline void ClearServer() { m_zone_server = 0; }
|
||||||
inline uint32 CharID() const { return pcharid; }
|
inline uint32 CharID() const { return m_char_id; }
|
||||||
inline const char *name() const { return pname; }
|
inline const char *name() const { return m_char_name; }
|
||||||
inline uint32 zone() const { return pzone; }
|
inline uint32 zone() const { return m_zone; }
|
||||||
inline uint16 instance() const { return pinstance; }
|
inline uint16 instance() const { return m_instance; }
|
||||||
inline uint8 level() const { return plevel; }
|
inline uint8 level() const { return m_level; }
|
||||||
inline uint8 class_() const { return pclass_; }
|
inline uint8 class_() const { return m_class_; }
|
||||||
inline uint16 race() const { return prace; }
|
inline uint16 race() const { return m_race; }
|
||||||
inline uint8 Anon() { return panon; }
|
inline uint8 Anon() { return m_anon; }
|
||||||
inline uint8 TellsOff() const { return ptellsoff; }
|
inline uint8 TellsOff() const { return m_tells_off; }
|
||||||
inline uint32 GuildID() const { return pguild_id; }
|
inline uint32 GuildID() const { return m_guild_id; }
|
||||||
inline uint32 GuildRank() const { return pguild_rank; }
|
inline uint32 GuildRank() const { return m_guild_rank; }
|
||||||
inline bool GuildTributeOptIn() const { return pguild_tribute_opt_in; }
|
inline bool GuildTributeOptIn() const { return m_guild_tribute_opt_in; }
|
||||||
inline void SetGuild(uint32 guild_id) { pguild_id = guild_id; }
|
inline void SetGuild(uint32 guild_id) { m_guild_id = guild_id; }
|
||||||
inline void SetGuildTributeOptIn(bool opt) { pguild_tribute_opt_in = opt; }
|
inline void SetGuildTributeOptIn(bool opt) { m_guild_tribute_opt_in = opt; }
|
||||||
inline bool LFG() const { return pLFG; }
|
inline bool LFG() const { return m_lfg; }
|
||||||
inline uint8 GetGM() const { return gm; }
|
inline uint8 GetGM() const { return m_gm; }
|
||||||
inline void SetGM(uint8 igm) { gm = igm; }
|
inline void SetGM(uint8 igm) { m_gm = igm; }
|
||||||
inline void SetZone(uint32 zone) { pzone = zone; }
|
inline void SetZone(uint32 zone) { m_zone = zone; }
|
||||||
inline bool IsLocalClient() const { return plocal; }
|
inline bool IsLocalClient() const { return m_is_local; }
|
||||||
inline uint8 GetLFGFromLevel() const { return pLFGFromLevel; }
|
inline uint8 GetLFGFromLevel() const { return m_lfg_from_level; }
|
||||||
inline uint8 GetLFGToLevel() const { return pLFGToLevel; }
|
inline uint8 GetLFGToLevel() const { return m_lfg_to_level; }
|
||||||
inline bool GetLFGMatchFilter() const { return pLFGMatchFilter; }
|
inline bool GetLFGMatchFilter() const { return m_lfg_match_filter; }
|
||||||
inline const char *GetLFGComments() const { return pLFGComments; }
|
inline const char *GetLFGComments() const { return m_lfg_comments; }
|
||||||
inline uint8 GetClientVersion() { return pClientVersion; }
|
inline uint8 GetClientVersion() { return m_client_version; }
|
||||||
|
|
||||||
inline bool TellQueueFull() const { return tell_queue.size() >= RuleI(World, TellQueueSize); }
|
inline bool TellQueueFull() const { return m_tell_queue.size() >= RuleI(World, TellQueueSize); }
|
||||||
inline bool TellQueueEmpty() const { return tell_queue.empty(); }
|
inline bool TellQueueEmpty() const { return m_tell_queue.empty(); }
|
||||||
inline void PushToTellQueue(ServerChannelMessage_Struct *scm) { tell_queue.push_back(scm); }
|
inline void PushToTellQueue(ServerChannelMessage_Struct *scm) { m_tell_queue.push_back(scm); }
|
||||||
void ProcessTellQueue();
|
void ProcessTellQueue();
|
||||||
|
|
||||||
void SetPendingExpeditionInvite(ServerPacket* pack) { p_pending_expedition_invite.reset(pack->Copy()); };
|
void SetPendingDzInvite(ServerPacket *pack) { m_dz_invite.reset(pack->Copy()); };
|
||||||
std::unique_ptr<ServerPacket> GetPendingExpeditionInvite() { return std::move(p_pending_expedition_invite); }
|
std::unique_ptr<ServerPacket> GetPendingDzInvite() { return std::move(m_dz_invite); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ClearVars(bool iAll = false);
|
void ClearVars(bool iAll = false);
|
||||||
|
|
||||||
const uint32 id;
|
const uint32 m_id;
|
||||||
uint32 pIP;
|
uint32 m_ip_address;
|
||||||
CLE_Status pOnline;
|
CLE_Status m_online;
|
||||||
uint8 stale;
|
uint8 m_stale;
|
||||||
|
|
||||||
// Login Server stuff
|
// Login Server stuff
|
||||||
char source_loginserver[64]{}; //Loginserver we came from.
|
char m_source_loginserver[64]{}; //Loginserver we came from.
|
||||||
uint32 pLSID;
|
uint32 m_login_server_id;
|
||||||
char loginserver_account_name[32]{};
|
char m_login_account_name[32]{};
|
||||||
char plskey[16]{};
|
char m_key[16]{};
|
||||||
int16 pworldadmin; // Login server's suggested admin status setting
|
int16 m_world_admin; // Login server's suggested admin status setting
|
||||||
bool plocal;
|
bool m_is_local;
|
||||||
|
|
||||||
// Account stuff
|
// Account stuff
|
||||||
uint32 paccountid;
|
uint32 m_account_id;
|
||||||
char paccountname[32]{};
|
char m_account_name[32]{};
|
||||||
int16 padmin{};
|
int16 m_admin{};
|
||||||
|
|
||||||
// Character info
|
// Character info
|
||||||
ZoneServer* pzoneserver{};
|
ZoneServer *m_zone_server{};
|
||||||
uint32 pzone{};
|
uint32 m_zone{};
|
||||||
uint16 pinstance{};
|
uint16 m_instance{};
|
||||||
uint32 pcharid{};
|
uint32 m_char_id{};
|
||||||
char pname[64]{};
|
char m_char_name[64]{};
|
||||||
uint8 plevel{};
|
uint8 m_level{};
|
||||||
uint8 pclass_{};
|
uint8 m_class_{};
|
||||||
uint16 prace{};
|
uint16 m_race{};
|
||||||
uint8 panon{};
|
uint8 m_anon{};
|
||||||
uint8 ptellsoff{};
|
uint8 m_tells_off{};
|
||||||
uint32 pguild_id{};
|
uint32 m_guild_id{};
|
||||||
uint32 pguild_rank;
|
uint32 m_guild_rank;
|
||||||
bool pguild_tribute_opt_in{};
|
bool m_guild_tribute_opt_in{};
|
||||||
bool pLFG{};
|
bool m_lfg{};
|
||||||
uint8 gm{};
|
uint8 m_gm{};
|
||||||
uint8 pClientVersion{};
|
uint8 m_client_version{};
|
||||||
uint8 pLFGFromLevel{};
|
uint8 m_lfg_from_level{};
|
||||||
uint8 pLFGToLevel{};
|
uint8 m_lfg_to_level{};
|
||||||
bool pLFGMatchFilter{};
|
bool m_lfg_match_filter{};
|
||||||
char pLFGComments[64]{};
|
char m_lfg_comments[64]{};
|
||||||
|
|
||||||
// Tell Queue -- really a vector :D
|
// 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_*/
|
#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) {
|
void ClientList::CLEAdd(
|
||||||
auto tmp = new ClientListEntry(GetNextCLEID(), iLSID, iLoginServerName, iLoginName, iLoginKey, iWorldAdmin, ip, local);
|
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);
|
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);
|
LinkedListIterator<ClientListEntry *> iterator(clientlist);
|
||||||
|
|
||||||
iterator.Reset();
|
iterator.Reset();
|
||||||
while (iterator.MoreElements()) {
|
while (iterator.MoreElements()) {
|
||||||
if (iterator.GetData()->CheckAuth(iLSID, iKey)) {
|
if (iterator.GetData()->CheckAuth(loginserver_account_id, key)) {
|
||||||
return iterator.GetData();
|
return iterator.GetData();
|
||||||
}
|
}
|
||||||
iterator.Advance();
|
iterator.Advance();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
|
void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
|
||||||
@@ -1717,13 +1735,13 @@ void ClientList::SendCharacterMessageID(ClientListEntry* character,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SerializeBuffer serialized_args;
|
SerializeBuffer argbuf;
|
||||||
for (const auto& arg : args)
|
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;
|
uint32_t pack_size = sizeof(CZClientMessageString_Struct) + args_size;
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_CZClientMessageString, pack_size);
|
auto pack = std::make_unique<ServerPacket>(ServerOP_CZClientMessageString, pack_size);
|
||||||
auto buf = reinterpret_cast<CZClientMessageString_Struct*>(pack->pBuffer);
|
auto buf = reinterpret_cast<CZClientMessageString_Struct*>(pack->pBuffer);
|
||||||
@@ -1731,7 +1749,10 @@ void ClientList::SendCharacterMessageID(ClientListEntry* character,
|
|||||||
buf->chat_type = chat_type;
|
buf->chat_type = chat_type;
|
||||||
strn0cpy(buf->client_name, character->name(), sizeof(buf->client_name));
|
strn0cpy(buf->client_name, character->name(), sizeof(buf->client_name));
|
||||||
buf->args_size = args_size;
|
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());
|
character->Server()->SendPacket(pack.get());
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
void ClientUpdate(ZoneServer* zoneserver, ServerClientList_Struct* scl);
|
void ClientUpdate(ZoneServer* zoneserver, ServerClientList_Struct* scl);
|
||||||
void CLERemoveZSRef(ZoneServer* iZS);
|
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* FindCharacter(const char* name);
|
||||||
ClientListEntry* FindCLEByAccountID(uint32 iAccID);
|
ClientListEntry* FindCLEByAccountID(uint32 iAccID);
|
||||||
ClientListEntry* FindCLEByCharacterID(uint32 iCharID);
|
ClientListEntry* FindCLEByCharacterID(uint32 iCharID);
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
void DisconnectByIP(uint32 in_ip);
|
void DisconnectByIP(uint32 in_ip);
|
||||||
void CLCheckStale();
|
void CLCheckStale();
|
||||||
void CLEKeepAlive(uint32 numupdates, uint32* wid);
|
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);
|
void UpdateClientGuild(uint32 char_id, uint32 guild_id);
|
||||||
bool IsAccountInGame(uint32 iLSID);
|
bool IsAccountInGame(uint32 iLSID);
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -911,11 +911,7 @@ void ConsoleReloadWorld(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
connection->SendLine("Reloading World...");
|
connection->SendLine("Reloading World...");
|
||||||
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
|
zoneserver_list.SendServerReload(ServerReload::Type::WorldRepop, nullptr);
|
||||||
ReloadWorld_Struct *RW = (ReloadWorld_Struct *) pack->pBuffer;
|
|
||||||
RW->global_repop = ReloadWorld::Repop;
|
|
||||||
zoneserver_list.SendPacket(pack);
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto debounce_reload = std::chrono::system_clock::now();
|
auto debounce_reload = std::chrono::system_clock::now();
|
||||||
|
|||||||
+2
-128
@@ -164,132 +164,6 @@ void DynamicZone::SendZonesLeaderChanged()
|
|||||||
zoneserver_list.SendPacket(pack.get());
|
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)
|
void DynamicZone::ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed)
|
||||||
{
|
{
|
||||||
DynamicZoneBase::ProcessMemberAddRemove(member, removed);
|
DynamicZoneBase::ProcessMemberAddRemove(member, removed);
|
||||||
@@ -345,13 +219,13 @@ void DynamicZone::SendZoneMemberStatuses(uint16_t zone_id, uint16_t instance_id)
|
|||||||
|
|
||||||
void DynamicZone::CacheMemberStatuses()
|
void DynamicZone::CacheMemberStatuses()
|
||||||
{
|
{
|
||||||
if (m_has_member_statuses)
|
if (m_has_member_statuses || m_members.empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when a new dz is cached to fill member statuses
|
// called when a new dz is cached to fill member statuses
|
||||||
std::string zone_name{};
|
std::string zone_name;
|
||||||
std::vector<ClientListEntry*> all_clients;
|
std::vector<ClientListEntry*> all_clients;
|
||||||
all_clients.reserve(client_list.GetClientCount());
|
all_clients.reserve(client_list.GetClientCount());
|
||||||
client_list.GetClients(zone_name.c_str(), all_clients);
|
client_list.GetClients(zone_name.c_str(), all_clients);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public:
|
|||||||
using DynamicZoneBase::DynamicZoneBase; // inherit base constructors
|
using DynamicZoneBase::DynamicZoneBase; // inherit base constructors
|
||||||
|
|
||||||
static DynamicZone* FindDynamicZoneByID(uint32_t dz_id);
|
static DynamicZone* FindDynamicZoneByID(uint32_t dz_id);
|
||||||
static void HandleZoneMessage(ServerPacket* pack);
|
|
||||||
|
|
||||||
void SetSecondsRemaining(uint32_t seconds_remaining) override;
|
void SetSecondsRemaining(uint32_t seconds_remaining) override;
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
Database& GetDatabase() override;
|
Database& GetDatabase() override;
|
||||||
void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed) 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;
|
bool SendServerPacket(ServerPacket* packet) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
+280
-39
@@ -1,12 +1,14 @@
|
|||||||
#include "dynamic_zone_manager.h"
|
#include "dynamic_zone_manager.h"
|
||||||
#include "dynamic_zone.h"
|
#include "dynamic_zone.h"
|
||||||
|
#include "cliententry.h"
|
||||||
|
#include "clientlist.h"
|
||||||
#include "worlddb.h"
|
#include "worlddb.h"
|
||||||
#include "zonelist.h"
|
#include "zonelist.h"
|
||||||
#include "zoneserver.h"
|
#include "zoneserver.h"
|
||||||
#include "../common/rulesys.h"
|
#include "../common/rulesys.h"
|
||||||
#include "../common/repositories/expeditions_repository.h"
|
#include "../common/repositories/dynamic_zone_lockouts_repository.h"
|
||||||
#include "../common/repositories/expedition_lockouts_repository.h"
|
|
||||||
|
|
||||||
|
extern ClientList client_list;
|
||||||
extern ZSList zoneserver_list;
|
extern ZSList zoneserver_list;
|
||||||
|
|
||||||
DynamicZoneManager dynamic_zone_manager;
|
DynamicZoneManager dynamic_zone_manager;
|
||||||
@@ -27,6 +29,8 @@ void DynamicZoneManager::PurgeExpiredDynamicZones()
|
|||||||
{
|
{
|
||||||
LogDynamicZones("Purging [{}] dynamic zone(s)", dz_ids.size());
|
LogDynamicZones("Purging [{}] dynamic zone(s)", dz_ids.size());
|
||||||
|
|
||||||
|
DynamicZoneLockoutsRepository::DeleteWhere(database,
|
||||||
|
fmt::format("dynamic_zone_id IN ({})", fmt::join(dz_ids, ",")));
|
||||||
DynamicZoneMembersRepository::DeleteWhere(database,
|
DynamicZoneMembersRepository::DeleteWhere(database,
|
||||||
fmt::format("dynamic_zone_id IN ({})", Strings::Join(dz_ids, ",")));
|
fmt::format("dynamic_zone_id IN ({})", Strings::Join(dz_ids, ",")));
|
||||||
DynamicZonesRepository::DeleteWhere(database,
|
DynamicZonesRepository::DeleteWhere(database,
|
||||||
@@ -34,8 +38,7 @@ void DynamicZoneManager::PurgeExpiredDynamicZones()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicZone* DynamicZoneManager::CreateNew(
|
DynamicZone* DynamicZoneManager::TryCreate(DynamicZone& dz_request, const std::vector<DynamicZoneMember>& members)
|
||||||
DynamicZone& dz_request, const std::vector<DynamicZoneMember>& members)
|
|
||||||
{
|
{
|
||||||
// this creates a new dz instance and saves it to both db and cache
|
// this creates a new dz instance and saves it to both db and cache
|
||||||
uint32_t dz_id = dz_request.Create();
|
uint32_t dz_id = dz_request.Create();
|
||||||
@@ -46,15 +49,12 @@ DynamicZone* DynamicZoneManager::CreateNew(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto dz = std::make_unique<DynamicZone>(dz_request);
|
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());
|
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());
|
zoneserver_list.SendPacket(pack.get());
|
||||||
|
|
||||||
auto inserted = dynamic_zone_cache.emplace(dz_id, std::move(dz));
|
auto inserted = dynamic_zone_cache.emplace(dz_id, std::move(dz));
|
||||||
@@ -63,18 +63,17 @@ DynamicZone* DynamicZoneManager::CreateNew(
|
|||||||
|
|
||||||
void DynamicZoneManager::CacheNewDynamicZone(ServerPacket* pack)
|
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>();
|
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();
|
new_dz->CacheMemberStatuses();
|
||||||
|
|
||||||
// reserialize with member statuses cached before forwarding (restore origin zone)
|
// 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(buf->dz_id, std::move(new_dz));
|
||||||
dynamic_zone_cache.emplace(dz_id, std::move(new_dz));
|
LogDynamicZones("Cached new dynamic zone [{}]", buf->dz_id);
|
||||||
LogDynamicZones("Cached new dynamic zone [{}]", dz_id);
|
|
||||||
|
|
||||||
zoneserver_list.SendPacket(repack.get());
|
zoneserver_list.SendPacket(repack.get());
|
||||||
}
|
}
|
||||||
@@ -83,18 +82,19 @@ void DynamicZoneManager::CacheAllFromDatabase()
|
|||||||
{
|
{
|
||||||
BenchTimer bench;
|
BenchTimer bench;
|
||||||
|
|
||||||
auto dynamic_zones = DynamicZonesRepository::AllWithInstanceNotExpired(database);
|
auto dzs = DynamicZonesRepository::AllWithInstanceNotExpired(database);
|
||||||
auto dynamic_zone_members = DynamicZoneMembersRepository::GetAllWithNames(database);
|
auto members = DynamicZoneMembersRepository::AllWithNames(database);
|
||||||
|
auto lockouts = DynamicZoneLockoutsRepository::All(database);
|
||||||
|
|
||||||
dynamic_zone_cache.clear();
|
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;
|
uint32_t dz_id = entry.id;
|
||||||
auto dz = std::make_unique<DynamicZone>(std::move(entry));
|
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)
|
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)
|
// note leader status won't be updated here until leader is set by owning system (expeditions)
|
||||||
dz->CacheMemberStatuses();
|
dz->CacheMemberStatuses();
|
||||||
|
|
||||||
@@ -142,24 +150,10 @@ void DynamicZoneManager::Process()
|
|||||||
dynamic_zone_cache.erase(dz_id);
|
dynamic_zone_cache.erase(dz_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to look up expedition ids until lockouts are moved to dynamic zones
|
DynamicZoneLockoutsRepository::DeleteWhere(database,
|
||||||
std::vector<uint32_t> expedition_ids;
|
fmt::format("dynamic_zone_id IN ({})", fmt::join(dynamic_zone_ids, ",")));
|
||||||
auto expeditions = ExpeditionsRepository::GetWhere(database,
|
DynamicZoneMembersRepository::DeleteWhere(database,
|
||||||
fmt::format("dynamic_zone_id IN ({})", Strings::Join(dynamic_zone_ids, ",")));
|
fmt::format("dynamic_zone_id IN ({})", fmt::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);
|
|
||||||
DynamicZonesRepository::DeleteWhere(database,
|
DynamicZonesRepository::DeleteWhere(database,
|
||||||
fmt::format("id IN ({})", Strings::Join(dynamic_zone_ids, ",")));
|
fmt::format("id IN ({})", Strings::Join(dynamic_zone_ids, ",")));
|
||||||
}
|
}
|
||||||
@@ -174,3 +168,250 @@ void DynamicZoneManager::LoadTemplates()
|
|||||||
m_dz_templates[dz_template.id] = dz_template;
|
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 CacheAllFromDatabase();
|
||||||
void CacheNewDynamicZone(ServerPacket* pack);
|
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 LoadTemplates();
|
||||||
void Process();
|
void Process();
|
||||||
void PurgeExpiredDynamicZones();
|
void PurgeExpiredDynamicZones();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "zoneserver.h"
|
#include "zoneserver.h"
|
||||||
#include "zonelist.h"
|
#include "zonelist.h"
|
||||||
#include "../common/database_schema.h"
|
#include "../common/database_schema.h"
|
||||||
|
#include "../common/server_reload_types.h"
|
||||||
#include "../common/zone_store.h"
|
#include "../common/zone_store.h"
|
||||||
#include "worlddb.h"
|
#include "worlddb.h"
|
||||||
#include "wguild_mgr.h"
|
#include "wguild_mgr.h"
|
||||||
@@ -113,136 +114,47 @@ void callGetClientList(Json::Value &response)
|
|||||||
client_list.GetClientList(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)
|
void getReloadTypes(Json::Value &response)
|
||||||
{
|
{
|
||||||
for (auto &c: reload_types) {
|
for (auto &t: ServerReload::GetTypes()) {
|
||||||
Json::Value v;
|
Json::Value v;
|
||||||
|
|
||||||
v["command"] = c.command;
|
v["command"] = std::to_string(t);
|
||||||
v["opcode"] = c.opcode;
|
v["description"] = ServerReload::GetName(t);
|
||||||
v["description"] = c.desc;
|
|
||||||
response.append(v);
|
response.append(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::string> &args)
|
void EQEmuApiWorldDataService::reload(Json::Value &r, const std::vector<std::string> &args)
|
||||||
{
|
{
|
||||||
std::vector<std::string> commands{};
|
std::vector<std::string> commands{};
|
||||||
commands.reserve(reload_types.size());
|
commands.reserve(ServerReload::GetTypes().size());
|
||||||
for (auto &c: reload_types) {
|
for (auto &c: ServerReload::GetTypes()) {
|
||||||
commands.emplace_back(c.command);
|
commands.emplace_back(std::to_string(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string command = !args[1].empty() ? args[1] : "";
|
std::string command = !args[1].empty() ? args[1] : "";
|
||||||
if (command.empty()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerPacket *pack = nullptr;
|
ServerPacket *pack = nullptr;
|
||||||
|
|
||||||
bool found_command = false;
|
bool found_command = false;
|
||||||
for (auto &c: reload_types) {
|
|
||||||
if (command == c.command) {
|
|
||||||
if (c.command == "world") {
|
|
||||||
uint8 global_repop = ReloadWorld::NoRepop;
|
|
||||||
|
|
||||||
if (Strings::IsNumber(args[2])) {
|
for (auto &t: ServerReload::GetTypes()) {
|
||||||
global_repop = static_cast<uint8>(Strings::ToUnsignedInt(args[2]));
|
if (std::to_string(t) == command || Strings::ToLower(ServerReload::GetName(t)) == command) {
|
||||||
|
message(r, fmt::format("Reloading [{}] globally", ServerReload::GetName(t)));
|
||||||
if (global_repop > ReloadWorld::ForceRepop) {
|
zoneserver_list.SendServerReload(t, nullptr);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
found_command = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found_command) {
|
if (!found_command) {
|
||||||
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 to reload. Example(s) [{}]", Strings::Implode("|", commands)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pack) {
|
|
||||||
zoneserver_list.SendPacket(pack);
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQEmuApiWorldDataService::message(Json::Value &r, const std::string &message)
|
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();
|
const WorldConfig *Config = WorldConfig::get();
|
||||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||||
|
|
||||||
UsertoWorldRequestLegacy_Struct *utwr = (UsertoWorldRequestLegacy_Struct *) p.Data();
|
UsertoWorldRequestLegacy *utwr = (UsertoWorldRequestLegacy *) p.Data();
|
||||||
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
|
uint32 id = database.GetAccountIDFromLSID("eqemu", utwr->lsaccountid);
|
||||||
int16 status = database.GetAccountStatus(id);
|
int16 status = database.GetAccountStatus(id);
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
@@ -63,11 +63,11 @@ void LoginServer::ProcessUsertoWorldReqLeg(uint16_t opcode, EQ::Net::Packet &p)
|
|||||||
|
|
||||||
ServerPacket outpack;
|
ServerPacket outpack;
|
||||||
outpack.opcode = ServerOP_UsertoWorldRespLeg;
|
outpack.opcode = ServerOP_UsertoWorldRespLeg;
|
||||||
outpack.size = sizeof(UsertoWorldResponseLegacy_Struct);
|
outpack.size = sizeof(UsertoWorldResponseLegacy);
|
||||||
outpack.pBuffer = new uchar[outpack.size];
|
outpack.pBuffer = new uchar[outpack.size];
|
||||||
memset(outpack.pBuffer, 0, 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->lsaccountid = utwr->lsaccountid;
|
||||||
utwrs->ToID = utwr->FromID;
|
utwrs->ToID = utwr->FromID;
|
||||||
utwrs->worldid = utwr->worldid;
|
utwrs->worldid = utwr->worldid;
|
||||||
@@ -126,8 +126,8 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
|
|||||||
const WorldConfig *Config = WorldConfig::get();
|
const WorldConfig *Config = WorldConfig::get();
|
||||||
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||||
|
|
||||||
UsertoWorldRequest_Struct *utwr = (UsertoWorldRequest_Struct *) p.Data();
|
UsertoWorldRequest *utwr = (UsertoWorldRequest *) p.Data();
|
||||||
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
|
uint32 id = database.GetAccountIDFromLSID(utwr->login, utwr->lsaccountid);
|
||||||
int16 status = database.GetAccountStatus(id);
|
int16 status = database.GetAccountStatus(id);
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
@@ -143,11 +143,11 @@ void LoginServer::ProcessUsertoWorldReq(uint16_t opcode, EQ::Net::Packet &p)
|
|||||||
|
|
||||||
ServerPacket outpack;
|
ServerPacket outpack;
|
||||||
outpack.opcode = ServerOP_UsertoWorldResp;
|
outpack.opcode = ServerOP_UsertoWorldResp;
|
||||||
outpack.size = sizeof(UsertoWorldResponse_Struct);
|
outpack.size = sizeof(UsertoWorldResponse);
|
||||||
outpack.pBuffer = new uchar[outpack.size];
|
outpack.pBuffer = new uchar[outpack.size];
|
||||||
memset(outpack.pBuffer, 0, 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->lsaccountid = utwr->lsaccountid;
|
||||||
utwrs->ToID = utwr->FromID;
|
utwrs->ToID = utwr->FromID;
|
||||||
strn0cpy(utwrs->login, utwr->login, 64);
|
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);
|
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto client_authentication_request = p.GetSerialize<ClientAuthLegacy_Struct>(0);
|
auto r = p.GetSerialize<ClientAuthLegacy>(0);
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
"Processing Loginserver Auth Legacy | account_id [{0}] account_name [{1}] key [{2}] admin [{3}] ip [{4}] "
|
"Processing Loginserver Auth Legacy | account_id [{}] account_name [{}] key [{}] admin [{}] ip [{}] "
|
||||||
"local_network [{5}]",
|
"local_network [{}]",
|
||||||
client_authentication_request.loginserver_account_id,
|
r.loginserver_account_id,
|
||||||
client_authentication_request.loginserver_account_name,
|
r.loginserver_account_name,
|
||||||
client_authentication_request.key,
|
r.key,
|
||||||
client_authentication_request.is_world_admin,
|
r.is_world_admin,
|
||||||
client_authentication_request.ip,
|
r.ip_address,
|
||||||
client_authentication_request.is_client_from_local_network
|
r.is_client_from_local_network
|
||||||
);
|
);
|
||||||
|
|
||||||
client_list.CLEAdd(
|
client_list.CLEAdd(
|
||||||
client_authentication_request.loginserver_account_id,
|
r.loginserver_account_id,
|
||||||
"eqemu",
|
"eqemu",
|
||||||
client_authentication_request.loginserver_account_name,
|
r.loginserver_account_name,
|
||||||
client_authentication_request.key,
|
r.key,
|
||||||
client_authentication_request.is_world_admin,
|
r.is_world_admin,
|
||||||
client_authentication_request.ip,
|
r.ip_address,
|
||||||
client_authentication_request.is_client_from_local_network
|
r.is_client_from_local_network
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (std::exception &ex) {
|
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);
|
LogNetcode("Received ServerPacket from LS OpCode {:#04x}", opcode);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto client_authentication_request = p.GetSerialize<ClientAuth_Struct>(0);
|
auto r = p.GetSerialize<ClientAuth>(0);
|
||||||
|
|
||||||
LogDebug(
|
LogDebug(
|
||||||
"Processing Loginserver Auth | account_id [{0}] account_name [{1}] loginserver_name [{2}] key [{3}] "
|
"Processing Loginserver Auth | account_id [{}] account_name [{}] loginserver_name [{}] key [{}] "
|
||||||
"admin [{4}] ip [{5}] local_network [{6}]",
|
"admin [{}] ip [{}] local_network [{}]",
|
||||||
client_authentication_request.loginserver_account_id,
|
r.loginserver_account_id,
|
||||||
client_authentication_request.account_name,
|
r.account_name,
|
||||||
client_authentication_request.loginserver_name,
|
r.loginserver_name,
|
||||||
client_authentication_request.key,
|
r.key,
|
||||||
client_authentication_request.is_world_admin,
|
r.is_world_admin,
|
||||||
client_authentication_request.ip,
|
r.ip_address,
|
||||||
client_authentication_request.is_client_from_local_network
|
r.is_client_from_local_network
|
||||||
);
|
);
|
||||||
|
|
||||||
client_list.CLEAdd(
|
client_list.CLEAdd(
|
||||||
client_authentication_request.loginserver_account_id,
|
r.loginserver_account_id,
|
||||||
client_authentication_request.loginserver_name,
|
r.loginserver_name,
|
||||||
client_authentication_request.account_name,
|
r.account_name,
|
||||||
client_authentication_request.key,
|
r.key,
|
||||||
client_authentication_request.is_world_admin,
|
r.is_world_admin,
|
||||||
client_authentication_request.ip,
|
r.ip_address,
|
||||||
client_authentication_request.is_client_from_local_network
|
r.is_client_from_local_network
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch (std::exception &ex) {
|
catch (std::exception &ex) {
|
||||||
|
|||||||
+2
-2
@@ -76,10 +76,10 @@
|
|||||||
#include "web_interface.h"
|
#include "web_interface.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "dynamic_zone_manager.h"
|
#include "dynamic_zone_manager.h"
|
||||||
#include "expedition_database.h"
|
|
||||||
|
|
||||||
#include "world_server_cli.h"
|
#include "world_server_cli.h"
|
||||||
#include "../common/content/world_content_service.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/repositories/character_task_timers_repository.h"
|
||||||
#include "../common/zone_store.h"
|
#include "../common/zone_store.h"
|
||||||
#include "world_event_scheduler.h"
|
#include "world_event_scheduler.h"
|
||||||
@@ -449,7 +449,7 @@ int main(int argc, char **argv)
|
|||||||
if (PurgeInstanceTimer.Check()) {
|
if (PurgeInstanceTimer.Check()) {
|
||||||
database.PurgeExpiredInstances();
|
database.PurgeExpiredInstances();
|
||||||
database.PurgeAllDeletedDataBuckets();
|
database.PurgeAllDeletedDataBuckets();
|
||||||
ExpeditionDatabase::PurgeExpiredCharacterLockouts();
|
CharacterExpeditionLockoutsRepository::DeleteWhere(database, "expire_time <= NOW()");
|
||||||
CharacterTaskTimersRepository::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) {
|
if (new_dz) {
|
||||||
auto shared_task_dz = SharedTaskDynamicZonesRepository::NewEntity();
|
auto shared_task_dz = SharedTaskDynamicZonesRepository::NewEntity();
|
||||||
shared_task_dz.shared_task_id = shared_task->GetDbSharedTask().id;
|
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);
|
auto t = shared_task_manager.FindSharedTaskByTaskIdAndCharacterId(buf->task_id, buf->source_character_id);
|
||||||
if (t) {
|
if (t) {
|
||||||
DynamicZone dz;
|
DynamicZone dz;
|
||||||
dz.LoadSerializedDzPacket(buf->cereal_data, buf->cereal_size);
|
dz.Unserialize({ buf->cereal_data, buf->cereal_size });
|
||||||
|
|
||||||
shared_task_manager.CreateDynamicZone(t, dz);
|
shared_task_manager.CreateDynamicZone(t, dz);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-4
@@ -5,12 +5,12 @@
|
|||||||
#include "../common/http/uri.h"
|
#include "../common/http/uri.h"
|
||||||
#include "../common/net/console_server.h"
|
#include "../common/net/console_server.h"
|
||||||
#include "../common/net/servertalk_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/repositories/character_task_timers_repository.h"
|
||||||
#include "../common/rulesys.h"
|
#include "../common/rulesys.h"
|
||||||
#include "../common/strings.h"
|
#include "../common/strings.h"
|
||||||
#include "adventure_manager.h"
|
#include "adventure_manager.h"
|
||||||
#include "dynamic_zone_manager.h"
|
#include "dynamic_zone_manager.h"
|
||||||
#include "expedition_database.h"
|
|
||||||
#include "login_server_list.h"
|
#include "login_server_list.h"
|
||||||
#include "shared_task_manager.h"
|
#include "shared_task_manager.h"
|
||||||
#include "ucs.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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,9 +374,8 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
|||||||
LogInfo("Purging expired dynamic zones and members");
|
LogInfo("Purging expired dynamic zones and members");
|
||||||
dynamic_zone_manager.PurgeExpiredDynamicZones();
|
dynamic_zone_manager.PurgeExpiredDynamicZones();
|
||||||
|
|
||||||
LogInfo("Purging expired expeditions");
|
LogInfo("Purging expired character expedition lockouts");
|
||||||
ExpeditionDatabase::PurgeExpiredExpeditions();
|
CharacterExpeditionLockoutsRepository::DeleteWhere(database, "expire_time <= NOW()");
|
||||||
ExpeditionDatabase::PurgeExpiredCharacterLockouts();
|
|
||||||
|
|
||||||
LogInfo("Purging expired character task timers");
|
LogInfo("Purging expired character task timers");
|
||||||
CharacterTaskTimersRepository::DeleteWhere(database, "expire_time <= NOW()");
|
CharacterTaskTimersRepository::DeleteWhere(database, "expire_time <= NOW()");
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "../common/types.h"
|
#include "../common/types.h"
|
||||||
#include "../common/discord/discord.h"
|
#include "../common/discord/discord.h"
|
||||||
|
#include "ucs.h"
|
||||||
|
|
||||||
extern UCSConnection UCSLink;
|
extern UCSConnection UCSLink;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "../common/servertalk.h"
|
#include "../common/servertalk.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "../common/rulesys.h"
|
#include "../common/rulesys.h"
|
||||||
|
#include "../common/server_reload_types.h"
|
||||||
|
|
||||||
void WorldEventScheduler::Process(ZSList *zs_list)
|
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) {
|
if (e.event_type == ServerEvents::EVENT_TYPE_RELOAD_WORLD) {
|
||||||
LogScheduler("Sending reload world event [{}]", e.event_data.c_str());
|
LogScheduler("Sending reload world event [{}]", e.event_data.c_str());
|
||||||
|
|
||||||
auto pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
|
zs_list->SendServerReload(ServerReload::Type::WorldRepop, nullptr);
|
||||||
auto *reload_world = (ReloadWorld_Struct *) pack->pBuffer;
|
|
||||||
reload_world->global_repop = ReloadWorld::Repop;
|
|
||||||
zs_list->SendPacket(pack);
|
|
||||||
safe_delete(pack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,6 @@ WorldDatabase content_db;
|
|||||||
extern std::vector<RaceClassAllocation> character_create_allocations;
|
extern std::vector<RaceClassAllocation> character_create_allocations;
|
||||||
extern std::vector<RaceClassCombos> character_create_race_class_combos;
|
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)
|
void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **out_app, uint32 client_version_bit)
|
||||||
{
|
{
|
||||||
EQ::versions::ClientVersion
|
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 "../common/event_sub.h"
|
||||||
#include "web_interface.h"
|
#include "web_interface.h"
|
||||||
#include "../common/zone_store.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 uint32 numzones;
|
||||||
extern EQ::Random emu_random;
|
extern EQ::Random emu_random;
|
||||||
extern WebInterfaceList web_interface;
|
extern WebInterfaceList web_interface;
|
||||||
|
extern SharedTaskManager shared_task_manager;
|
||||||
volatile bool UCSServerAvailable_ = false;
|
volatile bool UCSServerAvailable_ = false;
|
||||||
void CatchSignal(int sig_num);
|
void CatchSignal(int sig_num);
|
||||||
|
|
||||||
@@ -861,3 +870,76 @@ bool ZSList::SendPacketToBootedZones(ServerPacket* pack)
|
|||||||
|
|
||||||
return true;
|
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
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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/eqtime.h"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.h"
|
||||||
#include "../common/event/timer.h"
|
#include "../common/event/timer.h"
|
||||||
|
#include "../common/server_reload_types.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
@@ -69,6 +70,7 @@ public:
|
|||||||
ZoneServer* FindByZoneID(uint32 ZoneID);
|
ZoneServer* FindByZoneID(uint32 ZoneID);
|
||||||
|
|
||||||
const std::list<std::unique_ptr<ZoneServer>> &getZoneServerList() const;
|
const std::list<std::unique_ptr<ZoneServer>> &getZoneServerList() const;
|
||||||
|
void SendServerReload(ServerReload::Type type, uchar *packet = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnTick(EQ::Timer *t);
|
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 "../common/zone_store.h"
|
||||||
#include "dynamic_zone.h"
|
#include "dynamic_zone.h"
|
||||||
#include "dynamic_zone_manager.h"
|
#include "dynamic_zone_manager.h"
|
||||||
#include "expedition_message.h"
|
|
||||||
#include "shared_task_world_messaging.h"
|
#include "shared_task_world_messaging.h"
|
||||||
#include "../common/shared_tasks.h"
|
#include "../common/shared_tasks.h"
|
||||||
#include "shared_task_manager.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 "../zone/data_bucket.h"
|
||||||
#include "../common/repositories/guild_tributes_repository.h"
|
#include "../common/repositories/guild_tributes_repository.h"
|
||||||
#include "../common/skill_caps.h"
|
#include "../common/skill_caps.h"
|
||||||
|
#include "../common/server_reload_types.h"
|
||||||
|
|
||||||
extern ClientList client_list;
|
extern ClientList client_list;
|
||||||
extern GroupLFPList LFPGroupList;
|
extern GroupLFPList LFPGroupList;
|
||||||
@@ -1357,11 +1357,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
QSLink.SendPacket(pack);
|
QSLink.SendPacket(pack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_ReloadOpcodes: {
|
|
||||||
ReloadAllPatches();
|
|
||||||
zoneserver_list.SendPacket(pack);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ServerOP_CZDialogueWindow:
|
case ServerOP_CZDialogueWindow:
|
||||||
case ServerOP_CZLDoNUpdate:
|
case ServerOP_CZLDoNUpdate:
|
||||||
case ServerOP_CZMarquee:
|
case ServerOP_CZMarquee:
|
||||||
@@ -1375,10 +1370,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
case ServerOP_Consent:
|
case ServerOP_Consent:
|
||||||
case ServerOP_DepopAllPlayersCorpses:
|
case ServerOP_DepopAllPlayersCorpses:
|
||||||
case ServerOP_DepopPlayerCorpse:
|
case ServerOP_DepopPlayerCorpse:
|
||||||
case ServerOP_ExpeditionLockState:
|
|
||||||
case ServerOP_ExpeditionLockout:
|
|
||||||
case ServerOP_ExpeditionLockoutDuration:
|
|
||||||
case ServerOP_ExpeditionReplayOnJoin:
|
|
||||||
case ServerOP_GuildRankUpdate:
|
case ServerOP_GuildRankUpdate:
|
||||||
case ServerOP_ItemStatus:
|
case ServerOP_ItemStatus:
|
||||||
case ServerOP_KickPlayer:
|
case ServerOP_KickPlayer:
|
||||||
@@ -1389,30 +1380,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
case ServerOP_RaidGroupSay:
|
case ServerOP_RaidGroupSay:
|
||||||
case ServerOP_RaidSay:
|
case ServerOP_RaidSay:
|
||||||
case ServerOP_RefreshCensorship:
|
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_RezzPlayerAccept:
|
||||||
case ServerOP_SpawnStatusChange:
|
case ServerOP_SpawnStatusChange:
|
||||||
case ServerOP_TraderMessaging:
|
case ServerOP_TraderMessaging:
|
||||||
@@ -1430,14 +1397,9 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
zoneserver_list.SendPacket(pack);
|
zoneserver_list.SendPacket(pack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_ReloadSkillCaps: {
|
case ServerOP_ServerReloadRequest: {
|
||||||
zoneserver_list.SendPacket(pack);
|
auto o = (ServerReload::Request*) pack->pBuffer;
|
||||||
skill_caps.ReloadSkillCaps();
|
zoneserver_list.SendServerReload((ServerReload::Type) o->type, pack->pBuffer);
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ServerOP_ReloadRules: {
|
|
||||||
zoneserver_list.SendPacket(pack);
|
|
||||||
RuleManager::Instance()->LoadRules(&database, "default", true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_IsOwnerOnline: {
|
case ServerOP_IsOwnerOnline: {
|
||||||
@@ -1465,29 +1427,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
}
|
}
|
||||||
break;
|
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: {
|
case ServerOP_ChangeSharedMem: {
|
||||||
auto hotfix_name = std::string((char*) pack->pBuffer);
|
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);
|
SharedTaskWorldMessaging::HandleZoneMessage(pack);
|
||||||
break;
|
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_DzCreated:
|
||||||
|
case ServerOP_DzAddPlayer:
|
||||||
|
case ServerOP_DzSaveInvite:
|
||||||
|
case ServerOP_DzRequestInvite:
|
||||||
|
case ServerOP_DzMakeLeader:
|
||||||
case ServerOP_DzAddRemoveMember:
|
case ServerOP_DzAddRemoveMember:
|
||||||
case ServerOP_DzSwapMembers:
|
case ServerOP_DzSwapMembers:
|
||||||
case ServerOP_DzRemoveAllMembers:
|
case ServerOP_DzRemoveAllMembers:
|
||||||
@@ -1552,8 +1486,13 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
case ServerOP_DzSetZoneIn:
|
case ServerOP_DzSetZoneIn:
|
||||||
case ServerOP_DzSetSwitchID:
|
case ServerOP_DzSetSwitchID:
|
||||||
case ServerOP_DzMovePC:
|
case ServerOP_DzMovePC:
|
||||||
|
case ServerOP_DzLock:
|
||||||
|
case ServerOP_DzReplayOnJoin:
|
||||||
|
case ServerOP_DzLockout:
|
||||||
|
case ServerOP_DzLockoutDuration:
|
||||||
|
case ServerOP_DzCharacterLockout:
|
||||||
case ServerOP_DzUpdateMemberStatus: {
|
case ServerOP_DzUpdateMemberStatus: {
|
||||||
DynamicZone::HandleZoneMessage(pack);
|
dynamic_zone_manager.HandleZoneMessage(pack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_GuildTributeUpdate: {
|
case ServerOP_GuildTributeUpdate: {
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ SET(zone_sources
|
|||||||
encounter.cpp
|
encounter.cpp
|
||||||
entity.cpp
|
entity.cpp
|
||||||
exp.cpp
|
exp.cpp
|
||||||
expedition.cpp
|
|
||||||
expedition_database.cpp
|
|
||||||
expedition_request.cpp
|
expedition_request.cpp
|
||||||
fastmath.cpp
|
fastmath.cpp
|
||||||
fearpath.cpp
|
fearpath.cpp
|
||||||
@@ -205,8 +203,6 @@ SET(zone_headers
|
|||||||
encounter.h
|
encounter.h
|
||||||
entity.h
|
entity.h
|
||||||
event_codes.h
|
event_codes.h
|
||||||
expedition.h
|
|
||||||
expedition_database.h
|
|
||||||
expedition_request.h
|
expedition_request.h
|
||||||
fastmath.h
|
fastmath.h
|
||||||
forage.h
|
forage.h
|
||||||
|
|||||||
+34
-11
@@ -405,17 +405,12 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mob *pet_owner = mob->GetOwner();
|
Mob* pet_owner = mob->GetOwner();
|
||||||
if (
|
|
||||||
pet_owner &&
|
if (pet_owner && pet_owner->IsOfClientBot()) {
|
||||||
pet_owner->IsClient() &&
|
if (mob->IsPetAggroExempt(pet_owner)) {
|
||||||
(
|
return false;
|
||||||
!RuleB(Aggro, AggroPlayerPets) ||
|
}
|
||||||
pet_owner->CastToClient()->GetGM() ||
|
|
||||||
mob->GetSpecialAbility(SpecialAbility::AggroImmunity)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsNPC() && mob->IsNPC() && mob->GetSpecialAbility(SpecialAbility::NPCAggroImmunity)) {
|
if (IsNPC() && mob->IsNPC() && mob->GetSpecialAbility(SpecialAbility::NPCAggroImmunity)) {
|
||||||
@@ -582,6 +577,34 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Mob::IsPetAggroExempt(Mob* pet_owner) {
|
||||||
|
if (!pet_owner) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool exempt_client_pet = pet_owner->IsClient() && !RuleB(Aggro, AggroPlayerPets);
|
||||||
|
bool exempt_bot_pet = pet_owner->IsBot() && !RuleB(Aggro, AggroBotPets);
|
||||||
|
|
||||||
|
if (exempt_client_pet || exempt_bot_pet) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mob* ultimate_owner = GetUltimateOwner();
|
||||||
|
Client* client_owner = (ultimate_owner && ultimate_owner->IsClient())
|
||||||
|
? ultimate_owner->CastToClient()
|
||||||
|
: nullptr;
|
||||||
|
|
||||||
|
if (client_owner && client_owner->GetGM()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetSpecialAbility(SpecialAbility::AggroImmunity)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int EntityList::FleeAllyCount(Mob* attacker, Mob* skipped)
|
int EntityList::FleeAllyCount(Mob* attacker, Mob* skipped)
|
||||||
{
|
{
|
||||||
// Return a list of how many NPCs of the same faction or race are within aggro range of the given exclude Mob.
|
// Return a list of how many NPCs of the same faction or race are within aggro range of the given exclude Mob.
|
||||||
|
|||||||
+21
-18
@@ -2789,32 +2789,35 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
|||||||
const uint16 entity_id = GetID();
|
const uint16 entity_id = GetID();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!HasOwner() &&
|
|
||||||
!IsMerc() &&
|
|
||||||
!GetSwarmInfo() &&
|
|
||||||
(!is_merchant || allow_merchant_corpse) &&
|
|
||||||
(
|
(
|
||||||
|
!HasOwner() &&
|
||||||
|
!IsMerc() &&
|
||||||
|
!GetSwarmInfo() &&
|
||||||
|
(!is_merchant || allow_merchant_corpse) &&
|
||||||
(
|
(
|
||||||
killer &&
|
|
||||||
(
|
(
|
||||||
killer->IsClient() ||
|
killer &&
|
||||||
(
|
(
|
||||||
killer->HasOwner() &&
|
killer->IsClient() ||
|
||||||
killer->GetUltimateOwner()->IsClient()
|
(
|
||||||
) ||
|
killer->HasOwner() &&
|
||||||
(
|
killer->GetUltimateOwner()->IsClient()
|
||||||
killer->IsNPC() &&
|
) ||
|
||||||
killer->CastToNPC()->GetSwarmInfo() &&
|
(
|
||||||
killer->CastToNPC()->GetSwarmInfo()->GetOwner() &&
|
killer->IsNPC() &&
|
||||||
killer->CastToNPC()->GetSwarmInfo()->GetOwner()->IsClient()
|
killer->CastToNPC()->GetSwarmInfo() &&
|
||||||
|
killer->CastToNPC()->GetSwarmInfo()->GetOwner() &&
|
||||||
|
killer->CastToNPC()->GetSwarmInfo()->GetOwner()->IsClient()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
killer_mob && is_ldon_treasure
|
||||||
)
|
)
|
||||||
) ||
|
|
||||||
(
|
|
||||||
killer_mob && is_ldon_treasure
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {
|
|| IsQueuedForCorpse()
|
||||||
|
) {
|
||||||
if (killer) {
|
if (killer) {
|
||||||
if (killer->GetOwner() != 0 && killer->GetOwner()->IsClient()) {
|
if (killer->GetOwner() != 0 && killer->GetOwner()->IsClient()) {
|
||||||
killer = killer->GetOwner();
|
killer = killer->GetOwner();
|
||||||
|
|||||||
+190
-400
@@ -281,443 +281,233 @@ void Mob::AddItemBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_a
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_ammo_item) {
|
if (is_ammo_item) {
|
||||||
const auto recommended_level = is_augment ? recommended_level_override : inst->GetItemRecommendedLevel(true);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsNPC() || current_level >= recommended_level) {
|
const auto recommended_level = is_augment ? recommended_level_override : inst->GetItemRecommendedLevel(true);
|
||||||
b->HP += item->HP;
|
const bool meets_recommended = (IsNPC() && !RuleB(Items, NPCUseRecommendedLevels)) || current_level >= recommended_level;
|
||||||
b->Mana += item->Mana;
|
|
||||||
b->Endurance += item->Endur;
|
|
||||||
|
|
||||||
b->AC += item->AC;
|
auto CalcItemBonus = [&](int statValue) -> int {
|
||||||
b->ATK += item->Attack;
|
return meets_recommended ? statValue : CalcRecommendedLevelBonus(current_level, recommended_level, statValue);
|
||||||
|
};
|
||||||
|
|
||||||
b->STR += (item->AStr + item->HeroicStr);
|
auto CalcCappedItemBonus = [&](int currentStat, int bonus, int cap) -> int {
|
||||||
b->STA += (item->ASta + item->HeroicSta);
|
int calc_stat = currentStat + CalcItemBonus(bonus);
|
||||||
b->DEX += (item->ADex + item->HeroicDex);
|
return IsOfClientBotMerc() ? std::min(cap, calc_stat) : calc_stat;
|
||||||
b->AGI += (item->AAgi + item->HeroicAgi);
|
};
|
||||||
b->INT += (item->AInt + item->HeroicInt);
|
|
||||||
b->WIS += (item->AWis + item->HeroicWis);
|
|
||||||
b->CHA += (item->ACha + item->HeroicCha);
|
|
||||||
|
|
||||||
b->MR += (item->MR + item->HeroicMR);
|
b->HP += CalcItemBonus(item->HP);
|
||||||
b->FR += (item->FR + item->HeroicFR);
|
b->Mana += CalcItemBonus(item->Mana);
|
||||||
b->CR += (item->CR + item->HeroicCR);
|
b->Endurance += CalcItemBonus(item->Endur);
|
||||||
b->PR += (item->PR + item->HeroicPR);
|
b->AC += CalcItemBonus(item->AC);
|
||||||
b->DR += (item->DR + item->HeroicDR);
|
|
||||||
b->Corrup += (item->SVCorruption + item->HeroicSVCorrup);
|
|
||||||
|
|
||||||
b->STRCapMod += item->HeroicStr;
|
b->STR += CalcItemBonus(item->AStr + item->HeroicStr);
|
||||||
b->STACapMod += item->HeroicSta;
|
b->STA += CalcItemBonus(item->ASta + item->HeroicSta);
|
||||||
b->DEXCapMod += item->HeroicDex;
|
b->DEX += CalcItemBonus(item->ADex + item->HeroicDex);
|
||||||
b->AGICapMod += item->HeroicAgi;
|
b->AGI += CalcItemBonus(item->AAgi + item->HeroicAgi);
|
||||||
b->INTCapMod += item->HeroicInt;
|
b->INT += CalcItemBonus(item->AInt + item->HeroicInt);
|
||||||
b->WISCapMod += item->HeroicWis;
|
b->WIS += CalcItemBonus(item->AWis + item->HeroicWis);
|
||||||
b->CHACapMod += item->HeroicCha;
|
b->CHA += CalcItemBonus(item->ACha + item->HeroicCha);
|
||||||
|
|
||||||
b->MRCapMod += item->HeroicMR;
|
b->HeroicSTR += CalcItemBonus(item->HeroicStr);
|
||||||
b->CRCapMod += item->HeroicFR;
|
b->HeroicSTA += CalcItemBonus(item->HeroicSta);
|
||||||
b->FRCapMod += item->HeroicCR;
|
b->HeroicDEX += CalcItemBonus(item->HeroicDex);
|
||||||
b->PRCapMod += item->HeroicPR;
|
b->HeroicAGI += CalcItemBonus(item->HeroicAgi);
|
||||||
b->DRCapMod += item->HeroicDR;
|
b->HeroicINT += CalcItemBonus(item->HeroicInt);
|
||||||
b->CorrupCapMod += item->HeroicSVCorrup;
|
b->HeroicWIS += CalcItemBonus(item->HeroicWis);
|
||||||
|
b->HeroicCHA += CalcItemBonus(item->HeroicCha);
|
||||||
|
|
||||||
b->HeroicSTR += item->HeroicStr;
|
b->STRCapMod += b->HeroicSTR;
|
||||||
b->HeroicSTA += item->HeroicSta;
|
b->STACapMod += b->HeroicSTA;
|
||||||
b->HeroicDEX += item->HeroicDex;
|
b->DEXCapMod += b->HeroicDEX;
|
||||||
b->HeroicAGI += item->HeroicAgi;
|
b->AGICapMod += b->HeroicAGI;
|
||||||
b->HeroicINT += item->HeroicInt;
|
b->INTCapMod += b->HeroicINT;
|
||||||
b->HeroicWIS += item->HeroicWis;
|
b->WISCapMod += b->HeroicWIS;
|
||||||
b->HeroicCHA += item->HeroicCha;
|
b->CHACapMod += b->HeroicCHA;
|
||||||
|
|
||||||
b->HeroicMR += item->HeroicMR;
|
b->MR += CalcItemBonus(item->MR + item->HeroicMR);
|
||||||
b->HeroicFR += item->HeroicFR;
|
b->FR += CalcItemBonus(item->FR + item->HeroicFR);
|
||||||
b->HeroicCR += item->HeroicCR;
|
b->CR += CalcItemBonus(item->CR + item->HeroicCR);
|
||||||
b->HeroicPR += item->HeroicPR;
|
b->PR += CalcItemBonus(item->PR + item->HeroicPR);
|
||||||
b->HeroicDR += item->HeroicDR;
|
b->DR += CalcItemBonus(item->DR + item->HeroicDR);
|
||||||
b->HeroicCorrup += item->HeroicSVCorrup;
|
b->Corrup += CalcItemBonus(item->SVCorruption + item->HeroicSVCorrup);
|
||||||
|
|
||||||
|
b->HeroicMR += CalcItemBonus(item->HeroicMR);
|
||||||
|
b->HeroicFR += CalcItemBonus(item->HeroicFR);
|
||||||
|
b->HeroicCR += CalcItemBonus(item->HeroicCR);
|
||||||
|
b->HeroicPR += CalcItemBonus(item->HeroicPR);
|
||||||
|
b->HeroicDR += CalcItemBonus(item->HeroicDR);
|
||||||
|
b->HeroicCorrup += CalcItemBonus(item->HeroicSVCorrup);
|
||||||
|
|
||||||
|
b->MRCapMod += b->HeroicMR;
|
||||||
|
b->FRCapMod += b->HeroicFR;
|
||||||
|
b->CRCapMod += b->HeroicCR;
|
||||||
|
b->PRCapMod += b->HeroicPR;
|
||||||
|
b->DRCapMod += b->HeroicDR;
|
||||||
|
b->CorrupCapMod += b->HeroicCorrup;
|
||||||
|
|
||||||
|
b->HPRegen += CalcItemBonus(item->Regen);
|
||||||
|
b->ManaRegen += CalcItemBonus(item->ManaRegen);
|
||||||
|
b->ManaRegen += CalcItemBonus(item->EnduranceRegen);
|
||||||
|
|
||||||
|
// These have rule-configured caps.
|
||||||
|
b->ATK = CalcCappedItemBonus(b->ATK, item->Attack, RuleI(Character, ItemATKCap) + itembonuses.ItemATKCap + spellbonuses.ItemATKCap + aabonuses.ItemATKCap);
|
||||||
|
b->DamageShield = CalcCappedItemBonus(b->DamageShield, item->DamageShield, RuleI(Character, ItemDamageShieldCap));
|
||||||
|
b->SpellShield = CalcCappedItemBonus(b->SpellShield, item->SpellShield, RuleI(Character, ItemSpellShieldingCap));
|
||||||
|
b->MeleeMitigation = CalcCappedItemBonus(b->MeleeMitigation, item->Shielding, RuleI(Character, ItemShieldingCap));
|
||||||
|
b->StunResist = CalcCappedItemBonus(b->StunResist, item->StunResist, RuleI(Character, ItemStunResistCap));
|
||||||
|
b->StrikeThrough = CalcCappedItemBonus(b->StrikeThrough, item->StrikeThrough, RuleI(Character, ItemStrikethroughCap));
|
||||||
|
b->AvoidMeleeChance = CalcCappedItemBonus(b->AvoidMeleeChance, item->Avoidance, RuleI(Character, ItemAvoidanceCap));
|
||||||
|
b->HitChance = CalcCappedItemBonus(b->HitChance, item->Accuracy, RuleI(Character, ItemAccuracyCap));
|
||||||
|
b->ProcChance = CalcCappedItemBonus(b->ProcChance, item->CombatEffects, RuleI(Character, ItemCombatEffectsCap));
|
||||||
|
b->DoTShielding = CalcCappedItemBonus(b->DoTShielding, item->DotShielding, RuleI(Character, ItemDoTShieldingCap));
|
||||||
|
b->HealAmt = CalcCappedItemBonus(b->HealAmt, item->HealAmt, RuleI(Character, ItemHealAmtCap));
|
||||||
|
b->SpellDmg = CalcCappedItemBonus(b->SpellDmg, item->SpellDmg, RuleI(Character, ItemSpellDmgCap));
|
||||||
|
b->Clairvoyance = CalcCappedItemBonus(b->Clairvoyance, item->Clairvoyance, RuleI(Character, ItemClairvoyanceCap));
|
||||||
|
b->DSMitigation = CalcCappedItemBonus(b->DSMitigation, item->DSMitigation, RuleI(Character, ItemDSMitigationCap));
|
||||||
|
|
||||||
|
if (b->haste < item->Haste) {
|
||||||
|
b->haste = item->Haste;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->ExtraDmgAmt != 0 && item->ExtraDmgSkill <= EQ::skills::HIGHEST_SKILL) {
|
||||||
|
if (item->ExtraDmgSkill == ALL_SKILLS) {
|
||||||
|
for (const auto &skill_id: EQ::skills::GetExtraDamageSkills()) {
|
||||||
|
b->SkillDamageAmount[skill_id] = CalcCappedItemBonus(b->SkillDamageAmount[skill_id], item->ExtraDmgAmt, RuleI(Character, ItemExtraDmgCap));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
b->HP += CalcRecommendedLevelBonus(current_level, recommended_level, item->HP);
|
b->SkillDamageAmount[item->ExtraDmgSkill] = CalcCappedItemBonus(b->SkillDamageAmount[item->ExtraDmgSkill], item->ExtraDmgAmt, RuleI(Character, ItemExtraDmgCap));
|
||||||
b->Mana += CalcRecommendedLevelBonus(current_level, recommended_level, item->Mana);
|
|
||||||
b->Endurance += CalcRecommendedLevelBonus(current_level, recommended_level, item->Endur);
|
|
||||||
|
|
||||||
b->AC += CalcRecommendedLevelBonus(current_level, recommended_level, item->AC);
|
|
||||||
b->ATK += CalcRecommendedLevelBonus(current_level, recommended_level, item->Attack);
|
|
||||||
|
|
||||||
b->STR += CalcRecommendedLevelBonus(current_level, recommended_level, (item->AStr + item->HeroicStr));
|
|
||||||
b->STA += CalcRecommendedLevelBonus(current_level, recommended_level, (item->ASta + item->HeroicSta));
|
|
||||||
b->DEX += CalcRecommendedLevelBonus(current_level, recommended_level, (item->ADex + item->HeroicDex));
|
|
||||||
b->AGI += CalcRecommendedLevelBonus(current_level, recommended_level, (item->AAgi + item->HeroicAgi));
|
|
||||||
b->INT += CalcRecommendedLevelBonus(current_level, recommended_level, (item->AInt + item->HeroicInt));
|
|
||||||
b->WIS += CalcRecommendedLevelBonus(current_level, recommended_level, (item->AWis + item->HeroicWis));
|
|
||||||
b->CHA += CalcRecommendedLevelBonus(current_level, recommended_level, (item->ACha + item->HeroicCha));
|
|
||||||
|
|
||||||
b->MR += CalcRecommendedLevelBonus(current_level, recommended_level, (item->MR + item->HeroicMR));
|
|
||||||
b->FR += CalcRecommendedLevelBonus(current_level, recommended_level, (item->FR + item->HeroicFR));
|
|
||||||
b->CR += CalcRecommendedLevelBonus(current_level, recommended_level, (item->CR + item->HeroicCR));
|
|
||||||
b->PR += CalcRecommendedLevelBonus(current_level, recommended_level, (item->PR + item->HeroicPR));
|
|
||||||
b->DR += CalcRecommendedLevelBonus(current_level, recommended_level, (item->DR + item->HeroicDR));
|
|
||||||
b->Corrup += CalcRecommendedLevelBonus(current_level, recommended_level, (item->SVCorruption + item->HeroicSVCorrup));
|
|
||||||
|
|
||||||
b->STRCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicStr);
|
|
||||||
b->STACapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicSta);
|
|
||||||
b->DEXCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicDex);
|
|
||||||
b->AGICapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicAgi);
|
|
||||||
b->INTCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicInt);
|
|
||||||
b->WISCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicWis);
|
|
||||||
b->CHACapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicCha);
|
|
||||||
|
|
||||||
b->MRCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicMR);
|
|
||||||
b->CRCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicFR);
|
|
||||||
b->FRCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicCR);
|
|
||||||
b->PRCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicPR);
|
|
||||||
b->DRCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicDR);
|
|
||||||
b->CorrupCapMod += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicSVCorrup);
|
|
||||||
|
|
||||||
b->HeroicSTR += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicStr);
|
|
||||||
b->HeroicSTA += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicSta);
|
|
||||||
b->HeroicDEX += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicDex);
|
|
||||||
b->HeroicAGI += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicAgi);
|
|
||||||
b->HeroicINT += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicInt);
|
|
||||||
b->HeroicWIS += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicWis);
|
|
||||||
b->HeroicCHA += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicCha);
|
|
||||||
|
|
||||||
b->HeroicMR += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicMR);
|
|
||||||
b->HeroicFR += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicFR);
|
|
||||||
b->HeroicCR += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicCR);
|
|
||||||
b->HeroicPR += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicPR);
|
|
||||||
b->HeroicDR += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicDR);
|
|
||||||
b->HeroicCorrup += CalcRecommendedLevelBonus(current_level, recommended_level, item->HeroicSVCorrup);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (b->haste < item->Haste) {
|
if (item->Worn.Effect > 0 && item->Worn.Type == EQ::item::ItemEffectWorn) {
|
||||||
b->haste = item->Haste;
|
ApplySpellsBonuses(item->Worn.Effect, item->Worn.Level, b, 0, item->Worn.Type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->Focus.Effect > 0 && item->Focus.Type == EQ::item::ItemEffectFocus) {
|
||||||
|
if (
|
||||||
|
IsOfClientBotMerc() ||
|
||||||
|
(IsNPC() && RuleB(Spells, NPC_UseFocusFromItems))
|
||||||
|
) {
|
||||||
|
ApplySpellsBonuses(item->Focus.Effect, item->Focus.Level, b, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item->Regen != 0) {
|
switch (item->BardType) {
|
||||||
b->HPRegen += item->Regen;
|
case EQ::item::ItemTypeAllInstrumentTypes: { // (e.g. Singing Short Sword)
|
||||||
|
if (item->BardValue > b->singingMod) {
|
||||||
|
b->singingMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->BardValue > b->brassMod) {
|
||||||
|
b->brassMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->BardValue > b->stringedMod) {
|
||||||
|
b->stringedMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->BardValue > b->percussionMod) {
|
||||||
|
b->percussionMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->BardValue > b->windMod) {
|
||||||
|
b->windMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case EQ::item::ItemTypeSinging: {
|
||||||
|
if (item->BardValue > b->singingMod) {
|
||||||
|
b->singingMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item->ManaRegen != 0) {
|
break;
|
||||||
b->ManaRegen += item->ManaRegen;
|
|
||||||
}
|
}
|
||||||
|
case EQ::item::ItemTypeWindInstrument: {
|
||||||
|
if (item->BardValue > b->windMod) {
|
||||||
|
b->windMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item->EnduranceRegen != 0) {
|
break;
|
||||||
b->EnduranceRegen += item->EnduranceRegen;
|
|
||||||
}
|
}
|
||||||
|
case EQ::item::ItemTypeStringedInstrument: {
|
||||||
|
if (item->BardValue > b->stringedMod) {
|
||||||
|
b->stringedMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item->Attack != 0) {
|
break;
|
||||||
unsigned int cap = RuleI(Character, ItemATKCap);
|
}
|
||||||
cap += itembonuses.ItemATKCap + spellbonuses.ItemATKCap + aabonuses.ItemATKCap;
|
case EQ::item::ItemTypeBrassInstrument: {
|
||||||
|
if (item->BardValue > b->brassMod) {
|
||||||
|
b->brassMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
break;
|
||||||
IsOfClientBotMerc() &&
|
}
|
||||||
(b->ATK + item->Attack) > cap
|
case EQ::item::ItemTypePercussionInstrument: {
|
||||||
|
if (item->BardValue > b->percussionMod) {
|
||||||
|
b->percussionMod = item->BardValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->SkillModValue != 0 && item->SkillModType <= EQ::skills::HIGHEST_SKILL) {
|
||||||
|
if (
|
||||||
|
(item->SkillModValue > 0 && b->skillmod[item->SkillModType] < item->SkillModValue) ||
|
||||||
|
(item->SkillModValue < 0 && b->skillmod[item->SkillModType] > item->SkillModValue)
|
||||||
) {
|
) {
|
||||||
b->ATK = RuleI(Character, ItemATKCap);
|
b->skillmod[item->SkillModType] = item->SkillModValue;
|
||||||
} else {
|
|
||||||
b->ATK += item->Attack;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item->DamageShield != 0) {
|
if (item->FactionMod1) {
|
||||||
if (
|
if (item->FactionAmt1 > 0 && item->FactionAmt1 > GetItemFactionBonus(item->FactionMod1)) {
|
||||||
IsOfClientBotMerc() &&
|
AddItemFactionBonus(item->FactionMod1, item->FactionAmt1);
|
||||||
(b->DamageShield + item->DamageShield) > RuleI(Character, ItemDamageShieldCap)
|
} else if (item->FactionAmt1 < 0 && item->FactionAmt1 < GetItemFactionBonus(item->FactionMod1)) {
|
||||||
) {
|
AddItemFactionBonus(item->FactionMod1, item->FactionAmt1);
|
||||||
b->DamageShield = RuleI(Character, ItemDamageShieldCap);
|
|
||||||
} else {
|
|
||||||
b->DamageShield += item->DamageShield;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item->SpellShield != 0) {
|
if (item->FactionMod2) {
|
||||||
if (
|
if (item->FactionAmt2 > 0 && item->FactionAmt2 > GetItemFactionBonus(item->FactionMod2)) {
|
||||||
IsOfClientBotMerc() &&
|
AddItemFactionBonus(item->FactionMod2, item->FactionAmt2);
|
||||||
(b->SpellShield + item->SpellShield) > RuleI(Character, ItemSpellShieldingCap)
|
} else if (item->FactionAmt2 < 0 && item->FactionAmt2 < GetItemFactionBonus(item->FactionMod2)) {
|
||||||
) {
|
AddItemFactionBonus(item->FactionMod2, item->FactionAmt2);
|
||||||
b->SpellShield = RuleI(Character, ItemSpellShieldingCap);
|
|
||||||
} else {
|
|
||||||
b->SpellShield += item->SpellShield;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item->Shielding != 0) {
|
if (item->FactionMod3) {
|
||||||
if (
|
if (item->FactionAmt3 > 0 && item->FactionAmt3 > GetItemFactionBonus(item->FactionMod3)) {
|
||||||
IsOfClientBotMerc() &&
|
AddItemFactionBonus(item->FactionMod3, item->FactionAmt3);
|
||||||
(b->MeleeMitigation + item->Shielding) > RuleI(Character, ItemShieldingCap)
|
} else if (item->FactionAmt3 < 0 && item->FactionAmt3 < GetItemFactionBonus(item->FactionMod3)) {
|
||||||
) {
|
AddItemFactionBonus(item->FactionMod3, item->FactionAmt3);
|
||||||
b->MeleeMitigation = RuleI(Character, ItemShieldingCap);
|
|
||||||
} else {
|
|
||||||
b->MeleeMitigation += item->Shielding;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item->StunResist != 0) {
|
if (item->FactionMod4) {
|
||||||
if (
|
if (item->FactionAmt4 > 0 && item->FactionAmt4 > GetItemFactionBonus(item->FactionMod4)) {
|
||||||
IsOfClientBotMerc() &&
|
AddItemFactionBonus(item->FactionMod4, item->FactionAmt4);
|
||||||
(b->StunResist + item->StunResist) > RuleI(Character, ItemStunResistCap)
|
} else if (item->FactionAmt4 < 0 && item->FactionAmt4 < GetItemFactionBonus(item->FactionMod4)) {
|
||||||
) {
|
AddItemFactionBonus(item->FactionMod4, item->FactionAmt4);
|
||||||
b->StunResist = RuleI(Character, ItemStunResistCap);
|
|
||||||
} else {
|
|
||||||
b->StunResist += item->StunResist;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item->StrikeThrough != 0) {
|
if (!is_augment) {
|
||||||
if (
|
for (int i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) {
|
||||||
IsOfClientBotMerc() &&
|
const auto* augment = inst->GetAugment(i);
|
||||||
(b->StrikeThrough + item->StrikeThrough) > RuleI(Character, ItemStrikethroughCap)
|
if (!augment) {
|
||||||
) {
|
continue;
|
||||||
b->StrikeThrough = RuleI(Character, ItemStrikethroughCap);
|
|
||||||
} else {
|
|
||||||
b->StrikeThrough += item->StrikeThrough;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (item->Avoidance != 0) {
|
AddItemBonuses(augment, b, true, false, recommended_level);
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->AvoidMeleeChance + item->Avoidance) > RuleI(Character, ItemAvoidanceCap)
|
|
||||||
) {
|
|
||||||
b->AvoidMeleeChance = RuleI(Character, ItemAvoidanceCap);
|
|
||||||
} else {
|
|
||||||
b->AvoidMeleeChance += item->Avoidance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->Accuracy != 0) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->HitChance + item->Accuracy) > RuleI(Character, ItemAccuracyCap)
|
|
||||||
) {
|
|
||||||
b->HitChance = RuleI(Character, ItemAccuracyCap);
|
|
||||||
} else {
|
|
||||||
b->HitChance += item->Accuracy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->CombatEffects != 0) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->ProcChance + item->CombatEffects) > RuleI(Character, ItemCombatEffectsCap)
|
|
||||||
) {
|
|
||||||
b->ProcChance = RuleI(Character, ItemCombatEffectsCap);
|
|
||||||
} else {
|
|
||||||
b->ProcChance += item->CombatEffects;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->DotShielding != 0) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->DoTShielding + item->DotShielding) > RuleI(Character, ItemDoTShieldingCap)
|
|
||||||
) {
|
|
||||||
b->DoTShielding = RuleI(Character, ItemDoTShieldingCap);
|
|
||||||
} else {
|
|
||||||
b->DoTShielding += item->DotShielding;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->HealAmt != 0) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->HealAmt + item->HealAmt) > RuleI(Character, ItemHealAmtCap)
|
|
||||||
) {
|
|
||||||
b->HealAmt = RuleI(Character, ItemHealAmtCap);
|
|
||||||
} else {
|
|
||||||
b->HealAmt += item->HealAmt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->SpellDmg != 0) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->SpellDmg + item->SpellDmg) > RuleI(Character, ItemSpellDmgCap)
|
|
||||||
) {
|
|
||||||
b->SpellDmg = RuleI(Character, ItemSpellDmgCap);
|
|
||||||
} else {
|
|
||||||
b->SpellDmg += item->SpellDmg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->Clairvoyance != 0) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->Clairvoyance + item->Clairvoyance) > RuleI(Character, ItemClairvoyanceCap)
|
|
||||||
) {
|
|
||||||
b->Clairvoyance = RuleI(Character, ItemClairvoyanceCap);
|
|
||||||
} else {
|
|
||||||
b->Clairvoyance += item->Clairvoyance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->DSMitigation != 0) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() &&
|
|
||||||
(b->DSMitigation + item->DSMitigation) > RuleI(Character, ItemDSMitigationCap)
|
|
||||||
) {
|
|
||||||
b->DSMitigation = RuleI(Character, ItemDSMitigationCap);
|
|
||||||
} else {
|
|
||||||
b->DSMitigation += item->DSMitigation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->Worn.Effect > 0 && item->Worn.Type == EQ::item::ItemEffectWorn) {
|
|
||||||
ApplySpellsBonuses(item->Worn.Effect, item->Worn.Level, b, 0, item->Worn.Type);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->Focus.Effect > 0 && item->Focus.Type == EQ::item::ItemEffectFocus) {
|
|
||||||
if (
|
|
||||||
IsOfClientBotMerc() ||
|
|
||||||
(IsNPC() && RuleB(Spells, NPC_UseFocusFromItems))
|
|
||||||
) {
|
|
||||||
ApplySpellsBonuses(item->Focus.Effect, item->Focus.Level, b, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (item->BardType) {
|
|
||||||
case EQ::item::ItemTypeAllInstrumentTypes: { // (e.g. Singing Short Sword)
|
|
||||||
if (item->BardValue > b->singingMod) {
|
|
||||||
b->singingMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->BardValue > b->brassMod) {
|
|
||||||
b->brassMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->BardValue > b->stringedMod) {
|
|
||||||
b->stringedMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->BardValue > b->percussionMod) {
|
|
||||||
b->percussionMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->BardValue > b->windMod) {
|
|
||||||
b->windMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EQ::item::ItemTypeSinging: {
|
|
||||||
if (item->BardValue > b->singingMod) {
|
|
||||||
b->singingMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EQ::item::ItemTypeWindInstrument: {
|
|
||||||
if (item->BardValue > b->windMod) {
|
|
||||||
b->windMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EQ::item::ItemTypeStringedInstrument: {
|
|
||||||
if (item->BardValue > b->stringedMod) {
|
|
||||||
b->stringedMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EQ::item::ItemTypeBrassInstrument: {
|
|
||||||
if (item->BardValue > b->brassMod) {
|
|
||||||
b->brassMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EQ::item::ItemTypePercussionInstrument: {
|
|
||||||
if (item->BardValue > b->percussionMod) {
|
|
||||||
b->percussionMod = item->BardValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->SkillModValue != 0 && item->SkillModType <= EQ::skills::HIGHEST_SKILL) {
|
|
||||||
if (
|
|
||||||
(item->SkillModValue > 0 && b->skillmod[item->SkillModType] < item->SkillModValue) ||
|
|
||||||
(item->SkillModValue < 0 && b->skillmod[item->SkillModType] > item->SkillModValue)
|
|
||||||
) {
|
|
||||||
b->skillmod[item->SkillModType] = item->SkillModValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->FactionMod1) {
|
|
||||||
if (item->FactionAmt1 > 0 && item->FactionAmt1 > GetItemFactionBonus(item->FactionMod1)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod1, item->FactionAmt1);
|
|
||||||
} else if (item->FactionAmt1 < 0 && item->FactionAmt1 < GetItemFactionBonus(item->FactionMod1)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod1, item->FactionAmt1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->FactionMod2) {
|
|
||||||
if (item->FactionAmt2 > 0 && item->FactionAmt2 > GetItemFactionBonus(item->FactionMod2)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod2, item->FactionAmt2);
|
|
||||||
} else if (item->FactionAmt2 < 0 && item->FactionAmt2 < GetItemFactionBonus(item->FactionMod2)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod2, item->FactionAmt2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->FactionMod3) {
|
|
||||||
if (item->FactionAmt3 > 0 && item->FactionAmt3 > GetItemFactionBonus(item->FactionMod3)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod3, item->FactionAmt3);
|
|
||||||
} else if (item->FactionAmt3 < 0 && item->FactionAmt3 < GetItemFactionBonus(item->FactionMod3)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod3, item->FactionAmt3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->FactionMod4) {
|
|
||||||
if (item->FactionAmt4 > 0 && item->FactionAmt4 > GetItemFactionBonus(item->FactionMod4)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod4, item->FactionAmt4);
|
|
||||||
} else if (item->FactionAmt4 < 0 && item->FactionAmt4 < GetItemFactionBonus(item->FactionMod4)) {
|
|
||||||
AddItemFactionBonus(item->FactionMod4, item->FactionAmt4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->ExtraDmgAmt != 0 && item->ExtraDmgSkill <= EQ::skills::HIGHEST_SKILL) {
|
|
||||||
if (item->ExtraDmgSkill == ALL_SKILLS) {
|
|
||||||
for (const auto& skill_id : EQ::skills::GetExtraDamageSkills()) {
|
|
||||||
if (
|
|
||||||
!IsNPC() &&
|
|
||||||
RuleI(Character, ItemExtraDmgCap) >= 0 &&
|
|
||||||
(b->SkillDamageAmount[skill_id] + item->ExtraDmgAmt) > RuleI(Character, ItemExtraDmgCap)
|
|
||||||
) {
|
|
||||||
b->SkillDamageAmount[skill_id] = RuleI(Character, ItemExtraDmgCap);
|
|
||||||
} else {
|
|
||||||
b->SkillDamageAmount[skill_id] += item->ExtraDmgAmt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (
|
|
||||||
!IsNPC() &&
|
|
||||||
RuleI(Character, ItemExtraDmgCap) >= 0 &&
|
|
||||||
(b->SkillDamageAmount[item->ExtraDmgSkill] + item->ExtraDmgAmt) > RuleI(Character, ItemExtraDmgCap)
|
|
||||||
) {
|
|
||||||
b->SkillDamageAmount[item->ExtraDmgSkill] = RuleI(Character, ItemExtraDmgCap);
|
|
||||||
} else {
|
|
||||||
b->SkillDamageAmount[item->ExtraDmgSkill] += item->ExtraDmgAmt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_augment) {
|
|
||||||
for (int i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) {
|
|
||||||
const auto* augment = inst->GetAugment(i);
|
|
||||||
if (!augment) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddItemBonuses(augment, b, true, false, recommended_level);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Mob::AdditiveWornBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_augment) {
|
void Mob::AdditiveWornBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_augment) {
|
||||||
/*
|
/*
|
||||||
Powerful Non-live like option allows developers to add worn effects on items that
|
Powerful Non-live like option allows developers to add worn effects on items that
|
||||||
|
|||||||
+260
-346
File diff suppressed because it is too large
Load Diff
+27
-6
@@ -93,7 +93,7 @@ enum BotCastingChanceConditional : uint8
|
|||||||
cntHSND = 16
|
cntHSND = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace BotSettingCategories { // Update GetBotSpellCategoryName as needed
|
namespace BotSettingCategories {
|
||||||
constexpr uint8 BaseSetting = 0;
|
constexpr uint8 BaseSetting = 0;
|
||||||
constexpr uint8 SpellHold = 1;
|
constexpr uint8 SpellHold = 1;
|
||||||
constexpr uint8 SpellDelay = 2;
|
constexpr uint8 SpellDelay = 2;
|
||||||
@@ -118,13 +118,32 @@ namespace BotSettingCategories { // Update GetBotSpellCategoryName as needed
|
|||||||
constexpr uint16 END = BotSettingCategories::SpellTypeAnnounceCast;
|
constexpr uint16 END = BotSettingCategories::SpellTypeAnnounceCast;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<uint8, std::string> botSpellCategory_names = {
|
static std::map<uint8, std::string> bot_setting_category_names = {
|
||||||
|
{ BotSettingCategories::BaseSetting, "Base Setting" },
|
||||||
|
{ BotSettingCategories::SpellHold, "Spell Holds" },
|
||||||
|
{ BotSettingCategories::SpellDelay, "Spell Delays" },
|
||||||
|
{ BotSettingCategories::SpellMinThreshold, "Spell Minimum Thresholds" },
|
||||||
|
{ BotSettingCategories::SpellMaxThreshold, "Spell Maximum Thresholds" },
|
||||||
|
{ BotSettingCategories::SpellTypeResistLimit, "Spell Resist Limits" },
|
||||||
|
{ BotSettingCategories::SpellTypeAggroCheck, "Spell Aggro Checks" },
|
||||||
|
{ BotSettingCategories::SpellTypeMinManaPct, "Spell Min Mana Percent" },
|
||||||
|
{ BotSettingCategories::SpellTypeMaxManaPct, "Spell Max Mana Percent" },
|
||||||
|
{ BotSettingCategories::SpellTypeMinHPPct, "Spell Min HP Percent" },
|
||||||
|
{ BotSettingCategories::SpellTypeMaxHPPct, "Spell Max HP Percent" },
|
||||||
|
{ BotSettingCategories::SpellTypeIdlePriority, "Spell Idle Priority" },
|
||||||
|
{ BotSettingCategories::SpellTypeEngagedPriority, "Spell Engaged Priority" },
|
||||||
|
{ BotSettingCategories::SpellTypePursuePriority, "Spell Pursue Priority" },
|
||||||
|
{ BotSettingCategories::SpellTypeAEOrGroupTargetCount, "Spell Target Counts" },
|
||||||
|
{ BotSettingCategories::SpellTypeAnnounceCast, "Spell Announce Casts" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::map<uint8, std::string> bot_setting_category_short_names = {
|
||||||
{ BotSettingCategories::BaseSetting, "BaseSetting" },
|
{ BotSettingCategories::BaseSetting, "BaseSetting" },
|
||||||
{ BotSettingCategories::SpellHold, "SpellHolds" },
|
{ BotSettingCategories::SpellHold, "SpellHolds" },
|
||||||
{ BotSettingCategories::SpellDelay, "SpellDelays" },
|
{ BotSettingCategories::SpellDelay, "SpellDelays" },
|
||||||
{ BotSettingCategories::SpellMinThreshold, "SpellMinThresholds" },
|
{ BotSettingCategories::SpellMinThreshold, "SpellMinThresholds" },
|
||||||
{ BotSettingCategories::SpellMaxThreshold, "SpellMaxThresholds" },
|
{ BotSettingCategories::SpellMaxThreshold, "SpellMaxThresholds" },
|
||||||
{ BotSettingCategories::SpellTypeResistLimit, "SpellResistLimit" },
|
{ BotSettingCategories::SpellTypeResistLimit, "SpellResistLimits" },
|
||||||
{ BotSettingCategories::SpellTypeAggroCheck, "SpellAggroChecks" },
|
{ BotSettingCategories::SpellTypeAggroCheck, "SpellAggroChecks" },
|
||||||
{ BotSettingCategories::SpellTypeMinManaPct, "SpellMinManaPct" },
|
{ BotSettingCategories::SpellTypeMinManaPct, "SpellMinManaPct" },
|
||||||
{ BotSettingCategories::SpellTypeMaxManaPct, "SpellMaxManaPct" },
|
{ BotSettingCategories::SpellTypeMaxManaPct, "SpellMaxManaPct" },
|
||||||
@@ -137,7 +156,7 @@ static std::map<uint8, std::string> botSpellCategory_names = {
|
|||||||
{ BotSettingCategories::SpellTypeAnnounceCast, "SpellAnnounceCasts" }
|
{ BotSettingCategories::SpellTypeAnnounceCast, "SpellAnnounceCasts" }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace BotPriorityCategories { // Update GetBotSpellCategoryName as needed
|
namespace BotPriorityCategories {
|
||||||
constexpr uint8 Idle = 0;
|
constexpr uint8 Idle = 0;
|
||||||
constexpr uint8 Engaged = 1;
|
constexpr uint8 Engaged = 1;
|
||||||
constexpr uint8 Pursue = 2;
|
constexpr uint8 Pursue = 2;
|
||||||
@@ -591,7 +610,6 @@ public:
|
|||||||
void SetBotBaseSetting(uint16 bot_setting, int setting_value);
|
void SetBotBaseSetting(uint16 bot_setting, int setting_value);
|
||||||
int GetSetting(uint16 setting_category, uint16 setting_type);
|
int GetSetting(uint16 setting_category, uint16 setting_type);
|
||||||
void SetBotSetting(uint8 setting_type, uint16 bot_setting, int setting_value);
|
void SetBotSetting(uint8 setting_type, uint16 bot_setting, int setting_value);
|
||||||
void CopySettings(Bot* to, uint8 setting_type, uint16 spell_type = UINT16_MAX);
|
|
||||||
void CopyBotSpellSettings(Bot* to);
|
void CopyBotSpellSettings(Bot* to);
|
||||||
void ResetBotSpellSettings();
|
void ResetBotSpellSettings();
|
||||||
|
|
||||||
@@ -643,7 +661,7 @@ public:
|
|||||||
uint8 GetDefaultSpellTypeMinThreshold(uint16 spell_type, uint8 stance = Stance::Balanced);
|
uint8 GetDefaultSpellTypeMinThreshold(uint16 spell_type, uint8 stance = Stance::Balanced);
|
||||||
uint8 GetDefaultSpellTypeMaxThreshold(uint16 spell_type, uint8 stance = Stance::Balanced);
|
uint8 GetDefaultSpellTypeMaxThreshold(uint16 spell_type, uint8 stance = Stance::Balanced);
|
||||||
uint16 GetUltimateSpellTypeDelay(uint16 spell_type, Mob* tar);
|
uint16 GetUltimateSpellTypeDelay(uint16 spell_type, Mob* tar);
|
||||||
bool GetUltimateSpellTypeDelayCheck(uint16 spell_type, Mob* tar);
|
bool GetUltimateSpellTypeRecastCheck(uint16 spell_type, Mob* tar);
|
||||||
uint8 GetUltimateSpellTypeMinThreshold(uint16 spell_type, Mob* tar);
|
uint8 GetUltimateSpellTypeMinThreshold(uint16 spell_type, Mob* tar);
|
||||||
uint8 GetUltimateSpellTypeMaxThreshold(uint16 spell_type, Mob* tar);
|
uint8 GetUltimateSpellTypeMaxThreshold(uint16 spell_type, Mob* tar);
|
||||||
void SetIllusionBlock(bool value) { _illusionBlock = value; }
|
void SetIllusionBlock(bool value) { _illusionBlock = value; }
|
||||||
@@ -677,6 +695,7 @@ public:
|
|||||||
bool IsValidSpellTypeSubType(uint16 spell_type, uint16 sub_type, uint16 spell_id);
|
bool IsValidSpellTypeSubType(uint16 spell_type, uint16 sub_type, uint16 spell_id);
|
||||||
static bool IsValidBotSpellCategory(uint8 setting_type);
|
static bool IsValidBotSpellCategory(uint8 setting_type);
|
||||||
static std::string GetBotSpellCategoryName(uint8 setting_type);
|
static std::string GetBotSpellCategoryName(uint8 setting_type);
|
||||||
|
static std::string GetBotSpellCategoryShortName(uint8 setting_type);
|
||||||
static uint16 GetBotSpellCategoryIDByShortName(std::string setting_string);
|
static uint16 GetBotSpellCategoryIDByShortName(std::string setting_string);
|
||||||
void AssignBotSpellsToTypes(std::vector<BotSpells>& AIBot_spells, std::unordered_map<uint16, std::vector<BotSpells_wIndex>>& AIBot_spells_by_type);
|
void AssignBotSpellsToTypes(std::vector<BotSpells>& AIBot_spells, std::unordered_map<uint16, std::vector<BotSpells_wIndex>>& AIBot_spells_by_type);
|
||||||
uint16 GetSpellByAA(int id, AA::Rank*& rank);
|
uint16 GetSpellByAA(int id, AA::Rank*& rank);
|
||||||
@@ -797,6 +816,7 @@ public:
|
|||||||
|
|
||||||
bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; }
|
bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; }
|
||||||
uint8 GetBotStance() { return _botStance; }
|
uint8 GetBotStance() { return _botStance; }
|
||||||
|
static bool IsValidBotStance(uint8 stance);
|
||||||
uint8 GetChanceToCastBySpellType(uint16 spell_type);
|
uint8 GetChanceToCastBySpellType(uint16 spell_type);
|
||||||
bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; }
|
bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; }
|
||||||
bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; }
|
bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; }
|
||||||
@@ -1107,6 +1127,7 @@ public:
|
|||||||
bool TryAutoDefend(Client* bot_owner, float leash_distance);
|
bool TryAutoDefend(Client* bot_owner, float leash_distance);
|
||||||
bool TryIdleChecks(float fm_distance);
|
bool TryIdleChecks(float fm_distance);
|
||||||
bool TryNonCombatMovementChecks(Client* bot_owner, const Mob* follow_mob, glm::vec3& Goal);
|
bool TryNonCombatMovementChecks(Client* bot_owner, const Mob* follow_mob, glm::vec3& Goal);
|
||||||
|
void DoOutOfCombatChecks(Client* bot_owner, Mob* follow_mob, glm::vec3& Goal, float leash_distance, float fm_distance);
|
||||||
bool TryBardMovementCasts();
|
bool TryBardMovementCasts();
|
||||||
bool BotRangedAttack(Mob* other, bool can_double_attack = false);
|
bool BotRangedAttack(Mob* other, bool can_double_attack = false);
|
||||||
bool CheckDoubleRangedAttack();
|
bool CheckDoubleRangedAttack();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user