mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 20:33:01 +00:00
Compare commits
177 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2538ee7976 | |||
| a7bfc5ec92 | |||
| d7d99152ac | |||
| 0d09edf9aa | |||
| 0a3f1d3c41 | |||
| ac12ba153e | |||
| 989d199908 | |||
| 1bc1f71254 | |||
| 41c5369c18 | |||
| d6b5a9d343 | |||
| a5e8a4c2cd | |||
| 9a09d820a5 | |||
| b1d873d1fc | |||
| 043eeced6f | |||
| e9a0c79301 | |||
| dc48c45421 | |||
| d7a8fb8691 | |||
| 3a5381d38a | |||
| e64f03fcc0 | |||
| d77966797e | |||
| 048aad437b | |||
| b2d9de8d96 | |||
| 42bfa4bb2e | |||
| 72ce7c8e91 | |||
| e306c86875 | |||
| 3ae7979a67 | |||
| b638795f9b | |||
| 9e3bf91374 | |||
| cd89926435 | |||
| e19f72f021 | |||
| df1dc5d1e4 | |||
| e11286164f | |||
| b946b800fb | |||
| ab8ac81df6 | |||
| 109940fc0c | |||
| a87496b0cf | |||
| f905ee70e4 | |||
| 52417023f8 | |||
| 20d9417628 | |||
| 4692799677 | |||
| cf7f0f4321 | |||
| 823a5956de | |||
| 6a8bd3c5d6 | |||
| 523ba30d81 | |||
| d7ea290b6b | |||
| 036309ebec | |||
| b400700d81 | |||
| 21cec87ac4 | |||
| abdec39cdd | |||
| d2372de982 | |||
| ea9b7841d4 | |||
| 8826d7b927 | |||
| e4157f0221 | |||
| 66cc947b2a | |||
| 5bfd8f5da2 | |||
| 96830b4a19 | |||
| 4bf60a6522 | |||
| 16cb7364e8 | |||
| f5050ab5dc | |||
| e32cbf19ee | |||
| ee12a7ad2e | |||
| e5bdbc4f1e | |||
| f829a99e6d | |||
| 82aa6a1587 | |||
| 161c13f457 | |||
| b29c26becb | |||
| e48dae2392 | |||
| 4b83a96f64 | |||
| 95cc22ffbb | |||
| 6ca11256c6 | |||
| d94493468c | |||
| 957b4f8821 | |||
| 5013459824 | |||
| 94af2843e3 | |||
| 3bfb148bdc | |||
| 96370e0298 | |||
| fef5108b0d | |||
| 6f883566f6 | |||
| 45b1501c8a | |||
| 7e94f0ac72 | |||
| 2aa19f4cae | |||
| 805829f15d | |||
| 2c2a8cdb63 | |||
| ee3d02bac6 | |||
| b90139bd9a | |||
| e6a3d5e1c5 | |||
| 74f1eac401 | |||
| 1be9b2cdfd | |||
| add0a8dddf | |||
| 8c226054e7 | |||
| b4605f77e3 | |||
| 74a63daf7e | |||
| 8ee7910569 | |||
| b766a79c11 | |||
| 5e3b6d363a | |||
| b2fc59878a | |||
| 4896688ac5 | |||
| 0385ed8526 | |||
| 9974aaff57 | |||
| b6c3e549da | |||
| 70ee95efc0 | |||
| 1d38e473d7 | |||
| 1aa3a4b11a | |||
| 398ecbc8cf | |||
| c4613e1b0f | |||
| 3003a59955 | |||
| 0c582cc4f9 | |||
| 69c42510ca | |||
| 79c8858ec8 | |||
| c3d8d423fe | |||
| 1cbda61891 | |||
| 8d12a5b1b1 | |||
| 182327b385 | |||
| aa0ca88d9d | |||
| 103a37e762 | |||
| 34f19489d0 | |||
| c001060429 | |||
| 89be55254e | |||
| 2da6190950 | |||
| d5e024cc02 | |||
| 35fe38cd09 | |||
| eb3664a444 | |||
| a244509d63 | |||
| 873c128f46 | |||
| 8314f2348c | |||
| 29720f95ed | |||
| a478fd2600 | |||
| f57c37e9c5 | |||
| b9fb4babba | |||
| c2e4082045 | |||
| e1dee55ecd | |||
| 1632ff04b0 | |||
| 873209dbc0 | |||
| a00b2eb382 | |||
| 67d8250b1c | |||
| f505c2cfd2 | |||
| a221e50cc2 | |||
| 32c5d4d9f6 | |||
| ce4716e9a5 | |||
| a99ce4fbdb | |||
| dcfc54d408 | |||
| c13ec5a06d | |||
| d182fc3613 | |||
| 5a89fcfb78 | |||
| db3601c25c | |||
| 137a9f835a | |||
| 4ad46b54df | |||
| 3f46210639 | |||
| 6ec63969bb | |||
| 767846f7e5 | |||
| 04bb9bf39c | |||
| e6df5be1ed | |||
| 6bb2f97b74 | |||
| 86f39743fc | |||
| 447fc026a8 | |||
| 7408df933c | |||
| 2f59e70c6b | |||
| eb8514eea8 | |||
| f498bac574 | |||
| 9a0b3a4c36 | |||
| 34ea870717 | |||
| d68c1a7a6c | |||
| c50100fcdb | |||
| 20cdc1e63d | |||
| 43c7523ee1 | |||
| e060d97798 | |||
| 435b6142b8 | |||
| 508b37dc93 | |||
| 0adca46a73 | |||
| e920e35a5c | |||
| 20c01ef343 | |||
| 1567141c19 | |||
| 6bc9bcf15a | |||
| 86a2a86ba8 | |||
| 3e6924d10e | |||
| a27a8adf1e | |||
| 13994fb3e4 |
+395
@@ -1,3 +1,398 @@
|
||||
## [22.49.0] 4/15/2024
|
||||
|
||||
### Code
|
||||
|
||||
* Avoid unnecessary copies in database functions ([#4220](https://github.com/EQEmu/Server/pull/4220)) @joligario 2024-03-29
|
||||
* Reference type in `GetRaidLeaderName` ([#4218](https://github.com/EQEmu/Server/pull/4218)) @joligario 2024-03-28
|
||||
* Remove unnecessary reference types ([#4212](https://github.com/EQEmu/Server/pull/4212)) @joligario 2024-03-28
|
||||
|
||||
### Crash
|
||||
|
||||
* Check mob pointer before trying to remove it ([#4230](https://github.com/EQEmu/Server/pull/4230)) @Akkadius 2024-04-01
|
||||
|
||||
### Feature
|
||||
|
||||
* Add Character Auto Login ([#4216](https://github.com/EQEmu/Server/pull/4216)) @Kinglykrab 2024-04-15
|
||||
* Add LuaMod functions for CommonDamage and HealDamage ([#4227](https://github.com/EQEmu/Server/pull/4227)) @xackery 2024-03-31
|
||||
* Add RegisterBug LuaMod ([#4209](https://github.com/EQEmu/Server/pull/4209)) @xackery 2024-03-30
|
||||
* Additive Spell Focus from Worn slot with Limit Checks ([#4208](https://github.com/EQEmu/Server/pull/4208)) @KayenEQ 2024-03-30
|
||||
* Fix ignore_default on lua mod damage ([#4228](https://github.com/EQEmu/Server/pull/4228)) @xackery 2024-04-15
|
||||
|
||||
### Fixes
|
||||
|
||||
* Client not updating HP bar when an HP Buff with a Heal is applied. ([#4237](https://github.com/EQEmu/Server/pull/4237)) @KayenEQ 2024-04-02
|
||||
* Fix Account Flags Loading ([#4243](https://github.com/EQEmu/Server/pull/4243)) @Kinglykrab 2024-04-15
|
||||
* Fix Auto Login Issue ([#4213](https://github.com/EQEmu/Server/pull/4213)) @Kinglykrab 2024-03-28
|
||||
* Fix Bot Creation Issue ([#4235](https://github.com/EQEmu/Server/pull/4235)) @Kinglykrab 2024-04-02
|
||||
* Fix Bot/Character ID Overlap in Groups ([#4093](https://github.com/EQEmu/Server/pull/4093)) @Kinglykrab 2024-03-23
|
||||
* Fix Group Leadership ([#4214](https://github.com/EQEmu/Server/pull/4214)) @Kinglykrab 2024-03-28
|
||||
* Fix Issue With Bot Raid Aggro ([#4222](https://github.com/EQEmu/Server/pull/4222)) @Kinglykrab 2024-03-31
|
||||
* Fix Lua Crash with Spell Blocked Event ([#4236](https://github.com/EQEmu/Server/pull/4236)) @Kinglykrab 2024-04-01
|
||||
* Fix Luabind Double Class Register ([#4219](https://github.com/EQEmu/Server/pull/4219)) @Kinglykrab 2024-03-29
|
||||
* Fix crash in SendEnterWorld ([#4204](https://github.com/EQEmu/Server/pull/4204)) @Akkadius 2024-03-24
|
||||
* Fix event_consider any_cast error ([#4210](https://github.com/EQEmu/Server/pull/4210)) @xackery 2024-03-27
|
||||
* Fix fishing chances ([#4203](https://github.com/EQEmu/Server/pull/4203)) @joligario 2024-03-24
|
||||
* Fix manifest for skill caps schema type ([#4231](https://github.com/EQEmu/Server/pull/4231)) @Akkadius 2024-04-02
|
||||
* Hero forge armor bug on login and show helm toggle. ([#4246](https://github.com/EQEmu/Server/pull/4246)) @noudess 2024-04-15
|
||||
* Radiant/Ebon Crystals should only extract to 1000 ([#4195](https://github.com/EQEmu/Server/pull/4195)) @fryguy503 2024-03-23
|
||||
* SPA214 SE_MaxHPChange calculation errors corrected. ([#4238](https://github.com/EQEmu/Server/pull/4238)) @KayenEQ 2024-04-02
|
||||
* Shared Tasks - charid is now character_id ([#4233](https://github.com/EQEmu/Server/pull/4233)) @fryguy503 2024-04-01
|
||||
* Using %T in channel messages on fresh corpse yields mob, not corpse name. ([#4168](https://github.com/EQEmu/Server/pull/4168)) @noudess 2024-04-05
|
||||
|
||||
### Hot Fix
|
||||
|
||||
* Fix Group::AddToGroup ([#4201](https://github.com/EQEmu/Server/pull/4201)) @Kinglykrab 2024-03-23
|
||||
* Hot Fix for Group::AddToGroup Hot Fix ([#4202](https://github.com/EQEmu/Server/pull/4202)) @Kinglykrab 2024-03-23
|
||||
|
||||
### Loot
|
||||
|
||||
* Add content filtering to lootdrop_entries ([#4229](https://github.com/EQEmu/Server/pull/4229)) @Akkadius 2024-04-15
|
||||
|
||||
### Lua
|
||||
|
||||
* Add Zone and Language Constants ([#4211](https://github.com/EQEmu/Server/pull/4211)) @fryguy503 2024-03-28
|
||||
|
||||
### Messages
|
||||
|
||||
* Fix bug where DoT messages stop coming out when mob dies. ([#4249](https://github.com/EQEmu/Server/pull/4249)) @noudess 2024-04-15
|
||||
|
||||
### Performance
|
||||
|
||||
* Change skill_cap from vector to map ([#4252](https://github.com/EQEmu/Server/pull/4252)) @xackery 2024-04-15
|
||||
|
||||
### Pets
|
||||
|
||||
* Fix errors in sync with client of sit/stand ([#4245](https://github.com/EQEmu/Server/pull/4245)) @noudess 2024-04-15
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add Archetype Methods to Perl/Lua ([#4181](https://github.com/EQEmu/Server/pull/4181)) @Kinglykrab 2024-03-23
|
||||
* Add Class/Deity/Race Methods to Perl/Lua ([#4215](https://github.com/EQEmu/Server/pull/4215)) @Kinglykrab 2024-03-28
|
||||
* Add GetConsiderColor() to Perl/Lua ([#4253](https://github.com/EQEmu/Server/pull/4253)) @Kinglykrab 2024-04-15
|
||||
* Add Spell Blocked Event to Perl/Lua ([#4217](https://github.com/EQEmu/Server/pull/4217)) @Kinglykrab 2024-04-01
|
||||
|
||||
### Quests
|
||||
|
||||
* Avoid Player and Bot quests in unloaded zone ([#4232](https://github.com/EQEmu/Server/pull/4232)) @hgtw 2024-04-01
|
||||
|
||||
### Repositories
|
||||
|
||||
* Convert database.cpp to Repositories ([#4054](https://github.com/EQEmu/Server/pull/4054)) @Kinglykrab 2024-03-24
|
||||
|
||||
### Skill Caps
|
||||
|
||||
* Further improvements ([#4205](https://github.com/EQEmu/Server/pull/4205)) @Akkadius 2024-03-24
|
||||
* Remove from shared memory and simplify ([#4069](https://github.com/EQEmu/Server/pull/4069)) @Kinglykrab 2024-03-23
|
||||
|
||||
### Spells
|
||||
|
||||
* Implemented SPA 463 SE_SHIELD_TARGET ([#4224](https://github.com/EQEmu/Server/pull/4224)) @KayenEQ 2024-03-30
|
||||
* Normal Group Spells (non-raid) landed twice on caster ([#4240](https://github.com/EQEmu/Server/pull/4240)) @noudess 2024-04-15
|
||||
* SPA148 Stacking Fix ([#4206](https://github.com/EQEmu/Server/pull/4206)) @KayenEQ 2024-03-27
|
||||
* SPA69 TotalHP can be used in Worn Slot, Fixes/Updates to Max HP related variables. ([#4244](https://github.com/EQEmu/Server/pull/4244)) @KayenEQ 2024-04-15
|
||||
|
||||
## [22.48.0] 3/23/2024
|
||||
|
||||
### Bots
|
||||
|
||||
* IsValidTarget Crash Fix ([#4187](https://github.com/EQEmu/Server/pull/4187)) @nytmyr 2024-03-12
|
||||
* Move BotGroupSay to Pet Response ([#4171](https://github.com/EQEmu/Server/pull/4171)) @nytmyr 2024-03-08
|
||||
|
||||
### Code
|
||||
|
||||
* Cleanup Zone Get Methods ([#4169](https://github.com/EQEmu/Server/pull/4169)) @Kinglykrab 2024-03-09
|
||||
|
||||
### Fixes
|
||||
|
||||
* An Update to Xtarget to exclude Bot owned Temp/Swarm Pets ([#4172](https://github.com/EQEmu/Server/pull/4172)) @MortimerGreenwald 2024-03-08
|
||||
* Fix #serverrules Command ([#4193](https://github.com/EQEmu/Server/pull/4193)) @Kinglykrab 2024-03-20
|
||||
* Fix Bot Cloning ([#4186](https://github.com/EQEmu/Server/pull/4186)) @Kinglykrab 2024-03-17
|
||||
* Fix Crash in ClientList::GetCLEIP ([#4173](https://github.com/EQEmu/Server/pull/4173)) @Kinglykrab 2024-03-10
|
||||
* Fix Default Value in `rule_values` table ([#4166](https://github.com/EQEmu/Server/pull/4166)) @Kinglykrab 2024-03-07
|
||||
* Fix EVENT_KILLED_MERIT firing before NPC removal ([#4185](https://github.com/EQEmu/Server/pull/4185)) @Kinglykrab 2024-03-17
|
||||
* Fix Empty Groups When Removing Bots ([#4178](https://github.com/EQEmu/Server/pull/4178)) @Kinglykrab 2024-03-14
|
||||
* Fix GetLeaderName() for Groups ([#4184](https://github.com/EQEmu/Server/pull/4184)) @Kinglykrab 2024-03-14
|
||||
* Fix Mob::CalculateDistance(mob) Typo ([#4183](https://github.com/EQEmu/Server/pull/4183)) @Kinglykrab 2024-03-10
|
||||
* Fix Proximity Say ([#4189](https://github.com/EQEmu/Server/pull/4189)) @Kinglykrab 2024-03-15
|
||||
* Fix ScaleNPC() in Perl ([#4196](https://github.com/EQEmu/Server/pull/4196)) @Kinglykrab 2024-03-23
|
||||
* Fix range_percent ([#4197](https://github.com/EQEmu/Server/pull/4197)) @Kinglykrab 2024-03-22
|
||||
* Fix reusing timers ([#4199](https://github.com/EQEmu/Server/pull/4199)) @joligario 2024-03-23
|
||||
|
||||
### Hot Fix
|
||||
|
||||
* Add bool return to fix Client::RemoveAAPoints ([#4176](https://github.com/EQEmu/Server/pull/4176)) @Kinglykrab 2024-03-09
|
||||
|
||||
### Loot
|
||||
|
||||
* Fix issue with nested data being loaded multiple times ([#4192](https://github.com/EQEmu/Server/pull/4192)) @Akkadius 2024-03-23
|
||||
|
||||
### Misc
|
||||
|
||||
* Windows preprocessor define in crash.cpp ([#4191](https://github.com/EQEmu/Server/pull/4191)) @joligario 2024-03-23
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add Buff Support to Perl/Lua ([#4182](https://github.com/EQEmu/Server/pull/4182)) @Kinglykrab 2024-03-14
|
||||
* Add DeleteBot() to Perl/Lua ([#4167](https://github.com/EQEmu/Server/pull/4167)) @nytmyr 2024-03-07
|
||||
* Add GetDeityName() to Perl/Lua ([#4180](https://github.com/EQEmu/Server/pull/4180)) @Kinglykrab 2024-03-14
|
||||
* Add RemoveAAPoints() and AA Loss Event to Perl/Lua ([#4174](https://github.com/EQEmu/Server/pull/4174)) @Kinglykrab 2024-03-09
|
||||
* Add RemoveAlternateCurrencyValue() to Perl/Lua ([#4190](https://github.com/EQEmu/Server/pull/4190)) @Kinglykrab 2024-03-17
|
||||
* Add Restore Methods for Health, Mana, and Endurance to Perl/Lua ([#4179](https://github.com/EQEmu/Server/pull/4179)) @Kinglykrab 2024-03-23
|
||||
* Add Silent Saylink Methods to Perl/Lua ([#4177](https://github.com/EQEmu/Server/pull/4177)) @Kinglykrab 2024-03-14
|
||||
|
||||
### Rules
|
||||
|
||||
* Add World:Rules Rule ([#4194](https://github.com/EQEmu/Server/pull/4194)) @Kinglykrab 2024-03-23
|
||||
|
||||
### Tradeskills
|
||||
|
||||
* Implement learning recipes from books ([#4170](https://github.com/EQEmu/Server/pull/4170)) @hgtw 2024-03-23
|
||||
|
||||
## [22.47.0] 3/5/2024
|
||||
|
||||
### Crash Fix
|
||||
|
||||
* Added a guild_mgr check ([#4163](https://github.com/EQEmu/Server/pull/4163)) @neckkola 2024-03-06
|
||||
* Goto Command could crash using Developer Tools ([#4158](https://github.com/EQEmu/Server/pull/4158)) @neckkola 2024-03-04
|
||||
* Groundspawn Memory Corruption ([#4157](https://github.com/EQEmu/Server/pull/4157)) @neckkola 2024-03-04
|
||||
* Update to location of qGlobals initialization ([#4144](https://github.com/EQEmu/Server/pull/4144)) @neckkola 2024-03-02
|
||||
|
||||
### Feature
|
||||
|
||||
* Adds rules to control level requirements for Double Backstab, Assassinate, and Double Bowshot (#4159) ([#29](https://github.com/EQEmu/Server/pull/29)) @catapultam-habeo 2024-03-04
|
||||
* Adjust String-based Rules Length ([#4138](https://github.com/EQEmu/Server/pull/4138)) @Kinglykrab 2024-03-06
|
||||
* Exempt a zone from IP-limit checks. ([#4137](https://github.com/EQEmu/Server/pull/4137)) @catapultam-habeo 2024-03-02
|
||||
|
||||
### Fixes
|
||||
|
||||
* Add id to the guild_bank table ([#4155](https://github.com/EQEmu/Server/pull/4155)) @neckkola 2024-03-05
|
||||
* Fix Bots/Bot Pets ending up on XTargets ([#4132](https://github.com/EQEmu/Server/pull/4132)) @Kinglykrab 2024-03-02
|
||||
* Fix Character EXP Modifiers default ([#4161](https://github.com/EQEmu/Server/pull/4161)) @Kinglykrab 2024-03-06
|
||||
* Fix Spawns Not Parsing Quest on Zone Bootup ([#4149](https://github.com/EQEmu/Server/pull/4149)) @Kinglykrab 2024-03-05
|
||||
* Fix typo when updating spawn events in spawn condition manager ([#4160](https://github.com/EQEmu/Server/pull/4160)) @joligario 2024-03-05
|
||||
* GetBotNameByID Temporary Reference Warning ([#4145](https://github.com/EQEmu/Server/pull/4145)) @Kinglykrab 2024-03-02
|
||||
* Prevent NPE when creating DZ using ad-hoc version IDs ([#4141](https://github.com/EQEmu/Server/pull/4141)) @catapultam-habeo 2024-03-05
|
||||
* Update FreeGuildID Routine ([#4143](https://github.com/EQEmu/Server/pull/4143)) @neckkola 2024-03-02
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add Bot Special Attacks for Immune Aggro/Damage ([#4108](https://github.com/EQEmu/Server/pull/4108)) @Kinglykrab 2024-03-02
|
||||
* Add GetHeroicStrikethrough() to Perl/Lua ([#4150](https://github.com/EQEmu/Server/pull/4150)) @Kinglykrab 2024-03-03
|
||||
* Add IsAlwaysAggro() to Perl/Lua ([#4152](https://github.com/EQEmu/Server/pull/4152)) @Kinglykrab 2024-03-04
|
||||
* Add IsBoat()/IsControllableBoat() to Perl/Lua ([#4151](https://github.com/EQEmu/Server/pull/4151)) @Kinglykrab 2024-03-03
|
||||
* Add IsDestructibleObject() to Perl/Lua ([#4153](https://github.com/EQEmu/Server/pull/4153)) @Kinglykrab 2024-03-03
|
||||
|
||||
### Zone
|
||||
|
||||
* Zone Routing Improvements ([#4142](https://github.com/EQEmu/Server/pull/4142)) @Akkadius 2024-03-02
|
||||
|
||||
### Zoning
|
||||
|
||||
* Zone routing adjustment ([#4162](https://github.com/EQEmu/Server/pull/4162)) @Akkadius 2024-03-06
|
||||
|
||||
## [22.46.1] 3/2/2024
|
||||
|
||||
### Fixes
|
||||
|
||||
* Change `UnburyCorpse` to use repository methods ([#4147](https://github.com/EQEmu/Server/pull/4147)) @joligario 2024-03-03
|
||||
|
||||
## [22.46.0] 3/2/2024
|
||||
|
||||
### Commands
|
||||
|
||||
* Add #fish Command ([#4136](https://github.com/EQEmu/Server/pull/4136)) @Kinglykrab 2024-03-01
|
||||
|
||||
### Crash Fix
|
||||
|
||||
* Raid::UpdateGroupAAs ([#4139](https://github.com/EQEmu/Server/pull/4139)) @neckkola 2024-03-02
|
||||
* Update to location of qGlobals initialization ([#4144](https://github.com/EQEmu/Server/pull/4144)) @neckkola 2024-03-02
|
||||
|
||||
### Feature
|
||||
|
||||
* Exempt a zone from IP-limit checks. ([#4137](https://github.com/EQEmu/Server/pull/4137)) @catapultam-habeo 2024-03-02
|
||||
|
||||
### Fixes
|
||||
|
||||
* Cleanup NPC Mana Tap Logic ([#4134](https://github.com/EQEmu/Server/pull/4134)) @noudess 2024-03-02
|
||||
* Fix Bots/Bot Pets ending up on XTargets ([#4132](https://github.com/EQEmu/Server/pull/4132)) @Kinglykrab 2024-03-02
|
||||
* Fix issue with NPC Secondary Textures ([#4129](https://github.com/EQEmu/Server/pull/4129)) @Kinglykrab 2024-03-01
|
||||
* GetBotNameByID Temporary Reference Warning ([#4145](https://github.com/EQEmu/Server/pull/4145)) @Kinglykrab 2024-03-02
|
||||
* Update FreeGuildID Routine ([#4143](https://github.com/EQEmu/Server/pull/4143)) @neckkola 2024-03-02
|
||||
* Use std::clamp for Mob::ChangeSize ([#4140](https://github.com/EQEmu/Server/pull/4140)) @joligario 2024-03-02
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add Bot Special Attacks for Immune Aggro/Damage ([#4108](https://github.com/EQEmu/Server/pull/4108)) @Kinglykrab 2024-03-02
|
||||
|
||||
### Zone
|
||||
|
||||
* Zone Routing Improvements ([#4142](https://github.com/EQEmu/Server/pull/4142)) @Akkadius 2024-03-02
|
||||
|
||||
## [22.45.1] 2/29/2024
|
||||
|
||||
### Character Creation
|
||||
|
||||
* Improved Random Name Generator ([#4081](https://github.com/EQEmu/Server/pull/4081)) @catapultam-habeo 2024-02-27
|
||||
|
||||
### Code
|
||||
|
||||
* Fix Server Rules Documentation Generation ([#4125](https://github.com/EQEmu/Server/pull/4125)) @Kinglykrab 2024-02-26
|
||||
* Remove unnecessary stoptimer logs ([#4128](https://github.com/EQEmu/Server/pull/4128)) @Kinglykrab 2024-02-28
|
||||
|
||||
### Commands
|
||||
|
||||
* Add `#forage` command ([#4133](https://github.com/EQEmu/Server/pull/4133)) @joligario 2024-02-29
|
||||
|
||||
### Crash
|
||||
|
||||
* Fix crash issue during database dump ([#4127](https://github.com/EQEmu/Server/pull/4127)) @Akkadius 2024-02-29
|
||||
|
||||
### Crash Fix
|
||||
|
||||
* D20 crash if mitigation average resulted in 0 ([#4131](https://github.com/EQEmu/Server/pull/4131)) @nytmyr 2024-02-29
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix forage returning first result from table ([#4130](https://github.com/EQEmu/Server/pull/4130)) @nytmyr 2024-02-29
|
||||
* Who /all displays incorrect guild name ([#4123](https://github.com/EQEmu/Server/pull/4123)) @neckkola 2024-02-25
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add Pet Owner Methods to Perl/Lua ([#4115](https://github.com/EQEmu/Server/pull/4115)) @Kinglykrab 2024-02-25
|
||||
|
||||
## [22.45.0] 2/24/2024
|
||||
|
||||
### Beacon
|
||||
|
||||
* Revert a few lines of PR #4024 that broke beacons ([#4118](https://github.com/EQEmu/Server/pull/4118)) @noudess 2024-02-24
|
||||
|
||||
### Bots
|
||||
|
||||
* Cleanup empty `bot_commands` files ([#4095](https://github.com/EQEmu/Server/pull/4095)) @Kinglykrab 2024-02-19
|
||||
* Remove Alt Combat Functionality ([#4067](https://github.com/EQEmu/Server/pull/4067)) @Kinglykrab 2024-02-12
|
||||
|
||||
### Code
|
||||
|
||||
* Update fmt to 10.2.1 ([#4071](https://github.com/EQEmu/Server/pull/4071)) @hgtw 2024-02-16
|
||||
* Use explicit conversions for enum formatting ([#4064](https://github.com/EQEmu/Server/pull/4064)) @hgtw 2024-02-12
|
||||
|
||||
### Database
|
||||
|
||||
* Add content_database flag for zone changes ([#4104](https://github.com/EQEmu/Server/pull/4104)) @joligario 2024-02-20
|
||||
* Remove "item_tick" from database schema per https://github.com/EQEmu/Server/pull/3985 ([#4083](https://github.com/EQEmu/Server/pull/4083)) @Akkadius 2024-02-16
|
||||
|
||||
### Expansions
|
||||
|
||||
* Zone Expansion Version Routing ([#4084](https://github.com/EQEmu/Server/pull/4084)) @Akkadius 2024-02-20
|
||||
|
||||
### Factions
|
||||
|
||||
* Fix issue with npcedit and cached factions ([#4103](https://github.com/EQEmu/Server/pull/4103)) @noudess 2024-02-20
|
||||
|
||||
### Feature
|
||||
|
||||
* Add Augments to Starting Items for Bots/Players ([#4100](https://github.com/EQEmu/Server/pull/4100)) @Kinglykrab 2024-02-21
|
||||
* Hot Zone Bonus XP Notice ([#4091](https://github.com/EQEmu/Server/pull/4091)) @fryguy503 2024-02-18
|
||||
|
||||
### Fixes
|
||||
|
||||
* Add safety check to SummonAllCharacterCorpses. ([#4107](https://github.com/EQEmu/Server/pull/4107)) @fryguy503 2024-02-21
|
||||
* Added additional Guild-related crash checks ([#4105](https://github.com/EQEmu/Server/pull/4105)) @neckkola 2024-02-22
|
||||
* Aura effect spell id from #3964 ([#4094](https://github.com/EQEmu/Server/pull/4094)) @joligario 2024-02-18
|
||||
* Crash on Ubuntu 22.04 ([#4119](https://github.com/EQEmu/Server/pull/4119)) @neckkola 2024-02-25
|
||||
* Fix #wpadd Query ([#4078](https://github.com/EQEmu/Server/pull/4078)) @Kinglykrab 2024-02-14
|
||||
* Fix Bot Weapons with No Races ([#4110](https://github.com/EQEmu/Server/pull/4110)) @Kinglykrab 2024-02-25
|
||||
* Fix ClearSpawnTimers() ([#4073](https://github.com/EQEmu/Server/pull/4073)) @Kinglykrab 2024-02-13
|
||||
* Fix Issue with ClearSpawnTimers() ([#4070](https://github.com/EQEmu/Server/pull/4070)) @Kinglykrab 2024-02-13
|
||||
* Fix ObjectContentsRepository using content_db ([#4076](https://github.com/EQEmu/Server/pull/4076)) @Kinglykrab 2024-02-14
|
||||
* Fix Sympathetic Procs for Bots/Mercenariess ([#4086](https://github.com/EQEmu/Server/pull/4086)) @Kinglykrab 2024-02-19
|
||||
* Fix fix_z Query ([#4080](https://github.com/EQEmu/Server/pull/4080)) @Kinglykrab 2024-02-15
|
||||
* Fix hotzone string error ([#4109](https://github.com/EQEmu/Server/pull/4109)) @fryguy503 2024-02-22
|
||||
* Fix issue with IsEntOnHateList ([#4097](https://github.com/EQEmu/Server/pull/4097)) @Kinglykrab 2024-02-19
|
||||
* Fix manifest check on `base_data` change ([#4082](https://github.com/EQEmu/Server/pull/4082)) @joligario 2024-02-16
|
||||
* Revert 2df7d19 ([#4101](https://github.com/EQEmu/Server/pull/4101)) @joligario 2024-02-20
|
||||
* Update database_schema to add guild_permissions ([#4085](https://github.com/EQEmu/Server/pull/4085)) @neckkola 2024-02-16
|
||||
|
||||
### Guilds
|
||||
|
||||
* Fixes for Guild Bank ([#4120](https://github.com/EQEmu/Server/pull/4120)) @neckkola 2024-02-25
|
||||
|
||||
### Logs
|
||||
|
||||
* Fix log in BaseGuildManager::IsGuildLeader() ([#4102](https://github.com/EQEmu/Server/pull/4102)) @joligario 2024-02-20
|
||||
|
||||
### Opcodes
|
||||
|
||||
* Fix opcode reloading ([#4075](https://github.com/EQEmu/Server/pull/4075)) @Akkadius 2024-02-14
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add Bot Methods to Perl/Lua ([#4113](https://github.com/EQEmu/Server/pull/4113)) @Kinglykrab 2024-02-25
|
||||
* Add Entity Variable Events to Perl/Lua ([#4092](https://github.com/EQEmu/Server/pull/4092)) @Kinglykrab 2024-02-20
|
||||
* Add GetAugmentIDs() to Perl/Lua ([#4114](https://github.com/EQEmu/Server/pull/4114)) @Kinglykrab 2024-02-25
|
||||
* Add GetNPCSpellsEffectsID() to Perl/Lua ([#4117](https://github.com/EQEmu/Server/pull/4117)) @Kinglykrab 2024-02-25
|
||||
* Add Hatelist Count Methods to Perl/Lua ([#4106](https://github.com/EQEmu/Server/pull/4106)) @Kinglykrab 2024-02-21
|
||||
* Add IsInAGuild() to Perl/Lua ([#4066](https://github.com/EQEmu/Server/pull/4066)) @Kinglykrab 2024-02-14
|
||||
* Add Pet Methods to Perl/Lua ([#4116](https://github.com/EQEmu/Server/pull/4116)) @Kinglykrab 2024-02-25
|
||||
* Add Timer Events to Perl/Lua ([#4099](https://github.com/EQEmu/Server/pull/4099)) @Kinglykrab 2024-02-19
|
||||
* Add spell cast methods to Lua ([#4096](https://github.com/EQEmu/Server/pull/4096)) @Kinglykrab 2024-02-19
|
||||
* Add tracebacks to Lua error messages ([#4079](https://github.com/EQEmu/Server/pull/4079)) @hgtw 2024-02-16
|
||||
* Export Combat Record to Death Events ([#4112](https://github.com/EQEmu/Server/pull/4112)) @Kinglykrab 2024-02-25
|
||||
|
||||
### Repositories
|
||||
|
||||
* Cleanup and Convert Character Creation to Repositories ([#4053](https://github.com/EQEmu/Server/pull/4053)) @Kinglykrab 2024-02-20
|
||||
* Convert Zone Flags to Repositories ([#4077](https://github.com/EQEmu/Server/pull/4077)) @Kinglykrab 2024-02-16
|
||||
* Update `zone` base repository from #4084 ([#4111](https://github.com/EQEmu/Server/pull/4111)) @joligario 2024-02-23
|
||||
|
||||
## [22.44.5] - 2/12/2024
|
||||
|
||||
### Fixes
|
||||
|
||||
* [Hotfix] Fix issues where we're using the wrong database pointers @Akkadius
|
||||
|
||||
## [22.44.4] - 2/12/2024
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix ClearSpawnTimers() ([#4073](https://github.com/EQEmu/Server/pull/4073)) @Kinglykrab 2024-02-13
|
||||
|
||||
## [22.44.3] - 2/12/2024
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix Issue with ClearSpawnTimers() ([#4070](https://github.com/EQEmu/Server/pull/4070)) @Kinglykrab 2024-02-13
|
||||
|
||||
## [22.44.2] - 2/12/2024
|
||||
|
||||
### Bots
|
||||
|
||||
* Remove Alt Combat Functionality ([#4067](https://github.com/EQEmu/Server/pull/4067)) @Kinglykrab 2024-02-12
|
||||
|
||||
### Code
|
||||
|
||||
* Use explicit conversions for enum formatting ([#4064](https://github.com/EQEmu/Server/pull/4064)) @hgtw 2024-02-12
|
||||
|
||||
### Database
|
||||
|
||||
* Fix default value for `time_of_death` in `character_corpses` ([#4060](https://github.com/EQEmu/Server/pull/4060)) @joligario 2024-02-11
|
||||
* Fix table name in manifest ([#4063](https://github.com/EQEmu/Server/pull/4063)) @joligario 2024-02-11
|
||||
* Proper default for `droptime` from `object_contents` ([#4061](https://github.com/EQEmu/Server/pull/4061)) @joligario 2024-02-11
|
||||
|
||||
### Fixes
|
||||
|
||||
* Guard against crash condition ([#4062](https://github.com/EQEmu/Server/pull/4062)) @neckkola 2024-02-11
|
||||
|
||||
### Guilds
|
||||
|
||||
* Clean up `GUILD_RANK_NONE` references ([#4059](https://github.com/EQEmu/Server/pull/4059)) @joligario 2024-02-11
|
||||
|
||||
## [22.44.1] - 2/11/2024
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix File::Exists(file_name) to be resilient to Chinese characters ([#4058](https://github.com/EQEmu/Server/pull/4058)) @Akkadius 2024-02-11
|
||||
|
||||
## [22.44.0] - 2/10/2024
|
||||
|
||||
### Base Data
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "../../common/content/world_content_service.h"
|
||||
#include "../../common/zone_store.h"
|
||||
#include "../../common/path_manager.h"
|
||||
#include "../../common/repositories/skill_caps_repository.h"
|
||||
#include "../../common/file.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
WorldContentService content_service;
|
||||
@@ -164,81 +166,76 @@ void ExportSpells(SharedDatabase *db)
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id)
|
||||
bool SkillUsable(SharedDatabase* db, int skill_id, int class_id)
|
||||
{
|
||||
|
||||
bool res = false;
|
||||
|
||||
std::string query = StringFormat(
|
||||
"SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
|
||||
class_id, skill_id
|
||||
const auto& l = SkillCapsRepository::GetWhere(
|
||||
*db,
|
||||
fmt::format(
|
||||
"`class_id` = {} AND `skill_id` = {} ORDER BY `cap` DESC LIMIT 1",
|
||||
class_id,
|
||||
skill_id
|
||||
)
|
||||
);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
if (row[0] && Strings::ToInt(row[0]) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !l.empty();
|
||||
}
|
||||
|
||||
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level)
|
||||
uint32 GetSkill(SharedDatabase* db, int skill_id, int class_id, int level)
|
||||
{
|
||||
|
||||
std::string query = StringFormat(
|
||||
"SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
|
||||
class_id, skill_id, level
|
||||
const auto& l = SkillCapsRepository::GetWhere(
|
||||
*db,
|
||||
fmt::format(
|
||||
"`class_id` = {} AND `skill_id` = {} AND `level` = {}",
|
||||
class_id,
|
||||
skill_id,
|
||||
level
|
||||
)
|
||||
);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
|
||||
if (l.empty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
return 0;
|
||||
}
|
||||
auto e = l.front();
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
return e.cap;
|
||||
}
|
||||
|
||||
void ExportSkillCaps(SharedDatabase *db)
|
||||
void ExportSkillCaps(SharedDatabase* db)
|
||||
{
|
||||
LogInfo("Exporting Skill Caps");
|
||||
|
||||
std::string file = fmt::format("{}/export/SkillCaps.txt", path.GetServerPath());
|
||||
FILE *f = fopen(file.c_str(), "w");
|
||||
if (!f) {
|
||||
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", path.GetServerPath()));
|
||||
if (!file || !file.is_open()) {
|
||||
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int cl = 1; cl <= 16; ++cl) {
|
||||
for (int skill = 0; skill <= 77; ++skill) {
|
||||
if (SkillUsable(db, skill, cl)) {
|
||||
int previous_cap = 0;
|
||||
for (int level = 1; level <= 100; ++level) {
|
||||
int cap = GetSkill(db, skill, cl, level);
|
||||
const uint8 skill_cap_max_level = (
|
||||
RuleI(Character, SkillCapMaxLevel) > 0 ?
|
||||
RuleI(Character, SkillCapMaxLevel) :
|
||||
RuleI(Character, MaxLevel)
|
||||
);
|
||||
|
||||
for (uint8 class_id = Class::Warrior; class_id <= Class::Berserker; class_id++) {
|
||||
for (uint8 skill_id = EQ::skills::Skill1HBlunt; skill_id <= EQ::skills::Skill2HPiercing; skill_id++) {
|
||||
if (SkillUsable(db, skill_id, class_id)) {
|
||||
uint32 previous_cap = 0;
|
||||
for (uint8 level = 1; level <= skill_cap_max_level; level++) {
|
||||
uint32 cap = GetSkill(db, skill_id, class_id, level);
|
||||
if (cap < previous_cap) {
|
||||
cap = previous_cap;
|
||||
}
|
||||
|
||||
fprintf(f, "%d^%d^%d^%d^0\n", cl, skill, level, cap);
|
||||
file << fmt::format("{}^{}^{}^{}^0", class_id, skill_id, level, cap) << std::endl;
|
||||
|
||||
previous_cap = cap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
file.close();
|
||||
}
|
||||
|
||||
void ExportBaseData(SharedDatabase *db)
|
||||
|
||||
+11
-9
@@ -83,6 +83,7 @@ SET(common_sources
|
||||
shared_tasks.cpp
|
||||
shareddb.cpp
|
||||
skills.cpp
|
||||
skill_caps.cpp
|
||||
spdat.cpp
|
||||
strings.cpp
|
||||
struct_strategy.cpp
|
||||
@@ -492,7 +493,7 @@ SET(repositories
|
||||
repositories/zone_repository.h
|
||||
repositories/zone_points_repository.h
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
SET(common_headers
|
||||
additive_lagged_fibonacci_engine.h
|
||||
@@ -592,7 +593,7 @@ SET(common_headers
|
||||
ptimer.h
|
||||
queue.h
|
||||
races.h
|
||||
raid.h
|
||||
raid.h
|
||||
random.h
|
||||
rdtsc.h
|
||||
rulesys.h
|
||||
@@ -606,6 +607,7 @@ SET(common_headers
|
||||
shared_tasks.h
|
||||
shareddb.h
|
||||
skills.h
|
||||
skill_caps.h
|
||||
spdat.h
|
||||
strings.h
|
||||
struct_strategy.h
|
||||
@@ -681,13 +683,13 @@ SOURCE_GROUP(Event FILES
|
||||
event/event_loop.h
|
||||
event/timer.h
|
||||
event/task.h
|
||||
)
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Json FILES
|
||||
json/json.h
|
||||
json/jsoncpp.cpp
|
||||
json/json-forwards.h
|
||||
)
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Net FILES
|
||||
net/console_server.cpp
|
||||
@@ -724,7 +726,7 @@ SOURCE_GROUP(Net FILES
|
||||
net/websocket_server.h
|
||||
net/websocket_server_connection.cpp
|
||||
net/websocket_server_connection.h
|
||||
)
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Patches FILES
|
||||
patches/patches.h
|
||||
@@ -768,12 +770,12 @@ SOURCE_GROUP(Patches FILES
|
||||
patches/titanium_limits.cpp
|
||||
patches/uf.cpp
|
||||
patches/uf_limits.cpp
|
||||
)
|
||||
)
|
||||
|
||||
SOURCE_GROUP(StackWalker FILES
|
||||
StackWalker/StackWalker.h
|
||||
StackWalker/StackWalker.cpp
|
||||
)
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Util FILES
|
||||
util/memory_stream.h
|
||||
@@ -781,7 +783,7 @@ SOURCE_GROUP(Util FILES
|
||||
util/directory.h
|
||||
util/uuid.cpp
|
||||
util/uuid.h
|
||||
)
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
|
||||
|
||||
@@ -794,6 +796,6 @@ ENDIF (UNIX)
|
||||
|
||||
IF (WIN32 AND EQEMU_BUILD_PCH)
|
||||
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
@@ -64,4 +64,6 @@ typedef enum {
|
||||
} bodyType;
|
||||
/* bodytypes above 64 make the mob not show up */
|
||||
|
||||
constexpr int format_as(bodyType type) { return static_cast<int>(type); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,28 +1,11 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2019 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 "world_content_service.h"
|
||||
|
||||
#include <utility>
|
||||
#include <glm/vec3.hpp>
|
||||
#include "../database.h"
|
||||
#include "../rulesys.h"
|
||||
#include "../eqemu_logsys.h"
|
||||
#include "../repositories/content_flags_repository.h"
|
||||
#include "../repositories/instance_list_repository.h"
|
||||
|
||||
|
||||
WorldContentService::WorldContentService()
|
||||
@@ -119,7 +102,7 @@ std::vector<std::string> WorldContentService::GetContentFlagsDisabled()
|
||||
/**
|
||||
* @param content_flags
|
||||
*/
|
||||
void WorldContentService::SetContentFlags(const std::vector<ContentFlagsRepository::ContentFlags>& content_flags)
|
||||
void WorldContentService::SetContentFlags(const std::vector<ContentFlagsRepository::ContentFlags> &content_flags)
|
||||
{
|
||||
WorldContentService::content_flags = content_flags;
|
||||
}
|
||||
@@ -167,14 +150,14 @@ bool WorldContentService::DoesPassContentFiltering(const ContentFlags &f)
|
||||
}
|
||||
|
||||
// if we don't have any enabled flag in enabled flags, we fail
|
||||
for (const auto& flag: Strings::Split(f.content_flags)) {
|
||||
for (const auto &flag: Strings::Split(f.content_flags)) {
|
||||
if (!Strings::Contains(GetContentFlagsEnabled(), flag)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if we don't have any disabled flag in disabled flags, we fail
|
||||
for (const auto& flag: Strings::Split(f.content_flags_disabled)) {
|
||||
for (const auto &flag: Strings::Split(f.content_flags_disabled)) {
|
||||
if (!Strings::Contains(GetContentFlagsDisabled(), flag)) {
|
||||
return false;
|
||||
}
|
||||
@@ -195,11 +178,13 @@ void WorldContentService::ReloadContentFlags()
|
||||
LogInfo(
|
||||
"Loaded content flag [{}] [{}]",
|
||||
f.flag_name,
|
||||
(f.enabled ? "Enabled" : "Disabled")
|
||||
(f.enabled ? "enabled" : "disabled")
|
||||
);
|
||||
}
|
||||
|
||||
SetContentFlags(set_content_flags);
|
||||
LoadZones();
|
||||
LoadStaticGlobalZoneInstances();
|
||||
}
|
||||
|
||||
Database *WorldContentService::GetDatabase() const
|
||||
@@ -214,6 +199,18 @@ WorldContentService *WorldContentService::SetDatabase(Database *database)
|
||||
return this;
|
||||
}
|
||||
|
||||
Database *WorldContentService::GetContentDatabase() const
|
||||
{
|
||||
return m_content_database;
|
||||
}
|
||||
|
||||
WorldContentService *WorldContentService::SetContentDatabase(Database *database)
|
||||
{
|
||||
WorldContentService::m_content_database = database;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void WorldContentService::SetContentFlag(const std::string &content_flag_name, bool enabled)
|
||||
{
|
||||
auto flags = ContentFlagsRepository::GetWhere(
|
||||
@@ -238,3 +235,125 @@ void WorldContentService::SetContentFlag(const std::string &content_flag_name, b
|
||||
|
||||
ReloadContentFlags();
|
||||
}
|
||||
|
||||
// HandleZoneRoutingMiddleware is meant to handle content and context aware zone routing
|
||||
//
|
||||
// example # 1
|
||||
// lavastorm (pre-don) version 0 (classic)
|
||||
// lavastorm (don) version 1
|
||||
// we want to route players to the correct version of lavastorm based on the current server side expansion
|
||||
// in order to do that the simplest and cleanest way we intercept the zoning process and route players to an "instance" of the zone
|
||||
// the reason why we're doing this is because all of the zoning logic already is handled by two keys "zone_id" and "instance_id"
|
||||
// we can leverage static, never expires instances to handle this but to the client they don't see it any other way than a public normal zone
|
||||
// scripts handle all the same way, you don't have to think about instances, the middleware will handle the magic
|
||||
// the versions of zones are represented by two zone entries that have potentially different min/max expansion and/or different content flags
|
||||
// we decide to route the client to the correct version of the zone based on the current server side expansion
|
||||
void WorldContentService::HandleZoneRoutingMiddleware(ZoneChange_Struct *zc)
|
||||
{
|
||||
auto r = FindZone(zc->zoneID, zc->instanceID);
|
||||
if (r.zone_id == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
zc->instanceID = r.instance.id;
|
||||
}
|
||||
|
||||
// LoadStaticGlobalZoneInstances loads all static global zone instances
|
||||
// these are zones that are never set to expire and are global
|
||||
// these are used commonly in v1/v2/v3 versions of the same zone for expansion routing
|
||||
WorldContentService * WorldContentService::LoadStaticGlobalZoneInstances()
|
||||
{
|
||||
m_zone_instances = InstanceListRepository::GetWhere(*GetDatabase(), fmt::format("never_expires = 1 AND is_global = 1"));
|
||||
|
||||
LogInfo("Loaded [{}] zone_instances", m_zone_instances.size());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// LoadZones sets the zones for the world content service
|
||||
// this is used for zone routing middleware
|
||||
// we pull the zone list from the zone repository and feed from the zone store for now
|
||||
// we're holding a copy in the content service - but we're talking 250kb of data in memory to handle routing of zoning
|
||||
WorldContentService * WorldContentService::LoadZones()
|
||||
{
|
||||
m_zones = ZoneRepository::All(*GetContentDatabase());
|
||||
|
||||
LogInfo("Loaded [{}] zones", m_zones.size());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// FindZone is critical to the zone routing middleware and any logic that needs to route players to the correct zone
|
||||
// era contextual routing, multiple version of zones, etc
|
||||
WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id, uint32 instance_id)
|
||||
{
|
||||
// if there's an active dynamic instance, we don't need to route
|
||||
if (instance_id > 0) {
|
||||
auto inst = InstanceListRepository::FindOne(*GetDatabase(), instance_id);
|
||||
if (inst.id != 0 && !inst.is_global && !inst.never_expires) {
|
||||
return WorldContentService::FindZoneResult{
|
||||
.zone_id = 0,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &z: m_zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
auto f = ContentFlags{
|
||||
.min_expansion = z.min_expansion,
|
||||
.max_expansion = z.max_expansion,
|
||||
.content_flags = z.content_flags,
|
||||
.content_flags_disabled = z.content_flags_disabled
|
||||
};
|
||||
|
||||
if (DoesPassContentFiltering(f)) {
|
||||
LogInfo(
|
||||
"Attempting to route player to zone [{}] ({}) version [{}] long_name [{}]",
|
||||
z.short_name,
|
||||
z.zoneidnumber,
|
||||
z.version,
|
||||
z.long_name
|
||||
);
|
||||
|
||||
// first pass, explicit match on public static global zone instances
|
||||
for (auto &i: m_zone_instances) {
|
||||
if (i.zone == zone_id && i.version == z.version) {
|
||||
LogInfo(
|
||||
"Routed player to instance [{}] of zone [{}] ({}) version [{}] long_name [{}] notes [{}]",
|
||||
i.id,
|
||||
z.short_name,
|
||||
z.zoneidnumber,
|
||||
z.version,
|
||||
z.long_name,
|
||||
i.notes
|
||||
);
|
||||
|
||||
return WorldContentService::FindZoneResult{
|
||||
.zone_id = static_cast<uint32>(z.zoneidnumber),
|
||||
.instance = i,
|
||||
.zone = z
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Routed player to non-instance zone [{}] ({}) version [{}] long_name [{}] notes [{}]",
|
||||
z.short_name,
|
||||
z.zoneidnumber,
|
||||
z.version,
|
||||
z.long_name,
|
||||
z.note
|
||||
);
|
||||
|
||||
return WorldContentService::FindZoneResult{
|
||||
.zone_id = static_cast<uint32>(z.zoneidnumber),
|
||||
.instance = InstanceListRepository::NewEntity(),
|
||||
.zone = z
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return WorldContentService::FindZoneResult{.zone_id = 0};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2019 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 EQEMU_WORLD_CONTENT_SERVICE_H
|
||||
#define EQEMU_WORLD_CONTENT_SERVICE_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../repositories/content_flags_repository.h"
|
||||
#include "../repositories/zone_repository.h"
|
||||
#include "../repositories/instance_list_repository.h"
|
||||
|
||||
class Database;
|
||||
|
||||
@@ -182,14 +164,33 @@ public:
|
||||
WorldContentService * SetDatabase(Database *database);
|
||||
Database *GetDatabase() const;
|
||||
|
||||
WorldContentService * SetContentDatabase(Database *database);
|
||||
Database *GetContentDatabase() const;
|
||||
|
||||
void SetContentFlag(const std::string &content_flag_name, bool enabled);
|
||||
|
||||
void HandleZoneRoutingMiddleware(ZoneChange_Struct *zc);
|
||||
|
||||
struct FindZoneResult {
|
||||
uint32 zone_id = 0;
|
||||
InstanceListRepository::InstanceList instance;
|
||||
ZoneRepository::Zone zone;
|
||||
};
|
||||
|
||||
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
|
||||
private:
|
||||
int current_expansion{};
|
||||
std::vector<ContentFlagsRepository::ContentFlags> content_flags;
|
||||
|
||||
// reference to database
|
||||
Database *m_database;
|
||||
Database *m_content_database;
|
||||
|
||||
// holds a record of the zone table from the database
|
||||
std::vector<ZoneRepository::Zone> m_zones = {};
|
||||
WorldContentService *LoadStaticGlobalZoneInstances();
|
||||
std::vector<InstanceListRepository::InstanceList> m_zone_instances;
|
||||
WorldContentService * LoadZones();
|
||||
};
|
||||
|
||||
extern WorldContentService content_service;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
|
||||
#if WINDOWS
|
||||
#ifdef _WINDOWS
|
||||
#define popen _popen
|
||||
#endif
|
||||
|
||||
|
||||
+1177
-1624
File diff suppressed because it is too large
Load Diff
+145
-139
@@ -18,8 +18,8 @@
|
||||
#ifndef EQEMU_DATABASE_H
|
||||
#define EQEMU_DATABASE_H
|
||||
|
||||
#define AUTHENTICATION_TIMEOUT 60
|
||||
#define INVALID_ID 0xFFFFFFFF
|
||||
#define AUTHENTICATION_TIMEOUT 60
|
||||
#define INVALID_ID 0xFFFFFFFF
|
||||
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
@@ -38,8 +38,7 @@
|
||||
class MySQLRequestResult;
|
||||
class Client;
|
||||
|
||||
namespace EQ
|
||||
{
|
||||
namespace EQ {
|
||||
class InventoryProfile;
|
||||
}
|
||||
|
||||
@@ -52,10 +51,11 @@ struct npcDecayTimes_Struct {
|
||||
|
||||
struct VarCache_Struct {
|
||||
std::map<std::string, std::string> m_cache;
|
||||
uint32 last_update;
|
||||
uint32 last_update;
|
||||
VarCache_Struct() : last_update(0) { }
|
||||
void Add(const std::string &key, const std::string &value) { m_cache[key] = value; }
|
||||
const std::string *Get(const std::string &key) {
|
||||
void Add(const std::string& key, const std::string& value) { m_cache[key] = value; }
|
||||
const std::string* Get(const std::string& key)
|
||||
{
|
||||
auto it = m_cache.find(key);
|
||||
return (it != m_cache.end() ? &it->second : nullptr);
|
||||
}
|
||||
@@ -76,37 +76,33 @@ class PTimerList;
|
||||
|
||||
#define SQL(...) #__VA_ARGS__
|
||||
|
||||
class LogSettings;
|
||||
class Database : public DBcore {
|
||||
public:
|
||||
Database();
|
||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label = "default");
|
||||
Database(
|
||||
const std::string& host,
|
||||
const std::string& user,
|
||||
const std::string& password,
|
||||
const std::string& database,
|
||||
uint32 port
|
||||
);
|
||||
bool Connect(
|
||||
const std::string& host,
|
||||
const std::string& user,
|
||||
const std::string& password,
|
||||
const std::string& database,
|
||||
uint32 port,
|
||||
std::string connection_label = "default"
|
||||
);
|
||||
~Database();
|
||||
|
||||
/* Character Creation */
|
||||
|
||||
bool CreateCharacter(
|
||||
uint32 account_id,
|
||||
char *name,
|
||||
uint16 gender,
|
||||
uint16 race,
|
||||
uint16 class_,
|
||||
uint8 str,
|
||||
uint8 sta,
|
||||
uint8 cha,
|
||||
uint8 dex,
|
||||
uint8 int_,
|
||||
uint8 agi,
|
||||
uint8 wis,
|
||||
uint8 face
|
||||
);
|
||||
bool DeleteCharacter(char *character_name);
|
||||
bool MoveCharacterToZone(const char *charname, uint32 zone_id);
|
||||
bool DeleteCharacter(const std::string& name);
|
||||
bool MoveCharacterToZone(const std::string& name, uint32 zone_id);
|
||||
bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
|
||||
bool ReserveName(uint32 account_id, char *name);
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
|
||||
bool UpdateName(const char *oldname, const char *newname);
|
||||
bool ReserveName(uint32 account_id, const std::string& name);
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||
bool UpdateName(const std::string& old_name, const std::string& new_name);
|
||||
bool CopyCharacter(
|
||||
const std::string& source_character_name,
|
||||
const std::string& destination_character_name,
|
||||
@@ -114,161 +110,171 @@ public:
|
||||
);
|
||||
|
||||
/* General Information Queries */
|
||||
bool AddBannedIP(const std::string& banned_ip, const std::string& notes); //Add IP address to the banned_ips table.
|
||||
bool AddToNameFilter(const std::string& name);
|
||||
bool CheckBannedIPs(const std::string& login_ip); //Check incoming connection against banned IP table.
|
||||
bool CheckGMIPs(const std::string& login_ip, uint32 account_id);
|
||||
bool CheckNameFilter(const std::string& name, bool surname = false);
|
||||
bool IsNameUsed(const std::string& name);
|
||||
|
||||
bool AddBannedIP(std::string banned_ip, std::string notes); //Add IP address to the banned_ips table.
|
||||
bool AddToNameFilter(std::string name);
|
||||
bool CheckBannedIPs(std::string login_ip); //Check incoming connection against banned IP table.
|
||||
bool CheckGMIPs(std::string login_ip, uint32 account_id);
|
||||
bool CheckNameFilter(std::string name, bool surname = false);
|
||||
bool CheckUsedName(std::string name);
|
||||
uint32 GetAccountIDByChar(const std::string& name, uint32* character_id = 0);
|
||||
uint32 GetAccountIDByChar(uint32 character_id);
|
||||
uint32 GetAccountIDByName(const std::string& account_name, const std::string& loginserver, int16* status = 0, uint32* lsid = 0);
|
||||
uint32 GetCharacterID(const std::string& name);
|
||||
uint32 GetGuildIDByCharID(uint32 character_id);
|
||||
uint32 GetGroupIDByCharID(uint32 character_id);
|
||||
uint32 GetRaidIDByCharID(uint32 character_id);
|
||||
|
||||
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
|
||||
uint32 GetAccountIDByChar(uint32 char_id);
|
||||
uint32 GetAccountIDByName(std::string account_name, std::string loginserver, int16* status = 0, uint32* lsid = 0);
|
||||
uint32 GetCharacterID(const char *name);
|
||||
uint32 GetCharacterInfo(std::string character_name, uint32 *account_id, uint32 *zone_id, uint32 *instance_id);
|
||||
uint32 GetGuildIDByCharID(uint32 char_id);
|
||||
uint32 GetGroupIDByCharID(uint32 char_id);
|
||||
uint32 GetRaidIDByCharID(uint32 char_id);
|
||||
|
||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||
void GetCharName(uint32 char_id, char* name);
|
||||
std::string GetCharNameByID(uint32 char_id);
|
||||
std::string GetNPCNameByID(uint32 npc_id);
|
||||
std::string GetCleanNPCNameByID(uint32 npc_id);
|
||||
void LoginIP(uint32 account_id, std::string login_ip);
|
||||
const std::string GetAccountName(uint32 account_id, uint32* lsaccount_id = 0);
|
||||
const std::string GetCharName(uint32 character_id);
|
||||
const std::string GetCharNameByID(uint32 character_id);
|
||||
const std::string GetNPCNameByID(uint32 npc_id);
|
||||
const std::string GetCleanNPCNameByID(uint32 npc_id);
|
||||
void LoginIP(uint32 account_id, const std::string& login_ip);
|
||||
|
||||
/* Instancing */
|
||||
|
||||
bool AddClientToInstance(uint16 instance_id, uint32 character_id);
|
||||
bool CheckInstanceByCharID(uint16 instance_id, uint32 character_id);
|
||||
bool CheckInstanceExists(uint16 instance_id);
|
||||
bool CheckInstanceExpired(uint16 instance_id);
|
||||
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
|
||||
bool GetUnusedInstanceID(uint16 &instance_id);
|
||||
bool GetUnusedInstanceID(uint16& instance_id);
|
||||
bool IsGlobalInstance(uint16 instance_id);
|
||||
bool RemoveClientFromInstance(uint16 instance_id, uint32 char_id);
|
||||
bool RemoveClientsFromInstance(uint16 instance_id);
|
||||
bool VerifyInstanceAlive(uint16 instance_id, uint32 character_id);
|
||||
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
||||
|
||||
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
|
||||
uint16 GetInstanceID(uint32 zone, uint32 character_id, int16 version);
|
||||
std::vector<uint16> GetInstanceIDs(uint32 zone_id, uint32 character_id);
|
||||
uint8_t GetInstanceVersion(uint16 instance_id);
|
||||
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
|
||||
uint32 GetTimeRemainingInstance(uint16 instance_id, bool& is_perma);
|
||||
uint32 GetInstanceZoneID(uint16 instance_id);
|
||||
|
||||
void AssignGroupToInstance(uint32 gid, uint32 instance_id);
|
||||
void AssignRaidToInstance(uint32 rid, uint32 instance_id);
|
||||
void AssignGroupToInstance(uint32 group_id, uint32 instance_id);
|
||||
void AssignRaidToInstance(uint32 raid_id, uint32 instance_id);
|
||||
void DeleteInstance(uint16 instance_id);
|
||||
void FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 charid, uint32 group_id);
|
||||
void FlagInstanceByRaidLeader(uint32 zone_id, int16 version, uint32 charid, uint32 raid_id);
|
||||
void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &character_ids);
|
||||
void FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id);
|
||||
void FlagInstanceByRaidLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 raid_id);
|
||||
void GetCharactersInInstance(uint16 instance_id, std::list<uint32>& character_ids);
|
||||
void PurgeExpiredInstances();
|
||||
void SetInstanceDuration(uint16 instance_id, uint32 new_duration);
|
||||
void CleanupInstanceCorpses();
|
||||
|
||||
/* Adventure related. */
|
||||
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win = false, bool remove = false);
|
||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||
void UpdateAdventureStatsEntry(uint32 character_id, uint8 theme_id, bool is_win = false, bool is_remove = false);
|
||||
bool GetAdventureStats(uint32 character_id, AdventureStats_Struct* as);
|
||||
|
||||
/* Account Related */
|
||||
const std::string GetLiveChar(uint32 account_id);
|
||||
bool SetAccountStatus(const std::string& account_name, int16 status);
|
||||
bool SetLocalPassword(uint32 account_id, const std::string& password);
|
||||
bool UpdateLiveChar(const std::string& name, uint32 account_id);
|
||||
int16 CheckStatus(uint32 account_id);
|
||||
void SetAccountCRCField(uint32 account_id, const std::string& field_name, uint64 checksum);
|
||||
uint32 CheckLogin(const std::string& name, const std::string& password, const std::string& loginserver, int16* status = 0);
|
||||
uint32 CreateAccount(
|
||||
const std::string& name,
|
||||
const std::string& password,
|
||||
int16 status,
|
||||
const std::string& loginserver,
|
||||
uint32 lsaccount_id
|
||||
);
|
||||
uint32 GetAccountIDFromLSID(
|
||||
const std::string& in_loginserver_id,
|
||||
uint32 in_loginserver_account_id,
|
||||
char* in_account_name = 0,
|
||||
int16* in_status = 0
|
||||
);
|
||||
|
||||
bool DeleteAccount(const char *name, const char* loginserver);
|
||||
bool GetLiveChar(uint32 account_id, char* cname);
|
||||
bool SetAccountStatus(const char* name, int16 status);
|
||||
bool SetAccountStatus(const std::string& account_name, int16 status);
|
||||
bool SetLocalPassword(uint32 accid, const char* password);
|
||||
bool UpdateLiveChar(char* charname, uint32 account_id);
|
||||
uint8 GetAgreementFlag(uint32 account_id);
|
||||
void SetAgreementFlag(uint32 account_id);
|
||||
|
||||
int16 CheckStatus(uint32 account_id);
|
||||
int GetIPExemption(const std::string& account_ip);
|
||||
void SetIPExemption(const std::string& account_ip, int exemption_amount);
|
||||
|
||||
void SetAccountCRCField(uint32 account_id, std::string field_name, uint64 checksum);
|
||||
|
||||
uint32 CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus = 0);
|
||||
uint32 CreateAccount(const char* name, const char* password, int16 status, const char* loginserver, uint32 lsaccount_id);
|
||||
uint32 GetAccountIDFromLSID(const std::string& in_loginserver_id, uint32 in_loginserver_account_id, char* in_account_name = 0, int16* in_status = 0);
|
||||
uint8 GetAgreementFlag(uint32 account_id);
|
||||
|
||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||
void SetAgreementFlag(uint32 account_id);
|
||||
|
||||
int GetIPExemption(std::string account_ip);
|
||||
void SetIPExemption(std::string account_ip, int exemption_amount);
|
||||
|
||||
int GetInstanceID(uint32 char_id, uint32 zone_id);
|
||||
int GetInstanceID(uint32 character_id, uint32 zone_id);
|
||||
|
||||
|
||||
/* Groups */
|
||||
|
||||
std::string GetGroupLeaderForLogin(std::string character_name);
|
||||
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
|
||||
uint32 GetGroupID(const char* name);
|
||||
|
||||
void ClearGroup(uint32 gid = 0);
|
||||
void ClearGroupLeader(uint32 gid = 0);
|
||||
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
|
||||
void SetGroupLeaderName(uint32 gid, const char* name);
|
||||
std::string GetGroupLeaderForLogin(const std::string& character_name);
|
||||
char* GetGroupLeadershipInfo(
|
||||
uint32 group_id,
|
||||
char* leaderbuf,
|
||||
char* maintank = nullptr,
|
||||
char* assist = nullptr,
|
||||
char* puller = nullptr,
|
||||
char* marknpc = nullptr,
|
||||
char* mentoree = nullptr,
|
||||
int* mentor_percent = nullptr,
|
||||
GroupLeadershipAA_Struct* GLAA = nullptr
|
||||
);
|
||||
std::string GetGroupLeaderName(uint32 group_id);
|
||||
uint32 GetGroupID(const std::string& name);
|
||||
void ClearGroup(uint32 group_id = 0);
|
||||
void ClearGroupLeader(uint32 group_id = 0);
|
||||
void SetGroupLeaderName(uint32 group_id, const std::string& name);
|
||||
|
||||
/* Raids */
|
||||
const std::string GetRaidLeaderName(uint32 raid_id);
|
||||
uint32 GetRaidID(const std::string& name);
|
||||
void ClearRaid(uint32 raid_id = 0);
|
||||
void ClearRaidDetails(uint32 raid_id = 0);
|
||||
void ClearRaidLeader(uint32 group_id = std::numeric_limits<uint32>::max(), uint32 raid_id = 0);
|
||||
void GetGroupLeadershipInfo(
|
||||
uint32 group_id,
|
||||
uint32 raid_id,
|
||||
char* maintank = nullptr,
|
||||
char* assist = nullptr,
|
||||
char* puller = nullptr,
|
||||
char* marknpc = nullptr,
|
||||
char* mentoree = nullptr,
|
||||
int* mentor_percent = nullptr,
|
||||
GroupLeadershipAA_Struct* GLAA = nullptr
|
||||
);
|
||||
void GetRaidLeadershipInfo(
|
||||
uint32 raid_id,
|
||||
char* maintank = nullptr,
|
||||
char* assist = nullptr,
|
||||
char* puller = nullptr,
|
||||
char* marknpc = nullptr,
|
||||
RaidLeadershipAA_Struct* RLAA = nullptr
|
||||
);
|
||||
void SetRaidGroupLeaderInfo(uint32 group_id, uint32 raid_id);
|
||||
|
||||
const char *GetRaidLeaderName(uint32 rid);
|
||||
|
||||
uint32 GetRaidID(const char* name);
|
||||
|
||||
void ClearRaid(uint32 rid = 0);
|
||||
void ClearRaidDetails(uint32 rid = 0);
|
||||
void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0);
|
||||
void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, RaidLeadershipAA_Struct* RLAA = nullptr);
|
||||
void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid);
|
||||
|
||||
void PurgeAllDeletedDataBuckets();
|
||||
void PurgeAllDeletedDataBuckets();
|
||||
|
||||
|
||||
/* Database Variables */
|
||||
bool GetVariable(const std::string& name, std::string& value);
|
||||
bool SetVariable(const std::string& name, const std::string& value);
|
||||
bool LoadVariables();
|
||||
|
||||
bool GetVariable(std::string varname, std::string &varvalue);
|
||||
bool SetVariable(const std::string& varname, const std::string &varvalue);
|
||||
bool LoadVariables();
|
||||
uint8 GetPEQZone(uint32 zone_id, uint32 version);
|
||||
uint32 GetServerType();
|
||||
void AddReport(const std::string& who, const std::string& against, const std::string& lines);
|
||||
struct TimeOfDay_Struct LoadTime(time_t& realtime);
|
||||
bool SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year);
|
||||
void ClearMerchantTemp();
|
||||
void ClearPTimers(uint32 character_id);
|
||||
void SetFirstLogon(uint32 character_id, uint8 first_logon);
|
||||
void SetLFG(uint32 character_id, bool is_lfg);
|
||||
void SetLFP(uint32 character_id, bool is_lfp);
|
||||
void SetLoginFlags(uint32 character_id, bool is_lfp, bool is_lfg, uint8 first_logon);
|
||||
|
||||
/* General Queries */
|
||||
int64 CountInvSnapshots();
|
||||
void ClearInvSnapshots(bool from_now = false);
|
||||
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
|
||||
uint8 GetPEQZone(uint32 zone_id, uint32 version);
|
||||
uint8 GetMinStatus(uint32 zone_id, uint32 instance_version);
|
||||
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
||||
uint8 GetServerType();
|
||||
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
|
||||
|
||||
void AddReport(std::string who, std::string against, std::string lines);
|
||||
struct TimeOfDay_Struct LoadTime(time_t &realtime);
|
||||
bool SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year);
|
||||
void ClearMerchantTemp();
|
||||
void ClearPTimers(uint32 charid);
|
||||
void SetFirstLogon(uint32 CharID, uint8 firstlogon);
|
||||
void SetLFG(uint32 CharID, bool LFG);
|
||||
void SetLFP(uint32 CharID, bool LFP);
|
||||
void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon);
|
||||
|
||||
int CountInvSnapshots();
|
||||
void ClearInvSnapshots(bool from_now = false);
|
||||
|
||||
void SourceDatabaseTableFromUrl(std::string table_name, std::string url);
|
||||
void SourceSqlFromUrl(std::string url);
|
||||
void SourceDatabaseTableFromUrl(const std::string& table_name, const std::string& url);
|
||||
void SourceSqlFromUrl(const std::string& url);
|
||||
|
||||
private:
|
||||
|
||||
Mutex Mvarcache;
|
||||
Mutex Mvarcache;
|
||||
VarCache_Struct varcache;
|
||||
|
||||
/* Groups, utility methods. */
|
||||
void ClearAllGroupLeaders();
|
||||
void ClearAllGroups();
|
||||
void ClearAllGroupLeaders();
|
||||
void ClearAllGroups();
|
||||
|
||||
/* Raid, utility methods. */
|
||||
void ClearAllRaids();
|
||||
|
||||
@@ -575,7 +575,12 @@ void DatabaseDumpService::RemoveSqlBackup()
|
||||
{
|
||||
std::string file = fmt::format("{}.sql", GetDumpFileNameWithPath());
|
||||
if (File::Exists(file)) {
|
||||
std::filesystem::remove(file);
|
||||
try {
|
||||
std::filesystem::remove(file);
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
LogError("std::filesystem::remove err [{}]", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
RemoveCredentialsFile();
|
||||
|
||||
@@ -5247,7 +5247,7 @@ MODIFY COLUMN `name` varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci
|
||||
ManifestEntry{
|
||||
.version = 9257,
|
||||
.description = "2024_01_16_ground_spawns_fix_z.sql",
|
||||
.check = "SHOW COLUMNS FROM `ground_spawns` LIKE `fix_z`",
|
||||
.check = "SHOW COLUMNS FROM `ground_spawns` LIKE 'fix_z'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
@@ -5259,7 +5259,7 @@ ADD COLUMN `fix_z` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 AFTER `respawn_timer`;
|
||||
ManifestEntry{
|
||||
.version = 9258,
|
||||
.description = "2024_02_04_base_data.sql",
|
||||
.check = "SHOW COLUMNS FROM `base_data` LIKE `hp_regen`",
|
||||
.check = "SHOW COLUMNS FROM `base_data` LIKE 'hp_regen'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
@@ -5346,6 +5346,155 @@ CREATE TABLE guild_tributes (
|
||||
) ENGINE=InnoDB;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9261,
|
||||
.description = "2024_02_11_character_corpses.sql",
|
||||
.check = "SHOW COLUMNS FROM `character_corpses` LIKE 'time_of_death'",
|
||||
.condition = "contains",
|
||||
.match = "0000-00-00 00:00:00",
|
||||
.sql = R"(
|
||||
ALTER TABLE `character_corpses` MODIFY COLUMN `time_of_death` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9262,
|
||||
.description = "2024_02_11_object_contents.sql",
|
||||
.check = "SHOW COLUMNS FROM `object_contents` LIKE 'droptime'",
|
||||
.condition = "contains",
|
||||
.match = "0000-00-00 00:00:00",
|
||||
.sql = R"(
|
||||
ALTER TABLE `object_contents` MODIFY COLUMN `droptime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9263,
|
||||
.description = "2024_02_16_rearrange_zone_columns.sql",
|
||||
.check = "show columns from zone like 'note'",
|
||||
.condition = "missing",
|
||||
.match = "varchar(200)",
|
||||
.sql = R"(
|
||||
ALTER TABLE `zone`
|
||||
MODIFY COLUMN `id` int(10) NOT NULL AUTO_INCREMENT FIRST,
|
||||
MODIFY COLUMN `zoneidnumber` int(4) NOT NULL DEFAULT 0 AFTER `id`,
|
||||
MODIFY COLUMN `version` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `zoneidnumber`,
|
||||
MODIFY COLUMN `short_name` varchar(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `version`,
|
||||
MODIFY COLUMN `long_name` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL AFTER `short_name`,
|
||||
MODIFY COLUMN `min_status` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `long_name`,
|
||||
MODIFY COLUMN `note` varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `map_file_name`,
|
||||
MODIFY COLUMN `min_expansion` tinyint(4) NOT NULL DEFAULT -1 AFTER `note`,
|
||||
MODIFY COLUMN `max_expansion` tinyint(4) NOT NULL DEFAULT -1 AFTER `min_expansion`,
|
||||
MODIFY COLUMN `content_flags` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `max_expansion`,
|
||||
MODIFY COLUMN `content_flags_disabled` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `content_flags`,
|
||||
MODIFY COLUMN `expansion` tinyint(3) NOT NULL DEFAULT 0 AFTER `content_flags_disabled`,
|
||||
MODIFY COLUMN `file_name` varchar(16) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `expansion`,
|
||||
MODIFY COLUMN `safe_x` float NOT NULL DEFAULT 0 AFTER `file_name`,
|
||||
MODIFY COLUMN `safe_y` float NOT NULL DEFAULT 0 AFTER `safe_x`,
|
||||
MODIFY COLUMN `safe_z` float NOT NULL DEFAULT 0 AFTER `safe_y`,
|
||||
MODIFY COLUMN `safe_heading` float NOT NULL DEFAULT 0 AFTER `safe_z`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9264,
|
||||
.description = "2024_02_18_starting_items_augments.sql",
|
||||
.check = "SHOW COLUMNS FROM `starting_items` LIKE 'augment_one'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `starting_items`
|
||||
ADD COLUMN `augment_one` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `item_charges`,
|
||||
ADD COLUMN `augment_two` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_one`,
|
||||
ADD COLUMN `augment_three` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_two`,
|
||||
ADD COLUMN `augment_four` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_three`,
|
||||
ADD COLUMN `augment_five` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_four`,
|
||||
ADD COLUMN `augment_six` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9265,
|
||||
.description = "2024_03_03_add_id_to_guild_bank.sql",
|
||||
.check = "SHOW COLUMNS FROM `guild_bank` LIKE 'id'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `guild_bank`
|
||||
ADD COLUMN `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
|
||||
ADD PRIMARY KEY (`id`);
|
||||
)",
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9266,
|
||||
.description = "2024_03_02_rule_values_rule_value_length.sql",
|
||||
.check = "SHOW COLUMNS FROM `rule_values` LIKE 'rule_value'",
|
||||
.condition = "contains",
|
||||
.match = "varchar(30)",
|
||||
.sql = R"(
|
||||
ALTER TABLE `rule_values`
|
||||
MODIFY COLUMN `rule_value` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `rule_name`;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9267,
|
||||
.description = "2024_02_18_group_id_bot_id.sql",
|
||||
.check = "SHOW COLUMNS FROM `group_id` LIKE 'bot_id'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `group_id`
|
||||
CHANGE COLUMN `groupid` `group_id` int(11) UNSIGNED NOT NULL DEFAULT 0 FIRST,
|
||||
CHANGE COLUMN `charid` `character_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `group_id`,
|
||||
CHANGE COLUMN `ismerc` `merc_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `name`,
|
||||
ADD COLUMN `bot_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `character_id`,
|
||||
MODIFY COLUMN `name` varchar(64) NOT NULL DEFAULT '' AFTER `character_id`,
|
||||
DROP PRIMARY KEY,
|
||||
ADD PRIMARY KEY (`group_id`, `character_id`, `bot_id`, `merc_id`) USING BTREE;
|
||||
ALTER TABLE `group_id`
|
||||
MODIFY COLUMN `character_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `name`;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9268,
|
||||
.description = "2024_03_23_skill_caps.sql",
|
||||
.check = "SHOW COLUMNS FROM `skill_caps` LIKE 'skill_id'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `skill_caps`
|
||||
CHANGE COLUMN `skillID` `skill_id` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 FIRST,
|
||||
CHANGE COLUMN `class` `class_id` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `skill_id`,
|
||||
ADD COLUMN `id` int(3) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
|
||||
DROP PRIMARY KEY,
|
||||
ADD PRIMARY KEY (`id`) USING BTREE,
|
||||
ADD INDEX `level_skill_cap`(`skill_id`, `class_id`, `level`, `cap`);
|
||||
)",
|
||||
.content_schema_update = true,
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9269,
|
||||
.description = "2024_03_27_account_auto_login_charname.sql",
|
||||
.check = "SHOW COLUMNS FROM `account` LIKE 'auto_login_charname'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `account`
|
||||
ADD COLUMN `auto_login_charname` varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' AFTER `charname`;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9270,
|
||||
.description = "2024_04_31_content_flagging_lootdrop_entries.sql",
|
||||
.check = "SHOW COLUMNS FROM `lootdrop_entries` LIKE 'content_flags'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `lootdrop_entries` ADD `min_expansion` tinyint(4) NOT NULL DEFAULT -1;
|
||||
ALTER TABLE `lootdrop_entries` ADD `max_expansion` tinyint(4) NOT NULL DEFAULT -1;
|
||||
ALTER TABLE `lootdrop_entries` ADD `content_flags` varchar(100) NULL;
|
||||
ALTER TABLE `lootdrop_entries` ADD `content_flags_disabled` varchar(100) NULL;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
}
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
// ManifestEntry{
|
||||
// .version = 9228,
|
||||
|
||||
@@ -123,6 +123,22 @@ ALTER TABLE `bot_pets` DROP FOREIGN KEY `FK_bot_pets_1`;
|
||||
ALTER TABLE `bot_pet_buffs` DROP FOREIGN KEY `FK_bot_pet_buffs_1`;
|
||||
ALTER TABLE `bot_pet_inventories` DROP FOREIGN KEY `FK_bot_pet_inventories_1`;
|
||||
ALTER TABLE `bot_stances` DROP FOREIGN KEY `FK_bot_stances_1`;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9043,
|
||||
.description = "2024_02_18_bot_starting_items_augments.sql",
|
||||
.check = "SHOW COLUMNS FROM `bot_starting_items` LIKE 'augment_one'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `bot_starting_items`
|
||||
ADD COLUMN `augment_one` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `item_charges`,
|
||||
ADD COLUMN `augment_two` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_one`,
|
||||
ADD COLUMN `augment_three` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_two`,
|
||||
ADD COLUMN `augment_four` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_three`,
|
||||
ADD COLUMN `augment_five` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_four`,
|
||||
ADD COLUMN `augment_six` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`;
|
||||
)"
|
||||
}
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
|
||||
@@ -421,20 +421,25 @@ void Database::AssignGroupToInstance(uint32 group_id, uint32 instance_id)
|
||||
auto zone_id = GetInstanceZoneID(instance_id);
|
||||
auto version = GetInstanceVersion(instance_id);
|
||||
|
||||
auto l = GroupIdRepository::GetWhere(
|
||||
const auto& l = GroupIdRepository::GetWhere(
|
||||
*this,
|
||||
fmt::format(
|
||||
"groupid = {}",
|
||||
"`group_id` = {}",
|
||||
group_id
|
||||
)
|
||||
);
|
||||
|
||||
if (l.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& e : l) {
|
||||
if (!GetInstanceID(zone_id, e.charid, version)) {
|
||||
AddClientToInstance(instance_id, e.charid);
|
||||
if (!e.character_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetInstanceID(zone_id, e.character_id, version)) {
|
||||
AddClientToInstance(instance_id, e.character_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,7 +509,7 @@ void Database::FlagInstanceByRaidLeader(uint32 zone_id, int16 version, uint32 ch
|
||||
return;
|
||||
}
|
||||
|
||||
auto raid_leader_id = GetCharacterID(GetRaidLeaderName(raid_id));
|
||||
auto raid_leader_id = GetCharacterID(GetRaidLeaderName(raid_id).c_str());
|
||||
auto raid_leader_instance_id = GetInstanceID(zone_id, raid_leader_id, version);
|
||||
|
||||
if (!raid_leader_instance_id) {
|
||||
|
||||
@@ -146,6 +146,7 @@ namespace DatabaseSchema {
|
||||
"friends",
|
||||
"guild_bank",
|
||||
"guild_members",
|
||||
"guild_permissions",
|
||||
"guild_ranks",
|
||||
"guild_relations",
|
||||
"guild_tributes",
|
||||
@@ -333,7 +334,6 @@ namespace DatabaseSchema {
|
||||
"group_leaders",
|
||||
"instance_list",
|
||||
"ip_exemptions",
|
||||
"item_tick",
|
||||
"lfguild",
|
||||
"merc_buffs",
|
||||
"merchantlist_temp",
|
||||
|
||||
@@ -71,6 +71,8 @@ namespace EQ
|
||||
bit_DeityAll = UINT32_MAX
|
||||
};
|
||||
|
||||
constexpr int format_as(DeityType type) { return static_cast<int>(type); }
|
||||
|
||||
extern DeityTypeBit GetDeityBitmask(DeityType deity_type);
|
||||
extern std::string GetDeityName(DeityType deity_type);
|
||||
extern const std::map<DeityType, std::string>& GetDeityMap();
|
||||
|
||||
@@ -698,6 +698,8 @@ const std::map<uint32, std::string>& EQ::constants::GetSpecialAbilityMap()
|
||||
{ IMMUNE_OPEN, "Immune to Open" },
|
||||
{ IMMUNE_ASSASSINATE, "Immune to Assassinate" },
|
||||
{ IMMUNE_HEADSHOT, "Immune to Headshot" },
|
||||
{ IMMUNE_AGGRO_BOT, "Immune to Bot Aggro" },
|
||||
{ IMMUNE_DAMAGE_BOT, "Immune to Bot Damage" },
|
||||
};
|
||||
|
||||
return special_ability_map;
|
||||
@@ -712,3 +714,25 @@ std::string EQ::constants::GetSpecialAbilityName(uint32 ability_id)
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
const std::map<uint32, std::string>& EQ::constants::GetConsiderColorMap()
|
||||
{
|
||||
static const std::map<uint32, std::string> consider_color_map = {
|
||||
{ ConsiderColor::Green, "Green" },
|
||||
{ ConsiderColor::DarkBlue, "Dark Blue" },
|
||||
{ ConsiderColor::Gray, "Gray" },
|
||||
{ ConsiderColor::White, "White" },
|
||||
{ ConsiderColor::Red, "Red" },
|
||||
{ ConsiderColor::Yellow, "Yellow" },
|
||||
{ ConsiderColor::LightBlue, "Light Blue" },
|
||||
{ ConsiderColor::WhiteTitanium, "White" },
|
||||
};
|
||||
|
||||
return consider_color_map;
|
||||
}
|
||||
|
||||
std::string EQ::constants::GetConsiderColorName(uint32 consider_color)
|
||||
{
|
||||
const auto& c = EQ::constants::GetConsiderColorMap().find(consider_color);
|
||||
return c != EQ::constants::GetConsiderColorMap().end() ? c->second : std::string();
|
||||
}
|
||||
|
||||
+17
-1
@@ -404,6 +404,9 @@ namespace EQ
|
||||
extern const std::map<uint32, std::string>& GetSpecialAbilityMap();
|
||||
std::string GetSpecialAbilityName(uint32 ability_id);
|
||||
|
||||
extern const std::map<uint32, std::string>& GetConsiderColorMap();
|
||||
std::string GetConsiderColorName(uint32 consider_color);
|
||||
|
||||
const int STANCE_TYPE_FIRST = stancePassive;
|
||||
const int STANCE_TYPE_LAST = stanceBurnAE;
|
||||
const int STANCE_TYPE_COUNT = stanceBurnAE;
|
||||
@@ -559,6 +562,17 @@ enum ConsiderLevel : uint8 {
|
||||
Scowls
|
||||
};
|
||||
|
||||
namespace ConsiderColor {
|
||||
constexpr uint32 Green = 2;
|
||||
constexpr uint32 DarkBlue = 4;
|
||||
constexpr uint32 Gray = 6;
|
||||
constexpr uint32 White = 10;
|
||||
constexpr uint32 Red = 13;
|
||||
constexpr uint32 Yellow = 15;
|
||||
constexpr uint32 LightBlue = 18;
|
||||
constexpr uint32 WhiteTitanium = 20;
|
||||
};
|
||||
|
||||
enum TargetDescriptionType : uint8 {
|
||||
LCSelf,
|
||||
UCSelf,
|
||||
@@ -656,7 +670,9 @@ enum {
|
||||
IMMUNE_OPEN = 53,
|
||||
IMMUNE_ASSASSINATE = 54,
|
||||
IMMUNE_HEADSHOT = 55,
|
||||
MAX_SPECIAL_ATTACK = 56
|
||||
IMMUNE_AGGRO_BOT = 56,
|
||||
IMMUNE_DAMAGE_BOT = 57,
|
||||
MAX_SPECIAL_ATTACK = 58
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef enum { //EQEmu internal opcodes list
|
||||
_maxEmuOpcode
|
||||
} EmuOpcode;
|
||||
|
||||
constexpr int format_as(EmuOpcode opcode) { return static_cast<int>(opcode); }
|
||||
extern const char *OpcodeNames[_maxEmuOpcode+1];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1127,4 +1127,8 @@ namespace RaidLootType {
|
||||
constexpr uint32 EntireRaid = 4;
|
||||
}
|
||||
|
||||
namespace LeadershipAbilitySlot {
|
||||
constexpr uint16 HealthOfTargetsTarget = 14;
|
||||
}
|
||||
|
||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||
|
||||
@@ -130,6 +130,11 @@ enum CrystalReclaimTypes
|
||||
Radiant = 4,
|
||||
};
|
||||
|
||||
namespace ItemStackSizeConstraint {
|
||||
constexpr int16 Minimum = 1;
|
||||
constexpr int16 Maximum = 1000;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ namespace Logs {
|
||||
Zoning,
|
||||
EqTime,
|
||||
Corpses,
|
||||
XTargets,
|
||||
MaxCategoryID /* Don't Remove this */
|
||||
};
|
||||
|
||||
@@ -241,6 +242,7 @@ namespace Logs {
|
||||
"Zoning",
|
||||
"EqTime",
|
||||
"Corpses",
|
||||
"XTargets"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -834,6 +834,16 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::Corpses, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogXTargets(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::XTargets))\
|
||||
OutF(LogSys, Logs::General, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogXTargetsDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::XTargets))\
|
||||
OutF(LogSys, Logs::Detail, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(debug_level, log_category))\
|
||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
|
||||
+8
-8
@@ -38,21 +38,21 @@
|
||||
#include <fmt/format.h>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
|
||||
bool File::Exists(const std::string &name)
|
||||
{
|
||||
return fs::exists(fs::path{name});
|
||||
struct stat sb{};
|
||||
if (stat(name.c_str(), &sb) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param directory_name
|
||||
*/
|
||||
void File::Makedir(const std::string &directory_name)
|
||||
{
|
||||
try {
|
||||
|
||||
+9
-36
@@ -342,41 +342,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 BaseGuildManager::_GetFreeGuildID()
|
||||
{
|
||||
GuildsRepository::DeleteWhere(*m_db, "`name` = ''");
|
||||
|
||||
GuildsRepository::Guilds out;
|
||||
out.id = 0;
|
||||
out.leader = 0;
|
||||
out.minstatus = 0;
|
||||
out.tribute = 0;
|
||||
out.name = "";
|
||||
out.motd = "";
|
||||
out.motd_setter = "";
|
||||
out.url = "";
|
||||
out.channel = "";
|
||||
auto last_insert_id = GuildsRepository::InsertOne(*m_db, out);
|
||||
if (last_insert_id.id > 0) {
|
||||
LogGuilds("Located a free guild ID [{}] in the database", last_insert_id.id);
|
||||
return last_insert_id.id;
|
||||
}
|
||||
|
||||
LogGuilds("Unable to find a free guild ID in the database");
|
||||
return GUILD_NONE;
|
||||
}
|
||||
|
||||
uint32 BaseGuildManager::CreateGuild(std::string name, uint32 leader_char_id)
|
||||
{
|
||||
uint32 guild_id = UpdateDbCreateGuild(name, leader_char_id);
|
||||
if (guild_id == GUILD_NONE) {
|
||||
return (GUILD_NONE);
|
||||
}
|
||||
//RefreshGuild(guild_id);
|
||||
//SendGuildRefresh(guild_id, true, false, false, false);
|
||||
//SendCharRefresh(GUILD_NONE, guild_id, leader_char_id);
|
||||
uint32 guild_id = UpdateDbCreateGuild(name, leader_char_id);
|
||||
if (guild_id == GUILD_NONE) {
|
||||
return (GUILD_NONE);
|
||||
}
|
||||
|
||||
return guild_id;
|
||||
return guild_id;
|
||||
}
|
||||
|
||||
bool BaseGuildManager::DeleteGuild(uint32 guild_id)
|
||||
@@ -539,8 +512,8 @@ bool BaseGuildManager::SetPublicNote(uint32 charid, std::string public_note)
|
||||
|
||||
uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader)
|
||||
{
|
||||
auto new_id = _GetFreeGuildID();
|
||||
if (new_id == GUILD_NONE) {
|
||||
auto new_id = GuildsRepository::GetMaxId(*m_db) + 1;
|
||||
if (!new_id) {
|
||||
return GUILD_NONE;
|
||||
}
|
||||
|
||||
@@ -881,7 +854,7 @@ static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into)
|
||||
if (into.guild_id == 0) {
|
||||
into.guild_id = GUILD_NONE;
|
||||
}
|
||||
if (into.rank > GUILD_MAX_RANK) {
|
||||
if (into.rank > GUILD_MAX_RANK + 1) {
|
||||
into.rank = GUILD_RANK_NONE;
|
||||
}
|
||||
}
|
||||
@@ -1090,7 +1063,7 @@ bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const
|
||||
LogGuilds("Check leader for char [{}]: invalid guild", char_id);
|
||||
return (false); //invalid guild
|
||||
}
|
||||
LogGuilds("Check leader for guild [{}]\, char [{}]\: leader id=[{}]", guild_id, char_id, res->second->leader);
|
||||
LogGuilds("Check leader for guild [{}], char [{}]: leader id=[{}]", guild_id, char_id, res->second->leader);
|
||||
return (char_id == res->second->leader);
|
||||
}
|
||||
|
||||
|
||||
+12
-3
@@ -75,9 +75,18 @@ class BaseGuildManager
|
||||
virtual ~BaseGuildManager();
|
||||
|
||||
//this must be called before doing anything else with this object
|
||||
void SetDatabase(Database *db)
|
||||
BaseGuildManager * SetDatabase(Database *db)
|
||||
{
|
||||
m_db = db;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
BaseGuildManager * SetContentDatabase(Database *db)
|
||||
{
|
||||
m_content_db = db;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
bool LoadGuilds();
|
||||
@@ -194,11 +203,11 @@ class BaseGuildManager
|
||||
std::map<uint32, GuildInfo *> m_guilds; //we own the pointers in this map
|
||||
void ClearGuilds(); //clears internal structure
|
||||
|
||||
Database *m_db; //we do not own this
|
||||
Database *m_db;
|
||||
Database *m_content_db;
|
||||
|
||||
bool _StoreGuildDB(uint32 guild_id);
|
||||
GuildInfo* _CreateGuild(uint32 guild_id, std::string guild_name, uint32 leader_char_id, uint8 minstatus, std::string guild_motd, std::string motd_setter, std::string Channel, std::string URL, uint32 favour);
|
||||
uint32 _GetFreeGuildID();
|
||||
GuildsRepository::Guilds CreateGuildRepoFromGuildInfo(uint32 guild_id, BaseGuildManager::GuildInfo& in);
|
||||
};
|
||||
#endif /*GUILD_BASE_H_*/
|
||||
|
||||
+2
-1
@@ -35,7 +35,7 @@
|
||||
#define GUILD_MEMBER_TI 0
|
||||
#define GUILD_OFFICER_TI 1
|
||||
#define GUILD_LEADER_TI 2
|
||||
#define GUILD_RANK_NONE (GUILD_MAX_RANK+1)
|
||||
#define GUILD_RANK_NONE_TI (GUILD_MAX_RANK + 1)
|
||||
|
||||
//defines for standard ranks base on RoF2 definitions
|
||||
#define GUILD_RANK_NONE 0
|
||||
@@ -81,5 +81,6 @@ typedef enum {
|
||||
GUILD_ACTION_MEMBERS_DEMOTE_SELF = 30,
|
||||
} GuildAction;
|
||||
|
||||
constexpr int format_as(GuildAction action) { return static_cast<int>(action); }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1801,6 +1801,17 @@ uint32 EQ::ItemInstance::GetItemGuildFavor() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<uint32> EQ::ItemInstance::GetAugmentIDs() const
|
||||
{
|
||||
std::vector<uint32> augments;
|
||||
|
||||
for (uint8 slot_id = invaug::SOCKET_BEGIN; slot_id <= invaug::SOCKET_END; slot_id++) {
|
||||
augments.push_back(GetAugment(slot_id) ? GetAugmentItemID(slot_id) : 0);
|
||||
}
|
||||
|
||||
return augments;
|
||||
}
|
||||
|
||||
//
|
||||
// class EvolveInfo
|
||||
//
|
||||
|
||||
@@ -300,6 +300,7 @@ namespace EQ
|
||||
int GetItemHeroicCorrup(bool augments = false) const;
|
||||
int GetItemHaste(bool augments = false) const;
|
||||
uint32 GetItemGuildFavor() const;
|
||||
std::vector<uint32> GetAugmentIDs() const;
|
||||
|
||||
protected:
|
||||
//////////////////////////
|
||||
|
||||
@@ -158,6 +158,7 @@ namespace RoF2
|
||||
slotCursor
|
||||
};
|
||||
|
||||
constexpr int16 format_as(InventorySlots slot) { return static_cast<int16>(slot); }
|
||||
} // namespace enum_
|
||||
using namespace enum_;
|
||||
|
||||
|
||||
@@ -692,6 +692,10 @@ namespace Titanium
|
||||
eq->rank = GUILD_LEADER_TI;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
eq->rank = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(eq->member_name, emu->member_name, sizeof(eq->member_name));
|
||||
@@ -1417,6 +1421,7 @@ namespace Titanium
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
eq->guildrank = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1155,6 +1155,7 @@ namespace UF
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
emu_e->rank = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1256,6 +1257,10 @@ namespace UF
|
||||
eq->rank_ = GUILD_LEADER_TI;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
eq->rank_ = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
OUT(zone_id)
|
||||
OUT(last_on)
|
||||
@@ -1291,6 +1296,10 @@ namespace UF
|
||||
eq->rank_ = GUILD_LEADER_TI;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
eq->rank_ = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
FINISH_ENCODE()
|
||||
}
|
||||
@@ -1970,6 +1979,7 @@ namespace UF
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
emu->guildrank = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2503,6 +2513,10 @@ namespace UF
|
||||
eq->parameter = GUILD_LEADER_TI;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
eq->parameter = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2545,6 +2559,7 @@ namespace UF
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
emu->rank = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3163,6 +3178,7 @@ namespace UF
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
emu->guildrank = GUILD_RANK_NONE_TI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1379,7 +1379,7 @@ uint32 GetPlayerRaceValue(uint16 race_id) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetPlayerRaceBit(uint16 race_id) {
|
||||
uint16 GetPlayerRaceBit(uint16 race_id) {
|
||||
switch (race_id) {
|
||||
case HUMAN:
|
||||
return PLAYER_RACE_HUMAN_BIT;
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ bool IsPlayerRace(uint16 race_id);
|
||||
const std::string GetPlayerRaceAbbreviation(uint16 race_id);
|
||||
|
||||
uint32 GetPlayerRaceValue(uint16 race_id);
|
||||
uint32 GetPlayerRaceBit(uint16 race_id);
|
||||
uint16 GetPlayerRaceBit(uint16 race_id);
|
||||
|
||||
uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value);
|
||||
uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit);
|
||||
|
||||
@@ -44,7 +44,69 @@ public:
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
static int16 GetAccountStatus(Database& db, const uint32 account_id)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT `status`, TIMESTAMPDIFF(SECOND, NOW(), `suspendeduntil`) FROM `{}` WHERE `{}` = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
account_id
|
||||
)
|
||||
);
|
||||
|
||||
if (!results.Success() || !results.RowCount()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
int16 status = static_cast<int16>(Strings::ToInt(row[0]));
|
||||
int date_diff = 0;
|
||||
|
||||
if (row[1]) {
|
||||
date_diff = Strings::ToInt(row[1]);
|
||||
}
|
||||
|
||||
if (date_diff > 0) {
|
||||
status = -1;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static bool UpdatePassword(Database& db, const uint32 account_id, const std::string& password)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE `{}` SET `password` = MD5('{}') WHERE `{}` = {}",
|
||||
TableName(),
|
||||
password,
|
||||
PrimaryKey(),
|
||||
account_id
|
||||
)
|
||||
);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
static std::string GetAutoLoginCharacterNameByAccountID(Database& db, const uint32 account_id)
|
||||
{
|
||||
return AccountRepository::FindOne(db, account_id).auto_login_charname;
|
||||
}
|
||||
|
||||
static bool SetAutoLoginCharacterNameByAccountID(Database& db, const uint32 account_id, const std::string& character_name)
|
||||
{
|
||||
auto e = AccountRepository::FindOne(db, account_id);
|
||||
|
||||
if (!e.id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.auto_login_charname = character_name;
|
||||
|
||||
return AccountRepository::UpdateOne(db, e);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_ACCOUNT_REPOSITORY_H
|
||||
|
||||
@@ -44,7 +44,65 @@ public:
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
static void UpdateAdventureStatsEntry(Database& db, uint32 character_id, uint8 theme_id, bool is_win, bool is_remove)
|
||||
{
|
||||
std::string field;
|
||||
|
||||
switch (theme_id) {
|
||||
case LDoNThemes::GUK: {
|
||||
field = "guk_";
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::MIR: {
|
||||
field = "mir_";
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::MMC: {
|
||||
field = "mmc_";
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::RUJ: {
|
||||
field = "ruj_";
|
||||
break;
|
||||
}
|
||||
case LDoNThemes::TAK: {
|
||||
field = "tak_";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
field += is_win ? "wins" : "losses";
|
||||
|
||||
auto e = FindOne(db, character_id);
|
||||
|
||||
if (!e.player_id && !is_remove) {
|
||||
const std::string& query = fmt::format(
|
||||
"INSERT INTO `{}` SET `{}` = 1, `{}` = {}",
|
||||
TableName(),
|
||||
field,
|
||||
PrimaryKey(),
|
||||
character_id
|
||||
);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string& field_operation = is_remove ? "-" : "+";
|
||||
|
||||
const std::string& query = fmt::format(
|
||||
"UPDATE `{}` SET `{}` = {} {} 1 WHERE `{}` = {}",
|
||||
TableName(),
|
||||
field,
|
||||
field,
|
||||
field_operation,
|
||||
PrimaryKey(),
|
||||
character_id
|
||||
);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_ADVENTURE_STATS_REPOSITORY_H
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
int32_t accid;
|
||||
std::string ip;
|
||||
int32_t count;
|
||||
std::string lastused;
|
||||
time_t lastused;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
"accid",
|
||||
"ip",
|
||||
"count",
|
||||
"lastused",
|
||||
"UNIX_TIMESTAMP(lastused)",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.ip = row[1] ? row[1] : "";
|
||||
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
|
||||
e.lastused = row[3] ? row[3] : std::time(nullptr);
|
||||
e.lastused = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.accid));
|
||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.ip) + "'");
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.count));
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.lastused) + "'");
|
||||
v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
v.push_back(std::to_string(e.accid));
|
||||
v.push_back("'" + Strings::Escape(e.ip) + "'");
|
||||
v.push_back(std::to_string(e.count));
|
||||
v.push_back("'" + Strings::Escape(e.lastused) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -225,7 +225,7 @@ public:
|
||||
v.push_back(std::to_string(e.accid));
|
||||
v.push_back("'" + Strings::Escape(e.ip) + "'");
|
||||
v.push_back(std::to_string(e.count));
|
||||
v.push_back("'" + Strings::Escape(e.lastused) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.ip = row[1] ? row[1] : "";
|
||||
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
|
||||
e.lastused = row[3] ? row[3] : std::time(nullptr);
|
||||
e.lastused = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.ip = row[1] ? row[1] : "";
|
||||
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
|
||||
e.lastused = row[3] ? row[3] : std::time(nullptr);
|
||||
e.lastused = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -368,7 +368,7 @@ public:
|
||||
v.push_back(std::to_string(e.accid));
|
||||
v.push_back("'" + Strings::Escape(e.ip) + "'");
|
||||
v.push_back(std::to_string(e.count));
|
||||
v.push_back("'" + Strings::Escape(e.lastused) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -394,7 +394,7 @@ public:
|
||||
v.push_back(std::to_string(e.accid));
|
||||
v.push_back("'" + Strings::Escape(e.ip) + "'");
|
||||
v.push_back(std::to_string(e.count));
|
||||
v.push_back("'" + Strings::Escape(e.lastused) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
int32_t id;
|
||||
std::string name;
|
||||
std::string charname;
|
||||
std::string auto_login_charname;
|
||||
uint32_t sharedplat;
|
||||
std::string password;
|
||||
int32_t status;
|
||||
@@ -56,6 +57,7 @@ public:
|
||||
"id",
|
||||
"name",
|
||||
"charname",
|
||||
"auto_login_charname",
|
||||
"sharedplat",
|
||||
"password",
|
||||
"status",
|
||||
@@ -86,6 +88,7 @@ public:
|
||||
"id",
|
||||
"name",
|
||||
"charname",
|
||||
"auto_login_charname",
|
||||
"sharedplat",
|
||||
"password",
|
||||
"status",
|
||||
@@ -147,30 +150,31 @@ public:
|
||||
{
|
||||
Account e{};
|
||||
|
||||
e.id = 0;
|
||||
e.name = "";
|
||||
e.charname = "";
|
||||
e.sharedplat = 0;
|
||||
e.password = "";
|
||||
e.status = 0;
|
||||
e.ls_id = "eqemu";
|
||||
e.lsaccount_id = 0;
|
||||
e.gmspeed = 0;
|
||||
e.invulnerable = 0;
|
||||
e.flymode = 0;
|
||||
e.ignore_tells = 0;
|
||||
e.revoked = 0;
|
||||
e.karma = 0;
|
||||
e.minilogin_ip = "";
|
||||
e.hideme = 0;
|
||||
e.rulesflag = 0;
|
||||
e.suspendeduntil = 0;
|
||||
e.time_creation = 0;
|
||||
e.ban_reason = "";
|
||||
e.suspend_reason = "";
|
||||
e.crc_eqgame = "";
|
||||
e.crc_skillcaps = "";
|
||||
e.crc_basedata = "";
|
||||
e.id = 0;
|
||||
e.name = "";
|
||||
e.charname = "";
|
||||
e.auto_login_charname = "";
|
||||
e.sharedplat = 0;
|
||||
e.password = "";
|
||||
e.status = 0;
|
||||
e.ls_id = "eqemu";
|
||||
e.lsaccount_id = 0;
|
||||
e.gmspeed = 0;
|
||||
e.invulnerable = 0;
|
||||
e.flymode = 0;
|
||||
e.ignore_tells = 0;
|
||||
e.revoked = 0;
|
||||
e.karma = 0;
|
||||
e.minilogin_ip = "";
|
||||
e.hideme = 0;
|
||||
e.rulesflag = 0;
|
||||
e.suspendeduntil = 0;
|
||||
e.time_creation = 0;
|
||||
e.ban_reason = "";
|
||||
e.suspend_reason = "";
|
||||
e.crc_eqgame = "";
|
||||
e.crc_skillcaps = "";
|
||||
e.crc_basedata = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -207,30 +211,31 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
Account e{};
|
||||
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.password = row[4] ? row[4] : "";
|
||||
e.status = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.ls_id = row[6] ? row[6] : "eqemu";
|
||||
e.lsaccount_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.gmspeed = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.invulnerable = row[9] ? static_cast<int8_t>(atoi(row[9])) : 0;
|
||||
e.flymode = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.ignore_tells = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
|
||||
e.revoked = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.karma = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.minilogin_ip = row[14] ? row[14] : "";
|
||||
e.hideme = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
|
||||
e.rulesflag = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10);
|
||||
e.time_creation = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.ban_reason = row[19] ? row[19] : "";
|
||||
e.suspend_reason = row[20] ? row[20] : "";
|
||||
e.crc_eqgame = row[21] ? row[21] : "";
|
||||
e.crc_skillcaps = row[22] ? row[22] : "";
|
||||
e.crc_basedata = row[23] ? row[23] : "";
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.auto_login_charname = row[3] ? row[3] : "";
|
||||
e.sharedplat = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.password = row[5] ? row[5] : "";
|
||||
e.status = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.ls_id = row[7] ? row[7] : "eqemu";
|
||||
e.lsaccount_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.gmspeed = row[9] ? static_cast<uint8_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.invulnerable = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.flymode = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
|
||||
e.ignore_tells = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0;
|
||||
e.revoked = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.karma = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.minilogin_ip = row[15] ? row[15] : "";
|
||||
e.hideme = row[16] ? static_cast<int8_t>(atoi(row[16])) : 0;
|
||||
e.rulesflag = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.suspendeduntil = strtoll(row[18] ? row[18] : "-1", nullptr, 10);
|
||||
e.time_creation = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.ban_reason = row[20] ? row[20] : "";
|
||||
e.suspend_reason = row[21] ? row[21] : "";
|
||||
e.crc_eqgame = row[22] ? row[22] : "";
|
||||
e.crc_skillcaps = row[23] ? row[23] : "";
|
||||
e.crc_basedata = row[24] ? row[24] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -266,27 +271,28 @@ public:
|
||||
|
||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.sharedplat));
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.status));
|
||||
v.push_back(columns[6] + " = '" + Strings::Escape(e.ls_id) + "'");
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.lsaccount_id));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.gmspeed));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.invulnerable));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.flymode));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.ignore_tells));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.revoked));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.karma));
|
||||
v.push_back(columns[14] + " = '" + Strings::Escape(e.minilogin_ip) + "'");
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.hideme));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.rulesflag));
|
||||
v.push_back(columns[17] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")");
|
||||
v.push_back(columns[18] + " = " + std::to_string(e.time_creation));
|
||||
v.push_back(columns[19] + " = '" + Strings::Escape(e.ban_reason) + "'");
|
||||
v.push_back(columns[20] + " = '" + Strings::Escape(e.suspend_reason) + "'");
|
||||
v.push_back(columns[21] + " = '" + Strings::Escape(e.crc_eqgame) + "'");
|
||||
v.push_back(columns[22] + " = '" + Strings::Escape(e.crc_skillcaps) + "'");
|
||||
v.push_back(columns[23] + " = '" + Strings::Escape(e.crc_basedata) + "'");
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.auto_login_charname) + "'");
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.sharedplat));
|
||||
v.push_back(columns[5] + " = '" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.status));
|
||||
v.push_back(columns[7] + " = '" + Strings::Escape(e.ls_id) + "'");
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.lsaccount_id));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.gmspeed));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.invulnerable));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.flymode));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.ignore_tells));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.revoked));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.karma));
|
||||
v.push_back(columns[15] + " = '" + Strings::Escape(e.minilogin_ip) + "'");
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.hideme));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.rulesflag));
|
||||
v.push_back(columns[18] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")");
|
||||
v.push_back(columns[19] + " = " + std::to_string(e.time_creation));
|
||||
v.push_back(columns[20] + " = '" + Strings::Escape(e.ban_reason) + "'");
|
||||
v.push_back(columns[21] + " = '" + Strings::Escape(e.suspend_reason) + "'");
|
||||
v.push_back(columns[22] + " = '" + Strings::Escape(e.crc_eqgame) + "'");
|
||||
v.push_back(columns[23] + " = '" + Strings::Escape(e.crc_skillcaps) + "'");
|
||||
v.push_back(columns[24] + " = '" + Strings::Escape(e.crc_basedata) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -311,6 +317,7 @@ public:
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
|
||||
v.push_back(std::to_string(e.sharedplat));
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
@@ -364,6 +371,7 @@ public:
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
|
||||
v.push_back(std::to_string(e.sharedplat));
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
@@ -418,30 +426,31 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Account e{};
|
||||
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.password = row[4] ? row[4] : "";
|
||||
e.status = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.ls_id = row[6] ? row[6] : "eqemu";
|
||||
e.lsaccount_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.gmspeed = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.invulnerable = row[9] ? static_cast<int8_t>(atoi(row[9])) : 0;
|
||||
e.flymode = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.ignore_tells = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
|
||||
e.revoked = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.karma = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.minilogin_ip = row[14] ? row[14] : "";
|
||||
e.hideme = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
|
||||
e.rulesflag = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10);
|
||||
e.time_creation = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.ban_reason = row[19] ? row[19] : "";
|
||||
e.suspend_reason = row[20] ? row[20] : "";
|
||||
e.crc_eqgame = row[21] ? row[21] : "";
|
||||
e.crc_skillcaps = row[22] ? row[22] : "";
|
||||
e.crc_basedata = row[23] ? row[23] : "";
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.auto_login_charname = row[3] ? row[3] : "";
|
||||
e.sharedplat = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.password = row[5] ? row[5] : "";
|
||||
e.status = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.ls_id = row[7] ? row[7] : "eqemu";
|
||||
e.lsaccount_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.gmspeed = row[9] ? static_cast<uint8_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.invulnerable = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.flymode = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
|
||||
e.ignore_tells = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0;
|
||||
e.revoked = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.karma = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.minilogin_ip = row[15] ? row[15] : "";
|
||||
e.hideme = row[16] ? static_cast<int8_t>(atoi(row[16])) : 0;
|
||||
e.rulesflag = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.suspendeduntil = strtoll(row[18] ? row[18] : "-1", nullptr, 10);
|
||||
e.time_creation = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.ban_reason = row[20] ? row[20] : "";
|
||||
e.suspend_reason = row[21] ? row[21] : "";
|
||||
e.crc_eqgame = row[22] ? row[22] : "";
|
||||
e.crc_skillcaps = row[23] ? row[23] : "";
|
||||
e.crc_basedata = row[24] ? row[24] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -466,30 +475,31 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Account e{};
|
||||
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.password = row[4] ? row[4] : "";
|
||||
e.status = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.ls_id = row[6] ? row[6] : "eqemu";
|
||||
e.lsaccount_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.gmspeed = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.invulnerable = row[9] ? static_cast<int8_t>(atoi(row[9])) : 0;
|
||||
e.flymode = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.ignore_tells = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
|
||||
e.revoked = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.karma = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.minilogin_ip = row[14] ? row[14] : "";
|
||||
e.hideme = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
|
||||
e.rulesflag = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10);
|
||||
e.time_creation = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.ban_reason = row[19] ? row[19] : "";
|
||||
e.suspend_reason = row[20] ? row[20] : "";
|
||||
e.crc_eqgame = row[21] ? row[21] : "";
|
||||
e.crc_skillcaps = row[22] ? row[22] : "";
|
||||
e.crc_basedata = row[23] ? row[23] : "";
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.auto_login_charname = row[3] ? row[3] : "";
|
||||
e.sharedplat = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.password = row[5] ? row[5] : "";
|
||||
e.status = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.ls_id = row[7] ? row[7] : "eqemu";
|
||||
e.lsaccount_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.gmspeed = row[9] ? static_cast<uint8_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.invulnerable = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.flymode = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
|
||||
e.ignore_tells = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0;
|
||||
e.revoked = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.karma = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.minilogin_ip = row[15] ? row[15] : "";
|
||||
e.hideme = row[16] ? static_cast<int8_t>(atoi(row[16])) : 0;
|
||||
e.rulesflag = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.suspendeduntil = strtoll(row[18] ? row[18] : "-1", nullptr, 10);
|
||||
e.time_creation = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.ban_reason = row[20] ? row[20] : "";
|
||||
e.suspend_reason = row[21] ? row[21] : "";
|
||||
e.crc_eqgame = row[22] ? row[22] : "";
|
||||
e.crc_skillcaps = row[23] ? row[23] : "";
|
||||
e.crc_basedata = row[24] ? row[24] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -567,6 +577,7 @@ public:
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
|
||||
v.push_back(std::to_string(e.sharedplat));
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
@@ -613,6 +624,7 @@ public:
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
|
||||
v.push_back(std::to_string(e.sharedplat));
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
|
||||
@@ -24,6 +24,12 @@ public:
|
||||
uint32_t classes;
|
||||
uint32_t item_id;
|
||||
uint8_t item_charges;
|
||||
uint32_t augment_one;
|
||||
uint32_t augment_two;
|
||||
uint32_t augment_three;
|
||||
uint32_t augment_four;
|
||||
uint32_t augment_five;
|
||||
uint32_t augment_six;
|
||||
uint8_t min_status;
|
||||
int32_t slot_id;
|
||||
int8_t min_expansion;
|
||||
@@ -45,6 +51,12 @@ public:
|
||||
"classes",
|
||||
"item_id",
|
||||
"item_charges",
|
||||
"augment_one",
|
||||
"augment_two",
|
||||
"augment_three",
|
||||
"augment_four",
|
||||
"augment_five",
|
||||
"augment_six",
|
||||
"min_status",
|
||||
"slot_id",
|
||||
"min_expansion",
|
||||
@@ -62,6 +74,12 @@ public:
|
||||
"classes",
|
||||
"item_id",
|
||||
"item_charges",
|
||||
"augment_one",
|
||||
"augment_two",
|
||||
"augment_three",
|
||||
"augment_four",
|
||||
"augment_five",
|
||||
"augment_six",
|
||||
"min_status",
|
||||
"slot_id",
|
||||
"min_expansion",
|
||||
@@ -113,6 +131,12 @@ public:
|
||||
e.classes = 0;
|
||||
e.item_id = 0;
|
||||
e.item_charges = 1;
|
||||
e.augment_one = 0;
|
||||
e.augment_two = 0;
|
||||
e.augment_three = 0;
|
||||
e.augment_four = 0;
|
||||
e.augment_five = 0;
|
||||
e.augment_six = 0;
|
||||
e.min_status = 0;
|
||||
e.slot_id = -1;
|
||||
e.min_expansion = -1;
|
||||
@@ -160,12 +184,18 @@ public:
|
||||
e.classes = 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_charges = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 1;
|
||||
e.min_status = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.slot_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : -1;
|
||||
e.min_expansion = row[7] ? static_cast<int8_t>(atoi(row[7])) : -1;
|
||||
e.max_expansion = row[8] ? static_cast<int8_t>(atoi(row[8])) : -1;
|
||||
e.content_flags = row[9] ? row[9] : "";
|
||||
e.content_flags_disabled = row[10] ? row[10] : "";
|
||||
e.augment_one = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_five = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_six = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.min_status = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.slot_id = row[12] ? static_cast<int32_t>(atoi(row[12])) : -1;
|
||||
e.min_expansion = row[13] ? static_cast<int8_t>(atoi(row[13])) : -1;
|
||||
e.max_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
|
||||
e.content_flags = row[15] ? row[15] : "";
|
||||
e.content_flags_disabled = row[16] ? row[16] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -203,12 +233,18 @@ public:
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.classes));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.item_charges));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.min_status));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.slot_id));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.min_expansion));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.max_expansion));
|
||||
v.push_back(columns[9] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back(columns[10] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.augment_one));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.augment_two));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.augment_three));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.augment_four));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.augment_five));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.augment_six));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.min_status));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.slot_id));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.min_expansion));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.max_expansion));
|
||||
v.push_back(columns[15] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back(columns[16] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -235,6 +271,12 @@ public:
|
||||
v.push_back(std::to_string(e.classes));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.min_status));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
@@ -275,6 +317,12 @@ public:
|
||||
v.push_back(std::to_string(e.classes));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.min_status));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
@@ -319,12 +367,18 @@ public:
|
||||
e.classes = 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_charges = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 1;
|
||||
e.min_status = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.slot_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : -1;
|
||||
e.min_expansion = row[7] ? static_cast<int8_t>(atoi(row[7])) : -1;
|
||||
e.max_expansion = row[8] ? static_cast<int8_t>(atoi(row[8])) : -1;
|
||||
e.content_flags = row[9] ? row[9] : "";
|
||||
e.content_flags_disabled = row[10] ? row[10] : "";
|
||||
e.augment_one = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_five = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_six = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.min_status = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.slot_id = row[12] ? static_cast<int32_t>(atoi(row[12])) : -1;
|
||||
e.min_expansion = row[13] ? static_cast<int8_t>(atoi(row[13])) : -1;
|
||||
e.max_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
|
||||
e.content_flags = row[15] ? row[15] : "";
|
||||
e.content_flags_disabled = row[16] ? row[16] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -354,12 +408,18 @@ public:
|
||||
e.classes = 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_charges = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 1;
|
||||
e.min_status = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.slot_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : -1;
|
||||
e.min_expansion = row[7] ? static_cast<int8_t>(atoi(row[7])) : -1;
|
||||
e.max_expansion = row[8] ? static_cast<int8_t>(atoi(row[8])) : -1;
|
||||
e.content_flags = row[9] ? row[9] : "";
|
||||
e.content_flags_disabled = row[10] ? row[10] : "";
|
||||
e.augment_one = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.augment_two = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.augment_three = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_four = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_five = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_six = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.min_status = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.slot_id = row[12] ? static_cast<int32_t>(atoi(row[12])) : -1;
|
||||
e.min_expansion = row[13] ? static_cast<int8_t>(atoi(row[13])) : -1;
|
||||
e.max_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
|
||||
e.content_flags = row[15] ? row[15] : "";
|
||||
e.content_flags_disabled = row[16] ? row[16] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -439,6 +499,12 @@ public:
|
||||
v.push_back(std::to_string(e.classes));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.min_status));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
@@ -472,6 +538,12 @@ public:
|
||||
v.push_back(std::to_string(e.classes));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.min_status));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
e.y = 0;
|
||||
e.z = 0;
|
||||
e.heading = 0;
|
||||
e.time_of_death = 0;
|
||||
e.time_of_death = std::time(nullptr);
|
||||
e.guild_consent_id = 0;
|
||||
e.is_rezzed = 0;
|
||||
e.is_buried = 0;
|
||||
|
||||
@@ -19,34 +19,37 @@
|
||||
class BaseGroupIdRepository {
|
||||
public:
|
||||
struct GroupId {
|
||||
int32_t groupid;
|
||||
int32_t charid;
|
||||
uint32_t group_id;
|
||||
std::string name;
|
||||
int8_t ismerc;
|
||||
uint32_t character_id;
|
||||
uint32_t bot_id;
|
||||
uint32_t merc_id;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("groupid");
|
||||
return std::string("group_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"groupid",
|
||||
"charid",
|
||||
"group_id",
|
||||
"name",
|
||||
"ismerc",
|
||||
"character_id",
|
||||
"bot_id",
|
||||
"merc_id",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"groupid",
|
||||
"charid",
|
||||
"group_id",
|
||||
"name",
|
||||
"ismerc",
|
||||
"character_id",
|
||||
"bot_id",
|
||||
"merc_id",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,10 +90,11 @@ public:
|
||||
{
|
||||
GroupId e{};
|
||||
|
||||
e.groupid = 0;
|
||||
e.charid = 0;
|
||||
e.name = "";
|
||||
e.ismerc = 0;
|
||||
e.group_id = 0;
|
||||
e.name = "";
|
||||
e.character_id = 0;
|
||||
e.bot_id = 0;
|
||||
e.merc_id = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -101,7 +105,7 @@ public:
|
||||
)
|
||||
{
|
||||
for (auto &group_id : group_ids) {
|
||||
if (group_id.groupid == group_id_id) {
|
||||
if (group_id.group_id == group_id_id) {
|
||||
return group_id;
|
||||
}
|
||||
}
|
||||
@@ -127,10 +131,11 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
GroupId e{};
|
||||
|
||||
e.groupid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.charid = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.ismerc = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.group_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.character_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.bot_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.merc_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -164,10 +169,11 @@ public:
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.groupid));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.charid));
|
||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.ismerc));
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.group_id));
|
||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.character_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.bot_id));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.merc_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -175,7 +181,7 @@ public:
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.groupid
|
||||
e.group_id
|
||||
)
|
||||
);
|
||||
|
||||
@@ -189,10 +195,11 @@ public:
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.groupid));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back(std::to_string(e.group_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.ismerc));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.bot_id));
|
||||
v.push_back(std::to_string(e.merc_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -203,7 +210,7 @@ public:
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.groupid = results.LastInsertedID();
|
||||
e.group_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -222,10 +229,11 @@ public:
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.groupid));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back(std::to_string(e.group_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.ismerc));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.bot_id));
|
||||
v.push_back(std::to_string(e.merc_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -259,10 +267,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
GroupId e{};
|
||||
|
||||
e.groupid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.charid = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.ismerc = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.group_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.character_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.bot_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.merc_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -287,10 +296,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
GroupId e{};
|
||||
|
||||
e.groupid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.charid = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.ismerc = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.group_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.character_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.bot_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.merc_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -365,10 +375,11 @@ public:
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.groupid));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back(std::to_string(e.group_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.ismerc));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.bot_id));
|
||||
v.push_back(std::to_string(e.merc_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -391,10 +402,11 @@ public:
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.groupid));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back(std::to_string(e.group_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.ismerc));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.bot_id));
|
||||
v.push_back(std::to_string(e.merc_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
e.gid = 0;
|
||||
e.leadername = "";
|
||||
e.marknpc = "";
|
||||
e.leadershipaa = 0;
|
||||
e.leadershipaa = "";
|
||||
e.maintank = "";
|
||||
e.assist = "";
|
||||
e.puller = "";
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.leadername = row[1] ? row[1] : "";
|
||||
e.marknpc = row[2] ? row[2] : "";
|
||||
e.leadershipaa = row[3] ? row[3] : 0;
|
||||
e.leadershipaa = row[3] ? row[3] : "";
|
||||
e.maintank = row[4] ? row[4] : "";
|
||||
e.assist = row[5] ? row[5] : "";
|
||||
e.puller = row[6] ? row[6] : "";
|
||||
@@ -302,7 +302,7 @@ public:
|
||||
e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.leadername = row[1] ? row[1] : "";
|
||||
e.marknpc = row[2] ? row[2] : "";
|
||||
e.leadershipaa = row[3] ? row[3] : 0;
|
||||
e.leadershipaa = row[3] ? row[3] : "";
|
||||
e.maintank = row[4] ? row[4] : "";
|
||||
e.assist = row[5] ? row[5] : "";
|
||||
e.puller = row[6] ? row[6] : "";
|
||||
@@ -335,7 +335,7 @@ public:
|
||||
e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.leadername = row[1] ? row[1] : "";
|
||||
e.marknpc = row[2] ? row[2] : "";
|
||||
e.leadershipaa = row[3] ? row[3] : 0;
|
||||
e.leadershipaa = row[3] ? row[3] : "";
|
||||
e.maintank = row[4] ? row[4] : "";
|
||||
e.assist = row[5] ? row[5] : "";
|
||||
e.puller = row[6] ? row[6] : "";
|
||||
|
||||
@@ -19,17 +19,21 @@
|
||||
class BaseLootdropEntriesRepository {
|
||||
public:
|
||||
struct LootdropEntries {
|
||||
uint32_t lootdrop_id;
|
||||
int32_t item_id;
|
||||
uint16_t item_charges;
|
||||
uint8_t equip_item;
|
||||
float chance;
|
||||
float disabled_chance;
|
||||
uint16_t trivial_min_level;
|
||||
uint16_t trivial_max_level;
|
||||
uint8_t multiplier;
|
||||
uint16_t npc_min_level;
|
||||
uint16_t npc_max_level;
|
||||
uint32_t lootdrop_id;
|
||||
int32_t item_id;
|
||||
uint16_t item_charges;
|
||||
uint8_t equip_item;
|
||||
float chance;
|
||||
float disabled_chance;
|
||||
uint16_t trivial_min_level;
|
||||
uint16_t trivial_max_level;
|
||||
uint8_t multiplier;
|
||||
uint16_t npc_min_level;
|
||||
uint16_t npc_max_level;
|
||||
int8_t min_expansion;
|
||||
int8_t max_expansion;
|
||||
std::string content_flags;
|
||||
std::string content_flags_disabled;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -51,6 +55,10 @@ public:
|
||||
"multiplier",
|
||||
"npc_min_level",
|
||||
"npc_max_level",
|
||||
"min_expansion",
|
||||
"max_expansion",
|
||||
"content_flags",
|
||||
"content_flags_disabled",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -68,6 +76,10 @@ public:
|
||||
"multiplier",
|
||||
"npc_min_level",
|
||||
"npc_max_level",
|
||||
"min_expansion",
|
||||
"max_expansion",
|
||||
"content_flags",
|
||||
"content_flags_disabled",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -108,17 +120,21 @@ public:
|
||||
{
|
||||
LootdropEntries e{};
|
||||
|
||||
e.lootdrop_id = 0;
|
||||
e.item_id = 0;
|
||||
e.item_charges = 1;
|
||||
e.equip_item = 0;
|
||||
e.chance = 1;
|
||||
e.disabled_chance = 0;
|
||||
e.trivial_min_level = 0;
|
||||
e.trivial_max_level = 0;
|
||||
e.multiplier = 1;
|
||||
e.npc_min_level = 0;
|
||||
e.npc_max_level = 0;
|
||||
e.lootdrop_id = 0;
|
||||
e.item_id = 0;
|
||||
e.item_charges = 1;
|
||||
e.equip_item = 0;
|
||||
e.chance = 1;
|
||||
e.disabled_chance = 0;
|
||||
e.trivial_min_level = 0;
|
||||
e.trivial_max_level = 0;
|
||||
e.multiplier = 1;
|
||||
e.npc_min_level = 0;
|
||||
e.npc_max_level = 0;
|
||||
e.min_expansion = -1;
|
||||
e.max_expansion = -1;
|
||||
e.content_flags = "";
|
||||
e.content_flags_disabled = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -155,17 +171,21 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
LootdropEntries e{};
|
||||
|
||||
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.chance = row[4] ? strtof(row[4], nullptr) : 1;
|
||||
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
|
||||
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.chance = row[4] ? strtof(row[4], nullptr) : 1;
|
||||
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
|
||||
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||
e.content_flags = row[13] ? row[13] : "";
|
||||
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -210,6 +230,10 @@ public:
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.multiplier));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.npc_min_level));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.npc_max_level));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.min_expansion));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.max_expansion));
|
||||
v.push_back(columns[13] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back(columns[14] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -242,6 +266,10 @@ public:
|
||||
v.push_back(std::to_string(e.multiplier));
|
||||
v.push_back(std::to_string(e.npc_min_level));
|
||||
v.push_back(std::to_string(e.npc_max_level));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
v.push_back(std::to_string(e.max_expansion));
|
||||
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -282,6 +310,10 @@ public:
|
||||
v.push_back(std::to_string(e.multiplier));
|
||||
v.push_back(std::to_string(e.npc_min_level));
|
||||
v.push_back(std::to_string(e.npc_max_level));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
v.push_back(std::to_string(e.max_expansion));
|
||||
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -315,17 +347,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
LootdropEntries e{};
|
||||
|
||||
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.chance = row[4] ? strtof(row[4], nullptr) : 1;
|
||||
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
|
||||
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.chance = row[4] ? strtof(row[4], nullptr) : 1;
|
||||
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
|
||||
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||
e.content_flags = row[13] ? row[13] : "";
|
||||
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -350,17 +386,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
LootdropEntries e{};
|
||||
|
||||
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.chance = row[4] ? strtof(row[4], nullptr) : 1;
|
||||
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
|
||||
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
|
||||
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.chance = row[4] ? strtof(row[4], nullptr) : 1;
|
||||
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
|
||||
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||
e.content_flags = row[13] ? row[13] : "";
|
||||
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -446,6 +486,10 @@ public:
|
||||
v.push_back(std::to_string(e.multiplier));
|
||||
v.push_back(std::to_string(e.npc_min_level));
|
||||
v.push_back(std::to_string(e.npc_max_level));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
v.push_back(std::to_string(e.max_expansion));
|
||||
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -479,6 +523,10 @@ public:
|
||||
v.push_back(std::to_string(e.multiplier));
|
||||
v.push_back(std::to_string(e.npc_min_level));
|
||||
v.push_back(std::to_string(e.npc_max_level));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
v.push_back(std::to_string(e.max_expansion));
|
||||
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
e.bagidx = 0;
|
||||
e.itemid = 0;
|
||||
e.charges = 0;
|
||||
e.droptime = 0;
|
||||
e.droptime = std::time(nullptr);
|
||||
e.augslot1 = 0;
|
||||
e.augslot2 = 0;
|
||||
e.augslot3 = 0;
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
class BaseSkillCapsRepository {
|
||||
public:
|
||||
struct SkillCaps {
|
||||
uint8_t skillID;
|
||||
uint8_t class_;
|
||||
uint32_t id;
|
||||
uint8_t skill_id;
|
||||
uint8_t class_id;
|
||||
uint8_t level;
|
||||
uint32_t cap;
|
||||
uint8_t class_;
|
||||
@@ -28,14 +29,15 @@ public:
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("skillID");
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"skillID",
|
||||
"`class`",
|
||||
"id",
|
||||
"skill_id",
|
||||
"class_id",
|
||||
"level",
|
||||
"cap",
|
||||
"class_",
|
||||
@@ -45,8 +47,9 @@ public:
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"skillID",
|
||||
"`class`",
|
||||
"id",
|
||||
"skill_id",
|
||||
"class_id",
|
||||
"level",
|
||||
"cap",
|
||||
"class_",
|
||||
@@ -90,11 +93,12 @@ public:
|
||||
{
|
||||
SkillCaps e{};
|
||||
|
||||
e.skillID = 0;
|
||||
e.class_ = 0;
|
||||
e.level = 0;
|
||||
e.cap = 0;
|
||||
e.class_ = 0;
|
||||
e.id = 0;
|
||||
e.skill_id = 0;
|
||||
e.class_id = 0;
|
||||
e.level = 0;
|
||||
e.cap = 0;
|
||||
e.class_ = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -105,7 +109,7 @@ public:
|
||||
)
|
||||
{
|
||||
for (auto &skill_caps : skill_capss) {
|
||||
if (skill_caps.skillID == skill_caps_id) {
|
||||
if (skill_caps.id == skill_caps_id) {
|
||||
return skill_caps;
|
||||
}
|
||||
}
|
||||
@@ -131,11 +135,12 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
SkillCaps e{};
|
||||
|
||||
e.skillID = row[0] ? static_cast<uint8_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.class_ = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.level = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.cap = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.class_ = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.skill_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.class_id = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.cap = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.class_ = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -169,11 +174,11 @@ public:
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.skillID));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.class_));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.level));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.cap));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.class_));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.skill_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.class_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.level));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.cap));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.class_));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -181,7 +186,7 @@ public:
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.skillID
|
||||
e.id
|
||||
)
|
||||
);
|
||||
|
||||
@@ -195,8 +200,9 @@ public:
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.skillID));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.skill_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.cap));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
@@ -210,7 +216,7 @@ public:
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.skillID = results.LastInsertedID();
|
||||
e.id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -229,8 +235,9 @@ public:
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.skillID));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.skill_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.cap));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
@@ -267,11 +274,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
SkillCaps e{};
|
||||
|
||||
e.skillID = row[0] ? static_cast<uint8_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.class_ = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.level = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.cap = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.class_ = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.skill_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.class_id = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.cap = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.class_ = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -296,11 +304,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
SkillCaps e{};
|
||||
|
||||
e.skillID = row[0] ? static_cast<uint8_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.class_ = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.level = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.cap = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.class_ = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.skill_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.class_id = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.cap = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.class_ = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -375,8 +384,9 @@ public:
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.skillID));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.skill_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.cap));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
@@ -402,8 +412,9 @@ public:
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.skillID));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.skill_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.cap));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
|
||||
@@ -26,6 +26,12 @@ public:
|
||||
std::string zone_id_list;
|
||||
uint32_t item_id;
|
||||
uint8_t item_charges;
|
||||
uint32_t augment_one;
|
||||
uint32_t augment_two;
|
||||
uint32_t augment_three;
|
||||
uint32_t augment_four;
|
||||
uint32_t augment_five;
|
||||
uint32_t augment_six;
|
||||
int32_t status;
|
||||
int32_t inventory_slot;
|
||||
int8_t min_expansion;
|
||||
@@ -49,6 +55,12 @@ public:
|
||||
"zone_id_list",
|
||||
"item_id",
|
||||
"item_charges",
|
||||
"augment_one",
|
||||
"augment_two",
|
||||
"augment_three",
|
||||
"augment_four",
|
||||
"augment_five",
|
||||
"augment_six",
|
||||
"status",
|
||||
"inventory_slot",
|
||||
"min_expansion",
|
||||
@@ -68,6 +80,12 @@ public:
|
||||
"zone_id_list",
|
||||
"item_id",
|
||||
"item_charges",
|
||||
"augment_one",
|
||||
"augment_two",
|
||||
"augment_three",
|
||||
"augment_four",
|
||||
"augment_five",
|
||||
"augment_six",
|
||||
"status",
|
||||
"inventory_slot",
|
||||
"min_expansion",
|
||||
@@ -121,6 +139,12 @@ public:
|
||||
e.zone_id_list = "";
|
||||
e.item_id = 0;
|
||||
e.item_charges = 1;
|
||||
e.augment_one = 0;
|
||||
e.augment_two = 0;
|
||||
e.augment_three = 0;
|
||||
e.augment_four = 0;
|
||||
e.augment_five = 0;
|
||||
e.augment_six = 0;
|
||||
e.status = 0;
|
||||
e.inventory_slot = -1;
|
||||
e.min_expansion = -1;
|
||||
@@ -170,12 +194,18 @@ public:
|
||||
e.zone_id_list = row[4] ? row[4] : "";
|
||||
e.item_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.item_charges = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 1;
|
||||
e.status = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.inventory_slot = row[8] ? static_cast<int32_t>(atoi(row[8])) : -1;
|
||||
e.min_expansion = row[9] ? static_cast<int8_t>(atoi(row[9])) : -1;
|
||||
e.max_expansion = row[10] ? static_cast<int8_t>(atoi(row[10])) : -1;
|
||||
e.content_flags = row[11] ? row[11] : "";
|
||||
e.content_flags_disabled = row[12] ? row[12] : "";
|
||||
e.augment_one = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_two = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_three = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_four = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.augment_five = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.augment_six = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.status = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.inventory_slot = row[14] ? static_cast<int32_t>(atoi(row[14])) : -1;
|
||||
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
|
||||
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
|
||||
e.content_flags = row[17] ? row[17] : "";
|
||||
e.content_flags_disabled = row[18] ? row[18] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -215,12 +245,18 @@ public:
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.zone_id_list) + "'");
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.item_charges));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.status));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.inventory_slot));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.min_expansion));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.max_expansion));
|
||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back(columns[12] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.augment_one));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.augment_two));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.augment_three));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.augment_four));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.augment_five));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.augment_six));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.status));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.inventory_slot));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.min_expansion));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.max_expansion));
|
||||
v.push_back(columns[17] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back(columns[18] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -249,6 +285,12 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.zone_id_list) + "'");
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.inventory_slot));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
@@ -291,6 +333,12 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.zone_id_list) + "'");
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.inventory_slot));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
@@ -337,12 +385,18 @@ public:
|
||||
e.zone_id_list = row[4] ? row[4] : "";
|
||||
e.item_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.item_charges = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 1;
|
||||
e.status = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.inventory_slot = row[8] ? static_cast<int32_t>(atoi(row[8])) : -1;
|
||||
e.min_expansion = row[9] ? static_cast<int8_t>(atoi(row[9])) : -1;
|
||||
e.max_expansion = row[10] ? static_cast<int8_t>(atoi(row[10])) : -1;
|
||||
e.content_flags = row[11] ? row[11] : "";
|
||||
e.content_flags_disabled = row[12] ? row[12] : "";
|
||||
e.augment_one = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_two = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_three = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_four = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.augment_five = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.augment_six = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.status = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.inventory_slot = row[14] ? static_cast<int32_t>(atoi(row[14])) : -1;
|
||||
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
|
||||
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
|
||||
e.content_flags = row[17] ? row[17] : "";
|
||||
e.content_flags_disabled = row[18] ? row[18] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -374,12 +428,18 @@ public:
|
||||
e.zone_id_list = row[4] ? row[4] : "";
|
||||
e.item_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.item_charges = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 1;
|
||||
e.status = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.inventory_slot = row[8] ? static_cast<int32_t>(atoi(row[8])) : -1;
|
||||
e.min_expansion = row[9] ? static_cast<int8_t>(atoi(row[9])) : -1;
|
||||
e.max_expansion = row[10] ? static_cast<int8_t>(atoi(row[10])) : -1;
|
||||
e.content_flags = row[11] ? row[11] : "";
|
||||
e.content_flags_disabled = row[12] ? row[12] : "";
|
||||
e.augment_one = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.augment_two = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.augment_three = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.augment_four = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.augment_five = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.augment_six = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.status = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.inventory_slot = row[14] ? static_cast<int32_t>(atoi(row[14])) : -1;
|
||||
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
|
||||
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
|
||||
e.content_flags = row[17] ? row[17] : "";
|
||||
e.content_flags_disabled = row[18] ? row[18] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -461,6 +521,12 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.zone_id_list) + "'");
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.inventory_slot));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
@@ -496,6 +562,12 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.zone_id_list) + "'");
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.item_charges));
|
||||
v.push_back(std::to_string(e.augment_one));
|
||||
v.push_back(std::to_string(e.augment_two));
|
||||
v.push_back(std::to_string(e.augment_three));
|
||||
v.push_back(std::to_string(e.augment_four));
|
||||
v.push_back(std::to_string(e.augment_five));
|
||||
v.push_back(std::to_string(e.augment_six));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.inventory_slot));
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
std::string varname;
|
||||
std::string value;
|
||||
std::string information;
|
||||
std::string ts;
|
||||
time_t ts;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
"varname",
|
||||
"value",
|
||||
"information",
|
||||
"ts",
|
||||
"UNIX_TIMESTAMP(ts)",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
e.varname = row[1] ? row[1] : "";
|
||||
e.value = row[2] ? row[2] : "";
|
||||
e.information = row[3] ? row[3] : "";
|
||||
e.ts = row[4] ? row[4] : std::time(nullptr);
|
||||
e.ts = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.varname) + "'");
|
||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.value) + "'");
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.information) + "'");
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.ts) + "'");
|
||||
v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.varname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.information) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ts) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.varname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.information) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ts) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public:
|
||||
e.varname = row[1] ? row[1] : "";
|
||||
e.value = row[2] ? row[2] : "";
|
||||
e.information = row[3] ? row[3] : "";
|
||||
e.ts = row[4] ? row[4] : std::time(nullptr);
|
||||
e.ts = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
e.varname = row[1] ? row[1] : "";
|
||||
e.value = row[2] ? row[2] : "";
|
||||
e.information = row[3] ? row[3] : "";
|
||||
e.ts = row[4] ? row[4] : std::time(nullptr);
|
||||
e.ts = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.varname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.information) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ts) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -405,7 +405,7 @@ public:
|
||||
v.push_back("'" + Strings::Escape(e.varname) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.value) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.information) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ts) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,392 @@
|
||||
/**
|
||||
* 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_FLAGS_REPOSITORY_H
|
||||
#define EQEMU_BASE_ZONE_FLAGS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseZoneFlagsRepository {
|
||||
public:
|
||||
struct ZoneFlags {
|
||||
int32_t charID;
|
||||
int32_t zoneID;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("charID");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"charID",
|
||||
"zoneID",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"charID",
|
||||
"zoneID",
|
||||
};
|
||||
}
|
||||
|
||||
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_flags");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static ZoneFlags NewEntity()
|
||||
{
|
||||
ZoneFlags e{};
|
||||
|
||||
e.charID = 0;
|
||||
e.zoneID = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static ZoneFlags GetZoneFlags(
|
||||
const std::vector<ZoneFlags> &zone_flagss,
|
||||
int zone_flags_id
|
||||
)
|
||||
{
|
||||
for (auto &zone_flags : zone_flagss) {
|
||||
if (zone_flags.charID == zone_flags_id) {
|
||||
return zone_flags;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static ZoneFlags FindOne(
|
||||
Database& db,
|
||||
int zone_flags_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
zone_flags_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
ZoneFlags e{};
|
||||
|
||||
e.charID = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zoneID = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int zone_flags_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
zone_flags_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const ZoneFlags &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.charID));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.zoneID));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.charID
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static ZoneFlags InsertOne(
|
||||
Database& db,
|
||||
ZoneFlags e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.charID));
|
||||
v.push_back(std::to_string(e.zoneID));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.charID = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<ZoneFlags> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.charID));
|
||||
v.push_back(std::to_string(e.zoneID));
|
||||
|
||||
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<ZoneFlags> All(Database& db)
|
||||
{
|
||||
std::vector<ZoneFlags> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ZoneFlags e{};
|
||||
|
||||
e.charID = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zoneID = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<ZoneFlags> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<ZoneFlags> 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) {
|
||||
ZoneFlags e{};
|
||||
|
||||
e.charID = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zoneID = row[1] ? static_cast<int32_t>(atoi(row[1])) : 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 ZoneFlags &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.charID));
|
||||
v.push_back(std::to_string(e.zoneID));
|
||||
|
||||
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<ZoneFlags> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.charID));
|
||||
v.push_back(std::to_string(e.zoneID));
|
||||
|
||||
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_FLAGS_REPOSITORY_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,6 +59,24 @@ public:
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
// insert with ON DUPLICATE KEY UPDATE to leave rows that exist unchanged
|
||||
static int InsertUpdateMany(Database& db, const std::vector<CharRecipeList>& entries)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
values.reserve(entries.size());
|
||||
|
||||
for (const auto& e: entries)
|
||||
{
|
||||
values.emplace_back(fmt::format("({},{},{})", e.char_id, e.recipe_id, e.madecount));
|
||||
}
|
||||
|
||||
auto results = db.QueryDatabase(fmt::format(
|
||||
"INSERT INTO {0} (char_id, recipe_id, madecount) VALUES {1} ON DUPLICATE KEY UPDATE {2}={2}",
|
||||
TableName(), fmt::join(values, ","), PrimaryKey()));
|
||||
|
||||
return results.Success() ? results.RowsAffected() : 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHAR_RECIPE_LIST_REPOSITORY_H
|
||||
|
||||
@@ -213,23 +213,23 @@ public:
|
||||
const glm::vec4& position
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE `{}` SET `is_buried` = 0, `zone_id` = {}, `instance_id` = {}, `x` = {:.2f}, `y` = {:.2f}, `z` = {:.2f}, `heading` = {:.2f}, `time_of_death` = {}, `was_at_graveyard` = 0 WHERE `{}` = {}",
|
||||
TableName(),
|
||||
zone_id,
|
||||
instance_id,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z,
|
||||
position.w,
|
||||
std::time(nullptr),
|
||||
PrimaryKey(),
|
||||
corpse_id
|
||||
)
|
||||
);
|
||||
auto corpse = FindOne(db, corpse_id);
|
||||
|
||||
return results.Success() ? results.RowsAffected() : 0;
|
||||
if (corpse.id == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
corpse.is_buried = 0;
|
||||
corpse.zone_id = zone_id;
|
||||
corpse.instance_id = instance_id;
|
||||
corpse.x = position.x;
|
||||
corpse.y = position.y;
|
||||
corpse.z = position.z;
|
||||
corpse.heading = position.w;
|
||||
corpse.time_of_death = time(nullptr);
|
||||
corpse.was_at_graveyard = 0;
|
||||
|
||||
return UpdateOne(db, corpse);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -74,9 +74,11 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
const auto& m = l.front();
|
||||
|
||||
return EXPModifier{
|
||||
.aa_modifier = l[0].aa_modifier,
|
||||
.exp_modifier = l[0].exp_modifier
|
||||
.aa_modifier = m.aa_modifier,
|
||||
.exp_modifier = m.exp_modifier
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
{.parent_command = "set", .sub_command = "alternate_currency", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setaltcurrency"},
|
||||
{.parent_command = "set", .sub_command = "animation", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setanim"},
|
||||
{.parent_command = "set", .sub_command = "anon", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setanon"},
|
||||
{.parent_command = "set", .sub_command = "auto_login", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setautologin"},
|
||||
{.parent_command = "set", .sub_command = "bind", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "bind"},
|
||||
{.parent_command = "set", .sub_command = "checksum", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "updatechecksum"},
|
||||
{.parent_command = "set", .sub_command = "class_permanent", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "permaclass"},
|
||||
@@ -122,6 +123,7 @@ public:
|
||||
{.parent_command = "set", .sub_command = "zone", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "zclip|zcolor|zheader|zonelock|zsafecoords|zsky|zunderworld"},
|
||||
{.parent_command = "show", .sub_command = "aas", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showaas"},
|
||||
{.parent_command = "show", .sub_command = "aa_points", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showaapoints|showaapts"},
|
||||
{.parent_command = "show", .sub_command = "auto_login", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showautologin"},
|
||||
{.parent_command = "show", .sub_command = "aggro", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "aggro"},
|
||||
{.parent_command = "show", .sub_command = "buffs", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showbuffs"},
|
||||
{.parent_command = "show", .sub_command = "buried_corpse_count", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "getplayerburiedcorpsecount"},
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT MAX(`number`) FROM `{}` WHERE `zoneid` = {} AND `gridid` = {}",
|
||||
"SELECT COALESCE(MAX(`number`), 0) FROM `{}` WHERE `zoneid` = {} AND `gridid` = {}",
|
||||
TableName(),
|
||||
zone_id,
|
||||
grid_id
|
||||
|
||||
@@ -44,7 +44,15 @@ public:
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
static void ClearAllGroups(Database& db)
|
||||
{
|
||||
db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM `{}`",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_GROUP_ID_REPOSITORY_H
|
||||
|
||||
@@ -44,7 +44,15 @@ public:
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
static void ClearAllGroupLeaders(Database& db)
|
||||
{
|
||||
db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM `{}`",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_GROUP_LEADERS_REPOSITORY_H
|
||||
|
||||
@@ -191,4 +191,5 @@ public:
|
||||
return UpdateOne(db, m);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_GUILD_MEMBERS_REPOSITORY_H
|
||||
|
||||
@@ -44,7 +44,30 @@ public:
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
static int64 CountInventorySnapshots(Database& db)
|
||||
{
|
||||
const std::string& query = "SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b";
|
||||
|
||||
auto results = db.QueryDatabase(query);
|
||||
|
||||
if (!results.Success() || !results.RowCount()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
const int64 count = Strings::ToBigInt(row[0]);
|
||||
|
||||
if (count > std::numeric_limits<int>::max()) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (count < 0) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_INVENTORY_SNAPSHOTS_REPOSITORY_H
|
||||
|
||||
@@ -66,6 +66,16 @@ public:
|
||||
|
||||
return results.Success() ? results.RowsAffected() : 0;
|
||||
}
|
||||
|
||||
static void ClearAllRaidDetails(Database& db)
|
||||
{
|
||||
db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM `{}`",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_RAID_DETAILS_REPOSITORY_H
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
#ifndef EQEMU_RAID_LEADERS_REPOSITORY_H
|
||||
#define EQEMU_RAID_LEADERS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
|
||||
class RaidLeadersRepository {
|
||||
public:
|
||||
struct RaidLeaders {
|
||||
int gid;
|
||||
int rid;
|
||||
std::string marknpc;
|
||||
std::string maintank;
|
||||
std::string assist;
|
||||
std::string puller;
|
||||
std::string leadershipaa;
|
||||
std::string mentoree;
|
||||
int mentor_percent;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"gid",
|
||||
"rid",
|
||||
"marknpc",
|
||||
"maintank",
|
||||
"assist",
|
||||
"puller",
|
||||
"leadershipaa",
|
||||
"mentoree",
|
||||
"mentor_percent",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(Strings::Implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string InsertColumnsRaw()
|
||||
{
|
||||
std::vector<std::string> insert_columns;
|
||||
|
||||
for (auto &column : Columns()) {
|
||||
if (column == PrimaryKey()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
insert_columns.push_back(column);
|
||||
}
|
||||
|
||||
return std::string(Strings::Implode(", ", insert_columns));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("raid_leaders");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
InsertColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static RaidLeaders NewEntity()
|
||||
{
|
||||
RaidLeaders entry{};
|
||||
|
||||
entry.gid = 0;
|
||||
entry.rid = 0;
|
||||
entry.marknpc = "";
|
||||
entry.maintank = "";
|
||||
entry.assist = "";
|
||||
entry.puller = "";
|
||||
entry.leadershipaa = 0;
|
||||
entry.mentoree = "";
|
||||
entry.mentor_percent = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static RaidLeaders GetRaidLeadersEntry(
|
||||
const std::vector<RaidLeaders> &raid_leaderss,
|
||||
int raid_leaders_id
|
||||
)
|
||||
{
|
||||
for (auto &raid_leaders : raid_leaderss) {
|
||||
if (raid_leaders. == raid_leaders_id) {
|
||||
return raid_leaders;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static RaidLeaders FindOne(
|
||||
int raid_leaders_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
raid_leaders_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
RaidLeaders entry{};
|
||||
|
||||
entry.gid = atoi(row[0]);
|
||||
entry.rid = atoi(row[1]);
|
||||
entry.marknpc = row[2];
|
||||
entry.maintank = row[3];
|
||||
entry.assist = row[4];
|
||||
entry.puller = row[5];
|
||||
entry.leadershipaa = row[6];
|
||||
entry.mentoree = row[7];
|
||||
entry.mentor_percent = atoi(row[8]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
int raid_leaders_id
|
||||
)
|
||||
{
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
raid_leaders_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
RaidLeaders raid_leaders_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(raid_leaders_entry.gid));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(raid_leaders_entry.rid));
|
||||
update_values.push_back(columns[2] + " = '" + Strings::Escape(raid_leaders_entry.marknpc) + "'");
|
||||
update_values.push_back(columns[3] + " = '" + Strings::Escape(raid_leaders_entry.maintank) + "'");
|
||||
update_values.push_back(columns[4] + " = '" + Strings::Escape(raid_leaders_entry.assist) + "'");
|
||||
update_values.push_back(columns[5] + " = '" + Strings::Escape(raid_leaders_entry.puller) + "'");
|
||||
update_values.push_back(columns[6] + " = '" + Strings::Escape(raid_leaders_entry.leadershipaa) + "'");
|
||||
update_values.push_back(columns[7] + " = '" + Strings::Escape(raid_leaders_entry.mentoree) + "'");
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(raid_leaders_entry.mentor_percent));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
raid_leaders_entry.
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static RaidLeaders InsertOne(
|
||||
RaidLeaders raid_leaders_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(raid_leaders_entry.gid));
|
||||
insert_values.push_back(std::to_string(raid_leaders_entry.rid));
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.marknpc) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.maintank) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.assist) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.puller) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.leadershipaa) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.mentoree) + "'");
|
||||
insert_values.push_back(std::to_string(raid_leaders_entry.mentor_percent));
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
raid_leaders_entry.id = results.LastInsertedID();
|
||||
return raid_leaders_entry;
|
||||
}
|
||||
|
||||
raid_leaders_entry = InstanceListRepository::NewEntity();
|
||||
|
||||
return raid_leaders_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
std::vector<RaidLeaders> raid_leaders_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &raid_leaders_entry: raid_leaders_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(raid_leaders_entry.gid));
|
||||
insert_values.push_back(std::to_string(raid_leaders_entry.rid));
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.marknpc) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.maintank) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.assist) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.puller) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.leadershipaa) + "'");
|
||||
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.mentoree) + "'");
|
||||
insert_values.push_back(std::to_string(raid_leaders_entry.mentor_percent));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<RaidLeaders> All()
|
||||
{
|
||||
std::vector<RaidLeaders> all_entries;
|
||||
|
||||
auto results = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
RaidLeaders entry{};
|
||||
|
||||
entry.gid = atoi(row[0]);
|
||||
entry.rid = atoi(row[1]);
|
||||
entry.marknpc = row[2];
|
||||
entry.maintank = row[3];
|
||||
entry.assist = row[4];
|
||||
entry.puller = row[5];
|
||||
entry.leadershipaa = row[6];
|
||||
entry.mentoree = row[7];
|
||||
entry.mentor_percent = atoi(row[8]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_RAID_LEADERS_REPOSITORY_H
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
);
|
||||
return results.Success() ? results.RowsAffected() : 0;
|
||||
}
|
||||
|
||||
|
||||
static int UpdateRaidAssister(
|
||||
Database& db,
|
||||
int32_t raid_id,
|
||||
@@ -98,5 +98,15 @@ public:
|
||||
|
||||
return results.Success() ? results.RowsAffected() : 0;
|
||||
}
|
||||
|
||||
static void ClearAllRaids(Database& db)
|
||||
{
|
||||
db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM `{}`",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
#endif //EQEMU_RAID_MEMBERS_REPOSITORY_H
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef EQEMU_ZONE_FLAGS_REPOSITORY_H
|
||||
#define EQEMU_ZONE_FLAGS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_zone_flags_repository.h"
|
||||
|
||||
class ZoneFlagsRepository: public BaseZoneFlagsRepository {
|
||||
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
|
||||
*
|
||||
* ZoneFlagsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ZoneFlagsRepository::GetWhereNeverExpires()
|
||||
* ZoneFlagsRepository::GetWhereXAndY()
|
||||
* ZoneFlagsRepository::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_ZONE_FLAGS_REPOSITORY_H
|
||||
+35
-5
@@ -34,8 +34,8 @@ const char *RuleManager::s_categoryNames[_CatCount + 1] = {
|
||||
"InvalidCategory"
|
||||
};
|
||||
|
||||
const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + 1] = {
|
||||
/* this is done in three steps so we can reliably get to them by index*/
|
||||
const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount + 1] = {
|
||||
/* this is done in three steps, so we can reliably get to them by index*/
|
||||
#define RULE_INT(category_name, rule_name, default_value, notes) \
|
||||
{ #category_name ":" #rule_name, Category__##category_name, IntRule, Int__##rule_name, notes },
|
||||
#include "ruletypes.h"
|
||||
@@ -45,6 +45,9 @@ const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount
|
||||
#define RULE_BOOL(category_name, rule_name, default_value, notes) \
|
||||
{ #category_name ":" #rule_name, Category__##category_name, BoolRule, Bool__##rule_name, notes },
|
||||
#include "ruletypes.h"
|
||||
#define RULE_STRING(category_name, rule_name, default_value, notes) \
|
||||
{ #category_name ":" #rule_name, Category__##category_name, StringRule, String__##rule_name, notes },
|
||||
#include "ruletypes.h"
|
||||
{ "Invalid Rule", _CatCount, IntRule }
|
||||
};
|
||||
|
||||
@@ -114,6 +117,9 @@ bool RuleManager::GetRule(const std::string &rule_name, std::string &rule_value)
|
||||
case BoolRule:
|
||||
rule_value = m_RuleBoolValues[index] ? "true" : "false";
|
||||
break;
|
||||
case StringRule:
|
||||
rule_value = m_RuleStringValues[index];
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -152,6 +158,10 @@ bool RuleManager::SetRule(const std::string &rule_name, const std::string &rule_
|
||||
m_RuleBoolValues[index] = static_cast<uint32>(Strings::ToBool(rule_value));
|
||||
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleBoolValues[index] == 1 ? "true" : "false");
|
||||
break;
|
||||
case StringRule:
|
||||
m_RuleStringValues[index] = rule_value;
|
||||
LogRules("Set rule [{}] to value [{}]", rule_name, rule_value);
|
||||
break;
|
||||
}
|
||||
|
||||
if (db_save) {
|
||||
@@ -215,11 +225,13 @@ std::string RuleManager::_GetRuleName(RuleType type, uint16 index) {
|
||||
return s_RuleInfo[index + IntRuleCount].name;
|
||||
case BoolRule:
|
||||
return s_RuleInfo[index + IntRuleCount + RealRuleCount].name;
|
||||
case StringRule:
|
||||
return s_RuleInfo[index + IntRuleCount + RealRuleCount + StringRuleCount].name;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].name;
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount].name;
|
||||
}
|
||||
|
||||
//assumes index is valid!
|
||||
@@ -231,11 +243,13 @@ const std::string &RuleManager::_GetRuleNotes(RuleType type, uint16 index) {
|
||||
return s_RuleInfo[index + IntRuleCount].notes;
|
||||
case BoolRule:
|
||||
return s_RuleInfo[index + IntRuleCount + RealRuleCount].notes;
|
||||
case StringRule:
|
||||
return s_RuleInfo[index + IntRuleCount + RealRuleCount + StringRuleCount].notes;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].notes;
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount].notes;
|
||||
}
|
||||
|
||||
bool RuleManager::LoadRules(Database *db, const std::string &rule_set_name, bool reload) {
|
||||
@@ -343,6 +357,10 @@ void RuleManager::SaveRules(Database *db, const std::string &rule_set_name) {
|
||||
for (i = 0; i < BoolRuleCount; i++) {
|
||||
_SaveRule(db, BoolRule, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < StringRuleCount; i++) {
|
||||
_SaveRule(db, StringRule, i);
|
||||
}
|
||||
}
|
||||
|
||||
void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
|
||||
@@ -367,6 +385,9 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
|
||||
case BoolRule:
|
||||
rule_value = m_RuleBoolValues[index] ? "true" : "false";
|
||||
break;
|
||||
case StringRule:
|
||||
rule_value = m_RuleStringValues[index];
|
||||
break;
|
||||
}
|
||||
|
||||
const auto& rule_notes = _GetRuleNotes(type, index);
|
||||
@@ -446,6 +467,10 @@ bool RuleManager::UpdateInjectedRules(Database *db, const std::string &rule_set_
|
||||
rule_data[r.name].first = fmt::format("{}", m_RuleBoolValues[r.rule_index] ? "true" : "false");
|
||||
rule_data[r.name].second = &r.notes;
|
||||
break;
|
||||
case StringRule:
|
||||
rule_data[r.name].first = m_RuleStringValues[r.rule_index];
|
||||
rule_data[r.name].second = &r.notes;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -552,7 +577,7 @@ bool RuleManager::RestoreRuleNotes(Database *db)
|
||||
}
|
||||
}
|
||||
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount];
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount];
|
||||
}(e.rule_name);
|
||||
|
||||
if (Strings::Contains(rule.name, e.rule_name)) {
|
||||
@@ -617,3 +642,8 @@ bool RuleManager::GetBoolRule(RuleManager::BoolType t) const
|
||||
{
|
||||
return m_RuleBoolValues[t] == 1;
|
||||
}
|
||||
|
||||
std::string RuleManager::GetStringRule(RuleManager::StringType t) const
|
||||
{
|
||||
return m_RuleStringValues[t];
|
||||
}
|
||||
|
||||
+45
-25
@@ -23,6 +23,7 @@
|
||||
* - RuleI(category, rule) -> fetch an integer rule's value
|
||||
* - RuleR(category, rule) -> fetch a real (float) rule's value
|
||||
* - RuleB(category, rule) -> fetch a boolean/flag rule's value
|
||||
* - RuleS(category, rule) -> fetch a string rule's value
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -35,6 +36,8 @@
|
||||
RuleManager::Instance()->GetRealRule( RuleManager::Real__##rule_name )
|
||||
#define RuleB(category_name, rule_name) \
|
||||
RuleManager::Instance()->GetBoolRule( RuleManager::Bool__##rule_name )
|
||||
#define RuleS(category_name, rule_name) \
|
||||
RuleManager::Instance()->GetStringRule( RuleManager::String__##rule_name )
|
||||
|
||||
|
||||
#include <vector>
|
||||
@@ -81,6 +84,17 @@ public:
|
||||
|
||||
static const int BoolRuleCount = static_cast<int>(_BoolRuleCount);
|
||||
|
||||
typedef enum {
|
||||
#define RULE_STRING(category_name, rule_name, default_value, notes) \
|
||||
String__##rule_name,
|
||||
|
||||
#include "ruletypes.h"
|
||||
|
||||
_StringRuleCount
|
||||
} StringType;
|
||||
|
||||
static const int StringRuleCount = static_cast<int>(_StringRuleCount);
|
||||
|
||||
typedef enum {
|
||||
#define RULE_CATEGORY(category_name) \
|
||||
Category__##category_name,
|
||||
@@ -99,45 +113,49 @@ public:
|
||||
static const IntType InvalidInt = _IntRuleCount;
|
||||
static const RealType InvalidReal = _RealRuleCount;
|
||||
static const BoolType InvalidBool = _BoolRuleCount;
|
||||
static const StringType InvalidString = _StringRuleCount;
|
||||
static const CategoryType InvalidCategory = _CatCount;
|
||||
|
||||
static const uint32 RulesCount = IntRuleCount + RealRuleCount + BoolRuleCount;
|
||||
static const uint32 RulesCount = IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount;
|
||||
|
||||
//fetch routines, you should generally use the Rule* macros instead of this
|
||||
int GetIntRule(IntType t) const;
|
||||
float GetRealRule(RealType t) const;
|
||||
bool GetBoolRule(BoolType t) const;
|
||||
std::string GetStringRule(StringType t) const;
|
||||
|
||||
//management routines
|
||||
static std::string GetRuleName(IntType t) { return s_RuleInfo[static_cast<int>(t)].name; }
|
||||
static std::string GetRuleName(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].name; }
|
||||
static std::string GetRuleName(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].name; }
|
||||
static const std::string &GetRuleNotes(IntType t) { return s_RuleInfo[static_cast<int>(t)].notes; }
|
||||
static const std::string &GetRuleNotes(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].notes; }
|
||||
static const std::string &GetRuleNotes(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].notes; }
|
||||
static std::string GetRuleName(StringType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount + StringRuleCount].name; }
|
||||
static const std::string& GetRuleNotes(IntType t) { return s_RuleInfo[static_cast<int>(t)].notes; }
|
||||
static const std::string& GetRuleNotes(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].notes; }
|
||||
static const std::string& GetRuleNotes(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].notes; }
|
||||
static const std::string& GetRuleNotes(StringType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount + StringRuleCount].notes; }
|
||||
static uint32 CountRules() { return RulesCount; }
|
||||
static CategoryType FindCategory(const std::string &category_name);
|
||||
bool ListRules(const std::string &category_name, std::vector <std::string> &l);
|
||||
bool ListCategories(std::vector <std::string> &l);
|
||||
bool GetRule(const std::string &rule_name, std::string &rule_value);
|
||||
static CategoryType FindCategory(const std::string& category_name);
|
||||
bool ListRules(const std::string& category_name, std::vector<std::string>& l);
|
||||
bool ListCategories(std::vector<std::string>& l);
|
||||
bool GetRule(const std::string& rule_name, std::string& rule_value);
|
||||
bool SetRule(
|
||||
const std::string &rule_name,
|
||||
const std::string &rule_value,
|
||||
Database *db = nullptr,
|
||||
const std::string& rule_name,
|
||||
const std::string& rule_value,
|
||||
Database* db = nullptr,
|
||||
bool db_save = false,
|
||||
bool reload = false
|
||||
);
|
||||
|
||||
int GetActiveRulesetID() const { return m_activeRuleset; }
|
||||
std::string GetActiveRuleset() const { return m_activeName; }
|
||||
static bool ListRulesets(Database *db, std::map<int, std::string> &l);
|
||||
static bool ListRulesets(Database* db, std::map<int, std::string>& l);
|
||||
|
||||
void ResetRules(bool reload = false);
|
||||
bool LoadRules(Database *db, const std::string &rule_set_name, bool reload = false);
|
||||
void SaveRules(Database *db, const std::string &rule_set_name);
|
||||
bool UpdateInjectedRules(Database *db, const std::string &rule_set_name, bool quiet_update = false);
|
||||
bool UpdateOrphanedRules(Database *db, bool quiet_update = false);
|
||||
bool RestoreRuleNotes(Database *db);
|
||||
bool LoadRules(Database* db, const std::string& rule_set_name, bool reload = false);
|
||||
void SaveRules(Database* db, const std::string& rule_set_name);
|
||||
bool UpdateInjectedRules(Database* db, const std::string& rule_set_name, bool quiet_update = false);
|
||||
bool UpdateOrphanedRules(Database* db, bool quiet_update = false);
|
||||
bool RestoreRuleNotes(Database* db);
|
||||
|
||||
private:
|
||||
RuleManager();
|
||||
@@ -147,21 +165,23 @@ private:
|
||||
int m_activeRuleset;
|
||||
std::string m_activeName;
|
||||
|
||||
int m_RuleIntValues[IntRuleCount];
|
||||
float m_RuleRealValues[RealRuleCount];
|
||||
uint32 m_RuleBoolValues[BoolRuleCount];
|
||||
int m_RuleIntValues[IntRuleCount];
|
||||
float m_RuleRealValues[RealRuleCount];
|
||||
uint32 m_RuleBoolValues[BoolRuleCount];
|
||||
std::string m_RuleStringValues[StringRuleCount];
|
||||
|
||||
typedef enum {
|
||||
IntRule,
|
||||
RealRule,
|
||||
BoolRule
|
||||
BoolRule,
|
||||
StringRule
|
||||
} RuleType;
|
||||
|
||||
static bool _FindRule(const std::string &rule_name, RuleType &type_into, uint16 &index_into);
|
||||
static bool _FindRule(const std::string& rule_name, RuleType& type_into, uint16& index_into);
|
||||
static std::string _GetRuleName(RuleType type, uint16 index);
|
||||
static const std::string &_GetRuleNotes(RuleType type, uint16 index);
|
||||
static int _FindOrCreateRuleset(Database *db, const std::string &rule_set_name);
|
||||
void _SaveRule(Database *db, RuleType type, uint16 index);
|
||||
static const std::string& _GetRuleNotes(RuleType type, uint16 index);
|
||||
static int _FindOrCreateRuleset(Database* db, const std::string& rule_set_name);
|
||||
void _SaveRule(Database* db, RuleType type, uint16 index);
|
||||
|
||||
static const char* s_categoryNames[];
|
||||
typedef struct {
|
||||
|
||||
+19
-6
@@ -28,6 +28,9 @@
|
||||
#ifndef RULE_BOOL
|
||||
#define RULE_BOOL(cat, rule, default_value, notes)
|
||||
#endif
|
||||
#ifndef RULE_STRING
|
||||
#define RULE_STRING(cat, rule, default_value, notes)
|
||||
#endif
|
||||
#ifndef RULE_CATEGORY_END
|
||||
#define RULE_CATEGORY_END()
|
||||
#endif
|
||||
@@ -48,10 +51,10 @@ RULE_BOOL(Character, DeathKeepLevel, false, "Players can not drop below 0% exper
|
||||
RULE_BOOL(Character, UseDeathExpLossMult, false, "Setting to control whether DeathExpLossMultiplier or the code default is used: (Level x Level / 18.0) x 12000")
|
||||
RULE_BOOL(Character, UseOldRaceRezEffects, false, "Older clients had ID 757 for races with high starting STR, but it doesn't seem used anymore")
|
||||
RULE_INT(Character, CorpseDecayTime, 604800000, "Time after which the corpse decays (milliseconds) DEFAULT: 604800000 (7 Days)")
|
||||
RULE_INT( Character, EmptyCorpseDecayTime, 10800000, "Time after which an empty corpse decays (milliseconds) DEFAULT: 10800000 (3 Hours)")
|
||||
RULE_INT(Character, EmptyCorpseDecayTime, 10800000, "Time after which an empty corpse decays (milliseconds) DEFAULT: 10800000 (3 Hours)")
|
||||
RULE_INT(Character, CorpseResTime, 10800000, "Time after which the corpse can no longer be resurrected (milliseconds) DEFAULT: 10800000 (3 Hours)")
|
||||
RULE_INT( Character, DuelCorpseResTime, 600000, "Time before cant res corpse after a duel (milliseconds) DEFAULT: 600000 (10 Minutes)")
|
||||
RULE_INT( Character, CorpseOwnerOnlineTime, 30000, "How often corpse will check if its owner is online DEFAULT: 30000 (30 Seconds)")
|
||||
RULE_INT(Character, DuelCorpseResTime, 600000, "Time before cant res corpse after a duel (milliseconds) DEFAULT: 600000 (10 Minutes)")
|
||||
RULE_INT(Character, CorpseOwnerOnlineTime, 30000, "How often corpse will check if its owner is online DEFAULT: 30000 (30 Seconds)")
|
||||
RULE_BOOL(Character, LeaveCorpses, true, "Setting whether you leave a corpse behind")
|
||||
RULE_BOOL(Character, LeaveNakedCorpses, false, "Setting whether you leave a corpse without items")
|
||||
RULE_INT(Character, MaxDraggedCorpses, 2, "Maximum number of corpses you can drag at once")
|
||||
@@ -324,6 +327,10 @@ RULE_INT(World, MaximumQuestErrors, 30, "Changes the maximum number of quest err
|
||||
RULE_INT(World, BootHour, 0, "Sets the in-game hour world will set when it first boots. 0-24 are valid options, where 0 disables this rule")
|
||||
RULE_BOOL(World, UseItemLinksForKeyRing, false, "Uses item links for Key Ring Listing instead of item name")
|
||||
RULE_BOOL(World, UseOldShadowKnightClassExport, true, "Disable to have Shadowknight show as Shadow Knight (live-like)")
|
||||
RULE_STRING(World, IPExemptionZones, "", "Comma-delimited list of zones to exclude from IP-limit checks. Empty string to disable.")
|
||||
RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to have this be used instead of variables table 'motd' value")
|
||||
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
|
||||
RULE_BOOL(World, EnableAutoLogin, false, "Enables or disables auto login of characters, allowing people to log characters in directly from loginserver to ingame")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Zone)
|
||||
@@ -349,6 +356,7 @@ RULE_INT(Zone, GlobalLootMultiplier, 1, "Sets Global Loot drop multiplier for da
|
||||
RULE_BOOL(Zone, KillProcessOnDynamicShutdown, true, "When process has booted a zone and has hit its zone shut down timer, it will hard kill the process to free memory back to the OS")
|
||||
RULE_INT(Zone, SpawnEventMin, 3, "When strict is set in spawn_events, specifies the max EQ minutes into the trigger hour a spawn_event will fire. Going below 3 may cause the spawn_event to not fire.")
|
||||
RULE_INT(Zone, ForageChance, 25, "Chance of foraging from zone table vs global table")
|
||||
RULE_INT(Zone, FishingChance, 399, "Chance of fishing from zone table vs global table")
|
||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnBots, false, "Set to true to allow cross zone spells (cast/remove) to affect bots")
|
||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnMercs, false, "Set to true to allow cross zone spells (cast/remove) to affect mercenaries")
|
||||
RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets")
|
||||
@@ -444,7 +452,8 @@ RULE_BOOL(Spells, Jun182014HundredHandsRevamp, false, "This should be true for i
|
||||
RULE_BOOL(Spells, SwarmPetTargetLock, false, "Use old method of swarm pets target locking till target dies then despawning")
|
||||
RULE_BOOL(Spells, NPC_UseFocusFromSpells, true, "Allow NPC to use most spell derived focus effects")
|
||||
RULE_BOOL(Spells, NPC_UseFocusFromItems, false, "Allow NPC to use most item derived focus effects")
|
||||
RULE_BOOL(Spells, UseAdditiveFocusFromWornSlot, false, "Allows an additive focus effect to be calculated from worn slot")
|
||||
RULE_BOOL(Spells, UseAdditiveFocusFromWornSlot, false, "Allows an additive focus effect to be calculated from worn slot. Does not apply limits checks. Can only have one additive focus rule be true.")
|
||||
RULE_BOOL(Spells, UseAdditiveFocusFromWornSlotWithLimits, false, "Allows an additive focus effect to be calculated from worn slot. Applies normal limit checks. Can only have one additive focus rule be true.")
|
||||
RULE_BOOL(Spells, AlwaysSendTargetsBuffs, false, "Ignore Leadership Alternate Abilities level if true")
|
||||
RULE_BOOL(Spells, FlatItemExtraSpellAmt, false, "Allow SpellDmg stat to affect all spells, regardless of cast time/cooldown/etc")
|
||||
RULE_BOOL(Spells, IgnoreSpellDmgLvlRestriction, false, "Ignore the 5 level spread on applying SpellDmg")
|
||||
@@ -495,6 +504,7 @@ RULE_BOOL(Spells, EvacClearCharmPet, false, "Enable to have evac in zone clear c
|
||||
RULE_BOOL(Spells, ManaTapsRequireNPCMana, false, "Enabling will require target to have mana to tap. Default off as many npc's are caster class with 0 mana and need fixed.")
|
||||
RULE_INT(Spells, HarmTouchCritRatio, 200, "Harmtouch crit bonus, on top of BaseCritRatio")
|
||||
RULE_BOOL(Spells, UseClassicSpellFocus, false, "Enabling will tell the server to handle random focus damage as classic spell imports lack the limit values.")
|
||||
RULE_BOOL(Spells, ManaTapsOnAnyClass, false, "Enabling this will allow you to cast mana taps on any class, this will bypass ManaTapsRequireNPCMana rule.")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Combat)
|
||||
@@ -521,6 +531,7 @@ RULE_REAL(Combat, BaseProcChance, 0.035, "Base chance for procs")
|
||||
RULE_REAL(Combat, ProcDexDivideBy, 11000, "Divisor for the probability of a proc increased by dexterity")
|
||||
RULE_INT(Combat, MinRangedAttackDist, 25, "Minimum Distance to use Ranged Attacks")
|
||||
RULE_BOOL(Combat, ArcheryBonusRequiresStationary, true, "does the 2x archery bonus chance require a stationary npc")
|
||||
RULE_INT(Combat, ArcheryBonusLevelRequirement, 51, "Level requirement when the 2x archery bonus will be enabled. The default is 51.")
|
||||
RULE_REAL(Combat, ArcheryNPCMultiplier, 1.0, "Value is multiplied by the regular dmg to get the archery dmg")
|
||||
RULE_BOOL(Combat, AssistNoTargetSelf, true, "When assisting a target that does not have a target: true = target self, false = leave target as was before assist (false = live like)")
|
||||
RULE_INT(Combat, MaxRampageTargets, 3, "Maximum number of people hit with rampage")
|
||||
@@ -569,10 +580,12 @@ RULE_BOOL(Combat, NPCsUseFrontalStunImmunityClasses, false, "Enable or disable N
|
||||
RULE_INT(Combat, FrontalStunImmunityRaces, 512, "Bitmask for Races than have frontal stun immunity, Ogre (512) only by default.")
|
||||
RULE_BOOL(Combat, NPCsUseFrontalStunImmunityRaces, true, "Enable or disable NPCs using frontal stun immunity Races from Combat:FrontalStunImmunityRaces, true by default.")
|
||||
RULE_BOOL(Combat, AssassinateOnlyHumanoids, true, "Enable or disable Assassinate only being allowed on Humanoids, true by default.")
|
||||
RULE_INT(Combat, AssassinateLevelRequirement, 60, "Level requirement to enable assassinate attempts on backstabs. The default is 60.")
|
||||
RULE_BOOL(Combat, HeadshotOnlyHumanoids, true, "Enable or disable Headshot only being allowed on Humanoids, true by default.")
|
||||
RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.")
|
||||
RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.")
|
||||
RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.")
|
||||
RULE_INT(Combat, DoubleBackstabLevelRequirement, 55, "Level requirement to enable double backstab attempts. The default is 55.")
|
||||
RULE_BOOL(Combat, SummonMeleeRange, true, "Enable or disable summoning of a player when already in melee range of the summoner.")
|
||||
RULE_BOOL(Combat, WaterMatchRequiredForAutoFireLoS, true, "Enable/Disable the requirement of both the attacker/victim being both in or out of water for AutoFire LoS to pass.")
|
||||
RULE_INT(Combat, ExtraAllowedKickClassesBitmask, 0, "Bitmask for allowing extra classes beyond Warrior, Ranger, Beastlord, and Berserker to kick, No Extra Classes (0) by default")
|
||||
@@ -694,7 +707,6 @@ RULE_BOOL(Bots, BotGroupXP, false, "Determines whether client gets experience fo
|
||||
RULE_BOOL(Bots, BotLevelsWithOwner, false, "Auto-updates spawned bots as owner levels/de-levels (false is original behavior)")
|
||||
RULE_INT(Bots, BotCharacterLevel, 0, "If level is greater that value player can spawn bots if BotCharacterLevelEnabled is true")
|
||||
RULE_INT(Bots, CasterStopMeleeLevel, 13, "Level at which caster bots stop melee attacks")
|
||||
RULE_BOOL(Bots, AllowOwnerOptionAltCombat, true, "When option is enabled, bots will use an auto-/shared-aggro combat model")
|
||||
RULE_BOOL(Bots, AllowOwnerOptionAutoDefend, true, "When option is enabled, bots will defend their owner on enemy aggro")
|
||||
RULE_REAL(Bots, LeashDistance, 562500.0f, "Distance a bot is allowed to travel from leash owner before being pulled back (squared value)")
|
||||
RULE_BOOL(Bots, AllowApplyPoisonCommand, true, "Allows the use of the bot command 'applypoison'")
|
||||
@@ -891,7 +903,7 @@ RULE_INT(Expansion, AutoGrantAAExpansion, -1, "Expansion to auto grant AAs up to
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Instances)
|
||||
RULE_INT(Instances, ReservedInstances, 30, "Number of instance IDs which are reserved for globals. This value should not be changed while a server is running")
|
||||
RULE_INT(Instances, ReservedInstances, 100, "Number of instance IDs which are reserved for globals. This value should not be changed while a server is running")
|
||||
RULE_BOOL(Instances, RecycleInstanceIds, true, "Setting whether free instance IDs should be recycled to prevent them from gradually running out at 32k")
|
||||
RULE_INT(Instances, GuildHallExpirationDays, 90, "Amount of days before a Guild Hall instance expires")
|
||||
RULE_CATEGORY_END()
|
||||
@@ -951,4 +963,5 @@ RULE_CATEGORY_END()
|
||||
#undef RULE_INT
|
||||
#undef RULE_REAL
|
||||
#undef RULE_BOOL
|
||||
#undef RULE_STRING
|
||||
#undef RULE_CATEGORY_END
|
||||
|
||||
+4
-3
@@ -348,7 +348,7 @@ std::string EQ::SayLinkEngine::InjectSaylinksIfNotExist(const char *message)
|
||||
if (ch != startpos)
|
||||
{
|
||||
std::string str(startpos, ch - startpos);
|
||||
new_message += EQ::SayLinkEngine::GenerateQuestSaylink(str, false, str);
|
||||
new_message += Saylink::Create(str);
|
||||
}
|
||||
in_bracket_state = false;
|
||||
}
|
||||
@@ -417,11 +417,12 @@ SaylinkRepository::Saylink EQ::SayLinkEngine::GetOrSaveSaylink(std::string sayli
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string Saylink::Create(const std::string &saylink_text, bool silent, const std::string &link_name)
|
||||
std::string Saylink::Create(const std::string& saylink_text, bool silent, const std::string& link_name)
|
||||
{
|
||||
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, silent, (link_name.empty() ? saylink_text : link_name));
|
||||
}
|
||||
|
||||
std::string Saylink::Silent(const std::string &saylink_text, const std::string &link_name) {
|
||||
std::string Saylink::Silent(const std::string& saylink_text, const std::string& link_name)
|
||||
{
|
||||
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, true, (link_name.empty() ? saylink_text : link_name));
|
||||
}
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ namespace EQ
|
||||
|
||||
class Saylink {
|
||||
public:
|
||||
static std::string Create(const std::string &saylink_text, bool silent, const std::string &link_name = "");
|
||||
static std::string Create(const std::string &saylink_text, bool silent = false, const std::string &link_name = "");
|
||||
static std::string Silent(const std::string &saylink_text, const std::string &link_name = "");
|
||||
};
|
||||
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
#define ServerOP_ReloadFactions 0x4126
|
||||
#define ServerOP_ReloadLoot 0x4127
|
||||
#define ServerOP_ReloadBaseData 0x4128
|
||||
#define ServerOP_ReloadSkillCaps 0x4129
|
||||
|
||||
#define ServerOP_CZDialogueWindow 0x4500
|
||||
#define ServerOP_CZLDoNUpdate 0x4501
|
||||
|
||||
@@ -60,7 +60,7 @@ SharedTaskRequest SharedTask::GetRequestCharacters(Database &db, uint32_t reques
|
||||
request.group_type = SharedTaskRequestGroupType::Group;
|
||||
auto characters = CharacterDataRepository::GetWhere(
|
||||
db, fmt::format(
|
||||
"id IN (select charid from group_id where groupid = (select groupid from group_id where charid = {}))",
|
||||
"id IN (select character_id from group_id where group_id = (select group_id from group_id where character_id = {}))",
|
||||
requested_character_id
|
||||
)
|
||||
);
|
||||
|
||||
+21
-136
@@ -45,6 +45,7 @@
|
||||
#include "repositories/loottable_repository.h"
|
||||
#include "repositories/character_item_recast_repository.h"
|
||||
#include "repositories/character_corpses_repository.h"
|
||||
#include "repositories/skill_caps_repository.h"
|
||||
|
||||
namespace ItemField
|
||||
{
|
||||
@@ -461,7 +462,13 @@ bool SharedDatabase::SetStartingItems(
|
||||
{
|
||||
const EQ::ItemData *item_data;
|
||||
|
||||
const auto &l = StartingItemsRepository::All(*this);
|
||||
const auto& l = StartingItemsRepository::GetWhere(
|
||||
*this,
|
||||
fmt::format(
|
||||
"TRUE {}",
|
||||
ContentFilterCriteria::apply()
|
||||
)
|
||||
);
|
||||
|
||||
if (l.empty()) {
|
||||
return false;
|
||||
@@ -515,7 +522,16 @@ bool SharedDatabase::SetStartingItems(
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto *inst = CreateBaseItem(item_data, item_charges);
|
||||
const auto* inst = CreateItem(
|
||||
item_data,
|
||||
item_charges,
|
||||
e.augment_one,
|
||||
e.augment_two,
|
||||
e.augment_three,
|
||||
e.augment_four,
|
||||
e.augment_five,
|
||||
e.augment_six
|
||||
);
|
||||
|
||||
if (slot < EQ::invslot::slotCharm) {
|
||||
slot = inv->FindFreeSlot(false, false);
|
||||
@@ -778,8 +794,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
|
||||
}
|
||||
|
||||
if (cv_conflict) {
|
||||
char char_name[64] = "";
|
||||
GetCharName(char_id, char_name);
|
||||
const std::string& char_name = GetCharName(char_id);
|
||||
LogError("ClientVersion/Expansion conflict during inventory load at zone entry for [{}] (charid: [{}], inver: [{}], gmi: [{}])",
|
||||
char_name,
|
||||
char_id,
|
||||
@@ -1611,136 +1626,6 @@ bool SharedDatabase::GetCommandSubSettings(std::vector<CommandSubsettingsReposit
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
|
||||
skill_caps_mmf.reset(nullptr);
|
||||
|
||||
try {
|
||||
const auto Config = EQEmuConfig::get();
|
||||
EQ::IPCMutex mutex("skill_caps");
|
||||
mutex.Lock();
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("skill_caps"));
|
||||
LogInfo("Loading [{}]", file_name);
|
||||
skill_caps_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
|
||||
LogInfo("Loaded skill caps via shared memory");
|
||||
|
||||
mutex.Unlock();
|
||||
} catch(std::exception &ex) {
|
||||
LogError("Error loading skill caps: {}", ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SharedDatabase::LoadSkillCaps(void *data) {
|
||||
const uint32 class_count = Class::PLAYER_CLASS_COUNT;
|
||||
const uint32 skill_count = EQ::skills::HIGHEST_SKILL + 1;
|
||||
const uint32 level_count = HARD_LEVEL_CAP + 1;
|
||||
uint16 *skill_caps_table = static_cast<uint16*>(data);
|
||||
|
||||
const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogError("Error loading skill caps from database: {}", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
for(auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const uint8 skillID = Strings::ToUnsignedInt(row[0]);
|
||||
const uint8 class_ = Strings::ToUnsignedInt(row[1]) - 1;
|
||||
const uint8 level = Strings::ToUnsignedInt(row[2]);
|
||||
const uint16 cap = Strings::ToUnsignedInt(row[3]);
|
||||
|
||||
if(skillID >= skill_count || class_ >= class_count || level >= level_count)
|
||||
continue;
|
||||
|
||||
const uint32 index = (((class_ * skill_count) + skillID) * level_count) + level;
|
||||
skill_caps_table[index] = cap;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 SharedDatabase::GetSkillCap(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const
|
||||
{
|
||||
if(!skill_caps_mmf) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(Class_ == 0)
|
||||
return 0;
|
||||
|
||||
int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel);
|
||||
if(SkillMaxLevel < 1) {
|
||||
SkillMaxLevel = RuleI(Character, MaxLevel);
|
||||
}
|
||||
|
||||
const uint32 class_count = Class::PLAYER_CLASS_COUNT;
|
||||
const uint32 skill_count = EQ::skills::HIGHEST_SKILL + 1;
|
||||
const uint32 level_count = HARD_LEVEL_CAP + 1;
|
||||
if(Class_ > class_count || static_cast<uint32>(Skill) > skill_count || Level > level_count) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(Level > static_cast<uint8>(SkillMaxLevel)){
|
||||
Level = static_cast<uint8>(SkillMaxLevel);
|
||||
}
|
||||
|
||||
const uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count) + Level;
|
||||
const uint16 *skill_caps_table = static_cast<uint16*>(skill_caps_mmf->Get());
|
||||
return skill_caps_table[index];
|
||||
}
|
||||
|
||||
uint8 SharedDatabase::GetTrainLevel(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const
|
||||
{
|
||||
if(!skill_caps_mmf) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(Class_ == 0)
|
||||
return 0;
|
||||
|
||||
int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel);
|
||||
if (SkillMaxLevel < 1) {
|
||||
SkillMaxLevel = RuleI(Character, MaxLevel);
|
||||
}
|
||||
|
||||
const uint32 class_count = Class::PLAYER_CLASS_COUNT;
|
||||
const uint32 skill_count = EQ::skills::HIGHEST_SKILL + 1;
|
||||
const uint32 level_count = HARD_LEVEL_CAP + 1;
|
||||
if(Class_ > class_count || static_cast<uint32>(Skill) > skill_count || Level > level_count) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8 ret = 0;
|
||||
if(Level > static_cast<uint8>(SkillMaxLevel)) {
|
||||
const uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count);
|
||||
const uint16 *skill_caps_table = static_cast<uint16*>(skill_caps_mmf->Get());
|
||||
for(uint8 x = 0; x < Level; x++){
|
||||
if(skill_caps_table[index + x]){
|
||||
ret = x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count);
|
||||
const uint16 *skill_caps_table = static_cast<uint16*>(skill_caps_mmf->Get());
|
||||
for(int x = 0; x < SkillMaxLevel; x++){
|
||||
if(skill_caps_table[index + x]){
|
||||
ret = x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ret > GetSkillCap(Class_, Skill, Level))
|
||||
ret = static_cast<uint8>(GetSkillCap(Class_, Skill, Level));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) {
|
||||
const std::string query = StringFormat("SELECT `spellid`, `type` FROM `damageshieldtypes` WHERE `spellid` > 0 "
|
||||
"AND `spellid` <= %i", iMaxSpellID);
|
||||
@@ -1969,9 +1854,9 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
sp[tempid].min_range = Strings::ToFloat(row[231]);
|
||||
sp[tempid].no_remove = Strings::ToBool(row[232]);
|
||||
sp[tempid].damage_shield_type = 0;
|
||||
}
|
||||
}
|
||||
|
||||
LoadDamageShieldTypes(sp, max_spells);
|
||||
LoadDamageShieldTypes(sp, max_spells);
|
||||
}
|
||||
|
||||
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
|
||||
|
||||
@@ -160,14 +160,6 @@ public:
|
||||
uint32 GetSharedItemsCount() { return m_shared_items_count; }
|
||||
uint32 GetItemsCount();
|
||||
|
||||
/**
|
||||
* skills
|
||||
*/
|
||||
void LoadSkillCaps(void *data);
|
||||
bool LoadSkillCaps(const std::string &prefix);
|
||||
uint16 GetSkillCap(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const;
|
||||
uint8 GetTrainLevel(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const;
|
||||
|
||||
/**
|
||||
* spells
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
#include "skill_caps.h"
|
||||
|
||||
SkillCaps *SkillCaps::SetContentDatabase(Database *db)
|
||||
{
|
||||
m_content_database = db;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
SkillCapsRepository::SkillCaps SkillCaps::GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
|
||||
{
|
||||
if (!IsPlayerClass(class_id)) {
|
||||
return SkillCapsRepository::NewEntity();
|
||||
}
|
||||
|
||||
uint64_t key = (class_id * 1000000) + (level * 1000) + static_cast<uint32>(skill_id);
|
||||
auto pos = m_skill_caps.find(key);
|
||||
if (pos != m_skill_caps.end()) {
|
||||
return pos->second;
|
||||
}
|
||||
return SkillCapsRepository::NewEntity();
|
||||
}
|
||||
|
||||
uint8 SkillCaps::GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
|
||||
{
|
||||
if (
|
||||
!IsPlayerClass(class_id) ||
|
||||
class_id > Class::PLAYER_CLASS_COUNT ||
|
||||
static_cast<uint32>(skill_id) > (EQ::skills::HIGHEST_SKILL + 1)
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint8 skill_cap_max_level = (
|
||||
RuleI(Character, SkillCapMaxLevel) > 0 ?
|
||||
RuleI(Character, SkillCapMaxLevel) :
|
||||
RuleI(Character, MaxLevel)
|
||||
);
|
||||
|
||||
const uint8 max_level = level > skill_cap_max_level ? level : skill_cap_max_level;
|
||||
|
||||
for (const auto &e: m_skill_caps) {
|
||||
for (uint8 current_level = 1; current_level <= max_level; current_level++) {
|
||||
uint64_t key = (class_id * 1000000) + (level * 1000) + static_cast<uint32>(skill_id);
|
||||
auto pos = m_skill_caps.find(key);
|
||||
if (pos != m_skill_caps.end()) {
|
||||
return current_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SkillCaps::LoadSkillCaps()
|
||||
{
|
||||
const auto &l = SkillCapsRepository::All(*m_content_database);
|
||||
|
||||
m_skill_caps.clear();
|
||||
|
||||
for (const auto &e: l) {
|
||||
if (
|
||||
e.level < 1 ||
|
||||
!IsPlayerClass(e.class_id) ||
|
||||
static_cast<EQ::skills::SkillType>(e.skill_id) >= EQ::skills::SkillCount
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint64_t key = (e.class_id * 1000000) + (e.level * 1000) + e.skill_id;
|
||||
m_skill_caps[key] = e;
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Loaded [{}] Skill Cap Entr{}",
|
||||
l.size(),
|
||||
l.size() != 1 ? "ies" : "y"
|
||||
);
|
||||
}
|
||||
|
||||
void SkillCaps::ReloadSkillCaps()
|
||||
{
|
||||
ClearSkillCaps();
|
||||
LoadSkillCaps();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef CODE_SKILL_CAPS_H
|
||||
#define CODE_SKILL_CAPS_H
|
||||
|
||||
#include "repositories/skill_caps_repository.h"
|
||||
#include "types.h"
|
||||
#include "classes.h"
|
||||
#include "skills.h"
|
||||
|
||||
class SkillCaps {
|
||||
public:
|
||||
inline void ClearSkillCaps() { m_skill_caps.clear(); }
|
||||
SkillCapsRepository::SkillCaps GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
|
||||
uint8 GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
|
||||
void LoadSkillCaps();
|
||||
void ReloadSkillCaps();
|
||||
|
||||
SkillCaps *SetContentDatabase(Database *db);
|
||||
private:
|
||||
Database *m_content_database{};
|
||||
std::map<uint64, SkillCapsRepository::SkillCaps> m_skill_caps = {};
|
||||
};
|
||||
|
||||
extern SkillCaps skill_caps;
|
||||
|
||||
|
||||
#endif //CODE_SKILL_CAPS_H
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
|
||||
#include "skills.h"
|
||||
#include "classes.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
bool EQ::skills::IsTradeskill(SkillType skill)
|
||||
{
|
||||
switch (skill) {
|
||||
|
||||
+2
-1
@@ -26,7 +26,6 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace EQ
|
||||
{
|
||||
namespace skills {
|
||||
@@ -162,6 +161,8 @@ namespace EQ
|
||||
// server profile does not reflect this yet..so, prefixed with 'PACKET_'
|
||||
#define PACKET_SKILL_ARRAY_SIZE 100
|
||||
|
||||
constexpr int format_as(SkillType skill) { return static_cast<int>(skill); }
|
||||
|
||||
bool IsTradeskill(SkillType skill);
|
||||
bool IsSpecializedSkill(SkillType skill);
|
||||
float GetSkillMeleePushForce(SkillType skill);
|
||||
|
||||
+1
-1
@@ -1257,7 +1257,7 @@ typedef enum {
|
||||
#define SE_Ff_Override_NotFocusable 460 // implemented, @Fc, Allow spell to be focused event if flagged with 'not_focusable' in spell table, base: 1
|
||||
#define SE_ImprovedDamage2 461 // implemented, @Fc, On Caster, spell damage mod pct, base: min pct, limit: max pct
|
||||
#define SE_FcDamageAmt2 462 // implemented, @Fc, On Caster, spell damage mod flat amt, base: amt
|
||||
//#define SE_Shield_Target 463 //
|
||||
#define SE_Shield_Target 463 // implemented, Base1 % damage shielded on target
|
||||
#define SE_PC_Pet_Rampage 464 // implemented - Base1 % chance to do rampage for base2 % of damage each melee round
|
||||
#define SE_PC_Pet_AE_Rampage 465 // implemented - Base1 % chance to do AE rampage for base2 % of damage each melee round
|
||||
#define SE_PC_Pet_Flurry_Chance 466 // implemented - Base1 % chance to do flurry from double attack hit.
|
||||
|
||||
@@ -252,6 +252,8 @@ typedef enum {
|
||||
ActivityCompleted = 2
|
||||
} ActivityState;
|
||||
|
||||
constexpr int format_as(ActivityState state) { return static_cast<int>(state); }
|
||||
|
||||
struct ClientActivityInformation {
|
||||
int activity_id;
|
||||
int done_count;
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace EQ
|
||||
tintInvalid = textureInvalid
|
||||
};
|
||||
|
||||
constexpr int format_as(TextureSlot slot) { return static_cast<int>(slot); }
|
||||
|
||||
const int8 LastTexture = weaponSecondary;
|
||||
const int8 LastTintableTexture = tintFeet;
|
||||
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@
|
||||
|
||||
// Build variables
|
||||
// these get injected during the build pipeline
|
||||
#define CURRENT_VERSION "22.44.0-dev" // always append -dev to the current version for custom-builds
|
||||
#define CURRENT_VERSION "22.49.0-dev" // always append -dev to the current version for custom-builds
|
||||
#define LOGIN_VERSION "0.8.0"
|
||||
#define COMPILE_DATE __DATE__
|
||||
#define COMPILE_TIME __TIME__
|
||||
@@ -42,8 +42,8 @@
|
||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9260
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9042
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9270
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9043
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+225
-891
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eqemu-server",
|
||||
"version": "22.44.0",
|
||||
"version": "22.49.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/EQEmu/Server.git"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Description
|
||||
|
||||
Please include a summary of the changes and the related issue (Why is this change necessary). Please also include relevant motivation and context. List any dependencies that are required for this change.
|
||||
|
||||
Fixes # (issue)
|
||||
|
||||
## Type of change
|
||||
|
||||
Please delete options that are not relevant.
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] This change requires a documentation update
|
||||
|
||||
# Testing
|
||||
|
||||
Attach images and describe testing done to validate functionality.
|
||||
|
||||
Clients tested:
|
||||
|
||||
# Checklist
|
||||
|
||||
- [ ] I have tested my changes
|
||||
- [ ] I have performed a self-review of my code. Ensuring variables, functions and methods are named in a human-readable way, comments are added only where naming of variables, functions and methods can't give enough context.
|
||||
- [ ] I have made corresponding changes to the documentation (if applicable, if not delete this line)
|
||||
- [ ] I own the changes of my code and take responsibility for the potential issues that occur
|
||||
- [ ] If my changes make database schema changes, I have tested the changes on a local database (attach image). Updated version.h CURRENT_BINARY_DATABASE_VERSION to the new version. (Delete this if not applicable)
|
||||
@@ -4,13 +4,11 @@ SET(shared_memory_sources
|
||||
items.cpp
|
||||
main.cpp
|
||||
spells.cpp
|
||||
skill_caps.cpp
|
||||
)
|
||||
|
||||
SET(shared_memory_headers
|
||||
items.h
|
||||
spells.h
|
||||
skill_caps.h
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers})
|
||||
|
||||
+2
-17
@@ -28,7 +28,6 @@
|
||||
#include "../common/eqemu_exception.h"
|
||||
#include "../common/strings.h"
|
||||
#include "items.h"
|
||||
#include "skill_caps.h"
|
||||
#include "spells.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
#include "../common/zone_store.h"
|
||||
@@ -168,6 +167,7 @@ int main(int argc, char **argv)
|
||||
|
||||
content_service.SetCurrentExpansion(RuleI(Expansion, CurrentExpansion));
|
||||
content_service.SetDatabase(&database)
|
||||
->SetContentDatabase(&content_db)
|
||||
->SetExpansionContext()
|
||||
->ReloadContentFlags();
|
||||
|
||||
@@ -182,7 +182,6 @@ int main(int argc, char **argv)
|
||||
bool load_all = true;
|
||||
bool load_items = false;
|
||||
bool load_loot = false;
|
||||
bool load_skill_caps = false;
|
||||
bool load_spells = false;
|
||||
|
||||
if (argc > 1) {
|
||||
@@ -196,11 +195,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (strcasecmp("skill_caps", argv[i]) == 0) {
|
||||
load_skill_caps = true;
|
||||
load_all = false;
|
||||
}
|
||||
else if (strcasecmp("spells", argv[i]) == 0) {
|
||||
if (strcasecmp("spells", argv[i]) == 0) {
|
||||
load_spells = true;
|
||||
load_all = false;
|
||||
}
|
||||
@@ -235,16 +230,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (load_all || load_skill_caps) {
|
||||
LogInfo("Loading skill caps");
|
||||
try {
|
||||
LoadSkillCaps(&content_db, hotfix_name);
|
||||
} catch (std::exception &ex) {
|
||||
LogError("{}", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (load_all || load_spells) {
|
||||
LogInfo("Loading spells");
|
||||
try {
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2013 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 "skill_caps.h"
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/shareddb.h"
|
||||
#include "../common/ipc_mutex.h"
|
||||
#include "../common/memory_mapped_file.h"
|
||||
#include "../common/eqemu_exception.h"
|
||||
#include "../common/classes.h"
|
||||
#include "../common/features.h"
|
||||
|
||||
void LoadSkillCaps(SharedDatabase *database, const std::string &prefix) {
|
||||
EQ::IPCMutex mutex("skill_caps");
|
||||
mutex.Lock();
|
||||
|
||||
uint32 class_count = Class::PLAYER_CLASS_COUNT;
|
||||
uint32 skill_count = EQ::skills::HIGHEST_SKILL + 1;
|
||||
uint32 level_count = HARD_LEVEL_CAP + 1;
|
||||
uint32 size = (class_count * skill_count * level_count * sizeof(uint16));
|
||||
|
||||
auto Config = EQEmuConfig::get();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps");
|
||||
EQ::MemoryMappedFile mmf(file_name, size);
|
||||
mmf.ZeroFile();
|
||||
|
||||
void *ptr = mmf.Get();
|
||||
database->LoadSkillCaps(ptr);
|
||||
mutex.Unlock();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2013 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
|
||||
*/
|
||||
|
||||
#ifndef __EQEMU_SHARED_MEMORY_SKILL_CAPS_H
|
||||
#define __EQEMU_SHARED_MEMORY_SKILL_CAPS_H
|
||||
|
||||
#include <string>
|
||||
#include "../common/eqemu_config.h"
|
||||
|
||||
class SharedDatabase;
|
||||
void LoadSkillCaps(SharedDatabase *database, const std::string &prefix);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
Submodule submodules/fmt updated: a33701196a...e69e5f977d
@@ -280,7 +280,7 @@ foreach my $table_to_generate (@tables) {
|
||||
|
||||
# column names (string)
|
||||
$column_names_quoted .= sprintf("\t\t\t\"%s\",\n", format_column_name_for_mysql($column_name));
|
||||
if ($data_type =~ /datetime/) {
|
||||
if ($data_type =~ /datetime|timestamp/) {
|
||||
$select_column_names_quoted .= sprintf("\t\t\t\"UNIX_TIMESTAMP(%s)\",\n", format_column_name_for_mysql($column_name));
|
||||
}
|
||||
else {
|
||||
@@ -293,7 +293,7 @@ foreach my $table_to_generate (@tables) {
|
||||
if ($data_type =~ /int|float|double|decimal/) {
|
||||
$query_value = sprintf('" + std::to_string(e.%s));', $column_name_formatted);
|
||||
}
|
||||
elsif ($data_type =~ /datetime/) {
|
||||
elsif ($data_type =~ /datetime|timestamp/) {
|
||||
$query_value = sprintf('FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")");', $column_name_formatted, $column_name_formatted);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ foreach my $table_to_generate (@tables) {
|
||||
if ($data_type =~ /int|float|double|decimal/) {
|
||||
$value = sprintf('std::to_string(e.%s)', $column_name_formatted);
|
||||
}
|
||||
elsif ($data_type =~ /datetime/) {
|
||||
elsif ($data_type =~ /datetime|timestamp/) {
|
||||
$value = sprintf('"FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")"', $column_name_formatted, $column_name_formatted);
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ foreach my $table_to_generate (@tables) {
|
||||
$all_entries .= sprintf("\t\t\te.%-${longest_column_length}s = row[%s] ? strtoll(row[%s], nullptr, 10) : %s;\n", $column_name_formatted, $index, $index, $default_value);
|
||||
$find_one_entries .= sprintf("\t\t\te.%-${longest_column_length}s = row[%s] ? strtoll(row[%s], nullptr, 10) : %s;\n", $column_name_formatted, $index, $index, $default_value);
|
||||
}
|
||||
elsif ($data_type =~ /datetime/) {
|
||||
elsif ($data_type =~ /datetime|timestamp/) {
|
||||
$all_entries .= sprintf("\t\t\te.%-${longest_column_length}s = strtoll(row[%s] ? row[%s] : \"-1\", nullptr, 10);\n", $column_name_formatted, $index, $index);
|
||||
$find_one_entries .= sprintf("\t\t\te.%-${longest_column_length}s = strtoll(row[%s] ? row[%s] : \"-1\", nullptr, 10);\n", $column_name_formatted, $index, $index);
|
||||
}
|
||||
@@ -591,7 +591,7 @@ sub translate_mysql_data_type_to_c
|
||||
elsif ($mysql_data_type =~ /double/) {
|
||||
$struct_data_type = 'double';
|
||||
}
|
||||
elsif ($mysql_data_type =~ /datetime/) {
|
||||
elsif ($mysql_data_type =~ /datetime|timestamp/) {
|
||||
$struct_data_type = 'time_t';
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -56,7 +56,7 @@ void Adventure::AddPlayer(std::string character_name, bool add_client_to_instanc
|
||||
{
|
||||
if(!PlayerExists(character_name))
|
||||
{
|
||||
int32 character_id = database.GetCharacterID(character_name.c_str());
|
||||
int32 character_id = database.GetCharacterID(character_name);
|
||||
if(character_id && add_client_to_instance)
|
||||
{
|
||||
database.AddClientToInstance(instance_id, character_id);
|
||||
@@ -72,7 +72,7 @@ void Adventure::RemovePlayer(std::string character_name)
|
||||
{
|
||||
if((*iter).compare(character_name) == 0)
|
||||
{
|
||||
int32 character_id = database.GetCharacterID(character_name.c_str());
|
||||
int32 character_id = database.GetCharacterID(character_name);
|
||||
if (character_id)
|
||||
{
|
||||
database.RemoveClientFromInstance(instance_id, character_id);
|
||||
@@ -312,7 +312,7 @@ void Adventure::Finished(AdventureWinStatus ws)
|
||||
}
|
||||
|
||||
zoneserver_list.SendPacket(current->zone(), current->instance(), pack);
|
||||
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
|
||||
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter)), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
|
||||
delete pack;
|
||||
}
|
||||
else
|
||||
@@ -337,7 +337,7 @@ void Adventure::Finished(AdventureWinStatus ws)
|
||||
afe.points = 0;
|
||||
}
|
||||
adventure_manager.AddFinishedEvent(afe);
|
||||
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
|
||||
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter)), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -363,7 +363,7 @@ void Adventure::Finished(AdventureWinStatus ws)
|
||||
}
|
||||
adventure_manager.AddFinishedEvent(afe);
|
||||
|
||||
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter).c_str()), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
|
||||
database.UpdateAdventureStatsEntry(database.GetCharacterID((*iter)), GetTemplate()->theme, (ws != AWS_Lose) ? true : false);
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
+245
-222
@@ -50,7 +50,12 @@
|
||||
#include "../common/zone_store.h"
|
||||
#include "../common/repositories/account_repository.h"
|
||||
#include "../common/repositories/player_event_logs_repository.h"
|
||||
#include "../common/repositories/inventory_repository.h"
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
#include "../common/repositories/group_id_repository.h"
|
||||
#include "../common/repositories/character_data_repository.h"
|
||||
#include "../common/skill_caps.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@@ -188,18 +193,25 @@ bool Client::CanTradeFVNoDropItem()
|
||||
|
||||
void Client::SendEnterWorld(std::string name)
|
||||
{
|
||||
char char_name[64] = { 0 };
|
||||
if (is_player_zoning && database.GetLiveChar(GetAccountID(), char_name)) {
|
||||
if(database.GetAccountIDByChar(char_name) != GetAccountID()) {
|
||||
std::string live_name {};
|
||||
|
||||
if (is_player_zoning) {
|
||||
live_name = database.GetLiveChar(GetAccountID());
|
||||
if (database.GetAccountIDByChar(live_name) != GetAccountID()) {
|
||||
eqs->Close();
|
||||
return;
|
||||
} else {
|
||||
LogInfo("Telling client to continue session");
|
||||
}
|
||||
|
||||
LogInfo("Zoning with live_name [{}] account_id [{}]", live_name, GetAccountID());
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_EnterWorld, strlen(char_name) + 1);
|
||||
memcpy(outapp->pBuffer,char_name,strlen(char_name)+1);
|
||||
if (RuleB(World, EnableAutoLogin)) {
|
||||
live_name = AccountRepository::GetAutoLoginCharacterNameByAccountID(database, GetAccountID());
|
||||
LogInfo("Attempting to auto login with live_name [{}] account_id [{}]", live_name, GetAccountID());
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_EnterWorld, live_name.length() + 1);
|
||||
memcpy(outapp->pBuffer, live_name.c_str(), live_name.length() + 1);
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
@@ -598,79 +610,63 @@ bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
bool Client::HandleGenerateRandomNamePacket(const EQApplicationPacket *app) {
|
||||
// creates up to a 10 char name
|
||||
char vowels[18]="aeiouyaeiouaeioe";
|
||||
char cons[48]="bcdfghjklmnpqrstvwxzybcdgklmnprstvwbcdgkpstrkd";
|
||||
char rndname[17]="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
||||
char paircons[33]="ngrkndstshthphsktrdrbrgrfrclcr";
|
||||
int rndnum=emu_random.Int(0, 75),n=1;
|
||||
bool dlc=false;
|
||||
bool vwl=false;
|
||||
bool dbl=false;
|
||||
if (rndnum>63)
|
||||
{ // rndnum is 0 - 75 where 64-75 is cons pair, 17-63 is cons, 0-16 is vowel
|
||||
rndnum=(rndnum-61)*2; // name can't start with "ng" "nd" or "rk"
|
||||
rndname[0]=paircons[rndnum];
|
||||
rndname[1]=paircons[rndnum+1];
|
||||
n=2;
|
||||
}
|
||||
else if (rndnum>16)
|
||||
{
|
||||
rndnum-=17;
|
||||
rndname[0]=cons[rndnum];
|
||||
}
|
||||
else
|
||||
{
|
||||
rndname[0]=vowels[rndnum];
|
||||
vwl=true;
|
||||
}
|
||||
int namlen=emu_random.Int(5, 10);
|
||||
for (int i=n;i<namlen;i++)
|
||||
{
|
||||
dlc=false;
|
||||
if (vwl) //last char was a vowel
|
||||
{ // so pick a cons or cons pair
|
||||
rndnum=emu_random.Int(0, 62);
|
||||
if (rndnum>46)
|
||||
{ // pick a cons pair
|
||||
if (i>namlen-3) // last 2 chars in name?
|
||||
{ // name can only end in cons pair "rk" "st" "sh" "th" "ph" "sk" "nd" or "ng"
|
||||
rndnum=emu_random.Int(0, 7)*2;
|
||||
}
|
||||
else
|
||||
{ // pick any from the set
|
||||
rndnum=(rndnum-47)*2;
|
||||
}
|
||||
rndname[i]=paircons[rndnum];
|
||||
rndname[i+1]=paircons[rndnum+1];
|
||||
dlc=true; // flag keeps second letter from being doubled below
|
||||
i+=1;
|
||||
}
|
||||
else
|
||||
{ // select a single cons
|
||||
rndname[i]=cons[rndnum];
|
||||
char newName[17] = {0};
|
||||
bool unique = false;
|
||||
|
||||
while (!unique) {
|
||||
std::string cons = "bcdfghjklmnpqrstvwxyz";
|
||||
std::string vows = "aeou";
|
||||
std::string allVows = "aeiou";
|
||||
std::vector<std::string> endPhon = {"a", "e", "i", "o", "u", "os", "as", "us", "is", "y", "an", "en", "in", "on", "un"};
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
|
||||
std::uniform_int_distribution<int> lenDist(5, 10);
|
||||
std::uniform_int_distribution<int> firstCharDist(0, 1);
|
||||
std::uniform_int_distribution<int> consDist(0, cons.size() - 1);
|
||||
std::uniform_int_distribution<int> vowDist(0, vows.size() - 1);
|
||||
std::uniform_int_distribution<int> allVowDist(0, allVows.size() - 1);
|
||||
std::uniform_int_distribution<int> endPhonDist(0, endPhon.size() - 1);
|
||||
|
||||
int len = 0;
|
||||
memset(newName, 0, sizeof(newName));
|
||||
|
||||
if (firstCharDist(gen) == 0) {
|
||||
newName[len++] = vows[vowDist(gen)];
|
||||
newName[len++] = cons[consDist(gen)];
|
||||
} else {
|
||||
newName[len++] = cons[consDist(gen)];
|
||||
newName[len++] = allVows[allVowDist(gen)];
|
||||
}
|
||||
|
||||
newName[0] = toupper(newName[0]);
|
||||
|
||||
while (len < lenDist(gen) - 1) {
|
||||
if (len % 2 == 0) {
|
||||
newName[len++] = cons[consDist(gen)];
|
||||
} else {
|
||||
newName[len++] = allVows[allVowDist(gen)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // select a vowel
|
||||
rndname[i]=vowels[emu_random.Int(0, 16)];
|
||||
|
||||
std::string end = endPhon[endPhonDist(gen)];
|
||||
for (char c : end) {
|
||||
if (len < 10) newName[len++] = c;
|
||||
}
|
||||
vwl=!vwl;
|
||||
if (!dbl && !dlc)
|
||||
{ // one chance at double letters in name
|
||||
if (!emu_random.Int(0, i+9)) // chances decrease towards end of name
|
||||
{
|
||||
rndname[i+1]=rndname[i];
|
||||
dbl=true;
|
||||
i+=1;
|
||||
|
||||
if (database.CheckNameFilter(newName)) {
|
||||
std::string query = StringFormat("SELECT `name` FROM `character_data` WHERE `name` = '%s'", newName);
|
||||
auto res = database.QueryDatabase(query);
|
||||
if (res.Success() && res.RowCount() == 0) {
|
||||
unique = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rndname[0]=toupper(rndname[0]);
|
||||
NameGeneration_Struct* ngs = (NameGeneration_Struct*)app->pBuffer;
|
||||
memset(ngs->name,0,64);
|
||||
strcpy(ngs->name,rndname);
|
||||
memset(ngs->name, 0, 64);
|
||||
strcpy(ngs->name, newName);
|
||||
|
||||
QueuePacket(app);
|
||||
return true;
|
||||
@@ -778,21 +774,50 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
auto ew = (EnterWorld_Struct *) app->pBuffer;
|
||||
strn0cpy(char_name, ew->name, sizeof(char_name));
|
||||
|
||||
uint32 temporary_account_id = 0;
|
||||
charid = database.GetCharacterInfo(char_name, &temporary_account_id, &zone_id, &instance_id);
|
||||
if (!charid) {
|
||||
const auto& l = CharacterDataRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"`name` = '{}' LIMIT 1",
|
||||
Strings::Escape(char_name)
|
||||
)
|
||||
);
|
||||
|
||||
if (l.empty()) {
|
||||
LogInfo("Could not get CharInfo for [{}]", char_name);
|
||||
eqs->Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
auto r = content_service.FindZone(zone_id, instance_id);
|
||||
if (r.zone_id && r.instance.id != instance_id) {
|
||||
LogInfo(
|
||||
"Zone [{}] has been remapped to instance_id [{}] from instance_id [{}] for client [{}]",
|
||||
r.zone.short_name,
|
||||
r.instance.id,
|
||||
instance_id,
|
||||
char_name
|
||||
);
|
||||
instance_id = r.instance.id;
|
||||
}
|
||||
|
||||
const auto& e = l.front();
|
||||
|
||||
// Make sure this account owns this character
|
||||
if (temporary_account_id != account_id) {
|
||||
LogInfo("Account [{}] does not own the character named [{}] from account [{}]", account_id, char_name, temporary_account_id);
|
||||
if (e.account_id != account_id) {
|
||||
LogInfo(
|
||||
"Account [{}] does not own the character named [{}] from account [{}]",
|
||||
account_id,
|
||||
char_name,
|
||||
e.account_id
|
||||
);
|
||||
eqs->Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
charid = e.id;
|
||||
zone_id = e.zone_id;
|
||||
instance_id = e.zone_instance;
|
||||
|
||||
// This can probably be moved outside and have another method return requested info (don't forget to remove the #include "../common/shareddb.h" above)
|
||||
// (This is a literal translation of the original process..I don't see why it can't be changed to a single-target query over account iteration)
|
||||
if (!is_player_zoning) {
|
||||
@@ -883,7 +908,14 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
if(!is_player_zoning) {
|
||||
database.SetGroupID(char_name, 0, charid);
|
||||
GroupIdRepository::DeleteWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"`character_id` = {} AND `name` = '{}'",
|
||||
charid,
|
||||
Strings::Escape(char_name)
|
||||
)
|
||||
);
|
||||
database.SetLoginFlags(charid, false, false, 1);
|
||||
} else {
|
||||
auto group_id = database.GetGroupID(char_name);
|
||||
@@ -902,14 +934,19 @@ bool Client::HandleEnterWorldPacket(const EQApplicationPacket *app) {
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_MOTD);
|
||||
std::string motd_message;
|
||||
if (database.GetVariable("MOTD", motd_message)) {
|
||||
outapp->size = motd_message.length() + 1;
|
||||
std::string motd = RuleS(World, MOTD);
|
||||
if (!motd.empty()) {
|
||||
outapp->size = motd.length() + 1;
|
||||
outapp->pBuffer = new uchar[outapp->size];
|
||||
memset(outapp->pBuffer, 0, outapp->size);
|
||||
strcpy((char*)outapp->pBuffer, motd_message.c_str());
|
||||
strcpy((char*) outapp->pBuffer, motd.c_str());
|
||||
} else if (database.GetVariable("MOTD", motd)) {
|
||||
outapp->size = motd.length() + 1;
|
||||
outapp->pBuffer = new uchar[outapp->size];
|
||||
memset(outapp->pBuffer, 0, outapp->size);
|
||||
strcpy((char*) outapp->pBuffer, motd.c_str());
|
||||
} else { // Null Message of the Day. :)
|
||||
outapp->size = 1;
|
||||
outapp->size = 1;
|
||||
outapp->pBuffer = new uchar[outapp->size];
|
||||
outapp->pBuffer[0] = 0;
|
||||
}
|
||||
@@ -1613,10 +1650,18 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
inv.SetInventoryVersion(EQ::versions::ConvertClientVersionBitToClientVersion(m_ClientVersionBit));
|
||||
inv.SetGMInventory(false); // character cannot have gm flag at this point
|
||||
|
||||
time_t bday = time(nullptr);
|
||||
time_t bday = time(nullptr);
|
||||
in_addr in;
|
||||
|
||||
int stats_sum = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA;
|
||||
const uint32 stats_sum = (
|
||||
cc->AGI +
|
||||
cc->CHA +
|
||||
cc->DEX +
|
||||
cc->INT +
|
||||
cc->STA +
|
||||
cc->STR +
|
||||
cc->WIS
|
||||
);
|
||||
|
||||
in.s_addr = GetIP();
|
||||
|
||||
@@ -1629,7 +1674,7 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
);
|
||||
LogInfo("Name [{}]", name);
|
||||
LogInfo(
|
||||
"Race [{}] Class [{}] Gender [{}] Deity [{}] Start zone [{}] Tutorial [{}]",
|
||||
"race [{}] class [{}] gender [{}] deity [{}] start_zone [{}] tutorial [{}]",
|
||||
cc->race,
|
||||
cc->class_,
|
||||
cc->gender,
|
||||
@@ -1637,21 +1682,20 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
cc->start_zone,
|
||||
cc->tutorial ? "true" : "false"
|
||||
);
|
||||
LogInfo("STR STA AGI DEX WIS INT CHA Total");
|
||||
LogInfo(
|
||||
" [{}] [{}] [{}] [{}] [{}] [{}] [{}] [{}]",
|
||||
cc->STR,
|
||||
cc->STA,
|
||||
"AGI [{}] CHA [{}] DEX [{}] INT [{}] STA [{}] STR [{}] WIS [{}] Total [{}]",
|
||||
cc->AGI,
|
||||
cc->DEX,
|
||||
cc->WIS,
|
||||
cc->INT,
|
||||
cc->CHA,
|
||||
cc->DEX,
|
||||
cc->INT,
|
||||
cc->STA,
|
||||
cc->STR,
|
||||
cc->WIS,
|
||||
stats_sum
|
||||
);
|
||||
LogInfo("Face [{}] Eye colors [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
|
||||
LogInfo("Hairstyle [{}] Haircolor [{}]", cc->hairstyle, cc->haircolor);
|
||||
LogInfo("Beard [{}] Beardcolor [{}]", cc->beard, cc->beardcolor);
|
||||
LogInfo("Face [{}] Eye Colors [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
|
||||
LogInfo("Hair [{}] Hair Color [{}]", cc->hairstyle, cc->haircolor);
|
||||
LogInfo("Beard [{}] Beard Color [{}]", cc->beard, cc->beardcolor);
|
||||
|
||||
/* Validate the char creation struct */
|
||||
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
|
||||
@@ -1669,39 +1713,39 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
/* Convert incoming cc_s to the new PlayerProfile_Struct */
|
||||
memset(&pp, 0, sizeof(PlayerProfile_Struct)); // start building the profile
|
||||
|
||||
strn0cpy(pp.name, name, 63);
|
||||
strn0cpy(pp.name, name, sizeof(pp.name));
|
||||
|
||||
pp.race = cc->race;
|
||||
pp.class_ = cc->class_;
|
||||
pp.gender = cc->gender;
|
||||
pp.deity = cc->deity;
|
||||
pp.STR = cc->STR;
|
||||
pp.STA = cc->STA;
|
||||
pp.AGI = cc->AGI;
|
||||
pp.DEX = cc->DEX;
|
||||
pp.WIS = cc->WIS;
|
||||
pp.INT = cc->INT;
|
||||
pp.CHA = cc->CHA;
|
||||
pp.face = cc->face;
|
||||
pp.eyecolor1 = cc->eyecolor1;
|
||||
pp.eyecolor2 = cc->eyecolor2;
|
||||
pp.hairstyle = cc->hairstyle;
|
||||
pp.haircolor = cc->haircolor;
|
||||
pp.beard = cc->beard;
|
||||
pp.beardcolor = cc->beardcolor;
|
||||
pp.drakkin_heritage = cc->drakkin_heritage;
|
||||
pp.drakkin_tattoo = cc->drakkin_tattoo;
|
||||
pp.drakkin_details = cc->drakkin_details;
|
||||
pp.birthday = bday;
|
||||
pp.lastlogin = bday;
|
||||
pp.level = 1;
|
||||
pp.points = 5;
|
||||
pp.cur_hp = 1000; // 1k hp during dev only
|
||||
pp.hunger_level = 6000;
|
||||
pp.thirst_level = 6000;
|
||||
pp.race = cc->race;
|
||||
pp.class_ = cc->class_;
|
||||
pp.gender = cc->gender;
|
||||
pp.deity = cc->deity;
|
||||
pp.STR = cc->STR;
|
||||
pp.STA = cc->STA;
|
||||
pp.AGI = cc->AGI;
|
||||
pp.DEX = cc->DEX;
|
||||
pp.WIS = cc->WIS;
|
||||
pp.INT = cc->INT;
|
||||
pp.CHA = cc->CHA;
|
||||
pp.face = cc->face;
|
||||
pp.eyecolor1 = cc->eyecolor1;
|
||||
pp.eyecolor2 = cc->eyecolor2;
|
||||
pp.hairstyle = cc->hairstyle;
|
||||
pp.haircolor = cc->haircolor;
|
||||
pp.beard = cc->beard;
|
||||
pp.beardcolor = cc->beardcolor;
|
||||
pp.drakkin_heritage = cc->drakkin_heritage;
|
||||
pp.drakkin_tattoo = cc->drakkin_tattoo;
|
||||
pp.drakkin_details = cc->drakkin_details;
|
||||
pp.birthday = bday;
|
||||
pp.lastlogin = bday;
|
||||
pp.level = 1;
|
||||
pp.points = 5;
|
||||
pp.cur_hp = 1000;
|
||||
pp.hunger_level = 6000;
|
||||
pp.thirst_level = 6000;
|
||||
|
||||
/* Set default skills for everybody */
|
||||
pp.skills[EQ::skills::SkillSwimming] = RuleI(Skills, SwimmingStartValue);
|
||||
pp.skills[EQ::skills::SkillSwimming] = RuleI(Skills, SwimmingStartValue);
|
||||
pp.skills[EQ::skills::SkillSenseHeading] = RuleI(Skills, SenseHeadingStartValue);
|
||||
|
||||
/* Set Racial and Class specific language and skills */
|
||||
@@ -1710,13 +1754,12 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
SetClassStartingSkills(&pp);
|
||||
SetClassLanguages(&pp);
|
||||
|
||||
// strcpy(pp.servername, WorldConfig::get()->ShortName.c_str());
|
||||
memset(pp.spell_book, std::numeric_limits<uint8>::max(), (sizeof(uint32) * EQ::spells::SPELLBOOK_SIZE));
|
||||
memset(pp.mem_spells, std::numeric_limits<uint8>::max(), (sizeof(uint32) * EQ::spells::SPELL_GEM_COUNT));
|
||||
|
||||
memset(pp.spell_book, 0xFF, (sizeof(uint32) * EQ::spells::SPELLBOOK_SIZE));
|
||||
memset(pp.mem_spells, 0xFF, (sizeof(uint32) * EQ::spells::SPELL_GEM_COUNT));
|
||||
|
||||
for (auto& buff : pp.buffs)
|
||||
buff.spellid = 0xFFFF;
|
||||
for (auto& b : pp.buffs) {
|
||||
b.spellid = std::numeric_limits<uint16>::max();
|
||||
}
|
||||
|
||||
/* If server is PVP by default, make all character set to it. */
|
||||
pp.pvp = database.GetServerType() == 1 ? 1 : 0;
|
||||
@@ -1728,56 +1771,38 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
pp.zone_id = RuleI(World, SoFStartZoneID);
|
||||
cc->start_zone = pp.zone_id;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
LogInfo("Found [TitaniumStartZoneID] rule setting [{}]", RuleI(World, TitaniumStartZoneID));
|
||||
if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */
|
||||
|
||||
pp.zone_id = RuleI(World, TitaniumStartZoneID);
|
||||
pp.zone_id = RuleI(World, TitaniumStartZoneID);
|
||||
cc->start_zone = pp.zone_id;
|
||||
}
|
||||
}
|
||||
/* use normal starting zone logic to either get defaults, or if startzone was set, load that from the db table.*/
|
||||
bool ValidStartZone = content_db.GetStartZone(&pp, cc, m_ClientVersionBit & EQ::versions::maskTitaniumAndEarlier);
|
||||
|
||||
if (!ValidStartZone){
|
||||
/* use normal starting zone logic to either get defaults, or if startzone was set, load that from the db table.*/
|
||||
const bool is_valid_start_zone = content_db.GetStartZone(&pp, cc, m_ClientVersionBit & EQ::versions::maskTitaniumAndEarlier);
|
||||
if (!is_valid_start_zone){
|
||||
return false;
|
||||
}
|
||||
|
||||
/* just in case */
|
||||
if (!pp.zone_id) {
|
||||
pp.zone_id = 1; // qeynos
|
||||
pp.zone_id = Zones::QEYNOS;
|
||||
|
||||
pp.x = pp.y = pp.z = -1;
|
||||
}
|
||||
|
||||
/* Set Home Binds -- yep, all of them */
|
||||
pp.binds[1].zone_id = pp.zone_id;
|
||||
pp.binds[1].x = pp.x;
|
||||
pp.binds[1].y = pp.y;
|
||||
pp.binds[1].z = pp.z;
|
||||
pp.binds[1].heading = pp.heading;
|
||||
|
||||
pp.binds[2].zone_id = pp.zone_id;
|
||||
pp.binds[2].x = pp.x;
|
||||
pp.binds[2].y = pp.y;
|
||||
pp.binds[2].z = pp.z;
|
||||
pp.binds[2].heading = pp.heading;
|
||||
|
||||
pp.binds[3].zone_id = pp.zone_id;
|
||||
pp.binds[3].x = pp.x;
|
||||
pp.binds[3].y = pp.y;
|
||||
pp.binds[3].z = pp.z;
|
||||
pp.binds[3].heading = pp.heading;
|
||||
|
||||
pp.binds[4].zone_id = pp.zone_id;
|
||||
pp.binds[4].x = pp.x;
|
||||
pp.binds[4].y = pp.y;
|
||||
pp.binds[4].z = pp.z;
|
||||
pp.binds[4].heading = pp.heading;
|
||||
for (uint8 slot_id = 1; slot_id < 5; slot_id++) {
|
||||
pp.binds[slot_id].zone_id = pp.zone_id;
|
||||
pp.binds[slot_id].x = pp.x;
|
||||
pp.binds[slot_id].y = pp.y;
|
||||
pp.binds[slot_id].z = pp.z;
|
||||
pp.binds[slot_id].heading = pp.heading;
|
||||
}
|
||||
|
||||
/* Overrides if we have the tutorial flag set! */
|
||||
if (cc->tutorial && RuleB(World, EnableTutorialButton)) {
|
||||
pp.zone_id = RuleI(World, TutorialZoneID);
|
||||
|
||||
auto z = GetZone(pp.zone_id);
|
||||
if (z) {
|
||||
pp.x = z->safe_x;
|
||||
@@ -1787,17 +1812,17 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
}
|
||||
|
||||
/* Will either be the same as home or tutorial if enabled. */
|
||||
if(RuleB(World, StartZoneSameAsBindOnCreation)) {
|
||||
if (RuleB(World, StartZoneSameAsBindOnCreation)) {
|
||||
pp.binds[0].zone_id = pp.zone_id;
|
||||
pp.binds[0].x = pp.x;
|
||||
pp.binds[0].y = pp.y;
|
||||
pp.binds[0].z = pp.z;
|
||||
pp.binds[0].x = pp.x;
|
||||
pp.binds[0].y = pp.y;
|
||||
pp.binds[0].z = pp.z;
|
||||
pp.binds[0].heading = pp.heading;
|
||||
}
|
||||
|
||||
if (GetZone(pp.zone_id)) {
|
||||
LogInfo(
|
||||
"Current location [{}] [{}] [{:.2f}] [{:.2f}] [{:.2f}] [{:.2f}]",
|
||||
"Current location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
||||
ZoneName(pp.zone_id),
|
||||
pp.zone_id,
|
||||
pp.x,
|
||||
@@ -1809,37 +1834,34 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
|
||||
if (GetZone(pp.binds[0].zone_id)) {
|
||||
LogInfo(
|
||||
"Bind location [{}] [{}] [{:.2f}] [{:.2f}] [{:.2f}]",
|
||||
"Bind location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
||||
ZoneName(pp.binds[0].zone_id),
|
||||
pp.binds[0].zone_id,
|
||||
pp.binds[0].x,
|
||||
pp.binds[0].y,
|
||||
pp.binds[0].z
|
||||
pp.binds[0].z,
|
||||
pp.binds[4].heading
|
||||
);
|
||||
}
|
||||
|
||||
if (GetZone(pp.binds[4].zone_id)) {
|
||||
LogInfo(
|
||||
"Home location [{}] [{}] [{:.2f}] [{:.2f}] [{:.2f}]",
|
||||
"Home location zone_short_name [{}] zone_id [{}] x [{:.2f}] y [{:.2f}] z [{:.2f}] heading [{:.2f}]",
|
||||
ZoneName(pp.binds[4].zone_id),
|
||||
pp.binds[4].zone_id,
|
||||
pp.binds[4].x,
|
||||
pp.binds[4].y,
|
||||
pp.binds[4].z
|
||||
pp.binds[4].z,
|
||||
pp.binds[4].heading
|
||||
);
|
||||
}
|
||||
|
||||
/* Starting Items inventory */
|
||||
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
|
||||
|
||||
// now we give the pp and the inv we made to StoreCharacter
|
||||
// to see if we can store it
|
||||
if (!StoreCharacter(GetAccountID(), &pp, &inv)) {
|
||||
LogInfo("Character creation failed: [{}]", pp.name);
|
||||
return false;
|
||||
}
|
||||
LogInfo("Character creation successful: [{}]", pp.name);
|
||||
return true;
|
||||
const bool success = StoreCharacter(GetAccountID(), &pp, &inv);
|
||||
|
||||
LogInfo("Character creation {} for [{}]", success ? "succeeded" : "failed", pp.name);
|
||||
return success;
|
||||
}
|
||||
|
||||
// returns true if the request is ok, false if there's an error
|
||||
@@ -2119,7 +2141,7 @@ void Client::SetClassStartingSkills(PlayerProfile_Struct *pp)
|
||||
i == EQ::skills::SkillAlcoholTolerance || i == EQ::skills::SkillBindWound)
|
||||
continue;
|
||||
|
||||
pp->skills[i] = content_db.GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1);
|
||||
pp->skills[i] = skill_caps.GetSkillCap(pp->class_, (EQ::skills::SkillType)i, 1).cap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2312,56 +2334,57 @@ bool Client::StoreCharacter(
|
||||
EQ::InventoryProfile *p_inventory_profile
|
||||
)
|
||||
{
|
||||
uint32 character_id = 0;
|
||||
char zone[50];
|
||||
character_id = database.GetCharacterID(p_player_profile_struct->name);
|
||||
|
||||
const uint32 character_id = database.GetCharacterID(p_player_profile_struct->name);
|
||||
if (!character_id) {
|
||||
LogError("StoreCharacter: no character id");
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *zone_name = ZoneName(p_player_profile_struct->zone_id);
|
||||
if (zone_name == nullptr) {
|
||||
/* Zone not in the DB, something to prevent crash... */
|
||||
strn0cpy(zone, "qeynos", 49);
|
||||
p_player_profile_struct->zone_id = 1;
|
||||
}
|
||||
else {
|
||||
strn0cpy(zone, zone_name, 49);
|
||||
const std::string& zone_name = zone_store.GetZoneName(p_player_profile_struct->zone_id, true);
|
||||
if (Strings::EqualFold(zone_name, "UNKNOWN")) {
|
||||
p_player_profile_struct->zone_id = Zones::QEYNOS;
|
||||
}
|
||||
|
||||
database.SaveCharacterCreate(character_id, account_id, p_player_profile_struct);
|
||||
|
||||
std::string invquery;
|
||||
for (int16 i = EQ::invslot::EQUIPMENT_BEGIN; i <= EQ::invbag::BANK_BAGS_END;) {
|
||||
const EQ::ItemInstance *new_inventory_item = p_inventory_profile->GetItem(i);
|
||||
if (new_inventory_item) {
|
||||
invquery = StringFormat(
|
||||
"INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
|
||||
character_id,
|
||||
i,
|
||||
new_inventory_item->GetItem()->ID,
|
||||
new_inventory_item->GetCharges(),
|
||||
new_inventory_item->GetColor()
|
||||
);
|
||||
std::vector<InventoryRepository::Inventory> v;
|
||||
|
||||
auto results = database.QueryDatabase(invquery);
|
||||
auto e = InventoryRepository::NewEntity();
|
||||
|
||||
e.charid = character_id;
|
||||
|
||||
for (int16 slot_id = EQ::invslot::EQUIPMENT_BEGIN; slot_id <= EQ::invbag::BANK_BAGS_END;) {
|
||||
const auto inst = p_inventory_profile->GetItem(slot_id);
|
||||
if (inst) {
|
||||
e.slotid = slot_id;
|
||||
e.itemid = inst->GetItem()->ID;
|
||||
e.charges = inst->GetCharges();
|
||||
e.color = inst->GetColor();
|
||||
e.augslot1 = inst->GetAugmentItemID(EQ::invaug::SOCKET_BEGIN);
|
||||
e.augslot2 = inst->GetAugmentItemID(EQ::invaug::SOCKET_BEGIN + 1);
|
||||
e.augslot3 = inst->GetAugmentItemID(EQ::invaug::SOCKET_BEGIN + 2);
|
||||
e.augslot4 = inst->GetAugmentItemID(EQ::invaug::SOCKET_BEGIN + 3);
|
||||
e.augslot5 = inst->GetAugmentItemID(EQ::invaug::SOCKET_BEGIN + 4);
|
||||
e.augslot6 = inst->GetAugmentItemID(EQ::invaug::SOCKET_END);
|
||||
|
||||
v.emplace_back(e);
|
||||
}
|
||||
|
||||
if (i == EQ::invslot::slotCursor) {
|
||||
i = EQ::invbag::GENERAL_BAGS_BEGIN;
|
||||
if (slot_id == EQ::invslot::slotCursor) {
|
||||
slot_id = EQ::invbag::GENERAL_BAGS_BEGIN;
|
||||
continue;
|
||||
} else if (slot_id == EQ::invbag::CURSOR_BAG_END) {
|
||||
slot_id = EQ::invslot::BANK_BEGIN;
|
||||
continue;
|
||||
} else if (slot_id == EQ::invslot::BANK_END) {
|
||||
slot_id = EQ::invbag::BANK_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EQ::invbag::CURSOR_BAG_END) {
|
||||
i = EQ::invslot::BANK_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EQ::invslot::BANK_END) {
|
||||
i = EQ::invbag::BANK_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
|
||||
slot_id++;
|
||||
}
|
||||
|
||||
if (!v.empty()) {
|
||||
InventoryRepository::InsertMany(database, v);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2388,7 +2411,7 @@ void Client::RecordPossibleHack(const std::string& message)
|
||||
}
|
||||
}
|
||||
|
||||
void Client::SendGuildTributeFavorAndTimer(uint32 favor, uint32 time_remaining)
|
||||
void Client::SendGuildTributeFavorAndTimer(uint32 favor, uint32 time_remaining)
|
||||
{
|
||||
auto cle = GetCLE();
|
||||
if (!cle) {
|
||||
|
||||
@@ -139,7 +139,7 @@ void ClientListEntry::SetOnline(CLE_Status iOnline)
|
||||
AccountName(),
|
||||
AccountID(),
|
||||
CLEStatusString[CLE_Status::Online],
|
||||
iOnline
|
||||
static_cast<int>(iOnline)
|
||||
);
|
||||
|
||||
if (iOnline >= CLE_Status::Online && pOnline < CLE_Status::Online) {
|
||||
@@ -344,7 +344,7 @@ bool ClientListEntry::CheckAuth(uint32 loginserver_account_id, const char *key_p
|
||||
|
||||
paccountid = database.CreateAccount(
|
||||
loginserver_account_name,
|
||||
0,
|
||||
std::string(),
|
||||
default_account_status,
|
||||
source_loginserver,
|
||||
LSID()
|
||||
|
||||
+18
-1
@@ -94,8 +94,25 @@ void ClientList::GetCLEIP(uint32 in_ip) {
|
||||
int count = 0;
|
||||
iterator.Reset();
|
||||
|
||||
const auto& zones = Strings::Split(RuleS(World, IPExemptionZones), ",");
|
||||
|
||||
while (iterator.MoreElements()) {
|
||||
cle = iterator.GetData();
|
||||
|
||||
if (!zones.empty() && cle->zone()) {
|
||||
auto it = std::ranges::find_if(
|
||||
zones,
|
||||
[cle](const auto& z) {
|
||||
return Strings::ToUnsignedInt(z) == cle->zone();
|
||||
}
|
||||
);
|
||||
|
||||
if (it != zones.end()) {
|
||||
iterator.Advance();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
cle->GetIP() == in_ip &&
|
||||
(
|
||||
@@ -280,7 +297,7 @@ void ClientList::SendCLEList(const int16& admin, const char* to, WorldTCPConnect
|
||||
fmt::format_to(std::back_inserter(out), fmt::runtime(newline));
|
||||
}
|
||||
fmt::format_to(std::back_inserter(out), "ID: {} Acc# {} AccName: {} IP: {}", cle->GetID(), cle->AccountID(), cle->AccountName(), inet_ntoa(in));
|
||||
fmt::format_to(std::back_inserter(out), "{} Stale: {} Online: {} Admin: {}", newline, cle->GetStaleCounter(), cle->Online(), cle->Admin());
|
||||
fmt::format_to(std::back_inserter(out), "{} Stale: {} Online: {} Admin: {}", newline, cle->GetStaleCounter(), static_cast<int>(cle->Online()), cle->Admin());
|
||||
if (cle->LSID())
|
||||
fmt::format_to(std::back_inserter(out), "{} LSID: {} LSName: {} WorldAdmin: {}", newline, cle->LSID(), cle->LSName(), cle->WorldAdmin());
|
||||
if (cle->CharID())
|
||||
|
||||
+1
-2
@@ -57,8 +57,7 @@ struct EQ::Net::ConsoleLoginStatus CheckLogin(const std::string &username, const
|
||||
return ret;
|
||||
}
|
||||
|
||||
char account_name[64];
|
||||
database.GetAccountName(ret.account_id, account_name);
|
||||
const std::string& account_name = database.GetAccountName(ret.account_id);
|
||||
|
||||
ret.account_name = account_name;
|
||||
ret.status = database.CheckStatus(ret.account_id);
|
||||
|
||||
@@ -142,6 +142,7 @@ std::vector<Reload> reload_types = {
|
||||
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"},
|
||||
@@ -155,6 +156,7 @@ std::vector<Reload> reload_types = {
|
||||
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"},
|
||||
|
||||
+9
-1
@@ -86,8 +86,9 @@
|
||||
#include "world_boot.h"
|
||||
#include "../common/path_manager.h"
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/skill_caps.h"
|
||||
|
||||
|
||||
SkillCaps skill_caps;
|
||||
ZoneStore zone_store;
|
||||
ClientList client_list;
|
||||
GroupLFPList LFPGroupList;
|
||||
@@ -188,6 +189,13 @@ int main(int argc, char **argv)
|
||||
RegisterConsoleFunctions(console);
|
||||
}
|
||||
|
||||
content_service.SetDatabase(&database)
|
||||
->SetContentDatabase(&content_db)
|
||||
->SetExpansionContext()
|
||||
->ReloadContentFlags();
|
||||
|
||||
skill_caps.SetContentDatabase(&content_db)->LoadSkillCaps();
|
||||
|
||||
std::unique_ptr<EQ::Net::ServertalkServer> server_connection;
|
||||
server_connection = std::make_unique<EQ::Net::ServertalkServer>();
|
||||
|
||||
|
||||
+22
-3
@@ -230,13 +230,23 @@ void WorldGuildManager::ProcessZonePacket(ServerPacket *pack) {
|
||||
case ServerOP_GuildChannel:
|
||||
case ServerOP_GuildURL:
|
||||
case ServerOP_GuildMemberRemove:
|
||||
case ServerOP_GuildMemberAdd:
|
||||
case ServerOP_GuildSendGuildList:
|
||||
case ServerOP_GuildMembersList:
|
||||
{
|
||||
zoneserver_list.SendPacketToBootedZones(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_GuildMemberAdd:
|
||||
{
|
||||
auto in = (ServerOP_GuildMessage_Struct *)pack->pBuffer;
|
||||
auto guild = GetGuildByGuildID(in->guild_id);
|
||||
if (!guild) {
|
||||
BaseGuildManager::RefreshGuild(in->guild_id);
|
||||
}
|
||||
|
||||
zoneserver_list.SendPacketToBootedZones(pack);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LogGuilds("Unknown packet {:#04x} received from zone??", pack->opcode);
|
||||
break;
|
||||
@@ -325,7 +335,7 @@ bool WorldGuildManager::LoadTributes()
|
||||
|
||||
tribute_list.clear();
|
||||
|
||||
auto tributes = TributesRepository::All(*m_db);
|
||||
auto tributes = TributesRepository::All(*m_content_db);
|
||||
for (auto const& t : tributes) {
|
||||
td.name = t.name;
|
||||
td.description = t.descr;
|
||||
@@ -336,7 +346,7 @@ bool WorldGuildManager::LoadTributes()
|
||||
|
||||
LogInfo("Loaded [{}] tributes", Strings::Commify(tributes.size()));
|
||||
|
||||
auto tribute_levels = TributeLevelsRepository::GetWhere(*m_db, "TRUE ORDER BY tribute_id, level");
|
||||
auto tribute_levels = TributeLevelsRepository::GetWhere(*m_content_db, "TRUE ORDER BY tribute_id, level");
|
||||
|
||||
for (auto const& t : tribute_levels) {
|
||||
uint32 id = t.tribute_id;
|
||||
@@ -369,6 +379,10 @@ bool WorldGuildManager::LoadTributes()
|
||||
bool WorldGuildManager::RefreshGuild(uint32 guild_id)
|
||||
{
|
||||
auto temp_guild = GetGuildByGuildID(guild_id);
|
||||
if (!temp_guild) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BaseGuildManager::GuildInfo temp_guild_detail;
|
||||
|
||||
if (temp_guild) {
|
||||
@@ -389,6 +403,11 @@ bool WorldGuildManager::RefreshGuild(uint32 guild_id)
|
||||
LogGuilds("Found guild id [{}]. Loading details.....", db_guild.id);
|
||||
_CreateGuild(db_guild.id, db_guild.name, db_guild.leader, db_guild.minstatus, db_guild.motd, db_guild.motd_setter, db_guild.channel, db_guild.url, db_guild.favor);
|
||||
auto guild = GetGuildByGuildID(guild_id);
|
||||
if (!guild) {
|
||||
LogError("Error refreshing guild id {}", guild_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto where_filter = fmt::format("guild_id = '{}'", guild_id);
|
||||
auto guild_ranks = GuildRanksRepository::GetWhere(*m_db, where_filter);
|
||||
for (auto const& r : guild_ranks) {
|
||||
|
||||
@@ -264,7 +264,7 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
guild_mgr.SetDatabase(&database);
|
||||
guild_mgr.SetDatabase(&database)->SetContentDatabase(&content_db);
|
||||
|
||||
LogInfo("Purging expired data buckets");
|
||||
database.PurgeAllDeletedDataBuckets();
|
||||
@@ -292,10 +292,6 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
LogError("Error: Could not load item data. But ignoring");
|
||||
}
|
||||
|
||||
if (!content_db.LoadSkillCaps(std::string(hotfix_name))) {
|
||||
LogError("Error: Could not load skill cap data. But ignoring");
|
||||
}
|
||||
|
||||
guild_mgr.LoadGuilds();
|
||||
guild_mgr.LoadTributes();
|
||||
|
||||
@@ -381,6 +377,7 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
|
||||
LogInfo("Initializing [WorldContentService]");
|
||||
content_service.SetDatabase(&database)
|
||||
->SetContentDatabase(&content_db)
|
||||
->SetExpansionContext()
|
||||
->ReloadContentFlags();
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/patches/patches.h"
|
||||
#include "../zone/data_bucket.h"
|
||||
#include "../common/repositories/guild_tributes_repository.h"
|
||||
#include "../common/skill_caps.h"
|
||||
|
||||
extern ClientList client_list;
|
||||
extern GroupLFPList LFPGroupList;
|
||||
@@ -1100,7 +1101,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
|
||||
auto smotd = (ServerMotd_Struct*) pack->pBuffer;
|
||||
database.SetVariable("MOTD", smotd->motd);
|
||||
RuleManager::Instance()->SetRule("MOTD", smotd->motd, &database, true, true);
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
@@ -1367,6 +1368,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
}
|
||||
case ServerOP_ReloadOpcodes: {
|
||||
ReloadAllPatches();
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_CZDialogueWindow:
|
||||
@@ -1435,6 +1437,11 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadSkillCaps: {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
skill_caps.ReloadSkillCaps();
|
||||
break;
|
||||
}
|
||||
case ServerOP_ReloadRules: {
|
||||
zoneserver_list.SendPacket(pack);
|
||||
RuleManager::Instance()->LoadRules(&database, "default", true);
|
||||
@@ -1495,11 +1502,6 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
LogInfo("Error: Could not load item data. But ignoring");
|
||||
}
|
||||
|
||||
LogInfo("Loading skill caps");
|
||||
if (!content_db.LoadSkillCaps(hotfix_name)) {
|
||||
LogInfo("Error: Could not load skill cap data. But ignoring");
|
||||
}
|
||||
|
||||
zoneserver_list.SendPacket(pack);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ SET(zone_sources
|
||||
loot.cpp
|
||||
lua_bot.cpp
|
||||
lua_bit.cpp
|
||||
lua_buff.cpp
|
||||
lua_corpse.cpp
|
||||
lua_client.cpp
|
||||
lua_door.cpp
|
||||
@@ -105,6 +106,7 @@ SET(zone_sources
|
||||
pathfinder_null.cpp
|
||||
pathing.cpp
|
||||
perl_bot.cpp
|
||||
perl_buff.cpp
|
||||
perl_client.cpp
|
||||
perl_doors.cpp
|
||||
perl_entity.cpp
|
||||
@@ -207,6 +209,7 @@ SET(zone_headers
|
||||
horse.h
|
||||
lua_bot.h
|
||||
lua_bit.h
|
||||
lua_buff.h
|
||||
lua_client.h
|
||||
lua_corpse.h
|
||||
lua_door.h
|
||||
|
||||
+32
-22
@@ -221,7 +221,7 @@ void NPC::DescribeAggro(Client *to_who, Mob *mob, bool verbose) {
|
||||
if (RuleB(Aggro, UseLevelAggro)) {
|
||||
if (
|
||||
GetLevel() < RuleI(Aggro, MinAggroLevel) &&
|
||||
mob->GetLevelCon(GetLevel()) == CON_GRAY &&
|
||||
mob->GetLevelCon(GetLevel()) == ConsiderColor::Gray &&
|
||||
GetBodyType() != BT_Undead &&
|
||||
!AlwaysAggro()
|
||||
) {
|
||||
@@ -237,7 +237,7 @@ void NPC::DescribeAggro(Client *to_who, Mob *mob, bool verbose) {
|
||||
} else {
|
||||
if (
|
||||
GetINT() > RuleI(Aggro, IntAggroThreshold) &&
|
||||
mob->GetLevelCon(GetLevel()) == CON_GRAY &&
|
||||
mob->GetLevelCon(GetLevel()) == ConsiderColor::Gray &&
|
||||
!AlwaysAggro()
|
||||
) {
|
||||
to_who->Message(
|
||||
@@ -343,7 +343,7 @@ void NPC::DescribeAggro(Client *to_who, Mob *mob, bool verbose) {
|
||||
"{} does not have low enough faction, their Faction Level is {} ({}).",
|
||||
to_who->GetTargetDescription(mob),
|
||||
FactionValueToString(faction_value),
|
||||
faction_value
|
||||
static_cast<int>(faction_value)
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
@@ -502,7 +502,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
mob->IsClient() &&
|
||||
mob->CastToClient()->IsSitting()
|
||||
) ||
|
||||
mob->GetLevelCon(GetLevel()) != CON_GRAY
|
||||
mob->GetLevelCon(GetLevel()) != ConsiderColor::Gray
|
||||
) &&
|
||||
(
|
||||
faction_value == FACTION_SCOWLS ||
|
||||
@@ -531,7 +531,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
mob->IsClient() &&
|
||||
mob->CastToClient()->IsSitting()
|
||||
) ||
|
||||
mob->GetLevelCon(GetLevel()) != CON_GRAY
|
||||
mob->GetLevelCon(GetLevel()) != ConsiderColor::Gray
|
||||
) &&
|
||||
(
|
||||
faction_value == FACTION_SCOWLS ||
|
||||
@@ -556,7 +556,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
LogAggro("Is In zone?:[{}]\n", mob->InZone());
|
||||
LogAggro("Dist^2: [{}]\n", distance_squared);
|
||||
LogAggro("Range^2: [{}]\n", aggro_range_squared);
|
||||
LogAggro("Faction: [{}]\n", faction_value);
|
||||
LogAggro("Faction: [{}]\n", static_cast<int>(faction_value));
|
||||
LogAggro("AlwaysAggroFlag: [{}]\n", AlwaysAggro());
|
||||
LogAggro("Int: [{}]\n", GetINT());
|
||||
LogAggro("Con: [{}]\n", GetLevelCon(mob->GetLevel()));
|
||||
@@ -586,7 +586,7 @@ int EntityList::GetHatedCount(Mob *attacker, Mob *exclude, bool inc_gray_con)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!inc_gray_con && attacker->GetLevelCon(mob->GetLevel()) == CON_GRAY) {
|
||||
if (!inc_gray_con && attacker->GetLevelCon(mob->GetLevel()) == ConsiderColor::Gray) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -621,28 +621,38 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
|
||||
// NPC *npc1, *npc2;
|
||||
int reverse;
|
||||
|
||||
if(!zone->CanDoCombat())
|
||||
return false;
|
||||
|
||||
// some special cases
|
||||
if(!target)
|
||||
return false;
|
||||
|
||||
if(this == target) // you can attack yourself
|
||||
return true;
|
||||
|
||||
if(target->GetSpecialAbility(NO_HARM_FROM_CLIENT)){
|
||||
if (!zone->CanDoCombat()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->GetSpecialAbility(IMMUNE_DAMAGE_CLIENT) && IsClient())
|
||||
// some special cases
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->GetSpecialAbility(IMMUNE_DAMAGE_NPC) && IsNPC())
|
||||
return false;
|
||||
if (this == target) { // you can attack yourself
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target->IsHorse())
|
||||
if (target->GetSpecialAbility(NO_HARM_FROM_CLIENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsBot() && target->GetSpecialAbility(IMMUNE_DAMAGE_BOT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsClient() && target->GetSpecialAbility(IMMUNE_DAMAGE_CLIENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsNPC() && target->GetSpecialAbility(IMMUNE_DAMAGE_NPC)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->IsHorse()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// can't damage own pet (applies to everthing)
|
||||
Mob *target_owner = target->GetOwner();
|
||||
|
||||
@@ -57,9 +57,7 @@ EQ::Net::WebsocketLoginStatus CheckLogin(
|
||||
return ret;
|
||||
}
|
||||
|
||||
char account_name[64];
|
||||
database.GetAccountName(static_cast<uint32>(ret.account_id), account_name);
|
||||
ret.account_name = account_name;
|
||||
ret.account_name = database.GetAccountName(static_cast<uint32>(ret.account_id));
|
||||
ret.logged_in = true;
|
||||
ret.status = database.CheckStatus(ret.account_id);
|
||||
return ret;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user